@nova-ui/dashboards 12.0.23 → 12.0.25

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 (36) hide show
  1. package/bundles/nova-ui-dashboards.umd.js +87 -13
  2. package/bundles/nova-ui-dashboards.umd.js.map +1 -1
  3. package/esm2015/lib/components/timeseries-widget/chart-presets/status-bar-chart/status-bar-chart.component.js +14 -6
  4. package/esm2015/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.js +20 -4
  5. package/esm2015/lib/components/timeseries-widget/chart-presets/xy-chart/xy-chart.component.js +6 -3
  6. package/esm2015/lib/components/timeseries-widget/public-api.js +2 -1
  7. package/esm2015/lib/components/timeseries-widget/timeseries-helpers.js +36 -0
  8. package/esm2015/lib/components/timeseries-widget/timeseries-widget.component.js +8 -6
  9. package/esm2015/lib/components/timeseries-widget/types.js +1 -1
  10. package/fesm2015/nova-ui-dashboards.js +77 -15
  11. package/fesm2015/nova-ui-dashboards.js.map +1 -1
  12. package/lib/components/timeseries-widget/chart-presets/status-bar-chart/status-bar-chart.component.d.ts +1 -2
  13. package/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.d.ts +1 -0
  14. package/lib/components/timeseries-widget/public-api.d.ts +1 -0
  15. package/lib/components/timeseries-widget/timeseries-helpers.d.ts +6 -0
  16. package/lib/components/timeseries-widget/types.d.ts +1 -0
  17. package/package.json +3 -3
  18. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/status-bar-chart/status-bar-chart.component.d.ts +1 -2
  19. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/status-bar-chart/status-bar-chart.component.js +12 -4
  20. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/status-bar-chart/status-bar-chart.component.js.map +1 -1
  21. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.d.ts +1 -0
  22. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.js +19 -3
  23. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.js.map +1 -1
  24. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/xy-chart/xy-chart.component.js +4 -1
  25. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/xy-chart/xy-chart.component.js.map +1 -1
  26. package/sdk/atoms/src/lib/components/timeseries-widget/public-api.d.ts +1 -0
  27. package/sdk/atoms/src/lib/components/timeseries-widget/public-api.js +1 -0
  28. package/sdk/atoms/src/lib/components/timeseries-widget/public-api.js.map +1 -1
  29. package/sdk/atoms/src/lib/components/timeseries-widget/timeseries-helpers.d.ts +6 -0
  30. package/sdk/atoms/src/lib/components/timeseries-widget/timeseries-helpers.js +40 -0
  31. package/sdk/atoms/src/lib/components/timeseries-widget/timeseries-helpers.js.map +1 -0
  32. package/sdk/atoms/src/lib/components/timeseries-widget/timeseries-widget.component.js +7 -5
  33. package/sdk/atoms/src/lib/components/timeseries-widget/timeseries-widget.component.js.map +1 -1
  34. package/sdk/atoms/src/lib/components/timeseries-widget/types.d.ts +1 -0
  35. package/sdk/atoms/src/lib/components/timeseries-widget/types.js.map +1 -1
  36. package/sdk/locale/messages.en.xlf +10 -10
@@ -7123,6 +7123,42 @@
7123
7123
  TimeseriesWidgetProjectType[TimeseriesWidgetProjectType["PerfstackApp"] = 1] = "PerfstackApp";
7124
7124
  })(exports.TimeseriesWidgetProjectType || (exports.TimeseriesWidgetProjectType = {}));
7125
7125
 
7126
+ // © 2022 SolarWinds Worldwide, LLC. All rights reserved.
7127
+ //
7128
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
7129
+ // of this software and associated documentation files (the "Software"), to
7130
+ // deal in the Software without restriction, including without limitation the
7131
+ // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7132
+ // sell copies of the Software, and to permit persons to whom the Software is
7133
+ // furnished to do so, subject to the following conditions:
7134
+ //
7135
+ // The above copyright notice and this permission notice shall be included in
7136
+ // all copies or substantial portions of the Software.
7137
+ //
7138
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7139
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7140
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7141
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
7142
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
7143
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
7144
+ // THE SOFTWARE.
7145
+ function metricsSeriesMeasurementsMinMax(series, axisUnits) {
7146
+ if (axisUnits === "percent") {
7147
+ return { min: 0, max: 100 };
7148
+ }
7149
+ // skips percent measurements as they are displayed on the left y-axis and would affect right y-axis domain
7150
+ var nonPercentMetrics = series.filter(function (metric) { var _a; return metric.metricUnits !== "percent" && ((_a = metric.data) === null || _a === void 0 ? void 0 : _a.length); });
7151
+ // case where there are no measurements for non-percent metrics, e.g when a license expires
7152
+ if (nonPercentMetrics.length === 0) {
7153
+ return { min: -1, max: 1 };
7154
+ }
7155
+ var measurements = nonPercentMetrics.flatMap(function (m) { var _a; return (_a = m.data) !== null && _a !== void 0 ? _a : []; });
7156
+ return measurements.reduce(function (acc, measurement) { return ({
7157
+ min: Math.min(acc.min, measurement.y),
7158
+ max: Math.max(acc.max, measurement.y),
7159
+ }); }, { min: measurements[0].y, max: measurements[0].y });
7160
+ }
7161
+
7126
7162
  // © 2022 SolarWinds Worldwide, LLC. All rights reserved.
7127
7163
  var intlFormatOptions = {
7128
7164
  year: "numeric",
@@ -7317,7 +7353,9 @@
7317
7353
  });
7318
7354
  TimeseriesChartComponent.prototype.ngOnInit = function () {
7319
7355
  // save original data
7320
- if (this.widgetData && this.widgetData.series) {
7356
+ if (this.configuration.preset === exports.TimeseriesChartPreset.Line &&
7357
+ this.widgetData &&
7358
+ this.widgetData.series) {
7321
7359
  this.widgetData.series.forEach(function (serie) { return (serie.rawData = serie.data); });
7322
7360
  }
7323
7361
  };
@@ -7403,9 +7441,10 @@
7403
7441
  };
7404
7442
  TimeseriesChartComponent.prototype.transformSeriesData = function (serie) {
7405
7443
  if (serie.transformer && serie.rawData && serie.rawData.length > 0) {
7406
- // TODO percentile???
7407
7444
  try {
7408
- serie.data = serie.transformer(serie.rawData);
7445
+ var hasPercentile = serie.metricUnits === "percent";
7446
+ serie.data = serie.transformer(serie.rawData, hasPercentile);
7447
+ this.updateYAxisDomain();
7409
7448
  }
7410
7449
  catch (e) {
7411
7450
  serie.transformer = undefined;
@@ -7414,6 +7453,28 @@
7414
7453
  }
7415
7454
  }
7416
7455
  };
7456
+ TimeseriesChartComponent.prototype.updateYAxisDomain = function () {
7457
+ var e_2, _j;
7458
+ var _a, _b;
7459
+ var scaleKeys = ["y", "yRight"];
7460
+ try {
7461
+ for (var scaleKeys_2 = __values(scaleKeys), scaleKeys_2_1 = scaleKeys_2.next(); !scaleKeys_2_1.done; scaleKeys_2_1 = scaleKeys_2.next()) {
7462
+ var scaleKey = scaleKeys_2_1.value;
7463
+ var scaleConfig = (_a = this.configuration.scales) === null || _a === void 0 ? void 0 : _a[scaleKey];
7464
+ if (scaleConfig === null || scaleConfig === void 0 ? void 0 : scaleConfig.properties) {
7465
+ scaleConfig.properties.domain = Object.assign({}, metricsSeriesMeasurementsMinMax(this.widgetData.series, (_b = scaleConfig === null || scaleConfig === void 0 ? void 0 : scaleConfig.properties) === null || _b === void 0 ? void 0 : _b.axisUnits));
7466
+ this.timeseriesScalesService.updateConfiguration(this.scales[scaleKey], scaleConfig, this.configuration);
7467
+ }
7468
+ }
7469
+ }
7470
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
7471
+ finally {
7472
+ try {
7473
+ if (scaleKeys_2_1 && !scaleKeys_2_1.done && (_j = scaleKeys_2.return)) _j.call(scaleKeys_2);
7474
+ }
7475
+ finally { if (e_2) throw e_2.error; }
7476
+ }
7477
+ };
7417
7478
  return TimeseriesChartComponent;
7418
7479
  }());
7419
7480
  /** @nocollapse */ TimeseriesChartComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0__namespace, type: TimeseriesChartComponent, deps: "invalid", target: i0__namespace.ɵɵFactoryTarget.Directive });
@@ -7500,10 +7561,17 @@
7500
7561
  this.chartAssist.update(seriesSet);
7501
7562
  if (this.configuration.enableZoom) {
7502
7563
  this.chartAssist.sparks.forEach(function (spark) {
7503
- var _a, _b;
7504
- if (!((_a = spark === null || spark === void 0 ? void 0 : spark.chart) === null || _a === void 0 ? void 0 : _a.hasPlugin(i2.TimeseriesZoomPlugin)) &&
7505
- _this.configuration.enableZoom) {
7506
- (_b = spark === null || spark === void 0 ? void 0 : spark.chart) === null || _b === void 0 ? void 0 : _b.addPlugin(_this.zoomPlugin);
7564
+ var _a, _b, _c, _d, _e;
7565
+ if (((_a = _this.configuration) === null || _a === void 0 ? void 0 : _a.projectType) ===
7566
+ exports.TimeseriesWidgetProjectType.PerfstackApp) {
7567
+ if (!((_b = spark === null || spark === void 0 ? void 0 : spark.chart) === null || _b === void 0 ? void 0 : _b.hasPlugin(i2.TimeseriesZoomPlugin))) {
7568
+ (_c = spark === null || spark === void 0 ? void 0 : spark.chart) === null || _c === void 0 ? void 0 : _c.addPlugin(new i2.TimeseriesZoomPlugin({ collectionId: _this.collectionId }, _this.zoomPluginsSyncService));
7569
+ }
7570
+ }
7571
+ else {
7572
+ if (!((_d = spark === null || spark === void 0 ? void 0 : spark.chart) === null || _d === void 0 ? void 0 : _d.hasPlugin(i2.ZoomPlugin))) {
7573
+ (_e = spark === null || spark === void 0 ? void 0 : spark.chart) === null || _e === void 0 ? void 0 : _e.addPlugin(new i2.ZoomPlugin({ enableExternalEvents: true }));
7574
+ }
7507
7575
  }
7508
7576
  });
7509
7577
  // only need to subscribe to one chart's SET_DOMAIN_EVENT
@@ -8355,7 +8423,9 @@
8355
8423
  };
8356
8424
  XYChartComponent.prototype.displayLegendMenu = function () {
8357
8425
  return (this.configuration.preset === exports.TimeseriesChartPreset.Line &&
8358
- !!this.configuration.allowLegendMenu);
8426
+ !!this.configuration.allowLegendMenu &&
8427
+ this.configuration.projectType ===
8428
+ exports.TimeseriesWidgetProjectType.PerfstackApp);
8359
8429
  };
8360
8430
  XYChartComponent.prototype.removeMetric = function (metricId) {
8361
8431
  this.eventBus.next(CHART_METRIC_REMOVE, {
@@ -8376,6 +8446,7 @@
8376
8446
  if (serie.transformer === undefined) {
8377
8447
  // revert transformed data
8378
8448
  serie.data = serie.rawData;
8449
+ this.updateYAxisDomain();
8379
8450
  }
8380
8451
  else {
8381
8452
  this.transformSeriesData(serie);
@@ -8765,11 +8836,13 @@
8765
8836
  }
8766
8837
  TimeseriesWidgetComponent.prototype.ngOnInit = function () {
8767
8838
  var _a;
8768
- this.zoomPlugin =
8769
- ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.projectType) ===
8770
- exports.TimeseriesWidgetProjectType.ModernDashboard
8771
- ? new i2.ZoomPlugin()
8772
- : new i2.TimeseriesZoomPlugin({ collectionId: this.collectionId }, this.zoomPluginsSyncService);
8839
+ if (((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.projectType) ===
8840
+ exports.TimeseriesWidgetProjectType.PerfstackApp) {
8841
+ this.zoomPlugin = new i2.TimeseriesZoomPlugin({ collectionId: this.collectionId }, this.zoomPluginsSyncService);
8842
+ }
8843
+ else {
8844
+ this.zoomPlugin = new i2.ZoomPlugin();
8845
+ }
8773
8846
  };
8774
8847
  TimeseriesWidgetComponent.prototype.ngOnChanges = function (changes) {
8775
8848
  var _a, _b;
@@ -18900,6 +18973,7 @@
18900
18973
  exports.hasControlInErrorState = hasControlInErrorState;
18901
18974
  exports.mapDataToFormatterProperties = mapDataToFormatterProperties;
18902
18975
  exports.mergeChanges = mergeChanges;
18976
+ exports.metricsSeriesMeasurementsMinMax = metricsSeriesMeasurementsMinMax;
18903
18977
  exports.percentageAggregator = percentageAggregator;
18904
18978
  exports.refresher = refresher;
18905
18979
  exports.sumAggregator = sumAggregator;