@splunk/visualizations 27.0.0 → 27.2.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 +269 -122
- package/Area.config.js.map +4 -4
- package/Area.js +1065 -209
- package/Area.js.map +4 -4
- package/Bar.config.js +266 -82
- package/Bar.config.js.map +4 -4
- package/Bar.js +1065 -171
- package/Bar.js.map +4 -4
- package/Bubble.config.js +127 -1
- package/Bubble.config.js.map +4 -4
- package/Bubble.js +323 -80
- package/Bubble.js.map +4 -4
- package/ChoroplethSvg.js +64 -37
- package/ChoroplethSvg.js.map +4 -4
- package/Column.config.js +271 -82
- package/Column.config.js.map +4 -4
- package/Column.js +1070 -171
- package/Column.js.map +4 -4
- package/Ellipse.js +44 -14
- package/Ellipse.js.map +4 -4
- package/Events.js +172 -527
- package/Events.js.map +4 -4
- package/FillerGauge.js +45 -15
- package/FillerGauge.js.map +4 -4
- package/Image.js +42 -12
- package/Image.js.map +4 -4
- package/Line.config.js +271 -119
- package/Line.config.js.map +4 -4
- package/Line.js +1067 -206
- package/Line.js.map +4 -4
- package/LinkGraph.js +584 -545
- package/LinkGraph.js.map +4 -4
- package/Map.config.js +114 -72
- package/Map.config.js.map +4 -4
- package/Map.js +177 -94
- package/Map.js.map +4 -4
- package/Markdown.js +46 -16
- package/Markdown.js.map +4 -4
- package/MarkerGauge.js +42 -12
- package/MarkerGauge.js.map +4 -4
- package/ParallelCoordinates.js +123 -87
- package/ParallelCoordinates.js.map +4 -4
- package/Pie.js +198 -81
- package/Pie.js.map +4 -4
- package/Punchcard.js +241 -38
- package/Punchcard.js.map +4 -4
- package/Rectangle.js +56 -26
- package/Rectangle.js.map +4 -4
- package/Sankey.js +68 -38
- package/Sankey.js.map +4 -4
- package/Scatter.config.js +127 -1
- package/Scatter.config.js.map +4 -4
- package/Scatter.js +323 -80
- package/Scatter.js.map +4 -4
- package/SingleValue.config.js +43 -67
- package/SingleValue.config.js.map +4 -4
- package/SingleValue.js +1434 -1356
- package/SingleValue.js.map +4 -4
- package/SingleValueBasic.js +1 -1
- package/SingleValueBasic.js.map +3 -3
- package/SingleValueIcon.config.js +45 -69
- package/SingleValueIcon.config.js.map +4 -4
- package/SingleValueIcon.js +1739 -1407
- package/SingleValueIcon.js.map +4 -4
- package/SingleValueRadial.config.js +43 -67
- package/SingleValueRadial.config.js.map +4 -4
- package/SingleValueRadial.js +1366 -1273
- package/SingleValueRadial.js.map +4 -4
- package/SparkLine.js +1 -1
- package/SparkLine.js.map +3 -3
- package/TRELLIS.md +16 -15
- package/Table.js +65 -30
- package/Table.js.map +4 -4
- package/Timeline.config.js +418 -0
- package/Timeline.config.js.map +7 -0
- package/Timeline.js +3074 -0
- package/Timeline.js.map +7 -0
- package/common/Charting.js +133 -27
- package/common/Charting.js.map +4 -4
- package/common/OptionsDoc.js +8 -3
- package/common/OptionsDoc.js.map +2 -2
- package/common/utils/mapUtils.js.map +2 -2
- package/common/utils/singleValueUtils.js +26 -15
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/utils/trellisUtils.js +41 -1
- package/common/utils/trellisUtils.js.map +2 -2
- package/common/withDashboardViz.js +42 -12
- package/common/withDashboardViz.js.map +4 -4
- package/package.json +49 -38
package/SingleValueIcon.js
CHANGED
|
@@ -59,7 +59,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
59
|
));
|
|
60
60
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
61
61
|
|
|
62
|
-
// src/SingleValueIcon/
|
|
62
|
+
// src/SingleValueIcon/index.ts
|
|
63
63
|
var SingleValueIcon_exports = {};
|
|
64
64
|
__export(SingleValueIcon_exports, {
|
|
65
65
|
PureSingleValueIcon: () => PureSingleValueIcon,
|
|
@@ -133,59 +133,41 @@ var defaultImport7 = __toESM(require("lodash/isEmpty"));
|
|
|
133
133
|
__reExport(isEmpty_exports, require("lodash/isEmpty"));
|
|
134
134
|
var isEmpty_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
|
|
135
135
|
|
|
136
|
-
// esm-externals:@splunk/visualization-context/FeatureFlagContext
|
|
137
|
-
var FeatureFlagContext_exports = {};
|
|
138
|
-
__export(FeatureFlagContext_exports, {
|
|
139
|
-
default: () => FeatureFlagContext_default
|
|
140
|
-
});
|
|
141
|
-
var defaultImport8 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
|
|
142
|
-
__reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
|
|
143
|
-
var FeatureFlagContext_default = "default" in defaultImport8 ? defaultImport8.default : defaultImport8;
|
|
144
|
-
|
|
145
|
-
// esm-externals:@splunk/visualization-schemas
|
|
146
|
-
var visualization_schemas_exports = {};
|
|
147
|
-
__export(visualization_schemas_exports, {
|
|
148
|
-
default: () => visualization_schemas_default
|
|
149
|
-
});
|
|
150
|
-
var defaultImport9 = __toESM(require("@splunk/visualization-schemas"));
|
|
151
|
-
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
152
|
-
var visualization_schemas_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
|
|
153
|
-
|
|
154
136
|
// esm-externals:@splunk/visualizations-shared/style
|
|
155
137
|
var style_exports = {};
|
|
156
138
|
__export(style_exports, {
|
|
157
139
|
default: () => style_default
|
|
158
140
|
});
|
|
159
|
-
var
|
|
141
|
+
var defaultImport8 = __toESM(require("@splunk/visualizations-shared/style"));
|
|
160
142
|
__reExport(style_exports, require("@splunk/visualizations-shared/style"));
|
|
161
|
-
var style_default = "default" in
|
|
143
|
+
var style_default = "default" in defaultImport8 ? defaultImport8.default : defaultImport8;
|
|
162
144
|
|
|
163
145
|
// esm-externals:@splunk/ui-utils/i18n
|
|
164
146
|
var i18n_exports = {};
|
|
165
147
|
__export(i18n_exports, {
|
|
166
148
|
default: () => i18n_default
|
|
167
149
|
});
|
|
168
|
-
var
|
|
150
|
+
var defaultImport9 = __toESM(require("@splunk/ui-utils/i18n"));
|
|
169
151
|
__reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
|
|
170
|
-
var i18n_default = "default" in
|
|
152
|
+
var i18n_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
|
|
171
153
|
|
|
172
154
|
// esm-externals:@splunk/visualizations-shared/SizeAwareWrapper
|
|
173
155
|
var SizeAwareWrapper_exports = {};
|
|
174
156
|
__export(SizeAwareWrapper_exports, {
|
|
175
157
|
default: () => SizeAwareWrapper_default
|
|
176
158
|
});
|
|
177
|
-
var
|
|
159
|
+
var defaultImport10 = __toESM(require("@splunk/visualizations-shared/SizeAwareWrapper"));
|
|
178
160
|
__reExport(SizeAwareWrapper_exports, require("@splunk/visualizations-shared/SizeAwareWrapper"));
|
|
179
|
-
var SizeAwareWrapper_default = "default" in
|
|
161
|
+
var SizeAwareWrapper_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
|
|
180
162
|
|
|
181
163
|
// esm-externals:@splunk/visualizations-shared/Message
|
|
182
164
|
var Message_exports = {};
|
|
183
165
|
__export(Message_exports, {
|
|
184
166
|
default: () => Message_default
|
|
185
167
|
});
|
|
186
|
-
var
|
|
168
|
+
var defaultImport11 = __toESM(require("@splunk/visualizations-shared/Message"));
|
|
187
169
|
__reExport(Message_exports, require("@splunk/visualizations-shared/Message"));
|
|
188
|
-
var Message_default = "default" in
|
|
170
|
+
var Message_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
|
|
189
171
|
|
|
190
172
|
// src/common/components/VizStyleWrapper.jsx
|
|
191
173
|
var VizStyleWrapper = styled_components_default.div.attrs(({ dataTestKey }) => ({
|
|
@@ -234,104 +216,50 @@ var TrellisTitle = (props) => {
|
|
|
234
216
|
);
|
|
235
217
|
};
|
|
236
218
|
|
|
237
|
-
// esm-externals:@splunk/visualizations/SingleValueBasic
|
|
238
|
-
var SingleValueBasic_exports = {};
|
|
239
|
-
__export(SingleValueBasic_exports, {
|
|
240
|
-
default: () => SingleValueBasic_default
|
|
241
|
-
});
|
|
242
|
-
var defaultImport14 = __toESM(require("@splunk/visualizations/SingleValueBasic"));
|
|
243
|
-
__reExport(SingleValueBasic_exports, require("@splunk/visualizations/SingleValueBasic"));
|
|
244
|
-
var SingleValueBasic_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
|
|
245
|
-
|
|
246
|
-
// esm-externals:@splunk/react-icons/enterprise/Activity
|
|
247
|
-
var Activity_exports = {};
|
|
248
|
-
__export(Activity_exports, {
|
|
249
|
-
default: () => Activity_default
|
|
250
|
-
});
|
|
251
|
-
var defaultImport15 = __toESM(require("@splunk/react-icons/enterprise/Activity"));
|
|
252
|
-
__reExport(Activity_exports, require("@splunk/react-icons/enterprise/Activity"));
|
|
253
|
-
var Activity_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
|
|
254
|
-
|
|
255
|
-
// esm-externals:@splunk/react-icons/enterprise/Clock
|
|
256
|
-
var Clock_exports = {};
|
|
257
|
-
__export(Clock_exports, {
|
|
258
|
-
default: () => Clock_default
|
|
259
|
-
});
|
|
260
|
-
var defaultImport16 = __toESM(require("@splunk/react-icons/enterprise/Clock"));
|
|
261
|
-
__reExport(Clock_exports, require("@splunk/react-icons/enterprise/Clock"));
|
|
262
|
-
var Clock_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
|
|
263
|
-
|
|
264
|
-
// esm-externals:@splunk/react-icons/enterprise/Pencil
|
|
265
|
-
var Pencil_exports = {};
|
|
266
|
-
__export(Pencil_exports, {
|
|
267
|
-
default: () => Pencil_default
|
|
268
|
-
});
|
|
269
|
-
var defaultImport17 = __toESM(require("@splunk/react-icons/enterprise/Pencil"));
|
|
270
|
-
__reExport(Pencil_exports, require("@splunk/react-icons/enterprise/Pencil"));
|
|
271
|
-
var Pencil_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
|
|
272
|
-
|
|
273
|
-
// esm-externals:@splunk/react-icons/enterprise/Star
|
|
274
|
-
var Star_exports = {};
|
|
275
|
-
__export(Star_exports, {
|
|
276
|
-
default: () => Star_default
|
|
277
|
-
});
|
|
278
|
-
var defaultImport18 = __toESM(require("@splunk/react-icons/enterprise/Star"));
|
|
279
|
-
__reExport(Star_exports, require("@splunk/react-icons/enterprise/Star"));
|
|
280
|
-
var Star_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
|
|
281
|
-
|
|
282
|
-
// esm-externals:@splunk/react-icons/enterprise/Question
|
|
283
|
-
var Question_exports = {};
|
|
284
|
-
__export(Question_exports, {
|
|
285
|
-
default: () => Question_default
|
|
286
|
-
});
|
|
287
|
-
var defaultImport19 = __toESM(require("@splunk/react-icons/enterprise/Question"));
|
|
288
|
-
__reExport(Question_exports, require("@splunk/react-icons/enterprise/Question"));
|
|
289
|
-
var Question_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
|
|
290
|
-
|
|
291
219
|
// esm-externals:lodash
|
|
292
220
|
var lodash_exports = {};
|
|
293
221
|
__export(lodash_exports, {
|
|
294
222
|
default: () => lodash_default
|
|
295
223
|
});
|
|
296
|
-
var
|
|
224
|
+
var defaultImport12 = __toESM(require("lodash"));
|
|
297
225
|
__reExport(lodash_exports, require("lodash"));
|
|
298
|
-
var lodash_default = "default" in
|
|
226
|
+
var lodash_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
|
|
299
227
|
|
|
300
228
|
// esm-externals:@splunk/visualizations-shared/numberUtils
|
|
301
229
|
var numberUtils_exports = {};
|
|
302
230
|
__export(numberUtils_exports, {
|
|
303
231
|
default: () => numberUtils_default
|
|
304
232
|
});
|
|
305
|
-
var
|
|
233
|
+
var defaultImport13 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
|
|
306
234
|
__reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
|
|
307
|
-
var numberUtils_default = "default" in
|
|
235
|
+
var numberUtils_default = "default" in defaultImport13 ? defaultImport13.default : defaultImport13;
|
|
308
236
|
|
|
309
237
|
// esm-externals:@splunk/visualizations-shared/domUtils
|
|
310
238
|
var domUtils_exports = {};
|
|
311
239
|
__export(domUtils_exports, {
|
|
312
240
|
default: () => domUtils_default
|
|
313
241
|
});
|
|
314
|
-
var
|
|
242
|
+
var defaultImport14 = __toESM(require("@splunk/visualizations-shared/domUtils"));
|
|
315
243
|
__reExport(domUtils_exports, require("@splunk/visualizations-shared/domUtils"));
|
|
316
|
-
var domUtils_default = "default" in
|
|
244
|
+
var domUtils_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
|
|
317
245
|
|
|
318
246
|
// esm-externals:@splunk/visualizations-shared/propUtils
|
|
319
247
|
var propUtils_exports = {};
|
|
320
248
|
__export(propUtils_exports, {
|
|
321
249
|
default: () => propUtils_default
|
|
322
250
|
});
|
|
323
|
-
var
|
|
251
|
+
var defaultImport15 = __toESM(require("@splunk/visualizations-shared/propUtils"));
|
|
324
252
|
__reExport(propUtils_exports, require("@splunk/visualizations-shared/propUtils"));
|
|
325
|
-
var propUtils_default = "default" in
|
|
253
|
+
var propUtils_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
|
|
326
254
|
|
|
327
255
|
// esm-externals:@splunk/visualizations-shared/colorConstants
|
|
328
256
|
var colorConstants_exports = {};
|
|
329
257
|
__export(colorConstants_exports, {
|
|
330
258
|
default: () => colorConstants_default
|
|
331
259
|
});
|
|
332
|
-
var
|
|
260
|
+
var defaultImport16 = __toESM(require("@splunk/visualizations-shared/colorConstants"));
|
|
333
261
|
__reExport(colorConstants_exports, require("@splunk/visualizations-shared/colorConstants"));
|
|
334
|
-
var colorConstants_default = "default" in
|
|
262
|
+
var colorConstants_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
|
|
335
263
|
|
|
336
264
|
// src/common/utils/singleValueUtils.js
|
|
337
265
|
var DEFAULT_FONT = 12;
|
|
@@ -424,13 +352,13 @@ var computeText = ({
|
|
|
424
352
|
return text;
|
|
425
353
|
};
|
|
426
354
|
var getMajorText = ({
|
|
427
|
-
|
|
355
|
+
majorValueDisplay,
|
|
428
356
|
numberPrecision,
|
|
429
357
|
shouldUseThousandSeparators,
|
|
430
358
|
shouldAbbreviateMajorValue
|
|
431
359
|
}) => computeText({
|
|
432
|
-
value:
|
|
433
|
-
// if
|
|
360
|
+
value: majorValueDisplay === null ? "N/A" : majorValueDisplay,
|
|
361
|
+
// if majorValueDisplay is null, use `N/A`.
|
|
434
362
|
numberPrecision,
|
|
435
363
|
shouldUseThousandSeparators,
|
|
436
364
|
shouldAbbreviateValue: shouldAbbreviateMajorValue
|
|
@@ -505,6 +433,7 @@ var getMajorAndTrend = ({
|
|
|
505
433
|
width,
|
|
506
434
|
height,
|
|
507
435
|
majorValue,
|
|
436
|
+
majorValueDisplay,
|
|
508
437
|
trendValue,
|
|
509
438
|
majorFontSize,
|
|
510
439
|
trendFontSize,
|
|
@@ -519,7 +448,7 @@ var getMajorAndTrend = ({
|
|
|
519
448
|
const textContentWidth = width * 0.9;
|
|
520
449
|
const textContentHeight = height * 0.9;
|
|
521
450
|
const majorText = getMajorText({
|
|
522
|
-
|
|
451
|
+
majorValueDisplay,
|
|
523
452
|
numberPrecision,
|
|
524
453
|
shouldUseThousandSeparators,
|
|
525
454
|
shouldAbbreviateMajorValue
|
|
@@ -557,6 +486,7 @@ var updateVizInSmallSpace = ({
|
|
|
557
486
|
height,
|
|
558
487
|
toRemoveList,
|
|
559
488
|
majorValue,
|
|
489
|
+
majorValueDisplay,
|
|
560
490
|
trendValue,
|
|
561
491
|
majorFontSize,
|
|
562
492
|
trendFontSize,
|
|
@@ -577,6 +507,7 @@ var updateVizInSmallSpace = ({
|
|
|
577
507
|
});
|
|
578
508
|
newMajorAndTrend = getMajorAndTrend(__spreadValues({
|
|
579
509
|
majorValue,
|
|
510
|
+
majorValueDisplay,
|
|
580
511
|
trendValue,
|
|
581
512
|
majorFontSize,
|
|
582
513
|
trendFontSize,
|
|
@@ -591,9 +522,10 @@ var updateVizInSmallSpace = ({
|
|
|
591
522
|
removeIndex += 1;
|
|
592
523
|
}
|
|
593
524
|
if (newTextSize < 12) {
|
|
594
|
-
const truncateValue = `${majorValue.toString().slice(0, 3)}...`;
|
|
525
|
+
const truncateValue = `${(majorValueDisplay || majorValue).toString().slice(0, 3)}...`;
|
|
595
526
|
newMajorAndTrend = getMajorAndTrend(__spreadValues({
|
|
596
|
-
majorValue
|
|
527
|
+
majorValue,
|
|
528
|
+
majorValueDisplay: truncateValue,
|
|
597
529
|
trendValue,
|
|
598
530
|
majorFontSize,
|
|
599
531
|
trendFontSize,
|
|
@@ -613,6 +545,7 @@ var computeSingleValueContent = ({
|
|
|
613
545
|
containerWidth,
|
|
614
546
|
containerHeight,
|
|
615
547
|
majorValue,
|
|
548
|
+
majorValueDisplay,
|
|
616
549
|
trendValue,
|
|
617
550
|
majorFontSize,
|
|
618
551
|
trendFontSize,
|
|
@@ -626,6 +559,7 @@ var computeSingleValueContent = ({
|
|
|
626
559
|
}) => {
|
|
627
560
|
let { majorText, trendText, majorTextFontSize, trendTextFontSize } = getMajorAndTrend({
|
|
628
561
|
majorValue,
|
|
562
|
+
majorValueDisplay: majorValueDisplay || majorValue,
|
|
629
563
|
trendValue,
|
|
630
564
|
majorFontSize,
|
|
631
565
|
trendFontSize,
|
|
@@ -646,6 +580,7 @@ var computeSingleValueContent = ({
|
|
|
646
580
|
height: containerHeight,
|
|
647
581
|
toRemoveList,
|
|
648
582
|
majorValue,
|
|
583
|
+
majorValueDisplay: majorValueDisplay || majorValue,
|
|
649
584
|
trendValue,
|
|
650
585
|
majorFontSize,
|
|
651
586
|
trendFontSize,
|
|
@@ -667,17 +602,324 @@ var computeSingleValueContent = ({
|
|
|
667
602
|
smallVizProps
|
|
668
603
|
};
|
|
669
604
|
};
|
|
670
|
-
var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled = false,
|
|
671
|
-
|
|
605
|
+
var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled = false, trellisSplitBy = "", trellisKey = "") => onValueClick(__spreadProps(__spreadValues({}, ev), {
|
|
606
|
+
payload: __spreadValues({
|
|
672
607
|
trendValue,
|
|
673
608
|
value: majorValue,
|
|
674
609
|
name: majorValueField
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
|
|
610
|
+
}, trellisEnabled && { "trellis.name": trellisSplitBy, "trellis.value": trellisKey })
|
|
611
|
+
}));
|
|
612
|
+
var getTrendColorWithPercent = (options) => {
|
|
613
|
+
const shouldUsePercentTrendColor = options.trendColor === "> trendValue | rangeValue(trendColorEditorConfig)" && options.trendDisplay === "percent";
|
|
614
|
+
return shouldUsePercentTrendColor ? { trendColor: "> trendValuePercent | rangeValue(trendColorEditorConfig)" } : {};
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// esm-externals:@splunk/react-icons/enterprise/ArrowUp
|
|
618
|
+
var ArrowUp_exports = {};
|
|
619
|
+
__export(ArrowUp_exports, {
|
|
620
|
+
default: () => ArrowUp_default
|
|
621
|
+
});
|
|
622
|
+
var defaultImport17 = __toESM(require("@splunk/react-icons/enterprise/ArrowUp"));
|
|
623
|
+
__reExport(ArrowUp_exports, require("@splunk/react-icons/enterprise/ArrowUp"));
|
|
624
|
+
var ArrowUp_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
|
|
625
|
+
|
|
626
|
+
// esm-externals:@splunk/react-icons/enterprise/ArrowDown
|
|
627
|
+
var ArrowDown_exports = {};
|
|
628
|
+
__export(ArrowDown_exports, {
|
|
629
|
+
default: () => ArrowDown_default
|
|
630
|
+
});
|
|
631
|
+
var defaultImport18 = __toESM(require("@splunk/react-icons/enterprise/ArrowDown"));
|
|
632
|
+
__reExport(ArrowDown_exports, require("@splunk/react-icons/enterprise/ArrowDown"));
|
|
633
|
+
var ArrowDown_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
|
|
634
|
+
|
|
635
|
+
// src/SingleValueBasic/TrendValue.jsx
|
|
636
|
+
var Column = styled_components_default.div`
|
|
637
|
+
display: flex;
|
|
638
|
+
flex-direction: row;
|
|
639
|
+
justify-content: ${(props) => props.justify || "flex-end"};
|
|
640
|
+
height: ${(props) => props.size || 12}px;
|
|
641
|
+
${(props) => props.size ? `margin: 0 ${parseInt(props.size, 10) * 0.2 || 5}px;` : ""};
|
|
642
|
+
`;
|
|
643
|
+
var Text = styled_components_default.div`
|
|
644
|
+
white-space: nowrap;
|
|
645
|
+
font-size: ${(props) => props.size || 12}px;
|
|
646
|
+
color: ${(props) => props.color || "#000"};
|
|
647
|
+
font-family: ${DEFAULT_FONT_FAMILY};
|
|
648
|
+
height: ${(props) => props.size || 12}px;
|
|
649
|
+
line-height: ${(props) => props.size || 12}px;
|
|
650
|
+
display: flex;
|
|
651
|
+
align-self: baseline;
|
|
652
|
+
${(props) => props.size ? `margin-left: ${parseInt(props.size, 10) * 0.2 || 5}px;` : ""};
|
|
653
|
+
`;
|
|
654
|
+
var TrendValue = ({ fontSize, color, value, text }) => {
|
|
655
|
+
let TrendIndicator = false;
|
|
656
|
+
let ariaLabel = false;
|
|
657
|
+
if (parseFloat(value, 10) > 0) {
|
|
658
|
+
TrendIndicator = ArrowUp_default;
|
|
659
|
+
ariaLabel = (0, i18n_exports._)("increase");
|
|
660
|
+
} else if (parseFloat(value, 10) < 0) {
|
|
661
|
+
TrendIndicator = ArrowDown_default;
|
|
662
|
+
ariaLabel = (0, i18n_exports._)("decrease");
|
|
663
|
+
}
|
|
664
|
+
return /* @__PURE__ */ react_default.createElement(Column, { justify: "flex-end", size: fontSize }, /* @__PURE__ */ react_default.createElement(Text, { "data-test": "trendValueIndicator", size: fontSize, color }, TrendIndicator && /* @__PURE__ */ react_default.createElement(TrendIndicator, { "aria-label": ariaLabel })), /* @__PURE__ */ react_default.createElement(Text, { "data-test": "trendValue", size: fontSize, color }, `${text}`));
|
|
665
|
+
};
|
|
666
|
+
TrendValue.propTypes = {
|
|
667
|
+
fontSize: prop_types_default.number,
|
|
668
|
+
color: prop_types_default.string,
|
|
669
|
+
value: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
670
|
+
text: prop_types_default.string
|
|
671
|
+
};
|
|
672
|
+
var TrendValue_default = TrendValue;
|
|
673
|
+
|
|
674
|
+
// esm-externals:cssesc
|
|
675
|
+
var cssesc_exports = {};
|
|
676
|
+
__export(cssesc_exports, {
|
|
677
|
+
default: () => cssesc_default
|
|
678
|
+
});
|
|
679
|
+
var defaultImport19 = __toESM(require("cssesc"));
|
|
680
|
+
__reExport(cssesc_exports, require("cssesc"));
|
|
681
|
+
var cssesc_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
|
|
682
|
+
|
|
683
|
+
// src/SingleValueBasic/MajorValue.jsx
|
|
684
|
+
var Row = styled_components_default.div`
|
|
685
|
+
display: flex;
|
|
686
|
+
flex-direction: row;
|
|
687
|
+
align-items: flex-end;
|
|
688
|
+
justify-content: left;
|
|
689
|
+
height: ${(props) => props.size}px;
|
|
690
|
+
line-height: ${(props) => props.size}px;
|
|
691
|
+
`;
|
|
692
|
+
var Text2 = styled_components_default.div`
|
|
693
|
+
white-space: nowrap;
|
|
694
|
+
height: 100%;
|
|
695
|
+
font-size: ${(props) => props.size || 12}px;
|
|
696
|
+
color: ${(props) => props.color};
|
|
697
|
+
font-family: ${DEFAULT_FONT_FAMILY};
|
|
698
|
+
font-weight: bold;
|
|
699
|
+
&:hover {
|
|
700
|
+
text-decoration: ${(props) => props.showUnderline ? "underline" : "inherit"};
|
|
701
|
+
cursor: ${(props) => props.showUnderline ? "pointer" : "inherit"};
|
|
702
|
+
}
|
|
703
|
+
${(props) => {
|
|
704
|
+
if (!props.pseudoContent || !props.pseudoContentPosition) {
|
|
705
|
+
return "";
|
|
706
|
+
}
|
|
707
|
+
return `&:${props.pseudoContentPosition} {
|
|
708
|
+
// by default this pseudo element would inherit text-decoration from main element
|
|
709
|
+
// and text-decoration could not be overwritten.
|
|
710
|
+
// adding display: inline-block makes text decoration independent from main element.
|
|
711
|
+
// => the unit will not be underlined if a user hovers over the main value
|
|
712
|
+
display: inline-block;
|
|
713
|
+
font-size: ${props.pseudoContentFontSize}px;
|
|
714
|
+
position: relative;
|
|
715
|
+
font-weight: normal;
|
|
716
|
+
content: ${props.pseudoContent};
|
|
717
|
+
}`;
|
|
718
|
+
}}
|
|
719
|
+
`;
|
|
720
|
+
var validUnitPositions = ["before", "after"];
|
|
721
|
+
var MajorValue = ({ color, fontSize, unitPosition, title, value, onValueClick, unit }) => {
|
|
722
|
+
let sanitizedUnit;
|
|
723
|
+
let sanitizedUnitPosition;
|
|
724
|
+
if (typeof unit === "string") {
|
|
725
|
+
sanitizedUnit = cssesc_default(unit, { wrap: true, quotes: "double" });
|
|
726
|
+
if (typeof unitPosition === "string" && validUnitPositions.includes(unitPosition)) {
|
|
727
|
+
sanitizedUnitPosition = unitPosition;
|
|
728
|
+
} else {
|
|
729
|
+
sanitizedUnitPosition = "after";
|
|
730
|
+
}
|
|
678
731
|
}
|
|
679
|
-
|
|
732
|
+
const handleKeyDown = (e) => {
|
|
733
|
+
if (e.keyCode !== 13) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
e.preventDefault();
|
|
737
|
+
onValueClick(e);
|
|
738
|
+
};
|
|
739
|
+
return /* @__PURE__ */ react_default.createElement(Row, { size: fontSize }, /* @__PURE__ */ react_default.createElement(
|
|
740
|
+
Text2,
|
|
741
|
+
{
|
|
742
|
+
"data-test": "majorValue",
|
|
743
|
+
color,
|
|
744
|
+
onClick: (e) => typeof onValueClick === "function" && onValueClick(e),
|
|
745
|
+
showUnderline: !!onValueClick,
|
|
746
|
+
size: fontSize,
|
|
747
|
+
title,
|
|
748
|
+
pseudoContent: sanitizedUnit,
|
|
749
|
+
pseudoContentPosition: sanitizedUnitPosition,
|
|
750
|
+
pseudoContentFontSize: fontSize * 0.6,
|
|
751
|
+
tabIndex: "0",
|
|
752
|
+
role: "button",
|
|
753
|
+
onKeyDown: handleKeyDown
|
|
754
|
+
},
|
|
755
|
+
value
|
|
756
|
+
));
|
|
757
|
+
};
|
|
758
|
+
MajorValue.propTypes = {
|
|
759
|
+
color: prop_types_default.string,
|
|
760
|
+
fontSize: prop_types_default.number,
|
|
761
|
+
unit: prop_types_default.string,
|
|
762
|
+
unitPosition: prop_types_default.oneOf(validUnitPositions),
|
|
763
|
+
value: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
764
|
+
title: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
765
|
+
onValueClick: prop_types_default.oneOfType([prop_types_default.bool, prop_types_default.func])
|
|
766
|
+
};
|
|
767
|
+
var MajorValue_default = MajorValue;
|
|
768
|
+
|
|
769
|
+
// src/SingleValueBasic/SingleValueBasic.jsx
|
|
770
|
+
var Column2 = styled_components_default.div`
|
|
771
|
+
display: flex;
|
|
772
|
+
flex-direction: column;
|
|
773
|
+
align-self: center;
|
|
774
|
+
justify-content: center;
|
|
775
|
+
`;
|
|
776
|
+
var Row2 = styled_components_default.div`
|
|
777
|
+
display: flex;
|
|
778
|
+
flex-direction: row;
|
|
779
|
+
align-items: ${(props) => props.alignItems || "center"};
|
|
780
|
+
justify-content: ${(props) => getAligment(props.align)};
|
|
781
|
+
`;
|
|
782
|
+
var Text3 = styled_components_default.div`
|
|
783
|
+
font-weight: normal;
|
|
784
|
+
white-space: nowrap;
|
|
785
|
+
font-size: ${(props) => props.size || 12}px;
|
|
786
|
+
color: ${(props) => props.color || "#000"};
|
|
787
|
+
font-family: ${DEFAULT_FONT_FAMILY};
|
|
788
|
+
height: ${(props) => props.size || 12}px;
|
|
789
|
+
line-height: 1.2;
|
|
790
|
+
margin: ${(props) => props.margin || "inherit"};
|
|
791
|
+
`;
|
|
792
|
+
var SingleValueBasic = (_a) => {
|
|
793
|
+
var props = __objRest(_a, []);
|
|
794
|
+
const {
|
|
795
|
+
majorColor,
|
|
796
|
+
majorTextFontSize,
|
|
797
|
+
majorText,
|
|
798
|
+
majorValueTitle,
|
|
799
|
+
trendColor,
|
|
800
|
+
trendTextFontSize,
|
|
801
|
+
trendText,
|
|
802
|
+
showTrendIndicator,
|
|
803
|
+
unit,
|
|
804
|
+
unitPosition,
|
|
805
|
+
underLabel,
|
|
806
|
+
underLabelFontSize,
|
|
807
|
+
underLabelColor,
|
|
808
|
+
onValueClick,
|
|
809
|
+
align
|
|
810
|
+
} = props;
|
|
811
|
+
const trendIndicatorEnabled = trendText !== "" && showTrendIndicator;
|
|
812
|
+
return /* @__PURE__ */ react_default.createElement(Column2, null, /* @__PURE__ */ react_default.createElement(
|
|
813
|
+
Row2,
|
|
814
|
+
{
|
|
815
|
+
alignItems: "baseline",
|
|
816
|
+
align,
|
|
817
|
+
"data-test": `single-value-row-align-${getAligment(align)}`
|
|
818
|
+
},
|
|
819
|
+
/* @__PURE__ */ react_default.createElement(
|
|
820
|
+
MajorValue_default,
|
|
821
|
+
{
|
|
822
|
+
color: majorColor,
|
|
823
|
+
fontSize: majorTextFontSize,
|
|
824
|
+
unit,
|
|
825
|
+
unitPosition,
|
|
826
|
+
value: majorText,
|
|
827
|
+
title: majorValueTitle,
|
|
828
|
+
onValueClick
|
|
829
|
+
}
|
|
830
|
+
),
|
|
831
|
+
trendIndicatorEnabled && // Passing the same value for value and text is a temporary hold until completion of https://jira.splunk.com/browse/SCP-21371
|
|
832
|
+
/* @__PURE__ */ react_default.createElement(
|
|
833
|
+
TrendValue_default,
|
|
834
|
+
{
|
|
835
|
+
fontSize: trendTextFontSize,
|
|
836
|
+
color: trendColor,
|
|
837
|
+
value: trendText,
|
|
838
|
+
text: trendText
|
|
839
|
+
}
|
|
840
|
+
)
|
|
841
|
+
), underLabel && /* @__PURE__ */ react_default.createElement(
|
|
842
|
+
Row2,
|
|
843
|
+
{
|
|
844
|
+
justify: "center",
|
|
845
|
+
align,
|
|
846
|
+
"data-test": `single-value-row-align-${getAligment(align)}`
|
|
847
|
+
},
|
|
848
|
+
/* @__PURE__ */ react_default.createElement(
|
|
849
|
+
Text3,
|
|
850
|
+
{
|
|
851
|
+
"data-test": "underLabel",
|
|
852
|
+
size: underLabelFontSize,
|
|
853
|
+
color: underLabelColor,
|
|
854
|
+
margin: "0 6px"
|
|
855
|
+
},
|
|
856
|
+
underLabel
|
|
857
|
+
)
|
|
858
|
+
));
|
|
859
|
+
};
|
|
860
|
+
SingleValueBasic.propTypes = {
|
|
861
|
+
majorText: prop_types_default.string,
|
|
862
|
+
majorColor: prop_types_default.string,
|
|
863
|
+
majorTextFontSize: prop_types_default.number,
|
|
864
|
+
majorValueTitle: prop_types_default.string,
|
|
865
|
+
trendText: prop_types_default.string,
|
|
866
|
+
trendTextFontSize: prop_types_default.number,
|
|
867
|
+
trendColor: prop_types_default.string,
|
|
868
|
+
showTrendIndicator: prop_types_default.bool,
|
|
869
|
+
unit: prop_types_default.string,
|
|
870
|
+
unitPosition: prop_types_default.oneOf(["before", "after"]),
|
|
871
|
+
underLabel: prop_types_default.string,
|
|
872
|
+
underLabelFontSize: prop_types_default.number,
|
|
873
|
+
underLabelColor: prop_types_default.string,
|
|
874
|
+
onValueClick: prop_types_default.oneOfType([prop_types_default.bool, prop_types_default.func]),
|
|
875
|
+
align: prop_types_default.string
|
|
680
876
|
};
|
|
877
|
+
var SingleValueBasic_default = SingleValueBasic;
|
|
878
|
+
|
|
879
|
+
// esm-externals:@splunk/react-icons/enterprise/Activity
|
|
880
|
+
var Activity_exports = {};
|
|
881
|
+
__export(Activity_exports, {
|
|
882
|
+
default: () => Activity_default
|
|
883
|
+
});
|
|
884
|
+
var defaultImport20 = __toESM(require("@splunk/react-icons/enterprise/Activity"));
|
|
885
|
+
__reExport(Activity_exports, require("@splunk/react-icons/enterprise/Activity"));
|
|
886
|
+
var Activity_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
|
|
887
|
+
|
|
888
|
+
// esm-externals:@splunk/react-icons/enterprise/Clock
|
|
889
|
+
var Clock_exports = {};
|
|
890
|
+
__export(Clock_exports, {
|
|
891
|
+
default: () => Clock_default
|
|
892
|
+
});
|
|
893
|
+
var defaultImport21 = __toESM(require("@splunk/react-icons/enterprise/Clock"));
|
|
894
|
+
__reExport(Clock_exports, require("@splunk/react-icons/enterprise/Clock"));
|
|
895
|
+
var Clock_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
|
|
896
|
+
|
|
897
|
+
// esm-externals:@splunk/react-icons/enterprise/Pencil
|
|
898
|
+
var Pencil_exports = {};
|
|
899
|
+
__export(Pencil_exports, {
|
|
900
|
+
default: () => Pencil_default
|
|
901
|
+
});
|
|
902
|
+
var defaultImport22 = __toESM(require("@splunk/react-icons/enterprise/Pencil"));
|
|
903
|
+
__reExport(Pencil_exports, require("@splunk/react-icons/enterprise/Pencil"));
|
|
904
|
+
var Pencil_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
|
|
905
|
+
|
|
906
|
+
// esm-externals:@splunk/react-icons/enterprise/Star
|
|
907
|
+
var Star_exports = {};
|
|
908
|
+
__export(Star_exports, {
|
|
909
|
+
default: () => Star_default
|
|
910
|
+
});
|
|
911
|
+
var defaultImport23 = __toESM(require("@splunk/react-icons/enterprise/Star"));
|
|
912
|
+
__reExport(Star_exports, require("@splunk/react-icons/enterprise/Star"));
|
|
913
|
+
var Star_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
|
|
914
|
+
|
|
915
|
+
// esm-externals:@splunk/react-icons/enterprise/Question
|
|
916
|
+
var Question_exports = {};
|
|
917
|
+
__export(Question_exports, {
|
|
918
|
+
default: () => Question_default
|
|
919
|
+
});
|
|
920
|
+
var defaultImport24 = __toESM(require("@splunk/react-icons/enterprise/Question"));
|
|
921
|
+
__reExport(Question_exports, require("@splunk/react-icons/enterprise/Question"));
|
|
922
|
+
var Question_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
|
|
681
923
|
|
|
682
924
|
// src/SingleValueIcon/PureSingleValueIcon/utils/iconUtils.js
|
|
683
925
|
var ICON_POSITIONS = ["before", "after", "top", "below"];
|
|
@@ -757,7 +999,7 @@ IconContainer.propTypes = {
|
|
|
757
999
|
var IconContainer_default = IconContainer;
|
|
758
1000
|
|
|
759
1001
|
// src/SingleValueIcon/PureSingleValueIcon/SingleValueIconLayout.jsx
|
|
760
|
-
var
|
|
1002
|
+
var Column3 = styled_components_default.div`
|
|
761
1003
|
display: flex;
|
|
762
1004
|
flex-direction: column;
|
|
763
1005
|
justify-content: center;
|
|
@@ -844,7 +1086,7 @@ var SingleValueIconLayout = (_a) => {
|
|
|
844
1086
|
} else {
|
|
845
1087
|
iconLayout = /* @__PURE__ */ react_default.createElement(IconColumn, { align, "data-test": `single-value-icon-align-${getAligment(align)}` }, iconPosition === "top" && iconContainer, singleValueBasic, iconPosition === "below" && iconContainer);
|
|
846
1088
|
}
|
|
847
|
-
return /* @__PURE__ */ react_default.createElement(
|
|
1089
|
+
return /* @__PURE__ */ react_default.createElement(Column3, null, iconLayout);
|
|
848
1090
|
};
|
|
849
1091
|
SingleValueIconLayout.propTypes = __spreadProps(__spreadValues({}, SingleValueBasic_default.propTypes), {
|
|
850
1092
|
iconWidth: prop_types_default.number,
|
|
@@ -860,6 +1102,34 @@ SingleValueIconLayout.propTypes = __spreadProps(__spreadValues({}, SingleValueBa
|
|
|
860
1102
|
});
|
|
861
1103
|
var SingleValueIconLayout_default = SingleValueIconLayout;
|
|
862
1104
|
|
|
1105
|
+
// esm-externals:@splunk/visualization-context/FeatureFlagContext
|
|
1106
|
+
var FeatureFlagContext_exports = {};
|
|
1107
|
+
__export(FeatureFlagContext_exports, {
|
|
1108
|
+
default: () => FeatureFlagContext_default
|
|
1109
|
+
});
|
|
1110
|
+
var defaultImport25 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
|
|
1111
|
+
__reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
|
|
1112
|
+
var FeatureFlagContext_default = "default" in defaultImport25 ? defaultImport25.default : defaultImport25;
|
|
1113
|
+
|
|
1114
|
+
// esm-externals:@splunk/visualization-schemas
|
|
1115
|
+
var visualization_schemas_exports = {};
|
|
1116
|
+
__export(visualization_schemas_exports, {
|
|
1117
|
+
default: () => visualization_schemas_default
|
|
1118
|
+
});
|
|
1119
|
+
var defaultImport26 = __toESM(require("@splunk/visualization-schemas"));
|
|
1120
|
+
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
1121
|
+
var visualization_schemas_default = "default" in defaultImport26 ? defaultImport26.default : defaultImport26;
|
|
1122
|
+
|
|
1123
|
+
// src/common/hooks/useTrellisEnabled.ts
|
|
1124
|
+
var useTrellisFeatureFlagOn = () => {
|
|
1125
|
+
const context = (0, react_exports.useContext)(FeatureFlagContext_default);
|
|
1126
|
+
return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
|
|
1127
|
+
};
|
|
1128
|
+
var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
|
|
1129
|
+
const trellisFeatureEnabled = useTrellisFeatureFlagOn();
|
|
1130
|
+
return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1131
|
+
};
|
|
1132
|
+
|
|
863
1133
|
// src/SingleValueIcon/PureSingleValueIcon/SingleValueIcon.jsx
|
|
864
1134
|
var Container = styled_components_default.div`
|
|
865
1135
|
overflow: hidden;
|
|
@@ -873,6 +1143,7 @@ var SingleValueIcon = (_a) => {
|
|
|
873
1143
|
style,
|
|
874
1144
|
majorFontSize,
|
|
875
1145
|
majorValue,
|
|
1146
|
+
majorValueDisplay,
|
|
876
1147
|
majorValueField,
|
|
877
1148
|
trendValue,
|
|
878
1149
|
trendFontSize,
|
|
@@ -908,11 +1179,7 @@ var SingleValueIcon = (_a) => {
|
|
|
908
1179
|
defaultFontColor: defaultColors.defaultFontColor,
|
|
909
1180
|
defaultBlockFontColor: defaultColors.defaultBlockFontColor
|
|
910
1181
|
});
|
|
911
|
-
const
|
|
912
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
913
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
914
|
-
);
|
|
915
|
-
const trellisEnabled = isTrellisFeatureFlagOn && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1182
|
+
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
916
1183
|
const handleValueClick = (0, react_exports.useCallback)(
|
|
917
1184
|
(ev) => handleValueClickCallback(
|
|
918
1185
|
ev,
|
|
@@ -993,6 +1260,7 @@ var SingleValueIcon = (_a) => {
|
|
|
993
1260
|
smallVizProps
|
|
994
1261
|
} = computeSingleValueContent({
|
|
995
1262
|
majorValue,
|
|
1263
|
+
majorValueDisplay: majorValueDisplay || majorValue,
|
|
996
1264
|
trendValue,
|
|
997
1265
|
majorFontSize,
|
|
998
1266
|
trendFontSize,
|
|
@@ -1059,7 +1327,7 @@ var SingleValueIcon = (_a) => {
|
|
|
1059
1327
|
IconLayout
|
|
1060
1328
|
);
|
|
1061
1329
|
};
|
|
1062
|
-
if (
|
|
1330
|
+
if (trellisEnabled) {
|
|
1063
1331
|
return /* @__PURE__ */ react_default.createElement(react_default.Fragment, null, /* @__PURE__ */ react_default.createElement(
|
|
1064
1332
|
TrellisTitle,
|
|
1065
1333
|
{
|
|
@@ -1076,6 +1344,7 @@ SingleValueIcon.propTypes = {
|
|
|
1076
1344
|
height: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
1077
1345
|
style: prop_types_default.object,
|
|
1078
1346
|
majorValue: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
1347
|
+
majorValueDisplay: prop_types_default.oneOfType([prop_types_default.string, prop_types_default.number]),
|
|
1079
1348
|
majorValueField: prop_types_default.string,
|
|
1080
1349
|
majorColor: prop_types_default.string,
|
|
1081
1350
|
majorFontSize: prop_types_default.number,
|
|
@@ -1137,81 +1406,81 @@ var getSettingsFromThemedProps_exports = {};
|
|
|
1137
1406
|
__export(getSettingsFromThemedProps_exports, {
|
|
1138
1407
|
default: () => getSettingsFromThemedProps_default
|
|
1139
1408
|
});
|
|
1140
|
-
var
|
|
1409
|
+
var defaultImport27 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
|
|
1141
1410
|
__reExport(getSettingsFromThemedProps_exports, require("@splunk/themes/getSettingsFromThemedProps"));
|
|
1142
|
-
var getSettingsFromThemedProps_default = "default" in
|
|
1411
|
+
var getSettingsFromThemedProps_default = "default" in defaultImport27 ? defaultImport27.default : defaultImport27;
|
|
1143
1412
|
|
|
1144
1413
|
// esm-externals:@splunk/visualization-encoding/Options
|
|
1145
1414
|
var Options_exports = {};
|
|
1146
1415
|
__export(Options_exports, {
|
|
1147
1416
|
default: () => Options_default
|
|
1148
1417
|
});
|
|
1149
|
-
var
|
|
1418
|
+
var defaultImport28 = __toESM(require("@splunk/visualization-encoding/Options"));
|
|
1150
1419
|
__reExport(Options_exports, require("@splunk/visualization-encoding/Options"));
|
|
1151
|
-
var Options_default = "default" in
|
|
1420
|
+
var Options_default = "default" in defaultImport28 ? defaultImport28.default : defaultImport28;
|
|
1152
1421
|
|
|
1153
1422
|
// esm-externals:@splunk/visualizations-shared/SanitizeProps
|
|
1154
1423
|
var SanitizeProps_exports = {};
|
|
1155
1424
|
__export(SanitizeProps_exports, {
|
|
1156
1425
|
default: () => SanitizeProps_default
|
|
1157
1426
|
});
|
|
1158
|
-
var
|
|
1427
|
+
var defaultImport29 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
|
|
1159
1428
|
__reExport(SanitizeProps_exports, require("@splunk/visualizations-shared/SanitizeProps"));
|
|
1160
|
-
var SanitizeProps_default = "default" in
|
|
1429
|
+
var SanitizeProps_default = "default" in defaultImport29 ? defaultImport29.default : defaultImport29;
|
|
1161
1430
|
|
|
1162
1431
|
// esm-externals:@splunk/visualization-context/TimezoneContext
|
|
1163
1432
|
var TimezoneContext_exports = {};
|
|
1164
1433
|
__export(TimezoneContext_exports, {
|
|
1165
1434
|
default: () => TimezoneContext_default
|
|
1166
1435
|
});
|
|
1167
|
-
var
|
|
1436
|
+
var defaultImport30 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
|
|
1168
1437
|
__reExport(TimezoneContext_exports, require("@splunk/visualization-context/TimezoneContext"));
|
|
1169
|
-
var TimezoneContext_default = "default" in
|
|
1438
|
+
var TimezoneContext_default = "default" in defaultImport30 ? defaultImport30.default : defaultImport30;
|
|
1170
1439
|
|
|
1171
1440
|
// esm-externals:@splunk/moment
|
|
1172
1441
|
var moment_exports = {};
|
|
1173
1442
|
__export(moment_exports, {
|
|
1174
1443
|
default: () => moment_default
|
|
1175
1444
|
});
|
|
1176
|
-
var
|
|
1445
|
+
var defaultImport31 = __toESM(require("@splunk/moment"));
|
|
1177
1446
|
__reExport(moment_exports, require("@splunk/moment"));
|
|
1178
|
-
var moment_default = "default" in
|
|
1447
|
+
var moment_default = "default" in defaultImport31 ? defaultImport31.default : defaultImport31;
|
|
1179
1448
|
|
|
1180
1449
|
// esm-externals:@splunk/visualizations-shared/hocUtils
|
|
1181
1450
|
var hocUtils_exports = {};
|
|
1182
1451
|
__export(hocUtils_exports, {
|
|
1183
1452
|
default: () => hocUtils_default
|
|
1184
1453
|
});
|
|
1185
|
-
var
|
|
1454
|
+
var defaultImport32 = __toESM(require("@splunk/visualizations-shared/hocUtils"));
|
|
1186
1455
|
__reExport(hocUtils_exports, require("@splunk/visualizations-shared/hocUtils"));
|
|
1187
|
-
var hocUtils_default = "default" in
|
|
1456
|
+
var hocUtils_default = "default" in defaultImport32 ? defaultImport32.default : defaultImport32;
|
|
1188
1457
|
|
|
1189
1458
|
// esm-externals:@splunk/visualizations-shared/JSONSchemaUtils
|
|
1190
1459
|
var JSONSchemaUtils_exports = {};
|
|
1191
1460
|
__export(JSONSchemaUtils_exports, {
|
|
1192
1461
|
default: () => JSONSchemaUtils_default
|
|
1193
1462
|
});
|
|
1194
|
-
var
|
|
1463
|
+
var defaultImport33 = __toESM(require("@splunk/visualizations-shared/JSONSchemaUtils"));
|
|
1195
1464
|
__reExport(JSONSchemaUtils_exports, require("@splunk/visualizations-shared/JSONSchemaUtils"));
|
|
1196
|
-
var JSONSchemaUtils_default = "default" in
|
|
1465
|
+
var JSONSchemaUtils_default = "default" in defaultImport33 ? defaultImport33.default : defaultImport33;
|
|
1197
1466
|
|
|
1198
1467
|
// esm-externals:@splunk/async-dynamic-options-evaluator
|
|
1199
1468
|
var async_dynamic_options_evaluator_exports = {};
|
|
1200
1469
|
__export(async_dynamic_options_evaluator_exports, {
|
|
1201
1470
|
default: () => async_dynamic_options_evaluator_default
|
|
1202
1471
|
});
|
|
1203
|
-
var
|
|
1472
|
+
var defaultImport34 = __toESM(require("@splunk/async-dynamic-options-evaluator"));
|
|
1204
1473
|
__reExport(async_dynamic_options_evaluator_exports, require("@splunk/async-dynamic-options-evaluator"));
|
|
1205
|
-
var async_dynamic_options_evaluator_default = "default" in
|
|
1474
|
+
var async_dynamic_options_evaluator_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
|
|
1206
1475
|
|
|
1207
1476
|
// esm-externals:@splunk/ui-utils/id
|
|
1208
1477
|
var id_exports = {};
|
|
1209
1478
|
__export(id_exports, {
|
|
1210
1479
|
default: () => id_default
|
|
1211
1480
|
});
|
|
1212
|
-
var
|
|
1481
|
+
var defaultImport35 = __toESM(require("@splunk/ui-utils/id"));
|
|
1213
1482
|
__reExport(id_exports, require("@splunk/ui-utils/id"));
|
|
1214
|
-
var id_default = "default" in
|
|
1483
|
+
var id_default = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
|
|
1215
1484
|
|
|
1216
1485
|
// src/common/interfaces/VizActionHandler.ts
|
|
1217
1486
|
var DefaultVizActionHandler = class {
|
|
@@ -1419,9 +1688,9 @@ var colorUtils_exports = {};
|
|
|
1419
1688
|
__export(colorUtils_exports, {
|
|
1420
1689
|
default: () => colorUtils_default
|
|
1421
1690
|
});
|
|
1422
|
-
var
|
|
1691
|
+
var defaultImport36 = __toESM(require("@splunk/visualizations-shared/colorUtils"));
|
|
1423
1692
|
__reExport(colorUtils_exports, require("@splunk/visualizations-shared/colorUtils"));
|
|
1424
|
-
var colorUtils_default = "default" in
|
|
1693
|
+
var colorUtils_default = "default" in defaultImport36 ? defaultImport36.default : defaultImport36;
|
|
1425
1694
|
|
|
1426
1695
|
// src/common/hocs/FixedSizeContainer.tsx
|
|
1427
1696
|
var Item = styled_components_default.div.attrs(({ width }) => ({
|
|
@@ -1468,7 +1737,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
1468
1737
|
FixSizeItem,
|
|
1469
1738
|
{
|
|
1470
1739
|
"data-test": "fix-size-item",
|
|
1471
|
-
"data-splunk-visualization-version": "27.
|
|
1740
|
+
"data-splunk-visualization-version": "27.2.0 - 2e7eda8d4",
|
|
1472
1741
|
width,
|
|
1473
1742
|
height,
|
|
1474
1743
|
backgroundColor
|
|
@@ -1534,7 +1803,7 @@ var Cover = styled_components_default.div`
|
|
|
1534
1803
|
bottom: 0;
|
|
1535
1804
|
`;
|
|
1536
1805
|
var Blocker = styled_components_default.div.attrs({
|
|
1537
|
-
"data-splunk-visualization-version": "27.
|
|
1806
|
+
"data-splunk-visualization-version": "27.2.0 - 2e7eda8d4"
|
|
1538
1807
|
})`
|
|
1539
1808
|
position: relative;
|
|
1540
1809
|
width: 100%;
|
|
@@ -1556,9 +1825,9 @@ var variables_exports = {};
|
|
|
1556
1825
|
__export(variables_exports, {
|
|
1557
1826
|
default: () => variables_default
|
|
1558
1827
|
});
|
|
1559
|
-
var
|
|
1828
|
+
var defaultImport37 = __toESM(require("@splunk/themes/variables"));
|
|
1560
1829
|
__reExport(variables_exports, require("@splunk/themes/variables"));
|
|
1561
|
-
var variables_default = "default" in
|
|
1830
|
+
var variables_default = "default" in defaultImport37 ? defaultImport37.default : defaultImport37;
|
|
1562
1831
|
|
|
1563
1832
|
// src/common/components/IconPlaceholder.tsx
|
|
1564
1833
|
var shouldShowIconPlaceholder = (dataSources, loading = false) => {
|
|
@@ -2006,9 +2275,9 @@ var FeatureFlags_exports = {};
|
|
|
2006
2275
|
__export(FeatureFlags_exports, {
|
|
2007
2276
|
default: () => FeatureFlags_default
|
|
2008
2277
|
});
|
|
2009
|
-
var
|
|
2278
|
+
var defaultImport38 = __toESM(require("@splunk/visualization-context/FeatureFlags"));
|
|
2010
2279
|
__reExport(FeatureFlags_exports, require("@splunk/visualization-context/FeatureFlags"));
|
|
2011
|
-
var FeatureFlags_default = "default" in
|
|
2280
|
+
var FeatureFlags_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
|
|
2012
2281
|
|
|
2013
2282
|
// src/common/utils/featureFlagUtils.ts
|
|
2014
2283
|
var getFeatureFlag = (context, flagName) => {
|
|
@@ -2021,1325 +2290,1368 @@ var getFeatureFlag = (context, flagName) => {
|
|
|
2021
2290
|
return false;
|
|
2022
2291
|
};
|
|
2023
2292
|
|
|
2024
|
-
//
|
|
2025
|
-
var
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
} = props;
|
|
2052
|
-
const { serializedTimezone } = react_exports.useContext(TimezoneContext_default);
|
|
2053
|
-
if (serializedTimezone) {
|
|
2054
|
-
if (!moment_default.getDefaultSplunkTimezone()) {
|
|
2055
|
-
moment_default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2293
|
+
// esm-externals:@splunk/visualizations-shared/trellisUtils
|
|
2294
|
+
var trellisUtils_exports = {};
|
|
2295
|
+
__export(trellisUtils_exports, {
|
|
2296
|
+
default: () => trellisUtils_default
|
|
2297
|
+
});
|
|
2298
|
+
var defaultImport39 = __toESM(require("@splunk/visualizations-shared/trellisUtils"));
|
|
2299
|
+
__reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisUtils"));
|
|
2300
|
+
var trellisUtils_default = "default" in defaultImport39 ? defaultImport39.default : defaultImport39;
|
|
2301
|
+
|
|
2302
|
+
// src/common/utils/trellisUtils.ts
|
|
2303
|
+
var AGGREGATIONS = "aggregations";
|
|
2304
|
+
var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
2305
|
+
var _a, _b, _c, _d;
|
|
2306
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2307
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2308
|
+
let splitDataSources = null;
|
|
2309
|
+
let errorCode = null;
|
|
2310
|
+
if (fields && fields.length) {
|
|
2311
|
+
splitDataSources = {};
|
|
2312
|
+
for (let i = 0; i < fields.length; i += 1) {
|
|
2313
|
+
const fieldName = fields[i].name;
|
|
2314
|
+
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
2315
|
+
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
2316
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2317
|
+
);
|
|
2318
|
+
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
2319
|
+
splitDataSources[fieldName].primary.data.columns = [columns[i]];
|
|
2056
2320
|
}
|
|
2057
2321
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
[options, context]
|
|
2087
|
-
);
|
|
2088
|
-
const [threshold, setThreshold] = react_exports.useState(Number(width));
|
|
2089
|
-
const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
|
|
2090
|
-
setThreshold(newThreshold);
|
|
2091
|
-
}, []);
|
|
2092
|
-
const isDownsamplingEnabled = react_exports.useMemo(() => {
|
|
2093
|
-
return isDownsamplingEnabledByFeatureFlag && isDownsamplingEnabledForViz({ vizConfig });
|
|
2094
|
-
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
2095
|
-
const downsamplingProps = react_exports.useMemo(() => {
|
|
2096
|
-
if (!isDownsamplingEnabled) {
|
|
2097
|
-
return {};
|
|
2098
|
-
}
|
|
2099
|
-
return {
|
|
2100
|
-
onDownsamplingThresholdChange,
|
|
2101
|
-
originalDataSources: dataSources
|
|
2102
|
-
};
|
|
2103
|
-
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
2104
|
-
const downsampledDataSources = useDownsampleDataSources_default({
|
|
2105
|
-
options: optionsToEvaluate.options,
|
|
2106
|
-
context: optionsToEvaluate.context,
|
|
2107
|
-
dataSources,
|
|
2108
|
-
threshold,
|
|
2109
|
-
isDownsamplingEnabled
|
|
2110
|
-
});
|
|
2111
|
-
evaluatedOptions = useDeepMemo(() => {
|
|
2112
|
-
try {
|
|
2113
|
-
if (useAsyncEvaluatedOptions) {
|
|
2114
|
-
const asyncDynamicOptionsEvaluatorParams = {
|
|
2115
|
-
visualizationID,
|
|
2116
|
-
props,
|
|
2117
|
-
options: optionsToEvaluate,
|
|
2118
|
-
dataSources: downsampledDataSources,
|
|
2119
|
-
theme: vizConfig.themes,
|
|
2120
|
-
bypassCloneDeepOptionScope: Boolean(
|
|
2121
|
-
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
2122
|
-
),
|
|
2123
|
-
lazyLoadingDataFrame: Boolean(
|
|
2124
|
-
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
2125
|
-
)
|
|
2126
|
-
};
|
|
2127
|
-
async_dynamic_options_evaluator_default.evaluate(asyncDynamicOptionsEvaluatorParams).then((results) => {
|
|
2128
|
-
setEvaluatedOptionsAsync(results.results);
|
|
2129
|
-
}).catch(() => {
|
|
2130
|
-
if (isMounted.current) {
|
|
2131
|
-
setUseAsyncEvaluatedOptions(false);
|
|
2132
|
-
}
|
|
2133
|
-
});
|
|
2134
|
-
} else {
|
|
2135
|
-
let dataFrames = dataFramesInState;
|
|
2136
|
-
if (downsampledDataSources !== dataSourcesInState) {
|
|
2137
|
-
setDataSourcesInState(downsampledDataSources);
|
|
2138
|
-
dataFrames = Options_exports.Options.dataFrameFromDataSource(
|
|
2139
|
-
downsampledDataSources,
|
|
2140
|
-
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
2141
|
-
);
|
|
2142
|
-
setDataFramesInState(dataFrames);
|
|
2143
|
-
}
|
|
2144
|
-
const result = Options_exports.Options.evaluate(
|
|
2145
|
-
optionsToEvaluate,
|
|
2146
|
-
downsampledDataSources,
|
|
2147
|
-
themeFunc,
|
|
2148
|
-
dataFrames,
|
|
2149
|
-
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
2150
|
-
);
|
|
2151
|
-
return result;
|
|
2322
|
+
} else {
|
|
2323
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2324
|
+
}
|
|
2325
|
+
return { splitDataSources, errorCode };
|
|
2326
|
+
};
|
|
2327
|
+
var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
2328
|
+
var _a, _b, _c, _d;
|
|
2329
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2330
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2331
|
+
let splitDataSources = null;
|
|
2332
|
+
let splitByFields = [];
|
|
2333
|
+
let errorCode = null;
|
|
2334
|
+
if (typeof fields[0] !== "string") {
|
|
2335
|
+
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2336
|
+
}
|
|
2337
|
+
if (splitByFields && splitByFields.length > 0) {
|
|
2338
|
+
splitDataSources = {};
|
|
2339
|
+
splitByFields.forEach((splitByField) => {
|
|
2340
|
+
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
2341
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2342
|
+
);
|
|
2343
|
+
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
2344
|
+
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
2345
|
+
fields.forEach((field, idx) => {
|
|
2346
|
+
const fieldName = field == null ? void 0 : field.name;
|
|
2347
|
+
if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
|
|
2348
|
+
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
2349
|
+
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
2152
2350
|
}
|
|
2153
|
-
} catch (e) {
|
|
2154
|
-
console.error(`unexpected error evaluating options: ${e.message}`);
|
|
2155
|
-
return {};
|
|
2156
|
-
}
|
|
2157
|
-
return {};
|
|
2158
|
-
}, [
|
|
2159
|
-
currentThemeFamily,
|
|
2160
|
-
currentThemeColorScheme,
|
|
2161
|
-
currentThemeDensity,
|
|
2162
|
-
optionsToEvaluate,
|
|
2163
|
-
downsampledDataSources,
|
|
2164
|
-
serializedTimezone,
|
|
2165
|
-
useAsyncEvaluatedOptions
|
|
2166
|
-
]);
|
|
2167
|
-
const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
2168
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2169
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2170
|
-
);
|
|
2171
|
-
let clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
2172
|
-
if (isTrellisFeatureFlagOn && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.splitByLayout) === "trellis" /* TRELLIS */) {
|
|
2173
|
-
clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
|
|
2174
|
-
backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
2175
2351
|
});
|
|
2176
|
-
}
|
|
2177
|
-
react_exports.useEffect(() => {
|
|
2178
|
-
onComputedProps(clonedEvaluatedOptions);
|
|
2179
2352
|
});
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2353
|
+
} else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
|
|
2354
|
+
splitDataSources = {};
|
|
2355
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2356
|
+
const fieldName = fields[i].name;
|
|
2357
|
+
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
2358
|
+
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
2359
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2360
|
+
);
|
|
2361
|
+
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
2362
|
+
splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
} else {
|
|
2366
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2367
|
+
}
|
|
2368
|
+
return { splitDataSources, errorCode };
|
|
2369
|
+
};
|
|
2370
|
+
var dataSourcesSplitByAggregationsStats = (dataSource) => {
|
|
2371
|
+
var _a, _b, _c, _d;
|
|
2372
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2373
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2374
|
+
let splitDataSources = null;
|
|
2375
|
+
let splitByFields = [];
|
|
2376
|
+
let errorCode = null;
|
|
2377
|
+
if (typeof fields[0] !== "string") {
|
|
2378
|
+
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
|
|
2379
|
+
}
|
|
2380
|
+
if (splitByFields && splitByFields.length > 0) {
|
|
2381
|
+
splitDataSources = {};
|
|
2382
|
+
splitByFields.forEach((splitByField) => {
|
|
2383
|
+
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
2384
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2200
2385
|
);
|
|
2386
|
+
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
2387
|
+
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
2388
|
+
const idx = fields.findIndex((field) => field.name === splitByField);
|
|
2389
|
+
if (idx > 0) {
|
|
2390
|
+
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
2391
|
+
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
2392
|
+
}
|
|
2393
|
+
});
|
|
2394
|
+
} else {
|
|
2395
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2396
|
+
}
|
|
2397
|
+
return { splitDataSources, errorCode };
|
|
2398
|
+
};
|
|
2399
|
+
var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
2400
|
+
var _a, _b, _c, _d, _e;
|
|
2401
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2402
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2403
|
+
let splitDataSources = null;
|
|
2404
|
+
let splitByFields = [];
|
|
2405
|
+
let errorCode = null;
|
|
2406
|
+
if (typeof fields[0] !== "string") {
|
|
2407
|
+
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
2408
|
+
}
|
|
2409
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
2410
|
+
splitDataSources = {};
|
|
2411
|
+
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2412
|
+
const valueKeys = [];
|
|
2413
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2414
|
+
if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
|
|
2415
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
2416
|
+
}
|
|
2201
2417
|
}
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
if (
|
|
2216
|
-
|
|
2418
|
+
valueKeys.forEach((val) => {
|
|
2419
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2420
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2421
|
+
);
|
|
2422
|
+
splitDataSources[val].primary.data.fields = [
|
|
2423
|
+
{ name: fields[0].name },
|
|
2424
|
+
...dataSourceKeys.map((k) => ({
|
|
2425
|
+
name: k
|
|
2426
|
+
}))
|
|
2427
|
+
];
|
|
2428
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
2429
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
2430
|
+
fields.forEach((field, idx) => {
|
|
2431
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
2432
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
2217
2433
|
}
|
|
2218
|
-
|
|
2219
|
-
};
|
|
2220
|
-
if (parentKeys) {
|
|
2221
|
-
for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
2222
|
-
const newObject = {};
|
|
2223
|
-
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
2224
|
-
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2434
|
+
});
|
|
2227
2435
|
});
|
|
2436
|
+
});
|
|
2437
|
+
} else {
|
|
2438
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2439
|
+
}
|
|
2440
|
+
return { splitDataSources, errorCode };
|
|
2441
|
+
};
|
|
2442
|
+
var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
2443
|
+
var _a, _b, _c, _d;
|
|
2444
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2445
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2446
|
+
let splitDataSources = null;
|
|
2447
|
+
let splitByFields = [];
|
|
2448
|
+
let errorCode = null;
|
|
2449
|
+
if (typeof fields[0] !== "string") {
|
|
2450
|
+
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
2451
|
+
}
|
|
2452
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
2453
|
+
splitDataSources = {};
|
|
2454
|
+
const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
|
|
2455
|
+
const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
|
|
2456
|
+
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2457
|
+
const nonDataSourceAggregations = [];
|
|
2458
|
+
if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
|
|
2459
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2460
|
+
nonDataSourceAggregations.push(fields[i].name);
|
|
2461
|
+
}
|
|
2228
2462
|
}
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2463
|
+
if (splitByFieldIdx === 0) {
|
|
2464
|
+
const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
|
|
2465
|
+
valueKeys.forEach((val, idx) => {
|
|
2466
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2467
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2468
|
+
);
|
|
2469
|
+
splitDataSources[val].primary.data.fields = [];
|
|
2470
|
+
if (otherSplitBy.length) {
|
|
2471
|
+
splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
|
|
2472
|
+
}
|
|
2473
|
+
if (dataSourceKeys.length) {
|
|
2474
|
+
const columnValues = [[]];
|
|
2475
|
+
splitDataSources[val].primary.data.fields = [
|
|
2476
|
+
...splitDataSources[val].primary.data.fields,
|
|
2477
|
+
...dataSourceKeys.map((k) => ({
|
|
2478
|
+
name: k
|
|
2479
|
+
}))
|
|
2480
|
+
];
|
|
2481
|
+
dataSourceKeys.forEach(() => {
|
|
2482
|
+
columnValues.push([]);
|
|
2483
|
+
});
|
|
2484
|
+
for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
|
|
2485
|
+
columnValues[0].push(
|
|
2486
|
+
fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
|
|
2487
|
+
);
|
|
2488
|
+
dataSourceKeys.forEach((dskey, dsIndx) => {
|
|
2489
|
+
const mul = (fields.length - 1) / dataSourceKeys.length;
|
|
2490
|
+
columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
2494
|
+
} else if (nonDataSourceAggregations.length) {
|
|
2495
|
+
const columnValues = [];
|
|
2496
|
+
fields.forEach((aggregationField, fieldIdx) => {
|
|
2497
|
+
if (fieldIdx > 0) {
|
|
2498
|
+
splitDataSources[val].primary.data.fields.push(aggregationField);
|
|
2499
|
+
columnValues.push([columns[fieldIdx][idx]]);
|
|
2500
|
+
}
|
|
2501
|
+
});
|
|
2502
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
2503
|
+
}
|
|
2243
2504
|
});
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2505
|
+
} else {
|
|
2506
|
+
const valueKeys = [];
|
|
2507
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2508
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
2509
|
+
}
|
|
2510
|
+
valueKeys.forEach((val) => {
|
|
2511
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2512
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2513
|
+
);
|
|
2514
|
+
splitDataSources[val].primary.data.fields = [
|
|
2515
|
+
{ name: otherSplitBy[0] },
|
|
2516
|
+
...dataSourceKeys.map((k) => ({
|
|
2517
|
+
name: k
|
|
2518
|
+
}))
|
|
2519
|
+
];
|
|
2520
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
2521
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
2522
|
+
fields.forEach((field, idx) => {
|
|
2523
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
2524
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
2525
|
+
}
|
|
2526
|
+
});
|
|
2527
|
+
});
|
|
2248
2528
|
});
|
|
2249
|
-
dataSourceMetadata = {
|
|
2250
|
-
sortParams,
|
|
2251
|
-
paginatorParams
|
|
2252
|
-
};
|
|
2253
2529
|
}
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
DashboardViz.config = vizConfig;
|
|
2272
|
-
return (0, styled_components_exports.withTheme)(
|
|
2273
|
-
withPlaceholder_default(withEditModeCover_default(DashboardViz, disableEditModeCover), useIconPlaceholder)
|
|
2530
|
+
} else {
|
|
2531
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2532
|
+
}
|
|
2533
|
+
return { splitDataSources, errorCode };
|
|
2534
|
+
};
|
|
2535
|
+
var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
2536
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2537
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2538
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2539
|
+
let splitDataSources = null;
|
|
2540
|
+
let splitByFields = [];
|
|
2541
|
+
let errorCode = null;
|
|
2542
|
+
if (typeof fields[0] !== "string") {
|
|
2543
|
+
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
2544
|
+
}
|
|
2545
|
+
const splitByIndex = fields == null ? void 0 : fields.findIndex(
|
|
2546
|
+
(field) => field === splitBy || field.name === splitBy
|
|
2274
2547
|
);
|
|
2548
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
2549
|
+
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
2550
|
+
splitDataSources = {};
|
|
2551
|
+
splitByColumn.forEach((val, idx) => {
|
|
2552
|
+
if (!splitDataSources[val]) {
|
|
2553
|
+
splitDataSources[val] = [idx];
|
|
2554
|
+
} else {
|
|
2555
|
+
splitDataSources[val].push(idx);
|
|
2556
|
+
}
|
|
2557
|
+
});
|
|
2558
|
+
const cloneFields = (0, lodash_exports.cloneDeep)(fields);
|
|
2559
|
+
cloneFields.splice(splitByIndex, 1);
|
|
2560
|
+
const valueKeys = Object.keys(splitDataSources);
|
|
2561
|
+
valueKeys.forEach((val) => {
|
|
2562
|
+
const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
|
|
2563
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2564
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2565
|
+
);
|
|
2566
|
+
splitDataSources[val].primary.data.fields = cloneFields;
|
|
2567
|
+
splitDataSources[val].primary.data.columns = [];
|
|
2568
|
+
columns.forEach((col, idx) => {
|
|
2569
|
+
if (idx !== splitByIndex) {
|
|
2570
|
+
const newCol = valIndices.map((valIdx) => col[valIdx]);
|
|
2571
|
+
splitDataSources[val].primary.data.columns.push(newCol);
|
|
2572
|
+
}
|
|
2573
|
+
});
|
|
2574
|
+
});
|
|
2575
|
+
} else {
|
|
2576
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2577
|
+
}
|
|
2578
|
+
return { splitDataSources, errorCode };
|
|
2275
2579
|
};
|
|
2276
|
-
var
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
// esm-externals:@splunk/themes/pick
|
|
2288
|
-
var pick_exports2 = {};
|
|
2289
|
-
__export(pick_exports2, {
|
|
2290
|
-
default: () => pick_default2
|
|
2291
|
-
});
|
|
2292
|
-
var defaultImport38 = __toESM(require("@splunk/themes/pick"));
|
|
2293
|
-
__reExport(pick_exports2, require("@splunk/themes/pick"));
|
|
2294
|
-
var pick_default2 = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
|
|
2295
|
-
|
|
2296
|
-
// esm-externals:@splunk/visualizations-shared/configUtils
|
|
2297
|
-
var configUtils_exports = {};
|
|
2298
|
-
__export(configUtils_exports, {
|
|
2299
|
-
default: () => configUtils_default
|
|
2300
|
-
});
|
|
2301
|
-
var defaultImport39 = __toESM(require("@splunk/visualizations-shared/configUtils"));
|
|
2302
|
-
__reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
|
|
2303
|
-
var configUtils_default = "default" in defaultImport39 ? defaultImport39.default : defaultImport39;
|
|
2304
|
-
|
|
2305
|
-
// src/common/configContext/singleValueContext.ts
|
|
2306
|
-
var defaultContext = {
|
|
2307
|
-
trendColorConfig: [
|
|
2308
|
-
{
|
|
2309
|
-
to: 0,
|
|
2310
|
-
value: "#9E2520"
|
|
2311
|
-
},
|
|
2312
|
-
{
|
|
2313
|
-
from: 0,
|
|
2314
|
-
value: "#1C6B2D"
|
|
2580
|
+
var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
|
|
2581
|
+
let result = null;
|
|
2582
|
+
try {
|
|
2583
|
+
if (splitMode === trellisUtils_exports.TIMECHART) {
|
|
2584
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
|
|
2585
|
+
} else if (splitMode === trellisUtils_exports.STATS) {
|
|
2586
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
|
|
2587
|
+
} else if (splitMode === trellisUtils_exports.CHART) {
|
|
2588
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
|
|
2589
|
+
} else if (splitMode === trellisUtils_exports.UNKNOWN) {
|
|
2590
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
|
|
2315
2591
|
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
{
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2592
|
+
} catch (ex) {
|
|
2593
|
+
console.error("getTrellisDataSourcesBySplitMode ", ex);
|
|
2594
|
+
result = { splitDataSources: null, errorCode: "UNKNOWN" };
|
|
2595
|
+
}
|
|
2596
|
+
return result;
|
|
2597
|
+
};
|
|
2598
|
+
var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
|
|
2599
|
+
if (isTrellisOn && !options.legendDisplay) {
|
|
2600
|
+
return {
|
|
2601
|
+
legendDisplay: "off"
|
|
2602
|
+
};
|
|
2603
|
+
}
|
|
2604
|
+
return {};
|
|
2605
|
+
};
|
|
2606
|
+
var calculateSharedMinMax = (splitData) => {
|
|
2607
|
+
let max = -Infinity;
|
|
2608
|
+
let min = Infinity;
|
|
2609
|
+
Object.keys(splitData).forEach((splitByKey) => {
|
|
2610
|
+
const datasources = splitData[splitByKey];
|
|
2611
|
+
Object.keys(datasources).forEach((datasourceName) => {
|
|
2612
|
+
const dataColumns = datasources[datasourceName].data.columns;
|
|
2613
|
+
dataColumns.forEach((column) => {
|
|
2614
|
+
column.forEach((point) => {
|
|
2615
|
+
const pointNumber = Number(point);
|
|
2616
|
+
if (pointNumber > max) {
|
|
2617
|
+
max = pointNumber;
|
|
2618
|
+
}
|
|
2619
|
+
if (pointNumber < min) {
|
|
2620
|
+
min = pointNumber;
|
|
2621
|
+
}
|
|
2622
|
+
});
|
|
2623
|
+
});
|
|
2624
|
+
});
|
|
2625
|
+
});
|
|
2626
|
+
return [min, max];
|
|
2627
|
+
};
|
|
2628
|
+
var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
|
|
2629
|
+
if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
|
|
2630
|
+
return [yAxisMin, yAxisMax];
|
|
2631
|
+
const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
|
|
2632
|
+
const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
|
|
2633
|
+
const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
|
|
2634
|
+
return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
|
|
2325
2635
|
};
|
|
2326
2636
|
|
|
2327
|
-
// src/common/
|
|
2328
|
-
var
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
option: "unitPosition",
|
|
2334
|
-
editor: "editor.select",
|
|
2335
|
-
editorProps: {
|
|
2336
|
-
values: [
|
|
2337
|
-
{ label: (0, i18n_exports._)("Before"), value: "before" },
|
|
2338
|
-
{ label: (0, i18n_exports._)("After"), value: "after" }
|
|
2339
|
-
]
|
|
2340
|
-
},
|
|
2341
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
2637
|
+
// src/common/withDashboardViz.tsx
|
|
2638
|
+
var withDashboardViz = (opts) => {
|
|
2639
|
+
const {
|
|
2640
|
+
ReactViz,
|
|
2641
|
+
vizConfig,
|
|
2642
|
+
computeVizProps: computeVizProps2 = () => {
|
|
2342
2643
|
},
|
|
2343
|
-
{
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
},
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.backgroundColor)
|
|
2371
|
-
};
|
|
2372
|
-
var StaticBackgroundColorEditor_default = StaticBackgroundColorEditor;
|
|
2373
|
-
|
|
2374
|
-
// src/common/editorConfig/StaticIconColorEditor.js
|
|
2375
|
-
var StaticIconColorEditor = [
|
|
2376
|
-
{
|
|
2377
|
-
label: (0, i18n_exports._)("Icon"),
|
|
2378
|
-
option: "iconColor",
|
|
2379
|
-
editor: "editor.color",
|
|
2380
|
-
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.iconColor),
|
|
2381
|
-
editorProps: {
|
|
2382
|
-
labelPosition: "top",
|
|
2383
|
-
value: null,
|
|
2384
|
-
palette: [null, ...colorConstants_exports.COLOR_EDITOR_PALETTE]
|
|
2385
|
-
}
|
|
2386
|
-
}
|
|
2387
|
-
];
|
|
2388
|
-
var StaticIconColorEditor_default = StaticIconColorEditor;
|
|
2389
|
-
|
|
2390
|
-
// src/common/editorConfig/StaticMajorColorEditor.js
|
|
2391
|
-
var StaticMajorColorEditor = {
|
|
2392
|
-
label: (0, i18n_exports._)("Major value"),
|
|
2393
|
-
option: "majorColor",
|
|
2394
|
-
editor: "editor.color",
|
|
2395
|
-
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.majorColor)
|
|
2396
|
-
};
|
|
2397
|
-
var StaticMajorColorEditor_default = StaticMajorColorEditor;
|
|
2398
|
-
|
|
2399
|
-
// src/common/editorConfig/StaticTrendColorEditor.js
|
|
2400
|
-
var StaticTrendColorEditor = {
|
|
2401
|
-
label: (0, i18n_exports._)("Trend value"),
|
|
2402
|
-
option: "trendColor",
|
|
2403
|
-
editor: "editor.color",
|
|
2404
|
-
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.trendColor),
|
|
2405
|
-
isDisabled: ({ options }) => options.trendDisplay === "off"
|
|
2406
|
-
};
|
|
2407
|
-
var StaticTrendColorEditor_default = StaticTrendColorEditor;
|
|
2408
|
-
|
|
2409
|
-
// src/common/editorConfig/DynamicMajorColorEditor.js
|
|
2410
|
-
var getDynamicMajorColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
2411
|
-
label: (0, i18n_exports._)("Major value"),
|
|
2412
|
-
option: "majorColor",
|
|
2413
|
-
context: "majorColorEditorConfig",
|
|
2414
|
-
editor: "editor.dynamicColor",
|
|
2415
|
-
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.majorColor),
|
|
2416
|
-
editorProps: {
|
|
2417
|
-
labelPosition: "top",
|
|
2418
|
-
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: major value"),
|
|
2419
|
-
formatters: [
|
|
2420
|
-
{
|
|
2421
|
-
label: (0, i18n_exports._)("Ranges"),
|
|
2422
|
-
value: "rangeValue",
|
|
2423
|
-
defaults: {
|
|
2424
|
-
majorValue: defaultContext2.majorColorConfig
|
|
2425
|
-
}
|
|
2426
|
-
},
|
|
2427
|
-
{
|
|
2428
|
-
label: (0, i18n_exports._)("Matches"),
|
|
2429
|
-
value: "matchValue",
|
|
2430
|
-
defaults: {
|
|
2431
|
-
majorValue: defaultContext2.majorColorMatchConfig
|
|
2432
|
-
}
|
|
2644
|
+
computeVizPropsBeforeEval: computeVizPropsBeforeEval2 = () => {
|
|
2645
|
+
},
|
|
2646
|
+
disableEditModeCover,
|
|
2647
|
+
useIconPlaceholder
|
|
2648
|
+
} = opts;
|
|
2649
|
+
const SanitizedReactViz = (0, SanitizeProps_exports.withSanitizedProps)(ReactViz);
|
|
2650
|
+
const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(vizConfig.optionsSchema, "default");
|
|
2651
|
+
const DashboardViz = (props) => {
|
|
2652
|
+
var _a;
|
|
2653
|
+
const {
|
|
2654
|
+
mode,
|
|
2655
|
+
hasEventHandlers,
|
|
2656
|
+
dataSources,
|
|
2657
|
+
// type of { [key: string]: DataSource }
|
|
2658
|
+
options,
|
|
2659
|
+
context = {},
|
|
2660
|
+
width,
|
|
2661
|
+
height,
|
|
2662
|
+
onComputedProps,
|
|
2663
|
+
onEventTrigger,
|
|
2664
|
+
theme,
|
|
2665
|
+
onRequestParamsChange
|
|
2666
|
+
} = props;
|
|
2667
|
+
const { serializedTimezone } = react_exports.useContext(TimezoneContext_default);
|
|
2668
|
+
if (serializedTimezone) {
|
|
2669
|
+
if (!moment_default.getDefaultSplunkTimezone()) {
|
|
2670
|
+
moment_default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2433
2671
|
}
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2672
|
+
}
|
|
2673
|
+
const themeFunc = (themeVar) => {
|
|
2674
|
+
var _a2, _b;
|
|
2675
|
+
return (_b = (_a2 = vizConfig.themes)[themeVar]) == null ? void 0 : _b.call(_a2, props);
|
|
2676
|
+
};
|
|
2677
|
+
const bgColorFromTheme = themeFunc("defaultBackgroundColor");
|
|
2678
|
+
const {
|
|
2679
|
+
family: currentThemeFamily,
|
|
2680
|
+
colorScheme: currentThemeColorScheme,
|
|
2681
|
+
density: currentThemeDensity
|
|
2682
|
+
} = getSettingsFromThemedProps_default({ theme });
|
|
2683
|
+
let evaluatedOptions = {};
|
|
2684
|
+
const [evaluatedOptionsAsync, setEvaluatedOptionsAsync] = react_exports.useState({});
|
|
2685
|
+
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2686
|
+
const [visualizationID] = react_exports.useState(`${vizConfig.name} - ${(0, id_exports.createGUID)()}`);
|
|
2687
|
+
const [dataSourcesInState, setDataSourcesInState] = react_exports.useState({});
|
|
2688
|
+
const [dataFramesInState, setDataFramesInState] = react_exports.useState();
|
|
2689
|
+
const [useAsyncEvaluatedOptions, setUseAsyncEvaluatedOptions] = react_exports.useState(
|
|
2690
|
+
Boolean(getFeatureFlag(featureFlagContext, "visualizations_useWebWorkersForDSL"))
|
|
2691
|
+
);
|
|
2692
|
+
const isDownsamplingEnabledByFeatureFlag = Boolean(
|
|
2693
|
+
featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
|
|
2694
|
+
);
|
|
2695
|
+
const isTrellisFeatureFlagOn2 = Boolean(
|
|
2696
|
+
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2697
|
+
);
|
|
2698
|
+
const isTrellisOn = isTrellisFeatureFlagOn2 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
|
|
2699
|
+
const isMounted = react_exports.useRef(true);
|
|
2700
|
+
const optionsToEvaluate = react_exports.useMemo(() => {
|
|
2701
|
+
var _a2;
|
|
2702
|
+
const legendDisplay = turnOffLegendDisplayWhenTrellisIsOn(isTrellisOn, options);
|
|
2703
|
+
const computedOptions = (_a2 = computeVizPropsBeforeEval2(options)) != null ? _a2 : {};
|
|
2704
|
+
return {
|
|
2705
|
+
context: (0, lodash_exports.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
2706
|
+
options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)(
|
|
2707
|
+
{},
|
|
2708
|
+
legendDisplay,
|
|
2709
|
+
computedOptions,
|
|
2710
|
+
options,
|
|
2711
|
+
defaultOptions
|
|
2712
|
+
)
|
|
2713
|
+
};
|
|
2714
|
+
}, [isTrellisOn, options, context]);
|
|
2715
|
+
const [threshold, setThreshold] = react_exports.useState(Number(width));
|
|
2716
|
+
const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
|
|
2717
|
+
setThreshold(newThreshold);
|
|
2718
|
+
}, []);
|
|
2719
|
+
const isDownsamplingEnabled = react_exports.useMemo(() => {
|
|
2720
|
+
return isDownsamplingEnabledByFeatureFlag && isDownsamplingEnabledForViz({ vizConfig });
|
|
2721
|
+
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
2722
|
+
const downsamplingProps = react_exports.useMemo(() => {
|
|
2723
|
+
if (!isDownsamplingEnabled) {
|
|
2724
|
+
return {};
|
|
2439
2725
|
}
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2726
|
+
return {
|
|
2727
|
+
onDownsamplingThresholdChange,
|
|
2728
|
+
originalDataSources: dataSources
|
|
2729
|
+
};
|
|
2730
|
+
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
2731
|
+
const downsampledDataSources = useDownsampleDataSources_default({
|
|
2732
|
+
options: optionsToEvaluate.options,
|
|
2733
|
+
context: optionsToEvaluate.context,
|
|
2734
|
+
dataSources,
|
|
2735
|
+
threshold,
|
|
2736
|
+
isDownsamplingEnabled
|
|
2737
|
+
});
|
|
2738
|
+
evaluatedOptions = useDeepMemo(() => {
|
|
2739
|
+
try {
|
|
2740
|
+
if (useAsyncEvaluatedOptions) {
|
|
2741
|
+
const asyncDynamicOptionsEvaluatorParams = {
|
|
2742
|
+
visualizationID,
|
|
2743
|
+
props,
|
|
2744
|
+
options: optionsToEvaluate,
|
|
2745
|
+
dataSources: downsampledDataSources,
|
|
2746
|
+
theme: vizConfig.themes,
|
|
2747
|
+
bypassCloneDeepOptionScope: Boolean(
|
|
2748
|
+
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
2749
|
+
),
|
|
2750
|
+
lazyLoadingDataFrame: Boolean(
|
|
2751
|
+
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
2752
|
+
)
|
|
2753
|
+
};
|
|
2754
|
+
async_dynamic_options_evaluator_default.evaluate(asyncDynamicOptionsEvaluatorParams).then((results) => {
|
|
2755
|
+
setEvaluatedOptionsAsync(results.results);
|
|
2756
|
+
}).catch(() => {
|
|
2757
|
+
if (isMounted.current) {
|
|
2758
|
+
setUseAsyncEvaluatedOptions(false);
|
|
2759
|
+
}
|
|
2760
|
+
});
|
|
2761
|
+
} else {
|
|
2762
|
+
let dataFrames = dataFramesInState;
|
|
2763
|
+
if (downsampledDataSources !== dataSourcesInState) {
|
|
2764
|
+
setDataSourcesInState(downsampledDataSources);
|
|
2765
|
+
dataFrames = Options_exports.Options.dataFrameFromDataSource(
|
|
2766
|
+
downsampledDataSources,
|
|
2767
|
+
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
2768
|
+
);
|
|
2769
|
+
setDataFramesInState(dataFrames);
|
|
2770
|
+
}
|
|
2771
|
+
const result = Options_exports.Options.evaluate(
|
|
2772
|
+
optionsToEvaluate,
|
|
2773
|
+
downsampledDataSources,
|
|
2774
|
+
themeFunc,
|
|
2775
|
+
dataFrames,
|
|
2776
|
+
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
2777
|
+
);
|
|
2778
|
+
return result;
|
|
2461
2779
|
}
|
|
2780
|
+
} catch (e) {
|
|
2781
|
+
console.error(`unexpected error evaluating options: ${e.message}`);
|
|
2782
|
+
return {};
|
|
2462
2783
|
}
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
editor: "editor.dynamicColor",
|
|
2480
|
-
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.backgroundColor),
|
|
2481
|
-
editorProps: {
|
|
2482
|
-
labelPosition: "top",
|
|
2483
|
-
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: background"),
|
|
2484
|
-
formatters: [
|
|
2485
|
-
{
|
|
2486
|
-
label: (0, i18n_exports._)("Ranges"),
|
|
2487
|
-
value: "rangeValue",
|
|
2488
|
-
defaults: {
|
|
2489
|
-
majorValue: defaultContext2.majorColorConfig,
|
|
2490
|
-
trendValue: defaultContext2.trendColorConfig
|
|
2491
|
-
}
|
|
2492
|
-
},
|
|
2493
|
-
{
|
|
2494
|
-
label: (0, i18n_exports._)("Matches"),
|
|
2495
|
-
value: "matchValue",
|
|
2496
|
-
defaults: {
|
|
2497
|
-
majorValue: defaultContext2.majorColorMatchConfig
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
],
|
|
2501
|
-
dataSelectors: [
|
|
2502
|
-
{
|
|
2503
|
-
label: (0, i18n_exports._)("Major Value"),
|
|
2504
|
-
value: "majorValue"
|
|
2505
|
-
},
|
|
2506
|
-
{
|
|
2507
|
-
label: (0, i18n_exports._)("Trend"),
|
|
2508
|
-
value: "trendValue"
|
|
2509
|
-
}
|
|
2510
|
-
],
|
|
2511
|
-
defaultPalettesConfig: defaultPalettesConfig2
|
|
2512
|
-
}
|
|
2513
|
-
});
|
|
2514
|
-
|
|
2515
|
-
// src/common/editorConfig/TrellisEditors.ts
|
|
2516
|
-
var TrellisEditorConfig = [
|
|
2517
|
-
[
|
|
2518
|
-
{
|
|
2519
|
-
label: (0, i18n_exports._)("Trellis layout"),
|
|
2520
|
-
option: "splitByLayout",
|
|
2521
|
-
editor: "editor.toggle",
|
|
2522
|
-
showEditor: () => {
|
|
2523
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2524
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2525
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2526
|
-
);
|
|
2527
|
-
return isTrellisFeatureFlagOn;
|
|
2528
|
-
}
|
|
2529
|
-
}
|
|
2530
|
-
],
|
|
2531
|
-
[
|
|
2532
|
-
{
|
|
2533
|
-
label: (0, i18n_exports._)("Split by"),
|
|
2534
|
-
option: "trellisSplitBy",
|
|
2535
|
-
editor: "editor.trellisSplitBy",
|
|
2536
|
-
editorProps: {
|
|
2537
|
-
dataSourceKey: "primary"
|
|
2538
|
-
},
|
|
2539
|
-
showEditor: ({ options }) => {
|
|
2540
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2541
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2542
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2543
|
-
);
|
|
2544
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
],
|
|
2548
|
-
[
|
|
2549
|
-
{
|
|
2550
|
-
label: (0, i18n_exports._)("Number of columns"),
|
|
2551
|
-
option: "trellisColumns",
|
|
2552
|
-
editor: "editor.number",
|
|
2553
|
-
editorProps: {
|
|
2554
|
-
min: 1
|
|
2555
|
-
},
|
|
2556
|
-
placeholder: (0, i18n_exports._)("Auto"),
|
|
2557
|
-
showEditor: ({ options }) => {
|
|
2558
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2559
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2560
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2561
|
-
);
|
|
2562
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
2563
|
-
}
|
|
2564
|
-
}
|
|
2565
|
-
],
|
|
2566
|
-
[
|
|
2567
|
-
{
|
|
2568
|
-
label: (0, i18n_exports._)("Min column width"),
|
|
2569
|
-
option: "trellisMinColumnWidth",
|
|
2570
|
-
editor: "editor.number",
|
|
2571
|
-
editorProps: {
|
|
2572
|
-
min: 1
|
|
2573
|
-
},
|
|
2574
|
-
showEditor: ({ options }) => {
|
|
2575
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2576
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2577
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2578
|
-
);
|
|
2579
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
2580
|
-
}
|
|
2581
|
-
},
|
|
2582
|
-
{
|
|
2583
|
-
label: (0, i18n_exports._)("Row height"),
|
|
2584
|
-
option: "trellisRowHeight",
|
|
2585
|
-
editor: "editor.number",
|
|
2586
|
-
editorProps: {
|
|
2587
|
-
min: 1
|
|
2588
|
-
},
|
|
2589
|
-
showEditor: ({ options }) => {
|
|
2590
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2591
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2592
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2593
|
-
);
|
|
2594
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
2595
|
-
}
|
|
2596
|
-
}
|
|
2597
|
-
],
|
|
2598
|
-
[
|
|
2599
|
-
{
|
|
2600
|
-
label: (0, i18n_exports._)("Max number of components per page"),
|
|
2601
|
-
option: "trellisPageCount",
|
|
2602
|
-
editor: "editor.number",
|
|
2603
|
-
editorProps: {
|
|
2604
|
-
min: 1
|
|
2605
|
-
},
|
|
2606
|
-
showEditor: ({ options }) => {
|
|
2607
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2608
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2609
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2610
|
-
);
|
|
2611
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
]
|
|
2615
|
-
];
|
|
2616
|
-
var TrellisBackgroundColorEditor = {
|
|
2617
|
-
label: (0, i18n_exports._)("Trellis background"),
|
|
2618
|
-
option: "trellisBackgroundColor",
|
|
2619
|
-
editor: "editor.color",
|
|
2620
|
-
showEditor: ({ options }) => {
|
|
2621
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
2622
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2623
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2624
|
-
);
|
|
2625
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
2626
|
-
}
|
|
2627
|
-
};
|
|
2628
|
-
|
|
2629
|
-
// src/common/utils/configUtils.ts
|
|
2630
|
-
function enhanceConfig(vizConfig) {
|
|
2631
|
-
const enhancedConfig = __spreadValues({}, vizConfig);
|
|
2632
|
-
enhancedConfig.editorConfig = vizConfig.editorConfig.map(
|
|
2633
|
-
(config3) => {
|
|
2634
|
-
return __spreadProps(__spreadValues({}, config3), { open: config3.open || false });
|
|
2635
|
-
}
|
|
2636
|
-
);
|
|
2637
|
-
return enhancedConfig;
|
|
2638
|
-
}
|
|
2639
|
-
function hasCompatibleContexts(vizContext, presetContext) {
|
|
2640
|
-
const presetContextKeys = Object.keys(presetContext);
|
|
2641
|
-
return presetContextKeys.every(
|
|
2642
|
-
(contextKey) => presetContext[contextKey] === void 0 && vizContext[contextKey] === void 0 || presetContext[contextKey] !== void 0 && vizContext[contextKey] !== void 0
|
|
2643
|
-
);
|
|
2644
|
-
}
|
|
2645
|
-
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
2646
|
-
const presetOptionKeys = Object.keys(presetOptions);
|
|
2647
|
-
return presetOptionKeys.every(
|
|
2648
|
-
(optionKey) => (0, configUtils_exports.isDynamicOption)(presetOptions[optionKey]) === (0, configUtils_exports.isDynamicOption)(vizOptions[optionKey])
|
|
2649
|
-
);
|
|
2650
|
-
}
|
|
2651
|
-
function getInitialPreset(vizContext, vizOptions, presets2) {
|
|
2652
|
-
return presets2.find((preset) => {
|
|
2653
|
-
const presetContext = (0, lodash_exports.get)(preset, ["value", "context"], {});
|
|
2654
|
-
const presetOptions = (0, lodash_exports.get)(preset, ["value", "options"], {});
|
|
2655
|
-
const presetContextKeys = Object.keys(presetContext);
|
|
2656
|
-
const presetOptionKeys = Object.keys(presetOptions);
|
|
2657
|
-
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
2658
|
-
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
2659
|
-
});
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
// src/SingleValueIcon/config.ts
|
|
2663
|
-
var dataContract = {
|
|
2664
|
-
requiredDataSources: [
|
|
2665
|
-
{
|
|
2666
|
-
name: "primary",
|
|
2667
|
-
description: "DataSource that powers the visualization"
|
|
2668
|
-
}
|
|
2669
|
-
],
|
|
2670
|
-
optionalDataSources: [],
|
|
2671
|
-
initialRequestParams: {
|
|
2672
|
-
primary: { offset: 0, count: 1e4 }
|
|
2673
|
-
}
|
|
2674
|
-
};
|
|
2675
|
-
var size = {
|
|
2676
|
-
initialWidth: 250,
|
|
2677
|
-
initialHeight: 250
|
|
2678
|
-
};
|
|
2679
|
-
var basePresetContext = {
|
|
2680
|
-
iconColorEditorConfig: void 0,
|
|
2681
|
-
majorColorEditorConfig: void 0,
|
|
2682
|
-
trendColorEditorConfig: void 0,
|
|
2683
|
-
backgroundColorEditorConfig: void 0
|
|
2684
|
-
};
|
|
2685
|
-
var basePresetOptions = {
|
|
2686
|
-
iconColor: void 0,
|
|
2687
|
-
majorColor: void 0,
|
|
2688
|
-
trendColor: void 0,
|
|
2689
|
-
backgroundColor: void 0
|
|
2690
|
-
};
|
|
2691
|
-
var presets = [
|
|
2692
|
-
{
|
|
2693
|
-
// dummy context variables to allow for resetting of unused context states
|
|
2694
|
-
label: (0, i18n_exports._)("None"),
|
|
2695
|
-
name: "singleValueIcon.none",
|
|
2696
|
-
value: {
|
|
2697
|
-
context: __spreadValues({}, basePresetContext),
|
|
2698
|
-
options: __spreadValues({}, basePresetOptions)
|
|
2699
|
-
}
|
|
2700
|
-
},
|
|
2701
|
-
{
|
|
2702
|
-
label: (0, i18n_exports._)("Icon"),
|
|
2703
|
-
name: "singleValueIcon.icon",
|
|
2704
|
-
value: {
|
|
2705
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
2706
|
-
iconColorEditorConfig: defaultContext.majorColorConfig
|
|
2707
|
-
}),
|
|
2708
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
2709
|
-
iconColor: "> majorValue | rangeValue(iconColorEditorConfig)"
|
|
2710
|
-
})
|
|
2711
|
-
}
|
|
2712
|
-
},
|
|
2713
|
-
{
|
|
2714
|
-
label: (0, i18n_exports._)("Major value"),
|
|
2715
|
-
name: "singleValueIcon.majorValue",
|
|
2716
|
-
value: {
|
|
2717
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
2718
|
-
majorColorEditorConfig: defaultContext.majorColorConfig
|
|
2719
|
-
}),
|
|
2720
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
2721
|
-
majorColor: "> majorValue | rangeValue(majorColorEditorConfig)"
|
|
2722
|
-
})
|
|
2723
|
-
}
|
|
2724
|
-
},
|
|
2725
|
-
{
|
|
2726
|
-
label: (0, i18n_exports._)("Trend value"),
|
|
2727
|
-
name: "singleValueIcon.trend",
|
|
2728
|
-
value: {
|
|
2729
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
2730
|
-
trendColorEditorConfig: defaultContext.trendColorConfig
|
|
2731
|
-
}),
|
|
2732
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
2733
|
-
trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
|
|
2734
|
-
})
|
|
2735
|
-
}
|
|
2736
|
-
},
|
|
2737
|
-
{
|
|
2738
|
-
label: (0, i18n_exports._)("Icon and Major value"),
|
|
2739
|
-
name: "singleValueIcon.iconAndMajorValue",
|
|
2740
|
-
value: {
|
|
2741
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
2742
|
-
iconColorEditorConfig: defaultContext.majorColorConfig,
|
|
2743
|
-
majorColorEditorConfig: defaultContext.majorColorConfig
|
|
2744
|
-
}),
|
|
2745
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
2746
|
-
iconColor: "> majorValue | rangeValue(iconColorEditorConfig)",
|
|
2747
|
-
majorColor: "> majorValue | rangeValue(majorColorEditorConfig)"
|
|
2748
|
-
})
|
|
2749
|
-
}
|
|
2750
|
-
},
|
|
2751
|
-
{
|
|
2752
|
-
label: (0, i18n_exports._)("Background"),
|
|
2753
|
-
name: "singleValueIcon.background",
|
|
2754
|
-
value: {
|
|
2755
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
2756
|
-
backgroundColorEditorConfig: defaultContext.majorColorConfig
|
|
2757
|
-
}),
|
|
2758
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
2759
|
-
backgroundColor: "> majorValue | rangeValue(backgroundColorEditorConfig)"
|
|
2760
|
-
})
|
|
2784
|
+
return {};
|
|
2785
|
+
}, [
|
|
2786
|
+
currentThemeFamily,
|
|
2787
|
+
currentThemeColorScheme,
|
|
2788
|
+
currentThemeDensity,
|
|
2789
|
+
optionsToEvaluate,
|
|
2790
|
+
downsampledDataSources,
|
|
2791
|
+
serializedTimezone,
|
|
2792
|
+
useAsyncEvaluatedOptions
|
|
2793
|
+
]);
|
|
2794
|
+
const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
2795
|
+
let clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
2796
|
+
if (isTrellisOn) {
|
|
2797
|
+
clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
|
|
2798
|
+
backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
2799
|
+
});
|
|
2761
2800
|
}
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
prisma: variables_default.contentColorActive(props)
|
|
2771
|
-
})(props),
|
|
2772
|
-
defaultBlockFontColor: (props) => pick_default2({
|
|
2773
|
-
enterprise: variables_default.white(props),
|
|
2774
|
-
prisma: variables_default.contentColorActive(props)
|
|
2775
|
-
})(props)
|
|
2776
|
-
};
|
|
2777
|
-
var editorConfig = [
|
|
2778
|
-
{
|
|
2779
|
-
label: (0, i18n_exports._)("Data configurations"),
|
|
2780
|
-
layout: [
|
|
2781
|
-
[
|
|
2782
|
-
{
|
|
2783
|
-
label: (0, i18n_exports._)("Value"),
|
|
2784
|
-
editor: "editor.columnSelector",
|
|
2785
|
-
option: "majorValue",
|
|
2786
|
-
context: "valuesContext",
|
|
2787
|
-
editorProps: {
|
|
2788
|
-
dataSourceKey: "primary",
|
|
2789
|
-
prepareValue: (definition) => {
|
|
2790
|
-
const {
|
|
2791
|
-
options: { majorValue: baseSPL }
|
|
2792
|
-
} = definition;
|
|
2793
|
-
return {
|
|
2794
|
-
context: {},
|
|
2795
|
-
options: {
|
|
2796
|
-
majorValue: `${baseSPL} | lastPoint()`,
|
|
2797
|
-
trendValue: `${baseSPL} | delta(-2)`
|
|
2798
|
-
}
|
|
2799
|
-
};
|
|
2800
|
-
}
|
|
2801
|
-
},
|
|
2802
|
-
isDisabled: ({ options }) => options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis
|
|
2801
|
+
react_exports.useEffect(() => {
|
|
2802
|
+
onComputedProps(clonedEvaluatedOptions);
|
|
2803
|
+
});
|
|
2804
|
+
react_exports.useEffect(() => {
|
|
2805
|
+
return () => {
|
|
2806
|
+
if (useAsyncEvaluatedOptions) {
|
|
2807
|
+
isMounted.current = false;
|
|
2808
|
+
async_dynamic_options_evaluator_default.reset(visualizationID);
|
|
2803
2809
|
}
|
|
2804
|
-
|
|
2805
|
-
]
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2810
|
+
};
|
|
2811
|
+
}, []);
|
|
2812
|
+
const { requiredProps = [], supports } = vizConfig;
|
|
2813
|
+
const missing = missingKeys(requiredProps, evaluatedOptionsToUse);
|
|
2814
|
+
if (missing.length > 0 && supports.includes("placeholder" /* PLACEHOLDER */) && vizConfig.key !== "splunk.singlevalue") {
|
|
2815
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
2816
|
+
MissingPropsMessage_default,
|
|
2811
2817
|
{
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2818
|
+
"data-test": "missing-props-message",
|
|
2819
|
+
width,
|
|
2820
|
+
height,
|
|
2821
|
+
missingProps: missing,
|
|
2822
|
+
backgroundColor: bgColorFromTheme
|
|
2815
2823
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
},
|
|
2830
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
2824
|
+
);
|
|
2825
|
+
}
|
|
2826
|
+
const eventCallbackProps = {};
|
|
2827
|
+
if (hasEventHandlers && mode === "view" && vizConfig.supports.indexOf("events" /* EVENTS */) > -1) {
|
|
2828
|
+
const supportedEvents = vizConfig.events;
|
|
2829
|
+
Object.keys(supportedEvents).forEach((eventName) => {
|
|
2830
|
+
const { parentKeys, payloadKeys } = supportedEvents[eventName];
|
|
2831
|
+
const eventCallbackPropName = (0, lodash_exports.camelCase)(`on.${eventName}`);
|
|
2832
|
+
let payload = {};
|
|
2833
|
+
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
2834
|
+
payloadKeys.forEach((p) => {
|
|
2835
|
+
payload[p] = evaluatedOptionsToUse[p];
|
|
2836
|
+
});
|
|
2831
2837
|
}
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
},
|
|
2836
|
-
{
|
|
2837
|
-
label: (0, i18n_exports._)("Color and style"),
|
|
2838
|
-
layout: [
|
|
2839
|
-
[
|
|
2840
|
-
{
|
|
2841
|
-
label: (0, i18n_exports._)("Dynamic elements"),
|
|
2842
|
-
key: "presetSelector",
|
|
2843
|
-
editor: "editor.presetSelector",
|
|
2844
|
-
editorProps: {
|
|
2845
|
-
presets,
|
|
2846
|
-
value: ({ context, options }) => {
|
|
2847
|
-
const initialPreset = getInitialPreset(context, options, presets);
|
|
2848
|
-
return initialPreset && initialPreset.label || null;
|
|
2849
|
-
}
|
|
2838
|
+
eventCallbackProps[eventCallbackPropName] = (ev) => {
|
|
2839
|
+
if (ev && ev.payload) {
|
|
2840
|
+
payload = ev.payload;
|
|
2850
2841
|
}
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
context: "iconColorEditorConfig",
|
|
2859
|
-
editor: "editor.dynamicColor",
|
|
2860
|
-
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.iconColor),
|
|
2861
|
-
editorProps: {
|
|
2862
|
-
labelPosition: "top",
|
|
2863
|
-
flyoutTitle: "Dynamic coloring: icon",
|
|
2864
|
-
formatters: [
|
|
2865
|
-
{
|
|
2866
|
-
label: (0, i18n_exports._)("Ranges"),
|
|
2867
|
-
value: "rangeValue",
|
|
2868
|
-
defaults: {
|
|
2869
|
-
trendValue: defaultContext.trendColorConfig,
|
|
2870
|
-
majorValue: defaultContext.majorColorConfig
|
|
2871
|
-
}
|
|
2872
|
-
},
|
|
2873
|
-
{
|
|
2874
|
-
label: (0, i18n_exports._)("Matches"),
|
|
2875
|
-
value: "matchValue",
|
|
2876
|
-
defaults: {
|
|
2877
|
-
majorValue: defaultContext.majorColorMatchConfig
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
],
|
|
2881
|
-
dataSelectors: [
|
|
2882
|
-
{
|
|
2883
|
-
label: (0, i18n_exports._)("Major value"),
|
|
2884
|
-
value: "majorValue"
|
|
2885
|
-
},
|
|
2886
|
-
{
|
|
2887
|
-
label: (0, i18n_exports._)("Trend"),
|
|
2888
|
-
value: "trendValue"
|
|
2889
|
-
}
|
|
2890
|
-
],
|
|
2891
|
-
defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig
|
|
2842
|
+
return onEventTrigger({ originalEvent: ev, payload, type: eventName });
|
|
2843
|
+
};
|
|
2844
|
+
if (parentKeys) {
|
|
2845
|
+
for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
2846
|
+
const newObject = {};
|
|
2847
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
2848
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
2892
2849
|
}
|
|
2893
2850
|
}
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
[
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
const computedVizProps = computeVizProps2(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
2854
|
+
themeFunc
|
|
2855
|
+
}));
|
|
2856
|
+
let dataSourceMetadata = {};
|
|
2857
|
+
const OptionKey = "paginateDataSourceKey";
|
|
2858
|
+
const paginateDataSourceKey = (0, lodash_exports.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || "primary";
|
|
2859
|
+
if (vizConfig.supports.indexOf("page-and-sort" /* PAGE_AND_SORT */) > -1 && (0, lodash_exports.has)(dataSources, paginateDataSourceKey)) {
|
|
2860
|
+
const requestParams = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "requestParams"], {});
|
|
2861
|
+
const meta = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "meta"], {});
|
|
2862
|
+
const handleRequestParamsChange = (payload) => onRequestParamsChange(paginateDataSourceKey, payload);
|
|
2863
|
+
const sortParams = getSortingParams({
|
|
2864
|
+
requestParams,
|
|
2865
|
+
meta,
|
|
2866
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
2867
|
+
});
|
|
2868
|
+
const paginatorParams = getPaginationParams({
|
|
2869
|
+
requestParams,
|
|
2870
|
+
meta,
|
|
2871
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
2872
|
+
});
|
|
2873
|
+
dataSourceMetadata = {
|
|
2874
|
+
sortParams,
|
|
2875
|
+
paginatorParams
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
2879
|
+
return null;
|
|
2880
|
+
}
|
|
2881
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
2882
|
+
SanitizedReactViz,
|
|
2883
|
+
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
2884
|
+
mode,
|
|
2885
|
+
width,
|
|
2886
|
+
height
|
|
2887
|
+
}, downsamplingProps), evaluatedOptionsToUse), computedVizProps), eventCallbackProps), dataSourceMetadata)
|
|
2888
|
+
);
|
|
2889
|
+
};
|
|
2890
|
+
DashboardViz.propTypes = __spreadValues(__spreadValues({}, SplunkVisualization_default.propTypes), ReactViz.propTypes);
|
|
2891
|
+
DashboardViz.defaultProps = __spreadProps(__spreadValues(__spreadValues({}, SplunkVisualization_default.defaultProps), ReactViz.defaultProps), {
|
|
2892
|
+
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
2893
|
+
theme: {}
|
|
2894
|
+
});
|
|
2895
|
+
DashboardViz.config = vizConfig;
|
|
2896
|
+
return (0, styled_components_exports.withTheme)(
|
|
2897
|
+
withPlaceholder_default(withEditModeCover_default(DashboardViz, disableEditModeCover), useIconPlaceholder)
|
|
2898
|
+
);
|
|
2899
|
+
};
|
|
2900
|
+
var withDashboardViz_default = withDashboardViz;
|
|
2901
|
+
|
|
2902
|
+
// esm-externals:@splunk/visualization-color-palettes/editors/PresetPalettes
|
|
2903
|
+
var PresetPalettes_exports = {};
|
|
2904
|
+
__export(PresetPalettes_exports, {
|
|
2905
|
+
default: () => PresetPalettes_default
|
|
2906
|
+
});
|
|
2907
|
+
var defaultImport40 = __toESM(require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
|
|
2908
|
+
__reExport(PresetPalettes_exports, require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
|
|
2909
|
+
var PresetPalettes_default = "default" in defaultImport40 ? defaultImport40.default : defaultImport40;
|
|
2910
|
+
|
|
2911
|
+
// esm-externals:@splunk/themes/pick
|
|
2912
|
+
var pick_exports2 = {};
|
|
2913
|
+
__export(pick_exports2, {
|
|
2914
|
+
default: () => pick_default2
|
|
2915
|
+
});
|
|
2916
|
+
var defaultImport41 = __toESM(require("@splunk/themes/pick"));
|
|
2917
|
+
__reExport(pick_exports2, require("@splunk/themes/pick"));
|
|
2918
|
+
var pick_default2 = "default" in defaultImport41 ? defaultImport41.default : defaultImport41;
|
|
2919
|
+
|
|
2920
|
+
// esm-externals:@splunk/visualizations-shared/configUtils
|
|
2921
|
+
var configUtils_exports = {};
|
|
2922
|
+
__export(configUtils_exports, {
|
|
2923
|
+
default: () => configUtils_default
|
|
2924
|
+
});
|
|
2925
|
+
var defaultImport42 = __toESM(require("@splunk/visualizations-shared/configUtils"));
|
|
2926
|
+
__reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
|
|
2927
|
+
var configUtils_default = "default" in defaultImport42 ? defaultImport42.default : defaultImport42;
|
|
2928
|
+
|
|
2929
|
+
// src/common/configContext/singleValueContext.ts
|
|
2930
|
+
var defaultContext = {
|
|
2931
|
+
trendColorConfig: [
|
|
2932
|
+
{
|
|
2933
|
+
to: 0,
|
|
2934
|
+
value: "#9E2520"
|
|
2935
|
+
},
|
|
2936
|
+
{
|
|
2937
|
+
from: 0,
|
|
2938
|
+
value: "#1C6B2D"
|
|
2939
|
+
}
|
|
2940
|
+
],
|
|
2941
|
+
majorColorConfig: [
|
|
2942
|
+
{ to: 20, value: "#D41F1F" },
|
|
2943
|
+
{ from: 20, to: 40, value: "#D94E17" },
|
|
2944
|
+
{ from: 40, to: 60, value: "#CBA700" },
|
|
2945
|
+
{ from: 60, to: 80, value: "#669922" },
|
|
2946
|
+
{ from: 80, value: "#118832" }
|
|
2947
|
+
],
|
|
2948
|
+
majorColorMatchConfig: [{ match: "", value: "#5C33FF" }],
|
|
2949
|
+
trendValueCopy: "> trendValue",
|
|
2950
|
+
divisor: "> majorValue | subtract(trendValueCopy) | divideBy(100)",
|
|
2951
|
+
trendValuePercent: "> trendValue | divideBy(divisor)"
|
|
2952
|
+
};
|
|
2953
|
+
|
|
2954
|
+
// src/common/editorConfig/StaticMajorAndTrendLayout.js
|
|
2955
|
+
var StaticMajorAndTrendLayout = [
|
|
2956
|
+
[
|
|
2957
|
+
{
|
|
2958
|
+
label: (0, i18n_exports._)("Unit position"),
|
|
2959
|
+
// todo: we need a new editor combining unit and position
|
|
2960
|
+
option: "unitPosition",
|
|
2961
|
+
editor: "editor.select",
|
|
2962
|
+
editorProps: {
|
|
2963
|
+
values: [
|
|
2964
|
+
{ label: (0, i18n_exports._)("Before"), value: "before" },
|
|
2965
|
+
{ label: (0, i18n_exports._)("After"), value: "after" }
|
|
2966
|
+
]
|
|
2967
|
+
},
|
|
2968
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
2969
|
+
},
|
|
2970
|
+
{
|
|
2971
|
+
label: (0, i18n_exports._)("Unit label"),
|
|
2972
|
+
option: "unit",
|
|
2973
|
+
editor: "editor.text",
|
|
2974
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
2975
|
+
}
|
|
2976
|
+
],
|
|
2977
|
+
[
|
|
2978
|
+
{
|
|
2979
|
+
label: (0, i18n_exports._)("Precision"),
|
|
2980
|
+
option: "numberPrecision",
|
|
2981
|
+
editor: "editor.number",
|
|
2982
|
+
editorProps: {
|
|
2983
|
+
min: 0,
|
|
2984
|
+
max: 20
|
|
2985
|
+
},
|
|
2986
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
2987
|
+
}
|
|
2988
|
+
]
|
|
2989
|
+
];
|
|
2990
|
+
var StaticMajorAndTrendLayout_default = StaticMajorAndTrendLayout;
|
|
2991
|
+
|
|
2992
|
+
// src/common/editorConfig/StaticBackgroundColorEditor.js
|
|
2993
|
+
var StaticBackgroundColorEditor = {
|
|
2994
|
+
label: (0, i18n_exports._)("Background color"),
|
|
2995
|
+
option: "backgroundColor",
|
|
2996
|
+
editor: "editor.color",
|
|
2997
|
+
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.backgroundColor)
|
|
2998
|
+
};
|
|
2999
|
+
var StaticBackgroundColorEditor_default = StaticBackgroundColorEditor;
|
|
3000
|
+
|
|
3001
|
+
// src/common/editorConfig/StaticIconColorEditor.js
|
|
3002
|
+
var StaticIconColorEditor = [
|
|
3003
|
+
{
|
|
3004
|
+
label: (0, i18n_exports._)("Icon"),
|
|
3005
|
+
option: "iconColor",
|
|
3006
|
+
editor: "editor.color",
|
|
3007
|
+
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.iconColor),
|
|
3008
|
+
editorProps: {
|
|
3009
|
+
labelPosition: "top",
|
|
3010
|
+
value: null,
|
|
3011
|
+
palette: [null, ...colorConstants_exports.COLOR_EDITOR_PALETTE]
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
];
|
|
3015
|
+
var StaticIconColorEditor_default = StaticIconColorEditor;
|
|
3016
|
+
|
|
3017
|
+
// src/common/editorConfig/StaticMajorColorEditor.js
|
|
3018
|
+
var StaticMajorColorEditor = {
|
|
3019
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3020
|
+
option: "majorColor",
|
|
3021
|
+
editor: "editor.color",
|
|
3022
|
+
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.majorColor)
|
|
3023
|
+
};
|
|
3024
|
+
var StaticMajorColorEditor_default = StaticMajorColorEditor;
|
|
3025
|
+
|
|
3026
|
+
// src/common/editorConfig/StaticTrendColorEditor.js
|
|
3027
|
+
var StaticTrendColorEditor = {
|
|
3028
|
+
label: (0, i18n_exports._)("Trend value"),
|
|
3029
|
+
option: "trendColor",
|
|
3030
|
+
editor: "editor.color",
|
|
3031
|
+
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.trendColor),
|
|
3032
|
+
isDisabled: ({ options }) => options.trendDisplay === "off"
|
|
3033
|
+
};
|
|
3034
|
+
var StaticTrendColorEditor_default = StaticTrendColorEditor;
|
|
3035
|
+
|
|
3036
|
+
// src/common/editorConfig/DynamicMajorColorEditor.js
|
|
3037
|
+
var getDynamicMajorColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
3038
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3039
|
+
option: "majorColor",
|
|
3040
|
+
context: "majorColorEditorConfig",
|
|
3041
|
+
editor: "editor.dynamicColor",
|
|
3042
|
+
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.majorColor),
|
|
3043
|
+
editorProps: {
|
|
3044
|
+
labelPosition: "top",
|
|
3045
|
+
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: major value"),
|
|
3046
|
+
formatters: [
|
|
3047
|
+
{
|
|
3048
|
+
label: (0, i18n_exports._)("Ranges"),
|
|
3049
|
+
value: "rangeValue",
|
|
3050
|
+
defaults: {
|
|
3051
|
+
majorValue: defaultContext2.majorColorConfig
|
|
3052
|
+
}
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
label: (0, i18n_exports._)("Matches"),
|
|
3056
|
+
value: "matchValue",
|
|
3057
|
+
defaults: {
|
|
3058
|
+
majorValue: defaultContext2.majorColorMatchConfig
|
|
2947
3059
|
}
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
3060
|
+
}
|
|
3061
|
+
],
|
|
3062
|
+
dataSelectors: [
|
|
3063
|
+
{
|
|
3064
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3065
|
+
value: "majorValue"
|
|
3066
|
+
}
|
|
3067
|
+
],
|
|
3068
|
+
defaultPalettesConfig: defaultPalettesConfig2
|
|
3069
|
+
}
|
|
3070
|
+
});
|
|
3071
|
+
|
|
3072
|
+
// src/common/editorConfig/DynamicTrendColorEditor.js
|
|
3073
|
+
var getDynamicTrendColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
3074
|
+
label: (0, i18n_exports._)("Trend value"),
|
|
3075
|
+
option: "trendColor",
|
|
3076
|
+
context: "trendColorEditorConfig",
|
|
3077
|
+
editor: "editor.dynamicColor",
|
|
3078
|
+
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.trendColor),
|
|
3079
|
+
editorProps: {
|
|
3080
|
+
labelPosition: "top",
|
|
3081
|
+
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: trend value"),
|
|
3082
|
+
formatters: [
|
|
3083
|
+
{
|
|
3084
|
+
label: (0, i18n_exports._)("Ranges"),
|
|
3085
|
+
value: "rangeValue",
|
|
3086
|
+
defaults: {
|
|
3087
|
+
trendValue: defaultContext2.trendColorConfig
|
|
2954
3088
|
}
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
3089
|
+
}
|
|
3090
|
+
],
|
|
3091
|
+
dataSelectors: [
|
|
3092
|
+
{
|
|
3093
|
+
label: (0, i18n_exports._)("Trend value"),
|
|
3094
|
+
value: "trendValue"
|
|
3095
|
+
}
|
|
3096
|
+
],
|
|
3097
|
+
defaultPalettesConfig: defaultPalettesConfig2
|
|
3098
|
+
}
|
|
3099
|
+
});
|
|
3100
|
+
|
|
3101
|
+
// src/common/editorConfig/DynamicBackgroundColorEditor.js
|
|
3102
|
+
var getDynamicBackgroundColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
3103
|
+
label: (0, i18n_exports._)("Background color"),
|
|
3104
|
+
option: "backgroundColor",
|
|
3105
|
+
context: "backgroundColorEditorConfig",
|
|
3106
|
+
editor: "editor.dynamicColor",
|
|
3107
|
+
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.backgroundColor),
|
|
3108
|
+
editorProps: {
|
|
3109
|
+
labelPosition: "top",
|
|
3110
|
+
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: background"),
|
|
3111
|
+
formatters: [
|
|
3112
|
+
{
|
|
3113
|
+
label: (0, i18n_exports._)("Ranges"),
|
|
3114
|
+
value: "rangeValue",
|
|
3115
|
+
defaults: {
|
|
3116
|
+
majorValue: defaultContext2.majorColorConfig,
|
|
3117
|
+
trendValue: defaultContext2.trendColorConfig
|
|
2961
3118
|
}
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
editorProps: {
|
|
2969
|
-
values: [
|
|
2970
|
-
{ label: (0, i18n_exports._)("Left"), value: "left" },
|
|
2971
|
-
{ label: (0, i18n_exports._)("Center"), value: "center" },
|
|
2972
|
-
{ label: (0, i18n_exports._)("Right"), value: "right" }
|
|
2973
|
-
]
|
|
2974
|
-
},
|
|
2975
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3119
|
+
},
|
|
3120
|
+
{
|
|
3121
|
+
label: (0, i18n_exports._)("Matches"),
|
|
3122
|
+
value: "matchValue",
|
|
3123
|
+
defaults: {
|
|
3124
|
+
majorValue: defaultContext2.majorColorMatchConfig
|
|
2976
3125
|
}
|
|
2977
|
-
|
|
2978
|
-
]
|
|
3126
|
+
}
|
|
3127
|
+
],
|
|
3128
|
+
dataSelectors: [
|
|
3129
|
+
{
|
|
3130
|
+
label: (0, i18n_exports._)("Major Value"),
|
|
3131
|
+
value: "majorValue"
|
|
3132
|
+
},
|
|
3133
|
+
{
|
|
3134
|
+
label: (0, i18n_exports._)("Trend"),
|
|
3135
|
+
value: "trendValue"
|
|
3136
|
+
}
|
|
3137
|
+
],
|
|
3138
|
+
defaultPalettesConfig: defaultPalettesConfig2
|
|
2979
3139
|
}
|
|
3140
|
+
});
|
|
3141
|
+
|
|
3142
|
+
// src/common/editorConfig/TrellisEditors.ts
|
|
3143
|
+
var isTrellisFeatureFlagOn = ({ featureFlags }) => {
|
|
3144
|
+
return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
|
|
3145
|
+
};
|
|
3146
|
+
var isTrellisEnabled = ({ options, featureFlags }) => {
|
|
3147
|
+
const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
|
|
3148
|
+
return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
3149
|
+
};
|
|
3150
|
+
var TrellisEditorConfig = [
|
|
3151
|
+
[
|
|
3152
|
+
{
|
|
3153
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
3154
|
+
option: "splitByLayout",
|
|
3155
|
+
editor: "editor.toggle",
|
|
3156
|
+
showEditor: isTrellisFeatureFlagOn
|
|
3157
|
+
}
|
|
3158
|
+
],
|
|
3159
|
+
[
|
|
3160
|
+
{
|
|
3161
|
+
label: (0, i18n_exports._)("Split by"),
|
|
3162
|
+
option: "trellisSplitBy",
|
|
3163
|
+
editor: "editor.trellisSplitBy",
|
|
3164
|
+
editorProps: {
|
|
3165
|
+
dataSourceKey: "primary"
|
|
3166
|
+
},
|
|
3167
|
+
showEditor: isTrellisEnabled
|
|
3168
|
+
}
|
|
3169
|
+
],
|
|
3170
|
+
[
|
|
3171
|
+
{
|
|
3172
|
+
label: (0, i18n_exports._)("Number of columns"),
|
|
3173
|
+
option: "trellisColumns",
|
|
3174
|
+
editor: "editor.number",
|
|
3175
|
+
editorProps: {
|
|
3176
|
+
min: 1
|
|
3177
|
+
},
|
|
3178
|
+
placeholder: (0, i18n_exports._)("Auto"),
|
|
3179
|
+
showEditor: isTrellisEnabled
|
|
3180
|
+
}
|
|
3181
|
+
],
|
|
3182
|
+
[
|
|
3183
|
+
{
|
|
3184
|
+
label: (0, i18n_exports._)("Min column width"),
|
|
3185
|
+
option: "trellisMinColumnWidth",
|
|
3186
|
+
editor: "editor.number",
|
|
3187
|
+
editorProps: {
|
|
3188
|
+
min: 1
|
|
3189
|
+
},
|
|
3190
|
+
showEditor: isTrellisEnabled
|
|
3191
|
+
},
|
|
3192
|
+
{
|
|
3193
|
+
label: (0, i18n_exports._)("Row height"),
|
|
3194
|
+
option: "trellisRowHeight",
|
|
3195
|
+
editor: "editor.number",
|
|
3196
|
+
editorProps: {
|
|
3197
|
+
min: 1
|
|
3198
|
+
},
|
|
3199
|
+
showEditor: isTrellisEnabled
|
|
3200
|
+
}
|
|
3201
|
+
],
|
|
3202
|
+
[
|
|
3203
|
+
{
|
|
3204
|
+
label: (0, i18n_exports._)("Max number of components per page"),
|
|
3205
|
+
option: "trellisPageCount",
|
|
3206
|
+
editor: "editor.number",
|
|
3207
|
+
editorProps: {
|
|
3208
|
+
min: 1
|
|
3209
|
+
},
|
|
3210
|
+
showEditor: isTrellisEnabled
|
|
3211
|
+
}
|
|
3212
|
+
]
|
|
2980
3213
|
];
|
|
2981
|
-
var
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
dataContract,
|
|
2996
|
-
size,
|
|
2997
|
-
defaultContext,
|
|
2998
|
-
optionsSchema: visualization_schemas_exports.singleValueIconOptionsSchema,
|
|
2999
|
-
editorConfig,
|
|
3000
|
-
events: {
|
|
3001
|
-
"value.click": {
|
|
3002
|
-
description: "trigger when user clicks major value or icon",
|
|
3003
|
-
payloadKeys: ["majorValue", "trendValue", "icon"]
|
|
3214
|
+
var TimechartTrellisEditorConfig = [
|
|
3215
|
+
[
|
|
3216
|
+
{
|
|
3217
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
3218
|
+
option: "splitByLayout",
|
|
3219
|
+
editor: "editor.toggle",
|
|
3220
|
+
showEditor: isTrellisFeatureFlagOn,
|
|
3221
|
+
// add help text for timecharts
|
|
3222
|
+
editorProps: {
|
|
3223
|
+
help: (0, i18n_exports._)(
|
|
3224
|
+
"Y2-axis and overlay field configurations are not supported when trellis is enabled."
|
|
3225
|
+
),
|
|
3226
|
+
helpFormat: "under"
|
|
3227
|
+
}
|
|
3004
3228
|
}
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3229
|
+
],
|
|
3230
|
+
...TrellisEditorConfig.slice(1),
|
|
3231
|
+
[
|
|
3232
|
+
{
|
|
3233
|
+
label: (0, i18n_exports._)("Shared y-axis scale"),
|
|
3234
|
+
option: "trellisSharedScale",
|
|
3235
|
+
editor: "editor.checkbox",
|
|
3236
|
+
showEditor: isTrellisEnabled
|
|
3237
|
+
}
|
|
3238
|
+
]
|
|
3239
|
+
];
|
|
3240
|
+
var TrellisBackgroundColorEditor = {
|
|
3241
|
+
label: (0, i18n_exports._)("Trellis background"),
|
|
3242
|
+
option: "trellisBackgroundColor",
|
|
3243
|
+
editor: "editor.color",
|
|
3244
|
+
showEditor: isTrellisEnabled
|
|
3008
3245
|
};
|
|
3009
|
-
var config_default = enhanceConfig(config);
|
|
3010
|
-
|
|
3011
|
-
// esm-externals:@splunk/react-ui/Paginator
|
|
3012
|
-
var Paginator_exports = {};
|
|
3013
|
-
__export(Paginator_exports, {
|
|
3014
|
-
default: () => Paginator_default
|
|
3015
|
-
});
|
|
3016
|
-
var defaultImport40 = __toESM(require("@splunk/react-ui/Paginator"));
|
|
3017
|
-
__reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
|
|
3018
|
-
var Paginator_default = "default" in defaultImport40 ? defaultImport40.default : defaultImport40;
|
|
3019
|
-
|
|
3020
|
-
// esm-externals:@splunk/themes
|
|
3021
|
-
var themes_exports = {};
|
|
3022
|
-
__export(themes_exports, {
|
|
3023
|
-
default: () => themes_default
|
|
3024
|
-
});
|
|
3025
|
-
var defaultImport41 = __toESM(require("@splunk/themes"));
|
|
3026
|
-
__reExport(themes_exports, require("@splunk/themes"));
|
|
3027
|
-
var themes_default = "default" in defaultImport41 ? defaultImport41.default : defaultImport41;
|
|
3028
|
-
|
|
3029
|
-
// esm-externals:@splunk/themes/useSplunkTheme
|
|
3030
|
-
var useSplunkTheme_exports = {};
|
|
3031
|
-
__export(useSplunkTheme_exports, {
|
|
3032
|
-
default: () => useSplunkTheme_default
|
|
3033
|
-
});
|
|
3034
|
-
var defaultImport42 = __toESM(require("@splunk/themes/useSplunkTheme"));
|
|
3035
|
-
__reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
|
|
3036
|
-
var useSplunkTheme_default = "default" in defaultImport42 ? defaultImport42.default : defaultImport42;
|
|
3037
3246
|
|
|
3038
|
-
//
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3247
|
+
// src/common/utils/configUtils.ts
|
|
3248
|
+
function enhanceConfig(vizConfig) {
|
|
3249
|
+
const enhancedConfig = __spreadValues({}, vizConfig);
|
|
3250
|
+
enhancedConfig.editorConfig = vizConfig.editorConfig.map(
|
|
3251
|
+
(config3) => {
|
|
3252
|
+
return __spreadProps(__spreadValues({}, config3), { open: config3.open || false });
|
|
3253
|
+
}
|
|
3254
|
+
);
|
|
3255
|
+
return enhancedConfig;
|
|
3256
|
+
}
|
|
3257
|
+
function hasCompatibleContexts(vizContext, presetContext) {
|
|
3258
|
+
const presetContextKeys = Object.keys(presetContext);
|
|
3259
|
+
return presetContextKeys.every(
|
|
3260
|
+
(contextKey) => presetContext[contextKey] === void 0 && vizContext[contextKey] === void 0 || presetContext[contextKey] !== void 0 && vizContext[contextKey] !== void 0
|
|
3261
|
+
);
|
|
3262
|
+
}
|
|
3263
|
+
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
3264
|
+
const presetOptionKeys = Object.keys(presetOptions);
|
|
3265
|
+
return presetOptionKeys.every(
|
|
3266
|
+
(optionKey) => (0, configUtils_exports.isDynamicOption)(presetOptions[optionKey]) === (0, configUtils_exports.isDynamicOption)(vizOptions[optionKey])
|
|
3267
|
+
);
|
|
3268
|
+
}
|
|
3269
|
+
function getInitialPreset(vizContext, vizOptions, presets2) {
|
|
3270
|
+
return presets2.find((preset) => {
|
|
3271
|
+
const presetContext = (0, lodash_exports.get)(preset, ["value", "context"], {});
|
|
3272
|
+
const presetOptions = (0, lodash_exports.get)(preset, ["value", "options"], {});
|
|
3273
|
+
const presetContextKeys = Object.keys(presetContext);
|
|
3274
|
+
const presetOptionKeys = Object.keys(presetOptions);
|
|
3275
|
+
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
3276
|
+
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3046
3279
|
|
|
3047
|
-
// src/
|
|
3048
|
-
var
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
let splitDataSources = null;
|
|
3054
|
-
let errorCode = null;
|
|
3055
|
-
if (fields && fields.length) {
|
|
3056
|
-
splitDataSources = {};
|
|
3057
|
-
for (let i = 0; i < fields.length; i += 1) {
|
|
3058
|
-
const fieldName = fields[i].name;
|
|
3059
|
-
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
3060
|
-
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
3061
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3062
|
-
);
|
|
3063
|
-
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
3064
|
-
splitDataSources[fieldName].primary.data.columns = [columns[i]];
|
|
3065
|
-
}
|
|
3280
|
+
// src/SingleValueIcon/config.ts
|
|
3281
|
+
var dataContract = {
|
|
3282
|
+
requiredDataSources: [
|
|
3283
|
+
{
|
|
3284
|
+
name: "primary",
|
|
3285
|
+
description: "DataSource that powers the visualization"
|
|
3066
3286
|
}
|
|
3067
|
-
|
|
3068
|
-
|
|
3287
|
+
],
|
|
3288
|
+
optionalDataSources: [],
|
|
3289
|
+
initialRequestParams: {
|
|
3290
|
+
primary: { offset: 0, count: 1e4 }
|
|
3069
3291
|
}
|
|
3070
|
-
return { splitDataSources, errorCode };
|
|
3071
3292
|
};
|
|
3072
|
-
var
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3293
|
+
var size = {
|
|
3294
|
+
initialWidth: 250,
|
|
3295
|
+
initialHeight: 250
|
|
3296
|
+
};
|
|
3297
|
+
var basePresetContext = {
|
|
3298
|
+
iconColorEditorConfig: void 0,
|
|
3299
|
+
majorColorEditorConfig: void 0,
|
|
3300
|
+
trendColorEditorConfig: void 0,
|
|
3301
|
+
backgroundColorEditorConfig: void 0
|
|
3302
|
+
};
|
|
3303
|
+
var basePresetOptions = {
|
|
3304
|
+
iconColor: void 0,
|
|
3305
|
+
majorColor: void 0,
|
|
3306
|
+
trendColor: void 0,
|
|
3307
|
+
backgroundColor: void 0
|
|
3308
|
+
};
|
|
3309
|
+
var presets = [
|
|
3310
|
+
{
|
|
3311
|
+
// dummy context variables to allow for resetting of unused context states
|
|
3312
|
+
label: (0, i18n_exports._)("None"),
|
|
3313
|
+
name: "singleValueIcon.none",
|
|
3314
|
+
value: {
|
|
3315
|
+
context: __spreadValues({}, basePresetContext),
|
|
3316
|
+
options: __spreadValues({}, basePresetOptions)
|
|
3317
|
+
}
|
|
3318
|
+
},
|
|
3319
|
+
{
|
|
3320
|
+
label: (0, i18n_exports._)("Icon"),
|
|
3321
|
+
name: "singleValueIcon.icon",
|
|
3322
|
+
value: {
|
|
3323
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3324
|
+
iconColorEditorConfig: defaultContext.majorColorConfig
|
|
3325
|
+
}),
|
|
3326
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3327
|
+
iconColor: "> majorValue | rangeValue(iconColorEditorConfig)"
|
|
3328
|
+
})
|
|
3329
|
+
}
|
|
3330
|
+
},
|
|
3331
|
+
{
|
|
3332
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3333
|
+
name: "singleValueIcon.majorValue",
|
|
3334
|
+
value: {
|
|
3335
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3336
|
+
majorColorEditorConfig: defaultContext.majorColorConfig
|
|
3337
|
+
}),
|
|
3338
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3339
|
+
majorColor: "> majorValue | rangeValue(majorColorEditorConfig)"
|
|
3340
|
+
})
|
|
3341
|
+
}
|
|
3342
|
+
},
|
|
3343
|
+
{
|
|
3344
|
+
label: (0, i18n_exports._)("Trend value"),
|
|
3345
|
+
name: "singleValueIcon.trend",
|
|
3346
|
+
value: {
|
|
3347
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3348
|
+
trendColorEditorConfig: defaultContext.trendColorConfig
|
|
3349
|
+
}),
|
|
3350
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3351
|
+
trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
|
|
3352
|
+
})
|
|
3109
3353
|
}
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
}
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
3136
|
-
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
3137
|
-
}
|
|
3138
|
-
});
|
|
3139
|
-
} else {
|
|
3140
|
-
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3141
|
-
}
|
|
3142
|
-
return { splitDataSources, errorCode };
|
|
3143
|
-
};
|
|
3144
|
-
var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
3145
|
-
var _a, _b, _c, _d, _e;
|
|
3146
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3147
|
-
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3148
|
-
let splitDataSources = null;
|
|
3149
|
-
let splitByFields = [];
|
|
3150
|
-
let errorCode = null;
|
|
3151
|
-
if (typeof fields[0] !== "string") {
|
|
3152
|
-
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
3153
|
-
}
|
|
3154
|
-
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
3155
|
-
splitDataSources = {};
|
|
3156
|
-
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
3157
|
-
const valueKeys = [];
|
|
3158
|
-
for (let i = 1; i < fields.length; i += 1) {
|
|
3159
|
-
if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
|
|
3160
|
-
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
3161
|
-
}
|
|
3354
|
+
},
|
|
3355
|
+
{
|
|
3356
|
+
label: (0, i18n_exports._)("Icon and Major value"),
|
|
3357
|
+
name: "singleValueIcon.iconAndMajorValue",
|
|
3358
|
+
value: {
|
|
3359
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3360
|
+
iconColorEditorConfig: defaultContext.majorColorConfig,
|
|
3361
|
+
majorColorEditorConfig: defaultContext.majorColorConfig
|
|
3362
|
+
}),
|
|
3363
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3364
|
+
iconColor: "> majorValue | rangeValue(iconColorEditorConfig)",
|
|
3365
|
+
majorColor: "> majorValue | rangeValue(majorColorEditorConfig)"
|
|
3366
|
+
})
|
|
3367
|
+
}
|
|
3368
|
+
},
|
|
3369
|
+
{
|
|
3370
|
+
label: (0, i18n_exports._)("Background"),
|
|
3371
|
+
name: "singleValueIcon.background",
|
|
3372
|
+
value: {
|
|
3373
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3374
|
+
backgroundColorEditorConfig: defaultContext.majorColorConfig
|
|
3375
|
+
}),
|
|
3376
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3377
|
+
backgroundColor: "> majorValue | rangeValue(backgroundColorEditorConfig)"
|
|
3378
|
+
})
|
|
3162
3379
|
}
|
|
3163
|
-
valueKeys.forEach((val) => {
|
|
3164
|
-
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3165
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3166
|
-
);
|
|
3167
|
-
splitDataSources[val].primary.data.fields = [
|
|
3168
|
-
{ name: fields[0].name },
|
|
3169
|
-
...dataSourceKeys.map((k) => ({
|
|
3170
|
-
name: k
|
|
3171
|
-
}))
|
|
3172
|
-
];
|
|
3173
|
-
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
3174
|
-
dataSourceKeys.forEach((dsKey) => {
|
|
3175
|
-
fields.forEach((field, idx) => {
|
|
3176
|
-
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
3177
|
-
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3178
|
-
}
|
|
3179
|
-
});
|
|
3180
|
-
});
|
|
3181
|
-
});
|
|
3182
|
-
} else {
|
|
3183
|
-
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3184
3380
|
}
|
|
3185
|
-
|
|
3381
|
+
];
|
|
3382
|
+
var themes = {
|
|
3383
|
+
defaultFontColor: (props) => pick_default2({
|
|
3384
|
+
enterprise: {
|
|
3385
|
+
dark: variables_default.textColor(props),
|
|
3386
|
+
light: variables_default.gray20(props)
|
|
3387
|
+
},
|
|
3388
|
+
prisma: variables_default.contentColorActive(props)
|
|
3389
|
+
})(props),
|
|
3390
|
+
defaultBlockFontColor: (props) => pick_default2({
|
|
3391
|
+
enterprise: variables_default.white(props),
|
|
3392
|
+
prisma: variables_default.contentColorActive(props)
|
|
3393
|
+
})(props)
|
|
3186
3394
|
};
|
|
3187
|
-
var
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
(
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3395
|
+
var editorConfig = [
|
|
3396
|
+
{
|
|
3397
|
+
label: (0, i18n_exports._)("Data configurations"),
|
|
3398
|
+
layout: [
|
|
3399
|
+
[
|
|
3400
|
+
{
|
|
3401
|
+
label: (0, i18n_exports._)("Value"),
|
|
3402
|
+
editor: "editor.columnSelector",
|
|
3403
|
+
option: "majorValue",
|
|
3404
|
+
context: "valuesContext",
|
|
3405
|
+
editorProps: {
|
|
3406
|
+
dataSourceKey: "primary",
|
|
3407
|
+
prepareValue: (definition) => {
|
|
3408
|
+
const {
|
|
3409
|
+
options: { majorValue: baseSPL }
|
|
3410
|
+
} = definition;
|
|
3411
|
+
return {
|
|
3412
|
+
context: {},
|
|
3413
|
+
options: {
|
|
3414
|
+
majorValue: `${baseSPL} | lastPoint()`,
|
|
3415
|
+
trendValue: `${baseSPL} | delta(-2)`
|
|
3416
|
+
}
|
|
3417
|
+
};
|
|
3418
|
+
}
|
|
3419
|
+
},
|
|
3420
|
+
isDisabled: ({ options }) => options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis
|
|
3421
|
+
}
|
|
3422
|
+
]
|
|
3423
|
+
]
|
|
3424
|
+
},
|
|
3425
|
+
{
|
|
3426
|
+
label: (0, i18n_exports._)("Data display"),
|
|
3427
|
+
layout: [
|
|
3428
|
+
[
|
|
3429
|
+
{
|
|
3430
|
+
label: (0, i18n_exports._)("Show major and trend value"),
|
|
3431
|
+
option: "showValue",
|
|
3432
|
+
editor: "editor.toggle"
|
|
3433
|
+
}
|
|
3434
|
+
],
|
|
3435
|
+
...StaticMajorAndTrendLayout_default,
|
|
3436
|
+
[
|
|
3437
|
+
{
|
|
3438
|
+
label: (0, i18n_exports._)("Trend display"),
|
|
3439
|
+
option: "trendDisplay",
|
|
3440
|
+
editor: "editor.select",
|
|
3441
|
+
editorProps: {
|
|
3442
|
+
values: [
|
|
3443
|
+
{ label: (0, i18n_exports._)("Percent"), value: "percent" },
|
|
3444
|
+
{ label: (0, i18n_exports._)("Absolute"), value: "absolute" },
|
|
3445
|
+
{ label: (0, i18n_exports._)("Off"), value: "off" }
|
|
3446
|
+
]
|
|
3447
|
+
},
|
|
3448
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3449
|
+
}
|
|
3450
|
+
],
|
|
3451
|
+
...TrellisEditorConfig
|
|
3452
|
+
]
|
|
3453
|
+
},
|
|
3454
|
+
{
|
|
3455
|
+
label: (0, i18n_exports._)("Color and style"),
|
|
3456
|
+
layout: [
|
|
3457
|
+
[
|
|
3458
|
+
{
|
|
3459
|
+
label: (0, i18n_exports._)("Dynamic elements"),
|
|
3460
|
+
key: "presetSelector",
|
|
3461
|
+
editor: "editor.presetSelector",
|
|
3462
|
+
editorProps: {
|
|
3463
|
+
presets,
|
|
3464
|
+
value: ({ context, options }) => {
|
|
3465
|
+
const initialPreset = getInitialPreset(context, options, presets);
|
|
3466
|
+
return initialPreset && initialPreset.label || null;
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
],
|
|
3471
|
+
StaticIconColorEditor_default,
|
|
3472
|
+
[
|
|
3473
|
+
{
|
|
3474
|
+
label: (0, i18n_exports._)("Icon"),
|
|
3475
|
+
option: "iconColor",
|
|
3476
|
+
context: "iconColorEditorConfig",
|
|
3477
|
+
editor: "editor.dynamicColor",
|
|
3478
|
+
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.iconColor),
|
|
3479
|
+
editorProps: {
|
|
3480
|
+
labelPosition: "top",
|
|
3481
|
+
flyoutTitle: "Dynamic coloring: icon",
|
|
3482
|
+
formatters: [
|
|
3483
|
+
{
|
|
3484
|
+
label: (0, i18n_exports._)("Ranges"),
|
|
3485
|
+
value: "rangeValue",
|
|
3486
|
+
defaults: {
|
|
3487
|
+
trendValue: defaultContext.trendColorConfig,
|
|
3488
|
+
majorValue: defaultContext.majorColorConfig
|
|
3489
|
+
}
|
|
3490
|
+
},
|
|
3491
|
+
{
|
|
3492
|
+
label: (0, i18n_exports._)("Matches"),
|
|
3493
|
+
value: "matchValue",
|
|
3494
|
+
defaults: {
|
|
3495
|
+
majorValue: defaultContext.majorColorMatchConfig
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
],
|
|
3499
|
+
dataSelectors: [
|
|
3500
|
+
{
|
|
3501
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3502
|
+
value: "majorValue"
|
|
3503
|
+
},
|
|
3504
|
+
{
|
|
3505
|
+
label: (0, i18n_exports._)("Trend"),
|
|
3506
|
+
value: "trendValue"
|
|
3507
|
+
}
|
|
3508
|
+
],
|
|
3509
|
+
defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig
|
|
3510
|
+
}
|
|
3217
3511
|
}
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
name: k
|
|
3224
|
-
}))
|
|
3225
|
-
];
|
|
3226
|
-
dataSourceKeys.forEach(() => {
|
|
3227
|
-
columnValues.push([]);
|
|
3228
|
-
});
|
|
3229
|
-
for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
|
|
3230
|
-
columnValues[0].push(
|
|
3231
|
-
fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
|
|
3232
|
-
);
|
|
3233
|
-
dataSourceKeys.forEach((dskey, dsIndx) => {
|
|
3234
|
-
const mul = (fields.length - 1) / dataSourceKeys.length;
|
|
3235
|
-
columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
|
|
3236
|
-
});
|
|
3512
|
+
],
|
|
3513
|
+
[
|
|
3514
|
+
__spreadProps(__spreadValues({}, StaticMajorColorEditor_default), {
|
|
3515
|
+
editorProps: {
|
|
3516
|
+
themes
|
|
3237
3517
|
}
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3518
|
+
})
|
|
3519
|
+
],
|
|
3520
|
+
[getDynamicMajorColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
|
|
3521
|
+
[
|
|
3522
|
+
__spreadProps(__spreadValues({}, StaticTrendColorEditor_default), {
|
|
3523
|
+
editorProps: {
|
|
3524
|
+
themes
|
|
3525
|
+
}
|
|
3526
|
+
})
|
|
3527
|
+
],
|
|
3528
|
+
[getDynamicTrendColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
|
|
3529
|
+
[
|
|
3530
|
+
__spreadProps(__spreadValues({}, StaticBackgroundColorEditor_default), {
|
|
3531
|
+
editorProps: {
|
|
3532
|
+
themes
|
|
3533
|
+
}
|
|
3534
|
+
})
|
|
3535
|
+
],
|
|
3536
|
+
[
|
|
3537
|
+
__spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
|
|
3538
|
+
editorProps: {
|
|
3539
|
+
themes
|
|
3540
|
+
}
|
|
3541
|
+
})
|
|
3542
|
+
],
|
|
3543
|
+
[getDynamicBackgroundColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
|
|
3544
|
+
[
|
|
3545
|
+
{
|
|
3546
|
+
label: (0, i18n_exports._)("Major value size (px)"),
|
|
3547
|
+
option: "majorFontSize",
|
|
3548
|
+
editor: "editor.number",
|
|
3549
|
+
editorProps: {
|
|
3550
|
+
min: 1
|
|
3551
|
+
},
|
|
3552
|
+
placeholder: (0, i18n_exports._)("Auto"),
|
|
3553
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3554
|
+
},
|
|
3555
|
+
{
|
|
3556
|
+
label: (0, i18n_exports._)("Trend value size (px)"),
|
|
3557
|
+
option: "trendFontSize",
|
|
3558
|
+
editor: "editor.number",
|
|
3559
|
+
editorProps: {
|
|
3560
|
+
min: 1
|
|
3561
|
+
},
|
|
3562
|
+
placeholder: (0, i18n_exports._)("Auto"),
|
|
3563
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0,
|
|
3564
|
+
isDisabled: ({ options }) => options.trendDisplay === "off"
|
|
3248
3565
|
}
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
valueKeys.forEach((val) => {
|
|
3256
|
-
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3257
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3258
|
-
);
|
|
3259
|
-
splitDataSources[val].primary.data.fields = [
|
|
3260
|
-
{ name: otherSplitBy[0] },
|
|
3261
|
-
...dataSourceKeys.map((k) => ({
|
|
3262
|
-
name: k
|
|
3263
|
-
}))
|
|
3264
|
-
];
|
|
3265
|
-
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
3266
|
-
dataSourceKeys.forEach((dsKey) => {
|
|
3267
|
-
fields.forEach((field, idx) => {
|
|
3268
|
-
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
3269
|
-
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3270
|
-
}
|
|
3271
|
-
});
|
|
3272
|
-
});
|
|
3273
|
-
});
|
|
3274
|
-
}
|
|
3275
|
-
} else {
|
|
3276
|
-
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3277
|
-
}
|
|
3278
|
-
return { splitDataSources, errorCode };
|
|
3279
|
-
};
|
|
3280
|
-
var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
3281
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3282
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3283
|
-
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3284
|
-
let splitDataSources = null;
|
|
3285
|
-
let splitByFields = [];
|
|
3286
|
-
let errorCode = null;
|
|
3287
|
-
if (typeof fields[0] !== "string") {
|
|
3288
|
-
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
3289
|
-
}
|
|
3290
|
-
const splitByIndex = fields == null ? void 0 : fields.findIndex(
|
|
3291
|
-
(field) => field === splitBy || field.name === splitBy
|
|
3292
|
-
);
|
|
3293
|
-
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
3294
|
-
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
3295
|
-
splitDataSources = {};
|
|
3296
|
-
splitByColumn.forEach((val, idx) => {
|
|
3297
|
-
if (!splitDataSources[val]) {
|
|
3298
|
-
splitDataSources[val] = [idx];
|
|
3299
|
-
} else {
|
|
3300
|
-
splitDataSources[val].push(idx);
|
|
3301
|
-
}
|
|
3302
|
-
});
|
|
3303
|
-
const cloneFields = (0, lodash_exports.cloneDeep)(fields);
|
|
3304
|
-
cloneFields.splice(splitByIndex, 1);
|
|
3305
|
-
const valueKeys = Object.keys(splitDataSources);
|
|
3306
|
-
valueKeys.forEach((val) => {
|
|
3307
|
-
const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
|
|
3308
|
-
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3309
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3310
|
-
);
|
|
3311
|
-
splitDataSources[val].primary.data.fields = cloneFields;
|
|
3312
|
-
splitDataSources[val].primary.data.columns = [];
|
|
3313
|
-
columns.forEach((col, idx) => {
|
|
3314
|
-
if (idx !== splitByIndex) {
|
|
3315
|
-
const newCol = valIndices.map((valIdx) => col[valIdx]);
|
|
3316
|
-
splitDataSources[val].primary.data.columns.push(newCol);
|
|
3566
|
+
],
|
|
3567
|
+
[
|
|
3568
|
+
{
|
|
3569
|
+
label: (0, i18n_exports._)("Major value abbreviation"),
|
|
3570
|
+
option: "shouldAbbreviateMajorValue",
|
|
3571
|
+
editor: "editor.checkbox"
|
|
3317
3572
|
}
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3573
|
+
],
|
|
3574
|
+
[
|
|
3575
|
+
{
|
|
3576
|
+
label: (0, i18n_exports._)("Trend value abbreviation"),
|
|
3577
|
+
option: "shouldAbbreviateTrendValue",
|
|
3578
|
+
editor: "editor.checkbox"
|
|
3579
|
+
}
|
|
3580
|
+
],
|
|
3581
|
+
[
|
|
3582
|
+
{
|
|
3583
|
+
label: (0, i18n_exports._)("Alignment"),
|
|
3584
|
+
editor: "editor.radioBar",
|
|
3585
|
+
option: "align",
|
|
3586
|
+
editorProps: {
|
|
3587
|
+
values: [
|
|
3588
|
+
{ label: (0, i18n_exports._)("Left"), value: "left" },
|
|
3589
|
+
{ label: (0, i18n_exports._)("Center"), value: "center" },
|
|
3590
|
+
{ label: (0, i18n_exports._)("Right"), value: "right" }
|
|
3591
|
+
]
|
|
3592
|
+
},
|
|
3593
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3594
|
+
}
|
|
3595
|
+
]
|
|
3596
|
+
]
|
|
3322
3597
|
}
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3598
|
+
];
|
|
3599
|
+
var config = {
|
|
3600
|
+
/**
|
|
3601
|
+
* unique viz key
|
|
3602
|
+
*/
|
|
3603
|
+
key: "splunk.singlevalueicon",
|
|
3604
|
+
/**
|
|
3605
|
+
* viz name
|
|
3606
|
+
*/
|
|
3607
|
+
name: (0, i18n_exports._)("Single value icon"),
|
|
3608
|
+
category: "Single Value" /* SINGLE_VALUE */,
|
|
3609
|
+
/**
|
|
3610
|
+
* viz icon
|
|
3611
|
+
*/
|
|
3612
|
+
icon: null,
|
|
3613
|
+
dataContract,
|
|
3614
|
+
size,
|
|
3615
|
+
defaultContext,
|
|
3616
|
+
optionsSchema: visualization_schemas_exports.singleValueIconOptionsSchema,
|
|
3617
|
+
editorConfig,
|
|
3618
|
+
events: {
|
|
3619
|
+
"value.click": {
|
|
3620
|
+
description: "trigger when user clicks major value or icon",
|
|
3621
|
+
payloadKeys: ["majorValue", "trendValue", "icon"]
|
|
3336
3622
|
}
|
|
3337
|
-
}
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
}
|
|
3341
|
-
return result;
|
|
3623
|
+
},
|
|
3624
|
+
supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "events" /* EVENTS */, "trellis" /* TRELLIS */],
|
|
3625
|
+
themes
|
|
3342
3626
|
};
|
|
3627
|
+
var config_default = enhanceConfig(config);
|
|
3628
|
+
|
|
3629
|
+
// esm-externals:@splunk/react-ui/Paginator
|
|
3630
|
+
var Paginator_exports = {};
|
|
3631
|
+
__export(Paginator_exports, {
|
|
3632
|
+
default: () => Paginator_default
|
|
3633
|
+
});
|
|
3634
|
+
var defaultImport43 = __toESM(require("@splunk/react-ui/Paginator"));
|
|
3635
|
+
__reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
|
|
3636
|
+
var Paginator_default = "default" in defaultImport43 ? defaultImport43.default : defaultImport43;
|
|
3637
|
+
|
|
3638
|
+
// esm-externals:@splunk/themes
|
|
3639
|
+
var themes_exports = {};
|
|
3640
|
+
__export(themes_exports, {
|
|
3641
|
+
default: () => themes_default
|
|
3642
|
+
});
|
|
3643
|
+
var defaultImport44 = __toESM(require("@splunk/themes"));
|
|
3644
|
+
__reExport(themes_exports, require("@splunk/themes"));
|
|
3645
|
+
var themes_default = "default" in defaultImport44 ? defaultImport44.default : defaultImport44;
|
|
3646
|
+
|
|
3647
|
+
// esm-externals:@splunk/themes/useSplunkTheme
|
|
3648
|
+
var useSplunkTheme_exports = {};
|
|
3649
|
+
__export(useSplunkTheme_exports, {
|
|
3650
|
+
default: () => useSplunkTheme_default
|
|
3651
|
+
});
|
|
3652
|
+
var defaultImport45 = __toESM(require("@splunk/themes/useSplunkTheme"));
|
|
3653
|
+
__reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
|
|
3654
|
+
var useSplunkTheme_default = "default" in defaultImport45 ? defaultImport45.default : defaultImport45;
|
|
3343
3655
|
|
|
3344
3656
|
// src/common/hocs/withTrellis.tsx
|
|
3345
3657
|
var TrellisContainer = styled_components_default.div`
|
|
@@ -3403,7 +3715,11 @@ var withTrellis = (Viz) => {
|
|
|
3403
3715
|
trellisMinColumnWidth,
|
|
3404
3716
|
trellisRowHeight,
|
|
3405
3717
|
splitByLayout,
|
|
3406
|
-
trellisSplitBy
|
|
3718
|
+
trellisSplitBy,
|
|
3719
|
+
trellisSharedScale,
|
|
3720
|
+
stackMode,
|
|
3721
|
+
yAxisMin,
|
|
3722
|
+
yAxisMax
|
|
3407
3723
|
} = mergedOptions;
|
|
3408
3724
|
const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
|
|
3409
3725
|
const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
|
|
@@ -3474,10 +3790,10 @@ var withTrellis = (Viz) => {
|
|
|
3474
3790
|
[pageNum, pagedData]
|
|
3475
3791
|
);
|
|
3476
3792
|
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
3477
|
-
const
|
|
3793
|
+
const isTrellisFeatureFlagOn2 = Boolean(
|
|
3478
3794
|
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3479
3795
|
);
|
|
3480
|
-
if (!
|
|
3796
|
+
if (!isTrellisFeatureFlagOn2 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
3481
3797
|
return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
|
|
3482
3798
|
}
|
|
3483
3799
|
if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
@@ -3506,6 +3822,13 @@ var withTrellis = (Viz) => {
|
|
|
3506
3822
|
splitByKeys = splitByKeysModified;
|
|
3507
3823
|
totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
|
|
3508
3824
|
}
|
|
3825
|
+
const [calculatedMin, calculatedMax] = determineMinMax(
|
|
3826
|
+
modifiedDataSourceBySplitBy,
|
|
3827
|
+
trellisSharedScale,
|
|
3828
|
+
yAxisMin,
|
|
3829
|
+
yAxisMax,
|
|
3830
|
+
stackMode
|
|
3831
|
+
);
|
|
3509
3832
|
return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
|
|
3510
3833
|
TrellisContainerGrid,
|
|
3511
3834
|
{
|
|
@@ -3514,7 +3837,7 @@ var withTrellis = (Viz) => {
|
|
|
3514
3837
|
colMinWidth,
|
|
3515
3838
|
rowHeight
|
|
3516
3839
|
},
|
|
3517
|
-
pagedData
|
|
3840
|
+
pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
|
|
3518
3841
|
"div",
|
|
3519
3842
|
{
|
|
3520
3843
|
className: "child",
|
|
@@ -3535,7 +3858,10 @@ var withTrellis = (Viz) => {
|
|
|
3535
3858
|
trellisKey: splitByKey,
|
|
3536
3859
|
trellisSplitBy: currTrellisSplitBy,
|
|
3537
3860
|
dataSources: modifiedDataSourceBySplitBy[splitByKey],
|
|
3538
|
-
options,
|
|
3861
|
+
options: __spreadProps(__spreadValues({}, options), {
|
|
3862
|
+
yAxisMin: calculatedMin,
|
|
3863
|
+
yAxisMax: calculatedMax
|
|
3864
|
+
}),
|
|
3539
3865
|
key: `viz-${idx.toString()}`,
|
|
3540
3866
|
height: containerHeight,
|
|
3541
3867
|
width: containerWidth
|
|
@@ -3582,7 +3908,13 @@ var computeVizProps = ({
|
|
|
3582
3908
|
trellisSplitBy
|
|
3583
3909
|
};
|
|
3584
3910
|
};
|
|
3585
|
-
var
|
|
3911
|
+
var computeVizPropsBeforeEval = (options) => {
|
|
3912
|
+
const trendColor = getTrendColorWithPercent(options);
|
|
3913
|
+
return __spreadValues({}, trendColor);
|
|
3914
|
+
};
|
|
3915
|
+
var viz = withTrellis_default(
|
|
3916
|
+
withDashboardViz_default({ ReactViz: SingleValueIcon_default, vizConfig: config_default, computeVizProps, computeVizPropsBeforeEval })
|
|
3917
|
+
);
|
|
3586
3918
|
var { themes: themes2 } = config_default;
|
|
3587
3919
|
var SingleValueIcon_default2 = viz;
|
|
3588
3920
|
//# sourceMappingURL=SingleValueIcon.js.map
|