File

context-dashboard/context-dashboard.service.ts

Index

Properties
Methods
Accessors

Constructor

constructor(inventory: InventoryService, tabs: TabsService, modal: ModalService, translateService: TranslateService, router: Router, navigator: NavigatorService, permissions: Permissions, alert: AlertService, dynamicComponent: DynamicComponentService, groupService: GroupService, optionsService: OptionsService)
Parameters :
Name Type Optional
inventory InventoryService No
tabs TabsService No
modal ModalService No
translateService TranslateService No
router Router No
navigator NavigatorService No
permissions Permissions No
alert AlertService No
dynamicComponent DynamicComponentService No
groupService GroupService No
optionsService OptionsService No

Methods

activateDashboards
activateDashboards(route: ActivatedRouteSnapshot, types: ContextDashboardType[])
Parameters :
Name Type Optional
route ActivatedRouteSnapshot No
types ContextDashboardType[] No
Returns : Observable<boolean | []>
addReportNavigatorNode
addReportNavigatorNode(report: IManagedObject)
Parameters :
Name Type Optional
report IManagedObject No
Returns : void
Async canEditDashboard
canEditDashboard(mo: ContextDashboardManagedObject)

Checks if user is able to edit dashboard according to his roles and dashboard ownership.

Parameters :
Name Type Optional Description
mo ContextDashboardManagedObject No
  • Dashboard managed object.
Returns : Promise<boolean>

True if user is able to edit dashboard, false if he cannot.

Async create
create(dashboardCfg: ContextDashboard, context?: ContextData, name: string)
Parameters :
Name Type Optional Default value
dashboardCfg ContextDashboard No
context ContextData Yes
name string No ''
Returns : unknown
createFragmentKey
createFragmentKey(contextDashboardType: ContextDashboardType, value: string)

Creates fragment that associates dashboards with device/asset. It consists of three elements:

  • FRAGMENT_NAME - static string
  • dashboard type (e.g. 'group', 'device')
  • fragment value ( id of device/asset if it is not typed dashboard; deviceTypeValue property of dashboard if it is type dashboard) Example fragment for device dashboard: 'c8y_Dashboard!device!773200' Example fragment for group dashboard: 'c8y_Dashboard!group!84129208' Example fragment for typed device dashboard: 'c8y_Dashboard!type!c8y_lwm2m_connector_device'
Parameters :
Name Type Optional Description
contextDashboardType ContextDashboardType No

Type of dashboard

value string No

Fragment value

Returns : string

Fragment for dashboard

createReport
createReport(reportCfg: Partial)
Parameters :
Name Type Optional
reportCfg Partial<IManagedObject> No
Returns : any
Async delete
delete(dashboard: ContextDashboardManagedObject, withConfirmation)
Parameters :
Name Type Optional Default value
dashboard ContextDashboardManagedObject No
withConfirmation No true
Returns : any
Async detail
detail(dashboardMO: ContextDashboardManagedObject)
Parameters :
Name Type Optional
dashboardMO ContextDashboardManagedObject No
Returns : unknown
Async getContextDashboards
getContextDashboards(mo: IManagedObject, dashboardType: ContextDashboardType[])
Parameters :
Name Type Optional
mo IManagedObject No
dashboardType ContextDashboardType[] No
Returns : Promise<IResultList<IManagedObject>>
getContextForGS
getContextForGS(mo: IManagedObject)
Parameters :
Name Type Optional
mo IManagedObject No
Returns : string | null
getDashboard$
getDashboard$(dashboardIdOrName, dashboardType: ContextDashboardType[], mo?: IManagedObject)
Parameters :
Name Type Optional
dashboardIdOrName No
dashboardType ContextDashboardType[] No
mo IManagedObject Yes
Returns : any
getFilteredDashboardStyles
getFilteredDashboardStyles(styleList: string[])
Parameters :
Name Type Optional
styleList string[] No
Returns : any
getNamedDashboardOrCreate
getNamedDashboardOrCreate(name: string, defaultWidgets: Widget[], context?: ContextData)
Parameters :
Name Type Optional
name string No
defaultWidgets Widget[] No
context ContextData Yes
Returns : any
getStyling
getStyling(styleList, styleName, defaultValue)
Parameters :
Name Optional
styleList No
styleName No
defaultValue No
Returns : any
hasPermissionsToCopyDashboard
hasPermissionsToCopyDashboard()

Checks if user has permissions to copy dashboard according to his roles.

Returns : boolean

True if user has permissions to copy dashboard, false if he cannot.

isDeviceDashboard
isDeviceDashboard(dashboard: Partial)
Parameters :
Name Type Optional
dashboard Partial<ContextDashboardManagedObject> No
Returns : boolean
isDeviceType
isDeviceType(dashboard: Partial)
Parameters :
Name Type Optional
dashboard Partial<ContextDashboardManagedObject> No
Returns : any
isGroupDashboard
isGroupDashboard(dashboard: Partial)
Parameters :
Name Type Optional
dashboard Partial<ContextDashboardManagedObject> No
Returns : boolean
isNamed
isNamed(dashboard: Partial)
Parameters :
Name Type Optional
dashboard Partial<ContextDashboardManagedObject> No
Returns : any
isReport
isReport(dashboard: Partial)
Parameters :
Name Type Optional
dashboard Partial<ContextDashboardManagedObject> No
Returns : any
mapWidgets
mapWidgets(widgets: Widget[])
Parameters :
Name Type Optional
widgets Widget[] No
Returns : any
Async navigateToDashboard
navigateToDashboard(dashboardMO: ContextDashboardManagedObject)
Parameters :
Name Type Optional
dashboardMO ContextDashboardManagedObject No
Returns : any
Async pasteDashboard
pasteDashboard(newContext: DashboardContext)
Parameters :
Name Type Optional
newContext DashboardContext No
Returns : Promise<void>
shouldAllowToSetDashboardType
shouldAllowToSetDashboardType(mo: ContextDashboardManagedObject, context: ContextData)

Indicates if dashboard can be set to type dashboard. First, it checks if deviceTypeValue exists and if user has permission to set dashboard type. Then, case from sensor app is checked- dashboard created with sensor app has deviceType set to true but type fragment is missing- we do not support this combination.

Parameters :
Name Type Optional Description
mo ContextDashboardManagedObject No

Dashboard managed object

context ContextData No

Current context

Returns : AllowTypeDashboard

True if dashboard can be set to type dashboard, false if it is forbidden.

Async update
update(dashboard: ContextDashboardManagedObject, context?: ContextData)
Parameters :
Name Type Optional
dashboard ContextDashboardManagedObject No
context ContextData Yes
Returns : Promise<ContextDashboardManagedObject>
updateDashboardHistory
updateDashboardHistory(dashboard: Partial, dashboardCfg: ContextDashboard)
Parameters :
Name Type Optional
dashboard Partial<ContextDashboardManagedObject> No
dashboardCfg ContextDashboard No
Returns : Partial<ContextDashboardManagedObject>
updateNavigatorItem
updateNavigatorItem(mo: IManagedObject)
Parameters :
Name Type Optional
mo IManagedObject No
Returns : void

Properties

copyClipboard
Type : DashboardCopyClipboard
dashboardTabs$
Type : Observable<Tab[]>
formDisabled$
Type : Observable<boolean>
queriesUtil
Type : QueriesUtil
Readonly REPORT_PARTIAL_NAME
Type : string
Default value : 'report_'
Readonly VERSION_HISTORY_SIZE_LIMIT
Type : number
Default value : 10

Accessors

formDisabled
getformDisabled()
setformDisabled(value)
Parameters :
Name Optional
value No
Returns : void

results matching ""

    No results matching ""