@splunk/visualizations 26.0.0 → 26.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +103 -19
- package/Area.config.js.map +1 -1
- package/Area.js +646 -243
- package/Area.js.map +1 -1
- package/Bar.config.js +105 -21
- package/Bar.config.js.map +1 -1
- package/Bar.js +653 -237
- package/Bar.js.map +1 -1
- package/Bubble.config.js +95 -21
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +635 -229
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +66 -15
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +589 -211
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +104 -19
- package/Column.config.js.map +1 -1
- package/Column.js +666 -239
- package/Column.js.map +1 -1
- package/Ellipse.config.js +83 -18
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +444 -156
- package/Ellipse.js.map +1 -1
- package/Events.config.js +101 -19
- package/Events.config.js.map +1 -1
- package/Events.js +792 -322
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +97 -28
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +786 -390
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +63 -19
- package/Image.config.js.map +1 -1
- package/Image.js +439 -164
- package/Image.js.map +1 -1
- package/Line.config.js +107 -23
- package/Line.config.js.map +1 -1
- package/Line.js +841 -456
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +73 -23
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +653 -230
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +244 -99
- package/Map.config.js.map +1 -1
- package/Map.js +1223 -612
- package/Map.js.map +1 -1
- package/Markdown.config.js +71 -21
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +477 -202
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +80 -22
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +819 -418
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +73 -19
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +870 -491
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +76 -23
- package/Pie.config.js.map +1 -1
- package/Pie.js +643 -233
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +82 -30
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +863 -387
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +86 -20
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +449 -159
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +85 -23
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +895 -349
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +97 -23
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +639 -234
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +95 -25
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1198 -656
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +287 -226
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +93 -23
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +991 -522
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +100 -27
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1185 -624
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +127 -68
- package/SparkLine.js.map +1 -1
- package/Table.config.js +74 -21
- package/Table.config.js.map +1 -1
- package/Table.js +827 -329
- package/Table.js.map +1 -1
- package/common/Charting.js +152 -69
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +25 -14
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +530 -0
- package/common/DocExampleWithVizSandbox.js.map +1 -0
- package/common/EventsDoc.js +139 -104
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +79 -69
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +54 -45
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +178 -87
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +530 -68
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +47 -20
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +15 -9
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +57 -44
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +52 -20
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +139 -7
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +185 -102
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +28 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +50 -15
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +8 -3
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +4 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -1
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +288 -128
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +242 -197
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -1
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +62 -1
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +3 -1
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +389 -192
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +18 -26
package/SingleValueIcon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -127,7 +127,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
127
127
|
|
|
128
128
|
var getDynamicTrendColorEditor = function getDynamicTrendColorEditor(_ref) {
|
|
129
129
|
var defaultContext = _ref.defaultContext,
|
|
130
|
-
|
|
130
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
131
131
|
return {
|
|
132
132
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Trend value'),
|
|
133
133
|
option: 'trendColor',
|
|
@@ -172,7 +172,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
172
172
|
|
|
173
173
|
var getDynamicBackgroundColorEditor = function getDynamicBackgroundColorEditor(_ref) {
|
|
174
174
|
var defaultContext = _ref.defaultContext,
|
|
175
|
-
|
|
175
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
176
176
|
return {
|
|
177
177
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background'),
|
|
178
178
|
option: 'backgroundColor',
|
|
@@ -326,11 +326,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
326
326
|
value: true
|
|
327
327
|
});
|
|
328
328
|
exports.TrellisBackgroundColorEditor = exports.TrellisEditorConfig = void 0;
|
|
329
|
+
|
|
329
330
|
var React = __webpack_require__(1);
|
|
331
|
+
|
|
330
332
|
var i18n_1 = __webpack_require__(2);
|
|
333
|
+
|
|
331
334
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
335
|
+
|
|
332
336
|
var layoutUtils_1 = __webpack_require__(58);
|
|
333
337
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
338
|
+
|
|
339
|
+
|
|
334
340
|
exports.TrellisEditorConfig = [[{
|
|
335
341
|
label: (0, i18n_1._)('Trellis layout'),
|
|
336
342
|
option: 'splitByLayout',
|
|
@@ -428,37 +434,60 @@ exports.TrellisBackgroundColorEditor = {
|
|
|
428
434
|
|
|
429
435
|
|
|
430
436
|
var _slicedToArray = __webpack_require__(17);
|
|
437
|
+
|
|
431
438
|
var __rest = this && this.__rest || function (s, e) {
|
|
432
439
|
var t = {};
|
|
440
|
+
|
|
433
441
|
for (var p in s) {
|
|
434
442
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
435
443
|
}
|
|
444
|
+
|
|
436
445
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
437
446
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
438
447
|
}
|
|
439
448
|
return t;
|
|
440
449
|
};
|
|
450
|
+
|
|
441
451
|
Object.defineProperty(exports, "__esModule", {
|
|
442
452
|
value: true
|
|
443
453
|
});
|
|
454
|
+
|
|
444
455
|
var React = __webpack_require__(1);
|
|
456
|
+
|
|
445
457
|
var react_1 = __webpack_require__(1);
|
|
458
|
+
|
|
446
459
|
var lodash_1 = __webpack_require__(3);
|
|
460
|
+
|
|
447
461
|
var styled_components_1 = __webpack_require__(4);
|
|
448
|
-
|
|
462
|
+
|
|
463
|
+
var Paginator_1 = __webpack_require__(94);
|
|
464
|
+
|
|
449
465
|
var i18n_1 = __webpack_require__(2);
|
|
466
|
+
|
|
450
467
|
var themes_1 = __webpack_require__(60);
|
|
451
|
-
|
|
468
|
+
|
|
469
|
+
var useSplunkTheme_1 = __webpack_require__(56);
|
|
470
|
+
|
|
452
471
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
472
|
+
|
|
453
473
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
474
|
+
|
|
454
475
|
var style_1 = __webpack_require__(14);
|
|
476
|
+
|
|
455
477
|
var Message_1 = __webpack_require__(10);
|
|
456
|
-
|
|
478
|
+
|
|
479
|
+
var trellisUtils_1 = __webpack_require__(84);
|
|
480
|
+
|
|
457
481
|
var hocUtils_1 = __webpack_require__(27);
|
|
482
|
+
|
|
458
483
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
484
|
+
|
|
459
485
|
var Options_1 = __webpack_require__(30);
|
|
486
|
+
|
|
460
487
|
var trellisUtils_2 = __webpack_require__(107);
|
|
488
|
+
|
|
461
489
|
var layoutUtils_1 = __webpack_require__(58);
|
|
490
|
+
|
|
462
491
|
var TrellisContainer = styled_components_1.default.div.withConfig({
|
|
463
492
|
displayName: "withTrellis__TrellisContainer",
|
|
464
493
|
componentId: "pjmeig-0"
|
|
@@ -479,6 +508,7 @@ var TrellisContainerGrid = styled_components_1.default.div.withConfig({
|
|
|
479
508
|
}, function (props) {
|
|
480
509
|
return "".concat(props.rowHeight, "px");
|
|
481
510
|
});
|
|
511
|
+
|
|
482
512
|
var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
483
513
|
if (errorCode === 'INVALID_SPLIT_BY_FIELD') {
|
|
484
514
|
return React.createElement(Message_1.default, {
|
|
@@ -488,6 +518,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
488
518
|
level: "info"
|
|
489
519
|
});
|
|
490
520
|
}
|
|
521
|
+
|
|
491
522
|
if (errorCode === 'UNKNOWN_DATA_SPLIT_MODE') {
|
|
492
523
|
return React.createElement(Message_1.default, {
|
|
493
524
|
width: width,
|
|
@@ -496,6 +527,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
496
527
|
level: "info"
|
|
497
528
|
});
|
|
498
529
|
}
|
|
530
|
+
|
|
499
531
|
return React.createElement(Message_1.default, {
|
|
500
532
|
width: width,
|
|
501
533
|
height: height,
|
|
@@ -503,33 +535,38 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
503
535
|
level: "info"
|
|
504
536
|
});
|
|
505
537
|
};
|
|
538
|
+
|
|
506
539
|
var withTrellis = function withTrellis(Viz) {
|
|
507
540
|
var VizWithTrellis = function VizWithTrellis(opts) {
|
|
508
541
|
var _opts$options = opts.options,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
542
|
+
options = _opts$options === void 0 ? {} : _opts$options,
|
|
543
|
+
height = opts.height,
|
|
544
|
+
width = opts.width,
|
|
545
|
+
otherProps = __rest(opts, ["options", "height", "width"]);
|
|
546
|
+
|
|
513
547
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(Viz.config.optionsSchema, 'default');
|
|
514
548
|
var mergedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
|
|
515
549
|
var trellisColumns = mergedOptions.trellisColumns,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
550
|
+
trellisPageCount = mergedOptions.trellisPageCount,
|
|
551
|
+
trellisMinColumnWidth = mergedOptions.trellisMinColumnWidth,
|
|
552
|
+
trellisRowHeight = mergedOptions.trellisRowHeight,
|
|
553
|
+
splitByLayout = mergedOptions.splitByLayout,
|
|
554
|
+
trellisSplitBy = mergedOptions.trellisSplitBy;
|
|
521
555
|
var colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
|
|
522
556
|
var pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
|
|
523
557
|
var colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
|
|
524
558
|
var rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
|
|
559
|
+
|
|
525
560
|
var _ref = (0, react_1.useState)(1),
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
561
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
562
|
+
pageNum = _ref2[0],
|
|
563
|
+
setPageNum = _ref2[1];
|
|
564
|
+
|
|
529
565
|
var _ref3 = (0, react_1.useState)(null),
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
566
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
567
|
+
pagedData = _ref4[0],
|
|
568
|
+
setPagedData = _ref4[1];
|
|
569
|
+
|
|
533
570
|
var splitByKeys = [];
|
|
534
571
|
var totalPages = 0;
|
|
535
572
|
var showPaginator = false;
|
|
@@ -537,21 +574,25 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
537
574
|
var theme = {
|
|
538
575
|
splunkThemeV1: (0, useSplunkTheme_1.default)()
|
|
539
576
|
};
|
|
577
|
+
|
|
540
578
|
var _ref5 = (0, themes_1.getSettingsFromThemedProps)({
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
579
|
+
theme: theme
|
|
580
|
+
}),
|
|
581
|
+
currentThemeFamily = _ref5.family,
|
|
582
|
+
currentThemeColorScheme = _ref5.colorScheme,
|
|
583
|
+
currentThemeDensity = _ref5.density;
|
|
584
|
+
|
|
546
585
|
var trellisBackgroundColor = (0, react_1.useMemo)(function () {
|
|
547
586
|
var themeFunc = function themeFunc(themeVar) {
|
|
548
587
|
var _a, _b;
|
|
588
|
+
|
|
549
589
|
return (_b = (_a = Viz.config.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
550
590
|
trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
|
|
551
591
|
theme: theme
|
|
552
592
|
});
|
|
553
|
-
};
|
|
554
|
-
|
|
593
|
+
}; // trellisBackgroundColor option supports only static coloring and DSL option evaluation derived from the themes level only.
|
|
594
|
+
|
|
595
|
+
|
|
555
596
|
var evaluated = Options_1.Options.evaluate({
|
|
556
597
|
context: Viz.config.context,
|
|
557
598
|
options: {
|
|
@@ -564,6 +605,7 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
564
605
|
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields', undefined);
|
|
565
606
|
var noColumns = columns === undefined;
|
|
566
607
|
var noFields = fields === undefined;
|
|
608
|
+
|
|
567
609
|
var updateDataDisplay = function updateDataDisplay(currPage) {
|
|
568
610
|
if (!showPaginator) {
|
|
569
611
|
setPagedData(splitByKeys);
|
|
@@ -574,6 +616,7 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
574
616
|
setPagedData(paged);
|
|
575
617
|
}
|
|
576
618
|
};
|
|
619
|
+
|
|
577
620
|
(0, react_1.useEffect)(function () {
|
|
578
621
|
setPageNum(1);
|
|
579
622
|
updateDataDisplay(1);
|
|
@@ -587,9 +630,11 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
587
630
|
}, [pageNum, pagedData]);
|
|
588
631
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
589
632
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
633
|
+
|
|
590
634
|
if (!isTrellisFeatureFlagOn || !splitByLayout || splitByLayout !== layoutUtils_1.LAYOUT_TYPE.Trellis) {
|
|
591
635
|
return React.createElement(Viz, Object.assign({}, opts));
|
|
592
636
|
}
|
|
637
|
+
|
|
593
638
|
if (splitByLayout === layoutUtils_1.LAYOUT_TYPE.Trellis) {
|
|
594
639
|
if (noColumns || noFields) {
|
|
595
640
|
return React.createElement(Message_1.default, {
|
|
@@ -598,27 +643,34 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
598
643
|
message: (0, i18n_1._)('Loading'),
|
|
599
644
|
level: "info"
|
|
600
645
|
});
|
|
601
|
-
}
|
|
602
|
-
// If no trellisSplitBy value is passed in, assign default trellisSplitBy
|
|
646
|
+
} // If no trellisSplitBy value is passed in, assign default trellisSplitBy
|
|
603
647
|
// The default value will be the first value in the individual splitBy field list or 'aggregations'
|
|
648
|
+
|
|
649
|
+
|
|
604
650
|
var currTrellisSplitBy = trellisSplitBy;
|
|
651
|
+
|
|
605
652
|
if (!trellisSplitBy || trellisSplitBy.length === 0) {
|
|
606
653
|
var splitByPossibleFields = (0, trellisUtils_1.getAllPossibleSplitByFields)(fields);
|
|
607
654
|
currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : trellisUtils_2.AGGREGATIONS;
|
|
608
655
|
}
|
|
656
|
+
|
|
609
657
|
var splitMode = (0, trellisUtils_1.getTrellisDataSplitterMode)(fields);
|
|
610
658
|
var dataSplitResult = (0, trellisUtils_2.getTrellisDataSourcesBySplitMode)(splitMode, dataSources, currTrellisSplitBy);
|
|
611
659
|
var modifiedDataSourceBySplitBy = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.splitDataSources;
|
|
612
660
|
var dataSplitErrorCode = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.errorCode;
|
|
661
|
+
|
|
613
662
|
if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
|
|
614
663
|
return showErrorMessage(dataSplitErrorCode, width, height);
|
|
615
664
|
}
|
|
665
|
+
|
|
616
666
|
var splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
|
|
667
|
+
|
|
617
668
|
if (splitByKeysModified) {
|
|
618
669
|
showPaginator = splitByKeysModified.length > pageCount;
|
|
619
670
|
splitByKeys = splitByKeysModified;
|
|
620
671
|
totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
|
|
621
672
|
}
|
|
673
|
+
|
|
622
674
|
return React.createElement(TrellisContainer, {
|
|
623
675
|
height: height,
|
|
624
676
|
width: width,
|
|
@@ -635,8 +687,8 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
635
687
|
key: "div-child-".concat(idx.toString())
|
|
636
688
|
}, React.createElement(SizeAwareWrapper_1.default, null, function (_ref7) {
|
|
637
689
|
var childWidth = _ref7.childWidth,
|
|
638
|
-
|
|
639
|
-
|
|
690
|
+
_ref7$childHeight = _ref7.childHeight,
|
|
691
|
+
childHeight = _ref7$childHeight === void 0 ? rowHeight : _ref7$childHeight;
|
|
640
692
|
return React.createElement(Viz, Object.assign({}, otherProps, {
|
|
641
693
|
trellisKey: splitByKey,
|
|
642
694
|
trellisSplitBy: currTrellisSplitBy,
|
|
@@ -654,13 +706,16 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
654
706
|
totalPages: totalPages
|
|
655
707
|
}));
|
|
656
708
|
}
|
|
709
|
+
|
|
657
710
|
return null;
|
|
658
711
|
};
|
|
712
|
+
|
|
659
713
|
VizWithTrellis.propTypes = Viz.proptypes;
|
|
660
714
|
VizWithTrellis.defaultProps = Viz.defaultProps;
|
|
661
715
|
VizWithTrellis.config = Viz.config;
|
|
662
716
|
return VizWithTrellis;
|
|
663
717
|
};
|
|
718
|
+
|
|
664
719
|
exports.default = withTrellis;
|
|
665
720
|
|
|
666
721
|
/***/ }),
|
|
@@ -672,12 +727,16 @@ exports.default = withTrellis;
|
|
|
672
727
|
|
|
673
728
|
|
|
674
729
|
var _toConsumableArray = __webpack_require__(8);
|
|
730
|
+
|
|
675
731
|
Object.defineProperty(exports, "__esModule", {
|
|
676
732
|
value: true
|
|
677
733
|
});
|
|
678
734
|
exports.getTrellisDataSourcesBySplitMode = exports.dataSourcesSplitByModeStatsorUnknown = exports.dataSourcesSplitByModeChart = exports.dataSourcesSplitByModeTimechart = exports.dataSourcesSplitByAggregationsStats = exports.dataSourcesSplitByAggregationsTimechartAndChart = exports.dataSourcesSplitByAggregationsUnknown = exports.AGGREGATIONS = void 0;
|
|
735
|
+
|
|
679
736
|
var lodash_1 = __webpack_require__(3);
|
|
680
|
-
|
|
737
|
+
|
|
738
|
+
var trellisUtils_1 = __webpack_require__(84);
|
|
739
|
+
|
|
681
740
|
exports.AGGREGATIONS = 'aggregations';
|
|
682
741
|
/**
|
|
683
742
|
* There can be certain SPL cmds that can produce dataSource without a specific field meta info (like group_by_rank, split_by_field etc),
|
|
@@ -687,16 +746,21 @@ exports.AGGREGATIONS = 'aggregations';
|
|
|
687
746
|
* Example3:- `index = "_internal" | stats count`
|
|
688
747
|
* Example4:- `index=_internal | stats avg(count), max(count)`
|
|
689
748
|
*/
|
|
749
|
+
|
|
690
750
|
var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregationsUnknown(dataSource) {
|
|
691
751
|
var _a, _b, _c, _d;
|
|
752
|
+
|
|
692
753
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
693
754
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
694
755
|
var splitDataSources = null;
|
|
695
756
|
var errorCode = null;
|
|
757
|
+
|
|
696
758
|
if (fields && fields.length) {
|
|
697
759
|
splitDataSources = {};
|
|
760
|
+
|
|
698
761
|
for (var i = 0; i < fields.length; i += 1) {
|
|
699
762
|
var fieldName = fields[i].name;
|
|
763
|
+
|
|
700
764
|
if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
|
|
701
765
|
splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
702
766
|
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
@@ -706,22 +770,28 @@ var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregati
|
|
|
706
770
|
} else {
|
|
707
771
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
708
772
|
}
|
|
773
|
+
|
|
709
774
|
return {
|
|
710
775
|
splitDataSources: splitDataSources,
|
|
711
776
|
errorCode: errorCode
|
|
712
777
|
};
|
|
713
778
|
};
|
|
779
|
+
|
|
714
780
|
exports.dataSourcesSplitByAggregationsUnknown = dataSourcesSplitByAggregationsUnknown;
|
|
781
|
+
|
|
715
782
|
var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitByAggregationsTimechartAndChart(dataSource) {
|
|
716
783
|
var _a, _b, _c, _d;
|
|
784
|
+
|
|
717
785
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
718
786
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
719
787
|
var splitDataSources = null;
|
|
720
788
|
var splitByFields = [];
|
|
721
789
|
var errorCode = null;
|
|
790
|
+
|
|
722
791
|
if (typeof fields[0] !== 'string') {
|
|
723
792
|
splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
724
793
|
}
|
|
794
|
+
|
|
725
795
|
if (splitByFields && splitByFields.length > 0) {
|
|
726
796
|
splitDataSources = {};
|
|
727
797
|
splitByFields.forEach(function (splitByField) {
|
|
@@ -730,6 +800,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
730
800
|
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
731
801
|
fields.forEach(function (field, idx) {
|
|
732
802
|
var fieldName = field === null || field === void 0 ? void 0 : field.name;
|
|
803
|
+
|
|
733
804
|
if (fieldName !== '_time' && !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_')) && field.data_source === splitByField) {
|
|
734
805
|
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
735
806
|
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
@@ -741,8 +812,10 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
741
812
|
// example1 :- index=_internal | timechart count
|
|
742
813
|
// example2 :- index=_internal | timechart max(count) avg(count)
|
|
743
814
|
splitDataSources = {};
|
|
815
|
+
|
|
744
816
|
for (var i = 1; i < fields.length; i += 1) {
|
|
745
817
|
var fieldName = fields[i].name;
|
|
818
|
+
|
|
746
819
|
if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
|
|
747
820
|
splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
748
821
|
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
@@ -752,22 +825,28 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
752
825
|
} else {
|
|
753
826
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
754
827
|
}
|
|
828
|
+
|
|
755
829
|
return {
|
|
756
830
|
splitDataSources: splitDataSources,
|
|
757
831
|
errorCode: errorCode
|
|
758
832
|
};
|
|
759
833
|
};
|
|
834
|
+
|
|
760
835
|
exports.dataSourcesSplitByAggregationsTimechartAndChart = dataSourcesSplitByAggregationsTimechartAndChart;
|
|
836
|
+
|
|
761
837
|
var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregationsStats(dataSource) {
|
|
762
838
|
var _a, _b, _c, _d;
|
|
839
|
+
|
|
763
840
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
764
841
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
765
842
|
var splitDataSources = null;
|
|
766
843
|
var splitByFields = [];
|
|
767
844
|
var errorCode = null;
|
|
845
|
+
|
|
768
846
|
if (typeof fields[0] !== 'string') {
|
|
769
847
|
splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysStats)(fields);
|
|
770
848
|
}
|
|
849
|
+
|
|
771
850
|
if (splitByFields && splitByFields.length > 0) {
|
|
772
851
|
splitDataSources = {};
|
|
773
852
|
splitByFields.forEach(function (splitByField) {
|
|
@@ -777,6 +856,7 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
|
|
|
777
856
|
var idx = fields.findIndex(function (field) {
|
|
778
857
|
return field.name === splitByField;
|
|
779
858
|
});
|
|
859
|
+
|
|
780
860
|
if (idx > 0) {
|
|
781
861
|
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
782
862
|
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
@@ -785,32 +865,40 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
|
|
|
785
865
|
} else {
|
|
786
866
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
787
867
|
}
|
|
868
|
+
|
|
788
869
|
return {
|
|
789
870
|
splitDataSources: splitDataSources,
|
|
790
871
|
errorCode: errorCode
|
|
791
872
|
};
|
|
792
873
|
};
|
|
874
|
+
|
|
793
875
|
exports.dataSourcesSplitByAggregationsStats = dataSourcesSplitByAggregationsStats;
|
|
876
|
+
|
|
794
877
|
var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(dataSource, splitBy) {
|
|
795
878
|
var _a, _b, _c, _d, _e;
|
|
879
|
+
|
|
796
880
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
797
881
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
798
882
|
var splitDataSources = null;
|
|
799
883
|
var splitByFields = [];
|
|
800
884
|
var errorCode = null;
|
|
885
|
+
|
|
801
886
|
if (typeof fields[0] !== 'string') {
|
|
802
887
|
splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
|
|
803
888
|
}
|
|
889
|
+
|
|
804
890
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
805
891
|
splitDataSources = {};
|
|
806
892
|
var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
807
893
|
var valueKeys = [];
|
|
894
|
+
|
|
808
895
|
for (var i = 1; i < fields.length; i += 1) {
|
|
809
896
|
// not including internal fields
|
|
810
897
|
if (!((_e = fields[i].name) === null || _e === void 0 ? void 0 : _e.startsWith('_'))) {
|
|
811
898
|
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
812
899
|
}
|
|
813
900
|
}
|
|
901
|
+
|
|
814
902
|
valueKeys.forEach(function (val) {
|
|
815
903
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
816
904
|
splitDataSources[val].primary.data.fields = [{
|
|
@@ -832,22 +920,28 @@ var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(d
|
|
|
832
920
|
} else {
|
|
833
921
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
834
922
|
}
|
|
923
|
+
|
|
835
924
|
return {
|
|
836
925
|
splitDataSources: splitDataSources,
|
|
837
926
|
errorCode: errorCode
|
|
838
927
|
};
|
|
839
928
|
};
|
|
929
|
+
|
|
840
930
|
exports.dataSourcesSplitByModeTimechart = dataSourcesSplitByModeTimechart;
|
|
931
|
+
|
|
841
932
|
var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSource, splitBy) {
|
|
842
933
|
var _a, _b, _c, _d;
|
|
934
|
+
|
|
843
935
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
844
936
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
845
937
|
var splitDataSources = null;
|
|
846
938
|
var splitByFields = [];
|
|
847
939
|
var errorCode = null;
|
|
940
|
+
|
|
848
941
|
if (typeof fields[0] !== 'string') {
|
|
849
942
|
splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
|
|
850
943
|
}
|
|
944
|
+
|
|
851
945
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
852
946
|
splitDataSources = {};
|
|
853
947
|
var splitByFieldIdx = splitByFields.findIndex(function (f) {
|
|
@@ -858,6 +952,7 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
858
952
|
});
|
|
859
953
|
var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
860
954
|
var nonDataSourceAggregations = [];
|
|
955
|
+
|
|
861
956
|
if (!dataSourceKeys.length && fields[0].groupby_rank === '0' && fields.length && !fields[1].groupby_rank) {
|
|
862
957
|
/* check for another aggregation scenario where no key 'data_source' will be returned (applies for both chart and stats cmd)
|
|
863
958
|
For example :-
|
|
@@ -882,12 +977,14 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
882
977
|
nonDataSourceAggregations.push(fields[i].name);
|
|
883
978
|
}
|
|
884
979
|
}
|
|
980
|
+
|
|
885
981
|
if (splitByFieldIdx === 0) {
|
|
886
982
|
// if splitBy is the first field, split row wise
|
|
887
983
|
var valueKeys = (0, lodash_1.cloneDeep)(columns[0]);
|
|
888
984
|
valueKeys.forEach(function (val, idx) {
|
|
889
985
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
890
986
|
splitDataSources[val].primary.data.fields = [];
|
|
987
|
+
|
|
891
988
|
if (otherSplitBy.length) {
|
|
892
989
|
splitDataSources[val].primary.data.fields = [{
|
|
893
990
|
name: otherSplitBy[0]
|
|
@@ -959,16 +1056,20 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
959
1056
|
columnValues[1] = ['1','10','100']
|
|
960
1057
|
columnValues[2] = ['5', '50', '500']
|
|
961
1058
|
*/
|
|
1059
|
+
|
|
962
1060
|
var _loop = function _loop(_i) {
|
|
963
1061
|
columnValues[0].push(fields[_i].splitby_value ? fields[_i].splitby_value : fields[_i].name);
|
|
964
1062
|
dataSourceKeys.forEach(function (dskey, dsIndx) {
|
|
965
1063
|
var mul = (fields.length - 1) / dataSourceKeys.length; // This line does the index calculation
|
|
1064
|
+
|
|
966
1065
|
columnValues[dsIndx + 1].push(columns[_i + dsIndx * mul][idx]);
|
|
967
1066
|
});
|
|
968
1067
|
};
|
|
1068
|
+
|
|
969
1069
|
for (var _i = 1; _i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); _i += 1) {
|
|
970
1070
|
_loop(_i);
|
|
971
1071
|
}
|
|
1072
|
+
|
|
972
1073
|
splitDataSources[val].primary.data.columns = columnValues;
|
|
973
1074
|
})();
|
|
974
1075
|
} else if (nonDataSourceAggregations.length) {
|
|
@@ -990,9 +1091,11 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
990
1091
|
} else {
|
|
991
1092
|
// split column wise
|
|
992
1093
|
var _valueKeys = [];
|
|
1094
|
+
|
|
993
1095
|
for (var _i2 = 1; _i2 < fields.length; _i2 += 1) {
|
|
994
1096
|
_valueKeys.push(fields[_i2].splitby_value ? fields[_i2].splitby_value : fields[_i2].name);
|
|
995
1097
|
}
|
|
1098
|
+
|
|
996
1099
|
_valueKeys.forEach(function (val) {
|
|
997
1100
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
998
1101
|
splitDataSources[val].primary.data.fields = [{
|
|
@@ -1015,29 +1118,36 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
1015
1118
|
} else {
|
|
1016
1119
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
1017
1120
|
}
|
|
1121
|
+
|
|
1018
1122
|
return {
|
|
1019
1123
|
splitDataSources: splitDataSources,
|
|
1020
1124
|
errorCode: errorCode
|
|
1021
1125
|
};
|
|
1022
1126
|
};
|
|
1127
|
+
|
|
1023
1128
|
exports.dataSourcesSplitByModeChart = dataSourcesSplitByModeChart;
|
|
1024
1129
|
/**
|
|
1025
1130
|
* This method does datasplitting for 'stats' and generic cmds('makeresults','table' etc - categoried as 'unknown' splitMode).
|
|
1026
1131
|
* The main difference is for 'stats' cmd possible splitBy fields have 'group_by_rank' in field meta info, whereas for 'unknown' cmd it can be any fieldnames
|
|
1027
1132
|
*/
|
|
1133
|
+
|
|
1028
1134
|
var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatsorUnknown(dataSource, splitBy, splitMode) {
|
|
1029
1135
|
var _a, _b, _c, _d, _e, _f;
|
|
1136
|
+
|
|
1030
1137
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
1031
1138
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
1032
1139
|
var splitDataSources = null;
|
|
1033
1140
|
var splitByFields = [];
|
|
1034
1141
|
var errorCode = null;
|
|
1142
|
+
|
|
1035
1143
|
if (typeof fields[0] !== 'string') {
|
|
1036
1144
|
splitByFields = splitMode !== trellisUtils_1.UNKNOWN ? (0, trellisUtils_1.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_1.extractSplitByFieldsForUnknown)(fields);
|
|
1037
1145
|
}
|
|
1146
|
+
|
|
1038
1147
|
var splitByIndex = fields === null || fields === void 0 ? void 0 : fields.findIndex(function (field) {
|
|
1039
1148
|
return field === splitBy || field.name === splitBy;
|
|
1040
1149
|
});
|
|
1150
|
+
|
|
1041
1151
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
1042
1152
|
var splitByColumn = (_f = (_e = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.columns[splitByIndex];
|
|
1043
1153
|
splitDataSources = {};
|
|
@@ -1068,14 +1178,18 @@ var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatso
|
|
|
1068
1178
|
} else {
|
|
1069
1179
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
1070
1180
|
}
|
|
1181
|
+
|
|
1071
1182
|
return {
|
|
1072
1183
|
splitDataSources: splitDataSources,
|
|
1073
1184
|
errorCode: errorCode
|
|
1074
1185
|
};
|
|
1075
1186
|
};
|
|
1187
|
+
|
|
1076
1188
|
exports.dataSourcesSplitByModeStatsorUnknown = dataSourcesSplitByModeStatsorUnknown;
|
|
1189
|
+
|
|
1077
1190
|
var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode(splitMode, dataSources, trellisSplitBy) {
|
|
1078
1191
|
var result = null;
|
|
1192
|
+
|
|
1079
1193
|
try {
|
|
1080
1194
|
if (splitMode === trellisUtils_1.TIMECHART) {
|
|
1081
1195
|
result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsTimechartAndChart)(dataSources) : (0, exports.dataSourcesSplitByModeTimechart)(dataSources, trellisSplitBy);
|
|
@@ -1093,8 +1207,10 @@ var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode
|
|
|
1093
1207
|
errorCode: 'UNKNOWN'
|
|
1094
1208
|
};
|
|
1095
1209
|
}
|
|
1210
|
+
|
|
1096
1211
|
return result;
|
|
1097
1212
|
};
|
|
1213
|
+
|
|
1098
1214
|
exports.getTrellisDataSourcesBySplitMode = getTrellisDataSourcesBySplitMode;
|
|
1099
1215
|
|
|
1100
1216
|
/***/ }),
|
|
@@ -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.1 - b6df0a015",
|
|
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
|
/***/ }),
|
|
@@ -1368,35 +1497,35 @@ module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
|
1368
1497
|
|
|
1369
1498
|
/***/ }),
|
|
1370
1499
|
|
|
1371
|
-
/***/
|
|
1500
|
+
/***/ 172:
|
|
1372
1501
|
/***/ (function(module, exports) {
|
|
1373
1502
|
|
|
1374
1503
|
module.exports = require("@splunk/react-icons/enterprise/Activity");
|
|
1375
1504
|
|
|
1376
1505
|
/***/ }),
|
|
1377
1506
|
|
|
1378
|
-
/***/
|
|
1507
|
+
/***/ 173:
|
|
1379
1508
|
/***/ (function(module, exports) {
|
|
1380
1509
|
|
|
1381
1510
|
module.exports = require("@splunk/react-icons/enterprise/Clock");
|
|
1382
1511
|
|
|
1383
1512
|
/***/ }),
|
|
1384
1513
|
|
|
1385
|
-
/***/
|
|
1514
|
+
/***/ 174:
|
|
1386
1515
|
/***/ (function(module, exports) {
|
|
1387
1516
|
|
|
1388
1517
|
module.exports = require("@splunk/react-icons/enterprise/Pencil");
|
|
1389
1518
|
|
|
1390
1519
|
/***/ }),
|
|
1391
1520
|
|
|
1392
|
-
/***/
|
|
1521
|
+
/***/ 175:
|
|
1393
1522
|
/***/ (function(module, exports) {
|
|
1394
1523
|
|
|
1395
1524
|
module.exports = require("@splunk/react-icons/enterprise/Star");
|
|
1396
1525
|
|
|
1397
1526
|
/***/ }),
|
|
1398
1527
|
|
|
1399
|
-
/***/
|
|
1528
|
+
/***/ 176:
|
|
1400
1529
|
/***/ (function(module, exports) {
|
|
1401
1530
|
|
|
1402
1531
|
module.exports = require("@splunk/react-icons/enterprise/Question");
|
|
@@ -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: {
|
|
@@ -2740,9 +2958,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2740
2958
|
transform: 'translate(-50%, -50%)'
|
|
2741
2959
|
},
|
|
2742
2960
|
width: '50%',
|
|
2743
|
-
height: '50%'
|
|
2961
|
+
height: '50%',
|
|
2962
|
+
'data-test': 'icon-placeholder'
|
|
2744
2963
|
});
|
|
2745
2964
|
}
|
|
2965
|
+
|
|
2746
2966
|
return React.createElement(Message_1.default, {
|
|
2747
2967
|
width: width,
|
|
2748
2968
|
height: height,
|
|
@@ -2750,6 +2970,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2750
2970
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
2751
2971
|
});
|
|
2752
2972
|
};
|
|
2973
|
+
|
|
2753
2974
|
IconPlaceholder.propTypes = propTypes;
|
|
2754
2975
|
IconPlaceholder.defaultProps = {
|
|
2755
2976
|
width: '100%',
|
|
@@ -2766,21 +2987,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
2766
2987
|
|
|
2767
2988
|
|
|
2768
2989
|
var _defineProperty = __webpack_require__(7);
|
|
2990
|
+
|
|
2769
2991
|
Object.defineProperty(exports, "__esModule", {
|
|
2770
2992
|
value: true
|
|
2771
2993
|
});
|
|
2772
2994
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
2995
|
+
|
|
2773
2996
|
var T = __webpack_require__(0);
|
|
2997
|
+
|
|
2774
2998
|
var lodash_1 = __webpack_require__(3);
|
|
2775
|
-
|
|
2999
|
+
|
|
3000
|
+
var DataSource_1 = __webpack_require__(34);
|
|
3001
|
+
|
|
2776
3002
|
exports.SortParamsPropTypes = T.shape({
|
|
2777
3003
|
currentSortKey: T.string,
|
|
2778
3004
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
2779
3005
|
onSort: T.func
|
|
2780
3006
|
});
|
|
3007
|
+
|
|
2781
3008
|
var getSortingParams = function getSortingParams(_ref) {
|
|
2782
3009
|
var requestParams = _ref.requestParams,
|
|
2783
|
-
|
|
3010
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2784
3011
|
var currentSortKey;
|
|
2785
3012
|
var currentSortDir;
|
|
2786
3013
|
var nextSortDirMap = {
|
|
@@ -2789,15 +3016,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2789
3016
|
none: 'asc'
|
|
2790
3017
|
};
|
|
2791
3018
|
var onSort;
|
|
3019
|
+
|
|
2792
3020
|
if (typeof onRequestParamsChange === 'function') {
|
|
2793
3021
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
2794
3022
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
2795
3023
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
2796
|
-
}
|
|
2797
|
-
|
|
3024
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
3025
|
+
|
|
3026
|
+
|
|
2798
3027
|
onSort = function onSort(e, _ref2) {
|
|
2799
3028
|
var sortKey = _ref2.sortKey,
|
|
2800
|
-
|
|
3029
|
+
sortDir = _ref2.sortDir;
|
|
3030
|
+
|
|
2801
3031
|
if (typeof sortKey === 'string') {
|
|
2802
3032
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
2803
3033
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -2809,12 +3039,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2809
3039
|
}
|
|
2810
3040
|
};
|
|
2811
3041
|
}
|
|
3042
|
+
|
|
2812
3043
|
return {
|
|
2813
3044
|
currentSortKey: currentSortKey,
|
|
2814
3045
|
currentSortDir: currentSortDir,
|
|
2815
3046
|
onSort: onSort
|
|
2816
3047
|
};
|
|
2817
3048
|
};
|
|
3049
|
+
|
|
2818
3050
|
exports.getSortingParams = getSortingParams;
|
|
2819
3051
|
|
|
2820
3052
|
/***/ }),
|
|
@@ -2825,43 +3057,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
2825
3057
|
"use strict";
|
|
2826
3058
|
|
|
2827
3059
|
|
|
3060
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3061
|
+
value: true
|
|
3062
|
+
});
|
|
3063
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
3064
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3065
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
3066
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
3067
|
+
|
|
3068
|
+
/***/ }),
|
|
3069
|
+
|
|
3070
|
+
/***/ 35:
|
|
3071
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3072
|
+
|
|
3073
|
+
"use strict";
|
|
3074
|
+
|
|
3075
|
+
|
|
2828
3076
|
Object.defineProperty(exports, "__esModule", {
|
|
2829
3077
|
value: true
|
|
2830
3078
|
});
|
|
2831
3079
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
3080
|
+
|
|
2832
3081
|
var T = __webpack_require__(0);
|
|
3082
|
+
|
|
2833
3083
|
var lodash_1 = __webpack_require__(3);
|
|
3084
|
+
|
|
2834
3085
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
2835
3086
|
isPaging: T.bool,
|
|
2836
3087
|
current: T.number,
|
|
2837
3088
|
totalPages: T.number,
|
|
2838
3089
|
onChange: T.func
|
|
2839
3090
|
});
|
|
3091
|
+
|
|
2840
3092
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
2841
3093
|
var requestParams = _ref.requestParams,
|
|
2842
|
-
|
|
2843
|
-
|
|
3094
|
+
meta = _ref.meta,
|
|
3095
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2844
3096
|
var totalCount = meta && meta.totalCount || 0;
|
|
2845
3097
|
var offset = requestParams && requestParams.offset || 0;
|
|
2846
3098
|
var count = requestParams && requestParams.count;
|
|
2847
3099
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
2848
3100
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
2849
3101
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
3102
|
+
|
|
2850
3103
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
2851
3104
|
var page = _ref2.page,
|
|
2852
|
-
|
|
3105
|
+
countArg = _ref2.count;
|
|
2853
3106
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
3107
|
+
|
|
2854
3108
|
if (typeof countArg === 'number') {
|
|
2855
3109
|
newParams.count = countArg;
|
|
2856
3110
|
newParams.offset = 0;
|
|
2857
3111
|
}
|
|
3112
|
+
|
|
2858
3113
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
3114
|
+
|
|
2859
3115
|
if (typeof page === 'number' && page > 0) {
|
|
2860
3116
|
newParams.count = pageCount;
|
|
2861
3117
|
newParams.offset = (page - 1) * pageCount;
|
|
2862
3118
|
}
|
|
3119
|
+
|
|
2863
3120
|
onRequestParamsChange(newParams);
|
|
2864
3121
|
};
|
|
3122
|
+
|
|
2865
3123
|
return {
|
|
2866
3124
|
isPaging: isPaging,
|
|
2867
3125
|
current: current,
|
|
@@ -2869,11 +3127,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
2869
3127
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
2870
3128
|
};
|
|
2871
3129
|
};
|
|
3130
|
+
|
|
2872
3131
|
exports.getPaginationParams = getPaginationParams;
|
|
2873
3132
|
|
|
2874
3133
|
/***/ }),
|
|
2875
3134
|
|
|
2876
|
-
/***/
|
|
3135
|
+
/***/ 36:
|
|
2877
3136
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2878
3137
|
|
|
2879
3138
|
"use strict";
|
|
@@ -2884,6 +3143,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2884
3143
|
});
|
|
2885
3144
|
exports.VizCategory = void 0;
|
|
2886
3145
|
var VizCategory;
|
|
3146
|
+
|
|
2887
3147
|
(function (VizCategory) {
|
|
2888
3148
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
2889
3149
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -2901,67 +3161,96 @@ var VizCategory;
|
|
|
2901
3161
|
|
|
2902
3162
|
/***/ }),
|
|
2903
3163
|
|
|
2904
|
-
/***/
|
|
3164
|
+
/***/ 37:
|
|
2905
3165
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2906
3166
|
|
|
2907
3167
|
"use strict";
|
|
2908
3168
|
|
|
2909
3169
|
|
|
2910
3170
|
var _slicedToArray = __webpack_require__(17);
|
|
3171
|
+
|
|
2911
3172
|
Object.defineProperty(exports, "__esModule", {
|
|
2912
3173
|
value: true
|
|
2913
3174
|
});
|
|
3175
|
+
|
|
2914
3176
|
var React = __webpack_require__(1);
|
|
3177
|
+
|
|
2915
3178
|
var lodash_1 = __webpack_require__(3);
|
|
2916
|
-
|
|
3179
|
+
|
|
3180
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
3181
|
+
|
|
2917
3182
|
var Options_1 = __webpack_require__(30);
|
|
2918
|
-
|
|
3183
|
+
|
|
3184
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
3185
|
+
|
|
2919
3186
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
2920
|
-
|
|
3187
|
+
|
|
3188
|
+
var moment_1 = __webpack_require__(40);
|
|
3189
|
+
|
|
2921
3190
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
3191
|
+
|
|
2922
3192
|
var styled_components_1 = __webpack_require__(4);
|
|
3193
|
+
|
|
2923
3194
|
var hocUtils_1 = __webpack_require__(27);
|
|
3195
|
+
|
|
2924
3196
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
2925
|
-
|
|
3197
|
+
|
|
3198
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
3199
|
+
|
|
2926
3200
|
var id_1 = __webpack_require__(25);
|
|
2927
|
-
|
|
3201
|
+
|
|
3202
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
3203
|
+
|
|
2928
3204
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3205
|
+
|
|
2929
3206
|
var getSorting_1 = __webpack_require__(33);
|
|
2930
|
-
|
|
3207
|
+
|
|
3208
|
+
var getPagination_1 = __webpack_require__(35);
|
|
3209
|
+
|
|
2931
3210
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
3211
|
+
|
|
2932
3212
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
3213
|
+
|
|
2933
3214
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
3215
|
+
|
|
2934
3216
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
2935
3217
|
/**
|
|
2936
3218
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
2937
3219
|
* @param {DashboardVizOpts} opts
|
|
2938
3220
|
* @returns {HOC}
|
|
2939
3221
|
*/
|
|
3222
|
+
|
|
3223
|
+
|
|
2940
3224
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
2941
3225
|
var ReactViz = opts.ReactViz,
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
3226
|
+
vizConfig = opts.vizConfig,
|
|
3227
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
3228
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
3229
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
3230
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
3231
|
+
|
|
2947
3232
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
2948
3233
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
3234
|
+
|
|
2949
3235
|
var DashboardViz = function DashboardViz(props) {
|
|
2950
3236
|
var _a;
|
|
3237
|
+
|
|
2951
3238
|
var mode = props.mode,
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
3239
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
3240
|
+
dataSources = props.dataSources,
|
|
3241
|
+
options = props.options,
|
|
3242
|
+
_props$context = props.context,
|
|
3243
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
3244
|
+
width = props.width,
|
|
3245
|
+
height = props.height,
|
|
3246
|
+
onComputedProps = props.onComputedProps,
|
|
3247
|
+
onEventTrigger = props.onEventTrigger,
|
|
3248
|
+
theme = props.theme,
|
|
3249
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
3250
|
+
|
|
2963
3251
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
2964
|
-
|
|
3252
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
3253
|
+
|
|
2965
3254
|
if (serializedTimezone) {
|
|
2966
3255
|
/*
|
|
2967
3256
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -2975,38 +3264,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
2975
3264
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2976
3265
|
}
|
|
2977
3266
|
}
|
|
3267
|
+
|
|
2978
3268
|
var themeFunc = function themeFunc(themeVar) {
|
|
2979
3269
|
var _a, _b;
|
|
3270
|
+
|
|
2980
3271
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
2981
3272
|
};
|
|
3273
|
+
|
|
2982
3274
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
3275
|
+
|
|
2983
3276
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
3277
|
+
theme: theme
|
|
3278
|
+
}),
|
|
3279
|
+
currentThemeFamily = _ref.family,
|
|
3280
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
3281
|
+
currentThemeDensity = _ref.density;
|
|
3282
|
+
|
|
2989
3283
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
3284
|
+
|
|
2990
3285
|
var _React$useState = React.useState({}),
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3286
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3287
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
3288
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
3289
|
+
|
|
3290
|
+
|
|
2994
3291
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
3292
|
+
|
|
2995
3293
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
2996
|
-
|
|
2997
|
-
|
|
3294
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
3295
|
+
visualizationID = _React$useState4[0];
|
|
3296
|
+
|
|
2998
3297
|
var _React$useState5 = React.useState({}),
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3298
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3299
|
+
dataSourcesInState = _React$useState6[0],
|
|
3300
|
+
setDataSourcesInState = _React$useState6[1];
|
|
3301
|
+
|
|
3002
3302
|
var _React$useState7 = React.useState(),
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3303
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3304
|
+
dataFramesInState = _React$useState8[0],
|
|
3305
|
+
setDataFramesInState = _React$useState8[1];
|
|
3306
|
+
|
|
3006
3307
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3308
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
3309
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
3310
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
3311
|
+
|
|
3010
3312
|
var isMounted = React.useRef(true);
|
|
3011
3313
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
3012
3314
|
try {
|
|
@@ -3031,11 +3333,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3031
3333
|
});
|
|
3032
3334
|
} else {
|
|
3033
3335
|
var dataFrames = dataFramesInState;
|
|
3336
|
+
|
|
3034
3337
|
if (dataSources !== dataSourcesInState) {
|
|
3035
3338
|
setDataSourcesInState(dataSources);
|
|
3036
3339
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
3037
3340
|
setDataFramesInState(dataFrames);
|
|
3038
3341
|
}
|
|
3342
|
+
|
|
3039
3343
|
return Options_1.Options.evaluate({
|
|
3040
3344
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
3041
3345
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -3046,21 +3350,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3046
3350
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
3047
3351
|
return {};
|
|
3048
3352
|
}
|
|
3353
|
+
|
|
3049
3354
|
return {};
|
|
3050
3355
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
3051
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
3052
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
3356
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
3053
3357
|
// 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
3358
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
3359
|
+
|
|
3055
3360
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
3056
3361
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
3362
|
+
|
|
3057
3363
|
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
3364
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
3059
3365
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
3060
3366
|
});
|
|
3061
|
-
}
|
|
3062
|
-
// useEffect hook needs to be initialized before any early returns
|
|
3367
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
3063
3368
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
3369
|
+
|
|
3370
|
+
|
|
3064
3371
|
React.useEffect(function () {
|
|
3065
3372
|
onComputedProps(clonedEvaluatedOptions);
|
|
3066
3373
|
});
|
|
@@ -3070,53 +3377,68 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3070
3377
|
isMounted.current = false;
|
|
3071
3378
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
3072
3379
|
}
|
|
3073
|
-
};
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
// present warning message if any required props are missing
|
|
3380
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3381
|
+
}, []); // present warning message if any required props are missing
|
|
3382
|
+
|
|
3077
3383
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
3078
|
-
|
|
3079
|
-
|
|
3384
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
3385
|
+
supports = vizConfig.supports;
|
|
3080
3386
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
3387
|
+
|
|
3081
3388
|
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
3389
|
) {
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3390
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
3391
|
+
"data-test": "missing-props-message",
|
|
3392
|
+
width: width,
|
|
3393
|
+
height: height,
|
|
3394
|
+
missingProps: missing,
|
|
3395
|
+
backgroundColor: bgColorFromTheme
|
|
3396
|
+
});
|
|
3397
|
+
} // events
|
|
3398
|
+
|
|
3399
|
+
|
|
3092
3400
|
var eventCallbackProps = {};
|
|
3401
|
+
|
|
3093
3402
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
3094
3403
|
var supportedEvents = vizConfig.events;
|
|
3095
3404
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
3096
|
-
var
|
|
3097
|
-
|
|
3098
|
-
|
|
3405
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
3406
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
3407
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
3408
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
3099
3409
|
// then remove these lines
|
|
3100
|
-
|
|
3410
|
+
|
|
3101
3411
|
var payload = {};
|
|
3412
|
+
|
|
3102
3413
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
3103
3414
|
payloadKeys.forEach(function (p) {
|
|
3104
3415
|
payload[p] = evaluatedOptionsToUse[p];
|
|
3105
3416
|
});
|
|
3106
3417
|
}
|
|
3418
|
+
|
|
3107
3419
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
3108
3420
|
if (ev && ev.payload) {
|
|
3109
3421
|
payload = ev.payload;
|
|
3110
3422
|
}
|
|
3423
|
+
|
|
3111
3424
|
return onEventTrigger({
|
|
3112
3425
|
originalEvent: ev,
|
|
3113
3426
|
payload: payload,
|
|
3114
3427
|
type: eventName
|
|
3115
3428
|
});
|
|
3116
3429
|
};
|
|
3430
|
+
|
|
3431
|
+
if (parentKeys) {
|
|
3432
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
3433
|
+
var newObject = {};
|
|
3434
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
3435
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3117
3438
|
});
|
|
3118
|
-
}
|
|
3119
|
-
|
|
3439
|
+
} // compute pure viz props which are not from options
|
|
3440
|
+
|
|
3441
|
+
|
|
3120
3442
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
3121
3443
|
themeFunc: themeFunc
|
|
3122
3444
|
}));
|
|
@@ -3134,15 +3456,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3134
3456
|
* In future, we could automatically detect which all datasources are being used
|
|
3135
3457
|
* and bind those magically to pagination/sorting behavior.
|
|
3136
3458
|
*/
|
|
3459
|
+
|
|
3137
3460
|
var dataSourceMetadata = {};
|
|
3138
3461
|
var OptionKey = 'paginateDataSourceKey';
|
|
3139
3462
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
3463
|
+
|
|
3140
3464
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
3141
3465
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
3142
3466
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
3467
|
+
|
|
3143
3468
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
3144
3469
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
3145
3470
|
};
|
|
3471
|
+
|
|
3146
3472
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
3147
3473
|
requestParams: requestParams,
|
|
3148
3474
|
meta: meta,
|
|
@@ -3157,115 +3483,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3157
3483
|
sortParams: sortParams,
|
|
3158
3484
|
paginatorParams: paginatorParams
|
|
3159
3485
|
};
|
|
3160
|
-
}
|
|
3161
|
-
|
|
3486
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
3487
|
+
|
|
3488
|
+
|
|
3162
3489
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
3163
3490
|
return null;
|
|
3164
3491
|
}
|
|
3492
|
+
|
|
3165
3493
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
3166
3494
|
mode: mode,
|
|
3167
3495
|
width: width,
|
|
3168
3496
|
height: height
|
|
3169
3497
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
3170
3498
|
};
|
|
3499
|
+
|
|
3171
3500
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
3172
3501
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
3173
3502
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
3174
3503
|
theme: {}
|
|
3175
|
-
});
|
|
3176
|
-
|
|
3177
|
-
DashboardViz.config = vizConfig;
|
|
3178
|
-
|
|
3504
|
+
}); // attach viz config
|
|
3505
|
+
|
|
3506
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
3507
|
+
|
|
3179
3508
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
3180
3509
|
};
|
|
3510
|
+
|
|
3181
3511
|
exports.default = withDashboardViz;
|
|
3182
3512
|
|
|
3183
3513
|
/***/ }),
|
|
3184
3514
|
|
|
3185
|
-
/***/
|
|
3515
|
+
/***/ 38:
|
|
3186
3516
|
/***/ (function(module, exports) {
|
|
3187
3517
|
|
|
3188
3518
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
3189
3519
|
|
|
3190
3520
|
/***/ }),
|
|
3191
3521
|
|
|
3192
|
-
/***/
|
|
3522
|
+
/***/ 39:
|
|
3193
3523
|
/***/ (function(module, exports) {
|
|
3194
3524
|
|
|
3195
3525
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
3196
3526
|
|
|
3197
3527
|
/***/ }),
|
|
3198
3528
|
|
|
3199
|
-
/***/
|
|
3529
|
+
/***/ 4:
|
|
3200
3530
|
/***/ (function(module, exports) {
|
|
3201
3531
|
|
|
3202
|
-
module.exports = require("
|
|
3532
|
+
module.exports = require("styled-components");
|
|
3203
3533
|
|
|
3204
3534
|
/***/ }),
|
|
3205
3535
|
|
|
3206
|
-
/***/
|
|
3536
|
+
/***/ 40:
|
|
3207
3537
|
/***/ (function(module, exports) {
|
|
3208
3538
|
|
|
3209
|
-
module.exports = require("
|
|
3539
|
+
module.exports = require("@splunk/moment");
|
|
3210
3540
|
|
|
3211
3541
|
/***/ }),
|
|
3212
3542
|
|
|
3213
|
-
/***/
|
|
3543
|
+
/***/ 41:
|
|
3214
3544
|
/***/ (function(module, exports) {
|
|
3215
3545
|
|
|
3216
3546
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
3217
3547
|
|
|
3218
3548
|
/***/ }),
|
|
3219
3549
|
|
|
3220
|
-
/***/
|
|
3550
|
+
/***/ 42:
|
|
3221
3551
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3222
3552
|
|
|
3223
3553
|
"use strict";
|
|
3224
3554
|
|
|
3225
3555
|
|
|
3226
3556
|
var _classCallCheck = __webpack_require__(9);
|
|
3557
|
+
|
|
3227
3558
|
Object.defineProperty(exports, "__esModule", {
|
|
3228
3559
|
value: true
|
|
3229
3560
|
});
|
|
3230
3561
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
3231
3562
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
3563
|
+
|
|
3232
3564
|
var T = __webpack_require__(0);
|
|
3565
|
+
|
|
3233
3566
|
var lodash_1 = __webpack_require__(3);
|
|
3234
|
-
|
|
3235
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3567
|
+
|
|
3568
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3569
|
+
|
|
3570
|
+
|
|
3236
3571
|
exports.INITIAL_WIDTH = 250;
|
|
3237
3572
|
exports.INITIAL_HEIGHT = 250;
|
|
3238
3573
|
/**
|
|
3239
3574
|
* A Splunk visualization
|
|
3240
3575
|
*/
|
|
3576
|
+
|
|
3241
3577
|
var SplunkVisualization = function SplunkVisualization() {
|
|
3242
3578
|
_classCallCheck(this, SplunkVisualization);
|
|
3243
3579
|
};
|
|
3580
|
+
|
|
3244
3581
|
SplunkVisualization.propTypes = {
|
|
3245
3582
|
/**
|
|
3246
3583
|
* display mode
|
|
3247
3584
|
*/
|
|
3248
3585
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
3586
|
+
|
|
3249
3587
|
/**
|
|
3250
3588
|
* width in pixel or string, defaults to 100%
|
|
3251
3589
|
*/
|
|
3252
3590
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
3591
|
+
|
|
3253
3592
|
/**
|
|
3254
3593
|
* height in pixel or string
|
|
3255
3594
|
*/
|
|
3256
3595
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
3596
|
+
|
|
3257
3597
|
/**
|
|
3258
3598
|
* visualization context used for dynamic option evaluation
|
|
3259
3599
|
*/
|
|
3260
3600
|
context: T.object,
|
|
3601
|
+
|
|
3261
3602
|
/**
|
|
3262
3603
|
* visualization formatting options
|
|
3263
3604
|
*/
|
|
3264
3605
|
options: T.object,
|
|
3606
|
+
|
|
3265
3607
|
/**
|
|
3266
3608
|
* A callback to update formatting options
|
|
3267
3609
|
*/
|
|
3268
3610
|
onOptionsChange: T.func,
|
|
3611
|
+
|
|
3269
3612
|
/**
|
|
3270
3613
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
3271
3614
|
*/
|
|
@@ -3274,6 +3617,7 @@ SplunkVisualization.propTypes = {
|
|
|
3274
3617
|
* current request params
|
|
3275
3618
|
*/
|
|
3276
3619
|
requestParams: T.object,
|
|
3620
|
+
|
|
3277
3621
|
/**
|
|
3278
3622
|
* current dataset
|
|
3279
3623
|
*/
|
|
@@ -3281,6 +3625,7 @@ SplunkVisualization.propTypes = {
|
|
|
3281
3625
|
fields: T.array,
|
|
3282
3626
|
columns: T.array
|
|
3283
3627
|
}),
|
|
3628
|
+
|
|
3284
3629
|
/**
|
|
3285
3630
|
* error
|
|
3286
3631
|
*/
|
|
@@ -3288,29 +3633,35 @@ SplunkVisualization.propTypes = {
|
|
|
3288
3633
|
level: T.string,
|
|
3289
3634
|
message: T.string
|
|
3290
3635
|
}),
|
|
3636
|
+
|
|
3291
3637
|
/**
|
|
3292
3638
|
* meta data that came with the dataset
|
|
3293
3639
|
*/
|
|
3294
3640
|
meta: T.object
|
|
3295
3641
|
})),
|
|
3642
|
+
|
|
3296
3643
|
/**
|
|
3297
3644
|
* A callback to trigger event
|
|
3298
3645
|
*/
|
|
3299
3646
|
onEventTrigger: T.func,
|
|
3647
|
+
|
|
3300
3648
|
/**
|
|
3301
3649
|
* Inform viz if there are handlers listening to events
|
|
3302
3650
|
*/
|
|
3303
3651
|
hasEventHandlers: T.bool,
|
|
3652
|
+
|
|
3304
3653
|
/**
|
|
3305
3654
|
* A callback to communicate computed props to a consumer
|
|
3306
3655
|
*/
|
|
3307
3656
|
onComputedProps: T.func,
|
|
3657
|
+
|
|
3308
3658
|
/**
|
|
3309
3659
|
* A callback to obtain visualization api
|
|
3310
3660
|
*/
|
|
3311
3661
|
vizActionHandlerRef: T.func,
|
|
3312
3662
|
loading: T.bool,
|
|
3313
3663
|
theme: T.object,
|
|
3664
|
+
|
|
3314
3665
|
/**
|
|
3315
3666
|
* A callback to request new data with updated request params
|
|
3316
3667
|
*/
|
|
@@ -3319,6 +3670,7 @@ SplunkVisualization.propTypes = {
|
|
|
3319
3670
|
/**
|
|
3320
3671
|
*
|
|
3321
3672
|
*/
|
|
3673
|
+
|
|
3322
3674
|
SplunkVisualization.defaultProps = {
|
|
3323
3675
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
3324
3676
|
width: '100%',
|
|
@@ -3347,26 +3699,29 @@ exports.default = SplunkVisualization;
|
|
|
3347
3699
|
|
|
3348
3700
|
/***/ }),
|
|
3349
3701
|
|
|
3350
|
-
/***/
|
|
3702
|
+
/***/ 43:
|
|
3351
3703
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3352
3704
|
|
|
3353
3705
|
"use strict";
|
|
3354
3706
|
|
|
3355
3707
|
|
|
3356
3708
|
var _classCallCheck = __webpack_require__(9);
|
|
3709
|
+
|
|
3357
3710
|
var _createClass = __webpack_require__(18);
|
|
3711
|
+
|
|
3358
3712
|
Object.defineProperty(exports, "__esModule", {
|
|
3359
3713
|
value: true
|
|
3360
3714
|
});
|
|
3361
3715
|
exports.DefaultVizActionHandler = void 0;
|
|
3716
|
+
|
|
3362
3717
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
3363
3718
|
function DefaultVizActionHandler() {
|
|
3364
3719
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
3365
3720
|
}
|
|
3721
|
+
|
|
3366
3722
|
_createClass(DefaultVizActionHandler, [{
|
|
3367
3723
|
key: "focus",
|
|
3368
|
-
value: function focus() {
|
|
3369
|
-
// noop
|
|
3724
|
+
value: function focus() {// noop
|
|
3370
3725
|
}
|
|
3371
3726
|
}, {
|
|
3372
3727
|
key: "snapshot",
|
|
@@ -3374,23 +3729,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
3374
3729
|
return null; // noop
|
|
3375
3730
|
}
|
|
3376
3731
|
}]);
|
|
3732
|
+
|
|
3377
3733
|
return DefaultVizActionHandler;
|
|
3378
3734
|
}();
|
|
3379
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3380
|
-
|
|
3381
|
-
/***/ }),
|
|
3382
|
-
|
|
3383
|
-
/***/ 43:
|
|
3384
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3385
|
-
|
|
3386
|
-
"use strict";
|
|
3387
|
-
|
|
3388
3735
|
|
|
3389
|
-
|
|
3390
|
-
value: true
|
|
3391
|
-
});
|
|
3392
|
-
exports.validSortDirs = void 0;
|
|
3393
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3736
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3394
3737
|
|
|
3395
3738
|
/***/ }),
|
|
3396
3739
|
|
|
@@ -3404,7 +3747,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3404
3747
|
value: true
|
|
3405
3748
|
});
|
|
3406
3749
|
exports.useDeepMemo = void 0;
|
|
3750
|
+
|
|
3407
3751
|
var react_1 = __webpack_require__(1);
|
|
3752
|
+
|
|
3408
3753
|
var lodash_1 = __webpack_require__(3);
|
|
3409
3754
|
/**
|
|
3410
3755
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -3419,16 +3764,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3419
3764
|
* @param fn the function to be executed and
|
|
3420
3765
|
* @param dependencies an array of dependencies
|
|
3421
3766
|
*/
|
|
3767
|
+
|
|
3768
|
+
|
|
3422
3769
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
3423
3770
|
var ref = (0, react_1.useRef)();
|
|
3771
|
+
|
|
3424
3772
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
3425
3773
|
ref.current = {
|
|
3426
3774
|
dependencies: dependencies,
|
|
3427
3775
|
value: fn()
|
|
3428
3776
|
};
|
|
3429
3777
|
}
|
|
3778
|
+
|
|
3430
3779
|
return ref.current.value;
|
|
3431
3780
|
};
|
|
3781
|
+
|
|
3432
3782
|
exports.useDeepMemo = useDeepMemo;
|
|
3433
3783
|
|
|
3434
3784
|
/***/ }),
|
|
@@ -3443,19 +3793,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3443
3793
|
value: true
|
|
3444
3794
|
});
|
|
3445
3795
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
3796
|
+
|
|
3446
3797
|
var React = __webpack_require__(1);
|
|
3798
|
+
|
|
3447
3799
|
var T = __webpack_require__(0);
|
|
3800
|
+
|
|
3448
3801
|
var i18n_1 = __webpack_require__(2);
|
|
3802
|
+
|
|
3449
3803
|
var Message_1 = __webpack_require__(10);
|
|
3804
|
+
|
|
3450
3805
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
3451
3806
|
/**
|
|
3452
3807
|
* @method isMissing
|
|
3453
3808
|
* @param {any} v
|
|
3454
3809
|
* @returns {boolean} true if the input value === null or undefined
|
|
3455
3810
|
*/
|
|
3811
|
+
|
|
3812
|
+
|
|
3456
3813
|
var isMissing = function isMissing(v) {
|
|
3457
3814
|
return v === null || v === undefined;
|
|
3458
3815
|
};
|
|
3816
|
+
|
|
3459
3817
|
exports.isMissing = isMissing;
|
|
3460
3818
|
/**
|
|
3461
3819
|
* @method misskingKeys
|
|
@@ -3463,11 +3821,13 @@ exports.isMissing = isMissing;
|
|
|
3463
3821
|
* @param {object} target
|
|
3464
3822
|
* @returns {string[]} the keys of missing required props
|
|
3465
3823
|
*/
|
|
3824
|
+
|
|
3466
3825
|
var missingKeys = function missingKeys(keys, target) {
|
|
3467
3826
|
return keys.filter(function (k) {
|
|
3468
3827
|
return (0, exports.isMissing)(target[k]);
|
|
3469
3828
|
});
|
|
3470
3829
|
};
|
|
3830
|
+
|
|
3471
3831
|
exports.missingKeys = missingKeys;
|
|
3472
3832
|
var propTypes = {
|
|
3473
3833
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -3481,10 +3841,11 @@ var propTypes = {
|
|
|
3481
3841
|
* @param {MissingPropsProps} props
|
|
3482
3842
|
* @returns {React.ReactElement}
|
|
3483
3843
|
*/
|
|
3844
|
+
|
|
3484
3845
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
3485
3846
|
var width = props.width,
|
|
3486
|
-
|
|
3487
|
-
|
|
3847
|
+
height = props.height,
|
|
3848
|
+
missingProps = props.missingProps;
|
|
3488
3849
|
return React.createElement(Message_1.default, {
|
|
3489
3850
|
"data-test": "message",
|
|
3490
3851
|
width: width,
|
|
@@ -3492,6 +3853,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
3492
3853
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
3493
3854
|
});
|
|
3494
3855
|
};
|
|
3856
|
+
|
|
3495
3857
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
3496
3858
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
3497
3859
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -3511,15 +3873,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
3511
3873
|
Object.defineProperty(exports, "__esModule", {
|
|
3512
3874
|
value: true
|
|
3513
3875
|
});
|
|
3876
|
+
|
|
3514
3877
|
var React = __webpack_require__(1);
|
|
3878
|
+
|
|
3515
3879
|
var styled_components_1 = __webpack_require__(4);
|
|
3880
|
+
|
|
3516
3881
|
var hocUtils_1 = __webpack_require__(15);
|
|
3882
|
+
|
|
3517
3883
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3518
3884
|
displayName: "withEditModeCover__Cover",
|
|
3519
3885
|
componentId: "sc-1gsbnxb-0"
|
|
3520
3886
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3521
3887
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3522
|
-
'data-splunk-visualization-version': "26.
|
|
3888
|
+
'data-splunk-visualization-version': "26.1.1 - b6df0a015"
|
|
3523
3889
|
}).withConfig({
|
|
3524
3890
|
displayName: "withEditModeCover__Blocker",
|
|
3525
3891
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3530,6 +3896,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3530
3896
|
* @param {ExtendedDashViz} Visualization
|
|
3531
3897
|
* @returns {ExtendedDashViz} Wrapper
|
|
3532
3898
|
*/
|
|
3899
|
+
|
|
3533
3900
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3534
3901
|
var Wrapper = function Wrapper(props) {
|
|
3535
3902
|
var mode = props.mode;
|
|
@@ -3538,12 +3905,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3538
3905
|
"data-test": "edit-mode-cover"
|
|
3539
3906
|
}));
|
|
3540
3907
|
};
|
|
3908
|
+
|
|
3541
3909
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3542
3910
|
Wrapper: Wrapper,
|
|
3543
3911
|
Visualization: Visualization
|
|
3544
3912
|
});
|
|
3545
3913
|
return Wrapper;
|
|
3546
3914
|
};
|
|
3915
|
+
|
|
3547
3916
|
exports.default = withEditModeCover;
|
|
3548
3917
|
|
|
3549
3918
|
/***/ }),
|
|
@@ -3557,27 +3926,37 @@ exports.default = withEditModeCover;
|
|
|
3557
3926
|
Object.defineProperty(exports, "__esModule", {
|
|
3558
3927
|
value: true
|
|
3559
3928
|
});
|
|
3929
|
+
|
|
3560
3930
|
var React = __webpack_require__(1);
|
|
3931
|
+
|
|
3561
3932
|
var colorUtils_1 = __webpack_require__(12);
|
|
3933
|
+
|
|
3562
3934
|
var variables_1 = __webpack_require__(11);
|
|
3935
|
+
|
|
3563
3936
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
3937
|
+
|
|
3564
3938
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3939
|
+
|
|
3565
3940
|
var hocUtils_1 = __webpack_require__(15);
|
|
3941
|
+
|
|
3566
3942
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3567
3943
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3568
3944
|
var config = Visualization.config;
|
|
3569
3945
|
var themes = config.themes;
|
|
3946
|
+
|
|
3570
3947
|
var Wrapper = function Wrapper(props) {
|
|
3571
3948
|
var _a, _b;
|
|
3949
|
+
|
|
3572
3950
|
var dataSources = props.dataSources,
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3951
|
+
loading = props.loading,
|
|
3952
|
+
options = props.options,
|
|
3953
|
+
height = props.height,
|
|
3954
|
+
width = props.width;
|
|
3577
3955
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3578
3956
|
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
3957
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3580
3958
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
3959
|
+
|
|
3581
3960
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3582
3961
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3583
3962
|
"data-test": "icon-placeholder",
|
|
@@ -3588,14 +3967,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3588
3967
|
iconColor: iconColor
|
|
3589
3968
|
});
|
|
3590
3969
|
}
|
|
3970
|
+
|
|
3591
3971
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3592
3972
|
};
|
|
3973
|
+
|
|
3593
3974
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3594
3975
|
Wrapper: Wrapper,
|
|
3595
3976
|
Visualization: Visualization
|
|
3596
3977
|
});
|
|
3597
3978
|
return Wrapper;
|
|
3598
3979
|
};
|
|
3980
|
+
|
|
3599
3981
|
exports.default = withPlaceholder;
|
|
3600
3982
|
|
|
3601
3983
|
/***/ }),
|
|
@@ -3610,28 +3992,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3610
3992
|
value: true
|
|
3611
3993
|
});
|
|
3612
3994
|
exports.themes = exports.computeVizProps = exports.PureSingleValueIcon = exports.config = void 0;
|
|
3995
|
+
|
|
3613
3996
|
var React = __webpack_require__(1);
|
|
3997
|
+
|
|
3614
3998
|
var RemoteIcon_1 = __webpack_require__(471);
|
|
3999
|
+
|
|
3615
4000
|
var iconUtils_1 = __webpack_require__(472);
|
|
4001
|
+
|
|
3616
4002
|
var SingleValueIcon_1 = __webpack_require__(490);
|
|
3617
|
-
|
|
4003
|
+
|
|
4004
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
4005
|
+
|
|
3618
4006
|
var config_1 = __webpack_require__(473);
|
|
4007
|
+
|
|
3619
4008
|
var withTrellis_1 = __webpack_require__(106);
|
|
4009
|
+
|
|
3620
4010
|
exports.config = config_1.default;
|
|
3621
4011
|
exports.PureSingleValueIcon = SingleValueIcon_1.default;
|
|
4012
|
+
|
|
3622
4013
|
var computeVizProps = function computeVizProps(_ref) {
|
|
3623
4014
|
var icon = _ref.icon,
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
4015
|
+
_ref$IconComponent = _ref.IconComponent,
|
|
4016
|
+
IconComponent = _ref$IconComponent === void 0 ? null : _ref$IconComponent,
|
|
4017
|
+
themeFunc = _ref.themeFunc,
|
|
4018
|
+
trellisKey = _ref.trellisKey,
|
|
4019
|
+
trellisSplitBy = _ref.trellisSplitBy;
|
|
4020
|
+
|
|
3629
4021
|
if (icon && ((0, iconUtils_1.isRemoteIcon)(icon) || (0, iconUtils_1.isDataURI)(icon))) {
|
|
3630
4022
|
// eslint-disable-next-line no-param-reassign
|
|
3631
4023
|
IconComponent = React.createElement(RemoteIcon_1.default, {
|
|
3632
4024
|
iconURL: icon
|
|
3633
4025
|
});
|
|
3634
4026
|
}
|
|
4027
|
+
|
|
3635
4028
|
return {
|
|
3636
4029
|
IconComponent: IconComponent,
|
|
3637
4030
|
defaultFontColor: themeFunc('defaultFontColor'),
|
|
@@ -3640,6 +4033,7 @@ var computeVizProps = function computeVizProps(_ref) {
|
|
|
3640
4033
|
trellisSplitBy: trellisSplitBy
|
|
3641
4034
|
};
|
|
3642
4035
|
};
|
|
4036
|
+
|
|
3643
4037
|
exports.computeVizProps = computeVizProps;
|
|
3644
4038
|
var viz = (0, withTrellis_1.default)((0, withDashboardViz_1.default)({
|
|
3645
4039
|
ReactViz: SingleValueIcon_1.default,
|
|
@@ -3672,29 +4066,51 @@ module.exports = require("@splunk/visualizations-shared/iconUtils");
|
|
|
3672
4066
|
|
|
3673
4067
|
|
|
3674
4068
|
var _toConsumableArray = __webpack_require__(8);
|
|
4069
|
+
|
|
3675
4070
|
Object.defineProperty(exports, "__esModule", {
|
|
3676
4071
|
value: true
|
|
3677
4072
|
});
|
|
4073
|
+
|
|
3678
4074
|
var i18n_1 = __webpack_require__(2);
|
|
4075
|
+
|
|
3679
4076
|
var schemaUtils_1 = __webpack_require__(16);
|
|
4077
|
+
|
|
3680
4078
|
var PresetPalettes_1 = __webpack_require__(61);
|
|
4079
|
+
|
|
3681
4080
|
var pick_1 = __webpack_require__(23);
|
|
4081
|
+
|
|
3682
4082
|
var variables_1 = __webpack_require__(11);
|
|
4083
|
+
|
|
3683
4084
|
var configUtils_1 = __webpack_require__(22);
|
|
4085
|
+
|
|
3684
4086
|
var singleValueContext_1 = __webpack_require__(135);
|
|
4087
|
+
|
|
3685
4088
|
var StaticMajorAndTrendLayout_1 = __webpack_require__(102);
|
|
3686
|
-
|
|
4089
|
+
|
|
4090
|
+
var StaticBackgroundColorEditor_1 = __webpack_require__(91);
|
|
4091
|
+
|
|
3687
4092
|
var StaticIconColorEditor_1 = __webpack_require__(474);
|
|
4093
|
+
|
|
3688
4094
|
var StaticMajorColorEditor_1 = __webpack_require__(103);
|
|
4095
|
+
|
|
3689
4096
|
var StaticTrendColorEditor_1 = __webpack_require__(104);
|
|
4097
|
+
|
|
3690
4098
|
var DynamicMajorColorEditor_1 = __webpack_require__(136);
|
|
4099
|
+
|
|
3691
4100
|
var DynamicTrendColorEditor_1 = __webpack_require__(100);
|
|
4101
|
+
|
|
3692
4102
|
var DynamicBackgroundColorEditor_1 = __webpack_require__(101);
|
|
4103
|
+
|
|
3693
4104
|
var TrellisEditors_1 = __webpack_require__(105);
|
|
4105
|
+
|
|
3694
4106
|
var VizBehavior_1 = __webpack_require__(6);
|
|
4107
|
+
|
|
3695
4108
|
var configUtils_2 = __webpack_require__(20);
|
|
3696
|
-
|
|
4109
|
+
|
|
4110
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
4111
|
+
|
|
3697
4112
|
var layoutUtils_1 = __webpack_require__(58);
|
|
4113
|
+
|
|
3698
4114
|
var dataContract = {
|
|
3699
4115
|
requiredDataSources: [{
|
|
3700
4116
|
name: 'primary',
|
|
@@ -3941,6 +4357,7 @@ var presets = [{
|
|
|
3941
4357
|
* common theme variables such as enterprise.defaultFontColor
|
|
3942
4358
|
* that are repeated in multiple viz config themes should be DRYd up.
|
|
3943
4359
|
*/
|
|
4360
|
+
|
|
3944
4361
|
var themes = {
|
|
3945
4362
|
defaultFontColor: function defaultFontColor(props) {
|
|
3946
4363
|
return (0, pick_1.default)({
|
|
@@ -4020,7 +4437,7 @@ var editorConfig = [{
|
|
|
4020
4437
|
presets: presets,
|
|
4021
4438
|
value: function value(_ref3) {
|
|
4022
4439
|
var context = _ref3.context,
|
|
4023
|
-
|
|
4440
|
+
options = _ref3.options;
|
|
4024
4441
|
var initialPreset = (0, configUtils_2.getInitialPreset)(context, options, presets);
|
|
4025
4442
|
return initialPreset && initialPreset.label || null;
|
|
4026
4443
|
}
|
|
@@ -4118,16 +4535,19 @@ var editorConfig = [{
|
|
|
4118
4535
|
/**
|
|
4119
4536
|
* visualization configuration
|
|
4120
4537
|
*/
|
|
4538
|
+
|
|
4121
4539
|
var config = {
|
|
4122
4540
|
/**
|
|
4123
4541
|
* unique viz key
|
|
4124
4542
|
*/
|
|
4125
4543
|
key: 'splunk.singlevalueicon',
|
|
4544
|
+
|
|
4126
4545
|
/**
|
|
4127
4546
|
* viz name
|
|
4128
4547
|
*/
|
|
4129
4548
|
name: (0, i18n_1._)('Single value icon'),
|
|
4130
4549
|
category: VizCategory_1.VizCategory.SINGLE_VALUE,
|
|
4550
|
+
|
|
4131
4551
|
/**
|
|
4132
4552
|
* viz icon
|
|
4133
4553
|
*/
|
|
@@ -4266,23 +4686,23 @@ var SingleValueBasic_ = __webpack_require__(142);
|
|
|
4266
4686
|
var SingleValueBasic_default = /*#__PURE__*/__webpack_require__.n(SingleValueBasic_);
|
|
4267
4687
|
|
|
4268
4688
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/Activity"
|
|
4269
|
-
var Activity_ = __webpack_require__(
|
|
4689
|
+
var Activity_ = __webpack_require__(172);
|
|
4270
4690
|
var Activity_default = /*#__PURE__*/__webpack_require__.n(Activity_);
|
|
4271
4691
|
|
|
4272
4692
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/Clock"
|
|
4273
|
-
var Clock_ = __webpack_require__(
|
|
4693
|
+
var Clock_ = __webpack_require__(173);
|
|
4274
4694
|
var Clock_default = /*#__PURE__*/__webpack_require__.n(Clock_);
|
|
4275
4695
|
|
|
4276
4696
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/Pencil"
|
|
4277
|
-
var Pencil_ = __webpack_require__(
|
|
4697
|
+
var Pencil_ = __webpack_require__(174);
|
|
4278
4698
|
var Pencil_default = /*#__PURE__*/__webpack_require__.n(Pencil_);
|
|
4279
4699
|
|
|
4280
4700
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/Star"
|
|
4281
|
-
var Star_ = __webpack_require__(
|
|
4701
|
+
var Star_ = __webpack_require__(175);
|
|
4282
4702
|
var Star_default = /*#__PURE__*/__webpack_require__.n(Star_);
|
|
4283
4703
|
|
|
4284
4704
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/Question"
|
|
4285
|
-
var Question_ = __webpack_require__(
|
|
4705
|
+
var Question_ = __webpack_require__(176);
|
|
4286
4706
|
var Question_default = /*#__PURE__*/__webpack_require__.n(Question_);
|
|
4287
4707
|
|
|
4288
4708
|
// EXTERNAL MODULE: ./src/common/utils/singleValueUtils.js
|
|
@@ -4306,34 +4726,33 @@ var iconMap = {
|
|
|
4306
4726
|
star: Star_default.a,
|
|
4307
4727
|
default: Question_default.a
|
|
4308
4728
|
};
|
|
4309
|
-
|
|
4310
4729
|
/*
|
|
4311
4730
|
* get icon from icon map
|
|
4312
4731
|
* @param {String} key
|
|
4313
4732
|
* @return {Icon} icon component from icon map
|
|
4314
4733
|
*/
|
|
4734
|
+
|
|
4315
4735
|
var getIcon = function getIcon(key) {
|
|
4316
4736
|
return iconMap[key.toLowerCase()] || iconMap.default;
|
|
4317
4737
|
};
|
|
4318
|
-
|
|
4319
4738
|
/*
|
|
4320
4739
|
* @method isValidPosition
|
|
4321
4740
|
* @param {String} iconPosition
|
|
4322
4741
|
* @returns {Bool}
|
|
4323
4742
|
*/
|
|
4743
|
+
|
|
4324
4744
|
var isValidPosition = function isValidPosition(iconPosition) {
|
|
4325
4745
|
return ICON_POSITIONS.indexOf(iconPosition) > -1;
|
|
4326
4746
|
};
|
|
4327
|
-
|
|
4328
4747
|
/*
|
|
4329
4748
|
* @method isHorizontal
|
|
4330
4749
|
* @param {String} iconPosition
|
|
4331
4750
|
* @returns {Bool}
|
|
4332
4751
|
*/
|
|
4752
|
+
|
|
4333
4753
|
var isHorizontal = function isHorizontal(iconPosition) {
|
|
4334
4754
|
return iconPosition === 'before' || iconPosition === 'after';
|
|
4335
4755
|
};
|
|
4336
|
-
|
|
4337
4756
|
/*
|
|
4338
4757
|
* @method getIconWidth
|
|
4339
4758
|
* @param {Object} props
|
|
@@ -4341,12 +4760,12 @@ var isHorizontal = function isHorizontal(iconPosition) {
|
|
|
4341
4760
|
* @param {Number} props.width
|
|
4342
4761
|
* @returns {Number} iconWidth
|
|
4343
4762
|
*/
|
|
4763
|
+
|
|
4344
4764
|
var getIconWidth = function getIconWidth(_ref) {
|
|
4345
4765
|
var showHorizontal = _ref.showHorizontal,
|
|
4346
|
-
|
|
4766
|
+
width = _ref.width;
|
|
4347
4767
|
return showHorizontal ? width * ICON_HORIZONTAL_RATIO : width * ICON_VERTICAL_RATIO;
|
|
4348
4768
|
};
|
|
4349
|
-
|
|
4350
4769
|
/*
|
|
4351
4770
|
* @method getIconHeight
|
|
4352
4771
|
* @param {Object} props
|
|
@@ -4354,12 +4773,12 @@ var getIconWidth = function getIconWidth(_ref) {
|
|
|
4354
4773
|
* @param {Number} props.height
|
|
4355
4774
|
* @returns {Number} iconHeight
|
|
4356
4775
|
*/
|
|
4776
|
+
|
|
4357
4777
|
var getIconHeight = function getIconHeight(_ref2) {
|
|
4358
4778
|
var showHorizontal = _ref2.showHorizontal,
|
|
4359
|
-
|
|
4779
|
+
height = _ref2.height;
|
|
4360
4780
|
return showHorizontal ? height : height * 0.25;
|
|
4361
4781
|
};
|
|
4362
|
-
|
|
4363
4782
|
/*
|
|
4364
4783
|
* @method getIconFontSize
|
|
4365
4784
|
* @param {Object} props
|
|
@@ -4368,13 +4787,13 @@ var getIconHeight = function getIconHeight(_ref2) {
|
|
|
4368
4787
|
* @param {Number} props.iconWidth
|
|
4369
4788
|
* @returns {Number} iconFontSize
|
|
4370
4789
|
*/
|
|
4790
|
+
|
|
4371
4791
|
var getIconFontSize = function getIconFontSize(_ref3) {
|
|
4372
4792
|
var showValue = _ref3.showValue,
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
return showValue ? majorTextFontSize * 0.
|
|
4793
|
+
majorTextFontSize = _ref3.majorTextFontSize,
|
|
4794
|
+
iconWidth = _ref3.iconWidth;
|
|
4795
|
+
return showValue ? majorTextFontSize * 0.8 : iconWidth;
|
|
4376
4796
|
};
|
|
4377
|
-
|
|
4378
4797
|
/*
|
|
4379
4798
|
* @method getSVGDimension
|
|
4380
4799
|
* @param {Object} props
|
|
@@ -4384,14 +4803,14 @@ var getIconFontSize = function getIconFontSize(_ref3) {
|
|
|
4384
4803
|
* @param {Number} props.ratio
|
|
4385
4804
|
* @returns {Number} svg icon dimension
|
|
4386
4805
|
*/
|
|
4806
|
+
|
|
4387
4807
|
var getSVGDimension = function getSVGDimension(_ref4) {
|
|
4388
4808
|
var showValue = _ref4.showValue,
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4809
|
+
containerDimension = _ref4.containerDimension,
|
|
4810
|
+
iconDimension = _ref4.iconDimension,
|
|
4811
|
+
ratio = _ref4.ratio;
|
|
4392
4812
|
return showValue ? iconDimension * ratio : containerDimension;
|
|
4393
4813
|
};
|
|
4394
|
-
|
|
4395
4814
|
/*
|
|
4396
4815
|
* @method getValuesWidth
|
|
4397
4816
|
* @param {Object} props
|
|
@@ -4399,12 +4818,12 @@ var getSVGDimension = function getSVGDimension(_ref4) {
|
|
|
4399
4818
|
* @param {Number} props.width
|
|
4400
4819
|
* @returns {Number} valuesWidth
|
|
4401
4820
|
*/
|
|
4821
|
+
|
|
4402
4822
|
var getValuesWidth = function getValuesWidth(_ref5) {
|
|
4403
4823
|
var showHorizontal = _ref5.showHorizontal,
|
|
4404
|
-
|
|
4824
|
+
width = _ref5.width;
|
|
4405
4825
|
return showHorizontal ? width * (1 - ICON_HORIZONTAL_RATIO) : width;
|
|
4406
4826
|
};
|
|
4407
|
-
|
|
4408
4827
|
/*
|
|
4409
4828
|
* @method getValuesHeight
|
|
4410
4829
|
* @param {Object} props
|
|
@@ -4413,13 +4832,13 @@ var getValuesWidth = function getValuesWidth(_ref5) {
|
|
|
4413
4832
|
* @param {Number} props.iconHeight
|
|
4414
4833
|
* @returns {Number} valuesHeight
|
|
4415
4834
|
*/
|
|
4835
|
+
|
|
4416
4836
|
var getValuesHeight = function getValuesHeight(_ref6) {
|
|
4417
4837
|
var showHorizontal = _ref6.showHorizontal,
|
|
4418
|
-
|
|
4419
|
-
|
|
4838
|
+
height = _ref6.height,
|
|
4839
|
+
iconHeight = _ref6.iconHeight;
|
|
4420
4840
|
return showHorizontal ? height : height - iconHeight;
|
|
4421
4841
|
};
|
|
4422
|
-
|
|
4423
4842
|
/*
|
|
4424
4843
|
* getIconColor
|
|
4425
4844
|
* @param {Object} props
|
|
@@ -4429,11 +4848,13 @@ var getValuesHeight = function getValuesHeight(_ref6) {
|
|
|
4429
4848
|
* @param {String} props.defaultBlockFontColor
|
|
4430
4849
|
* @returns {String} icon color
|
|
4431
4850
|
*/
|
|
4851
|
+
|
|
4432
4852
|
var iconUtils_getIconColor = function getIconColor(_ref7) {
|
|
4433
4853
|
var iconColor = _ref7.iconColor,
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4854
|
+
backgroundColor = _ref7.backgroundColor,
|
|
4855
|
+
defaultFontColor = _ref7.defaultFontColor,
|
|
4856
|
+
defaultBlockFontColor = _ref7.defaultBlockFontColor;
|
|
4857
|
+
|
|
4437
4858
|
if (Object(singleValueUtils["hasBackground"])(backgroundColor) && !iconColor) {
|
|
4438
4859
|
return Object(singleValueUtils["getDefaultColorWithBg"])({
|
|
4439
4860
|
backgroundColor: backgroundColor,
|
|
@@ -4441,6 +4862,7 @@ var iconUtils_getIconColor = function getIconColor(_ref7) {
|
|
|
4441
4862
|
defaultBlockFontColor: defaultBlockFontColor
|
|
4442
4863
|
});
|
|
4443
4864
|
}
|
|
4865
|
+
|
|
4444
4866
|
return Object(singleValueUtils["getFormattedColor"])(iconColor, defaultFontColor);
|
|
4445
4867
|
};
|
|
4446
4868
|
// CONCATENATED MODULE: ./src/SingleValueIcon/PureSingleValueIcon/IconContainer.jsx
|
|
@@ -4466,25 +4888,27 @@ var StyledIconContainer = external_styled_components_default.a.div.attrs(functio
|
|
|
4466
4888
|
}, function (props) {
|
|
4467
4889
|
return props.onClick ? 'pointer' : 'inherit';
|
|
4468
4890
|
});
|
|
4891
|
+
|
|
4469
4892
|
var IconContainer_IconContainer = function IconContainer(_ref) {
|
|
4470
4893
|
var width = _ref.width,
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4894
|
+
height = _ref.height,
|
|
4895
|
+
fontSize = _ref.fontSize,
|
|
4896
|
+
color = _ref.color,
|
|
4897
|
+
opacity = _ref.opacity,
|
|
4898
|
+
icon = _ref.icon,
|
|
4899
|
+
IconComponent = _ref.IconComponent,
|
|
4900
|
+
onIconClick = _ref.onIconClick;
|
|
4478
4901
|
var onClick = typeof onIconClick === 'function' ? onIconClick : undefined;
|
|
4902
|
+
|
|
4479
4903
|
if (IconComponent) {
|
|
4480
4904
|
return /*#__PURE__*/external_react_default.a.createElement(StyledIconContainer, {
|
|
4481
4905
|
width: width,
|
|
4482
4906
|
height: height,
|
|
4483
4907
|
onClick: onClick
|
|
4484
4908
|
}, IconComponent);
|
|
4485
|
-
}
|
|
4909
|
+
} // todo: remove it after we have proper icon provider
|
|
4910
|
+
|
|
4486
4911
|
|
|
4487
|
-
// todo: remove it after we have proper icon provider
|
|
4488
4912
|
var Icon = getIcon(icon);
|
|
4489
4913
|
return /*#__PURE__*/external_react_default.a.createElement(StyledIconContainer, {
|
|
4490
4914
|
width: width,
|
|
@@ -4495,6 +4919,7 @@ var IconContainer_IconContainer = function IconContainer(_ref) {
|
|
|
4495
4919
|
onClick: onClick
|
|
4496
4920
|
}, /*#__PURE__*/external_react_default.a.createElement(Icon, null));
|
|
4497
4921
|
};
|
|
4922
|
+
|
|
4498
4923
|
IconContainer_IconContainer.propTypes = {
|
|
4499
4924
|
width: external_prop_types_default.a.number.isRequired,
|
|
4500
4925
|
height: external_prop_types_default.a.number.isRequired,
|
|
@@ -4509,25 +4934,38 @@ IconContainer_IconContainer.propTypes = {
|
|
|
4509
4934
|
// CONCATENATED MODULE: ./src/SingleValueIcon/PureSingleValueIcon/SingleValueIconLayout.jsx
|
|
4510
4935
|
|
|
4511
4936
|
|
|
4937
|
+
|
|
4512
4938
|
function ownKeys(object, enumerableOnly) {
|
|
4513
4939
|
var keys = Object.keys(object);
|
|
4940
|
+
|
|
4514
4941
|
if (Object.getOwnPropertySymbols) {
|
|
4515
4942
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
4516
|
-
enumerableOnly
|
|
4943
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
4517
4944
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4518
|
-
})
|
|
4945
|
+
});
|
|
4946
|
+
keys.push.apply(keys, symbols);
|
|
4519
4947
|
}
|
|
4948
|
+
|
|
4520
4949
|
return keys;
|
|
4521
4950
|
}
|
|
4951
|
+
|
|
4522
4952
|
function _objectSpread(target) {
|
|
4523
4953
|
for (var i = 1; i < arguments.length; i++) {
|
|
4524
|
-
var source =
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4954
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
4955
|
+
|
|
4956
|
+
if (i % 2) {
|
|
4957
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
4958
|
+
defineProperty_default()(target, key, source[key]);
|
|
4959
|
+
});
|
|
4960
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
4961
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4962
|
+
} else {
|
|
4963
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
4964
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4965
|
+
});
|
|
4966
|
+
}
|
|
4530
4967
|
}
|
|
4968
|
+
|
|
4531
4969
|
return target;
|
|
4532
4970
|
}
|
|
4533
4971
|
|
|
@@ -4536,6 +4974,7 @@ function _objectSpread(target) {
|
|
|
4536
4974
|
|
|
4537
4975
|
|
|
4538
4976
|
|
|
4977
|
+
|
|
4539
4978
|
var Column = external_styled_components_default.a.div.withConfig({
|
|
4540
4979
|
displayName: "SingleValueIconLayout__Column",
|
|
4541
4980
|
componentId: "c8okr6-0"
|
|
@@ -4548,31 +4987,33 @@ var IconColumn = external_styled_components_default.a.div.withConfig({
|
|
|
4548
4987
|
displayName: "SingleValueIconLayout__IconColumn",
|
|
4549
4988
|
componentId: "c8okr6-2"
|
|
4550
4989
|
})(["display:flex;flex-direction:column;justify-content:center;height:100%;"]);
|
|
4990
|
+
|
|
4551
4991
|
var SingleValueIconLayout_SingleValueIconLayout = function SingleValueIconLayout(_ref) {
|
|
4552
4992
|
var props = extends_default()({}, _ref);
|
|
4993
|
+
|
|
4553
4994
|
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
|
-
|
|
4995
|
+
majorText = props.majorText,
|
|
4996
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
4997
|
+
majorValueTitle = props.majorValueTitle,
|
|
4998
|
+
trendColor = props.trendColor,
|
|
4999
|
+
trendText = props.trendText,
|
|
5000
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
5001
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
5002
|
+
unit = props.unit,
|
|
5003
|
+
unitPosition = props.unitPosition,
|
|
5004
|
+
underLabel = props.underLabel,
|
|
5005
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
5006
|
+
underLabelColor = props.underLabelColor,
|
|
5007
|
+
onValueClick = props.onValueClick,
|
|
5008
|
+
iconWidth = props.iconWidth,
|
|
5009
|
+
iconHeight = props.iconHeight,
|
|
5010
|
+
icon = props.icon,
|
|
5011
|
+
iconColor = props.iconColor,
|
|
5012
|
+
iconOpacity = props.iconOpacity,
|
|
5013
|
+
iconPosition = props.iconPosition,
|
|
5014
|
+
iconFontSize = props.iconFontSize,
|
|
5015
|
+
showValue = props.showValue,
|
|
5016
|
+
svgIconComponent = props.svgIconComponent;
|
|
4576
5017
|
var iconContainer = /*#__PURE__*/external_react_default.a.createElement(PureSingleValueIcon_IconContainer, {
|
|
4577
5018
|
width: iconWidth,
|
|
4578
5019
|
height: iconHeight,
|
|
@@ -4601,13 +5042,16 @@ var SingleValueIconLayout_SingleValueIconLayout = function SingleValueIconLayout
|
|
|
4601
5042
|
}) : null;
|
|
4602
5043
|
var iconLayout = null;
|
|
4603
5044
|
var showHorizontal = isHorizontal(iconPosition);
|
|
5045
|
+
|
|
4604
5046
|
if (showHorizontal) {
|
|
4605
5047
|
iconLayout = /*#__PURE__*/external_react_default.a.createElement(IconRow, null, iconPosition === 'before' && iconContainer, singleValueBasic, iconPosition === 'after' && iconContainer);
|
|
4606
5048
|
} else {
|
|
4607
5049
|
iconLayout = /*#__PURE__*/external_react_default.a.createElement(IconColumn, null, iconPosition === 'top' && iconContainer, singleValueBasic, iconPosition === 'below' && iconContainer);
|
|
4608
5050
|
}
|
|
5051
|
+
|
|
4609
5052
|
return /*#__PURE__*/external_react_default.a.createElement(Column, null, iconLayout);
|
|
4610
5053
|
};
|
|
5054
|
+
|
|
4611
5055
|
SingleValueIconLayout_SingleValueIconLayout.propTypes = _objectSpread(_objectSpread({}, SingleValueBasic_default.a.propTypes), {}, {
|
|
4612
5056
|
iconWidth: external_prop_types_default.a.number,
|
|
4613
5057
|
iconHeight: external_prop_types_default.a.number,
|
|
@@ -4644,43 +5088,47 @@ var Container = external_styled_components_default.a.div.withConfig({
|
|
|
4644
5088
|
})(["overflow:hidden;", ";"], function (props) {
|
|
4645
5089
|
return Object(style_["toDimension"])(pick_default()(props, ['width', 'height']));
|
|
4646
5090
|
});
|
|
5091
|
+
|
|
4647
5092
|
var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
4648
5093
|
var props = extends_default()({}, _ref);
|
|
5094
|
+
|
|
4649
5095
|
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
|
-
|
|
5096
|
+
_props$height = props.height,
|
|
5097
|
+
height = _props$height === void 0 ? 250 : _props$height,
|
|
5098
|
+
style = props.style,
|
|
5099
|
+
majorFontSize = props.majorFontSize,
|
|
5100
|
+
majorValue = props.majorValue,
|
|
5101
|
+
majorValueField = props.majorValueField,
|
|
5102
|
+
trendValue = props.trendValue,
|
|
5103
|
+
trendFontSize = props.trendFontSize,
|
|
5104
|
+
unitPosition = props.unitPosition,
|
|
5105
|
+
numberPrecision = props.numberPrecision,
|
|
5106
|
+
shouldUseThousandSeparators = props.shouldUseThousandSeparators,
|
|
5107
|
+
shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
|
|
5108
|
+
icon = props.icon,
|
|
5109
|
+
iconOpacity = props.iconOpacity,
|
|
5110
|
+
IconComponent = props.IconComponent,
|
|
5111
|
+
noDataSources = props.noDataSources,
|
|
5112
|
+
noResult = props.noResult,
|
|
5113
|
+
onValueClick = props.onValueClick,
|
|
5114
|
+
defaultFontColor = props.defaultFontColor,
|
|
5115
|
+
defaultBlockFontColor = props.defaultBlockFontColor,
|
|
5116
|
+
splitByLayout = props.splitByLayout,
|
|
5117
|
+
_props$trellisKey = props.trellisKey,
|
|
5118
|
+
trellisKey = _props$trellisKey === void 0 ? '' : _props$trellisKey,
|
|
5119
|
+
_props$trellisSplitBy = props.trellisSplitBy,
|
|
5120
|
+
trellisSplitBy = _props$trellisSplitBy === void 0 ? '' : _props$trellisSplitBy;
|
|
4675
5121
|
var defaultColors = {
|
|
4676
5122
|
defaultBlockFontColor: defaultBlockFontColor,
|
|
4677
5123
|
defaultFontColor: defaultFontColor
|
|
4678
5124
|
};
|
|
5125
|
+
|
|
4679
5126
|
var _computeColors = Object(singleValueUtils["computeColors"])(props, defaultColors),
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
5127
|
+
backgroundColor = _computeColors.backgroundColor,
|
|
5128
|
+
majorColor = _computeColors.majorColor,
|
|
5129
|
+
trendColor = _computeColors.trendColor,
|
|
5130
|
+
underLabelColor = _computeColors.underLabelColor;
|
|
5131
|
+
|
|
4684
5132
|
var iconColor = iconUtils_getIconColor({
|
|
4685
5133
|
iconColor: props.iconColor,
|
|
4686
5134
|
backgroundColor: backgroundColor,
|
|
@@ -4693,9 +5141,11 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4693
5141
|
var handleValueClick = Object(external_react_["useCallback"])(function (ev) {
|
|
4694
5142
|
return Object(singleValueUtils["handleValueClickCallback"])(ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled, trellisSplitBy, trellisKey);
|
|
4695
5143
|
}, [onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]);
|
|
5144
|
+
|
|
4696
5145
|
var renderVisualization = function renderVisualization(_ref2) {
|
|
4697
5146
|
var containerWidth = _ref2.width,
|
|
4698
|
-
|
|
5147
|
+
containerHeight = _ref2.height;
|
|
5148
|
+
|
|
4699
5149
|
if ((noDataSources || noResult) && !IconComponent) {
|
|
4700
5150
|
return /*#__PURE__*/external_react_default.a.createElement(Message_default.a, {
|
|
4701
5151
|
width: containerWidth,
|
|
@@ -4704,7 +5154,9 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4704
5154
|
level: "warning"
|
|
4705
5155
|
});
|
|
4706
5156
|
}
|
|
5157
|
+
|
|
4707
5158
|
var IconLayout = null;
|
|
5159
|
+
|
|
4708
5160
|
if ((noDataSources || noResult) && IconComponent) {
|
|
4709
5161
|
IconLayout = /*#__PURE__*/external_react_default.a.cloneElement(IconComponent, {
|
|
4710
5162
|
width: containerWidth,
|
|
@@ -4715,14 +5167,16 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4715
5167
|
} else {
|
|
4716
5168
|
// will update later based on text size
|
|
4717
5169
|
var _props$showValue = props.showValue,
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
5170
|
+
showValue = _props$showValue === void 0 ? true : _props$showValue,
|
|
5171
|
+
trendDisplay = props.trendDisplay,
|
|
5172
|
+
unit = props.unit,
|
|
5173
|
+
underLabel = props.underLabel,
|
|
5174
|
+
iconPosition = props.iconPosition;
|
|
5175
|
+
|
|
4723
5176
|
if (!isValidPosition(iconPosition)) {
|
|
4724
5177
|
iconPosition = 'before';
|
|
4725
5178
|
}
|
|
5179
|
+
|
|
4726
5180
|
var showHorizontal = isHorizontal(iconPosition);
|
|
4727
5181
|
var iconWidth = getIconWidth({
|
|
4728
5182
|
showHorizontal: showHorizontal,
|
|
@@ -4733,26 +5187,27 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4733
5187
|
height: containerHeight
|
|
4734
5188
|
});
|
|
4735
5189
|
var svgIconComponent = null;
|
|
5190
|
+
|
|
4736
5191
|
if (IconComponent) {
|
|
4737
5192
|
svgIconComponent = /*#__PURE__*/external_react_default.a.cloneElement(IconComponent, {
|
|
4738
5193
|
width: getSVGDimension({
|
|
4739
5194
|
showValue: showValue,
|
|
4740
5195
|
containerDimension: containerWidth,
|
|
4741
5196
|
iconDimension: iconWidth,
|
|
4742
|
-
ratio: 0.
|
|
5197
|
+
ratio: 0.7
|
|
4743
5198
|
}),
|
|
4744
5199
|
height: getSVGDimension({
|
|
4745
5200
|
showValue: showValue,
|
|
4746
5201
|
containerDimension: containerHeight,
|
|
4747
5202
|
iconDimension: iconHeight,
|
|
4748
|
-
ratio: 0.
|
|
5203
|
+
ratio: 0.7
|
|
4749
5204
|
}),
|
|
4750
5205
|
color: props.iconColor,
|
|
4751
5206
|
opacity: iconOpacity
|
|
4752
5207
|
});
|
|
4753
|
-
}
|
|
5208
|
+
} // calculate major and trend text and font size
|
|
5209
|
+
|
|
4754
5210
|
|
|
4755
|
-
// claculate major and trend text and font size
|
|
4756
5211
|
var contentWidth = getValuesWidth({
|
|
4757
5212
|
showHorizontal: showHorizontal,
|
|
4758
5213
|
width: containerWidth
|
|
@@ -4775,41 +5230,43 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4775
5230
|
key: 'showValue',
|
|
4776
5231
|
value: false
|
|
4777
5232
|
}];
|
|
5233
|
+
|
|
4778
5234
|
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
|
-
|
|
5235
|
+
majorValue: majorValue,
|
|
5236
|
+
trendValue: trendValue,
|
|
5237
|
+
majorFontSize: majorFontSize,
|
|
5238
|
+
trendFontSize: trendFontSize,
|
|
5239
|
+
trendDisplay: trendDisplay,
|
|
5240
|
+
contentWidth: contentWidth,
|
|
5241
|
+
contentHeight: contentHeight,
|
|
5242
|
+
containerWidth: containerWidth,
|
|
5243
|
+
containerHeight: containerHeight,
|
|
5244
|
+
unit: unit,
|
|
5245
|
+
numberPrecision: numberPrecision,
|
|
5246
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
5247
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
5248
|
+
toRemoveList: toRemoveList
|
|
5249
|
+
}),
|
|
5250
|
+
majorText = _computeSingleValueCo.majorText,
|
|
5251
|
+
trendText = _computeSingleValueCo.trendText,
|
|
5252
|
+
majorTextFontSize = _computeSingleValueCo.majorTextFontSize,
|
|
5253
|
+
trendTextFontSize = _computeSingleValueCo.trendTextFontSize,
|
|
5254
|
+
majorValueTitle = _computeSingleValueCo.majorValueTitle,
|
|
5255
|
+
smallVizProps = _computeSingleValueCo.smallVizProps;
|
|
5256
|
+
|
|
4800
5257
|
if (!isEmpty_default()(smallVizProps)) {
|
|
4801
5258
|
showValue = smallVizProps.showValue;
|
|
4802
5259
|
trendDisplay = smallVizProps.trendDisplay;
|
|
4803
5260
|
underLabel = smallVizProps.underLabel;
|
|
4804
5261
|
unit = smallVizProps.unit;
|
|
4805
5262
|
}
|
|
5263
|
+
|
|
4806
5264
|
var iconFontSize = getIconFontSize({
|
|
4807
5265
|
showValue: showValue,
|
|
4808
5266
|
majorTextFontSize: majorTextFontSize,
|
|
4809
5267
|
iconWidth: iconWidth
|
|
4810
|
-
});
|
|
5268
|
+
}); // calculate underlabel size
|
|
4811
5269
|
|
|
4812
|
-
// calculate underlabel size
|
|
4813
5270
|
var underLabelHeight = Object(singleValueUtils["getUnderLabelHeight"])(containerHeight * 0.1);
|
|
4814
5271
|
var underLabelFontSize = Object(singleValueUtils["getUnderLabel"])({
|
|
4815
5272
|
underLabel: underLabel,
|
|
@@ -4843,12 +5300,14 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4843
5300
|
onValueClick: handleValueClick
|
|
4844
5301
|
});
|
|
4845
5302
|
}
|
|
5303
|
+
|
|
4846
5304
|
return /*#__PURE__*/external_react_default.a.createElement(VizStyleWrapper["default"], {
|
|
4847
5305
|
backgroundColor: backgroundColor,
|
|
4848
5306
|
style: style,
|
|
4849
5307
|
dataTestKey: "SingleValueIconWrapper"
|
|
4850
5308
|
}, IconLayout);
|
|
4851
5309
|
};
|
|
5310
|
+
|
|
4852
5311
|
if (isTrellisFeatureFlagOn && splitByLayout === layoutUtils["LAYOUT_TYPE"].Trellis) {
|
|
4853
5312
|
return /*#__PURE__*/external_react_default.a.createElement(external_react_default.a.Fragment, null, /*#__PURE__*/external_react_default.a.createElement(TrellisTitle["TrellisTitle"], {
|
|
4854
5313
|
fontColor: defaultFontColor,
|
|
@@ -4861,6 +5320,7 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4861
5320
|
return renderVisualization(containerDimension);
|
|
4862
5321
|
})));
|
|
4863
5322
|
}
|
|
5323
|
+
|
|
4864
5324
|
return /*#__PURE__*/external_react_default.a.createElement(Container, {
|
|
4865
5325
|
width: width,
|
|
4866
5326
|
height: height
|
|
@@ -4868,6 +5328,7 @@ var SingleValueIcon_SingleValueIcon = function SingleValueIcon(_ref) {
|
|
|
4868
5328
|
return renderVisualization(containerDimension);
|
|
4869
5329
|
}));
|
|
4870
5330
|
};
|
|
5331
|
+
|
|
4871
5332
|
SingleValueIcon_SingleValueIcon.propTypes = {
|
|
4872
5333
|
width: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
4873
5334
|
height: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
@@ -4904,7 +5365,7 @@ SingleValueIcon_SingleValueIcon.propTypes = {
|
|
|
4904
5365
|
};
|
|
4905
5366
|
SingleValueIcon_SingleValueIcon.defaultProps = {
|
|
4906
5367
|
width: '100%',
|
|
4907
|
-
height:
|
|
5368
|
+
height: 400,
|
|
4908
5369
|
majorValue: 'N/A',
|
|
4909
5370
|
majorValueField: '',
|
|
4910
5371
|
trendDisplay: 'absolute',
|
|
@@ -4933,7 +5394,7 @@ module.exports = require("@splunk/visualizations-shared/domUtils");
|
|
|
4933
5394
|
|
|
4934
5395
|
/***/ }),
|
|
4935
5396
|
|
|
4936
|
-
/***/
|
|
5397
|
+
/***/ 56:
|
|
4937
5398
|
/***/ (function(module, exports) {
|
|
4938
5399
|
|
|
4939
5400
|
module.exports = require("@splunk/themes/useSplunkTheme");
|
|
@@ -4951,6 +5412,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4951
5412
|
});
|
|
4952
5413
|
exports.LAYOUT_TYPE = void 0;
|
|
4953
5414
|
var LAYOUT_TYPE;
|
|
5415
|
+
|
|
4954
5416
|
(function (LAYOUT_TYPE) {
|
|
4955
5417
|
LAYOUT_TYPE["Off"] = "off";
|
|
4956
5418
|
LAYOUT_TYPE["Trellis"] = "trellis";
|
|
@@ -4969,6 +5431,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4969
5431
|
});
|
|
4970
5432
|
exports.VizBehavior = void 0;
|
|
4971
5433
|
var VizBehavior;
|
|
5434
|
+
|
|
4972
5435
|
(function (VizBehavior) {
|
|
4973
5436
|
/**
|
|
4974
5437
|
* Dynamic Options Behavior.
|
|
@@ -4988,6 +5451,7 @@ var VizBehavior;
|
|
|
4988
5451
|
* missing.
|
|
4989
5452
|
* @type {string}
|
|
4990
5453
|
*/
|
|
5454
|
+
|
|
4991
5455
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
4992
5456
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
4993
5457
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -5051,8 +5515,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5051
5515
|
value: true
|
|
5052
5516
|
});
|
|
5053
5517
|
exports.TrellisTitle = exports.TRELLIS_TITLE_HEIGHT = void 0;
|
|
5518
|
+
|
|
5054
5519
|
var React = __webpack_require__(1);
|
|
5520
|
+
|
|
5055
5521
|
var styled_components_1 = __webpack_require__(4);
|
|
5522
|
+
|
|
5056
5523
|
exports.TRELLIS_TITLE_HEIGHT = 28;
|
|
5057
5524
|
var TrellisTitleText = styled_components_1.default.div.withConfig({
|
|
5058
5525
|
displayName: "TrellisTitle__TrellisTitleText",
|
|
@@ -5068,6 +5535,7 @@ var TrellisTitleDiv = styled_components_1.default.div.withConfig({
|
|
|
5068
5535
|
}, function (props) {
|
|
5069
5536
|
return props.backgroundColor;
|
|
5070
5537
|
});
|
|
5538
|
+
|
|
5071
5539
|
var TrellisTitle = function TrellisTitle(props) {
|
|
5072
5540
|
var titleText = String(props.trellisKey).toString();
|
|
5073
5541
|
return React.createElement(TrellisTitleDiv, {
|
|
@@ -5077,6 +5545,7 @@ var TrellisTitle = function TrellisTitle(props) {
|
|
|
5077
5545
|
title: titleText
|
|
5078
5546
|
}, React.createElement(TrellisTitleText, null, titleText));
|
|
5079
5547
|
};
|
|
5548
|
+
|
|
5080
5549
|
exports.TrellisTitle = TrellisTitle;
|
|
5081
5550
|
|
|
5082
5551
|
/***/ }),
|
|
@@ -5088,7 +5557,7 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
5088
5557
|
|
|
5089
5558
|
/***/ }),
|
|
5090
5559
|
|
|
5091
|
-
/***/
|
|
5560
|
+
/***/ 84:
|
|
5092
5561
|
/***/ (function(module, exports) {
|
|
5093
5562
|
|
|
5094
5563
|
module.exports = require("@splunk/visualizations-shared/trellisUtils");
|
|
@@ -5102,7 +5571,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
5102
5571
|
|
|
5103
5572
|
/***/ }),
|
|
5104
5573
|
|
|
5105
|
-
/***/
|
|
5574
|
+
/***/ 91:
|
|
5106
5575
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5107
5576
|
|
|
5108
5577
|
"use strict";
|
|
@@ -5126,7 +5595,7 @@ var StaticBackgroundColorEditor = {
|
|
|
5126
5595
|
|
|
5127
5596
|
/***/ }),
|
|
5128
5597
|
|
|
5129
|
-
/***/
|
|
5598
|
+
/***/ 94:
|
|
5130
5599
|
/***/ (function(module, exports) {
|
|
5131
5600
|
|
|
5132
5601
|
module.exports = require("@splunk/react-ui/Paginator");
|