@splunk/visualizations 26.0.0 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
package/SingleValueIcon.js
CHANGED
|
@@ -127,7 +127,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
127
127
|
|
|
128
128
|
var getDynamicTrendColorEditor = function getDynamicTrendColorEditor(_ref) {
|
|
129
129
|
var defaultContext = _ref.defaultContext,
|
|
130
|
-
|
|
130
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
131
131
|
return {
|
|
132
132
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Trend value'),
|
|
133
133
|
option: 'trendColor',
|
|
@@ -172,7 +172,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
172
172
|
|
|
173
173
|
var getDynamicBackgroundColorEditor = function getDynamicBackgroundColorEditor(_ref) {
|
|
174
174
|
var defaultContext = _ref.defaultContext,
|
|
175
|
-
|
|
175
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
176
176
|
return {
|
|
177
177
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background'),
|
|
178
178
|
option: 'backgroundColor',
|
|
@@ -326,11 +326,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
326
326
|
value: true
|
|
327
327
|
});
|
|
328
328
|
exports.TrellisBackgroundColorEditor = exports.TrellisEditorConfig = void 0;
|
|
329
|
+
|
|
329
330
|
var React = __webpack_require__(1);
|
|
331
|
+
|
|
330
332
|
var i18n_1 = __webpack_require__(2);
|
|
333
|
+
|
|
331
334
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
335
|
+
|
|
332
336
|
var layoutUtils_1 = __webpack_require__(58);
|
|
333
337
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
338
|
+
|
|
339
|
+
|
|
334
340
|
exports.TrellisEditorConfig = [[{
|
|
335
341
|
label: (0, i18n_1._)('Trellis layout'),
|
|
336
342
|
option: 'splitByLayout',
|
|
@@ -428,37 +434,60 @@ exports.TrellisBackgroundColorEditor = {
|
|
|
428
434
|
|
|
429
435
|
|
|
430
436
|
var _slicedToArray = __webpack_require__(17);
|
|
437
|
+
|
|
431
438
|
var __rest = this && this.__rest || function (s, e) {
|
|
432
439
|
var t = {};
|
|
440
|
+
|
|
433
441
|
for (var p in s) {
|
|
434
442
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
435
443
|
}
|
|
444
|
+
|
|
436
445
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
437
446
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
438
447
|
}
|
|
439
448
|
return t;
|
|
440
449
|
};
|
|
450
|
+
|
|
441
451
|
Object.defineProperty(exports, "__esModule", {
|
|
442
452
|
value: true
|
|
443
453
|
});
|
|
454
|
+
|
|
444
455
|
var React = __webpack_require__(1);
|
|
456
|
+
|
|
445
457
|
var react_1 = __webpack_require__(1);
|
|
458
|
+
|
|
446
459
|
var lodash_1 = __webpack_require__(3);
|
|
460
|
+
|
|
447
461
|
var styled_components_1 = __webpack_require__(4);
|
|
448
|
-
|
|
462
|
+
|
|
463
|
+
var Paginator_1 = __webpack_require__(94);
|
|
464
|
+
|
|
449
465
|
var i18n_1 = __webpack_require__(2);
|
|
466
|
+
|
|
450
467
|
var themes_1 = __webpack_require__(60);
|
|
468
|
+
|
|
451
469
|
var useSplunkTheme_1 = __webpack_require__(57);
|
|
470
|
+
|
|
452
471
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
472
|
+
|
|
453
473
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
474
|
+
|
|
454
475
|
var style_1 = __webpack_require__(14);
|
|
476
|
+
|
|
455
477
|
var Message_1 = __webpack_require__(10);
|
|
456
|
-
|
|
478
|
+
|
|
479
|
+
var trellisUtils_1 = __webpack_require__(84);
|
|
480
|
+
|
|
457
481
|
var hocUtils_1 = __webpack_require__(27);
|
|
482
|
+
|
|
458
483
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
484
|
+
|
|
459
485
|
var Options_1 = __webpack_require__(30);
|
|
486
|
+
|
|
460
487
|
var trellisUtils_2 = __webpack_require__(107);
|
|
488
|
+
|
|
461
489
|
var layoutUtils_1 = __webpack_require__(58);
|
|
490
|
+
|
|
462
491
|
var TrellisContainer = styled_components_1.default.div.withConfig({
|
|
463
492
|
displayName: "withTrellis__TrellisContainer",
|
|
464
493
|
componentId: "pjmeig-0"
|
|
@@ -479,6 +508,7 @@ var TrellisContainerGrid = styled_components_1.default.div.withConfig({
|
|
|
479
508
|
}, function (props) {
|
|
480
509
|
return "".concat(props.rowHeight, "px");
|
|
481
510
|
});
|
|
511
|
+
|
|
482
512
|
var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
483
513
|
if (errorCode === 'INVALID_SPLIT_BY_FIELD') {
|
|
484
514
|
return React.createElement(Message_1.default, {
|
|
@@ -488,6 +518,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
488
518
|
level: "info"
|
|
489
519
|
});
|
|
490
520
|
}
|
|
521
|
+
|
|
491
522
|
if (errorCode === 'UNKNOWN_DATA_SPLIT_MODE') {
|
|
492
523
|
return React.createElement(Message_1.default, {
|
|
493
524
|
width: width,
|
|
@@ -496,6 +527,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
496
527
|
level: "info"
|
|
497
528
|
});
|
|
498
529
|
}
|
|
530
|
+
|
|
499
531
|
return React.createElement(Message_1.default, {
|
|
500
532
|
width: width,
|
|
501
533
|
height: height,
|
|
@@ -503,33 +535,38 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
503
535
|
level: "info"
|
|
504
536
|
});
|
|
505
537
|
};
|
|
538
|
+
|
|
506
539
|
var withTrellis = function withTrellis(Viz) {
|
|
507
540
|
var VizWithTrellis = function VizWithTrellis(opts) {
|
|
508
541
|
var _opts$options = opts.options,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
542
|
+
options = _opts$options === void 0 ? {} : _opts$options,
|
|
543
|
+
height = opts.height,
|
|
544
|
+
width = opts.width,
|
|
545
|
+
otherProps = __rest(opts, ["options", "height", "width"]);
|
|
546
|
+
|
|
513
547
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(Viz.config.optionsSchema, 'default');
|
|
514
548
|
var mergedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
|
|
515
549
|
var trellisColumns = mergedOptions.trellisColumns,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
550
|
+
trellisPageCount = mergedOptions.trellisPageCount,
|
|
551
|
+
trellisMinColumnWidth = mergedOptions.trellisMinColumnWidth,
|
|
552
|
+
trellisRowHeight = mergedOptions.trellisRowHeight,
|
|
553
|
+
splitByLayout = mergedOptions.splitByLayout,
|
|
554
|
+
trellisSplitBy = mergedOptions.trellisSplitBy;
|
|
521
555
|
var colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
|
|
522
556
|
var pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
|
|
523
557
|
var colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
|
|
524
558
|
var rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
|
|
559
|
+
|
|
525
560
|
var _ref = (0, react_1.useState)(1),
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
561
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
562
|
+
pageNum = _ref2[0],
|
|
563
|
+
setPageNum = _ref2[1];
|
|
564
|
+
|
|
529
565
|
var _ref3 = (0, react_1.useState)(null),
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
566
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
567
|
+
pagedData = _ref4[0],
|
|
568
|
+
setPagedData = _ref4[1];
|
|
569
|
+
|
|
533
570
|
var splitByKeys = [];
|
|
534
571
|
var totalPages = 0;
|
|
535
572
|
var showPaginator = false;
|
|
@@ -537,21 +574,25 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
537
574
|
var theme = {
|
|
538
575
|
splunkThemeV1: (0, useSplunkTheme_1.default)()
|
|
539
576
|
};
|
|
577
|
+
|
|
540
578
|
var _ref5 = (0, themes_1.getSettingsFromThemedProps)({
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
579
|
+
theme: theme
|
|
580
|
+
}),
|
|
581
|
+
currentThemeFamily = _ref5.family,
|
|
582
|
+
currentThemeColorScheme = _ref5.colorScheme,
|
|
583
|
+
currentThemeDensity = _ref5.density;
|
|
584
|
+
|
|
546
585
|
var trellisBackgroundColor = (0, react_1.useMemo)(function () {
|
|
547
586
|
var themeFunc = function themeFunc(themeVar) {
|
|
548
587
|
var _a, _b;
|
|
588
|
+
|
|
549
589
|
return (_b = (_a = Viz.config.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
550
590
|
trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
|
|
551
591
|
theme: theme
|
|
552
592
|
});
|
|
553
|
-
};
|
|
554
|
-
|
|
593
|
+
}; // trellisBackgroundColor option supports only static coloring and DSL option evaluation derived from the themes level only.
|
|
594
|
+
|
|
595
|
+
|
|
555
596
|
var evaluated = Options_1.Options.evaluate({
|
|
556
597
|
context: Viz.config.context,
|
|
557
598
|
options: {
|
|
@@ -564,6 +605,7 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
564
605
|
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields', undefined);
|
|
565
606
|
var noColumns = columns === undefined;
|
|
566
607
|
var noFields = fields === undefined;
|
|
608
|
+
|
|
567
609
|
var updateDataDisplay = function updateDataDisplay(currPage) {
|
|
568
610
|
if (!showPaginator) {
|
|
569
611
|
setPagedData(splitByKeys);
|
|
@@ -574,6 +616,7 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
574
616
|
setPagedData(paged);
|
|
575
617
|
}
|
|
576
618
|
};
|
|
619
|
+
|
|
577
620
|
(0, react_1.useEffect)(function () {
|
|
578
621
|
setPageNum(1);
|
|
579
622
|
updateDataDisplay(1);
|
|
@@ -587,9 +630,11 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
587
630
|
}, [pageNum, pagedData]);
|
|
588
631
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
589
632
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
633
|
+
|
|
590
634
|
if (!isTrellisFeatureFlagOn || !splitByLayout || splitByLayout !== layoutUtils_1.LAYOUT_TYPE.Trellis) {
|
|
591
635
|
return React.createElement(Viz, Object.assign({}, opts));
|
|
592
636
|
}
|
|
637
|
+
|
|
593
638
|
if (splitByLayout === layoutUtils_1.LAYOUT_TYPE.Trellis) {
|
|
594
639
|
if (noColumns || noFields) {
|
|
595
640
|
return React.createElement(Message_1.default, {
|
|
@@ -598,27 +643,34 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
598
643
|
message: (0, i18n_1._)('Loading'),
|
|
599
644
|
level: "info"
|
|
600
645
|
});
|
|
601
|
-
}
|
|
602
|
-
// If no trellisSplitBy value is passed in, assign default trellisSplitBy
|
|
646
|
+
} // If no trellisSplitBy value is passed in, assign default trellisSplitBy
|
|
603
647
|
// The default value will be the first value in the individual splitBy field list or 'aggregations'
|
|
648
|
+
|
|
649
|
+
|
|
604
650
|
var currTrellisSplitBy = trellisSplitBy;
|
|
651
|
+
|
|
605
652
|
if (!trellisSplitBy || trellisSplitBy.length === 0) {
|
|
606
653
|
var splitByPossibleFields = (0, trellisUtils_1.getAllPossibleSplitByFields)(fields);
|
|
607
654
|
currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : trellisUtils_2.AGGREGATIONS;
|
|
608
655
|
}
|
|
656
|
+
|
|
609
657
|
var splitMode = (0, trellisUtils_1.getTrellisDataSplitterMode)(fields);
|
|
610
658
|
var dataSplitResult = (0, trellisUtils_2.getTrellisDataSourcesBySplitMode)(splitMode, dataSources, currTrellisSplitBy);
|
|
611
659
|
var modifiedDataSourceBySplitBy = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.splitDataSources;
|
|
612
660
|
var dataSplitErrorCode = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.errorCode;
|
|
661
|
+
|
|
613
662
|
if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
|
|
614
663
|
return showErrorMessage(dataSplitErrorCode, width, height);
|
|
615
664
|
}
|
|
665
|
+
|
|
616
666
|
var splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
|
|
667
|
+
|
|
617
668
|
if (splitByKeysModified) {
|
|
618
669
|
showPaginator = splitByKeysModified.length > pageCount;
|
|
619
670
|
splitByKeys = splitByKeysModified;
|
|
620
671
|
totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
|
|
621
672
|
}
|
|
673
|
+
|
|
622
674
|
return React.createElement(TrellisContainer, {
|
|
623
675
|
height: height,
|
|
624
676
|
width: width,
|
|
@@ -635,8 +687,8 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
635
687
|
key: "div-child-".concat(idx.toString())
|
|
636
688
|
}, React.createElement(SizeAwareWrapper_1.default, null, function (_ref7) {
|
|
637
689
|
var childWidth = _ref7.childWidth,
|
|
638
|
-
|
|
639
|
-
|
|
690
|
+
_ref7$childHeight = _ref7.childHeight,
|
|
691
|
+
childHeight = _ref7$childHeight === void 0 ? rowHeight : _ref7$childHeight;
|
|
640
692
|
return React.createElement(Viz, Object.assign({}, otherProps, {
|
|
641
693
|
trellisKey: splitByKey,
|
|
642
694
|
trellisSplitBy: currTrellisSplitBy,
|
|
@@ -654,13 +706,16 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
654
706
|
totalPages: totalPages
|
|
655
707
|
}));
|
|
656
708
|
}
|
|
709
|
+
|
|
657
710
|
return null;
|
|
658
711
|
};
|
|
712
|
+
|
|
659
713
|
VizWithTrellis.propTypes = Viz.proptypes;
|
|
660
714
|
VizWithTrellis.defaultProps = Viz.defaultProps;
|
|
661
715
|
VizWithTrellis.config = Viz.config;
|
|
662
716
|
return VizWithTrellis;
|
|
663
717
|
};
|
|
718
|
+
|
|
664
719
|
exports.default = withTrellis;
|
|
665
720
|
|
|
666
721
|
/***/ }),
|
|
@@ -672,12 +727,16 @@ exports.default = withTrellis;
|
|
|
672
727
|
|
|
673
728
|
|
|
674
729
|
var _toConsumableArray = __webpack_require__(8);
|
|
730
|
+
|
|
675
731
|
Object.defineProperty(exports, "__esModule", {
|
|
676
732
|
value: true
|
|
677
733
|
});
|
|
678
734
|
exports.getTrellisDataSourcesBySplitMode = exports.dataSourcesSplitByModeStatsorUnknown = exports.dataSourcesSplitByModeChart = exports.dataSourcesSplitByModeTimechart = exports.dataSourcesSplitByAggregationsStats = exports.dataSourcesSplitByAggregationsTimechartAndChart = exports.dataSourcesSplitByAggregationsUnknown = exports.AGGREGATIONS = void 0;
|
|
735
|
+
|
|
679
736
|
var lodash_1 = __webpack_require__(3);
|
|
680
|
-
|
|
737
|
+
|
|
738
|
+
var trellisUtils_1 = __webpack_require__(84);
|
|
739
|
+
|
|
681
740
|
exports.AGGREGATIONS = 'aggregations';
|
|
682
741
|
/**
|
|
683
742
|
* There can be certain SPL cmds that can produce dataSource without a specific field meta info (like group_by_rank, split_by_field etc),
|
|
@@ -687,16 +746,21 @@ exports.AGGREGATIONS = 'aggregations';
|
|
|
687
746
|
* Example3:- `index = "_internal" | stats count`
|
|
688
747
|
* Example4:- `index=_internal | stats avg(count), max(count)`
|
|
689
748
|
*/
|
|
749
|
+
|
|
690
750
|
var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregationsUnknown(dataSource) {
|
|
691
751
|
var _a, _b, _c, _d;
|
|
752
|
+
|
|
692
753
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
693
754
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
694
755
|
var splitDataSources = null;
|
|
695
756
|
var errorCode = null;
|
|
757
|
+
|
|
696
758
|
if (fields && fields.length) {
|
|
697
759
|
splitDataSources = {};
|
|
760
|
+
|
|
698
761
|
for (var i = 0; i < fields.length; i += 1) {
|
|
699
762
|
var fieldName = fields[i].name;
|
|
763
|
+
|
|
700
764
|
if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
|
|
701
765
|
splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
702
766
|
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
@@ -706,22 +770,28 @@ var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregati
|
|
|
706
770
|
} else {
|
|
707
771
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
708
772
|
}
|
|
773
|
+
|
|
709
774
|
return {
|
|
710
775
|
splitDataSources: splitDataSources,
|
|
711
776
|
errorCode: errorCode
|
|
712
777
|
};
|
|
713
778
|
};
|
|
779
|
+
|
|
714
780
|
exports.dataSourcesSplitByAggregationsUnknown = dataSourcesSplitByAggregationsUnknown;
|
|
781
|
+
|
|
715
782
|
var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitByAggregationsTimechartAndChart(dataSource) {
|
|
716
783
|
var _a, _b, _c, _d;
|
|
784
|
+
|
|
717
785
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
718
786
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
719
787
|
var splitDataSources = null;
|
|
720
788
|
var splitByFields = [];
|
|
721
789
|
var errorCode = null;
|
|
790
|
+
|
|
722
791
|
if (typeof fields[0] !== 'string') {
|
|
723
792
|
splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
724
793
|
}
|
|
794
|
+
|
|
725
795
|
if (splitByFields && splitByFields.length > 0) {
|
|
726
796
|
splitDataSources = {};
|
|
727
797
|
splitByFields.forEach(function (splitByField) {
|
|
@@ -730,6 +800,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
730
800
|
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
731
801
|
fields.forEach(function (field, idx) {
|
|
732
802
|
var fieldName = field === null || field === void 0 ? void 0 : field.name;
|
|
803
|
+
|
|
733
804
|
if (fieldName !== '_time' && !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_')) && field.data_source === splitByField) {
|
|
734
805
|
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
735
806
|
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
@@ -741,8 +812,10 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
741
812
|
// example1 :- index=_internal | timechart count
|
|
742
813
|
// example2 :- index=_internal | timechart max(count) avg(count)
|
|
743
814
|
splitDataSources = {};
|
|
815
|
+
|
|
744
816
|
for (var i = 1; i < fields.length; i += 1) {
|
|
745
817
|
var fieldName = fields[i].name;
|
|
818
|
+
|
|
746
819
|
if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
|
|
747
820
|
splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
748
821
|
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
@@ -752,22 +825,28 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
752
825
|
} else {
|
|
753
826
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
754
827
|
}
|
|
828
|
+
|
|
755
829
|
return {
|
|
756
830
|
splitDataSources: splitDataSources,
|
|
757
831
|
errorCode: errorCode
|
|
758
832
|
};
|
|
759
833
|
};
|
|
834
|
+
|
|
760
835
|
exports.dataSourcesSplitByAggregationsTimechartAndChart = dataSourcesSplitByAggregationsTimechartAndChart;
|
|
836
|
+
|
|
761
837
|
var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregationsStats(dataSource) {
|
|
762
838
|
var _a, _b, _c, _d;
|
|
839
|
+
|
|
763
840
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
764
841
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
765
842
|
var splitDataSources = null;
|
|
766
843
|
var splitByFields = [];
|
|
767
844
|
var errorCode = null;
|
|
845
|
+
|
|
768
846
|
if (typeof fields[0] !== 'string') {
|
|
769
847
|
splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysStats)(fields);
|
|
770
848
|
}
|
|
849
|
+
|
|
771
850
|
if (splitByFields && splitByFields.length > 0) {
|
|
772
851
|
splitDataSources = {};
|
|
773
852
|
splitByFields.forEach(function (splitByField) {
|
|
@@ -777,6 +856,7 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
|
|
|
777
856
|
var idx = fields.findIndex(function (field) {
|
|
778
857
|
return field.name === splitByField;
|
|
779
858
|
});
|
|
859
|
+
|
|
780
860
|
if (idx > 0) {
|
|
781
861
|
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
782
862
|
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
@@ -785,32 +865,40 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
|
|
|
785
865
|
} else {
|
|
786
866
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
787
867
|
}
|
|
868
|
+
|
|
788
869
|
return {
|
|
789
870
|
splitDataSources: splitDataSources,
|
|
790
871
|
errorCode: errorCode
|
|
791
872
|
};
|
|
792
873
|
};
|
|
874
|
+
|
|
793
875
|
exports.dataSourcesSplitByAggregationsStats = dataSourcesSplitByAggregationsStats;
|
|
876
|
+
|
|
794
877
|
var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(dataSource, splitBy) {
|
|
795
878
|
var _a, _b, _c, _d, _e;
|
|
879
|
+
|
|
796
880
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
797
881
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
798
882
|
var splitDataSources = null;
|
|
799
883
|
var splitByFields = [];
|
|
800
884
|
var errorCode = null;
|
|
885
|
+
|
|
801
886
|
if (typeof fields[0] !== 'string') {
|
|
802
887
|
splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
|
|
803
888
|
}
|
|
889
|
+
|
|
804
890
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
805
891
|
splitDataSources = {};
|
|
806
892
|
var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
807
893
|
var valueKeys = [];
|
|
894
|
+
|
|
808
895
|
for (var i = 1; i < fields.length; i += 1) {
|
|
809
896
|
// not including internal fields
|
|
810
897
|
if (!((_e = fields[i].name) === null || _e === void 0 ? void 0 : _e.startsWith('_'))) {
|
|
811
898
|
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
812
899
|
}
|
|
813
900
|
}
|
|
901
|
+
|
|
814
902
|
valueKeys.forEach(function (val) {
|
|
815
903
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
816
904
|
splitDataSources[val].primary.data.fields = [{
|
|
@@ -832,22 +920,28 @@ var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(d
|
|
|
832
920
|
} else {
|
|
833
921
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
834
922
|
}
|
|
923
|
+
|
|
835
924
|
return {
|
|
836
925
|
splitDataSources: splitDataSources,
|
|
837
926
|
errorCode: errorCode
|
|
838
927
|
};
|
|
839
928
|
};
|
|
929
|
+
|
|
840
930
|
exports.dataSourcesSplitByModeTimechart = dataSourcesSplitByModeTimechart;
|
|
931
|
+
|
|
841
932
|
var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSource, splitBy) {
|
|
842
933
|
var _a, _b, _c, _d;
|
|
934
|
+
|
|
843
935
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
844
936
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
845
937
|
var splitDataSources = null;
|
|
846
938
|
var splitByFields = [];
|
|
847
939
|
var errorCode = null;
|
|
940
|
+
|
|
848
941
|
if (typeof fields[0] !== 'string') {
|
|
849
942
|
splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
|
|
850
943
|
}
|
|
944
|
+
|
|
851
945
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
852
946
|
splitDataSources = {};
|
|
853
947
|
var splitByFieldIdx = splitByFields.findIndex(function (f) {
|
|
@@ -858,6 +952,7 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
858
952
|
});
|
|
859
953
|
var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
860
954
|
var nonDataSourceAggregations = [];
|
|
955
|
+
|
|
861
956
|
if (!dataSourceKeys.length && fields[0].groupby_rank === '0' && fields.length && !fields[1].groupby_rank) {
|
|
862
957
|
/* check for another aggregation scenario where no key 'data_source' will be returned (applies for both chart and stats cmd)
|
|
863
958
|
For example :-
|
|
@@ -882,12 +977,14 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
882
977
|
nonDataSourceAggregations.push(fields[i].name);
|
|
883
978
|
}
|
|
884
979
|
}
|
|
980
|
+
|
|
885
981
|
if (splitByFieldIdx === 0) {
|
|
886
982
|
// if splitBy is the first field, split row wise
|
|
887
983
|
var valueKeys = (0, lodash_1.cloneDeep)(columns[0]);
|
|
888
984
|
valueKeys.forEach(function (val, idx) {
|
|
889
985
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
890
986
|
splitDataSources[val].primary.data.fields = [];
|
|
987
|
+
|
|
891
988
|
if (otherSplitBy.length) {
|
|
892
989
|
splitDataSources[val].primary.data.fields = [{
|
|
893
990
|
name: otherSplitBy[0]
|
|
@@ -959,16 +1056,20 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
959
1056
|
columnValues[1] = ['1','10','100']
|
|
960
1057
|
columnValues[2] = ['5', '50', '500']
|
|
961
1058
|
*/
|
|
1059
|
+
|
|
962
1060
|
var _loop = function _loop(_i) {
|
|
963
1061
|
columnValues[0].push(fields[_i].splitby_value ? fields[_i].splitby_value : fields[_i].name);
|
|
964
1062
|
dataSourceKeys.forEach(function (dskey, dsIndx) {
|
|
965
1063
|
var mul = (fields.length - 1) / dataSourceKeys.length; // This line does the index calculation
|
|
1064
|
+
|
|
966
1065
|
columnValues[dsIndx + 1].push(columns[_i + dsIndx * mul][idx]);
|
|
967
1066
|
});
|
|
968
1067
|
};
|
|
1068
|
+
|
|
969
1069
|
for (var _i = 1; _i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); _i += 1) {
|
|
970
1070
|
_loop(_i);
|
|
971
1071
|
}
|
|
1072
|
+
|
|
972
1073
|
splitDataSources[val].primary.data.columns = columnValues;
|
|
973
1074
|
})();
|
|
974
1075
|
} else if (nonDataSourceAggregations.length) {
|
|
@@ -990,9 +1091,11 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
990
1091
|
} else {
|
|
991
1092
|
// split column wise
|
|
992
1093
|
var _valueKeys = [];
|
|
1094
|
+
|
|
993
1095
|
for (var _i2 = 1; _i2 < fields.length; _i2 += 1) {
|
|
994
1096
|
_valueKeys.push(fields[_i2].splitby_value ? fields[_i2].splitby_value : fields[_i2].name);
|
|
995
1097
|
}
|
|
1098
|
+
|
|
996
1099
|
_valueKeys.forEach(function (val) {
|
|
997
1100
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
998
1101
|
splitDataSources[val].primary.data.fields = [{
|
|
@@ -1015,29 +1118,36 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
1015
1118
|
} else {
|
|
1016
1119
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
1017
1120
|
}
|
|
1121
|
+
|
|
1018
1122
|
return {
|
|
1019
1123
|
splitDataSources: splitDataSources,
|
|
1020
1124
|
errorCode: errorCode
|
|
1021
1125
|
};
|
|
1022
1126
|
};
|
|
1127
|
+
|
|
1023
1128
|
exports.dataSourcesSplitByModeChart = dataSourcesSplitByModeChart;
|
|
1024
1129
|
/**
|
|
1025
1130
|
* This method does datasplitting for 'stats' and generic cmds('makeresults','table' etc - categoried as 'unknown' splitMode).
|
|
1026
1131
|
* The main difference is for 'stats' cmd possible splitBy fields have 'group_by_rank' in field meta info, whereas for 'unknown' cmd it can be any fieldnames
|
|
1027
1132
|
*/
|
|
1133
|
+
|
|
1028
1134
|
var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatsorUnknown(dataSource, splitBy, splitMode) {
|
|
1029
1135
|
var _a, _b, _c, _d, _e, _f;
|
|
1136
|
+
|
|
1030
1137
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
1031
1138
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
1032
1139
|
var splitDataSources = null;
|
|
1033
1140
|
var splitByFields = [];
|
|
1034
1141
|
var errorCode = null;
|
|
1142
|
+
|
|
1035
1143
|
if (typeof fields[0] !== 'string') {
|
|
1036
1144
|
splitByFields = splitMode !== trellisUtils_1.UNKNOWN ? (0, trellisUtils_1.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_1.extractSplitByFieldsForUnknown)(fields);
|
|
1037
1145
|
}
|
|
1146
|
+
|
|
1038
1147
|
var splitByIndex = fields === null || fields === void 0 ? void 0 : fields.findIndex(function (field) {
|
|
1039
1148
|
return field === splitBy || field.name === splitBy;
|
|
1040
1149
|
});
|
|
1150
|
+
|
|
1041
1151
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
1042
1152
|
var splitByColumn = (_f = (_e = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.columns[splitByIndex];
|
|
1043
1153
|
splitDataSources = {};
|
|
@@ -1068,14 +1178,18 @@ var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatso
|
|
|
1068
1178
|
} else {
|
|
1069
1179
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
1070
1180
|
}
|
|
1181
|
+
|
|
1071
1182
|
return {
|
|
1072
1183
|
splitDataSources: splitDataSources,
|
|
1073
1184
|
errorCode: errorCode
|
|
1074
1185
|
};
|
|
1075
1186
|
};
|
|
1187
|
+
|
|
1076
1188
|
exports.dataSourcesSplitByModeStatsorUnknown = dataSourcesSplitByModeStatsorUnknown;
|
|
1189
|
+
|
|
1077
1190
|
var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode(splitMode, dataSources, trellisSplitBy) {
|
|
1078
1191
|
var result = null;
|
|
1192
|
+
|
|
1079
1193
|
try {
|
|
1080
1194
|
if (splitMode === trellisUtils_1.TIMECHART) {
|
|
1081
1195
|
result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsTimechartAndChart)(dataSources) : (0, exports.dataSourcesSplitByModeTimechart)(dataSources, trellisSplitBy);
|
|
@@ -1093,8 +1207,10 @@ var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode
|
|
|
1093
1207
|
errorCode: 'UNKNOWN'
|
|
1094
1208
|
};
|
|
1095
1209
|
}
|
|
1210
|
+
|
|
1096
1211
|
return result;
|
|
1097
1212
|
};
|
|
1213
|
+
|
|
1098
1214
|
exports.getTrellisDataSourcesBySplitMode = getTrellisDataSourcesBySplitMode;
|
|
1099
1215
|
|
|
1100
1216
|
/***/ }),
|
|
@@ -1136,11 +1252,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
1136
1252
|
Object.defineProperty(exports, "__esModule", {
|
|
1137
1253
|
value: true
|
|
1138
1254
|
});
|
|
1255
|
+
|
|
1139
1256
|
var React = __webpack_require__(1);
|
|
1257
|
+
|
|
1140
1258
|
var styled_components_1 = __webpack_require__(4);
|
|
1259
|
+
|
|
1141
1260
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
1261
|
+
|
|
1142
1262
|
var style_1 = __webpack_require__(14);
|
|
1263
|
+
|
|
1143
1264
|
var colorUtils_1 = __webpack_require__(12);
|
|
1265
|
+
|
|
1144
1266
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
1145
1267
|
var width = _ref.width;
|
|
1146
1268
|
return {
|
|
@@ -1153,11 +1275,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
1153
1275
|
componentId: "sc-1yhgpod-0"
|
|
1154
1276
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
1155
1277
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
1156
|
-
});
|
|
1157
|
-
|
|
1278
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
1279
|
+
|
|
1158
1280
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
1159
1281
|
var width = _ref2.width,
|
|
1160
|
-
|
|
1282
|
+
height = _ref2.height;
|
|
1161
1283
|
return {
|
|
1162
1284
|
style: Object.assign(Object.assign({}, width && {
|
|
1163
1285
|
width: (0, style_1.toPx)(width)
|
|
@@ -1179,11 +1301,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
1179
1301
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
1180
1302
|
componentId: "sc-1yhgpod-3"
|
|
1181
1303
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
1304
|
+
|
|
1182
1305
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
1183
1306
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
1184
1307
|
var width = props.width,
|
|
1185
|
-
|
|
1186
|
-
|
|
1308
|
+
height = props.height,
|
|
1309
|
+
backgroundColor = props.backgroundColor;
|
|
1310
|
+
|
|
1187
1311
|
if (!height) {
|
|
1188
1312
|
return React.createElement(Item, {
|
|
1189
1313
|
"data-test": "item",
|
|
@@ -1191,24 +1315,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
1191
1315
|
backgroundColor: backgroundColor
|
|
1192
1316
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
1193
1317
|
}
|
|
1318
|
+
|
|
1194
1319
|
return React.createElement(FixSizeItem, {
|
|
1195
1320
|
"data-test": "fix-size-item",
|
|
1196
|
-
"data-splunk-visualization-version": "26.
|
|
1321
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
1197
1322
|
width: width,
|
|
1198
1323
|
height: height,
|
|
1199
1324
|
backgroundColor: backgroundColor
|
|
1200
1325
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
1201
1326
|
var newWidth = _ref3.width,
|
|
1202
|
-
|
|
1327
|
+
newHeight = _ref3.height;
|
|
1203
1328
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
1204
1329
|
width: newWidth,
|
|
1205
1330
|
height: newHeight
|
|
1206
1331
|
}));
|
|
1207
1332
|
})));
|
|
1208
1333
|
};
|
|
1334
|
+
|
|
1209
1335
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
1210
1336
|
return FixedSizeContainer;
|
|
1211
1337
|
};
|
|
1338
|
+
|
|
1212
1339
|
exports.default = withFixedSizeContainer;
|
|
1213
1340
|
|
|
1214
1341
|
/***/ }),
|
|
@@ -1272,7 +1399,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1272
1399
|
|
|
1273
1400
|
var getDynamicMajorColorEditor = function getDynamicMajorColorEditor(_ref) {
|
|
1274
1401
|
var defaultContext = _ref.defaultContext,
|
|
1275
|
-
|
|
1402
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
1276
1403
|
return {
|
|
1277
1404
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Major value'),
|
|
1278
1405
|
option: 'majorColor',
|
|
@@ -1339,9 +1466,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
1339
1466
|
* @param {DashboardVizType} props.Wrapper
|
|
1340
1467
|
* @param {DashboardVizType} props.Visualization
|
|
1341
1468
|
*/
|
|
1469
|
+
|
|
1342
1470
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
1343
1471
|
var Wrapper = _ref.Wrapper,
|
|
1344
|
-
|
|
1472
|
+
Visualization = _ref.Visualization;
|
|
1345
1473
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
1346
1474
|
extendProperties.forEach(function (prop) {
|
|
1347
1475
|
if (Visualization[prop]) {
|
|
@@ -1350,6 +1478,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
1350
1478
|
}
|
|
1351
1479
|
});
|
|
1352
1480
|
};
|
|
1481
|
+
|
|
1353
1482
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
1354
1483
|
|
|
1355
1484
|
/***/ }),
|
|
@@ -1431,24 +1560,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
1431
1560
|
|
|
1432
1561
|
|
|
1433
1562
|
var _toConsumableArray = __webpack_require__(8);
|
|
1563
|
+
|
|
1434
1564
|
var _defineProperty = __webpack_require__(7);
|
|
1565
|
+
|
|
1435
1566
|
var __rest = this && this.__rest || function (s, e) {
|
|
1436
1567
|
var t = {};
|
|
1568
|
+
|
|
1437
1569
|
for (var p in s) {
|
|
1438
1570
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1439
1571
|
}
|
|
1572
|
+
|
|
1440
1573
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1441
1574
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1442
1575
|
}
|
|
1443
1576
|
return t;
|
|
1444
1577
|
};
|
|
1578
|
+
|
|
1445
1579
|
Object.defineProperty(exports, "__esModule", {
|
|
1446
1580
|
value: true
|
|
1447
1581
|
});
|
|
1448
1582
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
1583
|
+
|
|
1449
1584
|
var lodash_1 = __webpack_require__(3);
|
|
1585
|
+
|
|
1450
1586
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1587
|
+
|
|
1451
1588
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1589
|
+
|
|
1452
1590
|
var dynamicOptionsDSLType = {
|
|
1453
1591
|
type: 'string',
|
|
1454
1592
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -1458,20 +1596,22 @@ var dynamicOptionsDSLType = {
|
|
|
1458
1596
|
* @param optionsSchema a visualization's options schema
|
|
1459
1597
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
1460
1598
|
*/
|
|
1599
|
+
|
|
1461
1600
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
1462
1601
|
var enhancedOptionsSchema = {};
|
|
1463
1602
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
1464
1603
|
var _a = optionsSchema[key],
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1604
|
+
title = _a.title,
|
|
1605
|
+
description = _a.description,
|
|
1606
|
+
readOnly = _a.readOnly,
|
|
1607
|
+
writeOnly = _a.writeOnly,
|
|
1608
|
+
examples = _a.examples,
|
|
1609
|
+
defaultValue = _a.default,
|
|
1610
|
+
type = _a.type,
|
|
1611
|
+
properties = _a.properties,
|
|
1612
|
+
patternProperties = _a.patternProperties,
|
|
1613
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
1614
|
+
|
|
1475
1615
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
1476
1616
|
title: title
|
|
1477
1617
|
}), description !== undefined && {
|
|
@@ -1485,12 +1625,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1485
1625
|
}), defaultValue !== undefined && {
|
|
1486
1626
|
default: defaultValue
|
|
1487
1627
|
});
|
|
1628
|
+
|
|
1488
1629
|
if (type === 'object') {
|
|
1489
1630
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
1490
1631
|
type: type
|
|
1491
1632
|
}), properties && {
|
|
1492
1633
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
1493
1634
|
});
|
|
1635
|
+
|
|
1494
1636
|
if (patternProperties) {
|
|
1495
1637
|
var enhancedPatternProperties = {};
|
|
1496
1638
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -1508,6 +1650,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1508
1650
|
});
|
|
1509
1651
|
return enhancedOptionsSchema;
|
|
1510
1652
|
}
|
|
1653
|
+
|
|
1511
1654
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
1512
1655
|
/**
|
|
1513
1656
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -1516,11 +1659,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
1516
1659
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
1517
1660
|
* and containing `open: false` for all editor panels in editorConfig
|
|
1518
1661
|
*/
|
|
1662
|
+
|
|
1519
1663
|
function enhanceConfig(vizConfig) {
|
|
1520
1664
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
1665
|
+
|
|
1521
1666
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
1522
1667
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
1523
1668
|
}
|
|
1669
|
+
|
|
1524
1670
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
1525
1671
|
return Object.assign(Object.assign({}, config), {
|
|
1526
1672
|
open: config.open || false
|
|
@@ -1528,6 +1674,7 @@ function enhanceConfig(vizConfig) {
|
|
|
1528
1674
|
});
|
|
1529
1675
|
return enhancedConfig;
|
|
1530
1676
|
}
|
|
1677
|
+
|
|
1531
1678
|
exports.enhanceConfig = enhanceConfig;
|
|
1532
1679
|
/**
|
|
1533
1680
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -1535,6 +1682,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
1535
1682
|
* @param vizConfig a Visualization Config
|
|
1536
1683
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
1537
1684
|
*/
|
|
1685
|
+
|
|
1538
1686
|
function uncollapseEditorConfig(vizConfig) {
|
|
1539
1687
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
1540
1688
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -1544,13 +1692,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
1544
1692
|
});
|
|
1545
1693
|
return editorPanelUncollapsedConfig;
|
|
1546
1694
|
}
|
|
1695
|
+
|
|
1547
1696
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
1697
|
+
|
|
1548
1698
|
function isDynamicOption(option) {
|
|
1549
1699
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
1550
1700
|
}
|
|
1551
|
-
|
|
1552
|
-
// private helpers to improve readability of getInitialPreset
|
|
1701
|
+
|
|
1702
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
1553
1703
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
1704
|
+
|
|
1554
1705
|
/**
|
|
1555
1706
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
1556
1707
|
* 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
|
|
@@ -1559,6 +1710,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
1559
1710
|
*
|
|
1560
1711
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
1561
1712
|
*/
|
|
1713
|
+
|
|
1562
1714
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
1563
1715
|
var presetContextKeys = Object.keys(presetContext);
|
|
1564
1716
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -1568,6 +1720,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
1568
1720
|
/**
|
|
1569
1721
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
1570
1722
|
*/
|
|
1723
|
+
|
|
1724
|
+
|
|
1571
1725
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
1572
1726
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
1573
1727
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -1582,18 +1736,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
1582
1736
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
1583
1737
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
1584
1738
|
*/
|
|
1739
|
+
|
|
1740
|
+
|
|
1585
1741
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
1586
1742
|
return presets.find(function (preset) {
|
|
1587
1743
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
1588
1744
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
1589
1745
|
var presetContextKeys = Object.keys(presetContext);
|
|
1590
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
1591
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1746
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1592
1747
|
// if not, then the preset is invalid in config.ts
|
|
1748
|
+
|
|
1593
1749
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
1594
1750
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
1595
1751
|
});
|
|
1596
1752
|
}
|
|
1753
|
+
|
|
1597
1754
|
exports.getInitialPreset = getInitialPreset;
|
|
1598
1755
|
/**
|
|
1599
1756
|
* generates number precision values for a Select editor
|
|
@@ -1601,6 +1758,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
1601
1758
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
1602
1759
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
1603
1760
|
*/
|
|
1761
|
+
|
|
1604
1762
|
function generatePrecisionValues(numPrecisionValues) {
|
|
1605
1763
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
1606
1764
|
return {
|
|
@@ -1609,6 +1767,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
1609
1767
|
};
|
|
1610
1768
|
});
|
|
1611
1769
|
}
|
|
1770
|
+
|
|
1612
1771
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
1613
1772
|
/**
|
|
1614
1773
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -1618,12 +1777,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
1618
1777
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
1619
1778
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
1620
1779
|
*/
|
|
1780
|
+
|
|
1621
1781
|
var insertLayout = function insertLayout(layout, index) {
|
|
1622
1782
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1623
1783
|
layoutItems[_key - 2] = arguments[_key];
|
|
1624
1784
|
}
|
|
1785
|
+
|
|
1625
1786
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
1626
1787
|
};
|
|
1788
|
+
|
|
1627
1789
|
exports.insertLayout = insertLayout;
|
|
1628
1790
|
|
|
1629
1791
|
/***/ }),
|
|
@@ -1697,25 +1859,38 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1697
1859
|
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(49);
|
|
1698
1860
|
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
|
|
1699
1861
|
|
|
1862
|
+
|
|
1700
1863
|
function ownKeys(object, enumerableOnly) {
|
|
1701
1864
|
var keys = Object.keys(object);
|
|
1865
|
+
|
|
1702
1866
|
if (Object.getOwnPropertySymbols) {
|
|
1703
1867
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
1704
|
-
enumerableOnly
|
|
1868
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
1705
1869
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1706
|
-
})
|
|
1870
|
+
});
|
|
1871
|
+
keys.push.apply(keys, symbols);
|
|
1707
1872
|
}
|
|
1873
|
+
|
|
1708
1874
|
return keys;
|
|
1709
1875
|
}
|
|
1876
|
+
|
|
1710
1877
|
function _objectSpread(target) {
|
|
1711
1878
|
for (var i = 1; i < arguments.length; i++) {
|
|
1712
|
-
var source =
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1879
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1880
|
+
|
|
1881
|
+
if (i % 2) {
|
|
1882
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
1883
|
+
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
|
|
1884
|
+
});
|
|
1885
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
1886
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1887
|
+
} else {
|
|
1888
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
1889
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1718
1892
|
}
|
|
1893
|
+
|
|
1719
1894
|
return target;
|
|
1720
1895
|
}
|
|
1721
1896
|
|
|
@@ -1723,6 +1898,7 @@ function _objectSpread(target) {
|
|
|
1723
1898
|
|
|
1724
1899
|
|
|
1725
1900
|
|
|
1901
|
+
|
|
1726
1902
|
var DEFAULT_FONT = 12;
|
|
1727
1903
|
var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
|
|
1728
1904
|
var SVR_PADDING = {
|
|
@@ -1731,28 +1907,27 @@ var SVR_PADDING = {
|
|
|
1731
1907
|
left: 16,
|
|
1732
1908
|
right: 16
|
|
1733
1909
|
};
|
|
1734
|
-
|
|
1735
1910
|
/**
|
|
1736
1911
|
* @method shouldShowTrend
|
|
1737
1912
|
* @param {String} trendDisplay
|
|
1738
1913
|
* @returns {Bool}
|
|
1739
1914
|
*/
|
|
1915
|
+
|
|
1740
1916
|
var shouldShowTrend = function shouldShowTrend(trendDisplay) {
|
|
1741
1917
|
return trendDisplay === 'absolute' || trendDisplay === 'percent';
|
|
1742
1918
|
};
|
|
1743
|
-
|
|
1744
1919
|
/**
|
|
1745
1920
|
* @method isLoadingOrNoColumns
|
|
1746
1921
|
* @param {Object} dataSources
|
|
1747
1922
|
* @param {Boolean} loading
|
|
1748
1923
|
* @returns {Boolean} return true if loading or without columns in dataSources
|
|
1749
1924
|
*/
|
|
1925
|
+
|
|
1750
1926
|
var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
1751
1927
|
var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
|
|
1752
1928
|
var noColumns = data === undefined;
|
|
1753
1929
|
return loading || noColumns;
|
|
1754
1930
|
};
|
|
1755
|
-
|
|
1756
1931
|
/**
|
|
1757
1932
|
* Retrieve the valid formatted color
|
|
1758
1933
|
* @method getFormattedColor
|
|
@@ -1760,30 +1935,30 @@ var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
|
1760
1935
|
* @param {String} defaultColor
|
|
1761
1936
|
* @returns {String} the formatted color
|
|
1762
1937
|
*/
|
|
1938
|
+
|
|
1763
1939
|
var getFormattedColor = function getFormattedColor(color, defaultColor) {
|
|
1764
1940
|
return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
|
|
1765
1941
|
};
|
|
1766
|
-
|
|
1767
1942
|
/**
|
|
1768
1943
|
* Determines if there is a background color
|
|
1769
1944
|
* @method hasBackground
|
|
1770
1945
|
* @param {String} backgroundColor
|
|
1771
1946
|
* @returns true for non-transparent background color
|
|
1772
1947
|
*/
|
|
1948
|
+
|
|
1773
1949
|
var hasBackground = function hasBackground(backgroundColor) {
|
|
1774
1950
|
return !!backgroundColor && backgroundColor !== 'transparent';
|
|
1775
1951
|
};
|
|
1776
|
-
|
|
1777
1952
|
/**
|
|
1778
1953
|
* @method isIdenticalColor
|
|
1779
1954
|
* @param {String} colorA
|
|
1780
1955
|
* @param {String} colorB
|
|
1781
1956
|
* @returns {Boolean}
|
|
1782
1957
|
*/
|
|
1958
|
+
|
|
1783
1959
|
var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
1784
1960
|
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());
|
|
1785
1961
|
};
|
|
1786
|
-
|
|
1787
1962
|
/*
|
|
1788
1963
|
* @method getDefaultColorWithBg
|
|
1789
1964
|
* @param {Object} props
|
|
@@ -1792,13 +1967,13 @@ var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
|
1792
1967
|
* @param {String} props.defaultBlockFontColor
|
|
1793
1968
|
* @returns {String} defaultColor
|
|
1794
1969
|
*/
|
|
1970
|
+
|
|
1795
1971
|
var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
1796
1972
|
var backgroundColor = _ref.backgroundColor,
|
|
1797
|
-
|
|
1798
|
-
|
|
1973
|
+
defaultFontColor = _ref.defaultFontColor,
|
|
1974
|
+
defaultBlockFontColor = _ref.defaultBlockFontColor;
|
|
1799
1975
|
return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
|
|
1800
1976
|
};
|
|
1801
|
-
|
|
1802
1977
|
/*
|
|
1803
1978
|
* @method getMajorColor
|
|
1804
1979
|
* return formatted majorColor.
|
|
@@ -1809,15 +1984,16 @@ var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
|
1809
1984
|
* @param {String} props.defaultBlockFontColor
|
|
1810
1985
|
* @returns {String} majorColor
|
|
1811
1986
|
*/
|
|
1987
|
+
|
|
1812
1988
|
var getMajorColor = function getMajorColor(_ref2) {
|
|
1813
1989
|
var majorColor = _ref2.majorColor,
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
// If backgroundColor is set, but no majorColor,
|
|
1990
|
+
backgroundColor = _ref2.backgroundColor,
|
|
1991
|
+
defaultFontColor = _ref2.defaultFontColor,
|
|
1992
|
+
defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
|
|
1818
1993
|
// the default majorColor will turn to be defaultBlockFontColor.
|
|
1819
1994
|
// eg: major color will turn to be white in enterprise mode.
|
|
1820
1995
|
// however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
|
|
1996
|
+
|
|
1821
1997
|
if (hasBackground(backgroundColor) && !majorColor) {
|
|
1822
1998
|
return getDefaultColorWithBg({
|
|
1823
1999
|
backgroundColor: backgroundColor,
|
|
@@ -1825,9 +2001,9 @@ var getMajorColor = function getMajorColor(_ref2) {
|
|
|
1825
2001
|
defaultBlockFontColor: defaultBlockFontColor
|
|
1826
2002
|
});
|
|
1827
2003
|
}
|
|
2004
|
+
|
|
1828
2005
|
return getFormattedColor(majorColor, defaultFontColor);
|
|
1829
2006
|
};
|
|
1830
|
-
|
|
1831
2007
|
/**
|
|
1832
2008
|
* Get the color for the trend components
|
|
1833
2009
|
* @method getTrendColor
|
|
@@ -1840,35 +2016,41 @@ var getMajorColor = function getMajorColor(_ref2) {
|
|
|
1840
2016
|
* @param {Object} defaultColors
|
|
1841
2017
|
* @returns {String} trendColor
|
|
1842
2018
|
*/
|
|
2019
|
+
|
|
1843
2020
|
var getTrendColor = function getTrendColor(_ref3) {
|
|
1844
2021
|
var trendColor = _ref3.trendColor,
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
2022
|
+
trendValue = _ref3.trendValue,
|
|
2023
|
+
majorValue = _ref3.majorValue,
|
|
2024
|
+
customizedBgColor = _ref3.customizedBgColor,
|
|
2025
|
+
trendDisplay = _ref3.trendDisplay,
|
|
2026
|
+
defaultColors = _ref3.defaultColors;
|
|
2027
|
+
|
|
1850
2028
|
if (trendColor) {
|
|
1851
2029
|
return trendColor;
|
|
1852
2030
|
}
|
|
2031
|
+
|
|
1853
2032
|
if (Number.isNaN(Number(trendValue))) {
|
|
1854
2033
|
return undefined;
|
|
1855
2034
|
}
|
|
2035
|
+
|
|
1856
2036
|
var defaultFontColor = defaultColors.defaultFontColor,
|
|
1857
|
-
|
|
1858
|
-
|
|
2037
|
+
defaultBlockFontColor = defaultColors.defaultBlockFontColor,
|
|
2038
|
+
defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
|
|
2039
|
+
|
|
1859
2040
|
if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
|
|
1860
2041
|
return defaultBlockFontColor;
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
|
-
// if trendDisplay is percent, and trendValue === value
|
|
2042
|
+
} // if trendDisplay is percent, and trendValue === value
|
|
1864
2043
|
// the trend percent = trendValue / (value - trendValue) will return Infinity
|
|
2044
|
+
|
|
2045
|
+
|
|
1865
2046
|
var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
|
|
2047
|
+
|
|
1866
2048
|
if (trendValue === 0 || isInvalidTrend) {
|
|
1867
2049
|
return defaultFontColor;
|
|
1868
2050
|
}
|
|
2051
|
+
|
|
1869
2052
|
return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
|
|
1870
2053
|
};
|
|
1871
|
-
|
|
1872
2054
|
/**
|
|
1873
2055
|
* Computes visualization properties for display component
|
|
1874
2056
|
* @method computeColors
|
|
@@ -1881,6 +2063,7 @@ var getTrendColor = function getTrendColor(_ref3) {
|
|
|
1881
2063
|
* @returns {String} trendColor
|
|
1882
2064
|
* @returns {String} underLabelColor
|
|
1883
2065
|
*/
|
|
2066
|
+
|
|
1884
2067
|
var computeColors = function computeColors(props, defaultColors) {
|
|
1885
2068
|
var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
|
|
1886
2069
|
var backgroundEnabled = hasBackground(backgroundColor);
|
|
@@ -1897,8 +2080,8 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
1897
2080
|
customizedBgColor: props.backgroundColor,
|
|
1898
2081
|
trendDisplay: props.trendDisplay,
|
|
1899
2082
|
defaultColors: defaultColors
|
|
1900
|
-
});
|
|
1901
|
-
|
|
2083
|
+
}); // todo: need change it to not depend on majorColor
|
|
2084
|
+
|
|
1902
2085
|
var underLabelColor = majorColor;
|
|
1903
2086
|
return {
|
|
1904
2087
|
backgroundColor: backgroundColor,
|
|
@@ -1908,7 +2091,6 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
1908
2091
|
underLabelColor: underLabelColor
|
|
1909
2092
|
};
|
|
1910
2093
|
};
|
|
1911
|
-
|
|
1912
2094
|
/**
|
|
1913
2095
|
* Format and return the value (major/trend)
|
|
1914
2096
|
* @method computeText
|
|
@@ -1919,21 +2101,21 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
1919
2101
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
1920
2102
|
* @returns {Number} major or trend text
|
|
1921
2103
|
*/
|
|
2104
|
+
|
|
1922
2105
|
var computeText = function computeText(_ref4) {
|
|
1923
2106
|
var value = _ref4.value,
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
2107
|
+
numberPrecision = _ref4.numberPrecision,
|
|
2108
|
+
shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
|
|
2109
|
+
shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
|
|
1927
2110
|
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, {
|
|
1928
2111
|
useThousandSeparators: shouldUseThousandSeparators,
|
|
1929
2112
|
// todo: need update formatNumber
|
|
1930
2113
|
useTrendUnits: shouldAbbreviateTrendValue
|
|
1931
|
-
}) : value;
|
|
1932
|
-
|
|
2114
|
+
}) : value; // When text is undefined, return empty string
|
|
2115
|
+
|
|
1933
2116
|
text = text || '';
|
|
1934
2117
|
return text;
|
|
1935
2118
|
};
|
|
1936
|
-
|
|
1937
2119
|
/*
|
|
1938
2120
|
* @method getMajorText
|
|
1939
2121
|
* @param {Object} props
|
|
@@ -1942,10 +2124,11 @@ var computeText = function computeText(_ref4) {
|
|
|
1942
2124
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
1943
2125
|
* @returns {String} majorText
|
|
1944
2126
|
*/
|
|
2127
|
+
|
|
1945
2128
|
var getMajorText = function getMajorText(_ref5) {
|
|
1946
2129
|
var majorValue = _ref5.majorValue,
|
|
1947
|
-
|
|
1948
|
-
|
|
2130
|
+
numberPrecision = _ref5.numberPrecision,
|
|
2131
|
+
shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
|
|
1949
2132
|
return computeText({
|
|
1950
2133
|
value: majorValue === null ? 'N/A' : majorValue,
|
|
1951
2134
|
// if majorValue is null, use `N/A`.
|
|
@@ -1954,7 +2137,6 @@ var getMajorText = function getMajorText(_ref5) {
|
|
|
1954
2137
|
shouldAbbreviateTrendValue: false
|
|
1955
2138
|
});
|
|
1956
2139
|
};
|
|
1957
|
-
|
|
1958
2140
|
/*
|
|
1959
2141
|
* @method getTrendText
|
|
1960
2142
|
* @param {Object} props
|
|
@@ -1966,13 +2148,15 @@ var getMajorText = function getMajorText(_ref5) {
|
|
|
1966
2148
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
1967
2149
|
* @returns {String} trendText
|
|
1968
2150
|
*/
|
|
2151
|
+
|
|
1969
2152
|
var getTrendText = function getTrendText(_ref6) {
|
|
1970
2153
|
var majorValue = _ref6.majorValue,
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2154
|
+
trendValue = _ref6.trendValue,
|
|
2155
|
+
trendDisplay = _ref6.trendDisplay,
|
|
2156
|
+
numberPrecision = _ref6.numberPrecision,
|
|
2157
|
+
shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
|
|
2158
|
+
shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
|
|
2159
|
+
|
|
1976
2160
|
var compute = function compute(value) {
|
|
1977
2161
|
return computeText({
|
|
1978
2162
|
value: value,
|
|
@@ -1981,25 +2165,31 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
1981
2165
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1982
2166
|
});
|
|
1983
2167
|
};
|
|
2168
|
+
|
|
1984
2169
|
if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
|
|
1985
2170
|
return '';
|
|
1986
2171
|
}
|
|
2172
|
+
|
|
1987
2173
|
var showPercent = trendDisplay === 'percent';
|
|
2174
|
+
|
|
1988
2175
|
if (!showPercent) {
|
|
1989
2176
|
return compute(trendValue);
|
|
1990
2177
|
}
|
|
2178
|
+
|
|
1991
2179
|
var diff = Math.abs(trendValue - majorValue);
|
|
1992
2180
|
var val = Math.round(trendValue / diff * 100);
|
|
2181
|
+
|
|
1993
2182
|
if (trendValue === 0 && diff === 0) {
|
|
1994
2183
|
val = 0;
|
|
1995
2184
|
}
|
|
2185
|
+
|
|
1996
2186
|
if (!Number.isFinite(val)) {
|
|
1997
2187
|
return 'N/A';
|
|
1998
2188
|
}
|
|
2189
|
+
|
|
1999
2190
|
var text = compute(val);
|
|
2000
2191
|
return "".concat(text, "%");
|
|
2001
2192
|
};
|
|
2002
|
-
|
|
2003
2193
|
/**
|
|
2004
2194
|
* Helper to determine the font size for an element
|
|
2005
2195
|
* @method computeFontSize
|
|
@@ -2011,16 +2201,16 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
2011
2201
|
* @param {String} [fontWeight='normal'] Boldness of font
|
|
2012
2202
|
* @returns {Number} The size to use for fontSize styles
|
|
2013
2203
|
*/
|
|
2204
|
+
|
|
2014
2205
|
var computeFontSize = function computeFontSize(text, _ref7) {
|
|
2015
2206
|
var width = _ref7.width,
|
|
2016
|
-
|
|
2207
|
+
height = _ref7.height;
|
|
2017
2208
|
var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
|
|
2018
2209
|
var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
|
|
2019
2210
|
var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
|
|
2020
2211
|
var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
|
|
2021
2212
|
return parseInt(fontSize, 10);
|
|
2022
2213
|
};
|
|
2023
|
-
|
|
2024
2214
|
/*
|
|
2025
2215
|
* @method getMajorFontSize
|
|
2026
2216
|
* @param {Object} props
|
|
@@ -2031,20 +2221,20 @@ var computeFontSize = function computeFontSize(text, _ref7) {
|
|
|
2031
2221
|
* @param {Number} props.spaceRatio
|
|
2032
2222
|
* @returns {Number} majorFontSize
|
|
2033
2223
|
*/
|
|
2224
|
+
|
|
2034
2225
|
var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
2035
2226
|
var width = _ref8.width,
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2227
|
+
height = _ref8.height,
|
|
2228
|
+
unit = _ref8.unit,
|
|
2229
|
+
majorText = _ref8.majorText,
|
|
2230
|
+
_ref8$spaceRatio = _ref8.spaceRatio,
|
|
2231
|
+
spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
|
|
2041
2232
|
var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
|
|
2042
2233
|
return computeFontSize(majorTextCalc, {
|
|
2043
2234
|
width: width * spaceRatio,
|
|
2044
2235
|
height: height
|
|
2045
2236
|
});
|
|
2046
2237
|
};
|
|
2047
|
-
|
|
2048
2238
|
/*
|
|
2049
2239
|
* @method getTrendFontSize
|
|
2050
2240
|
* @param {Object} props
|
|
@@ -2054,13 +2244,15 @@ var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
|
2054
2244
|
* @param {Number} props.spaceRatio
|
|
2055
2245
|
* @returns {Number} trendFontSize
|
|
2056
2246
|
*/
|
|
2247
|
+
|
|
2057
2248
|
var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
2058
2249
|
var width = _ref9.width,
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2250
|
+
height = _ref9.height,
|
|
2251
|
+
trendText = _ref9.trendText,
|
|
2252
|
+
_ref9$spaceRatio = _ref9.spaceRatio,
|
|
2253
|
+
spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
|
|
2063
2254
|
var trendFontSize = 12;
|
|
2255
|
+
|
|
2064
2256
|
if (spaceRatio > 0) {
|
|
2065
2257
|
trendFontSize = computeFontSize(trendText, {
|
|
2066
2258
|
width: width * spaceRatio,
|
|
@@ -2068,18 +2260,18 @@ var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
|
2068
2260
|
});
|
|
2069
2261
|
trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
|
|
2070
2262
|
}
|
|
2263
|
+
|
|
2071
2264
|
return trendFontSize;
|
|
2072
2265
|
};
|
|
2073
|
-
|
|
2074
2266
|
/*
|
|
2075
2267
|
* The height of underLabel should no more than 12px
|
|
2076
2268
|
* @param {Number} height
|
|
2077
2269
|
* @return {Number} height || DEFAULT_FONT
|
|
2078
2270
|
*/
|
|
2271
|
+
|
|
2079
2272
|
var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
2080
2273
|
return height > DEFAULT_FONT ? DEFAULT_FONT : height;
|
|
2081
2274
|
};
|
|
2082
|
-
|
|
2083
2275
|
/*
|
|
2084
2276
|
* @param {Object} config
|
|
2085
2277
|
* @param {String} underLabel
|
|
@@ -2087,19 +2279,18 @@ var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
|
2087
2279
|
* @param {Number} height height of underLabel
|
|
2088
2280
|
* @param {Number} fond size of underLabel
|
|
2089
2281
|
*/
|
|
2282
|
+
|
|
2090
2283
|
var getUnderLabel = function getUnderLabel(_ref10) {
|
|
2091
2284
|
var underLabel = _ref10.underLabel,
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
return (
|
|
2095
|
-
// todo: may need truncate underLabel later
|
|
2285
|
+
width = _ref10.width,
|
|
2286
|
+
height = _ref10.height;
|
|
2287
|
+
return (// todo: may need truncate underLabel later
|
|
2096
2288
|
computeFontSize(underLabel, {
|
|
2097
2289
|
width: width,
|
|
2098
2290
|
height: height
|
|
2099
2291
|
})
|
|
2100
2292
|
);
|
|
2101
2293
|
};
|
|
2102
|
-
|
|
2103
2294
|
/**
|
|
2104
2295
|
* Compute value and font size for major and trend
|
|
2105
2296
|
* @method getMajorAndTrend
|
|
@@ -2117,18 +2308,19 @@ var getUnderLabel = function getUnderLabel(_ref10) {
|
|
|
2117
2308
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
2118
2309
|
* @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
|
|
2119
2310
|
*/
|
|
2311
|
+
|
|
2120
2312
|
var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
2121
2313
|
var width = _ref11.width,
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2314
|
+
height = _ref11.height,
|
|
2315
|
+
majorValue = _ref11.majorValue,
|
|
2316
|
+
trendValue = _ref11.trendValue,
|
|
2317
|
+
majorFontSize = _ref11.majorFontSize,
|
|
2318
|
+
trendFontSize = _ref11.trendFontSize,
|
|
2319
|
+
trendDisplay = _ref11.trendDisplay,
|
|
2320
|
+
unit = _ref11.unit,
|
|
2321
|
+
numberPrecision = _ref11.numberPrecision,
|
|
2322
|
+
shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
|
|
2323
|
+
shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
|
|
2132
2324
|
var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
|
|
2133
2325
|
var textContentWidth = width * 0.9;
|
|
2134
2326
|
var textContentHeight = height * 0.9;
|
|
@@ -2165,7 +2357,6 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
2165
2357
|
trendTextFontSize: trendTextFontSize
|
|
2166
2358
|
};
|
|
2167
2359
|
};
|
|
2168
|
-
|
|
2169
2360
|
/*
|
|
2170
2361
|
* @method updateVizInSmallSpace
|
|
2171
2362
|
* @param {Object} props
|
|
@@ -2185,25 +2376,26 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
2185
2376
|
* @returns {Object} results.newMajorAndTrend
|
|
2186
2377
|
* @returns {Object} results.updatedProps
|
|
2187
2378
|
*/
|
|
2379
|
+
|
|
2188
2380
|
var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
2189
2381
|
var width = _ref12.width,
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2382
|
+
height = _ref12.height,
|
|
2383
|
+
toRemoveList = _ref12.toRemoveList,
|
|
2384
|
+
majorValue = _ref12.majorValue,
|
|
2385
|
+
trendValue = _ref12.trendValue,
|
|
2386
|
+
majorFontSize = _ref12.majorFontSize,
|
|
2387
|
+
trendFontSize = _ref12.trendFontSize,
|
|
2388
|
+
majorTextFontSize = _ref12.majorTextFontSize,
|
|
2389
|
+
unit = _ref12.unit,
|
|
2390
|
+
numberPrecision = _ref12.numberPrecision,
|
|
2391
|
+
shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
|
|
2392
|
+
shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
|
|
2201
2393
|
var removeIndex = 0;
|
|
2202
2394
|
var newProps = {}; // options need to be updated
|
|
2395
|
+
|
|
2203
2396
|
var newMajorAndTrend = {};
|
|
2204
|
-
var newTextSize = majorTextFontSize;
|
|
2397
|
+
var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
|
|
2205
2398
|
|
|
2206
|
-
// remove info on viz to make textFontSize >= 12px;
|
|
2207
2399
|
while (newTextSize < 12 && removeIndex < toRemoveList.length) {
|
|
2208
2400
|
var toRemove = toRemoveList[removeIndex];
|
|
2209
2401
|
newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
|
|
@@ -2221,9 +2413,9 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2221
2413
|
}, newProps));
|
|
2222
2414
|
newTextSize = newMajorAndTrend.majorTextFontSize;
|
|
2223
2415
|
removeIndex += 1;
|
|
2224
|
-
}
|
|
2416
|
+
} // truncate text if textFontSize is still less than 12
|
|
2417
|
+
|
|
2225
2418
|
|
|
2226
|
-
// truncate text if textFontSize is still less than 12
|
|
2227
2419
|
if (newTextSize < 12) {
|
|
2228
2420
|
var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
|
|
2229
2421
|
newMajorAndTrend = getMajorAndTrend(_objectSpread({
|
|
@@ -2239,12 +2431,12 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2239
2431
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2240
2432
|
}, newProps));
|
|
2241
2433
|
}
|
|
2434
|
+
|
|
2242
2435
|
return {
|
|
2243
2436
|
newMajorAndTrend: newMajorAndTrend,
|
|
2244
2437
|
updatedProps: newProps
|
|
2245
2438
|
};
|
|
2246
2439
|
};
|
|
2247
|
-
|
|
2248
2440
|
/*
|
|
2249
2441
|
* @method computeSingleValueContent
|
|
2250
2442
|
* @param {Object} props
|
|
@@ -2270,67 +2462,71 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2270
2462
|
* @returns {String} results.majorValueTitle
|
|
2271
2463
|
* @returns {Object} results.smallVizProps
|
|
2272
2464
|
*/
|
|
2465
|
+
|
|
2273
2466
|
var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
2274
2467
|
var contentWidth = _ref13.contentWidth,
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2468
|
+
contentHeight = _ref13.contentHeight,
|
|
2469
|
+
containerWidth = _ref13.containerWidth,
|
|
2470
|
+
containerHeight = _ref13.containerHeight,
|
|
2471
|
+
majorValue = _ref13.majorValue,
|
|
2472
|
+
trendValue = _ref13.trendValue,
|
|
2473
|
+
majorFontSize = _ref13.majorFontSize,
|
|
2474
|
+
trendFontSize = _ref13.trendFontSize,
|
|
2475
|
+
trendDisplay = _ref13.trendDisplay,
|
|
2476
|
+
unit = _ref13.unit,
|
|
2477
|
+
numberPrecision = _ref13.numberPrecision,
|
|
2478
|
+
shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
|
|
2479
|
+
shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
|
|
2480
|
+
toRemoveList = _ref13.toRemoveList;
|
|
2481
|
+
|
|
2288
2482
|
var _getMajorAndTrend = getMajorAndTrend({
|
|
2483
|
+
majorValue: majorValue,
|
|
2484
|
+
trendValue: trendValue,
|
|
2485
|
+
majorFontSize: majorFontSize,
|
|
2486
|
+
trendFontSize: trendFontSize,
|
|
2487
|
+
trendDisplay: trendDisplay,
|
|
2488
|
+
width: contentWidth,
|
|
2489
|
+
height: contentHeight,
|
|
2490
|
+
unit: unit,
|
|
2491
|
+
numberPrecision: numberPrecision,
|
|
2492
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2493
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2494
|
+
}),
|
|
2495
|
+
majorText = _getMajorAndTrend.majorText,
|
|
2496
|
+
trendText = _getMajorAndTrend.trendText,
|
|
2497
|
+
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
2498
|
+
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
2499
|
+
|
|
2500
|
+
var majorValueTitle = majorText;
|
|
2501
|
+
var smallVizProps = {}; // update viz in small space
|
|
2502
|
+
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
2503
|
+
// or truncate major value to make the major font size >= 12
|
|
2504
|
+
|
|
2505
|
+
if (majorTextFontSize < 12) {
|
|
2506
|
+
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
2507
|
+
width: containerWidth,
|
|
2508
|
+
height: containerHeight,
|
|
2509
|
+
toRemoveList: toRemoveList,
|
|
2289
2510
|
majorValue: majorValue,
|
|
2290
2511
|
trendValue: trendValue,
|
|
2291
2512
|
majorFontSize: majorFontSize,
|
|
2292
2513
|
trendFontSize: trendFontSize,
|
|
2293
|
-
|
|
2294
|
-
width: contentWidth,
|
|
2295
|
-
height: contentHeight,
|
|
2514
|
+
majorTextFontSize: majorTextFontSize,
|
|
2296
2515
|
unit: unit,
|
|
2297
2516
|
numberPrecision: numberPrecision,
|
|
2298
2517
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2299
2518
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2300
2519
|
}),
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
2304
|
-
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
2305
|
-
var majorValueTitle = majorText;
|
|
2306
|
-
var smallVizProps = {};
|
|
2520
|
+
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
2521
|
+
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
2307
2522
|
|
|
2308
|
-
// update viz in small space
|
|
2309
|
-
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
2310
|
-
// or truncate major value to make the major font size >= 12
|
|
2311
|
-
if (majorTextFontSize < 12) {
|
|
2312
|
-
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
2313
|
-
width: containerWidth,
|
|
2314
|
-
height: containerHeight,
|
|
2315
|
-
toRemoveList: toRemoveList,
|
|
2316
|
-
majorValue: majorValue,
|
|
2317
|
-
trendValue: trendValue,
|
|
2318
|
-
majorFontSize: majorFontSize,
|
|
2319
|
-
trendFontSize: trendFontSize,
|
|
2320
|
-
majorTextFontSize: majorTextFontSize,
|
|
2321
|
-
unit: unit,
|
|
2322
|
-
numberPrecision: numberPrecision,
|
|
2323
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2324
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2325
|
-
}),
|
|
2326
|
-
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
2327
|
-
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
2328
2523
|
majorText = newMajorAndTrend.majorText;
|
|
2329
2524
|
trendText = newMajorAndTrend.trendText;
|
|
2330
2525
|
majorTextFontSize = newMajorAndTrend.majorTextFontSize;
|
|
2331
2526
|
trendTextFontSize = newMajorAndTrend.trendTextFontSize;
|
|
2332
2527
|
smallVizProps = updatedProps;
|
|
2333
2528
|
}
|
|
2529
|
+
|
|
2334
2530
|
return {
|
|
2335
2531
|
majorText: majorText,
|
|
2336
2532
|
trendText: trendText,
|
|
@@ -2342,17 +2538,17 @@ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
|
2342
2538
|
};
|
|
2343
2539
|
var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
|
|
2344
2540
|
var text = _ref14.text,
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2541
|
+
_ref14$fontSize = _ref14.fontSize,
|
|
2542
|
+
fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
|
|
2543
|
+
_ref14$fontFamily = _ref14.fontFamily,
|
|
2544
|
+
fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
|
|
2545
|
+
_ref14$fontWeight = _ref14.fontWeight,
|
|
2546
|
+
fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
|
|
2547
|
+
containerWidth = _ref14.containerWidth;
|
|
2352
2548
|
var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
2353
2549
|
var modifiedText = text;
|
|
2354
|
-
var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
2355
|
-
|
|
2550
|
+
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.
|
|
2551
|
+
|
|
2356
2552
|
if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
|
|
2357
2553
|
// Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
|
|
2358
2554
|
// `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
|
|
@@ -2361,11 +2557,12 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
2361
2557
|
modifiedText = modifiedText.substring(0, modifiedText.length - 1);
|
|
2362
2558
|
textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
|
|
2363
2559
|
}
|
|
2560
|
+
|
|
2364
2561
|
modifiedText = "".concat(modifiedText, "...");
|
|
2365
2562
|
}
|
|
2563
|
+
|
|
2366
2564
|
return modifiedText;
|
|
2367
2565
|
};
|
|
2368
|
-
|
|
2369
2566
|
/*
|
|
2370
2567
|
* @method computeSingleValueRadialContent
|
|
2371
2568
|
* @param {Object} props
|
|
@@ -2392,44 +2589,46 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
2392
2589
|
* @returns {String} results.majorValueTitle
|
|
2393
2590
|
* @returns {Object} results.smallVizProps
|
|
2394
2591
|
*/
|
|
2592
|
+
|
|
2395
2593
|
var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
|
|
2396
2594
|
var contentWidth = _ref15.contentWidth,
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2595
|
+
contentHeight = _ref15.contentHeight,
|
|
2596
|
+
containerWidth = _ref15.containerWidth,
|
|
2597
|
+
containerHeight = _ref15.containerHeight,
|
|
2598
|
+
majorValue = _ref15.majorValue,
|
|
2599
|
+
trendValue = _ref15.trendValue,
|
|
2600
|
+
majorFontSize = _ref15.majorFontSize,
|
|
2601
|
+
trendFontSize = _ref15.trendFontSize,
|
|
2602
|
+
trendDisplay = _ref15.trendDisplay,
|
|
2603
|
+
unit = _ref15.unit,
|
|
2604
|
+
numberPrecision = _ref15.numberPrecision,
|
|
2605
|
+
shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
|
|
2606
|
+
shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
|
|
2607
|
+
smallViz = _ref15.smallViz;
|
|
2608
|
+
|
|
2410
2609
|
var _getMajorAndTrend2 = getMajorAndTrend({
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
var majorValueTitle = majorText;
|
|
2428
|
-
var smallVizProps = {};
|
|
2610
|
+
majorValue: majorValue,
|
|
2611
|
+
trendValue: trendValue,
|
|
2612
|
+
majorFontSize: majorFontSize,
|
|
2613
|
+
trendFontSize: trendFontSize,
|
|
2614
|
+
trendDisplay: trendDisplay,
|
|
2615
|
+
width: contentWidth,
|
|
2616
|
+
height: contentHeight,
|
|
2617
|
+
unit: unit,
|
|
2618
|
+
numberPrecision: numberPrecision,
|
|
2619
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2620
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2621
|
+
}),
|
|
2622
|
+
majorText = _getMajorAndTrend2.majorText,
|
|
2623
|
+
trendText = _getMajorAndTrend2.trendText,
|
|
2624
|
+
majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
|
|
2625
|
+
trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
|
|
2429
2626
|
|
|
2430
|
-
|
|
2627
|
+
var majorValueTitle = majorText;
|
|
2628
|
+
var smallVizProps = {}; // custom logic for viz in small space
|
|
2431
2629
|
// if not showing the radial graph (if `smallViz` is true), then compute truncated major value
|
|
2432
2630
|
// and font sizes
|
|
2631
|
+
|
|
2433
2632
|
if (smallViz) {
|
|
2434
2633
|
var truncateValue = minimallyTruncateStringToWidth({
|
|
2435
2634
|
text: majorValue,
|
|
@@ -2437,6 +2636,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2437
2636
|
fontSize: 12,
|
|
2438
2637
|
containerWidth: containerWidth
|
|
2439
2638
|
});
|
|
2639
|
+
|
|
2440
2640
|
var _getMajorAndTrend3 = getMajorAndTrend({
|
|
2441
2641
|
majorValue: truncateValue,
|
|
2442
2642
|
trendValue: trendValue,
|
|
@@ -2450,6 +2650,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2450
2650
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2451
2651
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2452
2652
|
});
|
|
2653
|
+
|
|
2453
2654
|
majorText = _getMajorAndTrend3.majorText;
|
|
2454
2655
|
trendText = _getMajorAndTrend3.trendText;
|
|
2455
2656
|
majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
|
|
@@ -2459,6 +2660,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2459
2660
|
unit: unit
|
|
2460
2661
|
};
|
|
2461
2662
|
}
|
|
2663
|
+
|
|
2462
2664
|
return {
|
|
2463
2665
|
majorText: majorText,
|
|
2464
2666
|
trendText: trendText,
|
|
@@ -2468,7 +2670,6 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2468
2670
|
smallVizProps: smallVizProps
|
|
2469
2671
|
};
|
|
2470
2672
|
};
|
|
2471
|
-
|
|
2472
2673
|
/**
|
|
2473
2674
|
* Get the colors for a graph
|
|
2474
2675
|
*
|
|
@@ -2481,21 +2682,22 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2481
2682
|
* @returns {Object} { background, stroke } colors
|
|
2482
2683
|
* @private
|
|
2483
2684
|
*/
|
|
2685
|
+
|
|
2484
2686
|
var getGraphColors = function getGraphColors(_ref16) {
|
|
2485
2687
|
var backgroundEnabled = _ref16.backgroundEnabled,
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2688
|
+
backgroundColor = _ref16.backgroundColor,
|
|
2689
|
+
defaultColors = _ref16.defaultColors,
|
|
2690
|
+
customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
|
|
2691
|
+
|
|
2490
2692
|
if (backgroundEnabled) {
|
|
2491
2693
|
// Check if the user defined colors to use
|
|
2492
2694
|
if (backgroundColor && typeof customColorFormatter === 'function') {
|
|
2493
2695
|
return customColorFormatter(backgroundColor);
|
|
2494
2696
|
}
|
|
2495
2697
|
}
|
|
2698
|
+
|
|
2496
2699
|
return defaultColors.none;
|
|
2497
2700
|
};
|
|
2498
|
-
|
|
2499
2701
|
/**
|
|
2500
2702
|
* Adjust rgb value if it equals to 0 or 255
|
|
2501
2703
|
* @method adjustRGB
|
|
@@ -2504,16 +2706,18 @@ var getGraphColors = function getGraphColors(_ref16) {
|
|
|
2504
2706
|
* @returns {Number} adjusted rgb
|
|
2505
2707
|
* @private
|
|
2506
2708
|
*/
|
|
2709
|
+
|
|
2507
2710
|
var adjustRGB = function adjustRGB(rgb, delta) {
|
|
2508
2711
|
if (rgb === 255) {
|
|
2509
2712
|
return rgb - delta;
|
|
2510
2713
|
}
|
|
2714
|
+
|
|
2511
2715
|
if (rgb === 0) {
|
|
2512
2716
|
return rgb + delta;
|
|
2513
2717
|
}
|
|
2718
|
+
|
|
2514
2719
|
return rgb;
|
|
2515
2720
|
};
|
|
2516
|
-
|
|
2517
2721
|
/**
|
|
2518
2722
|
* Modifies colors by multiplying by a given ratio
|
|
2519
2723
|
* @method changeColor
|
|
@@ -2522,18 +2726,16 @@ var adjustRGB = function adjustRGB(rgb, delta) {
|
|
|
2522
2726
|
* @returns {String} new color
|
|
2523
2727
|
* @private
|
|
2524
2728
|
*/
|
|
2729
|
+
|
|
2525
2730
|
var changeColor = function changeColor(color, ratio) {
|
|
2526
2731
|
var hex = color.replace(/(0x|#)/, '');
|
|
2527
2732
|
var r = parseInt(hex.substr(0, 2), 16);
|
|
2528
2733
|
var g = parseInt(hex.substr(2, 2), 16);
|
|
2529
|
-
var b = parseInt(hex.substr(4, 2), 16);
|
|
2734
|
+
var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
|
|
2530
2735
|
|
|
2531
|
-
// Multiply by given ratio, make sure is between 0 and 255;
|
|
2532
2736
|
var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
|
|
2533
2737
|
var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
|
|
2534
|
-
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);
|
|
2535
|
-
|
|
2536
|
-
// If the color is not changed
|
|
2738
|
+
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
|
|
2537
2739
|
// case 1: the color is (0, 0 0)
|
|
2538
2740
|
// lighten color (80, 80, 80)
|
|
2539
2741
|
// darken color (40, 40, 40)
|
|
@@ -2542,6 +2744,7 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2542
2744
|
// darken color (175, 175, 175)
|
|
2543
2745
|
// case 3: the color is e.g. (0, 255, 0)
|
|
2544
2746
|
// new color (20, 235, 20)
|
|
2747
|
+
|
|
2545
2748
|
if (newR === r && newG === g && newB === b) {
|
|
2546
2749
|
if (newR === 0 && newG === 0 && newB === 0) {
|
|
2547
2750
|
if (ratio > 1) {
|
|
@@ -2569,9 +2772,9 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2569
2772
|
newB = adjustRGB(newB, 20);
|
|
2570
2773
|
}
|
|
2571
2774
|
}
|
|
2775
|
+
|
|
2572
2776
|
return "#".concat(newR.toString(16).padStart(2, 0)) + "".concat(newG.toString(16).padStart(2, 0)) + "".concat(newB.toString(16).padStart(2, 0));
|
|
2573
2777
|
};
|
|
2574
|
-
|
|
2575
2778
|
/**
|
|
2576
2779
|
* Lighten a given color
|
|
2577
2780
|
* @method lighten
|
|
@@ -2579,10 +2782,11 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2579
2782
|
* @returns {String}
|
|
2580
2783
|
* @private
|
|
2581
2784
|
*/
|
|
2785
|
+
|
|
2786
|
+
|
|
2582
2787
|
var lighten = function lighten(color) {
|
|
2583
2788
|
return changeColor(color, 1.3);
|
|
2584
2789
|
};
|
|
2585
|
-
|
|
2586
2790
|
/**
|
|
2587
2791
|
* Darkens a given color
|
|
2588
2792
|
* @method darken
|
|
@@ -2590,10 +2794,10 @@ var lighten = function lighten(color) {
|
|
|
2590
2794
|
* @returns {String}
|
|
2591
2795
|
* @private
|
|
2592
2796
|
*/
|
|
2797
|
+
|
|
2593
2798
|
var darken = function darken(color) {
|
|
2594
2799
|
return changeColor(color, 0.5);
|
|
2595
2800
|
};
|
|
2596
|
-
|
|
2597
2801
|
/** consistent token structure: handle callback to add value and name in event payload
|
|
2598
2802
|
* @method handleValueClickCallback
|
|
2599
2803
|
* @param {Object} ev
|
|
@@ -2602,6 +2806,7 @@ var darken = function darken(color) {
|
|
|
2602
2806
|
* @param {Number} trendValue
|
|
2603
2807
|
* @param {Function} onValueClick
|
|
2604
2808
|
*/
|
|
2809
|
+
|
|
2605
2810
|
var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
|
|
2606
2811
|
var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
2607
2812
|
var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
@@ -2611,12 +2816,14 @@ var handleValueClickCallback = function handleValueClickCallback(ev, majorValue,
|
|
|
2611
2816
|
value: majorValue,
|
|
2612
2817
|
name: majorValueField
|
|
2613
2818
|
};
|
|
2819
|
+
|
|
2614
2820
|
if (trellisEnabled) {
|
|
2615
2821
|
payload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
2616
2822
|
'trellis.name': trellisSplityBy,
|
|
2617
2823
|
'trellis.value': trellisKey
|
|
2618
2824
|
});
|
|
2619
2825
|
}
|
|
2826
|
+
|
|
2620
2827
|
return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
|
|
2621
2828
|
payload: payload
|
|
2622
2829
|
}));
|
|
@@ -2690,11 +2897,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2690
2897
|
value: true
|
|
2691
2898
|
});
|
|
2692
2899
|
exports.shouldShowIconPlaceholder = void 0;
|
|
2900
|
+
|
|
2693
2901
|
var React = __webpack_require__(1);
|
|
2902
|
+
|
|
2694
2903
|
var T = __webpack_require__(0);
|
|
2904
|
+
|
|
2695
2905
|
var lodash_1 = __webpack_require__(3);
|
|
2906
|
+
|
|
2696
2907
|
var i18n_1 = __webpack_require__(2);
|
|
2908
|
+
|
|
2697
2909
|
var Message_1 = __webpack_require__(10);
|
|
2910
|
+
|
|
2698
2911
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2699
2912
|
/**
|
|
2700
2913
|
* @method shouldShowIconPlaceholder
|
|
@@ -2702,6 +2915,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
2702
2915
|
* @param {boolean} loading
|
|
2703
2916
|
* @returns {boolean}
|
|
2704
2917
|
*/
|
|
2918
|
+
|
|
2919
|
+
|
|
2705
2920
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
2706
2921
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2707
2922
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -2710,6 +2925,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
2710
2925
|
var noFields = fields === undefined;
|
|
2711
2926
|
return loading || noData || noFields;
|
|
2712
2927
|
};
|
|
2928
|
+
|
|
2713
2929
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
2714
2930
|
var propTypes = {
|
|
2715
2931
|
icon: T.func,
|
|
@@ -2724,11 +2940,13 @@ var propTypes = {
|
|
|
2724
2940
|
* @param {IconPlaceholderProps} props
|
|
2725
2941
|
* @returns {React.ReactElement}
|
|
2726
2942
|
*/
|
|
2943
|
+
|
|
2727
2944
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
2728
2945
|
var width = props.width,
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2946
|
+
height = props.height,
|
|
2947
|
+
icon = props.icon,
|
|
2948
|
+
iconColor = props.iconColor;
|
|
2949
|
+
|
|
2732
2950
|
if (icon) {
|
|
2733
2951
|
return React.createElement(icon, {
|
|
2734
2952
|
style: {
|
|
@@ -2743,6 +2961,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2743
2961
|
height: '50%'
|
|
2744
2962
|
});
|
|
2745
2963
|
}
|
|
2964
|
+
|
|
2746
2965
|
return React.createElement(Message_1.default, {
|
|
2747
2966
|
width: width,
|
|
2748
2967
|
height: height,
|
|
@@ -2750,6 +2969,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2750
2969
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
2751
2970
|
});
|
|
2752
2971
|
};
|
|
2972
|
+
|
|
2753
2973
|
IconPlaceholder.propTypes = propTypes;
|
|
2754
2974
|
IconPlaceholder.defaultProps = {
|
|
2755
2975
|
width: '100%',
|
|
@@ -2766,21 +2986,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
2766
2986
|
|
|
2767
2987
|
|
|
2768
2988
|
var _defineProperty = __webpack_require__(7);
|
|
2989
|
+
|
|
2769
2990
|
Object.defineProperty(exports, "__esModule", {
|
|
2770
2991
|
value: true
|
|
2771
2992
|
});
|
|
2772
2993
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
2994
|
+
|
|
2773
2995
|
var T = __webpack_require__(0);
|
|
2996
|
+
|
|
2774
2997
|
var lodash_1 = __webpack_require__(3);
|
|
2775
|
-
|
|
2998
|
+
|
|
2999
|
+
var DataSource_1 = __webpack_require__(34);
|
|
3000
|
+
|
|
2776
3001
|
exports.SortParamsPropTypes = T.shape({
|
|
2777
3002
|
currentSortKey: T.string,
|
|
2778
3003
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
2779
3004
|
onSort: T.func
|
|
2780
3005
|
});
|
|
3006
|
+
|
|
2781
3007
|
var getSortingParams = function getSortingParams(_ref) {
|
|
2782
3008
|
var requestParams = _ref.requestParams,
|
|
2783
|
-
|
|
3009
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2784
3010
|
var currentSortKey;
|
|
2785
3011
|
var currentSortDir;
|
|
2786
3012
|
var nextSortDirMap = {
|
|
@@ -2789,15 +3015,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2789
3015
|
none: 'asc'
|
|
2790
3016
|
};
|
|
2791
3017
|
var onSort;
|
|
3018
|
+
|
|
2792
3019
|
if (typeof onRequestParamsChange === 'function') {
|
|
2793
3020
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
2794
3021
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
2795
3022
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
2796
|
-
}
|
|
2797
|
-
|
|
3023
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
3024
|
+
|
|
3025
|
+
|
|
2798
3026
|
onSort = function onSort(e, _ref2) {
|
|
2799
3027
|
var sortKey = _ref2.sortKey,
|
|
2800
|
-
|
|
3028
|
+
sortDir = _ref2.sortDir;
|
|
3029
|
+
|
|
2801
3030
|
if (typeof sortKey === 'string') {
|
|
2802
3031
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
2803
3032
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -2809,12 +3038,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2809
3038
|
}
|
|
2810
3039
|
};
|
|
2811
3040
|
}
|
|
3041
|
+
|
|
2812
3042
|
return {
|
|
2813
3043
|
currentSortKey: currentSortKey,
|
|
2814
3044
|
currentSortDir: currentSortDir,
|
|
2815
3045
|
onSort: onSort
|
|
2816
3046
|
};
|
|
2817
3047
|
};
|
|
3048
|
+
|
|
2818
3049
|
exports.getSortingParams = getSortingParams;
|
|
2819
3050
|
|
|
2820
3051
|
/***/ }),
|
|
@@ -2825,43 +3056,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
2825
3056
|
"use strict";
|
|
2826
3057
|
|
|
2827
3058
|
|
|
3059
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3060
|
+
value: true
|
|
3061
|
+
});
|
|
3062
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
3063
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3064
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
3065
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
3066
|
+
|
|
3067
|
+
/***/ }),
|
|
3068
|
+
|
|
3069
|
+
/***/ 35:
|
|
3070
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3071
|
+
|
|
3072
|
+
"use strict";
|
|
3073
|
+
|
|
3074
|
+
|
|
2828
3075
|
Object.defineProperty(exports, "__esModule", {
|
|
2829
3076
|
value: true
|
|
2830
3077
|
});
|
|
2831
3078
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
3079
|
+
|
|
2832
3080
|
var T = __webpack_require__(0);
|
|
3081
|
+
|
|
2833
3082
|
var lodash_1 = __webpack_require__(3);
|
|
3083
|
+
|
|
2834
3084
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
2835
3085
|
isPaging: T.bool,
|
|
2836
3086
|
current: T.number,
|
|
2837
3087
|
totalPages: T.number,
|
|
2838
3088
|
onChange: T.func
|
|
2839
3089
|
});
|
|
3090
|
+
|
|
2840
3091
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
2841
3092
|
var requestParams = _ref.requestParams,
|
|
2842
|
-
|
|
2843
|
-
|
|
3093
|
+
meta = _ref.meta,
|
|
3094
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2844
3095
|
var totalCount = meta && meta.totalCount || 0;
|
|
2845
3096
|
var offset = requestParams && requestParams.offset || 0;
|
|
2846
3097
|
var count = requestParams && requestParams.count;
|
|
2847
3098
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
2848
3099
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
2849
3100
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
3101
|
+
|
|
2850
3102
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
2851
3103
|
var page = _ref2.page,
|
|
2852
|
-
|
|
3104
|
+
countArg = _ref2.count;
|
|
2853
3105
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
3106
|
+
|
|
2854
3107
|
if (typeof countArg === 'number') {
|
|
2855
3108
|
newParams.count = countArg;
|
|
2856
3109
|
newParams.offset = 0;
|
|
2857
3110
|
}
|
|
3111
|
+
|
|
2858
3112
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
3113
|
+
|
|
2859
3114
|
if (typeof page === 'number' && page > 0) {
|
|
2860
3115
|
newParams.count = pageCount;
|
|
2861
3116
|
newParams.offset = (page - 1) * pageCount;
|
|
2862
3117
|
}
|
|
3118
|
+
|
|
2863
3119
|
onRequestParamsChange(newParams);
|
|
2864
3120
|
};
|
|
3121
|
+
|
|
2865
3122
|
return {
|
|
2866
3123
|
isPaging: isPaging,
|
|
2867
3124
|
current: current,
|
|
@@ -2869,11 +3126,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
2869
3126
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
2870
3127
|
};
|
|
2871
3128
|
};
|
|
3129
|
+
|
|
2872
3130
|
exports.getPaginationParams = getPaginationParams;
|
|
2873
3131
|
|
|
2874
3132
|
/***/ }),
|
|
2875
3133
|
|
|
2876
|
-
/***/
|
|
3134
|
+
/***/ 36:
|
|
2877
3135
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2878
3136
|
|
|
2879
3137
|
"use strict";
|
|
@@ -2884,6 +3142,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2884
3142
|
});
|
|
2885
3143
|
exports.VizCategory = void 0;
|
|
2886
3144
|
var VizCategory;
|
|
3145
|
+
|
|
2887
3146
|
(function (VizCategory) {
|
|
2888
3147
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
2889
3148
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -2901,67 +3160,96 @@ var VizCategory;
|
|
|
2901
3160
|
|
|
2902
3161
|
/***/ }),
|
|
2903
3162
|
|
|
2904
|
-
/***/
|
|
3163
|
+
/***/ 37:
|
|
2905
3164
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2906
3165
|
|
|
2907
3166
|
"use strict";
|
|
2908
3167
|
|
|
2909
3168
|
|
|
2910
3169
|
var _slicedToArray = __webpack_require__(17);
|
|
3170
|
+
|
|
2911
3171
|
Object.defineProperty(exports, "__esModule", {
|
|
2912
3172
|
value: true
|
|
2913
3173
|
});
|
|
3174
|
+
|
|
2914
3175
|
var React = __webpack_require__(1);
|
|
3176
|
+
|
|
2915
3177
|
var lodash_1 = __webpack_require__(3);
|
|
2916
|
-
|
|
3178
|
+
|
|
3179
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
3180
|
+
|
|
2917
3181
|
var Options_1 = __webpack_require__(30);
|
|
2918
|
-
|
|
3182
|
+
|
|
3183
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
3184
|
+
|
|
2919
3185
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
2920
|
-
|
|
3186
|
+
|
|
3187
|
+
var moment_1 = __webpack_require__(40);
|
|
3188
|
+
|
|
2921
3189
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
3190
|
+
|
|
2922
3191
|
var styled_components_1 = __webpack_require__(4);
|
|
3192
|
+
|
|
2923
3193
|
var hocUtils_1 = __webpack_require__(27);
|
|
3194
|
+
|
|
2924
3195
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
2925
|
-
|
|
3196
|
+
|
|
3197
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
3198
|
+
|
|
2926
3199
|
var id_1 = __webpack_require__(25);
|
|
2927
|
-
|
|
3200
|
+
|
|
3201
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
3202
|
+
|
|
2928
3203
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3204
|
+
|
|
2929
3205
|
var getSorting_1 = __webpack_require__(33);
|
|
2930
|
-
|
|
3206
|
+
|
|
3207
|
+
var getPagination_1 = __webpack_require__(35);
|
|
3208
|
+
|
|
2931
3209
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
3210
|
+
|
|
2932
3211
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
3212
|
+
|
|
2933
3213
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
3214
|
+
|
|
2934
3215
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
2935
3216
|
/**
|
|
2936
3217
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
2937
3218
|
* @param {DashboardVizOpts} opts
|
|
2938
3219
|
* @returns {HOC}
|
|
2939
3220
|
*/
|
|
3221
|
+
|
|
3222
|
+
|
|
2940
3223
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
2941
3224
|
var ReactViz = opts.ReactViz,
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
3225
|
+
vizConfig = opts.vizConfig,
|
|
3226
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
3227
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
3228
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
3229
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
3230
|
+
|
|
2947
3231
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
2948
3232
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
3233
|
+
|
|
2949
3234
|
var DashboardViz = function DashboardViz(props) {
|
|
2950
3235
|
var _a;
|
|
3236
|
+
|
|
2951
3237
|
var mode = props.mode,
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
3238
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
3239
|
+
dataSources = props.dataSources,
|
|
3240
|
+
options = props.options,
|
|
3241
|
+
_props$context = props.context,
|
|
3242
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
3243
|
+
width = props.width,
|
|
3244
|
+
height = props.height,
|
|
3245
|
+
onComputedProps = props.onComputedProps,
|
|
3246
|
+
onEventTrigger = props.onEventTrigger,
|
|
3247
|
+
theme = props.theme,
|
|
3248
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
3249
|
+
|
|
2963
3250
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
2964
|
-
|
|
3251
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
3252
|
+
|
|
2965
3253
|
if (serializedTimezone) {
|
|
2966
3254
|
/*
|
|
2967
3255
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -2975,38 +3263,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
2975
3263
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2976
3264
|
}
|
|
2977
3265
|
}
|
|
3266
|
+
|
|
2978
3267
|
var themeFunc = function themeFunc(themeVar) {
|
|
2979
3268
|
var _a, _b;
|
|
3269
|
+
|
|
2980
3270
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
2981
3271
|
};
|
|
3272
|
+
|
|
2982
3273
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
3274
|
+
|
|
2983
3275
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
3276
|
+
theme: theme
|
|
3277
|
+
}),
|
|
3278
|
+
currentThemeFamily = _ref.family,
|
|
3279
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
3280
|
+
currentThemeDensity = _ref.density;
|
|
3281
|
+
|
|
2989
3282
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
3283
|
+
|
|
2990
3284
|
var _React$useState = React.useState({}),
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3285
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3286
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
3287
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
3288
|
+
|
|
3289
|
+
|
|
2994
3290
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
3291
|
+
|
|
2995
3292
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
2996
|
-
|
|
2997
|
-
|
|
3293
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
3294
|
+
visualizationID = _React$useState4[0];
|
|
3295
|
+
|
|
2998
3296
|
var _React$useState5 = React.useState({}),
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3297
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3298
|
+
dataSourcesInState = _React$useState6[0],
|
|
3299
|
+
setDataSourcesInState = _React$useState6[1];
|
|
3300
|
+
|
|
3002
3301
|
var _React$useState7 = React.useState(),
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3302
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3303
|
+
dataFramesInState = _React$useState8[0],
|
|
3304
|
+
setDataFramesInState = _React$useState8[1];
|
|
3305
|
+
|
|
3006
3306
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3307
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
3308
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
3309
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
3310
|
+
|
|
3010
3311
|
var isMounted = React.useRef(true);
|
|
3011
3312
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
3012
3313
|
try {
|
|
@@ -3031,11 +3332,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3031
3332
|
});
|
|
3032
3333
|
} else {
|
|
3033
3334
|
var dataFrames = dataFramesInState;
|
|
3335
|
+
|
|
3034
3336
|
if (dataSources !== dataSourcesInState) {
|
|
3035
3337
|
setDataSourcesInState(dataSources);
|
|
3036
3338
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
3037
3339
|
setDataFramesInState(dataFrames);
|
|
3038
3340
|
}
|
|
3341
|
+
|
|
3039
3342
|
return Options_1.Options.evaluate({
|
|
3040
3343
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
3041
3344
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -3046,21 +3349,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3046
3349
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
3047
3350
|
return {};
|
|
3048
3351
|
}
|
|
3352
|
+
|
|
3049
3353
|
return {};
|
|
3050
3354
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
3051
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
3052
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
3355
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
3053
3356
|
// 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
|
|
3054
3357
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
3358
|
+
|
|
3055
3359
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
3056
3360
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
3361
|
+
|
|
3057
3362
|
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) {
|
|
3058
3363
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
3059
3364
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
3060
3365
|
});
|
|
3061
|
-
}
|
|
3062
|
-
// useEffect hook needs to be initialized before any early returns
|
|
3366
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
3063
3367
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
3368
|
+
|
|
3369
|
+
|
|
3064
3370
|
React.useEffect(function () {
|
|
3065
3371
|
onComputedProps(clonedEvaluatedOptions);
|
|
3066
3372
|
});
|
|
@@ -3070,44 +3376,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3070
3376
|
isMounted.current = false;
|
|
3071
3377
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
3072
3378
|
}
|
|
3073
|
-
};
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
// present warning message if any required props are missing
|
|
3379
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3380
|
+
}, []); // present warning message if any required props are missing
|
|
3381
|
+
|
|
3077
3382
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
3078
|
-
|
|
3079
|
-
|
|
3383
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
3384
|
+
supports = vizConfig.supports;
|
|
3080
3385
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
3386
|
+
|
|
3081
3387
|
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
|
|
3082
3388
|
) {
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3389
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
3390
|
+
"data-test": "missing-props-message",
|
|
3391
|
+
width: width,
|
|
3392
|
+
height: height,
|
|
3393
|
+
missingProps: missing,
|
|
3394
|
+
backgroundColor: bgColorFromTheme
|
|
3395
|
+
});
|
|
3396
|
+
} // events
|
|
3397
|
+
|
|
3398
|
+
|
|
3092
3399
|
var eventCallbackProps = {};
|
|
3400
|
+
|
|
3093
3401
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
3094
3402
|
var supportedEvents = vizConfig.events;
|
|
3095
3403
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
3096
3404
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
3097
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
3098
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
3405
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
3099
3406
|
// then remove these lines
|
|
3407
|
+
|
|
3100
3408
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
3101
3409
|
var payload = {};
|
|
3410
|
+
|
|
3102
3411
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
3103
3412
|
payloadKeys.forEach(function (p) {
|
|
3104
3413
|
payload[p] = evaluatedOptionsToUse[p];
|
|
3105
3414
|
});
|
|
3106
3415
|
}
|
|
3416
|
+
|
|
3107
3417
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
3108
3418
|
if (ev && ev.payload) {
|
|
3109
3419
|
payload = ev.payload;
|
|
3110
3420
|
}
|
|
3421
|
+
|
|
3111
3422
|
return onEventTrigger({
|
|
3112
3423
|
originalEvent: ev,
|
|
3113
3424
|
payload: payload,
|
|
@@ -3115,8 +3426,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3115
3426
|
});
|
|
3116
3427
|
};
|
|
3117
3428
|
});
|
|
3118
|
-
}
|
|
3119
|
-
|
|
3429
|
+
} // compute pure viz props which are not from options
|
|
3430
|
+
|
|
3431
|
+
|
|
3120
3432
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
3121
3433
|
themeFunc: themeFunc
|
|
3122
3434
|
}));
|
|
@@ -3134,15 +3446,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3134
3446
|
* In future, we could automatically detect which all datasources are being used
|
|
3135
3447
|
* and bind those magically to pagination/sorting behavior.
|
|
3136
3448
|
*/
|
|
3449
|
+
|
|
3137
3450
|
var dataSourceMetadata = {};
|
|
3138
3451
|
var OptionKey = 'paginateDataSourceKey';
|
|
3139
3452
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
3453
|
+
|
|
3140
3454
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
3141
3455
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
3142
3456
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
3457
|
+
|
|
3143
3458
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
3144
3459
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
3145
3460
|
};
|
|
3461
|
+
|
|
3146
3462
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
3147
3463
|
requestParams: requestParams,
|
|
3148
3464
|
meta: meta,
|
|
@@ -3157,115 +3473,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3157
3473
|
sortParams: sortParams,
|
|
3158
3474
|
paginatorParams: paginatorParams
|
|
3159
3475
|
};
|
|
3160
|
-
}
|
|
3161
|
-
|
|
3476
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
3477
|
+
|
|
3478
|
+
|
|
3162
3479
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
3163
3480
|
return null;
|
|
3164
3481
|
}
|
|
3482
|
+
|
|
3165
3483
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
3166
3484
|
mode: mode,
|
|
3167
3485
|
width: width,
|
|
3168
3486
|
height: height
|
|
3169
3487
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
3170
3488
|
};
|
|
3489
|
+
|
|
3171
3490
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
3172
3491
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
3173
3492
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
3174
3493
|
theme: {}
|
|
3175
|
-
});
|
|
3176
|
-
|
|
3177
|
-
DashboardViz.config = vizConfig;
|
|
3178
|
-
|
|
3494
|
+
}); // attach viz config
|
|
3495
|
+
|
|
3496
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
3497
|
+
|
|
3179
3498
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
3180
3499
|
};
|
|
3500
|
+
|
|
3181
3501
|
exports.default = withDashboardViz;
|
|
3182
3502
|
|
|
3183
3503
|
/***/ }),
|
|
3184
3504
|
|
|
3185
|
-
/***/
|
|
3505
|
+
/***/ 38:
|
|
3186
3506
|
/***/ (function(module, exports) {
|
|
3187
3507
|
|
|
3188
3508
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
3189
3509
|
|
|
3190
3510
|
/***/ }),
|
|
3191
3511
|
|
|
3192
|
-
/***/
|
|
3512
|
+
/***/ 39:
|
|
3193
3513
|
/***/ (function(module, exports) {
|
|
3194
3514
|
|
|
3195
3515
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
3196
3516
|
|
|
3197
3517
|
/***/ }),
|
|
3198
3518
|
|
|
3199
|
-
/***/
|
|
3519
|
+
/***/ 4:
|
|
3200
3520
|
/***/ (function(module, exports) {
|
|
3201
3521
|
|
|
3202
|
-
module.exports = require("
|
|
3522
|
+
module.exports = require("styled-components");
|
|
3203
3523
|
|
|
3204
3524
|
/***/ }),
|
|
3205
3525
|
|
|
3206
|
-
/***/
|
|
3526
|
+
/***/ 40:
|
|
3207
3527
|
/***/ (function(module, exports) {
|
|
3208
3528
|
|
|
3209
|
-
module.exports = require("
|
|
3529
|
+
module.exports = require("@splunk/moment");
|
|
3210
3530
|
|
|
3211
3531
|
/***/ }),
|
|
3212
3532
|
|
|
3213
|
-
/***/
|
|
3533
|
+
/***/ 41:
|
|
3214
3534
|
/***/ (function(module, exports) {
|
|
3215
3535
|
|
|
3216
3536
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
3217
3537
|
|
|
3218
3538
|
/***/ }),
|
|
3219
3539
|
|
|
3220
|
-
/***/
|
|
3540
|
+
/***/ 42:
|
|
3221
3541
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3222
3542
|
|
|
3223
3543
|
"use strict";
|
|
3224
3544
|
|
|
3225
3545
|
|
|
3226
3546
|
var _classCallCheck = __webpack_require__(9);
|
|
3547
|
+
|
|
3227
3548
|
Object.defineProperty(exports, "__esModule", {
|
|
3228
3549
|
value: true
|
|
3229
3550
|
});
|
|
3230
3551
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
3231
3552
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
3553
|
+
|
|
3232
3554
|
var T = __webpack_require__(0);
|
|
3555
|
+
|
|
3233
3556
|
var lodash_1 = __webpack_require__(3);
|
|
3234
|
-
|
|
3235
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3557
|
+
|
|
3558
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3559
|
+
|
|
3560
|
+
|
|
3236
3561
|
exports.INITIAL_WIDTH = 250;
|
|
3237
3562
|
exports.INITIAL_HEIGHT = 250;
|
|
3238
3563
|
/**
|
|
3239
3564
|
* A Splunk visualization
|
|
3240
3565
|
*/
|
|
3566
|
+
|
|
3241
3567
|
var SplunkVisualization = function SplunkVisualization() {
|
|
3242
3568
|
_classCallCheck(this, SplunkVisualization);
|
|
3243
3569
|
};
|
|
3570
|
+
|
|
3244
3571
|
SplunkVisualization.propTypes = {
|
|
3245
3572
|
/**
|
|
3246
3573
|
* display mode
|
|
3247
3574
|
*/
|
|
3248
3575
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
3576
|
+
|
|
3249
3577
|
/**
|
|
3250
3578
|
* width in pixel or string, defaults to 100%
|
|
3251
3579
|
*/
|
|
3252
3580
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
3581
|
+
|
|
3253
3582
|
/**
|
|
3254
3583
|
* height in pixel or string
|
|
3255
3584
|
*/
|
|
3256
3585
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
3586
|
+
|
|
3257
3587
|
/**
|
|
3258
3588
|
* visualization context used for dynamic option evaluation
|
|
3259
3589
|
*/
|
|
3260
3590
|
context: T.object,
|
|
3591
|
+
|
|
3261
3592
|
/**
|
|
3262
3593
|
* visualization formatting options
|
|
3263
3594
|
*/
|
|
3264
3595
|
options: T.object,
|
|
3596
|
+
|
|
3265
3597
|
/**
|
|
3266
3598
|
* A callback to update formatting options
|
|
3267
3599
|
*/
|
|
3268
3600
|
onOptionsChange: T.func,
|
|
3601
|
+
|
|
3269
3602
|
/**
|
|
3270
3603
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
3271
3604
|
*/
|
|
@@ -3274,6 +3607,7 @@ SplunkVisualization.propTypes = {
|
|
|
3274
3607
|
* current request params
|
|
3275
3608
|
*/
|
|
3276
3609
|
requestParams: T.object,
|
|
3610
|
+
|
|
3277
3611
|
/**
|
|
3278
3612
|
* current dataset
|
|
3279
3613
|
*/
|
|
@@ -3281,6 +3615,7 @@ SplunkVisualization.propTypes = {
|
|
|
3281
3615
|
fields: T.array,
|
|
3282
3616
|
columns: T.array
|
|
3283
3617
|
}),
|
|
3618
|
+
|
|
3284
3619
|
/**
|
|
3285
3620
|
* error
|
|
3286
3621
|
*/
|
|
@@ -3288,29 +3623,35 @@ SplunkVisualization.propTypes = {
|
|
|
3288
3623
|
level: T.string,
|
|
3289
3624
|
message: T.string
|
|
3290
3625
|
}),
|
|
3626
|
+
|
|
3291
3627
|
/**
|
|
3292
3628
|
* meta data that came with the dataset
|
|
3293
3629
|
*/
|
|
3294
3630
|
meta: T.object
|
|
3295
3631
|
})),
|
|
3632
|
+
|
|
3296
3633
|
/**
|
|
3297
3634
|
* A callback to trigger event
|
|
3298
3635
|
*/
|
|
3299
3636
|
onEventTrigger: T.func,
|
|
3637
|
+
|
|
3300
3638
|
/**
|
|
3301
3639
|
* Inform viz if there are handlers listening to events
|
|
3302
3640
|
*/
|
|
3303
3641
|
hasEventHandlers: T.bool,
|
|
3642
|
+
|
|
3304
3643
|
/**
|
|
3305
3644
|
* A callback to communicate computed props to a consumer
|
|
3306
3645
|
*/
|
|
3307
3646
|
onComputedProps: T.func,
|
|
3647
|
+
|
|
3308
3648
|
/**
|
|
3309
3649
|
* A callback to obtain visualization api
|
|
3310
3650
|
*/
|
|
3311
3651
|
vizActionHandlerRef: T.func,
|
|
3312
3652
|
loading: T.bool,
|
|
3313
3653
|
theme: T.object,
|
|
3654
|
+
|
|
3314
3655
|
/**
|
|
3315
3656
|
* A callback to request new data with updated request params
|
|
3316
3657
|
*/
|
|
@@ -3319,6 +3660,7 @@ SplunkVisualization.propTypes = {
|
|
|
3319
3660
|
/**
|
|
3320
3661
|
*
|
|
3321
3662
|
*/
|
|
3663
|
+
|
|
3322
3664
|
SplunkVisualization.defaultProps = {
|
|
3323
3665
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
3324
3666
|
width: '100%',
|
|
@@ -3347,26 +3689,29 @@ exports.default = SplunkVisualization;
|
|
|
3347
3689
|
|
|
3348
3690
|
/***/ }),
|
|
3349
3691
|
|
|
3350
|
-
/***/
|
|
3692
|
+
/***/ 43:
|
|
3351
3693
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3352
3694
|
|
|
3353
3695
|
"use strict";
|
|
3354
3696
|
|
|
3355
3697
|
|
|
3356
3698
|
var _classCallCheck = __webpack_require__(9);
|
|
3699
|
+
|
|
3357
3700
|
var _createClass = __webpack_require__(18);
|
|
3701
|
+
|
|
3358
3702
|
Object.defineProperty(exports, "__esModule", {
|
|
3359
3703
|
value: true
|
|
3360
3704
|
});
|
|
3361
3705
|
exports.DefaultVizActionHandler = void 0;
|
|
3706
|
+
|
|
3362
3707
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
3363
3708
|
function DefaultVizActionHandler() {
|
|
3364
3709
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
3365
3710
|
}
|
|
3711
|
+
|
|
3366
3712
|
_createClass(DefaultVizActionHandler, [{
|
|
3367
3713
|
key: "focus",
|
|
3368
|
-
value: function focus() {
|
|
3369
|
-
// noop
|
|
3714
|
+
value: function focus() {// noop
|
|
3370
3715
|
}
|
|
3371
3716
|
}, {
|
|
3372
3717
|
key: "snapshot",
|
|
@@ -3374,23 +3719,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
3374
3719
|
return null; // noop
|
|
3375
3720
|
}
|
|
3376
3721
|
}]);
|
|
3722
|
+
|
|
3377
3723
|
return DefaultVizActionHandler;
|
|
3378
3724
|
}();
|
|
3379
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3380
|
-
|
|
3381
|
-
/***/ }),
|
|
3382
|
-
|
|
3383
|
-
/***/ 43:
|
|
3384
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3385
|
-
|
|
3386
|
-
"use strict";
|
|
3387
|
-
|
|
3388
3725
|
|
|
3389
|
-
|
|
3390
|
-
value: true
|
|
3391
|
-
});
|
|
3392
|
-
exports.validSortDirs = void 0;
|
|
3393
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3726
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3394
3727
|
|
|
3395
3728
|
/***/ }),
|
|
3396
3729
|
|
|
@@ -3404,7 +3737,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3404
3737
|
value: true
|
|
3405
3738
|
});
|
|
3406
3739
|
exports.useDeepMemo = void 0;
|
|
3740
|
+
|
|
3407
3741
|
var react_1 = __webpack_require__(1);
|
|
3742
|
+
|
|
3408
3743
|
var lodash_1 = __webpack_require__(3);
|
|
3409
3744
|
/**
|
|
3410
3745
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -3419,16 +3754,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3419
3754
|
* @param fn the function to be executed and
|
|
3420
3755
|
* @param dependencies an array of dependencies
|
|
3421
3756
|
*/
|
|
3757
|
+
|
|
3758
|
+
|
|
3422
3759
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
3423
3760
|
var ref = (0, react_1.useRef)();
|
|
3761
|
+
|
|
3424
3762
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
3425
3763
|
ref.current = {
|
|
3426
3764
|
dependencies: dependencies,
|
|
3427
3765
|
value: fn()
|
|
3428
3766
|
};
|
|
3429
3767
|
}
|
|
3768
|
+
|
|
3430
3769
|
return ref.current.value;
|
|
3431
3770
|
};
|
|
3771
|
+
|
|
3432
3772
|
exports.useDeepMemo = useDeepMemo;
|
|
3433
3773
|
|
|
3434
3774
|
/***/ }),
|
|
@@ -3443,19 +3783,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3443
3783
|
value: true
|
|
3444
3784
|
});
|
|
3445
3785
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
3786
|
+
|
|
3446
3787
|
var React = __webpack_require__(1);
|
|
3788
|
+
|
|
3447
3789
|
var T = __webpack_require__(0);
|
|
3790
|
+
|
|
3448
3791
|
var i18n_1 = __webpack_require__(2);
|
|
3792
|
+
|
|
3449
3793
|
var Message_1 = __webpack_require__(10);
|
|
3794
|
+
|
|
3450
3795
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
3451
3796
|
/**
|
|
3452
3797
|
* @method isMissing
|
|
3453
3798
|
* @param {any} v
|
|
3454
3799
|
* @returns {boolean} true if the input value === null or undefined
|
|
3455
3800
|
*/
|
|
3801
|
+
|
|
3802
|
+
|
|
3456
3803
|
var isMissing = function isMissing(v) {
|
|
3457
3804
|
return v === null || v === undefined;
|
|
3458
3805
|
};
|
|
3806
|
+
|
|
3459
3807
|
exports.isMissing = isMissing;
|
|
3460
3808
|
/**
|
|
3461
3809
|
* @method misskingKeys
|
|
@@ -3463,11 +3811,13 @@ exports.isMissing = isMissing;
|
|
|
3463
3811
|
* @param {object} target
|
|
3464
3812
|
* @returns {string[]} the keys of missing required props
|
|
3465
3813
|
*/
|
|
3814
|
+
|
|
3466
3815
|
var missingKeys = function missingKeys(keys, target) {
|
|
3467
3816
|
return keys.filter(function (k) {
|
|
3468
3817
|
return (0, exports.isMissing)(target[k]);
|
|
3469
3818
|
});
|
|
3470
3819
|
};
|
|
3820
|
+
|
|
3471
3821
|
exports.missingKeys = missingKeys;
|
|
3472
3822
|
var propTypes = {
|
|
3473
3823
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -3481,10 +3831,11 @@ var propTypes = {
|
|
|
3481
3831
|
* @param {MissingPropsProps} props
|
|
3482
3832
|
* @returns {React.ReactElement}
|
|
3483
3833
|
*/
|
|
3834
|
+
|
|
3484
3835
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
3485
3836
|
var width = props.width,
|
|
3486
|
-
|
|
3487
|
-
|
|
3837
|
+
height = props.height,
|
|
3838
|
+
missingProps = props.missingProps;
|
|
3488
3839
|
return React.createElement(Message_1.default, {
|
|
3489
3840
|
"data-test": "message",
|
|
3490
3841
|
width: width,
|
|
@@ -3492,6 +3843,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
3492
3843
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
3493
3844
|
});
|
|
3494
3845
|
};
|
|
3846
|
+
|
|
3495
3847
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
3496
3848
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
3497
3849
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -3511,15 +3863,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
3511
3863
|
Object.defineProperty(exports, "__esModule", {
|
|
3512
3864
|
value: true
|
|
3513
3865
|
});
|
|
3866
|
+
|
|
3514
3867
|
var React = __webpack_require__(1);
|
|
3868
|
+
|
|
3515
3869
|
var styled_components_1 = __webpack_require__(4);
|
|
3870
|
+
|
|
3516
3871
|
var hocUtils_1 = __webpack_require__(15);
|
|
3872
|
+
|
|
3517
3873
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3518
3874
|
displayName: "withEditModeCover__Cover",
|
|
3519
3875
|
componentId: "sc-1gsbnxb-0"
|
|
3520
3876
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3521
3877
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3522
|
-
'data-splunk-visualization-version': "26.
|
|
3878
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
3523
3879
|
}).withConfig({
|
|
3524
3880
|
displayName: "withEditModeCover__Blocker",
|
|
3525
3881
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3530,6 +3886,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3530
3886
|
* @param {ExtendedDashViz} Visualization
|
|
3531
3887
|
* @returns {ExtendedDashViz} Wrapper
|
|
3532
3888
|
*/
|
|
3889
|
+
|
|
3533
3890
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3534
3891
|
var Wrapper = function Wrapper(props) {
|
|
3535
3892
|
var mode = props.mode;
|
|
@@ -3538,12 +3895,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3538
3895
|
"data-test": "edit-mode-cover"
|
|
3539
3896
|
}));
|
|
3540
3897
|
};
|
|
3898
|
+
|
|
3541
3899
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3542
3900
|
Wrapper: Wrapper,
|
|
3543
3901
|
Visualization: Visualization
|
|
3544
3902
|
});
|
|
3545
3903
|
return Wrapper;
|
|
3546
3904
|
};
|
|
3905
|
+
|
|
3547
3906
|
exports.default = withEditModeCover;
|
|
3548
3907
|
|
|
3549
3908
|
/***/ }),
|
|
@@ -3557,27 +3916,37 @@ exports.default = withEditModeCover;
|
|
|
3557
3916
|
Object.defineProperty(exports, "__esModule", {
|
|
3558
3917
|
value: true
|
|
3559
3918
|
});
|
|
3919
|
+
|
|
3560
3920
|
var React = __webpack_require__(1);
|
|
3921
|
+
|
|
3561
3922
|
var colorUtils_1 = __webpack_require__(12);
|
|
3923
|
+
|
|
3562
3924
|
var variables_1 = __webpack_require__(11);
|
|
3925
|
+
|
|
3563
3926
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
3927
|
+
|
|
3564
3928
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3929
|
+
|
|
3565
3930
|
var hocUtils_1 = __webpack_require__(15);
|
|
3931
|
+
|
|
3566
3932
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3567
3933
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3568
3934
|
var config = Visualization.config;
|
|
3569
3935
|
var themes = config.themes;
|
|
3936
|
+
|
|
3570
3937
|
var Wrapper = function Wrapper(props) {
|
|
3571
3938
|
var _a, _b;
|
|
3939
|
+
|
|
3572
3940
|
var dataSources = props.dataSources,
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3941
|
+
loading = props.loading,
|
|
3942
|
+
options = props.options,
|
|
3943
|
+
height = props.height,
|
|
3944
|
+
width = props.width;
|
|
3577
3945
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3578
3946
|
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);
|
|
3579
3947
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3580
3948
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
3949
|
+
|
|
3581
3950
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3582
3951
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3583
3952
|
"data-test": "icon-placeholder",
|
|
@@ -3588,14 +3957,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3588
3957
|
iconColor: iconColor
|
|
3589
3958
|
});
|
|
3590
3959
|
}
|
|
3960
|
+
|
|
3591
3961
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3592
3962
|
};
|
|
3963
|
+
|
|
3593
3964
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3594
3965
|
Wrapper: Wrapper,
|
|
3595
3966
|
Visualization: Visualization
|
|
3596
3967
|
});
|
|
3597
3968
|
return Wrapper;
|
|
3598
3969
|
};
|
|
3970
|
+
|
|
3599
3971
|
exports.default = withPlaceholder;
|
|
3600
3972
|
|
|
3601
3973
|
/***/ }),
|
|
@@ -3610,28 +3982,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3610
3982
|
value: true
|
|
3611
3983
|
});
|
|
3612
3984
|
exports.themes = exports.computeVizProps = exports.PureSingleValueIcon = exports.config = void 0;
|
|
3985
|
+
|
|
3613
3986
|
var React = __webpack_require__(1);
|
|
3987
|
+
|
|
3614
3988
|
var RemoteIcon_1 = __webpack_require__(471);
|
|
3989
|
+
|
|
3615
3990
|
var iconUtils_1 = __webpack_require__(472);
|
|
3991
|
+
|
|
3616
3992
|
var SingleValueIcon_1 = __webpack_require__(490);
|
|
3617
|
-
|
|
3993
|
+
|
|
3994
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
3995
|
+
|
|
3618
3996
|
var config_1 = __webpack_require__(473);
|
|
3997
|
+
|
|
3619
3998
|
var withTrellis_1 = __webpack_require__(106);
|
|
3999
|
+
|
|
3620
4000
|
exports.config = config_1.default;
|
|
3621
4001
|
exports.PureSingleValueIcon = SingleValueIcon_1.default;
|
|
4002
|
+
|
|
3622
4003
|
var computeVizProps = function computeVizProps(_ref) {
|
|
3623
4004
|
var icon = _ref.icon,
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
4005
|
+
_ref$IconComponent = _ref.IconComponent,
|
|
4006
|
+
IconComponent = _ref$IconComponent === void 0 ? null : _ref$IconComponent,
|
|
4007
|
+
themeFunc = _ref.themeFunc,
|
|
4008
|
+
trellisKey = _ref.trellisKey,
|
|
4009
|
+
trellisSplitBy = _ref.trellisSplitBy;
|
|
4010
|
+
|
|
3629
4011
|
if (icon && ((0, iconUtils_1.isRemoteIcon)(icon) || (0, iconUtils_1.isDataURI)(icon))) {
|
|
3630
4012
|
// eslint-disable-next-line no-param-reassign
|
|
3631
4013
|
IconComponent = React.createElement(RemoteIcon_1.default, {
|
|
3632
4014
|
iconURL: icon
|
|
3633
4015
|
});
|
|
3634
4016
|
}
|
|
4017
|
+
|
|
3635
4018
|
return {
|
|
3636
4019
|
IconComponent: IconComponent,
|
|
3637
4020
|
defaultFontColor: themeFunc('defaultFontColor'),
|
|
@@ -3640,6 +4023,7 @@ var computeVizProps = function computeVizProps(_ref) {
|
|
|
3640
4023
|
trellisSplitBy: trellisSplitBy
|
|
3641
4024
|
};
|
|
3642
4025
|
};
|
|
4026
|
+
|
|
3643
4027
|
exports.computeVizProps = computeVizProps;
|
|
3644
4028
|
var viz = (0, withTrellis_1.default)((0, withDashboardViz_1.default)({
|
|
3645
4029
|
ReactViz: SingleValueIcon_1.default,
|
|
@@ -3672,29 +4056,51 @@ module.exports = require("@splunk/visualizations-shared/iconUtils");
|
|
|
3672
4056
|
|
|
3673
4057
|
|
|
3674
4058
|
var _toConsumableArray = __webpack_require__(8);
|
|
4059
|
+
|
|
3675
4060
|
Object.defineProperty(exports, "__esModule", {
|
|
3676
4061
|
value: true
|
|
3677
4062
|
});
|
|
4063
|
+
|
|
3678
4064
|
var i18n_1 = __webpack_require__(2);
|
|
4065
|
+
|
|
3679
4066
|
var schemaUtils_1 = __webpack_require__(16);
|
|
4067
|
+
|
|
3680
4068
|
var PresetPalettes_1 = __webpack_require__(61);
|
|
4069
|
+
|
|
3681
4070
|
var pick_1 = __webpack_require__(23);
|
|
4071
|
+
|
|
3682
4072
|
var variables_1 = __webpack_require__(11);
|
|
4073
|
+
|
|
3683
4074
|
var configUtils_1 = __webpack_require__(22);
|
|
4075
|
+
|
|
3684
4076
|
var singleValueContext_1 = __webpack_require__(135);
|
|
4077
|
+
|
|
3685
4078
|
var StaticMajorAndTrendLayout_1 = __webpack_require__(102);
|
|
3686
|
-
|
|
4079
|
+
|
|
4080
|
+
var StaticBackgroundColorEditor_1 = __webpack_require__(91);
|
|
4081
|
+
|
|
3687
4082
|
var StaticIconColorEditor_1 = __webpack_require__(474);
|
|
4083
|
+
|
|
3688
4084
|
var StaticMajorColorEditor_1 = __webpack_require__(103);
|
|
4085
|
+
|
|
3689
4086
|
var StaticTrendColorEditor_1 = __webpack_require__(104);
|
|
4087
|
+
|
|
3690
4088
|
var DynamicMajorColorEditor_1 = __webpack_require__(136);
|
|
4089
|
+
|
|
3691
4090
|
var DynamicTrendColorEditor_1 = __webpack_require__(100);
|
|
4091
|
+
|
|
3692
4092
|
var DynamicBackgroundColorEditor_1 = __webpack_require__(101);
|
|
4093
|
+
|
|
3693
4094
|
var TrellisEditors_1 = __webpack_require__(105);
|
|
4095
|
+
|
|
3694
4096
|
var VizBehavior_1 = __webpack_require__(6);
|
|
4097
|
+
|
|
3695
4098
|
var configUtils_2 = __webpack_require__(20);
|
|
3696
|
-
|
|
4099
|
+
|
|
4100
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
4101
|
+
|
|
3697
4102
|
var layoutUtils_1 = __webpack_require__(58);
|
|
4103
|
+
|
|
3698
4104
|
var dataContract = {
|
|
3699
4105
|
requiredDataSources: [{
|
|
3700
4106
|
name: 'primary',
|
|
@@ -3941,6 +4347,7 @@ var presets = [{
|
|
|
3941
4347
|
* common theme variables such as enterprise.defaultFontColor
|
|
3942
4348
|
* that are repeated in multiple viz config themes should be DRYd up.
|
|
3943
4349
|
*/
|
|
4350
|
+
|
|
3944
4351
|
var themes = {
|
|
3945
4352
|
defaultFontColor: function defaultFontColor(props) {
|
|
3946
4353
|
return (0, pick_1.default)({
|
|
@@ -4020,7 +4427,7 @@ var editorConfig = [{
|
|
|
4020
4427
|
presets: presets,
|
|
4021
4428
|
value: function value(_ref3) {
|
|
4022
4429
|
var context = _ref3.context,
|
|
4023
|
-
|
|
4430
|
+
options = _ref3.options;
|
|
4024
4431
|
var initialPreset = (0, configUtils_2.getInitialPreset)(context, options, presets);
|
|
4025
4432
|
return initialPreset && initialPreset.label || null;
|
|
4026
4433
|
}
|
|
@@ -4118,16 +4525,19 @@ var editorConfig = [{
|
|
|
4118
4525
|
/**
|
|
4119
4526
|
* visualization configuration
|
|
4120
4527
|
*/
|
|
4528
|
+
|
|
4121
4529
|
var config = {
|
|
4122
4530
|
/**
|
|
4123
4531
|
* unique viz key
|
|
4124
4532
|
*/
|
|
4125
4533
|
key: 'splunk.singlevalueicon',
|
|
4534
|
+
|
|
4126
4535
|
/**
|
|
4127
4536
|
* viz name
|
|
4128
4537
|
*/
|
|
4129
4538
|
name: (0, i18n_1._)('Single value icon'),
|
|
4130
4539
|
category: VizCategory_1.VizCategory.SINGLE_VALUE,
|
|
4540
|
+
|
|
4131
4541
|
/**
|
|
4132
4542
|
* viz icon
|
|
4133
4543
|
*/
|
|
@@ -4306,34 +4716,33 @@ var iconMap = {
|
|
|
4306
4716
|
star: Star_default.a,
|
|
4307
4717
|
default: Question_default.a
|
|
4308
4718
|
};
|
|
4309
|
-
|
|
4310
4719
|
/*
|
|
4311
4720
|
* get icon from icon map
|
|
4312
4721
|
* @param {String} key
|
|
4313
4722
|
* @return {Icon} icon component from icon map
|
|
4314
4723
|
*/
|
|
4724
|
+
|
|
4315
4725
|
var getIcon = function getIcon(key) {
|
|
4316
4726
|
return iconMap[key.toLowerCase()] || iconMap.default;
|
|
4317
4727
|
};
|
|
4318
|
-
|
|
4319
4728
|
/*
|
|
4320
4729
|
* @method isValidPosition
|
|
4321
4730
|
* @param {String} iconPosition
|
|
4322
4731
|
* @returns {Bool}
|
|
4323
4732
|
*/
|
|
4733
|
+
|
|
4324
4734
|
var isValidPosition = function isValidPosition(iconPosition) {
|
|
4325
4735
|
return ICON_POSITIONS.indexOf(iconPosition) > -1;
|
|
4326
4736
|
};
|
|
4327
|
-
|
|
4328
4737
|
/*
|
|
4329
4738
|
* @method isHorizontal
|
|
4330
4739
|
* @param {String} iconPosition
|
|
4331
4740
|
* @returns {Bool}
|
|
4332
4741
|
*/
|
|
4742
|
+
|
|
4333
4743
|
var isHorizontal = function isHorizontal(iconPosition) {
|
|
4334
4744
|
return iconPosition === 'before' || iconPosition === 'after';
|
|
4335
4745
|
};
|
|
4336
|
-
|
|
4337
4746
|
/*
|
|
4338
4747
|
* @method getIconWidth
|
|
4339
4748
|
* @param {Object} props
|
|
@@ -4341,12 +4750,12 @@ var isHorizontal = function isHorizontal(iconPosition) {
|
|
|
4341
4750
|
* @param {Number} props.width
|
|
4342
4751
|
* @returns {Number} iconWidth
|
|
4343
4752
|
*/
|
|
4753
|
+
|
|
4344
4754
|
var getIconWidth = function getIconWidth(_ref) {
|
|
4345
4755
|
var showHorizontal = _ref.showHorizontal,
|
|
4346
|
-
|
|
4756
|
+
width = _ref.width;
|
|
4347
4757
|
return showHorizontal ? width * ICON_HORIZONTAL_RATIO : width * ICON_VERTICAL_RATIO;
|
|
4348
4758
|
};
|
|
4349
|
-
|
|
4350
4759
|
/*
|
|
4351
4760
|
* @method getIconHeight
|
|
4352
4761
|
* @param {Object} props
|
|
@@ -4354,12 +4763,12 @@ var getIconWidth = function getIconWidth(_ref) {
|
|
|
4354
4763
|
* @param {Number} props.height
|
|
4355
4764
|
* @returns {Number} iconHeight
|
|
4356
4765
|
*/
|
|
4766
|
+
|
|
4357
4767
|
var getIconHeight = function getIconHeight(_ref2) {
|
|
4358
4768
|
var showHorizontal = _ref2.showHorizontal,
|
|
4359
|
-
|
|
4769
|
+
height = _ref2.height;
|
|
4360
4770
|
return showHorizontal ? height : height * 0.25;
|
|
4361
4771
|
};
|
|
4362
|
-
|
|
4363
4772
|
/*
|
|
4364
4773
|
* @method getIconFontSize
|
|
4365
4774
|
* @param {Object} props
|
|
@@ -4368,13 +4777,13 @@ var getIconHeight = function getIconHeight(_ref2) {
|
|
|
4368
4777
|
* @param {Number} props.iconWidth
|
|
4369
4778
|
* @returns {Number} iconFontSize
|
|
4370
4779
|
*/
|
|
4780
|
+
|
|
4371
4781
|
var getIconFontSize = function getIconFontSize(_ref3) {
|
|
4372
4782
|
var showValue = _ref3.showValue,
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
return showValue ? majorTextFontSize * 0.
|
|
4783
|
+
majorTextFontSize = _ref3.majorTextFontSize,
|
|
4784
|
+
iconWidth = _ref3.iconWidth;
|
|
4785
|
+
return showValue ? majorTextFontSize * 0.8 : iconWidth;
|
|
4376
4786
|
};
|
|
4377
|
-
|
|
4378
4787
|
/*
|
|
4379
4788
|
* @method getSVGDimension
|
|
4380
4789
|
* @param {Object} props
|
|
@@ -4384,14 +4793,14 @@ var getIconFontSize = function getIconFontSize(_ref3) {
|
|
|
4384
4793
|
* @param {Number} props.ratio
|
|
4385
4794
|
* @returns {Number} svg icon dimension
|
|
4386
4795
|
*/
|
|
4796
|
+
|
|
4387
4797
|
var getSVGDimension = function getSVGDimension(_ref4) {
|
|
4388
4798
|
var showValue = _ref4.showValue,
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4799
|
+
containerDimension = _ref4.containerDimension,
|
|
4800
|
+
iconDimension = _ref4.iconDimension,
|
|
4801
|
+
ratio = _ref4.ratio;
|
|
4392
4802
|
return showValue ? iconDimension * ratio : containerDimension;
|
|
4393
4803
|
};
|
|
4394
|
-
|
|
4395
4804
|
/*
|
|
4396
4805
|
* @method getValuesWidth
|
|
4397
4806
|
* @param {Object} props
|
|
@@ -4399,12 +4808,12 @@ var getSVGDimension = function getSVGDimension(_ref4) {
|
|
|
4399
4808
|
* @param {Number} props.width
|
|
4400
4809
|
* @returns {Number} valuesWidth
|
|
4401
4810
|
*/
|
|
4811
|
+
|
|
4402
4812
|
var getValuesWidth = function getValuesWidth(_ref5) {
|
|
4403
4813
|
var showHorizontal = _ref5.showHorizontal,
|
|
4404
|
-
|
|
4814
|
+
width = _ref5.width;
|
|
4405
4815
|
return showHorizontal ? width * (1 - ICON_HORIZONTAL_RATIO) : width;
|
|
4406
4816
|
};
|
|
4407
|
-
|
|
4408
4817
|
/*
|
|
4409
4818
|
* @method getValuesHeight
|
|
4410
4819
|
* @param {Object} props
|
|
@@ -4413,13 +4822,13 @@ var getValuesWidth = function getValuesWidth(_ref5) {
|
|
|
4413
4822
|
* @param {Number} props.iconHeight
|
|
4414
4823
|
* @returns {Number} valuesHeight
|
|
4415
4824
|
*/
|
|
4825
|
+
|
|
4416
4826
|
var getValuesHeight = function getValuesHeight(_ref6) {
|
|
4417
4827
|
var showHorizontal = _ref6.showHorizontal,
|
|
4418
|
-
|
|
4419
|
-
|
|
4828
|
+
height = _ref6.height,
|
|
4829
|
+
iconHeight = _ref6.iconHeight;
|
|
4420
4830
|
return showHorizontal ? height : height - iconHeight;
|
|
4421
4831
|
};
|
|
4422
|
-
|
|
4423
4832
|
/*
|
|
4424
4833
|
* getIconColor
|
|
4425
4834
|
* @param {Object} props
|
|
@@ -4429,11 +4838,13 @@ var getValuesHeight = function getValuesHeight(_ref6) {
|
|
|
4429
4838
|
* @param {String} props.defaultBlockFontColor
|
|
4430
4839
|
* @returns {String} icon color
|
|
4431
4840
|
*/
|
|
4841
|
+
|
|
4432
4842
|
var iconUtils_getIconColor = function getIconColor(_ref7) {
|
|
4433
4843
|
var iconColor = _ref7.iconColor,
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4844
|
+
backgroundColor = _ref7.backgroundColor,
|
|
4845
|
+
defaultFontColor = _ref7.defaultFontColor,
|
|
4846
|
+
defaultBlockFontColor = _ref7.defaultBlockFontColor;
|
|
4847
|
+
|
|
4437
4848
|
if (Object(singleValueUtils["hasBackground"])(backgroundColor) && !iconColor) {
|
|
4438
4849
|
return Object(singleValueUtils["getDefaultColorWithBg"])({
|
|
4439
4850
|
backgroundColor: backgroundColor,
|
|
@@ -4441,6 +4852,7 @@ var iconUtils_getIconColor = function getIconColor(_ref7) {
|
|
|
4441
4852
|
defaultBlockFontColor: defaultBlockFontColor
|
|
4442
4853
|
});
|
|
4443
4854
|
}
|
|
4855
|
+
|
|
4444
4856
|
return Object(singleValueUtils["getFormattedColor"])(iconColor, defaultFontColor);
|
|
4445
4857
|
};
|
|
4446
4858
|
// CONCATENATED MODULE: ./src/SingleValueIcon/PureSingleValueIcon/IconContainer.jsx
|
|
@@ -4466,25 +4878,27 @@ var StyledIconContainer = external_styled_components_default.a.div.attrs(functio
|
|
|
4466
4878
|
}, function (props) {
|
|
4467
4879
|
return props.onClick ? 'pointer' : 'inherit';
|
|
4468
4880
|
});
|
|
4881
|
+
|
|
4469
4882
|
var IconContainer_IconContainer = function IconContainer(_ref) {
|
|
4470
4883
|
var width = _ref.width,
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4884
|
+
height = _ref.height,
|
|
4885
|
+
fontSize = _ref.fontSize,
|
|
4886
|
+
color = _ref.color,
|
|
4887
|
+
opacity = _ref.opacity,
|
|
4888
|
+
icon = _ref.icon,
|
|
4889
|
+
IconComponent = _ref.IconComponent,
|
|
4890
|
+
onIconClick = _ref.onIconClick;
|
|
4478
4891
|
var onClick = typeof onIconClick === 'function' ? onIconClick : undefined;
|
|
4892
|
+
|
|
4479
4893
|
if (IconComponent) {
|
|
4480
4894
|
return /*#__PURE__*/external_react_default.a.createElement(StyledIconContainer, {
|
|
4481
4895
|
width: width,
|
|
4482
4896
|
height: height,
|
|
4483
4897
|
onClick: onClick
|
|
4484
4898
|
}, IconComponent);
|
|
4485
|
-
}
|
|
4899
|
+
} // todo: remove it after we have proper icon provider
|
|
4900
|
+
|
|
4486
4901
|
|
|
4487
|
-
// todo: remove it after we have proper icon provider
|
|
4488
4902
|
var Icon = getIcon(icon);
|
|
4489
4903
|
return /*#__PURE__*/external_react_default.a.createElement(StyledIconContainer, {
|
|
4490
4904
|
width: width,
|
|
@@ -4495,6 +4909,7 @@ var IconContainer_IconContainer = function IconContainer(_ref) {
|
|
|
4495
4909
|
onClick: onClick
|
|
4496
4910
|
}, /*#__PURE__*/external_react_default.a.createElement(Icon, null));
|
|
4497
4911
|
};
|
|
4912
|
+
|
|
4498
4913
|
IconContainer_IconContainer.propTypes = {
|
|
4499
4914
|
width: external_prop_types_default.a.number.isRequired,
|
|
4500
4915
|
height: external_prop_types_default.a.number.isRequired,
|
|
@@ -4509,25 +4924,38 @@ IconContainer_IconContainer.propTypes = {
|
|
|
4509
4924
|
// CONCATENATED MODULE: ./src/SingleValueIcon/PureSingleValueIcon/SingleValueIconLayout.jsx
|
|
4510
4925
|
|
|
4511
4926
|
|
|
4927
|
+
|
|
4512
4928
|
function ownKeys(object, enumerableOnly) {
|
|
4513
4929
|
var keys = Object.keys(object);
|
|
4930
|
+
|
|
4514
4931
|
if (Object.getOwnPropertySymbols) {
|
|
4515
4932
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
4516
|
-
enumerableOnly
|
|
4933
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
4517
4934
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4518
|
-
})
|
|
4935
|
+
});
|
|
4936
|
+
keys.push.apply(keys, symbols);
|
|
4519
4937
|
}
|
|
4938
|
+
|
|
4520
4939
|
return keys;
|
|
4521
4940
|
}
|
|
4941
|
+
|
|
4522
4942
|
function _objectSpread(target) {
|
|
4523
4943
|
for (var i = 1; i < arguments.length; i++) {
|
|
4524
|
-
var source =
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4944
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
4945
|
+
|
|
4946
|
+
if (i % 2) {
|
|
4947
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
4948
|
+
defineProperty_default()(target, key, source[key]);
|
|
4949
|
+
});
|
|
4950
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
4951
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4952
|
+
} else {
|
|
4953
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
4954
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4955
|
+
});
|
|
4956
|
+
}
|
|
4530
4957
|
}
|
|
4958
|
+
|
|
4531
4959
|
return target;
|
|
4532
4960
|
}
|
|
4533
4961
|
|
|
@@ -4536,6 +4964,7 @@ function _objectSpread(target) {
|
|
|
4536
4964
|
|
|
4537
4965
|
|
|
4538
4966
|
|
|
4967
|
+
|
|
4539
4968
|
var Column = external_styled_components_default.a.div.withConfig({
|
|
4540
4969
|
displayName: "SingleValueIconLayout__Column",
|
|
4541
4970
|
componentId: "c8okr6-0"
|
|
@@ -4548,31 +4977,33 @@ var IconColumn = external_styled_components_default.a.div.withConfig({
|
|
|
4548
4977
|
displayName: "SingleValueIconLayout__IconColumn",
|
|
4549
4978
|
componentId: "c8okr6-2"
|
|
4550
4979
|
})(["display:flex;flex-direction:column;justify-content:center;height:100%;"]);
|
|
4980
|
+
|
|
4551
4981
|
var SingleValueIconLayout_SingleValueIconLayout = function SingleValueIconLayout(_ref) {
|
|
4552
4982
|
var props = extends_default()({}, _ref);
|
|
4983
|
+
|
|
4553
4984
|
var majorColor = props.majorColor,
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4985
|
+
majorText = props.majorText,
|
|
4986
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
4987
|
+
majorValueTitle = props.majorValueTitle,
|
|
4988
|
+
trendColor = props.trendColor,
|
|
4989
|
+
trendText = props.trendText,
|
|
4990
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
4991
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
4992
|
+
unit = props.unit,
|
|
4993
|
+
unitPosition = props.unitPosition,
|
|
4994
|
+
underLabel = props.underLabel,
|
|
4995
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
4996
|
+
underLabelColor = props.underLabelColor,
|
|
4997
|
+
onValueClick = props.onValueClick,
|
|
4998
|
+
iconWidth = props.iconWidth,
|
|
4999
|
+
iconHeight = props.iconHeight,
|
|
5000
|
+
icon = props.icon,
|
|
5001
|
+
iconColor = props.iconColor,
|
|
5002
|
+
iconOpacity = props.iconOpacity,
|
|
5003
|
+
iconPosition = props.iconPosition,
|
|
5004
|
+
iconFontSize = props.iconFontSize,
|
|
5005
|
+
showValue = props.showValue,
|
|
5006
|
+
svgIconComponent = props.svgIconComponent;
|
|
4576
5007
|
var iconContainer = /*#__PURE__*/external_react_default.a.createElement(PureSingleValueIcon_IconContainer, {
|
|
4577
5008
|
width: iconWidth,
|
|
4578
5009
|
height: iconHeight,
|
|
@@ -4601,13 +5032,16 @@ var SingleValueIconLayout_SingleValueIconLayout = function SingleValueIconLayout
|
|
|
4601
5032
|
}) : null;
|
|
4602
5033
|
var iconLayout = null;
|
|
4603
5034
|
var showHorizontal = isHorizontal(iconPosition);
|
|
5035
|
+
|
|
4604
5036
|
if (showHorizontal) {
|
|
4605
5037
|
iconLayout = /*#__PURE__*/external_react_default.a.createElement(IconRow, null, iconPosition === 'before' && iconContainer, singleValueBasic, iconPosition === 'after' && iconContainer);
|
|
4606
5038
|
} else {
|
|
4607
5039
|
iconLayout = /*#__PURE__*/external_react_default.a.createElement(IconColumn, null, iconPosition === 'top' && iconContainer, singleValueBasic, iconPosition === 'below' && iconContainer);
|
|
4608
5040
|
}
|
|
5041
|
+
|
|
4609
5042
|
return /*#__PURE__*/external_react_default.a.createElement(Column, null, iconLayout);
|
|
4610
5043
|
};
|
|
5044
|
+
|
|
4611
5045
|
SingleValueIconLayout_SingleValueIconLayout.propTypes = _objectSpread(_objectSpread({}, SingleValueBasic_default.a.propTypes), {}, {
|
|
4612
5046
|
iconWidth: external_prop_types_default.a.number,
|
|
4613
5047
|
iconHeight: external_prop_types_default.a.number,
|
|
@@ -4644,43 +5078,47 @@ var Container = external_styled_components_default.a.div.withConfig({
|
|
|
4644
5078
|
})(["overflow:hidden;", ";"], function (props) {
|
|
4645
5079
|
return Object(style_["toDimension"])(pick_default()(props, ['width', 'height']));
|
|
4646
5080
|
});
|
|
5081
|
+
|
|
4647
5082
|
var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
4648
5083
|
var props = extends_default()({}, _ref);
|
|
5084
|
+
|
|
4649
5085
|
var width = props.width,
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
5086
|
+
_props$height = props.height,
|
|
5087
|
+
height = _props$height === void 0 ? 250 : _props$height,
|
|
5088
|
+
style = props.style,
|
|
5089
|
+
majorFontSize = props.majorFontSize,
|
|
5090
|
+
majorValue = props.majorValue,
|
|
5091
|
+
majorValueField = props.majorValueField,
|
|
5092
|
+
trendValue = props.trendValue,
|
|
5093
|
+
trendFontSize = props.trendFontSize,
|
|
5094
|
+
unitPosition = props.unitPosition,
|
|
5095
|
+
numberPrecision = props.numberPrecision,
|
|
5096
|
+
shouldUseThousandSeparators = props.shouldUseThousandSeparators,
|
|
5097
|
+
shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
|
|
5098
|
+
icon = props.icon,
|
|
5099
|
+
iconOpacity = props.iconOpacity,
|
|
5100
|
+
IconComponent = props.IconComponent,
|
|
5101
|
+
noDataSources = props.noDataSources,
|
|
5102
|
+
noResult = props.noResult,
|
|
5103
|
+
onValueClick = props.onValueClick,
|
|
5104
|
+
defaultFontColor = props.defaultFontColor,
|
|
5105
|
+
defaultBlockFontColor = props.defaultBlockFontColor,
|
|
5106
|
+
splitByLayout = props.splitByLayout,
|
|
5107
|
+
_props$trellisKey = props.trellisKey,
|
|
5108
|
+
trellisKey = _props$trellisKey === void 0 ? '' : _props$trellisKey,
|
|
5109
|
+
_props$trellisSplitBy = props.trellisSplitBy,
|
|
5110
|
+
trellisSplitBy = _props$trellisSplitBy === void 0 ? '' : _props$trellisSplitBy;
|
|
4675
5111
|
var defaultColors = {
|
|
4676
5112
|
defaultBlockFontColor: defaultBlockFontColor,
|
|
4677
5113
|
defaultFontColor: defaultFontColor
|
|
4678
5114
|
};
|
|
5115
|
+
|
|
4679
5116
|
var _computeColors = Object(singleValueUtils["computeColors"])(props, defaultColors),
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
5117
|
+
backgroundColor = _computeColors.backgroundColor,
|
|
5118
|
+
majorColor = _computeColors.majorColor,
|
|
5119
|
+
trendColor = _computeColors.trendColor,
|
|
5120
|
+
underLabelColor = _computeColors.underLabelColor;
|
|
5121
|
+
|
|
4684
5122
|
var iconColor = iconUtils_getIconColor({
|
|
4685
5123
|
iconColor: props.iconColor,
|
|
4686
5124
|
backgroundColor: backgroundColor,
|
|
@@ -4693,9 +5131,11 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4693
5131
|
var handleValueClick = Object(external_react_["useCallback"])(function (ev) {
|
|
4694
5132
|
return Object(singleValueUtils["handleValueClickCallback"])(ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled, trellisSplitBy, trellisKey);
|
|
4695
5133
|
}, [onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]);
|
|
5134
|
+
|
|
4696
5135
|
var renderVisualization = function renderVisualization(_ref2) {
|
|
4697
5136
|
var containerWidth = _ref2.width,
|
|
4698
|
-
|
|
5137
|
+
containerHeight = _ref2.height;
|
|
5138
|
+
|
|
4699
5139
|
if ((noDataSources || noResult) && !IconComponent) {
|
|
4700
5140
|
return /*#__PURE__*/external_react_default.a.createElement(Message_default.a, {
|
|
4701
5141
|
width: containerWidth,
|
|
@@ -4704,7 +5144,9 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4704
5144
|
level: "warning"
|
|
4705
5145
|
});
|
|
4706
5146
|
}
|
|
5147
|
+
|
|
4707
5148
|
var IconLayout = null;
|
|
5149
|
+
|
|
4708
5150
|
if ((noDataSources || noResult) && IconComponent) {
|
|
4709
5151
|
IconLayout = /*#__PURE__*/external_react_default.a.cloneElement(IconComponent, {
|
|
4710
5152
|
width: containerWidth,
|
|
@@ -4715,14 +5157,16 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4715
5157
|
} else {
|
|
4716
5158
|
// will update later based on text size
|
|
4717
5159
|
var _props$showValue = props.showValue,
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
5160
|
+
showValue = _props$showValue === void 0 ? true : _props$showValue,
|
|
5161
|
+
trendDisplay = props.trendDisplay,
|
|
5162
|
+
unit = props.unit,
|
|
5163
|
+
underLabel = props.underLabel,
|
|
5164
|
+
iconPosition = props.iconPosition;
|
|
5165
|
+
|
|
4723
5166
|
if (!isValidPosition(iconPosition)) {
|
|
4724
5167
|
iconPosition = 'before';
|
|
4725
5168
|
}
|
|
5169
|
+
|
|
4726
5170
|
var showHorizontal = isHorizontal(iconPosition);
|
|
4727
5171
|
var iconWidth = getIconWidth({
|
|
4728
5172
|
showHorizontal: showHorizontal,
|
|
@@ -4733,26 +5177,27 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4733
5177
|
height: containerHeight
|
|
4734
5178
|
});
|
|
4735
5179
|
var svgIconComponent = null;
|
|
5180
|
+
|
|
4736
5181
|
if (IconComponent) {
|
|
4737
5182
|
svgIconComponent = /*#__PURE__*/external_react_default.a.cloneElement(IconComponent, {
|
|
4738
5183
|
width: getSVGDimension({
|
|
4739
5184
|
showValue: showValue,
|
|
4740
5185
|
containerDimension: containerWidth,
|
|
4741
5186
|
iconDimension: iconWidth,
|
|
4742
|
-
ratio: 0.
|
|
5187
|
+
ratio: 0.7
|
|
4743
5188
|
}),
|
|
4744
5189
|
height: getSVGDimension({
|
|
4745
5190
|
showValue: showValue,
|
|
4746
5191
|
containerDimension: containerHeight,
|
|
4747
5192
|
iconDimension: iconHeight,
|
|
4748
|
-
ratio: 0.
|
|
5193
|
+
ratio: 0.7
|
|
4749
5194
|
}),
|
|
4750
5195
|
color: props.iconColor,
|
|
4751
5196
|
opacity: iconOpacity
|
|
4752
5197
|
});
|
|
4753
|
-
}
|
|
5198
|
+
} // calculate major and trend text and font size
|
|
5199
|
+
|
|
4754
5200
|
|
|
4755
|
-
// claculate major and trend text and font size
|
|
4756
5201
|
var contentWidth = getValuesWidth({
|
|
4757
5202
|
showHorizontal: showHorizontal,
|
|
4758
5203
|
width: containerWidth
|
|
@@ -4775,41 +5220,43 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4775
5220
|
key: 'showValue',
|
|
4776
5221
|
value: false
|
|
4777
5222
|
}];
|
|
5223
|
+
|
|
4778
5224
|
var _computeSingleValueCo = Object(singleValueUtils["computeSingleValueContent"])({
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
5225
|
+
majorValue: majorValue,
|
|
5226
|
+
trendValue: trendValue,
|
|
5227
|
+
majorFontSize: majorFontSize,
|
|
5228
|
+
trendFontSize: trendFontSize,
|
|
5229
|
+
trendDisplay: trendDisplay,
|
|
5230
|
+
contentWidth: contentWidth,
|
|
5231
|
+
contentHeight: contentHeight,
|
|
5232
|
+
containerWidth: containerWidth,
|
|
5233
|
+
containerHeight: containerHeight,
|
|
5234
|
+
unit: unit,
|
|
5235
|
+
numberPrecision: numberPrecision,
|
|
5236
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
5237
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
5238
|
+
toRemoveList: toRemoveList
|
|
5239
|
+
}),
|
|
5240
|
+
majorText = _computeSingleValueCo.majorText,
|
|
5241
|
+
trendText = _computeSingleValueCo.trendText,
|
|
5242
|
+
majorTextFontSize = _computeSingleValueCo.majorTextFontSize,
|
|
5243
|
+
trendTextFontSize = _computeSingleValueCo.trendTextFontSize,
|
|
5244
|
+
majorValueTitle = _computeSingleValueCo.majorValueTitle,
|
|
5245
|
+
smallVizProps = _computeSingleValueCo.smallVizProps;
|
|
5246
|
+
|
|
4800
5247
|
if (!isEmpty_default()(smallVizProps)) {
|
|
4801
5248
|
showValue = smallVizProps.showValue;
|
|
4802
5249
|
trendDisplay = smallVizProps.trendDisplay;
|
|
4803
5250
|
underLabel = smallVizProps.underLabel;
|
|
4804
5251
|
unit = smallVizProps.unit;
|
|
4805
5252
|
}
|
|
5253
|
+
|
|
4806
5254
|
var iconFontSize = getIconFontSize({
|
|
4807
5255
|
showValue: showValue,
|
|
4808
5256
|
majorTextFontSize: majorTextFontSize,
|
|
4809
5257
|
iconWidth: iconWidth
|
|
4810
|
-
});
|
|
5258
|
+
}); // calculate underlabel size
|
|
4811
5259
|
|
|
4812
|
-
// calculate underlabel size
|
|
4813
5260
|
var underLabelHeight = Object(singleValueUtils["getUnderLabelHeight"])(containerHeight * 0.1);
|
|
4814
5261
|
var underLabelFontSize = Object(singleValueUtils["getUnderLabel"])({
|
|
4815
5262
|
underLabel: underLabel,
|
|
@@ -4843,12 +5290,14 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4843
5290
|
onValueClick: handleValueClick
|
|
4844
5291
|
});
|
|
4845
5292
|
}
|
|
5293
|
+
|
|
4846
5294
|
return /*#__PURE__*/external_react_default.a.createElement(VizStyleWrapper["default"], {
|
|
4847
5295
|
backgroundColor: backgroundColor,
|
|
4848
5296
|
style: style,
|
|
4849
5297
|
dataTestKey: "SingleValueIconWrapper"
|
|
4850
5298
|
}, IconLayout);
|
|
4851
5299
|
};
|
|
5300
|
+
|
|
4852
5301
|
if (isTrellisFeatureFlagOn && splitByLayout === layoutUtils["LAYOUT_TYPE"].Trellis) {
|
|
4853
5302
|
return /*#__PURE__*/external_react_default.a.createElement(external_react_default.a.Fragment, null, /*#__PURE__*/external_react_default.a.createElement(TrellisTitle["TrellisTitle"], {
|
|
4854
5303
|
fontColor: defaultFontColor,
|
|
@@ -4861,6 +5310,7 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4861
5310
|
return renderVisualization(containerDimension);
|
|
4862
5311
|
})));
|
|
4863
5312
|
}
|
|
5313
|
+
|
|
4864
5314
|
return /*#__PURE__*/external_react_default.a.createElement(Container, {
|
|
4865
5315
|
width: width,
|
|
4866
5316
|
height: height
|
|
@@ -4868,6 +5318,7 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4868
5318
|
return renderVisualization(containerDimension);
|
|
4869
5319
|
}));
|
|
4870
5320
|
};
|
|
5321
|
+
|
|
4871
5322
|
SingleValueIcon_SingleValueIcon.propTypes = {
|
|
4872
5323
|
width: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
4873
5324
|
height: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
@@ -4904,7 +5355,7 @@ SingleValueIcon_SingleValueIcon.propTypes = {
|
|
|
4904
5355
|
};
|
|
4905
5356
|
SingleValueIcon_SingleValueIcon.defaultProps = {
|
|
4906
5357
|
width: '100%',
|
|
4907
|
-
height:
|
|
5358
|
+
height: 400,
|
|
4908
5359
|
majorValue: 'N/A',
|
|
4909
5360
|
majorValueField: '',
|
|
4910
5361
|
trendDisplay: 'absolute',
|
|
@@ -4951,6 +5402,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4951
5402
|
});
|
|
4952
5403
|
exports.LAYOUT_TYPE = void 0;
|
|
4953
5404
|
var LAYOUT_TYPE;
|
|
5405
|
+
|
|
4954
5406
|
(function (LAYOUT_TYPE) {
|
|
4955
5407
|
LAYOUT_TYPE["Off"] = "off";
|
|
4956
5408
|
LAYOUT_TYPE["Trellis"] = "trellis";
|
|
@@ -4969,6 +5421,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4969
5421
|
});
|
|
4970
5422
|
exports.VizBehavior = void 0;
|
|
4971
5423
|
var VizBehavior;
|
|
5424
|
+
|
|
4972
5425
|
(function (VizBehavior) {
|
|
4973
5426
|
/**
|
|
4974
5427
|
* Dynamic Options Behavior.
|
|
@@ -4988,6 +5441,7 @@ var VizBehavior;
|
|
|
4988
5441
|
* missing.
|
|
4989
5442
|
* @type {string}
|
|
4990
5443
|
*/
|
|
5444
|
+
|
|
4991
5445
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
4992
5446
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
4993
5447
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -5051,8 +5505,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5051
5505
|
value: true
|
|
5052
5506
|
});
|
|
5053
5507
|
exports.TrellisTitle = exports.TRELLIS_TITLE_HEIGHT = void 0;
|
|
5508
|
+
|
|
5054
5509
|
var React = __webpack_require__(1);
|
|
5510
|
+
|
|
5055
5511
|
var styled_components_1 = __webpack_require__(4);
|
|
5512
|
+
|
|
5056
5513
|
exports.TRELLIS_TITLE_HEIGHT = 28;
|
|
5057
5514
|
var TrellisTitleText = styled_components_1.default.div.withConfig({
|
|
5058
5515
|
displayName: "TrellisTitle__TrellisTitleText",
|
|
@@ -5068,6 +5525,7 @@ var TrellisTitleDiv = styled_components_1.default.div.withConfig({
|
|
|
5068
5525
|
}, function (props) {
|
|
5069
5526
|
return props.backgroundColor;
|
|
5070
5527
|
});
|
|
5528
|
+
|
|
5071
5529
|
var TrellisTitle = function TrellisTitle(props) {
|
|
5072
5530
|
var titleText = String(props.trellisKey).toString();
|
|
5073
5531
|
return React.createElement(TrellisTitleDiv, {
|
|
@@ -5077,6 +5535,7 @@ var TrellisTitle = function TrellisTitle(props) {
|
|
|
5077
5535
|
title: titleText
|
|
5078
5536
|
}, React.createElement(TrellisTitleText, null, titleText));
|
|
5079
5537
|
};
|
|
5538
|
+
|
|
5080
5539
|
exports.TrellisTitle = TrellisTitle;
|
|
5081
5540
|
|
|
5082
5541
|
/***/ }),
|
|
@@ -5088,7 +5547,7 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
5088
5547
|
|
|
5089
5548
|
/***/ }),
|
|
5090
5549
|
|
|
5091
|
-
/***/
|
|
5550
|
+
/***/ 84:
|
|
5092
5551
|
/***/ (function(module, exports) {
|
|
5093
5552
|
|
|
5094
5553
|
module.exports = require("@splunk/visualizations-shared/trellisUtils");
|
|
@@ -5102,7 +5561,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
5102
5561
|
|
|
5103
5562
|
/***/ }),
|
|
5104
5563
|
|
|
5105
|
-
/***/
|
|
5564
|
+
/***/ 91:
|
|
5106
5565
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5107
5566
|
|
|
5108
5567
|
"use strict";
|
|
@@ -5126,7 +5585,7 @@ var StaticBackgroundColorEditor = {
|
|
|
5126
5585
|
|
|
5127
5586
|
/***/ }),
|
|
5128
5587
|
|
|
5129
|
-
/***/
|
|
5588
|
+
/***/ 94:
|
|
5130
5589
|
/***/ (function(module, exports) {
|
|
5131
5590
|
|
|
5132
5591
|
module.exports = require("@splunk/react-ui/Paginator");
|