File

context-dashboard/context-dashboard.component.ts

Description

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.

Implements

OnInit OnDestroy

Metadata

Index

Properties
Methods
Inputs
HostBindings

Constructor

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)
Parameters :
Name Type Optional
route ActivatedRoute No
router Router No
contextDashboardService ContextDashboardService No
alert AlertService No
renderer Renderer2 No
moduleConfig ContextDashboardConfig No
widgetService WidgetService No
bsModal BsModalService No
inventory InventoryService No
gainsightService GainsightService No
actionBarService ActionBarService No
translateService TranslateService No

Inputs

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

HostBindings

class
Type : string
Default value : ''

Methods

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 :
Name Type Optional Description
selected DynamicComponentDefinition Yes

Define a selected component to switch to edit mode directly.

Returns : any
applyDeviceTarget
applyDeviceTarget(widget)

Applies the current context to the widget

Parameters :
Name Optional Description
widget No

The widget to apply the context to.

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
deleteWidget
deleteWidget(change: WidgetChange)

Removes a widget and rearranges the remaining ones if necessary.

Parameters :
Name Type Optional Description
change WidgetChange No

The change event.

Returns : void
Async editDashboard
editDashboard()

Edits the current dashboard

Returns : any
Async editWidget
editWidget(change: WidgetChange)

Edits a widget on the dashboard.

Parameters :
Name Type Optional Description
change WidgetChange No

The widget change event.

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 :
Name Type Optional Description
settings DashboardSettings No

The current settings of the dashboard.

Returns : any
Async updateDashboardChildren
updateDashboardChildren(child: DashboardChildChange)

Updates all dashboards children's. Useful for position changes on the dashboard.

Parameters :
Name Type Optional Description
child DashboardChildChange No

The child to change.

Returns : unknown
Async updateWidget
updateWidget(widget)

Updates a widget or adds a new one if it doesn't exist on the dashboard.

Parameters :
Name Optional Description
widget No

The new widget

Returns : any

Properties

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 : []
<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>&nbsp;<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>

results matching ""

    No results matching ""