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
  • Render fields in the same Row
  • Render custom field - link type
  • Render field with condition

Was this helpful?

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

doc Layout

Doc layout is array of field that help you to manage the layout of the fields in the document.

with doc layout you can add custom fields, fields with condition :

Render fields in the same Row

module.exports = function (app) {
  const Model = createModel(app);
  const paginate = app.get('paginate'); // Register validators to validate schema and to register dashboard screen;

  const options = {
    Model,
    paginate,
    serviceRules,
    dashboardConfig: {
      docLayout: 
      [
        '_id',
        ['firstName', 'lastName']
      ]
    }
  };

  // Initialize our service with any options it requires
  app.use('/invitations', new Invitations(options));

  // Get our initialized service so that we can register hooks
  const service = app.service('invitations');

  service.hooks(hooks);
};

Render custom field - link type

docLayout: [
        {
          type: 'custom',
          customFieldType: 'link',
          style: 'button',
          linkTemplate: 'dashboard/floor-plan?floorId={{ _id }}',
          label: 'Plan',
          itemKey: 'linkToPlan',
          hideOnCreate: true,
          hideOnUpdate: false,
         }
]

Render field with condition

// equalTo
docLayout : [
  {
    when: {
      field: 'type',
      equalTo: OFFICES_TYPE.other,
      then: 'other_type'
    }
  }
]
// conditions (read sift query - https://github.com/crcn/sift.js/tree/master)
docLayout : [
  {
    when: {
      conditions: {tags: { $in: ["hello", "world"] }},
      then: 'other_type',
      otherwise: 'tags'
    }
  }
]

PreviousField configurationNextcustom Fields

Last updated 5 years ago

Was this helpful?

customElements