context-dashboard/context-dashboard.component.ts
The context dashboard is a dashboard which resolves it data from the current context (device or group) it is displayed on. It usually uses the route.data for it, but you can pass a different managedObject to the [mo] input parameter to change that behavior.
host | { |
selector | c8y-context-dashboard |
templateUrl | ./context-dashboard.component.html |
Properties |
|
Methods |
|
Inputs |
HostBindings |
constructor(route: ActivatedRoute, router: Router, contextDashboardService: ContextDashboardService, alert: AlertService, renderer: Renderer2, moduleConfig: ContextDashboardConfig, widgetService: WidgetService, bsModal: BsModalService, inventory: InventoryService, gainsightService: GainsightService)
|
|||||||||||||||||||||||||||||||||
Parameters :
|
breadcrumbSettings
|
Type : |
canDelete
|
Type :
Default value : |
childrenClasses
|
Default value : |
context
|
Type : |
defaultWidgets
|
Type :
Default value : |
disabled
|
Type :
Default value : |
isLoading
|
Type :
Default value : |
name
|
Type : |
setTitle
|
Type :
Default value : |
class |
class:
|
Default value : ''
|
addDashboardClassToBody |
addDashboardClassToBody()
|
This is a workaround to ensure that the dragged-element (which is attached to the body) has the right styling.
Returns :
void
|
Async addWidget | ||||||||
addWidget(selected?: DynamicComponentDefinition)
|
||||||||
Adds a widget to the dashboard.
Parameters :
Returns :
any
|
applyDeviceTarget | ||||||
applyDeviceTarget(widget)
|
||||||
Applies the current context to the widget
Parameters :
Returns :
void
|
Async deleteDashboard |
deleteDashboard()
|
Remove the complete dashboard and navigate away.
Returns :
any
|
deleteWidget | ||||||||
deleteWidget(change: WidgetChange)
|
||||||||
Removes a widget and rearranges the remaining ones if necessary.
Parameters :
Returns :
void
|
Async editDashboard |
editDashboard()
|
Edits the current dashboard
Returns :
any
|
Async editWidget | ||||||||
editWidget(change: WidgetChange)
|
||||||||
Edits a widget on the dashboard.
Parameters :
Returns :
any
|
ngOnDestroy |
ngOnDestroy()
|
Removes the route listener.
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
removeDashboardClassFromBody |
removeDashboardClassFromBody()
|
This is a workaround to ensure that the dragged-element (which is attached to the body) has the right styling.
Returns :
void
|
Async restore |
restore()
|
Restores the dashboard widgets to the default widgets.
Returns :
any
|
Async toggleFreeze | ||||||||
toggleFreeze(settings: DashboardSettings)
|
||||||||
Changes the dashboard settings to frozen or vice versa.
Parameters :
Returns :
any
|
Async updateDashboardChildren | ||||||||
updateDashboardChildren(child: DashboardChildChange)
|
||||||||
Updates all dashboards children's. Useful for position changes on the dashboard.
Parameters :
Returns :
{}
|
Async updateWidget | ||||||
updateWidget(widget)
|
||||||
Updates a widget or adds a new one if it doesn't exist on the dashboard.
Parameters :
Returns :
any
|
dashboard |
dashboard:
|
Type : ContextDashboard
|
mo |
mo:
|
Type : ContextDashboardManagedObject
|
Public moduleConfig |
moduleConfig:
|
Type : ContextDashboardConfig
|
Decorators :
@Inject(CONTEXT_DASHBOARD_CONFIG)
|
title |
title:
|
Type : string
|
widgets |
widgets:
|
Type : Widget[]
|
Default value : []
|
<c8y-action-bar-item [placement]="'more'" *ngIf="defaultWidgets.length > 0">
<button (click)="restore()" [disabled]="dashboard?.isFrozen || disabled">
<i c8yIcon="undo"></i> <span translate>Restore dashboard</span>
</button>
</c8y-action-bar-item>
<c8y-widgets-dashboard
[context]="context"
[contextDashboard]="dashboard"
[widgets]="widgets"
[settings]="{
isLoading: isLoading,
isFrozen: dashboard?.isFrozen,
isDisabled: disabled,
canDelete: canDelete,
translateWidgetTitle: dashboard?.translateWidgetTitle,
allowFullscreen: moduleConfig.allowFullscreen,
title: setTitle ? dashboard.name || title : undefined,
widgetMargin: dashboard?.widgetMargin
}"
[breadcrumb]="breadcrumbSettings"
(onFreeze)="toggleFreeze($event)"
(onChangeDashboard)="updateDashboardChildren($event)"
(onAddWidget)="addWidget()"
(onEditWidget)="editWidget($event)"
(onDeleteWidget)="deleteWidget($event)"
(onChangeStart)="addDashboardClassToBody()"
(onChangeEnd)="removeDashboardClassFromBody()"
(onEditDashboard)="editDashboard()"
(onDeleteDashboard)="deleteDashboard()"
>
</c8y-widgets-dashboard>