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 |
Accessors |
constructor(route: ActivatedRoute, router: Router, contextDashboardService: ContextDashboardService, alert: AlertService, renderer: Renderer2, moduleConfig: ContextDashboardConfig, widgetService: WidgetService, bsModal: BsModalService, inventory: InventoryService, gainsightService: GainsightService, actionBarService: ActionBarService, translateService: TranslateService, modal: ModalService)
|
||||||||||||||||||||||||||||||||||||||||||
|
Parameters :
|
| breadcrumbSettings |
Type : BreadcrumbItem
|
| canCopy |
Type : boolean
|
Default value : true
|
| canDelete |
Type : boolean
|
Default value : true
|
| childrenClasses |
Type : string
|
Default value : ''
|
| context |
Type : any
|
| defaultWidgets |
Type : Widget[]
|
Default value : []
|
| disabled |
Type : boolean
|
Default value : false
|
| isLoading |
Type : boolean
|
Default value : true
|
| name |
Type : string
|
| setTitle |
Type : boolean
|
Default value : false
|
| class |
Type : string
|
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 copyDashboard |
copyDashboard()
|
|
Copies the dashboard and current context to a clipboard.
Returns :
any
|
| Async deleteDashboard |
deleteDashboard()
|
|
Remove the complete dashboard and navigate away.
Returns :
any
|
| Async deleteWidget | ||||||||
deleteWidget(change: WidgetChange)
|
||||||||
|
Removes a widget and rearranges the remaining ones if necessary.
Parameters :
Returns :
any
|
| 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 | DashboardChange)
|
||||||||
|
Updates all dashboards children's. Useful for position changes on the dashboard.
Parameters :
Returns :
unknown
|
| Async updateWidget | ||||||
updateWidget(widget)
|
||||||
|
Updates a widget or adds a new one if it doesn't exist on the dashboard.
Parameters :
Returns :
any
|
| class |
Type : string
|
Default value : ''
|
Decorators :
@HostBinding('class')
|
| dashboard |
Type : ContextDashboard
|
| mo |
Type : ContextDashboardManagedObject
|
| Public moduleConfig |
Type : ContextDashboardConfig
|
Decorators :
@Inject(CONTEXT_DASHBOARD_CONFIG)
|
| title |
Type : string
|
| widgets |
Type : Widget[]
|
Default value : []
|
| isDeviceTypeDashboard |
getisDeviceTypeDashboard()
|
<c8y-title>
{{ title }}
</c8y-title>
<c8y-action-bar-item [placement]="'more'" *ngIf="defaultWidgets.length > 0">
<button (click)="restore()" px-event="Restore dashboard" [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,
canCopy: canCopy
}"
[breadcrumb]="breadcrumbSettings"
(onFreeze)="toggleFreeze($event)"
(onChangeDashboard)="updateDashboardChildren($event)"
(onAddWidget)="addWidget()"
(onEditWidget)="editWidget($event)"
(onDeleteWidget)="deleteWidget($event)"
(onChangeStart)="addDashboardClassToBody()"
(onChangeEnd)="removeDashboardClassFromBody()"
(onEditDashboard)="editDashboard()"
(onCopyDashboard)="copyDashboard()"
(onDeleteDashboard)="deleteDashboard()"
>
</c8y-widgets-dashboard>