feathers-mongoose-casl
Version 2.1.2
Version 2.1.2
  • feathers-mongoose-casl
  • Docs
    • Migrating
    • START A NEW PROJECT
      • Generate a new project.
      • install feathers-mongoose-casl
      • feathers-logger
      • Update config
      • Add mongoose
      • Email service
      • App hooks
      • Import required services
      • Verify user and filter user fields
      • Swagger, Logger, BodyParser
      • Email templates
      • public HTML
      • Run the server
      • Create you first user
      • vs code snippet extension
      • Test Login
      • Dashboard
      • Create a new Service with casl&Dashboard
      • Posts Postman snippet
      • Add Admin role
      • Done!
    • Advanced
      • Security - eslint-plugin-security
      • Security - rate limiting
      • Development tools
    • Guides
      • Throw errors
      • Auth Flow
      • Authentication
      • Authouriztion
      • /me
      • Rules Cache
      • Create a new service
      • Custom service validtor client data
      • validators
        • Example of use
        • Types
        • Mongoose schema
      • Default value
      • $Populate
      • Upload service
      • Upload files
        • Create upload service
        • Sign File After Populate
        • Storage support
          • Google-cloud
      • Error
      • feathers Client examples
      • Dashboard
        • Dashboard Config
          • Field configuration
          • doc Layout
          • custom Fields
            • customElements
        • Online dashboard
        • Add to your react app
      • customized feathers-mongoose-casl/services
      • Redis - in progress
      • S3
      • Postman
      • Swagger
      • debug
    • Production
      • ENV
    • Feathers wiki
      • Good links
    • utils
      • send email example
      • Async For Each
      • Create heroku server
      • pick
      • vs code snippet extension
      • Persist user request
    • Ecosystem
    • TODO
    • Versions updates
Powered by GitBook
On this page
  • How to add fields with specific type ?
  • How to configuration field in dashboard screen ?

Was this helpful?

  1. Docs
  2. Guides
  3. Dashboard
  4. Dashboard Config

Field configuration

Inside your validators files, each field can get a dashboard configuration

PreviousDashboard ConfigNextdoc Layout

Last updated 5 years ago

Was this helpful?

How to add fields with specific type ?

How to configuration field in dashboard screen ?

  • label - string Change the label of the document input and the table title

  • hide - boolean When is true the field won't be display in the table and the document

  • allowNull - boolean This will allow null in the client validator

  • displayKey - string Relevant to the reference field, the field to display instead of the _id

  • list - object configuration that relevant only to the table

    • hide - boolean When is true the field won't be display in the table

    • label - string Change the label of the document input and the table title

    • width - number Table column width

    • type - enums can be one of: ['link']

      • link -when equal to link, the field will be render inside

      • imageView - to display value inside an <img />

    • options - same as doc options, use it when you want to display a human text

    • dateFormat - pass a moment formatter to your date field

    • forceLtr - boolean - relevnat to mobile fields with + at first charter

  • doc - object configuration that relevant only to the document

    • hide - boolean When is true the field won't be display in the document

    • hideOnCreate - boolean When is true the field won't be display when you create a new document

    • hideOnCreate - boolean

      When is true the field won't be display when you edit a document

    • inputProps - stringify object - JSON.stringify({}) Props to pass the input

    • helpText: input help text

      //  ExampleJoi.string().meta({   dashboard:  {inputProps:  JSON.stringify({style:  {background:  'red'}}) )}
    • inputType - enum can be one of: ['file','boxSelect','textArea']

      • file - Use to render file upload input

      • boxSelect - Use only on array fields to render boxes with multi select

      • textArea - Use only on string field to render input

      • timePicker - unse on Date fields

      • imageView - To display image when the ref is to file collection with a file field or when field value is url string

    • options - array Use on array of string fields, to render multi select drop down

      // Exmpaletype: Joi.string().valid(Object.values(BUILDINGS_TYPE)).meta({ dashboard:  {     doc:  {         inputType:  'boxSelect',         options:  [             {value:  BUILDINGS_TYPE['stadium'], label:  'Stadium'},             {value:  BUILDINGS_TYPE['gym'], label:  'Gym', i18nLabels: { heIL: 'חדר כושר' }},         ]     } }})
    • initialValue - any The input initial value on creating a new document

    • readOnly - boolean When true the field will be in disabled mode

All the options:

 // all the options are optionalJoi.string().meta({  dashboard: {    label: 'FieldName',    hide: 0,    allowNull: 0,    list: {      hide: 0,      label: null,      width: 100,      type: 'link'    },    doc: {      hide: 0,      hideOnCreate: 0,      hideOnUpdate: 0,      inputProps: JSON.stringify({ ...}),      inputType: 'file',      options: array      initialValue: 'David',      readOnly: false,      displayKey: string,      optionKey: string,    }  }})

Meta on object

We can't pass dashboard in the meta of an object, this is wrong:

const getJoiObject = function (withRequired) {  const required = withRequired ? 'required' : 'optional';  return Joi.object({    someField: Joi.object().keys({      name: Joi.number(),      age: Joi.number()    }).meta({      dashboard: { list: { hide: 1 } }    })  })}

The solution is to pass a meta by the child, like this:

const getJoiObject = function (withRequired) {  const required = withRequired ? 'required' : 'optional';  return Joi.object({    someField: Joi.object().keys({      name: Joi.number().meta({        parentDashboard: {          list: { hide: 1 }        }      }),      age: Joi.number(),    })  })}

Example of use:

const { BUILDINGS_TYPE } = require('../enums');const getJoiObject = function (withRequired) {  const required = withRequired ? 'required' : 'optional';  return Joi.object({    name: Joi.string()[required](),    type: Joi.string().valid(Object.values(BUILDINGS_TYPE)).meta({      dashboard: {        doc: {          inputType: 'boxSelect',          options: [            { value: BUILDINGS_TYPE['stadium'], label: 'Stadium' },            { value: BUILDINGS_TYPE['gym'], label: 'Gym' },          ]        }      }    })  })}

validators
{value}
TextArea