@splunk/visualizations 26.1.2 → 26.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +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 +1421 -352
- 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 +18499 -24296
- 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 +14 -13
- 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/Pie.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 = 462);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -95,57 +95,562 @@ 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/
|
|
119
|
+
module.exports = require("@splunk/visualizations-shared/numberUtils");
|
|
120
120
|
|
|
121
121
|
/***/ }),
|
|
122
122
|
|
|
123
123
|
/***/ 12:
|
|
124
124
|
/***/ (function(module, exports) {
|
|
125
125
|
|
|
126
|
-
module.exports = require("@splunk/visualizations-shared/
|
|
126
|
+
module.exports = require("@splunk/visualizations-shared/Message");
|
|
127
127
|
|
|
128
128
|
/***/ }),
|
|
129
129
|
|
|
130
130
|
/***/ 13:
|
|
131
|
+
/***/ (function(module, exports) {
|
|
132
|
+
|
|
133
|
+
module.exports = require("@splunk/themes/variables");
|
|
134
|
+
|
|
135
|
+
/***/ }),
|
|
136
|
+
|
|
137
|
+
/***/ 14:
|
|
138
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
139
|
+
|
|
140
|
+
"use strict";
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
Object.defineProperty(exports, "__esModule", {
|
|
144
|
+
value: true
|
|
145
|
+
});
|
|
146
|
+
exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
|
|
147
|
+
|
|
148
|
+
var numberUtils_1 = __webpack_require__(11);
|
|
149
|
+
|
|
150
|
+
var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
154
|
+
if (!columns || !columns[0] || !columns[0].length) return [];
|
|
155
|
+
var data = [];
|
|
156
|
+
|
|
157
|
+
var _loop = function _loop(i) {
|
|
158
|
+
var newObj = {};
|
|
159
|
+
fields.forEach(function (field, index) {
|
|
160
|
+
var fieldName = typeof field === 'string' ? field : field.name;
|
|
161
|
+
|
|
162
|
+
if (columns[index][i] === '') {
|
|
163
|
+
newObj[fieldName] = null;
|
|
164
|
+
} else {
|
|
165
|
+
newObj[fieldName] = columns[index][i];
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
data.push(newObj);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
for (var i = 0; i < columns[0].length; i += 1) {
|
|
172
|
+
_loop(i);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return data;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
|
|
179
|
+
// the spikes and overall shape of the chart
|
|
180
|
+
// Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
|
|
181
|
+
// Modifications include:
|
|
182
|
+
// 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
|
|
183
|
+
// 2) Convert to camel case
|
|
184
|
+
// 3) Convert to TS and also return the indices of the points that are in the downsampled result.
|
|
185
|
+
// 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
|
|
186
|
+
// that should be used in case of a tie of the max area in a bucket
|
|
187
|
+
|
|
188
|
+
var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
|
|
189
|
+
var dataLength = data.length;
|
|
190
|
+
var downsampledIndices = [];
|
|
191
|
+
|
|
192
|
+
if (threshold >= dataLength || threshold === 0) {
|
|
193
|
+
var allIndices = data.map(function (values, index) {
|
|
194
|
+
return index;
|
|
195
|
+
});
|
|
196
|
+
return {
|
|
197
|
+
downsampledData: data,
|
|
198
|
+
downsampledIndices: allIndices
|
|
199
|
+
}; // Nothing to do
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
var sampled = [];
|
|
203
|
+
var sampledIndex = 0; // Bucket size. Leave room for start and end data points
|
|
204
|
+
|
|
205
|
+
var every = (dataLength - 2) / (threshold - 2);
|
|
206
|
+
var a = 0; // Initially a is the first point in the triangle
|
|
207
|
+
|
|
208
|
+
var maxAreaPoint;
|
|
209
|
+
var maxArea;
|
|
210
|
+
var area;
|
|
211
|
+
var nextA;
|
|
212
|
+
sampled.push(data[a]); // Always add the first point
|
|
213
|
+
|
|
214
|
+
downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
|
|
215
|
+
|
|
216
|
+
for (var i = 0; i < threshold - 2; i++) {
|
|
217
|
+
// Calculate point average for next bucket (containing c)
|
|
218
|
+
var avgX = 0;
|
|
219
|
+
var avgY = 0;
|
|
220
|
+
var avgRangeStart = Math.floor((i + 1) * every) + 1;
|
|
221
|
+
var avgRangeEnd = Math.floor((i + 2) * every) + 1;
|
|
222
|
+
avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
|
|
223
|
+
var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
|
|
224
|
+
|
|
225
|
+
for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
|
|
226
|
+
avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
|
|
227
|
+
|
|
228
|
+
avgY += data[avgRangeStart][1] * 1;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
avgX /= avgRangeLength;
|
|
232
|
+
avgY /= avgRangeLength; // Get the range for this bucket
|
|
233
|
+
|
|
234
|
+
var rangeOffs = Math.floor((i + 0) * every) + 1;
|
|
235
|
+
var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
|
|
236
|
+
|
|
237
|
+
var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
|
|
238
|
+
|
|
239
|
+
var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
|
|
240
|
+
|
|
241
|
+
maxArea = area = -1;
|
|
242
|
+
var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
|
|
243
|
+
|
|
244
|
+
for (; rangeOffs < rangeTo; rangeOffs++) {
|
|
245
|
+
// Calculate triangle area over three buckets
|
|
246
|
+
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
|
|
247
|
+
// If all points in a bucket have the same area, prioritize the one with an x index
|
|
248
|
+
// that also existed from another series so we don't add another point unnecessarily.
|
|
249
|
+
// By default LTTB picks the leftmost point in the bucket
|
|
250
|
+
|
|
251
|
+
if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
|
|
252
|
+
maxArea = area;
|
|
253
|
+
maxAreaPoint = data[rangeOffs];
|
|
254
|
+
nextA = rangeOffs; // Next a is this b
|
|
255
|
+
// Modification: save the index of the point with the most area
|
|
256
|
+
|
|
257
|
+
maxAreaIndex = rangeOffs;
|
|
258
|
+
}
|
|
259
|
+
} // eslint-disable-next-line no-plusplus
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
|
|
263
|
+
|
|
264
|
+
downsampledIndices.push(maxAreaIndex);
|
|
265
|
+
a = nextA; // This a is the next a (chosen b)
|
|
266
|
+
} // eslint-disable-next-line no-plusplus
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
|
|
270
|
+
|
|
271
|
+
downsampledIndices.push(dataLength - 1);
|
|
272
|
+
return {
|
|
273
|
+
downsampledData: sampled,
|
|
274
|
+
downsampledIndices: downsampledIndices
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
|
|
279
|
+
* if at least one of the values in the column can be loosely coerced to a number.
|
|
280
|
+
* If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
|
|
281
|
+
* returns that it cannot downsample the column.
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
|
|
286
|
+
// Splunk charting allows for numbers in formats such as negative hex that
|
|
287
|
+
// Number() does not support and also allows loose coercion of hex numbers (but not other formats)
|
|
288
|
+
// We want to identify columns which contain at least one value that can be loosely coerced
|
|
289
|
+
var canLooselyCoerceSomeValues = column.findIndex(function (value) {
|
|
290
|
+
return (0, numberUtils_1.startsWithNumber)("".concat(value));
|
|
291
|
+
}) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
|
|
292
|
+
|
|
293
|
+
var coercedColumn = [];
|
|
294
|
+
var canDownsampleColumn = !column.some(function (value) {
|
|
295
|
+
var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
|
|
296
|
+
|
|
297
|
+
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
|
|
298
|
+
return true;
|
|
299
|
+
} // save value and continue to next
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
coercedColumn.push(coercedValue);
|
|
303
|
+
return false;
|
|
304
|
+
});
|
|
305
|
+
return {
|
|
306
|
+
canDownsampleColumn: canDownsampleColumn,
|
|
307
|
+
canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
|
|
308
|
+
coercedColumn: canDownsampleColumn ? coercedColumn : []
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
|
|
313
|
+
* Only strictly increasing x-columns are eligible for downsampling.
|
|
314
|
+
* If the column is not eligible for downsampling, returns an empty array.
|
|
315
|
+
*/
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
|
|
319
|
+
if (fieldType === 'number') {
|
|
320
|
+
var coercedXColumn = column.map(function (xValue) {
|
|
321
|
+
return Number(xValue);
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
|
|
325
|
+
return coercedXColumn;
|
|
326
|
+
}
|
|
327
|
+
} else if (fieldType === 'time') {
|
|
328
|
+
var _coercedXColumn = column.map(function (xValue) {
|
|
329
|
+
return new Date(xValue);
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
|
|
333
|
+
return _coercedXColumn;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return [];
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
|
|
341
|
+
var vizConfig = _ref.vizConfig;
|
|
342
|
+
|
|
343
|
+
var _a;
|
|
344
|
+
|
|
345
|
+
return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
|
|
349
|
+
|
|
350
|
+
var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
|
|
351
|
+
var firstIndex = _ref2.firstIndex,
|
|
352
|
+
lastIndex = _ref2.lastIndex,
|
|
353
|
+
dataSources = _ref2.dataSources,
|
|
354
|
+
width = _ref2.width;
|
|
355
|
+
|
|
356
|
+
var _a, _b, _c;
|
|
357
|
+
|
|
358
|
+
var window = lastIndex - firstIndex + 1;
|
|
359
|
+
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;
|
|
360
|
+
return Math.round(ratio * Number(width));
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
|
|
364
|
+
/**
|
|
365
|
+
* Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
|
|
366
|
+
* then returns the width of the visualization.
|
|
367
|
+
*
|
|
368
|
+
* Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
|
|
369
|
+
* 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
|
|
370
|
+
* in for a categorical chart.
|
|
371
|
+
*/
|
|
372
|
+
|
|
373
|
+
var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
|
|
374
|
+
var enableSearchZoom = _ref3.enableSearchZoom,
|
|
375
|
+
dataSources = _ref3.dataSources,
|
|
376
|
+
selectChartEvent = _ref3.selectChartEvent,
|
|
377
|
+
width = _ref3.width,
|
|
378
|
+
xField = _ref3.xField,
|
|
379
|
+
y2Fields = _ref3.y2Fields;
|
|
380
|
+
|
|
381
|
+
var _a, _b, _c;
|
|
382
|
+
|
|
383
|
+
if (enableSearchZoom || !selectChartEvent) {
|
|
384
|
+
return Number(width);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
|
|
388
|
+
|
|
389
|
+
if (!primaryDataSource) {
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
var startXIndex = selectChartEvent.startXIndex,
|
|
394
|
+
endXIndex = selectChartEvent.endXIndex,
|
|
395
|
+
currentTarget = selectChartEvent.currentTarget;
|
|
396
|
+
|
|
397
|
+
try {
|
|
398
|
+
var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
|
|
399
|
+
return field.name === xField;
|
|
400
|
+
});
|
|
401
|
+
var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
|
|
402
|
+
return field === xField;
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
|
|
410
|
+
var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
|
|
411
|
+
var firstIndex = fullSeries.findIndex(function (x) {
|
|
412
|
+
return downsampledSeries[startXIndex] === x;
|
|
413
|
+
});
|
|
414
|
+
var lastIndex = fullSeries.findIndex(function (x) {
|
|
415
|
+
return downsampledSeries[endXIndex] === x;
|
|
416
|
+
}); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
|
|
417
|
+
// re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
|
|
418
|
+
// Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
|
|
419
|
+
// until SPL-259611 is fixed
|
|
420
|
+
|
|
421
|
+
if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
|
|
422
|
+
return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
|
|
426
|
+
return (0, exports.calculateThresholdOnRangeSelect)({
|
|
427
|
+
firstIndex: firstIndex,
|
|
428
|
+
lastIndex: lastIndex,
|
|
429
|
+
dataSources: dataSources,
|
|
430
|
+
width: width
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
} catch (e) {
|
|
434
|
+
console.error('Error occurred while setting downsample threshold on range select event', e);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return null;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
|
|
441
|
+
|
|
442
|
+
var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
|
|
443
|
+
return column.every(function (value, index) {
|
|
444
|
+
if (fieldType === 'number') {
|
|
445
|
+
if (Number.isNaN(value)) {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (fieldType === 'time') {
|
|
451
|
+
if (Number.isNaN(value.getTime())) {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (index === 0) {
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
return value > column[index - 1];
|
|
461
|
+
});
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
|
|
465
|
+
* displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
|
|
466
|
+
*
|
|
467
|
+
* If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
|
|
468
|
+
* If not all columns can be downsampled, then returns empty arrays for both x and y
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
|
|
473
|
+
var xColumn = [];
|
|
474
|
+
var yColumns = [];
|
|
475
|
+
var canDownsample = !ds.data.fields.some(function (field, index) {
|
|
476
|
+
var _a, _b;
|
|
477
|
+
|
|
478
|
+
var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
|
|
479
|
+
var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
|
|
480
|
+
var column = ds.data.columns[index];
|
|
481
|
+
var hasDisplayedColumnThatCantBeDownsampled = false;
|
|
482
|
+
|
|
483
|
+
if (fieldName === xField) {
|
|
484
|
+
xColumn = strictlyCoerceXColumn(column, fieldType);
|
|
485
|
+
} else if (yFields.has(fieldName)) {
|
|
486
|
+
var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
|
|
487
|
+
coercedColumn = _strictlyCoerceYColum.coercedColumn,
|
|
488
|
+
canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
|
|
489
|
+
canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
|
|
490
|
+
// be downsampled using LTTB
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
|
|
494
|
+
|
|
495
|
+
if (hasDisplayedColumnThatCantBeDownsampled) {
|
|
496
|
+
return true;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (canDownsampleColumn) {
|
|
500
|
+
yColumns.push(coercedColumn);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
return false;
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
if (canDownsample) {
|
|
508
|
+
return {
|
|
509
|
+
xColumn: xColumn,
|
|
510
|
+
yColumns: yColumns
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
return {
|
|
515
|
+
xColumn: [],
|
|
516
|
+
yColumns: []
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
|
|
521
|
+
var sortedIndices = Array.from(indices).sort(function (a, b) {
|
|
522
|
+
return a - b;
|
|
523
|
+
});
|
|
524
|
+
var slicedColumns = [];
|
|
525
|
+
ds.data.columns.forEach(function (column) {
|
|
526
|
+
var slicedColumn = [];
|
|
527
|
+
sortedIndices.forEach(function (index) {
|
|
528
|
+
slicedColumn.push(column[index]);
|
|
529
|
+
});
|
|
530
|
+
slicedColumns.push(slicedColumn);
|
|
531
|
+
}); // update data columns with downsampled columns
|
|
532
|
+
|
|
533
|
+
return Object.assign(Object.assign({}, ds), {
|
|
534
|
+
data: Object.assign(Object.assign({}, ds.data), {
|
|
535
|
+
columns: slicedColumns
|
|
536
|
+
})
|
|
537
|
+
});
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
var downsampleDataSources = function downsampleDataSources(_ref4) {
|
|
541
|
+
var dataSources = _ref4.dataSources,
|
|
542
|
+
threshold = _ref4.threshold,
|
|
543
|
+
options = _ref4.options;
|
|
544
|
+
|
|
545
|
+
var _a, _b, _c;
|
|
546
|
+
|
|
547
|
+
var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
|
|
548
|
+
|
|
549
|
+
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;
|
|
550
|
+
|
|
551
|
+
if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
|
|
552
|
+
return dataSources;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
var xField = options.xField,
|
|
556
|
+
yFields = options.yFields,
|
|
557
|
+
fieldTypes = options.fieldTypes;
|
|
558
|
+
|
|
559
|
+
if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
|
|
560
|
+
return dataSources;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
var nonInternalYFields = new Set(yFields.filter(function (yField) {
|
|
564
|
+
return !yField.startsWith('_');
|
|
565
|
+
}));
|
|
566
|
+
var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
|
|
567
|
+
// At the worst case, each series has non-overlapping downsampled pts
|
|
568
|
+
// which will mean that all points will be included in the downsampled result
|
|
569
|
+
// This will just lead to additional overhead due to coercing each
|
|
570
|
+
// x and y field to number
|
|
571
|
+
|
|
572
|
+
if (maxPointsInDownsample >= numPoints) {
|
|
573
|
+
return dataSources;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
|
|
577
|
+
xColumn = _tryToCoerceAllDispla.xColumn,
|
|
578
|
+
yColumns = _tryToCoerceAllDispla.yColumns;
|
|
579
|
+
|
|
580
|
+
if (!yColumns.length || !xColumn.length) {
|
|
581
|
+
return dataSources;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
var downsampledDataSources = Object.assign({}, dataSources);
|
|
585
|
+
var downsampledIndices = new Set();
|
|
586
|
+
yColumns.forEach(function (yColumn, columnIndex) {
|
|
587
|
+
// perform LTTB downsampling for current series, LTTB takes an [x, y] pair
|
|
588
|
+
var xyPair = yColumn.map(function (yValue, index) {
|
|
589
|
+
return [xColumn[index], yValue];
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
try {
|
|
593
|
+
var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
|
|
594
|
+
downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
|
|
595
|
+
|
|
596
|
+
downsampledIndicesForSeries.forEach(function (downsampleIndex) {
|
|
597
|
+
return downsampledIndices.add(downsampleIndex);
|
|
598
|
+
});
|
|
599
|
+
} catch (e) {
|
|
600
|
+
console.error("Error occurred while downsampling column ".concat(columnIndex), e);
|
|
601
|
+
}
|
|
602
|
+
}); // update data columns with downsampled columns
|
|
603
|
+
|
|
604
|
+
downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
|
|
605
|
+
return downsampledDataSources;
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
exports.downsampleDataSources = downsampleDataSources;
|
|
609
|
+
|
|
610
|
+
/***/ }),
|
|
611
|
+
|
|
612
|
+
/***/ 15:
|
|
613
|
+
/***/ (function(module, exports) {
|
|
614
|
+
|
|
615
|
+
module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
616
|
+
|
|
617
|
+
/***/ }),
|
|
618
|
+
|
|
619
|
+
/***/ 155:
|
|
620
|
+
/***/ (function(module, exports) {
|
|
621
|
+
|
|
622
|
+
module.exports = require("@splunk/visualization-encoding/utils/dsl");
|
|
623
|
+
|
|
624
|
+
/***/ }),
|
|
625
|
+
|
|
626
|
+
/***/ 16:
|
|
627
|
+
/***/ (function(module, exports) {
|
|
628
|
+
|
|
629
|
+
module.exports = require("@splunk/visualization-encoding/Options");
|
|
630
|
+
|
|
631
|
+
/***/ }),
|
|
632
|
+
|
|
633
|
+
/***/ 17:
|
|
131
634
|
/***/ (function(module, exports, __webpack_require__) {
|
|
132
635
|
|
|
133
636
|
"use strict";
|
|
134
637
|
|
|
135
638
|
|
|
639
|
+
var _slicedToArray = __webpack_require__(7);
|
|
640
|
+
|
|
136
641
|
Object.defineProperty(exports, "__esModule", {
|
|
137
642
|
value: true
|
|
138
643
|
});
|
|
139
644
|
|
|
140
|
-
var React = __webpack_require__(
|
|
645
|
+
var React = __webpack_require__(0);
|
|
141
646
|
|
|
142
647
|
var styled_components_1 = __webpack_require__(4);
|
|
143
648
|
|
|
144
|
-
var
|
|
649
|
+
var style_1 = __webpack_require__(18);
|
|
145
650
|
|
|
146
|
-
var
|
|
651
|
+
var colorUtils_1 = __webpack_require__(15);
|
|
147
652
|
|
|
148
|
-
var
|
|
653
|
+
var SizeAwareWrapper_1 = __webpack_require__(26);
|
|
149
654
|
|
|
150
655
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
151
656
|
var width = _ref.width;
|
|
@@ -191,6 +696,20 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
191
696
|
var width = props.width,
|
|
192
697
|
height = props.height,
|
|
193
698
|
backgroundColor = props.backgroundColor;
|
|
699
|
+
var cachedHandleResize = React.useCallback(function (w, h) {
|
|
700
|
+
setContainerWidth(w);
|
|
701
|
+
setContainerHeight(h);
|
|
702
|
+
}, []);
|
|
703
|
+
|
|
704
|
+
var _React$useState = React.useState(Number(props.width)),
|
|
705
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
706
|
+
containerWidth = _React$useState2[0],
|
|
707
|
+
setContainerWidth = _React$useState2[1];
|
|
708
|
+
|
|
709
|
+
var _React$useState3 = React.useState(Number(props.height)),
|
|
710
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
711
|
+
containerHeight = _React$useState4[0],
|
|
712
|
+
setContainerHeight = _React$useState4[1];
|
|
194
713
|
|
|
195
714
|
if (!height) {
|
|
196
715
|
return React.createElement(Item, {
|
|
@@ -202,18 +721,18 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
202
721
|
|
|
203
722
|
return React.createElement(FixSizeItem, {
|
|
204
723
|
"data-test": "fix-size-item",
|
|
205
|
-
"data-splunk-visualization-version": "26.1
|
|
724
|
+
"data-splunk-visualization-version": "26.2.1 - 714383dbb",
|
|
206
725
|
width: width,
|
|
207
726
|
height: height,
|
|
208
727
|
backgroundColor: backgroundColor
|
|
209
|
-
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
})));
|
|
728
|
+
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, {
|
|
729
|
+
width: width,
|
|
730
|
+
height: height,
|
|
731
|
+
onResize: cachedHandleResize
|
|
732
|
+
}), React.createElement(Viz, Object.assign({}, props, {
|
|
733
|
+
width: containerWidth,
|
|
734
|
+
height: containerHeight
|
|
735
|
+
}))));
|
|
217
736
|
};
|
|
218
737
|
|
|
219
738
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
@@ -224,78 +743,31 @@ exports.default = withFixedSizeContainer;
|
|
|
224
743
|
|
|
225
744
|
/***/ }),
|
|
226
745
|
|
|
227
|
-
/***/
|
|
228
|
-
/***/ (function(module, exports) {
|
|
229
|
-
|
|
230
|
-
module.exports = require("@splunk/visualization-encoding/utils/dsl");
|
|
231
|
-
|
|
232
|
-
/***/ }),
|
|
233
|
-
|
|
234
|
-
/***/ 14:
|
|
746
|
+
/***/ 18:
|
|
235
747
|
/***/ (function(module, exports) {
|
|
236
748
|
|
|
237
749
|
module.exports = require("@splunk/visualizations-shared/style");
|
|
238
750
|
|
|
239
751
|
/***/ }),
|
|
240
752
|
|
|
241
|
-
/***/
|
|
753
|
+
/***/ 187:
|
|
242
754
|
/***/ (function(module, exports, __webpack_require__) {
|
|
243
755
|
|
|
244
756
|
"use strict";
|
|
245
757
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
var Wrapper = _ref.Wrapper,
|
|
260
|
-
Visualization = _ref.Visualization;
|
|
261
|
-
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
262
|
-
extendProperties.forEach(function (prop) {
|
|
263
|
-
if (Visualization[prop]) {
|
|
264
|
-
// eslint-disable-next-line no-param-reassign
|
|
265
|
-
Wrapper[prop] = Visualization[prop];
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
271
|
-
|
|
272
|
-
/***/ }),
|
|
273
|
-
|
|
274
|
-
/***/ 16:
|
|
275
|
-
/***/ (function(module, exports) {
|
|
276
|
-
|
|
277
|
-
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
278
|
-
|
|
279
|
-
/***/ }),
|
|
280
|
-
|
|
281
|
-
/***/ 165:
|
|
282
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
283
|
-
|
|
284
|
-
"use strict";
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
var __rest = this && this.__rest || function (s, e) {
|
|
288
|
-
var t = {};
|
|
289
|
-
|
|
290
|
-
for (var p in s) {
|
|
291
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
295
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
296
|
-
}
|
|
297
|
-
return t;
|
|
298
|
-
};
|
|
758
|
+
|
|
759
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
760
|
+
var t = {};
|
|
761
|
+
|
|
762
|
+
for (var p in s) {
|
|
763
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
767
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
768
|
+
}
|
|
769
|
+
return t;
|
|
770
|
+
};
|
|
299
771
|
|
|
300
772
|
Object.defineProperty(exports, "__esModule", {
|
|
301
773
|
value: true
|
|
@@ -306,23 +778,23 @@ var lodash_1 = __webpack_require__(3); // Charting imports i18n which needs to b
|
|
|
306
778
|
// eslint-disable-next-line import/order
|
|
307
779
|
|
|
308
780
|
|
|
309
|
-
var Charting_1 = __webpack_require__(
|
|
781
|
+
var Charting_1 = __webpack_require__(87);
|
|
310
782
|
|
|
311
|
-
var charting_bundle_1 = __webpack_require__(
|
|
783
|
+
var charting_bundle_1 = __webpack_require__(77);
|
|
312
784
|
|
|
313
|
-
var simpleXMLOptions_1 = __webpack_require__(
|
|
785
|
+
var simpleXMLOptions_1 = __webpack_require__(93);
|
|
314
786
|
|
|
315
|
-
var config_1 = __webpack_require__(
|
|
787
|
+
var config_1 = __webpack_require__(463);
|
|
316
788
|
|
|
317
789
|
exports.config = config_1.default;
|
|
318
790
|
|
|
319
|
-
var withDashboardViz_1 = __webpack_require__(
|
|
791
|
+
var withDashboardViz_1 = __webpack_require__(56);
|
|
320
792
|
|
|
321
|
-
var pieUtils_1 = __webpack_require__(
|
|
793
|
+
var pieUtils_1 = __webpack_require__(465);
|
|
322
794
|
|
|
323
|
-
var chartingUtils_1 = __webpack_require__(
|
|
795
|
+
var chartingUtils_1 = __webpack_require__(79);
|
|
324
796
|
|
|
325
|
-
var IconPlaceholder_1 = __webpack_require__(
|
|
797
|
+
var IconPlaceholder_1 = __webpack_require__(37);
|
|
326
798
|
|
|
327
799
|
var validOptions = Object.keys(config_1.default.optionsSchema);
|
|
328
800
|
exports.PieInnerSize = 0.7;
|
|
@@ -408,35 +880,151 @@ exports.default = Pie;
|
|
|
408
880
|
|
|
409
881
|
/***/ }),
|
|
410
882
|
|
|
411
|
-
/***/
|
|
883
|
+
/***/ 19:
|
|
884
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
885
|
+
|
|
886
|
+
"use strict";
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
Object.defineProperty(exports, "__esModule", {
|
|
890
|
+
value: true
|
|
891
|
+
});
|
|
892
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
893
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
894
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
895
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
896
|
+
|
|
897
|
+
/***/ }),
|
|
898
|
+
|
|
899
|
+
/***/ 2:
|
|
412
900
|
/***/ (function(module, exports) {
|
|
413
901
|
|
|
414
|
-
module.exports = require("@
|
|
902
|
+
module.exports = require("@splunk/ui-utils/i18n");
|
|
415
903
|
|
|
416
904
|
/***/ }),
|
|
417
905
|
|
|
418
|
-
/***/
|
|
906
|
+
/***/ 21:
|
|
907
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
908
|
+
|
|
909
|
+
"use strict";
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
var _classCallCheck = __webpack_require__(10);
|
|
913
|
+
|
|
914
|
+
var _createClass = __webpack_require__(25);
|
|
915
|
+
|
|
916
|
+
Object.defineProperty(exports, "__esModule", {
|
|
917
|
+
value: true
|
|
918
|
+
});
|
|
919
|
+
exports.DefaultVizActionHandler = void 0;
|
|
920
|
+
|
|
921
|
+
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
922
|
+
function DefaultVizActionHandler() {
|
|
923
|
+
_classCallCheck(this, DefaultVizActionHandler);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
_createClass(DefaultVizActionHandler, [{
|
|
927
|
+
key: "focus",
|
|
928
|
+
value: function focus() {// noop
|
|
929
|
+
}
|
|
930
|
+
}, {
|
|
931
|
+
key: "snapshot",
|
|
932
|
+
value: function snapshot() {
|
|
933
|
+
return null; // noop
|
|
934
|
+
}
|
|
935
|
+
}]);
|
|
936
|
+
|
|
937
|
+
return DefaultVizActionHandler;
|
|
938
|
+
}();
|
|
939
|
+
|
|
940
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
941
|
+
|
|
942
|
+
/***/ }),
|
|
943
|
+
|
|
944
|
+
/***/ 22:
|
|
945
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
946
|
+
|
|
947
|
+
"use strict";
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
Object.defineProperty(exports, "__esModule", {
|
|
951
|
+
value: true
|
|
952
|
+
});
|
|
953
|
+
exports.VizCategory = void 0;
|
|
954
|
+
var VizCategory;
|
|
955
|
+
|
|
956
|
+
(function (VizCategory) {
|
|
957
|
+
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
958
|
+
VizCategory["TRENDS"] = "Trends";
|
|
959
|
+
VizCategory["COMPARISONS"] = "Comparisons";
|
|
960
|
+
VizCategory["TABLE"] = "Table";
|
|
961
|
+
VizCategory["GAUGE"] = "Gauge";
|
|
962
|
+
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
963
|
+
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
964
|
+
VizCategory["SHAPES"] = "Shapes";
|
|
965
|
+
VizCategory["MISC"] = "misc";
|
|
966
|
+
VizCategory["FLOW"] = "Flow";
|
|
967
|
+
VizCategory["CORRELATION"] = "Correlation";
|
|
968
|
+
VizCategory["SPATIAL"] = "Spatial";
|
|
969
|
+
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
970
|
+
|
|
971
|
+
/***/ }),
|
|
972
|
+
|
|
973
|
+
/***/ 23:
|
|
974
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
975
|
+
|
|
976
|
+
"use strict";
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
Object.defineProperty(exports, "__esModule", {
|
|
980
|
+
value: true
|
|
981
|
+
});
|
|
982
|
+
exports.extendStaticWrapperProps = void 0;
|
|
983
|
+
/**
|
|
984
|
+
* @method extendStaticWrapperProps
|
|
985
|
+
* @param {Object} props
|
|
986
|
+
* @param {DashboardVizType} props.Wrapper
|
|
987
|
+
* @param {DashboardVizType} props.Visualization
|
|
988
|
+
*/
|
|
989
|
+
|
|
990
|
+
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
991
|
+
var Wrapper = _ref.Wrapper,
|
|
992
|
+
Visualization = _ref.Visualization;
|
|
993
|
+
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
994
|
+
extendProperties.forEach(function (prop) {
|
|
995
|
+
if (Visualization[prop]) {
|
|
996
|
+
// eslint-disable-next-line no-param-reassign
|
|
997
|
+
Wrapper[prop] = Visualization[prop];
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
1003
|
+
|
|
1004
|
+
/***/ }),
|
|
1005
|
+
|
|
1006
|
+
/***/ 24:
|
|
419
1007
|
/***/ (function(module, exports) {
|
|
420
1008
|
|
|
421
|
-
module.exports = require("@
|
|
1009
|
+
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
422
1010
|
|
|
423
1011
|
/***/ }),
|
|
424
1012
|
|
|
425
|
-
/***/
|
|
1013
|
+
/***/ 25:
|
|
426
1014
|
/***/ (function(module, exports) {
|
|
427
1015
|
|
|
428
|
-
module.exports = require("@
|
|
1016
|
+
module.exports = require("@babel/runtime/helpers/createClass");
|
|
429
1017
|
|
|
430
1018
|
/***/ }),
|
|
431
1019
|
|
|
432
|
-
/***/
|
|
1020
|
+
/***/ 26:
|
|
433
1021
|
/***/ (function(module, exports) {
|
|
434
1022
|
|
|
435
|
-
module.exports = require("@splunk/
|
|
1023
|
+
module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
436
1024
|
|
|
437
1025
|
/***/ }),
|
|
438
1026
|
|
|
439
|
-
/***/
|
|
1027
|
+
/***/ 27:
|
|
440
1028
|
/***/ (function(module, exports, __webpack_require__) {
|
|
441
1029
|
|
|
442
1030
|
"use strict";
|
|
@@ -444,7 +1032,7 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
444
1032
|
|
|
445
1033
|
var _toConsumableArray = __webpack_require__(8);
|
|
446
1034
|
|
|
447
|
-
var _defineProperty = __webpack_require__(
|
|
1035
|
+
var _defineProperty = __webpack_require__(9);
|
|
448
1036
|
|
|
449
1037
|
var __rest = this && this.__rest || function (s, e) {
|
|
450
1038
|
var t = {};
|
|
@@ -466,7 +1054,7 @@ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig
|
|
|
466
1054
|
|
|
467
1055
|
var lodash_1 = __webpack_require__(3);
|
|
468
1056
|
|
|
469
|
-
var schemaUtils_1 = __webpack_require__(
|
|
1057
|
+
var schemaUtils_1 = __webpack_require__(24);
|
|
470
1058
|
|
|
471
1059
|
var VizBehavior_1 = __webpack_require__(6);
|
|
472
1060
|
|
|
@@ -673,70 +1261,87 @@ exports.insertLayout = insertLayout;
|
|
|
673
1261
|
|
|
674
1262
|
/***/ }),
|
|
675
1263
|
|
|
676
|
-
/***/
|
|
1264
|
+
/***/ 28:
|
|
677
1265
|
/***/ (function(module, exports) {
|
|
678
1266
|
|
|
679
1267
|
module.exports = require("@splunk/visualization-context/FeatureFlagContext");
|
|
680
1268
|
|
|
681
1269
|
/***/ }),
|
|
682
1270
|
|
|
683
|
-
/***/
|
|
1271
|
+
/***/ 3:
|
|
1272
|
+
/***/ (function(module, exports) {
|
|
1273
|
+
|
|
1274
|
+
module.exports = require("lodash");
|
|
1275
|
+
|
|
1276
|
+
/***/ }),
|
|
1277
|
+
|
|
1278
|
+
/***/ 30:
|
|
684
1279
|
/***/ (function(module, exports) {
|
|
685
1280
|
|
|
686
1281
|
module.exports = require("@splunk/themes/pick");
|
|
687
1282
|
|
|
688
1283
|
/***/ }),
|
|
689
1284
|
|
|
690
|
-
/***/
|
|
1285
|
+
/***/ 31:
|
|
691
1286
|
/***/ (function(module, exports) {
|
|
692
1287
|
|
|
693
1288
|
module.exports = require("@splunk/ui-utils/id");
|
|
694
1289
|
|
|
695
1290
|
/***/ }),
|
|
696
1291
|
|
|
697
|
-
/***/
|
|
1292
|
+
/***/ 32:
|
|
698
1293
|
/***/ (function(module, exports) {
|
|
699
1294
|
|
|
700
1295
|
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
701
1296
|
|
|
702
1297
|
/***/ }),
|
|
703
1298
|
|
|
704
|
-
/***/
|
|
705
|
-
/***/ (function(module, exports) {
|
|
1299
|
+
/***/ 33:
|
|
1300
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
706
1301
|
|
|
707
|
-
|
|
1302
|
+
"use strict";
|
|
708
1303
|
|
|
709
|
-
/***/ }),
|
|
710
1304
|
|
|
711
|
-
|
|
712
|
-
|
|
1305
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1306
|
+
value: true
|
|
1307
|
+
});
|
|
713
1308
|
|
|
714
|
-
|
|
1309
|
+
var react_1 = __webpack_require__(0);
|
|
1310
|
+
|
|
1311
|
+
function usePrevious(value) {
|
|
1312
|
+
var ref = (0, react_1.useRef)();
|
|
1313
|
+
(0, react_1.useEffect)(function () {
|
|
1314
|
+
ref.current = value;
|
|
1315
|
+
});
|
|
1316
|
+
return ref.current;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
exports.default = usePrevious;
|
|
715
1320
|
|
|
716
1321
|
/***/ }),
|
|
717
1322
|
|
|
718
|
-
/***/
|
|
1323
|
+
/***/ 34:
|
|
719
1324
|
/***/ (function(module, exports) {
|
|
720
1325
|
|
|
721
|
-
module.exports = require("@splunk/visualizations-shared/
|
|
1326
|
+
module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
722
1327
|
|
|
723
1328
|
/***/ }),
|
|
724
1329
|
|
|
725
|
-
/***/
|
|
1330
|
+
/***/ 35:
|
|
726
1331
|
/***/ (function(module, exports) {
|
|
727
1332
|
|
|
728
|
-
module.exports = require("
|
|
1333
|
+
module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
|
|
729
1334
|
|
|
730
1335
|
/***/ }),
|
|
731
1336
|
|
|
732
|
-
/***/
|
|
1337
|
+
/***/ 36:
|
|
733
1338
|
/***/ (function(module, exports) {
|
|
734
1339
|
|
|
735
|
-
module.exports = require("@splunk/
|
|
1340
|
+
module.exports = require("@splunk/visualizations-shared/propUtils");
|
|
736
1341
|
|
|
737
1342
|
/***/ }),
|
|
738
1343
|
|
|
739
|
-
/***/
|
|
1344
|
+
/***/ 37:
|
|
740
1345
|
/***/ (function(module, exports, __webpack_require__) {
|
|
741
1346
|
|
|
742
1347
|
"use strict";
|
|
@@ -747,17 +1352,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
747
1352
|
});
|
|
748
1353
|
exports.shouldShowIconPlaceholder = void 0;
|
|
749
1354
|
|
|
750
|
-
var React = __webpack_require__(
|
|
1355
|
+
var React = __webpack_require__(0);
|
|
751
1356
|
|
|
752
|
-
var T = __webpack_require__(
|
|
1357
|
+
var T = __webpack_require__(1);
|
|
753
1358
|
|
|
754
1359
|
var lodash_1 = __webpack_require__(3);
|
|
755
1360
|
|
|
756
1361
|
var i18n_1 = __webpack_require__(2);
|
|
757
1362
|
|
|
758
|
-
var Message_1 = __webpack_require__(
|
|
1363
|
+
var Message_1 = __webpack_require__(12);
|
|
759
1364
|
|
|
760
|
-
var FixedSizeContainer_1 = __webpack_require__(
|
|
1365
|
+
var FixedSizeContainer_1 = __webpack_require__(17);
|
|
761
1366
|
/**
|
|
762
1367
|
* @method shouldShowIconPlaceholder
|
|
763
1368
|
* @param {object} dataSources
|
|
@@ -829,24 +1434,24 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
829
1434
|
|
|
830
1435
|
/***/ }),
|
|
831
1436
|
|
|
832
|
-
/***/
|
|
1437
|
+
/***/ 38:
|
|
833
1438
|
/***/ (function(module, exports, __webpack_require__) {
|
|
834
1439
|
|
|
835
1440
|
"use strict";
|
|
836
1441
|
|
|
837
1442
|
|
|
838
|
-
var _defineProperty = __webpack_require__(
|
|
1443
|
+
var _defineProperty = __webpack_require__(9);
|
|
839
1444
|
|
|
840
1445
|
Object.defineProperty(exports, "__esModule", {
|
|
841
1446
|
value: true
|
|
842
1447
|
});
|
|
843
1448
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
844
1449
|
|
|
845
|
-
var T = __webpack_require__(
|
|
1450
|
+
var T = __webpack_require__(1);
|
|
846
1451
|
|
|
847
1452
|
var lodash_1 = __webpack_require__(3);
|
|
848
1453
|
|
|
849
|
-
var DataSource_1 = __webpack_require__(
|
|
1454
|
+
var DataSource_1 = __webpack_require__(19);
|
|
850
1455
|
|
|
851
1456
|
exports.SortParamsPropTypes = T.shape({
|
|
852
1457
|
currentSortKey: T.string,
|
|
@@ -900,23 +1505,7 @@ exports.getSortingParams = getSortingParams;
|
|
|
900
1505
|
|
|
901
1506
|
/***/ }),
|
|
902
1507
|
|
|
903
|
-
/***/
|
|
904
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
905
|
-
|
|
906
|
-
"use strict";
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
Object.defineProperty(exports, "__esModule", {
|
|
910
|
-
value: true
|
|
911
|
-
});
|
|
912
|
-
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
913
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
914
|
-
exports.validSegmentationModes = ['none', 'inner'];
|
|
915
|
-
exports.validOutputModes = ['json_cols', 'json'];
|
|
916
|
-
|
|
917
|
-
/***/ }),
|
|
918
|
-
|
|
919
|
-
/***/ 35:
|
|
1508
|
+
/***/ 39:
|
|
920
1509
|
/***/ (function(module, exports, __webpack_require__) {
|
|
921
1510
|
|
|
922
1511
|
"use strict";
|
|
@@ -927,7 +1516,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
927
1516
|
});
|
|
928
1517
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
929
1518
|
|
|
930
|
-
var T = __webpack_require__(
|
|
1519
|
+
var T = __webpack_require__(1);
|
|
931
1520
|
|
|
932
1521
|
var lodash_1 = __webpack_require__(3);
|
|
933
1522
|
|
|
@@ -981,737 +1570,243 @@ exports.getPaginationParams = getPaginationParams;
|
|
|
981
1570
|
|
|
982
1571
|
/***/ }),
|
|
983
1572
|
|
|
984
|
-
/***/
|
|
985
|
-
/***/ (function(module, exports
|
|
1573
|
+
/***/ 4:
|
|
1574
|
+
/***/ (function(module, exports) {
|
|
986
1575
|
|
|
987
|
-
|
|
1576
|
+
module.exports = require("styled-components");
|
|
988
1577
|
|
|
1578
|
+
/***/ }),
|
|
989
1579
|
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
});
|
|
993
|
-
exports.VizCategory = void 0;
|
|
994
|
-
var VizCategory;
|
|
1580
|
+
/***/ 40:
|
|
1581
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
995
1582
|
|
|
996
|
-
|
|
997
|
-
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
998
|
-
VizCategory["TRENDS"] = "Trends";
|
|
999
|
-
VizCategory["COMPARISONS"] = "Comparisons";
|
|
1000
|
-
VizCategory["TABLE"] = "Table";
|
|
1001
|
-
VizCategory["GAUGE"] = "Gauge";
|
|
1002
|
-
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
1003
|
-
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
1004
|
-
VizCategory["SHAPES"] = "Shapes";
|
|
1005
|
-
VizCategory["MISC"] = "misc";
|
|
1006
|
-
VizCategory["FLOW"] = "Flow";
|
|
1007
|
-
VizCategory["CORRELATION"] = "Correlation";
|
|
1008
|
-
VizCategory["SPATIAL"] = "Spatial";
|
|
1009
|
-
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
1583
|
+
"use strict";
|
|
1010
1584
|
|
|
1011
|
-
/***/ }),
|
|
1012
1585
|
|
|
1013
|
-
|
|
1014
|
-
|
|
1586
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1587
|
+
if (k2 === undefined) k2 = k;
|
|
1588
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1015
1589
|
|
|
1016
|
-
"
|
|
1590
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1591
|
+
desc = {
|
|
1592
|
+
enumerable: true,
|
|
1593
|
+
get: function get() {
|
|
1594
|
+
return m[k];
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1017
1598
|
|
|
1599
|
+
Object.defineProperty(o, k2, desc);
|
|
1600
|
+
} : function (o, m, k, k2) {
|
|
1601
|
+
if (k2 === undefined) k2 = k;
|
|
1602
|
+
o[k2] = m[k];
|
|
1603
|
+
});
|
|
1018
1604
|
|
|
1019
|
-
var
|
|
1605
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1606
|
+
for (var p in m) {
|
|
1607
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1020
1610
|
|
|
1021
1611
|
Object.defineProperty(exports, "__esModule", {
|
|
1022
1612
|
value: true
|
|
1023
1613
|
});
|
|
1024
1614
|
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
var lodash_1 = __webpack_require__(3);
|
|
1615
|
+
__exportStar(__webpack_require__(41), exports);
|
|
1028
1616
|
|
|
1029
|
-
|
|
1617
|
+
__exportStar(__webpack_require__(42), exports);
|
|
1030
1618
|
|
|
1031
|
-
|
|
1619
|
+
__exportStar(__webpack_require__(19), exports);
|
|
1032
1620
|
|
|
1033
|
-
|
|
1621
|
+
__exportStar(__webpack_require__(43), exports);
|
|
1034
1622
|
|
|
1035
|
-
|
|
1623
|
+
__exportStar(__webpack_require__(44), exports);
|
|
1036
1624
|
|
|
1037
|
-
|
|
1625
|
+
__exportStar(__webpack_require__(45), exports);
|
|
1038
1626
|
|
|
1039
|
-
|
|
1627
|
+
__exportStar(__webpack_require__(46), exports);
|
|
1040
1628
|
|
|
1041
|
-
|
|
1629
|
+
__exportStar(__webpack_require__(47), exports);
|
|
1042
1630
|
|
|
1043
|
-
|
|
1631
|
+
__exportStar(__webpack_require__(48), exports);
|
|
1044
1632
|
|
|
1045
|
-
|
|
1633
|
+
__exportStar(__webpack_require__(49), exports);
|
|
1046
1634
|
|
|
1047
|
-
|
|
1635
|
+
__exportStar(__webpack_require__(21), exports);
|
|
1048
1636
|
|
|
1049
|
-
|
|
1637
|
+
__exportStar(__webpack_require__(6), exports);
|
|
1050
1638
|
|
|
1051
|
-
|
|
1639
|
+
__exportStar(__webpack_require__(22), exports);
|
|
1052
1640
|
|
|
1053
|
-
|
|
1641
|
+
__exportStar(__webpack_require__(50), exports);
|
|
1054
1642
|
|
|
1055
|
-
|
|
1643
|
+
__exportStar(__webpack_require__(51), exports);
|
|
1056
1644
|
|
|
1057
|
-
|
|
1645
|
+
__exportStar(__webpack_require__(52), exports);
|
|
1058
1646
|
|
|
1059
|
-
|
|
1647
|
+
__exportStar(__webpack_require__(53), exports);
|
|
1060
1648
|
|
|
1061
|
-
|
|
1649
|
+
__exportStar(__webpack_require__(54), exports);
|
|
1062
1650
|
|
|
1063
|
-
|
|
1651
|
+
__exportStar(__webpack_require__(55), exports);
|
|
1064
1652
|
|
|
1065
|
-
|
|
1066
|
-
/**
|
|
1067
|
-
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
1068
|
-
* @param {DashboardVizOpts} opts
|
|
1069
|
-
* @returns {HOC}
|
|
1070
|
-
*/
|
|
1653
|
+
/***/ }),
|
|
1071
1654
|
|
|
1655
|
+
/***/ 41:
|
|
1656
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1072
1657
|
|
|
1073
|
-
|
|
1074
|
-
var ReactViz = opts.ReactViz,
|
|
1075
|
-
vizConfig = opts.vizConfig,
|
|
1076
|
-
_opts$computeVizProps = opts.computeVizProps,
|
|
1077
|
-
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1078
|
-
disableEditModeCover = opts.disableEditModeCover,
|
|
1079
|
-
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1658
|
+
"use strict";
|
|
1080
1659
|
|
|
1081
|
-
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
1082
|
-
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1083
1660
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1661
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1662
|
+
value: true
|
|
1663
|
+
});
|
|
1086
1664
|
|
|
1087
|
-
|
|
1088
|
-
hasEventHandlers = props.hasEventHandlers,
|
|
1089
|
-
dataSources = props.dataSources,
|
|
1090
|
-
options = props.options,
|
|
1091
|
-
_props$context = props.context,
|
|
1092
|
-
context = _props$context === void 0 ? {} : _props$context,
|
|
1093
|
-
width = props.width,
|
|
1094
|
-
height = props.height,
|
|
1095
|
-
onComputedProps = props.onComputedProps,
|
|
1096
|
-
onEventTrigger = props.onEventTrigger,
|
|
1097
|
-
theme = props.theme,
|
|
1098
|
-
onRequestParamsChange = props.onRequestParamsChange;
|
|
1665
|
+
/***/ }),
|
|
1099
1666
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1667
|
+
/***/ 42:
|
|
1668
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1102
1669
|
|
|
1103
|
-
|
|
1104
|
-
/*
|
|
1105
|
-
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
1106
|
-
This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
|
|
1107
|
-
will use it.
|
|
1108
|
-
@TODO(pwied):
|
|
1109
|
-
- remove when we moved away from @splunk/moment
|
|
1110
|
-
- provide timezone context to dynamic option evaluation phase
|
|
1111
|
-
*/
|
|
1112
|
-
if (!moment_1.default.getDefaultSplunkTimezone()) {
|
|
1113
|
-
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1670
|
+
"use strict";
|
|
1116
1671
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1672
|
+
/**
|
|
1673
|
+
* A data structure used at runtime to wire up a visualization.
|
|
1674
|
+
*/
|
|
1119
1675
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1676
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1677
|
+
value: true
|
|
1678
|
+
});
|
|
1122
1679
|
|
|
1123
|
-
|
|
1680
|
+
/***/ }),
|
|
1124
1681
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
}),
|
|
1128
|
-
currentThemeFamily = _ref.family,
|
|
1129
|
-
currentThemeColorScheme = _ref.colorScheme,
|
|
1130
|
-
currentThemeDensity = _ref.density;
|
|
1682
|
+
/***/ 43:
|
|
1683
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1131
1684
|
|
|
1132
|
-
|
|
1685
|
+
"use strict";
|
|
1133
1686
|
|
|
1134
|
-
var _React$useState = React.useState({}),
|
|
1135
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1136
|
-
evaluatedOptionsAsync = _React$useState2[0],
|
|
1137
|
-
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1138
1687
|
|
|
1688
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1689
|
+
value: true
|
|
1690
|
+
});
|
|
1139
1691
|
|
|
1140
|
-
|
|
1692
|
+
/***/ }),
|
|
1141
1693
|
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
visualizationID = _React$useState4[0];
|
|
1694
|
+
/***/ 44:
|
|
1695
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1145
1696
|
|
|
1146
|
-
|
|
1147
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1148
|
-
dataSourcesInState = _React$useState6[0],
|
|
1149
|
-
setDataSourcesInState = _React$useState6[1];
|
|
1697
|
+
"use strict";
|
|
1150
1698
|
|
|
1151
|
-
var _React$useState7 = React.useState(),
|
|
1152
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1153
|
-
dataFramesInState = _React$useState8[0],
|
|
1154
|
-
setDataFramesInState = _React$useState8[1];
|
|
1155
1699
|
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1700
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1701
|
+
value: true
|
|
1702
|
+
});
|
|
1160
1703
|
|
|
1161
|
-
|
|
1162
|
-
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
1163
|
-
try {
|
|
1164
|
-
if (useAsyncEvaluatedOptions) {
|
|
1165
|
-
var optionsToEvaluate = {
|
|
1166
|
-
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1167
|
-
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1168
|
-
};
|
|
1169
|
-
var asyncDynamicOptionsEvaluatorParams = {
|
|
1170
|
-
visualizationID: visualizationID,
|
|
1171
|
-
props: props,
|
|
1172
|
-
options: optionsToEvaluate,
|
|
1173
|
-
dataSources: dataSources,
|
|
1174
|
-
theme: vizConfig.themes
|
|
1175
|
-
};
|
|
1176
|
-
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
1177
|
-
setEvaluatedOptionsAsync(results.results);
|
|
1178
|
-
}).catch(function () {
|
|
1179
|
-
if (isMounted.current) {
|
|
1180
|
-
setUseAsyncEvaluatedOptions(false);
|
|
1181
|
-
}
|
|
1182
|
-
});
|
|
1183
|
-
} else {
|
|
1184
|
-
var dataFrames = dataFramesInState;
|
|
1704
|
+
/***/ }),
|
|
1185
1705
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1189
|
-
setDataFramesInState(dataFrames);
|
|
1190
|
-
}
|
|
1706
|
+
/***/ 45:
|
|
1707
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1191
1708
|
|
|
1192
|
-
|
|
1193
|
-
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1194
|
-
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1195
|
-
}, dataSources, themeFunc, dataFrames);
|
|
1196
|
-
}
|
|
1197
|
-
} catch (e) {
|
|
1198
|
-
// eslint-disable-next-line no-console
|
|
1199
|
-
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1200
|
-
return {};
|
|
1201
|
-
}
|
|
1709
|
+
"use strict";
|
|
1202
1710
|
|
|
1203
|
-
return {};
|
|
1204
|
-
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1205
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1206
|
-
// 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
|
|
1207
|
-
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1208
1711
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1712
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1713
|
+
value: true
|
|
1714
|
+
});
|
|
1211
1715
|
|
|
1212
|
-
|
|
1213
|
-
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1214
|
-
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1215
|
-
});
|
|
1216
|
-
} // useEffect hook needs to be initialized before any early returns
|
|
1217
|
-
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1716
|
+
/***/ }),
|
|
1218
1717
|
|
|
1718
|
+
/***/ 46:
|
|
1719
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1219
1720
|
|
|
1220
|
-
|
|
1221
|
-
onComputedProps(clonedEvaluatedOptions);
|
|
1222
|
-
});
|
|
1223
|
-
React.useEffect(function () {
|
|
1224
|
-
return function () {
|
|
1225
|
-
if (useAsyncEvaluatedOptions) {
|
|
1226
|
-
isMounted.current = false;
|
|
1227
|
-
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1228
|
-
}
|
|
1229
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1230
|
-
}, []); // present warning message if any required props are missing
|
|
1721
|
+
"use strict";
|
|
1231
1722
|
|
|
1232
|
-
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1233
|
-
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1234
|
-
supports = vizConfig.supports;
|
|
1235
|
-
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1236
1723
|
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
"data-test": "missing-props-message",
|
|
1241
|
-
width: width,
|
|
1242
|
-
height: height,
|
|
1243
|
-
missingProps: missing,
|
|
1244
|
-
backgroundColor: bgColorFromTheme
|
|
1245
|
-
});
|
|
1246
|
-
} // events
|
|
1724
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1725
|
+
value: true
|
|
1726
|
+
});
|
|
1247
1727
|
|
|
1728
|
+
/***/ }),
|
|
1248
1729
|
|
|
1249
|
-
|
|
1730
|
+
/***/ 462:
|
|
1731
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1250
1732
|
|
|
1251
|
-
|
|
1252
|
-
var supportedEvents = vizConfig.events;
|
|
1253
|
-
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1254
|
-
var _supportedEvents$even = supportedEvents[eventName],
|
|
1255
|
-
parentKeys = _supportedEvents$even.parentKeys,
|
|
1256
|
-
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
1257
|
-
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
1258
|
-
// then remove these lines
|
|
1733
|
+
"use strict";
|
|
1259
1734
|
|
|
1260
|
-
var payload = {};
|
|
1261
1735
|
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1736
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1737
|
+
if (k2 === undefined) k2 = k;
|
|
1738
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1267
1739
|
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
type: eventName
|
|
1277
|
-
});
|
|
1278
|
-
};
|
|
1279
|
-
|
|
1280
|
-
if (parentKeys) {
|
|
1281
|
-
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
1282
|
-
var newObject = {};
|
|
1283
|
-
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
1284
|
-
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
});
|
|
1288
|
-
} // compute pure viz props which are not from options
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1292
|
-
themeFunc: themeFunc
|
|
1293
|
-
}));
|
|
1294
|
-
/**
|
|
1295
|
-
* PAGE_AND_SORT behavior
|
|
1296
|
-
*
|
|
1297
|
-
* Some visualizations, like table, requires metadata about the datasource,
|
|
1298
|
-
* like total number of results, current count, offset, and sort, for rendering
|
|
1299
|
-
* paginator and sorting direction. In this approach, the visualization
|
|
1300
|
-
* allow users to set 'paginateDataSourceKey' to select which datasource
|
|
1301
|
-
* should the visualization extract the metadata from. It defaults to 'primary' datasource.
|
|
1302
|
-
* The visualization config should set the PAGE_AND_SORT behavior to receive
|
|
1303
|
-
* 'requestParams', 'meta' and onRequestParams callback as props.
|
|
1304
|
-
*
|
|
1305
|
-
* In future, we could automatically detect which all datasources are being used
|
|
1306
|
-
* and bind those magically to pagination/sorting behavior.
|
|
1307
|
-
*/
|
|
1308
|
-
|
|
1309
|
-
var dataSourceMetadata = {};
|
|
1310
|
-
var OptionKey = 'paginateDataSourceKey';
|
|
1311
|
-
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1312
|
-
|
|
1313
|
-
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1314
|
-
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1315
|
-
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1316
|
-
|
|
1317
|
-
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1318
|
-
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1319
|
-
};
|
|
1320
|
-
|
|
1321
|
-
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1322
|
-
requestParams: requestParams,
|
|
1323
|
-
meta: meta,
|
|
1324
|
-
onRequestParamsChange: handleRequestParamsChange
|
|
1325
|
-
});
|
|
1326
|
-
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
1327
|
-
requestParams: requestParams,
|
|
1328
|
-
meta: meta,
|
|
1329
|
-
onRequestParamsChange: handleRequestParamsChange
|
|
1330
|
-
});
|
|
1331
|
-
dataSourceMetadata = {
|
|
1332
|
-
sortParams: sortParams,
|
|
1333
|
-
paginatorParams: paginatorParams
|
|
1334
|
-
};
|
|
1335
|
-
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1339
|
-
return null;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1343
|
-
mode: mode,
|
|
1344
|
-
width: width,
|
|
1345
|
-
height: height
|
|
1346
|
-
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1347
|
-
};
|
|
1348
|
-
|
|
1349
|
-
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1350
|
-
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1351
|
-
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1352
|
-
theme: {}
|
|
1353
|
-
}); // attach viz config
|
|
1740
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1741
|
+
desc = {
|
|
1742
|
+
enumerable: true,
|
|
1743
|
+
get: function get() {
|
|
1744
|
+
return m[k];
|
|
1745
|
+
}
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1354
1748
|
|
|
1355
|
-
|
|
1749
|
+
Object.defineProperty(o, k2, desc);
|
|
1750
|
+
} : function (o, m, k, k2) {
|
|
1751
|
+
if (k2 === undefined) k2 = k;
|
|
1752
|
+
o[k2] = m[k];
|
|
1753
|
+
});
|
|
1356
1754
|
|
|
1357
|
-
|
|
1755
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1756
|
+
for (var p in m) {
|
|
1757
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1758
|
+
}
|
|
1358
1759
|
};
|
|
1359
1760
|
|
|
1360
|
-
exports
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
/***/ 38:
|
|
1365
|
-
/***/ (function(module, exports) {
|
|
1366
|
-
|
|
1367
|
-
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1368
|
-
|
|
1369
|
-
/***/ }),
|
|
1370
|
-
|
|
1371
|
-
/***/ 39:
|
|
1372
|
-
/***/ (function(module, exports) {
|
|
1373
|
-
|
|
1374
|
-
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1375
|
-
|
|
1376
|
-
/***/ }),
|
|
1377
|
-
|
|
1378
|
-
/***/ 4:
|
|
1379
|
-
/***/ (function(module, exports) {
|
|
1380
|
-
|
|
1381
|
-
module.exports = require("styled-components");
|
|
1382
|
-
|
|
1383
|
-
/***/ }),
|
|
1384
|
-
|
|
1385
|
-
/***/ 40:
|
|
1386
|
-
/***/ (function(module, exports) {
|
|
1387
|
-
|
|
1388
|
-
module.exports = require("@splunk/moment");
|
|
1761
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1762
|
+
value: true
|
|
1763
|
+
});
|
|
1764
|
+
exports.default = void 0;
|
|
1389
1765
|
|
|
1390
|
-
|
|
1766
|
+
__exportStar(__webpack_require__(187), exports);
|
|
1391
1767
|
|
|
1392
|
-
|
|
1393
|
-
/***/ (function(module, exports) {
|
|
1768
|
+
var Pie_1 = __webpack_require__(187);
|
|
1394
1769
|
|
|
1395
|
-
|
|
1770
|
+
Object.defineProperty(exports, "default", {
|
|
1771
|
+
enumerable: true,
|
|
1772
|
+
get: function get() {
|
|
1773
|
+
return Pie_1.default;
|
|
1774
|
+
}
|
|
1775
|
+
});
|
|
1396
1776
|
|
|
1397
1777
|
/***/ }),
|
|
1398
1778
|
|
|
1399
|
-
/***/
|
|
1779
|
+
/***/ 463:
|
|
1400
1780
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1401
1781
|
|
|
1402
1782
|
"use strict";
|
|
1403
1783
|
|
|
1404
1784
|
|
|
1405
|
-
var _classCallCheck = __webpack_require__(9);
|
|
1406
|
-
|
|
1407
1785
|
Object.defineProperty(exports, "__esModule", {
|
|
1408
1786
|
value: true
|
|
1409
1787
|
});
|
|
1410
|
-
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1411
|
-
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1412
|
-
|
|
1413
|
-
var T = __webpack_require__(0);
|
|
1414
|
-
|
|
1415
|
-
var lodash_1 = __webpack_require__(3);
|
|
1416
|
-
|
|
1417
|
-
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
exports.INITIAL_WIDTH = 250;
|
|
1421
|
-
exports.INITIAL_HEIGHT = 250;
|
|
1422
|
-
/**
|
|
1423
|
-
* A Splunk visualization
|
|
1424
|
-
*/
|
|
1425
|
-
|
|
1426
|
-
var SplunkVisualization = function SplunkVisualization() {
|
|
1427
|
-
_classCallCheck(this, SplunkVisualization);
|
|
1428
|
-
};
|
|
1429
|
-
|
|
1430
|
-
SplunkVisualization.propTypes = {
|
|
1431
|
-
/**
|
|
1432
|
-
* display mode
|
|
1433
|
-
*/
|
|
1434
|
-
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1435
|
-
|
|
1436
|
-
/**
|
|
1437
|
-
* width in pixel or string, defaults to 100%
|
|
1438
|
-
*/
|
|
1439
|
-
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1440
|
-
|
|
1441
|
-
/**
|
|
1442
|
-
* height in pixel or string
|
|
1443
|
-
*/
|
|
1444
|
-
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1445
|
-
|
|
1446
|
-
/**
|
|
1447
|
-
* visualization context used for dynamic option evaluation
|
|
1448
|
-
*/
|
|
1449
|
-
context: T.object,
|
|
1450
1788
|
|
|
1451
|
-
|
|
1452
|
-
* visualization formatting options
|
|
1453
|
-
*/
|
|
1454
|
-
options: T.object,
|
|
1789
|
+
var ChartPie_1 = __webpack_require__(464);
|
|
1455
1790
|
|
|
1456
|
-
|
|
1457
|
-
* A callback to update formatting options
|
|
1458
|
-
*/
|
|
1459
|
-
onOptionsChange: T.func,
|
|
1791
|
+
var placeholders_1 = __webpack_require__(72);
|
|
1460
1792
|
|
|
1461
|
-
|
|
1462
|
-
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1463
|
-
*/
|
|
1464
|
-
dataSources: T.objectOf(T.shape({
|
|
1465
|
-
/**
|
|
1466
|
-
* current request params
|
|
1467
|
-
*/
|
|
1468
|
-
requestParams: T.object,
|
|
1793
|
+
var i18n_1 = __webpack_require__(2);
|
|
1469
1794
|
|
|
1470
|
-
|
|
1471
|
-
* current dataset
|
|
1472
|
-
*/
|
|
1473
|
-
data: T.shape({
|
|
1474
|
-
fields: T.array,
|
|
1475
|
-
columns: T.array
|
|
1476
|
-
}),
|
|
1795
|
+
var schemaUtils_1 = __webpack_require__(24);
|
|
1477
1796
|
|
|
1478
|
-
|
|
1479
|
-
* error
|
|
1480
|
-
*/
|
|
1481
|
-
error: T.shape({
|
|
1482
|
-
level: T.string,
|
|
1483
|
-
message: T.string
|
|
1484
|
-
}),
|
|
1797
|
+
var visualization_color_palettes_1 = __webpack_require__(73);
|
|
1485
1798
|
|
|
1486
|
-
|
|
1487
|
-
* meta data that came with the dataset
|
|
1488
|
-
*/
|
|
1489
|
-
meta: T.object
|
|
1490
|
-
})),
|
|
1799
|
+
var pick_1 = __webpack_require__(30);
|
|
1491
1800
|
|
|
1492
|
-
|
|
1493
|
-
* A callback to trigger event
|
|
1494
|
-
*/
|
|
1495
|
-
onEventTrigger: T.func,
|
|
1801
|
+
var variables_1 = __webpack_require__(13);
|
|
1496
1802
|
|
|
1497
|
-
|
|
1498
|
-
* Inform viz if there are handlers listening to events
|
|
1499
|
-
*/
|
|
1500
|
-
hasEventHandlers: T.bool,
|
|
1803
|
+
var VizBehavior_1 = __webpack_require__(6);
|
|
1501
1804
|
|
|
1502
|
-
|
|
1503
|
-
* A callback to communicate computed props to a consumer
|
|
1504
|
-
*/
|
|
1505
|
-
onComputedProps: T.func,
|
|
1805
|
+
var VizCategory_1 = __webpack_require__(22);
|
|
1506
1806
|
|
|
1507
|
-
|
|
1508
|
-
* A callback to obtain visualization api
|
|
1509
|
-
*/
|
|
1510
|
-
vizActionHandlerRef: T.func,
|
|
1511
|
-
loading: T.bool,
|
|
1512
|
-
theme: T.object,
|
|
1807
|
+
var configUtils_1 = __webpack_require__(27);
|
|
1513
1808
|
|
|
1514
|
-
|
|
1515
|
-
* A callback to request new data with updated request params
|
|
1516
|
-
*/
|
|
1517
|
-
onRequestParamsChange: T.func
|
|
1518
|
-
};
|
|
1519
|
-
/**
|
|
1520
|
-
*
|
|
1521
|
-
*/
|
|
1522
|
-
|
|
1523
|
-
SplunkVisualization.defaultProps = {
|
|
1524
|
-
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1525
|
-
width: '100%',
|
|
1526
|
-
height: exports.INITIAL_HEIGHT,
|
|
1527
|
-
dataSources: {},
|
|
1528
|
-
onEventTrigger: function onEventTrigger() {
|
|
1529
|
-
return {};
|
|
1530
|
-
},
|
|
1531
|
-
mode: 'view',
|
|
1532
|
-
hasEventHandlers: false,
|
|
1533
|
-
options: {},
|
|
1534
|
-
context: {},
|
|
1535
|
-
onOptionsChange: function onOptionsChange() {
|
|
1536
|
-
return {};
|
|
1537
|
-
},
|
|
1538
|
-
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
1539
|
-
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
1540
|
-
},
|
|
1541
|
-
onComputedProps: function onComputedProps() {
|
|
1542
|
-
return {};
|
|
1543
|
-
},
|
|
1544
|
-
loading: false,
|
|
1545
|
-
onRequestParamsChange: lodash_1.noop
|
|
1546
|
-
};
|
|
1547
|
-
exports.default = SplunkVisualization;
|
|
1548
|
-
|
|
1549
|
-
/***/ }),
|
|
1550
|
-
|
|
1551
|
-
/***/ 43:
|
|
1552
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1553
|
-
|
|
1554
|
-
"use strict";
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
var _classCallCheck = __webpack_require__(9);
|
|
1558
|
-
|
|
1559
|
-
var _createClass = __webpack_require__(18);
|
|
1560
|
-
|
|
1561
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1562
|
-
value: true
|
|
1563
|
-
});
|
|
1564
|
-
exports.DefaultVizActionHandler = void 0;
|
|
1565
|
-
|
|
1566
|
-
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1567
|
-
function DefaultVizActionHandler() {
|
|
1568
|
-
_classCallCheck(this, DefaultVizActionHandler);
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
_createClass(DefaultVizActionHandler, [{
|
|
1572
|
-
key: "focus",
|
|
1573
|
-
value: function focus() {// noop
|
|
1574
|
-
}
|
|
1575
|
-
}, {
|
|
1576
|
-
key: "snapshot",
|
|
1577
|
-
value: function snapshot() {
|
|
1578
|
-
return null; // noop
|
|
1579
|
-
}
|
|
1580
|
-
}]);
|
|
1581
|
-
|
|
1582
|
-
return DefaultVizActionHandler;
|
|
1583
|
-
}();
|
|
1584
|
-
|
|
1585
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1586
|
-
|
|
1587
|
-
/***/ }),
|
|
1588
|
-
|
|
1589
|
-
/***/ 44:
|
|
1590
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1591
|
-
|
|
1592
|
-
"use strict";
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1596
|
-
value: true
|
|
1597
|
-
});
|
|
1598
|
-
exports.useDeepMemo = void 0;
|
|
1599
|
-
|
|
1600
|
-
var react_1 = __webpack_require__(1);
|
|
1601
|
-
|
|
1602
|
-
var lodash_1 = __webpack_require__(3);
|
|
1603
|
-
/**
|
|
1604
|
-
* This hook evaluates and stores the result of a passed function and only
|
|
1605
|
-
* re-evaluates the function when passed dependencies change.
|
|
1606
|
-
*
|
|
1607
|
-
* It is different from the internal React useMemo in the following aspects:
|
|
1608
|
-
* - it only stores the last evaluated result
|
|
1609
|
-
* - it uses a deep equality check to determine if dependencies have changed
|
|
1610
|
-
*
|
|
1611
|
-
* Inspired by apollo-client's useDeepMemo
|
|
1612
|
-
*
|
|
1613
|
-
* @param fn the function to be executed and
|
|
1614
|
-
* @param dependencies an array of dependencies
|
|
1615
|
-
*/
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1619
|
-
var ref = (0, react_1.useRef)();
|
|
1620
|
-
|
|
1621
|
-
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1622
|
-
ref.current = {
|
|
1623
|
-
dependencies: dependencies,
|
|
1624
|
-
value: fn()
|
|
1625
|
-
};
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
return ref.current.value;
|
|
1629
|
-
};
|
|
1630
|
-
|
|
1631
|
-
exports.useDeepMemo = useDeepMemo;
|
|
1632
|
-
|
|
1633
|
-
/***/ }),
|
|
1634
|
-
|
|
1635
|
-
/***/ 440:
|
|
1636
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1637
|
-
|
|
1638
|
-
"use strict";
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1642
|
-
if (k2 === undefined) k2 = k;
|
|
1643
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1644
|
-
|
|
1645
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1646
|
-
desc = {
|
|
1647
|
-
enumerable: true,
|
|
1648
|
-
get: function get() {
|
|
1649
|
-
return m[k];
|
|
1650
|
-
}
|
|
1651
|
-
};
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
Object.defineProperty(o, k2, desc);
|
|
1655
|
-
} : function (o, m, k, k2) {
|
|
1656
|
-
if (k2 === undefined) k2 = k;
|
|
1657
|
-
o[k2] = m[k];
|
|
1658
|
-
});
|
|
1659
|
-
|
|
1660
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1661
|
-
for (var p in m) {
|
|
1662
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1663
|
-
}
|
|
1664
|
-
};
|
|
1665
|
-
|
|
1666
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1667
|
-
value: true
|
|
1668
|
-
});
|
|
1669
|
-
exports.default = void 0;
|
|
1670
|
-
|
|
1671
|
-
__exportStar(__webpack_require__(165), exports);
|
|
1672
|
-
|
|
1673
|
-
var Pie_1 = __webpack_require__(165);
|
|
1674
|
-
|
|
1675
|
-
Object.defineProperty(exports, "default", {
|
|
1676
|
-
enumerable: true,
|
|
1677
|
-
get: function get() {
|
|
1678
|
-
return Pie_1.default;
|
|
1679
|
-
}
|
|
1680
|
-
});
|
|
1681
|
-
|
|
1682
|
-
/***/ }),
|
|
1683
|
-
|
|
1684
|
-
/***/ 441:
|
|
1685
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1686
|
-
|
|
1687
|
-
"use strict";
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1691
|
-
value: true
|
|
1692
|
-
});
|
|
1693
|
-
|
|
1694
|
-
var ChartPie_1 = __webpack_require__(442);
|
|
1695
|
-
|
|
1696
|
-
var placeholders_1 = __webpack_require__(50);
|
|
1697
|
-
|
|
1698
|
-
var i18n_1 = __webpack_require__(2);
|
|
1699
|
-
|
|
1700
|
-
var schemaUtils_1 = __webpack_require__(16);
|
|
1701
|
-
|
|
1702
|
-
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1703
|
-
|
|
1704
|
-
var pick_1 = __webpack_require__(23);
|
|
1705
|
-
|
|
1706
|
-
var variables_1 = __webpack_require__(11);
|
|
1707
|
-
|
|
1708
|
-
var VizBehavior_1 = __webpack_require__(6);
|
|
1709
|
-
|
|
1710
|
-
var VizCategory_1 = __webpack_require__(36);
|
|
1711
|
-
|
|
1712
|
-
var configUtils_1 = __webpack_require__(20);
|
|
1713
|
-
|
|
1714
|
-
var BackgroundColor_1 = __webpack_require__(53);
|
|
1809
|
+
var BackgroundColor_1 = __webpack_require__(75);
|
|
1715
1810
|
|
|
1716
1811
|
var dataContract = {
|
|
1717
1812
|
requiredDataSources: [{
|
|
@@ -1931,206 +2026,971 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
|
1931
2026
|
|
|
1932
2027
|
/***/ }),
|
|
1933
2028
|
|
|
1934
|
-
/***/
|
|
2029
|
+
/***/ 464:
|
|
2030
|
+
/***/ (function(module, exports) {
|
|
2031
|
+
|
|
2032
|
+
module.exports = require("@splunk/react-icons/enterprise/ChartPie");
|
|
2033
|
+
|
|
2034
|
+
/***/ }),
|
|
2035
|
+
|
|
2036
|
+
/***/ 465:
|
|
2037
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2038
|
+
|
|
2039
|
+
"use strict";
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2043
|
+
var t = {};
|
|
2044
|
+
|
|
2045
|
+
for (var p in s) {
|
|
2046
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2050
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2051
|
+
}
|
|
2052
|
+
return t;
|
|
2053
|
+
};
|
|
2054
|
+
|
|
2055
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2056
|
+
value: true
|
|
2057
|
+
});
|
|
2058
|
+
exports.allInvalidDataValues = exports.invalidOptionField = exports.getPieOptionFieldIndex = exports.getPieMergedOptions = exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
|
|
2059
|
+
|
|
2060
|
+
var lodash_1 = __webpack_require__(3);
|
|
2061
|
+
|
|
2062
|
+
var propUtils_1 = __webpack_require__(36);
|
|
2063
|
+
|
|
2064
|
+
var dsl_1 = __webpack_require__(155);
|
|
2065
|
+
|
|
2066
|
+
var hocUtils_1 = __webpack_require__(34);
|
|
2067
|
+
|
|
2068
|
+
var JSONSchemaUtils_1 = __webpack_require__(35); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
|
|
2069
|
+
// map for key names which are either new or not present in SimpleXML options mapping
|
|
2070
|
+
|
|
2071
|
+
|
|
2072
|
+
var pieOptionsSCMapping = {
|
|
2073
|
+
resultLimit: 'resultTruncationLimit',
|
|
2074
|
+
seriesColorsByField: 'fieldColors',
|
|
2075
|
+
collapseThreshold: 'chart.sliceCollapsingThreshold',
|
|
2076
|
+
collapseLabel: 'chart.sliceCollapsingLabel'
|
|
2077
|
+
};
|
|
2078
|
+
/**
|
|
2079
|
+
* Helper method to convert option which contains object literal values (e.g. arrays, objects)
|
|
2080
|
+
* to strings as SC can only accept their stringified equivalents
|
|
2081
|
+
* @method convertToStringValues
|
|
2082
|
+
* @param {Object} options
|
|
2083
|
+
* @returns {Object}
|
|
2084
|
+
*/
|
|
2085
|
+
|
|
2086
|
+
var convertToStringValues = function convertToStringValues(options) {
|
|
2087
|
+
var updatedOptions = (0, propUtils_1.convertPropsToString)({
|
|
2088
|
+
vizProps: options,
|
|
2089
|
+
propNames: ['seriesColors', 'fieldColors']
|
|
2090
|
+
});
|
|
2091
|
+
return Object.assign(Object.assign({}, options), updatedOptions);
|
|
2092
|
+
};
|
|
2093
|
+
|
|
2094
|
+
exports.convertToStringValues = convertToStringValues;
|
|
2095
|
+
/**
|
|
2096
|
+
* Helper method to map labelDisplay options to jsCharting options
|
|
2097
|
+
* @method mapLabelDisplay
|
|
2098
|
+
* @param {Object} options
|
|
2099
|
+
* @returns {Object}
|
|
2100
|
+
*/
|
|
2101
|
+
|
|
2102
|
+
var mapLabelDisplay = function mapLabelDisplay(_a) {
|
|
2103
|
+
var labelDisplay = _a.labelDisplay,
|
|
2104
|
+
options = __rest(_a, ["labelDisplay"]);
|
|
2105
|
+
|
|
2106
|
+
var convertedOptions = Object.assign(Object.assign({}, options), {
|
|
2107
|
+
// default for labelDisplay option is 'values'
|
|
2108
|
+
'chart.showLabels': true,
|
|
2109
|
+
'chart.showPercent': false
|
|
2110
|
+
});
|
|
2111
|
+
|
|
2112
|
+
if (labelDisplay === 'valuesAndPercentage') {
|
|
2113
|
+
convertedOptions['chart.showPercent'] = true;
|
|
2114
|
+
} else if (labelDisplay === 'off') {
|
|
2115
|
+
convertedOptions['chart.showLabels'] = false;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
return convertedOptions;
|
|
2119
|
+
};
|
|
2120
|
+
|
|
2121
|
+
exports.mapLabelDisplay = mapLabelDisplay;
|
|
2122
|
+
/**
|
|
2123
|
+
* Helper method to update the option names which can be mapped to SimpleXML options or
|
|
2124
|
+
* can be used directly with SC if don't have a 1-1 mapping in SimpleXML
|
|
2125
|
+
* @method mapToOldKey
|
|
2126
|
+
* @param {Object} options
|
|
2127
|
+
* @returns {Object}
|
|
2128
|
+
*/
|
|
2129
|
+
|
|
2130
|
+
var mapToOldKey = function mapToOldKey(options) {
|
|
2131
|
+
return (0, lodash_1.mapKeys)(options, function (val, key) {
|
|
2132
|
+
return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
|
|
2133
|
+
});
|
|
2134
|
+
};
|
|
2135
|
+
|
|
2136
|
+
exports.mapToOldKey = mapToOldKey;
|
|
2137
|
+
/**
|
|
2138
|
+
* Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
|
|
2139
|
+
* This is for options that has new key name and can not directly be mapped with SimpleXML or
|
|
2140
|
+
* don't have a 1-1 mapping in SimpleXML (i.e. a straightforward name mapping where values are preserved)
|
|
2141
|
+
* @method convertToPieSCProperties
|
|
2142
|
+
* @param {Object} originalOptions
|
|
2143
|
+
* @returns {Object}
|
|
2144
|
+
*/
|
|
2145
|
+
|
|
2146
|
+
var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
|
|
2147
|
+
return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
|
|
2148
|
+
};
|
|
2149
|
+
|
|
2150
|
+
exports.convertToPieSCProperties = convertToPieSCProperties;
|
|
2151
|
+
/**
|
|
2152
|
+
* Return all merged options (default + config) using vizConfig and options
|
|
2153
|
+
* @param options
|
|
2154
|
+
* @param vizConfig
|
|
2155
|
+
* @returns
|
|
2156
|
+
*/
|
|
2157
|
+
|
|
2158
|
+
var getPieMergedOptions = function getPieMergedOptions(options, vizConfig) {
|
|
2159
|
+
return (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default'));
|
|
2160
|
+
};
|
|
2161
|
+
|
|
2162
|
+
exports.getPieMergedOptions = getPieMergedOptions;
|
|
2163
|
+
/**
|
|
2164
|
+
* Returns option's field index. If not found returns -1
|
|
2165
|
+
* @param optionName
|
|
2166
|
+
* @param dataSources
|
|
2167
|
+
* @param options
|
|
2168
|
+
* @param vizConfig
|
|
2169
|
+
* @returns
|
|
2170
|
+
*/
|
|
2171
|
+
|
|
2172
|
+
var getPieOptionFieldIndex = function getPieOptionFieldIndex(optionName, dataSources, options, vizConfig) {
|
|
2173
|
+
var mergedOptions = (0, exports.getPieMergedOptions)(options, vizConfig); // find the field name configured for pie "value"
|
|
2174
|
+
|
|
2175
|
+
var fieldName = (0, dsl_1.getFieldsFromDSL)(mergedOptions[optionName], dataSources)[0];
|
|
2176
|
+
var fields = dataSources.primary.data.fields; // find the field index configured for pie "value"
|
|
2177
|
+
|
|
2178
|
+
var fieldIndex = fields.findIndex(function (field) {
|
|
2179
|
+
return (typeof field === 'string' ? field : field.name.toString()) === fieldName;
|
|
2180
|
+
});
|
|
2181
|
+
return fieldIndex;
|
|
2182
|
+
};
|
|
2183
|
+
|
|
2184
|
+
exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
|
|
2185
|
+
/**
|
|
2186
|
+
* Returns true if columns data has invalid data format for specified option (label or value)
|
|
2187
|
+
* @param optionName
|
|
2188
|
+
* @param dataSources
|
|
2189
|
+
* @param options
|
|
2190
|
+
* @param vizConfig
|
|
2191
|
+
* @returns
|
|
2192
|
+
*/
|
|
2193
|
+
|
|
2194
|
+
var invalidOptionField = function invalidOptionField(optionName, dataSources, options, vizConfig) {
|
|
2195
|
+
var columns = dataSources.primary.data.columns;
|
|
2196
|
+
var fieldIndex = (0, exports.getPieOptionFieldIndex)(optionName, dataSources, options, vizConfig);
|
|
2197
|
+
|
|
2198
|
+
if (fieldIndex === -1 || !columns[fieldIndex] || !Array.isArray(columns[fieldIndex]) || Array.isArray(columns[fieldIndex]) && !columns[fieldIndex].length) {
|
|
2199
|
+
return true;
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
return false;
|
|
2203
|
+
};
|
|
2204
|
+
|
|
2205
|
+
exports.invalidOptionField = invalidOptionField;
|
|
2206
|
+
/**
|
|
2207
|
+
* Helper function to evaluate if all data values are invalid (zero or negative)
|
|
2208
|
+
*/
|
|
2209
|
+
|
|
2210
|
+
var allInvalidDataValues = function allInvalidDataValues(dataSources, options, vizConfig) {
|
|
2211
|
+
var columns = dataSources.primary.data.columns; // find the field index configured for pie "value"
|
|
2212
|
+
|
|
2213
|
+
var valueFieldIndex = (0, exports.getPieOptionFieldIndex)('value', dataSources, options, vizConfig); // check if all values are invalid
|
|
2214
|
+
|
|
2215
|
+
if (Array.isArray(columns) && columns[valueFieldIndex] && Array.isArray(columns[valueFieldIndex])) {
|
|
2216
|
+
return !columns[valueFieldIndex].some(function (value) {
|
|
2217
|
+
return +value > 0;
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
return false;
|
|
2222
|
+
};
|
|
2223
|
+
|
|
2224
|
+
exports.allInvalidDataValues = allInvalidDataValues;
|
|
2225
|
+
|
|
2226
|
+
/***/ }),
|
|
2227
|
+
|
|
2228
|
+
/***/ 47:
|
|
2229
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2230
|
+
|
|
2231
|
+
"use strict";
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2235
|
+
value: true
|
|
2236
|
+
});
|
|
2237
|
+
|
|
2238
|
+
/***/ }),
|
|
2239
|
+
|
|
2240
|
+
/***/ 48:
|
|
2241
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2242
|
+
|
|
2243
|
+
"use strict";
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2247
|
+
value: true
|
|
2248
|
+
});
|
|
2249
|
+
|
|
2250
|
+
/***/ }),
|
|
2251
|
+
|
|
2252
|
+
/***/ 49:
|
|
2253
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2254
|
+
|
|
2255
|
+
"use strict";
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2259
|
+
value: true
|
|
2260
|
+
});
|
|
2261
|
+
|
|
2262
|
+
/***/ }),
|
|
2263
|
+
|
|
2264
|
+
/***/ 50:
|
|
2265
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2266
|
+
|
|
2267
|
+
"use strict";
|
|
2268
|
+
|
|
2269
|
+
|
|
2270
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2271
|
+
value: true
|
|
2272
|
+
});
|
|
2273
|
+
|
|
2274
|
+
/***/ }),
|
|
2275
|
+
|
|
2276
|
+
/***/ 51:
|
|
2277
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2278
|
+
|
|
2279
|
+
"use strict";
|
|
2280
|
+
|
|
2281
|
+
|
|
2282
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2283
|
+
value: true
|
|
2284
|
+
});
|
|
2285
|
+
|
|
2286
|
+
/***/ }),
|
|
2287
|
+
|
|
2288
|
+
/***/ 52:
|
|
2289
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2290
|
+
|
|
2291
|
+
"use strict";
|
|
2292
|
+
|
|
2293
|
+
|
|
2294
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2295
|
+
value: true
|
|
2296
|
+
});
|
|
2297
|
+
|
|
2298
|
+
/***/ }),
|
|
2299
|
+
|
|
2300
|
+
/***/ 53:
|
|
2301
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2302
|
+
|
|
2303
|
+
"use strict";
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2307
|
+
value: true
|
|
2308
|
+
});
|
|
2309
|
+
|
|
2310
|
+
/***/ }),
|
|
2311
|
+
|
|
2312
|
+
/***/ 54:
|
|
2313
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2314
|
+
|
|
2315
|
+
"use strict";
|
|
2316
|
+
|
|
2317
|
+
|
|
2318
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2319
|
+
value: true
|
|
2320
|
+
});
|
|
2321
|
+
|
|
2322
|
+
/***/ }),
|
|
2323
|
+
|
|
2324
|
+
/***/ 55:
|
|
2325
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2326
|
+
|
|
2327
|
+
"use strict";
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2331
|
+
value: true
|
|
2332
|
+
});
|
|
2333
|
+
|
|
2334
|
+
/***/ }),
|
|
2335
|
+
|
|
2336
|
+
/***/ 56:
|
|
2337
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2338
|
+
|
|
2339
|
+
"use strict";
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
var _slicedToArray = __webpack_require__(7);
|
|
2343
|
+
|
|
2344
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2345
|
+
value: true
|
|
2346
|
+
});
|
|
2347
|
+
|
|
2348
|
+
var React = __webpack_require__(0);
|
|
2349
|
+
|
|
2350
|
+
var lodash_1 = __webpack_require__(3);
|
|
2351
|
+
|
|
2352
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(57);
|
|
2353
|
+
|
|
2354
|
+
var Options_1 = __webpack_require__(16);
|
|
2355
|
+
|
|
2356
|
+
var SanitizeProps_1 = __webpack_require__(58);
|
|
2357
|
+
|
|
2358
|
+
var TimezoneContext_1 = __webpack_require__(32);
|
|
2359
|
+
|
|
2360
|
+
var moment_1 = __webpack_require__(59);
|
|
2361
|
+
|
|
2362
|
+
var FeatureFlagContext_1 = __webpack_require__(28);
|
|
2363
|
+
|
|
2364
|
+
var styled_components_1 = __webpack_require__(4);
|
|
2365
|
+
|
|
2366
|
+
var hocUtils_1 = __webpack_require__(34);
|
|
2367
|
+
|
|
2368
|
+
var JSONSchemaUtils_1 = __webpack_require__(35);
|
|
2369
|
+
|
|
2370
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(60);
|
|
2371
|
+
|
|
2372
|
+
var id_1 = __webpack_require__(31);
|
|
2373
|
+
|
|
2374
|
+
var SplunkVisualization_1 = __webpack_require__(61);
|
|
2375
|
+
|
|
2376
|
+
var VizBehavior_1 = __webpack_require__(6);
|
|
2377
|
+
|
|
2378
|
+
var getSorting_1 = __webpack_require__(38);
|
|
2379
|
+
|
|
2380
|
+
var getPagination_1 = __webpack_require__(39);
|
|
2381
|
+
|
|
2382
|
+
var useDeepMemo_1 = __webpack_require__(62);
|
|
2383
|
+
|
|
2384
|
+
var MissingPropsMessage_1 = __webpack_require__(63);
|
|
2385
|
+
|
|
2386
|
+
var withEditModeCover_1 = __webpack_require__(64);
|
|
2387
|
+
|
|
2388
|
+
var withPlaceholder_1 = __webpack_require__(65);
|
|
2389
|
+
|
|
2390
|
+
var useDownsampleDataSources_1 = __webpack_require__(66);
|
|
2391
|
+
|
|
2392
|
+
var dataUtils_1 = __webpack_require__(14);
|
|
2393
|
+
|
|
2394
|
+
var featureFlagUtils_1 = __webpack_require__(68);
|
|
2395
|
+
/**
|
|
2396
|
+
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
2397
|
+
* @param {DashboardVizOpts} opts
|
|
2398
|
+
* @returns {HOC}
|
|
2399
|
+
*/
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
var withDashboardViz = function withDashboardViz(opts) {
|
|
2403
|
+
var ReactViz = opts.ReactViz,
|
|
2404
|
+
vizConfig = opts.vizConfig,
|
|
2405
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
2406
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
2407
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
2408
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
2409
|
+
|
|
2410
|
+
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
2411
|
+
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
2412
|
+
|
|
2413
|
+
var DashboardViz = function DashboardViz(props) {
|
|
2414
|
+
var _a;
|
|
2415
|
+
|
|
2416
|
+
var mode = props.mode,
|
|
2417
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
2418
|
+
dataSources = props.dataSources,
|
|
2419
|
+
options = props.options,
|
|
2420
|
+
_props$context = props.context,
|
|
2421
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
2422
|
+
width = props.width,
|
|
2423
|
+
height = props.height,
|
|
2424
|
+
onComputedProps = props.onComputedProps,
|
|
2425
|
+
onEventTrigger = props.onEventTrigger,
|
|
2426
|
+
theme = props.theme,
|
|
2427
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
2428
|
+
|
|
2429
|
+
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
2430
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
2431
|
+
|
|
2432
|
+
if (serializedTimezone) {
|
|
2433
|
+
/*
|
|
2434
|
+
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
2435
|
+
This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
|
|
2436
|
+
will use it.
|
|
2437
|
+
@TODO(pwied):
|
|
2438
|
+
- remove when we moved away from @splunk/moment
|
|
2439
|
+
- provide timezone context to dynamic option evaluation phase
|
|
2440
|
+
*/
|
|
2441
|
+
if (!moment_1.default.getDefaultSplunkTimezone()) {
|
|
2442
|
+
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
var themeFunc = function themeFunc(themeVar) {
|
|
2447
|
+
var _a, _b;
|
|
2448
|
+
|
|
2449
|
+
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
2450
|
+
};
|
|
2451
|
+
|
|
2452
|
+
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
2453
|
+
|
|
2454
|
+
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
2455
|
+
theme: theme
|
|
2456
|
+
}),
|
|
2457
|
+
currentThemeFamily = _ref.family,
|
|
2458
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
2459
|
+
currentThemeDensity = _ref.density;
|
|
2460
|
+
|
|
2461
|
+
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
2462
|
+
|
|
2463
|
+
var _React$useState = React.useState({}),
|
|
2464
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2465
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
2466
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
2467
|
+
|
|
2468
|
+
|
|
2469
|
+
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
2470
|
+
|
|
2471
|
+
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
2472
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
2473
|
+
visualizationID = _React$useState4[0];
|
|
2474
|
+
|
|
2475
|
+
var _React$useState5 = React.useState({}),
|
|
2476
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2477
|
+
dataSourcesInState = _React$useState6[0],
|
|
2478
|
+
setDataSourcesInState = _React$useState6[1];
|
|
2479
|
+
|
|
2480
|
+
var _React$useState7 = React.useState(),
|
|
2481
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
2482
|
+
dataFramesInState = _React$useState8[0],
|
|
2483
|
+
setDataFramesInState = _React$useState8[1];
|
|
2484
|
+
|
|
2485
|
+
var _React$useState9 = React.useState(Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_useWebWorkersForDSL'))),
|
|
2486
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
2487
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
2488
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
2489
|
+
|
|
2490
|
+
var isDownsamplingEnabledByFeatureFlag = Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_enableDownsampling);
|
|
2491
|
+
var isMounted = React.useRef(true);
|
|
2492
|
+
var optionsToEvaluate = React.useMemo(function () {
|
|
2493
|
+
return {
|
|
2494
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
2495
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
2496
|
+
};
|
|
2497
|
+
}, [options, context]);
|
|
2498
|
+
|
|
2499
|
+
var _React$useState11 = React.useState(Number(width)),
|
|
2500
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
2501
|
+
threshold = _React$useState12[0],
|
|
2502
|
+
setThreshold = _React$useState12[1];
|
|
2503
|
+
|
|
2504
|
+
var onDownsamplingThresholdChange = React.useCallback(function (newThreshold) {
|
|
2505
|
+
setThreshold(newThreshold);
|
|
2506
|
+
}, []);
|
|
2507
|
+
var isDownsamplingEnabled = React.useMemo(function () {
|
|
2508
|
+
return isDownsamplingEnabledByFeatureFlag && (0, dataUtils_1.isDownsamplingEnabledForViz)({
|
|
2509
|
+
vizConfig: vizConfig
|
|
2510
|
+
});
|
|
2511
|
+
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
2512
|
+
var downsamplingProps = React.useMemo(function () {
|
|
2513
|
+
if (!isDownsamplingEnabled) {
|
|
2514
|
+
return {};
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
return {
|
|
2518
|
+
onDownsamplingThresholdChange: onDownsamplingThresholdChange,
|
|
2519
|
+
originalDataSources: dataSources
|
|
2520
|
+
};
|
|
2521
|
+
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
2522
|
+
var downsampledDataSources = (0, useDownsampleDataSources_1.default)({
|
|
2523
|
+
options: optionsToEvaluate.options,
|
|
2524
|
+
context: optionsToEvaluate.context,
|
|
2525
|
+
dataSources: dataSources,
|
|
2526
|
+
threshold: threshold,
|
|
2527
|
+
isDownsamplingEnabled: isDownsamplingEnabled
|
|
2528
|
+
});
|
|
2529
|
+
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
2530
|
+
try {
|
|
2531
|
+
if (useAsyncEvaluatedOptions) {
|
|
2532
|
+
var asyncDynamicOptionsEvaluatorParams = {
|
|
2533
|
+
visualizationID: visualizationID,
|
|
2534
|
+
props: props,
|
|
2535
|
+
options: optionsToEvaluate,
|
|
2536
|
+
dataSources: downsampledDataSources,
|
|
2537
|
+
theme: vizConfig.themes,
|
|
2538
|
+
bypassCloneDeepOptionScope: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope')),
|
|
2539
|
+
lazyLoadingDataFrame: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'))
|
|
2540
|
+
};
|
|
2541
|
+
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
2542
|
+
setEvaluatedOptionsAsync(results.results);
|
|
2543
|
+
}).catch(function () {
|
|
2544
|
+
if (isMounted.current) {
|
|
2545
|
+
setUseAsyncEvaluatedOptions(false);
|
|
2546
|
+
}
|
|
2547
|
+
});
|
|
2548
|
+
} else {
|
|
2549
|
+
var dataFrames = dataFramesInState;
|
|
2550
|
+
|
|
2551
|
+
if (downsampledDataSources !== dataSourcesInState) {
|
|
2552
|
+
setDataSourcesInState(downsampledDataSources);
|
|
2553
|
+
dataFrames = Options_1.Options.dataFrameFromDataSource(downsampledDataSources, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'));
|
|
2554
|
+
setDataFramesInState(dataFrames);
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
var result = Options_1.Options.evaluate(optionsToEvaluate, downsampledDataSources, themeFunc, dataFrames, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope'));
|
|
2558
|
+
return result;
|
|
2559
|
+
}
|
|
2560
|
+
} catch (e) {
|
|
2561
|
+
// eslint-disable-next-line no-console
|
|
2562
|
+
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
2563
|
+
return {};
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
return {};
|
|
2567
|
+
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, optionsToEvaluate, downsampledDataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
2568
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
2569
|
+
// 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
|
|
2570
|
+
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
2571
|
+
|
|
2572
|
+
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
2573
|
+
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
2574
|
+
|
|
2575
|
+
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) {
|
|
2576
|
+
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
2577
|
+
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
2578
|
+
});
|
|
2579
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
2580
|
+
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
2581
|
+
|
|
2582
|
+
|
|
2583
|
+
React.useEffect(function () {
|
|
2584
|
+
onComputedProps(clonedEvaluatedOptions);
|
|
2585
|
+
});
|
|
2586
|
+
React.useEffect(function () {
|
|
2587
|
+
return function () {
|
|
2588
|
+
if (useAsyncEvaluatedOptions) {
|
|
2589
|
+
isMounted.current = false;
|
|
2590
|
+
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
2591
|
+
}
|
|
2592
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2593
|
+
}, []); // present warning message if any required props are missing
|
|
2594
|
+
|
|
2595
|
+
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
2596
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
2597
|
+
supports = vizConfig.supports;
|
|
2598
|
+
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
2599
|
+
|
|
2600
|
+
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
|
|
2601
|
+
) {
|
|
2602
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
2603
|
+
"data-test": "missing-props-message",
|
|
2604
|
+
width: width,
|
|
2605
|
+
height: height,
|
|
2606
|
+
missingProps: missing,
|
|
2607
|
+
backgroundColor: bgColorFromTheme
|
|
2608
|
+
});
|
|
2609
|
+
} // events
|
|
2610
|
+
|
|
2611
|
+
|
|
2612
|
+
var eventCallbackProps = {};
|
|
2613
|
+
|
|
2614
|
+
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
2615
|
+
var supportedEvents = vizConfig.events;
|
|
2616
|
+
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
2617
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
2618
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
2619
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
2620
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
2621
|
+
// then remove these lines
|
|
2622
|
+
|
|
2623
|
+
var payload = {};
|
|
2624
|
+
|
|
2625
|
+
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
2626
|
+
payloadKeys.forEach(function (p) {
|
|
2627
|
+
payload[p] = evaluatedOptionsToUse[p];
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
2632
|
+
if (ev && ev.payload) {
|
|
2633
|
+
payload = ev.payload;
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
return onEventTrigger({
|
|
2637
|
+
originalEvent: ev,
|
|
2638
|
+
payload: payload,
|
|
2639
|
+
type: eventName
|
|
2640
|
+
});
|
|
2641
|
+
};
|
|
2642
|
+
|
|
2643
|
+
if (parentKeys) {
|
|
2644
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
2645
|
+
var newObject = {};
|
|
2646
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
2647
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
});
|
|
2651
|
+
} // compute pure viz props which are not from options
|
|
2652
|
+
|
|
2653
|
+
|
|
2654
|
+
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
2655
|
+
themeFunc: themeFunc
|
|
2656
|
+
}));
|
|
2657
|
+
/**
|
|
2658
|
+
* PAGE_AND_SORT behavior
|
|
2659
|
+
*
|
|
2660
|
+
* Some visualizations, like table, requires metadata about the datasource,
|
|
2661
|
+
* like total number of results, current count, offset, and sort, for rendering
|
|
2662
|
+
* paginator and sorting direction. In this approach, the visualization
|
|
2663
|
+
* allow users to set 'paginateDataSourceKey' to select which datasource
|
|
2664
|
+
* should the visualization extract the metadata from. It defaults to 'primary' datasource.
|
|
2665
|
+
* The visualization config should set the PAGE_AND_SORT behavior to receive
|
|
2666
|
+
* 'requestParams', 'meta' and onRequestParams callback as props.
|
|
2667
|
+
*
|
|
2668
|
+
* In future, we could automatically detect which all datasources are being used
|
|
2669
|
+
* and bind those magically to pagination/sorting behavior.
|
|
2670
|
+
*/
|
|
2671
|
+
|
|
2672
|
+
var dataSourceMetadata = {};
|
|
2673
|
+
var OptionKey = 'paginateDataSourceKey';
|
|
2674
|
+
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
2675
|
+
|
|
2676
|
+
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
2677
|
+
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
2678
|
+
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
2679
|
+
|
|
2680
|
+
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
2681
|
+
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
2682
|
+
};
|
|
2683
|
+
|
|
2684
|
+
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
2685
|
+
requestParams: requestParams,
|
|
2686
|
+
meta: meta,
|
|
2687
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
2688
|
+
});
|
|
2689
|
+
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
2690
|
+
requestParams: requestParams,
|
|
2691
|
+
meta: meta,
|
|
2692
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
2693
|
+
});
|
|
2694
|
+
dataSourceMetadata = {
|
|
2695
|
+
sortParams: sortParams,
|
|
2696
|
+
paginatorParams: paginatorParams
|
|
2697
|
+
};
|
|
2698
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
2699
|
+
|
|
2700
|
+
|
|
2701
|
+
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
2702
|
+
return null;
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
return React.createElement(SanitizedReactViz, Object.assign({
|
|
2706
|
+
mode: mode,
|
|
2707
|
+
width: width,
|
|
2708
|
+
height: height
|
|
2709
|
+
}, downsamplingProps, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
2710
|
+
};
|
|
2711
|
+
|
|
2712
|
+
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
2713
|
+
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
2714
|
+
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
2715
|
+
theme: {}
|
|
2716
|
+
}); // attach viz config
|
|
2717
|
+
|
|
2718
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
2719
|
+
|
|
2720
|
+
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
2721
|
+
};
|
|
2722
|
+
|
|
2723
|
+
exports.default = withDashboardViz;
|
|
2724
|
+
|
|
2725
|
+
/***/ }),
|
|
2726
|
+
|
|
2727
|
+
/***/ 57:
|
|
2728
|
+
/***/ (function(module, exports) {
|
|
2729
|
+
|
|
2730
|
+
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
2731
|
+
|
|
2732
|
+
/***/ }),
|
|
2733
|
+
|
|
2734
|
+
/***/ 58:
|
|
2735
|
+
/***/ (function(module, exports) {
|
|
2736
|
+
|
|
2737
|
+
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
2738
|
+
|
|
2739
|
+
/***/ }),
|
|
2740
|
+
|
|
2741
|
+
/***/ 59:
|
|
2742
|
+
/***/ (function(module, exports) {
|
|
2743
|
+
|
|
2744
|
+
module.exports = require("@splunk/moment");
|
|
2745
|
+
|
|
2746
|
+
/***/ }),
|
|
2747
|
+
|
|
2748
|
+
/***/ 6:
|
|
2749
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2750
|
+
|
|
2751
|
+
"use strict";
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2755
|
+
value: true
|
|
2756
|
+
});
|
|
2757
|
+
exports.VizBehavior = void 0;
|
|
2758
|
+
var VizBehavior;
|
|
2759
|
+
|
|
2760
|
+
(function (VizBehavior) {
|
|
2761
|
+
/**
|
|
2762
|
+
* Dynamic Options Behavior.
|
|
2763
|
+
* This allows visualization options to be powered by data
|
|
2764
|
+
*
|
|
2765
|
+
* **Example**
|
|
2766
|
+
*
|
|
2767
|
+
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
2768
|
+
* would configure sparklineValues with an array of data points
|
|
2769
|
+
* coming from the first series in the primary datasource
|
|
2770
|
+
*
|
|
2771
|
+
*/
|
|
2772
|
+
VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
|
|
2773
|
+
VizBehavior["EVENTS"] = "events";
|
|
2774
|
+
VizBehavior["DOWNSAMPLING"] = "downsampling";
|
|
2775
|
+
/**
|
|
2776
|
+
* Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
|
|
2777
|
+
* missing.
|
|
2778
|
+
* @type {string}
|
|
2779
|
+
*/
|
|
2780
|
+
|
|
2781
|
+
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
2782
|
+
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
2783
|
+
VizBehavior["TRELLIS"] = "trellis";
|
|
2784
|
+
})(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
|
|
2785
|
+
|
|
2786
|
+
/***/ }),
|
|
2787
|
+
|
|
2788
|
+
/***/ 60:
|
|
1935
2789
|
/***/ (function(module, exports) {
|
|
1936
2790
|
|
|
1937
|
-
module.exports = require("@splunk/
|
|
2791
|
+
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1938
2792
|
|
|
1939
2793
|
/***/ }),
|
|
1940
2794
|
|
|
1941
|
-
/***/
|
|
2795
|
+
/***/ 61:
|
|
1942
2796
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1943
2797
|
|
|
1944
2798
|
"use strict";
|
|
1945
2799
|
|
|
1946
2800
|
|
|
1947
|
-
var
|
|
1948
|
-
var t = {};
|
|
1949
|
-
|
|
1950
|
-
for (var p in s) {
|
|
1951
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1955
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1956
|
-
}
|
|
1957
|
-
return t;
|
|
1958
|
-
};
|
|
2801
|
+
var _classCallCheck = __webpack_require__(10);
|
|
1959
2802
|
|
|
1960
2803
|
Object.defineProperty(exports, "__esModule", {
|
|
1961
2804
|
value: true
|
|
1962
2805
|
});
|
|
1963
|
-
exports.
|
|
1964
|
-
|
|
1965
|
-
var lodash_1 = __webpack_require__(3);
|
|
1966
|
-
|
|
1967
|
-
var propUtils_1 = __webpack_require__(29);
|
|
2806
|
+
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
2807
|
+
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1968
2808
|
|
|
1969
|
-
var
|
|
2809
|
+
var T = __webpack_require__(1);
|
|
1970
2810
|
|
|
1971
|
-
var
|
|
2811
|
+
var lodash_1 = __webpack_require__(3);
|
|
1972
2812
|
|
|
1973
|
-
var
|
|
1974
|
-
// map for key names which are either new or not present in SimpleXML options mapping
|
|
2813
|
+
var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1975
2814
|
|
|
1976
2815
|
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
seriesColorsByField: 'fieldColors',
|
|
1980
|
-
collapseThreshold: 'chart.sliceCollapsingThreshold',
|
|
1981
|
-
collapseLabel: 'chart.sliceCollapsingLabel'
|
|
1982
|
-
};
|
|
2816
|
+
exports.INITIAL_WIDTH = 250;
|
|
2817
|
+
exports.INITIAL_HEIGHT = 250;
|
|
1983
2818
|
/**
|
|
1984
|
-
*
|
|
1985
|
-
* to strings as SC can only accept their stringified equivalents
|
|
1986
|
-
* @method convertToStringValues
|
|
1987
|
-
* @param {Object} options
|
|
1988
|
-
* @returns {Object}
|
|
2819
|
+
* A Splunk visualization
|
|
1989
2820
|
*/
|
|
1990
2821
|
|
|
1991
|
-
var
|
|
1992
|
-
|
|
1993
|
-
vizProps: options,
|
|
1994
|
-
propNames: ['seriesColors', 'fieldColors']
|
|
1995
|
-
});
|
|
1996
|
-
return Object.assign(Object.assign({}, options), updatedOptions);
|
|
2822
|
+
var SplunkVisualization = function SplunkVisualization() {
|
|
2823
|
+
_classCallCheck(this, SplunkVisualization);
|
|
1997
2824
|
};
|
|
1998
2825
|
|
|
1999
|
-
|
|
2000
|
-
/**
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
* @returns {Object}
|
|
2005
|
-
*/
|
|
2826
|
+
SplunkVisualization.propTypes = {
|
|
2827
|
+
/**
|
|
2828
|
+
* display mode
|
|
2829
|
+
*/
|
|
2830
|
+
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
2006
2831
|
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2832
|
+
/**
|
|
2833
|
+
* width in pixel or string, defaults to 100%
|
|
2834
|
+
*/
|
|
2835
|
+
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
2010
2836
|
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
});
|
|
2837
|
+
/**
|
|
2838
|
+
* height in pixel or string
|
|
2839
|
+
*/
|
|
2840
|
+
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
2016
2841
|
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
}
|
|
2842
|
+
/**
|
|
2843
|
+
* visualization context used for dynamic option evaluation
|
|
2844
|
+
*/
|
|
2845
|
+
context: T.object,
|
|
2022
2846
|
|
|
2023
|
-
|
|
2024
|
-
|
|
2847
|
+
/**
|
|
2848
|
+
* visualization formatting options
|
|
2849
|
+
*/
|
|
2850
|
+
options: T.object,
|
|
2025
2851
|
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
* @method mapToOldKey
|
|
2031
|
-
* @param {Object} options
|
|
2032
|
-
* @returns {Object}
|
|
2033
|
-
*/
|
|
2852
|
+
/**
|
|
2853
|
+
* A callback to update formatting options
|
|
2854
|
+
*/
|
|
2855
|
+
onOptionsChange: T.func,
|
|
2034
2856
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2857
|
+
/**
|
|
2858
|
+
* datasource state which include data and request params, object key indicate the datasource type.
|
|
2859
|
+
*/
|
|
2860
|
+
dataSources: T.objectOf(T.shape({
|
|
2861
|
+
/**
|
|
2862
|
+
* current request params
|
|
2863
|
+
*/
|
|
2864
|
+
requestParams: T.object,
|
|
2040
2865
|
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
* @returns {Object}
|
|
2049
|
-
*/
|
|
2866
|
+
/**
|
|
2867
|
+
* current dataset
|
|
2868
|
+
*/
|
|
2869
|
+
data: T.shape({
|
|
2870
|
+
fields: T.array,
|
|
2871
|
+
columns: T.array
|
|
2872
|
+
}),
|
|
2050
2873
|
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2874
|
+
/**
|
|
2875
|
+
* error
|
|
2876
|
+
*/
|
|
2877
|
+
error: T.shape({
|
|
2878
|
+
level: T.string,
|
|
2879
|
+
message: T.string
|
|
2880
|
+
}),
|
|
2054
2881
|
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
* @returns
|
|
2061
|
-
*/
|
|
2882
|
+
/**
|
|
2883
|
+
* meta data that came with the dataset
|
|
2884
|
+
*/
|
|
2885
|
+
meta: T.object
|
|
2886
|
+
})),
|
|
2062
2887
|
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2888
|
+
/**
|
|
2889
|
+
* A callback to trigger event
|
|
2890
|
+
*/
|
|
2891
|
+
onEventTrigger: T.func,
|
|
2066
2892
|
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
* @param dataSources
|
|
2072
|
-
* @param options
|
|
2073
|
-
* @param vizConfig
|
|
2074
|
-
* @returns
|
|
2075
|
-
*/
|
|
2893
|
+
/**
|
|
2894
|
+
* Inform viz if there are handlers listening to events
|
|
2895
|
+
*/
|
|
2896
|
+
hasEventHandlers: T.bool,
|
|
2076
2897
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2898
|
+
/**
|
|
2899
|
+
* A callback to communicate computed props to a consumer
|
|
2900
|
+
*/
|
|
2901
|
+
onComputedProps: T.func,
|
|
2079
2902
|
|
|
2080
|
-
|
|
2081
|
-
|
|
2903
|
+
/**
|
|
2904
|
+
* A callback to obtain visualization api
|
|
2905
|
+
*/
|
|
2906
|
+
vizActionHandlerRef: T.func,
|
|
2907
|
+
loading: T.bool,
|
|
2908
|
+
theme: T.object,
|
|
2082
2909
|
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2910
|
+
/**
|
|
2911
|
+
* A callback to request new data with updated request params
|
|
2912
|
+
*/
|
|
2913
|
+
onRequestParamsChange: T.func
|
|
2087
2914
|
};
|
|
2088
|
-
|
|
2089
|
-
exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
|
|
2090
2915
|
/**
|
|
2091
|
-
*
|
|
2092
|
-
* @param optionName
|
|
2093
|
-
* @param dataSources
|
|
2094
|
-
* @param options
|
|
2095
|
-
* @param vizConfig
|
|
2096
|
-
* @returns
|
|
2916
|
+
*
|
|
2097
2917
|
*/
|
|
2098
2918
|
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2919
|
+
SplunkVisualization.defaultProps = {
|
|
2920
|
+
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
2921
|
+
width: '100%',
|
|
2922
|
+
height: exports.INITIAL_HEIGHT,
|
|
2923
|
+
dataSources: {},
|
|
2924
|
+
onEventTrigger: function onEventTrigger() {
|
|
2925
|
+
return {};
|
|
2926
|
+
},
|
|
2927
|
+
mode: 'view',
|
|
2928
|
+
hasEventHandlers: false,
|
|
2929
|
+
options: {},
|
|
2930
|
+
context: {},
|
|
2931
|
+
onOptionsChange: function onOptionsChange() {
|
|
2932
|
+
return {};
|
|
2933
|
+
},
|
|
2934
|
+
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
2935
|
+
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
2936
|
+
},
|
|
2937
|
+
onComputedProps: function onComputedProps() {
|
|
2938
|
+
return {};
|
|
2939
|
+
},
|
|
2940
|
+
loading: false,
|
|
2941
|
+
onRequestParamsChange: lodash_1.noop
|
|
2942
|
+
};
|
|
2943
|
+
exports.default = SplunkVisualization;
|
|
2102
2944
|
|
|
2103
|
-
|
|
2104
|
-
return true;
|
|
2105
|
-
}
|
|
2945
|
+
/***/ }),
|
|
2106
2946
|
|
|
2107
|
-
|
|
2108
|
-
|
|
2947
|
+
/***/ 62:
|
|
2948
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2109
2949
|
|
|
2110
|
-
|
|
2950
|
+
"use strict";
|
|
2951
|
+
|
|
2952
|
+
|
|
2953
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2954
|
+
value: true
|
|
2955
|
+
});
|
|
2956
|
+
exports.useDeepMemo = void 0;
|
|
2957
|
+
|
|
2958
|
+
var react_1 = __webpack_require__(0);
|
|
2959
|
+
|
|
2960
|
+
var lodash_1 = __webpack_require__(3);
|
|
2111
2961
|
/**
|
|
2112
|
-
*
|
|
2962
|
+
* This hook evaluates and stores the result of a passed function and only
|
|
2963
|
+
* re-evaluates the function when passed dependencies change.
|
|
2964
|
+
*
|
|
2965
|
+
* It is different from the internal React useMemo in the following aspects:
|
|
2966
|
+
* - it only stores the last evaluated result
|
|
2967
|
+
* - it uses a deep equality check to determine if dependencies have changed
|
|
2968
|
+
*
|
|
2969
|
+
* Inspired by apollo-client's useDeepMemo
|
|
2970
|
+
*
|
|
2971
|
+
* @param fn the function to be executed and
|
|
2972
|
+
* @param dependencies an array of dependencies
|
|
2113
2973
|
*/
|
|
2114
2974
|
|
|
2115
|
-
var allInvalidDataValues = function allInvalidDataValues(dataSources, options, vizConfig) {
|
|
2116
|
-
var columns = dataSources.primary.data.columns; // find the field index configured for pie "value"
|
|
2117
2975
|
|
|
2118
|
-
|
|
2976
|
+
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
2977
|
+
var ref = (0, react_1.useRef)();
|
|
2119
2978
|
|
|
2120
|
-
if (
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2979
|
+
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
2980
|
+
ref.current = {
|
|
2981
|
+
dependencies: dependencies,
|
|
2982
|
+
value: fn()
|
|
2983
|
+
};
|
|
2124
2984
|
}
|
|
2125
2985
|
|
|
2126
|
-
return
|
|
2986
|
+
return ref.current.value;
|
|
2127
2987
|
};
|
|
2128
2988
|
|
|
2129
|
-
exports.
|
|
2989
|
+
exports.useDeepMemo = useDeepMemo;
|
|
2130
2990
|
|
|
2131
2991
|
/***/ }),
|
|
2132
2992
|
|
|
2133
|
-
/***/
|
|
2993
|
+
/***/ 63:
|
|
2134
2994
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2135
2995
|
|
|
2136
2996
|
"use strict";
|
|
@@ -2141,15 +3001,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2141
3001
|
});
|
|
2142
3002
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2143
3003
|
|
|
2144
|
-
var React = __webpack_require__(
|
|
3004
|
+
var React = __webpack_require__(0);
|
|
2145
3005
|
|
|
2146
|
-
var T = __webpack_require__(
|
|
3006
|
+
var T = __webpack_require__(1);
|
|
2147
3007
|
|
|
2148
3008
|
var i18n_1 = __webpack_require__(2);
|
|
2149
3009
|
|
|
2150
|
-
var Message_1 = __webpack_require__(
|
|
3010
|
+
var Message_1 = __webpack_require__(12);
|
|
2151
3011
|
|
|
2152
|
-
var FixedSizeContainer_1 = __webpack_require__(
|
|
3012
|
+
var FixedSizeContainer_1 = __webpack_require__(17);
|
|
2153
3013
|
/**
|
|
2154
3014
|
* @method isMissing
|
|
2155
3015
|
* @param {any} v
|
|
@@ -2211,7 +3071,7 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
2211
3071
|
|
|
2212
3072
|
/***/ }),
|
|
2213
3073
|
|
|
2214
|
-
/***/
|
|
3074
|
+
/***/ 64:
|
|
2215
3075
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2216
3076
|
|
|
2217
3077
|
"use strict";
|
|
@@ -2221,18 +3081,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2221
3081
|
value: true
|
|
2222
3082
|
});
|
|
2223
3083
|
|
|
2224
|
-
var React = __webpack_require__(
|
|
3084
|
+
var React = __webpack_require__(0);
|
|
2225
3085
|
|
|
2226
3086
|
var styled_components_1 = __webpack_require__(4);
|
|
2227
3087
|
|
|
2228
|
-
var hocUtils_1 = __webpack_require__(
|
|
3088
|
+
var hocUtils_1 = __webpack_require__(23);
|
|
2229
3089
|
|
|
2230
3090
|
var Cover = styled_components_1.default.div.withConfig({
|
|
2231
3091
|
displayName: "withEditModeCover__Cover",
|
|
2232
3092
|
componentId: "sc-1gsbnxb-0"
|
|
2233
3093
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
2234
3094
|
var Blocker = styled_components_1.default.div.attrs({
|
|
2235
|
-
'data-splunk-visualization-version': "26.1
|
|
3095
|
+
'data-splunk-visualization-version': "26.2.1 - 714383dbb"
|
|
2236
3096
|
}).withConfig({
|
|
2237
3097
|
displayName: "withEditModeCover__Blocker",
|
|
2238
3098
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -2264,7 +3124,7 @@ exports.default = withEditModeCover;
|
|
|
2264
3124
|
|
|
2265
3125
|
/***/ }),
|
|
2266
3126
|
|
|
2267
|
-
/***/
|
|
3127
|
+
/***/ 65:
|
|
2268
3128
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2269
3129
|
|
|
2270
3130
|
"use strict";
|
|
@@ -2274,17 +3134,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2274
3134
|
value: true
|
|
2275
3135
|
});
|
|
2276
3136
|
|
|
2277
|
-
var React = __webpack_require__(
|
|
3137
|
+
var React = __webpack_require__(0);
|
|
2278
3138
|
|
|
2279
|
-
var colorUtils_1 = __webpack_require__(
|
|
3139
|
+
var colorUtils_1 = __webpack_require__(15);
|
|
2280
3140
|
|
|
2281
|
-
var variables_1 = __webpack_require__(
|
|
3141
|
+
var variables_1 = __webpack_require__(13);
|
|
2282
3142
|
|
|
2283
|
-
var IconPlaceholder_1 = __webpack_require__(
|
|
3143
|
+
var IconPlaceholder_1 = __webpack_require__(37);
|
|
2284
3144
|
|
|
2285
3145
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2286
3146
|
|
|
2287
|
-
var hocUtils_1 = __webpack_require__(
|
|
3147
|
+
var hocUtils_1 = __webpack_require__(23);
|
|
2288
3148
|
|
|
2289
3149
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
2290
3150
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
@@ -2329,21 +3189,276 @@ exports.default = withPlaceholder;
|
|
|
2329
3189
|
|
|
2330
3190
|
/***/ }),
|
|
2331
3191
|
|
|
2332
|
-
/***/
|
|
3192
|
+
/***/ 66:
|
|
3193
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3194
|
+
|
|
3195
|
+
"use strict";
|
|
3196
|
+
|
|
3197
|
+
|
|
3198
|
+
var _slicedToArray = __webpack_require__(7);
|
|
3199
|
+
|
|
3200
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3201
|
+
value: true
|
|
3202
|
+
});
|
|
3203
|
+
|
|
3204
|
+
var react_1 = __webpack_require__(0);
|
|
3205
|
+
|
|
3206
|
+
var lodash_1 = __webpack_require__(3);
|
|
3207
|
+
|
|
3208
|
+
var dataUtils_1 = __webpack_require__(14);
|
|
3209
|
+
|
|
3210
|
+
var usePrevious_1 = __webpack_require__(33);
|
|
3211
|
+
|
|
3212
|
+
var useGetXAndYFields_1 = __webpack_require__(67);
|
|
3213
|
+
|
|
3214
|
+
var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
|
|
3215
|
+
var dataSources = _ref.dataSources,
|
|
3216
|
+
options = _ref.options,
|
|
3217
|
+
context = _ref.context,
|
|
3218
|
+
threshold = _ref.threshold,
|
|
3219
|
+
isDownsamplingEnabled = _ref.isDownsamplingEnabled;
|
|
3220
|
+
var isFirstUseEffectCall = (0, react_1.useRef)(true);
|
|
3221
|
+
var xAndYFieldsWithTypes = (0, useGetXAndYFields_1.default)({
|
|
3222
|
+
shouldEvaluateDSL: isDownsamplingEnabled,
|
|
3223
|
+
options: options,
|
|
3224
|
+
context: context,
|
|
3225
|
+
dataSources: dataSources
|
|
3226
|
+
});
|
|
3227
|
+
var previousXAndYFieldsWithTypes = (0, usePrevious_1.default)(xAndYFieldsWithTypes);
|
|
3228
|
+
var previousDataSources = (0, usePrevious_1.default)(dataSources);
|
|
3229
|
+
var previousThreshold = (0, usePrevious_1.default)(threshold);
|
|
3230
|
+
|
|
3231
|
+
var _ref2 = (0, react_1.useState)(function () {
|
|
3232
|
+
return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
|
|
3233
|
+
dataSources: dataSources,
|
|
3234
|
+
threshold: threshold,
|
|
3235
|
+
options: xAndYFieldsWithTypes
|
|
3236
|
+
}) : dataSources;
|
|
3237
|
+
}),
|
|
3238
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
3239
|
+
downsampledDataSources = _ref3[0],
|
|
3240
|
+
setDownsampledDataSources = _ref3[1];
|
|
3241
|
+
|
|
3242
|
+
var debouncedDownsampleDataSources = (0, react_1.useMemo)(function () {
|
|
3243
|
+
return (0, lodash_1.debounce)(function (downsampleOptions) {
|
|
3244
|
+
var downsampledResult = (0, dataUtils_1.downsampleDataSources)(downsampleOptions);
|
|
3245
|
+
setDownsampledDataSources(downsampledResult);
|
|
3246
|
+
}, 100, {
|
|
3247
|
+
trailing: true
|
|
3248
|
+
});
|
|
3249
|
+
}, []);
|
|
3250
|
+
(0, react_1.useEffect)(function () {
|
|
3251
|
+
// don't downsample again on the use effect call that happened due to the initial render
|
|
3252
|
+
// this is since we already downsampled as part of the useState call
|
|
3253
|
+
if (isFirstUseEffectCall.current) {
|
|
3254
|
+
isFirstUseEffectCall.current = false;
|
|
3255
|
+
return;
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
if (!isDownsamplingEnabled) {
|
|
3259
|
+
setDownsampledDataSources(dataSources);
|
|
3260
|
+
return;
|
|
3261
|
+
}
|
|
3262
|
+
|
|
3263
|
+
if ((0, lodash_1.isEqual)(previousXAndYFieldsWithTypes, xAndYFieldsWithTypes) && previousDataSources === dataSources && previousThreshold === threshold) {
|
|
3264
|
+
return;
|
|
3265
|
+
} // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
|
|
3266
|
+
// while the viz is being resized
|
|
3267
|
+
|
|
3268
|
+
|
|
3269
|
+
debouncedDownsampleDataSources({
|
|
3270
|
+
dataSources: dataSources,
|
|
3271
|
+
options: xAndYFieldsWithTypes,
|
|
3272
|
+
threshold: threshold
|
|
3273
|
+
}); // need to detect if this runs as part of the initial render
|
|
3274
|
+
}, [dataSources, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousXAndYFieldsWithTypes, previousDataSources, previousThreshold]);
|
|
3275
|
+
return downsampledDataSources;
|
|
3276
|
+
};
|
|
3277
|
+
|
|
3278
|
+
exports.default = useDownsampleDataSources;
|
|
3279
|
+
|
|
3280
|
+
/***/ }),
|
|
3281
|
+
|
|
3282
|
+
/***/ 67:
|
|
3283
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3284
|
+
|
|
3285
|
+
"use strict";
|
|
3286
|
+
|
|
3287
|
+
|
|
3288
|
+
var _toConsumableArray = __webpack_require__(8);
|
|
3289
|
+
|
|
3290
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3291
|
+
value: true
|
|
3292
|
+
});
|
|
3293
|
+
|
|
3294
|
+
var react_1 = __webpack_require__(0);
|
|
3295
|
+
|
|
3296
|
+
var Options_1 = __webpack_require__(16);
|
|
3297
|
+
/**
|
|
3298
|
+
* Hook that evaluates the DSL for subset of a viz's options needed to determine
|
|
3299
|
+
* its x and y fields as well as the types of all its fields.
|
|
3300
|
+
*/
|
|
3301
|
+
|
|
3302
|
+
|
|
3303
|
+
var useGetXAndYFields = function useGetXAndYFields(_ref) {
|
|
3304
|
+
var shouldEvaluateDSL = _ref.shouldEvaluateDSL,
|
|
3305
|
+
options = _ref.options,
|
|
3306
|
+
context = _ref.context,
|
|
3307
|
+
dataSources = _ref.dataSources;
|
|
3308
|
+
|
|
3309
|
+
var _ref2 = (0, react_1.useMemo)(function () {
|
|
3310
|
+
var _a, _b, _c;
|
|
3311
|
+
|
|
3312
|
+
if (!shouldEvaluateDSL) {
|
|
3313
|
+
return {
|
|
3314
|
+
dataSourcesWithOnlyOnePoint: null,
|
|
3315
|
+
dataFrameWithOnlyOnePoint: null
|
|
3316
|
+
};
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
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)) {
|
|
3320
|
+
return {
|
|
3321
|
+
dataSourcesWithOnlyOnePoint: null,
|
|
3322
|
+
dataFrameWithOnlyOnePoint: null
|
|
3323
|
+
};
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
var primaryDS = dataSources.primary;
|
|
3327
|
+
var columnsWithOnlyOnePoint = primaryDS.data.columns.map(function (column) {
|
|
3328
|
+
return [column[0]];
|
|
3329
|
+
});
|
|
3330
|
+
var filteredDataSources = {
|
|
3331
|
+
primary: Object.assign(Object.assign({}, primaryDS), {
|
|
3332
|
+
data: Object.assign(Object.assign({}, primaryDS.data), {
|
|
3333
|
+
columns: columnsWithOnlyOnePoint
|
|
3334
|
+
})
|
|
3335
|
+
})
|
|
3336
|
+
};
|
|
3337
|
+
return {
|
|
3338
|
+
dataSourcesWithOnlyOnePoint: filteredDataSources,
|
|
3339
|
+
dataFrameWithOnlyOnePoint: Options_1.Options.dataFrameFromDataSource(filteredDataSources)
|
|
3340
|
+
};
|
|
3341
|
+
}, [dataSources, shouldEvaluateDSL]),
|
|
3342
|
+
dataSourcesWithOnlyOnePoint = _ref2.dataSourcesWithOnlyOnePoint,
|
|
3343
|
+
dataFrameWithOnlyOnePoint = _ref2.dataFrameWithOnlyOnePoint;
|
|
3344
|
+
|
|
3345
|
+
var xAndYFieldsWithTypes = (0, react_1.useMemo)(function () {
|
|
3346
|
+
try {
|
|
3347
|
+
if (!dataSourcesWithOnlyOnePoint || !dataFrameWithOnlyOnePoint) {
|
|
3348
|
+
return options;
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
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)) {
|
|
3352
|
+
return options;
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
var optionsToEvaluate = {
|
|
3356
|
+
x: options.x,
|
|
3357
|
+
xField: '> x | getField()',
|
|
3358
|
+
y: options.y,
|
|
3359
|
+
yFields: options.y ? '> y | getField()' : undefined,
|
|
3360
|
+
y2: options.y2,
|
|
3361
|
+
y2Fields: options.y2 ? '> y2 | getField()' : undefined,
|
|
3362
|
+
fieldTypes: '> primary | getType()'
|
|
3363
|
+
};
|
|
3364
|
+
|
|
3365
|
+
var _Options_1$Options$ev = Options_1.Options.evaluate({
|
|
3366
|
+
options: optionsToEvaluate,
|
|
3367
|
+
context: context
|
|
3368
|
+
}, dataSourcesWithOnlyOnePoint, function () {}, dataFrameWithOnlyOnePoint),
|
|
3369
|
+
_Options_1$Options$ev2 = _Options_1$Options$ev.xField,
|
|
3370
|
+
xField = _Options_1$Options$ev2 === void 0 ? '' : _Options_1$Options$ev2,
|
|
3371
|
+
_Options_1$Options$ev3 = _Options_1$Options$ev.yFields,
|
|
3372
|
+
yFields = _Options_1$Options$ev3 === void 0 ? [] : _Options_1$Options$ev3,
|
|
3373
|
+
_Options_1$Options$ev4 = _Options_1$Options$ev.y2Fields,
|
|
3374
|
+
y2Fields = _Options_1$Options$ev4 === void 0 ? [] : _Options_1$Options$ev4,
|
|
3375
|
+
fieldTypes = _Options_1$Options$ev.fieldTypes;
|
|
3376
|
+
|
|
3377
|
+
return {
|
|
3378
|
+
xField: xField,
|
|
3379
|
+
yFields: [].concat(_toConsumableArray(yFields), _toConsumableArray(y2Fields)),
|
|
3380
|
+
fieldTypes: fieldTypes
|
|
3381
|
+
};
|
|
3382
|
+
} catch (e) {
|
|
3383
|
+
return {
|
|
3384
|
+
xField: undefined,
|
|
3385
|
+
yFields: [],
|
|
3386
|
+
fieldTypes: []
|
|
3387
|
+
};
|
|
3388
|
+
}
|
|
3389
|
+
}, [options, context, dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint]);
|
|
3390
|
+
return xAndYFieldsWithTypes;
|
|
3391
|
+
};
|
|
3392
|
+
|
|
3393
|
+
exports.default = useGetXAndYFields;
|
|
3394
|
+
|
|
3395
|
+
/***/ }),
|
|
3396
|
+
|
|
3397
|
+
/***/ 68:
|
|
3398
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3399
|
+
|
|
3400
|
+
"use strict";
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3404
|
+
value: true
|
|
3405
|
+
});
|
|
3406
|
+
exports.getFeatureFlag = void 0;
|
|
3407
|
+
|
|
3408
|
+
var FeatureFlags_1 = __webpack_require__(69);
|
|
3409
|
+
|
|
3410
|
+
var getFeatureFlag = function getFeatureFlag(context, flagName) {
|
|
3411
|
+
// look for feature flag in context first
|
|
3412
|
+
if (context && Object.keys(context).find(function (key) {
|
|
3413
|
+
return key === flagName;
|
|
3414
|
+
})) {
|
|
3415
|
+
return context[flagName];
|
|
3416
|
+
} // fall back to defaults
|
|
3417
|
+
|
|
3418
|
+
|
|
3419
|
+
if (Object.keys(FeatureFlags_1.default).find(function (key) {
|
|
3420
|
+
return key === flagName;
|
|
3421
|
+
})) {
|
|
3422
|
+
return FeatureFlags_1.default[flagName];
|
|
3423
|
+
} // fall back to false
|
|
3424
|
+
|
|
3425
|
+
|
|
3426
|
+
return false;
|
|
3427
|
+
};
|
|
3428
|
+
|
|
3429
|
+
exports.getFeatureFlag = getFeatureFlag;
|
|
3430
|
+
|
|
3431
|
+
/***/ }),
|
|
3432
|
+
|
|
3433
|
+
/***/ 69:
|
|
3434
|
+
/***/ (function(module, exports) {
|
|
3435
|
+
|
|
3436
|
+
module.exports = require("@splunk/visualization-context/FeatureFlags");
|
|
3437
|
+
|
|
3438
|
+
/***/ }),
|
|
3439
|
+
|
|
3440
|
+
/***/ 7:
|
|
3441
|
+
/***/ (function(module, exports) {
|
|
3442
|
+
|
|
3443
|
+
module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
3444
|
+
|
|
3445
|
+
/***/ }),
|
|
3446
|
+
|
|
3447
|
+
/***/ 72:
|
|
2333
3448
|
/***/ (function(module, exports) {
|
|
2334
3449
|
|
|
2335
3450
|
module.exports = require("@splunk/visualization-icons/placeholders");
|
|
2336
3451
|
|
|
2337
3452
|
/***/ }),
|
|
2338
3453
|
|
|
2339
|
-
/***/
|
|
3454
|
+
/***/ 73:
|
|
2340
3455
|
/***/ (function(module, exports) {
|
|
2341
3456
|
|
|
2342
3457
|
module.exports = require("@splunk/visualization-color-palettes");
|
|
2343
3458
|
|
|
2344
3459
|
/***/ }),
|
|
2345
3460
|
|
|
2346
|
-
/***/
|
|
3461
|
+
/***/ 75:
|
|
2347
3462
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2348
3463
|
|
|
2349
3464
|
"use strict";
|
|
@@ -2374,21 +3489,21 @@ exports.default = background;
|
|
|
2374
3489
|
|
|
2375
3490
|
/***/ }),
|
|
2376
3491
|
|
|
2377
|
-
/***/
|
|
3492
|
+
/***/ 77:
|
|
2378
3493
|
/***/ (function(module, exports) {
|
|
2379
3494
|
|
|
2380
3495
|
module.exports = require("@splunk/charting-bundle");
|
|
2381
3496
|
|
|
2382
3497
|
/***/ }),
|
|
2383
3498
|
|
|
2384
|
-
/***/
|
|
3499
|
+
/***/ 78:
|
|
2385
3500
|
/***/ (function(module, exports) {
|
|
2386
3501
|
|
|
2387
3502
|
module.exports = require("@splunk/themes/useSplunkTheme");
|
|
2388
3503
|
|
|
2389
3504
|
/***/ }),
|
|
2390
3505
|
|
|
2391
|
-
/***/
|
|
3506
|
+
/***/ 79:
|
|
2392
3507
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2393
3508
|
|
|
2394
3509
|
"use strict";
|
|
@@ -2412,7 +3527,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
2412
3527
|
Object.defineProperty(exports, "__esModule", {
|
|
2413
3528
|
value: true
|
|
2414
3529
|
});
|
|
2415
|
-
exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
|
|
3530
|
+
exports.shouldEnableSearchZoom = exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
|
|
2416
3531
|
|
|
2417
3532
|
var lodash_1 = __webpack_require__(3);
|
|
2418
3533
|
/**
|
|
@@ -2608,48 +3723,32 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
2608
3723
|
|
|
2609
3724
|
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
2610
3725
|
|
|
2611
|
-
|
|
3726
|
+
var shouldEnableSearchZoom = function shouldEnableSearchZoom() {
|
|
3727
|
+
var eventHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3728
|
+
var xField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
3729
|
+
var rangeSelectEventHandler = eventHandlers.find(function (eventHandler) {
|
|
3730
|
+
var _a;
|
|
2612
3731
|
|
|
2613
|
-
|
|
2614
|
-
|
|
3732
|
+
return (_a = eventHandler.options.events) === null || _a === void 0 ? void 0 : _a.includes('range.select');
|
|
3733
|
+
}); // Check if xField is _time. This is how splunk-charting distinguishes a time chart from categorical.
|
|
3734
|
+
// Note: search zoom will be buggy if the x axis uses timestamp values but is not _time
|
|
2615
3735
|
|
|
2616
|
-
|
|
3736
|
+
var xAxisIsTime = xField === '_time';
|
|
3737
|
+
return !!rangeSelectEventHandler && xAxisIsTime;
|
|
3738
|
+
};
|
|
2617
3739
|
|
|
3740
|
+
exports.shouldEnableSearchZoom = shouldEnableSearchZoom;
|
|
2618
3741
|
|
|
2619
|
-
|
|
2620
|
-
value: true
|
|
2621
|
-
});
|
|
2622
|
-
exports.VizBehavior = void 0;
|
|
2623
|
-
var VizBehavior;
|
|
3742
|
+
/***/ }),
|
|
2624
3743
|
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
* Dynamic Options Behavior.
|
|
2628
|
-
* This allows visualization options to be powered by data
|
|
2629
|
-
*
|
|
2630
|
-
* **Example**
|
|
2631
|
-
*
|
|
2632
|
-
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
2633
|
-
* would configure sparklineValues with an array of data points
|
|
2634
|
-
* coming from the first series in the primary datasource
|
|
2635
|
-
*
|
|
2636
|
-
*/
|
|
2637
|
-
VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
|
|
2638
|
-
VizBehavior["EVENTS"] = "events";
|
|
2639
|
-
/**
|
|
2640
|
-
* Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
|
|
2641
|
-
* missing.
|
|
2642
|
-
* @type {string}
|
|
2643
|
-
*/
|
|
3744
|
+
/***/ 8:
|
|
3745
|
+
/***/ (function(module, exports) {
|
|
2644
3746
|
|
|
2645
|
-
|
|
2646
|
-
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
2647
|
-
VizBehavior["TRELLIS"] = "trellis";
|
|
2648
|
-
})(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
|
|
3747
|
+
module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
2649
3748
|
|
|
2650
3749
|
/***/ }),
|
|
2651
3750
|
|
|
2652
|
-
/***/
|
|
3751
|
+
/***/ 87:
|
|
2653
3752
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2654
3753
|
|
|
2655
3754
|
"use strict";
|
|
@@ -2665,34 +3764,40 @@ var lodash_1 = __webpack_require__(3);
|
|
|
2665
3764
|
|
|
2666
3765
|
var i18n_1 = __webpack_require__(2);
|
|
2667
3766
|
|
|
2668
|
-
var visualization_color_palettes_1 = __webpack_require__(
|
|
3767
|
+
var visualization_color_palettes_1 = __webpack_require__(73);
|
|
2669
3768
|
|
|
2670
|
-
var react_1 = __webpack_require__(
|
|
3769
|
+
var react_1 = __webpack_require__(0);
|
|
2671
3770
|
|
|
2672
|
-
var React = __webpack_require__(
|
|
3771
|
+
var React = __webpack_require__(0);
|
|
2673
3772
|
|
|
2674
|
-
var T = __webpack_require__(
|
|
3773
|
+
var T = __webpack_require__(1);
|
|
2675
3774
|
|
|
2676
|
-
var react_event_listener_1 = __webpack_require__(
|
|
3775
|
+
var react_event_listener_1 = __webpack_require__(88);
|
|
2677
3776
|
|
|
2678
|
-
__webpack_require__(
|
|
3777
|
+
__webpack_require__(89); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
|
|
2679
3778
|
|
|
2680
3779
|
|
|
2681
|
-
var charting_bundle_1 = __webpack_require__(
|
|
3780
|
+
var charting_bundle_1 = __webpack_require__(77);
|
|
2682
3781
|
|
|
2683
|
-
var TimezoneContext_1 = __webpack_require__(
|
|
3782
|
+
var TimezoneContext_1 = __webpack_require__(32);
|
|
2684
3783
|
|
|
2685
|
-
var style_1 = __webpack_require__(
|
|
3784
|
+
var style_1 = __webpack_require__(18);
|
|
2686
3785
|
|
|
2687
3786
|
var styled_components_1 = __webpack_require__(4);
|
|
2688
3787
|
|
|
2689
|
-
var Message_1 = __webpack_require__(
|
|
3788
|
+
var Message_1 = __webpack_require__(12);
|
|
2690
3789
|
|
|
2691
|
-
var useSplunkTheme_1 = __webpack_require__(
|
|
3790
|
+
var useSplunkTheme_1 = __webpack_require__(78);
|
|
2692
3791
|
|
|
2693
|
-
var themeUtils_1 = __webpack_require__(
|
|
3792
|
+
var themeUtils_1 = __webpack_require__(90);
|
|
2694
3793
|
|
|
2695
|
-
var ChartingApi_1 = __webpack_require__(
|
|
3794
|
+
var ChartingApi_1 = __webpack_require__(91);
|
|
3795
|
+
|
|
3796
|
+
var usePrevious_1 = __webpack_require__(33);
|
|
3797
|
+
|
|
3798
|
+
var useEventCallback_1 = __webpack_require__(92);
|
|
3799
|
+
|
|
3800
|
+
var dataUtils_1 = __webpack_require__(14);
|
|
2696
3801
|
|
|
2697
3802
|
exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
|
|
2698
3803
|
|
|
@@ -2706,14 +3811,6 @@ var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
|
2706
3811
|
|
|
2707
3812
|
exports.changedOptions = changedOptions;
|
|
2708
3813
|
|
|
2709
|
-
function usePrevious(value) {
|
|
2710
|
-
var ref = (0, react_1.useRef)();
|
|
2711
|
-
(0, react_1.useEffect)(function () {
|
|
2712
|
-
ref.current = value;
|
|
2713
|
-
});
|
|
2714
|
-
return ref.current;
|
|
2715
|
-
}
|
|
2716
|
-
|
|
2717
3814
|
var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
|
|
2718
3815
|
// if either of the options are undefined
|
|
2719
3816
|
// it cannot update in place.
|
|
@@ -2778,16 +3875,23 @@ var propTypes = {
|
|
|
2778
3875
|
style: T.object,
|
|
2779
3876
|
colorPalette: T.array,
|
|
2780
3877
|
visualizationApiRef: T.func,
|
|
2781
|
-
themeKey: T.string
|
|
3878
|
+
themeKey: T.string,
|
|
3879
|
+
originalDataSources: T.object,
|
|
3880
|
+
onDownsamplingThresholdChange: T.func,
|
|
3881
|
+
xField: T.string,
|
|
3882
|
+
y2Fields: T.array
|
|
2782
3883
|
};
|
|
2783
3884
|
|
|
2784
3885
|
var Charting = function Charting(props) {
|
|
3886
|
+
var _a, _b;
|
|
3887
|
+
|
|
2785
3888
|
var container = (0, react_1.useRef)(null);
|
|
2786
3889
|
var needsInit = (0, react_1.useRef)(true);
|
|
2787
3890
|
var chart = (0, react_1.useRef)();
|
|
2788
3891
|
var needsRedraw = (0, react_1.useRef)(true);
|
|
2789
3892
|
var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
|
|
2790
3893
|
var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
|
|
3894
|
+
var selectChartEvent = (0, react_1.useRef)(null);
|
|
2791
3895
|
|
|
2792
3896
|
var computeChartingSize = function computeChartingSize() {
|
|
2793
3897
|
if (container.current) {
|
|
@@ -2815,9 +3919,13 @@ var Charting = function Charting(props) {
|
|
|
2815
3919
|
onSelect = props.onSelect,
|
|
2816
3920
|
onPointMouseOut = props.onPointMouseOut,
|
|
2817
3921
|
onPointMouseOver = props.onPointMouseOver,
|
|
2818
|
-
onEventTrigger = props.onEventTrigger
|
|
2819
|
-
|
|
2820
|
-
|
|
3922
|
+
onEventTrigger = props.onEventTrigger,
|
|
3923
|
+
originalDataSources = props.originalDataSources,
|
|
3924
|
+
onDownsamplingThresholdChange = props.onDownsamplingThresholdChange,
|
|
3925
|
+
xField = props.xField,
|
|
3926
|
+
y2Fields = props.y2Fields;
|
|
3927
|
+
var prevOptions = (0, usePrevious_1.default)(options);
|
|
3928
|
+
var prevTimezone = (0, usePrevious_1.default)(timezone);
|
|
2821
3929
|
|
|
2822
3930
|
var handleClick = function handleClick(chartEvent, type) {
|
|
2823
3931
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
|
|
@@ -2847,8 +3955,37 @@ var Charting = function Charting(props) {
|
|
|
2847
3955
|
needsInit.current = true;
|
|
2848
3956
|
};
|
|
2849
3957
|
|
|
2850
|
-
var
|
|
2851
|
-
|
|
3958
|
+
var enableSearchZoom = (_b = (_a = chartData === null || chartData === void 0 ? void 0 : chartData.chartDataOptions) === null || _a === void 0 ? void 0 : _a.enableSearchZoom) !== null && _b !== void 0 ? _b : false;
|
|
3959
|
+
var recalculateDownsamplingThreshold = React.useCallback(function () {
|
|
3960
|
+
if (!onDownsamplingThresholdChange || !xField) {
|
|
3961
|
+
return;
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3964
|
+
var newThreshold = (0, dataUtils_1.calculateDownsamplingThreshold)({
|
|
3965
|
+
enableSearchZoom: enableSearchZoom,
|
|
3966
|
+
dataSources: originalDataSources,
|
|
3967
|
+
width: Number(width),
|
|
3968
|
+
selectChartEvent: selectChartEvent.current,
|
|
3969
|
+
xField: xField,
|
|
3970
|
+
y2Fields: y2Fields
|
|
3971
|
+
});
|
|
3972
|
+
|
|
3973
|
+
if (Number.isFinite(newThreshold)) {
|
|
3974
|
+
onDownsamplingThresholdChange(newThreshold);
|
|
3975
|
+
}
|
|
3976
|
+
}, [enableSearchZoom, originalDataSources, onDownsamplingThresholdChange, width, xField, y2Fields]);
|
|
3977
|
+
React.useEffect(function () {
|
|
3978
|
+
recalculateDownsamplingThreshold();
|
|
3979
|
+
}, [recalculateDownsamplingThreshold]); // useEventCallback is used for these handlers to make sure that they are a stable reference and
|
|
3980
|
+
// we always use the latest version of the callback
|
|
3981
|
+
// Since chart drawing is debounced, there is a race condition where a stale callback may be called
|
|
3982
|
+
// if a prop changes and the event handler is called before the chart redraws. This means that
|
|
3983
|
+
// it will use the old callback rather than the newer one, which can lead to inaccurate results
|
|
3984
|
+
|
|
3985
|
+
var handleSelect = (0, useEventCallback_1.default)(function (chartEvent) {
|
|
3986
|
+
selectChartEvent.current = chartEvent;
|
|
3987
|
+
recalculateDownsamplingThreshold(); // todo: need change this after breaking all visualizations
|
|
3988
|
+
|
|
2852
3989
|
if (onSelect && typeof onSelect === 'function') {
|
|
2853
3990
|
onSelect({
|
|
2854
3991
|
type: 'range.select',
|
|
@@ -2864,9 +4001,8 @@ var Charting = function Charting(props) {
|
|
|
2864
4001
|
originalEvent: chartEvent,
|
|
2865
4002
|
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2866
4003
|
});
|
|
2867
|
-
};
|
|
2868
|
-
|
|
2869
|
-
var handlePointMouseOut = function handlePointMouseOut(chartEvent, type) {
|
|
4004
|
+
});
|
|
4005
|
+
var handlePointMouseOut = (0, useEventCallback_1.default)(function (chartEvent, type) {
|
|
2870
4006
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2871
4007
|
payload.name = payload.name2;
|
|
2872
4008
|
delete payload.name2;
|
|
@@ -2878,9 +4014,8 @@ var Charting = function Charting(props) {
|
|
|
2878
4014
|
originalEvent: chartEvent,
|
|
2879
4015
|
payload: payload
|
|
2880
4016
|
});
|
|
2881
|
-
};
|
|
2882
|
-
|
|
2883
|
-
var handlePointMouseOver = function handlePointMouseOver(chartEvent, type) {
|
|
4017
|
+
});
|
|
4018
|
+
var handlePointMouseOver = (0, useEventCallback_1.default)(function (chartEvent, type) {
|
|
2884
4019
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2885
4020
|
payload.name = payload.name2;
|
|
2886
4021
|
delete payload.name2;
|
|
@@ -2892,7 +4027,7 @@ var Charting = function Charting(props) {
|
|
|
2892
4027
|
originalEvent: chartEvent,
|
|
2893
4028
|
payload: payload
|
|
2894
4029
|
});
|
|
2895
|
-
};
|
|
4030
|
+
});
|
|
2896
4031
|
|
|
2897
4032
|
var drawChart = function drawChart() {
|
|
2898
4033
|
var updatedOptions = Object.assign(Object.assign({}, options), {
|
|
@@ -2918,7 +4053,7 @@ var Charting = function Charting(props) {
|
|
|
2918
4053
|
|
|
2919
4054
|
if (prevOptions) {
|
|
2920
4055
|
Object.keys(prevOptions).forEach(function (key) {
|
|
2921
|
-
if (updatedOptions[key] === undefined) {
|
|
4056
|
+
if (prevOptions[key] && updatedOptions[key] === undefined) {
|
|
2922
4057
|
updatedOptions[key] = '';
|
|
2923
4058
|
}
|
|
2924
4059
|
});
|
|
@@ -2988,8 +4123,8 @@ var Charting = function Charting(props) {
|
|
|
2988
4123
|
debouncedDrawChart();
|
|
2989
4124
|
};
|
|
2990
4125
|
|
|
2991
|
-
var prevTheme =
|
|
2992
|
-
var prevOnClick =
|
|
4126
|
+
var prevTheme = (0, usePrevious_1.default)(themeKey);
|
|
4127
|
+
var prevOnClick = (0, usePrevious_1.default)(onClick);
|
|
2993
4128
|
(0, react_1.useEffect)(function () {
|
|
2994
4129
|
debouncedDrawChart();
|
|
2995
4130
|
props.visualizationApiRef(api.current);
|
|
@@ -3004,11 +4139,11 @@ var Charting = function Charting(props) {
|
|
|
3004
4139
|
if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
|
|
3005
4140
|
JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
|
|
3006
4141
|
needsInit.current = true;
|
|
3007
|
-
}
|
|
3008
|
-
|
|
3009
|
-
needsRedraw.current = true; // need to immediately call drawChart upon an option or chartData change
|
|
4142
|
+
} // need to immediately call drawChart upon an option or chartData change
|
|
3010
4143
|
// otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
|
|
3011
4144
|
|
|
4145
|
+
|
|
4146
|
+
needsRedraw.current = true;
|
|
3012
4147
|
drawChart();
|
|
3013
4148
|
}, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone, timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset, timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone, themeKey, onClick]);
|
|
3014
4149
|
return React.createElement(ChartingContainer, {
|
|
@@ -3036,7 +4171,11 @@ var defaultProps = {
|
|
|
3036
4171
|
colorPalette: visualization_color_palettes_1.VIZ_CATEGORICAL,
|
|
3037
4172
|
visualizationApiRef: lodash_1.noop,
|
|
3038
4173
|
chartData: null,
|
|
3039
|
-
themeKey: null
|
|
4174
|
+
themeKey: null,
|
|
4175
|
+
onDownsamplingThresholdChange: null,
|
|
4176
|
+
originalDataSources: null,
|
|
4177
|
+
xField: null,
|
|
4178
|
+
y2Fields: []
|
|
3040
4179
|
};
|
|
3041
4180
|
Charting.propTypes = propTypes;
|
|
3042
4181
|
Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
|
|
@@ -3073,36 +4212,43 @@ exports.default = withEmptyChartMessage(Charting);
|
|
|
3073
4212
|
|
|
3074
4213
|
/***/ }),
|
|
3075
4214
|
|
|
3076
|
-
/***/
|
|
4215
|
+
/***/ 88:
|
|
3077
4216
|
/***/ (function(module, exports) {
|
|
3078
4217
|
|
|
3079
4218
|
module.exports = require("react-event-listener");
|
|
3080
4219
|
|
|
3081
4220
|
/***/ }),
|
|
3082
4221
|
|
|
3083
|
-
/***/
|
|
4222
|
+
/***/ 89:
|
|
3084
4223
|
/***/ (function(module, exports) {
|
|
3085
4224
|
|
|
3086
4225
|
module.exports = require("@splunk/visualizations-shared/i18n");
|
|
3087
4226
|
|
|
3088
4227
|
/***/ }),
|
|
3089
4228
|
|
|
3090
|
-
/***/
|
|
4229
|
+
/***/ 9:
|
|
4230
|
+
/***/ (function(module, exports) {
|
|
4231
|
+
|
|
4232
|
+
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
4233
|
+
|
|
4234
|
+
/***/ }),
|
|
4235
|
+
|
|
4236
|
+
/***/ 90:
|
|
3091
4237
|
/***/ (function(module, exports) {
|
|
3092
4238
|
|
|
3093
4239
|
module.exports = require("@splunk/visualizations-shared/themeUtils");
|
|
3094
4240
|
|
|
3095
4241
|
/***/ }),
|
|
3096
4242
|
|
|
3097
|
-
/***/
|
|
4243
|
+
/***/ 91:
|
|
3098
4244
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3099
4245
|
|
|
3100
4246
|
"use strict";
|
|
3101
4247
|
|
|
3102
4248
|
|
|
3103
|
-
var _classCallCheck = __webpack_require__(
|
|
4249
|
+
var _classCallCheck = __webpack_require__(10);
|
|
3104
4250
|
|
|
3105
|
-
var _createClass = __webpack_require__(
|
|
4251
|
+
var _createClass = __webpack_require__(25);
|
|
3106
4252
|
|
|
3107
4253
|
Object.defineProperty(exports, "__esModule", {
|
|
3108
4254
|
value: true
|
|
@@ -3163,31 +4309,36 @@ exports.ChartingApiFunctional = ChartingApiFunctional;
|
|
|
3163
4309
|
|
|
3164
4310
|
/***/ }),
|
|
3165
4311
|
|
|
3166
|
-
/***/
|
|
3167
|
-
/***/ (function(module, exports) {
|
|
3168
|
-
|
|
3169
|
-
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
4312
|
+
/***/ 92:
|
|
4313
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3170
4314
|
|
|
3171
|
-
|
|
4315
|
+
"use strict";
|
|
3172
4316
|
|
|
3173
|
-
/***/ 70:
|
|
3174
|
-
/***/ (function(module, exports) {
|
|
3175
4317
|
|
|
3176
|
-
|
|
4318
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4319
|
+
value: true
|
|
4320
|
+
});
|
|
3177
4321
|
|
|
3178
|
-
|
|
4322
|
+
var react_1 = __webpack_require__(0);
|
|
3179
4323
|
|
|
3180
|
-
|
|
3181
|
-
|
|
4324
|
+
var useEventCallback = function useEventCallback(fn) {
|
|
4325
|
+
var ref = (0, react_1.useRef)(fn);
|
|
4326
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
4327
|
+
ref.current = fn;
|
|
4328
|
+
});
|
|
4329
|
+
return (0, react_1.useCallback)(function () {
|
|
4330
|
+
return ref.current.apply(ref, arguments);
|
|
4331
|
+
}, []);
|
|
4332
|
+
};
|
|
3182
4333
|
|
|
3183
|
-
|
|
4334
|
+
exports.default = useEventCallback;
|
|
3184
4335
|
|
|
3185
4336
|
/***/ }),
|
|
3186
4337
|
|
|
3187
|
-
/***/
|
|
4338
|
+
/***/ 93:
|
|
3188
4339
|
/***/ (function(module, exports) {
|
|
3189
4340
|
|
|
3190
|
-
module.exports = require("@
|
|
4341
|
+
module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
|
|
3191
4342
|
|
|
3192
4343
|
/***/ })
|
|
3193
4344
|
|