@c8y/ngx-components 1022.44.7 → 1022.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/asset-properties/asset-properties.model.d.ts +1 -1
  2. package/asset-properties/asset-properties.model.d.ts.map +1 -1
  3. package/asset-properties/asset-property-list/asset-property-value.pipe.d.ts.map +1 -1
  4. package/computed-asset-properties/last-measurement/last-measurement-value.d.ts +2 -1
  5. package/computed-asset-properties/last-measurement/last-measurement-value.d.ts.map +1 -1
  6. package/computed-asset-properties/strategies/last-measurement-strategy.d.ts +4 -3
  7. package/computed-asset-properties/strategies/last-measurement-strategy.d.ts.map +1 -1
  8. package/context-dashboard/context-dashboard.service.d.ts +20 -2
  9. package/context-dashboard/context-dashboard.service.d.ts.map +1 -1
  10. package/context-dashboard/widget-config/widget-asset-selector.component.d.ts +8 -2
  11. package/context-dashboard/widget-config/widget-asset-selector.component.d.ts.map +1 -1
  12. package/context-dashboard/widget-config.component.d.ts.map +1 -1
  13. package/context-dashboard/widget-config.service.d.ts +7 -1
  14. package/context-dashboard/widget-config.service.d.ts.map +1 -1
  15. package/core/router/router.service.d.ts +1 -0
  16. package/core/router/router.service.d.ts.map +1 -1
  17. package/dashboard-manager/dashboard-manager.service.d.ts +5 -4
  18. package/dashboard-manager/dashboard-manager.service.d.ts.map +1 -1
  19. package/dashboard-manager/devicemanagement/dashboard-manager-navigation.factory.d.ts +10 -0
  20. package/dashboard-manager/devicemanagement/dashboard-manager-navigation.factory.d.ts.map +1 -0
  21. package/dashboard-manager/devicemanagement/dashboard-manager-tabs.factory.d.ts +11 -0
  22. package/dashboard-manager/devicemanagement/dashboard-manager-tabs.factory.d.ts.map +1 -0
  23. package/dashboard-manager/devicemanagement/index.d.ts +4 -0
  24. package/dashboard-manager/devicemanagement/index.d.ts.map +1 -1
  25. package/dashboard-manager/index.d.ts +2 -1
  26. package/dashboard-manager/index.d.ts.map +1 -1
  27. package/dashboard-manager/type-dashboards-list/index.d.ts +2 -0
  28. package/dashboard-manager/type-dashboards-list/index.d.ts.map +1 -0
  29. package/fesm2022/c8y-ngx-components-asset-properties.mjs +1 -1
  30. package/fesm2022/c8y-ngx-components-asset-properties.mjs.map +1 -1
  31. package/fesm2022/c8y-ngx-components-computed-asset-properties.mjs +1 -1
  32. package/fesm2022/c8y-ngx-components-computed-asset-properties.mjs.map +1 -1
  33. package/fesm2022/c8y-ngx-components-context-dashboard.mjs +54 -24
  34. package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
  35. package/fesm2022/c8y-ngx-components-dashboard-manager-devicemanagement.mjs +81 -6
  36. package/fesm2022/c8y-ngx-components-dashboard-manager-devicemanagement.mjs.map +1 -1
  37. package/fesm2022/c8y-ngx-components-dashboard-manager.mjs +185 -166
  38. package/fesm2022/c8y-ngx-components-dashboard-manager.mjs.map +1 -1
  39. package/fesm2022/c8y-ngx-components-map.mjs +1 -1
  40. package/fesm2022/c8y-ngx-components-map.mjs.map +1 -1
  41. package/fesm2022/c8y-ngx-components-widgets-implementations-cockpit-welcome.mjs +2 -2
  42. package/fesm2022/c8y-ngx-components-widgets-implementations-cockpit-welcome.mjs.map +1 -1
  43. package/fesm2022/c8y-ngx-components-widgets-implementations-map.mjs +12 -7
  44. package/fesm2022/c8y-ngx-components-widgets-implementations-map.mjs.map +1 -1
  45. package/fesm2022/c8y-ngx-components.mjs +14 -4
  46. package/fesm2022/c8y-ngx-components.mjs.map +1 -1
  47. package/locales/de.po +19 -0
  48. package/locales/es.po +19 -0
  49. package/locales/fr.po +19 -0
  50. package/locales/ja_JP.po +17 -0
  51. package/locales/ko.po +18 -0
  52. package/locales/locales.pot +18 -0
  53. package/locales/nl.po +19 -0
  54. package/locales/pl.po +19 -0
  55. package/locales/pt_BR.po +19 -0
  56. package/locales/zh_CN.po +18 -0
  57. package/locales/zh_TW.po +18 -0
  58. package/package.json +1 -1
  59. package/widgets/implementations/map/map-widget.component.d.ts +1 -0
  60. package/widgets/implementations/map/map-widget.component.d.ts.map +1 -1
@@ -44,7 +44,7 @@ class LastMeasurementStrategy {
44
44
  return `${date} | ${measurement[fragment][series].value} ${measurement[fragment][series].unit}`;
45
45
  }
46
46
  else if (resultType === 4) {
47
- return JSON.stringify(measurement);
47
+ return measurement[fragment][series];
48
48
  }
49
49
  return '';
50
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"c8y-ngx-components-computed-asset-properties.mjs","sources":["../../computed-asset-properties/strategies/last-measurement-strategy.ts","../../computed-asset-properties/common/realtime-value-handler.ts","../../computed-asset-properties/last-measurement/last-measurement-value.ts","../../computed-asset-properties/last-measurement/last-measurement-computed-property.ts","../../computed-asset-properties/strategies/child-count-strategy.ts","../../computed-asset-properties/child-count/child-count-value.ts","../../computed-asset-properties/child-count/child-assets-count-computed-property.ts","../../computed-asset-properties/strategies/count-strategy-base.ts","../../computed-asset-properties/strategies/alarm-count-strategy.ts","../../computed-asset-properties/alarm-count/alarm-count-value.ts","../../computed-asset-properties/alarm-count/alarm-count-3-months-computed-property.ts","../../computed-asset-properties/alarm-count/alarm-count-today-computed-property.ts","../../computed-asset-properties/strategies/event-count-strategy.ts","../../computed-asset-properties/event-count/event-count-value.ts","../../computed-asset-properties/event-count/event-count-today.ts","../../computed-asset-properties/event-count/event-count-3-months.ts","../../computed-asset-properties/configuration-snapshot/configuration-snapshot-computed-property.ts","../../computed-asset-properties/child-count/child-devices-count-computed-property.ts","../../computed-asset-properties/strategies/last-device-message-strategy.ts","../../computed-asset-properties/last-device-message/last-device-message-value.ts","../../computed-asset-properties/last-device-message/last-device-message-computed-property.ts","../../computed-asset-properties/index.ts","../../computed-asset-properties/c8y-ngx-components-computed-asset-properties.ts"],"sourcesContent":["// strategies/last-measurement-strategy.ts\nimport { Injector } from '@angular/core';\nimport { IMeasurement, MeasurementService } from '@c8y/client';\nimport { DatePipe, MeasurementRealtimeService } from '@c8y/ngx-components';\nimport { filter, from, map, Observable, startWith } from 'rxjs';\nimport { KPIDetails } from '@c8y/ngx-components/datapoint-selector';\nimport { LastMeasurementConfig } from '../last-measurement/last-measurement.model';\nimport { ValueStrategy } from '../common/realtime-value-base';\n\nexport class LastMeasurementStrategy implements ValueStrategy<string> {\n private measurementService: MeasurementService;\n private measurementRealtime: MeasurementRealtimeService;\n private datapoint: KPIDetails;\n private datePipe: DatePipe;\n\n constructor(\n private config: LastMeasurementConfig,\n injector: Injector\n ) {\n this.measurementService = injector.get(MeasurementService);\n this.measurementRealtime = injector.get(MeasurementRealtimeService);\n this.datePipe = injector.get(DatePipe);\n this.datapoint = config.dp.filter(dp => dp.__active)[0];\n }\n\n fetchCurrentValue(): Observable<string> {\n const measurementFilter: any = {\n valueFragmentSeries: this.datapoint.series,\n valueFragmentType: this.datapoint.fragment,\n pageSize: 1,\n revert: true,\n dateFrom: '1970-01-01',\n source: this.datapoint.__target.id\n };\n\n return from(this.measurementService.list(measurementFilter)).pipe(\n map(({ data }) => data[0]),\n filter(measurement => !!measurement),\n map(measurement => this.formatMeasurement(measurement))\n );\n }\n\n createRealtimeStream(initialValue: string): Observable<string> {\n return this.measurementRealtime\n .onCreateOfSpecificMeasurement$(\n this.datapoint.fragment,\n this.datapoint.series,\n this.datapoint.__target\n )\n .pipe(\n map(measurement => this.formatMeasurement(measurement)),\n startWith(initialValue)\n );\n }\n\n private formatMeasurement(measurement: IMeasurement): string {\n const resultType = this.config?.resultType;\n const fragment = this.datapoint.fragment;\n const series = this.datapoint.series;\n\n if (resultType === 1) {\n return measurement[fragment][series].value;\n } else if (resultType === 2) {\n return measurement[fragment][series].value + ' ' + measurement[fragment][series].unit;\n } else if (resultType === 3) {\n const date = this.datePipe.transform(new Date(measurement.time as string), 'short');\n return `${date} | ${measurement[fragment][series].value} ${measurement[fragment][series].unit}`;\n } else if (resultType === 4) {\n return JSON.stringify(measurement);\n }\n return '';\n }\n}\n","import {\n distinctUntilChanged,\n NEVER,\n Observable,\n pairwise,\n share,\n startWith,\n switchMap,\n take\n} from 'rxjs';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { ValueStrategy, RealtimeValueConfig } from './realtime-value-base';\n\n/**\n * Generic handler for realtime values following the three modes pattern\n * Closed for modification but open for extension through strategies\n */\nexport class RealtimeValueHandler<T> {\n private readonly config: Required<RealtimeValueConfig> = {\n refetchOnResume: true,\n preserveValueOnPause: true\n };\n\n constructor(\n private strategy: ValueStrategy<T>,\n config?: RealtimeValueConfig\n ) {\n if (config) {\n this.config = { ...this.config, ...config };\n }\n }\n\n /**\n * Creates an Observable based on the metadata mode\n */\n getValue(metadata: ValueCallbackMetadata = { mode: 'realtime' }): Observable<T> {\n if (metadata.mode === 'singleValue') {\n return this.strategy.fetchCurrentValue().pipe(take(1));\n }\n\n if (metadata.mode === 'realtime' && !metadata.realtimeControl$) {\n return this.handleUncontrolledRealtime();\n }\n\n if (metadata.mode === 'realtime' && metadata.realtimeControl$) {\n return this.handleControlledRealtime(metadata.realtimeControl$);\n }\n }\n\n private handleUncontrolledRealtime(): Observable<T> {\n return this.strategy\n .fetchCurrentValue()\n .pipe(switchMap(initialValue => this.strategy.createRealtimeStream(initialValue)));\n }\n\n private handleControlledRealtime(control$: Observable<boolean>): Observable<T> {\n const controlWithPrevious$ = control$.pipe(\n distinctUntilChanged(),\n startWith(null),\n pairwise(),\n share()\n );\n\n return controlWithPrevious$.pipe(\n switchMap(([previous, current]) => {\n if (!current) {\n // Realtime is disabled\n if (previous === null) {\n // Initial emission while disabled\n return this.strategy.fetchCurrentValue().pipe(take(1));\n } else if (this.config.preserveValueOnPause) {\n // Was previously enabled - preserve last value\n return NEVER;\n } else {\n // Don't preserve value - fetch current\n return this.strategy.fetchCurrentValue().pipe(take(1));\n }\n } else {\n // Realtime is enabled\n if (this.config.refetchOnResume || previous === null) {\n // Re-fetch current value and start streaming\n return this.strategy\n .fetchCurrentValue()\n .pipe(switchMap(currentValue => this.strategy.createRealtimeStream(currentValue)));\n } else {\n // Continue with realtime stream without re-fetching\n return this.strategy.createRealtimeStream(null as T);\n }\n }\n })\n );\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { LastMeasurementConfig } from './last-measurement.model';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { LastMeasurementStrategy } from '../strategies/last-measurement-strategy';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Creates an Observable that tracks the latest measurement value for a specific datapoint.\n * Combines initial server fetch with real-time measurement updates.\n *\n * @param config - Measurement configuration (datapoint, result type, etc.)\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<string> - Stream of measurement string values\n */\nexport function lastMeasurementValue(\n config: LastMeasurementConfig,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<string> {\n const injector = inject(Injector);\n const strategy = new LastMeasurementStrategy(config, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { ComputedPropertyDefinition } from '@c8y/ngx-components/asset-properties';\nimport { LastMeasurementConfig } from './last-measurement.model';\nimport { lastMeasurementValue } from './last-measurement-value';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const lastMeasurement: ComputedPropertyDefinition<\n ['device', 'asset', 'group'],\n LastMeasurementConfig\n> = {\n name: 'lastMeasurement',\n contextType: ['device', 'asset', 'group'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n lastMeasurement: {\n label: 'Last measurement',\n type: 'string'\n }\n }\n },\n name: 'lastMeasurement',\n label: gettext('Last measurement'),\n type: 'string',\n config: { dp: [], resultType: 1 } as LastMeasurementConfig,\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./last-measurement-config.component').then(\n m => m.ComputedPropertyLastMeasurementConfigComponent\n ),\n value: ({ config }) => {\n return lastMeasurementValue(config);\n }\n};\n","import { Injector } from '@angular/core';\nimport { IManagedObject, InventoryService } from '@c8y/client';\nimport { ManagedObjectRealtimeService } from '@c8y/ngx-components';\nimport { from, map, Observable, startWith } from 'rxjs';\nimport { ValueStrategy } from '../common/realtime-value-base';\n\nexport class ChildCountStrategy implements ValueStrategy<number> {\n private inventoryService: InventoryService;\n private moRealtimeService: ManagedObjectRealtimeService;\n\n constructor(\n private asset: IManagedObject,\n private childType: 'childDevices' | 'childAssets',\n injector: Injector\n ) {\n this.inventoryService = injector.get(InventoryService);\n this.moRealtimeService = injector.get(ManagedObjectRealtimeService);\n }\n\n fetchCurrentValue(): Observable<number> {\n return from(this.inventoryService.detail(this.asset.id, { withChildren: true })).pipe(\n map(resp => resp?.data?.[this.childType]?.references?.length || 0)\n );\n }\n\n createRealtimeStream(initialValue: number): Observable<number> {\n return this.moRealtimeService.onAll$(this.asset.id).pipe(\n map(resp => (resp?.data as IManagedObject)?.[this.childType]?.references?.length || 0),\n startWith(initialValue)\n );\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport { IManagedObject } from '@c8y/client';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { Observable } from 'rxjs';\nimport { ChildCountStrategy } from '../strategies/child-count-strategy';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Shared function that tracks the count of child items (devices or assets) for a specific managed object.\n * Supports real-time updates when child items are added or removed.\n *\n * @param asset - The managed object to track child items for\n * @param childType - Type of child items ('childDevices' or 'childAssets')\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of child items count values\n */\nexport function childCountValue(\n asset: IManagedObject,\n metadata: ValueCallbackMetadata = { mode: 'realtime' },\n childType: 'childDevices' | 'childAssets'\n): Observable<number> {\n const injector = inject(Injector);\n const strategy = new ChildCountStrategy(asset, childType, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { Observable } from 'rxjs';\nimport { childCountValue } from './child-count-value';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const childAssetsCount: ComputedPropertyDefinition<['group', 'asset']> = {\n name: 'childAssetsCount',\n contextType: ['group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n childAssetsCount: {\n label: 'Number of child assets',\n type: 'number'\n }\n }\n },\n name: 'childAssetsCount',\n label: gettext('Number of child assets'),\n type: 'number',\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n value: ({ context, metadata }) => childAssetsCountValue(context, metadata)\n};\n\n/**\n * Creates an Observable that tracks the count of child assets for a specific asset.\n * Supports real-time updates when child assets are added or removed.\n *\n * @param asset - The managed object (asset) to track child assets for\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of child assets count values\n */\nexport function childAssetsCountValue(\n asset: IManagedObject,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<number> {\n return childCountValue(asset, metadata, 'childAssets');\n}\n","import { Observable, scan, startWith } from 'rxjs';\nimport { ValueStrategy } from '../common/realtime-value-base';\n\n/**\n * Base class for count-based strategies\n * Provides common accumulation logic\n */\nexport abstract class CountStrategyBase implements ValueStrategy<number> {\n abstract fetchCurrentValue(): Observable<number>;\n abstract getRealtimeIncrement$(): Observable<number>;\n\n createRealtimeStream(initialValue: number): Observable<number> {\n return this.getRealtimeIncrement$().pipe(\n scan((count, increment) => count + increment, initialValue),\n startWith(initialValue)\n );\n }\n}\n","import { Injector } from '@angular/core';\nimport {\n AlarmQueryFilter,\n AlarmService,\n IAlarm,\n IManagedObject,\n SeverityFilter\n} from '@c8y/client';\nimport { AlarmRealtimeService } from '@c8y/ngx-components';\nimport { filter, from, map, Observable, tap } from 'rxjs';\nimport { AlarmCountConfig } from '../alarm-count/alarm-count.model';\nimport { CountStrategyBase } from './count-strategy-base';\n\nexport class AlarmCountStrategy extends CountStrategyBase {\n private alarmService: AlarmService;\n private alarmRealtimeService: AlarmRealtimeService;\n private startTime: Date;\n\n constructor(\n private config: AlarmCountConfig,\n private asset: IManagedObject,\n private dateFrom: Date,\n injector: Injector\n ) {\n super();\n this.alarmService = injector.get(AlarmService);\n this.alarmRealtimeService = injector.get(AlarmRealtimeService);\n this.startTime = new Date();\n }\n\n fetchCurrentValue(): Observable<number> {\n const severities: SeverityFilter[] = Object.keys(this.config.severities || {}).filter(\n key => this.config.severities[key]\n ) as SeverityFilter[];\n\n const filters: AlarmQueryFilter = {\n source: this.asset.id,\n dateFrom: this.dateFrom.toISOString(),\n type: this.config.type,\n pageSize: 1,\n withTotalElements: true,\n ...(severities.length && { severity: severities.join(',') })\n };\n\n return from(this.alarmService.list(filters)).pipe(\n map(resp => resp?.paging?.totalElements || 0),\n tap(() => (this.startTime = new Date())) // Update start time after fetch\n );\n }\n\n getRealtimeIncrement$(): Observable<number> {\n return this.alarmRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => data as IAlarm),\n filter(\n alarm =>\n alarm.type === this.config.type &&\n this.config.severities[alarm.severity] &&\n new Date(alarm.creationTime) > this.startTime\n ),\n tap(() => (this.startTime = new Date())),\n map(() => 1) // Each matching alarm increments by 1\n );\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport { IManagedObject } from '@c8y/client';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { Observable } from 'rxjs';\nimport { AlarmCountStrategy } from '../strategies/alarm-count-strategy';\nimport { AlarmCountConfig } from './alarm-count.model';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Creates an Observable that tracks alarm count for a specific asset.\n * When real-time is paused and resumed, it re-fetches the current count from server\n * to account for alarms that occurred during the pause.\n *\n * @param config - Alarm filtering configuration (type, severities, etc.)\n * @param asset - The managed object (device/asset) to track alarms for\n * @param dateFrom - Start date for counting alarms\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of alarm count values\n */\nexport function alarmCountValue(\n config: AlarmCountConfig,\n asset: IManagedObject,\n dateFrom: Date,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<number> {\n const injector = inject(Injector);\n const strategy = new AlarmCountStrategy(config, asset, dateFrom, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { AlarmCountConfig } from './alarm-count.model';\nimport { alarmCountValue } from './alarm-count-value';\nimport { Observable } from 'rxjs';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const alarmCount3Months: ComputedPropertyDefinition<\n ['device', 'group', 'asset'],\n AlarmCountConfig\n> = {\n name: 'alarmCount3Months',\n contextType: ['device', 'group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n alarmCount3Months: {\n label: 'Alarm count 3 months',\n type: 'number'\n }\n }\n },\n name: 'alarmCount3Months',\n label: gettext('Alarm count 3 months'),\n type: 'number',\n config: { type: '' } as AlarmCountConfig,\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./alarm-count-config.component').then(m => m.ComputedPropertyAlarmCountConfigComponent),\n value: ({ config, context, metadata }) => alarmCount3MonthsValue(config, context, metadata)\n};\n\nfunction alarmCount3MonthsValue(\n config: AlarmCountConfig,\n asset: IManagedObject,\n metadata: ValueCallbackMetadata\n): Observable<number> {\n const threeMonthsAgo = new Date();\n threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);\n return alarmCountValue(config, asset, threeMonthsAgo, metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { AlarmCountConfig } from './alarm-count.model';\nimport { alarmCountValue } from './alarm-count-value';\nimport { Observable } from 'rxjs';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const alarmCountToday: ComputedPropertyDefinition<\n ['device', 'group', 'asset'],\n AlarmCountConfig\n> = {\n name: 'alarmCountToday',\n contextType: ['device', 'group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n alarmCountToday: {\n label: 'Alarm count today',\n type: 'number'\n }\n }\n },\n name: 'alarmCountToday',\n label: gettext('Alarm count today'),\n type: 'number',\n config: { type: '' } as AlarmCountConfig,\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./alarm-count-config.component').then(m => m.ComputedPropertyAlarmCountConfigComponent),\n value: ({ config, context, metadata }) => alarmCountTodayValue(config, context, metadata)\n};\n\nfunction alarmCountTodayValue(\n config: AlarmCountConfig,\n asset: IManagedObject,\n metadata: ValueCallbackMetadata\n): Observable<number> {\n const oneDayAgo = new Date();\n oneDayAgo.setDate(oneDayAgo.getDate() - 1);\n return alarmCountValue(config, asset, oneDayAgo, metadata);\n}\n","import { Injector } from '@angular/core';\nimport { EventService, IEvent, IManagedObject } from '@c8y/client';\nimport { EventRealtimeService } from '@c8y/ngx-components';\nimport { filter, from, map, Observable } from 'rxjs';\nimport { EventCountConfig } from '../event-count/event-count.model';\nimport { CountStrategyBase } from './count-strategy-base';\n\nexport class EventCountStrategy extends CountStrategyBase {\n private eventService: EventService;\n private eventRealtimeService: EventRealtimeService;\n\n constructor(\n private config: EventCountConfig,\n private asset: IManagedObject,\n private dateFrom: Date,\n injector: Injector\n ) {\n super();\n this.eventService = injector.get(EventService);\n this.eventRealtimeService = injector.get(EventRealtimeService);\n }\n\n fetchCurrentValue(): Observable<number> {\n const filters = {\n source: this.asset.id,\n dateFrom: this.dateFrom.toISOString(),\n type: this.config.type,\n pageSize: 1,\n withTotalElements: true\n };\n\n return from(this.eventService.list(filters)).pipe(\n map(resp => resp?.paging?.totalElements || 0)\n );\n }\n\n getRealtimeIncrement$(): Observable<number> {\n return this.eventRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => data as IEvent),\n filter(event => event.type === this.config.type && new Date(event.time) >= this.dateFrom),\n map(() => 1)\n );\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport { IManagedObject } from '@c8y/client';\nimport { EventCountConfig } from './event-count.model';\nimport { Observable } from 'rxjs';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { EventCountStrategy } from '../strategies/event-count-strategy';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Creates an Observable that tracks event count for a specific asset.\n * When real-time is paused and resumed, it re-fetches the current count from server\n * to account for events that occurred during the pause.\n *\n * @param config - Event filtering configuration (type, etc.)\n * @param asset - The managed object (device/asset) to track events for\n * @param dateFrom - Start date for counting events\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of event count values\n */\nexport function eventCountValue(\n config: EventCountConfig,\n asset: IManagedObject,\n dateFrom: Date,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<number> {\n const injector = inject(Injector);\n const strategy = new EventCountStrategy(config, asset, dateFrom, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { EventCountConfig } from './event-count.model';\nimport { eventCountValue } from './event-count-value';\nimport { Observable } from 'rxjs';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const eventCountToday: ComputedPropertyDefinition<\n ['device', 'group', 'asset'],\n EventCountConfig\n> = {\n name: 'eventCountToday',\n contextType: ['device', 'group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n eventCountToday: {\n label: 'Event count today',\n type: 'number'\n }\n }\n },\n name: 'eventCountToday',\n label: gettext('Event count today'),\n type: 'number',\n config: { type: '' },\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./event-count-config.component').then(m => m.ComputedPropertyEventCountConfigComponent),\n value: ({ config, context, metadata }) => eventCountTodayValue(config, context, metadata)\n};\n\nfunction eventCountTodayValue(\n config: EventCountConfig,\n asset: IManagedObject,\n metadata: ValueCallbackMetadata\n): Observable<number> {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n return eventCountValue(config, asset, today, metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { EventCountConfig } from './event-count.model';\nimport { eventCountValue } from './event-count-value';\nimport { Observable } from 'rxjs';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const eventCount3Months: ComputedPropertyDefinition<\n ['device', 'group', 'asset'],\n EventCountConfig\n> = {\n name: 'eventCount3Months',\n contextType: ['device', 'group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n eventCount3Months: {\n label: 'Event count 3 months',\n type: 'number'\n }\n }\n },\n name: 'eventCount3Months',\n label: gettext('Event count 3 months'),\n type: 'number',\n config: { type: '' },\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./event-count-config.component').then(m => m.ComputedPropertyEventCountConfigComponent),\n value: ({ config, context, metadata }) => eventCount3MonthsValue(config, context, metadata)\n};\n\nfunction eventCount3MonthsValue(\n config: EventCountConfig,\n asset: IManagedObject,\n metadata: ValueCallbackMetadata\n): Observable<number> {\n const threeMonthsAgo = new Date();\n threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);\n return eventCountValue(config, asset, threeMonthsAgo, metadata);\n}\n","import { ComputedPropertyDefinition } from '@c8y/ngx-components/asset-properties';\nimport { from, Observable, of, switchMap } from 'rxjs';\nimport { ConfigurationSnapshotConfig } from './configuration-snapshot.model';\nimport { IManagedObject, InventoryService } from '@c8y/client';\nimport { inject, Injector } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const configurationSnapshot: ComputedPropertyDefinition<\n ['device', 'asset'],\n ConfigurationSnapshotConfig\n> = {\n name: 'configurationSnapshot',\n contextType: ['device', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n configurationSnapshot: {\n label: 'Configuration snapshot',\n type: 'string'\n }\n }\n },\n contextType: ['device', 'asset'],\n name: 'configurationSnapshot',\n label: gettext('Configuration snapshot'),\n type: 'string',\n config: { legacy: true } as ConfigurationSnapshotConfig,\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./configuration-snapshot-config.component').then(\n m => m.ConfigurationSnapshotConfigComponent\n ),\n value: ({ config, context }) => configurationSnapshotValue(config, context)\n};\n\nfunction configurationSnapshotValue(\n config: ConfigurationSnapshotConfig,\n asset: IManagedObject\n): Observable<string> {\n if (config.legacy) {\n const configId = asset.c8y_ConfigurationDump?.id;\n if (!configId) {\n return of(null);\n }\n const injector = inject(Injector);\n const inventoryService = injector.get(InventoryService);\n return from(inventoryService.detail(configId)).pipe(\n switchMap(({ data }) => {\n return of(data?.name);\n })\n );\n } else {\n const fragment = `c8y_Configuration_${config.type}`;\n return of(asset[fragment]?.name);\n }\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { Observable } from 'rxjs';\nimport { childCountValue } from './child-count-value';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const childDevicesCount: ComputedPropertyDefinition<['group', 'device', 'asset']> = {\n name: 'childDevicesCount',\n contextType: ['group', 'device', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n childDevicesCount: {\n label: 'Number of child devices',\n type: 'number'\n }\n }\n },\n name: 'childDevicesCount',\n label: gettext('Number of child devices'),\n type: 'number',\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n value: ({ context, metadata }) => childDevicesCountValue(context, metadata)\n};\n\n/**\n * Creates an Observable that tracks the count of child devices for a specific asset.\n * Supports real-time updates when child devices are added or removed.\n *\n * @param asset - The managed object (asset) to track child devices for\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of child devices count values\n */\nexport function childDevicesCountValue(\n asset: IManagedObject,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<number> {\n return childCountValue(asset, metadata, 'childDevices');\n}\n","import { Injector } from '@angular/core';\nimport {\n AlarmService,\n EventService,\n IAlarm,\n IEvent,\n IManagedObject,\n IMeasurement,\n IOperation,\n MeasurementService,\n OperationService\n} from '@c8y/client';\nimport {\n AlarmRealtimeService,\n EventRealtimeService,\n MeasurementRealtimeService,\n OperationRealtimeService\n} from '@c8y/ngx-components';\nimport {\n catchError,\n combineLatest,\n filter,\n from,\n map,\n merge,\n Observable,\n of,\n scan,\n startWith\n} from 'rxjs';\nimport { ValueStrategy } from '../common/realtime-value-base';\n\nexport class LastDeviceMessageStrategy implements ValueStrategy<string> {\n private measurementService: MeasurementService;\n private measurementRealtime: MeasurementRealtimeService;\n private eventService: EventService;\n private eventRealtimeService: EventRealtimeService;\n private alarmService: AlarmService;\n private alarmRealtimeService: AlarmRealtimeService;\n private operationService: OperationService;\n private operationRealtimeService: OperationRealtimeService;\n private startTime: Date;\n\n constructor(\n private asset: IManagedObject,\n injector: Injector\n ) {\n this.measurementService = injector.get(MeasurementService);\n this.measurementRealtime = injector.get(MeasurementRealtimeService);\n this.eventService = injector.get(EventService);\n this.eventRealtimeService = injector.get(EventRealtimeService);\n this.alarmService = injector.get(AlarmService);\n this.alarmRealtimeService = injector.get(AlarmRealtimeService);\n this.operationService = injector.get(OperationService);\n this.operationRealtimeService = injector.get(OperationRealtimeService);\n this.startTime = new Date();\n }\n\n fetchCurrentValue(): Observable<string> {\n const fetchFilter = {\n source: this.asset.id,\n pageSize: 1,\n revert: true\n };\n\n const fetchLatestMeasurement = (): Observable<string | null> => {\n return from(this.measurementService.list(fetchFilter)).pipe(\n map(resp => resp.data?.[0]?.time || null),\n catchError(() => of(null))\n );\n };\n\n const fetchLatestEvent = (): Observable<string | null> => {\n return from(this.eventService.list(fetchFilter)).pipe(\n map(resp => resp.data?.[0]?.time || null),\n catchError(() => of(null))\n );\n };\n\n const fetchLatestAlarm = (): Observable<string | null> => {\n return from(this.alarmService.list(fetchFilter)).pipe(\n map(resp => resp.data?.[0]?.time || null),\n catchError(() => of(null))\n );\n };\n\n const fetchLatestOperation = (): Observable<string | null> => {\n return from(this.operationService.list(fetchFilter)).pipe(\n map(resp => resp.data?.[0]?.creationTime || null),\n catchError(() => of(null))\n );\n };\n\n return combineLatest([\n fetchLatestMeasurement(),\n fetchLatestEvent(),\n fetchLatestAlarm(),\n fetchLatestOperation()\n ]).pipe(\n map(timestamps => {\n const validTimestamps = timestamps.filter(Boolean) as string[];\n\n if (validTimestamps.length === 0) {\n return null;\n }\n\n const latest = validTimestamps.reduce((latest, current) => {\n return new Date(current) > new Date(latest) ? current : latest;\n });\n\n // Update start time for realtime filtering\n this.startTime = new Date();\n return latest;\n })\n );\n }\n\n createRealtimeStream(initialValue: string): Observable<string> {\n const measurementStream$ = this.measurementRealtime.onAll$(this.asset.id).pipe(\n map(({ data }) => (data as IMeasurement).time),\n filter(time => new Date(time) > this.startTime)\n );\n\n const eventStream$ = this.eventRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => (data as IEvent).time),\n filter(time => new Date(time) > this.startTime)\n );\n\n const alarmStream$ = this.alarmRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => (data as IAlarm).time),\n filter(time => time && new Date(time) > this.startTime)\n );\n\n const operationStream$ = this.operationRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => (data as IOperation).creationTime),\n filter(time => time && new Date(time) > this.startTime)\n );\n\n return merge(measurementStream$, eventStream$, alarmStream$, operationStream$).pipe(\n scan((latestTimestamp, newTimestamp) => {\n return new Date(newTimestamp) > new Date(latestTimestamp) ? newTimestamp : latestTimestamp;\n }, initialValue),\n startWith(initialValue)\n );\n }\n}\n","import { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { IManagedObject } from '@c8y/client';\nimport { inject, Injector } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { LastDeviceMessageStrategy } from '../strategies/last-device-message-strategy';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Gets the latest timestamp from events, alarms, measurements, and operations for a device.\n * Returns the most recent timestamp across all these sources.\n *\n * @param asset - The managed object (device/asset) to track\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<string> - Stream of latest timestamp values\n */\nexport function getLastDeviceMessage(\n asset: IManagedObject,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<string> {\n const injector = inject(Injector);\n const strategy = new LastDeviceMessageStrategy(asset, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { ComputedPropertyDefinition } from '@c8y/ngx-components/asset-properties';\nimport { getLastDeviceMessage } from './last-device-message-value';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const lastDeviceMessage: ComputedPropertyDefinition<['device']> = {\n name: 'lastDeviceMessage',\n contextType: ['device'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n lastDeviceMessage: {\n label: 'Last device message',\n type: 'string'\n }\n }\n },\n name: 'lastDeviceMessage',\n label: gettext('Last device message'),\n printFormat: 'datetime',\n type: 'string',\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n value: ({ context }) => {\n return getLastDeviceMessage(context);\n }\n};\n","import { hookComputedProperty } from '@c8y/ngx-components/asset-properties';\nimport { lastMeasurement } from './last-measurement/last-measurement-computed-property';\nimport { childAssetsCount } from './child-count/child-assets-count-computed-property';\nimport {\n AlarmRealtimeService,\n EventRealtimeService,\n ManagedObjectRealtimeService,\n MeasurementRealtimeService,\n OperationRealtimeService\n} from '@c8y/ngx-components';\nimport { alarmCount3Months } from './alarm-count/alarm-count-3-months-computed-property';\nimport { alarmCountToday } from './alarm-count/alarm-count-today-computed-property';\nimport { eventCountToday } from './event-count/event-count-today';\nimport { eventCount3Months } from './event-count/event-count-3-months';\nimport { configurationSnapshot } from './configuration-snapshot/configuration-snapshot-computed-property';\nimport { childDevicesCount } from './child-count/child-devices-count-computed-property';\nimport { lastDeviceMessage } from './last-device-message/last-device-message-computed-property';\n\nexport const computedAssetPropertiesProviders = [\n AlarmRealtimeService,\n EventRealtimeService,\n MeasurementRealtimeService,\n OperationRealtimeService,\n ManagedObjectRealtimeService,\n hookComputedProperty([\n lastMeasurement,\n lastDeviceMessage,\n childAssetsCount,\n childDevicesCount,\n alarmCount3Months,\n alarmCountToday,\n eventCountToday,\n eventCount3Months,\n configurationSnapshot\n ])\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MASa,uBAAuB,CAAA;IAMlC,WAAA,CACU,MAA6B,EACrC,QAAkB,EAAA;QADV,IAAA,CAAA,MAAM,GAAN,MAAM;QAGd,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAC1D,IAAI,CAAC,mBAAmB,GAAG,QAAQ,CAAC,GAAG,CAAC,0BAA0B,CAAC;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzD;IAEA,iBAAiB,GAAA;AACf,QAAA,MAAM,iBAAiB,GAAQ;AAC7B,YAAA,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;AAC1C,YAAA,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ;AAC1C,YAAA,QAAQ,EAAE,CAAC;AACX,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,QAAQ,EAAE,YAAY;AACtB,YAAA,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SACjC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAC/D,GAAG,CA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["../../computed-asset-properties/strategies/last-measurement-strategy.ts","../../computed-asset-properties/common/realtime-value-handler.ts","../../computed-asset-properties/last-measurement/last-measurement-value.ts","../../computed-asset-properties/last-measurement/last-measurement-computed-property.ts","../../computed-asset-properties/strategies/child-count-strategy.ts","../../computed-asset-properties/child-count/child-count-value.ts","../../computed-asset-properties/child-count/child-assets-count-computed-property.ts","../../computed-asset-properties/strategies/count-strategy-base.ts","../../computed-asset-properties/strategies/alarm-count-strategy.ts","../../computed-asset-properties/alarm-count/alarm-count-value.ts","../../computed-asset-properties/alarm-count/alarm-count-3-months-computed-property.ts","../../computed-asset-properties/alarm-count/alarm-count-today-computed-property.ts","../../computed-asset-properties/strategies/event-count-strategy.ts","../../computed-asset-properties/event-count/event-count-value.ts","../../computed-asset-properties/event-count/event-count-today.ts","../../computed-asset-properties/event-count/event-count-3-months.ts","../../computed-asset-properties/configuration-snapshot/configuration-snapshot-computed-property.ts","../../computed-asset-properties/child-count/child-devices-count-computed-property.ts","../../computed-asset-properties/strategies/last-device-message-strategy.ts","../../computed-asset-properties/last-device-message/last-device-message-value.ts","../../computed-asset-properties/last-device-message/last-device-message-computed-property.ts","../../computed-asset-properties/index.ts","../../computed-asset-properties/c8y-ngx-components-computed-asset-properties.ts"],"sourcesContent":["import { Injector } from '@angular/core';\nimport { IMeasurement, IMeasurementValue, MeasurementService } from '@c8y/client';\nimport { DatePipe, MeasurementRealtimeService } from '@c8y/ngx-components';\nimport { filter, from, map, Observable, startWith } from 'rxjs';\nimport { KPIDetails } from '@c8y/ngx-components/datapoint-selector';\nimport { LastMeasurementConfig } from '../last-measurement/last-measurement.model';\nimport { ValueStrategy } from '../common/realtime-value-base';\n\nexport class LastMeasurementStrategy implements ValueStrategy<string | IMeasurementValue> {\n private measurementService: MeasurementService;\n private measurementRealtime: MeasurementRealtimeService;\n private datapoint: KPIDetails;\n private datePipe: DatePipe;\n\n constructor(\n private config: LastMeasurementConfig,\n injector: Injector\n ) {\n this.measurementService = injector.get(MeasurementService);\n this.measurementRealtime = injector.get(MeasurementRealtimeService);\n this.datePipe = injector.get(DatePipe);\n this.datapoint = config.dp.filter(dp => dp.__active)[0];\n }\n\n fetchCurrentValue(): Observable<string | IMeasurementValue> {\n const measurementFilter: any = {\n valueFragmentSeries: this.datapoint.series,\n valueFragmentType: this.datapoint.fragment,\n pageSize: 1,\n revert: true,\n dateFrom: '1970-01-01',\n source: this.datapoint.__target.id\n };\n\n return from(this.measurementService.list(measurementFilter)).pipe(\n map(({ data }) => data[0]),\n filter(measurement => !!measurement),\n map(measurement => this.formatMeasurement(measurement))\n );\n }\n\n createRealtimeStream(initialValue: string): Observable<string | IMeasurementValue> {\n return this.measurementRealtime\n .onCreateOfSpecificMeasurement$(\n this.datapoint.fragment,\n this.datapoint.series,\n this.datapoint.__target\n )\n .pipe(\n map(measurement => this.formatMeasurement(measurement)),\n startWith(initialValue)\n );\n }\n\n private formatMeasurement(measurement: IMeasurement): string | IMeasurementValue {\n const resultType = this.config?.resultType;\n const fragment = this.datapoint.fragment;\n const series = this.datapoint.series;\n\n if (resultType === 1) {\n return measurement[fragment][series].value;\n } else if (resultType === 2) {\n return measurement[fragment][series].value + ' ' + measurement[fragment][series].unit;\n } else if (resultType === 3) {\n const date = this.datePipe.transform(new Date(measurement.time as string), 'short');\n return `${date} | ${measurement[fragment][series].value} ${measurement[fragment][series].unit}`;\n } else if (resultType === 4) {\n return measurement[fragment][series] as IMeasurementValue;\n }\n return '';\n }\n}\n","import {\n distinctUntilChanged,\n NEVER,\n Observable,\n pairwise,\n share,\n startWith,\n switchMap,\n take\n} from 'rxjs';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { ValueStrategy, RealtimeValueConfig } from './realtime-value-base';\n\n/**\n * Generic handler for realtime values following the three modes pattern\n * Closed for modification but open for extension through strategies\n */\nexport class RealtimeValueHandler<T> {\n private readonly config: Required<RealtimeValueConfig> = {\n refetchOnResume: true,\n preserveValueOnPause: true\n };\n\n constructor(\n private strategy: ValueStrategy<T>,\n config?: RealtimeValueConfig\n ) {\n if (config) {\n this.config = { ...this.config, ...config };\n }\n }\n\n /**\n * Creates an Observable based on the metadata mode\n */\n getValue(metadata: ValueCallbackMetadata = { mode: 'realtime' }): Observable<T> {\n if (metadata.mode === 'singleValue') {\n return this.strategy.fetchCurrentValue().pipe(take(1));\n }\n\n if (metadata.mode === 'realtime' && !metadata.realtimeControl$) {\n return this.handleUncontrolledRealtime();\n }\n\n if (metadata.mode === 'realtime' && metadata.realtimeControl$) {\n return this.handleControlledRealtime(metadata.realtimeControl$);\n }\n }\n\n private handleUncontrolledRealtime(): Observable<T> {\n return this.strategy\n .fetchCurrentValue()\n .pipe(switchMap(initialValue => this.strategy.createRealtimeStream(initialValue)));\n }\n\n private handleControlledRealtime(control$: Observable<boolean>): Observable<T> {\n const controlWithPrevious$ = control$.pipe(\n distinctUntilChanged(),\n startWith(null),\n pairwise(),\n share()\n );\n\n return controlWithPrevious$.pipe(\n switchMap(([previous, current]) => {\n if (!current) {\n // Realtime is disabled\n if (previous === null) {\n // Initial emission while disabled\n return this.strategy.fetchCurrentValue().pipe(take(1));\n } else if (this.config.preserveValueOnPause) {\n // Was previously enabled - preserve last value\n return NEVER;\n } else {\n // Don't preserve value - fetch current\n return this.strategy.fetchCurrentValue().pipe(take(1));\n }\n } else {\n // Realtime is enabled\n if (this.config.refetchOnResume || previous === null) {\n // Re-fetch current value and start streaming\n return this.strategy\n .fetchCurrentValue()\n .pipe(switchMap(currentValue => this.strategy.createRealtimeStream(currentValue)));\n } else {\n // Continue with realtime stream without re-fetching\n return this.strategy.createRealtimeStream(null as T);\n }\n }\n })\n );\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { LastMeasurementConfig } from './last-measurement.model';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { LastMeasurementStrategy } from '../strategies/last-measurement-strategy';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\nimport { IMeasurementValue } from '@c8y/client';\n\n/**\n * Creates an Observable that tracks the latest measurement value for a specific datapoint.\n * Combines initial server fetch with real-time measurement updates.\n *\n * @param config - Measurement configuration (datapoint, result type, etc.)\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<string> - Stream of measurement string values\n */\nexport function lastMeasurementValue(\n config: LastMeasurementConfig,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<string | IMeasurementValue> {\n const injector = inject(Injector);\n const strategy = new LastMeasurementStrategy(config, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { ComputedPropertyDefinition } from '@c8y/ngx-components/asset-properties';\nimport { LastMeasurementConfig } from './last-measurement.model';\nimport { lastMeasurementValue } from './last-measurement-value';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const lastMeasurement: ComputedPropertyDefinition<\n ['device', 'asset', 'group'],\n LastMeasurementConfig\n> = {\n name: 'lastMeasurement',\n contextType: ['device', 'asset', 'group'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n lastMeasurement: {\n label: 'Last measurement',\n type: 'string'\n }\n }\n },\n name: 'lastMeasurement',\n label: gettext('Last measurement'),\n type: 'string',\n config: { dp: [], resultType: 1 } as LastMeasurementConfig,\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./last-measurement-config.component').then(\n m => m.ComputedPropertyLastMeasurementConfigComponent\n ),\n value: ({ config }) => {\n return lastMeasurementValue(config);\n }\n};\n","import { Injector } from '@angular/core';\nimport { IManagedObject, InventoryService } from '@c8y/client';\nimport { ManagedObjectRealtimeService } from '@c8y/ngx-components';\nimport { from, map, Observable, startWith } from 'rxjs';\nimport { ValueStrategy } from '../common/realtime-value-base';\n\nexport class ChildCountStrategy implements ValueStrategy<number> {\n private inventoryService: InventoryService;\n private moRealtimeService: ManagedObjectRealtimeService;\n\n constructor(\n private asset: IManagedObject,\n private childType: 'childDevices' | 'childAssets',\n injector: Injector\n ) {\n this.inventoryService = injector.get(InventoryService);\n this.moRealtimeService = injector.get(ManagedObjectRealtimeService);\n }\n\n fetchCurrentValue(): Observable<number> {\n return from(this.inventoryService.detail(this.asset.id, { withChildren: true })).pipe(\n map(resp => resp?.data?.[this.childType]?.references?.length || 0)\n );\n }\n\n createRealtimeStream(initialValue: number): Observable<number> {\n return this.moRealtimeService.onAll$(this.asset.id).pipe(\n map(resp => (resp?.data as IManagedObject)?.[this.childType]?.references?.length || 0),\n startWith(initialValue)\n );\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport { IManagedObject } from '@c8y/client';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { Observable } from 'rxjs';\nimport { ChildCountStrategy } from '../strategies/child-count-strategy';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Shared function that tracks the count of child items (devices or assets) for a specific managed object.\n * Supports real-time updates when child items are added or removed.\n *\n * @param asset - The managed object to track child items for\n * @param childType - Type of child items ('childDevices' or 'childAssets')\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of child items count values\n */\nexport function childCountValue(\n asset: IManagedObject,\n metadata: ValueCallbackMetadata = { mode: 'realtime' },\n childType: 'childDevices' | 'childAssets'\n): Observable<number> {\n const injector = inject(Injector);\n const strategy = new ChildCountStrategy(asset, childType, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { Observable } from 'rxjs';\nimport { childCountValue } from './child-count-value';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const childAssetsCount: ComputedPropertyDefinition<['group', 'asset']> = {\n name: 'childAssetsCount',\n contextType: ['group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n childAssetsCount: {\n label: 'Number of child assets',\n type: 'number'\n }\n }\n },\n name: 'childAssetsCount',\n label: gettext('Number of child assets'),\n type: 'number',\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n value: ({ context, metadata }) => childAssetsCountValue(context, metadata)\n};\n\n/**\n * Creates an Observable that tracks the count of child assets for a specific asset.\n * Supports real-time updates when child assets are added or removed.\n *\n * @param asset - The managed object (asset) to track child assets for\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of child assets count values\n */\nexport function childAssetsCountValue(\n asset: IManagedObject,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<number> {\n return childCountValue(asset, metadata, 'childAssets');\n}\n","import { Observable, scan, startWith } from 'rxjs';\nimport { ValueStrategy } from '../common/realtime-value-base';\n\n/**\n * Base class for count-based strategies\n * Provides common accumulation logic\n */\nexport abstract class CountStrategyBase implements ValueStrategy<number> {\n abstract fetchCurrentValue(): Observable<number>;\n abstract getRealtimeIncrement$(): Observable<number>;\n\n createRealtimeStream(initialValue: number): Observable<number> {\n return this.getRealtimeIncrement$().pipe(\n scan((count, increment) => count + increment, initialValue),\n startWith(initialValue)\n );\n }\n}\n","import { Injector } from '@angular/core';\nimport {\n AlarmQueryFilter,\n AlarmService,\n IAlarm,\n IManagedObject,\n SeverityFilter\n} from '@c8y/client';\nimport { AlarmRealtimeService } from '@c8y/ngx-components';\nimport { filter, from, map, Observable, tap } from 'rxjs';\nimport { AlarmCountConfig } from '../alarm-count/alarm-count.model';\nimport { CountStrategyBase } from './count-strategy-base';\n\nexport class AlarmCountStrategy extends CountStrategyBase {\n private alarmService: AlarmService;\n private alarmRealtimeService: AlarmRealtimeService;\n private startTime: Date;\n\n constructor(\n private config: AlarmCountConfig,\n private asset: IManagedObject,\n private dateFrom: Date,\n injector: Injector\n ) {\n super();\n this.alarmService = injector.get(AlarmService);\n this.alarmRealtimeService = injector.get(AlarmRealtimeService);\n this.startTime = new Date();\n }\n\n fetchCurrentValue(): Observable<number> {\n const severities: SeverityFilter[] = Object.keys(this.config.severities || {}).filter(\n key => this.config.severities[key]\n ) as SeverityFilter[];\n\n const filters: AlarmQueryFilter = {\n source: this.asset.id,\n dateFrom: this.dateFrom.toISOString(),\n type: this.config.type,\n pageSize: 1,\n withTotalElements: true,\n ...(severities.length && { severity: severities.join(',') })\n };\n\n return from(this.alarmService.list(filters)).pipe(\n map(resp => resp?.paging?.totalElements || 0),\n tap(() => (this.startTime = new Date())) // Update start time after fetch\n );\n }\n\n getRealtimeIncrement$(): Observable<number> {\n return this.alarmRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => data as IAlarm),\n filter(\n alarm =>\n alarm.type === this.config.type &&\n this.config.severities[alarm.severity] &&\n new Date(alarm.creationTime) > this.startTime\n ),\n tap(() => (this.startTime = new Date())),\n map(() => 1) // Each matching alarm increments by 1\n );\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport { IManagedObject } from '@c8y/client';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { Observable } from 'rxjs';\nimport { AlarmCountStrategy } from '../strategies/alarm-count-strategy';\nimport { AlarmCountConfig } from './alarm-count.model';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Creates an Observable that tracks alarm count for a specific asset.\n * When real-time is paused and resumed, it re-fetches the current count from server\n * to account for alarms that occurred during the pause.\n *\n * @param config - Alarm filtering configuration (type, severities, etc.)\n * @param asset - The managed object (device/asset) to track alarms for\n * @param dateFrom - Start date for counting alarms\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of alarm count values\n */\nexport function alarmCountValue(\n config: AlarmCountConfig,\n asset: IManagedObject,\n dateFrom: Date,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<number> {\n const injector = inject(Injector);\n const strategy = new AlarmCountStrategy(config, asset, dateFrom, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { AlarmCountConfig } from './alarm-count.model';\nimport { alarmCountValue } from './alarm-count-value';\nimport { Observable } from 'rxjs';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const alarmCount3Months: ComputedPropertyDefinition<\n ['device', 'group', 'asset'],\n AlarmCountConfig\n> = {\n name: 'alarmCount3Months',\n contextType: ['device', 'group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n alarmCount3Months: {\n label: 'Alarm count 3 months',\n type: 'number'\n }\n }\n },\n name: 'alarmCount3Months',\n label: gettext('Alarm count 3 months'),\n type: 'number',\n config: { type: '' } as AlarmCountConfig,\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./alarm-count-config.component').then(m => m.ComputedPropertyAlarmCountConfigComponent),\n value: ({ config, context, metadata }) => alarmCount3MonthsValue(config, context, metadata)\n};\n\nfunction alarmCount3MonthsValue(\n config: AlarmCountConfig,\n asset: IManagedObject,\n metadata: ValueCallbackMetadata\n): Observable<number> {\n const threeMonthsAgo = new Date();\n threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);\n return alarmCountValue(config, asset, threeMonthsAgo, metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { AlarmCountConfig } from './alarm-count.model';\nimport { alarmCountValue } from './alarm-count-value';\nimport { Observable } from 'rxjs';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const alarmCountToday: ComputedPropertyDefinition<\n ['device', 'group', 'asset'],\n AlarmCountConfig\n> = {\n name: 'alarmCountToday',\n contextType: ['device', 'group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n alarmCountToday: {\n label: 'Alarm count today',\n type: 'number'\n }\n }\n },\n name: 'alarmCountToday',\n label: gettext('Alarm count today'),\n type: 'number',\n config: { type: '' } as AlarmCountConfig,\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./alarm-count-config.component').then(m => m.ComputedPropertyAlarmCountConfigComponent),\n value: ({ config, context, metadata }) => alarmCountTodayValue(config, context, metadata)\n};\n\nfunction alarmCountTodayValue(\n config: AlarmCountConfig,\n asset: IManagedObject,\n metadata: ValueCallbackMetadata\n): Observable<number> {\n const oneDayAgo = new Date();\n oneDayAgo.setDate(oneDayAgo.getDate() - 1);\n return alarmCountValue(config, asset, oneDayAgo, metadata);\n}\n","import { Injector } from '@angular/core';\nimport { EventService, IEvent, IManagedObject } from '@c8y/client';\nimport { EventRealtimeService } from '@c8y/ngx-components';\nimport { filter, from, map, Observable } from 'rxjs';\nimport { EventCountConfig } from '../event-count/event-count.model';\nimport { CountStrategyBase } from './count-strategy-base';\n\nexport class EventCountStrategy extends CountStrategyBase {\n private eventService: EventService;\n private eventRealtimeService: EventRealtimeService;\n\n constructor(\n private config: EventCountConfig,\n private asset: IManagedObject,\n private dateFrom: Date,\n injector: Injector\n ) {\n super();\n this.eventService = injector.get(EventService);\n this.eventRealtimeService = injector.get(EventRealtimeService);\n }\n\n fetchCurrentValue(): Observable<number> {\n const filters = {\n source: this.asset.id,\n dateFrom: this.dateFrom.toISOString(),\n type: this.config.type,\n pageSize: 1,\n withTotalElements: true\n };\n\n return from(this.eventService.list(filters)).pipe(\n map(resp => resp?.paging?.totalElements || 0)\n );\n }\n\n getRealtimeIncrement$(): Observable<number> {\n return this.eventRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => data as IEvent),\n filter(event => event.type === this.config.type && new Date(event.time) >= this.dateFrom),\n map(() => 1)\n );\n }\n}\n","import { inject, Injector } from '@angular/core';\nimport { IManagedObject } from '@c8y/client';\nimport { EventCountConfig } from './event-count.model';\nimport { Observable } from 'rxjs';\nimport { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { EventCountStrategy } from '../strategies/event-count-strategy';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Creates an Observable that tracks event count for a specific asset.\n * When real-time is paused and resumed, it re-fetches the current count from server\n * to account for events that occurred during the pause.\n *\n * @param config - Event filtering configuration (type, etc.)\n * @param asset - The managed object (device/asset) to track events for\n * @param dateFrom - Start date for counting events\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of event count values\n */\nexport function eventCountValue(\n config: EventCountConfig,\n asset: IManagedObject,\n dateFrom: Date,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<number> {\n const injector = inject(Injector);\n const strategy = new EventCountStrategy(config, asset, dateFrom, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { EventCountConfig } from './event-count.model';\nimport { eventCountValue } from './event-count-value';\nimport { Observable } from 'rxjs';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const eventCountToday: ComputedPropertyDefinition<\n ['device', 'group', 'asset'],\n EventCountConfig\n> = {\n name: 'eventCountToday',\n contextType: ['device', 'group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n eventCountToday: {\n label: 'Event count today',\n type: 'number'\n }\n }\n },\n name: 'eventCountToday',\n label: gettext('Event count today'),\n type: 'number',\n config: { type: '' },\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./event-count-config.component').then(m => m.ComputedPropertyEventCountConfigComponent),\n value: ({ config, context, metadata }) => eventCountTodayValue(config, context, metadata)\n};\n\nfunction eventCountTodayValue(\n config: EventCountConfig,\n asset: IManagedObject,\n metadata: ValueCallbackMetadata\n): Observable<number> {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n return eventCountValue(config, asset, today, metadata);\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { EventCountConfig } from './event-count.model';\nimport { eventCountValue } from './event-count-value';\nimport { Observable } from 'rxjs';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const eventCount3Months: ComputedPropertyDefinition<\n ['device', 'group', 'asset'],\n EventCountConfig\n> = {\n name: 'eventCount3Months',\n contextType: ['device', 'group', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n eventCount3Months: {\n label: 'Event count 3 months',\n type: 'number'\n }\n }\n },\n name: 'eventCount3Months',\n label: gettext('Event count 3 months'),\n type: 'number',\n config: { type: '' },\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./event-count-config.component').then(m => m.ComputedPropertyEventCountConfigComponent),\n value: ({ config, context, metadata }) => eventCount3MonthsValue(config, context, metadata)\n};\n\nfunction eventCount3MonthsValue(\n config: EventCountConfig,\n asset: IManagedObject,\n metadata: ValueCallbackMetadata\n): Observable<number> {\n const threeMonthsAgo = new Date();\n threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);\n return eventCountValue(config, asset, threeMonthsAgo, metadata);\n}\n","import { ComputedPropertyDefinition } from '@c8y/ngx-components/asset-properties';\nimport { from, Observable, of, switchMap } from 'rxjs';\nimport { ConfigurationSnapshotConfig } from './configuration-snapshot.model';\nimport { IManagedObject, InventoryService } from '@c8y/client';\nimport { inject, Injector } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const configurationSnapshot: ComputedPropertyDefinition<\n ['device', 'asset'],\n ConfigurationSnapshotConfig\n> = {\n name: 'configurationSnapshot',\n contextType: ['device', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n configurationSnapshot: {\n label: 'Configuration snapshot',\n type: 'string'\n }\n }\n },\n contextType: ['device', 'asset'],\n name: 'configurationSnapshot',\n label: gettext('Configuration snapshot'),\n type: 'string',\n config: { legacy: true } as ConfigurationSnapshotConfig,\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n loadConfigComponent: () =>\n import('./configuration-snapshot-config.component').then(\n m => m.ConfigurationSnapshotConfigComponent\n ),\n value: ({ config, context }) => configurationSnapshotValue(config, context)\n};\n\nfunction configurationSnapshotValue(\n config: ConfigurationSnapshotConfig,\n asset: IManagedObject\n): Observable<string> {\n if (config.legacy) {\n const configId = asset.c8y_ConfigurationDump?.id;\n if (!configId) {\n return of(null);\n }\n const injector = inject(Injector);\n const inventoryService = injector.get(InventoryService);\n return from(inventoryService.detail(configId)).pipe(\n switchMap(({ data }) => {\n return of(data?.name);\n })\n );\n } else {\n const fragment = `c8y_Configuration_${config.type}`;\n return of(asset[fragment]?.name);\n }\n}\n","import { IManagedObject } from '@c8y/client';\nimport {\n ComputedPropertyDefinition,\n ValueCallbackMetadata\n} from '@c8y/ngx-components/asset-properties';\nimport { Observable } from 'rxjs';\nimport { childCountValue } from './child-count-value';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const childDevicesCount: ComputedPropertyDefinition<['group', 'device', 'asset']> = {\n name: 'childDevicesCount',\n contextType: ['group', 'device', 'asset'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n childDevicesCount: {\n label: 'Number of child devices',\n type: 'number'\n }\n }\n },\n name: 'childDevicesCount',\n label: gettext('Number of child devices'),\n type: 'number',\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n value: ({ context, metadata }) => childDevicesCountValue(context, metadata)\n};\n\n/**\n * Creates an Observable that tracks the count of child devices for a specific asset.\n * Supports real-time updates when child devices are added or removed.\n *\n * @param asset - The managed object (asset) to track child devices for\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<number> - Stream of child devices count values\n */\nexport function childDevicesCountValue(\n asset: IManagedObject,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<number> {\n return childCountValue(asset, metadata, 'childDevices');\n}\n","import { Injector } from '@angular/core';\nimport {\n AlarmService,\n EventService,\n IAlarm,\n IEvent,\n IManagedObject,\n IMeasurement,\n IOperation,\n MeasurementService,\n OperationService\n} from '@c8y/client';\nimport {\n AlarmRealtimeService,\n EventRealtimeService,\n MeasurementRealtimeService,\n OperationRealtimeService\n} from '@c8y/ngx-components';\nimport {\n catchError,\n combineLatest,\n filter,\n from,\n map,\n merge,\n Observable,\n of,\n scan,\n startWith\n} from 'rxjs';\nimport { ValueStrategy } from '../common/realtime-value-base';\n\nexport class LastDeviceMessageStrategy implements ValueStrategy<string> {\n private measurementService: MeasurementService;\n private measurementRealtime: MeasurementRealtimeService;\n private eventService: EventService;\n private eventRealtimeService: EventRealtimeService;\n private alarmService: AlarmService;\n private alarmRealtimeService: AlarmRealtimeService;\n private operationService: OperationService;\n private operationRealtimeService: OperationRealtimeService;\n private startTime: Date;\n\n constructor(\n private asset: IManagedObject,\n injector: Injector\n ) {\n this.measurementService = injector.get(MeasurementService);\n this.measurementRealtime = injector.get(MeasurementRealtimeService);\n this.eventService = injector.get(EventService);\n this.eventRealtimeService = injector.get(EventRealtimeService);\n this.alarmService = injector.get(AlarmService);\n this.alarmRealtimeService = injector.get(AlarmRealtimeService);\n this.operationService = injector.get(OperationService);\n this.operationRealtimeService = injector.get(OperationRealtimeService);\n this.startTime = new Date();\n }\n\n fetchCurrentValue(): Observable<string> {\n const fetchFilter = {\n source: this.asset.id,\n pageSize: 1,\n revert: true\n };\n\n const fetchLatestMeasurement = (): Observable<string | null> => {\n return from(this.measurementService.list(fetchFilter)).pipe(\n map(resp => resp.data?.[0]?.time || null),\n catchError(() => of(null))\n );\n };\n\n const fetchLatestEvent = (): Observable<string | null> => {\n return from(this.eventService.list(fetchFilter)).pipe(\n map(resp => resp.data?.[0]?.time || null),\n catchError(() => of(null))\n );\n };\n\n const fetchLatestAlarm = (): Observable<string | null> => {\n return from(this.alarmService.list(fetchFilter)).pipe(\n map(resp => resp.data?.[0]?.time || null),\n catchError(() => of(null))\n );\n };\n\n const fetchLatestOperation = (): Observable<string | null> => {\n return from(this.operationService.list(fetchFilter)).pipe(\n map(resp => resp.data?.[0]?.creationTime || null),\n catchError(() => of(null))\n );\n };\n\n return combineLatest([\n fetchLatestMeasurement(),\n fetchLatestEvent(),\n fetchLatestAlarm(),\n fetchLatestOperation()\n ]).pipe(\n map(timestamps => {\n const validTimestamps = timestamps.filter(Boolean) as string[];\n\n if (validTimestamps.length === 0) {\n return null;\n }\n\n const latest = validTimestamps.reduce((latest, current) => {\n return new Date(current) > new Date(latest) ? current : latest;\n });\n\n // Update start time for realtime filtering\n this.startTime = new Date();\n return latest;\n })\n );\n }\n\n createRealtimeStream(initialValue: string): Observable<string> {\n const measurementStream$ = this.measurementRealtime.onAll$(this.asset.id).pipe(\n map(({ data }) => (data as IMeasurement).time),\n filter(time => new Date(time) > this.startTime)\n );\n\n const eventStream$ = this.eventRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => (data as IEvent).time),\n filter(time => new Date(time) > this.startTime)\n );\n\n const alarmStream$ = this.alarmRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => (data as IAlarm).time),\n filter(time => time && new Date(time) > this.startTime)\n );\n\n const operationStream$ = this.operationRealtimeService.onAll$(this.asset.id).pipe(\n map(({ data }) => (data as IOperation).creationTime),\n filter(time => time && new Date(time) > this.startTime)\n );\n\n return merge(measurementStream$, eventStream$, alarmStream$, operationStream$).pipe(\n scan((latestTimestamp, newTimestamp) => {\n return new Date(newTimestamp) > new Date(latestTimestamp) ? newTimestamp : latestTimestamp;\n }, initialValue),\n startWith(initialValue)\n );\n }\n}\n","import { ValueCallbackMetadata } from '@c8y/ngx-components/asset-properties';\nimport { IManagedObject } from '@c8y/client';\nimport { inject, Injector } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { LastDeviceMessageStrategy } from '../strategies/last-device-message-strategy';\nimport { RealtimeValueHandler } from '../common/realtime-value-handler';\n\n/**\n * Gets the latest timestamp from events, alarms, measurements, and operations for a device.\n * Returns the most recent timestamp across all these sources.\n *\n * @param asset - The managed object (device/asset) to track\n * @param metadata - Configuration controlling the behavior of the function\n * @returns Observable<string> - Stream of latest timestamp values\n */\nexport function getLastDeviceMessage(\n asset: IManagedObject,\n metadata: ValueCallbackMetadata = { mode: 'realtime' }\n): Observable<string> {\n const injector = inject(Injector);\n const strategy = new LastDeviceMessageStrategy(asset, injector);\n const handler = new RealtimeValueHandler(strategy);\n return handler.getValue(metadata);\n}\n","import { ComputedPropertyDefinition } from '@c8y/ngx-components/asset-properties';\nimport { getLastDeviceMessage } from './last-device-message-value';\nimport { gettext } from '@c8y/ngx-components/gettext';\n\nexport const lastDeviceMessage: ComputedPropertyDefinition<['device']> = {\n name: 'lastDeviceMessage',\n contextType: ['device'],\n prop: {\n c8y_JsonSchema: {\n properties: {\n lastDeviceMessage: {\n label: 'Last device message',\n type: 'string'\n }\n }\n },\n name: 'lastDeviceMessage',\n label: gettext('Last device message'),\n printFormat: 'datetime',\n type: 'string',\n computed: true,\n isEditable: false,\n isStandardProperty: true\n },\n value: ({ context }) => {\n return getLastDeviceMessage(context);\n }\n};\n","import { hookComputedProperty } from '@c8y/ngx-components/asset-properties';\nimport { lastMeasurement } from './last-measurement/last-measurement-computed-property';\nimport { childAssetsCount } from './child-count/child-assets-count-computed-property';\nimport {\n AlarmRealtimeService,\n EventRealtimeService,\n ManagedObjectRealtimeService,\n MeasurementRealtimeService,\n OperationRealtimeService\n} from '@c8y/ngx-components';\nimport { alarmCount3Months } from './alarm-count/alarm-count-3-months-computed-property';\nimport { alarmCountToday } from './alarm-count/alarm-count-today-computed-property';\nimport { eventCountToday } from './event-count/event-count-today';\nimport { eventCount3Months } from './event-count/event-count-3-months';\nimport { configurationSnapshot } from './configuration-snapshot/configuration-snapshot-computed-property';\nimport { childDevicesCount } from './child-count/child-devices-count-computed-property';\nimport { lastDeviceMessage } from './last-device-message/last-device-message-computed-property';\n\nexport const computedAssetPropertiesProviders = [\n AlarmRealtimeService,\n EventRealtimeService,\n MeasurementRealtimeService,\n OperationRealtimeService,\n ManagedObjectRealtimeService,\n hookComputedProperty([\n lastMeasurement,\n lastDeviceMessage,\n childAssetsCount,\n childDevicesCount,\n alarmCount3Months,\n alarmCountToday,\n eventCountToday,\n eventCount3Months,\n configurationSnapshot\n ])\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAQa,uBAAuB,CAAA;IAMlC,WAAA,CACU,MAA6B,EACrC,QAAkB,EAAA;QADV,IAAA,CAAA,MAAM,GAAN,MAAM;QAGd,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAC1D,IAAI,CAAC,mBAAmB,GAAG,QAAQ,CAAC,GAAG,CAAC,0BAA0B,CAAC;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzD;IAEA,iBAAiB,GAAA;AACf,QAAA,MAAM,iBAAiB,GAAQ;AAC7B,YAAA,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;AAC1C,YAAA,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ;AAC1C,YAAA,QAAQ,EAAE,CAAC;AACX,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,QAAQ,EAAE,YAAY;AACtB,YAAA,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SACjC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAC/D,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,EAC1B,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC,EACpC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CACxD;IACH;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AAI,oBAAoB,CAAC,QAAQ,CAAC;AAClD,IAAA,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACnC;;ACpBO,MAAM,iBAAiB,GAA2C;AACvE,IAAA,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,CAAC,QAAQ,CAAC;AACvB,IAAA,IAAI,EAAE;AACJ,QAAA,cAAc,EAAE;AACd,YAAA,UAAU,EAAE;AACV,gBAAA,iBAAiB,EAAE;AACjB,oBAAA,KAAK,EAAE,qBAAqB;AAC5B,oBAAA,IAAI,EAAE;AACP;AACF;AACF,SAAA;AACD,QAAA,IAAI,EAAE,mBAAmB;AACzB,QAAA,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC;AACrC,QAAA,WAAW,EAAE,UAAU;AACvB,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,UAAU,EAAE,KAAK;AACjB,QAAA,kBAAkB,EAAE;AACrB,KAAA;AACD,IAAA,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,KAAI;AACrB,QAAA,OAAO,oBAAoB,CAAC,OAAO,CAAC;IACtC;CACD;;ACTM,MAAM,gCAAgC,GAAG;IAC9C,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;IAC1B,wBAAwB;IACxB,4BAA4B;AAC5B,IAAA,oBAAoB,CAAC;QACnB,eAAe;QACf,iBAAiB;QACjB,gBAAgB;QAChB,iBAAiB;QACjB,iBAAiB;QACjB,eAAe;QACf,eAAe;QACf,iBAAiB;QACjB;KACD;;;AClCH;;AAEG;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Component, inject, InjectionToken, EventEmitter, Output, Input, TemplateRef, ViewChild, Optional, Inject, HostListener, HostBinding, NgModule } from '@angular/core';
3
3
  import * as i2 from '@c8y/ngx-components';
4
- import { IconDirective, C8yTranslatePipe, Permissions, ContextRouteService, Status, NavigatorNode, NEW_DASHBOARD_ROUTER_STATE_PROP, getActivatedRoute, ViewContext, TabsOutletComponent, memoize, hookGeneric, ExtensionPointForPlugins, fromTriggerOnce, getInjectedHooks, stateToFactory, ListGroupModule, C8yComponentOutlet, AlertService, DynamicComponentModule, DynamicComponentComponent, sortByPriority, isPromise, CoreModule, WIDGET_CONFIGURATION_GRID_SIZE, C8yTranslateDirective, HighlightComponent, EmptyStateComponent, FormGroupComponent, RequiredInputPlaceholderDirective, ProductExperienceDirective, ResizableGridComponent, DashboardChildChange, CopyDashboardDisabledReason, TitleComponent, ActionBarItemComponent, HelpComponent, WidgetsDashboardComponent, DatePipe, hookRoute, hookTab, hookNavigator } from '@c8y/ngx-components';
4
+ import { IconDirective, C8yTranslatePipe, Permissions, ContextRouteService, Status, NavigatorNode, NEW_DASHBOARD_ROUTER_STATE_PROP, getActivatedRoute, ViewContext, TabsOutletComponent, memoize, hookGeneric, ExtensionPointForPlugins, fromTriggerOnce, getInjectedHooks, stateToFactory, ListGroupModule, C8yComponentOutlet, AlertService, C8yTranslateDirective, DynamicComponentModule, DynamicComponentComponent, sortByPriority, isPromise, CoreModule, WIDGET_CONFIGURATION_GRID_SIZE, HighlightComponent, EmptyStateComponent, FormGroupComponent, RequiredInputPlaceholderDirective, ProductExperienceDirective, ResizableGridComponent, DashboardChildChange, CopyDashboardDisabledReason, TitleComponent, ActionBarItemComponent, HelpComponent, WidgetsDashboardComponent, DatePipe, hookRoute, hookTab, hookNavigator } from '@c8y/ngx-components';
5
5
  import * as i1 from '@angular/router';
6
6
  import { RouterOutlet, ActivatedRoute, RouterModule } from '@angular/router';
7
7
  import { of, Subject, from, combineLatest, map as map$1, timer, BehaviorSubject, tap as tap$1, withLatestFrom, mergeMap as mergeMap$1, shareReplay as shareReplay$1, merge, scan, debounceTime, isObservable, iif } from 'rxjs';
@@ -295,7 +295,7 @@ class ContextDashboardService {
295
295
  this._formDisabled = value;
296
296
  this.formDisabledSubject.next(value);
297
297
  }
298
- constructor(inventory, tabs, modal, translateService, router, navigator, permissions, alert, dynamicComponent, groupService, optionsService) {
298
+ constructor(inventory, tabs, modal, translateService, router, navigator, permissions, alert, dynamicComponent, groupService, optionsService, appStateService) {
299
299
  this.inventory = inventory;
300
300
  this.tabs = tabs;
301
301
  this.modal = modal;
@@ -307,6 +307,7 @@ class ContextDashboardService {
307
307
  this.dynamicComponent = dynamicComponent;
308
308
  this.groupService = groupService;
309
309
  this.optionsService = optionsService;
310
+ this.appStateService = appStateService;
310
311
  this.REPORT_PARTIAL_NAME = 'report_';
311
312
  this.VERSION_HISTORY_SIZE_LIMIT = 10;
312
313
  this.INVENTORY_ROLES = [
@@ -316,11 +317,13 @@ class ContextDashboardService {
316
317
  this.cache = new Map();
317
318
  this.DEFAULT_PAGESIZE = 1000;
318
319
  this.FRAGMENT_NAME = 'c8y_Dashboard';
320
+ this.APPLIED_TO_FRAGMENT = 'c8y_AppliedToApplications';
319
321
  this.DASHBOARD_ROUTE_PATH = 'dashboard';
320
322
  this.INDEX_SPLIT = '!';
321
323
  this.CACHE_TIMEOUT = 500;
322
324
  this._formDisabled = true;
323
325
  this.formDisabledSubject = new Subject();
326
+ this.appName = '';
324
327
  this.HIDE_TYPE_DASHBOARD_FOR_ASSETS = 'hideTypeDashboardForAssets';
325
328
  this.formDisabled$ = this.formDisabledSubject.asObservable();
326
329
  this.queriesUtil = new QueriesUtil();
@@ -334,6 +337,9 @@ class ContextDashboardService {
334
337
  assign(dashboard, { c8y_Global: {} });
335
338
  }
336
339
  dashboard.name = dashboard.c8y_Dashboard.name;
340
+ if (this.appStateService?.currentApplication?.value) {
341
+ dashboard[this.APPLIED_TO_FRAGMENT] = [this.appStateService?.currentApplication?.value.key];
342
+ }
337
343
  const { data } = dashboardType === ContextDashboardType.Group ||
338
344
  dashboardType === ContextDashboardType.Device ||
339
345
  (context?.contextData?.id && dashboardType === ContextDashboardType.Named)
@@ -351,7 +357,7 @@ class ContextDashboardService {
351
357
  const dashboardCfg = dashboard.c8y_Dashboard;
352
358
  dashboard.name = dashboard.c8y_Dashboard.name;
353
359
  assign(dashboard, this.adjustDashboardFor24Columns({ c8y_Dashboard: dashboardCfg }), this.updateDashboardHistory(dashboard, dashboardCfg));
354
- const keepFragments = this.clean(pick(dashboard, [this.FRAGMENT_NAME, 'id', 'name']));
360
+ const keepFragments = this.clean(pick(dashboard, [this.FRAGMENT_NAME, 'id', 'name', this.APPLIED_TO_FRAGMENT]));
355
361
  keepFragments.c8y_DashboardHistory = dashboard.c8y_DashboardHistory;
356
362
  await this.serializeWidgetConfigs(keepFragments);
357
363
  const [, dashboardTypeFragments] = this.getDashboardFragments(dashboard, context, '', true);
@@ -694,7 +700,11 @@ class ContextDashboardService {
694
700
  const finalFilterCriteria = typeFilterCriteria
695
701
  ? [...filterCriteria, typeFilterCriteria]
696
702
  : filterCriteria;
697
- const query = this.queriesUtil.buildQuery({ __filter: { __or: finalFilterCriteria } });
703
+ const query = this.queriesUtil.buildQuery({
704
+ __filter: {
705
+ __and: [{ __or: finalFilterCriteria }, this.appliedToFilter()]
706
+ }
707
+ });
698
708
  const now = Date.now();
699
709
  const cacheHasValidResponse = this.contextDashboardsCache &&
700
710
  this.contextDashboardsCache.query === query &&
@@ -712,6 +722,18 @@ class ContextDashboardService {
712
722
  };
713
723
  return this.contextDashboardsCache.result;
714
724
  }
725
+ appliedToFilter() {
726
+ const key = this.appStateService?.currentApplication?.value?.key || '';
727
+ if (!key) {
728
+ return {};
729
+ }
730
+ return {
731
+ __or: [
732
+ { __not: { __has: this.APPLIED_TO_FRAGMENT } }, // legacy / unlabeled ⇒ show in all
733
+ { [this.APPLIED_TO_FRAGMENT]: { __in: [key] } }
734
+ ]
735
+ };
736
+ }
715
737
  /**
716
738
  * Creates a tuple describing the dashboard type and its fragments. For assets like devices and groups, it's possible
717
739
  * to have two fragments: one indicating this particular device/asset with its ID, and the second indicating
@@ -991,13 +1013,13 @@ class ContextDashboardService {
991
1013
  [`c8y_Dashboard!name!${dashboardCfg.name}`]: {}
992
1014
  };
993
1015
  }
994
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ContextDashboardService, deps: [{ token: i1$1.InventoryService }, { token: i2.TabsService }, { token: i2.ModalService }, { token: i2$1.TranslateService }, { token: i1.Router }, { token: i2.NavigatorService }, { token: i2.Permissions }, { token: i2.AlertService }, { token: i2.DynamicComponentService }, { token: i2.GroupService }, { token: i2.OptionsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1016
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ContextDashboardService, deps: [{ token: i1$1.InventoryService }, { token: i2.TabsService }, { token: i2.ModalService }, { token: i2$1.TranslateService }, { token: i1.Router }, { token: i2.NavigatorService }, { token: i2.Permissions }, { token: i2.AlertService }, { token: i2.DynamicComponentService }, { token: i2.GroupService }, { token: i2.OptionsService }, { token: i2.AppStateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
995
1017
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ContextDashboardService, providedIn: 'root' }); }
996
1018
  }
997
1019
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ContextDashboardService, decorators: [{
998
1020
  type: Injectable,
999
1021
  args: [{ providedIn: 'root' }]
1000
- }], ctorParameters: () => [{ type: i1$1.InventoryService }, { type: i2.TabsService }, { type: i2.ModalService }, { type: i2$1.TranslateService }, { type: i1.Router }, { type: i2.NavigatorService }, { type: i2.Permissions }, { type: i2.AlertService }, { type: i2.DynamicComponentService }, { type: i2.GroupService }, { type: i2.OptionsService }] });
1022
+ }], ctorParameters: () => [{ type: i1$1.InventoryService }, { type: i2.TabsService }, { type: i2.ModalService }, { type: i2$1.TranslateService }, { type: i1.Router }, { type: i2.NavigatorService }, { type: i2.Permissions }, { type: i2.AlertService }, { type: i2.DynamicComponentService }, { type: i2.GroupService }, { type: i2.OptionsService }, { type: i2.AppStateService }] });
1001
1023
 
1002
1024
  const DEFAULT_DUPLICATE_WITHOUT_TYPE = () => {
1003
1025
  throw new Error('duplicateWithoutTypeFn Not implemented');
@@ -1856,6 +1878,11 @@ class WidgetAssetSelectorComponent {
1856
1878
  * If set to true, a device must be selected. Default is true.
1857
1879
  */
1858
1880
  this.isRequired = true;
1881
+ /**
1882
+ * Template for displaying device names with their IDs.
1883
+ * @ignore
1884
+ */
1885
+ this.deviceWithIdTpl = gettext('Device {{ id }}');
1859
1886
  }
1860
1887
  /**
1861
1888
  * @ignore
@@ -1878,7 +1905,7 @@ class WidgetAssetSelectorComponent {
1878
1905
  else if (this.isRequired && !this.hasContext(this.widgetConfigService.currentConfig)) {
1879
1906
  this.sectionComponent.section.expanded = true;
1880
1907
  }
1881
- else if (this.hasContext(this.widgetConfigService.currentConfig)) {
1908
+ else if (this.hasContext(this.widgetConfigService.currentConfig) && this.isRequired) {
1882
1909
  this.selectedDevice = this.widgetConfigService.currentConfig.settings?.context;
1883
1910
  }
1884
1911
  this.assetSelectorConfig = {
@@ -1914,11 +1941,15 @@ class WidgetAssetSelectorComponent {
1914
1941
  this.updateConfig($event.change.item);
1915
1942
  }
1916
1943
  }
1944
+ selectCurrentContext() {
1945
+ this.selectedDevice = this.widgetConfigService.currentConfig.settings?.context;
1946
+ this.updateConfig(this.selectedDevice);
1947
+ }
1917
1948
  updateConfig(device) {
1918
1949
  this.widgetConfigService.updateConfig({ device });
1919
1950
  }
1920
1951
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: WidgetAssetSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1921
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: WidgetAssetSelectorComponent, isStandalone: true, selector: "c8y-widget-asset-selector", inputs: { isRequired: "isRequired", showUnassigned: "showUnassigned", groupsSelectable: "groupsSelectable", assetSelectorConfig: "assetSelectorConfig", selectedDevice: "selectedDevice" }, host: { classAttribute: "bg-level-1" }, ngImport: i0, template: "<div class=\"card borderless\">\n <div\n class=\"card-block p-0 bg-inherit\"\n style=\"height: 315px\"\n >\n <!-- \n ngIf is needed to avoid a race condition as \n asset-selector seems not to support dynamic config changes\n -->\n <c8y-asset-selector-miller\n class=\"d-block bg-inherit p-relative\"\n *ngIf=\"assetSelectorConfig\"\n (onSelected)=\"selectionChanged($event)\"\n [config]=\"assetSelectorConfig\"\n [asset]=\"(widgetConfigService.currentConfig$ | async).settings?.context\"\n [(ngModel)]=\"selectedDevice\"\n [required]=\"isRequired\"\n name=\"configAsset\"\n ></c8y-asset-selector-miller>\n </div>\n\n <c8y-widget-config-feedback>\n <span\n class=\"tag chip text-12 m-4\"\n [ngClass]=\"{\n 'tag--info': selectedDevice || !isRequired,\n 'tag--danger': !selectedDevice && isRequired\n }\"\n >\n <button\n class=\"btn-clean text-12 m-r-4\"\n title=\"{{ 'Deselect' | translate }}\"\n type=\"button\"\n *ngIf=\"selectedDevice\"\n (click)=\"selectedDevice = null; updateConfig(null)\"\n >\n <i c8yIcon=\"times\"></i>\n </button>\n <span\n class=\"text-truncate\"\n title=\"{{ selectedDevice.name || 'Device ' + selectedDevice.id }}\"\n *ngIf=\"selectedDevice\"\n >\n {{ selectedDevice.name || 'Device ' + selectedDevice.id }}\n </span>\n <span\n *ngIf=\"!selectedDevice\"\n translate\n >\n No asset selected\n </span>\n </span>\n </c8y-widget-config-feedback>\n</div>\n", dependencies: [{ kind: "ngmodule", type: AssetSelectorModule }, { kind: "component", type: i1$2.MillerViewComponent, selector: "c8y-asset-selector-miller", inputs: ["config", "asset", "selectedDevice", "rootNode", "container"], outputs: ["onSelected", "onClearSelected"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: WidgetConfigFeedbackComponent, selector: "c8y-widget-config-feedback" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] }); }
1952
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: WidgetAssetSelectorComponent, isStandalone: true, selector: "c8y-widget-asset-selector", inputs: { isRequired: "isRequired", showUnassigned: "showUnassigned", groupsSelectable: "groupsSelectable", assetSelectorConfig: "assetSelectorConfig", selectedDevice: "selectedDevice" }, host: { classAttribute: "bg-level-1" }, ngImport: i0, template: "<div class=\"card borderless\">\n <div\n class=\"card-block p-0 bg-inherit\"\n style=\"height: 315px\"\n >\n <div\n class=\"alert alert-info m-4\"\n *ngIf=\"widgetConfigService.isDeviceTypeDashboard$ | async\"\n >\n <i class=\"fa fa-info-circle m-r-4\"></i>\n <span translate>\n This widget is used within a dashboard template, so the asset selector is unavailable. The\n widget automatically inherits the asset from the context in which the dashboard is\n displayed.\n </span>\n\n <div\n class=\"p-t-8\"\n *ngIf=\"!isRequired\"\n >\n <p translate>Asset selection is optional for this widget.</p>\n <button\n class=\"btn btn-primary btn-sm m-t-8\"\n *ngIf=\"!selectedDevice\"\n (click)=\"selectCurrentContext()\"\n ngNonBindable\n translate\n [translateParams]=\"{\n deviceName:\n (widgetConfigService.currentConfig$ | async)?.settings?.context?.name ||\n (deviceWithIdTpl\n | translate\n : { id: (widgetConfigService.currentConfig$ | async)?.settings?.context?.id })\n }\"\n >\n Use context asset \"{{ deviceName }}\"\n </button>\n <button\n class=\"btn btn-default btn-sm m-t-8\"\n *ngIf=\"selectedDevice\"\n (click)=\"selectedDevice = null; updateConfig(null)\"\n ngNonBindable\n translate\n [translateParams]=\"{\n deviceName:\n selectedDevice.name || (deviceWithIdTpl | translate: { id: selectedDevice.id })\n }\"\n >\n Use without asset \"{{ deviceName }}\"\n </button>\n </div>\n </div>\n <c8y-asset-selector-miller\n class=\"d-block bg-inherit p-relative\"\n name=\"configAsset\"\n *ngIf=\"!(widgetConfigService.isDeviceTypeDashboard$ | async) && assetSelectorConfig\"\n (onSelected)=\"selectionChanged($event)\"\n [config]=\"assetSelectorConfig\"\n [asset]=\"(widgetConfigService.currentConfig$ | async).settings?.context\"\n [(ngModel)]=\"selectedDevice\"\n [required]=\"isRequired\"\n ></c8y-asset-selector-miller>\n\n <c8y-widget-config-feedback>\n <span\n class=\"tag chip text-12 m-4\"\n [ngClass]=\"{\n 'tag--info': selectedDevice || !isRequired,\n 'tag--danger': !selectedDevice && isRequired\n }\"\n >\n <button\n class=\"btn-clean text-12 m-r-4\"\n title=\"{{ 'Deselect' | translate }}\"\n type=\"button\"\n *ngIf=\"\n selectedDevice &&\n (!(widgetConfigService.isDeviceTypeDashboard$ | async) ||\n (!isRequired && (widgetConfigService.isDeviceTypeDashboard$ | async)))\n \"\n (click)=\"selectedDevice = null; updateConfig(null)\"\n >\n <i c8yIcon=\"times\"></i>\n </button>\n <span\n class=\"text-truncate\"\n title=\"{{\n selectedDevice.name || (deviceWithIdTpl | translate: { id: selectedDevice.id })\n }}\"\n *ngIf=\"selectedDevice\"\n >\n {{ selectedDevice.name || (deviceWithIdTpl | translate: { id: selectedDevice.id }) }}\n </span>\n <span\n *ngIf=\"!selectedDevice\"\n translate\n >\n No asset selected\n </span>\n </span>\n </c8y-widget-config-feedback>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: AssetSelectorModule }, { kind: "component", type: i1$2.MillerViewComponent, selector: "c8y-asset-selector-miller", inputs: ["config", "asset", "selectedDevice", "rootNode", "container"], outputs: ["onSelected", "onClearSelected"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: WidgetConfigFeedbackComponent, selector: "c8y-widget-config-feedback" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: C8yTranslateDirective, selector: "[translate],[ngx-translate]" }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] }); }
1922
1953
  }
1923
1954
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: WidgetAssetSelectorComponent, decorators: [{
1924
1955
  type: Component,
@@ -1930,8 +1961,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
1930
1961
  NgClass,
1931
1962
  C8yTranslatePipe,
1932
1963
  IconDirective,
1933
- FormsModule
1934
- ], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], template: "<div class=\"card borderless\">\n <div\n class=\"card-block p-0 bg-inherit\"\n style=\"height: 315px\"\n >\n <!-- \n ngIf is needed to avoid a race condition as \n asset-selector seems not to support dynamic config changes\n -->\n <c8y-asset-selector-miller\n class=\"d-block bg-inherit p-relative\"\n *ngIf=\"assetSelectorConfig\"\n (onSelected)=\"selectionChanged($event)\"\n [config]=\"assetSelectorConfig\"\n [asset]=\"(widgetConfigService.currentConfig$ | async).settings?.context\"\n [(ngModel)]=\"selectedDevice\"\n [required]=\"isRequired\"\n name=\"configAsset\"\n ></c8y-asset-selector-miller>\n </div>\n\n <c8y-widget-config-feedback>\n <span\n class=\"tag chip text-12 m-4\"\n [ngClass]=\"{\n 'tag--info': selectedDevice || !isRequired,\n 'tag--danger': !selectedDevice && isRequired\n }\"\n >\n <button\n class=\"btn-clean text-12 m-r-4\"\n title=\"{{ 'Deselect' | translate }}\"\n type=\"button\"\n *ngIf=\"selectedDevice\"\n (click)=\"selectedDevice = null; updateConfig(null)\"\n >\n <i c8yIcon=\"times\"></i>\n </button>\n <span\n class=\"text-truncate\"\n title=\"{{ selectedDevice.name || 'Device ' + selectedDevice.id }}\"\n *ngIf=\"selectedDevice\"\n >\n {{ selectedDevice.name || 'Device ' + selectedDevice.id }}\n </span>\n <span\n *ngIf=\"!selectedDevice\"\n translate\n >\n No asset selected\n </span>\n </span>\n </c8y-widget-config-feedback>\n</div>\n" }]
1964
+ FormsModule,
1965
+ C8yTranslateDirective
1966
+ ], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], template: "<div class=\"card borderless\">\n <div\n class=\"card-block p-0 bg-inherit\"\n style=\"height: 315px\"\n >\n <div\n class=\"alert alert-info m-4\"\n *ngIf=\"widgetConfigService.isDeviceTypeDashboard$ | async\"\n >\n <i class=\"fa fa-info-circle m-r-4\"></i>\n <span translate>\n This widget is used within a dashboard template, so the asset selector is unavailable. The\n widget automatically inherits the asset from the context in which the dashboard is\n displayed.\n </span>\n\n <div\n class=\"p-t-8\"\n *ngIf=\"!isRequired\"\n >\n <p translate>Asset selection is optional for this widget.</p>\n <button\n class=\"btn btn-primary btn-sm m-t-8\"\n *ngIf=\"!selectedDevice\"\n (click)=\"selectCurrentContext()\"\n ngNonBindable\n translate\n [translateParams]=\"{\n deviceName:\n (widgetConfigService.currentConfig$ | async)?.settings?.context?.name ||\n (deviceWithIdTpl\n | translate\n : { id: (widgetConfigService.currentConfig$ | async)?.settings?.context?.id })\n }\"\n >\n Use context asset \"{{ deviceName }}\"\n </button>\n <button\n class=\"btn btn-default btn-sm m-t-8\"\n *ngIf=\"selectedDevice\"\n (click)=\"selectedDevice = null; updateConfig(null)\"\n ngNonBindable\n translate\n [translateParams]=\"{\n deviceName:\n selectedDevice.name || (deviceWithIdTpl | translate: { id: selectedDevice.id })\n }\"\n >\n Use without asset \"{{ deviceName }}\"\n </button>\n </div>\n </div>\n <c8y-asset-selector-miller\n class=\"d-block bg-inherit p-relative\"\n name=\"configAsset\"\n *ngIf=\"!(widgetConfigService.isDeviceTypeDashboard$ | async) && assetSelectorConfig\"\n (onSelected)=\"selectionChanged($event)\"\n [config]=\"assetSelectorConfig\"\n [asset]=\"(widgetConfigService.currentConfig$ | async).settings?.context\"\n [(ngModel)]=\"selectedDevice\"\n [required]=\"isRequired\"\n ></c8y-asset-selector-miller>\n\n <c8y-widget-config-feedback>\n <span\n class=\"tag chip text-12 m-4\"\n [ngClass]=\"{\n 'tag--info': selectedDevice || !isRequired,\n 'tag--danger': !selectedDevice && isRequired\n }\"\n >\n <button\n class=\"btn-clean text-12 m-r-4\"\n title=\"{{ 'Deselect' | translate }}\"\n type=\"button\"\n *ngIf=\"\n selectedDevice &&\n (!(widgetConfigService.isDeviceTypeDashboard$ | async) ||\n (!isRequired && (widgetConfigService.isDeviceTypeDashboard$ | async)))\n \"\n (click)=\"selectedDevice = null; updateConfig(null)\"\n >\n <i c8yIcon=\"times\"></i>\n </button>\n <span\n class=\"text-truncate\"\n title=\"{{\n selectedDevice.name || (deviceWithIdTpl | translate: { id: selectedDevice.id })\n }}\"\n *ngIf=\"selectedDevice\"\n >\n {{ selectedDevice.name || (deviceWithIdTpl | translate: { id: selectedDevice.id }) }}\n </span>\n <span\n *ngIf=\"!selectedDevice\"\n translate\n >\n No asset selected\n </span>\n </span>\n </c8y-widget-config-feedback>\n </div>\n</div>\n" }]
1935
1967
  }], propDecorators: { isRequired: [{
1936
1968
  type: Input
1937
1969
  }], showUnassigned: [{
@@ -1982,10 +2014,15 @@ class WidgetConfigService {
1982
2014
  this.widgetConfigSectionService = widgetConfigSectionService;
1983
2015
  this._currentConfig$ = new BehaviorSubject(null);
1984
2016
  this._instanceId$ = new BehaviorSubject(null);
2017
+ this._isDeviceTypeDashboard$ = new BehaviorSubject(false);
1985
2018
  /**
1986
2019
  * The unique identifier of the current widget instance.
1987
2020
  */
1988
2021
  this.instanceId$ = this._instanceId$.asObservable();
2022
+ /**
2023
+ * Indicates if the selected widget is placed on a device type dashboard.
2024
+ */
2025
+ this.isDeviceTypeDashboard$ = this._isDeviceTypeDashboard$.asObservable();
1989
2026
  /**
1990
2027
  * The preview of the currently selected widget. If `null` no preview is shown
1991
2028
  * (except if the selected widget has no configuration).
@@ -2151,10 +2188,12 @@ class WidgetConfigService {
2151
2188
  * Select a widget
2152
2189
  * @param selected The widget to select.
2153
2190
  * @param identifier An optional unique identifier for the widget instance. Only used if the widget is not new.
2191
+ * @param isDeviceTypeDashboard Indicates if the selected widget is placed on a device-type dashboard. This is used to determine if the default asset selector should be shown.
2154
2192
  */
2155
- selectWidget(selected, identifier = null) {
2193
+ selectWidget(selected, identifier = null, isDeviceTypeDashboard = false) {
2156
2194
  this.selected$.next(selected);
2157
2195
  this._instanceId$.next(identifier);
2196
+ this._isDeviceTypeDashboard$.next(isDeviceTypeDashboard);
2158
2197
  }
2159
2198
  /**
2160
2199
  * Deselect the currently selected.
@@ -2521,7 +2560,7 @@ class WidgetConfigComponent {
2521
2560
  this.selected.data.title = this.selected.data.title || cmp.label;
2522
2561
  this.componentLabel = cmp.label;
2523
2562
  this.widgetConfigService.initConfig(this.widgetConfig);
2524
- this.widgetConfigService.selectWidget(this.selected, this.identifier);
2563
+ this.widgetConfigService.selectWidget(this.selected, this.identifier, this.isDeviceTypeDashboard);
2525
2564
  }
2526
2565
  search() {
2527
2566
  if (this.searchTerm.length > 0) {
@@ -2614,18 +2653,9 @@ class WidgetConfigComponent {
2614
2653
  const noDeviceTarget = widgetConfig.settings.ng1
2615
2654
  ? widgetConfig.settings.ng1.options.noDeviceTarget
2616
2655
  : widgetConfig.settings.noDeviceTarget;
2617
- if (isDeviceType) {
2618
- widgetConfig.settings.hideTarget = isDeviceType;
2619
- if (!noDeviceTarget) {
2620
- widgetConfig.device = {
2621
- id: this.context.id,
2622
- name: this.context.name
2623
- };
2624
- }
2625
- }
2626
- else if (this.context?.id && !noDeviceTarget) {
2627
- // if the widget is a new widget, we assign the current context
2628
- // as well to have the device available on init of the component
2656
+ const needsTargetAndIsDeviceType = isDeviceType && !noDeviceTarget && widgetConfig.device;
2657
+ const isNewWidgetWithContext = !this.isEdit && this.context?.id && !noDeviceTarget;
2658
+ if (needsTargetAndIsDeviceType || isNewWidgetWithContext) {
2629
2659
  widgetConfig.device = {
2630
2660
  id: this.context.id,
2631
2661
  name: this.context.name