@nova-ui/dashboards 12.0.24 → 12.0.26-4356

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 (28) hide show
  1. package/bundles/nova-ui-dashboards.umd.js +69 -4
  2. package/bundles/nova-ui-dashboards.umd.js.map +1 -1
  3. package/esm2015/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.js +20 -4
  4. package/esm2015/lib/components/timeseries-widget/chart-presets/xy-chart/xy-chart.component.js +6 -3
  5. package/esm2015/lib/components/timeseries-widget/public-api.js +2 -1
  6. package/esm2015/lib/components/timeseries-widget/timeseries-helpers.js +36 -0
  7. package/esm2015/lib/components/timeseries-widget/types.js +1 -1
  8. package/fesm2015/nova-ui-dashboards.js +58 -5
  9. package/fesm2015/nova-ui-dashboards.js.map +1 -1
  10. package/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.d.ts +1 -0
  11. package/lib/components/timeseries-widget/public-api.d.ts +1 -0
  12. package/lib/components/timeseries-widget/timeseries-helpers.d.ts +6 -0
  13. package/lib/components/timeseries-widget/types.d.ts +1 -0
  14. package/package.json +3 -3
  15. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.d.ts +1 -0
  16. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.js +19 -3
  17. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/timeseries-chart.component.js.map +1 -1
  18. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/xy-chart/xy-chart.component.js +4 -1
  19. package/sdk/atoms/src/lib/components/timeseries-widget/chart-presets/xy-chart/xy-chart.component.js.map +1 -1
  20. package/sdk/atoms/src/lib/components/timeseries-widget/public-api.d.ts +1 -0
  21. package/sdk/atoms/src/lib/components/timeseries-widget/public-api.js +1 -0
  22. package/sdk/atoms/src/lib/components/timeseries-widget/public-api.js.map +1 -1
  23. package/sdk/atoms/src/lib/components/timeseries-widget/timeseries-helpers.d.ts +6 -0
  24. package/sdk/atoms/src/lib/components/timeseries-widget/timeseries-helpers.js +40 -0
  25. package/sdk/atoms/src/lib/components/timeseries-widget/timeseries-helpers.js.map +1 -0
  26. package/sdk/atoms/src/lib/components/timeseries-widget/types.d.ts +1 -0
  27. package/sdk/atoms/src/lib/components/timeseries-widget/types.js.map +1 -1
  28. 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 });
@@ -8362,7 +8423,9 @@
8362
8423
  };
8363
8424
  XYChartComponent.prototype.displayLegendMenu = function () {
8364
8425
  return (this.configuration.preset === exports.TimeseriesChartPreset.Line &&
8365
- !!this.configuration.allowLegendMenu);
8426
+ !!this.configuration.allowLegendMenu &&
8427
+ this.configuration.projectType ===
8428
+ exports.TimeseriesWidgetProjectType.PerfstackApp);
8366
8429
  };
8367
8430
  XYChartComponent.prototype.removeMetric = function (metricId) {
8368
8431
  this.eventBus.next(CHART_METRIC_REMOVE, {
@@ -8383,6 +8446,7 @@
8383
8446
  if (serie.transformer === undefined) {
8384
8447
  // revert transformed data
8385
8448
  serie.data = serie.rawData;
8449
+ this.updateYAxisDomain();
8386
8450
  }
8387
8451
  else {
8388
8452
  this.transformSeriesData(serie);
@@ -18909,6 +18973,7 @@
18909
18973
  exports.hasControlInErrorState = hasControlInErrorState;
18910
18974
  exports.mapDataToFormatterProperties = mapDataToFormatterProperties;
18911
18975
  exports.mergeChanges = mergeChanges;
18976
+ exports.metricsSeriesMeasurementsMinMax = metricsSeriesMeasurementsMinMax;
18912
18977
  exports.percentageAggregator = percentageAggregator;
18913
18978
  exports.refresher = refresher;
18914
18979
  exports.sumAggregator = sumAggregator;