@splunk/visualizations 26.0.0 → 26.1.1
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 +103 -19
- package/Area.config.js.map +1 -1
- package/Area.js +646 -243
- package/Area.js.map +1 -1
- package/Bar.config.js +105 -21
- package/Bar.config.js.map +1 -1
- package/Bar.js +653 -237
- package/Bar.js.map +1 -1
- package/Bubble.config.js +95 -21
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +635 -229
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +66 -15
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +589 -211
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +104 -19
- package/Column.config.js.map +1 -1
- package/Column.js +666 -239
- package/Column.js.map +1 -1
- package/Ellipse.config.js +83 -18
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +444 -156
- package/Ellipse.js.map +1 -1
- package/Events.config.js +101 -19
- package/Events.config.js.map +1 -1
- package/Events.js +792 -322
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +97 -28
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +786 -390
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +63 -19
- package/Image.config.js.map +1 -1
- package/Image.js +439 -164
- package/Image.js.map +1 -1
- package/Line.config.js +107 -23
- package/Line.config.js.map +1 -1
- package/Line.js +841 -456
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +73 -23
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +653 -230
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +244 -99
- package/Map.config.js.map +1 -1
- package/Map.js +1223 -612
- package/Map.js.map +1 -1
- package/Markdown.config.js +71 -21
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +477 -202
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +80 -22
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +819 -418
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +73 -19
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +870 -491
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +76 -23
- package/Pie.config.js.map +1 -1
- package/Pie.js +643 -233
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +82 -30
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +863 -387
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +86 -20
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +449 -159
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +85 -23
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +895 -349
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +97 -23
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +639 -234
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +95 -25
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1198 -656
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +287 -226
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +93 -23
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +991 -522
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +100 -27
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1185 -624
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +127 -68
- package/SparkLine.js.map +1 -1
- package/Table.config.js +74 -21
- package/Table.config.js.map +1 -1
- package/Table.js +827 -329
- package/Table.js.map +1 -1
- package/common/Charting.js +152 -69
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +25 -14
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +530 -0
- package/common/DocExampleWithVizSandbox.js.map +1 -0
- package/common/EventsDoc.js +139 -104
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +79 -69
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +54 -45
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +178 -87
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +530 -68
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +47 -20
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +15 -9
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +57 -44
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +52 -20
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +139 -7
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +185 -102
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +28 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +50 -15
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +8 -3
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +4 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -1
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +288 -128
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +242 -197
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -1
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +62 -1
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +3 -1
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +389 -192
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +18 -26
package/SingleValueRadial.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -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);
|
|
451
|
-
|
|
468
|
+
|
|
469
|
+
var useSplunkTheme_1 = __webpack_require__(56);
|
|
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.1 - b6df0a015",
|
|
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
|
/***/ }),
|
|
@@ -1251,7 +1380,7 @@ module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
|
1251
1380
|
|
|
1252
1381
|
/***/ }),
|
|
1253
1382
|
|
|
1254
|
-
/***/
|
|
1383
|
+
/***/ 177:
|
|
1255
1384
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1256
1385
|
|
|
1257
1386
|
"use strict";
|
|
@@ -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: {
|
|
@@ -2846,9 +3100,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2846
3100
|
transform: 'translate(-50%, -50%)'
|
|
2847
3101
|
},
|
|
2848
3102
|
width: '50%',
|
|
2849
|
-
height: '50%'
|
|
3103
|
+
height: '50%',
|
|
3104
|
+
'data-test': 'icon-placeholder'
|
|
2850
3105
|
});
|
|
2851
3106
|
}
|
|
3107
|
+
|
|
2852
3108
|
return React.createElement(Message_1.default, {
|
|
2853
3109
|
width: width,
|
|
2854
3110
|
height: height,
|
|
@@ -2856,6 +3112,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2856
3112
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
2857
3113
|
});
|
|
2858
3114
|
};
|
|
3115
|
+
|
|
2859
3116
|
IconPlaceholder.propTypes = propTypes;
|
|
2860
3117
|
IconPlaceholder.defaultProps = {
|
|
2861
3118
|
width: '100%',
|
|
@@ -2872,21 +3129,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
2872
3129
|
|
|
2873
3130
|
|
|
2874
3131
|
var _defineProperty = __webpack_require__(7);
|
|
3132
|
+
|
|
2875
3133
|
Object.defineProperty(exports, "__esModule", {
|
|
2876
3134
|
value: true
|
|
2877
3135
|
});
|
|
2878
3136
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
3137
|
+
|
|
2879
3138
|
var T = __webpack_require__(0);
|
|
3139
|
+
|
|
2880
3140
|
var lodash_1 = __webpack_require__(3);
|
|
2881
|
-
|
|
3141
|
+
|
|
3142
|
+
var DataSource_1 = __webpack_require__(34);
|
|
3143
|
+
|
|
2882
3144
|
exports.SortParamsPropTypes = T.shape({
|
|
2883
3145
|
currentSortKey: T.string,
|
|
2884
3146
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
2885
3147
|
onSort: T.func
|
|
2886
3148
|
});
|
|
3149
|
+
|
|
2887
3150
|
var getSortingParams = function getSortingParams(_ref) {
|
|
2888
3151
|
var requestParams = _ref.requestParams,
|
|
2889
|
-
|
|
3152
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2890
3153
|
var currentSortKey;
|
|
2891
3154
|
var currentSortDir;
|
|
2892
3155
|
var nextSortDirMap = {
|
|
@@ -2895,15 +3158,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2895
3158
|
none: 'asc'
|
|
2896
3159
|
};
|
|
2897
3160
|
var onSort;
|
|
3161
|
+
|
|
2898
3162
|
if (typeof onRequestParamsChange === 'function') {
|
|
2899
3163
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
2900
3164
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
2901
3165
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
2902
|
-
}
|
|
2903
|
-
|
|
3166
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
3167
|
+
|
|
3168
|
+
|
|
2904
3169
|
onSort = function onSort(e, _ref2) {
|
|
2905
3170
|
var sortKey = _ref2.sortKey,
|
|
2906
|
-
|
|
3171
|
+
sortDir = _ref2.sortDir;
|
|
3172
|
+
|
|
2907
3173
|
if (typeof sortKey === 'string') {
|
|
2908
3174
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
2909
3175
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -2915,12 +3181,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2915
3181
|
}
|
|
2916
3182
|
};
|
|
2917
3183
|
}
|
|
3184
|
+
|
|
2918
3185
|
return {
|
|
2919
3186
|
currentSortKey: currentSortKey,
|
|
2920
3187
|
currentSortDir: currentSortDir,
|
|
2921
3188
|
onSort: onSort
|
|
2922
3189
|
};
|
|
2923
3190
|
};
|
|
3191
|
+
|
|
2924
3192
|
exports.getSortingParams = getSortingParams;
|
|
2925
3193
|
|
|
2926
3194
|
/***/ }),
|
|
@@ -2931,43 +3199,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
2931
3199
|
"use strict";
|
|
2932
3200
|
|
|
2933
3201
|
|
|
3202
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3203
|
+
value: true
|
|
3204
|
+
});
|
|
3205
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
3206
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3207
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
3208
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
3209
|
+
|
|
3210
|
+
/***/ }),
|
|
3211
|
+
|
|
3212
|
+
/***/ 35:
|
|
3213
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3214
|
+
|
|
3215
|
+
"use strict";
|
|
3216
|
+
|
|
3217
|
+
|
|
2934
3218
|
Object.defineProperty(exports, "__esModule", {
|
|
2935
3219
|
value: true
|
|
2936
3220
|
});
|
|
2937
3221
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
3222
|
+
|
|
2938
3223
|
var T = __webpack_require__(0);
|
|
3224
|
+
|
|
2939
3225
|
var lodash_1 = __webpack_require__(3);
|
|
3226
|
+
|
|
2940
3227
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
2941
3228
|
isPaging: T.bool,
|
|
2942
3229
|
current: T.number,
|
|
2943
3230
|
totalPages: T.number,
|
|
2944
3231
|
onChange: T.func
|
|
2945
3232
|
});
|
|
3233
|
+
|
|
2946
3234
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
2947
3235
|
var requestParams = _ref.requestParams,
|
|
2948
|
-
|
|
2949
|
-
|
|
3236
|
+
meta = _ref.meta,
|
|
3237
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2950
3238
|
var totalCount = meta && meta.totalCount || 0;
|
|
2951
3239
|
var offset = requestParams && requestParams.offset || 0;
|
|
2952
3240
|
var count = requestParams && requestParams.count;
|
|
2953
3241
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
2954
3242
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
2955
3243
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
3244
|
+
|
|
2956
3245
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
2957
3246
|
var page = _ref2.page,
|
|
2958
|
-
|
|
3247
|
+
countArg = _ref2.count;
|
|
2959
3248
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
3249
|
+
|
|
2960
3250
|
if (typeof countArg === 'number') {
|
|
2961
3251
|
newParams.count = countArg;
|
|
2962
3252
|
newParams.offset = 0;
|
|
2963
3253
|
}
|
|
3254
|
+
|
|
2964
3255
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
3256
|
+
|
|
2965
3257
|
if (typeof page === 'number' && page > 0) {
|
|
2966
3258
|
newParams.count = pageCount;
|
|
2967
3259
|
newParams.offset = (page - 1) * pageCount;
|
|
2968
3260
|
}
|
|
3261
|
+
|
|
2969
3262
|
onRequestParamsChange(newParams);
|
|
2970
3263
|
};
|
|
3264
|
+
|
|
2971
3265
|
return {
|
|
2972
3266
|
isPaging: isPaging,
|
|
2973
3267
|
current: current,
|
|
@@ -2975,11 +3269,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
2975
3269
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
2976
3270
|
};
|
|
2977
3271
|
};
|
|
3272
|
+
|
|
2978
3273
|
exports.getPaginationParams = getPaginationParams;
|
|
2979
3274
|
|
|
2980
3275
|
/***/ }),
|
|
2981
3276
|
|
|
2982
|
-
/***/
|
|
3277
|
+
/***/ 36:
|
|
2983
3278
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2984
3279
|
|
|
2985
3280
|
"use strict";
|
|
@@ -2990,6 +3285,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2990
3285
|
});
|
|
2991
3286
|
exports.VizCategory = void 0;
|
|
2992
3287
|
var VizCategory;
|
|
3288
|
+
|
|
2993
3289
|
(function (VizCategory) {
|
|
2994
3290
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
2995
3291
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -3007,67 +3303,96 @@ var VizCategory;
|
|
|
3007
3303
|
|
|
3008
3304
|
/***/ }),
|
|
3009
3305
|
|
|
3010
|
-
/***/
|
|
3306
|
+
/***/ 37:
|
|
3011
3307
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3012
3308
|
|
|
3013
3309
|
"use strict";
|
|
3014
3310
|
|
|
3015
3311
|
|
|
3016
3312
|
var _slicedToArray = __webpack_require__(17);
|
|
3313
|
+
|
|
3017
3314
|
Object.defineProperty(exports, "__esModule", {
|
|
3018
3315
|
value: true
|
|
3019
3316
|
});
|
|
3317
|
+
|
|
3020
3318
|
var React = __webpack_require__(1);
|
|
3319
|
+
|
|
3021
3320
|
var lodash_1 = __webpack_require__(3);
|
|
3022
|
-
|
|
3321
|
+
|
|
3322
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
3323
|
+
|
|
3023
3324
|
var Options_1 = __webpack_require__(30);
|
|
3024
|
-
|
|
3325
|
+
|
|
3326
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
3327
|
+
|
|
3025
3328
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
3026
|
-
|
|
3329
|
+
|
|
3330
|
+
var moment_1 = __webpack_require__(40);
|
|
3331
|
+
|
|
3027
3332
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
3333
|
+
|
|
3028
3334
|
var styled_components_1 = __webpack_require__(4);
|
|
3335
|
+
|
|
3029
3336
|
var hocUtils_1 = __webpack_require__(27);
|
|
3337
|
+
|
|
3030
3338
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
3031
|
-
|
|
3339
|
+
|
|
3340
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
3341
|
+
|
|
3032
3342
|
var id_1 = __webpack_require__(25);
|
|
3033
|
-
|
|
3343
|
+
|
|
3344
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
3345
|
+
|
|
3034
3346
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3347
|
+
|
|
3035
3348
|
var getSorting_1 = __webpack_require__(33);
|
|
3036
|
-
|
|
3349
|
+
|
|
3350
|
+
var getPagination_1 = __webpack_require__(35);
|
|
3351
|
+
|
|
3037
3352
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
3353
|
+
|
|
3038
3354
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
3355
|
+
|
|
3039
3356
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
3357
|
+
|
|
3040
3358
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
3041
3359
|
/**
|
|
3042
3360
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
3043
3361
|
* @param {DashboardVizOpts} opts
|
|
3044
3362
|
* @returns {HOC}
|
|
3045
3363
|
*/
|
|
3364
|
+
|
|
3365
|
+
|
|
3046
3366
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
3047
3367
|
var ReactViz = opts.ReactViz,
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3368
|
+
vizConfig = opts.vizConfig,
|
|
3369
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
3370
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
3371
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
3372
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
3373
|
+
|
|
3053
3374
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
3054
3375
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
3376
|
+
|
|
3055
3377
|
var DashboardViz = function DashboardViz(props) {
|
|
3056
3378
|
var _a;
|
|
3379
|
+
|
|
3057
3380
|
var mode = props.mode,
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3381
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
3382
|
+
dataSources = props.dataSources,
|
|
3383
|
+
options = props.options,
|
|
3384
|
+
_props$context = props.context,
|
|
3385
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
3386
|
+
width = props.width,
|
|
3387
|
+
height = props.height,
|
|
3388
|
+
onComputedProps = props.onComputedProps,
|
|
3389
|
+
onEventTrigger = props.onEventTrigger,
|
|
3390
|
+
theme = props.theme,
|
|
3391
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
3392
|
+
|
|
3069
3393
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
3070
|
-
|
|
3394
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
3395
|
+
|
|
3071
3396
|
if (serializedTimezone) {
|
|
3072
3397
|
/*
|
|
3073
3398
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -3081,38 +3406,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3081
3406
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
3082
3407
|
}
|
|
3083
3408
|
}
|
|
3409
|
+
|
|
3084
3410
|
var themeFunc = function themeFunc(themeVar) {
|
|
3085
3411
|
var _a, _b;
|
|
3412
|
+
|
|
3086
3413
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
3087
3414
|
};
|
|
3415
|
+
|
|
3088
3416
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
3417
|
+
|
|
3089
3418
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3419
|
+
theme: theme
|
|
3420
|
+
}),
|
|
3421
|
+
currentThemeFamily = _ref.family,
|
|
3422
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
3423
|
+
currentThemeDensity = _ref.density;
|
|
3424
|
+
|
|
3095
3425
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
3426
|
+
|
|
3096
3427
|
var _React$useState = React.useState({}),
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3428
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3429
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
3430
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
3431
|
+
|
|
3432
|
+
|
|
3100
3433
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
3434
|
+
|
|
3101
3435
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
3102
|
-
|
|
3103
|
-
|
|
3436
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
3437
|
+
visualizationID = _React$useState4[0];
|
|
3438
|
+
|
|
3104
3439
|
var _React$useState5 = React.useState({}),
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3440
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3441
|
+
dataSourcesInState = _React$useState6[0],
|
|
3442
|
+
setDataSourcesInState = _React$useState6[1];
|
|
3443
|
+
|
|
3108
3444
|
var _React$useState7 = React.useState(),
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3445
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3446
|
+
dataFramesInState = _React$useState8[0],
|
|
3447
|
+
setDataFramesInState = _React$useState8[1];
|
|
3448
|
+
|
|
3112
3449
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3450
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
3451
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
3452
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
3453
|
+
|
|
3116
3454
|
var isMounted = React.useRef(true);
|
|
3117
3455
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
3118
3456
|
try {
|
|
@@ -3137,11 +3475,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3137
3475
|
});
|
|
3138
3476
|
} else {
|
|
3139
3477
|
var dataFrames = dataFramesInState;
|
|
3478
|
+
|
|
3140
3479
|
if (dataSources !== dataSourcesInState) {
|
|
3141
3480
|
setDataSourcesInState(dataSources);
|
|
3142
3481
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
3143
3482
|
setDataFramesInState(dataFrames);
|
|
3144
3483
|
}
|
|
3484
|
+
|
|
3145
3485
|
return Options_1.Options.evaluate({
|
|
3146
3486
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
3147
3487
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -3152,21 +3492,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3152
3492
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
3153
3493
|
return {};
|
|
3154
3494
|
}
|
|
3495
|
+
|
|
3155
3496
|
return {};
|
|
3156
3497
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
3157
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
3158
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
3498
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
3159
3499
|
// 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
3500
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
3501
|
+
|
|
3161
3502
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
3162
3503
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
3504
|
+
|
|
3163
3505
|
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
3506
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
3165
3507
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
3166
3508
|
});
|
|
3167
|
-
}
|
|
3168
|
-
// useEffect hook needs to be initialized before any early returns
|
|
3509
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
3169
3510
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
3511
|
+
|
|
3512
|
+
|
|
3170
3513
|
React.useEffect(function () {
|
|
3171
3514
|
onComputedProps(clonedEvaluatedOptions);
|
|
3172
3515
|
});
|
|
@@ -3176,53 +3519,68 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3176
3519
|
isMounted.current = false;
|
|
3177
3520
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
3178
3521
|
}
|
|
3179
|
-
};
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
// present warning message if any required props are missing
|
|
3522
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3523
|
+
}, []); // present warning message if any required props are missing
|
|
3524
|
+
|
|
3183
3525
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
3184
|
-
|
|
3185
|
-
|
|
3526
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
3527
|
+
supports = vizConfig.supports;
|
|
3186
3528
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
3529
|
+
|
|
3187
3530
|
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
3531
|
) {
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3532
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
3533
|
+
"data-test": "missing-props-message",
|
|
3534
|
+
width: width,
|
|
3535
|
+
height: height,
|
|
3536
|
+
missingProps: missing,
|
|
3537
|
+
backgroundColor: bgColorFromTheme
|
|
3538
|
+
});
|
|
3539
|
+
} // events
|
|
3540
|
+
|
|
3541
|
+
|
|
3198
3542
|
var eventCallbackProps = {};
|
|
3543
|
+
|
|
3199
3544
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
3200
3545
|
var supportedEvents = vizConfig.events;
|
|
3201
3546
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
3202
|
-
var
|
|
3203
|
-
|
|
3204
|
-
|
|
3547
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
3548
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
3549
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
3550
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
3205
3551
|
// then remove these lines
|
|
3206
|
-
|
|
3552
|
+
|
|
3207
3553
|
var payload = {};
|
|
3554
|
+
|
|
3208
3555
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
3209
3556
|
payloadKeys.forEach(function (p) {
|
|
3210
3557
|
payload[p] = evaluatedOptionsToUse[p];
|
|
3211
3558
|
});
|
|
3212
3559
|
}
|
|
3560
|
+
|
|
3213
3561
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
3214
3562
|
if (ev && ev.payload) {
|
|
3215
3563
|
payload = ev.payload;
|
|
3216
3564
|
}
|
|
3565
|
+
|
|
3217
3566
|
return onEventTrigger({
|
|
3218
3567
|
originalEvent: ev,
|
|
3219
3568
|
payload: payload,
|
|
3220
3569
|
type: eventName
|
|
3221
3570
|
});
|
|
3222
3571
|
};
|
|
3572
|
+
|
|
3573
|
+
if (parentKeys) {
|
|
3574
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
3575
|
+
var newObject = {};
|
|
3576
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
3577
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3223
3580
|
});
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3581
|
+
} // compute pure viz props which are not from options
|
|
3582
|
+
|
|
3583
|
+
|
|
3226
3584
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
3227
3585
|
themeFunc: themeFunc
|
|
3228
3586
|
}));
|
|
@@ -3240,15 +3598,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3240
3598
|
* In future, we could automatically detect which all datasources are being used
|
|
3241
3599
|
* and bind those magically to pagination/sorting behavior.
|
|
3242
3600
|
*/
|
|
3601
|
+
|
|
3243
3602
|
var dataSourceMetadata = {};
|
|
3244
3603
|
var OptionKey = 'paginateDataSourceKey';
|
|
3245
3604
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
3605
|
+
|
|
3246
3606
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
3247
3607
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
3248
3608
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
3609
|
+
|
|
3249
3610
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
3250
3611
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
3251
3612
|
};
|
|
3613
|
+
|
|
3252
3614
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
3253
3615
|
requestParams: requestParams,
|
|
3254
3616
|
meta: meta,
|
|
@@ -3263,115 +3625,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3263
3625
|
sortParams: sortParams,
|
|
3264
3626
|
paginatorParams: paginatorParams
|
|
3265
3627
|
};
|
|
3266
|
-
}
|
|
3267
|
-
|
|
3628
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
3629
|
+
|
|
3630
|
+
|
|
3268
3631
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
3269
3632
|
return null;
|
|
3270
3633
|
}
|
|
3634
|
+
|
|
3271
3635
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
3272
3636
|
mode: mode,
|
|
3273
3637
|
width: width,
|
|
3274
3638
|
height: height
|
|
3275
3639
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
3276
3640
|
};
|
|
3641
|
+
|
|
3277
3642
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
3278
3643
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
3279
3644
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
3280
3645
|
theme: {}
|
|
3281
|
-
});
|
|
3282
|
-
|
|
3283
|
-
DashboardViz.config = vizConfig;
|
|
3284
|
-
|
|
3646
|
+
}); // attach viz config
|
|
3647
|
+
|
|
3648
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
3649
|
+
|
|
3285
3650
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
3286
3651
|
};
|
|
3652
|
+
|
|
3287
3653
|
exports.default = withDashboardViz;
|
|
3288
3654
|
|
|
3289
3655
|
/***/ }),
|
|
3290
3656
|
|
|
3291
|
-
/***/
|
|
3657
|
+
/***/ 38:
|
|
3292
3658
|
/***/ (function(module, exports) {
|
|
3293
3659
|
|
|
3294
3660
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
3295
3661
|
|
|
3296
3662
|
/***/ }),
|
|
3297
3663
|
|
|
3298
|
-
/***/
|
|
3664
|
+
/***/ 39:
|
|
3299
3665
|
/***/ (function(module, exports) {
|
|
3300
3666
|
|
|
3301
3667
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
3302
3668
|
|
|
3303
3669
|
/***/ }),
|
|
3304
3670
|
|
|
3305
|
-
/***/
|
|
3671
|
+
/***/ 4:
|
|
3306
3672
|
/***/ (function(module, exports) {
|
|
3307
3673
|
|
|
3308
|
-
module.exports = require("
|
|
3674
|
+
module.exports = require("styled-components");
|
|
3309
3675
|
|
|
3310
3676
|
/***/ }),
|
|
3311
3677
|
|
|
3312
|
-
/***/
|
|
3678
|
+
/***/ 40:
|
|
3313
3679
|
/***/ (function(module, exports) {
|
|
3314
3680
|
|
|
3315
|
-
module.exports = require("
|
|
3681
|
+
module.exports = require("@splunk/moment");
|
|
3316
3682
|
|
|
3317
3683
|
/***/ }),
|
|
3318
3684
|
|
|
3319
|
-
/***/
|
|
3685
|
+
/***/ 41:
|
|
3320
3686
|
/***/ (function(module, exports) {
|
|
3321
3687
|
|
|
3322
3688
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
3323
3689
|
|
|
3324
3690
|
/***/ }),
|
|
3325
3691
|
|
|
3326
|
-
/***/
|
|
3692
|
+
/***/ 42:
|
|
3327
3693
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3328
3694
|
|
|
3329
3695
|
"use strict";
|
|
3330
3696
|
|
|
3331
3697
|
|
|
3332
3698
|
var _classCallCheck = __webpack_require__(9);
|
|
3699
|
+
|
|
3333
3700
|
Object.defineProperty(exports, "__esModule", {
|
|
3334
3701
|
value: true
|
|
3335
3702
|
});
|
|
3336
3703
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
3337
3704
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
3705
|
+
|
|
3338
3706
|
var T = __webpack_require__(0);
|
|
3707
|
+
|
|
3339
3708
|
var lodash_1 = __webpack_require__(3);
|
|
3340
|
-
|
|
3341
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3709
|
+
|
|
3710
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3711
|
+
|
|
3712
|
+
|
|
3342
3713
|
exports.INITIAL_WIDTH = 250;
|
|
3343
3714
|
exports.INITIAL_HEIGHT = 250;
|
|
3344
3715
|
/**
|
|
3345
3716
|
* A Splunk visualization
|
|
3346
3717
|
*/
|
|
3718
|
+
|
|
3347
3719
|
var SplunkVisualization = function SplunkVisualization() {
|
|
3348
3720
|
_classCallCheck(this, SplunkVisualization);
|
|
3349
3721
|
};
|
|
3722
|
+
|
|
3350
3723
|
SplunkVisualization.propTypes = {
|
|
3351
3724
|
/**
|
|
3352
3725
|
* display mode
|
|
3353
3726
|
*/
|
|
3354
3727
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
3728
|
+
|
|
3355
3729
|
/**
|
|
3356
3730
|
* width in pixel or string, defaults to 100%
|
|
3357
3731
|
*/
|
|
3358
3732
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
3733
|
+
|
|
3359
3734
|
/**
|
|
3360
3735
|
* height in pixel or string
|
|
3361
3736
|
*/
|
|
3362
3737
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
3738
|
+
|
|
3363
3739
|
/**
|
|
3364
3740
|
* visualization context used for dynamic option evaluation
|
|
3365
3741
|
*/
|
|
3366
3742
|
context: T.object,
|
|
3743
|
+
|
|
3367
3744
|
/**
|
|
3368
3745
|
* visualization formatting options
|
|
3369
3746
|
*/
|
|
3370
3747
|
options: T.object,
|
|
3748
|
+
|
|
3371
3749
|
/**
|
|
3372
3750
|
* A callback to update formatting options
|
|
3373
3751
|
*/
|
|
3374
3752
|
onOptionsChange: T.func,
|
|
3753
|
+
|
|
3375
3754
|
/**
|
|
3376
3755
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
3377
3756
|
*/
|
|
@@ -3380,6 +3759,7 @@ SplunkVisualization.propTypes = {
|
|
|
3380
3759
|
* current request params
|
|
3381
3760
|
*/
|
|
3382
3761
|
requestParams: T.object,
|
|
3762
|
+
|
|
3383
3763
|
/**
|
|
3384
3764
|
* current dataset
|
|
3385
3765
|
*/
|
|
@@ -3387,6 +3767,7 @@ SplunkVisualization.propTypes = {
|
|
|
3387
3767
|
fields: T.array,
|
|
3388
3768
|
columns: T.array
|
|
3389
3769
|
}),
|
|
3770
|
+
|
|
3390
3771
|
/**
|
|
3391
3772
|
* error
|
|
3392
3773
|
*/
|
|
@@ -3394,29 +3775,35 @@ SplunkVisualization.propTypes = {
|
|
|
3394
3775
|
level: T.string,
|
|
3395
3776
|
message: T.string
|
|
3396
3777
|
}),
|
|
3778
|
+
|
|
3397
3779
|
/**
|
|
3398
3780
|
* meta data that came with the dataset
|
|
3399
3781
|
*/
|
|
3400
3782
|
meta: T.object
|
|
3401
3783
|
})),
|
|
3784
|
+
|
|
3402
3785
|
/**
|
|
3403
3786
|
* A callback to trigger event
|
|
3404
3787
|
*/
|
|
3405
3788
|
onEventTrigger: T.func,
|
|
3789
|
+
|
|
3406
3790
|
/**
|
|
3407
3791
|
* Inform viz if there are handlers listening to events
|
|
3408
3792
|
*/
|
|
3409
3793
|
hasEventHandlers: T.bool,
|
|
3794
|
+
|
|
3410
3795
|
/**
|
|
3411
3796
|
* A callback to communicate computed props to a consumer
|
|
3412
3797
|
*/
|
|
3413
3798
|
onComputedProps: T.func,
|
|
3799
|
+
|
|
3414
3800
|
/**
|
|
3415
3801
|
* A callback to obtain visualization api
|
|
3416
3802
|
*/
|
|
3417
3803
|
vizActionHandlerRef: T.func,
|
|
3418
3804
|
loading: T.bool,
|
|
3419
3805
|
theme: T.object,
|
|
3806
|
+
|
|
3420
3807
|
/**
|
|
3421
3808
|
* A callback to request new data with updated request params
|
|
3422
3809
|
*/
|
|
@@ -3425,6 +3812,7 @@ SplunkVisualization.propTypes = {
|
|
|
3425
3812
|
/**
|
|
3426
3813
|
*
|
|
3427
3814
|
*/
|
|
3815
|
+
|
|
3428
3816
|
SplunkVisualization.defaultProps = {
|
|
3429
3817
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
3430
3818
|
width: '100%',
|
|
@@ -3453,50 +3841,41 @@ exports.default = SplunkVisualization;
|
|
|
3453
3841
|
|
|
3454
3842
|
/***/ }),
|
|
3455
3843
|
|
|
3456
|
-
/***/
|
|
3844
|
+
/***/ 43:
|
|
3457
3845
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3458
3846
|
|
|
3459
3847
|
"use strict";
|
|
3460
3848
|
|
|
3461
3849
|
|
|
3462
3850
|
var _classCallCheck = __webpack_require__(9);
|
|
3851
|
+
|
|
3463
3852
|
var _createClass = __webpack_require__(18);
|
|
3853
|
+
|
|
3464
3854
|
Object.defineProperty(exports, "__esModule", {
|
|
3465
3855
|
value: true
|
|
3466
3856
|
});
|
|
3467
3857
|
exports.DefaultVizActionHandler = void 0;
|
|
3858
|
+
|
|
3468
3859
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
3469
3860
|
function DefaultVizActionHandler() {
|
|
3470
3861
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
3471
3862
|
}
|
|
3863
|
+
|
|
3472
3864
|
_createClass(DefaultVizActionHandler, [{
|
|
3473
3865
|
key: "focus",
|
|
3474
|
-
value: function focus() {
|
|
3475
|
-
// noop
|
|
3866
|
+
value: function focus() {// noop
|
|
3476
3867
|
}
|
|
3477
3868
|
}, {
|
|
3478
3869
|
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";
|
|
3870
|
+
value: function snapshot() {
|
|
3871
|
+
return null; // noop
|
|
3872
|
+
}
|
|
3873
|
+
}]);
|
|
3493
3874
|
|
|
3875
|
+
return DefaultVizActionHandler;
|
|
3876
|
+
}();
|
|
3494
3877
|
|
|
3495
|
-
|
|
3496
|
-
value: true
|
|
3497
|
-
});
|
|
3498
|
-
exports.validSortDirs = void 0;
|
|
3499
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3878
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3500
3879
|
|
|
3501
3880
|
/***/ }),
|
|
3502
3881
|
|
|
@@ -3510,7 +3889,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3510
3889
|
value: true
|
|
3511
3890
|
});
|
|
3512
3891
|
exports.useDeepMemo = void 0;
|
|
3892
|
+
|
|
3513
3893
|
var react_1 = __webpack_require__(1);
|
|
3894
|
+
|
|
3514
3895
|
var lodash_1 = __webpack_require__(3);
|
|
3515
3896
|
/**
|
|
3516
3897
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -3525,16 +3906,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3525
3906
|
* @param fn the function to be executed and
|
|
3526
3907
|
* @param dependencies an array of dependencies
|
|
3527
3908
|
*/
|
|
3909
|
+
|
|
3910
|
+
|
|
3528
3911
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
3529
3912
|
var ref = (0, react_1.useRef)();
|
|
3913
|
+
|
|
3530
3914
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
3531
3915
|
ref.current = {
|
|
3532
3916
|
dependencies: dependencies,
|
|
3533
3917
|
value: fn()
|
|
3534
3918
|
};
|
|
3535
3919
|
}
|
|
3920
|
+
|
|
3536
3921
|
return ref.current.value;
|
|
3537
3922
|
};
|
|
3923
|
+
|
|
3538
3924
|
exports.useDeepMemo = useDeepMemo;
|
|
3539
3925
|
|
|
3540
3926
|
/***/ }),
|
|
@@ -3549,19 +3935,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3549
3935
|
value: true
|
|
3550
3936
|
});
|
|
3551
3937
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
3938
|
+
|
|
3552
3939
|
var React = __webpack_require__(1);
|
|
3940
|
+
|
|
3553
3941
|
var T = __webpack_require__(0);
|
|
3942
|
+
|
|
3554
3943
|
var i18n_1 = __webpack_require__(2);
|
|
3944
|
+
|
|
3555
3945
|
var Message_1 = __webpack_require__(10);
|
|
3946
|
+
|
|
3556
3947
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
3557
3948
|
/**
|
|
3558
3949
|
* @method isMissing
|
|
3559
3950
|
* @param {any} v
|
|
3560
3951
|
* @returns {boolean} true if the input value === null or undefined
|
|
3561
3952
|
*/
|
|
3953
|
+
|
|
3954
|
+
|
|
3562
3955
|
var isMissing = function isMissing(v) {
|
|
3563
3956
|
return v === null || v === undefined;
|
|
3564
3957
|
};
|
|
3958
|
+
|
|
3565
3959
|
exports.isMissing = isMissing;
|
|
3566
3960
|
/**
|
|
3567
3961
|
* @method misskingKeys
|
|
@@ -3569,11 +3963,13 @@ exports.isMissing = isMissing;
|
|
|
3569
3963
|
* @param {object} target
|
|
3570
3964
|
* @returns {string[]} the keys of missing required props
|
|
3571
3965
|
*/
|
|
3966
|
+
|
|
3572
3967
|
var missingKeys = function missingKeys(keys, target) {
|
|
3573
3968
|
return keys.filter(function (k) {
|
|
3574
3969
|
return (0, exports.isMissing)(target[k]);
|
|
3575
3970
|
});
|
|
3576
3971
|
};
|
|
3972
|
+
|
|
3577
3973
|
exports.missingKeys = missingKeys;
|
|
3578
3974
|
var propTypes = {
|
|
3579
3975
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -3587,10 +3983,11 @@ var propTypes = {
|
|
|
3587
3983
|
* @param {MissingPropsProps} props
|
|
3588
3984
|
* @returns {React.ReactElement}
|
|
3589
3985
|
*/
|
|
3986
|
+
|
|
3590
3987
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
3591
3988
|
var width = props.width,
|
|
3592
|
-
|
|
3593
|
-
|
|
3989
|
+
height = props.height,
|
|
3990
|
+
missingProps = props.missingProps;
|
|
3594
3991
|
return React.createElement(Message_1.default, {
|
|
3595
3992
|
"data-test": "message",
|
|
3596
3993
|
width: width,
|
|
@@ -3598,6 +3995,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
3598
3995
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
3599
3996
|
});
|
|
3600
3997
|
};
|
|
3998
|
+
|
|
3601
3999
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
3602
4000
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
3603
4001
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -3617,15 +4015,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
3617
4015
|
Object.defineProperty(exports, "__esModule", {
|
|
3618
4016
|
value: true
|
|
3619
4017
|
});
|
|
4018
|
+
|
|
3620
4019
|
var React = __webpack_require__(1);
|
|
4020
|
+
|
|
3621
4021
|
var styled_components_1 = __webpack_require__(4);
|
|
4022
|
+
|
|
3622
4023
|
var hocUtils_1 = __webpack_require__(15);
|
|
4024
|
+
|
|
3623
4025
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3624
4026
|
displayName: "withEditModeCover__Cover",
|
|
3625
4027
|
componentId: "sc-1gsbnxb-0"
|
|
3626
4028
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3627
4029
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3628
|
-
'data-splunk-visualization-version': "26.
|
|
4030
|
+
'data-splunk-visualization-version': "26.1.1 - b6df0a015"
|
|
3629
4031
|
}).withConfig({
|
|
3630
4032
|
displayName: "withEditModeCover__Blocker",
|
|
3631
4033
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3636,6 +4038,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3636
4038
|
* @param {ExtendedDashViz} Visualization
|
|
3637
4039
|
* @returns {ExtendedDashViz} Wrapper
|
|
3638
4040
|
*/
|
|
4041
|
+
|
|
3639
4042
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3640
4043
|
var Wrapper = function Wrapper(props) {
|
|
3641
4044
|
var mode = props.mode;
|
|
@@ -3644,12 +4047,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3644
4047
|
"data-test": "edit-mode-cover"
|
|
3645
4048
|
}));
|
|
3646
4049
|
};
|
|
4050
|
+
|
|
3647
4051
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3648
4052
|
Wrapper: Wrapper,
|
|
3649
4053
|
Visualization: Visualization
|
|
3650
4054
|
});
|
|
3651
4055
|
return Wrapper;
|
|
3652
4056
|
};
|
|
4057
|
+
|
|
3653
4058
|
exports.default = withEditModeCover;
|
|
3654
4059
|
|
|
3655
4060
|
/***/ }),
|
|
@@ -3663,27 +4068,37 @@ exports.default = withEditModeCover;
|
|
|
3663
4068
|
Object.defineProperty(exports, "__esModule", {
|
|
3664
4069
|
value: true
|
|
3665
4070
|
});
|
|
4071
|
+
|
|
3666
4072
|
var React = __webpack_require__(1);
|
|
4073
|
+
|
|
3667
4074
|
var colorUtils_1 = __webpack_require__(12);
|
|
4075
|
+
|
|
3668
4076
|
var variables_1 = __webpack_require__(11);
|
|
4077
|
+
|
|
3669
4078
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
4079
|
+
|
|
3670
4080
|
var VizBehavior_1 = __webpack_require__(6);
|
|
4081
|
+
|
|
3671
4082
|
var hocUtils_1 = __webpack_require__(15);
|
|
4083
|
+
|
|
3672
4084
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3673
4085
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3674
4086
|
var config = Visualization.config;
|
|
3675
4087
|
var themes = config.themes;
|
|
4088
|
+
|
|
3676
4089
|
var Wrapper = function Wrapper(props) {
|
|
3677
4090
|
var _a, _b;
|
|
4091
|
+
|
|
3678
4092
|
var dataSources = props.dataSources,
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
4093
|
+
loading = props.loading,
|
|
4094
|
+
options = props.options,
|
|
4095
|
+
height = props.height,
|
|
4096
|
+
width = props.width;
|
|
3683
4097
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3684
4098
|
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
4099
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3686
4100
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
4101
|
+
|
|
3687
4102
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3688
4103
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3689
4104
|
"data-test": "icon-placeholder",
|
|
@@ -3694,14 +4109,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3694
4109
|
iconColor: iconColor
|
|
3695
4110
|
});
|
|
3696
4111
|
}
|
|
4112
|
+
|
|
3697
4113
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3698
4114
|
};
|
|
4115
|
+
|
|
3699
4116
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3700
4117
|
Wrapper: Wrapper,
|
|
3701
4118
|
Visualization: Visualization
|
|
3702
4119
|
});
|
|
3703
4120
|
return Wrapper;
|
|
3704
4121
|
};
|
|
4122
|
+
|
|
3705
4123
|
exports.default = withPlaceholder;
|
|
3706
4124
|
|
|
3707
4125
|
/***/ }),
|
|
@@ -3714,33 +4132,44 @@ exports.default = withPlaceholder;
|
|
|
3714
4132
|
|
|
3715
4133
|
var __rest = this && this.__rest || function (s, e) {
|
|
3716
4134
|
var t = {};
|
|
4135
|
+
|
|
3717
4136
|
for (var p in s) {
|
|
3718
4137
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
3719
4138
|
}
|
|
4139
|
+
|
|
3720
4140
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3721
4141
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
3722
4142
|
}
|
|
3723
4143
|
return t;
|
|
3724
4144
|
};
|
|
4145
|
+
|
|
3725
4146
|
Object.defineProperty(exports, "__esModule", {
|
|
3726
4147
|
value: true
|
|
3727
4148
|
});
|
|
3728
4149
|
exports.themes = exports.computeVizProps = exports.PureSingleValueRadialThemes = exports.PureSingleValueRadial = exports.config = void 0;
|
|
4150
|
+
|
|
3729
4151
|
var SingleValueRadial_1 = __webpack_require__(491);
|
|
3730
|
-
|
|
4152
|
+
|
|
4153
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
4154
|
+
|
|
3731
4155
|
var config_1 = __webpack_require__(476);
|
|
4156
|
+
|
|
3732
4157
|
var withTrellis_1 = __webpack_require__(106);
|
|
4158
|
+
|
|
3733
4159
|
exports.config = config_1.default;
|
|
3734
|
-
exports.PureSingleValueRadial = SingleValueRadial_1.default;
|
|
3735
|
-
|
|
4160
|
+
exports.PureSingleValueRadial = SingleValueRadial_1.default; // TODO: proper theming support for SVR when we come back to SVR viz
|
|
4161
|
+
|
|
3736
4162
|
exports.PureSingleValueRadialThemes = {};
|
|
4163
|
+
|
|
3737
4164
|
var computeVizProps = function computeVizProps(_a) {
|
|
3738
4165
|
var trellisKey = _a.trellisKey,
|
|
3739
|
-
|
|
4166
|
+
props = __rest(_a, ["trellisKey"]);
|
|
4167
|
+
|
|
3740
4168
|
return Object.assign({
|
|
3741
4169
|
trellisKey: trellisKey
|
|
3742
4170
|
}, props);
|
|
3743
4171
|
};
|
|
4172
|
+
|
|
3744
4173
|
exports.computeVizProps = computeVizProps;
|
|
3745
4174
|
var viz = (0, withTrellis_1.default)((0, withDashboardViz_1.default)({
|
|
3746
4175
|
ReactViz: SingleValueRadial_1.default,
|
|
@@ -3759,30 +4188,53 @@ exports.default = viz;
|
|
|
3759
4188
|
|
|
3760
4189
|
|
|
3761
4190
|
var _toConsumableArray = __webpack_require__(8);
|
|
4191
|
+
|
|
3762
4192
|
Object.defineProperty(exports, "__esModule", {
|
|
3763
4193
|
value: true
|
|
3764
4194
|
});
|
|
4195
|
+
|
|
3765
4196
|
var i18n_1 = __webpack_require__(2);
|
|
4197
|
+
|
|
3766
4198
|
var schemaUtils_1 = __webpack_require__(16);
|
|
4199
|
+
|
|
3767
4200
|
var pick_1 = __webpack_require__(23);
|
|
4201
|
+
|
|
3768
4202
|
var variables_1 = __webpack_require__(11);
|
|
4203
|
+
|
|
3769
4204
|
var PresetPalettes_1 = __webpack_require__(61);
|
|
4205
|
+
|
|
3770
4206
|
var visualization_icons_1 = __webpack_require__(52);
|
|
4207
|
+
|
|
3771
4208
|
var placeholders_1 = __webpack_require__(50);
|
|
4209
|
+
|
|
3772
4210
|
var configUtils_1 = __webpack_require__(22);
|
|
4211
|
+
|
|
3773
4212
|
var StaticMajorAndTrendLayout_1 = __webpack_require__(102);
|
|
4213
|
+
|
|
3774
4214
|
var VizBehavior_1 = __webpack_require__(6);
|
|
4215
|
+
|
|
3775
4216
|
var configUtils_2 = __webpack_require__(20);
|
|
3776
|
-
|
|
4217
|
+
|
|
4218
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
4219
|
+
|
|
3777
4220
|
var DynamicMajorColorAndGaugeEditor_1 = __webpack_require__(477);
|
|
4221
|
+
|
|
3778
4222
|
var DynamicTrendColorEditor_1 = __webpack_require__(100);
|
|
4223
|
+
|
|
3779
4224
|
var DynamicBackgroundColorEditor_1 = __webpack_require__(101);
|
|
4225
|
+
|
|
3780
4226
|
var StaticMajorColorEditor_1 = __webpack_require__(103);
|
|
4227
|
+
|
|
3781
4228
|
var StaticTrendColorEditor_1 = __webpack_require__(104);
|
|
3782
|
-
|
|
4229
|
+
|
|
4230
|
+
var StaticBackgroundColorEditor_1 = __webpack_require__(91);
|
|
4231
|
+
|
|
3783
4232
|
var RadialBackgroundColor_1 = __webpack_require__(478);
|
|
4233
|
+
|
|
3784
4234
|
var TrellisEditors_1 = __webpack_require__(105);
|
|
4235
|
+
|
|
3785
4236
|
var layoutUtils_1 = __webpack_require__(58);
|
|
4237
|
+
|
|
3786
4238
|
var dataContract = {
|
|
3787
4239
|
requiredDataSources: [{
|
|
3788
4240
|
name: 'primary',
|
|
@@ -4151,7 +4603,7 @@ var editorConfig = [{
|
|
|
4151
4603
|
presets: presets,
|
|
4152
4604
|
value: function value(_ref3) {
|
|
4153
4605
|
var context = _ref3.context,
|
|
4154
|
-
|
|
4606
|
+
options = _ref3.options;
|
|
4155
4607
|
var initialPreset = (0, configUtils_2.getInitialPreset)(context, options, presets);
|
|
4156
4608
|
return initialPreset && initialPreset.label || null;
|
|
4157
4609
|
}
|
|
@@ -4196,16 +4648,19 @@ var editorConfig = [{
|
|
|
4196
4648
|
/**
|
|
4197
4649
|
* visualization configuration
|
|
4198
4650
|
*/
|
|
4651
|
+
|
|
4199
4652
|
var config = {
|
|
4200
4653
|
/**
|
|
4201
4654
|
* unique viz key
|
|
4202
4655
|
*/
|
|
4203
4656
|
key: 'splunk.singlevalueradial',
|
|
4657
|
+
|
|
4204
4658
|
/**
|
|
4205
4659
|
* viz name
|
|
4206
4660
|
*/
|
|
4207
4661
|
name: (0, i18n_1._)('Single value radial'),
|
|
4208
4662
|
category: VizCategory_1.VizCategory.SINGLE_VALUE,
|
|
4663
|
+
|
|
4209
4664
|
/**
|
|
4210
4665
|
* viz icon
|
|
4211
4666
|
*/
|
|
@@ -4243,7 +4698,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4243
4698
|
|
|
4244
4699
|
var getDynamicMajorColorAndGaugeEditor = function getDynamicMajorColorAndGaugeEditor(_ref) {
|
|
4245
4700
|
var defaultContext = _ref.defaultContext,
|
|
4246
|
-
|
|
4701
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
4247
4702
|
return {
|
|
4248
4703
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Major value and gauge'),
|
|
4249
4704
|
option: 'majorColor',
|
|
@@ -4283,11 +4738,13 @@ var getDynamicMajorColorAndGaugeEditor = function getDynamicMajorColorAndGaugeEd
|
|
|
4283
4738
|
Object.defineProperty(exports, "__esModule", {
|
|
4284
4739
|
value: true
|
|
4285
4740
|
});
|
|
4741
|
+
|
|
4286
4742
|
var i18n_1 = __webpack_require__(2);
|
|
4743
|
+
|
|
4287
4744
|
var radialBackground = function radialBackground(_ref) {
|
|
4288
4745
|
var label = _ref.label,
|
|
4289
|
-
|
|
4290
|
-
|
|
4746
|
+
themes = _ref.themes,
|
|
4747
|
+
labelPosition = _ref.labelPosition;
|
|
4291
4748
|
return [{
|
|
4292
4749
|
label: (0, i18n_1._)(label || 'Radial background'),
|
|
4293
4750
|
option: 'radialBackgroundColor',
|
|
@@ -4298,6 +4755,7 @@ var radialBackground = function radialBackground(_ref) {
|
|
|
4298
4755
|
}
|
|
4299
4756
|
}];
|
|
4300
4757
|
};
|
|
4758
|
+
|
|
4301
4759
|
exports.default = radialBackground;
|
|
4302
4760
|
|
|
4303
4761
|
/***/ }),
|
|
@@ -4384,17 +4842,18 @@ var colorConstants_ = __webpack_require__(49);
|
|
|
4384
4842
|
|
|
4385
4843
|
|
|
4386
4844
|
|
|
4845
|
+
|
|
4387
4846
|
var RadialGraph_RadialGraph = function RadialGraph(_ref) {
|
|
4388
4847
|
var progress = _ref.progress,
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4848
|
+
strokeWidth = _ref.strokeWidth,
|
|
4849
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
4850
|
+
backgroundColor = _ref$backgroundColor === void 0 ? colorConstants_["RADIAL_BACKGROUND_COLOR"] : _ref$backgroundColor,
|
|
4851
|
+
_ref$progressColor = _ref.progressColor,
|
|
4852
|
+
progressColor = _ref$progressColor === void 0 ? colorConstants_["RADIAL_STROKE_COLOR"] : _ref$progressColor,
|
|
4853
|
+
_ref$width = _ref.width,
|
|
4854
|
+
width = _ref$width === void 0 ? 200 : _ref$width,
|
|
4855
|
+
_ref$height = _ref.height,
|
|
4856
|
+
height = _ref$height === void 0 ? 200 : _ref$height;
|
|
4398
4857
|
var semicircleRadius = height - strokeWidth / 2;
|
|
4399
4858
|
var circumference = semicircleRadius * 2 * Math.PI;
|
|
4400
4859
|
var bgCircleOffset = 0.5 * circumference;
|
|
@@ -4431,6 +4890,7 @@ var RadialGraph_RadialGraph = function RadialGraph(_ref) {
|
|
|
4431
4890
|
cy: semicircleRadius + strokeWidth / 2
|
|
4432
4891
|
})));
|
|
4433
4892
|
};
|
|
4893
|
+
|
|
4434
4894
|
RadialGraph_RadialGraph.propTypes = {
|
|
4435
4895
|
progress: external_prop_types_default.a.number,
|
|
4436
4896
|
strokeWidth: external_prop_types_default.a.number,
|
|
@@ -4448,31 +4908,44 @@ RadialGraph_RadialGraph.defaultProps = {
|
|
|
4448
4908
|
var displayUtils = __webpack_require__(80);
|
|
4449
4909
|
|
|
4450
4910
|
// EXTERNAL MODULE: ./src/SingleValueRadial/PureSingleValueRadial/GaugeGraph.tsx
|
|
4451
|
-
var GaugeGraph = __webpack_require__(
|
|
4911
|
+
var GaugeGraph = __webpack_require__(177);
|
|
4452
4912
|
var GaugeGraph_default = /*#__PURE__*/__webpack_require__.n(GaugeGraph);
|
|
4453
4913
|
|
|
4454
4914
|
// CONCATENATED MODULE: ./src/SingleValueRadial/PureSingleValueRadial/RadialLayout.jsx
|
|
4455
4915
|
|
|
4456
4916
|
|
|
4917
|
+
|
|
4457
4918
|
function ownKeys(object, enumerableOnly) {
|
|
4458
4919
|
var keys = Object.keys(object);
|
|
4920
|
+
|
|
4459
4921
|
if (Object.getOwnPropertySymbols) {
|
|
4460
4922
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
4461
|
-
enumerableOnly
|
|
4923
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
4462
4924
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4463
|
-
})
|
|
4925
|
+
});
|
|
4926
|
+
keys.push.apply(keys, symbols);
|
|
4464
4927
|
}
|
|
4928
|
+
|
|
4465
4929
|
return keys;
|
|
4466
4930
|
}
|
|
4931
|
+
|
|
4467
4932
|
function _objectSpread(target) {
|
|
4468
4933
|
for (var i = 1; i < arguments.length; i++) {
|
|
4469
|
-
var source =
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4934
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
4935
|
+
|
|
4936
|
+
if (i % 2) {
|
|
4937
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
4938
|
+
defineProperty_default()(target, key, source[key]);
|
|
4939
|
+
});
|
|
4940
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
4941
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4942
|
+
} else {
|
|
4943
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
4944
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4945
|
+
});
|
|
4946
|
+
}
|
|
4475
4947
|
}
|
|
4948
|
+
|
|
4476
4949
|
return target;
|
|
4477
4950
|
}
|
|
4478
4951
|
|
|
@@ -4482,6 +4955,7 @@ function _objectSpread(target) {
|
|
|
4482
4955
|
|
|
4483
4956
|
|
|
4484
4957
|
|
|
4958
|
+
|
|
4485
4959
|
var TextContainer = external_styled_components_default.a.div.withConfig({
|
|
4486
4960
|
displayName: "RadialLayout__TextContainer",
|
|
4487
4961
|
componentId: "sc-13x2rjt-0"
|
|
@@ -4536,50 +5010,54 @@ var UnderLabelText = external_styled_components_default.a.span.withConfig({
|
|
|
4536
5010
|
}, function (props) {
|
|
4537
5011
|
return props.maxWidth;
|
|
4538
5012
|
});
|
|
5013
|
+
|
|
4539
5014
|
var RadialLayout_RadialContent = function RadialContent(_ref) {
|
|
4540
5015
|
var props = extends_default()({}, _ref);
|
|
5016
|
+
|
|
4541
5017
|
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
|
-
|
|
5018
|
+
majorValue = props.majorValue,
|
|
5019
|
+
majorText = props.majorText,
|
|
5020
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
5021
|
+
majorValueTitle = props.majorValueTitle,
|
|
5022
|
+
minValue = props.minValue,
|
|
5023
|
+
maxValue = props.maxValue,
|
|
5024
|
+
trendColor = props.trendColor,
|
|
5025
|
+
trendText = props.trendText,
|
|
5026
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
5027
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
5028
|
+
unit = props.unit,
|
|
5029
|
+
unitPosition = props.unitPosition,
|
|
5030
|
+
underLabelColor = props.underLabelColor,
|
|
5031
|
+
underLabel = props.underLabel,
|
|
5032
|
+
onValueClick = props.onValueClick,
|
|
5033
|
+
showRadialGraph = props.showRadialGraph,
|
|
5034
|
+
progress = props.progress,
|
|
5035
|
+
radialBackgroundColor = props.radialBackgroundColor,
|
|
5036
|
+
radialStrokeColor = props.radialStrokeColor,
|
|
5037
|
+
radialStrokeWidth = props.radialStrokeWidth,
|
|
5038
|
+
graphWidth = props.graphWidth,
|
|
5039
|
+
graphHeight = props.graphHeight,
|
|
5040
|
+
isGaugeValid = props.isGaugeValid,
|
|
5041
|
+
formattedGaugeRanges = props.formattedGaugeRanges,
|
|
5042
|
+
defaultFontColor = props.defaultFontColor;
|
|
5043
|
+
|
|
4567
5044
|
var _getRadialHelperDimen = Object(displayUtils["getRadialHelperDimensions"])({
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
5045
|
+
height: graphHeight,
|
|
5046
|
+
strokeWidth: radialStrokeWidth
|
|
5047
|
+
}),
|
|
5048
|
+
semicircleRadius = _getRadialHelperDimen.semicircleRadius,
|
|
5049
|
+
helperArcRadius = _getRadialHelperDimen.helperArcRadius; // Two cases for filling underLabel space: either the semicircle radius is insufficiently sized for text
|
|
4573
5050
|
// or the radial visualization has been disabled (first condition reached first when making smaller).
|
|
4574
|
-
var fillVacantSpace = semicircleRadius < 50 || !showRadialGraph;
|
|
4575
5051
|
|
|
4576
|
-
|
|
5052
|
+
|
|
5053
|
+
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).
|
|
5054
|
+
|
|
4577
5055
|
var underLabelHeight = fillVacantSpace ? 0 : Math.max(helperArcRadius * 0.2, 20);
|
|
4578
|
-
var underLabelWidth = helperArcRadius * 2;
|
|
5056
|
+
var underLabelWidth = helperArcRadius * 2; // Remove extra padding under major value - this is specific to Proxima Nova
|
|
4579
5057
|
|
|
4580
|
-
// Remove extra padding under major value - this is specific to Proxima Nova
|
|
4581
5058
|
var singleValueBottomOffset = majorTextFontSize * 0.2;
|
|
4582
5059
|
var radialGraph = null;
|
|
5060
|
+
|
|
4583
5061
|
if (showRadialGraph) {
|
|
4584
5062
|
radialGraph = isGaugeValid ? /*#__PURE__*/external_react_default.a.createElement(GaugeGraph_default.a, {
|
|
4585
5063
|
width: graphWidth,
|
|
@@ -4601,6 +5079,7 @@ var RadialLayout_RadialContent = function RadialContent(_ref) {
|
|
|
4601
5079
|
height: graphHeight
|
|
4602
5080
|
});
|
|
4603
5081
|
}
|
|
5082
|
+
|
|
4604
5083
|
var singleValueComponent = /*#__PURE__*/external_react_default.a.createElement(SingleValueContainer, {
|
|
4605
5084
|
singleValueBottomOffset: singleValueBottomOffset
|
|
4606
5085
|
}, /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic["default"], {
|
|
@@ -4622,7 +5101,6 @@ var RadialLayout_RadialContent = function RadialContent(_ref) {
|
|
|
4622
5101
|
"data-test": "underLabel",
|
|
4623
5102
|
maxWidth: underLabelWidth * 0.9 // buffer for overflow ellipses
|
|
4624
5103
|
,
|
|
4625
|
-
|
|
4626
5104
|
color: underLabelColor,
|
|
4627
5105
|
title: underLabel
|
|
4628
5106
|
}, underLabel));
|
|
@@ -4635,6 +5113,7 @@ var RadialLayout_RadialContent = function RadialContent(_ref) {
|
|
|
4635
5113
|
height: graphHeight
|
|
4636
5114
|
}, singleValueComponent, underLabelComponent));
|
|
4637
5115
|
};
|
|
5116
|
+
|
|
4638
5117
|
RadialLayout_RadialContent.propTypes = _objectSpread(_objectSpread({}, SingleValueBasic["default"].propTypes), {}, {
|
|
4639
5118
|
trendPosition: external_prop_types_default.a.string,
|
|
4640
5119
|
showRadialGraph: external_prop_types_default.a.bool,
|
|
@@ -4679,31 +5158,34 @@ var Container = external_styled_components_default.a.div.withConfig({
|
|
|
4679
5158
|
})(["overflow:hidden;", ";"], function (props) {
|
|
4680
5159
|
return Object(style_["toDimension"])(Object(external_lodash_["pick"])(props, ['width', 'height']));
|
|
4681
5160
|
});
|
|
5161
|
+
|
|
4682
5162
|
var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
4683
5163
|
var props = extends_default()({}, _ref);
|
|
5164
|
+
|
|
4684
5165
|
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
|
-
|
|
5166
|
+
_props$height = props.height,
|
|
5167
|
+
height = _props$height === void 0 ? 250 : _props$height,
|
|
5168
|
+
style = props.style,
|
|
5169
|
+
isGaugeOn = props.isGaugeOn,
|
|
5170
|
+
gaugeRanges = props.gaugeRanges,
|
|
5171
|
+
majorFontSize = props.majorFontSize,
|
|
5172
|
+
majorValue = props.majorValue,
|
|
5173
|
+
majorValueField = props.majorValueField,
|
|
5174
|
+
minValue = props.minValue,
|
|
5175
|
+
maxValue = props.maxValue,
|
|
5176
|
+
trendValue = props.trendValue,
|
|
5177
|
+
trendFontSize = props.trendFontSize,
|
|
5178
|
+
unitPosition = props.unitPosition,
|
|
5179
|
+
numberPrecision = props.numberPrecision,
|
|
5180
|
+
shouldUseThousandSeparators = props.shouldUseThousandSeparators,
|
|
5181
|
+
shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
|
|
5182
|
+
onValueClick = props.onValueClick,
|
|
5183
|
+
splitByLayout = props.splitByLayout,
|
|
5184
|
+
_props$trellisKey = props.trellisKey,
|
|
5185
|
+
trellisKey = _props$trellisKey === void 0 ? '' : _props$trellisKey,
|
|
5186
|
+
_props$trellisSplitBy = props.trellisSplitBy,
|
|
5187
|
+
trellisSplitBy = _props$trellisSplitBy === void 0 ? '' : _props$trellisSplitBy; // calculate colors
|
|
5188
|
+
|
|
4707
5189
|
var defaultColors = {
|
|
4708
5190
|
defaultFontColor: pick_default()({
|
|
4709
5191
|
enterprise: {
|
|
@@ -4717,12 +5199,14 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4717
5199
|
prisma: variables_default.a.contentColorActive(props)
|
|
4718
5200
|
})(props)
|
|
4719
5201
|
};
|
|
5202
|
+
|
|
4720
5203
|
var _computeColors = Object(singleValueUtils["computeColors"])(props, defaultColors),
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
5204
|
+
backgroundEnabled = _computeColors.backgroundEnabled,
|
|
5205
|
+
backgroundColor = _computeColors.backgroundColor,
|
|
5206
|
+
majorColor = _computeColors.majorColor,
|
|
5207
|
+
trendColor = _computeColors.trendColor,
|
|
5208
|
+
underLabelColor = _computeColors.underLabelColor;
|
|
5209
|
+
|
|
4726
5210
|
var radialColors = Object(displayUtils["getRadialColors"])({
|
|
4727
5211
|
backgroundEnabled: backgroundEnabled,
|
|
4728
5212
|
backgroundColor: backgroundColor
|
|
@@ -4738,68 +5222,75 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4738
5222
|
var sortedGaugeRanges = gaugeRanges && Object(gaugeUtils["getSortedGaugeRanges"])(gaugeRanges);
|
|
4739
5223
|
var isGaugeValid = isGaugeOn && gaugeRanges && Object(gaugeUtils["validateGaugeRanges"])(sortedGaugeRanges);
|
|
4740
5224
|
var formattedGaugeRanges = isGaugeValid && Object(gaugeUtils["getFormattedGaugeRanges"])(sortedGaugeRanges, minValue, maxValue);
|
|
5225
|
+
|
|
4741
5226
|
var renderVisualization = function renderVisualization(_ref2) {
|
|
4742
5227
|
var containerWidth = _ref2.width,
|
|
4743
|
-
|
|
5228
|
+
containerHeight = _ref2.height;
|
|
4744
5229
|
var underLabel = props.underLabel;
|
|
4745
5230
|
var trendDisplay = props.trendDisplay,
|
|
4746
|
-
|
|
5231
|
+
unit = props.unit; // calculate radial graph dimensions, strokewidth, and major and trend content dimensions
|
|
5232
|
+
|
|
4747
5233
|
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
|
-
|
|
5234
|
+
width: containerWidth,
|
|
5235
|
+
height: containerHeight
|
|
5236
|
+
}),
|
|
5237
|
+
graphWidth = _getRadialGraphDimens.width,
|
|
5238
|
+
graphHeight = _getRadialGraphDimens.height; // Radial stroke width is stepped to lower value at lower sizes.
|
|
5239
|
+
|
|
5240
|
+
|
|
5241
|
+
var radialStrokeWidth = Object(displayUtils["getRadialStrokeWidth"])(graphHeight); // Subtract half of the stroke width for the exact internal radius.
|
|
5242
|
+
|
|
5243
|
+
var semicircleRadius = graphHeight - radialStrokeWidth / 2; // If radius drops below 20px, hide the radial graph.
|
|
5244
|
+
|
|
5245
|
+
var showRadialGraph = semicircleRadius >= 20; // if gauge is valid, reduce contentWidth and contentHeight by padding from GaugeGraph
|
|
5246
|
+
|
|
4761
5247
|
var offSet = isGaugeValid ? Object(gaugeUtils["getLabelFontSize"])(graphHeight, showRadialGraph) * 3 : 0;
|
|
5248
|
+
|
|
4762
5249
|
var _getRadialHelperDimen = Object(displayUtils["getRadialHelperDimensions"])({
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
5250
|
+
height: graphHeight - radialStrokeWidth / 2 - offSet,
|
|
5251
|
+
strokeWidth: radialStrokeWidth
|
|
5252
|
+
}),
|
|
5253
|
+
contentWidth = _getRadialHelperDimen.contentWidth,
|
|
5254
|
+
contentHeight = _getRadialHelperDimen.contentHeight; // If not showing the radial graph, then can forgo padding logic and use original container dimensions for content sizing computation.
|
|
5255
|
+
|
|
5256
|
+
|
|
4768
5257
|
if (!showRadialGraph) {
|
|
4769
5258
|
graphWidth = containerWidth;
|
|
4770
5259
|
contentWidth = containerWidth;
|
|
4771
5260
|
graphHeight = containerHeight;
|
|
4772
5261
|
contentHeight = containerHeight;
|
|
4773
5262
|
}
|
|
5263
|
+
|
|
4774
5264
|
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
|
-
|
|
5265
|
+
majorValue: majorValue,
|
|
5266
|
+
trendValue: trendValue,
|
|
5267
|
+
majorFontSize: majorFontSize,
|
|
5268
|
+
trendFontSize: trendFontSize,
|
|
5269
|
+
trendDisplay: trendDisplay,
|
|
5270
|
+
contentWidth: contentWidth,
|
|
5271
|
+
contentHeight: contentHeight,
|
|
5272
|
+
// buffer for height of div
|
|
5273
|
+
containerWidth: containerWidth * 0.9,
|
|
5274
|
+
containerHeight: containerHeight * 0.9,
|
|
5275
|
+
unit: unit,
|
|
5276
|
+
numberPrecision: numberPrecision,
|
|
5277
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
5278
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
5279
|
+
smallViz: !showRadialGraph
|
|
5280
|
+
}),
|
|
5281
|
+
majorText = _computeSingleValueRa.majorText,
|
|
5282
|
+
trendText = _computeSingleValueRa.trendText,
|
|
5283
|
+
majorTextFontSize = _computeSingleValueRa.majorTextFontSize,
|
|
5284
|
+
trendTextFontSize = _computeSingleValueRa.trendTextFontSize,
|
|
5285
|
+
majorValueTitle = _computeSingleValueRa.majorValueTitle,
|
|
5286
|
+
smallVizProps = _computeSingleValueRa.smallVizProps;
|
|
5287
|
+
|
|
4797
5288
|
if (!Object(external_lodash_["isEmpty"])(smallVizProps)) {
|
|
4798
5289
|
trendDisplay = smallVizProps.trendDisplay;
|
|
4799
5290
|
unit = smallVizProps.unit;
|
|
4800
|
-
}
|
|
5291
|
+
} // calculate radial progress
|
|
5292
|
+
|
|
4801
5293
|
|
|
4802
|
-
// calculate radial progress
|
|
4803
5294
|
var progress = Object(displayUtils["getRadialProgress"])(majorValue - minValue, minValue, maxValue);
|
|
4804
5295
|
return /*#__PURE__*/external_react_["createElement"](VizStyleWrapper["default"], {
|
|
4805
5296
|
backgroundColor: backgroundColor,
|
|
@@ -4835,6 +5326,7 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4835
5326
|
defaultFontColor: defaultColors.defaultFontColor
|
|
4836
5327
|
}));
|
|
4837
5328
|
};
|
|
5329
|
+
|
|
4838
5330
|
if (trellisEnabled) {
|
|
4839
5331
|
return /*#__PURE__*/external_react_["createElement"](external_react_["Fragment"], null, /*#__PURE__*/external_react_["createElement"](TrellisTitle["TrellisTitle"], {
|
|
4840
5332
|
fontColor: defaultColors.defaultFontColor,
|
|
@@ -4847,6 +5339,7 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4847
5339
|
return renderVisualization(containerDimension);
|
|
4848
5340
|
})));
|
|
4849
5341
|
}
|
|
5342
|
+
|
|
4850
5343
|
return /*#__PURE__*/external_react_["createElement"](Container, {
|
|
4851
5344
|
width: width,
|
|
4852
5345
|
height: height
|
|
@@ -4854,6 +5347,7 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref) {
|
|
|
4854
5347
|
return renderVisualization(containerDimension);
|
|
4855
5348
|
}));
|
|
4856
5349
|
};
|
|
5350
|
+
|
|
4857
5351
|
SingleValueRadial_SingleValueRadial.propTypes = {
|
|
4858
5352
|
width: external_prop_types_["oneOfType"]([external_prop_types_["string"], external_prop_types_["number"]]),
|
|
4859
5353
|
height: external_prop_types_["oneOfType"]([external_prop_types_["string"], external_prop_types_["number"]]),
|
|
@@ -4928,7 +5422,7 @@ module.exports = require("@splunk/visualizations-shared/domUtils");
|
|
|
4928
5422
|
|
|
4929
5423
|
/***/ }),
|
|
4930
5424
|
|
|
4931
|
-
/***/
|
|
5425
|
+
/***/ 56:
|
|
4932
5426
|
/***/ (function(module, exports) {
|
|
4933
5427
|
|
|
4934
5428
|
module.exports = require("@splunk/themes/useSplunkTheme");
|
|
@@ -4946,6 +5440,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4946
5440
|
});
|
|
4947
5441
|
exports.LAYOUT_TYPE = void 0;
|
|
4948
5442
|
var LAYOUT_TYPE;
|
|
5443
|
+
|
|
4949
5444
|
(function (LAYOUT_TYPE) {
|
|
4950
5445
|
LAYOUT_TYPE["Off"] = "off";
|
|
4951
5446
|
LAYOUT_TYPE["Trellis"] = "trellis";
|
|
@@ -4964,6 +5459,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4964
5459
|
});
|
|
4965
5460
|
exports.VizBehavior = void 0;
|
|
4966
5461
|
var VizBehavior;
|
|
5462
|
+
|
|
4967
5463
|
(function (VizBehavior) {
|
|
4968
5464
|
/**
|
|
4969
5465
|
* Dynamic Options Behavior.
|
|
@@ -4983,6 +5479,7 @@ var VizBehavior;
|
|
|
4983
5479
|
* missing.
|
|
4984
5480
|
* @type {string}
|
|
4985
5481
|
*/
|
|
5482
|
+
|
|
4986
5483
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
4987
5484
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
4988
5485
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -5046,8 +5543,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5046
5543
|
value: true
|
|
5047
5544
|
});
|
|
5048
5545
|
exports.TrellisTitle = exports.TRELLIS_TITLE_HEIGHT = void 0;
|
|
5546
|
+
|
|
5049
5547
|
var React = __webpack_require__(1);
|
|
5548
|
+
|
|
5050
5549
|
var styled_components_1 = __webpack_require__(4);
|
|
5550
|
+
|
|
5051
5551
|
exports.TRELLIS_TITLE_HEIGHT = 28;
|
|
5052
5552
|
var TrellisTitleText = styled_components_1.default.div.withConfig({
|
|
5053
5553
|
displayName: "TrellisTitle__TrellisTitleText",
|
|
@@ -5063,6 +5563,7 @@ var TrellisTitleDiv = styled_components_1.default.div.withConfig({
|
|
|
5063
5563
|
}, function (props) {
|
|
5064
5564
|
return props.backgroundColor;
|
|
5065
5565
|
});
|
|
5566
|
+
|
|
5066
5567
|
var TrellisTitle = function TrellisTitle(props) {
|
|
5067
5568
|
var titleText = String(props.trellisKey).toString();
|
|
5068
5569
|
return React.createElement(TrellisTitleDiv, {
|
|
@@ -5072,6 +5573,7 @@ var TrellisTitle = function TrellisTitle(props) {
|
|
|
5072
5573
|
title: titleText
|
|
5073
5574
|
}, React.createElement(TrellisTitleText, null, titleText));
|
|
5074
5575
|
};
|
|
5576
|
+
|
|
5075
5577
|
exports.TrellisTitle = TrellisTitle;
|
|
5076
5578
|
|
|
5077
5579
|
/***/ }),
|
|
@@ -5113,7 +5615,6 @@ var MAJOR_FONT_THRESHOLD = 25;
|
|
|
5113
5615
|
var TREND_FONT_THRESHOLD = 12;
|
|
5114
5616
|
var DEFAULT_RADIAL_STROKE_WIDTH = 16;
|
|
5115
5617
|
var SMALL_RADIAL_STROKE_WIDTH = 6;
|
|
5116
|
-
|
|
5117
5618
|
/**
|
|
5118
5619
|
* Get the colors for a radial graph based on severity
|
|
5119
5620
|
* @method getRadialColors
|
|
@@ -5122,9 +5623,10 @@ var SMALL_RADIAL_STROKE_WIDTH = 6;
|
|
|
5122
5623
|
* @param {String} props.backgroundColor
|
|
5123
5624
|
* @returns {Object} { background, stroke } colors
|
|
5124
5625
|
*/
|
|
5626
|
+
|
|
5125
5627
|
var getRadialColors = function getRadialColors(_ref) {
|
|
5126
5628
|
var backgroundEnabled = _ref.backgroundEnabled,
|
|
5127
|
-
|
|
5629
|
+
backgroundColor = _ref.backgroundColor;
|
|
5128
5630
|
return Object(_common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["getGraphColors"])({
|
|
5129
5631
|
backgroundEnabled: backgroundEnabled,
|
|
5130
5632
|
backgroundColor: backgroundColor,
|
|
@@ -5137,7 +5639,6 @@ var getRadialColors = function getRadialColors(_ref) {
|
|
|
5137
5639
|
}
|
|
5138
5640
|
});
|
|
5139
5641
|
};
|
|
5140
|
-
|
|
5141
5642
|
/**
|
|
5142
5643
|
* Figure out the dimensions of the graph
|
|
5143
5644
|
* @method getRadialGraphDimensions
|
|
@@ -5146,17 +5647,17 @@ var getRadialColors = function getRadialColors(_ref) {
|
|
|
5146
5647
|
* @param {Number} props.height // Height of the container
|
|
5147
5648
|
* @returns {Number} width and height of the graph
|
|
5148
5649
|
*/
|
|
5650
|
+
|
|
5149
5651
|
var getRadialGraphDimensions = function getRadialGraphDimensions(_ref2) {
|
|
5150
5652
|
var width = _ref2.width,
|
|
5151
|
-
|
|
5152
|
-
|
|
5653
|
+
height = _ref2.height; // height * 2 because we are fitting only half of a circle inside the container
|
|
5654
|
+
|
|
5153
5655
|
var radius = Math.min(width, height * 2) / 2;
|
|
5154
5656
|
return {
|
|
5155
5657
|
width: width - _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["SVR_PADDING"].left - _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["SVR_PADDING"].right,
|
|
5156
5658
|
height: radius - _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["SVR_PADDING"].top - _common_utils_singleValueUtils__WEBPACK_IMPORTED_MODULE_1__["SVR_PADDING"].bottom
|
|
5157
5659
|
};
|
|
5158
5660
|
};
|
|
5159
|
-
|
|
5160
5661
|
/**
|
|
5161
5662
|
* Figure out the dimensions of the content container for SVR
|
|
5162
5663
|
* @method getRadialHelperDimensions
|
|
@@ -5165,12 +5666,14 @@ var getRadialGraphDimensions = function getRadialGraphDimensions(_ref2) {
|
|
|
5165
5666
|
* @param {Number} props.height // Height of the visualization space
|
|
5166
5667
|
* @returns {Number} width and height of the content graph
|
|
5167
5668
|
*/
|
|
5669
|
+
|
|
5168
5670
|
var getRadialHelperDimensions = function getRadialHelperDimensions(_ref3) {
|
|
5169
5671
|
var height = _ref3.height,
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5672
|
+
_ref3$strokeWidth = _ref3.strokeWidth,
|
|
5673
|
+
strokeWidth = _ref3$strokeWidth === void 0 ? DEFAULT_RADIAL_STROKE_WIDTH : _ref3$strokeWidth; // The radius of the visualization is equal to the height
|
|
5674
|
+
|
|
5173
5675
|
var semicircleRadius = height - strokeWidth / 2; // The inner part of the arc is strokeWidth / 2 inset.
|
|
5676
|
+
|
|
5174
5677
|
var innerArcRadius = semicircleRadius * 0.9;
|
|
5175
5678
|
var halfContentWidth = innerArcRadius * 0.7;
|
|
5176
5679
|
var contentHeight = Math.floor(Math.sqrt(Math.pow(innerArcRadius, 2) - Math.pow(halfContentWidth, 2)));
|
|
@@ -5181,7 +5684,6 @@ var getRadialHelperDimensions = function getRadialHelperDimensions(_ref3) {
|
|
|
5181
5684
|
semicircleRadius: semicircleRadius
|
|
5182
5685
|
};
|
|
5183
5686
|
};
|
|
5184
|
-
|
|
5185
5687
|
/**
|
|
5186
5688
|
* Get the maximum size of the container that holds the graph text
|
|
5187
5689
|
* @method getValueContentSize
|
|
@@ -5190,34 +5692,34 @@ var getRadialHelperDimensions = function getRadialHelperDimensions(_ref3) {
|
|
|
5190
5692
|
* @param {Number} props.radialStrokeWidth // Stroke width of the graph
|
|
5191
5693
|
* @returns {Number} content size for showing major and trend values in radial graph
|
|
5192
5694
|
*/
|
|
5695
|
+
|
|
5193
5696
|
var getValueContentSize = function getValueContentSize(_ref4) {
|
|
5194
5697
|
var graphSize = _ref4.graphSize,
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
var diameter = graphSize - radialStrokeWidth;
|
|
5198
|
-
// Use pythagoreum theorum with circle diameter
|
|
5698
|
+
radialStrokeWidth = _ref4.radialStrokeWidth; // Account for the graph's stroke width
|
|
5699
|
+
|
|
5700
|
+
var diameter = graphSize - radialStrokeWidth; // Use pythagoreum theorum with circle diameter
|
|
5199
5701
|
// to calculate the size of the sides of the square inside the circle
|
|
5702
|
+
|
|
5200
5703
|
return Math.floor(Math.sqrt(Math.pow(diameter, 2) / 2));
|
|
5201
5704
|
};
|
|
5202
|
-
|
|
5203
5705
|
/*
|
|
5204
5706
|
* @method getRadialStrokeWidth
|
|
5205
5707
|
* @param {Number} graphHeight
|
|
5206
5708
|
* @returns {Number} radial stroke width
|
|
5207
5709
|
*/
|
|
5710
|
+
|
|
5208
5711
|
var getRadialStrokeWidth = function getRadialStrokeWidth(graphHeight) {
|
|
5209
5712
|
return graphHeight >= 90 ? DEFAULT_RADIAL_STROKE_WIDTH : SMALL_RADIAL_STROKE_WIDTH;
|
|
5210
5713
|
};
|
|
5211
|
-
|
|
5212
5714
|
/*
|
|
5213
5715
|
* @method isValidPosition
|
|
5214
5716
|
* @param {String} position
|
|
5215
5717
|
* @returns {Bool}
|
|
5216
5718
|
*/
|
|
5719
|
+
|
|
5217
5720
|
var isValidPosition = function isValidPosition(position) {
|
|
5218
5721
|
return VALID_TREND_POSITIONS.indexOf(position) > -1;
|
|
5219
5722
|
};
|
|
5220
|
-
|
|
5221
5723
|
/*
|
|
5222
5724
|
* @method showTrendPositionStandard
|
|
5223
5725
|
* @param {Object} props
|
|
@@ -5225,12 +5727,12 @@ var isValidPosition = function isValidPosition(position) {
|
|
|
5225
5727
|
* @param {String} props.position
|
|
5226
5728
|
* @returns {Bool}
|
|
5227
5729
|
*/
|
|
5730
|
+
|
|
5228
5731
|
var showTrendPositionStandard = function showTrendPositionStandard(_ref5) {
|
|
5229
5732
|
var showTrendIndicator = _ref5.showTrendIndicator,
|
|
5230
|
-
|
|
5733
|
+
position = _ref5.position;
|
|
5231
5734
|
return showTrendIndicator && position === 'standard';
|
|
5232
5735
|
};
|
|
5233
|
-
|
|
5234
5736
|
/*
|
|
5235
5737
|
* @method showTrendPositionBelow
|
|
5236
5738
|
* @param {Object} props
|
|
@@ -5238,12 +5740,12 @@ var showTrendPositionStandard = function showTrendPositionStandard(_ref5) {
|
|
|
5238
5740
|
* @param {String} props.position
|
|
5239
5741
|
* @returns {Bool}
|
|
5240
5742
|
*/
|
|
5743
|
+
|
|
5241
5744
|
var showTrendPositionBelow = function showTrendPositionBelow(_ref6) {
|
|
5242
5745
|
var showTrendIndicator = _ref6.showTrendIndicator,
|
|
5243
|
-
|
|
5746
|
+
position = _ref6.position;
|
|
5244
5747
|
return showTrendIndicator && position === 'below';
|
|
5245
5748
|
};
|
|
5246
|
-
|
|
5247
5749
|
/*
|
|
5248
5750
|
* @method showTrendPositionOutside
|
|
5249
5751
|
* @param {Object} props
|
|
@@ -5251,12 +5753,12 @@ var showTrendPositionBelow = function showTrendPositionBelow(_ref6) {
|
|
|
5251
5753
|
* @param {String} props.position
|
|
5252
5754
|
* @returns {Bool}
|
|
5253
5755
|
*/
|
|
5756
|
+
|
|
5254
5757
|
var showTrendPositionOutside = function showTrendPositionOutside(_ref7) {
|
|
5255
5758
|
var showTrendIndicator = _ref7.showTrendIndicator,
|
|
5256
|
-
|
|
5759
|
+
position = _ref7.position;
|
|
5257
5760
|
return showTrendIndicator && position === 'outside';
|
|
5258
5761
|
};
|
|
5259
|
-
|
|
5260
5762
|
/*
|
|
5261
5763
|
* @method getRadialProgress
|
|
5262
5764
|
* @param {Number} amount of progress in the radial
|
|
@@ -5264,6 +5766,7 @@ var showTrendPositionOutside = function showTrendPositionOutside(_ref7) {
|
|
|
5264
5766
|
* @param {Number} maxValue
|
|
5265
5767
|
* @returns {Number} percentage of progress in the radial
|
|
5266
5768
|
*/
|
|
5769
|
+
|
|
5267
5770
|
var getRadialProgress = function getRadialProgress(progressValue, minValue, maxValue) {
|
|
5268
5771
|
return typeof progressValue === 'number' && minValue < maxValue && progressValue > 0 ? progressValue / (maxValue - minValue) * 100 : 0;
|
|
5269
5772
|
};
|
|
@@ -5300,11 +5803,11 @@ var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(exte
|
|
|
5300
5803
|
var singleValueUtils = __webpack_require__(24);
|
|
5301
5804
|
|
|
5302
5805
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowUp"
|
|
5303
|
-
var ArrowUp_ = __webpack_require__(
|
|
5806
|
+
var ArrowUp_ = __webpack_require__(85);
|
|
5304
5807
|
var ArrowUp_default = /*#__PURE__*/__webpack_require__.n(ArrowUp_);
|
|
5305
5808
|
|
|
5306
5809
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowDown"
|
|
5307
|
-
var ArrowDown_ = __webpack_require__(
|
|
5810
|
+
var ArrowDown_ = __webpack_require__(86);
|
|
5308
5811
|
var ArrowDown_default = /*#__PURE__*/__webpack_require__.n(ArrowDown_);
|
|
5309
5812
|
|
|
5310
5813
|
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
@@ -5342,13 +5845,15 @@ var Text = external_styled_components_default.a.div.withConfig({
|
|
|
5342
5845
|
}, function (props) {
|
|
5343
5846
|
return props.size ? "margin-left: ".concat(parseInt(props.size, 10) * 0.2 || 5, "px;") : '';
|
|
5344
5847
|
});
|
|
5848
|
+
|
|
5345
5849
|
var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
5346
5850
|
var fontSize = _ref.fontSize,
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5851
|
+
color = _ref.color,
|
|
5852
|
+
value = _ref.value,
|
|
5853
|
+
text = _ref.text;
|
|
5350
5854
|
var TrendIndicator = false;
|
|
5351
5855
|
var ariaLabel = false;
|
|
5856
|
+
|
|
5352
5857
|
if (parseFloat(value, 10) > 0) {
|
|
5353
5858
|
TrendIndicator = ArrowUp_default.a;
|
|
5354
5859
|
ariaLabel = Object(i18n_["_"])('increase');
|
|
@@ -5356,6 +5861,7 @@ var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5356
5861
|
TrendIndicator = ArrowDown_default.a;
|
|
5357
5862
|
ariaLabel = Object(i18n_["_"])('decrease');
|
|
5358
5863
|
}
|
|
5864
|
+
|
|
5359
5865
|
return /*#__PURE__*/external_react_default.a.createElement(Column, {
|
|
5360
5866
|
justify: "flex-end",
|
|
5361
5867
|
size: fontSize
|
|
@@ -5371,6 +5877,7 @@ var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5371
5877
|
color: color
|
|
5372
5878
|
}, "".concat(text)));
|
|
5373
5879
|
};
|
|
5880
|
+
|
|
5374
5881
|
TrendValue_SingleValueContent.propTypes = {
|
|
5375
5882
|
fontSize: external_prop_types_default.a.number,
|
|
5376
5883
|
color: external_prop_types_default.a.string,
|
|
@@ -5379,7 +5886,7 @@ TrendValue_SingleValueContent.propTypes = {
|
|
|
5379
5886
|
};
|
|
5380
5887
|
/* harmony default export */ var TrendValue = (TrendValue_SingleValueContent);
|
|
5381
5888
|
// EXTERNAL MODULE: external "cssesc"
|
|
5382
|
-
var external_cssesc_ = __webpack_require__(
|
|
5889
|
+
var external_cssesc_ = __webpack_require__(87);
|
|
5383
5890
|
var external_cssesc_default = /*#__PURE__*/__webpack_require__.n(external_cssesc_);
|
|
5384
5891
|
|
|
5385
5892
|
// CONCATENATED MODULE: ./src/SingleValueBasic/MajorValue.jsx
|
|
@@ -5411,37 +5918,44 @@ var MajorValue_Text = external_styled_components_default.a.div.withConfig({
|
|
|
5411
5918
|
if (!props.pseudoContent || !props.pseudoContentPosition) {
|
|
5412
5919
|
return '';
|
|
5413
5920
|
}
|
|
5921
|
+
|
|
5414
5922
|
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
5923
|
});
|
|
5416
5924
|
var validUnitPositions = ['before', 'after'];
|
|
5925
|
+
|
|
5417
5926
|
var MajorValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
5418
5927
|
var color = _ref.color,
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5928
|
+
fontSize = _ref.fontSize,
|
|
5929
|
+
unitPosition = _ref.unitPosition,
|
|
5930
|
+
title = _ref.title,
|
|
5931
|
+
value = _ref.value,
|
|
5932
|
+
onValueClick = _ref.onValueClick,
|
|
5933
|
+
unit = _ref.unit;
|
|
5425
5934
|
var sanitizedUnit;
|
|
5426
5935
|
var sanitizedUnitPosition;
|
|
5936
|
+
|
|
5427
5937
|
if (typeof unit === 'string') {
|
|
5428
5938
|
sanitizedUnit = external_cssesc_default()(unit, {
|
|
5429
5939
|
wrap: true,
|
|
5430
5940
|
quotes: 'double'
|
|
5431
5941
|
});
|
|
5942
|
+
|
|
5432
5943
|
if (typeof unitPosition === 'string' && validUnitPositions.includes(unitPosition)) {
|
|
5433
5944
|
sanitizedUnitPosition = unitPosition;
|
|
5434
5945
|
} else {
|
|
5435
5946
|
sanitizedUnitPosition = 'after';
|
|
5436
5947
|
}
|
|
5437
5948
|
}
|
|
5949
|
+
|
|
5438
5950
|
var handleKeyDown = function handleKeyDown(e) {
|
|
5439
5951
|
if (e.keyCode !== 13) {
|
|
5440
5952
|
return;
|
|
5441
5953
|
}
|
|
5954
|
+
|
|
5442
5955
|
e.preventDefault();
|
|
5443
5956
|
onValueClick(e);
|
|
5444
5957
|
};
|
|
5958
|
+
|
|
5445
5959
|
return /*#__PURE__*/external_react_default.a.createElement(Row, {
|
|
5446
5960
|
size: fontSize
|
|
5447
5961
|
}, /*#__PURE__*/external_react_default.a.createElement(MajorValue_Text, {
|
|
@@ -5461,6 +5975,7 @@ var MajorValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5461
5975
|
onKeyDown: handleKeyDown
|
|
5462
5976
|
}, value));
|
|
5463
5977
|
};
|
|
5978
|
+
|
|
5464
5979
|
MajorValue_SingleValueContent.propTypes = {
|
|
5465
5980
|
color: external_prop_types_default.a.string,
|
|
5466
5981
|
fontSize: external_prop_types_default.a.number,
|
|
@@ -5499,22 +6014,24 @@ var SingleValueBasic_Text = external_styled_components_default.a.div.withConfig(
|
|
|
5499
6014
|
}, singleValueUtils["DEFAULT_FONT_FAMILY"], function (props) {
|
|
5500
6015
|
return props.size || 12;
|
|
5501
6016
|
});
|
|
6017
|
+
|
|
5502
6018
|
var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
5503
6019
|
var props = extends_default()({}, _ref);
|
|
6020
|
+
|
|
5504
6021
|
var majorColor = props.majorColor,
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
6022
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
6023
|
+
majorText = props.majorText,
|
|
6024
|
+
majorValueTitle = props.majorValueTitle,
|
|
6025
|
+
trendColor = props.trendColor,
|
|
6026
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
6027
|
+
trendText = props.trendText,
|
|
6028
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
6029
|
+
unit = props.unit,
|
|
6030
|
+
unitPosition = props.unitPosition,
|
|
6031
|
+
underLabel = props.underLabel,
|
|
6032
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
6033
|
+
underLabelColor = props.underLabelColor,
|
|
6034
|
+
onValueClick = props.onValueClick;
|
|
5518
6035
|
var trendIndicatorEnabled = trendText !== '' && showTrendIndicator;
|
|
5519
6036
|
return /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Column, null, /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Row, {
|
|
5520
6037
|
align: "baseline"
|
|
@@ -5527,7 +6044,8 @@ var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
|
5527
6044
|
value: majorText,
|
|
5528
6045
|
title: majorValueTitle,
|
|
5529
6046
|
onValueClick: onValueClick
|
|
5530
|
-
}), trendIndicatorEnabled &&
|
|
6047
|
+
}), trendIndicatorEnabled &&
|
|
6048
|
+
/*#__PURE__*/
|
|
5531
6049
|
// Passing the same value for value and text is a temporary hold until completion of https://jira.splunk.com/browse/SCP-21371
|
|
5532
6050
|
external_react_default.a.createElement(TrendValue, {
|
|
5533
6051
|
"data-test": "TrendIndicator",
|
|
@@ -5543,6 +6061,7 @@ var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
|
5543
6061
|
color: underLabelColor
|
|
5544
6062
|
}, underLabel)));
|
|
5545
6063
|
};
|
|
6064
|
+
|
|
5546
6065
|
SingleValueBasic_SingleValueBasic.propTypes = {
|
|
5547
6066
|
majorText: external_prop_types_default.a.string,
|
|
5548
6067
|
majorColor: external_prop_types_default.a.string,
|
|
@@ -5571,28 +6090,28 @@ module.exports = require("@babel/runtime/helpers/typeof");
|
|
|
5571
6090
|
|
|
5572
6091
|
/***/ }),
|
|
5573
6092
|
|
|
5574
|
-
/***/
|
|
6093
|
+
/***/ 84:
|
|
5575
6094
|
/***/ (function(module, exports) {
|
|
5576
6095
|
|
|
5577
6096
|
module.exports = require("@splunk/visualizations-shared/trellisUtils");
|
|
5578
6097
|
|
|
5579
6098
|
/***/ }),
|
|
5580
6099
|
|
|
5581
|
-
/***/
|
|
6100
|
+
/***/ 85:
|
|
5582
6101
|
/***/ (function(module, exports) {
|
|
5583
6102
|
|
|
5584
6103
|
module.exports = require("@splunk/react-icons/enterprise/ArrowUp");
|
|
5585
6104
|
|
|
5586
6105
|
/***/ }),
|
|
5587
6106
|
|
|
5588
|
-
/***/
|
|
6107
|
+
/***/ 86:
|
|
5589
6108
|
/***/ (function(module, exports) {
|
|
5590
6109
|
|
|
5591
6110
|
module.exports = require("@splunk/react-icons/enterprise/ArrowDown");
|
|
5592
6111
|
|
|
5593
6112
|
/***/ }),
|
|
5594
6113
|
|
|
5595
|
-
/***/
|
|
6114
|
+
/***/ 87:
|
|
5596
6115
|
/***/ (function(module, exports) {
|
|
5597
6116
|
|
|
5598
6117
|
module.exports = require("cssesc");
|
|
@@ -5606,7 +6125,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
5606
6125
|
|
|
5607
6126
|
/***/ }),
|
|
5608
6127
|
|
|
5609
|
-
/***/
|
|
6128
|
+
/***/ 91:
|
|
5610
6129
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5611
6130
|
|
|
5612
6131
|
"use strict";
|
|
@@ -5630,7 +6149,7 @@ var StaticBackgroundColorEditor = {
|
|
|
5630
6149
|
|
|
5631
6150
|
/***/ }),
|
|
5632
6151
|
|
|
5633
|
-
/***/
|
|
6152
|
+
/***/ 94:
|
|
5634
6153
|
/***/ (function(module, exports) {
|
|
5635
6154
|
|
|
5636
6155
|
module.exports = require("@splunk/react-ui/Paginator");
|
|
@@ -5644,10 +6163,12 @@ module.exports = require("@splunk/react-ui/Paginator");
|
|
|
5644
6163
|
|
|
5645
6164
|
|
|
5646
6165
|
var _typeof = __webpack_require__(82);
|
|
6166
|
+
|
|
5647
6167
|
Object.defineProperty(exports, "__esModule", {
|
|
5648
6168
|
value: true
|
|
5649
6169
|
});
|
|
5650
6170
|
exports.getFormattedGaugeRanges = exports.getSortedGaugeRanges = exports.getGaugeStrokeWidth = exports.getLabelFontSize = exports.getVerticalLabelOffset = exports.computeTextWidth = exports.getProgressWidth = exports.validateGaugeRanges = exports.getGaugeRange = void 0;
|
|
6171
|
+
|
|
5651
6172
|
var displayUtils_1 = __webpack_require__(80);
|
|
5652
6173
|
/**
|
|
5653
6174
|
* Figure out what range the major value lies in
|
|
@@ -5656,15 +6177,19 @@ var displayUtils_1 = __webpack_require__(80);
|
|
|
5656
6177
|
* @param {Number} majorValue
|
|
5657
6178
|
* @returns {Number} index of range that the major value lies in
|
|
5658
6179
|
*/
|
|
6180
|
+
|
|
6181
|
+
|
|
5659
6182
|
var getGaugeRange = function getGaugeRange(formattedGaugeRanges, majorValue) {
|
|
5660
6183
|
if (typeof majorValue !== 'number') {
|
|
5661
6184
|
return -1;
|
|
5662
6185
|
}
|
|
6186
|
+
|
|
5663
6187
|
var numRanges = formattedGaugeRanges.length;
|
|
5664
6188
|
return formattedGaugeRanges.findIndex(function (r, i) {
|
|
5665
6189
|
return i === numRanges - 1 && r.from <= majorValue || r.from <= majorValue && majorValue < r.to;
|
|
5666
6190
|
});
|
|
5667
6191
|
};
|
|
6192
|
+
|
|
5668
6193
|
exports.getGaugeRange = getGaugeRange;
|
|
5669
6194
|
/**
|
|
5670
6195
|
* Validate gauge ranges object
|
|
@@ -5672,30 +6197,39 @@ exports.getGaugeRange = getGaugeRange;
|
|
|
5672
6197
|
* @param {Array} gaugeRanges unformatted, open gauge ranges
|
|
5673
6198
|
* @returns {boolean} whether gauge ranges object is valid
|
|
5674
6199
|
*/
|
|
6200
|
+
|
|
5675
6201
|
var validateGaugeRanges = function validateGaugeRanges(gaugeRanges) {
|
|
5676
6202
|
if (!gaugeRanges || !Array.isArray(gaugeRanges) || gaugeRanges.length < 2) {
|
|
5677
6203
|
return false;
|
|
5678
6204
|
}
|
|
6205
|
+
|
|
5679
6206
|
for (var i = 0; i < gaugeRanges.length; i += 1) {
|
|
5680
6207
|
var range = gaugeRanges[i];
|
|
6208
|
+
|
|
5681
6209
|
if (!range || _typeof(range) !== 'object') {
|
|
5682
6210
|
return false;
|
|
5683
6211
|
}
|
|
6212
|
+
|
|
5684
6213
|
if (i === 0 && (Object.keys(range).includes('from') || !Object.keys(range).includes('to') || typeof range.to !== 'number')) {
|
|
5685
6214
|
return false;
|
|
5686
6215
|
}
|
|
6216
|
+
|
|
5687
6217
|
if (i === gaugeRanges.length - 1 && (Object.keys(range).includes('to') || !Object.keys(range).includes('from') || typeof range.from !== 'number')) {
|
|
5688
6218
|
return false;
|
|
5689
6219
|
}
|
|
6220
|
+
|
|
5690
6221
|
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
6222
|
return false;
|
|
5692
6223
|
}
|
|
6224
|
+
|
|
5693
6225
|
if (!Object.keys(range).includes('value') || typeof range.value !== 'string') {
|
|
5694
6226
|
return false;
|
|
5695
6227
|
}
|
|
5696
6228
|
}
|
|
6229
|
+
|
|
5697
6230
|
return true;
|
|
5698
6231
|
};
|
|
6232
|
+
|
|
5699
6233
|
exports.validateGaugeRanges = validateGaugeRanges;
|
|
5700
6234
|
/**
|
|
5701
6235
|
* Return progress width
|
|
@@ -5706,12 +6240,14 @@ exports.validateGaugeRanges = validateGaugeRanges;
|
|
|
5706
6240
|
* @param {Number} circumference
|
|
5707
6241
|
* @returns {Number} progress width of radial
|
|
5708
6242
|
*/
|
|
6243
|
+
|
|
5709
6244
|
var getProgressWidth = function getProgressWidth(value, minValue, maxValue, circumference) {
|
|
5710
6245
|
var progress = (0, displayUtils_1.getRadialProgress)(value, minValue, maxValue);
|
|
5711
6246
|
var progress50 = progress / 100 * 50;
|
|
5712
6247
|
var progressWidth = progress50 / 100 * circumference;
|
|
5713
6248
|
return progressWidth;
|
|
5714
6249
|
};
|
|
6250
|
+
|
|
5715
6251
|
exports.getProgressWidth = getProgressWidth;
|
|
5716
6252
|
/**
|
|
5717
6253
|
* Return text width
|
|
@@ -5720,6 +6256,7 @@ exports.getProgressWidth = getProgressWidth;
|
|
|
5720
6256
|
* @param {String} font
|
|
5721
6257
|
* @returns {Number} width of text with font
|
|
5722
6258
|
*/
|
|
6259
|
+
|
|
5723
6260
|
var computeTextWidth = function computeTextWidth(text, font) {
|
|
5724
6261
|
var canvas = document.createElement('canvas');
|
|
5725
6262
|
var context = canvas.getContext('2d');
|
|
@@ -5727,6 +6264,7 @@ var computeTextWidth = function computeTextWidth(text, font) {
|
|
|
5727
6264
|
var measure = context.measureText(text);
|
|
5728
6265
|
return measure.width;
|
|
5729
6266
|
};
|
|
6267
|
+
|
|
5730
6268
|
exports.computeTextWidth = computeTextWidth;
|
|
5731
6269
|
/**
|
|
5732
6270
|
* Return vertical offset of label
|
|
@@ -5736,12 +6274,15 @@ exports.computeTextWidth = computeTextWidth;
|
|
|
5736
6274
|
* @param {Number} maxOffset
|
|
5737
6275
|
* @returns {Number} vertical offset of label
|
|
5738
6276
|
*/
|
|
6277
|
+
|
|
5739
6278
|
var getVerticalLabelOffset = function getVerticalLabelOffset(theta, textHeight, maxOffset) {
|
|
5740
6279
|
if (theta > 90) {
|
|
5741
6280
|
return (-(maxOffset / 90) * (180 - theta) + maxOffset) * textHeight;
|
|
5742
6281
|
}
|
|
6282
|
+
|
|
5743
6283
|
return (-(maxOffset / 90) * theta + maxOffset) * textHeight;
|
|
5744
6284
|
};
|
|
6285
|
+
|
|
5745
6286
|
exports.getVerticalLabelOffset = getVerticalLabelOffset;
|
|
5746
6287
|
/**
|
|
5747
6288
|
* Returns font size of label
|
|
@@ -5750,19 +6291,24 @@ exports.getVerticalLabelOffset = getVerticalLabelOffset;
|
|
|
5750
6291
|
* @param {Number} showRadialGraph
|
|
5751
6292
|
* @returns {Number} font size of label
|
|
5752
6293
|
*/
|
|
6294
|
+
|
|
5753
6295
|
var getLabelFontSize = function getLabelFontSize(height, showRadialGraph) {
|
|
5754
6296
|
var strokeWidth = (0, exports.getGaugeStrokeWidth)(height);
|
|
6297
|
+
|
|
5755
6298
|
var _ref = (0, displayUtils_1.getRadialHelperDimensions)({
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
6299
|
+
height: height,
|
|
6300
|
+
strokeWidth: strokeWidth
|
|
6301
|
+
}),
|
|
6302
|
+
semicircleRadius = _ref.semicircleRadius,
|
|
6303
|
+
helperArcRadius = _ref.helperArcRadius; // Two cases for removing the labels:
|
|
5761
6304
|
// 1. the semicircle radius is insufficiently sized for text
|
|
5762
6305
|
// 2. the radial visualization has been disabled (first condition reached first when making smaller).
|
|
6306
|
+
|
|
6307
|
+
|
|
5763
6308
|
var fillVacantSpace = semicircleRadius < 50 || !showRadialGraph;
|
|
5764
6309
|
return fillVacantSpace ? 0 : Math.min(helperArcRadius * 0.08, 16);
|
|
5765
6310
|
};
|
|
6311
|
+
|
|
5766
6312
|
exports.getLabelFontSize = getLabelFontSize;
|
|
5767
6313
|
/**
|
|
5768
6314
|
* Returns radial gauge's stroke width
|
|
@@ -5770,9 +6316,11 @@ exports.getLabelFontSize = getLabelFontSize;
|
|
|
5770
6316
|
* @param {Number} height
|
|
5771
6317
|
* @returns {Number} radial gauge's stroke width
|
|
5772
6318
|
*/
|
|
6319
|
+
|
|
5773
6320
|
var getGaugeStrokeWidth = function getGaugeStrokeWidth(height) {
|
|
5774
6321
|
return height >= 225 ? 30 : 16;
|
|
5775
6322
|
};
|
|
6323
|
+
|
|
5776
6324
|
exports.getGaugeStrokeWidth = getGaugeStrokeWidth;
|
|
5777
6325
|
/**
|
|
5778
6326
|
* sort the ranges in ascending order
|
|
@@ -5780,6 +6328,7 @@ exports.getGaugeStrokeWidth = getGaugeStrokeWidth;
|
|
|
5780
6328
|
* @param {Array} gaugeRanges
|
|
5781
6329
|
* @return {Array} sortedRanges
|
|
5782
6330
|
*/
|
|
6331
|
+
|
|
5783
6332
|
var getSortedGaugeRanges = function getSortedGaugeRanges(gaugeRanges) {
|
|
5784
6333
|
gaugeRanges.sort(function (a, b) {
|
|
5785
6334
|
if (a.to == null) return 1;
|
|
@@ -5788,6 +6337,7 @@ var getSortedGaugeRanges = function getSortedGaugeRanges(gaugeRanges) {
|
|
|
5788
6337
|
});
|
|
5789
6338
|
return gaugeRanges;
|
|
5790
6339
|
};
|
|
6340
|
+
|
|
5791
6341
|
exports.getSortedGaugeRanges = getSortedGaugeRanges;
|
|
5792
6342
|
/**
|
|
5793
6343
|
* format the ranges
|
|
@@ -5797,6 +6347,7 @@ exports.getSortedGaugeRanges = getSortedGaugeRanges;
|
|
|
5797
6347
|
* @param {number} maxValue
|
|
5798
6348
|
* @return {Array} formatted, bounded gauge ranges
|
|
5799
6349
|
*/
|
|
6350
|
+
|
|
5800
6351
|
var getFormattedGaugeRanges = function getFormattedGaugeRanges(gaugeRanges, minValue, maxValue) {
|
|
5801
6352
|
var formattedGaugeRanges = [];
|
|
5802
6353
|
gaugeRanges.forEach(function (range, index) {
|
|
@@ -5806,30 +6357,39 @@ var getFormattedGaugeRanges = function getFormattedGaugeRanges(gaugeRanges, minV
|
|
|
5806
6357
|
to: range.to,
|
|
5807
6358
|
value: range.value
|
|
5808
6359
|
};
|
|
6360
|
+
|
|
5809
6361
|
if (maxValue < range.to) {
|
|
5810
6362
|
newRange.to = maxValue;
|
|
5811
6363
|
}
|
|
6364
|
+
|
|
5812
6365
|
formattedGaugeRanges.push(newRange);
|
|
5813
6366
|
}
|
|
6367
|
+
|
|
5814
6368
|
if (index === gaugeRanges.length - 1 && maxValue > range.from) {
|
|
5815
6369
|
var _newRange = {
|
|
5816
6370
|
from: range.from,
|
|
5817
6371
|
to: maxValue,
|
|
5818
6372
|
value: range.value
|
|
5819
6373
|
};
|
|
6374
|
+
|
|
5820
6375
|
if (minValue > range.from) {
|
|
5821
6376
|
_newRange.from = minValue;
|
|
5822
6377
|
}
|
|
6378
|
+
|
|
5823
6379
|
formattedGaugeRanges.push(_newRange);
|
|
5824
6380
|
}
|
|
6381
|
+
|
|
5825
6382
|
if (Object.keys(range).includes('from') && Object.keys(range).includes('to')) {
|
|
5826
6383
|
var _newRange2 = Object.assign({}, range);
|
|
6384
|
+
|
|
5827
6385
|
if (minValue > range.from && minValue < range.to) {
|
|
5828
6386
|
_newRange2.from = minValue;
|
|
5829
6387
|
}
|
|
6388
|
+
|
|
5830
6389
|
if (maxValue > range.from && maxValue < range.to) {
|
|
5831
6390
|
_newRange2.to = maxValue;
|
|
5832
6391
|
}
|
|
6392
|
+
|
|
5833
6393
|
if (minValue < range.to && maxValue > range.from) {
|
|
5834
6394
|
formattedGaugeRanges.push(_newRange2);
|
|
5835
6395
|
}
|
|
@@ -5837,6 +6397,7 @@ var getFormattedGaugeRanges = function getFormattedGaugeRanges(gaugeRanges, minV
|
|
|
5837
6397
|
});
|
|
5838
6398
|
return formattedGaugeRanges;
|
|
5839
6399
|
};
|
|
6400
|
+
|
|
5840
6401
|
exports.getFormattedGaugeRanges = getFormattedGaugeRanges;
|
|
5841
6402
|
|
|
5842
6403
|
/***/ })
|