@splunk/visualizations 26.0.0 → 26.1.0
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/Area.config.js +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
package/SingleValueRadial.js
CHANGED
|
@@ -127,7 +127,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
127
127
|
|
|
128
128
|
var getDynamicTrendColorEditor = function getDynamicTrendColorEditor(_ref) {
|
|
129
129
|
var defaultContext = _ref.defaultContext,
|
|
130
|
-
|
|
130
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
131
131
|
return {
|
|
132
132
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Trend value'),
|
|
133
133
|
option: 'trendColor',
|
|
@@ -172,7 +172,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
172
172
|
|
|
173
173
|
var getDynamicBackgroundColorEditor = function getDynamicBackgroundColorEditor(_ref) {
|
|
174
174
|
var defaultContext = _ref.defaultContext,
|
|
175
|
-
|
|
175
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
176
176
|
return {
|
|
177
177
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background'),
|
|
178
178
|
option: 'backgroundColor',
|
|
@@ -326,11 +326,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
326
326
|
value: true
|
|
327
327
|
});
|
|
328
328
|
exports.TrellisBackgroundColorEditor = exports.TrellisEditorConfig = void 0;
|
|
329
|
+
|
|
329
330
|
var React = __webpack_require__(1);
|
|
331
|
+
|
|
330
332
|
var i18n_1 = __webpack_require__(2);
|
|
333
|
+
|
|
331
334
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
335
|
+
|
|
332
336
|
var layoutUtils_1 = __webpack_require__(58);
|
|
333
337
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
338
|
+
|
|
339
|
+
|
|
334
340
|
exports.TrellisEditorConfig = [[{
|
|
335
341
|
label: (0, i18n_1._)('Trellis layout'),
|
|
336
342
|
option: 'splitByLayout',
|
|
@@ -428,37 +434,60 @@ exports.TrellisBackgroundColorEditor = {
|
|
|
428
434
|
|
|
429
435
|
|
|
430
436
|
var _slicedToArray = __webpack_require__(17);
|
|
437
|
+
|
|
431
438
|
var __rest = this && this.__rest || function (s, e) {
|
|
432
439
|
var t = {};
|
|
440
|
+
|
|
433
441
|
for (var p in s) {
|
|
434
442
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
435
443
|
}
|
|
444
|
+
|
|
436
445
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
437
446
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
438
447
|
}
|
|
439
448
|
return t;
|
|
440
449
|
};
|
|
450
|
+
|
|
441
451
|
Object.defineProperty(exports, "__esModule", {
|
|
442
452
|
value: true
|
|
443
453
|
});
|
|
454
|
+
|
|
444
455
|
var React = __webpack_require__(1);
|
|
456
|
+
|
|
445
457
|
var react_1 = __webpack_require__(1);
|
|
458
|
+
|
|
446
459
|
var lodash_1 = __webpack_require__(3);
|
|
460
|
+
|
|
447
461
|
var styled_components_1 = __webpack_require__(4);
|
|
448
|
-
|
|
462
|
+
|
|
463
|
+
var Paginator_1 = __webpack_require__(94);
|
|
464
|
+
|
|
449
465
|
var i18n_1 = __webpack_require__(2);
|
|
466
|
+
|
|
450
467
|
var themes_1 = __webpack_require__(60);
|
|
468
|
+
|
|
451
469
|
var useSplunkTheme_1 = __webpack_require__(57);
|
|
470
|
+
|
|
452
471
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
472
|
+
|
|
453
473
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
474
|
+
|
|
454
475
|
var style_1 = __webpack_require__(14);
|
|
476
|
+
|
|
455
477
|
var Message_1 = __webpack_require__(10);
|
|
456
|
-
|
|
478
|
+
|
|
479
|
+
var trellisUtils_1 = __webpack_require__(84);
|
|
480
|
+
|
|
457
481
|
var hocUtils_1 = __webpack_require__(27);
|
|
482
|
+
|
|
458
483
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
484
|
+
|
|
459
485
|
var Options_1 = __webpack_require__(30);
|
|
486
|
+
|
|
460
487
|
var trellisUtils_2 = __webpack_require__(107);
|
|
488
|
+
|
|
461
489
|
var layoutUtils_1 = __webpack_require__(58);
|
|
490
|
+
|
|
462
491
|
var TrellisContainer = styled_components_1.default.div.withConfig({
|
|
463
492
|
displayName: "withTrellis__TrellisContainer",
|
|
464
493
|
componentId: "pjmeig-0"
|
|
@@ -479,6 +508,7 @@ var TrellisContainerGrid = styled_components_1.default.div.withConfig({
|
|
|
479
508
|
}, function (props) {
|
|
480
509
|
return "".concat(props.rowHeight, "px");
|
|
481
510
|
});
|
|
511
|
+
|
|
482
512
|
var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
483
513
|
if (errorCode === 'INVALID_SPLIT_BY_FIELD') {
|
|
484
514
|
return React.createElement(Message_1.default, {
|
|
@@ -488,6 +518,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
488
518
|
level: "info"
|
|
489
519
|
});
|
|
490
520
|
}
|
|
521
|
+
|
|
491
522
|
if (errorCode === 'UNKNOWN_DATA_SPLIT_MODE') {
|
|
492
523
|
return React.createElement(Message_1.default, {
|
|
493
524
|
width: width,
|
|
@@ -496,6 +527,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
496
527
|
level: "info"
|
|
497
528
|
});
|
|
498
529
|
}
|
|
530
|
+
|
|
499
531
|
return React.createElement(Message_1.default, {
|
|
500
532
|
width: width,
|
|
501
533
|
height: height,
|
|
@@ -503,33 +535,38 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
503
535
|
level: "info"
|
|
504
536
|
});
|
|
505
537
|
};
|
|
538
|
+
|
|
506
539
|
var withTrellis = function withTrellis(Viz) {
|
|
507
540
|
var VizWithTrellis = function VizWithTrellis(opts) {
|
|
508
541
|
var _opts$options = opts.options,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
542
|
+
options = _opts$options === void 0 ? {} : _opts$options,
|
|
543
|
+
height = opts.height,
|
|
544
|
+
width = opts.width,
|
|
545
|
+
otherProps = __rest(opts, ["options", "height", "width"]);
|
|
546
|
+
|
|
513
547
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(Viz.config.optionsSchema, 'default');
|
|
514
548
|
var mergedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
|
|
515
549
|
var trellisColumns = mergedOptions.trellisColumns,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
550
|
+
trellisPageCount = mergedOptions.trellisPageCount,
|
|
551
|
+
trellisMinColumnWidth = mergedOptions.trellisMinColumnWidth,
|
|
552
|
+
trellisRowHeight = mergedOptions.trellisRowHeight,
|
|
553
|
+
splitByLayout = mergedOptions.splitByLayout,
|
|
554
|
+
trellisSplitBy = mergedOptions.trellisSplitBy;
|
|
521
555
|
var colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
|
|
522
556
|
var pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
|
|
523
557
|
var colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
|
|
524
558
|
var rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
|
|
559
|
+
|
|
525
560
|
var _ref = (0, react_1.useState)(1),
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
561
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
562
|
+
pageNum = _ref2[0],
|
|
563
|
+
setPageNum = _ref2[1];
|
|
564
|
+
|
|
529
565
|
var _ref3 = (0, react_1.useState)(null),
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
566
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
567
|
+
pagedData = _ref4[0],
|
|
568
|
+
setPagedData = _ref4[1];
|
|
569
|
+
|
|
533
570
|
var splitByKeys = [];
|
|
534
571
|
var totalPages = 0;
|
|
535
572
|
var showPaginator = false;
|
|
@@ -537,21 +574,25 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
537
574
|
var theme = {
|
|
538
575
|
splunkThemeV1: (0, useSplunkTheme_1.default)()
|
|
539
576
|
};
|
|
577
|
+
|
|
540
578
|
var _ref5 = (0, themes_1.getSettingsFromThemedProps)({
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
579
|
+
theme: theme
|
|
580
|
+
}),
|
|
581
|
+
currentThemeFamily = _ref5.family,
|
|
582
|
+
currentThemeColorScheme = _ref5.colorScheme,
|
|
583
|
+
currentThemeDensity = _ref5.density;
|
|
584
|
+
|
|
546
585
|
var trellisBackgroundColor = (0, react_1.useMemo)(function () {
|
|
547
586
|
var themeFunc = function themeFunc(themeVar) {
|
|
548
587
|
var _a, _b;
|
|
588
|
+
|
|
549
589
|
return (_b = (_a = Viz.config.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
550
590
|
trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
|
|
551
591
|
theme: theme
|
|
552
592
|
});
|
|
553
|
-
};
|
|
554
|
-
|
|
593
|
+
}; // trellisBackgroundColor option supports only static coloring and DSL option evaluation derived from the themes level only.
|
|
594
|
+
|
|
595
|
+
|
|
555
596
|
var evaluated = Options_1.Options.evaluate({
|
|
556
597
|
context: Viz.config.context,
|
|
557
598
|
options: {
|
|
@@ -564,6 +605,7 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
564
605
|
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields', undefined);
|
|
565
606
|
var noColumns = columns === undefined;
|
|
566
607
|
var noFields = fields === undefined;
|
|
608
|
+
|
|
567
609
|
var updateDataDisplay = function updateDataDisplay(currPage) {
|
|
568
610
|
if (!showPaginator) {
|
|
569
611
|
setPagedData(splitByKeys);
|
|
@@ -574,6 +616,7 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
574
616
|
setPagedData(paged);
|
|
575
617
|
}
|
|
576
618
|
};
|
|
619
|
+
|
|
577
620
|
(0, react_1.useEffect)(function () {
|
|
578
621
|
setPageNum(1);
|
|
579
622
|
updateDataDisplay(1);
|
|
@@ -587,9 +630,11 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
587
630
|
}, [pageNum, pagedData]);
|
|
588
631
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
589
632
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
633
|
+
|
|
590
634
|
if (!isTrellisFeatureFlagOn || !splitByLayout || splitByLayout !== layoutUtils_1.LAYOUT_TYPE.Trellis) {
|
|
591
635
|
return React.createElement(Viz, Object.assign({}, opts));
|
|
592
636
|
}
|
|
637
|
+
|
|
593
638
|
if (splitByLayout === layoutUtils_1.LAYOUT_TYPE.Trellis) {
|
|
594
639
|
if (noColumns || noFields) {
|
|
595
640
|
return React.createElement(Message_1.default, {
|
|
@@ -598,27 +643,34 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
598
643
|
message: (0, i18n_1._)('Loading'),
|
|
599
644
|
level: "info"
|
|
600
645
|
});
|
|
601
|
-
}
|
|
602
|
-
// If no trellisSplitBy value is passed in, assign default trellisSplitBy
|
|
646
|
+
} // If no trellisSplitBy value is passed in, assign default trellisSplitBy
|
|
603
647
|
// The default value will be the first value in the individual splitBy field list or 'aggregations'
|
|
648
|
+
|
|
649
|
+
|
|
604
650
|
var currTrellisSplitBy = trellisSplitBy;
|
|
651
|
+
|
|
605
652
|
if (!trellisSplitBy || trellisSplitBy.length === 0) {
|
|
606
653
|
var splitByPossibleFields = (0, trellisUtils_1.getAllPossibleSplitByFields)(fields);
|
|
607
654
|
currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : trellisUtils_2.AGGREGATIONS;
|
|
608
655
|
}
|
|
656
|
+
|
|
609
657
|
var splitMode = (0, trellisUtils_1.getTrellisDataSplitterMode)(fields);
|
|
610
658
|
var dataSplitResult = (0, trellisUtils_2.getTrellisDataSourcesBySplitMode)(splitMode, dataSources, currTrellisSplitBy);
|
|
611
659
|
var modifiedDataSourceBySplitBy = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.splitDataSources;
|
|
612
660
|
var dataSplitErrorCode = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.errorCode;
|
|
661
|
+
|
|
613
662
|
if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
|
|
614
663
|
return showErrorMessage(dataSplitErrorCode, width, height);
|
|
615
664
|
}
|
|
665
|
+
|
|
616
666
|
var splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
|
|
667
|
+
|
|
617
668
|
if (splitByKeysModified) {
|
|
618
669
|
showPaginator = splitByKeysModified.length > pageCount;
|
|
619
670
|
splitByKeys = splitByKeysModified;
|
|
620
671
|
totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
|
|
621
672
|
}
|
|
673
|
+
|
|
622
674
|
return React.createElement(TrellisContainer, {
|
|
623
675
|
height: height,
|
|
624
676
|
width: width,
|
|
@@ -635,8 +687,8 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
635
687
|
key: "div-child-".concat(idx.toString())
|
|
636
688
|
}, React.createElement(SizeAwareWrapper_1.default, null, function (_ref7) {
|
|
637
689
|
var childWidth = _ref7.childWidth,
|
|
638
|
-
|
|
639
|
-
|
|
690
|
+
_ref7$childHeight = _ref7.childHeight,
|
|
691
|
+
childHeight = _ref7$childHeight === void 0 ? rowHeight : _ref7$childHeight;
|
|
640
692
|
return React.createElement(Viz, Object.assign({}, otherProps, {
|
|
641
693
|
trellisKey: splitByKey,
|
|
642
694
|
trellisSplitBy: currTrellisSplitBy,
|
|
@@ -654,13 +706,16 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
654
706
|
totalPages: totalPages
|
|
655
707
|
}));
|
|
656
708
|
}
|
|
709
|
+
|
|
657
710
|
return null;
|
|
658
711
|
};
|
|
712
|
+
|
|
659
713
|
VizWithTrellis.propTypes = Viz.proptypes;
|
|
660
714
|
VizWithTrellis.defaultProps = Viz.defaultProps;
|
|
661
715
|
VizWithTrellis.config = Viz.config;
|
|
662
716
|
return VizWithTrellis;
|
|
663
717
|
};
|
|
718
|
+
|
|
664
719
|
exports.default = withTrellis;
|
|
665
720
|
|
|
666
721
|
/***/ }),
|
|
@@ -672,12 +727,16 @@ exports.default = withTrellis;
|
|
|
672
727
|
|
|
673
728
|
|
|
674
729
|
var _toConsumableArray = __webpack_require__(8);
|
|
730
|
+
|
|
675
731
|
Object.defineProperty(exports, "__esModule", {
|
|
676
732
|
value: true
|
|
677
733
|
});
|
|
678
734
|
exports.getTrellisDataSourcesBySplitMode = exports.dataSourcesSplitByModeStatsorUnknown = exports.dataSourcesSplitByModeChart = exports.dataSourcesSplitByModeTimechart = exports.dataSourcesSplitByAggregationsStats = exports.dataSourcesSplitByAggregationsTimechartAndChart = exports.dataSourcesSplitByAggregationsUnknown = exports.AGGREGATIONS = void 0;
|
|
735
|
+
|
|
679
736
|
var lodash_1 = __webpack_require__(3);
|
|
680
|
-
|
|
737
|
+
|
|
738
|
+
var trellisUtils_1 = __webpack_require__(84);
|
|
739
|
+
|
|
681
740
|
exports.AGGREGATIONS = 'aggregations';
|
|
682
741
|
/**
|
|
683
742
|
* There can be certain SPL cmds that can produce dataSource without a specific field meta info (like group_by_rank, split_by_field etc),
|
|
@@ -687,16 +746,21 @@ exports.AGGREGATIONS = 'aggregations';
|
|
|
687
746
|
* Example3:- `index = "_internal" | stats count`
|
|
688
747
|
* Example4:- `index=_internal | stats avg(count), max(count)`
|
|
689
748
|
*/
|
|
749
|
+
|
|
690
750
|
var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregationsUnknown(dataSource) {
|
|
691
751
|
var _a, _b, _c, _d;
|
|
752
|
+
|
|
692
753
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
693
754
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
694
755
|
var splitDataSources = null;
|
|
695
756
|
var errorCode = null;
|
|
757
|
+
|
|
696
758
|
if (fields && fields.length) {
|
|
697
759
|
splitDataSources = {};
|
|
760
|
+
|
|
698
761
|
for (var i = 0; i < fields.length; i += 1) {
|
|
699
762
|
var fieldName = fields[i].name;
|
|
763
|
+
|
|
700
764
|
if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
|
|
701
765
|
splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
702
766
|
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
@@ -706,22 +770,28 @@ var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregati
|
|
|
706
770
|
} else {
|
|
707
771
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
708
772
|
}
|
|
773
|
+
|
|
709
774
|
return {
|
|
710
775
|
splitDataSources: splitDataSources,
|
|
711
776
|
errorCode: errorCode
|
|
712
777
|
};
|
|
713
778
|
};
|
|
779
|
+
|
|
714
780
|
exports.dataSourcesSplitByAggregationsUnknown = dataSourcesSplitByAggregationsUnknown;
|
|
781
|
+
|
|
715
782
|
var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitByAggregationsTimechartAndChart(dataSource) {
|
|
716
783
|
var _a, _b, _c, _d;
|
|
784
|
+
|
|
717
785
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
718
786
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
719
787
|
var splitDataSources = null;
|
|
720
788
|
var splitByFields = [];
|
|
721
789
|
var errorCode = null;
|
|
790
|
+
|
|
722
791
|
if (typeof fields[0] !== 'string') {
|
|
723
792
|
splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
724
793
|
}
|
|
794
|
+
|
|
725
795
|
if (splitByFields && splitByFields.length > 0) {
|
|
726
796
|
splitDataSources = {};
|
|
727
797
|
splitByFields.forEach(function (splitByField) {
|
|
@@ -730,6 +800,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
730
800
|
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
731
801
|
fields.forEach(function (field, idx) {
|
|
732
802
|
var fieldName = field === null || field === void 0 ? void 0 : field.name;
|
|
803
|
+
|
|
733
804
|
if (fieldName !== '_time' && !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_')) && field.data_source === splitByField) {
|
|
734
805
|
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
735
806
|
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
@@ -741,8 +812,10 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
741
812
|
// example1 :- index=_internal | timechart count
|
|
742
813
|
// example2 :- index=_internal | timechart max(count) avg(count)
|
|
743
814
|
splitDataSources = {};
|
|
815
|
+
|
|
744
816
|
for (var i = 1; i < fields.length; i += 1) {
|
|
745
817
|
var fieldName = fields[i].name;
|
|
818
|
+
|
|
746
819
|
if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
|
|
747
820
|
splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
748
821
|
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
@@ -752,22 +825,28 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
752
825
|
} else {
|
|
753
826
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
754
827
|
}
|
|
828
|
+
|
|
755
829
|
return {
|
|
756
830
|
splitDataSources: splitDataSources,
|
|
757
831
|
errorCode: errorCode
|
|
758
832
|
};
|
|
759
833
|
};
|
|
834
|
+
|
|
760
835
|
exports.dataSourcesSplitByAggregationsTimechartAndChart = dataSourcesSplitByAggregationsTimechartAndChart;
|
|
836
|
+
|
|
761
837
|
var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregationsStats(dataSource) {
|
|
762
838
|
var _a, _b, _c, _d;
|
|
839
|
+
|
|
763
840
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
764
841
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
765
842
|
var splitDataSources = null;
|
|
766
843
|
var splitByFields = [];
|
|
767
844
|
var errorCode = null;
|
|
845
|
+
|
|
768
846
|
if (typeof fields[0] !== 'string') {
|
|
769
847
|
splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysStats)(fields);
|
|
770
848
|
}
|
|
849
|
+
|
|
771
850
|
if (splitByFields && splitByFields.length > 0) {
|
|
772
851
|
splitDataSources = {};
|
|
773
852
|
splitByFields.forEach(function (splitByField) {
|
|
@@ -777,6 +856,7 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
|
|
|
777
856
|
var idx = fields.findIndex(function (field) {
|
|
778
857
|
return field.name === splitByField;
|
|
779
858
|
});
|
|
859
|
+
|
|
780
860
|
if (idx > 0) {
|
|
781
861
|
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
782
862
|
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
@@ -785,32 +865,40 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
|
|
|
785
865
|
} else {
|
|
786
866
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
787
867
|
}
|
|
868
|
+
|
|
788
869
|
return {
|
|
789
870
|
splitDataSources: splitDataSources,
|
|
790
871
|
errorCode: errorCode
|
|
791
872
|
};
|
|
792
873
|
};
|
|
874
|
+
|
|
793
875
|
exports.dataSourcesSplitByAggregationsStats = dataSourcesSplitByAggregationsStats;
|
|
876
|
+
|
|
794
877
|
var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(dataSource, splitBy) {
|
|
795
878
|
var _a, _b, _c, _d, _e;
|
|
879
|
+
|
|
796
880
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
797
881
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
798
882
|
var splitDataSources = null;
|
|
799
883
|
var splitByFields = [];
|
|
800
884
|
var errorCode = null;
|
|
885
|
+
|
|
801
886
|
if (typeof fields[0] !== 'string') {
|
|
802
887
|
splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
|
|
803
888
|
}
|
|
889
|
+
|
|
804
890
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
805
891
|
splitDataSources = {};
|
|
806
892
|
var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
807
893
|
var valueKeys = [];
|
|
894
|
+
|
|
808
895
|
for (var i = 1; i < fields.length; i += 1) {
|
|
809
896
|
// not including internal fields
|
|
810
897
|
if (!((_e = fields[i].name) === null || _e === void 0 ? void 0 : _e.startsWith('_'))) {
|
|
811
898
|
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
812
899
|
}
|
|
813
900
|
}
|
|
901
|
+
|
|
814
902
|
valueKeys.forEach(function (val) {
|
|
815
903
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
816
904
|
splitDataSources[val].primary.data.fields = [{
|
|
@@ -832,22 +920,28 @@ var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(d
|
|
|
832
920
|
} else {
|
|
833
921
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
834
922
|
}
|
|
923
|
+
|
|
835
924
|
return {
|
|
836
925
|
splitDataSources: splitDataSources,
|
|
837
926
|
errorCode: errorCode
|
|
838
927
|
};
|
|
839
928
|
};
|
|
929
|
+
|
|
840
930
|
exports.dataSourcesSplitByModeTimechart = dataSourcesSplitByModeTimechart;
|
|
931
|
+
|
|
841
932
|
var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSource, splitBy) {
|
|
842
933
|
var _a, _b, _c, _d;
|
|
934
|
+
|
|
843
935
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
844
936
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
845
937
|
var splitDataSources = null;
|
|
846
938
|
var splitByFields = [];
|
|
847
939
|
var errorCode = null;
|
|
940
|
+
|
|
848
941
|
if (typeof fields[0] !== 'string') {
|
|
849
942
|
splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
|
|
850
943
|
}
|
|
944
|
+
|
|
851
945
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
852
946
|
splitDataSources = {};
|
|
853
947
|
var splitByFieldIdx = splitByFields.findIndex(function (f) {
|
|
@@ -858,6 +952,7 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
858
952
|
});
|
|
859
953
|
var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
860
954
|
var nonDataSourceAggregations = [];
|
|
955
|
+
|
|
861
956
|
if (!dataSourceKeys.length && fields[0].groupby_rank === '0' && fields.length && !fields[1].groupby_rank) {
|
|
862
957
|
/* check for another aggregation scenario where no key 'data_source' will be returned (applies for both chart and stats cmd)
|
|
863
958
|
For example :-
|
|
@@ -882,12 +977,14 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
882
977
|
nonDataSourceAggregations.push(fields[i].name);
|
|
883
978
|
}
|
|
884
979
|
}
|
|
980
|
+
|
|
885
981
|
if (splitByFieldIdx === 0) {
|
|
886
982
|
// if splitBy is the first field, split row wise
|
|
887
983
|
var valueKeys = (0, lodash_1.cloneDeep)(columns[0]);
|
|
888
984
|
valueKeys.forEach(function (val, idx) {
|
|
889
985
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
890
986
|
splitDataSources[val].primary.data.fields = [];
|
|
987
|
+
|
|
891
988
|
if (otherSplitBy.length) {
|
|
892
989
|
splitDataSources[val].primary.data.fields = [{
|
|
893
990
|
name: otherSplitBy[0]
|
|
@@ -959,16 +1056,20 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
959
1056
|
columnValues[1] = ['1','10','100']
|
|
960
1057
|
columnValues[2] = ['5', '50', '500']
|
|
961
1058
|
*/
|
|
1059
|
+
|
|
962
1060
|
var _loop = function _loop(_i) {
|
|
963
1061
|
columnValues[0].push(fields[_i].splitby_value ? fields[_i].splitby_value : fields[_i].name);
|
|
964
1062
|
dataSourceKeys.forEach(function (dskey, dsIndx) {
|
|
965
1063
|
var mul = (fields.length - 1) / dataSourceKeys.length; // This line does the index calculation
|
|
1064
|
+
|
|
966
1065
|
columnValues[dsIndx + 1].push(columns[_i + dsIndx * mul][idx]);
|
|
967
1066
|
});
|
|
968
1067
|
};
|
|
1068
|
+
|
|
969
1069
|
for (var _i = 1; _i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); _i += 1) {
|
|
970
1070
|
_loop(_i);
|
|
971
1071
|
}
|
|
1072
|
+
|
|
972
1073
|
splitDataSources[val].primary.data.columns = columnValues;
|
|
973
1074
|
})();
|
|
974
1075
|
} else if (nonDataSourceAggregations.length) {
|
|
@@ -990,9 +1091,11 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
990
1091
|
} else {
|
|
991
1092
|
// split column wise
|
|
992
1093
|
var _valueKeys = [];
|
|
1094
|
+
|
|
993
1095
|
for (var _i2 = 1; _i2 < fields.length; _i2 += 1) {
|
|
994
1096
|
_valueKeys.push(fields[_i2].splitby_value ? fields[_i2].splitby_value : fields[_i2].name);
|
|
995
1097
|
}
|
|
1098
|
+
|
|
996
1099
|
_valueKeys.forEach(function (val) {
|
|
997
1100
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
998
1101
|
splitDataSources[val].primary.data.fields = [{
|
|
@@ -1015,29 +1118,36 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
1015
1118
|
} else {
|
|
1016
1119
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
1017
1120
|
}
|
|
1121
|
+
|
|
1018
1122
|
return {
|
|
1019
1123
|
splitDataSources: splitDataSources,
|
|
1020
1124
|
errorCode: errorCode
|
|
1021
1125
|
};
|
|
1022
1126
|
};
|
|
1127
|
+
|
|
1023
1128
|
exports.dataSourcesSplitByModeChart = dataSourcesSplitByModeChart;
|
|
1024
1129
|
/**
|
|
1025
1130
|
* This method does datasplitting for 'stats' and generic cmds('makeresults','table' etc - categoried as 'unknown' splitMode).
|
|
1026
1131
|
* The main difference is for 'stats' cmd possible splitBy fields have 'group_by_rank' in field meta info, whereas for 'unknown' cmd it can be any fieldnames
|
|
1027
1132
|
*/
|
|
1133
|
+
|
|
1028
1134
|
var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatsorUnknown(dataSource, splitBy, splitMode) {
|
|
1029
1135
|
var _a, _b, _c, _d, _e, _f;
|
|
1136
|
+
|
|
1030
1137
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
1031
1138
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
1032
1139
|
var splitDataSources = null;
|
|
1033
1140
|
var splitByFields = [];
|
|
1034
1141
|
var errorCode = null;
|
|
1142
|
+
|
|
1035
1143
|
if (typeof fields[0] !== 'string') {
|
|
1036
1144
|
splitByFields = splitMode !== trellisUtils_1.UNKNOWN ? (0, trellisUtils_1.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_1.extractSplitByFieldsForUnknown)(fields);
|
|
1037
1145
|
}
|
|
1146
|
+
|
|
1038
1147
|
var splitByIndex = fields === null || fields === void 0 ? void 0 : fields.findIndex(function (field) {
|
|
1039
1148
|
return field === splitBy || field.name === splitBy;
|
|
1040
1149
|
});
|
|
1150
|
+
|
|
1041
1151
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
1042
1152
|
var splitByColumn = (_f = (_e = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.columns[splitByIndex];
|
|
1043
1153
|
splitDataSources = {};
|
|
@@ -1068,14 +1178,18 @@ var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatso
|
|
|
1068
1178
|
} else {
|
|
1069
1179
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
1070
1180
|
}
|
|
1181
|
+
|
|
1071
1182
|
return {
|
|
1072
1183
|
splitDataSources: splitDataSources,
|
|
1073
1184
|
errorCode: errorCode
|
|
1074
1185
|
};
|
|
1075
1186
|
};
|
|
1187
|
+
|
|
1076
1188
|
exports.dataSourcesSplitByModeStatsorUnknown = dataSourcesSplitByModeStatsorUnknown;
|
|
1189
|
+
|
|
1077
1190
|
var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode(splitMode, dataSources, trellisSplitBy) {
|
|
1078
1191
|
var result = null;
|
|
1192
|
+
|
|
1079
1193
|
try {
|
|
1080
1194
|
if (splitMode === trellisUtils_1.TIMECHART) {
|
|
1081
1195
|
result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsTimechartAndChart)(dataSources) : (0, exports.dataSourcesSplitByModeTimechart)(dataSources, trellisSplitBy);
|
|
@@ -1093,8 +1207,10 @@ var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode
|
|
|
1093
1207
|
errorCode: 'UNKNOWN'
|
|
1094
1208
|
};
|
|
1095
1209
|
}
|
|
1210
|
+
|
|
1096
1211
|
return result;
|
|
1097
1212
|
};
|
|
1213
|
+
|
|
1098
1214
|
exports.getTrellisDataSourcesBySplitMode = getTrellisDataSourcesBySplitMode;
|
|
1099
1215
|
|
|
1100
1216
|
/***/ }),
|
|
@@ -1122,11 +1238,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
1122
1238
|
Object.defineProperty(exports, "__esModule", {
|
|
1123
1239
|
value: true
|
|
1124
1240
|
});
|
|
1241
|
+
|
|
1125
1242
|
var React = __webpack_require__(1);
|
|
1243
|
+
|
|
1126
1244
|
var styled_components_1 = __webpack_require__(4);
|
|
1245
|
+
|
|
1127
1246
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
1247
|
+
|
|
1128
1248
|
var style_1 = __webpack_require__(14);
|
|
1249
|
+
|
|
1129
1250
|
var colorUtils_1 = __webpack_require__(12);
|
|
1251
|
+
|
|
1130
1252
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
1131
1253
|
var width = _ref.width;
|
|
1132
1254
|
return {
|
|
@@ -1139,11 +1261,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
1139
1261
|
componentId: "sc-1yhgpod-0"
|
|
1140
1262
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
1141
1263
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
1142
|
-
});
|
|
1143
|
-
|
|
1264
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
1265
|
+
|
|
1144
1266
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
1145
1267
|
var width = _ref2.width,
|
|
1146
|
-
|
|
1268
|
+
height = _ref2.height;
|
|
1147
1269
|
return {
|
|
1148
1270
|
style: Object.assign(Object.assign({}, width && {
|
|
1149
1271
|
width: (0, style_1.toPx)(width)
|
|
@@ -1165,11 +1287,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
1165
1287
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
1166
1288
|
componentId: "sc-1yhgpod-3"
|
|
1167
1289
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
1290
|
+
|
|
1168
1291
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
1169
1292
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
1170
1293
|
var width = props.width,
|
|
1171
|
-
|
|
1172
|
-
|
|
1294
|
+
height = props.height,
|
|
1295
|
+
backgroundColor = props.backgroundColor;
|
|
1296
|
+
|
|
1173
1297
|
if (!height) {
|
|
1174
1298
|
return React.createElement(Item, {
|
|
1175
1299
|
"data-test": "item",
|
|
@@ -1177,24 +1301,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
1177
1301
|
backgroundColor: backgroundColor
|
|
1178
1302
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
1179
1303
|
}
|
|
1304
|
+
|
|
1180
1305
|
return React.createElement(FixSizeItem, {
|
|
1181
1306
|
"data-test": "fix-size-item",
|
|
1182
|
-
"data-splunk-visualization-version": "26.
|
|
1307
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
1183
1308
|
width: width,
|
|
1184
1309
|
height: height,
|
|
1185
1310
|
backgroundColor: backgroundColor
|
|
1186
1311
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
1187
1312
|
var newWidth = _ref3.width,
|
|
1188
|
-
|
|
1313
|
+
newHeight = _ref3.height;
|
|
1189
1314
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
1190
1315
|
width: newWidth,
|
|
1191
1316
|
height: newHeight
|
|
1192
1317
|
}));
|
|
1193
1318
|
})));
|
|
1194
1319
|
};
|
|
1320
|
+
|
|
1195
1321
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
1196
1322
|
return FixedSizeContainer;
|
|
1197
1323
|
};
|
|
1324
|
+
|
|
1198
1325
|
exports.default = withFixedSizeContainer;
|
|
1199
1326
|
|
|
1200
1327
|
/***/ }),
|
|
@@ -1222,9 +1349,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
1222
1349
|
* @param {DashboardVizType} props.Wrapper
|
|
1223
1350
|
* @param {DashboardVizType} props.Visualization
|
|
1224
1351
|
*/
|
|
1352
|
+
|
|
1225
1353
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
1226
1354
|
var Wrapper = _ref.Wrapper,
|
|
1227
|
-
|
|
1355
|
+
Visualization = _ref.Visualization;
|
|
1228
1356
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
1229
1357
|
extendProperties.forEach(function (prop) {
|
|
1230
1358
|
if (Visualization[prop]) {
|
|
@@ -1233,6 +1361,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
1233
1361
|
}
|
|
1234
1362
|
});
|
|
1235
1363
|
};
|
|
1364
|
+
|
|
1236
1365
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
1237
1366
|
|
|
1238
1367
|
/***/ }),
|
|
@@ -1260,91 +1389,118 @@ module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
|
1260
1389
|
Object.defineProperty(exports, "__esModule", {
|
|
1261
1390
|
value: true
|
|
1262
1391
|
});
|
|
1392
|
+
|
|
1263
1393
|
var React = __webpack_require__(1);
|
|
1394
|
+
|
|
1264
1395
|
var T = __webpack_require__(0);
|
|
1396
|
+
|
|
1265
1397
|
var colorConstants_1 = __webpack_require__(49);
|
|
1398
|
+
|
|
1266
1399
|
var gaugeUtils_1 = __webpack_require__(96);
|
|
1400
|
+
|
|
1267
1401
|
var displayUtils_1 = __webpack_require__(80);
|
|
1402
|
+
|
|
1268
1403
|
var GaugeGraph = function GaugeGraph(_ref) {
|
|
1269
1404
|
var _ref$width = _ref.width,
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1405
|
+
width = _ref$width === void 0 ? 200 : _ref$width,
|
|
1406
|
+
_ref$height = _ref.height,
|
|
1407
|
+
height = _ref$height === void 0 ? 200 : _ref$height,
|
|
1408
|
+
_ref$strokeWidth = _ref.strokeWidth,
|
|
1409
|
+
strokeWidth = _ref$strokeWidth === void 0 ? (0, gaugeUtils_1.getGaugeStrokeWidth)(height) : _ref$strokeWidth,
|
|
1410
|
+
_ref$radialBackground = _ref.radialBackgroundColor,
|
|
1411
|
+
radialBackgroundColor = _ref$radialBackground === void 0 ? colorConstants_1.RADIAL_BACKGROUND_COLOR : _ref$radialBackground,
|
|
1412
|
+
fontColor = _ref.fontColor,
|
|
1413
|
+
formattedGaugeRanges = _ref.formattedGaugeRanges,
|
|
1414
|
+
propMajorValue = _ref.majorValue,
|
|
1415
|
+
maxValue = _ref.maxValue,
|
|
1416
|
+
minValue = _ref.minValue,
|
|
1417
|
+
showRadialGraph = _ref.showRadialGraph;
|
|
1418
|
+
|
|
1283
1419
|
function toRadians(degrees) {
|
|
1284
1420
|
return degrees * Math.PI / 180;
|
|
1285
1421
|
}
|
|
1422
|
+
|
|
1286
1423
|
function toDegrees(radians) {
|
|
1287
1424
|
return radians * 180 / Math.PI;
|
|
1288
1425
|
}
|
|
1426
|
+
|
|
1289
1427
|
var labelFontSize = (0, gaugeUtils_1.getLabelFontSize)(height, showRadialGraph);
|
|
1290
1428
|
var labelFontSizeString = "".concat(String(labelFontSize), "px Splunk Platform Sans");
|
|
1291
|
-
var maxOffset = 0.35;
|
|
1292
|
-
|
|
1293
|
-
var labelSpace = labelFontSize / 2;
|
|
1294
|
-
|
|
1295
|
-
var triangleBase = height >= 113 ? 8 : 4;
|
|
1296
|
-
|
|
1429
|
+
var maxOffset = 0.35; // space between the label and the radial
|
|
1430
|
+
|
|
1431
|
+
var labelSpace = labelFontSize / 2; // length of the base of triangle marker
|
|
1432
|
+
|
|
1433
|
+
var triangleBase = height >= 113 ? 8 : 4; // amount of padding around semi-circle
|
|
1434
|
+
|
|
1297
1435
|
var padding = labelFontSize > 0 ? labelSpace * 2 + labelFontSize * 2 : triangleBase;
|
|
1298
1436
|
var semicircleRadius = height - strokeWidth / 2 - padding;
|
|
1299
1437
|
var circumference = semicircleRadius * 2 * Math.PI;
|
|
1300
1438
|
var bgCircleOffset = circumference * 0.5; // half a circle
|
|
1439
|
+
|
|
1301
1440
|
var strokeDashoffset = circumference * 0.5; // half a circle
|
|
1302
|
-
|
|
1303
|
-
// For inner radial
|
|
1441
|
+
|
|
1442
|
+
var semicircleEdgeRadius = semicircleRadius + strokeWidth / 2; // For inner radial
|
|
1443
|
+
|
|
1304
1444
|
var innerStrokeWidth = strokeWidth / 4;
|
|
1305
1445
|
var innerSemicircleRadius = height - strokeWidth - padding - innerStrokeWidth / 2 - 1; // subtract 1 to make the 1px space between outer and inner arc
|
|
1306
|
-
|
|
1307
|
-
// Center of radials
|
|
1446
|
+
|
|
1447
|
+
var innerCircumference = innerSemicircleRadius * 2 * Math.PI; // Center of radials
|
|
1448
|
+
|
|
1308
1449
|
var cx = width / 2;
|
|
1309
1450
|
var cyOffset = labelFontSize > 0 ? labelSpace * 2 + labelFontSize : triangleBase / 2;
|
|
1310
1451
|
var cy = semicircleRadius + strokeWidth / 2 + cyOffset;
|
|
1311
1452
|
var majorValue;
|
|
1453
|
+
|
|
1312
1454
|
if (typeof propMajorValue === 'string') {
|
|
1313
1455
|
majorValue = parseInt(propMajorValue, 10);
|
|
1314
1456
|
} else {
|
|
1315
1457
|
majorValue = propMajorValue;
|
|
1316
1458
|
}
|
|
1459
|
+
|
|
1317
1460
|
var range = (0, gaugeUtils_1.getGaugeRange)(formattedGaugeRanges, majorValue);
|
|
1318
1461
|
var circles = [];
|
|
1319
1462
|
var labels = [];
|
|
1320
|
-
var showMarker = false;
|
|
1321
|
-
|
|
1463
|
+
var showMarker = false; // Calculate Marker Values
|
|
1464
|
+
|
|
1322
1465
|
var radius = semicircleRadius;
|
|
1323
1466
|
var x = strokeWidth / 2 + innerStrokeWidth + 2; // distance of tip of marker from center of outer semicircle stroke
|
|
1467
|
+
|
|
1324
1468
|
var markerVal = Math.max(Math.min(maxValue, majorValue), minValue);
|
|
1325
1469
|
var theta = toRadians(180 - (0, displayUtils_1.getRadialProgress)(markerVal - minValue, minValue, maxValue) / 100 * 180); // degree of progress
|
|
1470
|
+
|
|
1326
1471
|
var p1x = cx + (radius - x) * Math.cos(theta);
|
|
1327
1472
|
var p1y = cy - (radius - x) * Math.sin(theta);
|
|
1328
1473
|
var centerX = (radius - x - triangleBase / Math.sqrt(3)) * Math.cos(theta);
|
|
1329
1474
|
var centerY = (radius - x - triangleBase / Math.sqrt(3)) * Math.sin(theta);
|
|
1330
1475
|
var rotation1 = 2 * Math.PI / 3; // degrees of rotation around center for 2nd point
|
|
1476
|
+
|
|
1331
1477
|
var rotation2 = -2 * Math.PI / 3; // degrees of rotation around center for 3rd point
|
|
1478
|
+
|
|
1332
1479
|
var xVal = (radius - x) * Math.cos(theta); // x-axis offset of center
|
|
1480
|
+
|
|
1333
1481
|
var yVal = (radius - x) * Math.sin(theta); // y-axis offset of center
|
|
1482
|
+
|
|
1334
1483
|
var p2x = centerX + (xVal - centerX) * Math.cos(rotation1) - (yVal - centerY) * Math.sin(rotation1); // x-axis of 2nd point
|
|
1484
|
+
|
|
1335
1485
|
var p2y = centerY + (xVal - centerX) * Math.sin(rotation1) + (yVal - centerY) * Math.cos(rotation1); // y-axis of 2nd point
|
|
1486
|
+
|
|
1336
1487
|
var p3x = centerX + (xVal - centerX) * Math.cos(rotation2) - (yVal - centerY) * Math.sin(rotation2); // x-axis of 3rd point
|
|
1488
|
+
|
|
1337
1489
|
var p3y = centerY + (xVal - centerX) * Math.sin(rotation2) + (yVal - centerY) * Math.cos(rotation2); // y-axis of 3rd point
|
|
1490
|
+
|
|
1338
1491
|
var d = "M ".concat(p1x, " ").concat(p1y, " L ").concat(cx + p2x, " ").concat(cy - p2y, " L ").concat(cx + p3x, " ").concat(cy - p3y, " Z"); // d-value for marker path in SVG
|
|
1492
|
+
|
|
1339
1493
|
formattedGaugeRanges.forEach(function (r, i) {
|
|
1340
1494
|
if (range >= i && typeof majorValue === 'number') {
|
|
1341
1495
|
var startVal = Math.min(r.from, majorValue);
|
|
1342
|
-
var endVal = Math.min(r.to, majorValue);
|
|
1343
|
-
|
|
1344
|
-
var _progressWidth = (0, gaugeUtils_1.getProgressWidth)(endVal - startVal, minValue, maxValue, circumference);
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
// main gauge progress radial
|
|
1496
|
+
var endVal = Math.min(r.to, majorValue); // width of stroke for each gauge range
|
|
1497
|
+
|
|
1498
|
+
var _progressWidth = (0, gaugeUtils_1.getProgressWidth)(endVal - startVal, minValue, maxValue, circumference); // distance of stroke from right edge of circle
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
var _offsetDistance = (0, gaugeUtils_1.getProgressWidth)(maxValue - startVal, minValue, maxValue, circumference); // main gauge progress radial
|
|
1502
|
+
|
|
1503
|
+
|
|
1348
1504
|
circles.push(React.createElement("circle", {
|
|
1349
1505
|
"data-test": "progress-radial",
|
|
1350
1506
|
stroke: r.value,
|
|
@@ -1360,14 +1516,16 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1360
1516
|
key: "progress".concat(r.from)
|
|
1361
1517
|
}));
|
|
1362
1518
|
}
|
|
1519
|
+
|
|
1363
1520
|
if (range <= i && (typeof majorValue !== 'number' || majorValue < r.to) && i < formattedGaugeRanges.length - 1) {
|
|
1364
1521
|
// width of stroke for each breakpoint dash
|
|
1365
|
-
var breakpointWidth = 1;
|
|
1366
|
-
|
|
1367
|
-
var breakpointOpacity = 0.15;
|
|
1368
|
-
|
|
1369
|
-
var _offsetDistance2 = (0, gaugeUtils_1.getProgressWidth)(maxValue - r.to, minValue, maxValue, circumference);
|
|
1370
|
-
|
|
1522
|
+
var breakpointWidth = 1; // opacity of the dash (15%)
|
|
1523
|
+
|
|
1524
|
+
var breakpointOpacity = 0.15; // distance of stroke from right edge of circle
|
|
1525
|
+
|
|
1526
|
+
var _offsetDistance2 = (0, gaugeUtils_1.getProgressWidth)(maxValue - r.to, minValue, maxValue, circumference); // dashes at each gauge breakpoint after the major value
|
|
1527
|
+
|
|
1528
|
+
|
|
1371
1529
|
circles.push(React.createElement("circle", {
|
|
1372
1530
|
"data-test": "breakpoint-radial",
|
|
1373
1531
|
stroke: fontColor,
|
|
@@ -1384,6 +1542,7 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1384
1542
|
key: "breakpoint".concat(r.from)
|
|
1385
1543
|
}));
|
|
1386
1544
|
}
|
|
1545
|
+
|
|
1387
1546
|
if (i < formattedGaugeRanges.length - 1) {
|
|
1388
1547
|
var toTheta = toRadians(180 - (0, displayUtils_1.getRadialProgress)(r.to - minValue, minValue, maxValue) / 100 * 180);
|
|
1389
1548
|
var labelX = cx + (semicircleEdgeRadius + labelSpace) * Math.cos(toTheta);
|
|
@@ -1391,12 +1550,14 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1391
1550
|
var labelWidth = (0, gaugeUtils_1.computeTextWidth)(String(r.to), labelFontSizeString);
|
|
1392
1551
|
var vertOffset = (0, gaugeUtils_1.getVerticalLabelOffset)(toDegrees(toTheta), labelFontSize, maxOffset);
|
|
1393
1552
|
labelY += vertOffset;
|
|
1553
|
+
|
|
1394
1554
|
if (r.to < (maxValue + minValue) / 2) {
|
|
1395
1555
|
labelX -= labelWidth + vertOffset / 3;
|
|
1396
1556
|
} else if (r.to === (maxValue + minValue) / 2) {
|
|
1397
1557
|
labelX -= labelWidth / 2;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1558
|
+
} // labels of each gauge range, excluding min and max
|
|
1559
|
+
|
|
1560
|
+
|
|
1400
1561
|
labels.push(React.createElement("text", {
|
|
1401
1562
|
"data-test": "label",
|
|
1402
1563
|
fill: fontColor,
|
|
@@ -1405,12 +1566,13 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1405
1566
|
fontSize: labelFontSize,
|
|
1406
1567
|
key: "label".concat(r.from)
|
|
1407
1568
|
}, r.to));
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
// distance of stroke from right edge of circle
|
|
1412
|
-
|
|
1413
|
-
// inner radial for all gauge ranges
|
|
1569
|
+
} // width of stroke for each inner radial gauge range
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
var progressWidth = (0, gaugeUtils_1.getProgressWidth)(r.to - r.from, minValue, maxValue, innerCircumference); // distance of stroke from right edge of circle
|
|
1573
|
+
|
|
1574
|
+
var offsetDistance = (0, gaugeUtils_1.getProgressWidth)(maxValue - r.from, minValue, maxValue, innerCircumference); // inner radial for all gauge ranges
|
|
1575
|
+
|
|
1414
1576
|
circles.push(React.createElement("circle", {
|
|
1415
1577
|
"data-test": "inner-radial",
|
|
1416
1578
|
stroke: r.value,
|
|
@@ -1425,8 +1587,8 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1425
1587
|
cy: cy,
|
|
1426
1588
|
key: "inner".concat(r.from)
|
|
1427
1589
|
}));
|
|
1428
|
-
});
|
|
1429
|
-
|
|
1590
|
+
}); // min label
|
|
1591
|
+
|
|
1430
1592
|
labels.push(React.createElement("text", {
|
|
1431
1593
|
"data-test": "min-label",
|
|
1432
1594
|
fill: fontColor,
|
|
@@ -1434,8 +1596,8 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1434
1596
|
y: cy + labelFontSize,
|
|
1435
1597
|
fontSize: labelFontSize,
|
|
1436
1598
|
key: "min-label"
|
|
1437
|
-
}, minValue));
|
|
1438
|
-
|
|
1599
|
+
}, minValue)); // max label
|
|
1600
|
+
|
|
1439
1601
|
var maxLabelWidth = (0, gaugeUtils_1.computeTextWidth)(String(maxValue), labelFontSizeString);
|
|
1440
1602
|
labels.push(React.createElement("text", {
|
|
1441
1603
|
"data-test": "max-label",
|
|
@@ -1444,9 +1606,10 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1444
1606
|
y: cy + labelFontSize,
|
|
1445
1607
|
fontSize: labelFontSize,
|
|
1446
1608
|
key: "max-label"
|
|
1447
|
-
}, maxValue));
|
|
1448
|
-
|
|
1609
|
+
}, maxValue)); // dash to indicate majorValue
|
|
1610
|
+
|
|
1449
1611
|
showMarker = typeof majorValue === 'number' && formattedGaugeRanges.length >= 1;
|
|
1612
|
+
|
|
1450
1613
|
if (showMarker && majorValue > formattedGaugeRanges[0].from && majorValue <= formattedGaugeRanges[formattedGaugeRanges.length - 1].to) {
|
|
1451
1614
|
var progressWidth = (0, gaugeUtils_1.getProgressWidth)(maxValue - majorValue, minValue, maxValue, circumference);
|
|
1452
1615
|
var indicatorWidth = 1;
|
|
@@ -1465,6 +1628,7 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1465
1628
|
key: "indicator"
|
|
1466
1629
|
}));
|
|
1467
1630
|
}
|
|
1631
|
+
|
|
1468
1632
|
return React.createElement("svg", {
|
|
1469
1633
|
height: height,
|
|
1470
1634
|
width: width,
|
|
@@ -1489,6 +1653,7 @@ var GaugeGraph = function GaugeGraph(_ref) {
|
|
|
1489
1653
|
"data-test": "marker"
|
|
1490
1654
|
})));
|
|
1491
1655
|
};
|
|
1656
|
+
|
|
1492
1657
|
GaugeGraph.propTypes = {
|
|
1493
1658
|
width: T.number,
|
|
1494
1659
|
height: T.number,
|
|
@@ -1537,24 +1702,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
1537
1702
|
|
|
1538
1703
|
|
|
1539
1704
|
var _toConsumableArray = __webpack_require__(8);
|
|
1705
|
+
|
|
1540
1706
|
var _defineProperty = __webpack_require__(7);
|
|
1707
|
+
|
|
1541
1708
|
var __rest = this && this.__rest || function (s, e) {
|
|
1542
1709
|
var t = {};
|
|
1710
|
+
|
|
1543
1711
|
for (var p in s) {
|
|
1544
1712
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1545
1713
|
}
|
|
1714
|
+
|
|
1546
1715
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1547
1716
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1548
1717
|
}
|
|
1549
1718
|
return t;
|
|
1550
1719
|
};
|
|
1720
|
+
|
|
1551
1721
|
Object.defineProperty(exports, "__esModule", {
|
|
1552
1722
|
value: true
|
|
1553
1723
|
});
|
|
1554
1724
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
1725
|
+
|
|
1555
1726
|
var lodash_1 = __webpack_require__(3);
|
|
1727
|
+
|
|
1556
1728
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1729
|
+
|
|
1557
1730
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1731
|
+
|
|
1558
1732
|
var dynamicOptionsDSLType = {
|
|
1559
1733
|
type: 'string',
|
|
1560
1734
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -1564,20 +1738,22 @@ var dynamicOptionsDSLType = {
|
|
|
1564
1738
|
* @param optionsSchema a visualization's options schema
|
|
1565
1739
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
1566
1740
|
*/
|
|
1741
|
+
|
|
1567
1742
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
1568
1743
|
var enhancedOptionsSchema = {};
|
|
1569
1744
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
1570
1745
|
var _a = optionsSchema[key],
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1746
|
+
title = _a.title,
|
|
1747
|
+
description = _a.description,
|
|
1748
|
+
readOnly = _a.readOnly,
|
|
1749
|
+
writeOnly = _a.writeOnly,
|
|
1750
|
+
examples = _a.examples,
|
|
1751
|
+
defaultValue = _a.default,
|
|
1752
|
+
type = _a.type,
|
|
1753
|
+
properties = _a.properties,
|
|
1754
|
+
patternProperties = _a.patternProperties,
|
|
1755
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
1756
|
+
|
|
1581
1757
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
1582
1758
|
title: title
|
|
1583
1759
|
}), description !== undefined && {
|
|
@@ -1591,12 +1767,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1591
1767
|
}), defaultValue !== undefined && {
|
|
1592
1768
|
default: defaultValue
|
|
1593
1769
|
});
|
|
1770
|
+
|
|
1594
1771
|
if (type === 'object') {
|
|
1595
1772
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
1596
1773
|
type: type
|
|
1597
1774
|
}), properties && {
|
|
1598
1775
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
1599
1776
|
});
|
|
1777
|
+
|
|
1600
1778
|
if (patternProperties) {
|
|
1601
1779
|
var enhancedPatternProperties = {};
|
|
1602
1780
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -1614,6 +1792,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1614
1792
|
});
|
|
1615
1793
|
return enhancedOptionsSchema;
|
|
1616
1794
|
}
|
|
1795
|
+
|
|
1617
1796
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
1618
1797
|
/**
|
|
1619
1798
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -1622,11 +1801,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
1622
1801
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
1623
1802
|
* and containing `open: false` for all editor panels in editorConfig
|
|
1624
1803
|
*/
|
|
1804
|
+
|
|
1625
1805
|
function enhanceConfig(vizConfig) {
|
|
1626
1806
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
1807
|
+
|
|
1627
1808
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
1628
1809
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
1629
1810
|
}
|
|
1811
|
+
|
|
1630
1812
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
1631
1813
|
return Object.assign(Object.assign({}, config), {
|
|
1632
1814
|
open: config.open || false
|
|
@@ -1634,6 +1816,7 @@ function enhanceConfig(vizConfig) {
|
|
|
1634
1816
|
});
|
|
1635
1817
|
return enhancedConfig;
|
|
1636
1818
|
}
|
|
1819
|
+
|
|
1637
1820
|
exports.enhanceConfig = enhanceConfig;
|
|
1638
1821
|
/**
|
|
1639
1822
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -1641,6 +1824,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
1641
1824
|
* @param vizConfig a Visualization Config
|
|
1642
1825
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
1643
1826
|
*/
|
|
1827
|
+
|
|
1644
1828
|
function uncollapseEditorConfig(vizConfig) {
|
|
1645
1829
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
1646
1830
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -1650,13 +1834,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
1650
1834
|
});
|
|
1651
1835
|
return editorPanelUncollapsedConfig;
|
|
1652
1836
|
}
|
|
1837
|
+
|
|
1653
1838
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
1839
|
+
|
|
1654
1840
|
function isDynamicOption(option) {
|
|
1655
1841
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
1656
1842
|
}
|
|
1657
|
-
|
|
1658
|
-
// private helpers to improve readability of getInitialPreset
|
|
1843
|
+
|
|
1844
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
1659
1845
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
1846
|
+
|
|
1660
1847
|
/**
|
|
1661
1848
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
1662
1849
|
* if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
|
|
@@ -1665,6 +1852,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
1665
1852
|
*
|
|
1666
1853
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
1667
1854
|
*/
|
|
1855
|
+
|
|
1668
1856
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
1669
1857
|
var presetContextKeys = Object.keys(presetContext);
|
|
1670
1858
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -1674,6 +1862,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
1674
1862
|
/**
|
|
1675
1863
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
1676
1864
|
*/
|
|
1865
|
+
|
|
1866
|
+
|
|
1677
1867
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
1678
1868
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
1679
1869
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -1688,18 +1878,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
1688
1878
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
1689
1879
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
1690
1880
|
*/
|
|
1881
|
+
|
|
1882
|
+
|
|
1691
1883
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
1692
1884
|
return presets.find(function (preset) {
|
|
1693
1885
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
1694
1886
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
1695
1887
|
var presetContextKeys = Object.keys(presetContext);
|
|
1696
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
1697
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1888
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1698
1889
|
// if not, then the preset is invalid in config.ts
|
|
1890
|
+
|
|
1699
1891
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
1700
1892
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
1701
1893
|
});
|
|
1702
1894
|
}
|
|
1895
|
+
|
|
1703
1896
|
exports.getInitialPreset = getInitialPreset;
|
|
1704
1897
|
/**
|
|
1705
1898
|
* generates number precision values for a Select editor
|
|
@@ -1707,6 +1900,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
1707
1900
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
1708
1901
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
1709
1902
|
*/
|
|
1903
|
+
|
|
1710
1904
|
function generatePrecisionValues(numPrecisionValues) {
|
|
1711
1905
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
1712
1906
|
return {
|
|
@@ -1715,6 +1909,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
1715
1909
|
};
|
|
1716
1910
|
});
|
|
1717
1911
|
}
|
|
1912
|
+
|
|
1718
1913
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
1719
1914
|
/**
|
|
1720
1915
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -1724,12 +1919,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
1724
1919
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
1725
1920
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
1726
1921
|
*/
|
|
1922
|
+
|
|
1727
1923
|
var insertLayout = function insertLayout(layout, index) {
|
|
1728
1924
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1729
1925
|
layoutItems[_key - 2] = arguments[_key];
|
|
1730
1926
|
}
|
|
1927
|
+
|
|
1731
1928
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
1732
1929
|
};
|
|
1930
|
+
|
|
1733
1931
|
exports.insertLayout = insertLayout;
|
|
1734
1932
|
|
|
1735
1933
|
/***/ }),
|
|
@@ -1803,25 +2001,38 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1803
2001
|
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(49);
|
|
1804
2002
|
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
|
|
1805
2003
|
|
|
2004
|
+
|
|
1806
2005
|
function ownKeys(object, enumerableOnly) {
|
|
1807
2006
|
var keys = Object.keys(object);
|
|
2007
|
+
|
|
1808
2008
|
if (Object.getOwnPropertySymbols) {
|
|
1809
2009
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
1810
|
-
enumerableOnly
|
|
2010
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
1811
2011
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1812
|
-
})
|
|
2012
|
+
});
|
|
2013
|
+
keys.push.apply(keys, symbols);
|
|
1813
2014
|
}
|
|
2015
|
+
|
|
1814
2016
|
return keys;
|
|
1815
2017
|
}
|
|
2018
|
+
|
|
1816
2019
|
function _objectSpread(target) {
|
|
1817
2020
|
for (var i = 1; i < arguments.length; i++) {
|
|
1818
|
-
var source =
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
2021
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
2022
|
+
|
|
2023
|
+
if (i % 2) {
|
|
2024
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
2025
|
+
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
|
|
2026
|
+
});
|
|
2027
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
2028
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
2029
|
+
} else {
|
|
2030
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
2031
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
1824
2034
|
}
|
|
2035
|
+
|
|
1825
2036
|
return target;
|
|
1826
2037
|
}
|
|
1827
2038
|
|
|
@@ -1829,6 +2040,7 @@ function _objectSpread(target) {
|
|
|
1829
2040
|
|
|
1830
2041
|
|
|
1831
2042
|
|
|
2043
|
+
|
|
1832
2044
|
var DEFAULT_FONT = 12;
|
|
1833
2045
|
var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
|
|
1834
2046
|
var SVR_PADDING = {
|
|
@@ -1837,28 +2049,27 @@ var SVR_PADDING = {
|
|
|
1837
2049
|
left: 16,
|
|
1838
2050
|
right: 16
|
|
1839
2051
|
};
|
|
1840
|
-
|
|
1841
2052
|
/**
|
|
1842
2053
|
* @method shouldShowTrend
|
|
1843
2054
|
* @param {String} trendDisplay
|
|
1844
2055
|
* @returns {Bool}
|
|
1845
2056
|
*/
|
|
2057
|
+
|
|
1846
2058
|
var shouldShowTrend = function shouldShowTrend(trendDisplay) {
|
|
1847
2059
|
return trendDisplay === 'absolute' || trendDisplay === 'percent';
|
|
1848
2060
|
};
|
|
1849
|
-
|
|
1850
2061
|
/**
|
|
1851
2062
|
* @method isLoadingOrNoColumns
|
|
1852
2063
|
* @param {Object} dataSources
|
|
1853
2064
|
* @param {Boolean} loading
|
|
1854
2065
|
* @returns {Boolean} return true if loading or without columns in dataSources
|
|
1855
2066
|
*/
|
|
2067
|
+
|
|
1856
2068
|
var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
1857
2069
|
var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
|
|
1858
2070
|
var noColumns = data === undefined;
|
|
1859
2071
|
return loading || noColumns;
|
|
1860
2072
|
};
|
|
1861
|
-
|
|
1862
2073
|
/**
|
|
1863
2074
|
* Retrieve the valid formatted color
|
|
1864
2075
|
* @method getFormattedColor
|
|
@@ -1866,30 +2077,30 @@ var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
|
1866
2077
|
* @param {String} defaultColor
|
|
1867
2078
|
* @returns {String} the formatted color
|
|
1868
2079
|
*/
|
|
2080
|
+
|
|
1869
2081
|
var getFormattedColor = function getFormattedColor(color, defaultColor) {
|
|
1870
2082
|
return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
|
|
1871
2083
|
};
|
|
1872
|
-
|
|
1873
2084
|
/**
|
|
1874
2085
|
* Determines if there is a background color
|
|
1875
2086
|
* @method hasBackground
|
|
1876
2087
|
* @param {String} backgroundColor
|
|
1877
2088
|
* @returns true for non-transparent background color
|
|
1878
2089
|
*/
|
|
2090
|
+
|
|
1879
2091
|
var hasBackground = function hasBackground(backgroundColor) {
|
|
1880
2092
|
return !!backgroundColor && backgroundColor !== 'transparent';
|
|
1881
2093
|
};
|
|
1882
|
-
|
|
1883
2094
|
/**
|
|
1884
2095
|
* @method isIdenticalColor
|
|
1885
2096
|
* @param {String} colorA
|
|
1886
2097
|
* @param {String} colorB
|
|
1887
2098
|
* @returns {Boolean}
|
|
1888
2099
|
*/
|
|
2100
|
+
|
|
1889
2101
|
var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
1890
2102
|
return !!colorA && !!colorB && Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorA.toLowerCase()) === Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(colorB.toLowerCase());
|
|
1891
2103
|
};
|
|
1892
|
-
|
|
1893
2104
|
/*
|
|
1894
2105
|
* @method getDefaultColorWithBg
|
|
1895
2106
|
* @param {Object} props
|
|
@@ -1898,13 +2109,13 @@ var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
|
1898
2109
|
* @param {String} props.defaultBlockFontColor
|
|
1899
2110
|
* @returns {String} defaultColor
|
|
1900
2111
|
*/
|
|
2112
|
+
|
|
1901
2113
|
var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
1902
2114
|
var backgroundColor = _ref.backgroundColor,
|
|
1903
|
-
|
|
1904
|
-
|
|
2115
|
+
defaultFontColor = _ref.defaultFontColor,
|
|
2116
|
+
defaultBlockFontColor = _ref.defaultBlockFontColor;
|
|
1905
2117
|
return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
|
|
1906
2118
|
};
|
|
1907
|
-
|
|
1908
2119
|
/*
|
|
1909
2120
|
* @method getMajorColor
|
|
1910
2121
|
* return formatted majorColor.
|
|
@@ -1915,15 +2126,16 @@ var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
|
1915
2126
|
* @param {String} props.defaultBlockFontColor
|
|
1916
2127
|
* @returns {String} majorColor
|
|
1917
2128
|
*/
|
|
2129
|
+
|
|
1918
2130
|
var getMajorColor = function getMajorColor(_ref2) {
|
|
1919
2131
|
var majorColor = _ref2.majorColor,
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
// If backgroundColor is set, but no majorColor,
|
|
2132
|
+
backgroundColor = _ref2.backgroundColor,
|
|
2133
|
+
defaultFontColor = _ref2.defaultFontColor,
|
|
2134
|
+
defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
|
|
1924
2135
|
// the default majorColor will turn to be defaultBlockFontColor.
|
|
1925
2136
|
// eg: major color will turn to be white in enterprise mode.
|
|
1926
2137
|
// however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
|
|
2138
|
+
|
|
1927
2139
|
if (hasBackground(backgroundColor) && !majorColor) {
|
|
1928
2140
|
return getDefaultColorWithBg({
|
|
1929
2141
|
backgroundColor: backgroundColor,
|
|
@@ -1931,9 +2143,9 @@ var getMajorColor = function getMajorColor(_ref2) {
|
|
|
1931
2143
|
defaultBlockFontColor: defaultBlockFontColor
|
|
1932
2144
|
});
|
|
1933
2145
|
}
|
|
2146
|
+
|
|
1934
2147
|
return getFormattedColor(majorColor, defaultFontColor);
|
|
1935
2148
|
};
|
|
1936
|
-
|
|
1937
2149
|
/**
|
|
1938
2150
|
* Get the color for the trend components
|
|
1939
2151
|
* @method getTrendColor
|
|
@@ -1946,35 +2158,41 @@ var getMajorColor = function getMajorColor(_ref2) {
|
|
|
1946
2158
|
* @param {Object} defaultColors
|
|
1947
2159
|
* @returns {String} trendColor
|
|
1948
2160
|
*/
|
|
2161
|
+
|
|
1949
2162
|
var getTrendColor = function getTrendColor(_ref3) {
|
|
1950
2163
|
var trendColor = _ref3.trendColor,
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
2164
|
+
trendValue = _ref3.trendValue,
|
|
2165
|
+
majorValue = _ref3.majorValue,
|
|
2166
|
+
customizedBgColor = _ref3.customizedBgColor,
|
|
2167
|
+
trendDisplay = _ref3.trendDisplay,
|
|
2168
|
+
defaultColors = _ref3.defaultColors;
|
|
2169
|
+
|
|
1956
2170
|
if (trendColor) {
|
|
1957
2171
|
return trendColor;
|
|
1958
2172
|
}
|
|
2173
|
+
|
|
1959
2174
|
if (Number.isNaN(Number(trendValue))) {
|
|
1960
2175
|
return undefined;
|
|
1961
2176
|
}
|
|
2177
|
+
|
|
1962
2178
|
var defaultFontColor = defaultColors.defaultFontColor,
|
|
1963
|
-
|
|
1964
|
-
|
|
2179
|
+
defaultBlockFontColor = defaultColors.defaultBlockFontColor,
|
|
2180
|
+
defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
|
|
2181
|
+
|
|
1965
2182
|
if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
|
|
1966
2183
|
return defaultBlockFontColor;
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
// if trendDisplay is percent, and trendValue === value
|
|
2184
|
+
} // if trendDisplay is percent, and trendValue === value
|
|
1970
2185
|
// the trend percent = trendValue / (value - trendValue) will return Infinity
|
|
2186
|
+
|
|
2187
|
+
|
|
1971
2188
|
var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
|
|
2189
|
+
|
|
1972
2190
|
if (trendValue === 0 || isInvalidTrend) {
|
|
1973
2191
|
return defaultFontColor;
|
|
1974
2192
|
}
|
|
2193
|
+
|
|
1975
2194
|
return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
|
|
1976
2195
|
};
|
|
1977
|
-
|
|
1978
2196
|
/**
|
|
1979
2197
|
* Computes visualization properties for display component
|
|
1980
2198
|
* @method computeColors
|
|
@@ -1987,6 +2205,7 @@ var getTrendColor = function getTrendColor(_ref3) {
|
|
|
1987
2205
|
* @returns {String} trendColor
|
|
1988
2206
|
* @returns {String} underLabelColor
|
|
1989
2207
|
*/
|
|
2208
|
+
|
|
1990
2209
|
var computeColors = function computeColors(props, defaultColors) {
|
|
1991
2210
|
var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
|
|
1992
2211
|
var backgroundEnabled = hasBackground(backgroundColor);
|
|
@@ -2003,8 +2222,8 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
2003
2222
|
customizedBgColor: props.backgroundColor,
|
|
2004
2223
|
trendDisplay: props.trendDisplay,
|
|
2005
2224
|
defaultColors: defaultColors
|
|
2006
|
-
});
|
|
2007
|
-
|
|
2225
|
+
}); // todo: need change it to not depend on majorColor
|
|
2226
|
+
|
|
2008
2227
|
var underLabelColor = majorColor;
|
|
2009
2228
|
return {
|
|
2010
2229
|
backgroundColor: backgroundColor,
|
|
@@ -2014,7 +2233,6 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
2014
2233
|
underLabelColor: underLabelColor
|
|
2015
2234
|
};
|
|
2016
2235
|
};
|
|
2017
|
-
|
|
2018
2236
|
/**
|
|
2019
2237
|
* Format and return the value (major/trend)
|
|
2020
2238
|
* @method computeText
|
|
@@ -2025,21 +2243,21 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
2025
2243
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
2026
2244
|
* @returns {Number} major or trend text
|
|
2027
2245
|
*/
|
|
2246
|
+
|
|
2028
2247
|
var computeText = function computeText(_ref4) {
|
|
2029
2248
|
var value = _ref4.value,
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2249
|
+
numberPrecision = _ref4.numberPrecision,
|
|
2250
|
+
shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
|
|
2251
|
+
shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
|
|
2033
2252
|
var text = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(value) ? Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["formatNumber"])(value, numberPrecision, {
|
|
2034
2253
|
useThousandSeparators: shouldUseThousandSeparators,
|
|
2035
2254
|
// todo: need update formatNumber
|
|
2036
2255
|
useTrendUnits: shouldAbbreviateTrendValue
|
|
2037
|
-
}) : value;
|
|
2038
|
-
|
|
2256
|
+
}) : value; // When text is undefined, return empty string
|
|
2257
|
+
|
|
2039
2258
|
text = text || '';
|
|
2040
2259
|
return text;
|
|
2041
2260
|
};
|
|
2042
|
-
|
|
2043
2261
|
/*
|
|
2044
2262
|
* @method getMajorText
|
|
2045
2263
|
* @param {Object} props
|
|
@@ -2048,10 +2266,11 @@ var computeText = function computeText(_ref4) {
|
|
|
2048
2266
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
2049
2267
|
* @returns {String} majorText
|
|
2050
2268
|
*/
|
|
2269
|
+
|
|
2051
2270
|
var getMajorText = function getMajorText(_ref5) {
|
|
2052
2271
|
var majorValue = _ref5.majorValue,
|
|
2053
|
-
|
|
2054
|
-
|
|
2272
|
+
numberPrecision = _ref5.numberPrecision,
|
|
2273
|
+
shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
|
|
2055
2274
|
return computeText({
|
|
2056
2275
|
value: majorValue === null ? 'N/A' : majorValue,
|
|
2057
2276
|
// if majorValue is null, use `N/A`.
|
|
@@ -2060,7 +2279,6 @@ var getMajorText = function getMajorText(_ref5) {
|
|
|
2060
2279
|
shouldAbbreviateTrendValue: false
|
|
2061
2280
|
});
|
|
2062
2281
|
};
|
|
2063
|
-
|
|
2064
2282
|
/*
|
|
2065
2283
|
* @method getTrendText
|
|
2066
2284
|
* @param {Object} props
|
|
@@ -2072,13 +2290,15 @@ var getMajorText = function getMajorText(_ref5) {
|
|
|
2072
2290
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
2073
2291
|
* @returns {String} trendText
|
|
2074
2292
|
*/
|
|
2293
|
+
|
|
2075
2294
|
var getTrendText = function getTrendText(_ref6) {
|
|
2076
2295
|
var majorValue = _ref6.majorValue,
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2296
|
+
trendValue = _ref6.trendValue,
|
|
2297
|
+
trendDisplay = _ref6.trendDisplay,
|
|
2298
|
+
numberPrecision = _ref6.numberPrecision,
|
|
2299
|
+
shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
|
|
2300
|
+
shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
|
|
2301
|
+
|
|
2082
2302
|
var compute = function compute(value) {
|
|
2083
2303
|
return computeText({
|
|
2084
2304
|
value: value,
|
|
@@ -2087,25 +2307,31 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
2087
2307
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2088
2308
|
});
|
|
2089
2309
|
};
|
|
2310
|
+
|
|
2090
2311
|
if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
|
|
2091
2312
|
return '';
|
|
2092
2313
|
}
|
|
2314
|
+
|
|
2093
2315
|
var showPercent = trendDisplay === 'percent';
|
|
2316
|
+
|
|
2094
2317
|
if (!showPercent) {
|
|
2095
2318
|
return compute(trendValue);
|
|
2096
2319
|
}
|
|
2320
|
+
|
|
2097
2321
|
var diff = Math.abs(trendValue - majorValue);
|
|
2098
2322
|
var val = Math.round(trendValue / diff * 100);
|
|
2323
|
+
|
|
2099
2324
|
if (trendValue === 0 && diff === 0) {
|
|
2100
2325
|
val = 0;
|
|
2101
2326
|
}
|
|
2327
|
+
|
|
2102
2328
|
if (!Number.isFinite(val)) {
|
|
2103
2329
|
return 'N/A';
|
|
2104
2330
|
}
|
|
2331
|
+
|
|
2105
2332
|
var text = compute(val);
|
|
2106
2333
|
return "".concat(text, "%");
|
|
2107
2334
|
};
|
|
2108
|
-
|
|
2109
2335
|
/**
|
|
2110
2336
|
* Helper to determine the font size for an element
|
|
2111
2337
|
* @method computeFontSize
|
|
@@ -2117,16 +2343,16 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
2117
2343
|
* @param {String} [fontWeight='normal'] Boldness of font
|
|
2118
2344
|
* @returns {Number} The size to use for fontSize styles
|
|
2119
2345
|
*/
|
|
2346
|
+
|
|
2120
2347
|
var computeFontSize = function computeFontSize(text, _ref7) {
|
|
2121
2348
|
var width = _ref7.width,
|
|
2122
|
-
|
|
2349
|
+
height = _ref7.height;
|
|
2123
2350
|
var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
|
|
2124
2351
|
var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
|
|
2125
2352
|
var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
|
|
2126
2353
|
var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
|
|
2127
2354
|
return parseInt(fontSize, 10);
|
|
2128
2355
|
};
|
|
2129
|
-
|
|
2130
2356
|
/*
|
|
2131
2357
|
* @method getMajorFontSize
|
|
2132
2358
|
* @param {Object} props
|
|
@@ -2137,20 +2363,20 @@ var computeFontSize = function computeFontSize(text, _ref7) {
|
|
|
2137
2363
|
* @param {Number} props.spaceRatio
|
|
2138
2364
|
* @returns {Number} majorFontSize
|
|
2139
2365
|
*/
|
|
2366
|
+
|
|
2140
2367
|
var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
2141
2368
|
var width = _ref8.width,
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2369
|
+
height = _ref8.height,
|
|
2370
|
+
unit = _ref8.unit,
|
|
2371
|
+
majorText = _ref8.majorText,
|
|
2372
|
+
_ref8$spaceRatio = _ref8.spaceRatio,
|
|
2373
|
+
spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
|
|
2147
2374
|
var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
|
|
2148
2375
|
return computeFontSize(majorTextCalc, {
|
|
2149
2376
|
width: width * spaceRatio,
|
|
2150
2377
|
height: height
|
|
2151
2378
|
});
|
|
2152
2379
|
};
|
|
2153
|
-
|
|
2154
2380
|
/*
|
|
2155
2381
|
* @method getTrendFontSize
|
|
2156
2382
|
* @param {Object} props
|
|
@@ -2160,13 +2386,15 @@ var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
|
2160
2386
|
* @param {Number} props.spaceRatio
|
|
2161
2387
|
* @returns {Number} trendFontSize
|
|
2162
2388
|
*/
|
|
2389
|
+
|
|
2163
2390
|
var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
2164
2391
|
var width = _ref9.width,
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2392
|
+
height = _ref9.height,
|
|
2393
|
+
trendText = _ref9.trendText,
|
|
2394
|
+
_ref9$spaceRatio = _ref9.spaceRatio,
|
|
2395
|
+
spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
|
|
2169
2396
|
var trendFontSize = 12;
|
|
2397
|
+
|
|
2170
2398
|
if (spaceRatio > 0) {
|
|
2171
2399
|
trendFontSize = computeFontSize(trendText, {
|
|
2172
2400
|
width: width * spaceRatio,
|
|
@@ -2174,18 +2402,18 @@ var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
|
2174
2402
|
});
|
|
2175
2403
|
trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
|
|
2176
2404
|
}
|
|
2405
|
+
|
|
2177
2406
|
return trendFontSize;
|
|
2178
2407
|
};
|
|
2179
|
-
|
|
2180
2408
|
/*
|
|
2181
2409
|
* The height of underLabel should no more than 12px
|
|
2182
2410
|
* @param {Number} height
|
|
2183
2411
|
* @return {Number} height || DEFAULT_FONT
|
|
2184
2412
|
*/
|
|
2413
|
+
|
|
2185
2414
|
var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
2186
2415
|
return height > DEFAULT_FONT ? DEFAULT_FONT : height;
|
|
2187
2416
|
};
|
|
2188
|
-
|
|
2189
2417
|
/*
|
|
2190
2418
|
* @param {Object} config
|
|
2191
2419
|
* @param {String} underLabel
|
|
@@ -2193,19 +2421,18 @@ var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
|
2193
2421
|
* @param {Number} height height of underLabel
|
|
2194
2422
|
* @param {Number} fond size of underLabel
|
|
2195
2423
|
*/
|
|
2424
|
+
|
|
2196
2425
|
var getUnderLabel = function getUnderLabel(_ref10) {
|
|
2197
2426
|
var underLabel = _ref10.underLabel,
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
return (
|
|
2201
|
-
// todo: may need truncate underLabel later
|
|
2427
|
+
width = _ref10.width,
|
|
2428
|
+
height = _ref10.height;
|
|
2429
|
+
return (// todo: may need truncate underLabel later
|
|
2202
2430
|
computeFontSize(underLabel, {
|
|
2203
2431
|
width: width,
|
|
2204
2432
|
height: height
|
|
2205
2433
|
})
|
|
2206
2434
|
);
|
|
2207
2435
|
};
|
|
2208
|
-
|
|
2209
2436
|
/**
|
|
2210
2437
|
* Compute value and font size for major and trend
|
|
2211
2438
|
* @method getMajorAndTrend
|
|
@@ -2223,18 +2450,19 @@ var getUnderLabel = function getUnderLabel(_ref10) {
|
|
|
2223
2450
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
2224
2451
|
* @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
|
|
2225
2452
|
*/
|
|
2453
|
+
|
|
2226
2454
|
var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
2227
2455
|
var width = _ref11.width,
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2456
|
+
height = _ref11.height,
|
|
2457
|
+
majorValue = _ref11.majorValue,
|
|
2458
|
+
trendValue = _ref11.trendValue,
|
|
2459
|
+
majorFontSize = _ref11.majorFontSize,
|
|
2460
|
+
trendFontSize = _ref11.trendFontSize,
|
|
2461
|
+
trendDisplay = _ref11.trendDisplay,
|
|
2462
|
+
unit = _ref11.unit,
|
|
2463
|
+
numberPrecision = _ref11.numberPrecision,
|
|
2464
|
+
shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
|
|
2465
|
+
shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
|
|
2238
2466
|
var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
|
|
2239
2467
|
var textContentWidth = width * 0.9;
|
|
2240
2468
|
var textContentHeight = height * 0.9;
|
|
@@ -2271,7 +2499,6 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
2271
2499
|
trendTextFontSize: trendTextFontSize
|
|
2272
2500
|
};
|
|
2273
2501
|
};
|
|
2274
|
-
|
|
2275
2502
|
/*
|
|
2276
2503
|
* @method updateVizInSmallSpace
|
|
2277
2504
|
* @param {Object} props
|
|
@@ -2291,25 +2518,26 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
2291
2518
|
* @returns {Object} results.newMajorAndTrend
|
|
2292
2519
|
* @returns {Object} results.updatedProps
|
|
2293
2520
|
*/
|
|
2521
|
+
|
|
2294
2522
|
var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
2295
2523
|
var width = _ref12.width,
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2524
|
+
height = _ref12.height,
|
|
2525
|
+
toRemoveList = _ref12.toRemoveList,
|
|
2526
|
+
majorValue = _ref12.majorValue,
|
|
2527
|
+
trendValue = _ref12.trendValue,
|
|
2528
|
+
majorFontSize = _ref12.majorFontSize,
|
|
2529
|
+
trendFontSize = _ref12.trendFontSize,
|
|
2530
|
+
majorTextFontSize = _ref12.majorTextFontSize,
|
|
2531
|
+
unit = _ref12.unit,
|
|
2532
|
+
numberPrecision = _ref12.numberPrecision,
|
|
2533
|
+
shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
|
|
2534
|
+
shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
|
|
2307
2535
|
var removeIndex = 0;
|
|
2308
2536
|
var newProps = {}; // options need to be updated
|
|
2537
|
+
|
|
2309
2538
|
var newMajorAndTrend = {};
|
|
2310
|
-
var newTextSize = majorTextFontSize;
|
|
2539
|
+
var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
|
|
2311
2540
|
|
|
2312
|
-
// remove info on viz to make textFontSize >= 12px;
|
|
2313
2541
|
while (newTextSize < 12 && removeIndex < toRemoveList.length) {
|
|
2314
2542
|
var toRemove = toRemoveList[removeIndex];
|
|
2315
2543
|
newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
|
|
@@ -2327,9 +2555,9 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2327
2555
|
}, newProps));
|
|
2328
2556
|
newTextSize = newMajorAndTrend.majorTextFontSize;
|
|
2329
2557
|
removeIndex += 1;
|
|
2330
|
-
}
|
|
2558
|
+
} // truncate text if textFontSize is still less than 12
|
|
2559
|
+
|
|
2331
2560
|
|
|
2332
|
-
// truncate text if textFontSize is still less than 12
|
|
2333
2561
|
if (newTextSize < 12) {
|
|
2334
2562
|
var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
|
|
2335
2563
|
newMajorAndTrend = getMajorAndTrend(_objectSpread({
|
|
@@ -2345,12 +2573,12 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2345
2573
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2346
2574
|
}, newProps));
|
|
2347
2575
|
}
|
|
2576
|
+
|
|
2348
2577
|
return {
|
|
2349
2578
|
newMajorAndTrend: newMajorAndTrend,
|
|
2350
2579
|
updatedProps: newProps
|
|
2351
2580
|
};
|
|
2352
2581
|
};
|
|
2353
|
-
|
|
2354
2582
|
/*
|
|
2355
2583
|
* @method computeSingleValueContent
|
|
2356
2584
|
* @param {Object} props
|
|
@@ -2376,67 +2604,71 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2376
2604
|
* @returns {String} results.majorValueTitle
|
|
2377
2605
|
* @returns {Object} results.smallVizProps
|
|
2378
2606
|
*/
|
|
2607
|
+
|
|
2379
2608
|
var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
2380
2609
|
var contentWidth = _ref13.contentWidth,
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2610
|
+
contentHeight = _ref13.contentHeight,
|
|
2611
|
+
containerWidth = _ref13.containerWidth,
|
|
2612
|
+
containerHeight = _ref13.containerHeight,
|
|
2613
|
+
majorValue = _ref13.majorValue,
|
|
2614
|
+
trendValue = _ref13.trendValue,
|
|
2615
|
+
majorFontSize = _ref13.majorFontSize,
|
|
2616
|
+
trendFontSize = _ref13.trendFontSize,
|
|
2617
|
+
trendDisplay = _ref13.trendDisplay,
|
|
2618
|
+
unit = _ref13.unit,
|
|
2619
|
+
numberPrecision = _ref13.numberPrecision,
|
|
2620
|
+
shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
|
|
2621
|
+
shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
|
|
2622
|
+
toRemoveList = _ref13.toRemoveList;
|
|
2623
|
+
|
|
2394
2624
|
var _getMajorAndTrend = getMajorAndTrend({
|
|
2625
|
+
majorValue: majorValue,
|
|
2626
|
+
trendValue: trendValue,
|
|
2627
|
+
majorFontSize: majorFontSize,
|
|
2628
|
+
trendFontSize: trendFontSize,
|
|
2629
|
+
trendDisplay: trendDisplay,
|
|
2630
|
+
width: contentWidth,
|
|
2631
|
+
height: contentHeight,
|
|
2632
|
+
unit: unit,
|
|
2633
|
+
numberPrecision: numberPrecision,
|
|
2634
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2635
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2636
|
+
}),
|
|
2637
|
+
majorText = _getMajorAndTrend.majorText,
|
|
2638
|
+
trendText = _getMajorAndTrend.trendText,
|
|
2639
|
+
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
2640
|
+
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
2641
|
+
|
|
2642
|
+
var majorValueTitle = majorText;
|
|
2643
|
+
var smallVizProps = {}; // update viz in small space
|
|
2644
|
+
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
2645
|
+
// or truncate major value to make the major font size >= 12
|
|
2646
|
+
|
|
2647
|
+
if (majorTextFontSize < 12) {
|
|
2648
|
+
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
2649
|
+
width: containerWidth,
|
|
2650
|
+
height: containerHeight,
|
|
2651
|
+
toRemoveList: toRemoveList,
|
|
2395
2652
|
majorValue: majorValue,
|
|
2396
2653
|
trendValue: trendValue,
|
|
2397
2654
|
majorFontSize: majorFontSize,
|
|
2398
2655
|
trendFontSize: trendFontSize,
|
|
2399
|
-
|
|
2400
|
-
width: contentWidth,
|
|
2401
|
-
height: contentHeight,
|
|
2656
|
+
majorTextFontSize: majorTextFontSize,
|
|
2402
2657
|
unit: unit,
|
|
2403
2658
|
numberPrecision: numberPrecision,
|
|
2404
2659
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2405
2660
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2406
2661
|
}),
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
2410
|
-
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
2411
|
-
var majorValueTitle = majorText;
|
|
2412
|
-
var smallVizProps = {};
|
|
2662
|
+
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
2663
|
+
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
2413
2664
|
|
|
2414
|
-
// update viz in small space
|
|
2415
|
-
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
2416
|
-
// or truncate major value to make the major font size >= 12
|
|
2417
|
-
if (majorTextFontSize < 12) {
|
|
2418
|
-
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
2419
|
-
width: containerWidth,
|
|
2420
|
-
height: containerHeight,
|
|
2421
|
-
toRemoveList: toRemoveList,
|
|
2422
|
-
majorValue: majorValue,
|
|
2423
|
-
trendValue: trendValue,
|
|
2424
|
-
majorFontSize: majorFontSize,
|
|
2425
|
-
trendFontSize: trendFontSize,
|
|
2426
|
-
majorTextFontSize: majorTextFontSize,
|
|
2427
|
-
unit: unit,
|
|
2428
|
-
numberPrecision: numberPrecision,
|
|
2429
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2430
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2431
|
-
}),
|
|
2432
|
-
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
2433
|
-
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
2434
2665
|
majorText = newMajorAndTrend.majorText;
|
|
2435
2666
|
trendText = newMajorAndTrend.trendText;
|
|
2436
2667
|
majorTextFontSize = newMajorAndTrend.majorTextFontSize;
|
|
2437
2668
|
trendTextFontSize = newMajorAndTrend.trendTextFontSize;
|
|
2438
2669
|
smallVizProps = updatedProps;
|
|
2439
2670
|
}
|
|
2671
|
+
|
|
2440
2672
|
return {
|
|
2441
2673
|
majorText: majorText,
|
|
2442
2674
|
trendText: trendText,
|
|
@@ -2448,17 +2680,17 @@ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
|
2448
2680
|
};
|
|
2449
2681
|
var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
|
|
2450
2682
|
var text = _ref14.text,
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2683
|
+
_ref14$fontSize = _ref14.fontSize,
|
|
2684
|
+
fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
|
|
2685
|
+
_ref14$fontFamily = _ref14.fontFamily,
|
|
2686
|
+
fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
|
|
2687
|
+
_ref14$fontWeight = _ref14.fontWeight,
|
|
2688
|
+
fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
|
|
2689
|
+
containerWidth = _ref14.containerWidth;
|
|
2458
2690
|
var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
2459
2691
|
var modifiedText = text;
|
|
2460
|
-
var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
2461
|
-
|
|
2692
|
+
var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily)); // `containerWidth - ellipsesLength > 0` condition ensures space even exists for text.
|
|
2693
|
+
|
|
2462
2694
|
if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
|
|
2463
2695
|
// Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
|
|
2464
2696
|
// `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
|
|
@@ -2467,11 +2699,12 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
2467
2699
|
modifiedText = modifiedText.substring(0, modifiedText.length - 1);
|
|
2468
2700
|
textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
|
|
2469
2701
|
}
|
|
2702
|
+
|
|
2470
2703
|
modifiedText = "".concat(modifiedText, "...");
|
|
2471
2704
|
}
|
|
2705
|
+
|
|
2472
2706
|
return modifiedText;
|
|
2473
2707
|
};
|
|
2474
|
-
|
|
2475
2708
|
/*
|
|
2476
2709
|
* @method computeSingleValueRadialContent
|
|
2477
2710
|
* @param {Object} props
|
|
@@ -2498,44 +2731,46 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
2498
2731
|
* @returns {String} results.majorValueTitle
|
|
2499
2732
|
* @returns {Object} results.smallVizProps
|
|
2500
2733
|
*/
|
|
2734
|
+
|
|
2501
2735
|
var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
|
|
2502
2736
|
var contentWidth = _ref15.contentWidth,
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2737
|
+
contentHeight = _ref15.contentHeight,
|
|
2738
|
+
containerWidth = _ref15.containerWidth,
|
|
2739
|
+
containerHeight = _ref15.containerHeight,
|
|
2740
|
+
majorValue = _ref15.majorValue,
|
|
2741
|
+
trendValue = _ref15.trendValue,
|
|
2742
|
+
majorFontSize = _ref15.majorFontSize,
|
|
2743
|
+
trendFontSize = _ref15.trendFontSize,
|
|
2744
|
+
trendDisplay = _ref15.trendDisplay,
|
|
2745
|
+
unit = _ref15.unit,
|
|
2746
|
+
numberPrecision = _ref15.numberPrecision,
|
|
2747
|
+
shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
|
|
2748
|
+
shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
|
|
2749
|
+
smallViz = _ref15.smallViz;
|
|
2750
|
+
|
|
2516
2751
|
var _getMajorAndTrend2 = getMajorAndTrend({
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
var majorValueTitle = majorText;
|
|
2534
|
-
var smallVizProps = {};
|
|
2752
|
+
majorValue: majorValue,
|
|
2753
|
+
trendValue: trendValue,
|
|
2754
|
+
majorFontSize: majorFontSize,
|
|
2755
|
+
trendFontSize: trendFontSize,
|
|
2756
|
+
trendDisplay: trendDisplay,
|
|
2757
|
+
width: contentWidth,
|
|
2758
|
+
height: contentHeight,
|
|
2759
|
+
unit: unit,
|
|
2760
|
+
numberPrecision: numberPrecision,
|
|
2761
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2762
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2763
|
+
}),
|
|
2764
|
+
majorText = _getMajorAndTrend2.majorText,
|
|
2765
|
+
trendText = _getMajorAndTrend2.trendText,
|
|
2766
|
+
majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
|
|
2767
|
+
trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
|
|
2535
2768
|
|
|
2536
|
-
|
|
2769
|
+
var majorValueTitle = majorText;
|
|
2770
|
+
var smallVizProps = {}; // custom logic for viz in small space
|
|
2537
2771
|
// if not showing the radial graph (if `smallViz` is true), then compute truncated major value
|
|
2538
2772
|
// and font sizes
|
|
2773
|
+
|
|
2539
2774
|
if (smallViz) {
|
|
2540
2775
|
var truncateValue = minimallyTruncateStringToWidth({
|
|
2541
2776
|
text: majorValue,
|
|
@@ -2543,6 +2778,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2543
2778
|
fontSize: 12,
|
|
2544
2779
|
containerWidth: containerWidth
|
|
2545
2780
|
});
|
|
2781
|
+
|
|
2546
2782
|
var _getMajorAndTrend3 = getMajorAndTrend({
|
|
2547
2783
|
majorValue: truncateValue,
|
|
2548
2784
|
trendValue: trendValue,
|
|
@@ -2556,6 +2792,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2556
2792
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2557
2793
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2558
2794
|
});
|
|
2795
|
+
|
|
2559
2796
|
majorText = _getMajorAndTrend3.majorText;
|
|
2560
2797
|
trendText = _getMajorAndTrend3.trendText;
|
|
2561
2798
|
majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
|
|
@@ -2565,6 +2802,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2565
2802
|
unit: unit
|
|
2566
2803
|
};
|
|
2567
2804
|
}
|
|
2805
|
+
|
|
2568
2806
|
return {
|
|
2569
2807
|
majorText: majorText,
|
|
2570
2808
|
trendText: trendText,
|
|
@@ -2574,7 +2812,6 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2574
2812
|
smallVizProps: smallVizProps
|
|
2575
2813
|
};
|
|
2576
2814
|
};
|
|
2577
|
-
|
|
2578
2815
|
/**
|
|
2579
2816
|
* Get the colors for a graph
|
|
2580
2817
|
*
|
|
@@ -2587,21 +2824,22 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2587
2824
|
* @returns {Object} { background, stroke } colors
|
|
2588
2825
|
* @private
|
|
2589
2826
|
*/
|
|
2827
|
+
|
|
2590
2828
|
var getGraphColors = function getGraphColors(_ref16) {
|
|
2591
2829
|
var backgroundEnabled = _ref16.backgroundEnabled,
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2830
|
+
backgroundColor = _ref16.backgroundColor,
|
|
2831
|
+
defaultColors = _ref16.defaultColors,
|
|
2832
|
+
customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
|
|
2833
|
+
|
|
2596
2834
|
if (backgroundEnabled) {
|
|
2597
2835
|
// Check if the user defined colors to use
|
|
2598
2836
|
if (backgroundColor && typeof customColorFormatter === 'function') {
|
|
2599
2837
|
return customColorFormatter(backgroundColor);
|
|
2600
2838
|
}
|
|
2601
2839
|
}
|
|
2840
|
+
|
|
2602
2841
|
return defaultColors.none;
|
|
2603
2842
|
};
|
|
2604
|
-
|
|
2605
2843
|
/**
|
|
2606
2844
|
* Adjust rgb value if it equals to 0 or 255
|
|
2607
2845
|
* @method adjustRGB
|
|
@@ -2610,16 +2848,18 @@ var getGraphColors = function getGraphColors(_ref16) {
|
|
|
2610
2848
|
* @returns {Number} adjusted rgb
|
|
2611
2849
|
* @private
|
|
2612
2850
|
*/
|
|
2851
|
+
|
|
2613
2852
|
var adjustRGB = function adjustRGB(rgb, delta) {
|
|
2614
2853
|
if (rgb === 255) {
|
|
2615
2854
|
return rgb - delta;
|
|
2616
2855
|
}
|
|
2856
|
+
|
|
2617
2857
|
if (rgb === 0) {
|
|
2618
2858
|
return rgb + delta;
|
|
2619
2859
|
}
|
|
2860
|
+
|
|
2620
2861
|
return rgb;
|
|
2621
2862
|
};
|
|
2622
|
-
|
|
2623
2863
|
/**
|
|
2624
2864
|
* Modifies colors by multiplying by a given ratio
|
|
2625
2865
|
* @method changeColor
|
|
@@ -2628,18 +2868,16 @@ var adjustRGB = function adjustRGB(rgb, delta) {
|
|
|
2628
2868
|
* @returns {String} new color
|
|
2629
2869
|
* @private
|
|
2630
2870
|
*/
|
|
2871
|
+
|
|
2631
2872
|
var changeColor = function changeColor(color, ratio) {
|
|
2632
2873
|
var hex = color.replace(/(0x|#)/, '');
|
|
2633
2874
|
var r = parseInt(hex.substr(0, 2), 16);
|
|
2634
2875
|
var g = parseInt(hex.substr(2, 2), 16);
|
|
2635
|
-
var b = parseInt(hex.substr(4, 2), 16);
|
|
2876
|
+
var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
|
|
2636
2877
|
|
|
2637
|
-
// Multiply by given ratio, make sure is between 0 and 255;
|
|
2638
2878
|
var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
|
|
2639
2879
|
var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
|
|
2640
|
-
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);
|
|
2641
|
-
|
|
2642
|
-
// If the color is not changed
|
|
2880
|
+
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
|
|
2643
2881
|
// case 1: the color is (0, 0 0)
|
|
2644
2882
|
// lighten color (80, 80, 80)
|
|
2645
2883
|
// darken color (40, 40, 40)
|
|
@@ -2648,6 +2886,7 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2648
2886
|
// darken color (175, 175, 175)
|
|
2649
2887
|
// case 3: the color is e.g. (0, 255, 0)
|
|
2650
2888
|
// new color (20, 235, 20)
|
|
2889
|
+
|
|
2651
2890
|
if (newR === r && newG === g && newB === b) {
|
|
2652
2891
|
if (newR === 0 && newG === 0 && newB === 0) {
|
|
2653
2892
|
if (ratio > 1) {
|
|
@@ -2675,9 +2914,9 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2675
2914
|
newB = adjustRGB(newB, 20);
|
|
2676
2915
|
}
|
|
2677
2916
|
}
|
|
2917
|
+
|
|
2678
2918
|
return "#".concat(newR.toString(16).padStart(2, 0)) + "".concat(newG.toString(16).padStart(2, 0)) + "".concat(newB.toString(16).padStart(2, 0));
|
|
2679
2919
|
};
|
|
2680
|
-
|
|
2681
2920
|
/**
|
|
2682
2921
|
* Lighten a given color
|
|
2683
2922
|
* @method lighten
|
|
@@ -2685,10 +2924,11 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2685
2924
|
* @returns {String}
|
|
2686
2925
|
* @private
|
|
2687
2926
|
*/
|
|
2927
|
+
|
|
2928
|
+
|
|
2688
2929
|
var lighten = function lighten(color) {
|
|
2689
2930
|
return changeColor(color, 1.3);
|
|
2690
2931
|
};
|
|
2691
|
-
|
|
2692
2932
|
/**
|
|
2693
2933
|
* Darkens a given color
|
|
2694
2934
|
* @method darken
|
|
@@ -2696,10 +2936,10 @@ var lighten = function lighten(color) {
|
|
|
2696
2936
|
* @returns {String}
|
|
2697
2937
|
* @private
|
|
2698
2938
|
*/
|
|
2939
|
+
|
|
2699
2940
|
var darken = function darken(color) {
|
|
2700
2941
|
return changeColor(color, 0.5);
|
|
2701
2942
|
};
|
|
2702
|
-
|
|
2703
2943
|
/** consistent token structure: handle callback to add value and name in event payload
|
|
2704
2944
|
* @method handleValueClickCallback
|
|
2705
2945
|
* @param {Object} ev
|
|
@@ -2708,6 +2948,7 @@ var darken = function darken(color) {
|
|
|
2708
2948
|
* @param {Number} trendValue
|
|
2709
2949
|
* @param {Function} onValueClick
|
|
2710
2950
|
*/
|
|
2951
|
+
|
|
2711
2952
|
var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
|
|
2712
2953
|
var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
2713
2954
|
var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
@@ -2717,12 +2958,14 @@ var handleValueClickCallback = function handleValueClickCallback(ev, majorValue,
|
|
|
2717
2958
|
value: majorValue,
|
|
2718
2959
|
name: majorValueField
|
|
2719
2960
|
};
|
|
2961
|
+
|
|
2720
2962
|
if (trellisEnabled) {
|
|
2721
2963
|
payload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
2722
2964
|
'trellis.name': trellisSplityBy,
|
|
2723
2965
|
'trellis.value': trellisKey
|
|
2724
2966
|
});
|
|
2725
2967
|
}
|
|
2968
|
+
|
|
2726
2969
|
return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
|
|
2727
2970
|
payload: payload
|
|
2728
2971
|
}));
|
|
@@ -2796,11 +3039,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2796
3039
|
value: true
|
|
2797
3040
|
});
|
|
2798
3041
|
exports.shouldShowIconPlaceholder = void 0;
|
|
3042
|
+
|
|
2799
3043
|
var React = __webpack_require__(1);
|
|
3044
|
+
|
|
2800
3045
|
var T = __webpack_require__(0);
|
|
3046
|
+
|
|
2801
3047
|
var lodash_1 = __webpack_require__(3);
|
|
3048
|
+
|
|
2802
3049
|
var i18n_1 = __webpack_require__(2);
|
|
3050
|
+
|
|
2803
3051
|
var Message_1 = __webpack_require__(10);
|
|
3052
|
+
|
|
2804
3053
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2805
3054
|
/**
|
|
2806
3055
|
* @method shouldShowIconPlaceholder
|
|
@@ -2808,6 +3057,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
2808
3057
|
* @param {boolean} loading
|
|
2809
3058
|
* @returns {boolean}
|
|
2810
3059
|
*/
|
|
3060
|
+
|
|
3061
|
+
|
|
2811
3062
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
2812
3063
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2813
3064
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -2816,6 +3067,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
2816
3067
|
var noFields = fields === undefined;
|
|
2817
3068
|
return loading || noData || noFields;
|
|
2818
3069
|
};
|
|
3070
|
+
|
|
2819
3071
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
2820
3072
|
var propTypes = {
|
|
2821
3073
|
icon: T.func,
|
|
@@ -2830,11 +3082,13 @@ var propTypes = {
|
|
|
2830
3082
|
* @param {IconPlaceholderProps} props
|
|
2831
3083
|
* @returns {React.ReactElement}
|
|
2832
3084
|
*/
|
|
3085
|
+
|
|
2833
3086
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
2834
3087
|
var width = props.width,
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
3088
|
+
height = props.height,
|
|
3089
|
+
icon = props.icon,
|
|
3090
|
+
iconColor = props.iconColor;
|
|
3091
|
+
|
|
2838
3092
|
if (icon) {
|
|
2839
3093
|
return React.createElement(icon, {
|
|
2840
3094
|
style: {
|
|
@@ -2849,6 +3103,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2849
3103
|
height: '50%'
|
|
2850
3104
|
});
|
|
2851
3105
|
}
|
|
3106
|
+
|
|
2852
3107
|
return React.createElement(Message_1.default, {
|
|
2853
3108
|
width: width,
|
|
2854
3109
|
height: height,
|
|
@@ -2856,6 +3111,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2856
3111
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
2857
3112
|
});
|
|
2858
3113
|
};
|
|
3114
|
+
|
|
2859
3115
|
IconPlaceholder.propTypes = propTypes;
|
|
2860
3116
|
IconPlaceholder.defaultProps = {
|
|
2861
3117
|
width: '100%',
|
|
@@ -2872,21 +3128,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
2872
3128
|
|
|
2873
3129
|
|
|
2874
3130
|
var _defineProperty = __webpack_require__(7);
|
|
3131
|
+
|
|
2875
3132
|
Object.defineProperty(exports, "__esModule", {
|
|
2876
3133
|
value: true
|
|
2877
3134
|
});
|
|
2878
3135
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
3136
|
+
|
|
2879
3137
|
var T = __webpack_require__(0);
|
|
3138
|
+
|
|
2880
3139
|
var lodash_1 = __webpack_require__(3);
|
|
2881
|
-
|
|
3140
|
+
|
|
3141
|
+
var DataSource_1 = __webpack_require__(34);
|
|
3142
|
+
|
|
2882
3143
|
exports.SortParamsPropTypes = T.shape({
|
|
2883
3144
|
currentSortKey: T.string,
|
|
2884
3145
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
2885
3146
|
onSort: T.func
|
|
2886
3147
|
});
|
|
3148
|
+
|
|
2887
3149
|
var getSortingParams = function getSortingParams(_ref) {
|
|
2888
3150
|
var requestParams = _ref.requestParams,
|
|
2889
|
-
|
|
3151
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2890
3152
|
var currentSortKey;
|
|
2891
3153
|
var currentSortDir;
|
|
2892
3154
|
var nextSortDirMap = {
|
|
@@ -2895,15 +3157,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2895
3157
|
none: 'asc'
|
|
2896
3158
|
};
|
|
2897
3159
|
var onSort;
|
|
3160
|
+
|
|
2898
3161
|
if (typeof onRequestParamsChange === 'function') {
|
|
2899
3162
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
2900
3163
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
2901
3164
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
2902
|
-
}
|
|
2903
|
-
|
|
3165
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
3166
|
+
|
|
3167
|
+
|
|
2904
3168
|
onSort = function onSort(e, _ref2) {
|
|
2905
3169
|
var sortKey = _ref2.sortKey,
|
|
2906
|
-
|
|
3170
|
+
sortDir = _ref2.sortDir;
|
|
3171
|
+
|
|
2907
3172
|
if (typeof sortKey === 'string') {
|
|
2908
3173
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
2909
3174
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -2915,12 +3180,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2915
3180
|
}
|
|
2916
3181
|
};
|
|
2917
3182
|
}
|
|
3183
|
+
|
|
2918
3184
|
return {
|
|
2919
3185
|
currentSortKey: currentSortKey,
|
|
2920
3186
|
currentSortDir: currentSortDir,
|
|
2921
3187
|
onSort: onSort
|
|
2922
3188
|
};
|
|
2923
3189
|
};
|
|
3190
|
+
|
|
2924
3191
|
exports.getSortingParams = getSortingParams;
|
|
2925
3192
|
|
|
2926
3193
|
/***/ }),
|
|
@@ -2931,43 +3198,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
2931
3198
|
"use strict";
|
|
2932
3199
|
|
|
2933
3200
|
|
|
3201
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3202
|
+
value: true
|
|
3203
|
+
});
|
|
3204
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
3205
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3206
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
3207
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
3208
|
+
|
|
3209
|
+
/***/ }),
|
|
3210
|
+
|
|
3211
|
+
/***/ 35:
|
|
3212
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3213
|
+
|
|
3214
|
+
"use strict";
|
|
3215
|
+
|
|
3216
|
+
|
|
2934
3217
|
Object.defineProperty(exports, "__esModule", {
|
|
2935
3218
|
value: true
|
|
2936
3219
|
});
|
|
2937
3220
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
3221
|
+
|
|
2938
3222
|
var T = __webpack_require__(0);
|
|
3223
|
+
|
|
2939
3224
|
var lodash_1 = __webpack_require__(3);
|
|
3225
|
+
|
|
2940
3226
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
2941
3227
|
isPaging: T.bool,
|
|
2942
3228
|
current: T.number,
|
|
2943
3229
|
totalPages: T.number,
|
|
2944
3230
|
onChange: T.func
|
|
2945
3231
|
});
|
|
3232
|
+
|
|
2946
3233
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
2947
3234
|
var requestParams = _ref.requestParams,
|
|
2948
|
-
|
|
2949
|
-
|
|
3235
|
+
meta = _ref.meta,
|
|
3236
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2950
3237
|
var totalCount = meta && meta.totalCount || 0;
|
|
2951
3238
|
var offset = requestParams && requestParams.offset || 0;
|
|
2952
3239
|
var count = requestParams && requestParams.count;
|
|
2953
3240
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
2954
3241
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
2955
3242
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
3243
|
+
|
|
2956
3244
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
2957
3245
|
var page = _ref2.page,
|
|
2958
|
-
|
|
3246
|
+
countArg = _ref2.count;
|
|
2959
3247
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
3248
|
+
|
|
2960
3249
|
if (typeof countArg === 'number') {
|
|
2961
3250
|
newParams.count = countArg;
|
|
2962
3251
|
newParams.offset = 0;
|
|
2963
3252
|
}
|
|
3253
|
+
|
|
2964
3254
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
3255
|
+
|
|
2965
3256
|
if (typeof page === 'number' && page > 0) {
|
|
2966
3257
|
newParams.count = pageCount;
|
|
2967
3258
|
newParams.offset = (page - 1) * pageCount;
|
|
2968
3259
|
}
|
|
3260
|
+
|
|
2969
3261
|
onRequestParamsChange(newParams);
|
|
2970
3262
|
};
|
|
3263
|
+
|
|
2971
3264
|
return {
|
|
2972
3265
|
isPaging: isPaging,
|
|
2973
3266
|
current: current,
|
|
@@ -2975,11 +3268,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
2975
3268
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
2976
3269
|
};
|
|
2977
3270
|
};
|
|
3271
|
+
|
|
2978
3272
|
exports.getPaginationParams = getPaginationParams;
|
|
2979
3273
|
|
|
2980
3274
|
/***/ }),
|
|
2981
3275
|
|
|
2982
|
-
/***/
|
|
3276
|
+
/***/ 36:
|
|
2983
3277
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2984
3278
|
|
|
2985
3279
|
"use strict";
|
|
@@ -2990,6 +3284,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2990
3284
|
});
|
|
2991
3285
|
exports.VizCategory = void 0;
|
|
2992
3286
|
var VizCategory;
|
|
3287
|
+
|
|
2993
3288
|
(function (VizCategory) {
|
|
2994
3289
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
2995
3290
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -3007,67 +3302,96 @@ var VizCategory;
|
|
|
3007
3302
|
|
|
3008
3303
|
/***/ }),
|
|
3009
3304
|
|
|
3010
|
-
/***/
|
|
3305
|
+
/***/ 37:
|
|
3011
3306
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3012
3307
|
|
|
3013
3308
|
"use strict";
|
|
3014
3309
|
|
|
3015
3310
|
|
|
3016
3311
|
var _slicedToArray = __webpack_require__(17);
|
|
3312
|
+
|
|
3017
3313
|
Object.defineProperty(exports, "__esModule", {
|
|
3018
3314
|
value: true
|
|
3019
3315
|
});
|
|
3316
|
+
|
|
3020
3317
|
var React = __webpack_require__(1);
|
|
3318
|
+
|
|
3021
3319
|
var lodash_1 = __webpack_require__(3);
|
|
3022
|
-
|
|
3320
|
+
|
|
3321
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
3322
|
+
|
|
3023
3323
|
var Options_1 = __webpack_require__(30);
|
|
3024
|
-
|
|
3324
|
+
|
|
3325
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
3326
|
+
|
|
3025
3327
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
3026
|
-
|
|
3328
|
+
|
|
3329
|
+
var moment_1 = __webpack_require__(40);
|
|
3330
|
+
|
|
3027
3331
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
3332
|
+
|
|
3028
3333
|
var styled_components_1 = __webpack_require__(4);
|
|
3334
|
+
|
|
3029
3335
|
var hocUtils_1 = __webpack_require__(27);
|
|
3336
|
+
|
|
3030
3337
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
3031
|
-
|
|
3338
|
+
|
|
3339
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
3340
|
+
|
|
3032
3341
|
var id_1 = __webpack_require__(25);
|
|
3033
|
-
|
|
3342
|
+
|
|
3343
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
3344
|
+
|
|
3034
3345
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3346
|
+
|
|
3035
3347
|
var getSorting_1 = __webpack_require__(33);
|
|
3036
|
-
|
|
3348
|
+
|
|
3349
|
+
var getPagination_1 = __webpack_require__(35);
|
|
3350
|
+
|
|
3037
3351
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
3352
|
+
|
|
3038
3353
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
3354
|
+
|
|
3039
3355
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
3356
|
+
|
|
3040
3357
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
3041
3358
|
/**
|
|
3042
3359
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
3043
3360
|
* @param {DashboardVizOpts} opts
|
|
3044
3361
|
* @returns {HOC}
|
|
3045
3362
|
*/
|
|
3363
|
+
|
|
3364
|
+
|
|
3046
3365
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
3047
3366
|
var ReactViz = opts.ReactViz,
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3367
|
+
vizConfig = opts.vizConfig,
|
|
3368
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
3369
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
3370
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
3371
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
3372
|
+
|
|
3053
3373
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
3054
3374
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
3375
|
+
|
|
3055
3376
|
var DashboardViz = function DashboardViz(props) {
|
|
3056
3377
|
var _a;
|
|
3378
|
+
|
|
3057
3379
|
var mode = props.mode,
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3380
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
3381
|
+
dataSources = props.dataSources,
|
|
3382
|
+
options = props.options,
|
|
3383
|
+
_props$context = props.context,
|
|
3384
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
3385
|
+
width = props.width,
|
|
3386
|
+
height = props.height,
|
|
3387
|
+
onComputedProps = props.onComputedProps,
|
|
3388
|
+
onEventTrigger = props.onEventTrigger,
|
|
3389
|
+
theme = props.theme,
|
|
3390
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
3391
|
+
|
|
3069
3392
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
3070
|
-
|
|
3393
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
3394
|
+
|
|
3071
3395
|
if (serializedTimezone) {
|
|
3072
3396
|
/*
|
|
3073
3397
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -3081,38 +3405,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3081
3405
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
3082
3406
|
}
|
|
3083
3407
|
}
|
|
3408
|
+
|
|
3084
3409
|
var themeFunc = function themeFunc(themeVar) {
|
|
3085
3410
|
var _a, _b;
|
|
3411
|
+
|
|
3086
3412
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
3087
3413
|
};
|
|
3414
|
+
|
|
3088
3415
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
3416
|
+
|
|
3089
3417
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3418
|
+
theme: theme
|
|
3419
|
+
}),
|
|
3420
|
+
currentThemeFamily = _ref.family,
|
|
3421
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
3422
|
+
currentThemeDensity = _ref.density;
|
|
3423
|
+
|
|
3095
3424
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
3425
|
+
|
|
3096
3426
|
var _React$useState = React.useState({}),
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3427
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3428
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
3429
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
3430
|
+
|
|
3431
|
+
|
|
3100
3432
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
3433
|
+
|
|
3101
3434
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
3102
|
-
|
|
3103
|
-
|
|
3435
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
3436
|
+
visualizationID = _React$useState4[0];
|
|
3437
|
+
|
|
3104
3438
|
var _React$useState5 = React.useState({}),
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3439
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3440
|
+
dataSourcesInState = _React$useState6[0],
|
|
3441
|
+
setDataSourcesInState = _React$useState6[1];
|
|
3442
|
+
|
|
3108
3443
|
var _React$useState7 = React.useState(),
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3444
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3445
|
+
dataFramesInState = _React$useState8[0],
|
|
3446
|
+
setDataFramesInState = _React$useState8[1];
|
|
3447
|
+
|
|
3112
3448
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3449
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
3450
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
3451
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
3452
|
+
|
|
3116
3453
|
var isMounted = React.useRef(true);
|
|
3117
3454
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
3118
3455
|
try {
|
|
@@ -3137,11 +3474,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3137
3474
|
});
|
|
3138
3475
|
} else {
|
|
3139
3476
|
var dataFrames = dataFramesInState;
|
|
3477
|
+
|
|
3140
3478
|
if (dataSources !== dataSourcesInState) {
|
|
3141
3479
|
setDataSourcesInState(dataSources);
|
|
3142
3480
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
3143
3481
|
setDataFramesInState(dataFrames);
|
|
3144
3482
|
}
|
|
3483
|
+
|
|
3145
3484
|
return Options_1.Options.evaluate({
|
|
3146
3485
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
3147
3486
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -3152,21 +3491,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3152
3491
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
3153
3492
|
return {};
|
|
3154
3493
|
}
|
|
3494
|
+
|
|
3155
3495
|
return {};
|
|
3156
3496
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
3157
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
3158
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
3497
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
3159
3498
|
// if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
|
|
3160
3499
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
3500
|
+
|
|
3161
3501
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
3162
3502
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
3503
|
+
|
|
3163
3504
|
if (isTrellisFeatureFlagOn && ((_a = vizConfig === null || vizConfig === void 0 ? void 0 : vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(VizBehavior_1.VizBehavior.TRELLIS)) && (clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.splitByLayout) === VizBehavior_1.VizBehavior.TRELLIS) {
|
|
3164
3505
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
3165
3506
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
3166
3507
|
});
|
|
3167
|
-
}
|
|
3168
|
-
// useEffect hook needs to be initialized before any early returns
|
|
3508
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
3169
3509
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
3510
|
+
|
|
3511
|
+
|
|
3170
3512
|
React.useEffect(function () {
|
|
3171
3513
|
onComputedProps(clonedEvaluatedOptions);
|
|
3172
3514
|
});
|
|
@@ -3176,44 +3518,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3176
3518
|
isMounted.current = false;
|
|
3177
3519
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
3178
3520
|
}
|
|
3179
|
-
};
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
// present warning message if any required props are missing
|
|
3521
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3522
|
+
}, []); // present warning message if any required props are missing
|
|
3523
|
+
|
|
3183
3524
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
3184
|
-
|
|
3185
|
-
|
|
3525
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
3526
|
+
supports = vizConfig.supports;
|
|
3186
3527
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
3528
|
+
|
|
3187
3529
|
if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
|
|
3188
3530
|
) {
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3531
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
3532
|
+
"data-test": "missing-props-message",
|
|
3533
|
+
width: width,
|
|
3534
|
+
height: height,
|
|
3535
|
+
missingProps: missing,
|
|
3536
|
+
backgroundColor: bgColorFromTheme
|
|
3537
|
+
});
|
|
3538
|
+
} // events
|
|
3539
|
+
|
|
3540
|
+
|
|
3198
3541
|
var eventCallbackProps = {};
|
|
3542
|
+
|
|
3199
3543
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
3200
3544
|
var supportedEvents = vizConfig.events;
|
|
3201
3545
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
3202
3546
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
3203
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
3204
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
3547
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
3205
3548
|
// then remove these lines
|
|
3549
|
+
|
|
3206
3550
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
3207
3551
|
var payload = {};
|
|
3552
|
+
|
|
3208
3553
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
3209
3554
|
payloadKeys.forEach(function (p) {
|
|
3210
3555
|
payload[p] = evaluatedOptionsToUse[p];
|
|
3211
3556
|
});
|
|
3212
3557
|
}
|
|
3558
|
+
|
|
3213
3559
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
3214
3560
|
if (ev && ev.payload) {
|
|
3215
3561
|
payload = ev.payload;
|
|
3216
3562
|
}
|
|
3563
|
+
|
|
3217
3564
|
return onEventTrigger({
|
|
3218
3565
|
originalEvent: ev,
|
|
3219
3566
|
payload: payload,
|
|
@@ -3221,8 +3568,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3221
3568
|
});
|
|
3222
3569
|
};
|
|
3223
3570
|
});
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3571
|
+
} // compute pure viz props which are not from options
|
|
3572
|
+
|
|
3573
|
+
|
|
3226
3574
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
3227
3575
|
themeFunc: themeFunc
|
|
3228
3576
|
}));
|
|
@@ -3240,15 +3588,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3240
3588
|
* In future, we could automatically detect which all datasources are being used
|
|
3241
3589
|
* and bind those magically to pagination/sorting behavior.
|
|
3242
3590
|
*/
|
|
3591
|
+
|
|
3243
3592
|
var dataSourceMetadata = {};
|
|
3244
3593
|
var OptionKey = 'paginateDataSourceKey';
|
|
3245
3594
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
3595
|
+
|
|
3246
3596
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
3247
3597
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
3248
3598
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
3599
|
+
|
|
3249
3600
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
3250
3601
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
3251
3602
|
};
|
|
3603
|
+
|
|
3252
3604
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
3253
3605
|
requestParams: requestParams,
|
|
3254
3606
|
meta: meta,
|
|
@@ -3263,115 +3615,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3263
3615
|
sortParams: sortParams,
|
|
3264
3616
|
paginatorParams: paginatorParams
|
|
3265
3617
|
};
|
|
3266
|
-
}
|
|
3267
|
-
|
|
3618
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
3619
|
+
|
|
3620
|
+
|
|
3268
3621
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
3269
3622
|
return null;
|
|
3270
3623
|
}
|
|
3624
|
+
|
|
3271
3625
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
3272
3626
|
mode: mode,
|
|
3273
3627
|
width: width,
|
|
3274
3628
|
height: height
|
|
3275
3629
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
3276
3630
|
};
|
|
3631
|
+
|
|
3277
3632
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
3278
3633
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
3279
3634
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
3280
3635
|
theme: {}
|
|
3281
|
-
});
|
|
3282
|
-
|
|
3283
|
-
DashboardViz.config = vizConfig;
|
|
3284
|
-
|
|
3636
|
+
}); // attach viz config
|
|
3637
|
+
|
|
3638
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
3639
|
+
|
|
3285
3640
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
3286
3641
|
};
|
|
3642
|
+
|
|
3287
3643
|
exports.default = withDashboardViz;
|
|
3288
3644
|
|
|
3289
3645
|
/***/ }),
|
|
3290
3646
|
|
|
3291
|
-
/***/
|
|
3647
|
+
/***/ 38:
|
|
3292
3648
|
/***/ (function(module, exports) {
|
|
3293
3649
|
|
|
3294
3650
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
3295
3651
|
|
|
3296
3652
|
/***/ }),
|
|
3297
3653
|
|
|
3298
|
-
/***/
|
|
3654
|
+
/***/ 39:
|
|
3299
3655
|
/***/ (function(module, exports) {
|
|
3300
3656
|
|
|
3301
3657
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
3302
3658
|
|
|
3303
3659
|
/***/ }),
|
|
3304
3660
|
|
|
3305
|
-
/***/
|
|
3661
|
+
/***/ 4:
|
|
3306
3662
|
/***/ (function(module, exports) {
|
|
3307
3663
|
|
|
3308
|
-
module.exports = require("
|
|
3664
|
+
module.exports = require("styled-components");
|
|
3309
3665
|
|
|
3310
3666
|
/***/ }),
|
|
3311
3667
|
|
|
3312
|
-
/***/
|
|
3668
|
+
/***/ 40:
|
|
3313
3669
|
/***/ (function(module, exports) {
|
|
3314
3670
|
|
|
3315
|
-
module.exports = require("
|
|
3671
|
+
module.exports = require("@splunk/moment");
|
|
3316
3672
|
|
|
3317
3673
|
/***/ }),
|
|
3318
3674
|
|
|
3319
|
-
/***/
|
|
3675
|
+
/***/ 41:
|
|
3320
3676
|
/***/ (function(module, exports) {
|
|
3321
3677
|
|
|
3322
3678
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
3323
3679
|
|
|
3324
3680
|
/***/ }),
|
|
3325
3681
|
|
|
3326
|
-
/***/
|
|
3682
|
+
/***/ 42:
|
|
3327
3683
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3328
3684
|
|
|
3329
3685
|
"use strict";
|
|
3330
3686
|
|
|
3331
3687
|
|
|
3332
3688
|
var _classCallCheck = __webpack_require__(9);
|
|
3689
|
+
|
|
3333
3690
|
Object.defineProperty(exports, "__esModule", {
|
|
3334
3691
|
value: true
|
|
3335
3692
|
});
|
|
3336
3693
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
3337
3694
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
3695
|
+
|
|
3338
3696
|
var T = __webpack_require__(0);
|
|
3697
|
+
|
|
3339
3698
|
var lodash_1 = __webpack_require__(3);
|
|
3340
|
-
|
|
3341
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3699
|
+
|
|
3700
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3701
|
+
|
|
3702
|
+
|
|
3342
3703
|
exports.INITIAL_WIDTH = 250;
|
|
3343
3704
|
exports.INITIAL_HEIGHT = 250;
|
|
3344
3705
|
/**
|
|
3345
3706
|
* A Splunk visualization
|
|
3346
3707
|
*/
|
|
3708
|
+
|
|
3347
3709
|
var SplunkVisualization = function SplunkVisualization() {
|
|
3348
3710
|
_classCallCheck(this, SplunkVisualization);
|
|
3349
3711
|
};
|
|
3712
|
+
|
|
3350
3713
|
SplunkVisualization.propTypes = {
|
|
3351
3714
|
/**
|
|
3352
3715
|
* display mode
|
|
3353
3716
|
*/
|
|
3354
3717
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
3718
|
+
|
|
3355
3719
|
/**
|
|
3356
3720
|
* width in pixel or string, defaults to 100%
|
|
3357
3721
|
*/
|
|
3358
3722
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
3723
|
+
|
|
3359
3724
|
/**
|
|
3360
3725
|
* height in pixel or string
|
|
3361
3726
|
*/
|
|
3362
3727
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
3728
|
+
|
|
3363
3729
|
/**
|
|
3364
3730
|
* visualization context used for dynamic option evaluation
|
|
3365
3731
|
*/
|
|
3366
3732
|
context: T.object,
|
|
3733
|
+
|
|
3367
3734
|
/**
|
|
3368
3735
|
* visualization formatting options
|
|
3369
3736
|
*/
|
|
3370
3737
|
options: T.object,
|
|
3738
|
+
|
|
3371
3739
|
/**
|
|
3372
3740
|
* A callback to update formatting options
|
|
3373
3741
|
*/
|
|
3374
3742
|
onOptionsChange: T.func,
|
|
3743
|
+
|
|
3375
3744
|
/**
|
|
3376
3745
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
3377
3746
|
*/
|
|
@@ -3380,6 +3749,7 @@ SplunkVisualization.propTypes = {
|
|
|
3380
3749
|
* current request params
|
|
3381
3750
|
*/
|
|
3382
3751
|
requestParams: T.object,
|
|
3752
|
+
|
|
3383
3753
|
/**
|
|
3384
3754
|
* current dataset
|
|
3385
3755
|
*/
|
|
@@ -3387,6 +3757,7 @@ SplunkVisualization.propTypes = {
|
|
|
3387
3757
|
fields: T.array,
|
|
3388
3758
|
columns: T.array
|
|
3389
3759
|
}),
|
|
3760
|
+
|
|
3390
3761
|
/**
|
|
3391
3762
|
* error
|
|
3392
3763
|
*/
|
|
@@ -3394,29 +3765,35 @@ SplunkVisualization.propTypes = {
|
|
|
3394
3765
|
level: T.string,
|
|
3395
3766
|
message: T.string
|
|
3396
3767
|
}),
|
|
3768
|
+
|
|
3397
3769
|
/**
|
|
3398
3770
|
* meta data that came with the dataset
|
|
3399
3771
|
*/
|
|
3400
3772
|
meta: T.object
|
|
3401
3773
|
})),
|
|
3774
|
+
|
|
3402
3775
|
/**
|
|
3403
3776
|
* A callback to trigger event
|
|
3404
3777
|
*/
|
|
3405
3778
|
onEventTrigger: T.func,
|
|
3779
|
+
|
|
3406
3780
|
/**
|
|
3407
3781
|
* Inform viz if there are handlers listening to events
|
|
3408
3782
|
*/
|
|
3409
3783
|
hasEventHandlers: T.bool,
|
|
3784
|
+
|
|
3410
3785
|
/**
|
|
3411
3786
|
* A callback to communicate computed props to a consumer
|
|
3412
3787
|
*/
|
|
3413
3788
|
onComputedProps: T.func,
|
|
3789
|
+
|
|
3414
3790
|
/**
|
|
3415
3791
|
* A callback to obtain visualization api
|
|
3416
3792
|
*/
|
|
3417
3793
|
vizActionHandlerRef: T.func,
|
|
3418
3794
|
loading: T.bool,
|
|
3419
3795
|
theme: T.object,
|
|
3796
|
+
|
|
3420
3797
|
/**
|
|
3421
3798
|
* A callback to request new data with updated request params
|
|
3422
3799
|
*/
|
|
@@ -3425,6 +3802,7 @@ SplunkVisualization.propTypes = {
|
|
|
3425
3802
|
/**
|
|
3426
3803
|
*
|
|
3427
3804
|
*/
|
|
3805
|
+
|
|
3428
3806
|
SplunkVisualization.defaultProps = {
|
|
3429
3807
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
3430
3808
|
width: '100%',
|
|
@@ -3453,50 +3831,41 @@ exports.default = SplunkVisualization;
|
|
|
3453
3831
|
|
|
3454
3832
|
/***/ }),
|
|
3455
3833
|
|
|
3456
|
-
/***/
|
|
3834
|
+
/***/ 43:
|
|
3457
3835
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3458
3836
|
|
|
3459
3837
|
"use strict";
|
|
3460
3838
|
|
|
3461
3839
|
|
|
3462
3840
|
var _classCallCheck = __webpack_require__(9);
|
|
3841
|
+
|
|
3463
3842
|
var _createClass = __webpack_require__(18);
|
|
3843
|
+
|
|
3464
3844
|
Object.defineProperty(exports, "__esModule", {
|
|
3465
3845
|
value: true
|
|
3466
3846
|
});
|
|
3467
3847
|
exports.DefaultVizActionHandler = void 0;
|
|
3848
|
+
|
|
3468
3849
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
3469
3850
|
function DefaultVizActionHandler() {
|
|
3470
3851
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
3471
3852
|
}
|
|
3853
|
+
|
|
3472
3854
|
_createClass(DefaultVizActionHandler, [{
|
|
3473
3855
|
key: "focus",
|
|
3474
|
-
value: function focus() {
|
|
3475
|
-
// noop
|
|
3856
|
+
value: function focus() {// noop
|
|
3476
3857
|
}
|
|
3477
3858
|
}, {
|
|
3478
3859
|
key: "snapshot",
|
|
3479
|
-
value: function snapshot() {
|
|
3480
|
-
return null; // noop
|
|
3481
|
-
}
|
|
3482
|
-
}]);
|
|
3483
|
-
return DefaultVizActionHandler;
|
|
3484
|
-
}();
|
|
3485
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3486
|
-
|
|
3487
|
-
/***/ }),
|
|
3488
|
-
|
|
3489
|
-
/***/ 43:
|
|
3490
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3491
|
-
|
|
3492
|
-
"use strict";
|
|
3860
|
+
value: function snapshot() {
|
|
3861
|
+
return null; // noop
|
|
3862
|
+
}
|
|
3863
|
+
}]);
|
|
3493
3864
|
|
|
3865
|
+
return DefaultVizActionHandler;
|
|
3866
|
+
}();
|
|
3494
3867
|
|
|
3495
|
-
|
|
3496
|
-
value: true
|
|
3497
|
-
});
|
|
3498
|
-
exports.validSortDirs = void 0;
|
|
3499
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3868
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3500
3869
|
|
|
3501
3870
|
/***/ }),
|
|
3502
3871
|
|
|
@@ -3510,7 +3879,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3510
3879
|
value: true
|
|
3511
3880
|
});
|
|
3512
3881
|
exports.useDeepMemo = void 0;
|
|
3882
|
+
|
|
3513
3883
|
var react_1 = __webpack_require__(1);
|
|
3884
|
+
|
|
3514
3885
|
var lodash_1 = __webpack_require__(3);
|
|
3515
3886
|
/**
|
|
3516
3887
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -3525,16 +3896,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3525
3896
|
* @param fn the function to be executed and
|
|
3526
3897
|
* @param dependencies an array of dependencies
|
|
3527
3898
|
*/
|
|
3899
|
+
|
|
3900
|
+
|
|
3528
3901
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
3529
3902
|
var ref = (0, react_1.useRef)();
|
|
3903
|
+
|
|
3530
3904
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
3531
3905
|
ref.current = {
|
|
3532
3906
|
dependencies: dependencies,
|
|
3533
3907
|
value: fn()
|
|
3534
3908
|
};
|
|
3535
3909
|
}
|
|
3910
|
+
|
|
3536
3911
|
return ref.current.value;
|
|
3537
3912
|
};
|
|
3913
|
+
|
|
3538
3914
|
exports.useDeepMemo = useDeepMemo;
|
|
3539
3915
|
|
|
3540
3916
|
/***/ }),
|
|
@@ -3549,19 +3925,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3549
3925
|
value: true
|
|
3550
3926
|
});
|
|
3551
3927
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
3928
|
+
|
|
3552
3929
|
var React = __webpack_require__(1);
|
|
3930
|
+
|
|
3553
3931
|
var T = __webpack_require__(0);
|
|
3932
|
+
|
|
3554
3933
|
var i18n_1 = __webpack_require__(2);
|
|
3934
|
+
|
|
3555
3935
|
var Message_1 = __webpack_require__(10);
|
|
3936
|
+
|
|
3556
3937
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
3557
3938
|
/**
|
|
3558
3939
|
* @method isMissing
|
|
3559
3940
|
* @param {any} v
|
|
3560
3941
|
* @returns {boolean} true if the input value === null or undefined
|
|
3561
3942
|
*/
|
|
3943
|
+
|
|
3944
|
+
|
|
3562
3945
|
var isMissing = function isMissing(v) {
|
|
3563
3946
|
return v === null || v === undefined;
|
|
3564
3947
|
};
|
|
3948
|
+
|
|
3565
3949
|
exports.isMissing = isMissing;
|
|
3566
3950
|
/**
|
|
3567
3951
|
* @method misskingKeys
|
|
@@ -3569,11 +3953,13 @@ exports.isMissing = isMissing;
|
|
|
3569
3953
|
* @param {object} target
|
|
3570
3954
|
* @returns {string[]} the keys of missing required props
|
|
3571
3955
|
*/
|
|
3956
|
+
|
|
3572
3957
|
var missingKeys = function missingKeys(keys, target) {
|
|
3573
3958
|
return keys.filter(function (k) {
|
|
3574
3959
|
return (0, exports.isMissing)(target[k]);
|
|
3575
3960
|
});
|
|
3576
3961
|
};
|
|
3962
|
+
|
|
3577
3963
|
exports.missingKeys = missingKeys;
|
|
3578
3964
|
var propTypes = {
|
|
3579
3965
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -3587,10 +3973,11 @@ var propTypes = {
|
|
|
3587
3973
|
* @param {MissingPropsProps} props
|
|
3588
3974
|
* @returns {React.ReactElement}
|
|
3589
3975
|
*/
|
|
3976
|
+
|
|
3590
3977
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
3591
3978
|
var width = props.width,
|
|
3592
|
-
|
|
3593
|
-
|
|
3979
|
+
height = props.height,
|
|
3980
|
+
missingProps = props.missingProps;
|
|
3594
3981
|
return React.createElement(Message_1.default, {
|
|
3595
3982
|
"data-test": "message",
|
|
3596
3983
|
width: width,
|
|
@@ -3598,6 +3985,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
3598
3985
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
3599
3986
|
});
|
|
3600
3987
|
};
|
|
3988
|
+
|
|
3601
3989
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
3602
3990
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
3603
3991
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -3617,15 +4005,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
3617
4005
|
Object.defineProperty(exports, "__esModule", {
|
|
3618
4006
|
value: true
|
|
3619
4007
|
});
|
|
4008
|
+
|
|
3620
4009
|
var React = __webpack_require__(1);
|
|
4010
|
+
|
|
3621
4011
|
var styled_components_1 = __webpack_require__(4);
|
|
4012
|
+
|
|
3622
4013
|
var hocUtils_1 = __webpack_require__(15);
|
|
4014
|
+
|
|
3623
4015
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3624
4016
|
displayName: "withEditModeCover__Cover",
|
|
3625
4017
|
componentId: "sc-1gsbnxb-0"
|
|
3626
4018
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3627
4019
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3628
|
-
'data-splunk-visualization-version': "26.
|
|
4020
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
3629
4021
|
}).withConfig({
|
|
3630
4022
|
displayName: "withEditModeCover__Blocker",
|
|
3631
4023
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3636,6 +4028,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3636
4028
|
* @param {ExtendedDashViz} Visualization
|
|
3637
4029
|
* @returns {ExtendedDashViz} Wrapper
|
|
3638
4030
|
*/
|
|
4031
|
+
|
|
3639
4032
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3640
4033
|
var Wrapper = function Wrapper(props) {
|
|
3641
4034
|
var mode = props.mode;
|
|
@@ -3644,12 +4037,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3644
4037
|
"data-test": "edit-mode-cover"
|
|
3645
4038
|
}));
|
|
3646
4039
|
};
|
|
4040
|
+
|
|
3647
4041
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3648
4042
|
Wrapper: Wrapper,
|
|
3649
4043
|
Visualization: Visualization
|
|
3650
4044
|
});
|
|
3651
4045
|
return Wrapper;
|
|
3652
4046
|
};
|
|
4047
|
+
|
|
3653
4048
|
exports.default = withEditModeCover;
|
|
3654
4049
|
|
|
3655
4050
|
/***/ }),
|
|
@@ -3663,27 +4058,37 @@ exports.default = withEditModeCover;
|
|
|
3663
4058
|
Object.defineProperty(exports, "__esModule", {
|
|
3664
4059
|
value: true
|
|
3665
4060
|
});
|
|
4061
|
+
|
|
3666
4062
|
var React = __webpack_require__(1);
|
|
4063
|
+
|
|
3667
4064
|
var colorUtils_1 = __webpack_require__(12);
|
|
4065
|
+
|
|
3668
4066
|
var variables_1 = __webpack_require__(11);
|
|
4067
|
+
|
|
3669
4068
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
4069
|
+
|
|
3670
4070
|
var VizBehavior_1 = __webpack_require__(6);
|
|
4071
|
+
|
|
3671
4072
|
var hocUtils_1 = __webpack_require__(15);
|
|
4073
|
+
|
|
3672
4074
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3673
4075
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3674
4076
|
var config = Visualization.config;
|
|
3675
4077
|
var themes = config.themes;
|
|
4078
|
+
|
|
3676
4079
|
var Wrapper = function Wrapper(props) {
|
|
3677
4080
|
var _a, _b;
|
|
4081
|
+
|
|
3678
4082
|
var dataSources = props.dataSources,
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
4083
|
+
loading = props.loading,
|
|
4084
|
+
options = props.options,
|
|
4085
|
+
height = props.height,
|
|
4086
|
+
width = props.width;
|
|
3683
4087
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3684
4088
|
var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
|
|
3685
4089
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3686
4090
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
4091
|
+
|
|
3687
4092
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3688
4093
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3689
4094
|
"data-test": "icon-placeholder",
|
|
@@ -3694,14 +4099,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3694
4099
|
iconColor: iconColor
|
|
3695
4100
|
});
|
|
3696
4101
|
}
|
|
4102
|
+
|
|
3697
4103
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3698
4104
|
};
|
|
4105
|
+
|
|
3699
4106
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3700
4107
|
Wrapper: Wrapper,
|
|
3701
4108
|
Visualization: Visualization
|
|
3702
4109
|
});
|
|
3703
4110
|
return Wrapper;
|
|
3704
4111
|
};
|
|
4112
|
+
|
|
3705
4113
|
exports.default = withPlaceholder;
|
|
3706
4114
|
|
|
3707
4115
|
/***/ }),
|
|
@@ -3714,33 +4122,44 @@ exports.default = withPlaceholder;
|
|
|
3714
4122
|
|
|
3715
4123
|
var __rest = this && this.__rest || function (s, e) {
|
|
3716
4124
|
var t = {};
|
|
4125
|
+
|
|
3717
4126
|
for (var p in s) {
|
|
3718
4127
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
3719
4128
|
}
|
|
4129
|
+
|
|
3720
4130
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3721
4131
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
3722
4132
|
}
|
|
3723
4133
|
return t;
|
|
3724
4134
|
};
|
|
4135
|
+
|
|
3725
4136
|
Object.defineProperty(exports, "__esModule", {
|
|
3726
4137
|
value: true
|
|
3727
4138
|
});
|
|
3728
4139
|
exports.themes = exports.computeVizProps = exports.PureSingleValueRadialThemes = exports.PureSingleValueRadial = exports.config = void 0;
|
|
4140
|
+
|
|
3729
4141
|
var SingleValueRadial_1 = __webpack_require__(491);
|
|
3730
|
-
|
|
4142
|
+
|
|
4143
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
4144
|
+
|
|
3731
4145
|
var config_1 = __webpack_require__(476);
|
|
4146
|
+
|
|
3732
4147
|
var withTrellis_1 = __webpack_require__(106);
|
|
4148
|
+
|
|
3733
4149
|
exports.config = config_1.default;
|
|
3734
|
-
exports.PureSingleValueRadial = SingleValueRadial_1.default;
|
|
3735
|
-
|
|
4150
|
+
exports.PureSingleValueRadial = SingleValueRadial_1.default; // TODO: proper theming support for SVR when we come back to SVR viz
|
|
4151
|
+
|
|
3736
4152
|
exports.PureSingleValueRadialThemes = {};
|
|
4153
|
+
|
|
3737
4154
|
var computeVizProps = function computeVizProps(_a) {
|
|
3738
4155
|
var trellisKey = _a.trellisKey,
|
|
3739
|
-
|
|
4156
|
+
props = __rest(_a, ["trellisKey"]);
|
|
4157
|
+
|
|
3740
4158
|
return Object.assign({
|
|
3741
4159
|
trellisKey: trellisKey
|
|
3742
4160
|
}, props);
|
|
3743
4161
|
};
|
|
4162
|
+
|
|
3744
4163
|
exports.computeVizProps = computeVizProps;
|
|
3745
4164
|
var viz = (0, withTrellis_1.default)((0, withDashboardViz_1.default)({
|
|
3746
4165
|
ReactViz: SingleValueRadial_1.default,
|
|
@@ -3759,30 +4178,53 @@ exports.default = viz;
|
|
|
3759
4178
|
|
|
3760
4179
|
|
|
3761
4180
|
var _toConsumableArray = __webpack_require__(8);
|
|
4181
|
+
|
|
3762
4182
|
Object.defineProperty(exports, "__esModule", {
|
|
3763
4183
|
value: true
|
|
3764
4184
|
});
|
|
4185
|
+
|
|
3765
4186
|
var i18n_1 = __webpack_require__(2);
|
|
4187
|
+
|
|
3766
4188
|
var schemaUtils_1 = __webpack_require__(16);
|
|
4189
|
+
|
|
3767
4190
|
var pick_1 = __webpack_require__(23);
|
|
4191
|
+
|
|
3768
4192
|
var variables_1 = __webpack_require__(11);
|
|
4193
|
+
|
|
3769
4194
|
var PresetPalettes_1 = __webpack_require__(61);
|
|
4195
|
+
|
|
3770
4196
|
var visualization_icons_1 = __webpack_require__(52);
|
|
4197
|
+
|
|
3771
4198
|
var placeholders_1 = __webpack_require__(50);
|
|
4199
|
+
|
|
3772
4200
|
var configUtils_1 = __webpack_require__(22);
|
|
4201
|
+
|
|
3773
4202
|
var StaticMajorAndTrendLayout_1 = __webpack_require__(102);
|
|
4203
|
+
|
|
3774
4204
|
var VizBehavior_1 = __webpack_require__(6);
|
|
4205
|
+
|
|
3775
4206
|
var configUtils_2 = __webpack_require__(20);
|
|
3776
|
-
|
|
4207
|
+
|
|
4208
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
4209
|
+
|
|
3777
4210
|
var DynamicMajorColorAndGaugeEditor_1 = __webpack_require__(477);
|
|
4211
|
+
|
|
3778
4212
|
var DynamicTrendColorEditor_1 = __webpack_require__(100);
|
|
4213
|
+
|
|
3779
4214
|
var DynamicBackgroundColorEditor_1 = __webpack_require__(101);
|
|
4215
|
+
|
|
3780
4216
|
var StaticMajorColorEditor_1 = __webpack_require__(103);
|
|
4217
|
+
|
|
3781
4218
|
var StaticTrendColorEditor_1 = __webpack_require__(104);
|
|
3782
|
-
|
|
4219
|
+
|
|
4220
|
+
var StaticBackgroundColorEditor_1 = __webpack_require__(91);
|
|
4221
|
+
|
|
3783
4222
|
var RadialBackgroundColor_1 = __webpack_require__(478);
|
|
4223
|
+
|
|
3784
4224
|
var TrellisEditors_1 = __webpack_require__(105);
|
|
4225
|
+
|
|
3785
4226
|
var layoutUtils_1 = __webpack_require__(58);
|
|
4227
|
+
|
|
3786
4228
|
var dataContract = {
|
|
3787
4229
|
requiredDataSources: [{
|
|
3788
4230
|
name: 'primary',
|
|
@@ -4151,7 +4593,7 @@ var editorConfig = [{
|
|
|
4151
4593
|
presets: presets,
|
|
4152
4594
|
value: function value(_ref3) {
|
|
4153
4595
|
var context = _ref3.context,
|
|
4154
|
-
|
|
4596
|
+
options = _ref3.options;
|
|
4155
4597
|
var initialPreset = (0, configUtils_2.getInitialPreset)(context, options, presets);
|
|
4156
4598
|
return initialPreset && initialPreset.label || null;
|
|
4157
4599
|
}
|
|
@@ -4196,16 +4638,19 @@ var editorConfig = [{
|
|
|
4196
4638
|
/**
|
|
4197
4639
|
* visualization configuration
|
|
4198
4640
|
*/
|
|
4641
|
+
|
|
4199
4642
|
var config = {
|
|
4200
4643
|
/**
|
|
4201
4644
|
* unique viz key
|
|
4202
4645
|
*/
|
|
4203
4646
|
key: 'splunk.singlevalueradial',
|
|
4647
|
+
|
|
4204
4648
|
/**
|
|
4205
4649
|
* viz name
|
|
4206
4650
|
*/
|
|
4207
4651
|
name: (0, i18n_1._)('Single value radial'),
|
|
4208
4652
|
category: VizCategory_1.VizCategory.SINGLE_VALUE,
|
|
4653
|
+
|
|
4209
4654
|
/**
|
|
4210
4655
|
* viz icon
|
|
4211
4656
|
*/
|
|
@@ -4243,7 +4688,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4243
4688
|
|
|
4244
4689
|
var getDynamicMajorColorAndGaugeEditor = function getDynamicMajorColorAndGaugeEditor(_ref) {
|
|
4245
4690
|
var defaultContext = _ref.defaultContext,
|
|
4246
|
-
|
|
4691
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
4247
4692
|
return {
|
|
4248
4693
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Major value and gauge'),
|
|
4249
4694
|
option: 'majorColor',
|
|
@@ -4283,11 +4728,13 @@ var getDynamicMajorColorAndGaugeEditor = function getDynamicMajorColorAndGaugeEd
|
|
|
4283
4728
|
Object.defineProperty(exports, "__esModule", {
|
|
4284
4729
|
value: true
|
|
4285
4730
|
});
|
|
4731
|
+
|
|
4286
4732
|
var i18n_1 = __webpack_require__(2);
|
|
4733
|
+
|
|
4287
4734
|
var radialBackground = function radialBackground(_ref) {
|
|
4288
4735
|
var label = _ref.label,
|
|
4289
|
-
|
|
4290
|
-
|
|
4736
|
+
themes = _ref.themes,
|
|
4737
|
+
labelPosition = _ref.labelPosition;
|
|
4291
4738
|
return [{
|
|
4292
4739
|
label: (0, i18n_1._)(label || 'Radial background'),
|
|
4293
4740
|
option: 'radialBackgroundColor',
|
|
@@ -4298,6 +4745,7 @@ var radialBackground = function radialBackground(_ref) {
|
|
|
4298
4745
|
}
|
|
4299
4746
|
}];
|
|
4300
4747
|
};
|
|
4748
|
+
|
|
4301
4749
|
exports.default = radialBackground;
|
|
4302
4750
|
|
|
4303
4751
|
/***/ }),
|
|
@@ -4384,17 +4832,18 @@ var colorConstants_ = __webpack_require__(49);
|
|
|
4384
4832
|
|
|
4385
4833
|
|
|
4386
4834
|
|
|
4835
|
+
|
|
4387
4836
|
var RadialGraph_RadialGraph = function RadialGraph(_ref) {
|
|
4388
4837
|
var progress = _ref.progress,
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4838
|
+
strokeWidth = _ref.strokeWidth,
|
|
4839
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
4840
|
+
backgroundColor = _ref$backgroundColor === void 0 ? colorConstants_["RADIAL_BACKGROUND_COLOR"] : _ref$backgroundColor,
|
|
4841
|
+
_ref$progressColor = _ref.progressColor,
|
|
4842
|
+
progressColor = _ref$progressColor === void 0 ? colorConstants_["RADIAL_STROKE_COLOR"] : _ref$progressColor,
|
|
4843
|
+
_ref$width = _ref.width,
|
|
4844
|
+
width = _ref$width === void 0 ? 200 : _ref$width,
|
|
4845
|
+
_ref$height = _ref.height,
|
|
4846
|
+
height = _ref$height === void 0 ? 200 : _ref$height;
|
|
4398
4847
|
var semicircleRadius = height - strokeWidth / 2;
|
|
4399
4848
|
var circumference = semicircleRadius * 2 * Math.PI;
|
|
4400
4849
|
var bgCircleOffset = 0.5 * circumference;
|
|
@@ -4431,6 +4880,7 @@ var RadialGraph_RadialGraph = function RadialGraph(_ref) {
|
|
|
4431
4880
|
cy: semicircleRadius + strokeWidth / 2
|
|
4432
4881
|
})));
|
|
4433
4882
|
};
|
|
4883
|
+
|
|
4434
4884
|
RadialGraph_RadialGraph.propTypes = {
|
|
4435
4885
|
progress: external_prop_types_default.a.number,
|
|
4436
4886
|
strokeWidth: external_prop_types_default.a.number,
|
|
@@ -4454,25 +4904,38 @@ var GaugeGraph_default = /*#__PURE__*/__webpack_require__.n(GaugeGraph);
|
|
|
4454
4904
|
// CONCATENATED MODULE: ./src/SingleValueRadial/PureSingleValueRadial/RadialLayout.jsx
|
|
4455
4905
|
|
|
4456
4906
|
|
|
4907
|
+
|
|
4457
4908
|
function ownKeys(object, enumerableOnly) {
|
|
4458
4909
|
var keys = Object.keys(object);
|
|
4910
|
+
|
|
4459
4911
|
if (Object.getOwnPropertySymbols) {
|
|
4460
4912
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
4461
|
-
enumerableOnly
|
|
4913
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
4462
4914
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4463
|
-
})
|
|
4915
|
+
});
|
|
4916
|
+
keys.push.apply(keys, symbols);
|
|
4464
4917
|
}
|
|
4918
|
+
|
|
4465
4919
|
return keys;
|
|
4466
4920
|
}
|
|
4921
|
+
|
|
4467
4922
|
function _objectSpread(target) {
|
|
4468
4923
|
for (var i = 1; i < arguments.length; i++) {
|
|
4469
|
-
var source =
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4924
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
4925
|
+
|
|
4926
|
+
if (i % 2) {
|
|
4927
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
4928
|
+
defineProperty_default()(target, key, source[key]);
|
|
4929
|
+
});
|
|
4930
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
4931
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4932
|
+
} else {
|
|
4933
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
4934
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4935
|
+
});
|
|
4936
|
+
}
|
|
4475
4937
|
}
|
|
4938
|
+
|
|
4476
4939
|
return target;
|
|
4477
4940
|
}
|
|
4478
4941
|
|
|
@@ -4482,6 +4945,7 @@ function _objectSpread(target) {
|
|
|
4482
4945
|
|
|
4483
4946
|
|
|
4484
4947
|
|
|
4948
|
+
|
|
4485
4949
|
var TextContainer = external_styled_components_default.a.div.withConfig({
|
|
4486
4950
|
displayName: "RadialLayout__TextContainer",
|
|
4487
4951
|
componentId: "sc-13x2rjt-0"
|
|
@@ -4536,50 +5000,54 @@ var UnderLabelText = external_styled_components_default.a.span.withConfig({
|
|
|
4536
5000
|
}, function (props) {
|
|
4537
5001
|
return props.maxWidth;
|
|
4538
5002
|
});
|
|
5003
|
+
|
|
4539
5004
|
var RadialLayout_RadialContent = function RadialContent(_ref) {
|
|
4540
5005
|
var props = extends_default()({}, _ref);
|
|
5006
|
+
|
|
4541
5007
|
var majorColor = props.majorColor,
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
5008
|
+
majorValue = props.majorValue,
|
|
5009
|
+
majorText = props.majorText,
|
|
5010
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
5011
|
+
majorValueTitle = props.majorValueTitle,
|
|
5012
|
+
minValue = props.minValue,
|
|
5013
|
+
maxValue = props.maxValue,
|
|
5014
|
+
trendColor = props.trendColor,
|
|
5015
|
+
trendText = props.trendText,
|
|
5016
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
5017
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
5018
|
+
unit = props.unit,
|
|
5019
|
+
unitPosition = props.unitPosition,
|
|
5020
|
+
underLabelColor = props.underLabelColor,
|
|
5021
|
+
underLabel = props.underLabel,
|
|
5022
|
+
onValueClick = props.onValueClick,
|
|
5023
|
+
showRadialGraph = props.showRadialGraph,
|
|
5024
|
+
progress = props.progress,
|
|
5025
|
+
radialBackgroundColor = props.radialBackgroundColor,
|
|
5026
|
+
radialStrokeColor = props.radialStrokeColor,
|
|
5027
|
+
radialStrokeWidth = props.radialStrokeWidth,
|
|
5028
|
+
graphWidth = props.graphWidth,
|
|
5029
|
+
graphHeight = props.graphHeight,
|
|
5030
|
+
isGaugeValid = props.isGaugeValid,
|
|
5031
|
+
formattedGaugeRanges = props.formattedGaugeRanges,
|
|
5032
|
+
defaultFontColor = props.defaultFontColor;
|
|
5033
|
+
|
|
4567
5034
|
var _getRadialHelperDimen = Object(displayUtils["getRadialHelperDimensions"])({
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
5035
|
+
height: graphHeight,
|
|
5036
|
+
strokeWidth: radialStrokeWidth
|
|
5037
|
+
}),
|
|
5038
|
+
semicircleRadius = _getRadialHelperDimen.semicircleRadius,
|
|
5039
|
+
helperArcRadius = _getRadialHelperDimen.helperArcRadius; // Two cases for filling underLabel space: either the semicircle radius is insufficiently sized for text
|
|
4573
5040
|
// or the radial visualization has been disabled (first condition reached first when making smaller).
|
|
4574
|
-
var fillVacantSpace = semicircleRadius < 50 || !showRadialGraph;
|
|
4575
5041
|
|
|
4576
|
-
|
|
5042
|
+
|
|
5043
|
+
var fillVacantSpace = semicircleRadius < 50 || !showRadialGraph; // If filling the vacant space, no height on underLabel container. Otherwise, the underLabel height is 20% of the helperArcRadius (min 20px).
|
|
5044
|
+
|
|
4577
5045
|
var underLabelHeight = fillVacantSpace ? 0 : Math.max(helperArcRadius * 0.2, 20);
|
|
4578
|
-
var underLabelWidth = helperArcRadius * 2;
|
|
5046
|
+
var underLabelWidth = helperArcRadius * 2; // Remove extra padding under major value - this is specific to Proxima Nova
|
|
4579
5047
|
|
|
4580
|
-
// Remove extra padding under major value - this is specific to Proxima Nova
|
|
4581
5048
|
var singleValueBottomOffset = majorTextFontSize * 0.2;
|
|
4582
5049
|
var radialGraph = null;
|
|
5050
|
+
|
|
4583
5051
|
if (showRadialGraph) {
|
|
4584
5052
|
radialGraph = isGaugeValid ? /*#__PURE__*/external_react_default.a.createElement(GaugeGraph_default.a, {
|
|
4585
5053
|
width: graphWidth,
|
|
@@ -4601,6 +5069,7 @@ var RadialLayout_RadialContent = function RadialContent(_ref) {
|
|
|
4601
5069
|
height: graphHeight
|
|
4602
5070
|
});
|
|
4603
5071
|
}
|
|
5072
|
+
|
|
4604
5073
|
var singleValueComponent = /*#__PURE__*/external_react_default.a.createElement(SingleValueContainer, {
|
|
4605
5074
|
singleValueBottomOffset: singleValueBottomOffset
|
|
4606
5075
|
}, /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic["default"], {
|
|
@@ -4622,7 +5091,6 @@ var RadialLayout_RadialContent = function RadialContent(_ref) {
|
|
|
4622
5091
|
"data-test": "underLabel",
|
|
4623
5092
|
maxWidth: underLabelWidth * 0.9 // buffer for overflow ellipses
|
|
4624
5093
|
,
|
|
4625
|
-
|
|
4626
5094
|
color: underLabelColor,
|
|
4627
5095
|
title: underLabel
|
|
4628
5096
|
}, underLabel));
|
|
@@ -4635,6 +5103,7 @@ var RadialLayout_RadialContent = function RadialContent(_ref) {
|
|
|
4635
5103
|
height: graphHeight
|
|
4636
5104
|
}, singleValueComponent, underLabelComponent));
|
|
4637
5105
|
};
|
|
5106
|
+
|
|
4638
5107
|
RadialLayout_RadialContent.propTypes = _objectSpread(_objectSpread({}, SingleValueBasic["default"].propTypes), {}, {
|
|
4639
5108
|
trendPosition: external_prop_types_default.a.string,
|
|
4640
5109
|
showRadialGraph: external_prop_types_default.a.bool,
|
|
@@ -4679,31 +5148,34 @@ var Container = external_styled_components_default.a.div.withConfig({
|
|
|
4679
5148
|
})(["overflow:hidden;", ";"], function (props) {
|
|
4680
5149
|
return Object(style_["toDimension"])(Object(external_lodash_["pick"])(props, ['width', 'height']));
|
|
4681
5150
|
});
|
|
5151
|
+
|
|
4682
5152
|
var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
4683
5153
|
var props = extends_default()({}, _ref);
|
|
5154
|
+
|
|
4684
5155
|
var width = props.width,
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
5156
|
+
_props$height = props.height,
|
|
5157
|
+
height = _props$height === void 0 ? 250 : _props$height,
|
|
5158
|
+
style = props.style,
|
|
5159
|
+
isGaugeOn = props.isGaugeOn,
|
|
5160
|
+
gaugeRanges = props.gaugeRanges,
|
|
5161
|
+
majorFontSize = props.majorFontSize,
|
|
5162
|
+
majorValue = props.majorValue,
|
|
5163
|
+
majorValueField = props.majorValueField,
|
|
5164
|
+
minValue = props.minValue,
|
|
5165
|
+
maxValue = props.maxValue,
|
|
5166
|
+
trendValue = props.trendValue,
|
|
5167
|
+
trendFontSize = props.trendFontSize,
|
|
5168
|
+
unitPosition = props.unitPosition,
|
|
5169
|
+
numberPrecision = props.numberPrecision,
|
|
5170
|
+
shouldUseThousandSeparators = props.shouldUseThousandSeparators,
|
|
5171
|
+
shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
|
|
5172
|
+
onValueClick = props.onValueClick,
|
|
5173
|
+
splitByLayout = props.splitByLayout,
|
|
5174
|
+
_props$trellisKey = props.trellisKey,
|
|
5175
|
+
trellisKey = _props$trellisKey === void 0 ? '' : _props$trellisKey,
|
|
5176
|
+
_props$trellisSplitBy = props.trellisSplitBy,
|
|
5177
|
+
trellisSplitBy = _props$trellisSplitBy === void 0 ? '' : _props$trellisSplitBy; // calculate colors
|
|
5178
|
+
|
|
4707
5179
|
var defaultColors = {
|
|
4708
5180
|
defaultFontColor: pick_default()({
|
|
4709
5181
|
enterprise: {
|
|
@@ -4717,12 +5189,14 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4717
5189
|
prisma: variables_default.a.contentColorActive(props)
|
|
4718
5190
|
})(props)
|
|
4719
5191
|
};
|
|
5192
|
+
|
|
4720
5193
|
var _computeColors = Object(singleValueUtils["computeColors"])(props, defaultColors),
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
5194
|
+
backgroundEnabled = _computeColors.backgroundEnabled,
|
|
5195
|
+
backgroundColor = _computeColors.backgroundColor,
|
|
5196
|
+
majorColor = _computeColors.majorColor,
|
|
5197
|
+
trendColor = _computeColors.trendColor,
|
|
5198
|
+
underLabelColor = _computeColors.underLabelColor;
|
|
5199
|
+
|
|
4726
5200
|
var radialColors = Object(displayUtils["getRadialColors"])({
|
|
4727
5201
|
backgroundEnabled: backgroundEnabled,
|
|
4728
5202
|
backgroundColor: backgroundColor
|
|
@@ -4738,68 +5212,75 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4738
5212
|
var sortedGaugeRanges = gaugeRanges && Object(gaugeUtils["getSortedGaugeRanges"])(gaugeRanges);
|
|
4739
5213
|
var isGaugeValid = isGaugeOn && gaugeRanges && Object(gaugeUtils["validateGaugeRanges"])(sortedGaugeRanges);
|
|
4740
5214
|
var formattedGaugeRanges = isGaugeValid && Object(gaugeUtils["getFormattedGaugeRanges"])(sortedGaugeRanges, minValue, maxValue);
|
|
5215
|
+
|
|
4741
5216
|
var renderVisualization = function renderVisualization(_ref2) {
|
|
4742
5217
|
var containerWidth = _ref2.width,
|
|
4743
|
-
|
|
5218
|
+
containerHeight = _ref2.height;
|
|
4744
5219
|
var underLabel = props.underLabel;
|
|
4745
5220
|
var trendDisplay = props.trendDisplay,
|
|
4746
|
-
|
|
5221
|
+
unit = props.unit; // calculate radial graph dimensions, strokewidth, and major and trend content dimensions
|
|
5222
|
+
|
|
4747
5223
|
var _getRadialGraphDimens = Object(displayUtils["getRadialGraphDimensions"])({
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
// Subtract half of the stroke width for the exact internal radius.
|
|
4756
|
-
|
|
4757
|
-
// If radius drops below 20px, hide the radial graph.
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
5224
|
+
width: containerWidth,
|
|
5225
|
+
height: containerHeight
|
|
5226
|
+
}),
|
|
5227
|
+
graphWidth = _getRadialGraphDimens.width,
|
|
5228
|
+
graphHeight = _getRadialGraphDimens.height; // Radial stroke width is stepped to lower value at lower sizes.
|
|
5229
|
+
|
|
5230
|
+
|
|
5231
|
+
var radialStrokeWidth = Object(displayUtils["getRadialStrokeWidth"])(graphHeight); // Subtract half of the stroke width for the exact internal radius.
|
|
5232
|
+
|
|
5233
|
+
var semicircleRadius = graphHeight - radialStrokeWidth / 2; // If radius drops below 20px, hide the radial graph.
|
|
5234
|
+
|
|
5235
|
+
var showRadialGraph = semicircleRadius >= 20; // if gauge is valid, reduce contentWidth and contentHeight by padding from GaugeGraph
|
|
5236
|
+
|
|
4761
5237
|
var offSet = isGaugeValid ? Object(gaugeUtils["getLabelFontSize"])(graphHeight, showRadialGraph) * 3 : 0;
|
|
5238
|
+
|
|
4762
5239
|
var _getRadialHelperDimen = Object(displayUtils["getRadialHelperDimensions"])({
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
5240
|
+
height: graphHeight - radialStrokeWidth / 2 - offSet,
|
|
5241
|
+
strokeWidth: radialStrokeWidth
|
|
5242
|
+
}),
|
|
5243
|
+
contentWidth = _getRadialHelperDimen.contentWidth,
|
|
5244
|
+
contentHeight = _getRadialHelperDimen.contentHeight; // If not showing the radial graph, then can forgo padding logic and use original container dimensions for content sizing computation.
|
|
5245
|
+
|
|
5246
|
+
|
|
4768
5247
|
if (!showRadialGraph) {
|
|
4769
5248
|
graphWidth = containerWidth;
|
|
4770
5249
|
contentWidth = containerWidth;
|
|
4771
5250
|
graphHeight = containerHeight;
|
|
4772
5251
|
contentHeight = containerHeight;
|
|
4773
5252
|
}
|
|
5253
|
+
|
|
4774
5254
|
var _computeSingleValueRa = Object(singleValueUtils["computeSingleValueRadialContent"])({
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
5255
|
+
majorValue: majorValue,
|
|
5256
|
+
trendValue: trendValue,
|
|
5257
|
+
majorFontSize: majorFontSize,
|
|
5258
|
+
trendFontSize: trendFontSize,
|
|
5259
|
+
trendDisplay: trendDisplay,
|
|
5260
|
+
contentWidth: contentWidth,
|
|
5261
|
+
contentHeight: contentHeight,
|
|
5262
|
+
// buffer for height of div
|
|
5263
|
+
containerWidth: containerWidth * 0.9,
|
|
5264
|
+
containerHeight: containerHeight * 0.9,
|
|
5265
|
+
unit: unit,
|
|
5266
|
+
numberPrecision: numberPrecision,
|
|
5267
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
5268
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
5269
|
+
smallViz: !showRadialGraph
|
|
5270
|
+
}),
|
|
5271
|
+
majorText = _computeSingleValueRa.majorText,
|
|
5272
|
+
trendText = _computeSingleValueRa.trendText,
|
|
5273
|
+
majorTextFontSize = _computeSingleValueRa.majorTextFontSize,
|
|
5274
|
+
trendTextFontSize = _computeSingleValueRa.trendTextFontSize,
|
|
5275
|
+
majorValueTitle = _computeSingleValueRa.majorValueTitle,
|
|
5276
|
+
smallVizProps = _computeSingleValueRa.smallVizProps;
|
|
5277
|
+
|
|
4797
5278
|
if (!Object(external_lodash_["isEmpty"])(smallVizProps)) {
|
|
4798
5279
|
trendDisplay = smallVizProps.trendDisplay;
|
|
4799
5280
|
unit = smallVizProps.unit;
|
|
4800
|
-
}
|
|
5281
|
+
} // calculate radial progress
|
|
5282
|
+
|
|
4801
5283
|
|
|
4802
|
-
// calculate radial progress
|
|
4803
5284
|
var progress = Object(displayUtils["getRadialProgress"])(majorValue - minValue, minValue, maxValue);
|
|
4804
5285
|
return /*#__PURE__*/external_react_["createElement"](VizStyleWrapper["default"], {
|
|
4805
5286
|
backgroundColor: backgroundColor,
|
|
@@ -4835,6 +5316,7 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4835
5316
|
defaultFontColor: defaultColors.defaultFontColor
|
|
4836
5317
|
}));
|
|
4837
5318
|
};
|
|
5319
|
+
|
|
4838
5320
|
if (trellisEnabled) {
|
|
4839
5321
|
return /*#__PURE__*/external_react_["createElement"](external_react_["Fragment"], null, /*#__PURE__*/external_react_["createElement"](TrellisTitle["TrellisTitle"], {
|
|
4840
5322
|
fontColor: defaultColors.defaultFontColor,
|
|
@@ -4847,6 +5329,7 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4847
5329
|
return renderVisualization(containerDimension);
|
|
4848
5330
|
})));
|
|
4849
5331
|
}
|
|
5332
|
+
|
|
4850
5333
|
return /*#__PURE__*/external_react_["createElement"](Container, {
|
|
4851
5334
|
width: width,
|
|
4852
5335
|
height: height
|
|
@@ -4854,6 +5337,7 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4854
5337
|
return renderVisualization(containerDimension);
|
|
4855
5338
|
}));
|
|
4856
5339
|
};
|
|
5340
|
+
|
|
4857
5341
|
SingleValueRadial_SingleValueRadial.propTypes = {
|
|
4858
5342
|
width: external_prop_types_["oneOfType"]([external_prop_types_["string"], external_prop_types_["number"]]),
|
|
4859
5343
|
height: external_prop_types_["oneOfType"]([external_prop_types_["string"], external_prop_types_["number"]]),
|
|
@@ -4946,6 +5430,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4946
5430
|
});
|
|
4947
5431
|
exports.LAYOUT_TYPE = void 0;
|
|
4948
5432
|
var LAYOUT_TYPE;
|
|
5433
|
+
|
|
4949
5434
|
(function (LAYOUT_TYPE) {
|
|
4950
5435
|
LAYOUT_TYPE["Off"] = "off";
|
|
4951
5436
|
LAYOUT_TYPE["Trellis"] = "trellis";
|
|
@@ -4964,6 +5449,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4964
5449
|
});
|
|
4965
5450
|
exports.VizBehavior = void 0;
|
|
4966
5451
|
var VizBehavior;
|
|
5452
|
+
|
|
4967
5453
|
(function (VizBehavior) {
|
|
4968
5454
|
/**
|
|
4969
5455
|
* Dynamic Options Behavior.
|
|
@@ -4983,6 +5469,7 @@ var VizBehavior;
|
|
|
4983
5469
|
* missing.
|
|
4984
5470
|
* @type {string}
|
|
4985
5471
|
*/
|
|
5472
|
+
|
|
4986
5473
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
4987
5474
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
4988
5475
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -5046,8 +5533,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5046
5533
|
value: true
|
|
5047
5534
|
});
|
|
5048
5535
|
exports.TrellisTitle = exports.TRELLIS_TITLE_HEIGHT = void 0;
|
|
5536
|
+
|
|
5049
5537
|
var React = __webpack_require__(1);
|
|
5538
|
+
|
|
5050
5539
|
var styled_components_1 = __webpack_require__(4);
|
|
5540
|
+
|
|
5051
5541
|
exports.TRELLIS_TITLE_HEIGHT = 28;
|
|
5052
5542
|
var TrellisTitleText = styled_components_1.default.div.withConfig({
|
|
5053
5543
|
displayName: "TrellisTitle__TrellisTitleText",
|
|
@@ -5063,6 +5553,7 @@ var TrellisTitleDiv = styled_components_1.default.div.withConfig({
|
|
|
5063
5553
|
}, function (props) {
|
|
5064
5554
|
return props.backgroundColor;
|
|
5065
5555
|
});
|
|
5556
|
+
|
|
5066
5557
|
var TrellisTitle = function TrellisTitle(props) {
|
|
5067
5558
|
var titleText = String(props.trellisKey).toString();
|
|
5068
5559
|
return React.createElement(TrellisTitleDiv, {
|
|
@@ -5072,6 +5563,7 @@ var TrellisTitle = function TrellisTitle(props) {
|
|
|
5072
5563
|
title: titleText
|
|
5073
5564
|
}, React.createElement(TrellisTitleText, null, titleText));
|
|
5074
5565
|
};
|
|
5566
|
+
|
|
5075
5567
|
exports.TrellisTitle = TrellisTitle;
|
|
5076
5568
|
|
|
5077
5569
|
/***/ }),
|
|
@@ -5113,7 +5605,6 @@ var MAJOR_FONT_THRESHOLD = 25;
|
|
|
5113
5605
|
var TREND_FONT_THRESHOLD = 12;
|
|
5114
5606
|
var DEFAULT_RADIAL_STROKE_WIDTH = 16;
|
|
5115
5607
|
var SMALL_RADIAL_STROKE_WIDTH = 6;
|
|
5116
|
-
|
|
5117
5608
|
/**
|
|
5118
5609
|
* Get the colors for a radial graph based on severity
|
|
5119
5610
|
* @method getRadialColors
|
|
@@ -5122,9 +5613,10 @@ var SMALL_RADIAL_STROKE_WIDTH = 6;
|
|
|
5122
5613
|
* @param {String} props.backgroundColor
|
|
5123
5614
|
* @returns {Object} { background, stroke } colors
|
|
5124
5615
|
*/
|
|
5616
|
+
|
|
5125
5617
|
var getRadialColors = function getRadialColors(_ref) {
|
|
5126
5618
|
var backgroundEnabled = _ref.backgroundEnabled,
|
|
5127
|
-
|
|
5619
|
+
backgroundColor = _ref.backgroundColor;
|
|
5128
5620
|
return Object(_common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["getGraphColors"])({
|
|
5129
5621
|
backgroundEnabled: backgroundEnabled,
|
|
5130
5622
|
backgroundColor: backgroundColor,
|
|
@@ -5137,7 +5629,6 @@ var getRadialColors = function getRadialColors(_ref) {
|
|
|
5137
5629
|
}
|
|
5138
5630
|
});
|
|
5139
5631
|
};
|
|
5140
|
-
|
|
5141
5632
|
/**
|
|
5142
5633
|
* Figure out the dimensions of the graph
|
|
5143
5634
|
* @method getRadialGraphDimensions
|
|
@@ -5146,17 +5637,17 @@ var getRadialColors = function getRadialColors(_ref) {
|
|
|
5146
5637
|
* @param {Number} props.height // Height of the container
|
|
5147
5638
|
* @returns {Number} width and height of the graph
|
|
5148
5639
|
*/
|
|
5640
|
+
|
|
5149
5641
|
var getRadialGraphDimensions = function getRadialGraphDimensions(_ref2) {
|
|
5150
5642
|
var width = _ref2.width,
|
|
5151
|
-
|
|
5152
|
-
|
|
5643
|
+
height = _ref2.height; // height * 2 because we are fitting only half of a circle inside the container
|
|
5644
|
+
|
|
5153
5645
|
var radius = Math.min(width, height * 2) / 2;
|
|
5154
5646
|
return {
|
|
5155
5647
|
width: width - _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["SVR_PADDING"].left - _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["SVR_PADDING"].right,
|
|
5156
5648
|
height: radius - _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["SVR_PADDING"].top - _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["SVR_PADDING"].bottom
|
|
5157
5649
|
};
|
|
5158
5650
|
};
|
|
5159
|
-
|
|
5160
5651
|
/**
|
|
5161
5652
|
* Figure out the dimensions of the content container for SVR
|
|
5162
5653
|
* @method getRadialHelperDimensions
|
|
@@ -5165,12 +5656,14 @@ var getRadialGraphDimensions = function getRadialGraphDimensions(_ref2) {
|
|
|
5165
5656
|
* @param {Number} props.height // Height of the visualization space
|
|
5166
5657
|
* @returns {Number} width and height of the content graph
|
|
5167
5658
|
*/
|
|
5659
|
+
|
|
5168
5660
|
var getRadialHelperDimensions = function getRadialHelperDimensions(_ref3) {
|
|
5169
5661
|
var height = _ref3.height,
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5662
|
+
_ref3$strokeWidth = _ref3.strokeWidth,
|
|
5663
|
+
strokeWidth = _ref3$strokeWidth === void 0 ? DEFAULT_RADIAL_STROKE_WIDTH : _ref3$strokeWidth; // The radius of the visualization is equal to the height
|
|
5664
|
+
|
|
5173
5665
|
var semicircleRadius = height - strokeWidth / 2; // The inner part of the arc is strokeWidth / 2 inset.
|
|
5666
|
+
|
|
5174
5667
|
var innerArcRadius = semicircleRadius * 0.9;
|
|
5175
5668
|
var halfContentWidth = innerArcRadius * 0.7;
|
|
5176
5669
|
var contentHeight = Math.floor(Math.sqrt(Math.pow(innerArcRadius, 2) - Math.pow(halfContentWidth, 2)));
|
|
@@ -5181,7 +5674,6 @@ var getRadialHelperDimensions = function getRadialHelperDimensions(_ref3) {
|
|
|
5181
5674
|
semicircleRadius: semicircleRadius
|
|
5182
5675
|
};
|
|
5183
5676
|
};
|
|
5184
|
-
|
|
5185
5677
|
/**
|
|
5186
5678
|
* Get the maximum size of the container that holds the graph text
|
|
5187
5679
|
* @method getValueContentSize
|
|
@@ -5190,34 +5682,34 @@ var getRadialHelperDimensions = function getRadialHelperDimensions(_ref3) {
|
|
|
5190
5682
|
* @param {Number} props.radialStrokeWidth // Stroke width of the graph
|
|
5191
5683
|
* @returns {Number} content size for showing major and trend values in radial graph
|
|
5192
5684
|
*/
|
|
5685
|
+
|
|
5193
5686
|
var getValueContentSize = function getValueContentSize(_ref4) {
|
|
5194
5687
|
var graphSize = _ref4.graphSize,
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
var diameter = graphSize - radialStrokeWidth;
|
|
5198
|
-
// Use pythagoreum theorum with circle diameter
|
|
5688
|
+
radialStrokeWidth = _ref4.radialStrokeWidth; // Account for the graph's stroke width
|
|
5689
|
+
|
|
5690
|
+
var diameter = graphSize - radialStrokeWidth; // Use pythagoreum theorum with circle diameter
|
|
5199
5691
|
// to calculate the size of the sides of the square inside the circle
|
|
5692
|
+
|
|
5200
5693
|
return Math.floor(Math.sqrt(Math.pow(diameter, 2) / 2));
|
|
5201
5694
|
};
|
|
5202
|
-
|
|
5203
5695
|
/*
|
|
5204
5696
|
* @method getRadialStrokeWidth
|
|
5205
5697
|
* @param {Number} graphHeight
|
|
5206
5698
|
* @returns {Number} radial stroke width
|
|
5207
5699
|
*/
|
|
5700
|
+
|
|
5208
5701
|
var getRadialStrokeWidth = function getRadialStrokeWidth(graphHeight) {
|
|
5209
5702
|
return graphHeight >= 90 ? DEFAULT_RADIAL_STROKE_WIDTH : SMALL_RADIAL_STROKE_WIDTH;
|
|
5210
5703
|
};
|
|
5211
|
-
|
|
5212
5704
|
/*
|
|
5213
5705
|
* @method isValidPosition
|
|
5214
5706
|
* @param {String} position
|
|
5215
5707
|
* @returns {Bool}
|
|
5216
5708
|
*/
|
|
5709
|
+
|
|
5217
5710
|
var isValidPosition = function isValidPosition(position) {
|
|
5218
5711
|
return VALID_TREND_POSITIONS.indexOf(position) > -1;
|
|
5219
5712
|
};
|
|
5220
|
-
|
|
5221
5713
|
/*
|
|
5222
5714
|
* @method showTrendPositionStandard
|
|
5223
5715
|
* @param {Object} props
|
|
@@ -5225,12 +5717,12 @@ var isValidPosition = function isValidPosition(position) {
|
|
|
5225
5717
|
* @param {String} props.position
|
|
5226
5718
|
* @returns {Bool}
|
|
5227
5719
|
*/
|
|
5720
|
+
|
|
5228
5721
|
var showTrendPositionStandard = function showTrendPositionStandard(_ref5) {
|
|
5229
5722
|
var showTrendIndicator = _ref5.showTrendIndicator,
|
|
5230
|
-
|
|
5723
|
+
position = _ref5.position;
|
|
5231
5724
|
return showTrendIndicator && position === 'standard';
|
|
5232
5725
|
};
|
|
5233
|
-
|
|
5234
5726
|
/*
|
|
5235
5727
|
* @method showTrendPositionBelow
|
|
5236
5728
|
* @param {Object} props
|
|
@@ -5238,12 +5730,12 @@ var showTrendPositionStandard = function showTrendPositionStandard(_ref5) {
|
|
|
5238
5730
|
* @param {String} props.position
|
|
5239
5731
|
* @returns {Bool}
|
|
5240
5732
|
*/
|
|
5733
|
+
|
|
5241
5734
|
var showTrendPositionBelow = function showTrendPositionBelow(_ref6) {
|
|
5242
5735
|
var showTrendIndicator = _ref6.showTrendIndicator,
|
|
5243
|
-
|
|
5736
|
+
position = _ref6.position;
|
|
5244
5737
|
return showTrendIndicator && position === 'below';
|
|
5245
5738
|
};
|
|
5246
|
-
|
|
5247
5739
|
/*
|
|
5248
5740
|
* @method showTrendPositionOutside
|
|
5249
5741
|
* @param {Object} props
|
|
@@ -5251,12 +5743,12 @@ var showTrendPositionBelow = function showTrendPositionBelow(_ref6) {
|
|
|
5251
5743
|
* @param {String} props.position
|
|
5252
5744
|
* @returns {Bool}
|
|
5253
5745
|
*/
|
|
5746
|
+
|
|
5254
5747
|
var showTrendPositionOutside = function showTrendPositionOutside(_ref7) {
|
|
5255
5748
|
var showTrendIndicator = _ref7.showTrendIndicator,
|
|
5256
|
-
|
|
5749
|
+
position = _ref7.position;
|
|
5257
5750
|
return showTrendIndicator && position === 'outside';
|
|
5258
5751
|
};
|
|
5259
|
-
|
|
5260
5752
|
/*
|
|
5261
5753
|
* @method getRadialProgress
|
|
5262
5754
|
* @param {Number} amount of progress in the radial
|
|
@@ -5264,6 +5756,7 @@ var showTrendPositionOutside = function showTrendPositionOutside(_ref7) {
|
|
|
5264
5756
|
* @param {Number} maxValue
|
|
5265
5757
|
* @returns {Number} percentage of progress in the radial
|
|
5266
5758
|
*/
|
|
5759
|
+
|
|
5267
5760
|
var getRadialProgress = function getRadialProgress(progressValue, minValue, maxValue) {
|
|
5268
5761
|
return typeof progressValue === 'number' && minValue < maxValue && progressValue > 0 ? progressValue / (maxValue - minValue) * 100 : 0;
|
|
5269
5762
|
};
|
|
@@ -5300,11 +5793,11 @@ var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(exte
|
|
|
5300
5793
|
var singleValueUtils = __webpack_require__(24);
|
|
5301
5794
|
|
|
5302
5795
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowUp"
|
|
5303
|
-
var ArrowUp_ = __webpack_require__(
|
|
5796
|
+
var ArrowUp_ = __webpack_require__(85);
|
|
5304
5797
|
var ArrowUp_default = /*#__PURE__*/__webpack_require__.n(ArrowUp_);
|
|
5305
5798
|
|
|
5306
5799
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowDown"
|
|
5307
|
-
var ArrowDown_ = __webpack_require__(
|
|
5800
|
+
var ArrowDown_ = __webpack_require__(86);
|
|
5308
5801
|
var ArrowDown_default = /*#__PURE__*/__webpack_require__.n(ArrowDown_);
|
|
5309
5802
|
|
|
5310
5803
|
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
@@ -5342,13 +5835,15 @@ var Text = external_styled_components_default.a.div.withConfig({
|
|
|
5342
5835
|
}, function (props) {
|
|
5343
5836
|
return props.size ? "margin-left: ".concat(parseInt(props.size, 10) * 0.2 || 5, "px;") : '';
|
|
5344
5837
|
});
|
|
5838
|
+
|
|
5345
5839
|
var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
5346
5840
|
var fontSize = _ref.fontSize,
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5841
|
+
color = _ref.color,
|
|
5842
|
+
value = _ref.value,
|
|
5843
|
+
text = _ref.text;
|
|
5350
5844
|
var TrendIndicator = false;
|
|
5351
5845
|
var ariaLabel = false;
|
|
5846
|
+
|
|
5352
5847
|
if (parseFloat(value, 10) > 0) {
|
|
5353
5848
|
TrendIndicator = ArrowUp_default.a;
|
|
5354
5849
|
ariaLabel = Object(i18n_["_"])('increase');
|
|
@@ -5356,6 +5851,7 @@ var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5356
5851
|
TrendIndicator = ArrowDown_default.a;
|
|
5357
5852
|
ariaLabel = Object(i18n_["_"])('decrease');
|
|
5358
5853
|
}
|
|
5854
|
+
|
|
5359
5855
|
return /*#__PURE__*/external_react_default.a.createElement(Column, {
|
|
5360
5856
|
justify: "flex-end",
|
|
5361
5857
|
size: fontSize
|
|
@@ -5371,6 +5867,7 @@ var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5371
5867
|
color: color
|
|
5372
5868
|
}, "".concat(text)));
|
|
5373
5869
|
};
|
|
5870
|
+
|
|
5374
5871
|
TrendValue_SingleValueContent.propTypes = {
|
|
5375
5872
|
fontSize: external_prop_types_default.a.number,
|
|
5376
5873
|
color: external_prop_types_default.a.string,
|
|
@@ -5379,7 +5876,7 @@ TrendValue_SingleValueContent.propTypes = {
|
|
|
5379
5876
|
};
|
|
5380
5877
|
/* harmony default export */ var TrendValue = (TrendValue_SingleValueContent);
|
|
5381
5878
|
// EXTERNAL MODULE: external "cssesc"
|
|
5382
|
-
var external_cssesc_ = __webpack_require__(
|
|
5879
|
+
var external_cssesc_ = __webpack_require__(87);
|
|
5383
5880
|
var external_cssesc_default = /*#__PURE__*/__webpack_require__.n(external_cssesc_);
|
|
5384
5881
|
|
|
5385
5882
|
// CONCATENATED MODULE: ./src/SingleValueBasic/MajorValue.jsx
|
|
@@ -5411,37 +5908,44 @@ var MajorValue_Text = external_styled_components_default.a.div.withConfig({
|
|
|
5411
5908
|
if (!props.pseudoContent || !props.pseudoContentPosition) {
|
|
5412
5909
|
return '';
|
|
5413
5910
|
}
|
|
5911
|
+
|
|
5414
5912
|
return "&:".concat(props.pseudoContentPosition, " {\n // by default this pseudo element would inherit text-decoration from main element\n // and text-decoration could not be overwritten.\n // adding display: inline-block makes text decoration independent from main element.\n // => the unit will not be underlined if a user hovers over the main value\n display: inline-block;\n font-size: ").concat(props.pseudoContentFontSize, "px;\n position: relative;\n font-weight: normal;\n content: ").concat(props.pseudoContent, ";\n }");
|
|
5415
5913
|
});
|
|
5416
5914
|
var validUnitPositions = ['before', 'after'];
|
|
5915
|
+
|
|
5417
5916
|
var MajorValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
5418
5917
|
var color = _ref.color,
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5918
|
+
fontSize = _ref.fontSize,
|
|
5919
|
+
unitPosition = _ref.unitPosition,
|
|
5920
|
+
title = _ref.title,
|
|
5921
|
+
value = _ref.value,
|
|
5922
|
+
onValueClick = _ref.onValueClick,
|
|
5923
|
+
unit = _ref.unit;
|
|
5425
5924
|
var sanitizedUnit;
|
|
5426
5925
|
var sanitizedUnitPosition;
|
|
5926
|
+
|
|
5427
5927
|
if (typeof unit === 'string') {
|
|
5428
5928
|
sanitizedUnit = external_cssesc_default()(unit, {
|
|
5429
5929
|
wrap: true,
|
|
5430
5930
|
quotes: 'double'
|
|
5431
5931
|
});
|
|
5932
|
+
|
|
5432
5933
|
if (typeof unitPosition === 'string' && validUnitPositions.includes(unitPosition)) {
|
|
5433
5934
|
sanitizedUnitPosition = unitPosition;
|
|
5434
5935
|
} else {
|
|
5435
5936
|
sanitizedUnitPosition = 'after';
|
|
5436
5937
|
}
|
|
5437
5938
|
}
|
|
5939
|
+
|
|
5438
5940
|
var handleKeyDown = function handleKeyDown(e) {
|
|
5439
5941
|
if (e.keyCode !== 13) {
|
|
5440
5942
|
return;
|
|
5441
5943
|
}
|
|
5944
|
+
|
|
5442
5945
|
e.preventDefault();
|
|
5443
5946
|
onValueClick(e);
|
|
5444
5947
|
};
|
|
5948
|
+
|
|
5445
5949
|
return /*#__PURE__*/external_react_default.a.createElement(Row, {
|
|
5446
5950
|
size: fontSize
|
|
5447
5951
|
}, /*#__PURE__*/external_react_default.a.createElement(MajorValue_Text, {
|
|
@@ -5461,6 +5965,7 @@ var MajorValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5461
5965
|
onKeyDown: handleKeyDown
|
|
5462
5966
|
}, value));
|
|
5463
5967
|
};
|
|
5968
|
+
|
|
5464
5969
|
MajorValue_SingleValueContent.propTypes = {
|
|
5465
5970
|
color: external_prop_types_default.a.string,
|
|
5466
5971
|
fontSize: external_prop_types_default.a.number,
|
|
@@ -5499,22 +6004,24 @@ var SingleValueBasic_Text = external_styled_components_default.a.div.withConfig(
|
|
|
5499
6004
|
}, singleValueUtils["DEFAULT_FONT_FAMILY"], function (props) {
|
|
5500
6005
|
return props.size || 12;
|
|
5501
6006
|
});
|
|
6007
|
+
|
|
5502
6008
|
var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
5503
6009
|
var props = extends_default()({}, _ref);
|
|
6010
|
+
|
|
5504
6011
|
var majorColor = props.majorColor,
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
6012
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
6013
|
+
majorText = props.majorText,
|
|
6014
|
+
majorValueTitle = props.majorValueTitle,
|
|
6015
|
+
trendColor = props.trendColor,
|
|
6016
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
6017
|
+
trendText = props.trendText,
|
|
6018
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
6019
|
+
unit = props.unit,
|
|
6020
|
+
unitPosition = props.unitPosition,
|
|
6021
|
+
underLabel = props.underLabel,
|
|
6022
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
6023
|
+
underLabelColor = props.underLabelColor,
|
|
6024
|
+
onValueClick = props.onValueClick;
|
|
5518
6025
|
var trendIndicatorEnabled = trendText !== '' && showTrendIndicator;
|
|
5519
6026
|
return /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Column, null, /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Row, {
|
|
5520
6027
|
align: "baseline"
|
|
@@ -5527,7 +6034,8 @@ var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
|
5527
6034
|
value: majorText,
|
|
5528
6035
|
title: majorValueTitle,
|
|
5529
6036
|
onValueClick: onValueClick
|
|
5530
|
-
}), trendIndicatorEnabled &&
|
|
6037
|
+
}), trendIndicatorEnabled &&
|
|
6038
|
+
/*#__PURE__*/
|
|
5531
6039
|
// Passing the same value for value and text is a temporary hold until completion of https://jira.splunk.com/browse/SCP-21371
|
|
5532
6040
|
external_react_default.a.createElement(TrendValue, {
|
|
5533
6041
|
"data-test": "TrendIndicator",
|
|
@@ -5543,6 +6051,7 @@ var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
|
5543
6051
|
color: underLabelColor
|
|
5544
6052
|
}, underLabel)));
|
|
5545
6053
|
};
|
|
6054
|
+
|
|
5546
6055
|
SingleValueBasic_SingleValueBasic.propTypes = {
|
|
5547
6056
|
majorText: external_prop_types_default.a.string,
|
|
5548
6057
|
majorColor: external_prop_types_default.a.string,
|
|
@@ -5571,28 +6080,28 @@ module.exports = require("@babel/runtime/helpers/typeof");
|
|
|
5571
6080
|
|
|
5572
6081
|
/***/ }),
|
|
5573
6082
|
|
|
5574
|
-
/***/
|
|
6083
|
+
/***/ 84:
|
|
5575
6084
|
/***/ (function(module, exports) {
|
|
5576
6085
|
|
|
5577
6086
|
module.exports = require("@splunk/visualizations-shared/trellisUtils");
|
|
5578
6087
|
|
|
5579
6088
|
/***/ }),
|
|
5580
6089
|
|
|
5581
|
-
/***/
|
|
6090
|
+
/***/ 85:
|
|
5582
6091
|
/***/ (function(module, exports) {
|
|
5583
6092
|
|
|
5584
6093
|
module.exports = require("@splunk/react-icons/enterprise/ArrowUp");
|
|
5585
6094
|
|
|
5586
6095
|
/***/ }),
|
|
5587
6096
|
|
|
5588
|
-
/***/
|
|
6097
|
+
/***/ 86:
|
|
5589
6098
|
/***/ (function(module, exports) {
|
|
5590
6099
|
|
|
5591
6100
|
module.exports = require("@splunk/react-icons/enterprise/ArrowDown");
|
|
5592
6101
|
|
|
5593
6102
|
/***/ }),
|
|
5594
6103
|
|
|
5595
|
-
/***/
|
|
6104
|
+
/***/ 87:
|
|
5596
6105
|
/***/ (function(module, exports) {
|
|
5597
6106
|
|
|
5598
6107
|
module.exports = require("cssesc");
|
|
@@ -5606,7 +6115,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
5606
6115
|
|
|
5607
6116
|
/***/ }),
|
|
5608
6117
|
|
|
5609
|
-
/***/
|
|
6118
|
+
/***/ 91:
|
|
5610
6119
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5611
6120
|
|
|
5612
6121
|
"use strict";
|
|
@@ -5630,7 +6139,7 @@ var StaticBackgroundColorEditor = {
|
|
|
5630
6139
|
|
|
5631
6140
|
/***/ }),
|
|
5632
6141
|
|
|
5633
|
-
/***/
|
|
6142
|
+
/***/ 94:
|
|
5634
6143
|
/***/ (function(module, exports) {
|
|
5635
6144
|
|
|
5636
6145
|
module.exports = require("@splunk/react-ui/Paginator");
|
|
@@ -5644,10 +6153,12 @@ module.exports = require("@splunk/react-ui/Paginator");
|
|
|
5644
6153
|
|
|
5645
6154
|
|
|
5646
6155
|
var _typeof = __webpack_require__(82);
|
|
6156
|
+
|
|
5647
6157
|
Object.defineProperty(exports, "__esModule", {
|
|
5648
6158
|
value: true
|
|
5649
6159
|
});
|
|
5650
6160
|
exports.getFormattedGaugeRanges = exports.getSortedGaugeRanges = exports.getGaugeStrokeWidth = exports.getLabelFontSize = exports.getVerticalLabelOffset = exports.computeTextWidth = exports.getProgressWidth = exports.validateGaugeRanges = exports.getGaugeRange = void 0;
|
|
6161
|
+
|
|
5651
6162
|
var displayUtils_1 = __webpack_require__(80);
|
|
5652
6163
|
/**
|
|
5653
6164
|
* Figure out what range the major value lies in
|
|
@@ -5656,15 +6167,19 @@ var displayUtils_1 = __webpack_require__(80);
|
|
|
5656
6167
|
* @param {Number} majorValue
|
|
5657
6168
|
* @returns {Number} index of range that the major value lies in
|
|
5658
6169
|
*/
|
|
6170
|
+
|
|
6171
|
+
|
|
5659
6172
|
var getGaugeRange = function getGaugeRange(formattedGaugeRanges, majorValue) {
|
|
5660
6173
|
if (typeof majorValue !== 'number') {
|
|
5661
6174
|
return -1;
|
|
5662
6175
|
}
|
|
6176
|
+
|
|
5663
6177
|
var numRanges = formattedGaugeRanges.length;
|
|
5664
6178
|
return formattedGaugeRanges.findIndex(function (r, i) {
|
|
5665
6179
|
return i === numRanges - 1 && r.from <= majorValue || r.from <= majorValue && majorValue < r.to;
|
|
5666
6180
|
});
|
|
5667
6181
|
};
|
|
6182
|
+
|
|
5668
6183
|
exports.getGaugeRange = getGaugeRange;
|
|
5669
6184
|
/**
|
|
5670
6185
|
* Validate gauge ranges object
|
|
@@ -5672,30 +6187,39 @@ exports.getGaugeRange = getGaugeRange;
|
|
|
5672
6187
|
* @param {Array} gaugeRanges unformatted, open gauge ranges
|
|
5673
6188
|
* @returns {boolean} whether gauge ranges object is valid
|
|
5674
6189
|
*/
|
|
6190
|
+
|
|
5675
6191
|
var validateGaugeRanges = function validateGaugeRanges(gaugeRanges) {
|
|
5676
6192
|
if (!gaugeRanges || !Array.isArray(gaugeRanges) || gaugeRanges.length < 2) {
|
|
5677
6193
|
return false;
|
|
5678
6194
|
}
|
|
6195
|
+
|
|
5679
6196
|
for (var i = 0; i < gaugeRanges.length; i += 1) {
|
|
5680
6197
|
var range = gaugeRanges[i];
|
|
6198
|
+
|
|
5681
6199
|
if (!range || _typeof(range) !== 'object') {
|
|
5682
6200
|
return false;
|
|
5683
6201
|
}
|
|
6202
|
+
|
|
5684
6203
|
if (i === 0 && (Object.keys(range).includes('from') || !Object.keys(range).includes('to') || typeof range.to !== 'number')) {
|
|
5685
6204
|
return false;
|
|
5686
6205
|
}
|
|
6206
|
+
|
|
5687
6207
|
if (i === gaugeRanges.length - 1 && (Object.keys(range).includes('to') || !Object.keys(range).includes('from') || typeof range.from !== 'number')) {
|
|
5688
6208
|
return false;
|
|
5689
6209
|
}
|
|
6210
|
+
|
|
5690
6211
|
if (i > 0 && i < gaugeRanges.length - 1 && (!Object.keys(range).includes('from') || !Object.keys(range).includes('to') || typeof range.from !== 'number' || typeof range.to !== 'number' || range.from !== gaugeRanges[i - 1].to || range.from >= range.to)) {
|
|
5691
6212
|
return false;
|
|
5692
6213
|
}
|
|
6214
|
+
|
|
5693
6215
|
if (!Object.keys(range).includes('value') || typeof range.value !== 'string') {
|
|
5694
6216
|
return false;
|
|
5695
6217
|
}
|
|
5696
6218
|
}
|
|
6219
|
+
|
|
5697
6220
|
return true;
|
|
5698
6221
|
};
|
|
6222
|
+
|
|
5699
6223
|
exports.validateGaugeRanges = validateGaugeRanges;
|
|
5700
6224
|
/**
|
|
5701
6225
|
* Return progress width
|
|
@@ -5706,12 +6230,14 @@ exports.validateGaugeRanges = validateGaugeRanges;
|
|
|
5706
6230
|
* @param {Number} circumference
|
|
5707
6231
|
* @returns {Number} progress width of radial
|
|
5708
6232
|
*/
|
|
6233
|
+
|
|
5709
6234
|
var getProgressWidth = function getProgressWidth(value, minValue, maxValue, circumference) {
|
|
5710
6235
|
var progress = (0, displayUtils_1.getRadialProgress)(value, minValue, maxValue);
|
|
5711
6236
|
var progress50 = progress / 100 * 50;
|
|
5712
6237
|
var progressWidth = progress50 / 100 * circumference;
|
|
5713
6238
|
return progressWidth;
|
|
5714
6239
|
};
|
|
6240
|
+
|
|
5715
6241
|
exports.getProgressWidth = getProgressWidth;
|
|
5716
6242
|
/**
|
|
5717
6243
|
* Return text width
|
|
@@ -5720,6 +6246,7 @@ exports.getProgressWidth = getProgressWidth;
|
|
|
5720
6246
|
* @param {String} font
|
|
5721
6247
|
* @returns {Number} width of text with font
|
|
5722
6248
|
*/
|
|
6249
|
+
|
|
5723
6250
|
var computeTextWidth = function computeTextWidth(text, font) {
|
|
5724
6251
|
var canvas = document.createElement('canvas');
|
|
5725
6252
|
var context = canvas.getContext('2d');
|
|
@@ -5727,6 +6254,7 @@ var computeTextWidth = function computeTextWidth(text, font) {
|
|
|
5727
6254
|
var measure = context.measureText(text);
|
|
5728
6255
|
return measure.width;
|
|
5729
6256
|
};
|
|
6257
|
+
|
|
5730
6258
|
exports.computeTextWidth = computeTextWidth;
|
|
5731
6259
|
/**
|
|
5732
6260
|
* Return vertical offset of label
|
|
@@ -5736,12 +6264,15 @@ exports.computeTextWidth = computeTextWidth;
|
|
|
5736
6264
|
* @param {Number} maxOffset
|
|
5737
6265
|
* @returns {Number} vertical offset of label
|
|
5738
6266
|
*/
|
|
6267
|
+
|
|
5739
6268
|
var getVerticalLabelOffset = function getVerticalLabelOffset(theta, textHeight, maxOffset) {
|
|
5740
6269
|
if (theta > 90) {
|
|
5741
6270
|
return (-(maxOffset / 90) * (180 - theta) + maxOffset) * textHeight;
|
|
5742
6271
|
}
|
|
6272
|
+
|
|
5743
6273
|
return (-(maxOffset / 90) * theta + maxOffset) * textHeight;
|
|
5744
6274
|
};
|
|
6275
|
+
|
|
5745
6276
|
exports.getVerticalLabelOffset = getVerticalLabelOffset;
|
|
5746
6277
|
/**
|
|
5747
6278
|
* Returns font size of label
|
|
@@ -5750,19 +6281,24 @@ exports.getVerticalLabelOffset = getVerticalLabelOffset;
|
|
|
5750
6281
|
* @param {Number} showRadialGraph
|
|
5751
6282
|
* @returns {Number} font size of label
|
|
5752
6283
|
*/
|
|
6284
|
+
|
|
5753
6285
|
var getLabelFontSize = function getLabelFontSize(height, showRadialGraph) {
|
|
5754
6286
|
var strokeWidth = (0, exports.getGaugeStrokeWidth)(height);
|
|
6287
|
+
|
|
5755
6288
|
var _ref = (0, displayUtils_1.getRadialHelperDimensions)({
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
6289
|
+
height: height,
|
|
6290
|
+
strokeWidth: strokeWidth
|
|
6291
|
+
}),
|
|
6292
|
+
semicircleRadius = _ref.semicircleRadius,
|
|
6293
|
+
helperArcRadius = _ref.helperArcRadius; // Two cases for removing the labels:
|
|
5761
6294
|
// 1. the semicircle radius is insufficiently sized for text
|
|
5762
6295
|
// 2. the radial visualization has been disabled (first condition reached first when making smaller).
|
|
6296
|
+
|
|
6297
|
+
|
|
5763
6298
|
var fillVacantSpace = semicircleRadius < 50 || !showRadialGraph;
|
|
5764
6299
|
return fillVacantSpace ? 0 : Math.min(helperArcRadius * 0.08, 16);
|
|
5765
6300
|
};
|
|
6301
|
+
|
|
5766
6302
|
exports.getLabelFontSize = getLabelFontSize;
|
|
5767
6303
|
/**
|
|
5768
6304
|
* Returns radial gauge's stroke width
|
|
@@ -5770,9 +6306,11 @@ exports.getLabelFontSize = getLabelFontSize;
|
|
|
5770
6306
|
* @param {Number} height
|
|
5771
6307
|
* @returns {Number} radial gauge's stroke width
|
|
5772
6308
|
*/
|
|
6309
|
+
|
|
5773
6310
|
var getGaugeStrokeWidth = function getGaugeStrokeWidth(height) {
|
|
5774
6311
|
return height >= 225 ? 30 : 16;
|
|
5775
6312
|
};
|
|
6313
|
+
|
|
5776
6314
|
exports.getGaugeStrokeWidth = getGaugeStrokeWidth;
|
|
5777
6315
|
/**
|
|
5778
6316
|
* sort the ranges in ascending order
|
|
@@ -5780,6 +6318,7 @@ exports.getGaugeStrokeWidth = getGaugeStrokeWidth;
|
|
|
5780
6318
|
* @param {Array} gaugeRanges
|
|
5781
6319
|
* @return {Array} sortedRanges
|
|
5782
6320
|
*/
|
|
6321
|
+
|
|
5783
6322
|
var getSortedGaugeRanges = function getSortedGaugeRanges(gaugeRanges) {
|
|
5784
6323
|
gaugeRanges.sort(function (a, b) {
|
|
5785
6324
|
if (a.to == null) return 1;
|
|
@@ -5788,6 +6327,7 @@ var getSortedGaugeRanges = function getSortedGaugeRanges(gaugeRanges) {
|
|
|
5788
6327
|
});
|
|
5789
6328
|
return gaugeRanges;
|
|
5790
6329
|
};
|
|
6330
|
+
|
|
5791
6331
|
exports.getSortedGaugeRanges = getSortedGaugeRanges;
|
|
5792
6332
|
/**
|
|
5793
6333
|
* format the ranges
|
|
@@ -5797,6 +6337,7 @@ exports.getSortedGaugeRanges = getSortedGaugeRanges;
|
|
|
5797
6337
|
* @param {number} maxValue
|
|
5798
6338
|
* @return {Array} formatted, bounded gauge ranges
|
|
5799
6339
|
*/
|
|
6340
|
+
|
|
5800
6341
|
var getFormattedGaugeRanges = function getFormattedGaugeRanges(gaugeRanges, minValue, maxValue) {
|
|
5801
6342
|
var formattedGaugeRanges = [];
|
|
5802
6343
|
gaugeRanges.forEach(function (range, index) {
|
|
@@ -5806,30 +6347,39 @@ var getFormattedGaugeRanges = function getFormattedGaugeRanges(gaugeRanges, minV
|
|
|
5806
6347
|
to: range.to,
|
|
5807
6348
|
value: range.value
|
|
5808
6349
|
};
|
|
6350
|
+
|
|
5809
6351
|
if (maxValue < range.to) {
|
|
5810
6352
|
newRange.to = maxValue;
|
|
5811
6353
|
}
|
|
6354
|
+
|
|
5812
6355
|
formattedGaugeRanges.push(newRange);
|
|
5813
6356
|
}
|
|
6357
|
+
|
|
5814
6358
|
if (index === gaugeRanges.length - 1 && maxValue > range.from) {
|
|
5815
6359
|
var _newRange = {
|
|
5816
6360
|
from: range.from,
|
|
5817
6361
|
to: maxValue,
|
|
5818
6362
|
value: range.value
|
|
5819
6363
|
};
|
|
6364
|
+
|
|
5820
6365
|
if (minValue > range.from) {
|
|
5821
6366
|
_newRange.from = minValue;
|
|
5822
6367
|
}
|
|
6368
|
+
|
|
5823
6369
|
formattedGaugeRanges.push(_newRange);
|
|
5824
6370
|
}
|
|
6371
|
+
|
|
5825
6372
|
if (Object.keys(range).includes('from') && Object.keys(range).includes('to')) {
|
|
5826
6373
|
var _newRange2 = Object.assign({}, range);
|
|
6374
|
+
|
|
5827
6375
|
if (minValue > range.from && minValue < range.to) {
|
|
5828
6376
|
_newRange2.from = minValue;
|
|
5829
6377
|
}
|
|
6378
|
+
|
|
5830
6379
|
if (maxValue > range.from && maxValue < range.to) {
|
|
5831
6380
|
_newRange2.to = maxValue;
|
|
5832
6381
|
}
|
|
6382
|
+
|
|
5833
6383
|
if (minValue < range.to && maxValue > range.from) {
|
|
5834
6384
|
formattedGaugeRanges.push(_newRange2);
|
|
5835
6385
|
}
|
|
@@ -5837,6 +6387,7 @@ var getFormattedGaugeRanges = function getFormattedGaugeRanges(gaugeRanges, minV
|
|
|
5837
6387
|
});
|
|
5838
6388
|
return formattedGaugeRanges;
|
|
5839
6389
|
};
|
|
6390
|
+
|
|
5840
6391
|
exports.getFormattedGaugeRanges = getFormattedGaugeRanges;
|
|
5841
6392
|
|
|
5842
6393
|
/***/ })
|