The dashboard module

Index

Back to: modules

The dashboard module – is a module designed to display brief information in the form of blocks. The dashboard is based on the widget model.

Module structure

The control panel consists of three basic entities - the manager, the layout and the widget.

Manager

The manager - is the main component of the module which is responsible for creating and initializing widgets, layouts, connecting the panel to other modules.

Layout

Layout - is an EJS template, which defines the layout of the widgets, the parameters for the widget templates, a plugin for managing the layout grid on the client (for example, gridster), shared resources are connected.
Basic layouts of the module are located in the /dashboard/layouts. Published from metadata in the /applications/${meta-namespace}/layouts folder.
Each layout has a unique ID. When publishing a layout from a meta, a prefix is added to the ID.

When rendering a layout, you must pass an object to the manager.

Widget

Widget - is an object that is located on the layout and interacts with the server via ajax requests.

Basic widgets are located in the /dashboard/widgets. Published from the metadata are located in the folder /applications/${meta-namespace}/widgets.

A widget consists of the the index.js file class and the view.ejs view template. The class must be inherited from the base class /dashboard/base-widget or its descendants.

  • The init() method is responsible for the initial initialization of the widget when the server starts.
  • The refresh() method is called when receiving an ajax request from a client.
  • The job() method gets the data for the widget.

Each widget has a unique ID. When you publish a widget from meta, a prefix is added to the ID.

When rendering a widget view, you must pass an object to the widget.

Publishing from the meta

Example of the structure in applications/develop-and-test:

dashboard
    layouts
      demo-layout
    widgets
      demo-widget
        index.js
        view.ejs
    static
        layouts
        widgets
          demo-widget

Add the following section in the "modules"of the deploy.json configuration file to load the data from the meta to the dashboard module:


Licence  Contact us   English  

iondv metrics

Copyright (c) 2018 LLC “ION DV”.
All rights reserved.