@c8y/ngx-components 1023.14.145 → 1023.14.146
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.
- package/context-dashboard/index.d.ts.map +1 -1
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs +4 -0
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-global-context.mjs +40 -12
- package/fesm2022/c8y-ngx-components-global-context.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-alarms-all-critical-alarms.mjs +3 -4
- package/fesm2022/c8y-ngx-components-widgets-definitions-alarms-all-critical-alarms.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-definitions-alarms-recent-alarms.mjs +3 -4
- package/fesm2022/c8y-ngx-components-widgets-definitions-alarms-recent-alarms.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-widgets-implementations-alarms.mjs +66 -59
- package/fesm2022/c8y-ngx-components-widgets-implementations-alarms.mjs.map +1 -1
- package/global-context/index.d.ts +87 -1
- package/global-context/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/widgets/definitions/alarms/all-critical-alarms/index.d.ts +1 -2
- package/widgets/definitions/alarms/all-critical-alarms/index.d.ts.map +1 -1
- package/widgets/definitions/alarms/recent-alarms/index.d.ts +1 -2
- package/widgets/definitions/alarms/recent-alarms/index.d.ts.map +1 -1
- package/widgets/implementations/alarms/index.d.ts +6 -1
- package/widgets/implementations/alarms/index.d.ts.map +1 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { gettext } from '@c8y/ngx-components/gettext';
|
|
2
2
|
import { DynamicComponentErrorStrategy, DynamicManagedObjectResolver, hookWidget } from '@c8y/ngx-components';
|
|
3
3
|
import { hookWidgetConfig } from '@c8y/ngx-components/context-dashboard';
|
|
4
|
+
import { PRESET_NAME } from '@c8y/ngx-components/global-context';
|
|
4
5
|
import { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';
|
|
5
6
|
import { importConfigWithDevice, exportConfigWithDevice } from '@c8y/ngx-components/widgets/import-export-config';
|
|
6
|
-
import { createLegacyAlarmControls } from '@c8y/ngx-components/widgets/definitions/alarms/alarm-widget-controls.presets';
|
|
7
7
|
|
|
8
|
-
const CRITICAL_ALARM_CONTROLS = createLegacyAlarmControls();
|
|
9
8
|
const criticalAlarmsWidgetDefinition = {
|
|
10
9
|
id: defaultWidgetIds.ALL_CRITICAL_ALARMS,
|
|
11
10
|
label: gettext('All critical alarms'),
|
|
@@ -20,7 +19,7 @@ const criticalAlarmsWidgetDefinition = {
|
|
|
20
19
|
schema: () => import('c8y-schema-loader?interfaceName=AlarmListWidgetConfig!@c8y/ngx-components/widgets/implementations/alarms'),
|
|
21
20
|
export: exportConfigWithDevice,
|
|
22
21
|
import: importConfigWithDevice,
|
|
23
|
-
|
|
22
|
+
controls: PRESET_NAME.ALARM_LIST_LEGACY,
|
|
24
23
|
settings: {
|
|
25
24
|
criticalAlarmsWidget: true,
|
|
26
25
|
noNewWidgets: true,
|
|
@@ -48,7 +47,7 @@ const criticalAlarmsWidgetProviders = [
|
|
|
48
47
|
priority: 10,
|
|
49
48
|
label: gettext('Time context'),
|
|
50
49
|
initialState: {
|
|
51
|
-
|
|
50
|
+
controls: PRESET_NAME.ALARM_LIST_CONFIG
|
|
52
51
|
},
|
|
53
52
|
loadComponent: () => import('@c8y/ngx-components/context-dashboard').then(m => m.GlobalContextSectionComponent)
|
|
54
53
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-widgets-definitions-alarms-all-critical-alarms.mjs","sources":["../../widgets/definitions/alarms/all-critical-alarms/index.ts","../../widgets/definitions/alarms/all-critical-alarms/c8y-ngx-components-widgets-definitions-alarms-all-critical-alarms.ts"],"sourcesContent":["import { gettext } from '@c8y/ngx-components/gettext';\nimport {\n DynamicComponentErrorStrategy,\n DynamicWidgetDefinition,\n hookWidget,\n DynamicManagedObjectResolver\n} from '@c8y/ngx-components';\nimport {\n GlobalContextSectionComponent,\n hookWidgetConfig\n} from '@c8y/ngx-components/context-dashboard';\nimport {
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-widgets-definitions-alarms-all-critical-alarms.mjs","sources":["../../widgets/definitions/alarms/all-critical-alarms/index.ts","../../widgets/definitions/alarms/all-critical-alarms/c8y-ngx-components-widgets-definitions-alarms-all-critical-alarms.ts"],"sourcesContent":["import { gettext } from '@c8y/ngx-components/gettext';\nimport {\n DynamicComponentErrorStrategy,\n DynamicWidgetDefinition,\n hookWidget,\n DynamicManagedObjectResolver\n} from '@c8y/ngx-components';\nimport {\n GlobalContextSectionComponent,\n hookWidgetConfig\n} from '@c8y/ngx-components/context-dashboard';\nimport { PRESET_NAME } from '@c8y/ngx-components/global-context';\nimport { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';\nimport {\n importConfigWithDevice,\n exportConfigWithDevice\n} from '@c8y/ngx-components/widgets/import-export-config';\n\nexport const criticalAlarmsWidgetDefinition = {\n id: defaultWidgetIds.ALL_CRITICAL_ALARMS,\n label: gettext('All critical alarms'),\n description: gettext(`Display all critical alarms from all devices`),\n loadComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/alarms').then(\n m => m.AlarmListWidgetComponent\n ),\n loadConfigComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/alarms').then(\n m => m.AlarmListWidgetConfigComponent\n ),\n resolve: {\n device: DynamicManagedObjectResolver\n },\n errorStrategy: DynamicComponentErrorStrategy.OVERLAY_ERROR,\n data: {\n schema: () =>\n import(\n 'c8y-schema-loader?interfaceName=AlarmListWidgetConfig!@c8y/ngx-components/widgets/implementations/alarms'\n ),\n export: exportConfigWithDevice,\n import: importConfigWithDevice,\n controls: PRESET_NAME.ALARM_LIST_LEGACY,\n settings: {\n criticalAlarmsWidget: true,\n noNewWidgets: true,\n widgetDefaults: {\n _width: 4,\n _height: 4\n },\n ng1: {\n options: {\n noDeviceTarget: false,\n groupsSelectable: true,\n deviceTargetNotRequired: true\n }\n }\n },\n displaySettings: {\n globalAutoRefreshContext: true\n }\n }\n} satisfies DynamicWidgetDefinition;\n\nexport const criticalAlarmsWidgetProviders = [\n hookWidget(criticalAlarmsWidgetDefinition),\n hookWidgetConfig<GlobalContextSectionComponent>({\n widgetId: defaultWidgetIds.ALL_CRITICAL_ALARMS,\n priority: 10,\n label: gettext('Time context'),\n initialState: {\n controls: PRESET_NAME.ALARM_LIST_CONFIG\n },\n loadComponent: () =>\n import('@c8y/ngx-components/context-dashboard').then(m => m.GlobalContextSectionComponent)\n })\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAkBO,MAAM,8BAA8B,GAAG;IAC5C,EAAE,EAAE,gBAAgB,CAAC,mBAAmB;AACxC,IAAA,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC;AACrC,IAAA,WAAW,EAAE,OAAO,CAAC,CAAA,4CAAA,CAA8C,CAAC;AACpE,IAAA,aAAa,EAAE,MACb,OAAO,oDAAoD,CAAC,CAAC,IAAI,CAC/D,CAAC,IAAI,CAAC,CAAC,wBAAwB,CAChC;AACH,IAAA,mBAAmB,EAAE,MACnB,OAAO,oDAAoD,CAAC,CAAC,IAAI,CAC/D,CAAC,IAAI,CAAC,CAAC,8BAA8B,CACtC;AACH,IAAA,OAAO,EAAE;AACP,QAAA,MAAM,EAAE;AACT,KAAA;IACD,aAAa,EAAE,6BAA6B,CAAC,aAAa;AAC1D,IAAA,IAAI,EAAE;AACJ,QAAA,MAAM,EAAE,MACN,OACE,0GAA0G,CAC3G;AACH,QAAA,MAAM,EAAE,sBAAsB;AAC9B,QAAA,MAAM,EAAE,sBAAsB;QAC9B,QAAQ,EAAE,WAAW,CAAC,iBAAiB;AACvC,QAAA,QAAQ,EAAE;AACR,YAAA,oBAAoB,EAAE,IAAI;AAC1B,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,cAAc,EAAE;AACd,gBAAA,MAAM,EAAE,CAAC;AACT,gBAAA,OAAO,EAAE;AACV,aAAA;AACD,YAAA,GAAG,EAAE;AACH,gBAAA,OAAO,EAAE;AACP,oBAAA,cAAc,EAAE,KAAK;AACrB,oBAAA,gBAAgB,EAAE,IAAI;AACtB,oBAAA,uBAAuB,EAAE;AAC1B;AACF;AACF,SAAA;AACD,QAAA,eAAe,EAAE;AACf,YAAA,wBAAwB,EAAE;AAC3B;AACF;;AAGI,MAAM,6BAA6B,GAAG;IAC3C,UAAU,CAAC,8BAA8B,CAAC;AAC1C,IAAA,gBAAgB,CAAgC;QAC9C,QAAQ,EAAE,gBAAgB,CAAC,mBAAmB;AAC9C,QAAA,QAAQ,EAAE,EAAE;AACZ,QAAA,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC;AAC9B,QAAA,YAAY,EAAE;YACZ,QAAQ,EAAE,WAAW,CAAC;AACvB,SAAA;AACD,QAAA,aAAa,EAAE,MACb,OAAO,uCAAuC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,6BAA6B;KAC5F;;;AC1EH;;AAEG;;;;"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { gettext } from '@c8y/ngx-components/gettext';
|
|
2
2
|
import { DynamicComponentErrorStrategy, DynamicManagedObjectResolver, hookWidget } from '@c8y/ngx-components';
|
|
3
3
|
import { hookWidgetConfig } from '@c8y/ngx-components/context-dashboard';
|
|
4
|
+
import { PRESET_NAME } from '@c8y/ngx-components/global-context';
|
|
4
5
|
import { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';
|
|
5
6
|
import { importConfigWithDevice, exportConfigWithDevice } from '@c8y/ngx-components/widgets/import-export-config';
|
|
6
|
-
import { createLegacyAlarmControls } from '@c8y/ngx-components/widgets/definitions/alarms/alarm-widget-controls.presets';
|
|
7
7
|
|
|
8
|
-
const RECENT_ALARM_CONTROLS = createLegacyAlarmControls();
|
|
9
8
|
const recentAlarmsDefinition = {
|
|
10
9
|
id: defaultWidgetIds.RECENT_ALARMS,
|
|
11
10
|
label: gettext('Recent alarms'),
|
|
@@ -20,7 +19,7 @@ const recentAlarmsDefinition = {
|
|
|
20
19
|
schema: () => import('c8y-schema-loader?interfaceName=AlarmListWidgetConfig!@c8y/ngx-components/widgets/implementations/alarms'),
|
|
21
20
|
export: exportConfigWithDevice,
|
|
22
21
|
import: importConfigWithDevice,
|
|
23
|
-
|
|
22
|
+
controls: PRESET_NAME.ALARM_LIST_LEGACY,
|
|
24
23
|
settings: {
|
|
25
24
|
recentAlarmsWidget: true,
|
|
26
25
|
noNewWidgets: true,
|
|
@@ -48,7 +47,7 @@ const recentAlarmsWidgetProviders = [
|
|
|
48
47
|
priority: 10,
|
|
49
48
|
label: gettext('Time context'),
|
|
50
49
|
initialState: {
|
|
51
|
-
|
|
50
|
+
controls: PRESET_NAME.ALARM_LIST_CONFIG
|
|
52
51
|
},
|
|
53
52
|
loadComponent: () => import('@c8y/ngx-components/context-dashboard').then(m => m.GlobalContextSectionComponent)
|
|
54
53
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c8y-ngx-components-widgets-definitions-alarms-recent-alarms.mjs","sources":["../../widgets/definitions/alarms/recent-alarms/index.ts","../../widgets/definitions/alarms/recent-alarms/c8y-ngx-components-widgets-definitions-alarms-recent-alarms.ts"],"sourcesContent":["import { gettext } from '@c8y/ngx-components/gettext';\nimport {\n DynamicWidgetDefinition,\n DynamicComponentErrorStrategy,\n hookWidget,\n DynamicManagedObjectResolver\n} from '@c8y/ngx-components';\nimport {\n GlobalContextSectionComponent,\n hookWidgetConfig\n} from '@c8y/ngx-components/context-dashboard';\nimport {
|
|
1
|
+
{"version":3,"file":"c8y-ngx-components-widgets-definitions-alarms-recent-alarms.mjs","sources":["../../widgets/definitions/alarms/recent-alarms/index.ts","../../widgets/definitions/alarms/recent-alarms/c8y-ngx-components-widgets-definitions-alarms-recent-alarms.ts"],"sourcesContent":["import { gettext } from '@c8y/ngx-components/gettext';\nimport {\n DynamicWidgetDefinition,\n DynamicComponentErrorStrategy,\n hookWidget,\n DynamicManagedObjectResolver\n} from '@c8y/ngx-components';\nimport {\n GlobalContextSectionComponent,\n hookWidgetConfig\n} from '@c8y/ngx-components/context-dashboard';\nimport { PRESET_NAME } from '@c8y/ngx-components/global-context';\nimport { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';\nimport {\n importConfigWithDevice,\n exportConfigWithDevice\n} from '@c8y/ngx-components/widgets/import-export-config';\n\nexport const recentAlarmsDefinition = {\n id: defaultWidgetIds.RECENT_ALARMS,\n label: gettext('Recent alarms'),\n description: gettext('Log of recent alarms from all devices with any severity and status'),\n loadComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/alarms').then(\n m => m.AlarmListWidgetComponent\n ),\n loadConfigComponent: () =>\n import('@c8y/ngx-components/widgets/implementations/alarms').then(\n m => m.AlarmListWidgetConfigComponent\n ),\n resolve: {\n device: DynamicManagedObjectResolver\n },\n errorStrategy: DynamicComponentErrorStrategy.OVERLAY_ERROR,\n data: {\n schema: () =>\n import(\n 'c8y-schema-loader?interfaceName=AlarmListWidgetConfig!@c8y/ngx-components/widgets/implementations/alarms'\n ),\n export: exportConfigWithDevice,\n import: importConfigWithDevice,\n controls: PRESET_NAME.ALARM_LIST_LEGACY,\n settings: {\n recentAlarmsWidget: true,\n noNewWidgets: true,\n widgetDefaults: {\n _width: 4,\n _height: 4\n },\n ng1: {\n options: {\n noDeviceTarget: false,\n groupsSelectable: true,\n deviceTargetNotRequired: true\n }\n }\n },\n displaySettings: {\n globalAutoRefreshContext: true\n }\n }\n} satisfies DynamicWidgetDefinition;\n\nexport const recentAlarmsWidgetProviders = [\n hookWidget(recentAlarmsDefinition),\n hookWidgetConfig<GlobalContextSectionComponent>({\n widgetId: defaultWidgetIds.RECENT_ALARMS,\n priority: 10,\n label: gettext('Time context'),\n initialState: {\n controls: PRESET_NAME.ALARM_LIST_CONFIG\n },\n loadComponent: () =>\n import('@c8y/ngx-components/context-dashboard').then(m => m.GlobalContextSectionComponent)\n })\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAkBO,MAAM,sBAAsB,GAAG;IACpC,EAAE,EAAE,gBAAgB,CAAC,aAAa;AAClC,IAAA,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC;AAC/B,IAAA,WAAW,EAAE,OAAO,CAAC,oEAAoE,CAAC;AAC1F,IAAA,aAAa,EAAE,MACb,OAAO,oDAAoD,CAAC,CAAC,IAAI,CAC/D,CAAC,IAAI,CAAC,CAAC,wBAAwB,CAChC;AACH,IAAA,mBAAmB,EAAE,MACnB,OAAO,oDAAoD,CAAC,CAAC,IAAI,CAC/D,CAAC,IAAI,CAAC,CAAC,8BAA8B,CACtC;AACH,IAAA,OAAO,EAAE;AACP,QAAA,MAAM,EAAE;AACT,KAAA;IACD,aAAa,EAAE,6BAA6B,CAAC,aAAa;AAC1D,IAAA,IAAI,EAAE;AACJ,QAAA,MAAM,EAAE,MACN,OACE,0GAA0G,CAC3G;AACH,QAAA,MAAM,EAAE,sBAAsB;AAC9B,QAAA,MAAM,EAAE,sBAAsB;QAC9B,QAAQ,EAAE,WAAW,CAAC,iBAAiB;AACvC,QAAA,QAAQ,EAAE;AACR,YAAA,kBAAkB,EAAE,IAAI;AACxB,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,cAAc,EAAE;AACd,gBAAA,MAAM,EAAE,CAAC;AACT,gBAAA,OAAO,EAAE;AACV,aAAA;AACD,YAAA,GAAG,EAAE;AACH,gBAAA,OAAO,EAAE;AACP,oBAAA,cAAc,EAAE,KAAK;AACrB,oBAAA,gBAAgB,EAAE,IAAI;AACtB,oBAAA,uBAAuB,EAAE;AAC1B;AACF;AACF,SAAA;AACD,QAAA,eAAe,EAAE;AACf,YAAA,wBAAwB,EAAE;AAC3B;AACF;;AAGI,MAAM,2BAA2B,GAAG;IACzC,UAAU,CAAC,sBAAsB,CAAC;AAClC,IAAA,gBAAgB,CAAgC;QAC9C,QAAQ,EAAE,gBAAgB,CAAC,aAAa;AACxC,QAAA,QAAQ,EAAE,EAAE;AACZ,QAAA,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC;AAC9B,QAAA,YAAY,EAAE;YACZ,QAAQ,EAAE,WAAW,CAAC;AACvB,SAAA;AACD,QAAA,aAAa,EAAE,MACb,OAAO,uCAAuC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,6BAA6B;KAC5F;;;AC1EH;;AAEG;;;;"}
|
|
@@ -10,11 +10,11 @@ import { FormGroupComponent, RequiredInputPlaceholderDirective, IconDirective, M
|
|
|
10
10
|
import * as i1 from '@c8y/ngx-components/alarms';
|
|
11
11
|
import { ALARM_STATUS_ICON, DEFAULT_SEVERITY_VALUES, DEFAULT_STATUS_VALUES, AlarmsDateFilterComponent, AlarmsListComponent, AlarmsModule } from '@c8y/ngx-components/alarms';
|
|
12
12
|
import * as i6 from '@c8y/ngx-components/context-dashboard';
|
|
13
|
-
import { PRESET_NAME,
|
|
13
|
+
import { PRESET_NAME, REFRESH_OPTION, DateTimeContextUtil, LocalControlsComponent, WidgetConfigMigrationService, GLOBAL_CONTEXT_DISPLAY_MODE, CONTEXT_FEATURE, GlobalContextConnectorComponent, GlobalContextConfigComponent, GlobalContextInlineComponent, ConfigContextSelectorComponent, GlobalContextWidgetWrapperComponent } from '@c8y/ngx-components/global-context';
|
|
14
14
|
import { merge, isEmpty, isMatch } from 'lodash-es';
|
|
15
15
|
import { PopoverDirective, PopoverModule } from 'ngx-bootstrap/popover';
|
|
16
16
|
import { BehaviorSubject, Subject, EMPTY, from } from 'rxjs';
|
|
17
|
-
import { filter, tap, takeUntil, shareReplay, switchMap } from 'rxjs/operators';
|
|
17
|
+
import { filter, tap, takeUntil, shareReplay, map, switchMap } from 'rxjs/operators';
|
|
18
18
|
import { gettext } from '@c8y/ngx-components/gettext';
|
|
19
19
|
import { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';
|
|
20
20
|
import { RouterModule } from '@angular/router';
|
|
@@ -485,7 +485,7 @@ class AlarmListWidgetConfigComponent {
|
|
|
485
485
|
*/
|
|
486
486
|
this.statusList = [AlarmStatus.ACTIVE, AlarmStatus.ACKNOWLEDGED, AlarmStatus.CLEARED];
|
|
487
487
|
this.destroy$ = new Subject();
|
|
488
|
-
this.config$ = this.widgetConfigService.currentConfig$.pipe(filter(config => !!config), filter(c => c.dateTimeContext), tap(config => {
|
|
488
|
+
this.config$ = this.widgetConfigService.currentConfig$.pipe(filter(config => !!config), filter(c => !!c.dateTimeContext), tap(config => {
|
|
489
489
|
if (!this.formGroup) {
|
|
490
490
|
this.initializeForm();
|
|
491
491
|
}
|
|
@@ -498,12 +498,14 @@ class AlarmListWidgetConfigComponent {
|
|
|
498
498
|
}
|
|
499
499
|
ngOnInit() {
|
|
500
500
|
this.config$
|
|
501
|
-
.pipe(takeUntil(this.destroy$), filter(config => {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
501
|
+
.pipe(takeUntil(this.destroy$), filter(config => config?.isGlobalContextReady === true), map(config => {
|
|
502
|
+
if (config.refreshOption !== REFRESH_OPTION.HISTORY && config.dateTimeContext) {
|
|
503
|
+
return {
|
|
504
|
+
...config,
|
|
505
|
+
dateTimeContext: DateTimeContextUtil.normalizeForLive(config.dateTimeContext)
|
|
506
|
+
};
|
|
505
507
|
}
|
|
506
|
-
return
|
|
508
|
+
return config;
|
|
507
509
|
}), switchMap(config => {
|
|
508
510
|
if ((config?.severities && this.alarmListWidgetService.allValuesFalse(config.severities)) ||
|
|
509
511
|
(config?.status && this.alarmListWidgetService.allValuesFalse(config.status))) {
|
|
@@ -669,58 +671,12 @@ class AlarmListWidgetComponent {
|
|
|
669
671
|
this.unsubscribe$ = new Subject();
|
|
670
672
|
this.hasPermissions = true;
|
|
671
673
|
}
|
|
672
|
-
|
|
674
|
+
ngOnInit() {
|
|
673
675
|
this.alerts.setAlertGroupDismissStrategy('warning', DismissAlertStrategy.TEMPORARY_OR_PERMANENT);
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
isEmpty(this.config) ||
|
|
679
|
-
(isMatch(this.config, { displaySettings: { globalAutoRefreshContext: true } }) &&
|
|
680
|
-
!this.config['options']?.device &&
|
|
681
|
-
!this.config.types &&
|
|
682
|
-
!this.config.status &&
|
|
683
|
-
!this.config.severities);
|
|
684
|
-
if (isLegacyWidgetWithoutConfiguration) {
|
|
685
|
-
let updatedId = alarmsWidgetId;
|
|
686
|
-
const assetAlarms = this.dashboardChild['data']?.title === 'Active, critical alarms' && 'Asset alarms';
|
|
687
|
-
const recentAlarms = this.dashboardChild['data']?.title === 'Recent alarms' && 'Recent alarms';
|
|
688
|
-
if (assetAlarms) {
|
|
689
|
-
updatedId = ASSET_ALARMS_WIDGET_ID;
|
|
690
|
-
}
|
|
691
|
-
if (recentAlarms) {
|
|
692
|
-
updatedId = RECENT_ALARMS_WIDGET_ID;
|
|
693
|
-
}
|
|
694
|
-
this.setLegacyRecentOrCriticalAlarmWidgetConfig(updatedId);
|
|
695
|
-
this.config.widgetId = updatedId;
|
|
696
|
-
}
|
|
697
|
-
else if (this.alarmWidgetService.isOldAlarmConfigStructure(this.config)) {
|
|
698
|
-
const mappedConfig = this.alarmWidgetService.mapToNewConfigStructure(this.config);
|
|
699
|
-
Object.assign(this.config, mappedConfig);
|
|
700
|
-
}
|
|
701
|
-
if (this.config?.widgetId === RECENT_ALARMS_WIDGET_ID ||
|
|
702
|
-
this.config?.widgetId === ASSET_ALARMS_WIDGET_ID) {
|
|
703
|
-
this.widgetControls.set(PRESET_NAME.ALARM_LIST_LEGACY);
|
|
704
|
-
}
|
|
705
|
-
const migratedConfig = this.widgetConfigMigrationService.migrateWidgetConfig(this.config);
|
|
706
|
-
this.config = merge(this.config, migratedConfig);
|
|
707
|
-
const resolvedWidgetId = this.config?.widgetId ?? alarmsWidgetId ?? defaultWidgetIds.ALARM_LIST;
|
|
708
|
-
this.config.widgetId = resolvedWidgetId;
|
|
709
|
-
const displayMode = this.config.displayMode || GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;
|
|
710
|
-
this.displayMode.set(displayMode);
|
|
711
|
-
const initialContextConfig = {
|
|
712
|
-
dateTimeContext: this.config.dateTimeContext,
|
|
713
|
-
aggregation: this.config.aggregation,
|
|
714
|
-
isAutoRefreshEnabled: this.config.isAutoRefreshEnabled,
|
|
715
|
-
refreshInterval: this.config.refreshInterval,
|
|
716
|
-
refreshOption: this.config.refreshOption
|
|
717
|
-
};
|
|
718
|
-
this.contextConfig.set(initialContextConfig);
|
|
719
|
-
// In dashboard mode, wait for GlobalContextConnector to emit the first state
|
|
720
|
-
// In config modes, fetch immediately with widget config
|
|
721
|
-
if (displayMode !== GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD) {
|
|
722
|
-
await this.fetchAlarms();
|
|
723
|
-
}
|
|
676
|
+
this.migrateConfig();
|
|
677
|
+
this.resolveDisplayMode();
|
|
678
|
+
this.initContextConfig();
|
|
679
|
+
// First fetch is triggered by controls/connector emitting initial configChange.
|
|
724
680
|
}
|
|
725
681
|
ngOnDestroy() {
|
|
726
682
|
if (this.config?.isRealtime) {
|
|
@@ -752,6 +708,57 @@ class AlarmListWidgetComponent {
|
|
|
752
708
|
this.contextConfig.set({ ...current, isAutoRefreshEnabled: !isScrolling });
|
|
753
709
|
this.isLinkedToGlobal.set(!isScrolling);
|
|
754
710
|
}
|
|
711
|
+
migrateConfig() {
|
|
712
|
+
const alarmsWidgetId = this.dashboardChild['data']?.componentId ?? this.dashboardChild['data']?.name;
|
|
713
|
+
if (this.isLegacyWidgetWithoutConfig(alarmsWidgetId)) {
|
|
714
|
+
const updatedId = this.resolveLegacyWidgetId(alarmsWidgetId);
|
|
715
|
+
this.setLegacyRecentOrCriticalAlarmWidgetConfig(updatedId);
|
|
716
|
+
this.config.widgetId = updatedId;
|
|
717
|
+
}
|
|
718
|
+
else if (this.alarmWidgetService.isOldAlarmConfigStructure(this.config)) {
|
|
719
|
+
const mappedConfig = this.alarmWidgetService.mapToNewConfigStructure(this.config);
|
|
720
|
+
Object.assign(this.config, mappedConfig);
|
|
721
|
+
}
|
|
722
|
+
if (this.config?.widgetId === RECENT_ALARMS_WIDGET_ID ||
|
|
723
|
+
this.config?.widgetId === ASSET_ALARMS_WIDGET_ID) {
|
|
724
|
+
this.widgetControls.set(PRESET_NAME.ALARM_LIST_LEGACY);
|
|
725
|
+
}
|
|
726
|
+
const migratedConfig = this.widgetConfigMigrationService.migrateWidgetConfig(this.config);
|
|
727
|
+
this.config = merge(this.config, migratedConfig);
|
|
728
|
+
this.config.widgetId = this.config?.widgetId ?? alarmsWidgetId ?? defaultWidgetIds.ALARM_LIST;
|
|
729
|
+
}
|
|
730
|
+
isLegacyWidgetWithoutConfig(alarmsWidgetId) {
|
|
731
|
+
const effectiveId = this.config?.widgetId ?? alarmsWidgetId;
|
|
732
|
+
return (effectiveId === defaultWidgetIds.ALL_CRITICAL_ALARMS ||
|
|
733
|
+
effectiveId === defaultWidgetIds.RECENT_ALARMS ||
|
|
734
|
+
isEmpty(this.config) ||
|
|
735
|
+
(isMatch(this.config, { displaySettings: { globalAutoRefreshContext: true } }) &&
|
|
736
|
+
!this.config['options']?.device &&
|
|
737
|
+
!this.config.types &&
|
|
738
|
+
!this.config.status &&
|
|
739
|
+
!this.config.severities));
|
|
740
|
+
}
|
|
741
|
+
resolveLegacyWidgetId(fallbackId) {
|
|
742
|
+
const title = this.dashboardChild['data']?.title;
|
|
743
|
+
if (title === 'Active, critical alarms')
|
|
744
|
+
return ASSET_ALARMS_WIDGET_ID;
|
|
745
|
+
if (title === 'Recent alarms')
|
|
746
|
+
return RECENT_ALARMS_WIDGET_ID;
|
|
747
|
+
return fallbackId;
|
|
748
|
+
}
|
|
749
|
+
resolveDisplayMode() {
|
|
750
|
+
const displayMode = this.config.displayMode || GLOBAL_CONTEXT_DISPLAY_MODE.DASHBOARD;
|
|
751
|
+
this.displayMode.set(displayMode);
|
|
752
|
+
}
|
|
753
|
+
initContextConfig() {
|
|
754
|
+
this.contextConfig.set({
|
|
755
|
+
dateTimeContext: this.config.dateTimeContext,
|
|
756
|
+
aggregation: this.config.aggregation,
|
|
757
|
+
isAutoRefreshEnabled: this.config.isAutoRefreshEnabled,
|
|
758
|
+
refreshInterval: this.config.refreshInterval,
|
|
759
|
+
refreshOption: this.config.refreshOption
|
|
760
|
+
});
|
|
761
|
+
}
|
|
755
762
|
async fetchAlarms() {
|
|
756
763
|
const alarms = await this.getAlarms();
|
|
757
764
|
this.alarms$.next(alarms);
|