@splunk/visualizations 26.1.2 → 26.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 +2 -1
- package/Area.config.js.map +1 -1
- package/Area.js +1562 -433
- package/Area.js.map +1 -1
- package/Bar.config.js +1 -0
- package/Bar.config.js.map +1 -1
- package/Bar.js +1555 -430
- package/Bar.js.map +1 -1
- package/Bubble.config.js +1 -0
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +1580 -455
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +1 -0
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +1418 -351
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +2 -1
- package/Column.config.js.map +1 -1
- package/Column.js +1564 -435
- package/Column.js.map +1 -1
- package/Ellipse.config.js +1 -0
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +1342 -297
- package/Ellipse.js.map +1 -1
- package/Events.config.js +4 -0
- package/Events.config.js.map +1 -1
- package/Events.js +1503 -489
- package/Events.js.map +1 -1
- package/FEATUREFLAGS.md +3 -0
- package/FillerGauge.config.js +1 -0
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +1406 -345
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +1 -0
- package/Image.config.js.map +1 -1
- package/Image.js +2355 -1183
- package/Image.js.map +1 -1
- package/Line.config.js +2 -1
- package/Line.config.js.map +1 -1
- package/Line.js +1562 -433
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +1 -0
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +2013 -968
- package/LinkGraph.js.map +1 -1
- package/Map.config.js +1 -0
- package/Map.config.js.map +1 -1
- package/Map.js +2556 -1527
- package/Map.js.map +1 -1
- package/Markdown.config.js +1 -0
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +1952 -883
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +1 -0
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +4049 -2965
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +1 -0
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +3286 -2215
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +1 -0
- package/Pie.config.js.map +1 -1
- package/Pie.js +2187 -1036
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +1 -0
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +3397 -2299
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +1 -0
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +2181 -1112
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +1 -0
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +3275 -2199
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +1 -0
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +3551 -2400
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +27 -0
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +5551 -4397
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +1227 -1209
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +27 -0
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +2850 -1696
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +1 -0
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +6334 -5215
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +96 -96
- package/SparkLine.js.map +1 -1
- package/Table.config.js +172 -7
- package/Table.config.js.map +1 -1
- package/Table.js +3500 -2195
- package/Table.js.map +1 -1
- package/common/Charting.js +1009 -82
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +4 -4
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +54 -57
- package/common/DocExampleWithVizSandbox.js.map +1 -1
- package/common/EventsDoc.js +40 -40
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +15 -13
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +12 -12
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +34 -34
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +124 -103
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +49 -49
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +4 -4
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +31 -31
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +24 -8
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +4 -4
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +16 -16
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +36 -36
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +48 -47
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +832 -6
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/featureFlagUtils.js +139 -0
- package/common/utils/featureFlagUtils.js.map +1 -0
- package/common/utils/hocUtils.js +2 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -2
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +77 -54
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +28 -19
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -10
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +6 -6
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -2
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +1313 -235
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +13 -12
- package/__mocks__/fileMock.js +0 -2
- package/__mocks__/styleMock.js +0 -2
- package/babel.config.js +0 -11
- package/jest.config.js +0 -8
- package/loki.config.js +0 -14
package/Rectangle.js
CHANGED
|
@@ -87,7 +87,7 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 477);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -95,32 +95,46 @@ module.exports =
|
|
|
95
95
|
/***/ 0:
|
|
96
96
|
/***/ (function(module, exports) {
|
|
97
97
|
|
|
98
|
-
module.exports = require("
|
|
98
|
+
module.exports = require("react");
|
|
99
99
|
|
|
100
100
|
/***/ }),
|
|
101
101
|
|
|
102
102
|
/***/ 1:
|
|
103
103
|
/***/ (function(module, exports) {
|
|
104
104
|
|
|
105
|
-
module.exports = require("
|
|
105
|
+
module.exports = require("prop-types");
|
|
106
106
|
|
|
107
107
|
/***/ }),
|
|
108
108
|
|
|
109
109
|
/***/ 10:
|
|
110
110
|
/***/ (function(module, exports) {
|
|
111
111
|
|
|
112
|
-
module.exports = require("@
|
|
112
|
+
module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
113
113
|
|
|
114
114
|
/***/ }),
|
|
115
115
|
|
|
116
116
|
/***/ 11:
|
|
117
117
|
/***/ (function(module, exports) {
|
|
118
118
|
|
|
119
|
+
module.exports = require("@splunk/visualizations-shared/numberUtils");
|
|
120
|
+
|
|
121
|
+
/***/ }),
|
|
122
|
+
|
|
123
|
+
/***/ 12:
|
|
124
|
+
/***/ (function(module, exports) {
|
|
125
|
+
|
|
126
|
+
module.exports = require("@splunk/visualizations-shared/Message");
|
|
127
|
+
|
|
128
|
+
/***/ }),
|
|
129
|
+
|
|
130
|
+
/***/ 13:
|
|
131
|
+
/***/ (function(module, exports) {
|
|
132
|
+
|
|
119
133
|
module.exports = require("@splunk/themes/variables");
|
|
120
134
|
|
|
121
135
|
/***/ }),
|
|
122
136
|
|
|
123
|
-
/***/
|
|
137
|
+
/***/ 137:
|
|
124
138
|
/***/ (function(module, exports, __webpack_require__) {
|
|
125
139
|
|
|
126
140
|
"use strict";
|
|
@@ -133,7 +147,7 @@ exports.getDynamicFillColorEditor = void 0;
|
|
|
133
147
|
|
|
134
148
|
var i18n_1 = __webpack_require__(2);
|
|
135
149
|
|
|
136
|
-
var configUtils_1 = __webpack_require__(
|
|
150
|
+
var configUtils_1 = __webpack_require__(29);
|
|
137
151
|
|
|
138
152
|
var getDynamicFillColorEditor = function getDynamicFillColorEditor(_ref) {
|
|
139
153
|
var defaultContext = _ref.defaultContext,
|
|
@@ -176,7 +190,7 @@ exports.getDynamicFillColorEditor = getDynamicFillColorEditor;
|
|
|
176
190
|
|
|
177
191
|
/***/ }),
|
|
178
192
|
|
|
179
|
-
/***/
|
|
193
|
+
/***/ 138:
|
|
180
194
|
/***/ (function(module, exports, __webpack_require__) {
|
|
181
195
|
|
|
182
196
|
"use strict";
|
|
@@ -189,7 +203,7 @@ exports.getDynamicStrokeColorEditor = void 0;
|
|
|
189
203
|
|
|
190
204
|
var i18n_1 = __webpack_require__(2);
|
|
191
205
|
|
|
192
|
-
var configUtils_1 = __webpack_require__(
|
|
206
|
+
var configUtils_1 = __webpack_require__(29);
|
|
193
207
|
|
|
194
208
|
var getDynamicStrokeColorEditor = function getDynamicStrokeColorEditor(_ref) {
|
|
195
209
|
var defaultContext = _ref.defaultContext,
|
|
@@ -232,7 +246,7 @@ exports.getDynamicStrokeColorEditor = getDynamicStrokeColorEditor;
|
|
|
232
246
|
|
|
233
247
|
/***/ }),
|
|
234
248
|
|
|
235
|
-
/***/
|
|
249
|
+
/***/ 139:
|
|
236
250
|
/***/ (function(module, exports, __webpack_require__) {
|
|
237
251
|
|
|
238
252
|
"use strict";
|
|
@@ -244,7 +258,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
244
258
|
|
|
245
259
|
var i18n_1 = __webpack_require__(2);
|
|
246
260
|
|
|
247
|
-
var configUtils_1 = __webpack_require__(
|
|
261
|
+
var configUtils_1 = __webpack_require__(29);
|
|
248
262
|
|
|
249
263
|
var StaticFillColorEditor = {
|
|
250
264
|
label: (0, i18n_1._)('Fill'),
|
|
@@ -259,7 +273,482 @@ exports.default = StaticFillColorEditor;
|
|
|
259
273
|
|
|
260
274
|
/***/ }),
|
|
261
275
|
|
|
262
|
-
/***/
|
|
276
|
+
/***/ 14:
|
|
277
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
278
|
+
|
|
279
|
+
"use strict";
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
Object.defineProperty(exports, "__esModule", {
|
|
283
|
+
value: true
|
|
284
|
+
});
|
|
285
|
+
exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
|
|
286
|
+
|
|
287
|
+
var numberUtils_1 = __webpack_require__(11);
|
|
288
|
+
|
|
289
|
+
var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
293
|
+
if (!columns || !columns[0] || !columns[0].length) return [];
|
|
294
|
+
var data = [];
|
|
295
|
+
|
|
296
|
+
var _loop = function _loop(i) {
|
|
297
|
+
var newObj = {};
|
|
298
|
+
fields.forEach(function (field, index) {
|
|
299
|
+
var fieldName = typeof field === 'string' ? field : field.name;
|
|
300
|
+
|
|
301
|
+
if (columns[index][i] === '') {
|
|
302
|
+
newObj[fieldName] = null;
|
|
303
|
+
} else {
|
|
304
|
+
newObj[fieldName] = columns[index][i];
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
data.push(newObj);
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
for (var i = 0; i < columns[0].length; i += 1) {
|
|
311
|
+
_loop(i);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return data;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
|
|
318
|
+
// the spikes and overall shape of the chart
|
|
319
|
+
// Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
|
|
320
|
+
// Modifications include:
|
|
321
|
+
// 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
|
|
322
|
+
// 2) Convert to camel case
|
|
323
|
+
// 3) Convert to TS and also return the indices of the points that are in the downsampled result.
|
|
324
|
+
// 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
|
|
325
|
+
// that should be used in case of a tie of the max area in a bucket
|
|
326
|
+
|
|
327
|
+
var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
|
|
328
|
+
var dataLength = data.length;
|
|
329
|
+
var downsampledIndices = [];
|
|
330
|
+
|
|
331
|
+
if (threshold >= dataLength || threshold === 0) {
|
|
332
|
+
var allIndices = data.map(function (values, index) {
|
|
333
|
+
return index;
|
|
334
|
+
});
|
|
335
|
+
return {
|
|
336
|
+
downsampledData: data,
|
|
337
|
+
downsampledIndices: allIndices
|
|
338
|
+
}; // Nothing to do
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
var sampled = [];
|
|
342
|
+
var sampledIndex = 0; // Bucket size. Leave room for start and end data points
|
|
343
|
+
|
|
344
|
+
var every = (dataLength - 2) / (threshold - 2);
|
|
345
|
+
var a = 0; // Initially a is the first point in the triangle
|
|
346
|
+
|
|
347
|
+
var maxAreaPoint;
|
|
348
|
+
var maxArea;
|
|
349
|
+
var area;
|
|
350
|
+
var nextA;
|
|
351
|
+
sampled.push(data[a]); // Always add the first point
|
|
352
|
+
|
|
353
|
+
downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
|
|
354
|
+
|
|
355
|
+
for (var i = 0; i < threshold - 2; i++) {
|
|
356
|
+
// Calculate point average for next bucket (containing c)
|
|
357
|
+
var avgX = 0;
|
|
358
|
+
var avgY = 0;
|
|
359
|
+
var avgRangeStart = Math.floor((i + 1) * every) + 1;
|
|
360
|
+
var avgRangeEnd = Math.floor((i + 2) * every) + 1;
|
|
361
|
+
avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
|
|
362
|
+
var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
|
|
363
|
+
|
|
364
|
+
for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
|
|
365
|
+
avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
|
|
366
|
+
|
|
367
|
+
avgY += data[avgRangeStart][1] * 1;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
avgX /= avgRangeLength;
|
|
371
|
+
avgY /= avgRangeLength; // Get the range for this bucket
|
|
372
|
+
|
|
373
|
+
var rangeOffs = Math.floor((i + 0) * every) + 1;
|
|
374
|
+
var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
|
|
375
|
+
|
|
376
|
+
var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
|
|
377
|
+
|
|
378
|
+
var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
|
|
379
|
+
|
|
380
|
+
maxArea = area = -1;
|
|
381
|
+
var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
|
|
382
|
+
|
|
383
|
+
for (; rangeOffs < rangeTo; rangeOffs++) {
|
|
384
|
+
// Calculate triangle area over three buckets
|
|
385
|
+
area = Math.abs((pointAX - avgX) * (data[rangeOffs][1] - pointAY) - (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)) * 0.5; // Modification: try to downsample the least amount of points possible when there are multiple series
|
|
386
|
+
// If all points in a bucket have the same area, prioritize the one with an x index
|
|
387
|
+
// that also existed from another series so we don't add another point unnecessarily.
|
|
388
|
+
// By default LTTB picks the leftmost point in the bucket
|
|
389
|
+
|
|
390
|
+
if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
|
|
391
|
+
maxArea = area;
|
|
392
|
+
maxAreaPoint = data[rangeOffs];
|
|
393
|
+
nextA = rangeOffs; // Next a is this b
|
|
394
|
+
// Modification: save the index of the point with the most area
|
|
395
|
+
|
|
396
|
+
maxAreaIndex = rangeOffs;
|
|
397
|
+
}
|
|
398
|
+
} // eslint-disable-next-line no-plusplus
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
|
|
402
|
+
|
|
403
|
+
downsampledIndices.push(maxAreaIndex);
|
|
404
|
+
a = nextA; // This a is the next a (chosen b)
|
|
405
|
+
} // eslint-disable-next-line no-plusplus
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
|
|
409
|
+
|
|
410
|
+
downsampledIndices.push(dataLength - 1);
|
|
411
|
+
return {
|
|
412
|
+
downsampledData: sampled,
|
|
413
|
+
downsampledIndices: downsampledIndices
|
|
414
|
+
};
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
|
|
418
|
+
* if at least one of the values in the column can be loosely coerced to a number.
|
|
419
|
+
* If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
|
|
420
|
+
* returns that it cannot downsample the column.
|
|
421
|
+
*/
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
|
|
425
|
+
// Splunk charting allows for numbers in formats such as negative hex that
|
|
426
|
+
// Number() does not support and also allows loose coercion of hex numbers (but not other formats)
|
|
427
|
+
// We want to identify columns which contain at least one value that can be loosely coerced
|
|
428
|
+
var canLooselyCoerceSomeValues = column.findIndex(function (value) {
|
|
429
|
+
return (0, numberUtils_1.startsWithNumber)("".concat(value));
|
|
430
|
+
}) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
|
|
431
|
+
|
|
432
|
+
var coercedColumn = [];
|
|
433
|
+
var canDownsampleColumn = !column.some(function (value) {
|
|
434
|
+
var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
|
|
435
|
+
|
|
436
|
+
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
|
|
437
|
+
return true;
|
|
438
|
+
} // save value and continue to next
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
coercedColumn.push(coercedValue);
|
|
442
|
+
return false;
|
|
443
|
+
});
|
|
444
|
+
return {
|
|
445
|
+
canDownsampleColumn: canDownsampleColumn,
|
|
446
|
+
canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
|
|
447
|
+
coercedColumn: canDownsampleColumn ? coercedColumn : []
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
|
|
452
|
+
* Only strictly increasing x-columns are eligible for downsampling.
|
|
453
|
+
* If the column is not eligible for downsampling, returns an empty array.
|
|
454
|
+
*/
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
|
|
458
|
+
if (fieldType === 'number') {
|
|
459
|
+
var coercedXColumn = column.map(function (xValue) {
|
|
460
|
+
return Number(xValue);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
|
|
464
|
+
return coercedXColumn;
|
|
465
|
+
}
|
|
466
|
+
} else if (fieldType === 'time') {
|
|
467
|
+
var _coercedXColumn = column.map(function (xValue) {
|
|
468
|
+
return new Date(xValue);
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
|
|
472
|
+
return _coercedXColumn;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
return [];
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
|
|
480
|
+
var vizConfig = _ref.vizConfig;
|
|
481
|
+
|
|
482
|
+
var _a;
|
|
483
|
+
|
|
484
|
+
return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
|
|
488
|
+
|
|
489
|
+
var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
|
|
490
|
+
var firstIndex = _ref2.firstIndex,
|
|
491
|
+
lastIndex = _ref2.lastIndex,
|
|
492
|
+
dataSources = _ref2.dataSources,
|
|
493
|
+
width = _ref2.width;
|
|
494
|
+
|
|
495
|
+
var _a, _b, _c;
|
|
496
|
+
|
|
497
|
+
var window = lastIndex - firstIndex + 1;
|
|
498
|
+
var ratio = Math.round(Number(((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns[0]) === null || _c === void 0 ? void 0 : _c.length) / window) * 10) / 10;
|
|
499
|
+
return Math.round(ratio * Number(width));
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
|
|
503
|
+
/**
|
|
504
|
+
* Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
|
|
505
|
+
* then returns the width of the visualization.
|
|
506
|
+
*
|
|
507
|
+
* Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
|
|
508
|
+
* data sources. Returns null if the chart event's dataset does not match the passed in primary data source or if the chart is zoomed
|
|
509
|
+
* in for a categorical chart.
|
|
510
|
+
*/
|
|
511
|
+
|
|
512
|
+
var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
|
|
513
|
+
var enableSearchZoom = _ref3.enableSearchZoom,
|
|
514
|
+
dataSources = _ref3.dataSources,
|
|
515
|
+
selectChartEvent = _ref3.selectChartEvent,
|
|
516
|
+
width = _ref3.width,
|
|
517
|
+
xField = _ref3.xField,
|
|
518
|
+
y2Fields = _ref3.y2Fields;
|
|
519
|
+
|
|
520
|
+
var _a, _b, _c;
|
|
521
|
+
|
|
522
|
+
if (enableSearchZoom || !selectChartEvent) {
|
|
523
|
+
return Number(width);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
|
|
527
|
+
|
|
528
|
+
if (!primaryDataSource) {
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
var startXIndex = selectChartEvent.startXIndex,
|
|
533
|
+
endXIndex = selectChartEvent.endXIndex,
|
|
534
|
+
currentTarget = selectChartEvent.currentTarget;
|
|
535
|
+
|
|
536
|
+
try {
|
|
537
|
+
var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
|
|
538
|
+
return field.name === xField;
|
|
539
|
+
});
|
|
540
|
+
var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
|
|
541
|
+
return field === xField;
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
|
|
549
|
+
var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
|
|
550
|
+
var firstIndex = fullSeries.findIndex(function (x) {
|
|
551
|
+
return downsampledSeries[startXIndex] === x;
|
|
552
|
+
});
|
|
553
|
+
var lastIndex = fullSeries.findIndex(function (x) {
|
|
554
|
+
return downsampledSeries[endXIndex] === x;
|
|
555
|
+
}); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
|
|
556
|
+
// re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
|
|
557
|
+
// Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
|
|
558
|
+
// until SPL-259611 is fixed
|
|
559
|
+
|
|
560
|
+
if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
|
|
561
|
+
return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
|
|
565
|
+
return (0, exports.calculateThresholdOnRangeSelect)({
|
|
566
|
+
firstIndex: firstIndex,
|
|
567
|
+
lastIndex: lastIndex,
|
|
568
|
+
dataSources: dataSources,
|
|
569
|
+
width: width
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
} catch (e) {
|
|
573
|
+
console.error('Error occurred while setting downsample threshold on range select event', e);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
return null;
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
|
|
580
|
+
|
|
581
|
+
var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
|
|
582
|
+
return column.every(function (value, index) {
|
|
583
|
+
if (fieldType === 'number') {
|
|
584
|
+
if (Number.isNaN(value)) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
if (fieldType === 'time') {
|
|
590
|
+
if (Number.isNaN(value.getTime())) {
|
|
591
|
+
return false;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (index === 0) {
|
|
596
|
+
return true;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
return value > column[index - 1];
|
|
600
|
+
});
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
|
|
604
|
+
* displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
|
|
605
|
+
*
|
|
606
|
+
* If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
|
|
607
|
+
* If not all columns can be downsampled, then returns empty arrays for both x and y
|
|
608
|
+
*/
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
|
|
612
|
+
var xColumn = [];
|
|
613
|
+
var yColumns = [];
|
|
614
|
+
var canDownsample = !ds.data.fields.some(function (field, index) {
|
|
615
|
+
var _a, _b;
|
|
616
|
+
|
|
617
|
+
var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
|
|
618
|
+
var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
|
|
619
|
+
var column = ds.data.columns[index];
|
|
620
|
+
var hasDisplayedColumnThatCantBeDownsampled = false;
|
|
621
|
+
|
|
622
|
+
if (fieldName === xField) {
|
|
623
|
+
xColumn = strictlyCoerceXColumn(column, fieldType);
|
|
624
|
+
} else if (yFields.has(fieldName)) {
|
|
625
|
+
var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
|
|
626
|
+
coercedColumn = _strictlyCoerceYColum.coercedColumn,
|
|
627
|
+
canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
|
|
628
|
+
canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
|
|
629
|
+
// be downsampled using LTTB
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
|
|
633
|
+
|
|
634
|
+
if (hasDisplayedColumnThatCantBeDownsampled) {
|
|
635
|
+
return true;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (canDownsampleColumn) {
|
|
639
|
+
yColumns.push(coercedColumn);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
return false;
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
if (canDownsample) {
|
|
647
|
+
return {
|
|
648
|
+
xColumn: xColumn,
|
|
649
|
+
yColumns: yColumns
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
return {
|
|
654
|
+
xColumn: [],
|
|
655
|
+
yColumns: []
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
|
|
660
|
+
var sortedIndices = Array.from(indices).sort(function (a, b) {
|
|
661
|
+
return a - b;
|
|
662
|
+
});
|
|
663
|
+
var slicedColumns = [];
|
|
664
|
+
ds.data.columns.forEach(function (column) {
|
|
665
|
+
var slicedColumn = [];
|
|
666
|
+
sortedIndices.forEach(function (index) {
|
|
667
|
+
slicedColumn.push(column[index]);
|
|
668
|
+
});
|
|
669
|
+
slicedColumns.push(slicedColumn);
|
|
670
|
+
}); // update data columns with downsampled columns
|
|
671
|
+
|
|
672
|
+
return Object.assign(Object.assign({}, ds), {
|
|
673
|
+
data: Object.assign(Object.assign({}, ds.data), {
|
|
674
|
+
columns: slicedColumns
|
|
675
|
+
})
|
|
676
|
+
});
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
var downsampleDataSources = function downsampleDataSources(_ref4) {
|
|
680
|
+
var dataSources = _ref4.dataSources,
|
|
681
|
+
threshold = _ref4.threshold,
|
|
682
|
+
options = _ref4.options;
|
|
683
|
+
|
|
684
|
+
var _a, _b, _c;
|
|
685
|
+
|
|
686
|
+
var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
|
|
687
|
+
|
|
688
|
+
var numPoints = (_c = (_b = (_a = primaryDS === null || primaryDS === void 0 ? void 0 : primaryDS.data) === null || _a === void 0 ? void 0 : _a.columns[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
689
|
+
|
|
690
|
+
if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
|
|
691
|
+
return dataSources;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
var xField = options.xField,
|
|
695
|
+
yFields = options.yFields,
|
|
696
|
+
fieldTypes = options.fieldTypes;
|
|
697
|
+
|
|
698
|
+
if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
|
|
699
|
+
return dataSources;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
var nonInternalYFields = new Set(yFields.filter(function (yField) {
|
|
703
|
+
return !yField.startsWith('_');
|
|
704
|
+
}));
|
|
705
|
+
var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
|
|
706
|
+
// At the worst case, each series has non-overlapping downsampled pts
|
|
707
|
+
// which will mean that all points will be included in the downsampled result
|
|
708
|
+
// This will just lead to additional overhead due to coercing each
|
|
709
|
+
// x and y field to number
|
|
710
|
+
|
|
711
|
+
if (maxPointsInDownsample >= numPoints) {
|
|
712
|
+
return dataSources;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
|
|
716
|
+
xColumn = _tryToCoerceAllDispla.xColumn,
|
|
717
|
+
yColumns = _tryToCoerceAllDispla.yColumns;
|
|
718
|
+
|
|
719
|
+
if (!yColumns.length || !xColumn.length) {
|
|
720
|
+
return dataSources;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
var downsampledDataSources = Object.assign({}, dataSources);
|
|
724
|
+
var downsampledIndices = new Set();
|
|
725
|
+
yColumns.forEach(function (yColumn, columnIndex) {
|
|
726
|
+
// perform LTTB downsampling for current series, LTTB takes an [x, y] pair
|
|
727
|
+
var xyPair = yColumn.map(function (yValue, index) {
|
|
728
|
+
return [xColumn[index], yValue];
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
try {
|
|
732
|
+
var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
|
|
733
|
+
downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
|
|
734
|
+
|
|
735
|
+
downsampledIndicesForSeries.forEach(function (downsampleIndex) {
|
|
736
|
+
return downsampledIndices.add(downsampleIndex);
|
|
737
|
+
});
|
|
738
|
+
} catch (e) {
|
|
739
|
+
console.error("Error occurred while downsampling column ".concat(columnIndex), e);
|
|
740
|
+
}
|
|
741
|
+
}); // update data columns with downsampled columns
|
|
742
|
+
|
|
743
|
+
downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
|
|
744
|
+
return downsampledDataSources;
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
exports.downsampleDataSources = downsampleDataSources;
|
|
748
|
+
|
|
749
|
+
/***/ }),
|
|
750
|
+
|
|
751
|
+
/***/ 140:
|
|
263
752
|
/***/ (function(module, exports, __webpack_require__) {
|
|
264
753
|
|
|
265
754
|
"use strict";
|
|
@@ -271,7 +760,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
271
760
|
|
|
272
761
|
var i18n_1 = __webpack_require__(2);
|
|
273
762
|
|
|
274
|
-
var configUtils_1 = __webpack_require__(
|
|
763
|
+
var configUtils_1 = __webpack_require__(29);
|
|
275
764
|
|
|
276
765
|
var StaticStrokeColorEditor = {
|
|
277
766
|
label: (0, i18n_1._)('Stroke'),
|
|
@@ -286,13 +775,13 @@ exports.default = StaticStrokeColorEditor;
|
|
|
286
775
|
|
|
287
776
|
/***/ }),
|
|
288
777
|
|
|
289
|
-
/***/
|
|
778
|
+
/***/ 141:
|
|
290
779
|
/***/ (function(module, exports, __webpack_require__) {
|
|
291
780
|
|
|
292
781
|
"use strict";
|
|
293
782
|
|
|
294
783
|
|
|
295
|
-
var _taggedTemplateLiteral = __webpack_require__(
|
|
784
|
+
var _taggedTemplateLiteral = __webpack_require__(81);
|
|
296
785
|
|
|
297
786
|
var _templateObject;
|
|
298
787
|
|
|
@@ -305,11 +794,11 @@ var lodash_1 = __webpack_require__(3);
|
|
|
305
794
|
|
|
306
795
|
var styled_components_1 = __webpack_require__(4);
|
|
307
796
|
|
|
308
|
-
var pick_1 = __webpack_require__(
|
|
797
|
+
var pick_1 = __webpack_require__(30);
|
|
309
798
|
|
|
310
|
-
var variables_1 = __webpack_require__(
|
|
799
|
+
var variables_1 = __webpack_require__(13);
|
|
311
800
|
|
|
312
|
-
var propUtils_1 = __webpack_require__(
|
|
801
|
+
var propUtils_1 = __webpack_require__(36); // map for new options names to old option names
|
|
313
802
|
|
|
314
803
|
|
|
315
804
|
var shapeOptionsMapping = {
|
|
@@ -364,32 +853,41 @@ exports.getStyledShape = getStyledShape;
|
|
|
364
853
|
|
|
365
854
|
/***/ }),
|
|
366
855
|
|
|
367
|
-
/***/
|
|
856
|
+
/***/ 15:
|
|
368
857
|
/***/ (function(module, exports) {
|
|
369
858
|
|
|
370
859
|
module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
371
860
|
|
|
372
861
|
/***/ }),
|
|
373
862
|
|
|
374
|
-
/***/
|
|
863
|
+
/***/ 16:
|
|
864
|
+
/***/ (function(module, exports) {
|
|
865
|
+
|
|
866
|
+
module.exports = require("@splunk/visualization-encoding/Options");
|
|
867
|
+
|
|
868
|
+
/***/ }),
|
|
869
|
+
|
|
870
|
+
/***/ 17:
|
|
375
871
|
/***/ (function(module, exports, __webpack_require__) {
|
|
376
872
|
|
|
377
873
|
"use strict";
|
|
378
874
|
|
|
379
875
|
|
|
876
|
+
var _slicedToArray = __webpack_require__(7);
|
|
877
|
+
|
|
380
878
|
Object.defineProperty(exports, "__esModule", {
|
|
381
879
|
value: true
|
|
382
880
|
});
|
|
383
881
|
|
|
384
|
-
var React = __webpack_require__(
|
|
882
|
+
var React = __webpack_require__(0);
|
|
385
883
|
|
|
386
884
|
var styled_components_1 = __webpack_require__(4);
|
|
387
885
|
|
|
388
|
-
var
|
|
886
|
+
var style_1 = __webpack_require__(18);
|
|
389
887
|
|
|
390
|
-
var
|
|
888
|
+
var colorUtils_1 = __webpack_require__(15);
|
|
391
889
|
|
|
392
|
-
var
|
|
890
|
+
var SizeAwareWrapper_1 = __webpack_require__(26);
|
|
393
891
|
|
|
394
892
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
395
893
|
var width = _ref.width;
|
|
@@ -435,6 +933,20 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
435
933
|
var width = props.width,
|
|
436
934
|
height = props.height,
|
|
437
935
|
backgroundColor = props.backgroundColor;
|
|
936
|
+
var cachedHandleResize = React.useCallback(function (w, h) {
|
|
937
|
+
setContainerWidth(w);
|
|
938
|
+
setContainerHeight(h);
|
|
939
|
+
}, []);
|
|
940
|
+
|
|
941
|
+
var _React$useState = React.useState(Number(props.width)),
|
|
942
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
943
|
+
containerWidth = _React$useState2[0],
|
|
944
|
+
setContainerWidth = _React$useState2[1];
|
|
945
|
+
|
|
946
|
+
var _React$useState3 = React.useState(Number(props.height)),
|
|
947
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
948
|
+
containerHeight = _React$useState4[0],
|
|
949
|
+
setContainerHeight = _React$useState4[1];
|
|
438
950
|
|
|
439
951
|
if (!height) {
|
|
440
952
|
return React.createElement(Item, {
|
|
@@ -446,18 +958,18 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
446
958
|
|
|
447
959
|
return React.createElement(FixSizeItem, {
|
|
448
960
|
"data-test": "fix-size-item",
|
|
449
|
-
"data-splunk-visualization-version": "26.
|
|
961
|
+
"data-splunk-visualization-version": "26.2.0 - 49b909915",
|
|
450
962
|
width: width,
|
|
451
963
|
height: height,
|
|
452
964
|
backgroundColor: backgroundColor
|
|
453
|
-
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default,
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
})));
|
|
965
|
+
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, {
|
|
966
|
+
width: width,
|
|
967
|
+
height: height,
|
|
968
|
+
onResize: cachedHandleResize
|
|
969
|
+
}), React.createElement(Viz, Object.assign({}, props, {
|
|
970
|
+
width: containerWidth,
|
|
971
|
+
height: containerHeight
|
|
972
|
+
}))));
|
|
461
973
|
};
|
|
462
974
|
|
|
463
975
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
@@ -468,92 +980,52 @@ exports.default = withFixedSizeContainer;
|
|
|
468
980
|
|
|
469
981
|
/***/ }),
|
|
470
982
|
|
|
471
|
-
/***/
|
|
983
|
+
/***/ 18:
|
|
472
984
|
/***/ (function(module, exports) {
|
|
473
985
|
|
|
474
986
|
module.exports = require("@splunk/visualizations-shared/style");
|
|
475
987
|
|
|
476
988
|
/***/ }),
|
|
477
989
|
|
|
478
|
-
/***/
|
|
990
|
+
/***/ 188:
|
|
479
991
|
/***/ (function(module, exports, __webpack_require__) {
|
|
480
992
|
|
|
481
993
|
"use strict";
|
|
482
994
|
|
|
483
995
|
|
|
996
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
997
|
+
var t = {};
|
|
998
|
+
|
|
999
|
+
for (var p in s) {
|
|
1000
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1004
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1005
|
+
}
|
|
1006
|
+
return t;
|
|
1007
|
+
};
|
|
1008
|
+
|
|
484
1009
|
Object.defineProperty(exports, "__esModule", {
|
|
485
1010
|
value: true
|
|
486
1011
|
});
|
|
487
|
-
exports.
|
|
488
|
-
/**
|
|
489
|
-
* @method extendStaticWrapperProps
|
|
490
|
-
* @param {Object} props
|
|
491
|
-
* @param {DashboardVizType} props.Wrapper
|
|
492
|
-
* @param {DashboardVizType} props.Visualization
|
|
493
|
-
*/
|
|
1012
|
+
exports.config = exports.computeVizProps = void 0;
|
|
494
1013
|
|
|
495
|
-
var
|
|
496
|
-
var Wrapper = _ref.Wrapper,
|
|
497
|
-
Visualization = _ref.Visualization;
|
|
498
|
-
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
499
|
-
extendProperties.forEach(function (prop) {
|
|
500
|
-
if (Visualization[prop]) {
|
|
501
|
-
// eslint-disable-next-line no-param-reassign
|
|
502
|
-
Wrapper[prop] = Visualization[prop];
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
508
|
-
|
|
509
|
-
/***/ }),
|
|
510
|
-
|
|
511
|
-
/***/ 16:
|
|
512
|
-
/***/ (function(module, exports) {
|
|
513
|
-
|
|
514
|
-
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
515
|
-
|
|
516
|
-
/***/ }),
|
|
517
|
-
|
|
518
|
-
/***/ 166:
|
|
519
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
520
|
-
|
|
521
|
-
"use strict";
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
var __rest = this && this.__rest || function (s, e) {
|
|
525
|
-
var t = {};
|
|
526
|
-
|
|
527
|
-
for (var p in s) {
|
|
528
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
532
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
533
|
-
}
|
|
534
|
-
return t;
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
Object.defineProperty(exports, "__esModule", {
|
|
538
|
-
value: true
|
|
539
|
-
});
|
|
540
|
-
exports.config = exports.computeVizProps = void 0;
|
|
541
|
-
|
|
542
|
-
var React = __webpack_require__(1);
|
|
1014
|
+
var React = __webpack_require__(0);
|
|
543
1015
|
|
|
544
1016
|
var styled_components_1 = __webpack_require__(4);
|
|
545
1017
|
|
|
546
1018
|
var lodash_1 = __webpack_require__(3);
|
|
547
1019
|
|
|
548
|
-
var T = __webpack_require__(
|
|
1020
|
+
var T = __webpack_require__(1);
|
|
549
1021
|
|
|
550
|
-
var withDashboardViz_1 = __webpack_require__(
|
|
1022
|
+
var withDashboardViz_1 = __webpack_require__(56);
|
|
551
1023
|
|
|
552
|
-
var config_1 = __webpack_require__(
|
|
1024
|
+
var config_1 = __webpack_require__(478);
|
|
553
1025
|
|
|
554
1026
|
exports.config = config_1.default;
|
|
555
1027
|
|
|
556
|
-
var shapeUtils_1 = __webpack_require__(
|
|
1028
|
+
var shapeUtils_1 = __webpack_require__(141);
|
|
557
1029
|
|
|
558
1030
|
var SVGContainer = styled_components_1.default.svg.withConfig({
|
|
559
1031
|
displayName: "Rectangle__SVGContainer",
|
|
@@ -627,35 +1099,151 @@ exports.default = Rectangle;
|
|
|
627
1099
|
|
|
628
1100
|
/***/ }),
|
|
629
1101
|
|
|
630
|
-
/***/
|
|
1102
|
+
/***/ 19:
|
|
1103
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1104
|
+
|
|
1105
|
+
"use strict";
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1109
|
+
value: true
|
|
1110
|
+
});
|
|
1111
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1112
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1113
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
1114
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
1115
|
+
|
|
1116
|
+
/***/ }),
|
|
1117
|
+
|
|
1118
|
+
/***/ 2:
|
|
631
1119
|
/***/ (function(module, exports) {
|
|
632
1120
|
|
|
633
|
-
module.exports = require("@
|
|
1121
|
+
module.exports = require("@splunk/ui-utils/i18n");
|
|
634
1122
|
|
|
635
1123
|
/***/ }),
|
|
636
1124
|
|
|
637
|
-
/***/
|
|
1125
|
+
/***/ 21:
|
|
1126
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1127
|
+
|
|
1128
|
+
"use strict";
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
var _classCallCheck = __webpack_require__(10);
|
|
1132
|
+
|
|
1133
|
+
var _createClass = __webpack_require__(25);
|
|
1134
|
+
|
|
1135
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1136
|
+
value: true
|
|
1137
|
+
});
|
|
1138
|
+
exports.DefaultVizActionHandler = void 0;
|
|
1139
|
+
|
|
1140
|
+
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1141
|
+
function DefaultVizActionHandler() {
|
|
1142
|
+
_classCallCheck(this, DefaultVizActionHandler);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
_createClass(DefaultVizActionHandler, [{
|
|
1146
|
+
key: "focus",
|
|
1147
|
+
value: function focus() {// noop
|
|
1148
|
+
}
|
|
1149
|
+
}, {
|
|
1150
|
+
key: "snapshot",
|
|
1151
|
+
value: function snapshot() {
|
|
1152
|
+
return null; // noop
|
|
1153
|
+
}
|
|
1154
|
+
}]);
|
|
1155
|
+
|
|
1156
|
+
return DefaultVizActionHandler;
|
|
1157
|
+
}();
|
|
1158
|
+
|
|
1159
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1160
|
+
|
|
1161
|
+
/***/ }),
|
|
1162
|
+
|
|
1163
|
+
/***/ 22:
|
|
1164
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1165
|
+
|
|
1166
|
+
"use strict";
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1170
|
+
value: true
|
|
1171
|
+
});
|
|
1172
|
+
exports.VizCategory = void 0;
|
|
1173
|
+
var VizCategory;
|
|
1174
|
+
|
|
1175
|
+
(function (VizCategory) {
|
|
1176
|
+
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1177
|
+
VizCategory["TRENDS"] = "Trends";
|
|
1178
|
+
VizCategory["COMPARISONS"] = "Comparisons";
|
|
1179
|
+
VizCategory["TABLE"] = "Table";
|
|
1180
|
+
VizCategory["GAUGE"] = "Gauge";
|
|
1181
|
+
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
1182
|
+
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
1183
|
+
VizCategory["SHAPES"] = "Shapes";
|
|
1184
|
+
VizCategory["MISC"] = "misc";
|
|
1185
|
+
VizCategory["FLOW"] = "Flow";
|
|
1186
|
+
VizCategory["CORRELATION"] = "Correlation";
|
|
1187
|
+
VizCategory["SPATIAL"] = "Spatial";
|
|
1188
|
+
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
1189
|
+
|
|
1190
|
+
/***/ }),
|
|
1191
|
+
|
|
1192
|
+
/***/ 23:
|
|
1193
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1194
|
+
|
|
1195
|
+
"use strict";
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1199
|
+
value: true
|
|
1200
|
+
});
|
|
1201
|
+
exports.extendStaticWrapperProps = void 0;
|
|
1202
|
+
/**
|
|
1203
|
+
* @method extendStaticWrapperProps
|
|
1204
|
+
* @param {Object} props
|
|
1205
|
+
* @param {DashboardVizType} props.Wrapper
|
|
1206
|
+
* @param {DashboardVizType} props.Visualization
|
|
1207
|
+
*/
|
|
1208
|
+
|
|
1209
|
+
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
1210
|
+
var Wrapper = _ref.Wrapper,
|
|
1211
|
+
Visualization = _ref.Visualization;
|
|
1212
|
+
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
1213
|
+
extendProperties.forEach(function (prop) {
|
|
1214
|
+
if (Visualization[prop]) {
|
|
1215
|
+
// eslint-disable-next-line no-param-reassign
|
|
1216
|
+
Wrapper[prop] = Visualization[prop];
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
1222
|
+
|
|
1223
|
+
/***/ }),
|
|
1224
|
+
|
|
1225
|
+
/***/ 24:
|
|
638
1226
|
/***/ (function(module, exports) {
|
|
639
1227
|
|
|
640
|
-
module.exports = require("@
|
|
1228
|
+
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
641
1229
|
|
|
642
1230
|
/***/ }),
|
|
643
1231
|
|
|
644
|
-
/***/
|
|
1232
|
+
/***/ 25:
|
|
645
1233
|
/***/ (function(module, exports) {
|
|
646
1234
|
|
|
647
|
-
module.exports = require("@
|
|
1235
|
+
module.exports = require("@babel/runtime/helpers/createClass");
|
|
648
1236
|
|
|
649
1237
|
/***/ }),
|
|
650
1238
|
|
|
651
|
-
/***/
|
|
1239
|
+
/***/ 26:
|
|
652
1240
|
/***/ (function(module, exports) {
|
|
653
1241
|
|
|
654
|
-
module.exports = require("@splunk/
|
|
1242
|
+
module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
655
1243
|
|
|
656
1244
|
/***/ }),
|
|
657
1245
|
|
|
658
|
-
/***/
|
|
1246
|
+
/***/ 27:
|
|
659
1247
|
/***/ (function(module, exports, __webpack_require__) {
|
|
660
1248
|
|
|
661
1249
|
"use strict";
|
|
@@ -663,7 +1251,7 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
663
1251
|
|
|
664
1252
|
var _toConsumableArray = __webpack_require__(8);
|
|
665
1253
|
|
|
666
|
-
var _defineProperty = __webpack_require__(
|
|
1254
|
+
var _defineProperty = __webpack_require__(9);
|
|
667
1255
|
|
|
668
1256
|
var __rest = this && this.__rest || function (s, e) {
|
|
669
1257
|
var t = {};
|
|
@@ -685,7 +1273,7 @@ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig
|
|
|
685
1273
|
|
|
686
1274
|
var lodash_1 = __webpack_require__(3);
|
|
687
1275
|
|
|
688
|
-
var schemaUtils_1 = __webpack_require__(
|
|
1276
|
+
var schemaUtils_1 = __webpack_require__(24);
|
|
689
1277
|
|
|
690
1278
|
var VizBehavior_1 = __webpack_require__(6);
|
|
691
1279
|
|
|
@@ -892,77 +1480,94 @@ exports.insertLayout = insertLayout;
|
|
|
892
1480
|
|
|
893
1481
|
/***/ }),
|
|
894
1482
|
|
|
895
|
-
/***/
|
|
1483
|
+
/***/ 28:
|
|
896
1484
|
/***/ (function(module, exports) {
|
|
897
1485
|
|
|
898
1486
|
module.exports = require("@splunk/visualization-context/FeatureFlagContext");
|
|
899
1487
|
|
|
900
1488
|
/***/ }),
|
|
901
1489
|
|
|
902
|
-
/***/
|
|
1490
|
+
/***/ 29:
|
|
903
1491
|
/***/ (function(module, exports) {
|
|
904
1492
|
|
|
905
1493
|
module.exports = require("@splunk/visualizations-shared/configUtils");
|
|
906
1494
|
|
|
907
1495
|
/***/ }),
|
|
908
1496
|
|
|
909
|
-
/***/
|
|
1497
|
+
/***/ 3:
|
|
1498
|
+
/***/ (function(module, exports) {
|
|
1499
|
+
|
|
1500
|
+
module.exports = require("lodash");
|
|
1501
|
+
|
|
1502
|
+
/***/ }),
|
|
1503
|
+
|
|
1504
|
+
/***/ 30:
|
|
910
1505
|
/***/ (function(module, exports) {
|
|
911
1506
|
|
|
912
1507
|
module.exports = require("@splunk/themes/pick");
|
|
913
1508
|
|
|
914
1509
|
/***/ }),
|
|
915
1510
|
|
|
916
|
-
/***/
|
|
1511
|
+
/***/ 31:
|
|
917
1512
|
/***/ (function(module, exports) {
|
|
918
1513
|
|
|
919
1514
|
module.exports = require("@splunk/ui-utils/id");
|
|
920
1515
|
|
|
921
1516
|
/***/ }),
|
|
922
1517
|
|
|
923
|
-
/***/
|
|
1518
|
+
/***/ 32:
|
|
924
1519
|
/***/ (function(module, exports) {
|
|
925
1520
|
|
|
926
1521
|
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
927
1522
|
|
|
928
1523
|
/***/ }),
|
|
929
1524
|
|
|
930
|
-
/***/
|
|
931
|
-
/***/ (function(module, exports) {
|
|
1525
|
+
/***/ 33:
|
|
1526
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
932
1527
|
|
|
933
|
-
|
|
1528
|
+
"use strict";
|
|
934
1529
|
|
|
935
|
-
/***/ }),
|
|
936
1530
|
|
|
937
|
-
|
|
938
|
-
|
|
1531
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1532
|
+
value: true
|
|
1533
|
+
});
|
|
939
1534
|
|
|
940
|
-
|
|
1535
|
+
var react_1 = __webpack_require__(0);
|
|
1536
|
+
|
|
1537
|
+
function usePrevious(value) {
|
|
1538
|
+
var ref = (0, react_1.useRef)();
|
|
1539
|
+
(0, react_1.useEffect)(function () {
|
|
1540
|
+
ref.current = value;
|
|
1541
|
+
});
|
|
1542
|
+
return ref.current;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
exports.default = usePrevious;
|
|
941
1546
|
|
|
942
1547
|
/***/ }),
|
|
943
1548
|
|
|
944
|
-
/***/
|
|
1549
|
+
/***/ 34:
|
|
945
1550
|
/***/ (function(module, exports) {
|
|
946
1551
|
|
|
947
|
-
module.exports = require("@splunk/visualizations-shared/
|
|
1552
|
+
module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
948
1553
|
|
|
949
1554
|
/***/ }),
|
|
950
1555
|
|
|
951
|
-
/***/
|
|
1556
|
+
/***/ 35:
|
|
952
1557
|
/***/ (function(module, exports) {
|
|
953
1558
|
|
|
954
|
-
module.exports = require("
|
|
1559
|
+
module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
|
|
955
1560
|
|
|
956
1561
|
/***/ }),
|
|
957
1562
|
|
|
958
|
-
/***/
|
|
1563
|
+
/***/ 36:
|
|
959
1564
|
/***/ (function(module, exports) {
|
|
960
1565
|
|
|
961
|
-
module.exports = require("@splunk/
|
|
1566
|
+
module.exports = require("@splunk/visualizations-shared/propUtils");
|
|
962
1567
|
|
|
963
1568
|
/***/ }),
|
|
964
1569
|
|
|
965
|
-
/***/
|
|
1570
|
+
/***/ 37:
|
|
966
1571
|
/***/ (function(module, exports, __webpack_require__) {
|
|
967
1572
|
|
|
968
1573
|
"use strict";
|
|
@@ -973,17 +1578,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
973
1578
|
});
|
|
974
1579
|
exports.shouldShowIconPlaceholder = void 0;
|
|
975
1580
|
|
|
976
|
-
var React = __webpack_require__(
|
|
1581
|
+
var React = __webpack_require__(0);
|
|
977
1582
|
|
|
978
|
-
var T = __webpack_require__(
|
|
1583
|
+
var T = __webpack_require__(1);
|
|
979
1584
|
|
|
980
1585
|
var lodash_1 = __webpack_require__(3);
|
|
981
1586
|
|
|
982
1587
|
var i18n_1 = __webpack_require__(2);
|
|
983
1588
|
|
|
984
|
-
var Message_1 = __webpack_require__(
|
|
1589
|
+
var Message_1 = __webpack_require__(12);
|
|
985
1590
|
|
|
986
|
-
var FixedSizeContainer_1 = __webpack_require__(
|
|
1591
|
+
var FixedSizeContainer_1 = __webpack_require__(17);
|
|
987
1592
|
/**
|
|
988
1593
|
* @method shouldShowIconPlaceholder
|
|
989
1594
|
* @param {object} dataSources
|
|
@@ -1055,24 +1660,24 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
1055
1660
|
|
|
1056
1661
|
/***/ }),
|
|
1057
1662
|
|
|
1058
|
-
/***/
|
|
1663
|
+
/***/ 38:
|
|
1059
1664
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1060
1665
|
|
|
1061
1666
|
"use strict";
|
|
1062
1667
|
|
|
1063
1668
|
|
|
1064
|
-
var _defineProperty = __webpack_require__(
|
|
1669
|
+
var _defineProperty = __webpack_require__(9);
|
|
1065
1670
|
|
|
1066
1671
|
Object.defineProperty(exports, "__esModule", {
|
|
1067
1672
|
value: true
|
|
1068
1673
|
});
|
|
1069
1674
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
1070
1675
|
|
|
1071
|
-
var T = __webpack_require__(
|
|
1676
|
+
var T = __webpack_require__(1);
|
|
1072
1677
|
|
|
1073
1678
|
var lodash_1 = __webpack_require__(3);
|
|
1074
1679
|
|
|
1075
|
-
var DataSource_1 = __webpack_require__(
|
|
1680
|
+
var DataSource_1 = __webpack_require__(19);
|
|
1076
1681
|
|
|
1077
1682
|
exports.SortParamsPropTypes = T.shape({
|
|
1078
1683
|
currentSortKey: T.string,
|
|
@@ -1126,23 +1731,7 @@ exports.getSortingParams = getSortingParams;
|
|
|
1126
1731
|
|
|
1127
1732
|
/***/ }),
|
|
1128
1733
|
|
|
1129
|
-
/***/
|
|
1130
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1131
|
-
|
|
1132
|
-
"use strict";
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1136
|
-
value: true
|
|
1137
|
-
});
|
|
1138
|
-
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1139
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1140
|
-
exports.validSegmentationModes = ['none', 'inner'];
|
|
1141
|
-
exports.validOutputModes = ['json_cols', 'json'];
|
|
1142
|
-
|
|
1143
|
-
/***/ }),
|
|
1144
|
-
|
|
1145
|
-
/***/ 35:
|
|
1734
|
+
/***/ 39:
|
|
1146
1735
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1147
1736
|
|
|
1148
1737
|
"use strict";
|
|
@@ -1153,7 +1742,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1153
1742
|
});
|
|
1154
1743
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1155
1744
|
|
|
1156
|
-
var T = __webpack_require__(
|
|
1745
|
+
var T = __webpack_require__(1);
|
|
1157
1746
|
|
|
1158
1747
|
var lodash_1 = __webpack_require__(3);
|
|
1159
1748
|
|
|
@@ -1207,1132 +1796,1403 @@ exports.getPaginationParams = getPaginationParams;
|
|
|
1207
1796
|
|
|
1208
1797
|
/***/ }),
|
|
1209
1798
|
|
|
1210
|
-
/***/
|
|
1799
|
+
/***/ 4:
|
|
1800
|
+
/***/ (function(module, exports) {
|
|
1801
|
+
|
|
1802
|
+
module.exports = require("styled-components");
|
|
1803
|
+
|
|
1804
|
+
/***/ }),
|
|
1805
|
+
|
|
1806
|
+
/***/ 40:
|
|
1211
1807
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1212
1808
|
|
|
1213
1809
|
"use strict";
|
|
1214
1810
|
|
|
1215
1811
|
|
|
1216
|
-
Object.
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
exports.VizCategory = void 0;
|
|
1220
|
-
var VizCategory;
|
|
1812
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1813
|
+
if (k2 === undefined) k2 = k;
|
|
1814
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1221
1815
|
|
|
1222
|
-
(
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
VizCategory["SHAPES"] = "Shapes";
|
|
1231
|
-
VizCategory["MISC"] = "misc";
|
|
1232
|
-
VizCategory["FLOW"] = "Flow";
|
|
1233
|
-
VizCategory["CORRELATION"] = "Correlation";
|
|
1234
|
-
VizCategory["SPATIAL"] = "Spatial";
|
|
1235
|
-
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
1236
|
-
|
|
1237
|
-
/***/ }),
|
|
1238
|
-
|
|
1239
|
-
/***/ 37:
|
|
1240
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1241
|
-
|
|
1242
|
-
"use strict";
|
|
1816
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1817
|
+
desc = {
|
|
1818
|
+
enumerable: true,
|
|
1819
|
+
get: function get() {
|
|
1820
|
+
return m[k];
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
1243
1824
|
|
|
1825
|
+
Object.defineProperty(o, k2, desc);
|
|
1826
|
+
} : function (o, m, k, k2) {
|
|
1827
|
+
if (k2 === undefined) k2 = k;
|
|
1828
|
+
o[k2] = m[k];
|
|
1829
|
+
});
|
|
1244
1830
|
|
|
1245
|
-
var
|
|
1831
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1832
|
+
for (var p in m) {
|
|
1833
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1246
1836
|
|
|
1247
1837
|
Object.defineProperty(exports, "__esModule", {
|
|
1248
1838
|
value: true
|
|
1249
1839
|
});
|
|
1250
1840
|
|
|
1251
|
-
|
|
1841
|
+
__exportStar(__webpack_require__(41), exports);
|
|
1252
1842
|
|
|
1253
|
-
|
|
1843
|
+
__exportStar(__webpack_require__(42), exports);
|
|
1254
1844
|
|
|
1255
|
-
|
|
1845
|
+
__exportStar(__webpack_require__(19), exports);
|
|
1256
1846
|
|
|
1257
|
-
|
|
1847
|
+
__exportStar(__webpack_require__(43), exports);
|
|
1258
1848
|
|
|
1259
|
-
|
|
1849
|
+
__exportStar(__webpack_require__(44), exports);
|
|
1260
1850
|
|
|
1261
|
-
|
|
1851
|
+
__exportStar(__webpack_require__(45), exports);
|
|
1262
1852
|
|
|
1263
|
-
|
|
1853
|
+
__exportStar(__webpack_require__(46), exports);
|
|
1264
1854
|
|
|
1265
|
-
|
|
1855
|
+
__exportStar(__webpack_require__(47), exports);
|
|
1266
1856
|
|
|
1267
|
-
|
|
1857
|
+
__exportStar(__webpack_require__(48), exports);
|
|
1268
1858
|
|
|
1269
|
-
|
|
1859
|
+
__exportStar(__webpack_require__(49), exports);
|
|
1270
1860
|
|
|
1271
|
-
|
|
1861
|
+
__exportStar(__webpack_require__(21), exports);
|
|
1272
1862
|
|
|
1273
|
-
|
|
1863
|
+
__exportStar(__webpack_require__(6), exports);
|
|
1274
1864
|
|
|
1275
|
-
|
|
1865
|
+
__exportStar(__webpack_require__(22), exports);
|
|
1276
1866
|
|
|
1277
|
-
|
|
1867
|
+
__exportStar(__webpack_require__(50), exports);
|
|
1278
1868
|
|
|
1279
|
-
|
|
1869
|
+
__exportStar(__webpack_require__(51), exports);
|
|
1280
1870
|
|
|
1281
|
-
|
|
1871
|
+
__exportStar(__webpack_require__(52), exports);
|
|
1282
1872
|
|
|
1283
|
-
|
|
1873
|
+
__exportStar(__webpack_require__(53), exports);
|
|
1284
1874
|
|
|
1285
|
-
|
|
1875
|
+
__exportStar(__webpack_require__(54), exports);
|
|
1286
1876
|
|
|
1287
|
-
|
|
1877
|
+
__exportStar(__webpack_require__(55), exports);
|
|
1288
1878
|
|
|
1289
|
-
|
|
1879
|
+
/***/ }),
|
|
1290
1880
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
1294
|
-
* @param {DashboardVizOpts} opts
|
|
1295
|
-
* @returns {HOC}
|
|
1296
|
-
*/
|
|
1881
|
+
/***/ 41:
|
|
1882
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1297
1883
|
|
|
1884
|
+
"use strict";
|
|
1298
1885
|
|
|
1299
|
-
var withDashboardViz = function withDashboardViz(opts) {
|
|
1300
|
-
var ReactViz = opts.ReactViz,
|
|
1301
|
-
vizConfig = opts.vizConfig,
|
|
1302
|
-
_opts$computeVizProps = opts.computeVizProps,
|
|
1303
|
-
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1304
|
-
disableEditModeCover = opts.disableEditModeCover,
|
|
1305
|
-
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1306
1886
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1887
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1888
|
+
value: true
|
|
1889
|
+
});
|
|
1309
1890
|
|
|
1310
|
-
|
|
1311
|
-
var _a;
|
|
1891
|
+
/***/ }),
|
|
1312
1892
|
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
dataSources = props.dataSources,
|
|
1316
|
-
options = props.options,
|
|
1317
|
-
_props$context = props.context,
|
|
1318
|
-
context = _props$context === void 0 ? {} : _props$context,
|
|
1319
|
-
width = props.width,
|
|
1320
|
-
height = props.height,
|
|
1321
|
-
onComputedProps = props.onComputedProps,
|
|
1322
|
-
onEventTrigger = props.onEventTrigger,
|
|
1323
|
-
theme = props.theme,
|
|
1324
|
-
onRequestParamsChange = props.onRequestParamsChange;
|
|
1893
|
+
/***/ 42:
|
|
1894
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1325
1895
|
|
|
1326
|
-
|
|
1327
|
-
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1896
|
+
"use strict";
|
|
1328
1897
|
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
|
|
1333
|
-
will use it.
|
|
1334
|
-
@TODO(pwied):
|
|
1335
|
-
- remove when we moved away from @splunk/moment
|
|
1336
|
-
- provide timezone context to dynamic option evaluation phase
|
|
1337
|
-
*/
|
|
1338
|
-
if (!moment_1.default.getDefaultSplunkTimezone()) {
|
|
1339
|
-
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1898
|
+
/**
|
|
1899
|
+
* A data structure used at runtime to wire up a visualization.
|
|
1900
|
+
*/
|
|
1342
1901
|
|
|
1343
|
-
|
|
1344
|
-
|
|
1902
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1903
|
+
value: true
|
|
1904
|
+
});
|
|
1345
1905
|
|
|
1346
|
-
|
|
1347
|
-
};
|
|
1906
|
+
/***/ }),
|
|
1348
1907
|
|
|
1349
|
-
|
|
1908
|
+
/***/ 43:
|
|
1909
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1350
1910
|
|
|
1351
|
-
|
|
1352
|
-
theme: theme
|
|
1353
|
-
}),
|
|
1354
|
-
currentThemeFamily = _ref.family,
|
|
1355
|
-
currentThemeColorScheme = _ref.colorScheme,
|
|
1356
|
-
currentThemeDensity = _ref.density;
|
|
1911
|
+
"use strict";
|
|
1357
1912
|
|
|
1358
|
-
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1359
1913
|
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1914
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1915
|
+
value: true
|
|
1916
|
+
});
|
|
1364
1917
|
|
|
1918
|
+
/***/ }),
|
|
1365
1919
|
|
|
1366
|
-
|
|
1920
|
+
/***/ 44:
|
|
1921
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1367
1922
|
|
|
1368
|
-
|
|
1369
|
-
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1370
|
-
visualizationID = _React$useState4[0];
|
|
1923
|
+
"use strict";
|
|
1371
1924
|
|
|
1372
|
-
var _React$useState5 = React.useState({}),
|
|
1373
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1374
|
-
dataSourcesInState = _React$useState6[0],
|
|
1375
|
-
setDataSourcesInState = _React$useState6[1];
|
|
1376
1925
|
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
setDataFramesInState = _React$useState8[1];
|
|
1926
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1927
|
+
value: true
|
|
1928
|
+
});
|
|
1381
1929
|
|
|
1382
|
-
|
|
1383
|
-
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1384
|
-
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1385
|
-
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1930
|
+
/***/ }),
|
|
1386
1931
|
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
try {
|
|
1390
|
-
if (useAsyncEvaluatedOptions) {
|
|
1391
|
-
var optionsToEvaluate = {
|
|
1392
|
-
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1393
|
-
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1394
|
-
};
|
|
1395
|
-
var asyncDynamicOptionsEvaluatorParams = {
|
|
1396
|
-
visualizationID: visualizationID,
|
|
1397
|
-
props: props,
|
|
1398
|
-
options: optionsToEvaluate,
|
|
1399
|
-
dataSources: dataSources,
|
|
1400
|
-
theme: vizConfig.themes
|
|
1401
|
-
};
|
|
1402
|
-
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
1403
|
-
setEvaluatedOptionsAsync(results.results);
|
|
1404
|
-
}).catch(function () {
|
|
1405
|
-
if (isMounted.current) {
|
|
1406
|
-
setUseAsyncEvaluatedOptions(false);
|
|
1407
|
-
}
|
|
1408
|
-
});
|
|
1409
|
-
} else {
|
|
1410
|
-
var dataFrames = dataFramesInState;
|
|
1932
|
+
/***/ 45:
|
|
1933
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1411
1934
|
|
|
1412
|
-
|
|
1413
|
-
setDataSourcesInState(dataSources);
|
|
1414
|
-
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1415
|
-
setDataFramesInState(dataFrames);
|
|
1416
|
-
}
|
|
1935
|
+
"use strict";
|
|
1417
1936
|
|
|
1418
|
-
return Options_1.Options.evaluate({
|
|
1419
|
-
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1420
|
-
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1421
|
-
}, dataSources, themeFunc, dataFrames);
|
|
1422
|
-
}
|
|
1423
|
-
} catch (e) {
|
|
1424
|
-
// eslint-disable-next-line no-console
|
|
1425
|
-
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1426
|
-
return {};
|
|
1427
|
-
}
|
|
1428
1937
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
// if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
|
|
1433
|
-
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1938
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1939
|
+
value: true
|
|
1940
|
+
});
|
|
1434
1941
|
|
|
1435
|
-
|
|
1436
|
-
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1942
|
+
/***/ }),
|
|
1437
1943
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1441
|
-
});
|
|
1442
|
-
} // useEffect hook needs to be initialized before any early returns
|
|
1443
|
-
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1944
|
+
/***/ 46:
|
|
1945
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1444
1946
|
|
|
1947
|
+
"use strict";
|
|
1445
1948
|
|
|
1446
|
-
React.useEffect(function () {
|
|
1447
|
-
onComputedProps(clonedEvaluatedOptions);
|
|
1448
|
-
});
|
|
1449
|
-
React.useEffect(function () {
|
|
1450
|
-
return function () {
|
|
1451
|
-
if (useAsyncEvaluatedOptions) {
|
|
1452
|
-
isMounted.current = false;
|
|
1453
|
-
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1454
|
-
}
|
|
1455
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1456
|
-
}, []); // present warning message if any required props are missing
|
|
1457
1949
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1950
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1951
|
+
value: true
|
|
1952
|
+
});
|
|
1462
1953
|
|
|
1463
|
-
|
|
1464
|
-
) {
|
|
1465
|
-
return React.createElement(MissingPropsMessage_1.default, {
|
|
1466
|
-
"data-test": "missing-props-message",
|
|
1467
|
-
width: width,
|
|
1468
|
-
height: height,
|
|
1469
|
-
missingProps: missing,
|
|
1470
|
-
backgroundColor: bgColorFromTheme
|
|
1471
|
-
});
|
|
1472
|
-
} // events
|
|
1954
|
+
/***/ }),
|
|
1473
1955
|
|
|
1956
|
+
/***/ 47:
|
|
1957
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1474
1958
|
|
|
1475
|
-
|
|
1959
|
+
"use strict";
|
|
1476
1960
|
|
|
1477
|
-
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1478
|
-
var supportedEvents = vizConfig.events;
|
|
1479
|
-
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1480
|
-
var _supportedEvents$even = supportedEvents[eventName],
|
|
1481
|
-
parentKeys = _supportedEvents$even.parentKeys,
|
|
1482
|
-
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
1483
|
-
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
1484
|
-
// then remove these lines
|
|
1485
1961
|
|
|
1486
|
-
|
|
1962
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1963
|
+
value: true
|
|
1964
|
+
});
|
|
1487
1965
|
|
|
1488
|
-
|
|
1489
|
-
payloadKeys.forEach(function (p) {
|
|
1490
|
-
payload[p] = evaluatedOptionsToUse[p];
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1966
|
+
/***/ }),
|
|
1493
1967
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
payload = ev.payload;
|
|
1497
|
-
}
|
|
1968
|
+
/***/ 477:
|
|
1969
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1498
1970
|
|
|
1499
|
-
|
|
1500
|
-
originalEvent: ev,
|
|
1501
|
-
payload: payload,
|
|
1502
|
-
type: eventName
|
|
1503
|
-
});
|
|
1504
|
-
};
|
|
1971
|
+
"use strict";
|
|
1505
1972
|
|
|
1506
|
-
if (parentKeys) {
|
|
1507
|
-
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
1508
|
-
var newObject = {};
|
|
1509
|
-
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
1510
|
-
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
});
|
|
1514
|
-
} // compute pure viz props which are not from options
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1518
|
-
themeFunc: themeFunc
|
|
1519
|
-
}));
|
|
1520
|
-
/**
|
|
1521
|
-
* PAGE_AND_SORT behavior
|
|
1522
|
-
*
|
|
1523
|
-
* Some visualizations, like table, requires metadata about the datasource,
|
|
1524
|
-
* like total number of results, current count, offset, and sort, for rendering
|
|
1525
|
-
* paginator and sorting direction. In this approach, the visualization
|
|
1526
|
-
* allow users to set 'paginateDataSourceKey' to select which datasource
|
|
1527
|
-
* should the visualization extract the metadata from. It defaults to 'primary' datasource.
|
|
1528
|
-
* The visualization config should set the PAGE_AND_SORT behavior to receive
|
|
1529
|
-
* 'requestParams', 'meta' and onRequestParams callback as props.
|
|
1530
|
-
*
|
|
1531
|
-
* In future, we could automatically detect which all datasources are being used
|
|
1532
|
-
* and bind those magically to pagination/sorting behavior.
|
|
1533
|
-
*/
|
|
1534
|
-
|
|
1535
|
-
var dataSourceMetadata = {};
|
|
1536
|
-
var OptionKey = 'paginateDataSourceKey';
|
|
1537
|
-
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1538
|
-
|
|
1539
|
-
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1540
|
-
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1541
|
-
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1542
1973
|
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1548
|
-
requestParams: requestParams,
|
|
1549
|
-
meta: meta,
|
|
1550
|
-
onRequestParamsChange: handleRequestParamsChange
|
|
1551
|
-
});
|
|
1552
|
-
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
1553
|
-
requestParams: requestParams,
|
|
1554
|
-
meta: meta,
|
|
1555
|
-
onRequestParamsChange: handleRequestParamsChange
|
|
1556
|
-
});
|
|
1557
|
-
dataSourceMetadata = {
|
|
1558
|
-
sortParams: sortParams,
|
|
1559
|
-
paginatorParams: paginatorParams
|
|
1560
|
-
};
|
|
1561
|
-
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1565
|
-
return null;
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
|
-
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1569
|
-
mode: mode,
|
|
1570
|
-
width: width,
|
|
1571
|
-
height: height
|
|
1572
|
-
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1573
|
-
};
|
|
1974
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1975
|
+
if (k2 === undefined) k2 = k;
|
|
1976
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1574
1977
|
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1978
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1979
|
+
desc = {
|
|
1980
|
+
enumerable: true,
|
|
1981
|
+
get: function get() {
|
|
1982
|
+
return m[k];
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
}
|
|
1580
1986
|
|
|
1581
|
-
|
|
1987
|
+
Object.defineProperty(o, k2, desc);
|
|
1988
|
+
} : function (o, m, k, k2) {
|
|
1989
|
+
if (k2 === undefined) k2 = k;
|
|
1990
|
+
o[k2] = m[k];
|
|
1991
|
+
});
|
|
1582
1992
|
|
|
1583
|
-
|
|
1993
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1994
|
+
for (var p in m) {
|
|
1995
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1996
|
+
}
|
|
1584
1997
|
};
|
|
1585
1998
|
|
|
1586
|
-
exports
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
/***/ 38:
|
|
1591
|
-
/***/ (function(module, exports) {
|
|
1592
|
-
|
|
1593
|
-
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1594
|
-
|
|
1595
|
-
/***/ }),
|
|
1596
|
-
|
|
1597
|
-
/***/ 39:
|
|
1598
|
-
/***/ (function(module, exports) {
|
|
1599
|
-
|
|
1600
|
-
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1601
|
-
|
|
1602
|
-
/***/ }),
|
|
1603
|
-
|
|
1604
|
-
/***/ 4:
|
|
1605
|
-
/***/ (function(module, exports) {
|
|
1606
|
-
|
|
1607
|
-
module.exports = require("styled-components");
|
|
1608
|
-
|
|
1609
|
-
/***/ }),
|
|
1610
|
-
|
|
1611
|
-
/***/ 40:
|
|
1612
|
-
/***/ (function(module, exports) {
|
|
1613
|
-
|
|
1614
|
-
module.exports = require("@splunk/moment");
|
|
1999
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2000
|
+
value: true
|
|
2001
|
+
});
|
|
2002
|
+
exports.default = void 0;
|
|
1615
2003
|
|
|
1616
|
-
|
|
2004
|
+
__exportStar(__webpack_require__(188), exports);
|
|
1617
2005
|
|
|
1618
|
-
|
|
1619
|
-
/***/ (function(module, exports) {
|
|
2006
|
+
var Rectangle_1 = __webpack_require__(188);
|
|
1620
2007
|
|
|
1621
|
-
|
|
2008
|
+
Object.defineProperty(exports, "default", {
|
|
2009
|
+
enumerable: true,
|
|
2010
|
+
get: function get() {
|
|
2011
|
+
return Rectangle_1.default;
|
|
2012
|
+
}
|
|
2013
|
+
});
|
|
1622
2014
|
|
|
1623
2015
|
/***/ }),
|
|
1624
2016
|
|
|
1625
|
-
/***/
|
|
2017
|
+
/***/ 478:
|
|
1626
2018
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1627
2019
|
|
|
1628
2020
|
"use strict";
|
|
1629
2021
|
|
|
1630
2022
|
|
|
1631
|
-
var _classCallCheck = __webpack_require__(9);
|
|
1632
|
-
|
|
1633
2023
|
Object.defineProperty(exports, "__esModule", {
|
|
1634
2024
|
value: true
|
|
1635
2025
|
});
|
|
1636
|
-
exports.
|
|
1637
|
-
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1638
|
-
|
|
1639
|
-
var T = __webpack_require__(0);
|
|
1640
|
-
|
|
1641
|
-
var lodash_1 = __webpack_require__(3);
|
|
1642
|
-
|
|
1643
|
-
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
exports.INITIAL_WIDTH = 250;
|
|
1647
|
-
exports.INITIAL_HEIGHT = 250;
|
|
1648
|
-
/**
|
|
1649
|
-
* A Splunk visualization
|
|
1650
|
-
*/
|
|
1651
|
-
|
|
1652
|
-
var SplunkVisualization = function SplunkVisualization() {
|
|
1653
|
-
_classCallCheck(this, SplunkVisualization);
|
|
1654
|
-
};
|
|
1655
|
-
|
|
1656
|
-
SplunkVisualization.propTypes = {
|
|
1657
|
-
/**
|
|
1658
|
-
* display mode
|
|
1659
|
-
*/
|
|
1660
|
-
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1661
|
-
|
|
1662
|
-
/**
|
|
1663
|
-
* width in pixel or string, defaults to 100%
|
|
1664
|
-
*/
|
|
1665
|
-
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
2026
|
+
exports.optionsSchema = void 0;
|
|
1666
2027
|
|
|
1667
|
-
|
|
1668
|
-
* height in pixel or string
|
|
1669
|
-
*/
|
|
1670
|
-
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
2028
|
+
var visualization_icons_1 = __webpack_require__(74);
|
|
1671
2029
|
|
|
1672
|
-
|
|
1673
|
-
* visualization context used for dynamic option evaluation
|
|
1674
|
-
*/
|
|
1675
|
-
context: T.object,
|
|
2030
|
+
var schemaUtils_1 = __webpack_require__(24);
|
|
1676
2031
|
|
|
1677
|
-
|
|
1678
|
-
* visualization formatting options
|
|
1679
|
-
*/
|
|
1680
|
-
options: T.object,
|
|
2032
|
+
var i18n_1 = __webpack_require__(2);
|
|
1681
2033
|
|
|
1682
|
-
|
|
1683
|
-
* A callback to update formatting options
|
|
1684
|
-
*/
|
|
1685
|
-
onOptionsChange: T.func,
|
|
2034
|
+
var PresetPalettes_1 = __webpack_require__(83);
|
|
1686
2035
|
|
|
1687
|
-
|
|
1688
|
-
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1689
|
-
*/
|
|
1690
|
-
dataSources: T.objectOf(T.shape({
|
|
1691
|
-
/**
|
|
1692
|
-
* current request params
|
|
1693
|
-
*/
|
|
1694
|
-
requestParams: T.object,
|
|
2036
|
+
var themes_1 = __webpack_require__(82);
|
|
1695
2037
|
|
|
1696
|
-
|
|
1697
|
-
* current dataset
|
|
1698
|
-
*/
|
|
1699
|
-
data: T.shape({
|
|
1700
|
-
fields: T.array,
|
|
1701
|
-
columns: T.array
|
|
1702
|
-
}),
|
|
2038
|
+
var VizBehavior_1 = __webpack_require__(6);
|
|
1703
2039
|
|
|
1704
|
-
|
|
1705
|
-
* error
|
|
1706
|
-
*/
|
|
1707
|
-
error: T.shape({
|
|
1708
|
-
level: T.string,
|
|
1709
|
-
message: T.string
|
|
1710
|
-
}),
|
|
2040
|
+
var VizCategory_1 = __webpack_require__(22);
|
|
1711
2041
|
|
|
1712
|
-
|
|
1713
|
-
* meta data that came with the dataset
|
|
1714
|
-
*/
|
|
1715
|
-
meta: T.object
|
|
1716
|
-
})),
|
|
2042
|
+
var configUtils_1 = __webpack_require__(27);
|
|
1717
2043
|
|
|
1718
|
-
|
|
1719
|
-
* A callback to trigger event
|
|
1720
|
-
*/
|
|
1721
|
-
onEventTrigger: T.func,
|
|
2044
|
+
var DynamicFillColorEditor_1 = __webpack_require__(137);
|
|
1722
2045
|
|
|
1723
|
-
|
|
1724
|
-
* Inform viz if there are handlers listening to events
|
|
1725
|
-
*/
|
|
1726
|
-
hasEventHandlers: T.bool,
|
|
2046
|
+
var DynamicStrokeColorEditor_1 = __webpack_require__(138);
|
|
1727
2047
|
|
|
1728
|
-
|
|
1729
|
-
* A callback to communicate computed props to a consumer
|
|
1730
|
-
*/
|
|
1731
|
-
onComputedProps: T.func,
|
|
2048
|
+
var StaticFillColorEditor_1 = __webpack_require__(139);
|
|
1732
2049
|
|
|
1733
|
-
|
|
1734
|
-
* A callback to obtain visualization api
|
|
1735
|
-
*/
|
|
1736
|
-
vizActionHandlerRef: T.func,
|
|
1737
|
-
loading: T.bool,
|
|
1738
|
-
theme: T.object,
|
|
2050
|
+
var StaticStrokeColorEditor_1 = __webpack_require__(140);
|
|
1739
2051
|
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
2052
|
+
var dataContract = {
|
|
2053
|
+
requiredDataSources: [],
|
|
2054
|
+
optionalDataSources: [{
|
|
2055
|
+
name: 'primary',
|
|
2056
|
+
description: 'DataSource that powers the visualization'
|
|
2057
|
+
}],
|
|
2058
|
+
initialRequestParams: {
|
|
2059
|
+
primary: {
|
|
2060
|
+
offset: 0,
|
|
2061
|
+
count: 10000
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
1744
2064
|
};
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
2065
|
+
var size = {
|
|
2066
|
+
initialWidth: 300,
|
|
2067
|
+
initialHeight: 300
|
|
2068
|
+
};
|
|
2069
|
+
var defaultContext = {
|
|
2070
|
+
fillColorConfig: [{
|
|
2071
|
+
from: 100,
|
|
2072
|
+
value: '#088F44'
|
|
2073
|
+
}, {
|
|
2074
|
+
from: 80,
|
|
2075
|
+
to: 100,
|
|
2076
|
+
value: '#2EB82E'
|
|
2077
|
+
}, {
|
|
2078
|
+
from: 60,
|
|
2079
|
+
to: 80,
|
|
2080
|
+
value: '#C3CC33'
|
|
2081
|
+
}, {
|
|
2082
|
+
from: 40,
|
|
2083
|
+
to: 60,
|
|
2084
|
+
value: '#FFD442'
|
|
2085
|
+
}, {
|
|
2086
|
+
from: 20,
|
|
2087
|
+
to: 40,
|
|
2088
|
+
value: '#FFA857'
|
|
2089
|
+
}, {
|
|
2090
|
+
from: 0,
|
|
2091
|
+
to: 20,
|
|
2092
|
+
value: '#FF7149'
|
|
2093
|
+
}, {
|
|
2094
|
+
to: 0,
|
|
2095
|
+
value: '#FE3A3A'
|
|
2096
|
+
}],
|
|
2097
|
+
strokeColorConfig: [{
|
|
2098
|
+
from: 100,
|
|
2099
|
+
value: '#088F44'
|
|
2100
|
+
}, {
|
|
2101
|
+
from: 80,
|
|
2102
|
+
to: 100,
|
|
2103
|
+
value: '#2EB82E'
|
|
2104
|
+
}, {
|
|
2105
|
+
from: 60,
|
|
2106
|
+
to: 80,
|
|
2107
|
+
value: '#C3CC33'
|
|
2108
|
+
}, {
|
|
2109
|
+
from: 40,
|
|
2110
|
+
to: 60,
|
|
2111
|
+
value: '#FFD442'
|
|
2112
|
+
}, {
|
|
2113
|
+
from: 20,
|
|
2114
|
+
to: 40,
|
|
2115
|
+
value: '#FFA857'
|
|
2116
|
+
}, {
|
|
2117
|
+
from: 0,
|
|
2118
|
+
to: 20,
|
|
2119
|
+
value: '#FF7149'
|
|
2120
|
+
}, {
|
|
2121
|
+
to: 0,
|
|
2122
|
+
value: '#FE3A3A'
|
|
2123
|
+
}],
|
|
2124
|
+
fillColorMatchConfig: [{
|
|
2125
|
+
match: '',
|
|
2126
|
+
value: '#5C33FF'
|
|
2127
|
+
}],
|
|
2128
|
+
strokeColorMatchConfig: [{
|
|
2129
|
+
match: '',
|
|
2130
|
+
value: '#5C33FF'
|
|
2131
|
+
}]
|
|
2132
|
+
};
|
|
2133
|
+
exports.optionsSchema = {
|
|
2134
|
+
fillColor: {
|
|
2135
|
+
default: '> themes.defaultFillColor',
|
|
2136
|
+
description: 'Specify the fill color. You may use a dataSource to apply the color. The hex value format should be "#FFFFFF". The default for enterprise light mode is "#C3CBD4". The default for enterprise dark mode is "#31373E". The default for prisma dark mode is "#0B0C0E".',
|
|
2137
|
+
type: 'string'
|
|
1763
2138
|
},
|
|
1764
|
-
|
|
1765
|
-
|
|
2139
|
+
fillOpacity: {
|
|
2140
|
+
description: 'Specify the opacity of the fill. Choose a number in the range of 0 - 1 (inclusive). You can also express the value as a percentage. For example, "0.80" in source or "80%" in UI.',
|
|
2141
|
+
type: 'number',
|
|
2142
|
+
default: 1
|
|
1766
2143
|
},
|
|
1767
|
-
|
|
1768
|
-
|
|
2144
|
+
rx: {
|
|
2145
|
+
description: 'Specify the curvature of the horizontal corner (or border) radius with an integer or a percent greater than or equal to zero.',
|
|
2146
|
+
type: 'number',
|
|
2147
|
+
default: 0
|
|
1769
2148
|
},
|
|
1770
|
-
|
|
1771
|
-
|
|
2149
|
+
ry: {
|
|
2150
|
+
description: 'Specify the curvature of the vertical corner (or border) radius with an integer or a percent greater than or equal to zero.',
|
|
2151
|
+
type: 'number',
|
|
2152
|
+
default: '> rx'
|
|
2153
|
+
},
|
|
2154
|
+
strokeColor: {
|
|
2155
|
+
default: '> themes.defaultStrokeColor',
|
|
2156
|
+
description: 'Specify the stroke color. You may use a dataSource to apply the color. The hex value format should be "#FFFFFF". The default for enterprise light mode is "#3C444D". The default for enterprise dark mode is "#C3CBD4". The default for prisma dark mode is "#ACACAD".',
|
|
2157
|
+
type: 'string'
|
|
2158
|
+
},
|
|
2159
|
+
strokeDashStyle: {
|
|
2160
|
+
description: 'Specify the size, in pixels, of dashes and spaces used to create a custom stitched outline. The value you specify applies to both the dashes and the spaces between them.',
|
|
2161
|
+
type: 'number',
|
|
2162
|
+
default: 0
|
|
2163
|
+
},
|
|
2164
|
+
strokeJoinStyle: {
|
|
2165
|
+
description: 'Specifies the shape to be used at the corners of paths when they are joined.',
|
|
2166
|
+
type: 'string',
|
|
2167
|
+
default: 'miter',
|
|
2168
|
+
pattern: (0, schemaUtils_1.getPattern)(['arcs', 'bevel', 'miter', 'miter-clip', 'round'])
|
|
2169
|
+
},
|
|
2170
|
+
strokeOpacity: {
|
|
2171
|
+
description: 'Specify the opacity of the stroke. Choose a number in the range of 0 - 1 (inclusive). You can also express the value as a percentage. For example, "0.80" in source or "80%" in UI.',
|
|
2172
|
+
type: 'number',
|
|
2173
|
+
default: 1
|
|
2174
|
+
},
|
|
2175
|
+
strokeWidth: {
|
|
2176
|
+
description: 'Specify the width of the stroke, in pixels, in the range of 1 - 25 (inclusive).',
|
|
2177
|
+
type: 'number',
|
|
2178
|
+
default: 1
|
|
2179
|
+
}
|
|
1772
2180
|
};
|
|
1773
|
-
|
|
2181
|
+
var themes = {
|
|
2182
|
+
defaultFillColor: function defaultFillColor(props) {
|
|
2183
|
+
return (0, themes_1.pick)({
|
|
2184
|
+
enterprise: {
|
|
2185
|
+
dark: themes_1.variables.gray25(props),
|
|
2186
|
+
light: themes_1.variables.gray80(props)
|
|
2187
|
+
},
|
|
2188
|
+
prisma: themes_1.variables.backgroundColorSidebar(props)
|
|
2189
|
+
})(props);
|
|
2190
|
+
},
|
|
2191
|
+
defaultStrokeColor: function defaultStrokeColor(props) {
|
|
2192
|
+
return (0, themes_1.pick)({
|
|
2193
|
+
enterprise: {
|
|
2194
|
+
dark: themes_1.variables.gray80(props),
|
|
2195
|
+
light: themes_1.variables.gray30(props)
|
|
2196
|
+
},
|
|
2197
|
+
prisma: themes_1.variables.neutral500(props)
|
|
2198
|
+
})(props);
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
var basePresetContext = {
|
|
2202
|
+
fillColorEditorConfig: undefined,
|
|
2203
|
+
strokeColorEditorConfig: undefined
|
|
2204
|
+
};
|
|
2205
|
+
var basePresetOptions = {
|
|
2206
|
+
fillColor: undefined,
|
|
2207
|
+
strokeColor: undefined
|
|
2208
|
+
};
|
|
2209
|
+
var presets = [{
|
|
2210
|
+
// dummy context variables to allow for resetting of unused context states
|
|
2211
|
+
label: (0, i18n_1._)('None'),
|
|
2212
|
+
name: 'rectangle.none',
|
|
2213
|
+
value: {
|
|
2214
|
+
context: Object.assign({}, basePresetContext),
|
|
2215
|
+
options: Object.assign({}, basePresetOptions)
|
|
2216
|
+
}
|
|
2217
|
+
}, {
|
|
2218
|
+
label: (0, i18n_1._)('Fill'),
|
|
2219
|
+
name: 'rectangle.fill',
|
|
2220
|
+
value: {
|
|
2221
|
+
context: Object.assign(Object.assign({}, basePresetContext), {
|
|
2222
|
+
fillDataValue: '> primary | seriesByType("number") | lastPoint()',
|
|
2223
|
+
fillColorEditorConfig: defaultContext.fillColorConfig
|
|
2224
|
+
}),
|
|
2225
|
+
options: Object.assign(Object.assign({}, basePresetOptions), {
|
|
2226
|
+
fillColor: '> fillDataValue | rangeValue(fillColorEditorConfig)'
|
|
2227
|
+
})
|
|
2228
|
+
}
|
|
2229
|
+
}, {
|
|
2230
|
+
label: (0, i18n_1._)('Stroke'),
|
|
2231
|
+
name: 'rectangle.stroke',
|
|
2232
|
+
value: {
|
|
2233
|
+
context: Object.assign(Object.assign({}, basePresetContext), {
|
|
2234
|
+
strokeDataValue: '> primary | seriesByType("number") | lastPoint()',
|
|
2235
|
+
strokeColorEditorConfig: defaultContext.strokeColorConfig
|
|
2236
|
+
}),
|
|
2237
|
+
options: Object.assign(Object.assign({}, basePresetOptions), {
|
|
2238
|
+
strokeColor: '> strokeDataValue | rangeValue(strokeColorEditorConfig)'
|
|
2239
|
+
})
|
|
2240
|
+
}
|
|
2241
|
+
}, {
|
|
2242
|
+
label: (0, i18n_1._)('Fill and Stroke'),
|
|
2243
|
+
name: 'rectangle.fillAndStroke',
|
|
2244
|
+
value: {
|
|
2245
|
+
context: Object.assign(Object.assign({}, basePresetContext), {
|
|
2246
|
+
fillDataValue: '> primary | seriesByType("number") | lastPoint()',
|
|
2247
|
+
strokeDataValue: '> primary | seriesByType("number") | lastPoint()',
|
|
2248
|
+
fillColorEditorConfig: defaultContext.fillColorConfig,
|
|
2249
|
+
strokeColorEditorConfig: defaultContext.strokeColorConfig
|
|
2250
|
+
}),
|
|
2251
|
+
options: Object.assign(Object.assign({}, basePresetOptions), {
|
|
2252
|
+
fillColor: '> fillDataValue | rangeValue(fillColorEditorConfig)',
|
|
2253
|
+
strokeColor: '> strokeDataValue | rangeValue(strokeColorEditorConfig)'
|
|
2254
|
+
})
|
|
2255
|
+
}
|
|
2256
|
+
}];
|
|
2257
|
+
var editorConfig = [{
|
|
2258
|
+
label: (0, i18n_1._)('Color and style'),
|
|
2259
|
+
layout: [[{
|
|
2260
|
+
label: (0, i18n_1._)('Dynamic elements'),
|
|
2261
|
+
key: 'presetSelector',
|
|
2262
|
+
editor: 'editor.presetSelector',
|
|
2263
|
+
editorProps: {
|
|
2264
|
+
presets: presets,
|
|
2265
|
+
value: function value(_ref) {
|
|
2266
|
+
var context = _ref.context,
|
|
2267
|
+
options = _ref.options;
|
|
2268
|
+
var initialPreset = (0, configUtils_1.getInitialPreset)(context, options, presets);
|
|
2269
|
+
return initialPreset && initialPreset.label || null;
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}], [Object.assign(Object.assign({}, StaticFillColorEditor_1.default), {
|
|
2273
|
+
editorProps: {
|
|
2274
|
+
themes: themes
|
|
2275
|
+
}
|
|
2276
|
+
})], [(0, DynamicFillColorEditor_1.getDynamicFillColorEditor)({
|
|
2277
|
+
defaultContext: defaultContext,
|
|
2278
|
+
defaultPalettesConfig: PresetPalettes_1.defaultPalettesConfig
|
|
2279
|
+
})], [Object.assign(Object.assign({}, StaticStrokeColorEditor_1.default), {
|
|
2280
|
+
editorProps: {
|
|
2281
|
+
themes: themes
|
|
2282
|
+
}
|
|
2283
|
+
})], [(0, DynamicStrokeColorEditor_1.getDynamicStrokeColorEditor)({
|
|
2284
|
+
defaultContext: defaultContext,
|
|
2285
|
+
defaultPalettesConfig: PresetPalettes_1.defaultPalettesConfig
|
|
2286
|
+
})], [{
|
|
2287
|
+
label: (0, i18n_1._)('Fill opacity (%)'),
|
|
2288
|
+
option: 'fillOpacity',
|
|
2289
|
+
editor: 'editor.percent',
|
|
2290
|
+
editorProps: {
|
|
2291
|
+
min: 0
|
|
2292
|
+
}
|
|
2293
|
+
}, {
|
|
2294
|
+
label: (0, i18n_1._)('Stroke opacity (%)'),
|
|
2295
|
+
option: 'strokeOpacity',
|
|
2296
|
+
editor: 'editor.percent',
|
|
2297
|
+
editorProps: {
|
|
2298
|
+
min: 0
|
|
2299
|
+
}
|
|
2300
|
+
}], [{
|
|
2301
|
+
label: (0, i18n_1._)('Stroke width'),
|
|
2302
|
+
option: 'strokeWidth',
|
|
2303
|
+
editor: 'editor.number',
|
|
2304
|
+
editorProps: {
|
|
2305
|
+
min: 0
|
|
2306
|
+
}
|
|
2307
|
+
}, {
|
|
2308
|
+
label: (0, i18n_1._)('Stroke dash style'),
|
|
2309
|
+
option: 'strokeDashStyle',
|
|
2310
|
+
editor: 'editor.number',
|
|
2311
|
+
editorProps: {
|
|
2312
|
+
min: 0
|
|
2313
|
+
}
|
|
2314
|
+
}], [{
|
|
2315
|
+
label: (0, i18n_1._)('Radius (px)'),
|
|
2316
|
+
option: 'rx',
|
|
2317
|
+
editor: 'editor.number',
|
|
2318
|
+
editorProps: {
|
|
2319
|
+
min: 0
|
|
2320
|
+
}
|
|
2321
|
+
}, {}]]
|
|
2322
|
+
}];
|
|
2323
|
+
/**
|
|
2324
|
+
* visualization configuration
|
|
2325
|
+
*/
|
|
2326
|
+
|
|
2327
|
+
var config = {
|
|
2328
|
+
/**
|
|
2329
|
+
* unique viz key
|
|
2330
|
+
*/
|
|
2331
|
+
key: 'splunk.rectangle',
|
|
2332
|
+
|
|
2333
|
+
/**
|
|
2334
|
+
* viz name
|
|
2335
|
+
*/
|
|
2336
|
+
name: (0, i18n_1._)('Rectangle'),
|
|
2337
|
+
category: VizCategory_1.VizCategory.SHAPES,
|
|
2338
|
+
|
|
2339
|
+
/**
|
|
2340
|
+
* viz icon
|
|
2341
|
+
*/
|
|
2342
|
+
icon: visualization_icons_1.Rectangle,
|
|
2343
|
+
dataContract: dataContract,
|
|
2344
|
+
size: size,
|
|
2345
|
+
defaultContext: defaultContext,
|
|
2346
|
+
optionsSchema: exports.optionsSchema,
|
|
2347
|
+
editorConfig: editorConfig,
|
|
2348
|
+
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS],
|
|
2349
|
+
themes: themes,
|
|
2350
|
+
events: {
|
|
2351
|
+
'rectangle.click': {
|
|
2352
|
+
description: 'trigger when user clicks rectangle',
|
|
2353
|
+
payloadKeys: ['strokeColor', 'fillColor']
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
};
|
|
2357
|
+
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
1774
2358
|
|
|
1775
2359
|
/***/ }),
|
|
1776
2360
|
|
|
1777
|
-
/***/
|
|
2361
|
+
/***/ 48:
|
|
1778
2362
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1779
2363
|
|
|
1780
2364
|
"use strict";
|
|
1781
2365
|
|
|
1782
2366
|
|
|
1783
|
-
|
|
2367
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2368
|
+
value: true
|
|
2369
|
+
});
|
|
2370
|
+
|
|
2371
|
+
/***/ }),
|
|
2372
|
+
|
|
2373
|
+
/***/ 49:
|
|
2374
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2375
|
+
|
|
2376
|
+
"use strict";
|
|
1784
2377
|
|
|
1785
|
-
var _createClass = __webpack_require__(18);
|
|
1786
2378
|
|
|
1787
2379
|
Object.defineProperty(exports, "__esModule", {
|
|
1788
2380
|
value: true
|
|
1789
2381
|
});
|
|
1790
|
-
exports.DefaultVizActionHandler = void 0;
|
|
1791
2382
|
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
2383
|
+
/***/ }),
|
|
2384
|
+
|
|
2385
|
+
/***/ 50:
|
|
2386
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2387
|
+
|
|
2388
|
+
"use strict";
|
|
2389
|
+
|
|
2390
|
+
|
|
2391
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2392
|
+
value: true
|
|
2393
|
+
});
|
|
2394
|
+
|
|
2395
|
+
/***/ }),
|
|
2396
|
+
|
|
2397
|
+
/***/ 51:
|
|
2398
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2399
|
+
|
|
2400
|
+
"use strict";
|
|
2401
|
+
|
|
2402
|
+
|
|
2403
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2404
|
+
value: true
|
|
2405
|
+
});
|
|
2406
|
+
|
|
2407
|
+
/***/ }),
|
|
2408
|
+
|
|
2409
|
+
/***/ 52:
|
|
2410
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2411
|
+
|
|
2412
|
+
"use strict";
|
|
2413
|
+
|
|
2414
|
+
|
|
2415
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2416
|
+
value: true
|
|
2417
|
+
});
|
|
2418
|
+
|
|
2419
|
+
/***/ }),
|
|
2420
|
+
|
|
2421
|
+
/***/ 53:
|
|
2422
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2423
|
+
|
|
2424
|
+
"use strict";
|
|
2425
|
+
|
|
2426
|
+
|
|
2427
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2428
|
+
value: true
|
|
2429
|
+
});
|
|
2430
|
+
|
|
2431
|
+
/***/ }),
|
|
2432
|
+
|
|
2433
|
+
/***/ 54:
|
|
2434
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2435
|
+
|
|
2436
|
+
"use strict";
|
|
2437
|
+
|
|
2438
|
+
|
|
2439
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2440
|
+
value: true
|
|
2441
|
+
});
|
|
2442
|
+
|
|
2443
|
+
/***/ }),
|
|
2444
|
+
|
|
2445
|
+
/***/ 55:
|
|
2446
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2447
|
+
|
|
2448
|
+
"use strict";
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2452
|
+
value: true
|
|
2453
|
+
});
|
|
2454
|
+
|
|
2455
|
+
/***/ }),
|
|
2456
|
+
|
|
2457
|
+
/***/ 56:
|
|
2458
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2459
|
+
|
|
2460
|
+
"use strict";
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
var _slicedToArray = __webpack_require__(7);
|
|
2464
|
+
|
|
2465
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2466
|
+
value: true
|
|
2467
|
+
});
|
|
2468
|
+
|
|
2469
|
+
var React = __webpack_require__(0);
|
|
2470
|
+
|
|
2471
|
+
var lodash_1 = __webpack_require__(3);
|
|
2472
|
+
|
|
2473
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(57);
|
|
2474
|
+
|
|
2475
|
+
var Options_1 = __webpack_require__(16);
|
|
2476
|
+
|
|
2477
|
+
var SanitizeProps_1 = __webpack_require__(58);
|
|
2478
|
+
|
|
2479
|
+
var TimezoneContext_1 = __webpack_require__(32);
|
|
2480
|
+
|
|
2481
|
+
var moment_1 = __webpack_require__(59);
|
|
2482
|
+
|
|
2483
|
+
var FeatureFlagContext_1 = __webpack_require__(28);
|
|
2484
|
+
|
|
2485
|
+
var styled_components_1 = __webpack_require__(4);
|
|
2486
|
+
|
|
2487
|
+
var hocUtils_1 = __webpack_require__(34);
|
|
2488
|
+
|
|
2489
|
+
var JSONSchemaUtils_1 = __webpack_require__(35);
|
|
2490
|
+
|
|
2491
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(60);
|
|
2492
|
+
|
|
2493
|
+
var id_1 = __webpack_require__(31);
|
|
2494
|
+
|
|
2495
|
+
var SplunkVisualization_1 = __webpack_require__(61);
|
|
2496
|
+
|
|
2497
|
+
var VizBehavior_1 = __webpack_require__(6);
|
|
2498
|
+
|
|
2499
|
+
var getSorting_1 = __webpack_require__(38);
|
|
2500
|
+
|
|
2501
|
+
var getPagination_1 = __webpack_require__(39);
|
|
2502
|
+
|
|
2503
|
+
var useDeepMemo_1 = __webpack_require__(62);
|
|
2504
|
+
|
|
2505
|
+
var MissingPropsMessage_1 = __webpack_require__(63);
|
|
2506
|
+
|
|
2507
|
+
var withEditModeCover_1 = __webpack_require__(64);
|
|
2508
|
+
|
|
2509
|
+
var withPlaceholder_1 = __webpack_require__(65);
|
|
2510
|
+
|
|
2511
|
+
var useDownsampleDataSources_1 = __webpack_require__(66);
|
|
2512
|
+
|
|
2513
|
+
var dataUtils_1 = __webpack_require__(14);
|
|
2514
|
+
|
|
2515
|
+
var featureFlagUtils_1 = __webpack_require__(68);
|
|
2516
|
+
/**
|
|
2517
|
+
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
2518
|
+
* @param {DashboardVizOpts} opts
|
|
2519
|
+
* @returns {HOC}
|
|
2520
|
+
*/
|
|
2521
|
+
|
|
2522
|
+
|
|
2523
|
+
var withDashboardViz = function withDashboardViz(opts) {
|
|
2524
|
+
var ReactViz = opts.ReactViz,
|
|
2525
|
+
vizConfig = opts.vizConfig,
|
|
2526
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
2527
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
2528
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
2529
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
2530
|
+
|
|
2531
|
+
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
2532
|
+
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
2533
|
+
|
|
2534
|
+
var DashboardViz = function DashboardViz(props) {
|
|
2535
|
+
var _a;
|
|
2536
|
+
|
|
2537
|
+
var mode = props.mode,
|
|
2538
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
2539
|
+
dataSources = props.dataSources,
|
|
2540
|
+
options = props.options,
|
|
2541
|
+
_props$context = props.context,
|
|
2542
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
2543
|
+
width = props.width,
|
|
2544
|
+
height = props.height,
|
|
2545
|
+
onComputedProps = props.onComputedProps,
|
|
2546
|
+
onEventTrigger = props.onEventTrigger,
|
|
2547
|
+
theme = props.theme,
|
|
2548
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
2549
|
+
|
|
2550
|
+
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
2551
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
2552
|
+
|
|
2553
|
+
if (serializedTimezone) {
|
|
2554
|
+
/*
|
|
2555
|
+
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
2556
|
+
This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
|
|
2557
|
+
will use it.
|
|
2558
|
+
@TODO(pwied):
|
|
2559
|
+
- remove when we moved away from @splunk/moment
|
|
2560
|
+
- provide timezone context to dynamic option evaluation phase
|
|
2561
|
+
*/
|
|
2562
|
+
if (!moment_1.default.getDefaultSplunkTimezone()) {
|
|
2563
|
+
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
var themeFunc = function themeFunc(themeVar) {
|
|
2568
|
+
var _a, _b;
|
|
2569
|
+
|
|
2570
|
+
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
2571
|
+
};
|
|
2572
|
+
|
|
2573
|
+
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
2574
|
+
|
|
2575
|
+
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
2576
|
+
theme: theme
|
|
2577
|
+
}),
|
|
2578
|
+
currentThemeFamily = _ref.family,
|
|
2579
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
2580
|
+
currentThemeDensity = _ref.density;
|
|
2581
|
+
|
|
2582
|
+
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
2583
|
+
|
|
2584
|
+
var _React$useState = React.useState({}),
|
|
2585
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2586
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
2587
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
2588
|
+
|
|
2589
|
+
|
|
2590
|
+
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
2591
|
+
|
|
2592
|
+
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
2593
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
2594
|
+
visualizationID = _React$useState4[0];
|
|
2595
|
+
|
|
2596
|
+
var _React$useState5 = React.useState({}),
|
|
2597
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2598
|
+
dataSourcesInState = _React$useState6[0],
|
|
2599
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1796
2600
|
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
}, {
|
|
1802
|
-
key: "snapshot",
|
|
1803
|
-
value: function snapshot() {
|
|
1804
|
-
return null; // noop
|
|
1805
|
-
}
|
|
1806
|
-
}]);
|
|
2601
|
+
var _React$useState7 = React.useState(),
|
|
2602
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
2603
|
+
dataFramesInState = _React$useState8[0],
|
|
2604
|
+
setDataFramesInState = _React$useState8[1];
|
|
1807
2605
|
|
|
1808
|
-
|
|
1809
|
-
|
|
2606
|
+
var _React$useState9 = React.useState(Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_useWebWorkersForDSL'))),
|
|
2607
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
2608
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
2609
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1810
2610
|
|
|
1811
|
-
|
|
2611
|
+
var isDownsamplingEnabledByFeatureFlag = Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_enableDownsampling);
|
|
2612
|
+
var isMounted = React.useRef(true);
|
|
2613
|
+
var optionsToEvaluate = React.useMemo(function () {
|
|
2614
|
+
return {
|
|
2615
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
2616
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
2617
|
+
};
|
|
2618
|
+
}, [options, context]);
|
|
2619
|
+
|
|
2620
|
+
var _React$useState11 = React.useState(Number(width)),
|
|
2621
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
2622
|
+
threshold = _React$useState12[0],
|
|
2623
|
+
setThreshold = _React$useState12[1];
|
|
2624
|
+
|
|
2625
|
+
var onDownsamplingThresholdChange = React.useCallback(function (newThreshold) {
|
|
2626
|
+
setThreshold(newThreshold);
|
|
2627
|
+
}, []);
|
|
2628
|
+
var isDownsamplingEnabled = React.useMemo(function () {
|
|
2629
|
+
return isDownsamplingEnabledByFeatureFlag && (0, dataUtils_1.isDownsamplingEnabledForViz)({
|
|
2630
|
+
vizConfig: vizConfig
|
|
2631
|
+
});
|
|
2632
|
+
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
2633
|
+
var downsamplingProps = React.useMemo(function () {
|
|
2634
|
+
if (!isDownsamplingEnabled) {
|
|
2635
|
+
return {};
|
|
2636
|
+
}
|
|
1812
2637
|
|
|
1813
|
-
|
|
2638
|
+
return {
|
|
2639
|
+
onDownsamplingThresholdChange: onDownsamplingThresholdChange,
|
|
2640
|
+
originalDataSources: dataSources
|
|
2641
|
+
};
|
|
2642
|
+
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
2643
|
+
var downsampledDataSources = (0, useDownsampleDataSources_1.default)({
|
|
2644
|
+
options: optionsToEvaluate.options,
|
|
2645
|
+
context: optionsToEvaluate.context,
|
|
2646
|
+
dataSources: dataSources,
|
|
2647
|
+
threshold: threshold,
|
|
2648
|
+
isDownsamplingEnabled: isDownsamplingEnabled
|
|
2649
|
+
});
|
|
2650
|
+
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
2651
|
+
try {
|
|
2652
|
+
if (useAsyncEvaluatedOptions) {
|
|
2653
|
+
var asyncDynamicOptionsEvaluatorParams = {
|
|
2654
|
+
visualizationID: visualizationID,
|
|
2655
|
+
props: props,
|
|
2656
|
+
options: optionsToEvaluate,
|
|
2657
|
+
dataSources: downsampledDataSources,
|
|
2658
|
+
theme: vizConfig.themes,
|
|
2659
|
+
bypassCloneDeepOptionScope: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope')),
|
|
2660
|
+
lazyLoadingDataFrame: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'))
|
|
2661
|
+
};
|
|
2662
|
+
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
2663
|
+
setEvaluatedOptionsAsync(results.results);
|
|
2664
|
+
}).catch(function () {
|
|
2665
|
+
if (isMounted.current) {
|
|
2666
|
+
setUseAsyncEvaluatedOptions(false);
|
|
2667
|
+
}
|
|
2668
|
+
});
|
|
2669
|
+
} else {
|
|
2670
|
+
var dataFrames = dataFramesInState;
|
|
1814
2671
|
|
|
1815
|
-
|
|
1816
|
-
|
|
2672
|
+
if (downsampledDataSources !== dataSourcesInState) {
|
|
2673
|
+
setDataSourcesInState(downsampledDataSources);
|
|
2674
|
+
dataFrames = Options_1.Options.dataFrameFromDataSource(downsampledDataSources, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'));
|
|
2675
|
+
setDataFramesInState(dataFrames);
|
|
2676
|
+
}
|
|
1817
2677
|
|
|
1818
|
-
|
|
2678
|
+
var result = Options_1.Options.evaluate(optionsToEvaluate, downsampledDataSources, themeFunc, dataFrames, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope'));
|
|
2679
|
+
return result;
|
|
2680
|
+
}
|
|
2681
|
+
} catch (e) {
|
|
2682
|
+
// eslint-disable-next-line no-console
|
|
2683
|
+
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
2684
|
+
return {};
|
|
2685
|
+
}
|
|
1819
2686
|
|
|
2687
|
+
return {};
|
|
2688
|
+
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, optionsToEvaluate, downsampledDataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
2689
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
2690
|
+
// if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
|
|
2691
|
+
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1820
2692
|
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
});
|
|
1824
|
-
exports.useDeepMemo = void 0;
|
|
2693
|
+
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
2694
|
+
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1825
2695
|
|
|
1826
|
-
|
|
2696
|
+
if (isTrellisFeatureFlagOn && ((_a = vizConfig === null || vizConfig === void 0 ? void 0 : vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(VizBehavior_1.VizBehavior.TRELLIS)) && (clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.splitByLayout) === VizBehavior_1.VizBehavior.TRELLIS) {
|
|
2697
|
+
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
2698
|
+
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
2699
|
+
});
|
|
2700
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
2701
|
+
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1827
2702
|
|
|
1828
|
-
var lodash_1 = __webpack_require__(3);
|
|
1829
|
-
/**
|
|
1830
|
-
* This hook evaluates and stores the result of a passed function and only
|
|
1831
|
-
* re-evaluates the function when passed dependencies change.
|
|
1832
|
-
*
|
|
1833
|
-
* It is different from the internal React useMemo in the following aspects:
|
|
1834
|
-
* - it only stores the last evaluated result
|
|
1835
|
-
* - it uses a deep equality check to determine if dependencies have changed
|
|
1836
|
-
*
|
|
1837
|
-
* Inspired by apollo-client's useDeepMemo
|
|
1838
|
-
*
|
|
1839
|
-
* @param fn the function to be executed and
|
|
1840
|
-
* @param dependencies an array of dependencies
|
|
1841
|
-
*/
|
|
1842
2703
|
|
|
2704
|
+
React.useEffect(function () {
|
|
2705
|
+
onComputedProps(clonedEvaluatedOptions);
|
|
2706
|
+
});
|
|
2707
|
+
React.useEffect(function () {
|
|
2708
|
+
return function () {
|
|
2709
|
+
if (useAsyncEvaluatedOptions) {
|
|
2710
|
+
isMounted.current = false;
|
|
2711
|
+
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
2712
|
+
}
|
|
2713
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2714
|
+
}, []); // present warning message if any required props are missing
|
|
1843
2715
|
|
|
1844
|
-
var
|
|
1845
|
-
|
|
2716
|
+
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
2717
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
2718
|
+
supports = vizConfig.supports;
|
|
2719
|
+
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1846
2720
|
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
2721
|
+
if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
|
|
2722
|
+
) {
|
|
2723
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
2724
|
+
"data-test": "missing-props-message",
|
|
2725
|
+
width: width,
|
|
2726
|
+
height: height,
|
|
2727
|
+
missingProps: missing,
|
|
2728
|
+
backgroundColor: bgColorFromTheme
|
|
2729
|
+
});
|
|
2730
|
+
} // events
|
|
1853
2731
|
|
|
1854
|
-
return ref.current.value;
|
|
1855
|
-
};
|
|
1856
2732
|
|
|
1857
|
-
|
|
2733
|
+
var eventCallbackProps = {};
|
|
1858
2734
|
|
|
1859
|
-
|
|
2735
|
+
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
2736
|
+
var supportedEvents = vizConfig.events;
|
|
2737
|
+
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
2738
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
2739
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
2740
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
2741
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
2742
|
+
// then remove these lines
|
|
1860
2743
|
|
|
1861
|
-
|
|
1862
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2744
|
+
var payload = {};
|
|
1863
2745
|
|
|
1864
|
-
|
|
2746
|
+
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
2747
|
+
payloadKeys.forEach(function (p) {
|
|
2748
|
+
payload[p] = evaluatedOptionsToUse[p];
|
|
2749
|
+
});
|
|
2750
|
+
}
|
|
1865
2751
|
|
|
2752
|
+
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
2753
|
+
if (ev && ev.payload) {
|
|
2754
|
+
payload = ev.payload;
|
|
2755
|
+
}
|
|
1866
2756
|
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
2757
|
+
return onEventTrigger({
|
|
2758
|
+
originalEvent: ev,
|
|
2759
|
+
payload: payload,
|
|
2760
|
+
type: eventName
|
|
2761
|
+
});
|
|
2762
|
+
};
|
|
1871
2763
|
|
|
1872
|
-
|
|
2764
|
+
if (parentKeys) {
|
|
2765
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
2766
|
+
var newObject = {};
|
|
2767
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
2768
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
});
|
|
2772
|
+
} // compute pure viz props which are not from options
|
|
1873
2773
|
|
|
1874
|
-
var T = __webpack_require__(0);
|
|
1875
2774
|
|
|
1876
|
-
var
|
|
2775
|
+
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
2776
|
+
themeFunc: themeFunc
|
|
2777
|
+
}));
|
|
2778
|
+
/**
|
|
2779
|
+
* PAGE_AND_SORT behavior
|
|
2780
|
+
*
|
|
2781
|
+
* Some visualizations, like table, requires metadata about the datasource,
|
|
2782
|
+
* like total number of results, current count, offset, and sort, for rendering
|
|
2783
|
+
* paginator and sorting direction. In this approach, the visualization
|
|
2784
|
+
* allow users to set 'paginateDataSourceKey' to select which datasource
|
|
2785
|
+
* should the visualization extract the metadata from. It defaults to 'primary' datasource.
|
|
2786
|
+
* The visualization config should set the PAGE_AND_SORT behavior to receive
|
|
2787
|
+
* 'requestParams', 'meta' and onRequestParams callback as props.
|
|
2788
|
+
*
|
|
2789
|
+
* In future, we could automatically detect which all datasources are being used
|
|
2790
|
+
* and bind those magically to pagination/sorting behavior.
|
|
2791
|
+
*/
|
|
1877
2792
|
|
|
1878
|
-
var
|
|
2793
|
+
var dataSourceMetadata = {};
|
|
2794
|
+
var OptionKey = 'paginateDataSourceKey';
|
|
2795
|
+
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1879
2796
|
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
* @param {any} v
|
|
1884
|
-
* @returns {boolean} true if the input value === null or undefined
|
|
1885
|
-
*/
|
|
2797
|
+
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
2798
|
+
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
2799
|
+
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1886
2800
|
|
|
2801
|
+
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
2802
|
+
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
2803
|
+
};
|
|
1887
2804
|
|
|
1888
|
-
var
|
|
1889
|
-
|
|
1890
|
-
|
|
2805
|
+
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
2806
|
+
requestParams: requestParams,
|
|
2807
|
+
meta: meta,
|
|
2808
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
2809
|
+
});
|
|
2810
|
+
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
2811
|
+
requestParams: requestParams,
|
|
2812
|
+
meta: meta,
|
|
2813
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
2814
|
+
});
|
|
2815
|
+
dataSourceMetadata = {
|
|
2816
|
+
sortParams: sortParams,
|
|
2817
|
+
paginatorParams: paginatorParams
|
|
2818
|
+
};
|
|
2819
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1891
2820
|
|
|
1892
|
-
exports.isMissing = isMissing;
|
|
1893
|
-
/**
|
|
1894
|
-
* @method misskingKeys
|
|
1895
|
-
* @param {string[]} keys
|
|
1896
|
-
* @param {object} target
|
|
1897
|
-
* @returns {string[]} the keys of missing required props
|
|
1898
|
-
*/
|
|
1899
2821
|
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
});
|
|
1904
|
-
};
|
|
2822
|
+
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
2823
|
+
return null;
|
|
2824
|
+
}
|
|
1905
2825
|
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
missingProps: T.arrayOf(T.string)
|
|
1913
|
-
};
|
|
1914
|
-
/**
|
|
1915
|
-
* @method MissingPropsMessage
|
|
1916
|
-
* @param {MissingPropsProps} props
|
|
1917
|
-
* @returns {React.ReactElement}
|
|
1918
|
-
*/
|
|
2826
|
+
return React.createElement(SanitizedReactViz, Object.assign({
|
|
2827
|
+
mode: mode,
|
|
2828
|
+
width: width,
|
|
2829
|
+
height: height
|
|
2830
|
+
}, downsamplingProps, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
2831
|
+
};
|
|
1919
2832
|
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
"data-test": "message",
|
|
1926
|
-
width: width,
|
|
1927
|
-
height: height,
|
|
1928
|
-
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1929
|
-
});
|
|
1930
|
-
};
|
|
2833
|
+
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
2834
|
+
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
2835
|
+
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
2836
|
+
theme: {}
|
|
2837
|
+
}); // attach viz config
|
|
1931
2838
|
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
width: '100%',
|
|
1936
|
-
height: 250
|
|
2839
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
2840
|
+
|
|
2841
|
+
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1937
2842
|
};
|
|
1938
|
-
|
|
2843
|
+
|
|
2844
|
+
exports.default = withDashboardViz;
|
|
1939
2845
|
|
|
1940
2846
|
/***/ }),
|
|
1941
2847
|
|
|
1942
|
-
/***/
|
|
1943
|
-
/***/ (function(module, exports
|
|
2848
|
+
/***/ 57:
|
|
2849
|
+
/***/ (function(module, exports) {
|
|
1944
2850
|
|
|
1945
|
-
|
|
2851
|
+
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1946
2852
|
|
|
2853
|
+
/***/ }),
|
|
1947
2854
|
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2855
|
+
/***/ 58:
|
|
2856
|
+
/***/ (function(module, exports) {
|
|
1951
2857
|
|
|
1952
|
-
|
|
1953
|
-
desc = {
|
|
1954
|
-
enumerable: true,
|
|
1955
|
-
get: function get() {
|
|
1956
|
-
return m[k];
|
|
1957
|
-
}
|
|
1958
|
-
};
|
|
1959
|
-
}
|
|
2858
|
+
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1960
2859
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2860
|
+
/***/ }),
|
|
2861
|
+
|
|
2862
|
+
/***/ 59:
|
|
2863
|
+
/***/ (function(module, exports) {
|
|
2864
|
+
|
|
2865
|
+
module.exports = require("@splunk/moment");
|
|
2866
|
+
|
|
2867
|
+
/***/ }),
|
|
2868
|
+
|
|
2869
|
+
/***/ 6:
|
|
2870
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2871
|
+
|
|
2872
|
+
"use strict";
|
|
1966
2873
|
|
|
1967
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1968
|
-
for (var p in m) {
|
|
1969
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1970
|
-
}
|
|
1971
|
-
};
|
|
1972
2874
|
|
|
1973
2875
|
Object.defineProperty(exports, "__esModule", {
|
|
1974
2876
|
value: true
|
|
1975
2877
|
});
|
|
1976
|
-
exports.
|
|
2878
|
+
exports.VizBehavior = void 0;
|
|
2879
|
+
var VizBehavior;
|
|
2880
|
+
|
|
2881
|
+
(function (VizBehavior) {
|
|
2882
|
+
/**
|
|
2883
|
+
* Dynamic Options Behavior.
|
|
2884
|
+
* This allows visualization options to be powered by data
|
|
2885
|
+
*
|
|
2886
|
+
* **Example**
|
|
2887
|
+
*
|
|
2888
|
+
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
2889
|
+
* would configure sparklineValues with an array of data points
|
|
2890
|
+
* coming from the first series in the primary datasource
|
|
2891
|
+
*
|
|
2892
|
+
*/
|
|
2893
|
+
VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
|
|
2894
|
+
VizBehavior["EVENTS"] = "events";
|
|
2895
|
+
VizBehavior["DOWNSAMPLING"] = "downsampling";
|
|
2896
|
+
/**
|
|
2897
|
+
* Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
|
|
2898
|
+
* missing.
|
|
2899
|
+
* @type {string}
|
|
2900
|
+
*/
|
|
2901
|
+
|
|
2902
|
+
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
2903
|
+
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
2904
|
+
VizBehavior["TRELLIS"] = "trellis";
|
|
2905
|
+
})(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
|
|
1977
2906
|
|
|
1978
|
-
|
|
2907
|
+
/***/ }),
|
|
1979
2908
|
|
|
1980
|
-
|
|
2909
|
+
/***/ 60:
|
|
2910
|
+
/***/ (function(module, exports) {
|
|
1981
2911
|
|
|
1982
|
-
|
|
1983
|
-
enumerable: true,
|
|
1984
|
-
get: function get() {
|
|
1985
|
-
return Rectangle_1.default;
|
|
1986
|
-
}
|
|
1987
|
-
});
|
|
2912
|
+
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1988
2913
|
|
|
1989
2914
|
/***/ }),
|
|
1990
2915
|
|
|
1991
|
-
/***/
|
|
2916
|
+
/***/ 61:
|
|
1992
2917
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1993
2918
|
|
|
1994
2919
|
"use strict";
|
|
1995
2920
|
|
|
1996
2921
|
|
|
2922
|
+
var _classCallCheck = __webpack_require__(10);
|
|
2923
|
+
|
|
1997
2924
|
Object.defineProperty(exports, "__esModule", {
|
|
1998
2925
|
value: true
|
|
1999
2926
|
});
|
|
2000
|
-
exports.
|
|
2927
|
+
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
2928
|
+
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
2929
|
+
|
|
2930
|
+
var T = __webpack_require__(1);
|
|
2001
2931
|
|
|
2002
|
-
var
|
|
2932
|
+
var lodash_1 = __webpack_require__(3);
|
|
2003
2933
|
|
|
2004
|
-
var
|
|
2934
|
+
var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2005
2935
|
|
|
2006
|
-
var i18n_1 = __webpack_require__(2);
|
|
2007
2936
|
|
|
2008
|
-
|
|
2937
|
+
exports.INITIAL_WIDTH = 250;
|
|
2938
|
+
exports.INITIAL_HEIGHT = 250;
|
|
2939
|
+
/**
|
|
2940
|
+
* A Splunk visualization
|
|
2941
|
+
*/
|
|
2009
2942
|
|
|
2010
|
-
var
|
|
2943
|
+
var SplunkVisualization = function SplunkVisualization() {
|
|
2944
|
+
_classCallCheck(this, SplunkVisualization);
|
|
2945
|
+
};
|
|
2011
2946
|
|
|
2012
|
-
|
|
2947
|
+
SplunkVisualization.propTypes = {
|
|
2948
|
+
/**
|
|
2949
|
+
* display mode
|
|
2950
|
+
*/
|
|
2951
|
+
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
2013
2952
|
|
|
2014
|
-
|
|
2953
|
+
/**
|
|
2954
|
+
* width in pixel or string, defaults to 100%
|
|
2955
|
+
*/
|
|
2956
|
+
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
2015
2957
|
|
|
2016
|
-
|
|
2958
|
+
/**
|
|
2959
|
+
* height in pixel or string
|
|
2960
|
+
*/
|
|
2961
|
+
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
2017
2962
|
|
|
2018
|
-
|
|
2963
|
+
/**
|
|
2964
|
+
* visualization context used for dynamic option evaluation
|
|
2965
|
+
*/
|
|
2966
|
+
context: T.object,
|
|
2019
2967
|
|
|
2020
|
-
|
|
2968
|
+
/**
|
|
2969
|
+
* visualization formatting options
|
|
2970
|
+
*/
|
|
2971
|
+
options: T.object,
|
|
2021
2972
|
|
|
2022
|
-
|
|
2973
|
+
/**
|
|
2974
|
+
* A callback to update formatting options
|
|
2975
|
+
*/
|
|
2976
|
+
onOptionsChange: T.func,
|
|
2023
2977
|
|
|
2024
|
-
|
|
2978
|
+
/**
|
|
2979
|
+
* datasource state which include data and request params, object key indicate the datasource type.
|
|
2980
|
+
*/
|
|
2981
|
+
dataSources: T.objectOf(T.shape({
|
|
2982
|
+
/**
|
|
2983
|
+
* current request params
|
|
2984
|
+
*/
|
|
2985
|
+
requestParams: T.object,
|
|
2025
2986
|
|
|
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
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
}, {
|
|
2075
|
-
from: 80,
|
|
2076
|
-
to: 100,
|
|
2077
|
-
value: '#2EB82E'
|
|
2078
|
-
}, {
|
|
2079
|
-
from: 60,
|
|
2080
|
-
to: 80,
|
|
2081
|
-
value: '#C3CC33'
|
|
2082
|
-
}, {
|
|
2083
|
-
from: 40,
|
|
2084
|
-
to: 60,
|
|
2085
|
-
value: '#FFD442'
|
|
2086
|
-
}, {
|
|
2087
|
-
from: 20,
|
|
2088
|
-
to: 40,
|
|
2089
|
-
value: '#FFA857'
|
|
2090
|
-
}, {
|
|
2091
|
-
from: 0,
|
|
2092
|
-
to: 20,
|
|
2093
|
-
value: '#FF7149'
|
|
2094
|
-
}, {
|
|
2095
|
-
to: 0,
|
|
2096
|
-
value: '#FE3A3A'
|
|
2097
|
-
}],
|
|
2098
|
-
fillColorMatchConfig: [{
|
|
2099
|
-
match: '',
|
|
2100
|
-
value: '#5C33FF'
|
|
2101
|
-
}],
|
|
2102
|
-
strokeColorMatchConfig: [{
|
|
2103
|
-
match: '',
|
|
2104
|
-
value: '#5C33FF'
|
|
2105
|
-
}]
|
|
2987
|
+
/**
|
|
2988
|
+
* current dataset
|
|
2989
|
+
*/
|
|
2990
|
+
data: T.shape({
|
|
2991
|
+
fields: T.array,
|
|
2992
|
+
columns: T.array
|
|
2993
|
+
}),
|
|
2994
|
+
|
|
2995
|
+
/**
|
|
2996
|
+
* error
|
|
2997
|
+
*/
|
|
2998
|
+
error: T.shape({
|
|
2999
|
+
level: T.string,
|
|
3000
|
+
message: T.string
|
|
3001
|
+
}),
|
|
3002
|
+
|
|
3003
|
+
/**
|
|
3004
|
+
* meta data that came with the dataset
|
|
3005
|
+
*/
|
|
3006
|
+
meta: T.object
|
|
3007
|
+
})),
|
|
3008
|
+
|
|
3009
|
+
/**
|
|
3010
|
+
* A callback to trigger event
|
|
3011
|
+
*/
|
|
3012
|
+
onEventTrigger: T.func,
|
|
3013
|
+
|
|
3014
|
+
/**
|
|
3015
|
+
* Inform viz if there are handlers listening to events
|
|
3016
|
+
*/
|
|
3017
|
+
hasEventHandlers: T.bool,
|
|
3018
|
+
|
|
3019
|
+
/**
|
|
3020
|
+
* A callback to communicate computed props to a consumer
|
|
3021
|
+
*/
|
|
3022
|
+
onComputedProps: T.func,
|
|
3023
|
+
|
|
3024
|
+
/**
|
|
3025
|
+
* A callback to obtain visualization api
|
|
3026
|
+
*/
|
|
3027
|
+
vizActionHandlerRef: T.func,
|
|
3028
|
+
loading: T.bool,
|
|
3029
|
+
theme: T.object,
|
|
3030
|
+
|
|
3031
|
+
/**
|
|
3032
|
+
* A callback to request new data with updated request params
|
|
3033
|
+
*/
|
|
3034
|
+
onRequestParamsChange: T.func
|
|
2106
3035
|
};
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
rx: {
|
|
2119
|
-
description: 'Specify the curvature of the horizontal corner (or border) radius with an integer or a percent greater than or equal to zero.',
|
|
2120
|
-
type: 'number',
|
|
2121
|
-
default: 0
|
|
2122
|
-
},
|
|
2123
|
-
ry: {
|
|
2124
|
-
description: 'Specify the curvature of the vertical corner (or border) radius with an integer or a percent greater than or equal to zero.',
|
|
2125
|
-
type: 'number',
|
|
2126
|
-
default: '> rx'
|
|
2127
|
-
},
|
|
2128
|
-
strokeColor: {
|
|
2129
|
-
default: '> themes.defaultStrokeColor',
|
|
2130
|
-
description: 'Specify the stroke color. You may use a dataSource to apply the color. The hex value format should be "#FFFFFF". The default for enterprise light mode is "#3C444D". The default for enterprise dark mode is "#C3CBD4". The default for prisma dark mode is "#ACACAD".',
|
|
2131
|
-
type: 'string'
|
|
2132
|
-
},
|
|
2133
|
-
strokeDashStyle: {
|
|
2134
|
-
description: 'Specify the size, in pixels, of dashes and spaces used to create a custom stitched outline. The value you specify applies to both the dashes and the spaces between them.',
|
|
2135
|
-
type: 'number',
|
|
2136
|
-
default: 0
|
|
3036
|
+
/**
|
|
3037
|
+
*
|
|
3038
|
+
*/
|
|
3039
|
+
|
|
3040
|
+
SplunkVisualization.defaultProps = {
|
|
3041
|
+
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
3042
|
+
width: '100%',
|
|
3043
|
+
height: exports.INITIAL_HEIGHT,
|
|
3044
|
+
dataSources: {},
|
|
3045
|
+
onEventTrigger: function onEventTrigger() {
|
|
3046
|
+
return {};
|
|
2137
3047
|
},
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
3048
|
+
mode: 'view',
|
|
3049
|
+
hasEventHandlers: false,
|
|
3050
|
+
options: {},
|
|
3051
|
+
context: {},
|
|
3052
|
+
onOptionsChange: function onOptionsChange() {
|
|
3053
|
+
return {};
|
|
2143
3054
|
},
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
type: 'number',
|
|
2147
|
-
default: 1
|
|
3055
|
+
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
3056
|
+
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
2148
3057
|
},
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
type: 'number',
|
|
2152
|
-
default: 1
|
|
2153
|
-
}
|
|
2154
|
-
};
|
|
2155
|
-
var themes = {
|
|
2156
|
-
defaultFillColor: function defaultFillColor(props) {
|
|
2157
|
-
return (0, themes_1.pick)({
|
|
2158
|
-
enterprise: {
|
|
2159
|
-
dark: themes_1.variables.gray25(props),
|
|
2160
|
-
light: themes_1.variables.gray80(props)
|
|
2161
|
-
},
|
|
2162
|
-
prisma: themes_1.variables.backgroundColorSidebar(props)
|
|
2163
|
-
})(props);
|
|
3058
|
+
onComputedProps: function onComputedProps() {
|
|
3059
|
+
return {};
|
|
2164
3060
|
},
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
enterprise: {
|
|
2168
|
-
dark: themes_1.variables.gray80(props),
|
|
2169
|
-
light: themes_1.variables.gray30(props)
|
|
2170
|
-
},
|
|
2171
|
-
prisma: themes_1.variables.neutral500(props)
|
|
2172
|
-
})(props);
|
|
2173
|
-
}
|
|
2174
|
-
};
|
|
2175
|
-
var basePresetContext = {
|
|
2176
|
-
fillColorEditorConfig: undefined,
|
|
2177
|
-
strokeColorEditorConfig: undefined
|
|
2178
|
-
};
|
|
2179
|
-
var basePresetOptions = {
|
|
2180
|
-
fillColor: undefined,
|
|
2181
|
-
strokeColor: undefined
|
|
3061
|
+
loading: false,
|
|
3062
|
+
onRequestParamsChange: lodash_1.noop
|
|
2182
3063
|
};
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
value:
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
})
|
|
2202
|
-
}
|
|
2203
|
-
}, {
|
|
2204
|
-
label: (0, i18n_1._)('Stroke'),
|
|
2205
|
-
name: 'rectangle.stroke',
|
|
2206
|
-
value: {
|
|
2207
|
-
context: Object.assign(Object.assign({}, basePresetContext), {
|
|
2208
|
-
strokeDataValue: '> primary | seriesByType("number") | lastPoint()',
|
|
2209
|
-
strokeColorEditorConfig: defaultContext.strokeColorConfig
|
|
2210
|
-
}),
|
|
2211
|
-
options: Object.assign(Object.assign({}, basePresetOptions), {
|
|
2212
|
-
strokeColor: '> strokeDataValue | rangeValue(strokeColorEditorConfig)'
|
|
2213
|
-
})
|
|
2214
|
-
}
|
|
2215
|
-
}, {
|
|
2216
|
-
label: (0, i18n_1._)('Fill and Stroke'),
|
|
2217
|
-
name: 'rectangle.fillAndStroke',
|
|
2218
|
-
value: {
|
|
2219
|
-
context: Object.assign(Object.assign({}, basePresetContext), {
|
|
2220
|
-
fillDataValue: '> primary | seriesByType("number") | lastPoint()',
|
|
2221
|
-
strokeDataValue: '> primary | seriesByType("number") | lastPoint()',
|
|
2222
|
-
fillColorEditorConfig: defaultContext.fillColorConfig,
|
|
2223
|
-
strokeColorEditorConfig: defaultContext.strokeColorConfig
|
|
2224
|
-
}),
|
|
2225
|
-
options: Object.assign(Object.assign({}, basePresetOptions), {
|
|
2226
|
-
fillColor: '> fillDataValue | rangeValue(fillColorEditorConfig)',
|
|
2227
|
-
strokeColor: '> strokeDataValue | rangeValue(strokeColorEditorConfig)'
|
|
2228
|
-
})
|
|
2229
|
-
}
|
|
2230
|
-
}];
|
|
2231
|
-
var editorConfig = [{
|
|
2232
|
-
label: (0, i18n_1._)('Color and style'),
|
|
2233
|
-
layout: [[{
|
|
2234
|
-
label: (0, i18n_1._)('Dynamic elements'),
|
|
2235
|
-
key: 'presetSelector',
|
|
2236
|
-
editor: 'editor.presetSelector',
|
|
2237
|
-
editorProps: {
|
|
2238
|
-
presets: presets,
|
|
2239
|
-
value: function value(_ref) {
|
|
2240
|
-
var context = _ref.context,
|
|
2241
|
-
options = _ref.options;
|
|
2242
|
-
var initialPreset = (0, configUtils_1.getInitialPreset)(context, options, presets);
|
|
2243
|
-
return initialPreset && initialPreset.label || null;
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
}], [Object.assign(Object.assign({}, StaticFillColorEditor_1.default), {
|
|
2247
|
-
editorProps: {
|
|
2248
|
-
themes: themes
|
|
2249
|
-
}
|
|
2250
|
-
})], [(0, DynamicFillColorEditor_1.getDynamicFillColorEditor)({
|
|
2251
|
-
defaultContext: defaultContext,
|
|
2252
|
-
defaultPalettesConfig: PresetPalettes_1.defaultPalettesConfig
|
|
2253
|
-
})], [Object.assign(Object.assign({}, StaticStrokeColorEditor_1.default), {
|
|
2254
|
-
editorProps: {
|
|
2255
|
-
themes: themes
|
|
2256
|
-
}
|
|
2257
|
-
})], [(0, DynamicStrokeColorEditor_1.getDynamicStrokeColorEditor)({
|
|
2258
|
-
defaultContext: defaultContext,
|
|
2259
|
-
defaultPalettesConfig: PresetPalettes_1.defaultPalettesConfig
|
|
2260
|
-
})], [{
|
|
2261
|
-
label: (0, i18n_1._)('Fill opacity (%)'),
|
|
2262
|
-
option: 'fillOpacity',
|
|
2263
|
-
editor: 'editor.percent',
|
|
2264
|
-
editorProps: {
|
|
2265
|
-
min: 0
|
|
2266
|
-
}
|
|
2267
|
-
}, {
|
|
2268
|
-
label: (0, i18n_1._)('Stroke opacity (%)'),
|
|
2269
|
-
option: 'strokeOpacity',
|
|
2270
|
-
editor: 'editor.percent',
|
|
2271
|
-
editorProps: {
|
|
2272
|
-
min: 0
|
|
2273
|
-
}
|
|
2274
|
-
}], [{
|
|
2275
|
-
label: (0, i18n_1._)('Stroke width'),
|
|
2276
|
-
option: 'strokeWidth',
|
|
2277
|
-
editor: 'editor.number',
|
|
2278
|
-
editorProps: {
|
|
2279
|
-
min: 0
|
|
2280
|
-
}
|
|
2281
|
-
}, {
|
|
2282
|
-
label: (0, i18n_1._)('Stroke dash style'),
|
|
2283
|
-
option: 'strokeDashStyle',
|
|
2284
|
-
editor: 'editor.number',
|
|
2285
|
-
editorProps: {
|
|
2286
|
-
min: 0
|
|
2287
|
-
}
|
|
2288
|
-
}], [{
|
|
2289
|
-
label: (0, i18n_1._)('Radius (px)'),
|
|
2290
|
-
option: 'rx',
|
|
2291
|
-
editor: 'editor.number',
|
|
2292
|
-
editorProps: {
|
|
2293
|
-
min: 0
|
|
2294
|
-
}
|
|
2295
|
-
}, {}]]
|
|
2296
|
-
}];
|
|
3064
|
+
exports.default = SplunkVisualization;
|
|
3065
|
+
|
|
3066
|
+
/***/ }),
|
|
3067
|
+
|
|
3068
|
+
/***/ 62:
|
|
3069
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3070
|
+
|
|
3071
|
+
"use strict";
|
|
3072
|
+
|
|
3073
|
+
|
|
3074
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3075
|
+
value: true
|
|
3076
|
+
});
|
|
3077
|
+
exports.useDeepMemo = void 0;
|
|
3078
|
+
|
|
3079
|
+
var react_1 = __webpack_require__(0);
|
|
3080
|
+
|
|
3081
|
+
var lodash_1 = __webpack_require__(3);
|
|
2297
3082
|
/**
|
|
2298
|
-
*
|
|
3083
|
+
* This hook evaluates and stores the result of a passed function and only
|
|
3084
|
+
* re-evaluates the function when passed dependencies change.
|
|
3085
|
+
*
|
|
3086
|
+
* It is different from the internal React useMemo in the following aspects:
|
|
3087
|
+
* - it only stores the last evaluated result
|
|
3088
|
+
* - it uses a deep equality check to determine if dependencies have changed
|
|
3089
|
+
*
|
|
3090
|
+
* Inspired by apollo-client's useDeepMemo
|
|
3091
|
+
*
|
|
3092
|
+
* @param fn the function to be executed and
|
|
3093
|
+
* @param dependencies an array of dependencies
|
|
2299
3094
|
*/
|
|
2300
3095
|
|
|
2301
|
-
var config = {
|
|
2302
|
-
/**
|
|
2303
|
-
* unique viz key
|
|
2304
|
-
*/
|
|
2305
|
-
key: 'splunk.rectangle',
|
|
2306
3096
|
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
*/
|
|
2310
|
-
name: (0, i18n_1._)('Rectangle'),
|
|
2311
|
-
category: VizCategory_1.VizCategory.SHAPES,
|
|
3097
|
+
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
3098
|
+
var ref = (0, react_1.useRef)();
|
|
2312
3099
|
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
size: size,
|
|
2319
|
-
defaultContext: defaultContext,
|
|
2320
|
-
optionsSchema: exports.optionsSchema,
|
|
2321
|
-
editorConfig: editorConfig,
|
|
2322
|
-
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS],
|
|
2323
|
-
themes: themes,
|
|
2324
|
-
events: {
|
|
2325
|
-
'rectangle.click': {
|
|
2326
|
-
description: 'trigger when user clicks rectangle',
|
|
2327
|
-
payloadKeys: ['strokeColor', 'fillColor']
|
|
2328
|
-
}
|
|
3100
|
+
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
3101
|
+
ref.current = {
|
|
3102
|
+
dependencies: dependencies,
|
|
3103
|
+
value: fn()
|
|
3104
|
+
};
|
|
2329
3105
|
}
|
|
3106
|
+
|
|
3107
|
+
return ref.current.value;
|
|
2330
3108
|
};
|
|
2331
|
-
|
|
3109
|
+
|
|
3110
|
+
exports.useDeepMemo = useDeepMemo;
|
|
2332
3111
|
|
|
2333
3112
|
/***/ }),
|
|
2334
3113
|
|
|
2335
|
-
/***/
|
|
3114
|
+
/***/ 63:
|
|
3115
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3116
|
+
|
|
3117
|
+
"use strict";
|
|
3118
|
+
|
|
3119
|
+
|
|
3120
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3121
|
+
value: true
|
|
3122
|
+
});
|
|
3123
|
+
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
3124
|
+
|
|
3125
|
+
var React = __webpack_require__(0);
|
|
3126
|
+
|
|
3127
|
+
var T = __webpack_require__(1);
|
|
3128
|
+
|
|
3129
|
+
var i18n_1 = __webpack_require__(2);
|
|
3130
|
+
|
|
3131
|
+
var Message_1 = __webpack_require__(12);
|
|
3132
|
+
|
|
3133
|
+
var FixedSizeContainer_1 = __webpack_require__(17);
|
|
3134
|
+
/**
|
|
3135
|
+
* @method isMissing
|
|
3136
|
+
* @param {any} v
|
|
3137
|
+
* @returns {boolean} true if the input value === null or undefined
|
|
3138
|
+
*/
|
|
3139
|
+
|
|
3140
|
+
|
|
3141
|
+
var isMissing = function isMissing(v) {
|
|
3142
|
+
return v === null || v === undefined;
|
|
3143
|
+
};
|
|
3144
|
+
|
|
3145
|
+
exports.isMissing = isMissing;
|
|
3146
|
+
/**
|
|
3147
|
+
* @method misskingKeys
|
|
3148
|
+
* @param {string[]} keys
|
|
3149
|
+
* @param {object} target
|
|
3150
|
+
* @returns {string[]} the keys of missing required props
|
|
3151
|
+
*/
|
|
3152
|
+
|
|
3153
|
+
var missingKeys = function missingKeys(keys, target) {
|
|
3154
|
+
return keys.filter(function (k) {
|
|
3155
|
+
return (0, exports.isMissing)(target[k]);
|
|
3156
|
+
});
|
|
3157
|
+
};
|
|
3158
|
+
|
|
3159
|
+
exports.missingKeys = missingKeys;
|
|
3160
|
+
var propTypes = {
|
|
3161
|
+
width: T.oneOfType([T.string, T.number]),
|
|
3162
|
+
height: T.oneOfType([T.string, T.number]),
|
|
3163
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
3164
|
+
backgroundColor: T.string,
|
|
3165
|
+
missingProps: T.arrayOf(T.string)
|
|
3166
|
+
};
|
|
3167
|
+
/**
|
|
3168
|
+
* @method MissingPropsMessage
|
|
3169
|
+
* @param {MissingPropsProps} props
|
|
3170
|
+
* @returns {React.ReactElement}
|
|
3171
|
+
*/
|
|
3172
|
+
|
|
3173
|
+
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
3174
|
+
var width = props.width,
|
|
3175
|
+
height = props.height,
|
|
3176
|
+
missingProps = props.missingProps;
|
|
3177
|
+
return React.createElement(Message_1.default, {
|
|
3178
|
+
"data-test": "message",
|
|
3179
|
+
width: width,
|
|
3180
|
+
height: height,
|
|
3181
|
+
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
3182
|
+
});
|
|
3183
|
+
};
|
|
3184
|
+
|
|
3185
|
+
exports.MissingPropsMessage = MissingPropsMessage;
|
|
3186
|
+
exports.MissingPropsMessage.propTypes = propTypes;
|
|
3187
|
+
exports.MissingPropsMessage.defaultProps = {
|
|
3188
|
+
width: '100%',
|
|
3189
|
+
height: 250
|
|
3190
|
+
};
|
|
3191
|
+
exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
|
|
3192
|
+
|
|
3193
|
+
/***/ }),
|
|
3194
|
+
|
|
3195
|
+
/***/ 64:
|
|
2336
3196
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2337
3197
|
|
|
2338
3198
|
"use strict";
|
|
@@ -2342,18 +3202,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2342
3202
|
value: true
|
|
2343
3203
|
});
|
|
2344
3204
|
|
|
2345
|
-
var React = __webpack_require__(
|
|
3205
|
+
var React = __webpack_require__(0);
|
|
2346
3206
|
|
|
2347
3207
|
var styled_components_1 = __webpack_require__(4);
|
|
2348
3208
|
|
|
2349
|
-
var hocUtils_1 = __webpack_require__(
|
|
3209
|
+
var hocUtils_1 = __webpack_require__(23);
|
|
2350
3210
|
|
|
2351
3211
|
var Cover = styled_components_1.default.div.withConfig({
|
|
2352
3212
|
displayName: "withEditModeCover__Cover",
|
|
2353
3213
|
componentId: "sc-1gsbnxb-0"
|
|
2354
3214
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
2355
3215
|
var Blocker = styled_components_1.default.div.attrs({
|
|
2356
|
-
'data-splunk-visualization-version': "26.
|
|
3216
|
+
'data-splunk-visualization-version': "26.2.0 - 49b909915"
|
|
2357
3217
|
}).withConfig({
|
|
2358
3218
|
displayName: "withEditModeCover__Blocker",
|
|
2359
3219
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -2385,7 +3245,7 @@ exports.default = withEditModeCover;
|
|
|
2385
3245
|
|
|
2386
3246
|
/***/ }),
|
|
2387
3247
|
|
|
2388
|
-
/***/
|
|
3248
|
+
/***/ 65:
|
|
2389
3249
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2390
3250
|
|
|
2391
3251
|
"use strict";
|
|
@@ -2395,17 +3255,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2395
3255
|
value: true
|
|
2396
3256
|
});
|
|
2397
3257
|
|
|
2398
|
-
var React = __webpack_require__(
|
|
3258
|
+
var React = __webpack_require__(0);
|
|
2399
3259
|
|
|
2400
|
-
var colorUtils_1 = __webpack_require__(
|
|
3260
|
+
var colorUtils_1 = __webpack_require__(15);
|
|
2401
3261
|
|
|
2402
|
-
var variables_1 = __webpack_require__(
|
|
3262
|
+
var variables_1 = __webpack_require__(13);
|
|
2403
3263
|
|
|
2404
|
-
var IconPlaceholder_1 = __webpack_require__(
|
|
3264
|
+
var IconPlaceholder_1 = __webpack_require__(37);
|
|
2405
3265
|
|
|
2406
3266
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2407
3267
|
|
|
2408
|
-
var hocUtils_1 = __webpack_require__(
|
|
3268
|
+
var hocUtils_1 = __webpack_require__(23);
|
|
2409
3269
|
|
|
2410
3270
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
2411
3271
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
@@ -2450,21 +3310,212 @@ exports.default = withPlaceholder;
|
|
|
2450
3310
|
|
|
2451
3311
|
/***/ }),
|
|
2452
3312
|
|
|
2453
|
-
/***/
|
|
2454
|
-
/***/ (function(module, exports) {
|
|
3313
|
+
/***/ 66:
|
|
3314
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2455
3315
|
|
|
2456
|
-
|
|
3316
|
+
"use strict";
|
|
3317
|
+
|
|
3318
|
+
|
|
3319
|
+
var _slicedToArray = __webpack_require__(7);
|
|
3320
|
+
|
|
3321
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3322
|
+
value: true
|
|
3323
|
+
});
|
|
3324
|
+
|
|
3325
|
+
var react_1 = __webpack_require__(0);
|
|
3326
|
+
|
|
3327
|
+
var lodash_1 = __webpack_require__(3);
|
|
3328
|
+
|
|
3329
|
+
var dataUtils_1 = __webpack_require__(14);
|
|
3330
|
+
|
|
3331
|
+
var usePrevious_1 = __webpack_require__(33);
|
|
3332
|
+
|
|
3333
|
+
var useGetXAndYFields_1 = __webpack_require__(67);
|
|
3334
|
+
|
|
3335
|
+
var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
|
|
3336
|
+
var dataSources = _ref.dataSources,
|
|
3337
|
+
options = _ref.options,
|
|
3338
|
+
context = _ref.context,
|
|
3339
|
+
threshold = _ref.threshold,
|
|
3340
|
+
isDownsamplingEnabled = _ref.isDownsamplingEnabled;
|
|
3341
|
+
var isFirstUseEffectCall = (0, react_1.useRef)(true);
|
|
3342
|
+
var xAndYFieldsWithTypes = (0, useGetXAndYFields_1.default)({
|
|
3343
|
+
shouldEvaluateDSL: isDownsamplingEnabled,
|
|
3344
|
+
options: options,
|
|
3345
|
+
context: context,
|
|
3346
|
+
dataSources: dataSources
|
|
3347
|
+
});
|
|
3348
|
+
var previousXAndYFieldsWithTypes = (0, usePrevious_1.default)(xAndYFieldsWithTypes);
|
|
3349
|
+
var previousDataSources = (0, usePrevious_1.default)(dataSources);
|
|
3350
|
+
var previousThreshold = (0, usePrevious_1.default)(threshold);
|
|
3351
|
+
|
|
3352
|
+
var _ref2 = (0, react_1.useState)(function () {
|
|
3353
|
+
return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
|
|
3354
|
+
dataSources: dataSources,
|
|
3355
|
+
threshold: threshold,
|
|
3356
|
+
options: xAndYFieldsWithTypes
|
|
3357
|
+
}) : dataSources;
|
|
3358
|
+
}),
|
|
3359
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
3360
|
+
downsampledDataSources = _ref3[0],
|
|
3361
|
+
setDownsampledDataSources = _ref3[1];
|
|
3362
|
+
|
|
3363
|
+
var debouncedDownsampleDataSources = (0, react_1.useMemo)(function () {
|
|
3364
|
+
return (0, lodash_1.debounce)(function (downsampleOptions) {
|
|
3365
|
+
var downsampledResult = (0, dataUtils_1.downsampleDataSources)(downsampleOptions);
|
|
3366
|
+
setDownsampledDataSources(downsampledResult);
|
|
3367
|
+
}, 100, {
|
|
3368
|
+
trailing: true
|
|
3369
|
+
});
|
|
3370
|
+
}, []);
|
|
3371
|
+
(0, react_1.useEffect)(function () {
|
|
3372
|
+
// don't downsample again on the use effect call that happened due to the initial render
|
|
3373
|
+
// this is since we already downsampled as part of the useState call
|
|
3374
|
+
if (isFirstUseEffectCall.current) {
|
|
3375
|
+
isFirstUseEffectCall.current = false;
|
|
3376
|
+
return;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
if (!isDownsamplingEnabled) {
|
|
3380
|
+
setDownsampledDataSources(dataSources);
|
|
3381
|
+
return;
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3384
|
+
if ((0, lodash_1.isEqual)(previousXAndYFieldsWithTypes, xAndYFieldsWithTypes) && previousDataSources === dataSources && previousThreshold === threshold) {
|
|
3385
|
+
return;
|
|
3386
|
+
} // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
|
|
3387
|
+
// while the viz is being resized
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
debouncedDownsampleDataSources({
|
|
3391
|
+
dataSources: dataSources,
|
|
3392
|
+
options: xAndYFieldsWithTypes,
|
|
3393
|
+
threshold: threshold
|
|
3394
|
+
}); // need to detect if this runs as part of the initial render
|
|
3395
|
+
}, [dataSources, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousXAndYFieldsWithTypes, previousDataSources, previousThreshold]);
|
|
3396
|
+
return downsampledDataSources;
|
|
3397
|
+
};
|
|
3398
|
+
|
|
3399
|
+
exports.default = useDownsampleDataSources;
|
|
2457
3400
|
|
|
2458
3401
|
/***/ }),
|
|
2459
3402
|
|
|
2460
|
-
/***/
|
|
2461
|
-
/***/ (function(module, exports) {
|
|
3403
|
+
/***/ 67:
|
|
3404
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2462
3405
|
|
|
2463
|
-
|
|
3406
|
+
"use strict";
|
|
3407
|
+
|
|
3408
|
+
|
|
3409
|
+
var _toConsumableArray = __webpack_require__(8);
|
|
3410
|
+
|
|
3411
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3412
|
+
value: true
|
|
3413
|
+
});
|
|
3414
|
+
|
|
3415
|
+
var react_1 = __webpack_require__(0);
|
|
3416
|
+
|
|
3417
|
+
var Options_1 = __webpack_require__(16);
|
|
3418
|
+
/**
|
|
3419
|
+
* Hook that evaluates the DSL for subset of a viz's options needed to determine
|
|
3420
|
+
* its x and y fields as well as the types of all its fields.
|
|
3421
|
+
*/
|
|
3422
|
+
|
|
3423
|
+
|
|
3424
|
+
var useGetXAndYFields = function useGetXAndYFields(_ref) {
|
|
3425
|
+
var shouldEvaluateDSL = _ref.shouldEvaluateDSL,
|
|
3426
|
+
options = _ref.options,
|
|
3427
|
+
context = _ref.context,
|
|
3428
|
+
dataSources = _ref.dataSources;
|
|
3429
|
+
|
|
3430
|
+
var _ref2 = (0, react_1.useMemo)(function () {
|
|
3431
|
+
var _a, _b, _c;
|
|
3432
|
+
|
|
3433
|
+
if (!shouldEvaluateDSL) {
|
|
3434
|
+
return {
|
|
3435
|
+
dataSourcesWithOnlyOnePoint: null,
|
|
3436
|
+
dataFrameWithOnlyOnePoint: null
|
|
3437
|
+
};
|
|
3438
|
+
}
|
|
3439
|
+
|
|
3440
|
+
if (!((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
3441
|
+
return {
|
|
3442
|
+
dataSourcesWithOnlyOnePoint: null,
|
|
3443
|
+
dataFrameWithOnlyOnePoint: null
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
var primaryDS = dataSources.primary;
|
|
3448
|
+
var columnsWithOnlyOnePoint = primaryDS.data.columns.map(function (column) {
|
|
3449
|
+
return [column[0]];
|
|
3450
|
+
});
|
|
3451
|
+
var filteredDataSources = {
|
|
3452
|
+
primary: Object.assign(Object.assign({}, primaryDS), {
|
|
3453
|
+
data: Object.assign(Object.assign({}, primaryDS.data), {
|
|
3454
|
+
columns: columnsWithOnlyOnePoint
|
|
3455
|
+
})
|
|
3456
|
+
})
|
|
3457
|
+
};
|
|
3458
|
+
return {
|
|
3459
|
+
dataSourcesWithOnlyOnePoint: filteredDataSources,
|
|
3460
|
+
dataFrameWithOnlyOnePoint: Options_1.Options.dataFrameFromDataSource(filteredDataSources)
|
|
3461
|
+
};
|
|
3462
|
+
}, [dataSources, shouldEvaluateDSL]),
|
|
3463
|
+
dataSourcesWithOnlyOnePoint = _ref2.dataSourcesWithOnlyOnePoint,
|
|
3464
|
+
dataFrameWithOnlyOnePoint = _ref2.dataFrameWithOnlyOnePoint;
|
|
3465
|
+
|
|
3466
|
+
var xAndYFieldsWithTypes = (0, react_1.useMemo)(function () {
|
|
3467
|
+
try {
|
|
3468
|
+
if (!dataSourcesWithOnlyOnePoint || !dataFrameWithOnlyOnePoint) {
|
|
3469
|
+
return options;
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
if (!(options === null || options === void 0 ? void 0 : options.x) || !(options === null || options === void 0 ? void 0 : options.y) && !(options === null || options === void 0 ? void 0 : options.y2)) {
|
|
3473
|
+
return options;
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3476
|
+
var optionsToEvaluate = {
|
|
3477
|
+
x: options.x,
|
|
3478
|
+
xField: '> x | getField()',
|
|
3479
|
+
y: options.y,
|
|
3480
|
+
yFields: options.y ? '> y | getField()' : undefined,
|
|
3481
|
+
y2: options.y2,
|
|
3482
|
+
y2Fields: options.y2 ? '> y2 | getField()' : undefined,
|
|
3483
|
+
fieldTypes: '> primary | getType()'
|
|
3484
|
+
};
|
|
3485
|
+
|
|
3486
|
+
var _Options_1$Options$ev = Options_1.Options.evaluate({
|
|
3487
|
+
options: optionsToEvaluate,
|
|
3488
|
+
context: context
|
|
3489
|
+
}, dataSourcesWithOnlyOnePoint, function () {}, dataFrameWithOnlyOnePoint),
|
|
3490
|
+
_Options_1$Options$ev2 = _Options_1$Options$ev.xField,
|
|
3491
|
+
xField = _Options_1$Options$ev2 === void 0 ? '' : _Options_1$Options$ev2,
|
|
3492
|
+
_Options_1$Options$ev3 = _Options_1$Options$ev.yFields,
|
|
3493
|
+
yFields = _Options_1$Options$ev3 === void 0 ? [] : _Options_1$Options$ev3,
|
|
3494
|
+
_Options_1$Options$ev4 = _Options_1$Options$ev.y2Fields,
|
|
3495
|
+
y2Fields = _Options_1$Options$ev4 === void 0 ? [] : _Options_1$Options$ev4,
|
|
3496
|
+
fieldTypes = _Options_1$Options$ev.fieldTypes;
|
|
3497
|
+
|
|
3498
|
+
return {
|
|
3499
|
+
xField: xField,
|
|
3500
|
+
yFields: [].concat(_toConsumableArray(yFields), _toConsumableArray(y2Fields)),
|
|
3501
|
+
fieldTypes: fieldTypes
|
|
3502
|
+
};
|
|
3503
|
+
} catch (e) {
|
|
3504
|
+
return {
|
|
3505
|
+
xField: undefined,
|
|
3506
|
+
yFields: [],
|
|
3507
|
+
fieldTypes: []
|
|
3508
|
+
};
|
|
3509
|
+
}
|
|
3510
|
+
}, [options, context, dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint]);
|
|
3511
|
+
return xAndYFieldsWithTypes;
|
|
3512
|
+
};
|
|
3513
|
+
|
|
3514
|
+
exports.default = useGetXAndYFields;
|
|
2464
3515
|
|
|
2465
3516
|
/***/ }),
|
|
2466
3517
|
|
|
2467
|
-
/***/
|
|
3518
|
+
/***/ 68:
|
|
2468
3519
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2469
3520
|
|
|
2470
3521
|
"use strict";
|
|
@@ -2473,54 +3524,51 @@ module.exports = require("@babel/runtime/helpers/taggedTemplateLiteral");
|
|
|
2473
3524
|
Object.defineProperty(exports, "__esModule", {
|
|
2474
3525
|
value: true
|
|
2475
3526
|
});
|
|
2476
|
-
exports.
|
|
2477
|
-
var VizBehavior;
|
|
3527
|
+
exports.getFeatureFlag = void 0;
|
|
2478
3528
|
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
* missing.
|
|
2496
|
-
* @type {string}
|
|
2497
|
-
*/
|
|
3529
|
+
var FeatureFlags_1 = __webpack_require__(69);
|
|
3530
|
+
|
|
3531
|
+
var getFeatureFlag = function getFeatureFlag(context, flagName) {
|
|
3532
|
+
// look for feature flag in context first
|
|
3533
|
+
if (context && Object.keys(context).find(function (key) {
|
|
3534
|
+
return key === flagName;
|
|
3535
|
+
})) {
|
|
3536
|
+
return context[flagName];
|
|
3537
|
+
} // fall back to defaults
|
|
3538
|
+
|
|
3539
|
+
|
|
3540
|
+
if (Object.keys(FeatureFlags_1.default).find(function (key) {
|
|
3541
|
+
return key === flagName;
|
|
3542
|
+
})) {
|
|
3543
|
+
return FeatureFlags_1.default[flagName];
|
|
3544
|
+
} // fall back to false
|
|
2498
3545
|
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
3546
|
+
|
|
3547
|
+
return false;
|
|
3548
|
+
};
|
|
3549
|
+
|
|
3550
|
+
exports.getFeatureFlag = getFeatureFlag;
|
|
2503
3551
|
|
|
2504
3552
|
/***/ }),
|
|
2505
3553
|
|
|
2506
|
-
/***/
|
|
3554
|
+
/***/ 69:
|
|
2507
3555
|
/***/ (function(module, exports) {
|
|
2508
3556
|
|
|
2509
|
-
module.exports = require("@splunk/
|
|
3557
|
+
module.exports = require("@splunk/visualization-context/FeatureFlags");
|
|
2510
3558
|
|
|
2511
3559
|
/***/ }),
|
|
2512
3560
|
|
|
2513
|
-
/***/
|
|
3561
|
+
/***/ 7:
|
|
2514
3562
|
/***/ (function(module, exports) {
|
|
2515
3563
|
|
|
2516
|
-
module.exports = require("@
|
|
3564
|
+
module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
2517
3565
|
|
|
2518
3566
|
/***/ }),
|
|
2519
3567
|
|
|
2520
|
-
/***/
|
|
3568
|
+
/***/ 74:
|
|
2521
3569
|
/***/ (function(module, exports) {
|
|
2522
3570
|
|
|
2523
|
-
module.exports = require("@
|
|
3571
|
+
module.exports = require("@splunk/visualization-icons");
|
|
2524
3572
|
|
|
2525
3573
|
/***/ }),
|
|
2526
3574
|
|
|
@@ -2531,10 +3579,31 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
2531
3579
|
|
|
2532
3580
|
/***/ }),
|
|
2533
3581
|
|
|
3582
|
+
/***/ 81:
|
|
3583
|
+
/***/ (function(module, exports) {
|
|
3584
|
+
|
|
3585
|
+
module.exports = require("@babel/runtime/helpers/taggedTemplateLiteral");
|
|
3586
|
+
|
|
3587
|
+
/***/ }),
|
|
3588
|
+
|
|
3589
|
+
/***/ 82:
|
|
3590
|
+
/***/ (function(module, exports) {
|
|
3591
|
+
|
|
3592
|
+
module.exports = require("@splunk/themes");
|
|
3593
|
+
|
|
3594
|
+
/***/ }),
|
|
3595
|
+
|
|
3596
|
+
/***/ 83:
|
|
3597
|
+
/***/ (function(module, exports) {
|
|
3598
|
+
|
|
3599
|
+
module.exports = require("@splunk/visualization-color-palettes/editors/PresetPalettes");
|
|
3600
|
+
|
|
3601
|
+
/***/ }),
|
|
3602
|
+
|
|
2534
3603
|
/***/ 9:
|
|
2535
3604
|
/***/ (function(module, exports) {
|
|
2536
3605
|
|
|
2537
|
-
module.exports = require("@babel/runtime/helpers/
|
|
3606
|
+
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
2538
3607
|
|
|
2539
3608
|
/***/ })
|
|
2540
3609
|
|