@splunk/visualizations 26.0.0 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
package/SingleValue.js
CHANGED
|
@@ -127,7 +127,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
127
127
|
|
|
128
128
|
var getDynamicTrendColorEditor = function getDynamicTrendColorEditor(_ref) {
|
|
129
129
|
var defaultContext = _ref.defaultContext,
|
|
130
|
-
|
|
130
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
131
131
|
return {
|
|
132
132
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Trend value'),
|
|
133
133
|
option: 'trendColor',
|
|
@@ -172,7 +172,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
172
172
|
|
|
173
173
|
var getDynamicBackgroundColorEditor = function getDynamicBackgroundColorEditor(_ref) {
|
|
174
174
|
var defaultContext = _ref.defaultContext,
|
|
175
|
-
|
|
175
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
176
176
|
return {
|
|
177
177
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Background'),
|
|
178
178
|
option: 'backgroundColor',
|
|
@@ -326,11 +326,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
326
326
|
value: true
|
|
327
327
|
});
|
|
328
328
|
exports.TrellisBackgroundColorEditor = exports.TrellisEditorConfig = void 0;
|
|
329
|
+
|
|
329
330
|
var React = __webpack_require__(1);
|
|
331
|
+
|
|
330
332
|
var i18n_1 = __webpack_require__(2);
|
|
333
|
+
|
|
331
334
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
335
|
+
|
|
332
336
|
var layoutUtils_1 = __webpack_require__(58);
|
|
333
337
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
338
|
+
|
|
339
|
+
|
|
334
340
|
exports.TrellisEditorConfig = [[{
|
|
335
341
|
label: (0, i18n_1._)('Trellis layout'),
|
|
336
342
|
option: 'splitByLayout',
|
|
@@ -428,37 +434,60 @@ exports.TrellisBackgroundColorEditor = {
|
|
|
428
434
|
|
|
429
435
|
|
|
430
436
|
var _slicedToArray = __webpack_require__(17);
|
|
437
|
+
|
|
431
438
|
var __rest = this && this.__rest || function (s, e) {
|
|
432
439
|
var t = {};
|
|
440
|
+
|
|
433
441
|
for (var p in s) {
|
|
434
442
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
435
443
|
}
|
|
444
|
+
|
|
436
445
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
437
446
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
438
447
|
}
|
|
439
448
|
return t;
|
|
440
449
|
};
|
|
450
|
+
|
|
441
451
|
Object.defineProperty(exports, "__esModule", {
|
|
442
452
|
value: true
|
|
443
453
|
});
|
|
454
|
+
|
|
444
455
|
var React = __webpack_require__(1);
|
|
456
|
+
|
|
445
457
|
var react_1 = __webpack_require__(1);
|
|
458
|
+
|
|
446
459
|
var lodash_1 = __webpack_require__(3);
|
|
460
|
+
|
|
447
461
|
var styled_components_1 = __webpack_require__(4);
|
|
448
|
-
|
|
462
|
+
|
|
463
|
+
var Paginator_1 = __webpack_require__(94);
|
|
464
|
+
|
|
449
465
|
var i18n_1 = __webpack_require__(2);
|
|
466
|
+
|
|
450
467
|
var themes_1 = __webpack_require__(60);
|
|
468
|
+
|
|
451
469
|
var useSplunkTheme_1 = __webpack_require__(57);
|
|
470
|
+
|
|
452
471
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
472
|
+
|
|
453
473
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
474
|
+
|
|
454
475
|
var style_1 = __webpack_require__(14);
|
|
476
|
+
|
|
455
477
|
var Message_1 = __webpack_require__(10);
|
|
456
|
-
|
|
478
|
+
|
|
479
|
+
var trellisUtils_1 = __webpack_require__(84);
|
|
480
|
+
|
|
457
481
|
var hocUtils_1 = __webpack_require__(27);
|
|
482
|
+
|
|
458
483
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
484
|
+
|
|
459
485
|
var Options_1 = __webpack_require__(30);
|
|
486
|
+
|
|
460
487
|
var trellisUtils_2 = __webpack_require__(107);
|
|
488
|
+
|
|
461
489
|
var layoutUtils_1 = __webpack_require__(58);
|
|
490
|
+
|
|
462
491
|
var TrellisContainer = styled_components_1.default.div.withConfig({
|
|
463
492
|
displayName: "withTrellis__TrellisContainer",
|
|
464
493
|
componentId: "pjmeig-0"
|
|
@@ -479,6 +508,7 @@ var TrellisContainerGrid = styled_components_1.default.div.withConfig({
|
|
|
479
508
|
}, function (props) {
|
|
480
509
|
return "".concat(props.rowHeight, "px");
|
|
481
510
|
});
|
|
511
|
+
|
|
482
512
|
var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
483
513
|
if (errorCode === 'INVALID_SPLIT_BY_FIELD') {
|
|
484
514
|
return React.createElement(Message_1.default, {
|
|
@@ -488,6 +518,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
488
518
|
level: "info"
|
|
489
519
|
});
|
|
490
520
|
}
|
|
521
|
+
|
|
491
522
|
if (errorCode === 'UNKNOWN_DATA_SPLIT_MODE') {
|
|
492
523
|
return React.createElement(Message_1.default, {
|
|
493
524
|
width: width,
|
|
@@ -496,6 +527,7 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
496
527
|
level: "info"
|
|
497
528
|
});
|
|
498
529
|
}
|
|
530
|
+
|
|
499
531
|
return React.createElement(Message_1.default, {
|
|
500
532
|
width: width,
|
|
501
533
|
height: height,
|
|
@@ -503,33 +535,38 @@ var showErrorMessage = function showErrorMessage(errorCode, width, height) {
|
|
|
503
535
|
level: "info"
|
|
504
536
|
});
|
|
505
537
|
};
|
|
538
|
+
|
|
506
539
|
var withTrellis = function withTrellis(Viz) {
|
|
507
540
|
var VizWithTrellis = function VizWithTrellis(opts) {
|
|
508
541
|
var _opts$options = opts.options,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
542
|
+
options = _opts$options === void 0 ? {} : _opts$options,
|
|
543
|
+
height = opts.height,
|
|
544
|
+
width = opts.width,
|
|
545
|
+
otherProps = __rest(opts, ["options", "height", "width"]);
|
|
546
|
+
|
|
513
547
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(Viz.config.optionsSchema, 'default');
|
|
514
548
|
var mergedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions);
|
|
515
549
|
var trellisColumns = mergedOptions.trellisColumns,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
550
|
+
trellisPageCount = mergedOptions.trellisPageCount,
|
|
551
|
+
trellisMinColumnWidth = mergedOptions.trellisMinColumnWidth,
|
|
552
|
+
trellisRowHeight = mergedOptions.trellisRowHeight,
|
|
553
|
+
splitByLayout = mergedOptions.splitByLayout,
|
|
554
|
+
trellisSplitBy = mergedOptions.trellisSplitBy;
|
|
521
555
|
var colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
|
|
522
556
|
var pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
|
|
523
557
|
var colMinWidth = trellisMinColumnWidth > 0 ? trellisMinColumnWidth : defaultOptions.trellisMinColumnWidth;
|
|
524
558
|
var rowHeight = trellisRowHeight > 0 ? trellisRowHeight : defaultOptions.trellisRowHeight;
|
|
559
|
+
|
|
525
560
|
var _ref = (0, react_1.useState)(1),
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
561
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
562
|
+
pageNum = _ref2[0],
|
|
563
|
+
setPageNum = _ref2[1];
|
|
564
|
+
|
|
529
565
|
var _ref3 = (0, react_1.useState)(null),
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
566
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
567
|
+
pagedData = _ref4[0],
|
|
568
|
+
setPagedData = _ref4[1];
|
|
569
|
+
|
|
533
570
|
var splitByKeys = [];
|
|
534
571
|
var totalPages = 0;
|
|
535
572
|
var showPaginator = false;
|
|
@@ -537,21 +574,25 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
537
574
|
var theme = {
|
|
538
575
|
splunkThemeV1: (0, useSplunkTheme_1.default)()
|
|
539
576
|
};
|
|
577
|
+
|
|
540
578
|
var _ref5 = (0, themes_1.getSettingsFromThemedProps)({
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
579
|
+
theme: theme
|
|
580
|
+
}),
|
|
581
|
+
currentThemeFamily = _ref5.family,
|
|
582
|
+
currentThemeColorScheme = _ref5.colorScheme,
|
|
583
|
+
currentThemeDensity = _ref5.density;
|
|
584
|
+
|
|
546
585
|
var trellisBackgroundColor = (0, react_1.useMemo)(function () {
|
|
547
586
|
var themeFunc = function themeFunc(themeVar) {
|
|
548
587
|
var _a, _b;
|
|
588
|
+
|
|
549
589
|
return (_b = (_a = Viz.config.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
550
590
|
trellisBackgroundColor: mergedOptions.trellisBackgroundColor,
|
|
551
591
|
theme: theme
|
|
552
592
|
});
|
|
553
|
-
};
|
|
554
|
-
|
|
593
|
+
}; // trellisBackgroundColor option supports only static coloring and DSL option evaluation derived from the themes level only.
|
|
594
|
+
|
|
595
|
+
|
|
555
596
|
var evaluated = Options_1.Options.evaluate({
|
|
556
597
|
context: Viz.config.context,
|
|
557
598
|
options: {
|
|
@@ -564,6 +605,7 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
564
605
|
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields', undefined);
|
|
565
606
|
var noColumns = columns === undefined;
|
|
566
607
|
var noFields = fields === undefined;
|
|
608
|
+
|
|
567
609
|
var updateDataDisplay = function updateDataDisplay(currPage) {
|
|
568
610
|
if (!showPaginator) {
|
|
569
611
|
setPagedData(splitByKeys);
|
|
@@ -574,6 +616,7 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
574
616
|
setPagedData(paged);
|
|
575
617
|
}
|
|
576
618
|
};
|
|
619
|
+
|
|
577
620
|
(0, react_1.useEffect)(function () {
|
|
578
621
|
setPageNum(1);
|
|
579
622
|
updateDataDisplay(1);
|
|
@@ -587,9 +630,11 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
587
630
|
}, [pageNum, pagedData]);
|
|
588
631
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
589
632
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
633
|
+
|
|
590
634
|
if (!isTrellisFeatureFlagOn || !splitByLayout || splitByLayout !== layoutUtils_1.LAYOUT_TYPE.Trellis) {
|
|
591
635
|
return React.createElement(Viz, Object.assign({}, opts));
|
|
592
636
|
}
|
|
637
|
+
|
|
593
638
|
if (splitByLayout === layoutUtils_1.LAYOUT_TYPE.Trellis) {
|
|
594
639
|
if (noColumns || noFields) {
|
|
595
640
|
return React.createElement(Message_1.default, {
|
|
@@ -598,27 +643,34 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
598
643
|
message: (0, i18n_1._)('Loading'),
|
|
599
644
|
level: "info"
|
|
600
645
|
});
|
|
601
|
-
}
|
|
602
|
-
// If no trellisSplitBy value is passed in, assign default trellisSplitBy
|
|
646
|
+
} // If no trellisSplitBy value is passed in, assign default trellisSplitBy
|
|
603
647
|
// The default value will be the first value in the individual splitBy field list or 'aggregations'
|
|
648
|
+
|
|
649
|
+
|
|
604
650
|
var currTrellisSplitBy = trellisSplitBy;
|
|
651
|
+
|
|
605
652
|
if (!trellisSplitBy || trellisSplitBy.length === 0) {
|
|
606
653
|
var splitByPossibleFields = (0, trellisUtils_1.getAllPossibleSplitByFields)(fields);
|
|
607
654
|
currTrellisSplitBy = splitByPossibleFields.fields && splitByPossibleFields.fields.length ? splitByPossibleFields.fields[0] : trellisUtils_2.AGGREGATIONS;
|
|
608
655
|
}
|
|
656
|
+
|
|
609
657
|
var splitMode = (0, trellisUtils_1.getTrellisDataSplitterMode)(fields);
|
|
610
658
|
var dataSplitResult = (0, trellisUtils_2.getTrellisDataSourcesBySplitMode)(splitMode, dataSources, currTrellisSplitBy);
|
|
611
659
|
var modifiedDataSourceBySplitBy = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.splitDataSources;
|
|
612
660
|
var dataSplitErrorCode = dataSplitResult === null || dataSplitResult === void 0 ? void 0 : dataSplitResult.errorCode;
|
|
661
|
+
|
|
613
662
|
if (!modifiedDataSourceBySplitBy || Object.keys(modifiedDataSourceBySplitBy).length === 0 || dataSplitErrorCode) {
|
|
614
663
|
return showErrorMessage(dataSplitErrorCode, width, height);
|
|
615
664
|
}
|
|
665
|
+
|
|
616
666
|
var splitByKeysModified = modifiedDataSourceBySplitBy ? Object.keys(modifiedDataSourceBySplitBy) : [];
|
|
667
|
+
|
|
617
668
|
if (splitByKeysModified) {
|
|
618
669
|
showPaginator = splitByKeysModified.length > pageCount;
|
|
619
670
|
splitByKeys = splitByKeysModified;
|
|
620
671
|
totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
|
|
621
672
|
}
|
|
673
|
+
|
|
622
674
|
return React.createElement(TrellisContainer, {
|
|
623
675
|
height: height,
|
|
624
676
|
width: width,
|
|
@@ -635,8 +687,8 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
635
687
|
key: "div-child-".concat(idx.toString())
|
|
636
688
|
}, React.createElement(SizeAwareWrapper_1.default, null, function (_ref7) {
|
|
637
689
|
var childWidth = _ref7.childWidth,
|
|
638
|
-
|
|
639
|
-
|
|
690
|
+
_ref7$childHeight = _ref7.childHeight,
|
|
691
|
+
childHeight = _ref7$childHeight === void 0 ? rowHeight : _ref7$childHeight;
|
|
640
692
|
return React.createElement(Viz, Object.assign({}, otherProps, {
|
|
641
693
|
trellisKey: splitByKey,
|
|
642
694
|
trellisSplitBy: currTrellisSplitBy,
|
|
@@ -654,13 +706,16 @@ var withTrellis = function withTrellis(Viz) {
|
|
|
654
706
|
totalPages: totalPages
|
|
655
707
|
}));
|
|
656
708
|
}
|
|
709
|
+
|
|
657
710
|
return null;
|
|
658
711
|
};
|
|
712
|
+
|
|
659
713
|
VizWithTrellis.propTypes = Viz.proptypes;
|
|
660
714
|
VizWithTrellis.defaultProps = Viz.defaultProps;
|
|
661
715
|
VizWithTrellis.config = Viz.config;
|
|
662
716
|
return VizWithTrellis;
|
|
663
717
|
};
|
|
718
|
+
|
|
664
719
|
exports.default = withTrellis;
|
|
665
720
|
|
|
666
721
|
/***/ }),
|
|
@@ -672,12 +727,16 @@ exports.default = withTrellis;
|
|
|
672
727
|
|
|
673
728
|
|
|
674
729
|
var _toConsumableArray = __webpack_require__(8);
|
|
730
|
+
|
|
675
731
|
Object.defineProperty(exports, "__esModule", {
|
|
676
732
|
value: true
|
|
677
733
|
});
|
|
678
734
|
exports.getTrellisDataSourcesBySplitMode = exports.dataSourcesSplitByModeStatsorUnknown = exports.dataSourcesSplitByModeChart = exports.dataSourcesSplitByModeTimechart = exports.dataSourcesSplitByAggregationsStats = exports.dataSourcesSplitByAggregationsTimechartAndChart = exports.dataSourcesSplitByAggregationsUnknown = exports.AGGREGATIONS = void 0;
|
|
735
|
+
|
|
679
736
|
var lodash_1 = __webpack_require__(3);
|
|
680
|
-
|
|
737
|
+
|
|
738
|
+
var trellisUtils_1 = __webpack_require__(84);
|
|
739
|
+
|
|
681
740
|
exports.AGGREGATIONS = 'aggregations';
|
|
682
741
|
/**
|
|
683
742
|
* There can be certain SPL cmds that can produce dataSource without a specific field meta info (like group_by_rank, split_by_field etc),
|
|
@@ -687,16 +746,21 @@ exports.AGGREGATIONS = 'aggregations';
|
|
|
687
746
|
* Example3:- `index = "_internal" | stats count`
|
|
688
747
|
* Example4:- `index=_internal | stats avg(count), max(count)`
|
|
689
748
|
*/
|
|
749
|
+
|
|
690
750
|
var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregationsUnknown(dataSource) {
|
|
691
751
|
var _a, _b, _c, _d;
|
|
752
|
+
|
|
692
753
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
693
754
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
694
755
|
var splitDataSources = null;
|
|
695
756
|
var errorCode = null;
|
|
757
|
+
|
|
696
758
|
if (fields && fields.length) {
|
|
697
759
|
splitDataSources = {};
|
|
760
|
+
|
|
698
761
|
for (var i = 0; i < fields.length; i += 1) {
|
|
699
762
|
var fieldName = fields[i].name;
|
|
763
|
+
|
|
700
764
|
if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
|
|
701
765
|
splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
702
766
|
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
@@ -706,22 +770,28 @@ var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregati
|
|
|
706
770
|
} else {
|
|
707
771
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
708
772
|
}
|
|
773
|
+
|
|
709
774
|
return {
|
|
710
775
|
splitDataSources: splitDataSources,
|
|
711
776
|
errorCode: errorCode
|
|
712
777
|
};
|
|
713
778
|
};
|
|
779
|
+
|
|
714
780
|
exports.dataSourcesSplitByAggregationsUnknown = dataSourcesSplitByAggregationsUnknown;
|
|
781
|
+
|
|
715
782
|
var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitByAggregationsTimechartAndChart(dataSource) {
|
|
716
783
|
var _a, _b, _c, _d;
|
|
784
|
+
|
|
717
785
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
718
786
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
719
787
|
var splitDataSources = null;
|
|
720
788
|
var splitByFields = [];
|
|
721
789
|
var errorCode = null;
|
|
790
|
+
|
|
722
791
|
if (typeof fields[0] !== 'string') {
|
|
723
792
|
splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
724
793
|
}
|
|
794
|
+
|
|
725
795
|
if (splitByFields && splitByFields.length > 0) {
|
|
726
796
|
splitDataSources = {};
|
|
727
797
|
splitByFields.forEach(function (splitByField) {
|
|
@@ -730,6 +800,7 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
730
800
|
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
731
801
|
fields.forEach(function (field, idx) {
|
|
732
802
|
var fieldName = field === null || field === void 0 ? void 0 : field.name;
|
|
803
|
+
|
|
733
804
|
if (fieldName !== '_time' && !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_')) && field.data_source === splitByField) {
|
|
734
805
|
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
735
806
|
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
@@ -741,8 +812,10 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
741
812
|
// example1 :- index=_internal | timechart count
|
|
742
813
|
// example2 :- index=_internal | timechart max(count) avg(count)
|
|
743
814
|
splitDataSources = {};
|
|
815
|
+
|
|
744
816
|
for (var i = 1; i < fields.length; i += 1) {
|
|
745
817
|
var fieldName = fields[i].name;
|
|
818
|
+
|
|
746
819
|
if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
|
|
747
820
|
splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
748
821
|
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
@@ -752,22 +825,28 @@ var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitB
|
|
|
752
825
|
} else {
|
|
753
826
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
754
827
|
}
|
|
828
|
+
|
|
755
829
|
return {
|
|
756
830
|
splitDataSources: splitDataSources,
|
|
757
831
|
errorCode: errorCode
|
|
758
832
|
};
|
|
759
833
|
};
|
|
834
|
+
|
|
760
835
|
exports.dataSourcesSplitByAggregationsTimechartAndChart = dataSourcesSplitByAggregationsTimechartAndChart;
|
|
836
|
+
|
|
761
837
|
var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregationsStats(dataSource) {
|
|
762
838
|
var _a, _b, _c, _d;
|
|
839
|
+
|
|
763
840
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
764
841
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
765
842
|
var splitDataSources = null;
|
|
766
843
|
var splitByFields = [];
|
|
767
844
|
var errorCode = null;
|
|
845
|
+
|
|
768
846
|
if (typeof fields[0] !== 'string') {
|
|
769
847
|
splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysStats)(fields);
|
|
770
848
|
}
|
|
849
|
+
|
|
771
850
|
if (splitByFields && splitByFields.length > 0) {
|
|
772
851
|
splitDataSources = {};
|
|
773
852
|
splitByFields.forEach(function (splitByField) {
|
|
@@ -777,6 +856,7 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
|
|
|
777
856
|
var idx = fields.findIndex(function (field) {
|
|
778
857
|
return field.name === splitByField;
|
|
779
858
|
});
|
|
859
|
+
|
|
780
860
|
if (idx > 0) {
|
|
781
861
|
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
782
862
|
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
@@ -785,32 +865,40 @@ var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregation
|
|
|
785
865
|
} else {
|
|
786
866
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
787
867
|
}
|
|
868
|
+
|
|
788
869
|
return {
|
|
789
870
|
splitDataSources: splitDataSources,
|
|
790
871
|
errorCode: errorCode
|
|
791
872
|
};
|
|
792
873
|
};
|
|
874
|
+
|
|
793
875
|
exports.dataSourcesSplitByAggregationsStats = dataSourcesSplitByAggregationsStats;
|
|
876
|
+
|
|
794
877
|
var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(dataSource, splitBy) {
|
|
795
878
|
var _a, _b, _c, _d, _e;
|
|
879
|
+
|
|
796
880
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
797
881
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
798
882
|
var splitDataSources = null;
|
|
799
883
|
var splitByFields = [];
|
|
800
884
|
var errorCode = null;
|
|
885
|
+
|
|
801
886
|
if (typeof fields[0] !== 'string') {
|
|
802
887
|
splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
|
|
803
888
|
}
|
|
889
|
+
|
|
804
890
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
805
891
|
splitDataSources = {};
|
|
806
892
|
var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
807
893
|
var valueKeys = [];
|
|
894
|
+
|
|
808
895
|
for (var i = 1; i < fields.length; i += 1) {
|
|
809
896
|
// not including internal fields
|
|
810
897
|
if (!((_e = fields[i].name) === null || _e === void 0 ? void 0 : _e.startsWith('_'))) {
|
|
811
898
|
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
812
899
|
}
|
|
813
900
|
}
|
|
901
|
+
|
|
814
902
|
valueKeys.forEach(function (val) {
|
|
815
903
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
816
904
|
splitDataSources[val].primary.data.fields = [{
|
|
@@ -832,22 +920,28 @@ var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(d
|
|
|
832
920
|
} else {
|
|
833
921
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
834
922
|
}
|
|
923
|
+
|
|
835
924
|
return {
|
|
836
925
|
splitDataSources: splitDataSources,
|
|
837
926
|
errorCode: errorCode
|
|
838
927
|
};
|
|
839
928
|
};
|
|
929
|
+
|
|
840
930
|
exports.dataSourcesSplitByModeTimechart = dataSourcesSplitByModeTimechart;
|
|
931
|
+
|
|
841
932
|
var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSource, splitBy) {
|
|
842
933
|
var _a, _b, _c, _d;
|
|
934
|
+
|
|
843
935
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
844
936
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
845
937
|
var splitDataSources = null;
|
|
846
938
|
var splitByFields = [];
|
|
847
939
|
var errorCode = null;
|
|
940
|
+
|
|
848
941
|
if (typeof fields[0] !== 'string') {
|
|
849
942
|
splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
|
|
850
943
|
}
|
|
944
|
+
|
|
851
945
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
852
946
|
splitDataSources = {};
|
|
853
947
|
var splitByFieldIdx = splitByFields.findIndex(function (f) {
|
|
@@ -858,6 +952,7 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
858
952
|
});
|
|
859
953
|
var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
|
|
860
954
|
var nonDataSourceAggregations = [];
|
|
955
|
+
|
|
861
956
|
if (!dataSourceKeys.length && fields[0].groupby_rank === '0' && fields.length && !fields[1].groupby_rank) {
|
|
862
957
|
/* check for another aggregation scenario where no key 'data_source' will be returned (applies for both chart and stats cmd)
|
|
863
958
|
For example :-
|
|
@@ -882,12 +977,14 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
882
977
|
nonDataSourceAggregations.push(fields[i].name);
|
|
883
978
|
}
|
|
884
979
|
}
|
|
980
|
+
|
|
885
981
|
if (splitByFieldIdx === 0) {
|
|
886
982
|
// if splitBy is the first field, split row wise
|
|
887
983
|
var valueKeys = (0, lodash_1.cloneDeep)(columns[0]);
|
|
888
984
|
valueKeys.forEach(function (val, idx) {
|
|
889
985
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
890
986
|
splitDataSources[val].primary.data.fields = [];
|
|
987
|
+
|
|
891
988
|
if (otherSplitBy.length) {
|
|
892
989
|
splitDataSources[val].primary.data.fields = [{
|
|
893
990
|
name: otherSplitBy[0]
|
|
@@ -959,16 +1056,20 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
959
1056
|
columnValues[1] = ['1','10','100']
|
|
960
1057
|
columnValues[2] = ['5', '50', '500']
|
|
961
1058
|
*/
|
|
1059
|
+
|
|
962
1060
|
var _loop = function _loop(_i) {
|
|
963
1061
|
columnValues[0].push(fields[_i].splitby_value ? fields[_i].splitby_value : fields[_i].name);
|
|
964
1062
|
dataSourceKeys.forEach(function (dskey, dsIndx) {
|
|
965
1063
|
var mul = (fields.length - 1) / dataSourceKeys.length; // This line does the index calculation
|
|
1064
|
+
|
|
966
1065
|
columnValues[dsIndx + 1].push(columns[_i + dsIndx * mul][idx]);
|
|
967
1066
|
});
|
|
968
1067
|
};
|
|
1068
|
+
|
|
969
1069
|
for (var _i = 1; _i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); _i += 1) {
|
|
970
1070
|
_loop(_i);
|
|
971
1071
|
}
|
|
1072
|
+
|
|
972
1073
|
splitDataSources[val].primary.data.columns = columnValues;
|
|
973
1074
|
})();
|
|
974
1075
|
} else if (nonDataSourceAggregations.length) {
|
|
@@ -990,9 +1091,11 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
990
1091
|
} else {
|
|
991
1092
|
// split column wise
|
|
992
1093
|
var _valueKeys = [];
|
|
1094
|
+
|
|
993
1095
|
for (var _i2 = 1; _i2 < fields.length; _i2 += 1) {
|
|
994
1096
|
_valueKeys.push(fields[_i2].splitby_value ? fields[_i2].splitby_value : fields[_i2].name);
|
|
995
1097
|
}
|
|
1098
|
+
|
|
996
1099
|
_valueKeys.forEach(function (val) {
|
|
997
1100
|
splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
|
|
998
1101
|
splitDataSources[val].primary.data.fields = [{
|
|
@@ -1015,29 +1118,36 @@ var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSourc
|
|
|
1015
1118
|
} else {
|
|
1016
1119
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
1017
1120
|
}
|
|
1121
|
+
|
|
1018
1122
|
return {
|
|
1019
1123
|
splitDataSources: splitDataSources,
|
|
1020
1124
|
errorCode: errorCode
|
|
1021
1125
|
};
|
|
1022
1126
|
};
|
|
1127
|
+
|
|
1023
1128
|
exports.dataSourcesSplitByModeChart = dataSourcesSplitByModeChart;
|
|
1024
1129
|
/**
|
|
1025
1130
|
* This method does datasplitting for 'stats' and generic cmds('makeresults','table' etc - categoried as 'unknown' splitMode).
|
|
1026
1131
|
* The main difference is for 'stats' cmd possible splitBy fields have 'group_by_rank' in field meta info, whereas for 'unknown' cmd it can be any fieldnames
|
|
1027
1132
|
*/
|
|
1133
|
+
|
|
1028
1134
|
var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatsorUnknown(dataSource, splitBy, splitMode) {
|
|
1029
1135
|
var _a, _b, _c, _d, _e, _f;
|
|
1136
|
+
|
|
1030
1137
|
var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
|
|
1031
1138
|
var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
|
|
1032
1139
|
var splitDataSources = null;
|
|
1033
1140
|
var splitByFields = [];
|
|
1034
1141
|
var errorCode = null;
|
|
1142
|
+
|
|
1035
1143
|
if (typeof fields[0] !== 'string') {
|
|
1036
1144
|
splitByFields = splitMode !== trellisUtils_1.UNKNOWN ? (0, trellisUtils_1.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_1.extractSplitByFieldsForUnknown)(fields);
|
|
1037
1145
|
}
|
|
1146
|
+
|
|
1038
1147
|
var splitByIndex = fields === null || fields === void 0 ? void 0 : fields.findIndex(function (field) {
|
|
1039
1148
|
return field === splitBy || field.name === splitBy;
|
|
1040
1149
|
});
|
|
1150
|
+
|
|
1041
1151
|
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
1042
1152
|
var splitByColumn = (_f = (_e = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.columns[splitByIndex];
|
|
1043
1153
|
splitDataSources = {};
|
|
@@ -1068,14 +1178,18 @@ var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatso
|
|
|
1068
1178
|
} else {
|
|
1069
1179
|
errorCode = 'INVALID_SPLIT_BY_FIELD';
|
|
1070
1180
|
}
|
|
1181
|
+
|
|
1071
1182
|
return {
|
|
1072
1183
|
splitDataSources: splitDataSources,
|
|
1073
1184
|
errorCode: errorCode
|
|
1074
1185
|
};
|
|
1075
1186
|
};
|
|
1187
|
+
|
|
1076
1188
|
exports.dataSourcesSplitByModeStatsorUnknown = dataSourcesSplitByModeStatsorUnknown;
|
|
1189
|
+
|
|
1077
1190
|
var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode(splitMode, dataSources, trellisSplitBy) {
|
|
1078
1191
|
var result = null;
|
|
1192
|
+
|
|
1079
1193
|
try {
|
|
1080
1194
|
if (splitMode === trellisUtils_1.TIMECHART) {
|
|
1081
1195
|
result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsTimechartAndChart)(dataSources) : (0, exports.dataSourcesSplitByModeTimechart)(dataSources, trellisSplitBy);
|
|
@@ -1093,8 +1207,10 @@ var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode
|
|
|
1093
1207
|
errorCode: 'UNKNOWN'
|
|
1094
1208
|
};
|
|
1095
1209
|
}
|
|
1210
|
+
|
|
1096
1211
|
return result;
|
|
1097
1212
|
};
|
|
1213
|
+
|
|
1098
1214
|
exports.getTrellisDataSourcesBySplitMode = getTrellisDataSourcesBySplitMode;
|
|
1099
1215
|
|
|
1100
1216
|
/***/ }),
|
|
@@ -1136,11 +1252,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
1136
1252
|
Object.defineProperty(exports, "__esModule", {
|
|
1137
1253
|
value: true
|
|
1138
1254
|
});
|
|
1255
|
+
|
|
1139
1256
|
var React = __webpack_require__(1);
|
|
1257
|
+
|
|
1140
1258
|
var styled_components_1 = __webpack_require__(4);
|
|
1259
|
+
|
|
1141
1260
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
1261
|
+
|
|
1142
1262
|
var style_1 = __webpack_require__(14);
|
|
1263
|
+
|
|
1143
1264
|
var colorUtils_1 = __webpack_require__(12);
|
|
1265
|
+
|
|
1144
1266
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
1145
1267
|
var width = _ref.width;
|
|
1146
1268
|
return {
|
|
@@ -1153,11 +1275,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
1153
1275
|
componentId: "sc-1yhgpod-0"
|
|
1154
1276
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
1155
1277
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
1156
|
-
});
|
|
1157
|
-
|
|
1278
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
1279
|
+
|
|
1158
1280
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
1159
1281
|
var width = _ref2.width,
|
|
1160
|
-
|
|
1282
|
+
height = _ref2.height;
|
|
1161
1283
|
return {
|
|
1162
1284
|
style: Object.assign(Object.assign({}, width && {
|
|
1163
1285
|
width: (0, style_1.toPx)(width)
|
|
@@ -1179,11 +1301,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
1179
1301
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
1180
1302
|
componentId: "sc-1yhgpod-3"
|
|
1181
1303
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
1304
|
+
|
|
1182
1305
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
1183
1306
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
1184
1307
|
var width = props.width,
|
|
1185
|
-
|
|
1186
|
-
|
|
1308
|
+
height = props.height,
|
|
1309
|
+
backgroundColor = props.backgroundColor;
|
|
1310
|
+
|
|
1187
1311
|
if (!height) {
|
|
1188
1312
|
return React.createElement(Item, {
|
|
1189
1313
|
"data-test": "item",
|
|
@@ -1191,24 +1315,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
1191
1315
|
backgroundColor: backgroundColor
|
|
1192
1316
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
1193
1317
|
}
|
|
1318
|
+
|
|
1194
1319
|
return React.createElement(FixSizeItem, {
|
|
1195
1320
|
"data-test": "fix-size-item",
|
|
1196
|
-
"data-splunk-visualization-version": "26.
|
|
1321
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
1197
1322
|
width: width,
|
|
1198
1323
|
height: height,
|
|
1199
1324
|
backgroundColor: backgroundColor
|
|
1200
1325
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
1201
1326
|
var newWidth = _ref3.width,
|
|
1202
|
-
|
|
1327
|
+
newHeight = _ref3.height;
|
|
1203
1328
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
1204
1329
|
width: newWidth,
|
|
1205
1330
|
height: newHeight
|
|
1206
1331
|
}));
|
|
1207
1332
|
})));
|
|
1208
1333
|
};
|
|
1334
|
+
|
|
1209
1335
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
1210
1336
|
return FixedSizeContainer;
|
|
1211
1337
|
};
|
|
1338
|
+
|
|
1212
1339
|
exports.default = withFixedSizeContainer;
|
|
1213
1340
|
|
|
1214
1341
|
/***/ }),
|
|
@@ -1272,7 +1399,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1272
1399
|
|
|
1273
1400
|
var getDynamicMajorColorEditor = function getDynamicMajorColorEditor(_ref) {
|
|
1274
1401
|
var defaultContext = _ref.defaultContext,
|
|
1275
|
-
|
|
1402
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
1276
1403
|
return {
|
|
1277
1404
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Major value'),
|
|
1278
1405
|
option: 'majorColor',
|
|
@@ -1332,9 +1459,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
1332
1459
|
* @param {DashboardVizType} props.Wrapper
|
|
1333
1460
|
* @param {DashboardVizType} props.Visualization
|
|
1334
1461
|
*/
|
|
1462
|
+
|
|
1335
1463
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
1336
1464
|
var Wrapper = _ref.Wrapper,
|
|
1337
|
-
|
|
1465
|
+
Visualization = _ref.Visualization;
|
|
1338
1466
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
1339
1467
|
extendProperties.forEach(function (prop) {
|
|
1340
1468
|
if (Visualization[prop]) {
|
|
@@ -1343,6 +1471,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
1343
1471
|
}
|
|
1344
1472
|
});
|
|
1345
1473
|
};
|
|
1474
|
+
|
|
1346
1475
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
1347
1476
|
|
|
1348
1477
|
/***/ }),
|
|
@@ -1389,24 +1518,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
1389
1518
|
|
|
1390
1519
|
|
|
1391
1520
|
var _toConsumableArray = __webpack_require__(8);
|
|
1521
|
+
|
|
1392
1522
|
var _defineProperty = __webpack_require__(7);
|
|
1523
|
+
|
|
1393
1524
|
var __rest = this && this.__rest || function (s, e) {
|
|
1394
1525
|
var t = {};
|
|
1526
|
+
|
|
1395
1527
|
for (var p in s) {
|
|
1396
1528
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1397
1529
|
}
|
|
1530
|
+
|
|
1398
1531
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1399
1532
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1400
1533
|
}
|
|
1401
1534
|
return t;
|
|
1402
1535
|
};
|
|
1536
|
+
|
|
1403
1537
|
Object.defineProperty(exports, "__esModule", {
|
|
1404
1538
|
value: true
|
|
1405
1539
|
});
|
|
1406
1540
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
1541
|
+
|
|
1407
1542
|
var lodash_1 = __webpack_require__(3);
|
|
1543
|
+
|
|
1408
1544
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1545
|
+
|
|
1409
1546
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1547
|
+
|
|
1410
1548
|
var dynamicOptionsDSLType = {
|
|
1411
1549
|
type: 'string',
|
|
1412
1550
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -1416,20 +1554,22 @@ var dynamicOptionsDSLType = {
|
|
|
1416
1554
|
* @param optionsSchema a visualization's options schema
|
|
1417
1555
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
1418
1556
|
*/
|
|
1557
|
+
|
|
1419
1558
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
1420
1559
|
var enhancedOptionsSchema = {};
|
|
1421
1560
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
1422
1561
|
var _a = optionsSchema[key],
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1562
|
+
title = _a.title,
|
|
1563
|
+
description = _a.description,
|
|
1564
|
+
readOnly = _a.readOnly,
|
|
1565
|
+
writeOnly = _a.writeOnly,
|
|
1566
|
+
examples = _a.examples,
|
|
1567
|
+
defaultValue = _a.default,
|
|
1568
|
+
type = _a.type,
|
|
1569
|
+
properties = _a.properties,
|
|
1570
|
+
patternProperties = _a.patternProperties,
|
|
1571
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
1572
|
+
|
|
1433
1573
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
1434
1574
|
title: title
|
|
1435
1575
|
}), description !== undefined && {
|
|
@@ -1443,12 +1583,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1443
1583
|
}), defaultValue !== undefined && {
|
|
1444
1584
|
default: defaultValue
|
|
1445
1585
|
});
|
|
1586
|
+
|
|
1446
1587
|
if (type === 'object') {
|
|
1447
1588
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
1448
1589
|
type: type
|
|
1449
1590
|
}), properties && {
|
|
1450
1591
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
1451
1592
|
});
|
|
1593
|
+
|
|
1452
1594
|
if (patternProperties) {
|
|
1453
1595
|
var enhancedPatternProperties = {};
|
|
1454
1596
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -1466,6 +1608,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1466
1608
|
});
|
|
1467
1609
|
return enhancedOptionsSchema;
|
|
1468
1610
|
}
|
|
1611
|
+
|
|
1469
1612
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
1470
1613
|
/**
|
|
1471
1614
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -1474,11 +1617,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
1474
1617
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
1475
1618
|
* and containing `open: false` for all editor panels in editorConfig
|
|
1476
1619
|
*/
|
|
1620
|
+
|
|
1477
1621
|
function enhanceConfig(vizConfig) {
|
|
1478
1622
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
1623
|
+
|
|
1479
1624
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
1480
1625
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
1481
1626
|
}
|
|
1627
|
+
|
|
1482
1628
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
1483
1629
|
return Object.assign(Object.assign({}, config), {
|
|
1484
1630
|
open: config.open || false
|
|
@@ -1486,6 +1632,7 @@ function enhanceConfig(vizConfig) {
|
|
|
1486
1632
|
});
|
|
1487
1633
|
return enhancedConfig;
|
|
1488
1634
|
}
|
|
1635
|
+
|
|
1489
1636
|
exports.enhanceConfig = enhanceConfig;
|
|
1490
1637
|
/**
|
|
1491
1638
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -1493,6 +1640,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
1493
1640
|
* @param vizConfig a Visualization Config
|
|
1494
1641
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
1495
1642
|
*/
|
|
1643
|
+
|
|
1496
1644
|
function uncollapseEditorConfig(vizConfig) {
|
|
1497
1645
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
1498
1646
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -1502,13 +1650,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
1502
1650
|
});
|
|
1503
1651
|
return editorPanelUncollapsedConfig;
|
|
1504
1652
|
}
|
|
1653
|
+
|
|
1505
1654
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
1655
|
+
|
|
1506
1656
|
function isDynamicOption(option) {
|
|
1507
1657
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
1508
1658
|
}
|
|
1509
|
-
|
|
1510
|
-
// private helpers to improve readability of getInitialPreset
|
|
1659
|
+
|
|
1660
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
1511
1661
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
1662
|
+
|
|
1512
1663
|
/**
|
|
1513
1664
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
1514
1665
|
* 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
|
|
@@ -1517,6 +1668,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
1517
1668
|
*
|
|
1518
1669
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
1519
1670
|
*/
|
|
1671
|
+
|
|
1520
1672
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
1521
1673
|
var presetContextKeys = Object.keys(presetContext);
|
|
1522
1674
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -1526,6 +1678,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
1526
1678
|
/**
|
|
1527
1679
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
1528
1680
|
*/
|
|
1681
|
+
|
|
1682
|
+
|
|
1529
1683
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
1530
1684
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
1531
1685
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -1540,18 +1694,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
1540
1694
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
1541
1695
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
1542
1696
|
*/
|
|
1697
|
+
|
|
1698
|
+
|
|
1543
1699
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
1544
1700
|
return presets.find(function (preset) {
|
|
1545
1701
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
1546
1702
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
1547
1703
|
var presetContextKeys = Object.keys(presetContext);
|
|
1548
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
1549
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1704
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1550
1705
|
// if not, then the preset is invalid in config.ts
|
|
1706
|
+
|
|
1551
1707
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
1552
1708
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
1553
1709
|
});
|
|
1554
1710
|
}
|
|
1711
|
+
|
|
1555
1712
|
exports.getInitialPreset = getInitialPreset;
|
|
1556
1713
|
/**
|
|
1557
1714
|
* generates number precision values for a Select editor
|
|
@@ -1559,6 +1716,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
1559
1716
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
1560
1717
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
1561
1718
|
*/
|
|
1719
|
+
|
|
1562
1720
|
function generatePrecisionValues(numPrecisionValues) {
|
|
1563
1721
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
1564
1722
|
return {
|
|
@@ -1567,6 +1725,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
1567
1725
|
};
|
|
1568
1726
|
});
|
|
1569
1727
|
}
|
|
1728
|
+
|
|
1570
1729
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
1571
1730
|
/**
|
|
1572
1731
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -1576,12 +1735,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
1576
1735
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
1577
1736
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
1578
1737
|
*/
|
|
1738
|
+
|
|
1579
1739
|
var insertLayout = function insertLayout(layout, index) {
|
|
1580
1740
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1581
1741
|
layoutItems[_key - 2] = arguments[_key];
|
|
1582
1742
|
}
|
|
1743
|
+
|
|
1583
1744
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
1584
1745
|
};
|
|
1746
|
+
|
|
1585
1747
|
exports.insertLayout = insertLayout;
|
|
1586
1748
|
|
|
1587
1749
|
/***/ }),
|
|
@@ -1655,25 +1817,38 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1655
1817
|
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(49);
|
|
1656
1818
|
/* harmony import */ var _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__);
|
|
1657
1819
|
|
|
1820
|
+
|
|
1658
1821
|
function ownKeys(object, enumerableOnly) {
|
|
1659
1822
|
var keys = Object.keys(object);
|
|
1823
|
+
|
|
1660
1824
|
if (Object.getOwnPropertySymbols) {
|
|
1661
1825
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
1662
|
-
enumerableOnly
|
|
1826
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
1663
1827
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1664
|
-
})
|
|
1828
|
+
});
|
|
1829
|
+
keys.push.apply(keys, symbols);
|
|
1665
1830
|
}
|
|
1831
|
+
|
|
1666
1832
|
return keys;
|
|
1667
1833
|
}
|
|
1834
|
+
|
|
1668
1835
|
function _objectSpread(target) {
|
|
1669
1836
|
for (var i = 1; i < arguments.length; i++) {
|
|
1670
|
-
var source =
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1837
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1838
|
+
|
|
1839
|
+
if (i % 2) {
|
|
1840
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
1841
|
+
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
|
|
1842
|
+
});
|
|
1843
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
1844
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1845
|
+
} else {
|
|
1846
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
1847
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1676
1850
|
}
|
|
1851
|
+
|
|
1677
1852
|
return target;
|
|
1678
1853
|
}
|
|
1679
1854
|
|
|
@@ -1681,6 +1856,7 @@ function _objectSpread(target) {
|
|
|
1681
1856
|
|
|
1682
1857
|
|
|
1683
1858
|
|
|
1859
|
+
|
|
1684
1860
|
var DEFAULT_FONT = 12;
|
|
1685
1861
|
var DEFAULT_FONT_FAMILY = '"Splunk Platform Sans", "Proxima Nova", "Helvetica Neue", Helvetica, Arial, sans-serif';
|
|
1686
1862
|
var SVR_PADDING = {
|
|
@@ -1689,28 +1865,27 @@ var SVR_PADDING = {
|
|
|
1689
1865
|
left: 16,
|
|
1690
1866
|
right: 16
|
|
1691
1867
|
};
|
|
1692
|
-
|
|
1693
1868
|
/**
|
|
1694
1869
|
* @method shouldShowTrend
|
|
1695
1870
|
* @param {String} trendDisplay
|
|
1696
1871
|
* @returns {Bool}
|
|
1697
1872
|
*/
|
|
1873
|
+
|
|
1698
1874
|
var shouldShowTrend = function shouldShowTrend(trendDisplay) {
|
|
1699
1875
|
return trendDisplay === 'absolute' || trendDisplay === 'percent';
|
|
1700
1876
|
};
|
|
1701
|
-
|
|
1702
1877
|
/**
|
|
1703
1878
|
* @method isLoadingOrNoColumns
|
|
1704
1879
|
* @param {Object} dataSources
|
|
1705
1880
|
* @param {Boolean} loading
|
|
1706
1881
|
* @returns {Boolean} return true if loading or without columns in dataSources
|
|
1707
1882
|
*/
|
|
1883
|
+
|
|
1708
1884
|
var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
1709
1885
|
var data = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["get"])(dataSources, 'primary.data.columns[0]', undefined);
|
|
1710
1886
|
var noColumns = data === undefined;
|
|
1711
1887
|
return loading || noColumns;
|
|
1712
1888
|
};
|
|
1713
|
-
|
|
1714
1889
|
/**
|
|
1715
1890
|
* Retrieve the valid formatted color
|
|
1716
1891
|
* @method getFormattedColor
|
|
@@ -1718,30 +1893,30 @@ var isLoadingOrNoColumns = function isLoadingOrNoColumns(dataSources, loading) {
|
|
|
1718
1893
|
* @param {String} defaultColor
|
|
1719
1894
|
* @returns {String} the formatted color
|
|
1720
1895
|
*/
|
|
1896
|
+
|
|
1721
1897
|
var getFormattedColor = function getFormattedColor(color, defaultColor) {
|
|
1722
1898
|
return Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(color) || Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_4__["formatColor"])(defaultColor);
|
|
1723
1899
|
};
|
|
1724
|
-
|
|
1725
1900
|
/**
|
|
1726
1901
|
* Determines if there is a background color
|
|
1727
1902
|
* @method hasBackground
|
|
1728
1903
|
* @param {String} backgroundColor
|
|
1729
1904
|
* @returns true for non-transparent background color
|
|
1730
1905
|
*/
|
|
1906
|
+
|
|
1731
1907
|
var hasBackground = function hasBackground(backgroundColor) {
|
|
1732
1908
|
return !!backgroundColor && backgroundColor !== 'transparent';
|
|
1733
1909
|
};
|
|
1734
|
-
|
|
1735
1910
|
/**
|
|
1736
1911
|
* @method isIdenticalColor
|
|
1737
1912
|
* @param {String} colorA
|
|
1738
1913
|
* @param {String} colorB
|
|
1739
1914
|
* @returns {Boolean}
|
|
1740
1915
|
*/
|
|
1916
|
+
|
|
1741
1917
|
var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
1742
1918
|
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());
|
|
1743
1919
|
};
|
|
1744
|
-
|
|
1745
1920
|
/*
|
|
1746
1921
|
* @method getDefaultColorWithBg
|
|
1747
1922
|
* @param {Object} props
|
|
@@ -1750,13 +1925,13 @@ var isIdenticalColor = function isIdenticalColor(colorA, colorB) {
|
|
|
1750
1925
|
* @param {String} props.defaultBlockFontColor
|
|
1751
1926
|
* @returns {String} defaultColor
|
|
1752
1927
|
*/
|
|
1928
|
+
|
|
1753
1929
|
var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
1754
1930
|
var backgroundColor = _ref.backgroundColor,
|
|
1755
|
-
|
|
1756
|
-
|
|
1931
|
+
defaultFontColor = _ref.defaultFontColor,
|
|
1932
|
+
defaultBlockFontColor = _ref.defaultBlockFontColor;
|
|
1757
1933
|
return isIdenticalColor(backgroundColor, defaultBlockFontColor) ? defaultFontColor : defaultBlockFontColor;
|
|
1758
1934
|
};
|
|
1759
|
-
|
|
1760
1935
|
/*
|
|
1761
1936
|
* @method getMajorColor
|
|
1762
1937
|
* return formatted majorColor.
|
|
@@ -1767,15 +1942,16 @@ var getDefaultColorWithBg = function getDefaultColorWithBg(_ref) {
|
|
|
1767
1942
|
* @param {String} props.defaultBlockFontColor
|
|
1768
1943
|
* @returns {String} majorColor
|
|
1769
1944
|
*/
|
|
1945
|
+
|
|
1770
1946
|
var getMajorColor = function getMajorColor(_ref2) {
|
|
1771
1947
|
var majorColor = _ref2.majorColor,
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
// If backgroundColor is set, but no majorColor,
|
|
1948
|
+
backgroundColor = _ref2.backgroundColor,
|
|
1949
|
+
defaultFontColor = _ref2.defaultFontColor,
|
|
1950
|
+
defaultBlockFontColor = _ref2.defaultBlockFontColor; // If backgroundColor is set, but no majorColor,
|
|
1776
1951
|
// the default majorColor will turn to be defaultBlockFontColor.
|
|
1777
1952
|
// eg: major color will turn to be white in enterprise mode.
|
|
1778
1953
|
// however, if the bgColor is the same as defaultBlockFontColor, use defaultFontColor.
|
|
1954
|
+
|
|
1779
1955
|
if (hasBackground(backgroundColor) && !majorColor) {
|
|
1780
1956
|
return getDefaultColorWithBg({
|
|
1781
1957
|
backgroundColor: backgroundColor,
|
|
@@ -1783,9 +1959,9 @@ var getMajorColor = function getMajorColor(_ref2) {
|
|
|
1783
1959
|
defaultBlockFontColor: defaultBlockFontColor
|
|
1784
1960
|
});
|
|
1785
1961
|
}
|
|
1962
|
+
|
|
1786
1963
|
return getFormattedColor(majorColor, defaultFontColor);
|
|
1787
1964
|
};
|
|
1788
|
-
|
|
1789
1965
|
/**
|
|
1790
1966
|
* Get the color for the trend components
|
|
1791
1967
|
* @method getTrendColor
|
|
@@ -1798,35 +1974,41 @@ var getMajorColor = function getMajorColor(_ref2) {
|
|
|
1798
1974
|
* @param {Object} defaultColors
|
|
1799
1975
|
* @returns {String} trendColor
|
|
1800
1976
|
*/
|
|
1977
|
+
|
|
1801
1978
|
var getTrendColor = function getTrendColor(_ref3) {
|
|
1802
1979
|
var trendColor = _ref3.trendColor,
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1980
|
+
trendValue = _ref3.trendValue,
|
|
1981
|
+
majorValue = _ref3.majorValue,
|
|
1982
|
+
customizedBgColor = _ref3.customizedBgColor,
|
|
1983
|
+
trendDisplay = _ref3.trendDisplay,
|
|
1984
|
+
defaultColors = _ref3.defaultColors;
|
|
1985
|
+
|
|
1808
1986
|
if (trendColor) {
|
|
1809
1987
|
return trendColor;
|
|
1810
1988
|
}
|
|
1989
|
+
|
|
1811
1990
|
if (Number.isNaN(Number(trendValue))) {
|
|
1812
1991
|
return undefined;
|
|
1813
1992
|
}
|
|
1993
|
+
|
|
1814
1994
|
var defaultFontColor = defaultColors.defaultFontColor,
|
|
1815
|
-
|
|
1816
|
-
|
|
1995
|
+
defaultBlockFontColor = defaultColors.defaultBlockFontColor,
|
|
1996
|
+
defaultBackgroundColor = defaultColors.defaultBackgroundColor; // if user defined a backgroundColor, the default trend color will be defaultBlockFontColor
|
|
1997
|
+
|
|
1817
1998
|
if (hasBackground(customizedBgColor) && !isIdenticalColor(customizedBgColor, defaultBackgroundColor) && !isIdenticalColor(customizedBgColor, defaultBlockFontColor)) {
|
|
1818
1999
|
return defaultBlockFontColor;
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
// if trendDisplay is percent, and trendValue === value
|
|
2000
|
+
} // if trendDisplay is percent, and trendValue === value
|
|
1822
2001
|
// the trend percent = trendValue / (value - trendValue) will return Infinity
|
|
2002
|
+
|
|
2003
|
+
|
|
1823
2004
|
var isInvalidTrend = trendDisplay === 'percent' && trendValue === parseFloat(majorValue);
|
|
2005
|
+
|
|
1824
2006
|
if (trendValue === 0 || isInvalidTrend) {
|
|
1825
2007
|
return defaultFontColor;
|
|
1826
2008
|
}
|
|
2009
|
+
|
|
1827
2010
|
return trendValue > 0 ? _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_GREEN"] : _splunk_visualizations_shared_colorConstants__WEBPACK_IMPORTED_MODULE_5__["DELTA_RED"];
|
|
1828
2011
|
};
|
|
1829
|
-
|
|
1830
2012
|
/**
|
|
1831
2013
|
* Computes visualization properties for display component
|
|
1832
2014
|
* @method computeColors
|
|
@@ -1839,6 +2021,7 @@ var getTrendColor = function getTrendColor(_ref3) {
|
|
|
1839
2021
|
* @returns {String} trendColor
|
|
1840
2022
|
* @returns {String} underLabelColor
|
|
1841
2023
|
*/
|
|
2024
|
+
|
|
1842
2025
|
var computeColors = function computeColors(props, defaultColors) {
|
|
1843
2026
|
var backgroundColor = getFormattedColor(props.backgroundColor, defaultColors.defaultBackgroundColor);
|
|
1844
2027
|
var backgroundEnabled = hasBackground(backgroundColor);
|
|
@@ -1855,8 +2038,8 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
1855
2038
|
customizedBgColor: props.backgroundColor,
|
|
1856
2039
|
trendDisplay: props.trendDisplay,
|
|
1857
2040
|
defaultColors: defaultColors
|
|
1858
|
-
});
|
|
1859
|
-
|
|
2041
|
+
}); // todo: need change it to not depend on majorColor
|
|
2042
|
+
|
|
1860
2043
|
var underLabelColor = majorColor;
|
|
1861
2044
|
return {
|
|
1862
2045
|
backgroundColor: backgroundColor,
|
|
@@ -1866,7 +2049,6 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
1866
2049
|
underLabelColor: underLabelColor
|
|
1867
2050
|
};
|
|
1868
2051
|
};
|
|
1869
|
-
|
|
1870
2052
|
/**
|
|
1871
2053
|
* Format and return the value (major/trend)
|
|
1872
2054
|
* @method computeText
|
|
@@ -1877,21 +2059,21 @@ var computeColors = function computeColors(props, defaultColors) {
|
|
|
1877
2059
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
1878
2060
|
* @returns {Number} major or trend text
|
|
1879
2061
|
*/
|
|
2062
|
+
|
|
1880
2063
|
var computeText = function computeText(_ref4) {
|
|
1881
2064
|
var value = _ref4.value,
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2065
|
+
numberPrecision = _ref4.numberPrecision,
|
|
2066
|
+
shouldUseThousandSeparators = _ref4.shouldUseThousandSeparators,
|
|
2067
|
+
shouldAbbreviateTrendValue = _ref4.shouldAbbreviateTrendValue;
|
|
1885
2068
|
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, {
|
|
1886
2069
|
useThousandSeparators: shouldUseThousandSeparators,
|
|
1887
2070
|
// todo: need update formatNumber
|
|
1888
2071
|
useTrendUnits: shouldAbbreviateTrendValue
|
|
1889
|
-
}) : value;
|
|
1890
|
-
|
|
2072
|
+
}) : value; // When text is undefined, return empty string
|
|
2073
|
+
|
|
1891
2074
|
text = text || '';
|
|
1892
2075
|
return text;
|
|
1893
2076
|
};
|
|
1894
|
-
|
|
1895
2077
|
/*
|
|
1896
2078
|
* @method getMajorText
|
|
1897
2079
|
* @param {Object} props
|
|
@@ -1900,10 +2082,11 @@ var computeText = function computeText(_ref4) {
|
|
|
1900
2082
|
* @param {Bool} props.shouldUseThousandSeparators
|
|
1901
2083
|
* @returns {String} majorText
|
|
1902
2084
|
*/
|
|
2085
|
+
|
|
1903
2086
|
var getMajorText = function getMajorText(_ref5) {
|
|
1904
2087
|
var majorValue = _ref5.majorValue,
|
|
1905
|
-
|
|
1906
|
-
|
|
2088
|
+
numberPrecision = _ref5.numberPrecision,
|
|
2089
|
+
shouldUseThousandSeparators = _ref5.shouldUseThousandSeparators;
|
|
1907
2090
|
return computeText({
|
|
1908
2091
|
value: majorValue === null ? 'N/A' : majorValue,
|
|
1909
2092
|
// if majorValue is null, use `N/A`.
|
|
@@ -1912,7 +2095,6 @@ var getMajorText = function getMajorText(_ref5) {
|
|
|
1912
2095
|
shouldAbbreviateTrendValue: false
|
|
1913
2096
|
});
|
|
1914
2097
|
};
|
|
1915
|
-
|
|
1916
2098
|
/*
|
|
1917
2099
|
* @method getTrendText
|
|
1918
2100
|
* @param {Object} props
|
|
@@ -1924,13 +2106,15 @@ var getMajorText = function getMajorText(_ref5) {
|
|
|
1924
2106
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
1925
2107
|
* @returns {String} trendText
|
|
1926
2108
|
*/
|
|
2109
|
+
|
|
1927
2110
|
var getTrendText = function getTrendText(_ref6) {
|
|
1928
2111
|
var majorValue = _ref6.majorValue,
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
2112
|
+
trendValue = _ref6.trendValue,
|
|
2113
|
+
trendDisplay = _ref6.trendDisplay,
|
|
2114
|
+
numberPrecision = _ref6.numberPrecision,
|
|
2115
|
+
shouldUseThousandSeparators = _ref6.shouldUseThousandSeparators,
|
|
2116
|
+
shouldAbbreviateTrendValue = _ref6.shouldAbbreviateTrendValue;
|
|
2117
|
+
|
|
1934
2118
|
var compute = function compute(value) {
|
|
1935
2119
|
return computeText({
|
|
1936
2120
|
value: value,
|
|
@@ -1939,25 +2123,31 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
1939
2123
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
1940
2124
|
});
|
|
1941
2125
|
};
|
|
2126
|
+
|
|
1942
2127
|
if (trendValue === '' || !Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue)) {
|
|
1943
2128
|
return '';
|
|
1944
2129
|
}
|
|
2130
|
+
|
|
1945
2131
|
var showPercent = trendDisplay === 'percent';
|
|
2132
|
+
|
|
1946
2133
|
if (!showPercent) {
|
|
1947
2134
|
return compute(trendValue);
|
|
1948
2135
|
}
|
|
2136
|
+
|
|
1949
2137
|
var diff = Math.abs(trendValue - majorValue);
|
|
1950
2138
|
var val = Math.round(trendValue / diff * 100);
|
|
2139
|
+
|
|
1951
2140
|
if (trendValue === 0 && diff === 0) {
|
|
1952
2141
|
val = 0;
|
|
1953
2142
|
}
|
|
2143
|
+
|
|
1954
2144
|
if (!Number.isFinite(val)) {
|
|
1955
2145
|
return 'N/A';
|
|
1956
2146
|
}
|
|
2147
|
+
|
|
1957
2148
|
var text = compute(val);
|
|
1958
2149
|
return "".concat(text, "%");
|
|
1959
2150
|
};
|
|
1960
|
-
|
|
1961
2151
|
/**
|
|
1962
2152
|
* Helper to determine the font size for an element
|
|
1963
2153
|
* @method computeFontSize
|
|
@@ -1969,16 +2159,16 @@ var getTrendText = function getTrendText(_ref6) {
|
|
|
1969
2159
|
* @param {String} [fontWeight='normal'] Boldness of font
|
|
1970
2160
|
* @returns {Number} The size to use for fontSize styles
|
|
1971
2161
|
*/
|
|
2162
|
+
|
|
1972
2163
|
var computeFontSize = function computeFontSize(text, _ref7) {
|
|
1973
2164
|
var width = _ref7.width,
|
|
1974
|
-
|
|
2165
|
+
height = _ref7.height;
|
|
1975
2166
|
var fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_FONT_FAMILY;
|
|
1976
2167
|
var fontWeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'normal';
|
|
1977
2168
|
var widthInDefaultFont = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(DEFAULT_FONT, "px ").concat(fontFamily));
|
|
1978
2169
|
var fontSize = Math.min(width / widthInDefaultFont * DEFAULT_FONT, height / DEFAULT_FONT * DEFAULT_FONT);
|
|
1979
2170
|
return parseInt(fontSize, 10);
|
|
1980
2171
|
};
|
|
1981
|
-
|
|
1982
2172
|
/*
|
|
1983
2173
|
* @method getMajorFontSize
|
|
1984
2174
|
* @param {Object} props
|
|
@@ -1989,20 +2179,20 @@ var computeFontSize = function computeFontSize(text, _ref7) {
|
|
|
1989
2179
|
* @param {Number} props.spaceRatio
|
|
1990
2180
|
* @returns {Number} majorFontSize
|
|
1991
2181
|
*/
|
|
2182
|
+
|
|
1992
2183
|
var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
1993
2184
|
var width = _ref8.width,
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2185
|
+
height = _ref8.height,
|
|
2186
|
+
unit = _ref8.unit,
|
|
2187
|
+
majorText = _ref8.majorText,
|
|
2188
|
+
_ref8$spaceRatio = _ref8.spaceRatio,
|
|
2189
|
+
spaceRatio = _ref8$spaceRatio === void 0 ? 1 : _ref8$spaceRatio;
|
|
1999
2190
|
var majorTextCalc = unit ? "".concat(unit).concat(majorText) : majorText;
|
|
2000
2191
|
return computeFontSize(majorTextCalc, {
|
|
2001
2192
|
width: width * spaceRatio,
|
|
2002
2193
|
height: height
|
|
2003
2194
|
});
|
|
2004
2195
|
};
|
|
2005
|
-
|
|
2006
2196
|
/*
|
|
2007
2197
|
* @method getTrendFontSize
|
|
2008
2198
|
* @param {Object} props
|
|
@@ -2012,13 +2202,15 @@ var getMajorFontSize = function getMajorFontSize(_ref8) {
|
|
|
2012
2202
|
* @param {Number} props.spaceRatio
|
|
2013
2203
|
* @returns {Number} trendFontSize
|
|
2014
2204
|
*/
|
|
2205
|
+
|
|
2015
2206
|
var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
2016
2207
|
var width = _ref9.width,
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2208
|
+
height = _ref9.height,
|
|
2209
|
+
trendText = _ref9.trendText,
|
|
2210
|
+
_ref9$spaceRatio = _ref9.spaceRatio,
|
|
2211
|
+
spaceRatio = _ref9$spaceRatio === void 0 ? 1 : _ref9$spaceRatio;
|
|
2021
2212
|
var trendFontSize = 12;
|
|
2213
|
+
|
|
2022
2214
|
if (spaceRatio > 0) {
|
|
2023
2215
|
trendFontSize = computeFontSize(trendText, {
|
|
2024
2216
|
width: width * spaceRatio,
|
|
@@ -2026,18 +2218,18 @@ var getTrendFontSize = function getTrendFontSize(_ref9) {
|
|
|
2026
2218
|
});
|
|
2027
2219
|
trendFontSize = parseInt(trendFontSize, 10) * spaceRatio;
|
|
2028
2220
|
}
|
|
2221
|
+
|
|
2029
2222
|
return trendFontSize;
|
|
2030
2223
|
};
|
|
2031
|
-
|
|
2032
2224
|
/*
|
|
2033
2225
|
* The height of underLabel should no more than 12px
|
|
2034
2226
|
* @param {Number} height
|
|
2035
2227
|
* @return {Number} height || DEFAULT_FONT
|
|
2036
2228
|
*/
|
|
2229
|
+
|
|
2037
2230
|
var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
2038
2231
|
return height > DEFAULT_FONT ? DEFAULT_FONT : height;
|
|
2039
2232
|
};
|
|
2040
|
-
|
|
2041
2233
|
/*
|
|
2042
2234
|
* @param {Object} config
|
|
2043
2235
|
* @param {String} underLabel
|
|
@@ -2045,19 +2237,18 @@ var getUnderLabelHeight = function getUnderLabelHeight(height) {
|
|
|
2045
2237
|
* @param {Number} height height of underLabel
|
|
2046
2238
|
* @param {Number} fond size of underLabel
|
|
2047
2239
|
*/
|
|
2240
|
+
|
|
2048
2241
|
var getUnderLabel = function getUnderLabel(_ref10) {
|
|
2049
2242
|
var underLabel = _ref10.underLabel,
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
return (
|
|
2053
|
-
// todo: may need truncate underLabel later
|
|
2243
|
+
width = _ref10.width,
|
|
2244
|
+
height = _ref10.height;
|
|
2245
|
+
return (// todo: may need truncate underLabel later
|
|
2054
2246
|
computeFontSize(underLabel, {
|
|
2055
2247
|
width: width,
|
|
2056
2248
|
height: height
|
|
2057
2249
|
})
|
|
2058
2250
|
);
|
|
2059
2251
|
};
|
|
2060
|
-
|
|
2061
2252
|
/**
|
|
2062
2253
|
* Compute value and font size for major and trend
|
|
2063
2254
|
* @method getMajorAndTrend
|
|
@@ -2075,18 +2266,19 @@ var getUnderLabel = function getUnderLabel(_ref10) {
|
|
|
2075
2266
|
* @param {Bool} props.shouldAbbreviateTrendValue
|
|
2076
2267
|
* @returns {Number, Number, Number, Number} Major text, trend text, major text size, trend text size
|
|
2077
2268
|
*/
|
|
2269
|
+
|
|
2078
2270
|
var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
2079
2271
|
var width = _ref11.width,
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2272
|
+
height = _ref11.height,
|
|
2273
|
+
majorValue = _ref11.majorValue,
|
|
2274
|
+
trendValue = _ref11.trendValue,
|
|
2275
|
+
majorFontSize = _ref11.majorFontSize,
|
|
2276
|
+
trendFontSize = _ref11.trendFontSize,
|
|
2277
|
+
trendDisplay = _ref11.trendDisplay,
|
|
2278
|
+
unit = _ref11.unit,
|
|
2279
|
+
numberPrecision = _ref11.numberPrecision,
|
|
2280
|
+
shouldUseThousandSeparators = _ref11.shouldUseThousandSeparators,
|
|
2281
|
+
shouldAbbreviateTrendValue = _ref11.shouldAbbreviateTrendValue;
|
|
2090
2282
|
var majorTextSpaceRatio = Object(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_2__["isNumerial"])(trendValue) && shouldShowTrend(trendDisplay) ? 0.6 : 1;
|
|
2091
2283
|
var textContentWidth = width * 0.9;
|
|
2092
2284
|
var textContentHeight = height * 0.9;
|
|
@@ -2123,7 +2315,6 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
2123
2315
|
trendTextFontSize: trendTextFontSize
|
|
2124
2316
|
};
|
|
2125
2317
|
};
|
|
2126
|
-
|
|
2127
2318
|
/*
|
|
2128
2319
|
* @method updateVizInSmallSpace
|
|
2129
2320
|
* @param {Object} props
|
|
@@ -2143,25 +2334,26 @@ var getMajorAndTrend = function getMajorAndTrend(_ref11) {
|
|
|
2143
2334
|
* @returns {Object} results.newMajorAndTrend
|
|
2144
2335
|
* @returns {Object} results.updatedProps
|
|
2145
2336
|
*/
|
|
2337
|
+
|
|
2146
2338
|
var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
2147
2339
|
var width = _ref12.width,
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2340
|
+
height = _ref12.height,
|
|
2341
|
+
toRemoveList = _ref12.toRemoveList,
|
|
2342
|
+
majorValue = _ref12.majorValue,
|
|
2343
|
+
trendValue = _ref12.trendValue,
|
|
2344
|
+
majorFontSize = _ref12.majorFontSize,
|
|
2345
|
+
trendFontSize = _ref12.trendFontSize,
|
|
2346
|
+
majorTextFontSize = _ref12.majorTextFontSize,
|
|
2347
|
+
unit = _ref12.unit,
|
|
2348
|
+
numberPrecision = _ref12.numberPrecision,
|
|
2349
|
+
shouldUseThousandSeparators = _ref12.shouldUseThousandSeparators,
|
|
2350
|
+
shouldAbbreviateTrendValue = _ref12.shouldAbbreviateTrendValue;
|
|
2159
2351
|
var removeIndex = 0;
|
|
2160
2352
|
var newProps = {}; // options need to be updated
|
|
2353
|
+
|
|
2161
2354
|
var newMajorAndTrend = {};
|
|
2162
|
-
var newTextSize = majorTextFontSize;
|
|
2355
|
+
var newTextSize = majorTextFontSize; // remove info on viz to make textFontSize >= 12px;
|
|
2163
2356
|
|
|
2164
|
-
// remove info on viz to make textFontSize >= 12px;
|
|
2165
2357
|
while (newTextSize < 12 && removeIndex < toRemoveList.length) {
|
|
2166
2358
|
var toRemove = toRemoveList[removeIndex];
|
|
2167
2359
|
newProps = _objectSpread(_objectSpread({}, newProps), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, toRemove.key, toRemove.value));
|
|
@@ -2179,9 +2371,9 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2179
2371
|
}, newProps));
|
|
2180
2372
|
newTextSize = newMajorAndTrend.majorTextFontSize;
|
|
2181
2373
|
removeIndex += 1;
|
|
2182
|
-
}
|
|
2374
|
+
} // truncate text if textFontSize is still less than 12
|
|
2375
|
+
|
|
2183
2376
|
|
|
2184
|
-
// truncate text if textFontSize is still less than 12
|
|
2185
2377
|
if (newTextSize < 12) {
|
|
2186
2378
|
var truncateValue = "".concat(majorValue.toString().slice(0, 3), "...");
|
|
2187
2379
|
newMajorAndTrend = getMajorAndTrend(_objectSpread({
|
|
@@ -2197,12 +2389,12 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2197
2389
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2198
2390
|
}, newProps));
|
|
2199
2391
|
}
|
|
2392
|
+
|
|
2200
2393
|
return {
|
|
2201
2394
|
newMajorAndTrend: newMajorAndTrend,
|
|
2202
2395
|
updatedProps: newProps
|
|
2203
2396
|
};
|
|
2204
2397
|
};
|
|
2205
|
-
|
|
2206
2398
|
/*
|
|
2207
2399
|
* @method computeSingleValueContent
|
|
2208
2400
|
* @param {Object} props
|
|
@@ -2228,67 +2420,71 @@ var updateVizInSmallSpace = function updateVizInSmallSpace(_ref12) {
|
|
|
2228
2420
|
* @returns {String} results.majorValueTitle
|
|
2229
2421
|
* @returns {Object} results.smallVizProps
|
|
2230
2422
|
*/
|
|
2423
|
+
|
|
2231
2424
|
var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
2232
2425
|
var contentWidth = _ref13.contentWidth,
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2426
|
+
contentHeight = _ref13.contentHeight,
|
|
2427
|
+
containerWidth = _ref13.containerWidth,
|
|
2428
|
+
containerHeight = _ref13.containerHeight,
|
|
2429
|
+
majorValue = _ref13.majorValue,
|
|
2430
|
+
trendValue = _ref13.trendValue,
|
|
2431
|
+
majorFontSize = _ref13.majorFontSize,
|
|
2432
|
+
trendFontSize = _ref13.trendFontSize,
|
|
2433
|
+
trendDisplay = _ref13.trendDisplay,
|
|
2434
|
+
unit = _ref13.unit,
|
|
2435
|
+
numberPrecision = _ref13.numberPrecision,
|
|
2436
|
+
shouldUseThousandSeparators = _ref13.shouldUseThousandSeparators,
|
|
2437
|
+
shouldAbbreviateTrendValue = _ref13.shouldAbbreviateTrendValue,
|
|
2438
|
+
toRemoveList = _ref13.toRemoveList;
|
|
2439
|
+
|
|
2246
2440
|
var _getMajorAndTrend = getMajorAndTrend({
|
|
2247
|
-
|
|
2441
|
+
majorValue: majorValue,
|
|
2442
|
+
trendValue: trendValue,
|
|
2443
|
+
majorFontSize: majorFontSize,
|
|
2444
|
+
trendFontSize: trendFontSize,
|
|
2445
|
+
trendDisplay: trendDisplay,
|
|
2446
|
+
width: contentWidth,
|
|
2447
|
+
height: contentHeight,
|
|
2448
|
+
unit: unit,
|
|
2449
|
+
numberPrecision: numberPrecision,
|
|
2450
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2451
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2452
|
+
}),
|
|
2453
|
+
majorText = _getMajorAndTrend.majorText,
|
|
2454
|
+
trendText = _getMajorAndTrend.trendText,
|
|
2455
|
+
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
2456
|
+
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
2457
|
+
|
|
2458
|
+
var majorValueTitle = majorText;
|
|
2459
|
+
var smallVizProps = {}; // update viz in small space
|
|
2460
|
+
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
2461
|
+
// or truncate major value to make the major font size >= 12
|
|
2462
|
+
|
|
2463
|
+
if (majorTextFontSize < 12) {
|
|
2464
|
+
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
2465
|
+
width: containerWidth,
|
|
2466
|
+
height: containerHeight,
|
|
2467
|
+
toRemoveList: toRemoveList,
|
|
2468
|
+
majorValue: majorValue,
|
|
2248
2469
|
trendValue: trendValue,
|
|
2249
2470
|
majorFontSize: majorFontSize,
|
|
2250
2471
|
trendFontSize: trendFontSize,
|
|
2251
|
-
|
|
2252
|
-
width: contentWidth,
|
|
2253
|
-
height: contentHeight,
|
|
2472
|
+
majorTextFontSize: majorTextFontSize,
|
|
2254
2473
|
unit: unit,
|
|
2255
2474
|
numberPrecision: numberPrecision,
|
|
2256
2475
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2257
2476
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2258
2477
|
}),
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
majorTextFontSize = _getMajorAndTrend.majorTextFontSize,
|
|
2262
|
-
trendTextFontSize = _getMajorAndTrend.trendTextFontSize;
|
|
2263
|
-
var majorValueTitle = majorText;
|
|
2264
|
-
var smallVizProps = {};
|
|
2478
|
+
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
2479
|
+
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
2265
2480
|
|
|
2266
|
-
// update viz in small space
|
|
2267
|
-
// if textFontSize is less than 12, remove extra info like sparkline, trendvalue, unit
|
|
2268
|
-
// or truncate major value to make the major font size >= 12
|
|
2269
|
-
if (majorTextFontSize < 12) {
|
|
2270
|
-
var _updateVizInSmallSpac = updateVizInSmallSpace({
|
|
2271
|
-
width: containerWidth,
|
|
2272
|
-
height: containerHeight,
|
|
2273
|
-
toRemoveList: toRemoveList,
|
|
2274
|
-
majorValue: majorValue,
|
|
2275
|
-
trendValue: trendValue,
|
|
2276
|
-
majorFontSize: majorFontSize,
|
|
2277
|
-
trendFontSize: trendFontSize,
|
|
2278
|
-
majorTextFontSize: majorTextFontSize,
|
|
2279
|
-
unit: unit,
|
|
2280
|
-
numberPrecision: numberPrecision,
|
|
2281
|
-
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2282
|
-
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2283
|
-
}),
|
|
2284
|
-
newMajorAndTrend = _updateVizInSmallSpac.newMajorAndTrend,
|
|
2285
|
-
updatedProps = _updateVizInSmallSpac.updatedProps;
|
|
2286
2481
|
majorText = newMajorAndTrend.majorText;
|
|
2287
2482
|
trendText = newMajorAndTrend.trendText;
|
|
2288
2483
|
majorTextFontSize = newMajorAndTrend.majorTextFontSize;
|
|
2289
2484
|
trendTextFontSize = newMajorAndTrend.trendTextFontSize;
|
|
2290
2485
|
smallVizProps = updatedProps;
|
|
2291
2486
|
}
|
|
2487
|
+
|
|
2292
2488
|
return {
|
|
2293
2489
|
majorText: majorText,
|
|
2294
2490
|
trendText: trendText,
|
|
@@ -2300,17 +2496,17 @@ var computeSingleValueContent = function computeSingleValueContent(_ref13) {
|
|
|
2300
2496
|
};
|
|
2301
2497
|
var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_ref14) {
|
|
2302
2498
|
var text = _ref14.text,
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2499
|
+
_ref14$fontSize = _ref14.fontSize,
|
|
2500
|
+
fontSize = _ref14$fontSize === void 0 ? DEFAULT_FONT : _ref14$fontSize,
|
|
2501
|
+
_ref14$fontFamily = _ref14.fontFamily,
|
|
2502
|
+
fontFamily = _ref14$fontFamily === void 0 ? DEFAULT_FONT_FAMILY : _ref14$fontFamily,
|
|
2503
|
+
_ref14$fontWeight = _ref14.fontWeight,
|
|
2504
|
+
fontWeight = _ref14$fontWeight === void 0 ? 'normal' : _ref14$fontWeight,
|
|
2505
|
+
containerWidth = _ref14.containerWidth;
|
|
2310
2506
|
var textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(text, "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
2311
2507
|
var modifiedText = text;
|
|
2312
|
-
var ellipsesLength = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])('...', "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily));
|
|
2313
|
-
|
|
2508
|
+
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.
|
|
2509
|
+
|
|
2314
2510
|
if (containerWidth - ellipsesLength > 0 && textWidth > containerWidth) {
|
|
2315
2511
|
// Truncates the content such that the truncated value + ellipses fit within the allocated space for the ellipses.
|
|
2316
2512
|
// `textWidth > containerWidth - ellipsesLength` condition checks if text + ellipses exceeds container width.
|
|
@@ -2319,11 +2515,12 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
2319
2515
|
modifiedText = modifiedText.substring(0, modifiedText.length - 1);
|
|
2320
2516
|
textWidth = Object(_splunk_visualizations_shared_domUtils__WEBPACK_IMPORTED_MODULE_3__["computeTextSize"])(modifiedText, "normal ".concat(fontSize, "px ").concat(fontFamily));
|
|
2321
2517
|
}
|
|
2518
|
+
|
|
2322
2519
|
modifiedText = "".concat(modifiedText, "...");
|
|
2323
2520
|
}
|
|
2521
|
+
|
|
2324
2522
|
return modifiedText;
|
|
2325
2523
|
};
|
|
2326
|
-
|
|
2327
2524
|
/*
|
|
2328
2525
|
* @method computeSingleValueRadialContent
|
|
2329
2526
|
* @param {Object} props
|
|
@@ -2350,44 +2547,46 @@ var minimallyTruncateStringToWidth = function minimallyTruncateStringToWidth(_re
|
|
|
2350
2547
|
* @returns {String} results.majorValueTitle
|
|
2351
2548
|
* @returns {Object} results.smallVizProps
|
|
2352
2549
|
*/
|
|
2550
|
+
|
|
2353
2551
|
var computeSingleValueRadialContent = function computeSingleValueRadialContent(_ref15) {
|
|
2354
2552
|
var contentWidth = _ref15.contentWidth,
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2553
|
+
contentHeight = _ref15.contentHeight,
|
|
2554
|
+
containerWidth = _ref15.containerWidth,
|
|
2555
|
+
containerHeight = _ref15.containerHeight,
|
|
2556
|
+
majorValue = _ref15.majorValue,
|
|
2557
|
+
trendValue = _ref15.trendValue,
|
|
2558
|
+
majorFontSize = _ref15.majorFontSize,
|
|
2559
|
+
trendFontSize = _ref15.trendFontSize,
|
|
2560
|
+
trendDisplay = _ref15.trendDisplay,
|
|
2561
|
+
unit = _ref15.unit,
|
|
2562
|
+
numberPrecision = _ref15.numberPrecision,
|
|
2563
|
+
shouldUseThousandSeparators = _ref15.shouldUseThousandSeparators,
|
|
2564
|
+
shouldAbbreviateTrendValue = _ref15.shouldAbbreviateTrendValue,
|
|
2565
|
+
smallViz = _ref15.smallViz;
|
|
2566
|
+
|
|
2368
2567
|
var _getMajorAndTrend2 = getMajorAndTrend({
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
var majorValueTitle = majorText;
|
|
2386
|
-
var smallVizProps = {};
|
|
2568
|
+
majorValue: majorValue,
|
|
2569
|
+
trendValue: trendValue,
|
|
2570
|
+
majorFontSize: majorFontSize,
|
|
2571
|
+
trendFontSize: trendFontSize,
|
|
2572
|
+
trendDisplay: trendDisplay,
|
|
2573
|
+
width: contentWidth,
|
|
2574
|
+
height: contentHeight,
|
|
2575
|
+
unit: unit,
|
|
2576
|
+
numberPrecision: numberPrecision,
|
|
2577
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2578
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2579
|
+
}),
|
|
2580
|
+
majorText = _getMajorAndTrend2.majorText,
|
|
2581
|
+
trendText = _getMajorAndTrend2.trendText,
|
|
2582
|
+
majorTextFontSize = _getMajorAndTrend2.majorTextFontSize,
|
|
2583
|
+
trendTextFontSize = _getMajorAndTrend2.trendTextFontSize;
|
|
2387
2584
|
|
|
2388
|
-
|
|
2585
|
+
var majorValueTitle = majorText;
|
|
2586
|
+
var smallVizProps = {}; // custom logic for viz in small space
|
|
2389
2587
|
// if not showing the radial graph (if `smallViz` is true), then compute truncated major value
|
|
2390
2588
|
// and font sizes
|
|
2589
|
+
|
|
2391
2590
|
if (smallViz) {
|
|
2392
2591
|
var truncateValue = minimallyTruncateStringToWidth({
|
|
2393
2592
|
text: majorValue,
|
|
@@ -2395,6 +2594,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2395
2594
|
fontSize: 12,
|
|
2396
2595
|
containerWidth: containerWidth
|
|
2397
2596
|
});
|
|
2597
|
+
|
|
2398
2598
|
var _getMajorAndTrend3 = getMajorAndTrend({
|
|
2399
2599
|
majorValue: truncateValue,
|
|
2400
2600
|
trendValue: trendValue,
|
|
@@ -2408,6 +2608,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2408
2608
|
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
2409
2609
|
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue
|
|
2410
2610
|
});
|
|
2611
|
+
|
|
2411
2612
|
majorText = _getMajorAndTrend3.majorText;
|
|
2412
2613
|
trendText = _getMajorAndTrend3.trendText;
|
|
2413
2614
|
majorTextFontSize = _getMajorAndTrend3.majorTextFontSize;
|
|
@@ -2417,6 +2618,7 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2417
2618
|
unit: unit
|
|
2418
2619
|
};
|
|
2419
2620
|
}
|
|
2621
|
+
|
|
2420
2622
|
return {
|
|
2421
2623
|
majorText: majorText,
|
|
2422
2624
|
trendText: trendText,
|
|
@@ -2426,7 +2628,6 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2426
2628
|
smallVizProps: smallVizProps
|
|
2427
2629
|
};
|
|
2428
2630
|
};
|
|
2429
|
-
|
|
2430
2631
|
/**
|
|
2431
2632
|
* Get the colors for a graph
|
|
2432
2633
|
*
|
|
@@ -2439,21 +2640,22 @@ var computeSingleValueRadialContent = function computeSingleValueRadialContent(_
|
|
|
2439
2640
|
* @returns {Object} { background, stroke } colors
|
|
2440
2641
|
* @private
|
|
2441
2642
|
*/
|
|
2643
|
+
|
|
2442
2644
|
var getGraphColors = function getGraphColors(_ref16) {
|
|
2443
2645
|
var backgroundEnabled = _ref16.backgroundEnabled,
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2646
|
+
backgroundColor = _ref16.backgroundColor,
|
|
2647
|
+
defaultColors = _ref16.defaultColors,
|
|
2648
|
+
customColorFormatter = _ref16.customColorFormatter; // Only do custom colors in block mode
|
|
2649
|
+
|
|
2448
2650
|
if (backgroundEnabled) {
|
|
2449
2651
|
// Check if the user defined colors to use
|
|
2450
2652
|
if (backgroundColor && typeof customColorFormatter === 'function') {
|
|
2451
2653
|
return customColorFormatter(backgroundColor);
|
|
2452
2654
|
}
|
|
2453
2655
|
}
|
|
2656
|
+
|
|
2454
2657
|
return defaultColors.none;
|
|
2455
2658
|
};
|
|
2456
|
-
|
|
2457
2659
|
/**
|
|
2458
2660
|
* Adjust rgb value if it equals to 0 or 255
|
|
2459
2661
|
* @method adjustRGB
|
|
@@ -2462,16 +2664,18 @@ var getGraphColors = function getGraphColors(_ref16) {
|
|
|
2462
2664
|
* @returns {Number} adjusted rgb
|
|
2463
2665
|
* @private
|
|
2464
2666
|
*/
|
|
2667
|
+
|
|
2465
2668
|
var adjustRGB = function adjustRGB(rgb, delta) {
|
|
2466
2669
|
if (rgb === 255) {
|
|
2467
2670
|
return rgb - delta;
|
|
2468
2671
|
}
|
|
2672
|
+
|
|
2469
2673
|
if (rgb === 0) {
|
|
2470
2674
|
return rgb + delta;
|
|
2471
2675
|
}
|
|
2676
|
+
|
|
2472
2677
|
return rgb;
|
|
2473
2678
|
};
|
|
2474
|
-
|
|
2475
2679
|
/**
|
|
2476
2680
|
* Modifies colors by multiplying by a given ratio
|
|
2477
2681
|
* @method changeColor
|
|
@@ -2480,18 +2684,16 @@ var adjustRGB = function adjustRGB(rgb, delta) {
|
|
|
2480
2684
|
* @returns {String} new color
|
|
2481
2685
|
* @private
|
|
2482
2686
|
*/
|
|
2687
|
+
|
|
2483
2688
|
var changeColor = function changeColor(color, ratio) {
|
|
2484
2689
|
var hex = color.replace(/(0x|#)/, '');
|
|
2485
2690
|
var r = parseInt(hex.substr(0, 2), 16);
|
|
2486
2691
|
var g = parseInt(hex.substr(2, 2), 16);
|
|
2487
|
-
var b = parseInt(hex.substr(4, 2), 16);
|
|
2692
|
+
var b = parseInt(hex.substr(4, 2), 16); // Multiply by given ratio, make sure is between 0 and 255;
|
|
2488
2693
|
|
|
2489
|
-
// Multiply by given ratio, make sure is between 0 and 255;
|
|
2490
2694
|
var newR = Math.max(Math.min(Math.floor(r * ratio), 255), 0);
|
|
2491
2695
|
var newG = Math.max(Math.min(Math.floor(g * ratio), 255), 0);
|
|
2492
|
-
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0);
|
|
2493
|
-
|
|
2494
|
-
// If the color is not changed
|
|
2696
|
+
var newB = Math.max(Math.min(Math.floor(b * ratio), 255), 0); // If the color is not changed
|
|
2495
2697
|
// case 1: the color is (0, 0 0)
|
|
2496
2698
|
// lighten color (80, 80, 80)
|
|
2497
2699
|
// darken color (40, 40, 40)
|
|
@@ -2500,6 +2702,7 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2500
2702
|
// darken color (175, 175, 175)
|
|
2501
2703
|
// case 3: the color is e.g. (0, 255, 0)
|
|
2502
2704
|
// new color (20, 235, 20)
|
|
2705
|
+
|
|
2503
2706
|
if (newR === r && newG === g && newB === b) {
|
|
2504
2707
|
if (newR === 0 && newG === 0 && newB === 0) {
|
|
2505
2708
|
if (ratio > 1) {
|
|
@@ -2527,9 +2730,9 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2527
2730
|
newB = adjustRGB(newB, 20);
|
|
2528
2731
|
}
|
|
2529
2732
|
}
|
|
2733
|
+
|
|
2530
2734
|
return "#".concat(newR.toString(16).padStart(2, 0)) + "".concat(newG.toString(16).padStart(2, 0)) + "".concat(newB.toString(16).padStart(2, 0));
|
|
2531
2735
|
};
|
|
2532
|
-
|
|
2533
2736
|
/**
|
|
2534
2737
|
* Lighten a given color
|
|
2535
2738
|
* @method lighten
|
|
@@ -2537,10 +2740,11 @@ var changeColor = function changeColor(color, ratio) {
|
|
|
2537
2740
|
* @returns {String}
|
|
2538
2741
|
* @private
|
|
2539
2742
|
*/
|
|
2743
|
+
|
|
2744
|
+
|
|
2540
2745
|
var lighten = function lighten(color) {
|
|
2541
2746
|
return changeColor(color, 1.3);
|
|
2542
2747
|
};
|
|
2543
|
-
|
|
2544
2748
|
/**
|
|
2545
2749
|
* Darkens a given color
|
|
2546
2750
|
* @method darken
|
|
@@ -2548,10 +2752,10 @@ var lighten = function lighten(color) {
|
|
|
2548
2752
|
* @returns {String}
|
|
2549
2753
|
* @private
|
|
2550
2754
|
*/
|
|
2755
|
+
|
|
2551
2756
|
var darken = function darken(color) {
|
|
2552
2757
|
return changeColor(color, 0.5);
|
|
2553
2758
|
};
|
|
2554
|
-
|
|
2555
2759
|
/** consistent token structure: handle callback to add value and name in event payload
|
|
2556
2760
|
* @method handleValueClickCallback
|
|
2557
2761
|
* @param {Object} ev
|
|
@@ -2560,6 +2764,7 @@ var darken = function darken(color) {
|
|
|
2560
2764
|
* @param {Number} trendValue
|
|
2561
2765
|
* @param {Function} onValueClick
|
|
2562
2766
|
*/
|
|
2767
|
+
|
|
2563
2768
|
var handleValueClickCallback = function handleValueClickCallback(ev, majorValue, majorValueField, trendValue, onValueClick) {
|
|
2564
2769
|
var trellisEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
2565
2770
|
var trellisSplityBy = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : '';
|
|
@@ -2569,12 +2774,14 @@ var handleValueClickCallback = function handleValueClickCallback(ev, majorValue,
|
|
|
2569
2774
|
value: majorValue,
|
|
2570
2775
|
name: majorValueField
|
|
2571
2776
|
};
|
|
2777
|
+
|
|
2572
2778
|
if (trellisEnabled) {
|
|
2573
2779
|
payload = _objectSpread(_objectSpread({}, payload), {}, {
|
|
2574
2780
|
'trellis.name': trellisSplityBy,
|
|
2575
2781
|
'trellis.value': trellisKey
|
|
2576
2782
|
});
|
|
2577
2783
|
}
|
|
2784
|
+
|
|
2578
2785
|
return onValueClick(_objectSpread(_objectSpread({}, ev), {}, {
|
|
2579
2786
|
payload: payload
|
|
2580
2787
|
}));
|
|
@@ -2648,11 +2855,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2648
2855
|
value: true
|
|
2649
2856
|
});
|
|
2650
2857
|
exports.shouldShowIconPlaceholder = void 0;
|
|
2858
|
+
|
|
2651
2859
|
var React = __webpack_require__(1);
|
|
2860
|
+
|
|
2652
2861
|
var T = __webpack_require__(0);
|
|
2862
|
+
|
|
2653
2863
|
var lodash_1 = __webpack_require__(3);
|
|
2864
|
+
|
|
2654
2865
|
var i18n_1 = __webpack_require__(2);
|
|
2866
|
+
|
|
2655
2867
|
var Message_1 = __webpack_require__(10);
|
|
2868
|
+
|
|
2656
2869
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2657
2870
|
/**
|
|
2658
2871
|
* @method shouldShowIconPlaceholder
|
|
@@ -2660,6 +2873,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
2660
2873
|
* @param {boolean} loading
|
|
2661
2874
|
* @returns {boolean}
|
|
2662
2875
|
*/
|
|
2876
|
+
|
|
2877
|
+
|
|
2663
2878
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
2664
2879
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2665
2880
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -2668,6 +2883,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
2668
2883
|
var noFields = fields === undefined;
|
|
2669
2884
|
return loading || noData || noFields;
|
|
2670
2885
|
};
|
|
2886
|
+
|
|
2671
2887
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
2672
2888
|
var propTypes = {
|
|
2673
2889
|
icon: T.func,
|
|
@@ -2682,11 +2898,13 @@ var propTypes = {
|
|
|
2682
2898
|
* @param {IconPlaceholderProps} props
|
|
2683
2899
|
* @returns {React.ReactElement}
|
|
2684
2900
|
*/
|
|
2901
|
+
|
|
2685
2902
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
2686
2903
|
var width = props.width,
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2904
|
+
height = props.height,
|
|
2905
|
+
icon = props.icon,
|
|
2906
|
+
iconColor = props.iconColor;
|
|
2907
|
+
|
|
2690
2908
|
if (icon) {
|
|
2691
2909
|
return React.createElement(icon, {
|
|
2692
2910
|
style: {
|
|
@@ -2701,6 +2919,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2701
2919
|
height: '50%'
|
|
2702
2920
|
});
|
|
2703
2921
|
}
|
|
2922
|
+
|
|
2704
2923
|
return React.createElement(Message_1.default, {
|
|
2705
2924
|
width: width,
|
|
2706
2925
|
height: height,
|
|
@@ -2708,6 +2927,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
2708
2927
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
2709
2928
|
});
|
|
2710
2929
|
};
|
|
2930
|
+
|
|
2711
2931
|
IconPlaceholder.propTypes = propTypes;
|
|
2712
2932
|
IconPlaceholder.defaultProps = {
|
|
2713
2933
|
width: '100%',
|
|
@@ -2724,21 +2944,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
2724
2944
|
|
|
2725
2945
|
|
|
2726
2946
|
var _defineProperty = __webpack_require__(7);
|
|
2947
|
+
|
|
2727
2948
|
Object.defineProperty(exports, "__esModule", {
|
|
2728
2949
|
value: true
|
|
2729
2950
|
});
|
|
2730
2951
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
2952
|
+
|
|
2731
2953
|
var T = __webpack_require__(0);
|
|
2954
|
+
|
|
2732
2955
|
var lodash_1 = __webpack_require__(3);
|
|
2733
|
-
|
|
2956
|
+
|
|
2957
|
+
var DataSource_1 = __webpack_require__(34);
|
|
2958
|
+
|
|
2734
2959
|
exports.SortParamsPropTypes = T.shape({
|
|
2735
2960
|
currentSortKey: T.string,
|
|
2736
2961
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
2737
2962
|
onSort: T.func
|
|
2738
2963
|
});
|
|
2964
|
+
|
|
2739
2965
|
var getSortingParams = function getSortingParams(_ref) {
|
|
2740
2966
|
var requestParams = _ref.requestParams,
|
|
2741
|
-
|
|
2967
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2742
2968
|
var currentSortKey;
|
|
2743
2969
|
var currentSortDir;
|
|
2744
2970
|
var nextSortDirMap = {
|
|
@@ -2747,15 +2973,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2747
2973
|
none: 'asc'
|
|
2748
2974
|
};
|
|
2749
2975
|
var onSort;
|
|
2976
|
+
|
|
2750
2977
|
if (typeof onRequestParamsChange === 'function') {
|
|
2751
2978
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
2752
2979
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
2753
2980
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
2754
|
-
}
|
|
2755
|
-
|
|
2981
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
2982
|
+
|
|
2983
|
+
|
|
2756
2984
|
onSort = function onSort(e, _ref2) {
|
|
2757
2985
|
var sortKey = _ref2.sortKey,
|
|
2758
|
-
|
|
2986
|
+
sortDir = _ref2.sortDir;
|
|
2987
|
+
|
|
2759
2988
|
if (typeof sortKey === 'string') {
|
|
2760
2989
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
2761
2990
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -2767,12 +2996,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
2767
2996
|
}
|
|
2768
2997
|
};
|
|
2769
2998
|
}
|
|
2999
|
+
|
|
2770
3000
|
return {
|
|
2771
3001
|
currentSortKey: currentSortKey,
|
|
2772
3002
|
currentSortDir: currentSortDir,
|
|
2773
3003
|
onSort: onSort
|
|
2774
3004
|
};
|
|
2775
3005
|
};
|
|
3006
|
+
|
|
2776
3007
|
exports.getSortingParams = getSortingParams;
|
|
2777
3008
|
|
|
2778
3009
|
/***/ }),
|
|
@@ -2783,43 +3014,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
2783
3014
|
"use strict";
|
|
2784
3015
|
|
|
2785
3016
|
|
|
3017
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3018
|
+
value: true
|
|
3019
|
+
});
|
|
3020
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
3021
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3022
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
3023
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
3024
|
+
|
|
3025
|
+
/***/ }),
|
|
3026
|
+
|
|
3027
|
+
/***/ 35:
|
|
3028
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3029
|
+
|
|
3030
|
+
"use strict";
|
|
3031
|
+
|
|
3032
|
+
|
|
2786
3033
|
Object.defineProperty(exports, "__esModule", {
|
|
2787
3034
|
value: true
|
|
2788
3035
|
});
|
|
2789
3036
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
3037
|
+
|
|
2790
3038
|
var T = __webpack_require__(0);
|
|
3039
|
+
|
|
2791
3040
|
var lodash_1 = __webpack_require__(3);
|
|
3041
|
+
|
|
2792
3042
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
2793
3043
|
isPaging: T.bool,
|
|
2794
3044
|
current: T.number,
|
|
2795
3045
|
totalPages: T.number,
|
|
2796
3046
|
onChange: T.func
|
|
2797
3047
|
});
|
|
3048
|
+
|
|
2798
3049
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
2799
3050
|
var requestParams = _ref.requestParams,
|
|
2800
|
-
|
|
2801
|
-
|
|
3051
|
+
meta = _ref.meta,
|
|
3052
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
2802
3053
|
var totalCount = meta && meta.totalCount || 0;
|
|
2803
3054
|
var offset = requestParams && requestParams.offset || 0;
|
|
2804
3055
|
var count = requestParams && requestParams.count;
|
|
2805
3056
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
2806
3057
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
2807
3058
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
3059
|
+
|
|
2808
3060
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
2809
3061
|
var page = _ref2.page,
|
|
2810
|
-
|
|
3062
|
+
countArg = _ref2.count;
|
|
2811
3063
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
3064
|
+
|
|
2812
3065
|
if (typeof countArg === 'number') {
|
|
2813
3066
|
newParams.count = countArg;
|
|
2814
3067
|
newParams.offset = 0;
|
|
2815
3068
|
}
|
|
3069
|
+
|
|
2816
3070
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
3071
|
+
|
|
2817
3072
|
if (typeof page === 'number' && page > 0) {
|
|
2818
3073
|
newParams.count = pageCount;
|
|
2819
3074
|
newParams.offset = (page - 1) * pageCount;
|
|
2820
3075
|
}
|
|
3076
|
+
|
|
2821
3077
|
onRequestParamsChange(newParams);
|
|
2822
3078
|
};
|
|
3079
|
+
|
|
2823
3080
|
return {
|
|
2824
3081
|
isPaging: isPaging,
|
|
2825
3082
|
current: current,
|
|
@@ -2827,11 +3084,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
2827
3084
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
2828
3085
|
};
|
|
2829
3086
|
};
|
|
3087
|
+
|
|
2830
3088
|
exports.getPaginationParams = getPaginationParams;
|
|
2831
3089
|
|
|
2832
3090
|
/***/ }),
|
|
2833
3091
|
|
|
2834
|
-
/***/
|
|
3092
|
+
/***/ 36:
|
|
2835
3093
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2836
3094
|
|
|
2837
3095
|
"use strict";
|
|
@@ -2842,6 +3100,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2842
3100
|
});
|
|
2843
3101
|
exports.VizCategory = void 0;
|
|
2844
3102
|
var VizCategory;
|
|
3103
|
+
|
|
2845
3104
|
(function (VizCategory) {
|
|
2846
3105
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
2847
3106
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -2859,67 +3118,96 @@ var VizCategory;
|
|
|
2859
3118
|
|
|
2860
3119
|
/***/ }),
|
|
2861
3120
|
|
|
2862
|
-
/***/
|
|
3121
|
+
/***/ 37:
|
|
2863
3122
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2864
3123
|
|
|
2865
3124
|
"use strict";
|
|
2866
3125
|
|
|
2867
3126
|
|
|
2868
3127
|
var _slicedToArray = __webpack_require__(17);
|
|
3128
|
+
|
|
2869
3129
|
Object.defineProperty(exports, "__esModule", {
|
|
2870
3130
|
value: true
|
|
2871
3131
|
});
|
|
3132
|
+
|
|
2872
3133
|
var React = __webpack_require__(1);
|
|
3134
|
+
|
|
2873
3135
|
var lodash_1 = __webpack_require__(3);
|
|
2874
|
-
|
|
3136
|
+
|
|
3137
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
3138
|
+
|
|
2875
3139
|
var Options_1 = __webpack_require__(30);
|
|
2876
|
-
|
|
3140
|
+
|
|
3141
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
3142
|
+
|
|
2877
3143
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
2878
|
-
|
|
3144
|
+
|
|
3145
|
+
var moment_1 = __webpack_require__(40);
|
|
3146
|
+
|
|
2879
3147
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
3148
|
+
|
|
2880
3149
|
var styled_components_1 = __webpack_require__(4);
|
|
3150
|
+
|
|
2881
3151
|
var hocUtils_1 = __webpack_require__(27);
|
|
3152
|
+
|
|
2882
3153
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
2883
|
-
|
|
3154
|
+
|
|
3155
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
3156
|
+
|
|
2884
3157
|
var id_1 = __webpack_require__(25);
|
|
2885
|
-
|
|
3158
|
+
|
|
3159
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
3160
|
+
|
|
2886
3161
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3162
|
+
|
|
2887
3163
|
var getSorting_1 = __webpack_require__(33);
|
|
2888
|
-
|
|
3164
|
+
|
|
3165
|
+
var getPagination_1 = __webpack_require__(35);
|
|
3166
|
+
|
|
2889
3167
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
3168
|
+
|
|
2890
3169
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
3170
|
+
|
|
2891
3171
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
3172
|
+
|
|
2892
3173
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
2893
3174
|
/**
|
|
2894
3175
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
2895
3176
|
* @param {DashboardVizOpts} opts
|
|
2896
3177
|
* @returns {HOC}
|
|
2897
3178
|
*/
|
|
3179
|
+
|
|
3180
|
+
|
|
2898
3181
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
2899
3182
|
var ReactViz = opts.ReactViz,
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
3183
|
+
vizConfig = opts.vizConfig,
|
|
3184
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
3185
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
3186
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
3187
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
3188
|
+
|
|
2905
3189
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
2906
3190
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
3191
|
+
|
|
2907
3192
|
var DashboardViz = function DashboardViz(props) {
|
|
2908
3193
|
var _a;
|
|
3194
|
+
|
|
2909
3195
|
var mode = props.mode,
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
3196
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
3197
|
+
dataSources = props.dataSources,
|
|
3198
|
+
options = props.options,
|
|
3199
|
+
_props$context = props.context,
|
|
3200
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
3201
|
+
width = props.width,
|
|
3202
|
+
height = props.height,
|
|
3203
|
+
onComputedProps = props.onComputedProps,
|
|
3204
|
+
onEventTrigger = props.onEventTrigger,
|
|
3205
|
+
theme = props.theme,
|
|
3206
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
3207
|
+
|
|
2921
3208
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
2922
|
-
|
|
3209
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
3210
|
+
|
|
2923
3211
|
if (serializedTimezone) {
|
|
2924
3212
|
/*
|
|
2925
3213
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -2933,38 +3221,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
2933
3221
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2934
3222
|
}
|
|
2935
3223
|
}
|
|
3224
|
+
|
|
2936
3225
|
var themeFunc = function themeFunc(themeVar) {
|
|
2937
3226
|
var _a, _b;
|
|
3227
|
+
|
|
2938
3228
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
2939
3229
|
};
|
|
3230
|
+
|
|
2940
3231
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
3232
|
+
|
|
2941
3233
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
3234
|
+
theme: theme
|
|
3235
|
+
}),
|
|
3236
|
+
currentThemeFamily = _ref.family,
|
|
3237
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
3238
|
+
currentThemeDensity = _ref.density;
|
|
3239
|
+
|
|
2947
3240
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
3241
|
+
|
|
2948
3242
|
var _React$useState = React.useState({}),
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
3243
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3244
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
3245
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
3246
|
+
|
|
3247
|
+
|
|
2952
3248
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
3249
|
+
|
|
2953
3250
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
2954
|
-
|
|
2955
|
-
|
|
3251
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
3252
|
+
visualizationID = _React$useState4[0];
|
|
3253
|
+
|
|
2956
3254
|
var _React$useState5 = React.useState({}),
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3255
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3256
|
+
dataSourcesInState = _React$useState6[0],
|
|
3257
|
+
setDataSourcesInState = _React$useState6[1];
|
|
3258
|
+
|
|
2960
3259
|
var _React$useState7 = React.useState(),
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
3260
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3261
|
+
dataFramesInState = _React$useState8[0],
|
|
3262
|
+
setDataFramesInState = _React$useState8[1];
|
|
3263
|
+
|
|
2964
3264
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
3265
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
3266
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
3267
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
3268
|
+
|
|
2968
3269
|
var isMounted = React.useRef(true);
|
|
2969
3270
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
2970
3271
|
try {
|
|
@@ -2989,11 +3290,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
2989
3290
|
});
|
|
2990
3291
|
} else {
|
|
2991
3292
|
var dataFrames = dataFramesInState;
|
|
3293
|
+
|
|
2992
3294
|
if (dataSources !== dataSourcesInState) {
|
|
2993
3295
|
setDataSourcesInState(dataSources);
|
|
2994
3296
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
2995
3297
|
setDataFramesInState(dataFrames);
|
|
2996
3298
|
}
|
|
3299
|
+
|
|
2997
3300
|
return Options_1.Options.evaluate({
|
|
2998
3301
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
2999
3302
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -3004,21 +3307,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3004
3307
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
3005
3308
|
return {};
|
|
3006
3309
|
}
|
|
3310
|
+
|
|
3007
3311
|
return {};
|
|
3008
3312
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
3009
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
3010
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
3313
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
3011
3314
|
// 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
|
|
3012
3315
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
3316
|
+
|
|
3013
3317
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
3014
3318
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
3319
|
+
|
|
3015
3320
|
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) {
|
|
3016
3321
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
3017
3322
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
3018
3323
|
});
|
|
3019
|
-
}
|
|
3020
|
-
// useEffect hook needs to be initialized before any early returns
|
|
3324
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
3021
3325
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
3326
|
+
|
|
3327
|
+
|
|
3022
3328
|
React.useEffect(function () {
|
|
3023
3329
|
onComputedProps(clonedEvaluatedOptions);
|
|
3024
3330
|
});
|
|
@@ -3028,44 +3334,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3028
3334
|
isMounted.current = false;
|
|
3029
3335
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
3030
3336
|
}
|
|
3031
|
-
};
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
// present warning message if any required props are missing
|
|
3337
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3338
|
+
}, []); // present warning message if any required props are missing
|
|
3339
|
+
|
|
3035
3340
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
3036
|
-
|
|
3037
|
-
|
|
3341
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
3342
|
+
supports = vizConfig.supports;
|
|
3038
3343
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
3344
|
+
|
|
3039
3345
|
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
|
|
3040
3346
|
) {
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3347
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
3348
|
+
"data-test": "missing-props-message",
|
|
3349
|
+
width: width,
|
|
3350
|
+
height: height,
|
|
3351
|
+
missingProps: missing,
|
|
3352
|
+
backgroundColor: bgColorFromTheme
|
|
3353
|
+
});
|
|
3354
|
+
} // events
|
|
3355
|
+
|
|
3356
|
+
|
|
3050
3357
|
var eventCallbackProps = {};
|
|
3358
|
+
|
|
3051
3359
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
3052
3360
|
var supportedEvents = vizConfig.events;
|
|
3053
3361
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
3054
3362
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
3055
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
3056
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
3363
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
3057
3364
|
// then remove these lines
|
|
3365
|
+
|
|
3058
3366
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
3059
3367
|
var payload = {};
|
|
3368
|
+
|
|
3060
3369
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
3061
3370
|
payloadKeys.forEach(function (p) {
|
|
3062
3371
|
payload[p] = evaluatedOptionsToUse[p];
|
|
3063
3372
|
});
|
|
3064
3373
|
}
|
|
3374
|
+
|
|
3065
3375
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
3066
3376
|
if (ev && ev.payload) {
|
|
3067
3377
|
payload = ev.payload;
|
|
3068
3378
|
}
|
|
3379
|
+
|
|
3069
3380
|
return onEventTrigger({
|
|
3070
3381
|
originalEvent: ev,
|
|
3071
3382
|
payload: payload,
|
|
@@ -3073,8 +3384,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3073
3384
|
});
|
|
3074
3385
|
};
|
|
3075
3386
|
});
|
|
3076
|
-
}
|
|
3077
|
-
|
|
3387
|
+
} // compute pure viz props which are not from options
|
|
3388
|
+
|
|
3389
|
+
|
|
3078
3390
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
3079
3391
|
themeFunc: themeFunc
|
|
3080
3392
|
}));
|
|
@@ -3092,15 +3404,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3092
3404
|
* In future, we could automatically detect which all datasources are being used
|
|
3093
3405
|
* and bind those magically to pagination/sorting behavior.
|
|
3094
3406
|
*/
|
|
3407
|
+
|
|
3095
3408
|
var dataSourceMetadata = {};
|
|
3096
3409
|
var OptionKey = 'paginateDataSourceKey';
|
|
3097
3410
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
3411
|
+
|
|
3098
3412
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
3099
3413
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
3100
3414
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
3415
|
+
|
|
3101
3416
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
3102
3417
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
3103
3418
|
};
|
|
3419
|
+
|
|
3104
3420
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
3105
3421
|
requestParams: requestParams,
|
|
3106
3422
|
meta: meta,
|
|
@@ -3115,115 +3431,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
3115
3431
|
sortParams: sortParams,
|
|
3116
3432
|
paginatorParams: paginatorParams
|
|
3117
3433
|
};
|
|
3118
|
-
}
|
|
3119
|
-
|
|
3434
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
3435
|
+
|
|
3436
|
+
|
|
3120
3437
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
3121
3438
|
return null;
|
|
3122
3439
|
}
|
|
3440
|
+
|
|
3123
3441
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
3124
3442
|
mode: mode,
|
|
3125
3443
|
width: width,
|
|
3126
3444
|
height: height
|
|
3127
3445
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
3128
3446
|
};
|
|
3447
|
+
|
|
3129
3448
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
3130
3449
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
3131
3450
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
3132
3451
|
theme: {}
|
|
3133
|
-
});
|
|
3134
|
-
|
|
3135
|
-
DashboardViz.config = vizConfig;
|
|
3136
|
-
|
|
3452
|
+
}); // attach viz config
|
|
3453
|
+
|
|
3454
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
3455
|
+
|
|
3137
3456
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
3138
3457
|
};
|
|
3458
|
+
|
|
3139
3459
|
exports.default = withDashboardViz;
|
|
3140
3460
|
|
|
3141
3461
|
/***/ }),
|
|
3142
3462
|
|
|
3143
|
-
/***/
|
|
3463
|
+
/***/ 38:
|
|
3144
3464
|
/***/ (function(module, exports) {
|
|
3145
3465
|
|
|
3146
3466
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
3147
3467
|
|
|
3148
3468
|
/***/ }),
|
|
3149
3469
|
|
|
3150
|
-
/***/
|
|
3470
|
+
/***/ 39:
|
|
3151
3471
|
/***/ (function(module, exports) {
|
|
3152
3472
|
|
|
3153
3473
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
3154
3474
|
|
|
3155
3475
|
/***/ }),
|
|
3156
3476
|
|
|
3157
|
-
/***/
|
|
3477
|
+
/***/ 4:
|
|
3158
3478
|
/***/ (function(module, exports) {
|
|
3159
3479
|
|
|
3160
|
-
module.exports = require("
|
|
3480
|
+
module.exports = require("styled-components");
|
|
3161
3481
|
|
|
3162
3482
|
/***/ }),
|
|
3163
3483
|
|
|
3164
|
-
/***/
|
|
3484
|
+
/***/ 40:
|
|
3165
3485
|
/***/ (function(module, exports) {
|
|
3166
3486
|
|
|
3167
|
-
module.exports = require("
|
|
3487
|
+
module.exports = require("@splunk/moment");
|
|
3168
3488
|
|
|
3169
3489
|
/***/ }),
|
|
3170
3490
|
|
|
3171
|
-
/***/
|
|
3491
|
+
/***/ 41:
|
|
3172
3492
|
/***/ (function(module, exports) {
|
|
3173
3493
|
|
|
3174
3494
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
3175
3495
|
|
|
3176
3496
|
/***/ }),
|
|
3177
3497
|
|
|
3178
|
-
/***/
|
|
3498
|
+
/***/ 42:
|
|
3179
3499
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3180
3500
|
|
|
3181
3501
|
"use strict";
|
|
3182
3502
|
|
|
3183
3503
|
|
|
3184
3504
|
var _classCallCheck = __webpack_require__(9);
|
|
3505
|
+
|
|
3185
3506
|
Object.defineProperty(exports, "__esModule", {
|
|
3186
3507
|
value: true
|
|
3187
3508
|
});
|
|
3188
3509
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
3189
3510
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
3511
|
+
|
|
3190
3512
|
var T = __webpack_require__(0);
|
|
3513
|
+
|
|
3191
3514
|
var lodash_1 = __webpack_require__(3);
|
|
3192
|
-
|
|
3193
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3515
|
+
|
|
3516
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3517
|
+
|
|
3518
|
+
|
|
3194
3519
|
exports.INITIAL_WIDTH = 250;
|
|
3195
3520
|
exports.INITIAL_HEIGHT = 250;
|
|
3196
3521
|
/**
|
|
3197
3522
|
* A Splunk visualization
|
|
3198
3523
|
*/
|
|
3524
|
+
|
|
3199
3525
|
var SplunkVisualization = function SplunkVisualization() {
|
|
3200
3526
|
_classCallCheck(this, SplunkVisualization);
|
|
3201
3527
|
};
|
|
3528
|
+
|
|
3202
3529
|
SplunkVisualization.propTypes = {
|
|
3203
3530
|
/**
|
|
3204
3531
|
* display mode
|
|
3205
3532
|
*/
|
|
3206
3533
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
3534
|
+
|
|
3207
3535
|
/**
|
|
3208
3536
|
* width in pixel or string, defaults to 100%
|
|
3209
3537
|
*/
|
|
3210
3538
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
3539
|
+
|
|
3211
3540
|
/**
|
|
3212
3541
|
* height in pixel or string
|
|
3213
3542
|
*/
|
|
3214
3543
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
3544
|
+
|
|
3215
3545
|
/**
|
|
3216
3546
|
* visualization context used for dynamic option evaluation
|
|
3217
3547
|
*/
|
|
3218
3548
|
context: T.object,
|
|
3549
|
+
|
|
3219
3550
|
/**
|
|
3220
3551
|
* visualization formatting options
|
|
3221
3552
|
*/
|
|
3222
3553
|
options: T.object,
|
|
3554
|
+
|
|
3223
3555
|
/**
|
|
3224
3556
|
* A callback to update formatting options
|
|
3225
3557
|
*/
|
|
3226
3558
|
onOptionsChange: T.func,
|
|
3559
|
+
|
|
3227
3560
|
/**
|
|
3228
3561
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
3229
3562
|
*/
|
|
@@ -3232,6 +3565,7 @@ SplunkVisualization.propTypes = {
|
|
|
3232
3565
|
* current request params
|
|
3233
3566
|
*/
|
|
3234
3567
|
requestParams: T.object,
|
|
3568
|
+
|
|
3235
3569
|
/**
|
|
3236
3570
|
* current dataset
|
|
3237
3571
|
*/
|
|
@@ -3239,6 +3573,7 @@ SplunkVisualization.propTypes = {
|
|
|
3239
3573
|
fields: T.array,
|
|
3240
3574
|
columns: T.array
|
|
3241
3575
|
}),
|
|
3576
|
+
|
|
3242
3577
|
/**
|
|
3243
3578
|
* error
|
|
3244
3579
|
*/
|
|
@@ -3246,29 +3581,35 @@ SplunkVisualization.propTypes = {
|
|
|
3246
3581
|
level: T.string,
|
|
3247
3582
|
message: T.string
|
|
3248
3583
|
}),
|
|
3584
|
+
|
|
3249
3585
|
/**
|
|
3250
3586
|
* meta data that came with the dataset
|
|
3251
3587
|
*/
|
|
3252
3588
|
meta: T.object
|
|
3253
3589
|
})),
|
|
3590
|
+
|
|
3254
3591
|
/**
|
|
3255
3592
|
* A callback to trigger event
|
|
3256
3593
|
*/
|
|
3257
3594
|
onEventTrigger: T.func,
|
|
3595
|
+
|
|
3258
3596
|
/**
|
|
3259
3597
|
* Inform viz if there are handlers listening to events
|
|
3260
3598
|
*/
|
|
3261
3599
|
hasEventHandlers: T.bool,
|
|
3600
|
+
|
|
3262
3601
|
/**
|
|
3263
3602
|
* A callback to communicate computed props to a consumer
|
|
3264
3603
|
*/
|
|
3265
3604
|
onComputedProps: T.func,
|
|
3605
|
+
|
|
3266
3606
|
/**
|
|
3267
3607
|
* A callback to obtain visualization api
|
|
3268
3608
|
*/
|
|
3269
3609
|
vizActionHandlerRef: T.func,
|
|
3270
3610
|
loading: T.bool,
|
|
3271
3611
|
theme: T.object,
|
|
3612
|
+
|
|
3272
3613
|
/**
|
|
3273
3614
|
* A callback to request new data with updated request params
|
|
3274
3615
|
*/
|
|
@@ -3277,6 +3618,7 @@ SplunkVisualization.propTypes = {
|
|
|
3277
3618
|
/**
|
|
3278
3619
|
*
|
|
3279
3620
|
*/
|
|
3621
|
+
|
|
3280
3622
|
SplunkVisualization.defaultProps = {
|
|
3281
3623
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
3282
3624
|
width: '100%',
|
|
@@ -3305,26 +3647,29 @@ exports.default = SplunkVisualization;
|
|
|
3305
3647
|
|
|
3306
3648
|
/***/ }),
|
|
3307
3649
|
|
|
3308
|
-
/***/
|
|
3650
|
+
/***/ 43:
|
|
3309
3651
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3310
3652
|
|
|
3311
3653
|
"use strict";
|
|
3312
3654
|
|
|
3313
3655
|
|
|
3314
3656
|
var _classCallCheck = __webpack_require__(9);
|
|
3657
|
+
|
|
3315
3658
|
var _createClass = __webpack_require__(18);
|
|
3659
|
+
|
|
3316
3660
|
Object.defineProperty(exports, "__esModule", {
|
|
3317
3661
|
value: true
|
|
3318
3662
|
});
|
|
3319
3663
|
exports.DefaultVizActionHandler = void 0;
|
|
3664
|
+
|
|
3320
3665
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
3321
3666
|
function DefaultVizActionHandler() {
|
|
3322
3667
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
3323
3668
|
}
|
|
3669
|
+
|
|
3324
3670
|
_createClass(DefaultVizActionHandler, [{
|
|
3325
3671
|
key: "focus",
|
|
3326
|
-
value: function focus() {
|
|
3327
|
-
// noop
|
|
3672
|
+
value: function focus() {// noop
|
|
3328
3673
|
}
|
|
3329
3674
|
}, {
|
|
3330
3675
|
key: "snapshot",
|
|
@@ -3332,23 +3677,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
3332
3677
|
return null; // noop
|
|
3333
3678
|
}
|
|
3334
3679
|
}]);
|
|
3680
|
+
|
|
3335
3681
|
return DefaultVizActionHandler;
|
|
3336
3682
|
}();
|
|
3337
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3338
|
-
|
|
3339
|
-
/***/ }),
|
|
3340
3683
|
|
|
3341
|
-
|
|
3342
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3343
|
-
|
|
3344
|
-
"use strict";
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3348
|
-
value: true
|
|
3349
|
-
});
|
|
3350
|
-
exports.validSortDirs = void 0;
|
|
3351
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
3684
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3352
3685
|
|
|
3353
3686
|
/***/ }),
|
|
3354
3687
|
|
|
@@ -3362,7 +3695,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3362
3695
|
value: true
|
|
3363
3696
|
});
|
|
3364
3697
|
exports.useDeepMemo = void 0;
|
|
3698
|
+
|
|
3365
3699
|
var react_1 = __webpack_require__(1);
|
|
3700
|
+
|
|
3366
3701
|
var lodash_1 = __webpack_require__(3);
|
|
3367
3702
|
/**
|
|
3368
3703
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -3377,16 +3712,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3377
3712
|
* @param fn the function to be executed and
|
|
3378
3713
|
* @param dependencies an array of dependencies
|
|
3379
3714
|
*/
|
|
3715
|
+
|
|
3716
|
+
|
|
3380
3717
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
3381
3718
|
var ref = (0, react_1.useRef)();
|
|
3719
|
+
|
|
3382
3720
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
3383
3721
|
ref.current = {
|
|
3384
3722
|
dependencies: dependencies,
|
|
3385
3723
|
value: fn()
|
|
3386
3724
|
};
|
|
3387
3725
|
}
|
|
3726
|
+
|
|
3388
3727
|
return ref.current.value;
|
|
3389
3728
|
};
|
|
3729
|
+
|
|
3390
3730
|
exports.useDeepMemo = useDeepMemo;
|
|
3391
3731
|
|
|
3392
3732
|
/***/ }),
|
|
@@ -3401,19 +3741,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3401
3741
|
value: true
|
|
3402
3742
|
});
|
|
3403
3743
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
3744
|
+
|
|
3404
3745
|
var React = __webpack_require__(1);
|
|
3746
|
+
|
|
3405
3747
|
var T = __webpack_require__(0);
|
|
3748
|
+
|
|
3406
3749
|
var i18n_1 = __webpack_require__(2);
|
|
3750
|
+
|
|
3407
3751
|
var Message_1 = __webpack_require__(10);
|
|
3752
|
+
|
|
3408
3753
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
3409
3754
|
/**
|
|
3410
3755
|
* @method isMissing
|
|
3411
3756
|
* @param {any} v
|
|
3412
3757
|
* @returns {boolean} true if the input value === null or undefined
|
|
3413
3758
|
*/
|
|
3759
|
+
|
|
3760
|
+
|
|
3414
3761
|
var isMissing = function isMissing(v) {
|
|
3415
3762
|
return v === null || v === undefined;
|
|
3416
3763
|
};
|
|
3764
|
+
|
|
3417
3765
|
exports.isMissing = isMissing;
|
|
3418
3766
|
/**
|
|
3419
3767
|
* @method misskingKeys
|
|
@@ -3421,11 +3769,13 @@ exports.isMissing = isMissing;
|
|
|
3421
3769
|
* @param {object} target
|
|
3422
3770
|
* @returns {string[]} the keys of missing required props
|
|
3423
3771
|
*/
|
|
3772
|
+
|
|
3424
3773
|
var missingKeys = function missingKeys(keys, target) {
|
|
3425
3774
|
return keys.filter(function (k) {
|
|
3426
3775
|
return (0, exports.isMissing)(target[k]);
|
|
3427
3776
|
});
|
|
3428
3777
|
};
|
|
3778
|
+
|
|
3429
3779
|
exports.missingKeys = missingKeys;
|
|
3430
3780
|
var propTypes = {
|
|
3431
3781
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -3439,10 +3789,11 @@ var propTypes = {
|
|
|
3439
3789
|
* @param {MissingPropsProps} props
|
|
3440
3790
|
* @returns {React.ReactElement}
|
|
3441
3791
|
*/
|
|
3792
|
+
|
|
3442
3793
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
3443
3794
|
var width = props.width,
|
|
3444
|
-
|
|
3445
|
-
|
|
3795
|
+
height = props.height,
|
|
3796
|
+
missingProps = props.missingProps;
|
|
3446
3797
|
return React.createElement(Message_1.default, {
|
|
3447
3798
|
"data-test": "message",
|
|
3448
3799
|
width: width,
|
|
@@ -3450,6 +3801,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
3450
3801
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
3451
3802
|
});
|
|
3452
3803
|
};
|
|
3804
|
+
|
|
3453
3805
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
3454
3806
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
3455
3807
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -3469,15 +3821,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
3469
3821
|
Object.defineProperty(exports, "__esModule", {
|
|
3470
3822
|
value: true
|
|
3471
3823
|
});
|
|
3824
|
+
|
|
3472
3825
|
var React = __webpack_require__(1);
|
|
3826
|
+
|
|
3473
3827
|
var styled_components_1 = __webpack_require__(4);
|
|
3828
|
+
|
|
3474
3829
|
var hocUtils_1 = __webpack_require__(15);
|
|
3830
|
+
|
|
3475
3831
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3476
3832
|
displayName: "withEditModeCover__Cover",
|
|
3477
3833
|
componentId: "sc-1gsbnxb-0"
|
|
3478
3834
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3479
3835
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3480
|
-
'data-splunk-visualization-version': "26.
|
|
3836
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
3481
3837
|
}).withConfig({
|
|
3482
3838
|
displayName: "withEditModeCover__Blocker",
|
|
3483
3839
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3488,6 +3844,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3488
3844
|
* @param {ExtendedDashViz} Visualization
|
|
3489
3845
|
* @returns {ExtendedDashViz} Wrapper
|
|
3490
3846
|
*/
|
|
3847
|
+
|
|
3491
3848
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3492
3849
|
var Wrapper = function Wrapper(props) {
|
|
3493
3850
|
var mode = props.mode;
|
|
@@ -3496,12 +3853,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3496
3853
|
"data-test": "edit-mode-cover"
|
|
3497
3854
|
}));
|
|
3498
3855
|
};
|
|
3856
|
+
|
|
3499
3857
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3500
3858
|
Wrapper: Wrapper,
|
|
3501
3859
|
Visualization: Visualization
|
|
3502
3860
|
});
|
|
3503
3861
|
return Wrapper;
|
|
3504
3862
|
};
|
|
3863
|
+
|
|
3505
3864
|
exports.default = withEditModeCover;
|
|
3506
3865
|
|
|
3507
3866
|
/***/ }),
|
|
@@ -3514,45 +3873,59 @@ exports.default = withEditModeCover;
|
|
|
3514
3873
|
|
|
3515
3874
|
var __rest = this && this.__rest || function (s, e) {
|
|
3516
3875
|
var t = {};
|
|
3876
|
+
|
|
3517
3877
|
for (var p in s) {
|
|
3518
3878
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
3519
3879
|
}
|
|
3880
|
+
|
|
3520
3881
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3521
3882
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
3522
3883
|
}
|
|
3523
3884
|
return t;
|
|
3524
3885
|
};
|
|
3886
|
+
|
|
3525
3887
|
Object.defineProperty(exports, "__esModule", {
|
|
3526
3888
|
value: true
|
|
3527
3889
|
});
|
|
3528
3890
|
exports.themes = exports.computeVizProps = exports.PureSingleValue = exports.config = void 0;
|
|
3891
|
+
|
|
3529
3892
|
var SingleValue_1 = __webpack_require__(489);
|
|
3530
|
-
|
|
3893
|
+
|
|
3894
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
3895
|
+
|
|
3531
3896
|
var singleValueUtils_1 = __webpack_require__(24);
|
|
3897
|
+
|
|
3532
3898
|
var config_1 = __webpack_require__(468);
|
|
3899
|
+
|
|
3533
3900
|
var withTrellis_1 = __webpack_require__(106);
|
|
3901
|
+
|
|
3534
3902
|
exports.config = config_1.default;
|
|
3535
3903
|
exports.PureSingleValue = SingleValue_1.default;
|
|
3904
|
+
|
|
3536
3905
|
var computeVizProps = function computeVizProps(_a) {
|
|
3537
3906
|
var themeFunc = _a.themeFunc,
|
|
3538
|
-
|
|
3907
|
+
props = __rest(_a, ["themeFunc"]);
|
|
3908
|
+
|
|
3539
3909
|
var defaultThemeColorVariables = ['defaultFontColor', 'defaultBackgroundColor', 'defaultBlockFontColor', 'defaultSparklineStrokeColor', 'sparklineSeverityColors'];
|
|
3540
3910
|
var defaultThemeColors = {};
|
|
3541
3911
|
defaultThemeColorVariables.forEach(function (variable) {
|
|
3542
3912
|
defaultThemeColors[variable] = themeFunc(variable);
|
|
3543
3913
|
});
|
|
3914
|
+
|
|
3544
3915
|
if (typeof defaultThemeColors.sparklineSeverityColors === 'string') {
|
|
3545
3916
|
// sparkline severity color defaults are stored as a stringified object inside platformViz themes, since @splunk/themes/pick does not accept objects for theme variable values
|
|
3546
3917
|
// convert stringified object into object if using platformviz themes
|
|
3547
3918
|
try {
|
|
3548
3919
|
defaultThemeColors.sparklineSeverityColors = JSON.parse(defaultThemeColors.sparklineSeverityColors);
|
|
3549
3920
|
} catch (e) {} // eslint-disable-line no-empty
|
|
3921
|
+
|
|
3550
3922
|
}
|
|
3551
3923
|
|
|
3552
3924
|
return Object.assign({
|
|
3553
3925
|
defaultThemeColors: defaultThemeColors
|
|
3554
3926
|
}, props);
|
|
3555
3927
|
};
|
|
3928
|
+
|
|
3556
3929
|
exports.computeVizProps = computeVizProps;
|
|
3557
3930
|
var viz = (0, withTrellis_1.default)((0, withDashboardViz_1.default)({
|
|
3558
3931
|
ReactViz: SingleValue_1.default,
|
|
@@ -3574,30 +3947,53 @@ exports.default = viz;
|
|
|
3574
3947
|
|
|
3575
3948
|
|
|
3576
3949
|
var _toConsumableArray = __webpack_require__(8);
|
|
3950
|
+
|
|
3577
3951
|
Object.defineProperty(exports, "__esModule", {
|
|
3578
3952
|
value: true
|
|
3579
3953
|
});
|
|
3954
|
+
|
|
3580
3955
|
var i18n_1 = __webpack_require__(2);
|
|
3956
|
+
|
|
3581
3957
|
var schemaUtils_1 = __webpack_require__(16);
|
|
3958
|
+
|
|
3582
3959
|
var PresetPalettes_1 = __webpack_require__(61);
|
|
3960
|
+
|
|
3583
3961
|
var variables_1 = __webpack_require__(469);
|
|
3962
|
+
|
|
3584
3963
|
var pick_1 = __webpack_require__(23);
|
|
3964
|
+
|
|
3585
3965
|
var variables_2 = __webpack_require__(11);
|
|
3966
|
+
|
|
3586
3967
|
var visualization_icons_1 = __webpack_require__(52);
|
|
3968
|
+
|
|
3587
3969
|
var placeholders_1 = __webpack_require__(50);
|
|
3970
|
+
|
|
3588
3971
|
var singleValueContext_1 = __webpack_require__(135);
|
|
3972
|
+
|
|
3589
3973
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3974
|
+
|
|
3590
3975
|
var DynamicMajorColorEditor_1 = __webpack_require__(136);
|
|
3976
|
+
|
|
3591
3977
|
var DynamicTrendColorEditor_1 = __webpack_require__(100);
|
|
3978
|
+
|
|
3592
3979
|
var DynamicBackgroundColorEditor_1 = __webpack_require__(101);
|
|
3980
|
+
|
|
3593
3981
|
var StaticMajorAndTrendLayout_1 = __webpack_require__(102);
|
|
3982
|
+
|
|
3594
3983
|
var StaticMajorColorEditor_1 = __webpack_require__(103);
|
|
3984
|
+
|
|
3595
3985
|
var StaticTrendColorEditor_1 = __webpack_require__(104);
|
|
3596
|
-
|
|
3986
|
+
|
|
3987
|
+
var StaticBackgroundColorEditor_1 = __webpack_require__(91);
|
|
3988
|
+
|
|
3597
3989
|
var configUtils_1 = __webpack_require__(20);
|
|
3990
|
+
|
|
3598
3991
|
var TrellisEditors_1 = __webpack_require__(105);
|
|
3599
|
-
|
|
3992
|
+
|
|
3993
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
3994
|
+
|
|
3600
3995
|
var layoutUtils_1 = __webpack_require__(58);
|
|
3996
|
+
|
|
3601
3997
|
var dataContract = {
|
|
3602
3998
|
requiredDataSources: [{
|
|
3603
3999
|
name: 'primary',
|
|
@@ -3855,10 +4251,10 @@ var presets = [{
|
|
|
3855
4251
|
backgroundColor: '> majorValue | rangeValue(backgroundColorEditorConfig)'
|
|
3856
4252
|
})
|
|
3857
4253
|
}
|
|
3858
|
-
}];
|
|
3859
|
-
// @TODO(pwied):
|
|
4254
|
+
}]; // @TODO(pwied):
|
|
3860
4255
|
// remove once react-visualizations/SV was deprecated
|
|
3861
4256
|
// including unused sparklineFillColor
|
|
4257
|
+
|
|
3862
4258
|
var LIGHTMODE_SPARKLINE_AREA_COLOR = '#171D21';
|
|
3863
4259
|
var DARKMODE_SPARKLINE_AREA_COLOR = '#FFFFFF';
|
|
3864
4260
|
var themes = {
|
|
@@ -4066,7 +4462,7 @@ var editorConfig = [{
|
|
|
4066
4462
|
presets: presets,
|
|
4067
4463
|
value: function value(_ref3) {
|
|
4068
4464
|
var context = _ref3.context,
|
|
4069
|
-
|
|
4465
|
+
options = _ref3.options;
|
|
4070
4466
|
var initialPreset = (0, configUtils_1.getInitialPreset)(context, options, presets);
|
|
4071
4467
|
return initialPreset && initialPreset.label || null;
|
|
4072
4468
|
}
|
|
@@ -4129,16 +4525,19 @@ var editorConfig = [{
|
|
|
4129
4525
|
/**
|
|
4130
4526
|
* visualization configuration
|
|
4131
4527
|
*/
|
|
4528
|
+
|
|
4132
4529
|
var config = {
|
|
4133
4530
|
/**
|
|
4134
4531
|
* unique viz key
|
|
4135
4532
|
*/
|
|
4136
4533
|
key: 'splunk.singlevalue',
|
|
4534
|
+
|
|
4137
4535
|
/**
|
|
4138
4536
|
* viz name
|
|
4139
4537
|
*/
|
|
4140
4538
|
name: (0, i18n_1._)('Single value'),
|
|
4141
4539
|
category: VizCategory_1.VizCategory.SINGLE_VALUE,
|
|
4540
|
+
|
|
4142
4541
|
/**
|
|
4143
4542
|
* viz icon
|
|
4144
4543
|
*/
|
|
@@ -4179,27 +4578,37 @@ module.exports = require("@splunk/visualization-themes/variables");
|
|
|
4179
4578
|
Object.defineProperty(exports, "__esModule", {
|
|
4180
4579
|
value: true
|
|
4181
4580
|
});
|
|
4581
|
+
|
|
4182
4582
|
var React = __webpack_require__(1);
|
|
4583
|
+
|
|
4183
4584
|
var colorUtils_1 = __webpack_require__(12);
|
|
4585
|
+
|
|
4184
4586
|
var variables_1 = __webpack_require__(11);
|
|
4587
|
+
|
|
4185
4588
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
4589
|
+
|
|
4186
4590
|
var VizBehavior_1 = __webpack_require__(6);
|
|
4591
|
+
|
|
4187
4592
|
var hocUtils_1 = __webpack_require__(15);
|
|
4593
|
+
|
|
4188
4594
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
4189
4595
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
4190
4596
|
var config = Visualization.config;
|
|
4191
4597
|
var themes = config.themes;
|
|
4598
|
+
|
|
4192
4599
|
var Wrapper = function Wrapper(props) {
|
|
4193
4600
|
var _a, _b;
|
|
4601
|
+
|
|
4194
4602
|
var dataSources = props.dataSources,
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4603
|
+
loading = props.loading,
|
|
4604
|
+
options = props.options,
|
|
4605
|
+
height = props.height,
|
|
4606
|
+
width = props.width;
|
|
4199
4607
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
4200
4608
|
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);
|
|
4201
4609
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
4202
4610
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
4611
|
+
|
|
4203
4612
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
4204
4613
|
return React.createElement(IconPlaceholder_1.default, {
|
|
4205
4614
|
"data-test": "icon-placeholder",
|
|
@@ -4210,14 +4619,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
4210
4619
|
iconColor: iconColor
|
|
4211
4620
|
});
|
|
4212
4621
|
}
|
|
4622
|
+
|
|
4213
4623
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
4214
4624
|
};
|
|
4625
|
+
|
|
4215
4626
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
4216
4627
|
Wrapper: Wrapper,
|
|
4217
4628
|
Visualization: Visualization
|
|
4218
4629
|
});
|
|
4219
4630
|
return Wrapper;
|
|
4220
4631
|
};
|
|
4632
|
+
|
|
4221
4633
|
exports.default = withPlaceholder;
|
|
4222
4634
|
|
|
4223
4635
|
/***/ }),
|
|
@@ -4302,22 +4714,23 @@ var SparkLine = __webpack_require__(95);
|
|
|
4302
4714
|
|
|
4303
4715
|
|
|
4304
4716
|
|
|
4717
|
+
|
|
4305
4718
|
var SingleValueSparkline_SingleValueSparkline = function SingleValueSparkline(_ref) {
|
|
4306
4719
|
var width = _ref.width,
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4720
|
+
height = _ref.height,
|
|
4721
|
+
data = _ref.data,
|
|
4722
|
+
fill = _ref.fill,
|
|
4723
|
+
_ref$fillOpacity = _ref.fillOpacity,
|
|
4724
|
+
fillOpacity = _ref$fillOpacity === void 0 ? 0.2 : _ref$fillOpacity,
|
|
4725
|
+
stroke = _ref.stroke,
|
|
4726
|
+
showTooltip = _ref.showTooltip,
|
|
4727
|
+
isArea = _ref.isArea,
|
|
4728
|
+
_ref$lineLength = _ref.lineLength,
|
|
4729
|
+
lineLength = _ref$lineLength === void 0 ? 0 : _ref$lineLength,
|
|
4730
|
+
_ref$endDotCount = _ref.endDotCount,
|
|
4731
|
+
endDotCount = _ref$endDotCount === void 0 ? 0 : _ref$endDotCount,
|
|
4732
|
+
_ref$acceptNull = _ref.acceptNull,
|
|
4733
|
+
acceptNull = _ref$acceptNull === void 0 ? true : _ref$acceptNull;
|
|
4321
4734
|
return /*#__PURE__*/external_react_default.a.createElement(SparkLine["default"], {
|
|
4322
4735
|
lineColor: Object(propUtils_["formatColor"])(stroke),
|
|
4323
4736
|
fillColor: Object(propUtils_["formatColor"])(fill),
|
|
@@ -4342,6 +4755,7 @@ var SingleValueSparkline_SingleValueSparkline = function SingleValueSparkline(_r
|
|
|
4342
4755
|
}
|
|
4343
4756
|
});
|
|
4344
4757
|
};
|
|
4758
|
+
|
|
4345
4759
|
SingleValueSparkline_SingleValueSparkline.propTypes = {
|
|
4346
4760
|
acceptNull: external_prop_types_default.a.bool,
|
|
4347
4761
|
data: external_prop_types_default.a.arrayOf(external_prop_types_default.a.number),
|
|
@@ -4373,7 +4787,6 @@ var CONTENT_NEXT_TO_SPARKLINE_WIDTH_ALLOCATION_RATIO = 0.4;
|
|
|
4373
4787
|
var LINEHEIGHT_FACTOR = 1.2;
|
|
4374
4788
|
var CONTENT_SPARKLINE_SPACING = 16;
|
|
4375
4789
|
var VALID_SPARKLINE_POSITIONS = ['below', 'before', 'after', 'off'];
|
|
4376
|
-
|
|
4377
4790
|
/*
|
|
4378
4791
|
* @method getUnderLabelHeight
|
|
4379
4792
|
* @param {Object} props
|
|
@@ -4381,12 +4794,12 @@ var VALID_SPARKLINE_POSITIONS = ['below', 'before', 'after', 'off'];
|
|
|
4381
4794
|
* @param {Number} underLabelFontSize
|
|
4382
4795
|
* @returns {Number} underLabelHeight
|
|
4383
4796
|
*/
|
|
4797
|
+
|
|
4384
4798
|
var getUnderLabelHeight = function getUnderLabelHeight(_ref) {
|
|
4385
4799
|
var underLabel = _ref.underLabel,
|
|
4386
|
-
|
|
4800
|
+
underLabelFontSize = _ref.underLabelFontSize;
|
|
4387
4801
|
return underLabel && underLabel.length ? underLabelFontSize * LINEHEIGHT_FACTOR : 0;
|
|
4388
4802
|
};
|
|
4389
|
-
|
|
4390
4803
|
/**
|
|
4391
4804
|
* Get the available width for the Single Value content part
|
|
4392
4805
|
* @method getAvailableContentWidth
|
|
@@ -4397,18 +4810,20 @@ var getUnderLabelHeight = function getUnderLabelHeight(_ref) {
|
|
|
4397
4810
|
* @param {Number} config.overflowArea
|
|
4398
4811
|
* @returns {Number} available content width to use
|
|
4399
4812
|
*/
|
|
4813
|
+
|
|
4400
4814
|
var getAvailableContentWidth = function getAvailableContentWidth(_ref2) {
|
|
4401
4815
|
var hasSparkline = _ref2.hasSparkline,
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4816
|
+
isSparklinePositionBelow = _ref2.isSparklinePositionBelow,
|
|
4817
|
+
containerWidth = _ref2.containerWidth,
|
|
4818
|
+
overflowArea = _ref2.overflowArea;
|
|
4405
4819
|
var overflowTotalArea = 2 * overflowArea; // left and right overflow
|
|
4820
|
+
|
|
4406
4821
|
if (hasSparkline && !isSparklinePositionBelow) {
|
|
4407
4822
|
return CONTENT_NEXT_TO_SPARKLINE_WIDTH_ALLOCATION_RATIO * containerWidth - overflowTotalArea;
|
|
4408
4823
|
}
|
|
4824
|
+
|
|
4409
4825
|
return containerWidth - overflowTotalArea;
|
|
4410
4826
|
};
|
|
4411
|
-
|
|
4412
4827
|
/*
|
|
4413
4828
|
* @method getAvailableContentHeight
|
|
4414
4829
|
* @param {Object} props
|
|
@@ -4419,49 +4834,52 @@ var getAvailableContentWidth = function getAvailableContentWidth(_ref2) {
|
|
|
4419
4834
|
* @param {Number} props.underLabelHeight
|
|
4420
4835
|
* @returns {Number} contentHeight
|
|
4421
4836
|
*/
|
|
4837
|
+
|
|
4422
4838
|
var getAvailableContentHeight = function getAvailableContentHeight(_ref3) {
|
|
4423
4839
|
var height = _ref3.height,
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4840
|
+
hasSparkline = _ref3.hasSparkline,
|
|
4841
|
+
isSparklinePositionBelow = _ref3.isSparklinePositionBelow,
|
|
4842
|
+
majorTextFontSize = _ref3.majorTextFontSize,
|
|
4843
|
+
_ref3$underLabelHeigh = _ref3.underLabelHeight,
|
|
4844
|
+
underLabelHeight = _ref3$underLabelHeigh === void 0 ? 0 : _ref3$underLabelHeigh;
|
|
4845
|
+
|
|
4429
4846
|
if (hasSparkline && !isSparklinePositionBelow) {
|
|
4430
4847
|
return height;
|
|
4431
4848
|
}
|
|
4849
|
+
|
|
4432
4850
|
return majorTextFontSize + CONTENT_SPARKLINE_SPACING + underLabelHeight;
|
|
4433
4851
|
};
|
|
4434
|
-
|
|
4435
4852
|
/*
|
|
4436
4853
|
* @method isValidPosition
|
|
4437
4854
|
* @param {String} sparklinePosition
|
|
4438
4855
|
* @param {Bool} isValid
|
|
4439
4856
|
*/
|
|
4857
|
+
|
|
4440
4858
|
var isValidPosition = function isValidPosition(sparklinePosition) {
|
|
4441
4859
|
return VALID_SPARKLINE_POSITIONS.indexOf(sparklinePosition) > -1;
|
|
4442
4860
|
};
|
|
4443
|
-
|
|
4444
4861
|
/**
|
|
4445
4862
|
* Sanitize sparklineValues, convert all values to numbers
|
|
4446
4863
|
* @method parseSparklineValues
|
|
4447
4864
|
* @params {Array} sparklineValues
|
|
4448
4865
|
* @params {Array}
|
|
4449
4866
|
*/
|
|
4867
|
+
|
|
4450
4868
|
var displayUtils_parseSparklineValues = function parseSparklineValues(_ref4) {
|
|
4451
4869
|
var sparklineValues = _ref4.sparklineValues;
|
|
4452
|
-
return (
|
|
4453
|
-
// todo: need this function to maitain the behavior for dashboard-viz and react-viz.
|
|
4870
|
+
return (// todo: need this function to maitain the behavior for dashboard-viz and react-viz.
|
|
4454
4871
|
// can refactor it after we discard dashboard-viz and react-viz repo
|
|
4455
4872
|
Array.isArray(sparklineValues) ? sparklineValues.map(function (v) {
|
|
4456
4873
|
var numV = Object(numberUtils_["parseNumber"])(v);
|
|
4874
|
+
|
|
4457
4875
|
if (numV === 0) {
|
|
4458
4876
|
return null;
|
|
4459
4877
|
}
|
|
4878
|
+
|
|
4460
4879
|
return numV || v;
|
|
4461
4880
|
}) : undefined
|
|
4462
4881
|
);
|
|
4463
4882
|
};
|
|
4464
|
-
|
|
4465
4883
|
/**
|
|
4466
4884
|
* Determine if a sparkline graph should be displayed
|
|
4467
4885
|
* @method shouldShowSparkline
|
|
@@ -4470,9 +4888,10 @@ var displayUtils_parseSparklineValues = function parseSparklineValues(_ref4) {
|
|
|
4470
4888
|
* @param {Array} props.sparklineValues List of values to display in graph
|
|
4471
4889
|
* @returns {Bool} true if flag is on and sparklineValues has data to show
|
|
4472
4890
|
*/
|
|
4891
|
+
|
|
4473
4892
|
var displayUtils_shouldShowSparkline = function shouldShowSparkline(_ref5) {
|
|
4474
4893
|
var showSparkline = _ref5.showSparkline,
|
|
4475
|
-
|
|
4894
|
+
sparklineValues = _ref5.sparklineValues;
|
|
4476
4895
|
return showSparkline && Array.isArray(sparklineValues) && sparklineValues.length > 1 && sparklineValues.every(function (v) {
|
|
4477
4896
|
return v === null || !Number.isNaN(Object(numberUtils_["parseNumber"])(v));
|
|
4478
4897
|
}) && sparklineValues.filter(function (v) {
|
|
@@ -4487,13 +4906,13 @@ var displayUtils_shouldShowSparkline = function shouldShowSparkline(_ref5) {
|
|
|
4487
4906
|
* @param {Bool} props.isSparklinePositionBelow
|
|
4488
4907
|
* @returns {Number} sparklineWidth
|
|
4489
4908
|
*/
|
|
4909
|
+
|
|
4490
4910
|
var getSparklineWidth = function getSparklineWidth(_ref6) {
|
|
4491
4911
|
var width = _ref6.width,
|
|
4492
|
-
|
|
4912
|
+
isSparklinePositionBelow = _ref6.isSparklinePositionBelow;
|
|
4493
4913
|
var spaceRatio = isSparklinePositionBelow ? 1 : 0.6;
|
|
4494
4914
|
return width * spaceRatio;
|
|
4495
4915
|
};
|
|
4496
|
-
|
|
4497
4916
|
/*
|
|
4498
4917
|
* getSparklineHeight
|
|
4499
4918
|
* @param {Object} props
|
|
@@ -4502,15 +4921,15 @@ var getSparklineWidth = function getSparklineWidth(_ref6) {
|
|
|
4502
4921
|
* @param {Bool} props.isSparklinePositionBelow
|
|
4503
4922
|
* @returns {Number} sparklineHeight
|
|
4504
4923
|
*/
|
|
4924
|
+
|
|
4505
4925
|
var getSparklineHeight = function getSparklineHeight(_ref7) {
|
|
4506
4926
|
var height = _ref7.height,
|
|
4507
|
-
|
|
4508
|
-
|
|
4927
|
+
contentHeight = _ref7.contentHeight,
|
|
4928
|
+
isSparklinePositionBelow = _ref7.isSparklinePositionBelow;
|
|
4509
4929
|
var belowPositionHeight = height - contentHeight;
|
|
4510
4930
|
var sanitizedBelowPositionHeight = belowPositionHeight < 0 ? 0 : belowPositionHeight;
|
|
4511
4931
|
return isSparklinePositionBelow ? sanitizedBelowPositionHeight : height;
|
|
4512
4932
|
};
|
|
4513
|
-
|
|
4514
4933
|
/*
|
|
4515
4934
|
* getSparklineSegments
|
|
4516
4935
|
* @param {Object} props
|
|
@@ -4518,12 +4937,12 @@ var getSparklineHeight = function getSparklineHeight(_ref7) {
|
|
|
4518
4937
|
* @param {Number} props.sparklineHighlightSegments
|
|
4519
4938
|
* @returns {Number} sparkline segments
|
|
4520
4939
|
*/
|
|
4940
|
+
|
|
4521
4941
|
var getSparklineSegments = function getSparklineSegments(_ref8) {
|
|
4522
4942
|
var hasSparkline = _ref8.hasSparkline,
|
|
4523
|
-
|
|
4943
|
+
sparklineHighlightSegments = _ref8.sparklineHighlightSegments;
|
|
4524
4944
|
return hasSparkline && typeof sparklineHighlightSegments === 'number' && sparklineHighlightSegments > 0 ? sparklineHighlightSegments + 1 : 0;
|
|
4525
4945
|
};
|
|
4526
|
-
|
|
4527
4946
|
/*
|
|
4528
4947
|
* getEndDots
|
|
4529
4948
|
* @param {Object} props
|
|
@@ -4531,12 +4950,12 @@ var getSparklineSegments = function getSparklineSegments(_ref8) {
|
|
|
4531
4950
|
* @param {Number} props.sparklineHighlightDots
|
|
4532
4951
|
* @returns {Number} sparkline end dots
|
|
4533
4952
|
*/
|
|
4953
|
+
|
|
4534
4954
|
var getEndDots = function getEndDots(_ref9) {
|
|
4535
4955
|
var hasSparkline = _ref9.hasSparkline,
|
|
4536
|
-
|
|
4956
|
+
sparklineHighlightDots = _ref9.sparklineHighlightDots;
|
|
4537
4957
|
return !hasSparkline || typeof sparklineHighlightDots === 'string' || sparklineHighlightDots < 0 ? 0 : sparklineHighlightDots;
|
|
4538
4958
|
};
|
|
4539
|
-
|
|
4540
4959
|
/**
|
|
4541
4960
|
* Get the colors for a sparkline graph based on severity
|
|
4542
4961
|
* @method getSparklineColors
|
|
@@ -4546,10 +4965,11 @@ var getEndDots = function getEndDots(_ref9) {
|
|
|
4546
4965
|
* @param {Object} props.sparklineSeverityColors
|
|
4547
4966
|
* @returns {Object} { background, stroke } colors
|
|
4548
4967
|
*/
|
|
4968
|
+
|
|
4549
4969
|
var displayUtils_getSparklineColors = function getSparklineColors(_ref10) {
|
|
4550
4970
|
var backgroundEnabled = _ref10.backgroundEnabled,
|
|
4551
|
-
|
|
4552
|
-
|
|
4971
|
+
backgroundColor = _ref10.backgroundColor,
|
|
4972
|
+
sparklineSeverityColors = _ref10.sparklineSeverityColors;
|
|
4553
4973
|
return Object(singleValueUtils["getGraphColors"])({
|
|
4554
4974
|
backgroundEnabled: backgroundEnabled,
|
|
4555
4975
|
backgroundColor: backgroundColor,
|
|
@@ -4558,6 +4978,7 @@ var displayUtils_getSparklineColors = function getSparklineColors(_ref10) {
|
|
|
4558
4978
|
if (color === colorConstants_["SPARKLINE_WHITE"]) {
|
|
4559
4979
|
return sparklineSeverityColors.none;
|
|
4560
4980
|
}
|
|
4981
|
+
|
|
4561
4982
|
return {
|
|
4562
4983
|
background: Object(singleValueUtils["darken"])(color),
|
|
4563
4984
|
stroke: colorConstants_["SPARKLINE_WHITE"]
|
|
@@ -4565,7 +4986,6 @@ var displayUtils_getSparklineColors = function getSparklineColors(_ref10) {
|
|
|
4565
4986
|
}
|
|
4566
4987
|
});
|
|
4567
4988
|
};
|
|
4568
|
-
|
|
4569
4989
|
/*
|
|
4570
4990
|
* getSparklines
|
|
4571
4991
|
* @param {Object} props
|
|
@@ -4578,14 +4998,15 @@ var displayUtils_getSparklineColors = function getSparklineColors(_ref10) {
|
|
|
4578
4998
|
* @param {Number} props.sparklineHighlightDots
|
|
4579
4999
|
* @returns {Object} { sparklineWidth, sparklineHeight, sparklineSegments, endDots }
|
|
4580
5000
|
*/
|
|
5001
|
+
|
|
4581
5002
|
var getSparklines = function getSparklines(_ref11) {
|
|
4582
5003
|
var width = _ref11.width,
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
5004
|
+
height = _ref11.height,
|
|
5005
|
+
contentHeight = _ref11.contentHeight,
|
|
5006
|
+
hasSparkline = _ref11.hasSparkline,
|
|
5007
|
+
isSparklinePositionBelow = _ref11.isSparklinePositionBelow,
|
|
5008
|
+
sparklineHighlightSegments = _ref11.sparklineHighlightSegments,
|
|
5009
|
+
sparklineHighlightDots = _ref11.sparklineHighlightDots;
|
|
4589
5010
|
var sparklineWidth = getSparklineWidth({
|
|
4590
5011
|
width: width,
|
|
4591
5012
|
isSparklinePositionBelow: isSparklinePositionBelow
|
|
@@ -4613,25 +5034,38 @@ var getSparklines = function getSparklines(_ref11) {
|
|
|
4613
5034
|
// CONCATENATED MODULE: ./src/SingleValue/PureSingleValue/StandardLayout.jsx
|
|
4614
5035
|
|
|
4615
5036
|
|
|
5037
|
+
|
|
4616
5038
|
function ownKeys(object, enumerableOnly) {
|
|
4617
5039
|
var keys = Object.keys(object);
|
|
5040
|
+
|
|
4618
5041
|
if (Object.getOwnPropertySymbols) {
|
|
4619
5042
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
4620
|
-
enumerableOnly
|
|
5043
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
4621
5044
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4622
|
-
})
|
|
5045
|
+
});
|
|
5046
|
+
keys.push.apply(keys, symbols);
|
|
4623
5047
|
}
|
|
5048
|
+
|
|
4624
5049
|
return keys;
|
|
4625
5050
|
}
|
|
5051
|
+
|
|
4626
5052
|
function _objectSpread(target) {
|
|
4627
5053
|
for (var i = 1; i < arguments.length; i++) {
|
|
4628
|
-
var source =
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
5054
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
5055
|
+
|
|
5056
|
+
if (i % 2) {
|
|
5057
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
5058
|
+
defineProperty_default()(target, key, source[key]);
|
|
5059
|
+
});
|
|
5060
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
5061
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
5062
|
+
} else {
|
|
5063
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
5064
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
5065
|
+
});
|
|
5066
|
+
}
|
|
4634
5067
|
}
|
|
5068
|
+
|
|
4635
5069
|
return target;
|
|
4636
5070
|
}
|
|
4637
5071
|
|
|
@@ -4640,6 +5074,7 @@ function _objectSpread(target) {
|
|
|
4640
5074
|
|
|
4641
5075
|
|
|
4642
5076
|
|
|
5077
|
+
|
|
4643
5078
|
var CONTENT_OVERFLOW_FADEOUT_AREA_PX = 16;
|
|
4644
5079
|
var Column = external_styled_components_default.a.div.withConfig({
|
|
4645
5080
|
displayName: "StandardLayout__Column",
|
|
@@ -4667,37 +5102,40 @@ var OverflowWrapper = external_styled_components_default.a.div.attrs(function ()
|
|
|
4667
5102
|
}, function (props) {
|
|
4668
5103
|
return props.overflowBackgroundColor;
|
|
4669
5104
|
});
|
|
5105
|
+
|
|
4670
5106
|
var StandardLayout_SingleValueContent = function SingleValueContent(_ref) {
|
|
4671
5107
|
var props = extends_default()({}, _ref);
|
|
5108
|
+
|
|
4672
5109
|
var backgroundColor = props.backgroundColor,
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
5110
|
+
contentHeight = props.contentHeight,
|
|
5111
|
+
majorColor = props.majorColor,
|
|
5112
|
+
majorText = props.majorText,
|
|
5113
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
5114
|
+
majorValueTitle = props.majorValueTitle,
|
|
5115
|
+
trendColor = props.trendColor,
|
|
5116
|
+
trendText = props.trendText,
|
|
5117
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
5118
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
5119
|
+
unit = props.unit,
|
|
5120
|
+
unitPosition = props.unitPosition,
|
|
5121
|
+
underLabel = props.underLabel,
|
|
5122
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
5123
|
+
underLabelColor = props.underLabelColor,
|
|
5124
|
+
onValueClick = props.onValueClick,
|
|
5125
|
+
showSparkline = props.showSparkline,
|
|
5126
|
+
sparklinePosition = props.sparklinePosition,
|
|
5127
|
+
sparklineWidth = props.sparklineWidth,
|
|
5128
|
+
sparklineHeight = props.sparklineHeight,
|
|
5129
|
+
sparklineValues = props.sparklineValues,
|
|
5130
|
+
sparklineAreaColor = props.sparklineAreaColor,
|
|
5131
|
+
sparklineStrokeColor = props.sparklineStrokeColor,
|
|
5132
|
+
showSparklineTooltip = props.showSparklineTooltip,
|
|
5133
|
+
showSparklineAreaGraph = props.showSparklineAreaGraph,
|
|
5134
|
+
shouldSparklineAcceptNullData = props.shouldSparklineAcceptNullData,
|
|
5135
|
+
sparklineSegments = props.sparklineSegments,
|
|
5136
|
+
endDots = props.endDots;
|
|
4700
5137
|
var sparkline = null;
|
|
5138
|
+
|
|
4701
5139
|
if (displayUtils_shouldShowSparkline({
|
|
4702
5140
|
showSparkline: showSparkline,
|
|
4703
5141
|
sparklineValues: sparklineValues
|
|
@@ -4715,6 +5153,7 @@ var StandardLayout_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
4715
5153
|
endDotCount: endDots
|
|
4716
5154
|
});
|
|
4717
5155
|
}
|
|
5156
|
+
|
|
4718
5157
|
return /*#__PURE__*/external_react_default.a.createElement(Column, null, /*#__PURE__*/external_react_default.a.createElement(Row, null, sparklinePosition === 'before' && sparkline, /*#__PURE__*/external_react_default.a.createElement(OverflowWrapper, {
|
|
4719
5158
|
overflowBackgroundColor: backgroundColor,
|
|
4720
5159
|
height: contentHeight
|
|
@@ -4735,6 +5174,7 @@ var StandardLayout_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
4735
5174
|
onValueClick: onValueClick
|
|
4736
5175
|
})), sparklinePosition === 'after' && sparkline), sparklinePosition === 'below' && sparkline);
|
|
4737
5176
|
};
|
|
5177
|
+
|
|
4738
5178
|
StandardLayout_SingleValueContent.propTypes = _objectSpread(_objectSpread({}, SingleValueBasic["default"].propTypes), {}, {
|
|
4739
5179
|
contentHeight: external_prop_types_default.a.number,
|
|
4740
5180
|
backgroundColor: external_prop_types_default.a.string,
|
|
@@ -4802,42 +5242,44 @@ var Container = external_styled_components_default.a.div.withConfig({
|
|
|
4802
5242
|
})(["overflow:hidden;", ";"], function (props) {
|
|
4803
5243
|
return Object(style_["toDimension"])(pick_default()(props, ['width', 'height']));
|
|
4804
5244
|
});
|
|
5245
|
+
|
|
4805
5246
|
var SingleValue_SingleValue = function SingleValue(_ref) {
|
|
4806
5247
|
var props = extends_default()({}, _ref);
|
|
5248
|
+
|
|
4807
5249
|
var width = props.width,
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
5250
|
+
_props$height = props.height,
|
|
5251
|
+
height = _props$height === void 0 ? 250 : _props$height,
|
|
5252
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
5253
|
+
style = props.style,
|
|
5254
|
+
majorFontSize = props.majorFontSize,
|
|
5255
|
+
majorValue = props.majorValue,
|
|
5256
|
+
majorValueField = props.majorValueField,
|
|
5257
|
+
trendValue = props.trendValue,
|
|
5258
|
+
trendFontSize = props.trendFontSize,
|
|
5259
|
+
unitPosition = props.unitPosition,
|
|
5260
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
5261
|
+
numberPrecision = props.numberPrecision,
|
|
5262
|
+
shouldUseThousandSeparators = props.shouldUseThousandSeparators,
|
|
5263
|
+
shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
|
|
5264
|
+
sparklineValues = props.sparklineValues,
|
|
5265
|
+
sparklineHighlightSegments = props.sparklineHighlightSegments,
|
|
5266
|
+
sparklineHighlightDots = props.sparklineHighlightDots,
|
|
5267
|
+
showSparklineAreaGraph = props.showSparklineAreaGraph,
|
|
5268
|
+
showSparklineTooltip = props.showSparklineTooltip,
|
|
5269
|
+
shouldSparklineAcceptNullData = props.shouldSparklineAcceptNullData,
|
|
5270
|
+
onValueClick = props.onValueClick,
|
|
5271
|
+
defaultFontColor = props.defaultFontColor,
|
|
5272
|
+
defaultBackgroundColor = props.defaultBackgroundColor,
|
|
5273
|
+
defaultBlockFontColor = props.defaultBlockFontColor,
|
|
5274
|
+
_props$sparklineSever = props.sparklineSeverityColors,
|
|
5275
|
+
sparklineSeverityColors = _props$sparklineSever === void 0 ? DEFAULT_SPARKLINE_SEVERITY_COLORS : _props$sparklineSever,
|
|
5276
|
+
sparklineAreaColor = props.sparklineAreaColor,
|
|
5277
|
+
defaultThemeColors = props.defaultThemeColors,
|
|
5278
|
+
splitByLayout = props.splitByLayout,
|
|
5279
|
+
_props$trellisKey = props.trellisKey,
|
|
5280
|
+
trellisKey = _props$trellisKey === void 0 ? '' : _props$trellisKey,
|
|
5281
|
+
_props$trellisSplitBy = props.trellisSplitBy,
|
|
5282
|
+
trellisSplitBy = _props$trellisSplitBy === void 0 ? '' : _props$trellisSplitBy;
|
|
4841
5283
|
var defaultColors = {
|
|
4842
5284
|
defaultFontColor: defaultFontColor,
|
|
4843
5285
|
defaultBackgroundColor: defaultBackgroundColor,
|
|
@@ -4849,56 +5291,58 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
|
|
|
4849
5291
|
var trellisEnabled = isTrellisFeatureFlagOn && splitByLayout === layoutUtils["LAYOUT_TYPE"].Trellis;
|
|
4850
5292
|
var handleValueClick = Object(external_react_["useCallback"])(function (ev) {
|
|
4851
5293
|
return Object(singleValueUtils["handleValueClickCallback"])(ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled, trellisSplitBy, trellisKey);
|
|
4852
|
-
}, [onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]);
|
|
4853
|
-
|
|
4854
|
-
// FIXME todo 'compute colors' is not pure, it must be lifted into behavior or DSL
|
|
5294
|
+
}, [onValueClick, majorValue, majorValueField, trendValue, trellisEnabled, trellisSplitBy, trellisKey]); // FIXME todo 'compute colors' is not pure, it must be lifted into behavior or DSL
|
|
4855
5295
|
// compute colors
|
|
5296
|
+
|
|
4856
5297
|
var _computeColors = Object(singleValueUtils["computeColors"])(props, defaultColors),
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
5298
|
+
backgroundEnabled = _computeColors.backgroundEnabled,
|
|
5299
|
+
backgroundColor = _computeColors.backgroundColor,
|
|
5300
|
+
majorColor = _computeColors.majorColor,
|
|
5301
|
+
trendColor = _computeColors.trendColor,
|
|
5302
|
+
underLabelColor = _computeColors.underLabelColor; // TODO(fkurniawan): possibly remove getSparklineColors, since for the new viz package,
|
|
4862
5303
|
// the default is obtained from > themes.defaultSparklineStrokeColor
|
|
5304
|
+
|
|
5305
|
+
|
|
4863
5306
|
var sparklineStrokeColor = props.sparklineStrokeColor || displayUtils_getSparklineColors({
|
|
4864
5307
|
backgroundEnabled: backgroundEnabled,
|
|
4865
5308
|
backgroundColor: backgroundColor,
|
|
4866
5309
|
sparklineSeverityColors: sparklineSeverityColors
|
|
4867
5310
|
}).stroke;
|
|
5311
|
+
|
|
4868
5312
|
var renderVisualization = function renderVisualization(_ref2) {
|
|
4869
5313
|
var containerWidth = _ref2.width,
|
|
4870
|
-
|
|
4871
|
-
|
|
5314
|
+
containerHeight = _ref2.height; // will update later based on text size
|
|
5315
|
+
|
|
4872
5316
|
var _props$sparklineDispl = props.sparklineDisplay,
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
5317
|
+
sparklineDisplay = _props$sparklineDispl === void 0 ? 'below' : _props$sparklineDispl,
|
|
5318
|
+
_props$trendDisplay = props.trendDisplay,
|
|
5319
|
+
trendDisplay = _props$trendDisplay === void 0 ? 'absolute' : _props$trendDisplay,
|
|
5320
|
+
unit = props.unit,
|
|
5321
|
+
underLabel = props.underLabel; // todo: need this function to maitain the behavior for dashboard-viz and react-viz.
|
|
4878
5322
|
// can refactor it after we discard dashboard-viz and react-viz repo
|
|
5323
|
+
|
|
4879
5324
|
var parsedSparklineValues = displayUtils_parseSparklineValues({
|
|
4880
5325
|
sparklineValues: sparklineValues
|
|
4881
5326
|
});
|
|
4882
5327
|
var hasSparkline = displayUtils_shouldShowSparkline({
|
|
4883
5328
|
showSparkline: isValidPosition(sparklineDisplay) && sparklineDisplay !== 'off',
|
|
4884
5329
|
sparklineValues: parsedSparklineValues
|
|
4885
|
-
});
|
|
5330
|
+
}); // by default, the sparkline position is always below
|
|
4886
5331
|
|
|
4887
|
-
// by default, the sparkline position is always below
|
|
4888
5332
|
if (hasSparkline) {
|
|
4889
5333
|
if (!isValidPosition(sparklineDisplay)) {
|
|
4890
5334
|
sparklineDisplay = 'below';
|
|
4891
5335
|
}
|
|
4892
5336
|
}
|
|
5337
|
+
|
|
4893
5338
|
var isSparklinePositionBelow = hasSparkline && sparklineDisplay === 'below';
|
|
4894
5339
|
var contentWidth = getAvailableContentWidth({
|
|
4895
5340
|
hasSparkline: hasSparkline,
|
|
4896
5341
|
isSparklinePositionBelow: isSparklinePositionBelow,
|
|
4897
5342
|
containerWidth: containerWidth,
|
|
4898
5343
|
overflowArea: SingleValue_CONTENT_OVERFLOW_FADEOUT_AREA_PX
|
|
4899
|
-
});
|
|
5344
|
+
}); // calculate major and trend text and font size
|
|
4900
5345
|
|
|
4901
|
-
// calculate major and trend text and font size
|
|
4902
5346
|
var toRemoveList = [{
|
|
4903
5347
|
key: 'sparklineDisplay',
|
|
4904
5348
|
value: 'off'
|
|
@@ -4912,28 +5356,30 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
|
|
|
4912
5356
|
key: 'unit',
|
|
4913
5357
|
value: ''
|
|
4914
5358
|
}];
|
|
5359
|
+
|
|
4915
5360
|
var _computeSingleValueCo = Object(singleValueUtils["computeSingleValueContent"])({
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
5361
|
+
majorValue: majorValue,
|
|
5362
|
+
trendValue: trendValue,
|
|
5363
|
+
majorFontSize: majorFontSize,
|
|
5364
|
+
trendFontSize: trendFontSize,
|
|
5365
|
+
trendDisplay: trendDisplay,
|
|
5366
|
+
contentWidth: contentWidth,
|
|
5367
|
+
contentHeight: containerHeight * DEFAULT_CONTENT_HEIGHT_ALLOCATION_RATIO,
|
|
5368
|
+
containerWidth: containerWidth,
|
|
5369
|
+
containerHeight: containerHeight,
|
|
5370
|
+
unit: unit,
|
|
5371
|
+
numberPrecision: numberPrecision,
|
|
5372
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
5373
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
5374
|
+
toRemoveList: toRemoveList
|
|
5375
|
+
}),
|
|
5376
|
+
majorText = _computeSingleValueCo.majorText,
|
|
5377
|
+
trendText = _computeSingleValueCo.trendText,
|
|
5378
|
+
majorTextFontSize = _computeSingleValueCo.majorTextFontSize,
|
|
5379
|
+
trendTextFontSize = _computeSingleValueCo.trendTextFontSize,
|
|
5380
|
+
majorValueTitle = _computeSingleValueCo.majorValueTitle,
|
|
5381
|
+
smallVizProps = _computeSingleValueCo.smallVizProps;
|
|
5382
|
+
|
|
4937
5383
|
if (!isEmpty_default()(smallVizProps)) {
|
|
4938
5384
|
sparklineDisplay = smallVizProps.sparklineDisplay;
|
|
4939
5385
|
trendDisplay = smallVizProps.trendDisplay;
|
|
@@ -4944,6 +5390,7 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
|
|
|
4944
5390
|
sparklineValues: parsedSparklineValues
|
|
4945
5391
|
});
|
|
4946
5392
|
}
|
|
5393
|
+
|
|
4947
5394
|
var contentHeight = getAvailableContentHeight({
|
|
4948
5395
|
height: containerHeight,
|
|
4949
5396
|
hasSparkline: hasSparkline,
|
|
@@ -4953,22 +5400,22 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
|
|
|
4953
5400
|
underLabel: underLabel,
|
|
4954
5401
|
underLabelFontSize: underLabelFontSize
|
|
4955
5402
|
})
|
|
4956
|
-
});
|
|
5403
|
+
}); // calculate sparkline size and positions
|
|
4957
5404
|
|
|
4958
|
-
// calculate sparkline size and positions
|
|
4959
5405
|
var _getSparklines = getSparklines({
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
5406
|
+
width: containerWidth,
|
|
5407
|
+
height: containerHeight,
|
|
5408
|
+
contentHeight: contentHeight,
|
|
5409
|
+
hasSparkline: hasSparkline,
|
|
5410
|
+
isSparklinePositionBelow: isSparklinePositionBelow,
|
|
5411
|
+
sparklineHighlightSegments: sparklineHighlightSegments,
|
|
5412
|
+
sparklineHighlightDots: sparklineHighlightDots
|
|
5413
|
+
}),
|
|
5414
|
+
sparklineWidth = _getSparklines.sparklineWidth,
|
|
5415
|
+
sparklineHeight = _getSparklines.sparklineHeight,
|
|
5416
|
+
sparklineSegments = _getSparklines.sparklineSegments,
|
|
5417
|
+
endDots = _getSparklines.endDots;
|
|
5418
|
+
|
|
4972
5419
|
return /*#__PURE__*/external_react_default.a.createElement(VizStyleWrapper["default"], {
|
|
4973
5420
|
backgroundColor: backgroundColor,
|
|
4974
5421
|
style: style,
|
|
@@ -5005,6 +5452,7 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
|
|
|
5005
5452
|
endDots: endDots
|
|
5006
5453
|
}));
|
|
5007
5454
|
};
|
|
5455
|
+
|
|
5008
5456
|
if (trellisEnabled) {
|
|
5009
5457
|
return /*#__PURE__*/external_react_default.a.createElement(external_react_default.a.Fragment, null, /*#__PURE__*/external_react_default.a.createElement(TrellisTitle["TrellisTitle"], {
|
|
5010
5458
|
fontColor: defaultThemeColors === null || defaultThemeColors === void 0 ? void 0 : defaultThemeColors.defaultFontColor,
|
|
@@ -5017,6 +5465,7 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
|
|
|
5017
5465
|
return renderVisualization(containerDimension);
|
|
5018
5466
|
})));
|
|
5019
5467
|
}
|
|
5468
|
+
|
|
5020
5469
|
return /*#__PURE__*/external_react_default.a.createElement(Container, {
|
|
5021
5470
|
width: width,
|
|
5022
5471
|
height: height
|
|
@@ -5024,6 +5473,7 @@ var SingleValue_SingleValue = function SingleValue(_ref) {
|
|
|
5024
5473
|
return renderVisualization(containerDimension);
|
|
5025
5474
|
}));
|
|
5026
5475
|
};
|
|
5476
|
+
|
|
5027
5477
|
SingleValue_SingleValue.propTypes = {
|
|
5028
5478
|
width: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
5029
5479
|
height: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
@@ -5084,11 +5534,10 @@ SingleValue_SingleValue.defaultProps = {
|
|
|
5084
5534
|
hasEventHandlers: false,
|
|
5085
5535
|
onValueClick: function onValueClick() {},
|
|
5086
5536
|
trellisKey: '',
|
|
5087
|
-
trellisSplitBy: ''
|
|
5088
|
-
// fixme todo: a pure viz should not be passed a map of severity colors! This should be resolved
|
|
5537
|
+
trellisSplitBy: '' // fixme todo: a pure viz should not be passed a map of severity colors! This should be resolved
|
|
5089
5538
|
// by behaviors or DSL in future. Pure viz does not understand concepts such as severity.
|
|
5090
|
-
};
|
|
5091
5539
|
|
|
5540
|
+
};
|
|
5092
5541
|
/* harmony default export */ var PureSingleValue_SingleValue = __webpack_exports__["default"] = (SingleValue_SingleValue);
|
|
5093
5542
|
|
|
5094
5543
|
/***/ }),
|
|
@@ -5139,6 +5588,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5139
5588
|
});
|
|
5140
5589
|
exports.LAYOUT_TYPE = void 0;
|
|
5141
5590
|
var LAYOUT_TYPE;
|
|
5591
|
+
|
|
5142
5592
|
(function (LAYOUT_TYPE) {
|
|
5143
5593
|
LAYOUT_TYPE["Off"] = "off";
|
|
5144
5594
|
LAYOUT_TYPE["Trellis"] = "trellis";
|
|
@@ -5157,6 +5607,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5157
5607
|
});
|
|
5158
5608
|
exports.VizBehavior = void 0;
|
|
5159
5609
|
var VizBehavior;
|
|
5610
|
+
|
|
5160
5611
|
(function (VizBehavior) {
|
|
5161
5612
|
/**
|
|
5162
5613
|
* Dynamic Options Behavior.
|
|
@@ -5176,6 +5627,7 @@ var VizBehavior;
|
|
|
5176
5627
|
* missing.
|
|
5177
5628
|
* @type {string}
|
|
5178
5629
|
*/
|
|
5630
|
+
|
|
5179
5631
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
5180
5632
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
5181
5633
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -5267,8 +5719,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5267
5719
|
value: true
|
|
5268
5720
|
});
|
|
5269
5721
|
exports.TrellisTitle = exports.TRELLIS_TITLE_HEIGHT = void 0;
|
|
5722
|
+
|
|
5270
5723
|
var React = __webpack_require__(1);
|
|
5724
|
+
|
|
5271
5725
|
var styled_components_1 = __webpack_require__(4);
|
|
5726
|
+
|
|
5272
5727
|
exports.TRELLIS_TITLE_HEIGHT = 28;
|
|
5273
5728
|
var TrellisTitleText = styled_components_1.default.div.withConfig({
|
|
5274
5729
|
displayName: "TrellisTitle__TrellisTitleText",
|
|
@@ -5284,6 +5739,7 @@ var TrellisTitleDiv = styled_components_1.default.div.withConfig({
|
|
|
5284
5739
|
}, function (props) {
|
|
5285
5740
|
return props.backgroundColor;
|
|
5286
5741
|
});
|
|
5742
|
+
|
|
5287
5743
|
var TrellisTitle = function TrellisTitle(props) {
|
|
5288
5744
|
var titleText = String(props.trellisKey).toString();
|
|
5289
5745
|
return React.createElement(TrellisTitleDiv, {
|
|
@@ -5293,6 +5749,7 @@ var TrellisTitle = function TrellisTitle(props) {
|
|
|
5293
5749
|
title: titleText
|
|
5294
5750
|
}, React.createElement(TrellisTitleText, null, titleText));
|
|
5295
5751
|
};
|
|
5752
|
+
|
|
5296
5753
|
exports.TrellisTitle = TrellisTitle;
|
|
5297
5754
|
|
|
5298
5755
|
/***/ }),
|
|
@@ -5334,11 +5791,11 @@ var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(exte
|
|
|
5334
5791
|
var singleValueUtils = __webpack_require__(24);
|
|
5335
5792
|
|
|
5336
5793
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowUp"
|
|
5337
|
-
var ArrowUp_ = __webpack_require__(
|
|
5794
|
+
var ArrowUp_ = __webpack_require__(85);
|
|
5338
5795
|
var ArrowUp_default = /*#__PURE__*/__webpack_require__.n(ArrowUp_);
|
|
5339
5796
|
|
|
5340
5797
|
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ArrowDown"
|
|
5341
|
-
var ArrowDown_ = __webpack_require__(
|
|
5798
|
+
var ArrowDown_ = __webpack_require__(86);
|
|
5342
5799
|
var ArrowDown_default = /*#__PURE__*/__webpack_require__.n(ArrowDown_);
|
|
5343
5800
|
|
|
5344
5801
|
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
@@ -5376,13 +5833,15 @@ var Text = external_styled_components_default.a.div.withConfig({
|
|
|
5376
5833
|
}, function (props) {
|
|
5377
5834
|
return props.size ? "margin-left: ".concat(parseInt(props.size, 10) * 0.2 || 5, "px;") : '';
|
|
5378
5835
|
});
|
|
5836
|
+
|
|
5379
5837
|
var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
5380
5838
|
var fontSize = _ref.fontSize,
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5839
|
+
color = _ref.color,
|
|
5840
|
+
value = _ref.value,
|
|
5841
|
+
text = _ref.text;
|
|
5384
5842
|
var TrendIndicator = false;
|
|
5385
5843
|
var ariaLabel = false;
|
|
5844
|
+
|
|
5386
5845
|
if (parseFloat(value, 10) > 0) {
|
|
5387
5846
|
TrendIndicator = ArrowUp_default.a;
|
|
5388
5847
|
ariaLabel = Object(i18n_["_"])('increase');
|
|
@@ -5390,6 +5849,7 @@ var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5390
5849
|
TrendIndicator = ArrowDown_default.a;
|
|
5391
5850
|
ariaLabel = Object(i18n_["_"])('decrease');
|
|
5392
5851
|
}
|
|
5852
|
+
|
|
5393
5853
|
return /*#__PURE__*/external_react_default.a.createElement(Column, {
|
|
5394
5854
|
justify: "flex-end",
|
|
5395
5855
|
size: fontSize
|
|
@@ -5405,6 +5865,7 @@ var TrendValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5405
5865
|
color: color
|
|
5406
5866
|
}, "".concat(text)));
|
|
5407
5867
|
};
|
|
5868
|
+
|
|
5408
5869
|
TrendValue_SingleValueContent.propTypes = {
|
|
5409
5870
|
fontSize: external_prop_types_default.a.number,
|
|
5410
5871
|
color: external_prop_types_default.a.string,
|
|
@@ -5413,7 +5874,7 @@ TrendValue_SingleValueContent.propTypes = {
|
|
|
5413
5874
|
};
|
|
5414
5875
|
/* harmony default export */ var TrendValue = (TrendValue_SingleValueContent);
|
|
5415
5876
|
// EXTERNAL MODULE: external "cssesc"
|
|
5416
|
-
var external_cssesc_ = __webpack_require__(
|
|
5877
|
+
var external_cssesc_ = __webpack_require__(87);
|
|
5417
5878
|
var external_cssesc_default = /*#__PURE__*/__webpack_require__.n(external_cssesc_);
|
|
5418
5879
|
|
|
5419
5880
|
// CONCATENATED MODULE: ./src/SingleValueBasic/MajorValue.jsx
|
|
@@ -5445,37 +5906,44 @@ var MajorValue_Text = external_styled_components_default.a.div.withConfig({
|
|
|
5445
5906
|
if (!props.pseudoContent || !props.pseudoContentPosition) {
|
|
5446
5907
|
return '';
|
|
5447
5908
|
}
|
|
5909
|
+
|
|
5448
5910
|
return "&:".concat(props.pseudoContentPosition, " {\n // by default this pseudo element would inherit text-decoration from main element\n // and text-decoration could not be overwritten.\n // adding display: inline-block makes text decoration independent from main element.\n // => the unit will not be underlined if a user hovers over the main value\n display: inline-block;\n font-size: ").concat(props.pseudoContentFontSize, "px;\n position: relative;\n font-weight: normal;\n content: ").concat(props.pseudoContent, ";\n }");
|
|
5449
5911
|
});
|
|
5450
5912
|
var validUnitPositions = ['before', 'after'];
|
|
5913
|
+
|
|
5451
5914
|
var MajorValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
5452
5915
|
var color = _ref.color,
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5916
|
+
fontSize = _ref.fontSize,
|
|
5917
|
+
unitPosition = _ref.unitPosition,
|
|
5918
|
+
title = _ref.title,
|
|
5919
|
+
value = _ref.value,
|
|
5920
|
+
onValueClick = _ref.onValueClick,
|
|
5921
|
+
unit = _ref.unit;
|
|
5459
5922
|
var sanitizedUnit;
|
|
5460
5923
|
var sanitizedUnitPosition;
|
|
5924
|
+
|
|
5461
5925
|
if (typeof unit === 'string') {
|
|
5462
5926
|
sanitizedUnit = external_cssesc_default()(unit, {
|
|
5463
5927
|
wrap: true,
|
|
5464
5928
|
quotes: 'double'
|
|
5465
5929
|
});
|
|
5930
|
+
|
|
5466
5931
|
if (typeof unitPosition === 'string' && validUnitPositions.includes(unitPosition)) {
|
|
5467
5932
|
sanitizedUnitPosition = unitPosition;
|
|
5468
5933
|
} else {
|
|
5469
5934
|
sanitizedUnitPosition = 'after';
|
|
5470
5935
|
}
|
|
5471
5936
|
}
|
|
5937
|
+
|
|
5472
5938
|
var handleKeyDown = function handleKeyDown(e) {
|
|
5473
5939
|
if (e.keyCode !== 13) {
|
|
5474
5940
|
return;
|
|
5475
5941
|
}
|
|
5942
|
+
|
|
5476
5943
|
e.preventDefault();
|
|
5477
5944
|
onValueClick(e);
|
|
5478
5945
|
};
|
|
5946
|
+
|
|
5479
5947
|
return /*#__PURE__*/external_react_default.a.createElement(Row, {
|
|
5480
5948
|
size: fontSize
|
|
5481
5949
|
}, /*#__PURE__*/external_react_default.a.createElement(MajorValue_Text, {
|
|
@@ -5495,6 +5963,7 @@ var MajorValue_SingleValueContent = function SingleValueContent(_ref) {
|
|
|
5495
5963
|
onKeyDown: handleKeyDown
|
|
5496
5964
|
}, value));
|
|
5497
5965
|
};
|
|
5966
|
+
|
|
5498
5967
|
MajorValue_SingleValueContent.propTypes = {
|
|
5499
5968
|
color: external_prop_types_default.a.string,
|
|
5500
5969
|
fontSize: external_prop_types_default.a.number,
|
|
@@ -5533,22 +6002,24 @@ var SingleValueBasic_Text = external_styled_components_default.a.div.withConfig(
|
|
|
5533
6002
|
}, singleValueUtils["DEFAULT_FONT_FAMILY"], function (props) {
|
|
5534
6003
|
return props.size || 12;
|
|
5535
6004
|
});
|
|
6005
|
+
|
|
5536
6006
|
var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
5537
6007
|
var props = extends_default()({}, _ref);
|
|
6008
|
+
|
|
5538
6009
|
var majorColor = props.majorColor,
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
6010
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
6011
|
+
majorText = props.majorText,
|
|
6012
|
+
majorValueTitle = props.majorValueTitle,
|
|
6013
|
+
trendColor = props.trendColor,
|
|
6014
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
6015
|
+
trendText = props.trendText,
|
|
6016
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
6017
|
+
unit = props.unit,
|
|
6018
|
+
unitPosition = props.unitPosition,
|
|
6019
|
+
underLabel = props.underLabel,
|
|
6020
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
6021
|
+
underLabelColor = props.underLabelColor,
|
|
6022
|
+
onValueClick = props.onValueClick;
|
|
5552
6023
|
var trendIndicatorEnabled = trendText !== '' && showTrendIndicator;
|
|
5553
6024
|
return /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Column, null, /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_Row, {
|
|
5554
6025
|
align: "baseline"
|
|
@@ -5561,7 +6032,8 @@ var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
|
5561
6032
|
value: majorText,
|
|
5562
6033
|
title: majorValueTitle,
|
|
5563
6034
|
onValueClick: onValueClick
|
|
5564
|
-
}), trendIndicatorEnabled &&
|
|
6035
|
+
}), trendIndicatorEnabled &&
|
|
6036
|
+
/*#__PURE__*/
|
|
5565
6037
|
// Passing the same value for value and text is a temporary hold until completion of https://jira.splunk.com/browse/SCP-21371
|
|
5566
6038
|
external_react_default.a.createElement(TrendValue, {
|
|
5567
6039
|
"data-test": "TrendIndicator",
|
|
@@ -5577,6 +6049,7 @@ var SingleValueBasic_SingleValueBasic = function SingleValueBasic(_ref) {
|
|
|
5577
6049
|
color: underLabelColor
|
|
5578
6050
|
}, underLabel)));
|
|
5579
6051
|
};
|
|
6052
|
+
|
|
5580
6053
|
SingleValueBasic_SingleValueBasic.propTypes = {
|
|
5581
6054
|
majorText: external_prop_types_default.a.string,
|
|
5582
6055
|
majorColor: external_prop_types_default.a.string,
|
|
@@ -5598,35 +6071,35 @@ var SingleValueTrendValue = TrendValue;
|
|
|
5598
6071
|
|
|
5599
6072
|
/***/ }),
|
|
5600
6073
|
|
|
5601
|
-
/***/
|
|
6074
|
+
/***/ 84:
|
|
5602
6075
|
/***/ (function(module, exports) {
|
|
5603
6076
|
|
|
5604
6077
|
module.exports = require("@splunk/visualizations-shared/trellisUtils");
|
|
5605
6078
|
|
|
5606
6079
|
/***/ }),
|
|
5607
6080
|
|
|
5608
|
-
/***/
|
|
6081
|
+
/***/ 85:
|
|
5609
6082
|
/***/ (function(module, exports) {
|
|
5610
6083
|
|
|
5611
6084
|
module.exports = require("@splunk/react-icons/enterprise/ArrowUp");
|
|
5612
6085
|
|
|
5613
6086
|
/***/ }),
|
|
5614
6087
|
|
|
5615
|
-
/***/
|
|
6088
|
+
/***/ 86:
|
|
5616
6089
|
/***/ (function(module, exports) {
|
|
5617
6090
|
|
|
5618
6091
|
module.exports = require("@splunk/react-icons/enterprise/ArrowDown");
|
|
5619
6092
|
|
|
5620
6093
|
/***/ }),
|
|
5621
6094
|
|
|
5622
|
-
/***/
|
|
6095
|
+
/***/ 87:
|
|
5623
6096
|
/***/ (function(module, exports) {
|
|
5624
6097
|
|
|
5625
6098
|
module.exports = require("cssesc");
|
|
5626
6099
|
|
|
5627
6100
|
/***/ }),
|
|
5628
6101
|
|
|
5629
|
-
/***/
|
|
6102
|
+
/***/ 88:
|
|
5630
6103
|
/***/ (function(module, exports) {
|
|
5631
6104
|
|
|
5632
6105
|
module.exports = require("@babel/runtime/helpers/assertThisInitialized");
|
|
@@ -5640,7 +6113,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
5640
6113
|
|
|
5641
6114
|
/***/ }),
|
|
5642
6115
|
|
|
5643
|
-
/***/
|
|
6116
|
+
/***/ 91:
|
|
5644
6117
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5645
6118
|
|
|
5646
6119
|
"use strict";
|
|
@@ -5664,7 +6137,7 @@ var StaticBackgroundColorEditor = {
|
|
|
5664
6137
|
|
|
5665
6138
|
/***/ }),
|
|
5666
6139
|
|
|
5667
|
-
/***/
|
|
6140
|
+
/***/ 94:
|
|
5668
6141
|
/***/ (function(module, exports) {
|
|
5669
6142
|
|
|
5670
6143
|
module.exports = require("@splunk/react-ui/Paginator");
|
|
@@ -5682,7 +6155,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5682
6155
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
|
|
5683
6156
|
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
|
|
5684
6157
|
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
|
|
5685
|
-
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
6158
|
+
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(88);
|
|
5686
6159
|
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__);
|
|
5687
6160
|
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71);
|
|
5688
6161
|
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);
|
|
@@ -5714,24 +6187,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5714
6187
|
|
|
5715
6188
|
|
|
5716
6189
|
|
|
6190
|
+
|
|
5717
6191
|
function _createSuper(Derived) {
|
|
5718
6192
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
6193
|
+
|
|
5719
6194
|
return function _createSuperInternal() {
|
|
5720
6195
|
var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived),
|
|
5721
|
-
|
|
6196
|
+
result;
|
|
6197
|
+
|
|
5722
6198
|
if (hasNativeReflectConstruct) {
|
|
5723
6199
|
var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;
|
|
6200
|
+
|
|
5724
6201
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
5725
6202
|
} else {
|
|
5726
6203
|
result = Super.apply(this, arguments);
|
|
5727
6204
|
}
|
|
6205
|
+
|
|
5728
6206
|
return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, result);
|
|
5729
6207
|
};
|
|
5730
6208
|
}
|
|
6209
|
+
|
|
5731
6210
|
function _isNativeReflectConstruct() {
|
|
5732
6211
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
5733
6212
|
if (Reflect.construct.sham) return false;
|
|
5734
6213
|
if (typeof Proxy === "function") return true;
|
|
6214
|
+
|
|
5735
6215
|
try {
|
|
5736
6216
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
5737
6217
|
return true;
|
|
@@ -5746,6 +6226,7 @@ function _isNativeReflectConstruct() {
|
|
|
5746
6226
|
|
|
5747
6227
|
|
|
5748
6228
|
|
|
6229
|
+
|
|
5749
6230
|
var StyledSvg = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.svg.withConfig({
|
|
5750
6231
|
displayName: "SparkLine__StyledSvg",
|
|
5751
6232
|
componentId: "sc-5oplra-0"
|
|
@@ -5754,21 +6235,29 @@ var StyledTooltip = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.di
|
|
|
5754
6235
|
displayName: "SparkLine__StyledTooltip",
|
|
5755
6236
|
componentId: "sc-5oplra-1"
|
|
5756
6237
|
})(["padding:3px 8px;font-size:12px;"]);
|
|
6238
|
+
|
|
5757
6239
|
var SparkLine = /*#__PURE__*/function (_Component) {
|
|
5758
6240
|
_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(SparkLine, _Component);
|
|
6241
|
+
|
|
5759
6242
|
var _super = _createSuper(SparkLine);
|
|
6243
|
+
|
|
5760
6244
|
function SparkLine(props) {
|
|
5761
6245
|
var _this;
|
|
6246
|
+
|
|
5762
6247
|
_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SparkLine);
|
|
6248
|
+
|
|
5763
6249
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5764
6250
|
rest[_key - 1] = arguments[_key];
|
|
5765
6251
|
}
|
|
6252
|
+
|
|
5766
6253
|
_this = _super.call.apply(_super, [this, props].concat(rest));
|
|
6254
|
+
|
|
5767
6255
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this), "handleCursorMount", function (el) {
|
|
5768
6256
|
_this.setState({
|
|
5769
6257
|
anchor: el
|
|
5770
6258
|
});
|
|
5771
6259
|
});
|
|
6260
|
+
|
|
5772
6261
|
_this.state = {
|
|
5773
6262
|
anchor: null,
|
|
5774
6263
|
currentPointX: null,
|
|
@@ -5779,69 +6268,75 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
5779
6268
|
_this.titleId = Object(_splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__["createDOMID"])();
|
|
5780
6269
|
return _this;
|
|
5781
6270
|
}
|
|
6271
|
+
|
|
5782
6272
|
_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(SparkLine, [{
|
|
5783
6273
|
key: "getMax",
|
|
5784
6274
|
value: function getMax() {
|
|
5785
6275
|
var _this2 = this;
|
|
6276
|
+
|
|
5786
6277
|
var _this$props = this.props,
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
6278
|
+
data = _this$props.data,
|
|
6279
|
+
acceptNull = _this$props.acceptNull,
|
|
6280
|
+
yMax = _this$props.yMax;
|
|
6281
|
+
|
|
5790
6282
|
var dataMax = function dataMax() {
|
|
5791
6283
|
return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(_this2.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(data);
|
|
5792
6284
|
};
|
|
6285
|
+
|
|
5793
6286
|
return yMax !== undefined ? yMax : dataMax();
|
|
5794
6287
|
}
|
|
5795
6288
|
}, {
|
|
5796
6289
|
key: "getMin",
|
|
5797
6290
|
value: function getMin() {
|
|
5798
6291
|
var _this3 = this;
|
|
6292
|
+
|
|
5799
6293
|
var _this$props2 = this.props,
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
6294
|
+
data = _this$props2.data,
|
|
6295
|
+
acceptNull = _this$props2.acceptNull,
|
|
6296
|
+
yMin = _this$props2.yMin;
|
|
6297
|
+
|
|
5803
6298
|
var dataMin = function dataMin() {
|
|
5804
6299
|
return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(_this3.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(data);
|
|
5805
6300
|
};
|
|
6301
|
+
|
|
5806
6302
|
return yMin !== undefined ? yMin : dataMin();
|
|
5807
6303
|
}
|
|
5808
|
-
|
|
5809
6304
|
/**
|
|
5810
6305
|
* Gets unit value of x axis.
|
|
5811
6306
|
* @param {Number} xMargin - margin of x axis.
|
|
5812
6307
|
* @return {Number} unit value of x axis.
|
|
5813
6308
|
* @private
|
|
5814
6309
|
*/
|
|
6310
|
+
|
|
5815
6311
|
}, {
|
|
5816
6312
|
key: "getXUnit",
|
|
5817
6313
|
value: function getXUnit(xMargin) {
|
|
5818
6314
|
var _this$props3 = this.props,
|
|
5819
|
-
|
|
5820
|
-
|
|
6315
|
+
data = _this$props3.data,
|
|
6316
|
+
width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
|
|
6317
|
+
|
|
5821
6318
|
var xUnit = (width - xMargin * 2) / (data.length > 1 ? data.length - 1 : 1);
|
|
5822
6319
|
return Math.max(0, xUnit);
|
|
5823
6320
|
}
|
|
5824
|
-
|
|
5825
6321
|
/**
|
|
5826
6322
|
* Gets unit value of y axis.
|
|
5827
6323
|
* @param {String} yMargin - margin of y axis.
|
|
5828
6324
|
* @return {Number} unit value of y axis.
|
|
5829
6325
|
* @private
|
|
5830
6326
|
*/
|
|
6327
|
+
|
|
5831
6328
|
}, {
|
|
5832
6329
|
key: "getYUnit",
|
|
5833
6330
|
value: function getYUnit(yMargin) {
|
|
5834
6331
|
var height = this.props.height;
|
|
5835
6332
|
var maxValue = this.getMax();
|
|
5836
|
-
var minValue = this.getMin();
|
|
5837
|
-
|
|
5838
|
-
// Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
|
|
6333
|
+
var minValue = this.getMin(); // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
|
|
5839
6334
|
// if the maxValue equals minValue, means all values in data are the same, then, we need to set the YUnit at the mid value of Height.
|
|
5840
6335
|
// So, draws sparkline right in the mid of the container.
|
|
6336
|
+
|
|
5841
6337
|
var yUnit = (height - yMargin * 2) / (maxValue - minValue || 2);
|
|
5842
6338
|
return Math.max(0, yUnit);
|
|
5843
6339
|
}
|
|
5844
|
-
|
|
5845
6340
|
/**
|
|
5846
6341
|
* Get a list of arrays of points for drawing lines, based on acceptNull property
|
|
5847
6342
|
* @method getSegmentSets
|
|
@@ -5849,6 +6344,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
5849
6344
|
* @param {Array} points
|
|
5850
6345
|
* @returns {Array} List of datapoint sets used for drawing lines
|
|
5851
6346
|
*/
|
|
6347
|
+
|
|
5852
6348
|
}, {
|
|
5853
6349
|
key: "getSegmentSets",
|
|
5854
6350
|
value: function getSegmentSets(data, points) {
|
|
@@ -5861,19 +6357,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
5861
6357
|
// need at least 2 points to draw a segment
|
|
5862
6358
|
if (currentLine.length > 1) {
|
|
5863
6359
|
lines.push(currentLine);
|
|
5864
|
-
}
|
|
5865
|
-
|
|
6360
|
+
} // reset for the next segment
|
|
6361
|
+
|
|
6362
|
+
|
|
5866
6363
|
currentLine = [];
|
|
5867
6364
|
} else {
|
|
5868
6365
|
// data is good, add point data
|
|
5869
6366
|
currentLine.push(points[idx]);
|
|
5870
6367
|
}
|
|
5871
|
-
});
|
|
6368
|
+
}); // Add the last line
|
|
5872
6369
|
|
|
5873
|
-
// Add the last line
|
|
5874
6370
|
if (currentLine.length > 1) {
|
|
5875
6371
|
lines.push(currentLine);
|
|
5876
6372
|
}
|
|
6373
|
+
|
|
5877
6374
|
return lines;
|
|
5878
6375
|
}
|
|
5879
6376
|
}, {
|
|
@@ -5889,7 +6386,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
5889
6386
|
return value === null ? 0 : value;
|
|
5890
6387
|
});
|
|
5891
6388
|
}
|
|
5892
|
-
|
|
5893
6389
|
/**
|
|
5894
6390
|
* Converts data to points in svg
|
|
5895
6391
|
* @param {Number} xMargin - margin of x axis.
|
|
@@ -5897,6 +6393,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
5897
6393
|
* @return {Array} points coordination.
|
|
5898
6394
|
* @private
|
|
5899
6395
|
*/
|
|
6396
|
+
|
|
5900
6397
|
}, {
|
|
5901
6398
|
key: "dataToPoints",
|
|
5902
6399
|
value: function dataToPoints(xMargin, yMargin) {
|
|
@@ -5914,7 +6411,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
5914
6411
|
return [p.x, p.y];
|
|
5915
6412
|
});
|
|
5916
6413
|
}
|
|
5917
|
-
|
|
5918
6414
|
/**
|
|
5919
6415
|
* Renders rect area for helping figure out which is the nearest point so that
|
|
5920
6416
|
* render related cursor and tooltip.
|
|
@@ -5923,16 +6419,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
5923
6419
|
* @return {Array} array of svg rect objects
|
|
5924
6420
|
* @private
|
|
5925
6421
|
*/
|
|
6422
|
+
|
|
5926
6423
|
}, {
|
|
5927
6424
|
key: "renderRect",
|
|
5928
6425
|
value: function renderRect(points, xMargin) {
|
|
5929
6426
|
var _this4 = this;
|
|
6427
|
+
|
|
5930
6428
|
var _this$props4 = this.props,
|
|
5931
|
-
|
|
5932
|
-
|
|
6429
|
+
data = _this$props4.data,
|
|
6430
|
+
height = _this$props4.height;
|
|
5933
6431
|
var xUnit = this.getXUnit(xMargin);
|
|
5934
6432
|
return points.map(function (p, i) {
|
|
5935
|
-
return
|
|
6433
|
+
return (
|
|
6434
|
+
/*#__PURE__*/
|
|
6435
|
+
|
|
5936
6436
|
/* eslint-disable react/no-array-index-key */
|
|
5937
6437
|
react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("rect", {
|
|
5938
6438
|
// eslint-disable-line jsx-a11y/mouse-events-have-key-events
|
|
@@ -5955,33 +6455,32 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
5955
6455
|
}
|
|
5956
6456
|
})
|
|
5957
6457
|
/* eslint-enable react/no-array-index-key */
|
|
6458
|
+
|
|
5958
6459
|
);
|
|
5959
6460
|
});
|
|
5960
|
-
}
|
|
6461
|
+
} // Renders area chart
|
|
5961
6462
|
|
|
5962
|
-
// Renders area chart
|
|
5963
6463
|
}, {
|
|
5964
6464
|
key: "renderArea",
|
|
5965
6465
|
value: function renderArea(points) {
|
|
5966
6466
|
var _this$props5 = this.props,
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
6467
|
+
data = _this$props5.data,
|
|
6468
|
+
fillColor = _this$props5.fillColor,
|
|
6469
|
+
fillOpacity = _this$props5.fillOpacity,
|
|
6470
|
+
height = _this$props5.height,
|
|
6471
|
+
isArea = _this$props5.isArea;
|
|
6472
|
+
|
|
5972
6473
|
if (!isArea || points.length === 0) {
|
|
5973
6474
|
return null;
|
|
5974
6475
|
}
|
|
6476
|
+
|
|
5975
6477
|
var segments = this.getSegmentSets(data, points);
|
|
5976
6478
|
segments = segments.map(function (s) {
|
|
5977
|
-
return s.concat([[s[s.length - 1][0], height],
|
|
5978
|
-
//
|
|
5979
|
-
[s[0][0], height],
|
|
5980
|
-
// over to below first data point
|
|
6479
|
+
return s.concat([[s[s.length - 1][0], height], // down to bottom of graph
|
|
6480
|
+
[s[0][0], height], // over to below first data point
|
|
5981
6481
|
s[0] // up to first data point to close the box
|
|
5982
6482
|
]);
|
|
5983
6483
|
});
|
|
5984
|
-
|
|
5985
6484
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
|
|
5986
6485
|
"data-test": "area"
|
|
5987
6486
|
}, segments.map(function (s) {
|
|
@@ -6001,11 +6500,11 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
6001
6500
|
key: "renderCursor",
|
|
6002
6501
|
value: function renderCursor() {
|
|
6003
6502
|
var _this$props6 = this.props,
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6503
|
+
cursorStroke = _this$props6.cursorStroke,
|
|
6504
|
+
cursorStrokeWidth = _this$props6.cursorStrokeWidth,
|
|
6505
|
+
cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
|
|
6506
|
+
cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
|
|
6507
|
+
height = _this$props6.height;
|
|
6009
6508
|
return this.state.rectArea !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("line", {
|
|
6010
6509
|
"data-test": "cursor",
|
|
6011
6510
|
ref: this.handleCursorMount,
|
|
@@ -6034,7 +6533,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
6034
6533
|
animation: false
|
|
6035
6534
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(StyledTooltip, null, this.state.anchor !== null ? this.state.tooltip : undefined));
|
|
6036
6535
|
}
|
|
6037
|
-
|
|
6038
6536
|
/**
|
|
6039
6537
|
* Renders one or more svg circles to highlight values on the sparkline
|
|
6040
6538
|
* @method renderEndDots
|
|
@@ -6044,14 +6542,15 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
6044
6542
|
* @returns {Object} React representation of SVG group
|
|
6045
6543
|
* @private
|
|
6046
6544
|
*/
|
|
6545
|
+
|
|
6047
6546
|
}, {
|
|
6048
6547
|
key: "renderEndDots",
|
|
6049
6548
|
value: function renderEndDots(points, dotsToShow, xMargin) {
|
|
6050
6549
|
var _this$props7 = this.props,
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6550
|
+
endDotFillColor = _this$props7.endDotFillColor,
|
|
6551
|
+
endDotRadius = _this$props7.endDotRadius,
|
|
6552
|
+
endDotStroke = _this$props7.endDotStroke,
|
|
6553
|
+
endDotStrokeWidth = _this$props7.endDotStrokeWidth;
|
|
6055
6554
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, points.slice(-dotsToShow).map(function (point) {
|
|
6056
6555
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("circle", {
|
|
6057
6556
|
key: "end-dot".concat(point[0]).concat(point[1]),
|
|
@@ -6067,21 +6566,21 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
6067
6566
|
});
|
|
6068
6567
|
}));
|
|
6069
6568
|
}
|
|
6070
|
-
|
|
6071
6569
|
/**
|
|
6072
6570
|
* Renders the line(s) above the area graph
|
|
6073
6571
|
* @method renderPolyline
|
|
6074
6572
|
* @param {Array} points
|
|
6075
6573
|
* @returns {Object} SVG Group of polylines
|
|
6076
6574
|
*/
|
|
6575
|
+
|
|
6077
6576
|
}, {
|
|
6078
6577
|
key: "renderPolyline",
|
|
6079
6578
|
value: function renderPolyline(points) {
|
|
6080
6579
|
var _this$props8 = this.props,
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6580
|
+
data = _this$props8.data,
|
|
6581
|
+
lineColor = _this$props8.lineColor,
|
|
6582
|
+
lineLength = _this$props8.lineLength,
|
|
6583
|
+
lineStrokeWidth = _this$props8.lineStrokeWidth;
|
|
6085
6584
|
var linePoints = Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(lineLength) && lineLength > 0 ? lineLength : points.length;
|
|
6086
6585
|
var lines = this.getSegmentSets(data.slice(-linePoints), points.slice(-linePoints));
|
|
6087
6586
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
|
|
@@ -6105,24 +6604,26 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
6105
6604
|
key: "render",
|
|
6106
6605
|
value: function render() {
|
|
6107
6606
|
var _this5 = this;
|
|
6607
|
+
|
|
6108
6608
|
var _this$props9 = this.props,
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6609
|
+
data = _this$props9.data,
|
|
6610
|
+
elementRef = _this$props9.elementRef,
|
|
6611
|
+
showTooltip = _this$props9.showTooltip,
|
|
6612
|
+
showEndDot = _this$props9.showEndDot,
|
|
6613
|
+
endDotRadius = _this$props9.endDotRadius,
|
|
6614
|
+
endDotStrokeWidth = _this$props9.endDotStrokeWidth,
|
|
6615
|
+
endDotCount = _this$props9.endDotCount,
|
|
6616
|
+
height = _this$props9.height,
|
|
6617
|
+
isArea = _this$props9.isArea,
|
|
6618
|
+
lineStrokeWidth = _this$props9.lineStrokeWidth,
|
|
6619
|
+
width = _this$props9.width,
|
|
6620
|
+
title = _this$props9.title;
|
|
6621
|
+
|
|
6121
6622
|
if (data.length === 0) {
|
|
6122
6623
|
return null;
|
|
6123
|
-
}
|
|
6624
|
+
} // Calculate horizontal and vertical margin so that fit line or end dot.
|
|
6625
|
+
|
|
6124
6626
|
|
|
6125
|
-
// Calculate horizontal and vertical margin so that fit line or end dot.
|
|
6126
6627
|
var xMargin = endDotRadius + endDotStrokeWidth / 2;
|
|
6127
6628
|
var yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
|
|
6128
6629
|
var points = this.dataToPoints(xMargin, yMargin);
|
|
@@ -6152,84 +6653,114 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
6152
6653
|
}, title || Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__["_"])('Source count over time sparkline trend')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, this.renderCursor(), this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, showTooltip ? this.renderRect(points, xMargin) : null, showTooltip ? this.renderTooltip() : null)));
|
|
6153
6654
|
}
|
|
6154
6655
|
}]);
|
|
6656
|
+
|
|
6155
6657
|
return SparkLine;
|
|
6156
6658
|
}(react__WEBPACK_IMPORTED_MODULE_9__["Component"]);
|
|
6659
|
+
|
|
6157
6660
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "propTypes", {
|
|
6158
6661
|
/**
|
|
6159
6662
|
* If true, data can contain `null` as a value and is treated as `0`. If false, this throws error when data contains `null`.
|
|
6160
6663
|
*/
|
|
6161
6664
|
acceptNull: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
|
|
6665
|
+
|
|
6162
6666
|
/** Array of numbers. These data numbers are converted to points and show on sparkline. */
|
|
6163
6667
|
data: function data(props) {
|
|
6164
6668
|
if (!Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isArray"])(props.data)) {
|
|
6165
6669
|
return new Error('Data provided to Sparkline must be an array.');
|
|
6166
6670
|
}
|
|
6671
|
+
|
|
6167
6672
|
if (props.acceptNull && !props.data.every(function (value) {
|
|
6168
6673
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isNull"])(value) || Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
|
|
6169
6674
|
})) {
|
|
6170
6675
|
return new Error('Data provided to Sparkline must be finite numbers or null.');
|
|
6171
6676
|
}
|
|
6677
|
+
|
|
6172
6678
|
if (!props.acceptNull && !props.data.every(function (value) {
|
|
6173
6679
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
|
|
6174
6680
|
})) {
|
|
6175
6681
|
return new Error('Data provided to Sparkline must be finite numbers.');
|
|
6176
6682
|
}
|
|
6683
|
+
|
|
6177
6684
|
return null;
|
|
6178
6685
|
},
|
|
6686
|
+
|
|
6179
6687
|
/** A React ref which is set to the DOM element when the component mounts and `null` when it unmounts. */
|
|
6180
6688
|
elementRef: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.object]),
|
|
6689
|
+
|
|
6181
6690
|
/** Sets the number of end dots to display. When showEndDot is set to `true`, endDotCount is at least 1. If set to a positive value, this overrides showEndDot. */
|
|
6182
6691
|
endDotCount: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
6692
|
+
|
|
6183
6693
|
/** Fills color to the end dot. */
|
|
6184
6694
|
endDotFillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
6695
|
+
|
|
6185
6696
|
/**
|
|
6186
6697
|
* Sets end dot radius. End dot radius must be less than or equal to the margin. By default, its value equals the margin.
|
|
6187
6698
|
*/
|
|
6188
6699
|
endDotRadius: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
6700
|
+
|
|
6189
6701
|
/** Sets end dot circle stroke color. */
|
|
6190
6702
|
endDotStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
6703
|
+
|
|
6191
6704
|
/** Sets end dot circle stroke width in pixels. */
|
|
6192
6705
|
endDotStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
6706
|
+
|
|
6193
6707
|
/** Fills color to area. */
|
|
6194
6708
|
fillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
6709
|
+
|
|
6195
6710
|
/** Fills opacity to area. Value must be in 0 ~ 1. */
|
|
6196
6711
|
fillOpacity: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
6712
|
+
|
|
6197
6713
|
/** Sets cursor stroke color. */
|
|
6198
6714
|
cursorStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
6715
|
+
|
|
6199
6716
|
/** Sets cursor stroke width in pixels. */
|
|
6200
6717
|
cursorStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
6718
|
+
|
|
6201
6719
|
/** Sets cursor line cap style. */
|
|
6202
6720
|
cursorStrokeLinecap: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOf(['butt', 'round', 'square']),
|
|
6721
|
+
|
|
6203
6722
|
/** Sets cursor dash array style. */
|
|
6204
6723
|
cursorStrokeDasharray: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
6724
|
+
|
|
6205
6725
|
/**
|
|
6206
6726
|
* Container height. If this value is specified, sparkline calculates the size using this height. If height isn't specified,
|
|
6207
6727
|
* sparkline figures out the container height by itself.
|
|
6208
6728
|
*/
|
|
6209
6729
|
height: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
|
|
6730
|
+
|
|
6210
6731
|
/** When set to `true`, sparkline shows as area. */
|
|
6211
6732
|
isArea: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
|
|
6733
|
+
|
|
6212
6734
|
/** The sparkline line color. */
|
|
6213
6735
|
lineColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
6736
|
+
|
|
6214
6737
|
/** Allows user to draw only the last data points for the line. */
|
|
6215
6738
|
lineLength: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
6739
|
+
|
|
6216
6740
|
/** The sparkline line stroke width in pixels. */
|
|
6217
6741
|
lineStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
6742
|
+
|
|
6218
6743
|
/** Enable to show end dot. */
|
|
6219
6744
|
showEndDot: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
|
|
6745
|
+
|
|
6220
6746
|
/** Enable to show tooltip. */
|
|
6221
6747
|
showTooltip: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
|
|
6748
|
+
|
|
6222
6749
|
/** Sets the data value range and maximum value shown on sparkline. */
|
|
6223
6750
|
yMax: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
6751
|
+
|
|
6224
6752
|
/** Sets the data value range and minimum value shown on sparkline. */
|
|
6225
6753
|
yMin: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
6754
|
+
|
|
6226
6755
|
/**
|
|
6227
6756
|
* The width of the container.
|
|
6228
6757
|
*/
|
|
6229
6758
|
width: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
|
|
6759
|
+
|
|
6230
6760
|
/** Sets the a11y title text on sparkline. */
|
|
6231
6761
|
title: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string
|
|
6232
6762
|
});
|
|
6763
|
+
|
|
6233
6764
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "defaultProps", {
|
|
6234
6765
|
acceptNull: false,
|
|
6235
6766
|
data: [],
|
|
@@ -6250,6 +6781,7 @@ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(Spa
|
|
|
6250
6781
|
lineColor: '#65a637',
|
|
6251
6782
|
lineStrokeWidth: 1
|
|
6252
6783
|
});
|
|
6784
|
+
|
|
6253
6785
|
/* harmony default export */ __webpack_exports__["default"] = (SparkLine);
|
|
6254
6786
|
|
|
6255
6787
|
/***/ })
|