@c8y/ngx-components 1024.19.1 → 1024.19.5

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.
@@ -286,7 +286,7 @@ class DatapointsGraphWidgetViewComponent {
286
286
  this.AGGREGATION_TEXTS = AGGREGATION_TEXTS;
287
287
  this.datapointsOutOfSync = new Map();
288
288
  this.hasAtLeastOneDatapointActive = true;
289
- this.hasAtLeastOneAlarmActive = true;
289
+ this.hasAtLeastOneAlarmActive = false;
290
290
  this.isMarkedAreaEnabled = false;
291
291
  this.loadedDatapoints = [];
292
292
  this.loadedAlarmsOrEvents = [];
@@ -346,6 +346,10 @@ class DatapointsGraphWidgetViewComponent {
346
346
  this.totalLegendItems = dpLegendCount + (this.displayConfig?.alarmsEventsConfigs?.length || 0);
347
347
  this.loadedDatapoints = (this.displayConfig?.datapoints || []).filter(dp => dp.__active);
348
348
  this.loadedAlarmsOrEvents = (this.displayConfig?.alarmsEventsConfigs || []).filter(aOrE => aOrE.__active && !aOrE.__hidden);
349
+ // Seed from the config so the severity filter mounts with the widget. The filter emits its
350
+ // initial value on init, and mounting it only after the chart has loaded its alarms would
351
+ // trigger a second load.
352
+ this.hasAtLeastOneAlarmActive = (this.displayConfig?.alarmsEventsConfigs || []).some(aOrE => aOrE.timelineType === 'ALARM' && aOrE.__active);
349
353
  if (this.totalLegendItems > 5 || this.displayConfig?.dataPointLegendDisplay === 'dropdown') {
350
354
  this.selectableItems = this.buildSelectableItems();
351
355
  // Initialize selectedItems with the currently active items
@@ -801,9 +805,10 @@ class DatapointsGraphWidgetViewComponent {
801
805
  updateAlarmsAndEvents(alarmsEventsConfigs) {
802
806
  this.alarms = alarmsEventsConfigs.filter(alarm => alarm.timelineType === 'ALARM');
803
807
  this.events = alarmsEventsConfigs.filter(event => event.timelineType === 'EVENT');
804
- if (this.alarms.length === 0 || !this.alarms.find(alarm => alarm.__active)) {
805
- this.hasAtLeastOneAlarmActive = false;
806
- }
808
+ // Recompute in both directions. Only ever clearing this flag left the severity filter
809
+ // showing for widgets that have no alarms at all, and kept it hidden after an alarm was
810
+ // added back.
811
+ this.hasAtLeastOneAlarmActive = this.alarms.some(alarm => alarm.__active);
807
812
  }
808
813
  filterSeverity(eventTarget) {
809
814
  this.alarms = this.alarms.map(alarm => {