Flexible dashboard¶
Flexible dashboards are an extension of static dashboards that allow users to customize the content according to their specific needs.
Usage¶
Flexible dashboards offers a personalized experience by enabling users to tailor the dashboards content itself.
Users can enter the edit mode to add, move and remove widgets, as well as restoring the dashboard to its default settings.
When to use¶
- Use it when there is a large amount of widgets that users can choose from.
- Use it if the application is used by a diverse group of users with different needs and goals.
- Use it if users may need to prioritize certain types of information over others based on their current tasks or goals.
- Be mindful about its use. Providing too many customization options can overwhelm users and make the dashboard more difficult to use.
Design¶
Default mode¶
In default mode, the dashboard displays a pre-defined set of widgets, providing users with a view of the data and insights based on their chosen configuration.
- Title (optional), 2. Dashboard options (optional), 3. Content area 4. Edit mode button
The dashboard options area on top of the widgets can be used for actions such as filtering, which affect the whole dashboard.
Edit mode¶
In edit mode, users can customize the dashboard to fit their specific needs. The dashboard options area is replaced by editing options that allow users to add widgets and perform other actions.
- Title (optional), 2. Editing options (optional), 3. Content area, 4. Save and cancel button
Add widget¶
- Select
Add widget
to open the widget library. - Select the desired widget.
- Click
Add
. The library will be closed and the new widget will be added at the bottom of the page.
Resize¶
Users can use the resize handler at the bottom right corner and drag horizontally to change the width, vertically to change the height, or diagonally to change both dimensions. A light blue box appears to indicate the area a widget will snap to, once the user releases the resize handle.
Move¶
Users can select a widget within the content area and drag it to the desired location. As with resizing, a light blue box appears to indicate where the widget will be positioned upon letting it go.
Code¶
The Flexible Dashboards are based on gridstack.js.
See README for details about including to your app.
Direct Link to dashboard demo.
SiFlexibleDashboardComponent API Documentation¶
si-flexible-dashboard
The component implements a dashboard with adding, removing and resizing widgets. It consists and connects a toolbar, a grid with widgets, and a widget catalog.
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
config ¶ | Config | inject(SI_DASHBOARD_CONFIGURATION) | Option to configure a dashboard instance. Default is the optional value from the SI_DASHBOARD_CONFIGURATION . |
dashboardId ¶ | string | Optionally, but it is recommended to include an id for a dashboard. The id is utilized in the persistence calls on the SiWidgetStorage . | |
editable ¶ | boolean | false | Input to change the dashboard editable state. |
heading ¶ | string | Heading for the dashboard. | |
hideAddWidgetInstanceButton ¶ | boolean | false | Option to remove the add widget instance button from the primary toolbar. |
hideEditButton ¶ | boolean | false | Option to hide the dashboard edit button. |
hideProgressIndicator ¶ | boolean | false | Option to turn off the loading spinner on save and load operations. |
searchPlaceholder ¶ | TranslatableString | $localize`:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget` | Placeholder text for the search input field in the widget catalog. |
showEditButtonLabel ¶ | boolean | false | Option to display the edit button as a text button instead, only if the window is larger than xs SiResponsiveContainerDirective . |
widgetCatalog ¶ | Widget [] | [] | Sets the available widgets for the widget catalog to the dashboard. |
widgetCatalogComponent ¶ | Type <SiWidgetCatalogComponent > | Optionally, provide a custom subclass of the SiWidgetCatalogComponent to use your own catalog component. | |
widgetInstanceEditorDialogComponent ¶ | Type <SiWidgetInstanceEditorDialogComponent > | Optionally, provide a custom subclass of the SiWidgetInstanceEditorDialogComponent to use your own implementation. |
Output Properties¶
Name | Type | Description |
---|---|---|
editableChange ¶ | boolean | Input to change the dashboard editable state. |
isModified ¶ | boolean | Emits the modification state of the grid. It is unmodified when the visible state is equal to the loaded state from the widget storage. When the user modifies the dashboard by e.g. while moving the widgets, the dashboard is marked as modified and emits true and when the user persists the change by saving, or reverts the state by canceling, the state is unmodified again and emits false . |
SiGridComponent API Documentation¶
si-grid
The grid component is the actual component on which the widget instances are placed and visualized. You can think of a headless dashboard, without a title, toolbar or edit buttons.
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
dashboardId ¶ | string | An optional, but recommended dashboard id that is used in persistence and passed to the widget store for saving and loading data. | |
editable ¶ | boolean | false | Sets the grid into editable mode, in which the widget instances can be moved, resized, removed or new ones added. |
emitWidgetInstanceEditEvents ¶ | boolean | false | When the user clicks edit on a widget instance, an editor need to appear and the widget editor component need to be loaded. When the grid is used standalone, it takes care and opens a modal dialog and loads the configured widget editor component. When the grid is used in a container like the flexible dashboard, the container manages where the widget instance editor is displayed. In this case this options prevents the grid from showing the editor in the dialog, and emits on widgetInstanceEdit on clicking the widget edit action. |
hideProgressIndicator ¶ | boolean | false | Option to turn off the loading spinner on save and load operations. |
widgetCatalog ¶ | Widget [] | [] | Provides the available widgets to the grid. When loading the widget configurations from the storage, we need to have the widget definition available to be able to create the widget instances on the grid. |
widgetInstanceEditorDialogComponent ¶ | Type <SiWidgetInstanceEditorDialogComponent > | Option to configure a custom widget instance editor dialog component. The component provides the editor hosting and the buttons to save and cancel. |
Output Properties¶
Name | Type | Description |
---|---|---|
editableChange ¶ | boolean | Sets the grid into editable mode, in which the widget instances can be moved, resized, removed or new ones added. |
isModified ¶ | boolean | Emits the modification state of the grid. It is unmodified when the visible state is equal to the loaded state from the widget storage. When the user modifies the dashboard by e.g. while moving the widgets, the dashboard is marked as modified and emits true and when the user persists the change by saving, or reverts the state by canceling, the state is unmodified again and emits false . |
widgetInstanceEdit ¶ | WidgetConfig | Emits to notify about edit events of widget instances. Only emits if emitWidgetInstanceEditEvents is set to true . |
Attributes and Methods¶
Name | Type | Default | Description |
---|---|---|---|
addWidgetInstance(...) ¶ | (widgetInstanceConfig: Omit <WidgetConfig , "id" >) => void | Adds a new widget instance configuration to the dashboard grid. It is not persisted yet and is added to the transient widget instances. Parameters
| |
cancel() ¶ | () => void | Cancel current changes and restore last saved state. | |
edit() ¶ | () => void | Set dashboard grid in editable mode to modify widget instances. | |
editWidgetInstance(...) ¶ | (widgetInstanceConfig: WidgetConfig ) => void | Opens the provided widget configuration in the related editor or emits on widgetInstanceEdit , if emitWidgetInstanceEditEvents is true. Parameters
| |
(readonly) gridConfig ¶ | InputSignal <(undefined | GridConfig )> | inject(SI_DASHBOARD_CONFIGURATION)?.grid | Configuration options for a grid instance. Default is the optional value from the SI_DASHBOARD_CONFIGURATION . |
(readonly) gridStackWrapper ¶ | Signal <SiGridstackWrapperComponent > | viewChild.required(SiGridstackWrapperComponent) | |
(readonly) isLoading ¶ | BehaviorSubject <boolean > | ... | Indication for load and save operations. |
removeWidgetInstance(...) ¶ | (widgetInstanceId: string ) => void | Removes a widget instance from the visible widgets and puts it in the markedForRemoval array. Parameters
| |
save() ¶ | () => void | Persists the current widget instances to the widget storage and changes the editable and isModified modes. | |
updateWidgetInstance(...) ¶ | (editedWidgetConfig: WidgetConfig ) => void | Updates the visible widgets with an updated configuration. Will update the user interface and emit on isModified . Parameters
| |
loadingService | SiLoadingService | inject(SiLoadingService) | Service used to indicate load and save indication. Deprecated: Use isLoading instead. |
Persistence of dashboard configuration¶
Widget storage api to provide the persistence layer of the widgets of a dashboard (typically from a web service). The dashboard grid uses this API to load and save the widget configurations. Applications using siemens-dashboard needs to implement this abstract class and provide it in the module configuration. | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||
| |||||||||||||
|
SiWidgetCatalogComponent API Documentation¶
si-widget-catalog
Default widget catalog implementation to show all available widgets that can be added to a dashboard. It consists of a list view, that lists all available widgets and after selection, a host in which the widget specific editor is loaded. Applications can either stay with the default catalog or implement their own by extending this class.
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
searchPlaceholder ¶ | TranslatableString | $localize`:@@DASHBOARD.WIDGET_LIBRARY.SEARCH_PLACEHOLDER:Search widget` | Placeholder text for the search input field in the widget catalog. |
Output Properties¶
Name | Type | Description |
---|---|---|
closed ¶ | (undefined | Omit <WidgetConfig , "id" >) | Emits when the catalog is closed , either by canceling or by adding or saving a widget configuration. On cancel undefined is emitted, otherwise the related widget configuration is emitted. |
Attributes and Methods¶
Name | Type | Default | Description |
---|---|---|---|
widgetCatalog ¶ | Widget [] | [] | Property to provide the available widgets to the catalog. The flexible dashboard creates the catalog by Angular's createComponent() method and sets the available widgets to this attribute. |
SiWidgetInstanceEditorDialogComponent API Documentation¶
si-widget-instance-editor-dialog
The Dialog component is utilized when editing a widget instance within a dashboard. It dynamically loads and creates the associated widget editor and incorporates it into its content. The dialog component is accountable for interacting with the dashboard and offers options for saving changes or terminating the editing process.
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
widget | Widget | Input for the widget definition. It is required to retrieve the component factory to instantiate the widget editor. | |
widgetConfig | WidgetConfig | Input for the widget instance configuration. It is used to populate the widget editor. |
Output Properties¶
Name | Type | Description |
---|---|---|
closed ¶ | (undefined | WidgetConfig ) | Emits the edited widget instance configuration if the user confirms by saving, or undefined if the user cancels the dialog. |
editorSetupCompleted ¶ | void | Emits when the editor instantiation is completed. |
widgetConfigChange ¶ | WidgetConfig | Input for the widget instance configuration. It is used to populate the widget editor. |
Types Documentation¶
Dashboard configuration object. Inject globally using the SI_DASHBOARD_CONFIGURATION or configure individual dashboard instances. |
---|
Variable Injection token to configure dashboards. Use { provide: SI_DASHBOARD_CONFIGURATION, useValue: config } in your app configuration. |
---|
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit . Equivalent to a normal string in usage and functionality. |
---|
Widgets describe the entries within the widget catalog and holds all default configuration and factory functionality to instantiate a widget instance, represented as WidgetConfig objects. | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
A WidgetConfig holds the configuration of a widget instance component that is visible on a dashboard. It can be persisted and used to restore a dashboards state. | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
State to control the behavior of a widget instance editor wizard. The wizard state is used to control the behavior of the dialog buttons provided by the catalog and editor components. | ||||
---|---|---|---|---|
|
An editor component for a widget instance need to implement this interface. After initializing the instance editor component, with widget configuration is set. Optionally, the component can emit changes during editing to control e.g. the dialog behavior like disabling the save button. | ||||
---|---|---|---|---|
|
Configuration object for the si-grid component, including the options of gridstack. | ||
---|---|---|
|
Image is used to configure an image to be displayed on a widget instance. | ||||||
---|---|---|---|---|---|---|
|
A widget instance editor component that shall support a multi-page widget configuration can implement this interface. The wizard-like page state WidgetInstanceEditorWizardState needs to be managed by the editor itself and is used to control wizard dialog buttons that are provided by the catalog and editor component. | ||||||
---|---|---|---|---|---|---|
| ||||||
|
The Remote Module definition is based on @angular-architects . We take it over into this file to prevent adding a hard dependency. |
---|
Object is used to inform the editor hosting component about configuration changes to configure (e.g. enable/disable) the control buttons accordingly. | |||
---|---|---|---|
|
import imported from gridstack |
---|
ObjectFit configuration options for a widget image. See https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit |
---|
Returns the return value type for the given action dialog type |
---|
Property The hosting component of the widget instance editor sets the configuration after initialization. The editor component should use the configuration as input and persist all relevant changes within the config. The hosting component takes the config after adding of saving the widget instance and updates the dashboard. |
---|
Property Optionally, emit updated widget configuration using an event emitter. |
---|
Property Optionally, inform the hosting component about widget configuration status changes. |
---|
Union type for all possible items in the dashboard toolbar. |
---|
All possible action dialogs. |
---|
An action dialog showing an alert | ||||||||
---|---|---|---|---|---|---|---|---|
|
An action dialog for a confirmation. | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
An action dialog for an edit/discard prompt. | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
An action dialog for a delete confirmation. | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
|
Variable Deprecated: Will be removed in a future release. Use the string values directly. |
---|
Variable Deprecated: Will be removed in a future release. Use the string values directly. |
---|
Variable Deprecated: Will be removed in a future release. Use the string values directly. |
---|
|
|
Represents a menu item that navigates using the Angular Router. Requires a configured Angular Router. | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
Interface representing an action item in the dashboard toolbar. | ||||
---|---|---|---|---|
|
Interface representing a router link item in the dashboard toolbar. | |||||
---|---|---|---|---|---|
|
Interface representing a link item in the dashboard toolbar. | |||||
---|---|---|---|---|---|
|
Reference to a modal dialog | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
| ||||||||||||
| ||||||||||||
|
Variable Deprecated: Will be removed in a future release. Use the string values directly. |
---|
|
|
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit . Equivalent to a normal string in usage and functionality. |
---|
Property Badge that is rendered after the label. |
---|
Property Color of the badge (not iconBadge). |
---|
Property Whether the menu item id disabled. |
---|
icon? Property Optional icon that will be rendered before the label. |
---|
Property Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. |
---|
id? Property ID that will be attached to the DOM node. |
---|
Property Label that is shown to the user. |
---|
Implement and provide this to an SiMenuFactoryComponent to receive trigger events. | |||||||
---|---|---|---|---|---|---|---|
| |||||||
|
Translatable import imported from @siemens/element-translate-ng |
---|
Property Optional environment Injector. |
---|
Property Optional element Injector. |
---|
Property Additional providers for the modal. |
---|
Used in events emitted from SiLinkActionService | |||
---|---|---|---|
|
|
The grid component is the actual component on which the widget instances are placed and visualized. You can think of a headless dashboard, without a title, toolbar or edit buttons. | |||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||
|
The service provides convenient methods to show common modal dialogs. All return an observable, which emit the dialog results. After emitting, the observables complete. Therefore, clients do not need to unsubscribe. | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||
| |||||||||||||||||||||||||
|
| |||||||||||||||||||||
| |||||||||||||||||||||
|
| |||||||
| |||||||
|
| |||
| |||
|
Except where otherwise noted, content on this site is licensed under MIT License.