@c8y/ngx-components 1023.65.0 → 1023.65.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.
@@ -536,10 +536,19 @@ declare class WidgetDatapointsSelectorComponent implements OnInit {
536
536
  private readonly widgetComponent;
537
537
  private readonly dashboardContextComponent;
538
538
  private readonly destroyRef;
539
+ private readonly measurementService;
539
540
  ngOnInit(): void;
540
541
  onDatapointsChange(datapoints: KPIDetails[]): void;
541
542
  private getDatapointsFromWidgetConfig;
542
543
  private assignContextFromContextDashboard;
544
+ /**
545
+ * @deprecated
546
+ * DEPRECATED: to be removed when there is another way to identify time series migration.
547
+ * This method checks if the tenant is migrated to time series by making a call to measurement detail endpoint.
548
+ * If the endpoint returns 405, it means the tenant is migrated. This is a workaround for now until we have a
549
+ * better way to identify time series migration.
550
+ */
551
+ private detectTimeSeriesMigration;
543
552
  /**
544
553
  * Checks if selected datapoints have different units and sets warning flag.
545
554
  * Different units in a pie chart can be misleading to users.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sources":["../../datapoint-selector/datapoint-attributes-form/datapoint-attributes.model.ts","../../datapoint-selector/datapoint-selection.model.ts","../../datapoint-selector/datapoint-library.service.ts","../../datapoint-selector/datapoint-selector.component.ts","../../datapoint-selector/datapoint-selector-modal/datapoint-selector-modal.component.ts","../../datapoint-selector/datapoint-selector-list-item/datapoint-selector-list-item.component.ts","../../datapoint-selector/datapoint-selector-modal/datapoint-selector-modal.model.ts","../../datapoint-selector/datapoint-selector.service.ts","../../datapoint-selector/datapoint-selection-list/datapoint-selection-list.component.ts","../../datapoint-selector/datapoint-template-popover/datapoint-template-popover.component.ts","../../datapoint-selector/pipes/includes-datapoint.pipe.ts","../../datapoint-selector/pipes/datapoint-label.pipe.ts","../../datapoint-selector/pipes/filter-datapoints.pipe.ts","../../datapoint-selector/datapoint-attributes-form/datapoint-attributes-form-validation.service.ts","../../datapoint-selector/datapoint-attributes-form/datapoint-attributes-form.component.ts","../../datapoint-selector/datapoint-selector.module.ts","../../datapoint-selector/widget-datapoints-selector.component.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;AAMM;AAEN;;;;;;;;;;;;;;;;;;;AASM;AAEN;;;;;;;;;;;;;;;;;;;AASM;;ACrBN;;;;AAKE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AAEK;AACJ;AACD;;;AAIC;;AAED;;;;;;;;;;;;AAaA;AAEK;;ACzCN;AAII;AACA;AACA;AACA;;AAHQ;;AAoBJ;AAUA;AAQA;AA4CA;AAwBN;;;;AAIG;AACG;AA+BU;;;;;AA4CA;AAsBhB;;;AA0BgB;;;AAqBjB;;ACpPD;AAgEc;;AAlCH;AACA;AACT;AACS;AACA;AACA;AACA;AACA;AACA;AACA;AACT;AACA;;;;;;;;AAIgC;AAEhC;AACA;AACA;AACA;AACA;;AAGA;AACA;;;;;AASoB;AAEpB;AAoBA;AAIA;AAIA;AAIA;AAYA;;;AAgCA;AAKA;AAsCA;AAQA;AAKA;AAIA;AAOA;;;AAkBD;;ACrPD;AA6BI;AACA;;AAvBF;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAUU;AAIV;AAIA;;AAUA;AAOA;;;;AAIG;AACH;;;AAOD;;AClCD;;;;;AAKM;AAEN;AAiEc;;AAzBH;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACC;AACA;AACD;AACA;;;AAIT;AACA;AACA;;;;;;AAEgC;AAEZ;AAgBpB;AAeA;AAIA;AAIA;AAIA;;;;;AAiCA;;AAoCA;AAgBA;AAUA;;;AAKD;;ACnQK;;ACIN;;AAEwB;AAEtB;;;AAcD;;ACkCD;AAoEI;AACA;AACA;AACY;;AAtCd;;AAEG;AACM;AACA;AACA;AACT;;AAEG;;AAEH;;AAEG;AACM;AACA;AACA;AACA;;;AAGT;;;;;AACgC;AAEhC;AAGA;AAGA;AAEU;AACA;;AAIA;AAaV;AAQA;AAUA;AAIA;AAUA;AAYA;;;AAqCA;AAIA;AAMA;AAOA;AASA;;;AAaD;;AC9PD;;;;;;AAWG;;;AAwBF;;ACrCD;;;;AAaC;;ACbD;AAEE;;;AAE0D;;;AAmB3D;;ACvBD;;AAYE;;;AAqBD;;ACvBD;AAEc;AAAQ;AAEpB;AA4BA;;;;;;;;;;;AAyJA;AAOA;AAQA;AAMA;AAOA;;;AAWD;;AC5MD;AAkEc;;;;AA9BH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;;;AAaT;;AAEI;;;AAGJ;;;AAIoB;AAKpB;AAKA;AAMA;AAMA;AAOA;AAeA;AASA;AAIA;AAOA;AAYA;AAYA;AAMA;AAcA;AAQA;;;AAOD;;AC3MD;;;;AA+BuC;;AClCvC;;AAEG;AACH;AAgBE;;AAEG;AACM;AAET;;AAEG;;AAGH;;;AAGG;AACM;AAET;;;;AAIG;AACM;AAET;;AAEG;AACM;AAET;;;;;AAKG;AACM;AAET;;;;;AAKG;AACM;AAET;;;;AAIG;AACM;AAET;;;;;;;AAOG;AACM;;AAGT;AAEA;;AAGA;AACA;AAGA;AAEA;AAcA;AAKA;AAWA;AAYA;;;;;AAKG;AACH;;;AAgBD;;;"}
1
+ {"version":3,"file":"index.d.ts","sources":["../../datapoint-selector/datapoint-attributes-form/datapoint-attributes.model.ts","../../datapoint-selector/datapoint-selection.model.ts","../../datapoint-selector/datapoint-library.service.ts","../../datapoint-selector/datapoint-selector.component.ts","../../datapoint-selector/datapoint-selector-modal/datapoint-selector-modal.component.ts","../../datapoint-selector/datapoint-selector-list-item/datapoint-selector-list-item.component.ts","../../datapoint-selector/datapoint-selector-modal/datapoint-selector-modal.model.ts","../../datapoint-selector/datapoint-selector.service.ts","../../datapoint-selector/datapoint-selection-list/datapoint-selection-list.component.ts","../../datapoint-selector/datapoint-template-popover/datapoint-template-popover.component.ts","../../datapoint-selector/pipes/includes-datapoint.pipe.ts","../../datapoint-selector/pipes/datapoint-label.pipe.ts","../../datapoint-selector/pipes/filter-datapoints.pipe.ts","../../datapoint-selector/datapoint-attributes-form/datapoint-attributes-form-validation.service.ts","../../datapoint-selector/datapoint-attributes-form/datapoint-attributes-form.component.ts","../../datapoint-selector/datapoint-selector.module.ts","../../datapoint-selector/widget-datapoints-selector.component.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;AAMM;AAEN;;;;;;;;;;;;;;;;;;;AASM;AAEN;;;;;;;;;;;;;;;;;;;AASM;;ACrBN;;;;AAKE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACD;AAEK;AACJ;AACD;;;AAIC;;AAED;;;;;;;;;;;;AAaA;AAEK;;ACzCN;AAII;AACA;AACA;AACA;;AAHQ;;AAoBJ;AAUA;AAQA;AA4CA;AAwBN;;;;AAIG;AACG;AA+BU;;;;;AA4CA;AAsBhB;;;AA0BgB;;;AAqBjB;;ACpPD;AAgEc;;AAlCH;AACA;AACT;AACS;AACA;AACA;AACA;AACA;AACA;AACA;AACT;AACA;;;;;;;;AAIgC;AAEhC;AACA;AACA;AACA;AACA;;AAGA;AACA;;;;;AASoB;AAEpB;AAoBA;AAIA;AAIA;AAIA;AAYA;;;AAgCA;AAKA;AAsCA;AAQA;AAKA;AAIA;AAOA;;;AAkBD;;ACrPD;AA6BI;AACA;;AAvBF;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAUU;AAIV;AAIA;;AAUA;AAOA;;;;AAIG;AACH;;;AAOD;;AClCD;;;;;AAKM;AAEN;AAiEc;;AAzBH;AACA;AACA;;AAEA;AACA;AACA;A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eyValuePipe, AsyncPipe, NgIf, NgFor } from '@angular/common';
18
18
  import * as i4 from '@c8y/ngx-components/context-dashboard';
19
19
  import { WidgetConfigService, WidgetConfigComponent, ContextDashboardComponent, WidgetConfigFeedbackComponent } from '@c8y/ngx-components/context-dashboard';
20
- import { pipe, BehaviorSubject, from, combineLatest } from 'rxjs';
20
+ import { pipe, BehaviorSubject, from, combineLatest, filter as filter$1, take as take$1, map as map$1, switchMap as switchMap$1 } from 'rxjs';
21
21
  import * as i1 from '@c8y/client';
22
+ import { MeasurementService } from '@c8y/client';
22
23
  import { sortBy, get, uniq } from 'lodash-es';
23
24
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
24
25
 
@@ -1568,11 +1569,17 @@ class WidgetDatapointsSelectorComponent {
1568
1569
  optional: true
1569
1570
  });
1570
1571
  this.destroyRef = inject(DestroyRef);
1572
+ this.measurementService = inject(MeasurementService);
1571
1573
  }
1572
1574
  ngOnInit() {
1573
1575
  this.datapoints = this.getDatapointsFromWidgetConfig();
1574
1576
  this.checkUnitsMatch(this.datapoints);
1575
1577
  if (this.useAdvancedChartOptions) {
1578
+ this.widgetConfigService.currentConfig$
1579
+ .pipe(filter$1(config => config?.datapoints?.length > 0), take$1(1), map$1(config => config.datapoints[0]), switchMap$1(firstDp => this.detectTimeSeriesMigration(firstDp)), takeUntilDestroyed(this.destroyRef))
1580
+ .subscribe(isMigrated => {
1581
+ this.widgetConfigService.updateConfig({ showAdvancedChartOptions: isMigrated });
1582
+ });
1576
1583
  this.widgetConfigService.currentConfig$
1577
1584
  .pipe(takeUntilDestroyed(this.destroyRef))
1578
1585
  .subscribe(({ showAdvancedChartOptions }) => (this.defaultFormOptions = { ...this.defaultFormOptions, showAdvancedChartOptions }));
@@ -1601,6 +1608,26 @@ class WidgetDatapointsSelectorComponent {
1601
1608
  this.config.contextAsset = { id };
1602
1609
  }
1603
1610
  }
1611
+ /**
1612
+ * @deprecated
1613
+ * DEPRECATED: to be removed when there is another way to identify time series migration.
1614
+ * This method checks if the tenant is migrated to time series by making a call to measurement detail endpoint.
1615
+ * If the endpoint returns 405, it means the tenant is migrated. This is a workaround for now until we have a
1616
+ * better way to identify time series migration.
1617
+ */
1618
+ async detectTimeSeriesMigration(firstDp) {
1619
+ const targetId = firstDp?.__target?.id;
1620
+ if (!targetId) {
1621
+ return false;
1622
+ }
1623
+ try {
1624
+ await this.measurementService.detail(targetId);
1625
+ return false;
1626
+ }
1627
+ catch (err) {
1628
+ return err?.res?.status === 405;
1629
+ }
1630
+ }
1604
1631
  /**
1605
1632
  * Checks if selected datapoints have different units and sets warning flag.
1606
1633
  * Different units in a pie chart can be misleading to users.