@splunk/visualizations 26.1.2 → 26.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +2 -1
- package/Area.config.js.map +1 -1
- package/Area.js +1562 -433
- package/Area.js.map +1 -1
- package/Bar.config.js +1 -0
- package/Bar.config.js.map +1 -1
- package/Bar.js +1555 -430
- package/Bar.js.map +1 -1
- package/Bubble.config.js +1 -0
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +1580 -455
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +1 -0
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +1418 -351
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +2 -1
- package/Column.config.js.map +1 -1
- package/Column.js +1564 -435
- package/Column.js.map +1 -1
- package/Ellipse.config.js +1 -0
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +1342 -297
- package/Ellipse.js.map +1 -1
- package/Events.config.js +4 -0
- package/Events.config.js.map +1 -1
- package/Events.js +1503 -489
- package/Events.js.map +1 -1
- package/FEATUREFLAGS.md +3 -0
- package/FillerGauge.config.js +1 -0
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +1406 -345
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +1 -0
- package/Image.config.js.map +1 -1
- package/Image.js +2355 -1183
- package/Image.js.map +1 -1
- package/Line.config.js +2 -1
- package/Line.config.js.map +1 -1
- package/Line.js +1562 -433
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +1 -0
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +2013 -968
- package/LinkGraph.js.map +1 -1
- package/Map.config.js +1 -0
- package/Map.config.js.map +1 -1
- package/Map.js +2556 -1527
- package/Map.js.map +1 -1
- package/Markdown.config.js +1 -0
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +1952 -883
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +1 -0
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +4049 -2965
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +1 -0
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +3286 -2215
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +1 -0
- package/Pie.config.js.map +1 -1
- package/Pie.js +2187 -1036
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +1 -0
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +3397 -2299
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +1 -0
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +2181 -1112
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +1 -0
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +3275 -2199
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +1 -0
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +3551 -2400
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +27 -0
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +5551 -4397
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +1227 -1209
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +27 -0
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +2850 -1696
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +1 -0
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +6334 -5215
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +96 -96
- package/SparkLine.js.map +1 -1
- package/Table.config.js +172 -7
- package/Table.config.js.map +1 -1
- package/Table.js +3500 -2195
- package/Table.js.map +1 -1
- package/common/Charting.js +1009 -82
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +4 -4
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +54 -57
- package/common/DocExampleWithVizSandbox.js.map +1 -1
- package/common/EventsDoc.js +40 -40
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +15 -13
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +12 -12
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +34 -34
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +124 -103
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +49 -49
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +4 -4
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +31 -31
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +24 -8
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +4 -4
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +16 -16
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +36 -36
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +48 -47
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +832 -6
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/featureFlagUtils.js +139 -0
- package/common/utils/featureFlagUtils.js.map +1 -0
- package/common/utils/hocUtils.js +2 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -2
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +77 -54
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +28 -19
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -10
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +6 -6
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -2
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +1313 -235
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +13 -12
- package/__mocks__/fileMock.js +0 -2
- package/__mocks__/styleMock.js +0 -2
- package/babel.config.js +0 -11
- package/jest.config.js +0 -8
- package/loki.config.js +0 -14
package/Markdown.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 = 445);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -95,78 +95,583 @@ 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
|
+
|
|
114
|
+
/***/ }),
|
|
115
|
+
|
|
116
|
+
/***/ 106:
|
|
117
|
+
/***/ (function(module, exports) {
|
|
118
|
+
|
|
119
|
+
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
113
120
|
|
|
114
121
|
/***/ }),
|
|
115
122
|
|
|
116
123
|
/***/ 11:
|
|
117
124
|
/***/ (function(module, exports) {
|
|
118
125
|
|
|
126
|
+
module.exports = require("@splunk/visualizations-shared/numberUtils");
|
|
127
|
+
|
|
128
|
+
/***/ }),
|
|
129
|
+
|
|
130
|
+
/***/ 12:
|
|
131
|
+
/***/ (function(module, exports) {
|
|
132
|
+
|
|
133
|
+
module.exports = require("@splunk/visualizations-shared/Message");
|
|
134
|
+
|
|
135
|
+
/***/ }),
|
|
136
|
+
|
|
137
|
+
/***/ 13:
|
|
138
|
+
/***/ (function(module, exports) {
|
|
139
|
+
|
|
119
140
|
module.exports = require("@splunk/themes/variables");
|
|
120
141
|
|
|
121
142
|
/***/ }),
|
|
122
143
|
|
|
123
|
-
/***/
|
|
144
|
+
/***/ 133:
|
|
124
145
|
/***/ (function(module, exports) {
|
|
125
146
|
|
|
126
147
|
module.exports = require("@splunk/react-ui/Paragraph");
|
|
127
148
|
|
|
128
149
|
/***/ }),
|
|
129
150
|
|
|
130
|
-
/***/
|
|
131
|
-
/***/ (function(module, exports) {
|
|
151
|
+
/***/ 14:
|
|
152
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
132
153
|
|
|
133
|
-
|
|
154
|
+
"use strict";
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
Object.defineProperty(exports, "__esModule", {
|
|
158
|
+
value: true
|
|
159
|
+
});
|
|
160
|
+
exports.downsampleDataSources = exports.calculateDownsamplingThreshold = exports.calculateThresholdOnRangeSelect = exports.isDownsamplingEnabledForViz = exports.convertToArrOfObjects = void 0;
|
|
161
|
+
|
|
162
|
+
var numberUtils_1 = __webpack_require__(11);
|
|
163
|
+
|
|
164
|
+
var interfaces_1 = __webpack_require__(40); // TODO: utilize this fn in ParallelCoordinates
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
168
|
+
if (!columns || !columns[0] || !columns[0].length) return [];
|
|
169
|
+
var data = [];
|
|
170
|
+
|
|
171
|
+
var _loop = function _loop(i) {
|
|
172
|
+
var newObj = {};
|
|
173
|
+
fields.forEach(function (field, index) {
|
|
174
|
+
var fieldName = typeof field === 'string' ? field : field.name;
|
|
175
|
+
|
|
176
|
+
if (columns[index][i] === '') {
|
|
177
|
+
newObj[fieldName] = null;
|
|
178
|
+
} else {
|
|
179
|
+
newObj[fieldName] = columns[index][i];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
data.push(newObj);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
for (var i = 0; i < columns[0].length; i += 1) {
|
|
186
|
+
_loop(i);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return data;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
exports.convertToArrOfObjects = convertToArrOfObjects; // LTTB algorithm which can be used to downsample time series data while striving to maintain
|
|
193
|
+
// the spikes and overall shape of the chart
|
|
194
|
+
// Copied from https://github.com/sveinn-steinarsson/flot-downsample/blob/0815010016fc94b1bbc6a010afb8aad13ada6d0d/jquery.flot.downsample.js
|
|
195
|
+
// Modifications include:
|
|
196
|
+
// 1) Convert to modern JavaScript(use const, let, and use array.push to push to last element of array)
|
|
197
|
+
// 2) Convert to camel case
|
|
198
|
+
// 3) Convert to TS and also return the indices of the points that are in the downsampled result.
|
|
199
|
+
// 4) Add a new parameter preferredDownsampleIndices that correspond to the indices of points
|
|
200
|
+
// that should be used in case of a tie of the max area in a bucket
|
|
201
|
+
|
|
202
|
+
var largestTriangleThreeBuckets = function largestTriangleThreeBuckets(data, threshold, preferredDownsampleIndices) {
|
|
203
|
+
var dataLength = data.length;
|
|
204
|
+
var downsampledIndices = [];
|
|
205
|
+
|
|
206
|
+
if (threshold >= dataLength || threshold === 0) {
|
|
207
|
+
var allIndices = data.map(function (values, index) {
|
|
208
|
+
return index;
|
|
209
|
+
});
|
|
210
|
+
return {
|
|
211
|
+
downsampledData: data,
|
|
212
|
+
downsampledIndices: allIndices
|
|
213
|
+
}; // Nothing to do
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
var sampled = [];
|
|
217
|
+
var sampledIndex = 0; // Bucket size. Leave room for start and end data points
|
|
218
|
+
|
|
219
|
+
var every = (dataLength - 2) / (threshold - 2);
|
|
220
|
+
var a = 0; // Initially a is the first point in the triangle
|
|
221
|
+
|
|
222
|
+
var maxAreaPoint;
|
|
223
|
+
var maxArea;
|
|
224
|
+
var area;
|
|
225
|
+
var nextA;
|
|
226
|
+
sampled.push(data[a]); // Always add the first point
|
|
227
|
+
|
|
228
|
+
downsampledIndices.push(0); // eslint-disable-next-line no-plusplus
|
|
229
|
+
|
|
230
|
+
for (var i = 0; i < threshold - 2; i++) {
|
|
231
|
+
// Calculate point average for next bucket (containing c)
|
|
232
|
+
var avgX = 0;
|
|
233
|
+
var avgY = 0;
|
|
234
|
+
var avgRangeStart = Math.floor((i + 1) * every) + 1;
|
|
235
|
+
var avgRangeEnd = Math.floor((i + 2) * every) + 1;
|
|
236
|
+
avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
|
|
237
|
+
var avgRangeLength = avgRangeEnd - avgRangeStart; // eslint-disable-next-line no-plusplus
|
|
238
|
+
|
|
239
|
+
for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
|
|
240
|
+
avgX += Number(data[avgRangeStart][0]); // * 1 enforces Number (value may be Date)
|
|
241
|
+
|
|
242
|
+
avgY += data[avgRangeStart][1] * 1;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
avgX /= avgRangeLength;
|
|
246
|
+
avgY /= avgRangeLength; // Get the range for this bucket
|
|
247
|
+
|
|
248
|
+
var rangeOffs = Math.floor((i + 0) * every) + 1;
|
|
249
|
+
var rangeTo = Math.floor((i + 1) * every) + 1; // Point a
|
|
250
|
+
|
|
251
|
+
var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
|
|
252
|
+
|
|
253
|
+
var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
|
|
254
|
+
|
|
255
|
+
maxArea = area = -1;
|
|
256
|
+
var maxAreaIndex = rangeOffs; // eslint-disable-next-line no-plusplus
|
|
257
|
+
|
|
258
|
+
for (; rangeOffs < rangeTo; rangeOffs++) {
|
|
259
|
+
// Calculate triangle area over three buckets
|
|
260
|
+
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
|
|
261
|
+
// If all points in a bucket have the same area, prioritize the one with an x index
|
|
262
|
+
// that also existed from another series so we don't add another point unnecessarily.
|
|
263
|
+
// By default LTTB picks the leftmost point in the bucket
|
|
264
|
+
|
|
265
|
+
if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
|
|
266
|
+
maxArea = area;
|
|
267
|
+
maxAreaPoint = data[rangeOffs];
|
|
268
|
+
nextA = rangeOffs; // Next a is this b
|
|
269
|
+
// Modification: save the index of the point with the most area
|
|
270
|
+
|
|
271
|
+
maxAreaIndex = rangeOffs;
|
|
272
|
+
}
|
|
273
|
+
} // eslint-disable-next-line no-plusplus
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
|
|
277
|
+
|
|
278
|
+
downsampledIndices.push(maxAreaIndex);
|
|
279
|
+
a = nextA; // This a is the next a (chosen b)
|
|
280
|
+
} // eslint-disable-next-line no-plusplus
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
|
|
284
|
+
|
|
285
|
+
downsampledIndices.push(dataLength - 1);
|
|
286
|
+
return {
|
|
287
|
+
downsampledData: sampled,
|
|
288
|
+
downsampledIndices: downsampledIndices
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Strictly coerces the entire column to numbers if it only consists of numeric strings or numbers. Also determines
|
|
293
|
+
* if at least one of the values in the column can be loosely coerced to a number.
|
|
294
|
+
* If the column cannot be strictly downsampled (if it contains nulls or non-numeric strings), returns an empty array and
|
|
295
|
+
* returns that it cannot downsample the column.
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
var strictlyCoerceYColumn = function strictlyCoerceYColumn(column) {
|
|
300
|
+
// Splunk charting allows for numbers in formats such as negative hex that
|
|
301
|
+
// Number() does not support and also allows loose coercion of hex numbers (but not other formats)
|
|
302
|
+
// We want to identify columns which contain at least one value that can be loosely coerced
|
|
303
|
+
var canLooselyCoerceSomeValues = column.findIndex(function (value) {
|
|
304
|
+
return (0, numberUtils_1.startsWithNumber)("".concat(value));
|
|
305
|
+
}) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
|
|
306
|
+
|
|
307
|
+
var coercedColumn = [];
|
|
308
|
+
var canDownsampleColumn = !column.some(function (value) {
|
|
309
|
+
var coercedValue = Number(value); // if it can't be parsed or isn't safe, fail
|
|
310
|
+
|
|
311
|
+
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number') {
|
|
312
|
+
return true;
|
|
313
|
+
} // save value and continue to next
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
coercedColumn.push(coercedValue);
|
|
317
|
+
return false;
|
|
318
|
+
});
|
|
319
|
+
return {
|
|
320
|
+
canDownsampleColumn: canDownsampleColumn,
|
|
321
|
+
canLooselyCoerceSomeValues: canLooselyCoerceSomeValues,
|
|
322
|
+
coercedColumn: canDownsampleColumn ? coercedColumn : []
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Tries to coerce the x-column to numbers or dates, if it is eligible for downsampling.
|
|
327
|
+
* Only strictly increasing x-columns are eligible for downsampling.
|
|
328
|
+
* If the column is not eligible for downsampling, returns an empty array.
|
|
329
|
+
*/
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
|
|
333
|
+
if (fieldType === 'number') {
|
|
334
|
+
var coercedXColumn = column.map(function (xValue) {
|
|
335
|
+
return Number(xValue);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
|
|
339
|
+
return coercedXColumn;
|
|
340
|
+
}
|
|
341
|
+
} else if (fieldType === 'time') {
|
|
342
|
+
var _coercedXColumn = column.map(function (xValue) {
|
|
343
|
+
return new Date(xValue);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
|
|
347
|
+
return _coercedXColumn;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return [];
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
|
|
355
|
+
var vizConfig = _ref.vizConfig;
|
|
356
|
+
|
|
357
|
+
var _a;
|
|
358
|
+
|
|
359
|
+
return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
|
|
363
|
+
|
|
364
|
+
var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
|
|
365
|
+
var firstIndex = _ref2.firstIndex,
|
|
366
|
+
lastIndex = _ref2.lastIndex,
|
|
367
|
+
dataSources = _ref2.dataSources,
|
|
368
|
+
width = _ref2.width;
|
|
369
|
+
|
|
370
|
+
var _a, _b, _c;
|
|
371
|
+
|
|
372
|
+
var window = lastIndex - firstIndex + 1;
|
|
373
|
+
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;
|
|
374
|
+
return Math.round(ratio * Number(width));
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
exports.calculateThresholdOnRangeSelect = calculateThresholdOnRangeSelect;
|
|
378
|
+
/**
|
|
379
|
+
* Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
|
|
380
|
+
* then returns the width of the visualization.
|
|
381
|
+
*
|
|
382
|
+
* Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
|
|
383
|
+
* 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
|
|
384
|
+
* in for a categorical chart.
|
|
385
|
+
*/
|
|
386
|
+
|
|
387
|
+
var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
|
|
388
|
+
var enableSearchZoom = _ref3.enableSearchZoom,
|
|
389
|
+
dataSources = _ref3.dataSources,
|
|
390
|
+
selectChartEvent = _ref3.selectChartEvent,
|
|
391
|
+
width = _ref3.width,
|
|
392
|
+
xField = _ref3.xField,
|
|
393
|
+
y2Fields = _ref3.y2Fields;
|
|
394
|
+
|
|
395
|
+
var _a, _b, _c;
|
|
396
|
+
|
|
397
|
+
if (enableSearchZoom || !selectChartEvent) {
|
|
398
|
+
return Number(width);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
|
|
402
|
+
|
|
403
|
+
if (!primaryDataSource) {
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
var startXIndex = selectChartEvent.startXIndex,
|
|
408
|
+
endXIndex = selectChartEvent.endXIndex,
|
|
409
|
+
currentTarget = selectChartEvent.currentTarget;
|
|
410
|
+
|
|
411
|
+
try {
|
|
412
|
+
var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
|
|
413
|
+
return field.name === xField;
|
|
414
|
+
});
|
|
415
|
+
var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
|
|
416
|
+
return field === xField;
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
|
|
420
|
+
return null;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
|
|
424
|
+
var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
|
|
425
|
+
var firstIndex = fullSeries.findIndex(function (x) {
|
|
426
|
+
return downsampledSeries[startXIndex] === x;
|
|
427
|
+
});
|
|
428
|
+
var lastIndex = fullSeries.findIndex(function (x) {
|
|
429
|
+
return downsampledSeries[endXIndex] === x;
|
|
430
|
+
}); // For charts with categorical x-axis (charts with an xField that isn't _time), do not support
|
|
431
|
+
// re-calculating downsampling threshold if the chart is zoomed in until SPL-259458 is fixed
|
|
432
|
+
// Also do not support re-calculating downsampling threshold for zoomed-in charts with y2
|
|
433
|
+
// until SPL-259611 is fixed
|
|
434
|
+
|
|
435
|
+
if (xField !== '_time' || (y2Fields === null || y2Fields === void 0 ? void 0 : y2Fields.length)) {
|
|
436
|
+
return firstIndex === 0 && lastIndex === fullSeries.length - 1 ? width : null;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
|
|
440
|
+
return (0, exports.calculateThresholdOnRangeSelect)({
|
|
441
|
+
firstIndex: firstIndex,
|
|
442
|
+
lastIndex: lastIndex,
|
|
443
|
+
dataSources: dataSources,
|
|
444
|
+
width: width
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
} catch (e) {
|
|
448
|
+
console.error('Error occurred while setting downsample threshold on range select event', e);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return null;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
|
|
455
|
+
|
|
456
|
+
var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
|
|
457
|
+
return column.every(function (value, index) {
|
|
458
|
+
if (fieldType === 'number') {
|
|
459
|
+
if (Number.isNaN(value)) {
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (fieldType === 'time') {
|
|
465
|
+
if (Number.isNaN(value.getTime())) {
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
if (index === 0) {
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return value > column[index - 1];
|
|
475
|
+
});
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Verifies that all of the columns that are displayed in a chart can be downsampled. Valid columns that can be
|
|
479
|
+
* displayed are those that contain at least one number. We can only downsample columns that only consist of numbers.
|
|
480
|
+
*
|
|
481
|
+
* If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
|
|
482
|
+
* If not all columns can be downsampled, then returns empty arrays for both x and y
|
|
483
|
+
*/
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes) {
|
|
487
|
+
var xColumn = [];
|
|
488
|
+
var yColumns = [];
|
|
489
|
+
var canDownsample = !ds.data.fields.some(function (field, index) {
|
|
490
|
+
var _a, _b;
|
|
491
|
+
|
|
492
|
+
var fieldName = (_a = field.name) !== null && _a !== void 0 ? _a : field;
|
|
493
|
+
var fieldType = (_b = fieldTypes[index]) !== null && _b !== void 0 ? _b : 'unknown';
|
|
494
|
+
var column = ds.data.columns[index];
|
|
495
|
+
var hasDisplayedColumnThatCantBeDownsampled = false;
|
|
496
|
+
|
|
497
|
+
if (fieldName === xField) {
|
|
498
|
+
xColumn = strictlyCoerceXColumn(column, fieldType);
|
|
499
|
+
} else if (yFields.has(fieldName)) {
|
|
500
|
+
var _strictlyCoerceYColum = strictlyCoerceYColumn(ds.data.columns[index]),
|
|
501
|
+
coercedColumn = _strictlyCoerceYColum.coercedColumn,
|
|
502
|
+
canLooselyCoerceSomeValues = _strictlyCoerceYColum.canLooselyCoerceSomeValues,
|
|
503
|
+
canDownsampleColumn = _strictlyCoerceYColum.canDownsampleColumn; // do not perform downsampling if a column can possibly be displayed but cannot
|
|
504
|
+
// be downsampled using LTTB
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
|
|
508
|
+
|
|
509
|
+
if (hasDisplayedColumnThatCantBeDownsampled) {
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if (canDownsampleColumn) {
|
|
514
|
+
yColumns.push(coercedColumn);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return false;
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
if (canDownsample) {
|
|
522
|
+
return {
|
|
523
|
+
xColumn: xColumn,
|
|
524
|
+
yColumns: yColumns
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return {
|
|
529
|
+
xColumn: [],
|
|
530
|
+
yColumns: []
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
var pickIndicesFromDataSource = function pickIndicesFromDataSource(ds, indices) {
|
|
535
|
+
var sortedIndices = Array.from(indices).sort(function (a, b) {
|
|
536
|
+
return a - b;
|
|
537
|
+
});
|
|
538
|
+
var slicedColumns = [];
|
|
539
|
+
ds.data.columns.forEach(function (column) {
|
|
540
|
+
var slicedColumn = [];
|
|
541
|
+
sortedIndices.forEach(function (index) {
|
|
542
|
+
slicedColumn.push(column[index]);
|
|
543
|
+
});
|
|
544
|
+
slicedColumns.push(slicedColumn);
|
|
545
|
+
}); // update data columns with downsampled columns
|
|
546
|
+
|
|
547
|
+
return Object.assign(Object.assign({}, ds), {
|
|
548
|
+
data: Object.assign(Object.assign({}, ds.data), {
|
|
549
|
+
columns: slicedColumns
|
|
550
|
+
})
|
|
551
|
+
});
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
var downsampleDataSources = function downsampleDataSources(_ref4) {
|
|
555
|
+
var dataSources = _ref4.dataSources,
|
|
556
|
+
threshold = _ref4.threshold,
|
|
557
|
+
options = _ref4.options;
|
|
558
|
+
|
|
559
|
+
var _a, _b, _c;
|
|
560
|
+
|
|
561
|
+
var primaryDS = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary; // only downsample time series when number of data points are over threshold
|
|
562
|
+
|
|
563
|
+
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;
|
|
564
|
+
|
|
565
|
+
if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
|
|
566
|
+
return dataSources;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
var xField = options.xField,
|
|
570
|
+
yFields = options.yFields,
|
|
571
|
+
fieldTypes = options.fieldTypes;
|
|
572
|
+
|
|
573
|
+
if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
|
|
574
|
+
return dataSources;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
var nonInternalYFields = new Set(yFields.filter(function (yField) {
|
|
578
|
+
return !yField.startsWith('_');
|
|
579
|
+
}));
|
|
580
|
+
var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
|
|
581
|
+
// At the worst case, each series has non-overlapping downsampled pts
|
|
582
|
+
// which will mean that all points will be included in the downsampled result
|
|
583
|
+
// This will just lead to additional overhead due to coercing each
|
|
584
|
+
// x and y field to number
|
|
585
|
+
|
|
586
|
+
if (maxPointsInDownsample >= numPoints) {
|
|
587
|
+
return dataSources;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
var _tryToCoerceAllDispla = tryToCoerceAllDisplayedFields(primaryDS, xField, nonInternalYFields, fieldTypes),
|
|
591
|
+
xColumn = _tryToCoerceAllDispla.xColumn,
|
|
592
|
+
yColumns = _tryToCoerceAllDispla.yColumns;
|
|
593
|
+
|
|
594
|
+
if (!yColumns.length || !xColumn.length) {
|
|
595
|
+
return dataSources;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
var downsampledDataSources = Object.assign({}, dataSources);
|
|
599
|
+
var downsampledIndices = new Set();
|
|
600
|
+
yColumns.forEach(function (yColumn, columnIndex) {
|
|
601
|
+
// perform LTTB downsampling for current series, LTTB takes an [x, y] pair
|
|
602
|
+
var xyPair = yColumn.map(function (yValue, index) {
|
|
603
|
+
return [xColumn[index], yValue];
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
try {
|
|
607
|
+
var _largestTriangleThree = largestTriangleThreeBuckets(xyPair, threshold, downsampledIndices),
|
|
608
|
+
downsampledIndicesForSeries = _largestTriangleThree.downsampledIndices;
|
|
609
|
+
|
|
610
|
+
downsampledIndicesForSeries.forEach(function (downsampleIndex) {
|
|
611
|
+
return downsampledIndices.add(downsampleIndex);
|
|
612
|
+
});
|
|
613
|
+
} catch (e) {
|
|
614
|
+
console.error("Error occurred while downsampling column ".concat(columnIndex), e);
|
|
615
|
+
}
|
|
616
|
+
}); // update data columns with downsampled columns
|
|
617
|
+
|
|
618
|
+
downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
|
|
619
|
+
return downsampledDataSources;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
exports.downsampleDataSources = downsampleDataSources;
|
|
134
623
|
|
|
135
624
|
/***/ }),
|
|
136
625
|
|
|
137
|
-
/***/
|
|
626
|
+
/***/ 144:
|
|
138
627
|
/***/ (function(module, exports) {
|
|
139
628
|
|
|
140
629
|
module.exports = require("@splunk/react-ui/Markdown");
|
|
141
630
|
|
|
142
631
|
/***/ }),
|
|
143
632
|
|
|
144
|
-
/***/
|
|
633
|
+
/***/ 147:
|
|
145
634
|
/***/ (function(module, exports) {
|
|
146
635
|
|
|
147
636
|
module.exports = require("@splunk/react-ui/Heading");
|
|
148
637
|
|
|
149
638
|
/***/ }),
|
|
150
639
|
|
|
151
|
-
/***/
|
|
640
|
+
/***/ 15:
|
|
641
|
+
/***/ (function(module, exports) {
|
|
642
|
+
|
|
643
|
+
module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
644
|
+
|
|
645
|
+
/***/ }),
|
|
646
|
+
|
|
647
|
+
/***/ 16:
|
|
648
|
+
/***/ (function(module, exports) {
|
|
649
|
+
|
|
650
|
+
module.exports = require("@splunk/visualization-encoding/Options");
|
|
651
|
+
|
|
652
|
+
/***/ }),
|
|
653
|
+
|
|
654
|
+
/***/ 17:
|
|
152
655
|
/***/ (function(module, exports, __webpack_require__) {
|
|
153
656
|
|
|
154
657
|
"use strict";
|
|
155
658
|
|
|
156
659
|
|
|
660
|
+
var _slicedToArray = __webpack_require__(7);
|
|
661
|
+
|
|
157
662
|
Object.defineProperty(exports, "__esModule", {
|
|
158
663
|
value: true
|
|
159
664
|
});
|
|
160
665
|
|
|
161
|
-
var React = __webpack_require__(
|
|
666
|
+
var React = __webpack_require__(0);
|
|
162
667
|
|
|
163
668
|
var styled_components_1 = __webpack_require__(4);
|
|
164
669
|
|
|
165
|
-
var
|
|
670
|
+
var style_1 = __webpack_require__(18);
|
|
166
671
|
|
|
167
|
-
var
|
|
672
|
+
var colorUtils_1 = __webpack_require__(15);
|
|
168
673
|
|
|
169
|
-
var
|
|
674
|
+
var SizeAwareWrapper_1 = __webpack_require__(26);
|
|
170
675
|
|
|
171
676
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
172
677
|
var width = _ref.width;
|
|
@@ -212,6 +717,20 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
212
717
|
var width = props.width,
|
|
213
718
|
height = props.height,
|
|
214
719
|
backgroundColor = props.backgroundColor;
|
|
720
|
+
var cachedHandleResize = React.useCallback(function (w, h) {
|
|
721
|
+
setContainerWidth(w);
|
|
722
|
+
setContainerHeight(h);
|
|
723
|
+
}, []);
|
|
724
|
+
|
|
725
|
+
var _React$useState = React.useState(Number(props.width)),
|
|
726
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
727
|
+
containerWidth = _React$useState2[0],
|
|
728
|
+
setContainerWidth = _React$useState2[1];
|
|
729
|
+
|
|
730
|
+
var _React$useState3 = React.useState(Number(props.height)),
|
|
731
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
732
|
+
containerHeight = _React$useState4[0],
|
|
733
|
+
setContainerHeight = _React$useState4[1];
|
|
215
734
|
|
|
216
735
|
if (!height) {
|
|
217
736
|
return React.createElement(Item, {
|
|
@@ -223,18 +742,18 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
223
742
|
|
|
224
743
|
return React.createElement(FixSizeItem, {
|
|
225
744
|
"data-test": "fix-size-item",
|
|
226
|
-
"data-splunk-visualization-version": "26.
|
|
745
|
+
"data-splunk-visualization-version": "26.2.0 - 49b909915",
|
|
227
746
|
width: width,
|
|
228
747
|
height: height,
|
|
229
748
|
backgroundColor: backgroundColor
|
|
230
|
-
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
})));
|
|
749
|
+
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, {
|
|
750
|
+
width: width,
|
|
751
|
+
height: height,
|
|
752
|
+
onResize: cachedHandleResize
|
|
753
|
+
}), React.createElement(Viz, Object.assign({}, props, {
|
|
754
|
+
width: containerWidth,
|
|
755
|
+
height: containerHeight
|
|
756
|
+
}))));
|
|
238
757
|
};
|
|
239
758
|
|
|
240
759
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
@@ -245,95 +764,55 @@ exports.default = withFixedSizeContainer;
|
|
|
245
764
|
|
|
246
765
|
/***/ }),
|
|
247
766
|
|
|
248
|
-
/***/
|
|
767
|
+
/***/ 18:
|
|
249
768
|
/***/ (function(module, exports) {
|
|
250
769
|
|
|
251
770
|
module.exports = require("@splunk/visualizations-shared/style");
|
|
252
771
|
|
|
253
772
|
/***/ }),
|
|
254
773
|
|
|
255
|
-
/***/
|
|
774
|
+
/***/ 184:
|
|
256
775
|
/***/ (function(module, exports, __webpack_require__) {
|
|
257
776
|
|
|
258
777
|
"use strict";
|
|
259
778
|
|
|
260
779
|
|
|
780
|
+
var _taggedTemplateLiteral = __webpack_require__(81);
|
|
781
|
+
|
|
782
|
+
var _templateObject;
|
|
783
|
+
|
|
261
784
|
Object.defineProperty(exports, "__esModule", {
|
|
262
785
|
value: true
|
|
263
786
|
});
|
|
264
|
-
exports.
|
|
265
|
-
/**
|
|
266
|
-
* @method extendStaticWrapperProps
|
|
267
|
-
* @param {Object} props
|
|
268
|
-
* @param {DashboardVizType} props.Wrapper
|
|
269
|
-
* @param {DashboardVizType} props.Visualization
|
|
270
|
-
*/
|
|
271
|
-
|
|
272
|
-
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
273
|
-
var Wrapper = _ref.Wrapper,
|
|
274
|
-
Visualization = _ref.Visualization;
|
|
275
|
-
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
276
|
-
extendProperties.forEach(function (prop) {
|
|
277
|
-
if (Visualization[prop]) {
|
|
278
|
-
// eslint-disable-next-line no-param-reassign
|
|
279
|
-
Wrapper[prop] = Visualization[prop];
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
285
|
-
|
|
286
|
-
/***/ }),
|
|
287
|
-
|
|
288
|
-
/***/ 16:
|
|
289
|
-
/***/ (function(module, exports) {
|
|
290
|
-
|
|
291
|
-
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
292
|
-
|
|
293
|
-
/***/ }),
|
|
294
|
-
|
|
295
|
-
/***/ 162:
|
|
296
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
297
|
-
|
|
298
|
-
"use strict";
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
302
|
-
|
|
303
|
-
var _templateObject;
|
|
304
|
-
|
|
305
|
-
Object.defineProperty(exports, "__esModule", {
|
|
306
|
-
value: true
|
|
307
|
-
});
|
|
308
|
-
exports.getFontMap = exports.config = exports.themes = exports.computeVizProps = exports.FONT_SIZES = void 0;
|
|
787
|
+
exports.getFontMap = exports.config = exports.themes = exports.computeVizProps = exports.FONT_SIZES = void 0;
|
|
309
788
|
|
|
310
789
|
var lodash_1 = __webpack_require__(3);
|
|
311
790
|
|
|
312
|
-
var types_1 = __webpack_require__(
|
|
791
|
+
var types_1 = __webpack_require__(106);
|
|
313
792
|
|
|
314
|
-
var React = __webpack_require__(
|
|
793
|
+
var React = __webpack_require__(0);
|
|
315
794
|
|
|
316
|
-
var style_1 = __webpack_require__(
|
|
795
|
+
var style_1 = __webpack_require__(18);
|
|
317
796
|
|
|
318
|
-
var Markdown_1 = __webpack_require__(
|
|
797
|
+
var Markdown_1 = __webpack_require__(144);
|
|
319
798
|
|
|
320
799
|
var styled_components_1 = __webpack_require__(4);
|
|
321
800
|
|
|
322
|
-
var T = __webpack_require__(
|
|
801
|
+
var T = __webpack_require__(1);
|
|
323
802
|
|
|
324
|
-
var themes_1 = __webpack_require__(
|
|
803
|
+
var themes_1 = __webpack_require__(82);
|
|
325
804
|
|
|
326
|
-
var Heading_1 = __webpack_require__(
|
|
805
|
+
var Heading_1 = __webpack_require__(147);
|
|
327
806
|
|
|
328
|
-
var Paragraph_1 = __webpack_require__(
|
|
807
|
+
var Paragraph_1 = __webpack_require__(133);
|
|
329
808
|
|
|
330
|
-
var List_1 = __webpack_require__(
|
|
809
|
+
var List_1 = __webpack_require__(446);
|
|
331
810
|
|
|
332
|
-
var Code_1 = __webpack_require__(
|
|
811
|
+
var Code_1 = __webpack_require__(447);
|
|
333
812
|
|
|
334
|
-
var withDashboardViz_1 = __webpack_require__(
|
|
813
|
+
var withDashboardViz_1 = __webpack_require__(56);
|
|
335
814
|
|
|
336
|
-
var config_1 = __webpack_require__(
|
|
815
|
+
var config_1 = __webpack_require__(448);
|
|
337
816
|
|
|
338
817
|
exports.config = config_1.default; // map of valid font sizes with elements' respective pixel sizes
|
|
339
818
|
|
|
@@ -610,35 +1089,151 @@ exports.default = Markdown;
|
|
|
610
1089
|
|
|
611
1090
|
/***/ }),
|
|
612
1091
|
|
|
613
|
-
/***/
|
|
1092
|
+
/***/ 19:
|
|
1093
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1094
|
+
|
|
1095
|
+
"use strict";
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1099
|
+
value: true
|
|
1100
|
+
});
|
|
1101
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1102
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1103
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
1104
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
1105
|
+
|
|
1106
|
+
/***/ }),
|
|
1107
|
+
|
|
1108
|
+
/***/ 2:
|
|
614
1109
|
/***/ (function(module, exports) {
|
|
615
1110
|
|
|
616
|
-
module.exports = require("@
|
|
1111
|
+
module.exports = require("@splunk/ui-utils/i18n");
|
|
617
1112
|
|
|
618
1113
|
/***/ }),
|
|
619
1114
|
|
|
620
|
-
/***/
|
|
1115
|
+
/***/ 21:
|
|
1116
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1117
|
+
|
|
1118
|
+
"use strict";
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
var _classCallCheck = __webpack_require__(10);
|
|
1122
|
+
|
|
1123
|
+
var _createClass = __webpack_require__(25);
|
|
1124
|
+
|
|
1125
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1126
|
+
value: true
|
|
1127
|
+
});
|
|
1128
|
+
exports.DefaultVizActionHandler = void 0;
|
|
1129
|
+
|
|
1130
|
+
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1131
|
+
function DefaultVizActionHandler() {
|
|
1132
|
+
_classCallCheck(this, DefaultVizActionHandler);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
_createClass(DefaultVizActionHandler, [{
|
|
1136
|
+
key: "focus",
|
|
1137
|
+
value: function focus() {// noop
|
|
1138
|
+
}
|
|
1139
|
+
}, {
|
|
1140
|
+
key: "snapshot",
|
|
1141
|
+
value: function snapshot() {
|
|
1142
|
+
return null; // noop
|
|
1143
|
+
}
|
|
1144
|
+
}]);
|
|
1145
|
+
|
|
1146
|
+
return DefaultVizActionHandler;
|
|
1147
|
+
}();
|
|
1148
|
+
|
|
1149
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1150
|
+
|
|
1151
|
+
/***/ }),
|
|
1152
|
+
|
|
1153
|
+
/***/ 22:
|
|
1154
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1155
|
+
|
|
1156
|
+
"use strict";
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1160
|
+
value: true
|
|
1161
|
+
});
|
|
1162
|
+
exports.VizCategory = void 0;
|
|
1163
|
+
var VizCategory;
|
|
1164
|
+
|
|
1165
|
+
(function (VizCategory) {
|
|
1166
|
+
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1167
|
+
VizCategory["TRENDS"] = "Trends";
|
|
1168
|
+
VizCategory["COMPARISONS"] = "Comparisons";
|
|
1169
|
+
VizCategory["TABLE"] = "Table";
|
|
1170
|
+
VizCategory["GAUGE"] = "Gauge";
|
|
1171
|
+
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
1172
|
+
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
1173
|
+
VizCategory["SHAPES"] = "Shapes";
|
|
1174
|
+
VizCategory["MISC"] = "misc";
|
|
1175
|
+
VizCategory["FLOW"] = "Flow";
|
|
1176
|
+
VizCategory["CORRELATION"] = "Correlation";
|
|
1177
|
+
VizCategory["SPATIAL"] = "Spatial";
|
|
1178
|
+
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
1179
|
+
|
|
1180
|
+
/***/ }),
|
|
1181
|
+
|
|
1182
|
+
/***/ 23:
|
|
1183
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1184
|
+
|
|
1185
|
+
"use strict";
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1189
|
+
value: true
|
|
1190
|
+
});
|
|
1191
|
+
exports.extendStaticWrapperProps = void 0;
|
|
1192
|
+
/**
|
|
1193
|
+
* @method extendStaticWrapperProps
|
|
1194
|
+
* @param {Object} props
|
|
1195
|
+
* @param {DashboardVizType} props.Wrapper
|
|
1196
|
+
* @param {DashboardVizType} props.Visualization
|
|
1197
|
+
*/
|
|
1198
|
+
|
|
1199
|
+
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
1200
|
+
var Wrapper = _ref.Wrapper,
|
|
1201
|
+
Visualization = _ref.Visualization;
|
|
1202
|
+
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
1203
|
+
extendProperties.forEach(function (prop) {
|
|
1204
|
+
if (Visualization[prop]) {
|
|
1205
|
+
// eslint-disable-next-line no-param-reassign
|
|
1206
|
+
Wrapper[prop] = Visualization[prop];
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
};
|
|
1210
|
+
|
|
1211
|
+
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
1212
|
+
|
|
1213
|
+
/***/ }),
|
|
1214
|
+
|
|
1215
|
+
/***/ 24:
|
|
621
1216
|
/***/ (function(module, exports) {
|
|
622
1217
|
|
|
623
|
-
module.exports = require("@
|
|
1218
|
+
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
624
1219
|
|
|
625
1220
|
/***/ }),
|
|
626
1221
|
|
|
627
|
-
/***/
|
|
1222
|
+
/***/ 25:
|
|
628
1223
|
/***/ (function(module, exports) {
|
|
629
1224
|
|
|
630
|
-
module.exports = require("@
|
|
1225
|
+
module.exports = require("@babel/runtime/helpers/createClass");
|
|
631
1226
|
|
|
632
1227
|
/***/ }),
|
|
633
1228
|
|
|
634
|
-
/***/
|
|
1229
|
+
/***/ 26:
|
|
635
1230
|
/***/ (function(module, exports) {
|
|
636
1231
|
|
|
637
|
-
module.exports = require("@splunk/
|
|
1232
|
+
module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
638
1233
|
|
|
639
1234
|
/***/ }),
|
|
640
1235
|
|
|
641
|
-
/***/
|
|
1236
|
+
/***/ 27:
|
|
642
1237
|
/***/ (function(module, exports, __webpack_require__) {
|
|
643
1238
|
|
|
644
1239
|
"use strict";
|
|
@@ -646,7 +1241,7 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
646
1241
|
|
|
647
1242
|
var _toConsumableArray = __webpack_require__(8);
|
|
648
1243
|
|
|
649
|
-
var _defineProperty = __webpack_require__(
|
|
1244
|
+
var _defineProperty = __webpack_require__(9);
|
|
650
1245
|
|
|
651
1246
|
var __rest = this && this.__rest || function (s, e) {
|
|
652
1247
|
var t = {};
|
|
@@ -668,7 +1263,7 @@ exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig
|
|
|
668
1263
|
|
|
669
1264
|
var lodash_1 = __webpack_require__(3);
|
|
670
1265
|
|
|
671
|
-
var schemaUtils_1 = __webpack_require__(
|
|
1266
|
+
var schemaUtils_1 = __webpack_require__(24);
|
|
672
1267
|
|
|
673
1268
|
var VizBehavior_1 = __webpack_require__(6);
|
|
674
1269
|
|
|
@@ -875,56 +1470,73 @@ exports.insertLayout = insertLayout;
|
|
|
875
1470
|
|
|
876
1471
|
/***/ }),
|
|
877
1472
|
|
|
878
|
-
/***/
|
|
1473
|
+
/***/ 28:
|
|
879
1474
|
/***/ (function(module, exports) {
|
|
880
1475
|
|
|
881
1476
|
module.exports = require("@splunk/visualization-context/FeatureFlagContext");
|
|
882
1477
|
|
|
883
1478
|
/***/ }),
|
|
884
1479
|
|
|
885
|
-
/***/
|
|
1480
|
+
/***/ 3:
|
|
886
1481
|
/***/ (function(module, exports) {
|
|
887
1482
|
|
|
888
|
-
module.exports = require("
|
|
1483
|
+
module.exports = require("lodash");
|
|
889
1484
|
|
|
890
1485
|
/***/ }),
|
|
891
1486
|
|
|
892
|
-
/***/
|
|
1487
|
+
/***/ 31:
|
|
893
1488
|
/***/ (function(module, exports) {
|
|
894
1489
|
|
|
895
|
-
module.exports = require("@splunk/
|
|
1490
|
+
module.exports = require("@splunk/ui-utils/id");
|
|
896
1491
|
|
|
897
1492
|
/***/ }),
|
|
898
1493
|
|
|
899
|
-
/***/
|
|
1494
|
+
/***/ 32:
|
|
900
1495
|
/***/ (function(module, exports) {
|
|
901
1496
|
|
|
902
|
-
module.exports = require("@splunk/
|
|
1497
|
+
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
903
1498
|
|
|
904
1499
|
/***/ }),
|
|
905
1500
|
|
|
906
|
-
/***/
|
|
907
|
-
/***/ (function(module, exports) {
|
|
1501
|
+
/***/ 33:
|
|
1502
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
908
1503
|
|
|
909
|
-
|
|
1504
|
+
"use strict";
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1508
|
+
value: true
|
|
1509
|
+
});
|
|
1510
|
+
|
|
1511
|
+
var react_1 = __webpack_require__(0);
|
|
1512
|
+
|
|
1513
|
+
function usePrevious(value) {
|
|
1514
|
+
var ref = (0, react_1.useRef)();
|
|
1515
|
+
(0, react_1.useEffect)(function () {
|
|
1516
|
+
ref.current = value;
|
|
1517
|
+
});
|
|
1518
|
+
return ref.current;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
exports.default = usePrevious;
|
|
910
1522
|
|
|
911
1523
|
/***/ }),
|
|
912
1524
|
|
|
913
|
-
/***/
|
|
1525
|
+
/***/ 34:
|
|
914
1526
|
/***/ (function(module, exports) {
|
|
915
1527
|
|
|
916
|
-
module.exports = require("
|
|
1528
|
+
module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
917
1529
|
|
|
918
1530
|
/***/ }),
|
|
919
1531
|
|
|
920
|
-
/***/
|
|
1532
|
+
/***/ 35:
|
|
921
1533
|
/***/ (function(module, exports) {
|
|
922
1534
|
|
|
923
|
-
module.exports = require("@splunk/
|
|
1535
|
+
module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
|
|
924
1536
|
|
|
925
1537
|
/***/ }),
|
|
926
1538
|
|
|
927
|
-
/***/
|
|
1539
|
+
/***/ 37:
|
|
928
1540
|
/***/ (function(module, exports, __webpack_require__) {
|
|
929
1541
|
|
|
930
1542
|
"use strict";
|
|
@@ -935,17 +1547,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
935
1547
|
});
|
|
936
1548
|
exports.shouldShowIconPlaceholder = void 0;
|
|
937
1549
|
|
|
938
|
-
var React = __webpack_require__(
|
|
1550
|
+
var React = __webpack_require__(0);
|
|
939
1551
|
|
|
940
|
-
var T = __webpack_require__(
|
|
1552
|
+
var T = __webpack_require__(1);
|
|
941
1553
|
|
|
942
1554
|
var lodash_1 = __webpack_require__(3);
|
|
943
1555
|
|
|
944
1556
|
var i18n_1 = __webpack_require__(2);
|
|
945
1557
|
|
|
946
|
-
var Message_1 = __webpack_require__(
|
|
1558
|
+
var Message_1 = __webpack_require__(12);
|
|
947
1559
|
|
|
948
|
-
var FixedSizeContainer_1 = __webpack_require__(
|
|
1560
|
+
var FixedSizeContainer_1 = __webpack_require__(17);
|
|
949
1561
|
/**
|
|
950
1562
|
* @method shouldShowIconPlaceholder
|
|
951
1563
|
* @param {object} dataSources
|
|
@@ -1017,24 +1629,24 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
1017
1629
|
|
|
1018
1630
|
/***/ }),
|
|
1019
1631
|
|
|
1020
|
-
/***/
|
|
1632
|
+
/***/ 38:
|
|
1021
1633
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1022
1634
|
|
|
1023
1635
|
"use strict";
|
|
1024
1636
|
|
|
1025
1637
|
|
|
1026
|
-
var _defineProperty = __webpack_require__(
|
|
1638
|
+
var _defineProperty = __webpack_require__(9);
|
|
1027
1639
|
|
|
1028
1640
|
Object.defineProperty(exports, "__esModule", {
|
|
1029
1641
|
value: true
|
|
1030
1642
|
});
|
|
1031
1643
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
1032
1644
|
|
|
1033
|
-
var T = __webpack_require__(
|
|
1645
|
+
var T = __webpack_require__(1);
|
|
1034
1646
|
|
|
1035
1647
|
var lodash_1 = __webpack_require__(3);
|
|
1036
1648
|
|
|
1037
|
-
var DataSource_1 = __webpack_require__(
|
|
1649
|
+
var DataSource_1 = __webpack_require__(19);
|
|
1038
1650
|
|
|
1039
1651
|
exports.SortParamsPropTypes = T.shape({
|
|
1040
1652
|
currentSortKey: T.string,
|
|
@@ -1088,23 +1700,7 @@ exports.getSortingParams = getSortingParams;
|
|
|
1088
1700
|
|
|
1089
1701
|
/***/ }),
|
|
1090
1702
|
|
|
1091
|
-
/***/
|
|
1092
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1093
|
-
|
|
1094
|
-
"use strict";
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1098
|
-
value: true
|
|
1099
|
-
});
|
|
1100
|
-
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1101
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1102
|
-
exports.validSegmentationModes = ['none', 'inner'];
|
|
1103
|
-
exports.validOutputModes = ['json_cols', 'json'];
|
|
1104
|
-
|
|
1105
|
-
/***/ }),
|
|
1106
|
-
|
|
1107
|
-
/***/ 35:
|
|
1703
|
+
/***/ 39:
|
|
1108
1704
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1109
1705
|
|
|
1110
1706
|
"use strict";
|
|
@@ -1115,7 +1711,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1115
1711
|
});
|
|
1116
1712
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1117
1713
|
|
|
1118
|
-
var T = __webpack_require__(
|
|
1714
|
+
var T = __webpack_require__(1);
|
|
1119
1715
|
|
|
1120
1716
|
var lodash_1 = __webpack_require__(3);
|
|
1121
1717
|
|
|
@@ -1169,311 +1765,874 @@ exports.getPaginationParams = getPaginationParams;
|
|
|
1169
1765
|
|
|
1170
1766
|
/***/ }),
|
|
1171
1767
|
|
|
1172
|
-
/***/
|
|
1173
|
-
/***/ (function(module, exports
|
|
1174
|
-
|
|
1175
|
-
"use strict";
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1179
|
-
value: true
|
|
1180
|
-
});
|
|
1181
|
-
exports.VizCategory = void 0;
|
|
1182
|
-
var VizCategory;
|
|
1768
|
+
/***/ 4:
|
|
1769
|
+
/***/ (function(module, exports) {
|
|
1183
1770
|
|
|
1184
|
-
|
|
1185
|
-
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1186
|
-
VizCategory["TRENDS"] = "Trends";
|
|
1187
|
-
VizCategory["COMPARISONS"] = "Comparisons";
|
|
1188
|
-
VizCategory["TABLE"] = "Table";
|
|
1189
|
-
VizCategory["GAUGE"] = "Gauge";
|
|
1190
|
-
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
1191
|
-
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
1192
|
-
VizCategory["SHAPES"] = "Shapes";
|
|
1193
|
-
VizCategory["MISC"] = "misc";
|
|
1194
|
-
VizCategory["FLOW"] = "Flow";
|
|
1195
|
-
VizCategory["CORRELATION"] = "Correlation";
|
|
1196
|
-
VizCategory["SPATIAL"] = "Spatial";
|
|
1197
|
-
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
1771
|
+
module.exports = require("styled-components");
|
|
1198
1772
|
|
|
1199
1773
|
/***/ }),
|
|
1200
1774
|
|
|
1201
|
-
/***/
|
|
1775
|
+
/***/ 40:
|
|
1202
1776
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1203
1777
|
|
|
1204
1778
|
"use strict";
|
|
1205
1779
|
|
|
1206
1780
|
|
|
1207
|
-
var
|
|
1781
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1782
|
+
if (k2 === undefined) k2 = k;
|
|
1783
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1208
1784
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1785
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1786
|
+
desc = {
|
|
1787
|
+
enumerable: true,
|
|
1788
|
+
get: function get() {
|
|
1789
|
+
return m[k];
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1212
1793
|
|
|
1213
|
-
|
|
1794
|
+
Object.defineProperty(o, k2, desc);
|
|
1795
|
+
} : function (o, m, k, k2) {
|
|
1796
|
+
if (k2 === undefined) k2 = k;
|
|
1797
|
+
o[k2] = m[k];
|
|
1798
|
+
});
|
|
1214
1799
|
|
|
1215
|
-
var
|
|
1800
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1801
|
+
for (var p in m) {
|
|
1802
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1803
|
+
}
|
|
1804
|
+
};
|
|
1216
1805
|
|
|
1217
|
-
|
|
1806
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1807
|
+
value: true
|
|
1808
|
+
});
|
|
1218
1809
|
|
|
1219
|
-
|
|
1810
|
+
__exportStar(__webpack_require__(41), exports);
|
|
1220
1811
|
|
|
1221
|
-
|
|
1812
|
+
__exportStar(__webpack_require__(42), exports);
|
|
1222
1813
|
|
|
1223
|
-
|
|
1814
|
+
__exportStar(__webpack_require__(19), exports);
|
|
1224
1815
|
|
|
1225
|
-
|
|
1816
|
+
__exportStar(__webpack_require__(43), exports);
|
|
1226
1817
|
|
|
1227
|
-
|
|
1818
|
+
__exportStar(__webpack_require__(44), exports);
|
|
1228
1819
|
|
|
1229
|
-
|
|
1820
|
+
__exportStar(__webpack_require__(45), exports);
|
|
1230
1821
|
|
|
1231
|
-
|
|
1822
|
+
__exportStar(__webpack_require__(46), exports);
|
|
1232
1823
|
|
|
1233
|
-
|
|
1824
|
+
__exportStar(__webpack_require__(47), exports);
|
|
1234
1825
|
|
|
1235
|
-
|
|
1826
|
+
__exportStar(__webpack_require__(48), exports);
|
|
1236
1827
|
|
|
1237
|
-
|
|
1828
|
+
__exportStar(__webpack_require__(49), exports);
|
|
1238
1829
|
|
|
1239
|
-
|
|
1830
|
+
__exportStar(__webpack_require__(21), exports);
|
|
1240
1831
|
|
|
1241
|
-
|
|
1832
|
+
__exportStar(__webpack_require__(6), exports);
|
|
1242
1833
|
|
|
1243
|
-
|
|
1834
|
+
__exportStar(__webpack_require__(22), exports);
|
|
1244
1835
|
|
|
1245
|
-
|
|
1836
|
+
__exportStar(__webpack_require__(50), exports);
|
|
1246
1837
|
|
|
1247
|
-
|
|
1838
|
+
__exportStar(__webpack_require__(51), exports);
|
|
1248
1839
|
|
|
1249
|
-
|
|
1840
|
+
__exportStar(__webpack_require__(52), exports);
|
|
1250
1841
|
|
|
1251
|
-
|
|
1842
|
+
__exportStar(__webpack_require__(53), exports);
|
|
1252
1843
|
|
|
1253
|
-
|
|
1254
|
-
/**
|
|
1255
|
-
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
1256
|
-
* @param {DashboardVizOpts} opts
|
|
1257
|
-
* @returns {HOC}
|
|
1258
|
-
*/
|
|
1844
|
+
__exportStar(__webpack_require__(54), exports);
|
|
1259
1845
|
|
|
1846
|
+
__exportStar(__webpack_require__(55), exports);
|
|
1260
1847
|
|
|
1261
|
-
|
|
1262
|
-
var ReactViz = opts.ReactViz,
|
|
1263
|
-
vizConfig = opts.vizConfig,
|
|
1264
|
-
_opts$computeVizProps = opts.computeVizProps,
|
|
1265
|
-
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1266
|
-
disableEditModeCover = opts.disableEditModeCover,
|
|
1267
|
-
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1848
|
+
/***/ }),
|
|
1268
1849
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1850
|
+
/***/ 41:
|
|
1851
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1271
1852
|
|
|
1272
|
-
|
|
1273
|
-
var _a;
|
|
1853
|
+
"use strict";
|
|
1274
1854
|
|
|
1275
|
-
var mode = props.mode,
|
|
1276
|
-
hasEventHandlers = props.hasEventHandlers,
|
|
1277
|
-
dataSources = props.dataSources,
|
|
1278
|
-
options = props.options,
|
|
1279
|
-
_props$context = props.context,
|
|
1280
|
-
context = _props$context === void 0 ? {} : _props$context,
|
|
1281
|
-
width = props.width,
|
|
1282
|
-
height = props.height,
|
|
1283
|
-
onComputedProps = props.onComputedProps,
|
|
1284
|
-
onEventTrigger = props.onEventTrigger,
|
|
1285
|
-
theme = props.theme,
|
|
1286
|
-
onRequestParamsChange = props.onRequestParamsChange;
|
|
1287
1855
|
|
|
1288
|
-
|
|
1289
|
-
|
|
1856
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1857
|
+
value: true
|
|
1858
|
+
});
|
|
1290
1859
|
|
|
1291
|
-
|
|
1292
|
-
/*
|
|
1293
|
-
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
1294
|
-
This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
|
|
1295
|
-
will use it.
|
|
1296
|
-
@TODO(pwied):
|
|
1297
|
-
- remove when we moved away from @splunk/moment
|
|
1298
|
-
- provide timezone context to dynamic option evaluation phase
|
|
1299
|
-
*/
|
|
1300
|
-
if (!moment_1.default.getDefaultSplunkTimezone()) {
|
|
1301
|
-
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1860
|
+
/***/ }),
|
|
1304
1861
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1862
|
+
/***/ 42:
|
|
1863
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1307
1864
|
|
|
1308
|
-
|
|
1309
|
-
};
|
|
1865
|
+
"use strict";
|
|
1310
1866
|
|
|
1311
|
-
|
|
1867
|
+
/**
|
|
1868
|
+
* A data structure used at runtime to wire up a visualization.
|
|
1869
|
+
*/
|
|
1312
1870
|
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
currentThemeFamily = _ref.family,
|
|
1317
|
-
currentThemeColorScheme = _ref.colorScheme,
|
|
1318
|
-
currentThemeDensity = _ref.density;
|
|
1871
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1872
|
+
value: true
|
|
1873
|
+
});
|
|
1319
1874
|
|
|
1320
|
-
|
|
1875
|
+
/***/ }),
|
|
1321
1876
|
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
evaluatedOptionsAsync = _React$useState2[0],
|
|
1325
|
-
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1877
|
+
/***/ 43:
|
|
1878
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1326
1879
|
|
|
1880
|
+
"use strict";
|
|
1327
1881
|
|
|
1328
|
-
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1329
1882
|
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1883
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1884
|
+
value: true
|
|
1885
|
+
});
|
|
1333
1886
|
|
|
1334
|
-
|
|
1335
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1336
|
-
dataSourcesInState = _React$useState6[0],
|
|
1337
|
-
setDataSourcesInState = _React$useState6[1];
|
|
1887
|
+
/***/ }),
|
|
1338
1888
|
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
dataFramesInState = _React$useState8[0],
|
|
1342
|
-
setDataFramesInState = _React$useState8[1];
|
|
1889
|
+
/***/ 44:
|
|
1890
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1343
1891
|
|
|
1344
|
-
|
|
1345
|
-
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1346
|
-
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1347
|
-
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1892
|
+
"use strict";
|
|
1348
1893
|
|
|
1349
|
-
var isMounted = React.useRef(true);
|
|
1350
|
-
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
1351
|
-
try {
|
|
1352
|
-
if (useAsyncEvaluatedOptions) {
|
|
1353
|
-
var optionsToEvaluate = {
|
|
1354
|
-
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1355
|
-
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1356
|
-
};
|
|
1357
|
-
var asyncDynamicOptionsEvaluatorParams = {
|
|
1358
|
-
visualizationID: visualizationID,
|
|
1359
|
-
props: props,
|
|
1360
|
-
options: optionsToEvaluate,
|
|
1361
|
-
dataSources: dataSources,
|
|
1362
|
-
theme: vizConfig.themes
|
|
1363
|
-
};
|
|
1364
|
-
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
1365
|
-
setEvaluatedOptionsAsync(results.results);
|
|
1366
|
-
}).catch(function () {
|
|
1367
|
-
if (isMounted.current) {
|
|
1368
|
-
setUseAsyncEvaluatedOptions(false);
|
|
1369
|
-
}
|
|
1370
|
-
});
|
|
1371
|
-
} else {
|
|
1372
|
-
var dataFrames = dataFramesInState;
|
|
1373
1894
|
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
setDataFramesInState(dataFrames);
|
|
1378
|
-
}
|
|
1895
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1896
|
+
value: true
|
|
1897
|
+
});
|
|
1379
1898
|
|
|
1380
|
-
|
|
1381
|
-
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1382
|
-
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1383
|
-
}, dataSources, themeFunc, dataFrames);
|
|
1384
|
-
}
|
|
1385
|
-
} catch (e) {
|
|
1386
|
-
// eslint-disable-next-line no-console
|
|
1387
|
-
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1388
|
-
return {};
|
|
1389
|
-
}
|
|
1899
|
+
/***/ }),
|
|
1390
1900
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1394
|
-
// 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
|
|
1395
|
-
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1901
|
+
/***/ 445:
|
|
1902
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1396
1903
|
|
|
1397
|
-
|
|
1398
|
-
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1904
|
+
"use strict";
|
|
1399
1905
|
|
|
1400
|
-
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) {
|
|
1401
|
-
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1402
|
-
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1403
|
-
});
|
|
1404
|
-
} // useEffect hook needs to be initialized before any early returns
|
|
1405
|
-
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1406
1906
|
|
|
1907
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1908
|
+
if (k2 === undefined) k2 = k;
|
|
1909
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1407
1910
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
}
|
|
1417
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1418
|
-
}, []); // present warning message if any required props are missing
|
|
1911
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1912
|
+
desc = {
|
|
1913
|
+
enumerable: true,
|
|
1914
|
+
get: function get() {
|
|
1915
|
+
return m[k];
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1419
1919
|
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1920
|
+
Object.defineProperty(o, k2, desc);
|
|
1921
|
+
} : function (o, m, k, k2) {
|
|
1922
|
+
if (k2 === undefined) k2 = k;
|
|
1923
|
+
o[k2] = m[k];
|
|
1924
|
+
});
|
|
1424
1925
|
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
height: height,
|
|
1431
|
-
missingProps: missing,
|
|
1432
|
-
backgroundColor: bgColorFromTheme
|
|
1433
|
-
});
|
|
1434
|
-
} // events
|
|
1926
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1927
|
+
for (var p in m) {
|
|
1928
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1435
1931
|
|
|
1932
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1933
|
+
value: true
|
|
1934
|
+
});
|
|
1935
|
+
exports.default = void 0;
|
|
1436
1936
|
|
|
1437
|
-
|
|
1937
|
+
__exportStar(__webpack_require__(184), exports);
|
|
1438
1938
|
|
|
1439
|
-
|
|
1440
|
-
var supportedEvents = vizConfig.events;
|
|
1441
|
-
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1442
|
-
var _supportedEvents$even = supportedEvents[eventName],
|
|
1443
|
-
parentKeys = _supportedEvents$even.parentKeys,
|
|
1444
|
-
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
1445
|
-
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
1446
|
-
// then remove these lines
|
|
1939
|
+
var Markdown_1 = __webpack_require__(184);
|
|
1447
1940
|
|
|
1448
|
-
|
|
1941
|
+
Object.defineProperty(exports, "default", {
|
|
1942
|
+
enumerable: true,
|
|
1943
|
+
get: function get() {
|
|
1944
|
+
return Markdown_1.default;
|
|
1945
|
+
}
|
|
1946
|
+
});
|
|
1449
1947
|
|
|
1450
|
-
|
|
1451
|
-
payloadKeys.forEach(function (p) {
|
|
1452
|
-
payload[p] = evaluatedOptionsToUse[p];
|
|
1453
|
-
});
|
|
1454
|
-
}
|
|
1948
|
+
/***/ }),
|
|
1455
1949
|
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
payload = ev.payload;
|
|
1459
|
-
}
|
|
1950
|
+
/***/ 446:
|
|
1951
|
+
/***/ (function(module, exports) {
|
|
1460
1952
|
|
|
1461
|
-
|
|
1462
|
-
originalEvent: ev,
|
|
1463
|
-
payload: payload,
|
|
1464
|
-
type: eventName
|
|
1465
|
-
});
|
|
1466
|
-
};
|
|
1953
|
+
module.exports = require("@splunk/react-ui/List");
|
|
1467
1954
|
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1955
|
+
/***/ }),
|
|
1956
|
+
|
|
1957
|
+
/***/ 447:
|
|
1958
|
+
/***/ (function(module, exports) {
|
|
1959
|
+
|
|
1960
|
+
module.exports = require("@splunk/react-ui/Code");
|
|
1961
|
+
|
|
1962
|
+
/***/ }),
|
|
1963
|
+
|
|
1964
|
+
/***/ 448:
|
|
1965
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1966
|
+
|
|
1967
|
+
"use strict";
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
var _toConsumableArray = __webpack_require__(8);
|
|
1971
|
+
|
|
1972
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1973
|
+
value: true
|
|
1974
|
+
});
|
|
1975
|
+
|
|
1976
|
+
var themes_1 = __webpack_require__(82);
|
|
1977
|
+
|
|
1978
|
+
var i18n_1 = __webpack_require__(2);
|
|
1979
|
+
|
|
1980
|
+
var schemaUtils_1 = __webpack_require__(24);
|
|
1981
|
+
|
|
1982
|
+
var VizBehavior_1 = __webpack_require__(6);
|
|
1983
|
+
|
|
1984
|
+
var VizCategory_1 = __webpack_require__(22);
|
|
1985
|
+
|
|
1986
|
+
var configUtils_1 = __webpack_require__(27);
|
|
1987
|
+
|
|
1988
|
+
var BackgroundColor_1 = __webpack_require__(75);
|
|
1989
|
+
|
|
1990
|
+
var FONT_OPTIONS = new Set(['extraSmall', 'small', 'default', 'large', 'extraLarge']);
|
|
1991
|
+
var dataContract = {
|
|
1992
|
+
requiredDataSources: [],
|
|
1993
|
+
optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1994
|
+
// {
|
|
1995
|
+
// name: 'annotation',
|
|
1996
|
+
// description: 'DataSource that populate event annotations',
|
|
1997
|
+
// },
|
|
1998
|
+
],
|
|
1999
|
+
initialRequestParams: {
|
|
2000
|
+
primary: {
|
|
2001
|
+
offset: 0,
|
|
2002
|
+
count: 10000
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
};
|
|
2006
|
+
var size = {
|
|
2007
|
+
initialWidth: 300,
|
|
2008
|
+
initialHeight: 300
|
|
2009
|
+
};
|
|
2010
|
+
var defaultContext = {};
|
|
2011
|
+
var optionsSchema = {
|
|
2012
|
+
backgroundColor: {
|
|
2013
|
+
description: 'Specify the background color using a Hex code such as "#FF0000".',
|
|
2014
|
+
type: 'string',
|
|
2015
|
+
default: 'transparent',
|
|
2016
|
+
pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
|
|
2017
|
+
},
|
|
2018
|
+
customFontSize: {
|
|
2019
|
+
description: 'Specify the font size (in pixels) you would like to use for unformatted text when `fontSize` is set to `custom`. Header elements are calculated with the following formula: h1 = 2 × `customFontSize`, h2 = 1.5 × `customFontSize`, h3 = 1.25 × `customFontSize`',
|
|
2020
|
+
default: 14,
|
|
2021
|
+
type: 'number'
|
|
2022
|
+
},
|
|
2023
|
+
fontColor: {
|
|
2024
|
+
description: 'Specify the text color using Hex codes or RGBA values, such as "#FF0000" or "rgba(25,12,13,0.1)". The default for enterprise light is "#3c444d". The default for enterprise dark is "#FFFFFF". The default for prisma dark is "rgba(255, 255, 255, 0.7)".',
|
|
2025
|
+
type: 'string',
|
|
2026
|
+
default: '> themes.defaultFontColor',
|
|
2027
|
+
pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
|
|
2028
|
+
},
|
|
2029
|
+
fontFamily: {
|
|
2030
|
+
default: 'Splunk Platform Sans',
|
|
2031
|
+
pattern: (0, schemaUtils_1.getPattern)(['Splunk Platform Sans', 'Splunk Data Sans', 'Splunk Platform Mono', 'Arial', 'Helvetica', 'Times New Roman', 'Comic Sans MS']),
|
|
2032
|
+
description: 'Specify the font family you would like to use for markdown content, such as "Comic Sans MS". Note: the font needs to be available to your end user.',
|
|
2033
|
+
type: 'string'
|
|
2034
|
+
},
|
|
2035
|
+
fontSize: {
|
|
2036
|
+
description: 'Specify the font size you would like to use for markdown content. Font sizes range from extra small (10px for unformatted text) to extra large (18px for unformatted text) with the default being 14px for unformatted text.',
|
|
2037
|
+
type: 'string',
|
|
2038
|
+
default: 'default',
|
|
2039
|
+
pattern: (0, schemaUtils_1.getPattern)(['extraSmall', 'small', 'default', 'large', 'extraLarge', 'custom'])
|
|
2040
|
+
},
|
|
2041
|
+
markdown: {
|
|
2042
|
+
description: 'Add text using basic markdown syntax.',
|
|
2043
|
+
type: 'string'
|
|
2044
|
+
},
|
|
2045
|
+
rotation: {
|
|
2046
|
+
description: 'Specify the angle of rotation of the markdown content in degrees.',
|
|
2047
|
+
type: 'number',
|
|
2048
|
+
default: 0
|
|
2049
|
+
}
|
|
2050
|
+
};
|
|
2051
|
+
var themes = {
|
|
2052
|
+
defaultFontColor: function defaultFontColor(props) {
|
|
2053
|
+
return (0, themes_1.pick)({
|
|
2054
|
+
enterprise: {
|
|
2055
|
+
dark: themes_1.variables.textColor(props),
|
|
2056
|
+
light: themes_1.variables.textColor(props)
|
|
2057
|
+
},
|
|
2058
|
+
prisma: themes_1.variables.contentColorDefault(props)
|
|
2059
|
+
})(props);
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
var editorConfig = [{
|
|
2063
|
+
label: (0, i18n_1._)('Color and style'),
|
|
2064
|
+
layout: [[{
|
|
2065
|
+
label: (0, i18n_1._)('Font'),
|
|
2066
|
+
option: 'fontColor',
|
|
2067
|
+
editor: 'editor.color',
|
|
2068
|
+
editorProps: {
|
|
2069
|
+
labelPosition: 'top',
|
|
2070
|
+
themes: themes
|
|
2071
|
+
}
|
|
2072
|
+
}].concat(_toConsumableArray((0, BackgroundColor_1.default)({
|
|
2073
|
+
label: 'Background',
|
|
2074
|
+
themes: themes
|
|
2075
|
+
}))), [{
|
|
2076
|
+
label: (0, i18n_1._)('Font family'),
|
|
2077
|
+
option: 'fontFamily',
|
|
2078
|
+
editor: 'editor.select',
|
|
2079
|
+
editorProps: {
|
|
2080
|
+
values: [{
|
|
2081
|
+
value: 'Splunk Platform Sans'
|
|
2082
|
+
}, {
|
|
2083
|
+
value: 'Splunk Data Sans'
|
|
2084
|
+
}, {
|
|
2085
|
+
value: 'Splunk Platform Mono'
|
|
2086
|
+
}, {
|
|
2087
|
+
value: 'Arial'
|
|
2088
|
+
}, {
|
|
2089
|
+
value: 'Helvetica'
|
|
2090
|
+
}, {
|
|
2091
|
+
value: 'Times New Roman'
|
|
2092
|
+
}, {
|
|
2093
|
+
value: 'Comic Sans MS'
|
|
2094
|
+
}]
|
|
2095
|
+
}
|
|
2096
|
+
}], [{
|
|
2097
|
+
label: (0, i18n_1._)('Font size'),
|
|
2098
|
+
option: 'fontSize',
|
|
2099
|
+
editor: 'editor.select',
|
|
2100
|
+
editorProps: {
|
|
2101
|
+
values: [{
|
|
2102
|
+
label: (0, i18n_1._)('Extra Small'),
|
|
2103
|
+
value: 'extraSmall'
|
|
2104
|
+
}, {
|
|
2105
|
+
label: (0, i18n_1._)('Small'),
|
|
2106
|
+
value: 'small'
|
|
2107
|
+
}, {
|
|
2108
|
+
label: (0, i18n_1._)('Default'),
|
|
2109
|
+
value: 'default'
|
|
2110
|
+
}, {
|
|
2111
|
+
label: (0, i18n_1._)('Large'),
|
|
2112
|
+
value: 'large'
|
|
2113
|
+
}, {
|
|
2114
|
+
label: (0, i18n_1._)('Extra Large'),
|
|
2115
|
+
value: 'extraLarge'
|
|
2116
|
+
}, {
|
|
2117
|
+
label: (0, i18n_1._)('Custom'),
|
|
2118
|
+
value: 'custom'
|
|
2119
|
+
}]
|
|
2120
|
+
}
|
|
2121
|
+
}, {
|
|
2122
|
+
label: (0, i18n_1._)('Custom font size (px)'),
|
|
2123
|
+
option: 'customFontSize',
|
|
2124
|
+
editor: 'editor.number',
|
|
2125
|
+
editorProps: {
|
|
2126
|
+
min: 0,
|
|
2127
|
+
labelPosition: 'top'
|
|
2128
|
+
},
|
|
2129
|
+
showEditor: function showEditor(_ref) {
|
|
2130
|
+
var options = _ref.options;
|
|
2131
|
+
return options.fontSize && !FONT_OPTIONS.has(options.fontSize);
|
|
2132
|
+
}
|
|
2133
|
+
}], [{
|
|
2134
|
+
label: (0, i18n_1._)('Rotation (degrees)'),
|
|
2135
|
+
option: 'rotation',
|
|
2136
|
+
editor: 'editor.number',
|
|
2137
|
+
editorProps: {
|
|
2138
|
+
min: -360,
|
|
2139
|
+
max: 360
|
|
2140
|
+
}
|
|
2141
|
+
}]]
|
|
2142
|
+
}, {
|
|
2143
|
+
label: (0, i18n_1._)('Markdown content'),
|
|
2144
|
+
open: true,
|
|
2145
|
+
layout: [[{
|
|
2146
|
+
label: '',
|
|
2147
|
+
option: 'markdown',
|
|
2148
|
+
editor: 'editor.markdown'
|
|
2149
|
+
}]]
|
|
2150
|
+
}];
|
|
2151
|
+
/**
|
|
2152
|
+
* visualization configuration
|
|
2153
|
+
*/
|
|
2154
|
+
|
|
2155
|
+
var config = {
|
|
2156
|
+
/**
|
|
2157
|
+
* unique viz key
|
|
2158
|
+
*/
|
|
2159
|
+
key: 'splunk.markdown',
|
|
2160
|
+
|
|
2161
|
+
/**
|
|
2162
|
+
* viz name
|
|
2163
|
+
*/
|
|
2164
|
+
name: (0, i18n_1._)('Markdown'),
|
|
2165
|
+
category: VizCategory_1.VizCategory.COMPARISONS,
|
|
2166
|
+
|
|
2167
|
+
/**
|
|
2168
|
+
* viz icon
|
|
2169
|
+
*/
|
|
2170
|
+
icon: null,
|
|
2171
|
+
dataContract: dataContract,
|
|
2172
|
+
size: size,
|
|
2173
|
+
defaultContext: defaultContext,
|
|
2174
|
+
optionsSchema: optionsSchema,
|
|
2175
|
+
editorConfig: editorConfig,
|
|
2176
|
+
events: {
|
|
2177
|
+
'markdown.click': {
|
|
2178
|
+
description: 'triggered when user clicks on markdown area not formatted as a link'
|
|
2179
|
+
}
|
|
2180
|
+
},
|
|
2181
|
+
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS],
|
|
2182
|
+
themes: themes
|
|
2183
|
+
};
|
|
2184
|
+
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
2185
|
+
|
|
2186
|
+
/***/ }),
|
|
2187
|
+
|
|
2188
|
+
/***/ 45:
|
|
2189
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2190
|
+
|
|
2191
|
+
"use strict";
|
|
2192
|
+
|
|
2193
|
+
|
|
2194
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2195
|
+
value: true
|
|
2196
|
+
});
|
|
2197
|
+
|
|
2198
|
+
/***/ }),
|
|
2199
|
+
|
|
2200
|
+
/***/ 46:
|
|
2201
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2202
|
+
|
|
2203
|
+
"use strict";
|
|
2204
|
+
|
|
2205
|
+
|
|
2206
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2207
|
+
value: true
|
|
2208
|
+
});
|
|
2209
|
+
|
|
2210
|
+
/***/ }),
|
|
2211
|
+
|
|
2212
|
+
/***/ 47:
|
|
2213
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2214
|
+
|
|
2215
|
+
"use strict";
|
|
2216
|
+
|
|
2217
|
+
|
|
2218
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2219
|
+
value: true
|
|
2220
|
+
});
|
|
2221
|
+
|
|
2222
|
+
/***/ }),
|
|
2223
|
+
|
|
2224
|
+
/***/ 48:
|
|
2225
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2226
|
+
|
|
2227
|
+
"use strict";
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2231
|
+
value: true
|
|
2232
|
+
});
|
|
2233
|
+
|
|
2234
|
+
/***/ }),
|
|
2235
|
+
|
|
2236
|
+
/***/ 49:
|
|
2237
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2238
|
+
|
|
2239
|
+
"use strict";
|
|
2240
|
+
|
|
2241
|
+
|
|
2242
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2243
|
+
value: true
|
|
2244
|
+
});
|
|
2245
|
+
|
|
2246
|
+
/***/ }),
|
|
2247
|
+
|
|
2248
|
+
/***/ 50:
|
|
2249
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2250
|
+
|
|
2251
|
+
"use strict";
|
|
2252
|
+
|
|
2253
|
+
|
|
2254
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2255
|
+
value: true
|
|
2256
|
+
});
|
|
2257
|
+
|
|
2258
|
+
/***/ }),
|
|
2259
|
+
|
|
2260
|
+
/***/ 51:
|
|
2261
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2262
|
+
|
|
2263
|
+
"use strict";
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2267
|
+
value: true
|
|
2268
|
+
});
|
|
2269
|
+
|
|
2270
|
+
/***/ }),
|
|
2271
|
+
|
|
2272
|
+
/***/ 52:
|
|
2273
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2274
|
+
|
|
2275
|
+
"use strict";
|
|
2276
|
+
|
|
2277
|
+
|
|
2278
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2279
|
+
value: true
|
|
2280
|
+
});
|
|
2281
|
+
|
|
2282
|
+
/***/ }),
|
|
2283
|
+
|
|
2284
|
+
/***/ 53:
|
|
2285
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2286
|
+
|
|
2287
|
+
"use strict";
|
|
2288
|
+
|
|
2289
|
+
|
|
2290
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2291
|
+
value: true
|
|
2292
|
+
});
|
|
2293
|
+
|
|
2294
|
+
/***/ }),
|
|
2295
|
+
|
|
2296
|
+
/***/ 54:
|
|
2297
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2298
|
+
|
|
2299
|
+
"use strict";
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2303
|
+
value: true
|
|
2304
|
+
});
|
|
2305
|
+
|
|
2306
|
+
/***/ }),
|
|
2307
|
+
|
|
2308
|
+
/***/ 55:
|
|
2309
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2310
|
+
|
|
2311
|
+
"use strict";
|
|
2312
|
+
|
|
2313
|
+
|
|
2314
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2315
|
+
value: true
|
|
2316
|
+
});
|
|
2317
|
+
|
|
2318
|
+
/***/ }),
|
|
2319
|
+
|
|
2320
|
+
/***/ 56:
|
|
2321
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2322
|
+
|
|
2323
|
+
"use strict";
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
var _slicedToArray = __webpack_require__(7);
|
|
2327
|
+
|
|
2328
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2329
|
+
value: true
|
|
2330
|
+
});
|
|
2331
|
+
|
|
2332
|
+
var React = __webpack_require__(0);
|
|
2333
|
+
|
|
2334
|
+
var lodash_1 = __webpack_require__(3);
|
|
2335
|
+
|
|
2336
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(57);
|
|
2337
|
+
|
|
2338
|
+
var Options_1 = __webpack_require__(16);
|
|
2339
|
+
|
|
2340
|
+
var SanitizeProps_1 = __webpack_require__(58);
|
|
2341
|
+
|
|
2342
|
+
var TimezoneContext_1 = __webpack_require__(32);
|
|
2343
|
+
|
|
2344
|
+
var moment_1 = __webpack_require__(59);
|
|
2345
|
+
|
|
2346
|
+
var FeatureFlagContext_1 = __webpack_require__(28);
|
|
2347
|
+
|
|
2348
|
+
var styled_components_1 = __webpack_require__(4);
|
|
2349
|
+
|
|
2350
|
+
var hocUtils_1 = __webpack_require__(34);
|
|
2351
|
+
|
|
2352
|
+
var JSONSchemaUtils_1 = __webpack_require__(35);
|
|
2353
|
+
|
|
2354
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(60);
|
|
2355
|
+
|
|
2356
|
+
var id_1 = __webpack_require__(31);
|
|
2357
|
+
|
|
2358
|
+
var SplunkVisualization_1 = __webpack_require__(61);
|
|
2359
|
+
|
|
2360
|
+
var VizBehavior_1 = __webpack_require__(6);
|
|
2361
|
+
|
|
2362
|
+
var getSorting_1 = __webpack_require__(38);
|
|
2363
|
+
|
|
2364
|
+
var getPagination_1 = __webpack_require__(39);
|
|
2365
|
+
|
|
2366
|
+
var useDeepMemo_1 = __webpack_require__(62);
|
|
2367
|
+
|
|
2368
|
+
var MissingPropsMessage_1 = __webpack_require__(63);
|
|
2369
|
+
|
|
2370
|
+
var withEditModeCover_1 = __webpack_require__(64);
|
|
2371
|
+
|
|
2372
|
+
var withPlaceholder_1 = __webpack_require__(65);
|
|
2373
|
+
|
|
2374
|
+
var useDownsampleDataSources_1 = __webpack_require__(66);
|
|
2375
|
+
|
|
2376
|
+
var dataUtils_1 = __webpack_require__(14);
|
|
2377
|
+
|
|
2378
|
+
var featureFlagUtils_1 = __webpack_require__(68);
|
|
2379
|
+
/**
|
|
2380
|
+
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
2381
|
+
* @param {DashboardVizOpts} opts
|
|
2382
|
+
* @returns {HOC}
|
|
2383
|
+
*/
|
|
2384
|
+
|
|
2385
|
+
|
|
2386
|
+
var withDashboardViz = function withDashboardViz(opts) {
|
|
2387
|
+
var ReactViz = opts.ReactViz,
|
|
2388
|
+
vizConfig = opts.vizConfig,
|
|
2389
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
2390
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
2391
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
2392
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
2393
|
+
|
|
2394
|
+
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
2395
|
+
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
2396
|
+
|
|
2397
|
+
var DashboardViz = function DashboardViz(props) {
|
|
2398
|
+
var _a;
|
|
2399
|
+
|
|
2400
|
+
var mode = props.mode,
|
|
2401
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
2402
|
+
dataSources = props.dataSources,
|
|
2403
|
+
options = props.options,
|
|
2404
|
+
_props$context = props.context,
|
|
2405
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
2406
|
+
width = props.width,
|
|
2407
|
+
height = props.height,
|
|
2408
|
+
onComputedProps = props.onComputedProps,
|
|
2409
|
+
onEventTrigger = props.onEventTrigger,
|
|
2410
|
+
theme = props.theme,
|
|
2411
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
2412
|
+
|
|
2413
|
+
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
2414
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
2415
|
+
|
|
2416
|
+
if (serializedTimezone) {
|
|
2417
|
+
/*
|
|
2418
|
+
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
2419
|
+
This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
|
|
2420
|
+
will use it.
|
|
2421
|
+
@TODO(pwied):
|
|
2422
|
+
- remove when we moved away from @splunk/moment
|
|
2423
|
+
- provide timezone context to dynamic option evaluation phase
|
|
2424
|
+
*/
|
|
2425
|
+
if (!moment_1.default.getDefaultSplunkTimezone()) {
|
|
2426
|
+
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
var themeFunc = function themeFunc(themeVar) {
|
|
2431
|
+
var _a, _b;
|
|
2432
|
+
|
|
2433
|
+
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
2434
|
+
};
|
|
2435
|
+
|
|
2436
|
+
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
2437
|
+
|
|
2438
|
+
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
2439
|
+
theme: theme
|
|
2440
|
+
}),
|
|
2441
|
+
currentThemeFamily = _ref.family,
|
|
2442
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
2443
|
+
currentThemeDensity = _ref.density;
|
|
2444
|
+
|
|
2445
|
+
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
2446
|
+
|
|
2447
|
+
var _React$useState = React.useState({}),
|
|
2448
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2449
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
2450
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
2454
|
+
|
|
2455
|
+
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
2456
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
2457
|
+
visualizationID = _React$useState4[0];
|
|
2458
|
+
|
|
2459
|
+
var _React$useState5 = React.useState({}),
|
|
2460
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2461
|
+
dataSourcesInState = _React$useState6[0],
|
|
2462
|
+
setDataSourcesInState = _React$useState6[1];
|
|
2463
|
+
|
|
2464
|
+
var _React$useState7 = React.useState(),
|
|
2465
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
2466
|
+
dataFramesInState = _React$useState8[0],
|
|
2467
|
+
setDataFramesInState = _React$useState8[1];
|
|
2468
|
+
|
|
2469
|
+
var _React$useState9 = React.useState(Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_useWebWorkersForDSL'))),
|
|
2470
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
2471
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
2472
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
2473
|
+
|
|
2474
|
+
var isDownsamplingEnabledByFeatureFlag = Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_enableDownsampling);
|
|
2475
|
+
var isMounted = React.useRef(true);
|
|
2476
|
+
var optionsToEvaluate = React.useMemo(function () {
|
|
2477
|
+
return {
|
|
2478
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
2479
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
2480
|
+
};
|
|
2481
|
+
}, [options, context]);
|
|
2482
|
+
|
|
2483
|
+
var _React$useState11 = React.useState(Number(width)),
|
|
2484
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
2485
|
+
threshold = _React$useState12[0],
|
|
2486
|
+
setThreshold = _React$useState12[1];
|
|
2487
|
+
|
|
2488
|
+
var onDownsamplingThresholdChange = React.useCallback(function (newThreshold) {
|
|
2489
|
+
setThreshold(newThreshold);
|
|
2490
|
+
}, []);
|
|
2491
|
+
var isDownsamplingEnabled = React.useMemo(function () {
|
|
2492
|
+
return isDownsamplingEnabledByFeatureFlag && (0, dataUtils_1.isDownsamplingEnabledForViz)({
|
|
2493
|
+
vizConfig: vizConfig
|
|
2494
|
+
});
|
|
2495
|
+
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
2496
|
+
var downsamplingProps = React.useMemo(function () {
|
|
2497
|
+
if (!isDownsamplingEnabled) {
|
|
2498
|
+
return {};
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
return {
|
|
2502
|
+
onDownsamplingThresholdChange: onDownsamplingThresholdChange,
|
|
2503
|
+
originalDataSources: dataSources
|
|
2504
|
+
};
|
|
2505
|
+
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
2506
|
+
var downsampledDataSources = (0, useDownsampleDataSources_1.default)({
|
|
2507
|
+
options: optionsToEvaluate.options,
|
|
2508
|
+
context: optionsToEvaluate.context,
|
|
2509
|
+
dataSources: dataSources,
|
|
2510
|
+
threshold: threshold,
|
|
2511
|
+
isDownsamplingEnabled: isDownsamplingEnabled
|
|
2512
|
+
});
|
|
2513
|
+
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
2514
|
+
try {
|
|
2515
|
+
if (useAsyncEvaluatedOptions) {
|
|
2516
|
+
var asyncDynamicOptionsEvaluatorParams = {
|
|
2517
|
+
visualizationID: visualizationID,
|
|
2518
|
+
props: props,
|
|
2519
|
+
options: optionsToEvaluate,
|
|
2520
|
+
dataSources: downsampledDataSources,
|
|
2521
|
+
theme: vizConfig.themes,
|
|
2522
|
+
bypassCloneDeepOptionScope: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope')),
|
|
2523
|
+
lazyLoadingDataFrame: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'))
|
|
2524
|
+
};
|
|
2525
|
+
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
2526
|
+
setEvaluatedOptionsAsync(results.results);
|
|
2527
|
+
}).catch(function () {
|
|
2528
|
+
if (isMounted.current) {
|
|
2529
|
+
setUseAsyncEvaluatedOptions(false);
|
|
2530
|
+
}
|
|
2531
|
+
});
|
|
2532
|
+
} else {
|
|
2533
|
+
var dataFrames = dataFramesInState;
|
|
2534
|
+
|
|
2535
|
+
if (downsampledDataSources !== dataSourcesInState) {
|
|
2536
|
+
setDataSourcesInState(downsampledDataSources);
|
|
2537
|
+
dataFrames = Options_1.Options.dataFrameFromDataSource(downsampledDataSources, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'));
|
|
2538
|
+
setDataFramesInState(dataFrames);
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
var result = Options_1.Options.evaluate(optionsToEvaluate, downsampledDataSources, themeFunc, dataFrames, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope'));
|
|
2542
|
+
return result;
|
|
2543
|
+
}
|
|
2544
|
+
} catch (e) {
|
|
2545
|
+
// eslint-disable-next-line no-console
|
|
2546
|
+
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
2547
|
+
return {};
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
return {};
|
|
2551
|
+
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, optionsToEvaluate, downsampledDataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
2552
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
2553
|
+
// 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
|
|
2554
|
+
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
2555
|
+
|
|
2556
|
+
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
2557
|
+
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
2558
|
+
|
|
2559
|
+
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) {
|
|
2560
|
+
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
2561
|
+
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
2562
|
+
});
|
|
2563
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
2564
|
+
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
React.useEffect(function () {
|
|
2568
|
+
onComputedProps(clonedEvaluatedOptions);
|
|
2569
|
+
});
|
|
2570
|
+
React.useEffect(function () {
|
|
2571
|
+
return function () {
|
|
2572
|
+
if (useAsyncEvaluatedOptions) {
|
|
2573
|
+
isMounted.current = false;
|
|
2574
|
+
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
2575
|
+
}
|
|
2576
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2577
|
+
}, []); // present warning message if any required props are missing
|
|
2578
|
+
|
|
2579
|
+
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
2580
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
2581
|
+
supports = vizConfig.supports;
|
|
2582
|
+
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
2583
|
+
|
|
2584
|
+
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
|
|
2585
|
+
) {
|
|
2586
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
2587
|
+
"data-test": "missing-props-message",
|
|
2588
|
+
width: width,
|
|
2589
|
+
height: height,
|
|
2590
|
+
missingProps: missing,
|
|
2591
|
+
backgroundColor: bgColorFromTheme
|
|
2592
|
+
});
|
|
2593
|
+
} // events
|
|
2594
|
+
|
|
2595
|
+
|
|
2596
|
+
var eventCallbackProps = {};
|
|
2597
|
+
|
|
2598
|
+
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
2599
|
+
var supportedEvents = vizConfig.events;
|
|
2600
|
+
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
2601
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
2602
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
2603
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
2604
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
2605
|
+
// then remove these lines
|
|
2606
|
+
|
|
2607
|
+
var payload = {};
|
|
2608
|
+
|
|
2609
|
+
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
2610
|
+
payloadKeys.forEach(function (p) {
|
|
2611
|
+
payload[p] = evaluatedOptionsToUse[p];
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
2616
|
+
if (ev && ev.payload) {
|
|
2617
|
+
payload = ev.payload;
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
return onEventTrigger({
|
|
2621
|
+
originalEvent: ev,
|
|
2622
|
+
payload: payload,
|
|
2623
|
+
type: eventName
|
|
2624
|
+
});
|
|
2625
|
+
};
|
|
2626
|
+
|
|
2627
|
+
if (parentKeys) {
|
|
2628
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
2629
|
+
var newObject = {};
|
|
2630
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
2631
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
});
|
|
2635
|
+
} // compute pure viz props which are not from options
|
|
1477
2636
|
|
|
1478
2637
|
|
|
1479
2638
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
@@ -1531,7 +2690,7 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1531
2690
|
mode: mode,
|
|
1532
2691
|
width: width,
|
|
1533
2692
|
height: height
|
|
1534
|
-
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
2693
|
+
}, downsamplingProps, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1535
2694
|
};
|
|
1536
2695
|
|
|
1537
2696
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
@@ -1549,519 +2708,227 @@ exports.default = withDashboardViz;
|
|
|
1549
2708
|
|
|
1550
2709
|
/***/ }),
|
|
1551
2710
|
|
|
1552
|
-
/***/
|
|
2711
|
+
/***/ 57:
|
|
1553
2712
|
/***/ (function(module, exports) {
|
|
1554
2713
|
|
|
1555
2714
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1556
2715
|
|
|
1557
2716
|
/***/ }),
|
|
1558
2717
|
|
|
1559
|
-
/***/
|
|
2718
|
+
/***/ 58:
|
|
1560
2719
|
/***/ (function(module, exports) {
|
|
1561
2720
|
|
|
1562
2721
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1563
2722
|
|
|
1564
2723
|
/***/ }),
|
|
1565
2724
|
|
|
1566
|
-
/***/
|
|
1567
|
-
/***/ (function(module, exports) {
|
|
1568
|
-
|
|
1569
|
-
module.exports = require("styled-components");
|
|
1570
|
-
|
|
1571
|
-
/***/ }),
|
|
1572
|
-
|
|
1573
|
-
/***/ 40:
|
|
2725
|
+
/***/ 59:
|
|
1574
2726
|
/***/ (function(module, exports) {
|
|
1575
2727
|
|
|
1576
2728
|
module.exports = require("@splunk/moment");
|
|
1577
2729
|
|
|
1578
2730
|
/***/ }),
|
|
1579
2731
|
|
|
1580
|
-
/***/
|
|
1581
|
-
/***/ (function(module, exports) {
|
|
1582
|
-
|
|
1583
|
-
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1584
|
-
|
|
1585
|
-
/***/ }),
|
|
1586
|
-
|
|
1587
|
-
/***/ 42:
|
|
2732
|
+
/***/ 6:
|
|
1588
2733
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1589
2734
|
|
|
1590
2735
|
"use strict";
|
|
1591
2736
|
|
|
1592
2737
|
|
|
1593
|
-
var _classCallCheck = __webpack_require__(9);
|
|
1594
|
-
|
|
1595
2738
|
Object.defineProperty(exports, "__esModule", {
|
|
1596
2739
|
value: true
|
|
1597
2740
|
});
|
|
1598
|
-
exports.
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
var T = __webpack_require__(0);
|
|
1602
|
-
|
|
1603
|
-
var lodash_1 = __webpack_require__(3);
|
|
1604
|
-
|
|
1605
|
-
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
exports.INITIAL_WIDTH = 250;
|
|
1609
|
-
exports.INITIAL_HEIGHT = 250;
|
|
1610
|
-
/**
|
|
1611
|
-
* A Splunk visualization
|
|
1612
|
-
*/
|
|
1613
|
-
|
|
1614
|
-
var SplunkVisualization = function SplunkVisualization() {
|
|
1615
|
-
_classCallCheck(this, SplunkVisualization);
|
|
1616
|
-
};
|
|
1617
|
-
|
|
1618
|
-
SplunkVisualization.propTypes = {
|
|
1619
|
-
/**
|
|
1620
|
-
* display mode
|
|
1621
|
-
*/
|
|
1622
|
-
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1623
|
-
|
|
1624
|
-
/**
|
|
1625
|
-
* width in pixel or string, defaults to 100%
|
|
1626
|
-
*/
|
|
1627
|
-
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1628
|
-
|
|
1629
|
-
/**
|
|
1630
|
-
* height in pixel or string
|
|
1631
|
-
*/
|
|
1632
|
-
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1633
|
-
|
|
1634
|
-
/**
|
|
1635
|
-
* visualization context used for dynamic option evaluation
|
|
1636
|
-
*/
|
|
1637
|
-
context: T.object,
|
|
1638
|
-
|
|
1639
|
-
/**
|
|
1640
|
-
* visualization formatting options
|
|
1641
|
-
*/
|
|
1642
|
-
options: T.object,
|
|
1643
|
-
|
|
1644
|
-
/**
|
|
1645
|
-
* A callback to update formatting options
|
|
1646
|
-
*/
|
|
1647
|
-
onOptionsChange: T.func,
|
|
1648
|
-
|
|
1649
|
-
/**
|
|
1650
|
-
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1651
|
-
*/
|
|
1652
|
-
dataSources: T.objectOf(T.shape({
|
|
1653
|
-
/**
|
|
1654
|
-
* current request params
|
|
1655
|
-
*/
|
|
1656
|
-
requestParams: T.object,
|
|
1657
|
-
|
|
1658
|
-
/**
|
|
1659
|
-
* current dataset
|
|
1660
|
-
*/
|
|
1661
|
-
data: T.shape({
|
|
1662
|
-
fields: T.array,
|
|
1663
|
-
columns: T.array
|
|
1664
|
-
}),
|
|
1665
|
-
|
|
1666
|
-
/**
|
|
1667
|
-
* error
|
|
1668
|
-
*/
|
|
1669
|
-
error: T.shape({
|
|
1670
|
-
level: T.string,
|
|
1671
|
-
message: T.string
|
|
1672
|
-
}),
|
|
1673
|
-
|
|
1674
|
-
/**
|
|
1675
|
-
* meta data that came with the dataset
|
|
1676
|
-
*/
|
|
1677
|
-
meta: T.object
|
|
1678
|
-
})),
|
|
1679
|
-
|
|
1680
|
-
/**
|
|
1681
|
-
* A callback to trigger event
|
|
1682
|
-
*/
|
|
1683
|
-
onEventTrigger: T.func,
|
|
1684
|
-
|
|
1685
|
-
/**
|
|
1686
|
-
* Inform viz if there are handlers listening to events
|
|
1687
|
-
*/
|
|
1688
|
-
hasEventHandlers: T.bool,
|
|
1689
|
-
|
|
1690
|
-
/**
|
|
1691
|
-
* A callback to communicate computed props to a consumer
|
|
1692
|
-
*/
|
|
1693
|
-
onComputedProps: T.func,
|
|
1694
|
-
|
|
1695
|
-
/**
|
|
1696
|
-
* A callback to obtain visualization api
|
|
1697
|
-
*/
|
|
1698
|
-
vizActionHandlerRef: T.func,
|
|
1699
|
-
loading: T.bool,
|
|
1700
|
-
theme: T.object,
|
|
2741
|
+
exports.VizBehavior = void 0;
|
|
2742
|
+
var VizBehavior;
|
|
1701
2743
|
|
|
2744
|
+
(function (VizBehavior) {
|
|
1702
2745
|
/**
|
|
1703
|
-
*
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
options: {},
|
|
1722
|
-
context: {},
|
|
1723
|
-
onOptionsChange: function onOptionsChange() {
|
|
1724
|
-
return {};
|
|
1725
|
-
},
|
|
1726
|
-
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
1727
|
-
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
1728
|
-
},
|
|
1729
|
-
onComputedProps: function onComputedProps() {
|
|
1730
|
-
return {};
|
|
1731
|
-
},
|
|
1732
|
-
loading: false,
|
|
1733
|
-
onRequestParamsChange: lodash_1.noop
|
|
1734
|
-
};
|
|
1735
|
-
exports.default = SplunkVisualization;
|
|
1736
|
-
|
|
1737
|
-
/***/ }),
|
|
1738
|
-
|
|
1739
|
-
/***/ 423:
|
|
1740
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1741
|
-
|
|
1742
|
-
"use strict";
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1746
|
-
if (k2 === undefined) k2 = k;
|
|
1747
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1748
|
-
|
|
1749
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1750
|
-
desc = {
|
|
1751
|
-
enumerable: true,
|
|
1752
|
-
get: function get() {
|
|
1753
|
-
return m[k];
|
|
1754
|
-
}
|
|
1755
|
-
};
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
Object.defineProperty(o, k2, desc);
|
|
1759
|
-
} : function (o, m, k, k2) {
|
|
1760
|
-
if (k2 === undefined) k2 = k;
|
|
1761
|
-
o[k2] = m[k];
|
|
1762
|
-
});
|
|
1763
|
-
|
|
1764
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1765
|
-
for (var p in m) {
|
|
1766
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1767
|
-
}
|
|
1768
|
-
};
|
|
1769
|
-
|
|
1770
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1771
|
-
value: true
|
|
1772
|
-
});
|
|
1773
|
-
exports.default = void 0;
|
|
1774
|
-
|
|
1775
|
-
__exportStar(__webpack_require__(162), exports);
|
|
1776
|
-
|
|
1777
|
-
var Markdown_1 = __webpack_require__(162);
|
|
1778
|
-
|
|
1779
|
-
Object.defineProperty(exports, "default", {
|
|
1780
|
-
enumerable: true,
|
|
1781
|
-
get: function get() {
|
|
1782
|
-
return Markdown_1.default;
|
|
1783
|
-
}
|
|
1784
|
-
});
|
|
1785
|
-
|
|
1786
|
-
/***/ }),
|
|
1787
|
-
|
|
1788
|
-
/***/ 424:
|
|
1789
|
-
/***/ (function(module, exports) {
|
|
2746
|
+
* Dynamic Options Behavior.
|
|
2747
|
+
* This allows visualization options to be powered by data
|
|
2748
|
+
*
|
|
2749
|
+
* **Example**
|
|
2750
|
+
*
|
|
2751
|
+
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
2752
|
+
* would configure sparklineValues with an array of data points
|
|
2753
|
+
* coming from the first series in the primary datasource
|
|
2754
|
+
*
|
|
2755
|
+
*/
|
|
2756
|
+
VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
|
|
2757
|
+
VizBehavior["EVENTS"] = "events";
|
|
2758
|
+
VizBehavior["DOWNSAMPLING"] = "downsampling";
|
|
2759
|
+
/**
|
|
2760
|
+
* Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
|
|
2761
|
+
* missing.
|
|
2762
|
+
* @type {string}
|
|
2763
|
+
*/
|
|
1790
2764
|
|
|
1791
|
-
|
|
2765
|
+
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
2766
|
+
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
2767
|
+
VizBehavior["TRELLIS"] = "trellis";
|
|
2768
|
+
})(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
|
|
1792
2769
|
|
|
1793
2770
|
/***/ }),
|
|
1794
2771
|
|
|
1795
|
-
/***/
|
|
2772
|
+
/***/ 60:
|
|
1796
2773
|
/***/ (function(module, exports) {
|
|
1797
2774
|
|
|
1798
|
-
module.exports = require("@splunk/
|
|
2775
|
+
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1799
2776
|
|
|
1800
2777
|
/***/ }),
|
|
1801
2778
|
|
|
1802
|
-
/***/
|
|
2779
|
+
/***/ 61:
|
|
1803
2780
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1804
2781
|
|
|
1805
2782
|
"use strict";
|
|
1806
2783
|
|
|
1807
2784
|
|
|
1808
|
-
var
|
|
2785
|
+
var _classCallCheck = __webpack_require__(10);
|
|
1809
2786
|
|
|
1810
2787
|
Object.defineProperty(exports, "__esModule", {
|
|
1811
2788
|
value: true
|
|
1812
2789
|
});
|
|
2790
|
+
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
2791
|
+
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1813
2792
|
|
|
1814
|
-
var
|
|
2793
|
+
var T = __webpack_require__(1);
|
|
1815
2794
|
|
|
1816
|
-
var
|
|
2795
|
+
var lodash_1 = __webpack_require__(3);
|
|
1817
2796
|
|
|
1818
|
-
var
|
|
2797
|
+
var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1819
2798
|
|
|
1820
|
-
var VizBehavior_1 = __webpack_require__(6);
|
|
1821
2799
|
|
|
1822
|
-
|
|
2800
|
+
exports.INITIAL_WIDTH = 250;
|
|
2801
|
+
exports.INITIAL_HEIGHT = 250;
|
|
2802
|
+
/**
|
|
2803
|
+
* A Splunk visualization
|
|
2804
|
+
*/
|
|
1823
2805
|
|
|
1824
|
-
var
|
|
2806
|
+
var SplunkVisualization = function SplunkVisualization() {
|
|
2807
|
+
_classCallCheck(this, SplunkVisualization);
|
|
2808
|
+
};
|
|
1825
2809
|
|
|
1826
|
-
|
|
2810
|
+
SplunkVisualization.propTypes = {
|
|
2811
|
+
/**
|
|
2812
|
+
* display mode
|
|
2813
|
+
*/
|
|
2814
|
+
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1827
2815
|
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
],
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
},
|
|
1883
|
-
rotation: {
|
|
1884
|
-
description: 'Specify the angle of rotation of the markdown content in degrees.',
|
|
1885
|
-
type: 'number',
|
|
1886
|
-
default: 0
|
|
1887
|
-
}
|
|
1888
|
-
};
|
|
1889
|
-
var themes = {
|
|
1890
|
-
defaultFontColor: function defaultFontColor(props) {
|
|
1891
|
-
return (0, themes_1.pick)({
|
|
1892
|
-
enterprise: {
|
|
1893
|
-
dark: themes_1.variables.textColor(props),
|
|
1894
|
-
light: themes_1.variables.textColor(props)
|
|
1895
|
-
},
|
|
1896
|
-
prisma: themes_1.variables.contentColorDefault(props)
|
|
1897
|
-
})(props);
|
|
1898
|
-
}
|
|
1899
|
-
};
|
|
1900
|
-
var editorConfig = [{
|
|
1901
|
-
label: (0, i18n_1._)('Color and style'),
|
|
1902
|
-
layout: [[{
|
|
1903
|
-
label: (0, i18n_1._)('Font'),
|
|
1904
|
-
option: 'fontColor',
|
|
1905
|
-
editor: 'editor.color',
|
|
1906
|
-
editorProps: {
|
|
1907
|
-
labelPosition: 'top',
|
|
1908
|
-
themes: themes
|
|
1909
|
-
}
|
|
1910
|
-
}].concat(_toConsumableArray((0, BackgroundColor_1.default)({
|
|
1911
|
-
label: 'Background',
|
|
1912
|
-
themes: themes
|
|
1913
|
-
}))), [{
|
|
1914
|
-
label: (0, i18n_1._)('Font family'),
|
|
1915
|
-
option: 'fontFamily',
|
|
1916
|
-
editor: 'editor.select',
|
|
1917
|
-
editorProps: {
|
|
1918
|
-
values: [{
|
|
1919
|
-
value: 'Splunk Platform Sans'
|
|
1920
|
-
}, {
|
|
1921
|
-
value: 'Splunk Data Sans'
|
|
1922
|
-
}, {
|
|
1923
|
-
value: 'Splunk Platform Mono'
|
|
1924
|
-
}, {
|
|
1925
|
-
value: 'Arial'
|
|
1926
|
-
}, {
|
|
1927
|
-
value: 'Helvetica'
|
|
1928
|
-
}, {
|
|
1929
|
-
value: 'Times New Roman'
|
|
1930
|
-
}, {
|
|
1931
|
-
value: 'Comic Sans MS'
|
|
1932
|
-
}]
|
|
1933
|
-
}
|
|
1934
|
-
}], [{
|
|
1935
|
-
label: (0, i18n_1._)('Font size'),
|
|
1936
|
-
option: 'fontSize',
|
|
1937
|
-
editor: 'editor.select',
|
|
1938
|
-
editorProps: {
|
|
1939
|
-
values: [{
|
|
1940
|
-
label: (0, i18n_1._)('Extra Small'),
|
|
1941
|
-
value: 'extraSmall'
|
|
1942
|
-
}, {
|
|
1943
|
-
label: (0, i18n_1._)('Small'),
|
|
1944
|
-
value: 'small'
|
|
1945
|
-
}, {
|
|
1946
|
-
label: (0, i18n_1._)('Default'),
|
|
1947
|
-
value: 'default'
|
|
1948
|
-
}, {
|
|
1949
|
-
label: (0, i18n_1._)('Large'),
|
|
1950
|
-
value: 'large'
|
|
1951
|
-
}, {
|
|
1952
|
-
label: (0, i18n_1._)('Extra Large'),
|
|
1953
|
-
value: 'extraLarge'
|
|
1954
|
-
}, {
|
|
1955
|
-
label: (0, i18n_1._)('Custom'),
|
|
1956
|
-
value: 'custom'
|
|
1957
|
-
}]
|
|
1958
|
-
}
|
|
1959
|
-
}, {
|
|
1960
|
-
label: (0, i18n_1._)('Custom font size (px)'),
|
|
1961
|
-
option: 'customFontSize',
|
|
1962
|
-
editor: 'editor.number',
|
|
1963
|
-
editorProps: {
|
|
1964
|
-
min: 0,
|
|
1965
|
-
labelPosition: 'top'
|
|
1966
|
-
},
|
|
1967
|
-
showEditor: function showEditor(_ref) {
|
|
1968
|
-
var options = _ref.options;
|
|
1969
|
-
return options.fontSize && !FONT_OPTIONS.has(options.fontSize);
|
|
1970
|
-
}
|
|
1971
|
-
}], [{
|
|
1972
|
-
label: (0, i18n_1._)('Rotation (degrees)'),
|
|
1973
|
-
option: 'rotation',
|
|
1974
|
-
editor: 'editor.number',
|
|
1975
|
-
editorProps: {
|
|
1976
|
-
min: -360,
|
|
1977
|
-
max: 360
|
|
1978
|
-
}
|
|
1979
|
-
}]]
|
|
1980
|
-
}, {
|
|
1981
|
-
label: (0, i18n_1._)('Markdown content'),
|
|
1982
|
-
open: true,
|
|
1983
|
-
layout: [[{
|
|
1984
|
-
label: '',
|
|
1985
|
-
option: 'markdown',
|
|
1986
|
-
editor: 'editor.markdown'
|
|
1987
|
-
}]]
|
|
1988
|
-
}];
|
|
1989
|
-
/**
|
|
1990
|
-
* visualization configuration
|
|
1991
|
-
*/
|
|
2816
|
+
/**
|
|
2817
|
+
* width in pixel or string, defaults to 100%
|
|
2818
|
+
*/
|
|
2819
|
+
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
2820
|
+
|
|
2821
|
+
/**
|
|
2822
|
+
* height in pixel or string
|
|
2823
|
+
*/
|
|
2824
|
+
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
2825
|
+
|
|
2826
|
+
/**
|
|
2827
|
+
* visualization context used for dynamic option evaluation
|
|
2828
|
+
*/
|
|
2829
|
+
context: T.object,
|
|
2830
|
+
|
|
2831
|
+
/**
|
|
2832
|
+
* visualization formatting options
|
|
2833
|
+
*/
|
|
2834
|
+
options: T.object,
|
|
2835
|
+
|
|
2836
|
+
/**
|
|
2837
|
+
* A callback to update formatting options
|
|
2838
|
+
*/
|
|
2839
|
+
onOptionsChange: T.func,
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* datasource state which include data and request params, object key indicate the datasource type.
|
|
2843
|
+
*/
|
|
2844
|
+
dataSources: T.objectOf(T.shape({
|
|
2845
|
+
/**
|
|
2846
|
+
* current request params
|
|
2847
|
+
*/
|
|
2848
|
+
requestParams: T.object,
|
|
2849
|
+
|
|
2850
|
+
/**
|
|
2851
|
+
* current dataset
|
|
2852
|
+
*/
|
|
2853
|
+
data: T.shape({
|
|
2854
|
+
fields: T.array,
|
|
2855
|
+
columns: T.array
|
|
2856
|
+
}),
|
|
2857
|
+
|
|
2858
|
+
/**
|
|
2859
|
+
* error
|
|
2860
|
+
*/
|
|
2861
|
+
error: T.shape({
|
|
2862
|
+
level: T.string,
|
|
2863
|
+
message: T.string
|
|
2864
|
+
}),
|
|
2865
|
+
|
|
2866
|
+
/**
|
|
2867
|
+
* meta data that came with the dataset
|
|
2868
|
+
*/
|
|
2869
|
+
meta: T.object
|
|
2870
|
+
})),
|
|
1992
2871
|
|
|
1993
|
-
var config = {
|
|
1994
2872
|
/**
|
|
1995
|
-
*
|
|
2873
|
+
* A callback to trigger event
|
|
1996
2874
|
*/
|
|
1997
|
-
|
|
2875
|
+
onEventTrigger: T.func,
|
|
1998
2876
|
|
|
1999
2877
|
/**
|
|
2000
|
-
* viz
|
|
2878
|
+
* Inform viz if there are handlers listening to events
|
|
2001
2879
|
*/
|
|
2002
|
-
|
|
2003
|
-
category: VizCategory_1.VizCategory.COMPARISONS,
|
|
2880
|
+
hasEventHandlers: T.bool,
|
|
2004
2881
|
|
|
2005
2882
|
/**
|
|
2006
|
-
*
|
|
2883
|
+
* A callback to communicate computed props to a consumer
|
|
2007
2884
|
*/
|
|
2008
|
-
|
|
2009
|
-
dataContract: dataContract,
|
|
2010
|
-
size: size,
|
|
2011
|
-
defaultContext: defaultContext,
|
|
2012
|
-
optionsSchema: optionsSchema,
|
|
2013
|
-
editorConfig: editorConfig,
|
|
2014
|
-
events: {
|
|
2015
|
-
'markdown.click': {
|
|
2016
|
-
description: 'triggered when user clicks on markdown area not formatted as a link'
|
|
2017
|
-
}
|
|
2018
|
-
},
|
|
2019
|
-
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS],
|
|
2020
|
-
themes: themes
|
|
2021
|
-
};
|
|
2022
|
-
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
2023
|
-
|
|
2024
|
-
/***/ }),
|
|
2025
|
-
|
|
2026
|
-
/***/ 43:
|
|
2027
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2028
|
-
|
|
2029
|
-
"use strict";
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
var _classCallCheck = __webpack_require__(9);
|
|
2033
|
-
|
|
2034
|
-
var _createClass = __webpack_require__(18);
|
|
2035
|
-
|
|
2036
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2037
|
-
value: true
|
|
2038
|
-
});
|
|
2039
|
-
exports.DefaultVizActionHandler = void 0;
|
|
2040
|
-
|
|
2041
|
-
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
2042
|
-
function DefaultVizActionHandler() {
|
|
2043
|
-
_classCallCheck(this, DefaultVizActionHandler);
|
|
2044
|
-
}
|
|
2885
|
+
onComputedProps: T.func,
|
|
2045
2886
|
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
value: function snapshot() {
|
|
2053
|
-
return null; // noop
|
|
2054
|
-
}
|
|
2055
|
-
}]);
|
|
2887
|
+
/**
|
|
2888
|
+
* A callback to obtain visualization api
|
|
2889
|
+
*/
|
|
2890
|
+
vizActionHandlerRef: T.func,
|
|
2891
|
+
loading: T.bool,
|
|
2892
|
+
theme: T.object,
|
|
2056
2893
|
|
|
2057
|
-
|
|
2058
|
-
|
|
2894
|
+
/**
|
|
2895
|
+
* A callback to request new data with updated request params
|
|
2896
|
+
*/
|
|
2897
|
+
onRequestParamsChange: T.func
|
|
2898
|
+
};
|
|
2899
|
+
/**
|
|
2900
|
+
*
|
|
2901
|
+
*/
|
|
2059
2902
|
|
|
2060
|
-
|
|
2903
|
+
SplunkVisualization.defaultProps = {
|
|
2904
|
+
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
2905
|
+
width: '100%',
|
|
2906
|
+
height: exports.INITIAL_HEIGHT,
|
|
2907
|
+
dataSources: {},
|
|
2908
|
+
onEventTrigger: function onEventTrigger() {
|
|
2909
|
+
return {};
|
|
2910
|
+
},
|
|
2911
|
+
mode: 'view',
|
|
2912
|
+
hasEventHandlers: false,
|
|
2913
|
+
options: {},
|
|
2914
|
+
context: {},
|
|
2915
|
+
onOptionsChange: function onOptionsChange() {
|
|
2916
|
+
return {};
|
|
2917
|
+
},
|
|
2918
|
+
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
2919
|
+
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
2920
|
+
},
|
|
2921
|
+
onComputedProps: function onComputedProps() {
|
|
2922
|
+
return {};
|
|
2923
|
+
},
|
|
2924
|
+
loading: false,
|
|
2925
|
+
onRequestParamsChange: lodash_1.noop
|
|
2926
|
+
};
|
|
2927
|
+
exports.default = SplunkVisualization;
|
|
2061
2928
|
|
|
2062
2929
|
/***/ }),
|
|
2063
2930
|
|
|
2064
|
-
/***/
|
|
2931
|
+
/***/ 62:
|
|
2065
2932
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2066
2933
|
|
|
2067
2934
|
"use strict";
|
|
@@ -2072,7 +2939,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2072
2939
|
});
|
|
2073
2940
|
exports.useDeepMemo = void 0;
|
|
2074
2941
|
|
|
2075
|
-
var react_1 = __webpack_require__(
|
|
2942
|
+
var react_1 = __webpack_require__(0);
|
|
2076
2943
|
|
|
2077
2944
|
var lodash_1 = __webpack_require__(3);
|
|
2078
2945
|
/**
|
|
@@ -2107,7 +2974,7 @@ exports.useDeepMemo = useDeepMemo;
|
|
|
2107
2974
|
|
|
2108
2975
|
/***/ }),
|
|
2109
2976
|
|
|
2110
|
-
/***/
|
|
2977
|
+
/***/ 63:
|
|
2111
2978
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2112
2979
|
|
|
2113
2980
|
"use strict";
|
|
@@ -2118,15 +2985,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2118
2985
|
});
|
|
2119
2986
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2120
2987
|
|
|
2121
|
-
var React = __webpack_require__(
|
|
2988
|
+
var React = __webpack_require__(0);
|
|
2122
2989
|
|
|
2123
|
-
var T = __webpack_require__(
|
|
2990
|
+
var T = __webpack_require__(1);
|
|
2124
2991
|
|
|
2125
2992
|
var i18n_1 = __webpack_require__(2);
|
|
2126
2993
|
|
|
2127
|
-
var Message_1 = __webpack_require__(
|
|
2994
|
+
var Message_1 = __webpack_require__(12);
|
|
2128
2995
|
|
|
2129
|
-
var FixedSizeContainer_1 = __webpack_require__(
|
|
2996
|
+
var FixedSizeContainer_1 = __webpack_require__(17);
|
|
2130
2997
|
/**
|
|
2131
2998
|
* @method isMissing
|
|
2132
2999
|
* @param {any} v
|
|
@@ -2188,7 +3055,7 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
2188
3055
|
|
|
2189
3056
|
/***/ }),
|
|
2190
3057
|
|
|
2191
|
-
/***/
|
|
3058
|
+
/***/ 64:
|
|
2192
3059
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2193
3060
|
|
|
2194
3061
|
"use strict";
|
|
@@ -2198,18 +3065,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2198
3065
|
value: true
|
|
2199
3066
|
});
|
|
2200
3067
|
|
|
2201
|
-
var React = __webpack_require__(
|
|
3068
|
+
var React = __webpack_require__(0);
|
|
2202
3069
|
|
|
2203
3070
|
var styled_components_1 = __webpack_require__(4);
|
|
2204
3071
|
|
|
2205
|
-
var hocUtils_1 = __webpack_require__(
|
|
3072
|
+
var hocUtils_1 = __webpack_require__(23);
|
|
2206
3073
|
|
|
2207
3074
|
var Cover = styled_components_1.default.div.withConfig({
|
|
2208
3075
|
displayName: "withEditModeCover__Cover",
|
|
2209
3076
|
componentId: "sc-1gsbnxb-0"
|
|
2210
3077
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
2211
3078
|
var Blocker = styled_components_1.default.div.attrs({
|
|
2212
|
-
'data-splunk-visualization-version': "26.
|
|
3079
|
+
'data-splunk-visualization-version': "26.2.0 - 49b909915"
|
|
2213
3080
|
}).withConfig({
|
|
2214
3081
|
displayName: "withEditModeCover__Blocker",
|
|
2215
3082
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -2241,7 +3108,7 @@ exports.default = withEditModeCover;
|
|
|
2241
3108
|
|
|
2242
3109
|
/***/ }),
|
|
2243
3110
|
|
|
2244
|
-
/***/
|
|
3111
|
+
/***/ 65:
|
|
2245
3112
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2246
3113
|
|
|
2247
3114
|
"use strict";
|
|
@@ -2251,17 +3118,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2251
3118
|
value: true
|
|
2252
3119
|
});
|
|
2253
3120
|
|
|
2254
|
-
var React = __webpack_require__(
|
|
3121
|
+
var React = __webpack_require__(0);
|
|
2255
3122
|
|
|
2256
|
-
var colorUtils_1 = __webpack_require__(
|
|
3123
|
+
var colorUtils_1 = __webpack_require__(15);
|
|
2257
3124
|
|
|
2258
|
-
var variables_1 = __webpack_require__(
|
|
3125
|
+
var variables_1 = __webpack_require__(13);
|
|
2259
3126
|
|
|
2260
|
-
var IconPlaceholder_1 = __webpack_require__(
|
|
3127
|
+
var IconPlaceholder_1 = __webpack_require__(37);
|
|
2261
3128
|
|
|
2262
3129
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2263
3130
|
|
|
2264
|
-
var hocUtils_1 = __webpack_require__(
|
|
3131
|
+
var hocUtils_1 = __webpack_require__(23);
|
|
2265
3132
|
|
|
2266
3133
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
2267
3134
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
@@ -2306,45 +3173,212 @@ exports.default = withPlaceholder;
|
|
|
2306
3173
|
|
|
2307
3174
|
/***/ }),
|
|
2308
3175
|
|
|
2309
|
-
/***/
|
|
3176
|
+
/***/ 66:
|
|
2310
3177
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2311
3178
|
|
|
2312
3179
|
"use strict";
|
|
2313
3180
|
|
|
2314
3181
|
|
|
3182
|
+
var _slicedToArray = __webpack_require__(7);
|
|
3183
|
+
|
|
2315
3184
|
Object.defineProperty(exports, "__esModule", {
|
|
2316
3185
|
value: true
|
|
2317
3186
|
});
|
|
2318
3187
|
|
|
2319
|
-
var
|
|
3188
|
+
var react_1 = __webpack_require__(0);
|
|
2320
3189
|
|
|
2321
|
-
var
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
3190
|
+
var lodash_1 = __webpack_require__(3);
|
|
3191
|
+
|
|
3192
|
+
var dataUtils_1 = __webpack_require__(14);
|
|
3193
|
+
|
|
3194
|
+
var usePrevious_1 = __webpack_require__(33);
|
|
3195
|
+
|
|
3196
|
+
var useGetXAndYFields_1 = __webpack_require__(67);
|
|
3197
|
+
|
|
3198
|
+
var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
|
|
3199
|
+
var dataSources = _ref.dataSources,
|
|
3200
|
+
options = _ref.options,
|
|
3201
|
+
context = _ref.context,
|
|
3202
|
+
threshold = _ref.threshold,
|
|
3203
|
+
isDownsamplingEnabled = _ref.isDownsamplingEnabled;
|
|
3204
|
+
var isFirstUseEffectCall = (0, react_1.useRef)(true);
|
|
3205
|
+
var xAndYFieldsWithTypes = (0, useGetXAndYFields_1.default)({
|
|
3206
|
+
shouldEvaluateDSL: isDownsamplingEnabled,
|
|
3207
|
+
options: options,
|
|
3208
|
+
context: context,
|
|
3209
|
+
dataSources: dataSources
|
|
3210
|
+
});
|
|
3211
|
+
var previousXAndYFieldsWithTypes = (0, usePrevious_1.default)(xAndYFieldsWithTypes);
|
|
3212
|
+
var previousDataSources = (0, usePrevious_1.default)(dataSources);
|
|
3213
|
+
var previousThreshold = (0, usePrevious_1.default)(threshold);
|
|
3214
|
+
|
|
3215
|
+
var _ref2 = (0, react_1.useState)(function () {
|
|
3216
|
+
return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
|
|
3217
|
+
dataSources: dataSources,
|
|
3218
|
+
threshold: threshold,
|
|
3219
|
+
options: xAndYFieldsWithTypes
|
|
3220
|
+
}) : dataSources;
|
|
3221
|
+
}),
|
|
3222
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
3223
|
+
downsampledDataSources = _ref3[0],
|
|
3224
|
+
setDownsampledDataSources = _ref3[1];
|
|
3225
|
+
|
|
3226
|
+
var debouncedDownsampleDataSources = (0, react_1.useMemo)(function () {
|
|
3227
|
+
return (0, lodash_1.debounce)(function (downsampleOptions) {
|
|
3228
|
+
var downsampledResult = (0, dataUtils_1.downsampleDataSources)(downsampleOptions);
|
|
3229
|
+
setDownsampledDataSources(downsampledResult);
|
|
3230
|
+
}, 100, {
|
|
3231
|
+
trailing: true
|
|
3232
|
+
});
|
|
3233
|
+
}, []);
|
|
3234
|
+
(0, react_1.useEffect)(function () {
|
|
3235
|
+
// don't downsample again on the use effect call that happened due to the initial render
|
|
3236
|
+
// this is since we already downsampled as part of the useState call
|
|
3237
|
+
if (isFirstUseEffectCall.current) {
|
|
3238
|
+
isFirstUseEffectCall.current = false;
|
|
3239
|
+
return;
|
|
2332
3240
|
}
|
|
2333
|
-
|
|
3241
|
+
|
|
3242
|
+
if (!isDownsamplingEnabled) {
|
|
3243
|
+
setDownsampledDataSources(dataSources);
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
if ((0, lodash_1.isEqual)(previousXAndYFieldsWithTypes, xAndYFieldsWithTypes) && previousDataSources === dataSources && previousThreshold === threshold) {
|
|
3248
|
+
return;
|
|
3249
|
+
} // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
|
|
3250
|
+
// while the viz is being resized
|
|
3251
|
+
|
|
3252
|
+
|
|
3253
|
+
debouncedDownsampleDataSources({
|
|
3254
|
+
dataSources: dataSources,
|
|
3255
|
+
options: xAndYFieldsWithTypes,
|
|
3256
|
+
threshold: threshold
|
|
3257
|
+
}); // need to detect if this runs as part of the initial render
|
|
3258
|
+
}, [dataSources, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousXAndYFieldsWithTypes, previousDataSources, previousThreshold]);
|
|
3259
|
+
return downsampledDataSources;
|
|
2334
3260
|
};
|
|
2335
3261
|
|
|
2336
|
-
exports.default =
|
|
3262
|
+
exports.default = useDownsampleDataSources;
|
|
2337
3263
|
|
|
2338
3264
|
/***/ }),
|
|
2339
3265
|
|
|
2340
|
-
/***/
|
|
2341
|
-
/***/ (function(module, exports) {
|
|
3266
|
+
/***/ 67:
|
|
3267
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2342
3268
|
|
|
2343
|
-
|
|
3269
|
+
"use strict";
|
|
3270
|
+
|
|
3271
|
+
|
|
3272
|
+
var _toConsumableArray = __webpack_require__(8);
|
|
3273
|
+
|
|
3274
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3275
|
+
value: true
|
|
3276
|
+
});
|
|
3277
|
+
|
|
3278
|
+
var react_1 = __webpack_require__(0);
|
|
3279
|
+
|
|
3280
|
+
var Options_1 = __webpack_require__(16);
|
|
3281
|
+
/**
|
|
3282
|
+
* Hook that evaluates the DSL for subset of a viz's options needed to determine
|
|
3283
|
+
* its x and y fields as well as the types of all its fields.
|
|
3284
|
+
*/
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
var useGetXAndYFields = function useGetXAndYFields(_ref) {
|
|
3288
|
+
var shouldEvaluateDSL = _ref.shouldEvaluateDSL,
|
|
3289
|
+
options = _ref.options,
|
|
3290
|
+
context = _ref.context,
|
|
3291
|
+
dataSources = _ref.dataSources;
|
|
3292
|
+
|
|
3293
|
+
var _ref2 = (0, react_1.useMemo)(function () {
|
|
3294
|
+
var _a, _b, _c;
|
|
3295
|
+
|
|
3296
|
+
if (!shouldEvaluateDSL) {
|
|
3297
|
+
return {
|
|
3298
|
+
dataSourcesWithOnlyOnePoint: null,
|
|
3299
|
+
dataFrameWithOnlyOnePoint: null
|
|
3300
|
+
};
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
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)) {
|
|
3304
|
+
return {
|
|
3305
|
+
dataSourcesWithOnlyOnePoint: null,
|
|
3306
|
+
dataFrameWithOnlyOnePoint: null
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
var primaryDS = dataSources.primary;
|
|
3311
|
+
var columnsWithOnlyOnePoint = primaryDS.data.columns.map(function (column) {
|
|
3312
|
+
return [column[0]];
|
|
3313
|
+
});
|
|
3314
|
+
var filteredDataSources = {
|
|
3315
|
+
primary: Object.assign(Object.assign({}, primaryDS), {
|
|
3316
|
+
data: Object.assign(Object.assign({}, primaryDS.data), {
|
|
3317
|
+
columns: columnsWithOnlyOnePoint
|
|
3318
|
+
})
|
|
3319
|
+
})
|
|
3320
|
+
};
|
|
3321
|
+
return {
|
|
3322
|
+
dataSourcesWithOnlyOnePoint: filteredDataSources,
|
|
3323
|
+
dataFrameWithOnlyOnePoint: Options_1.Options.dataFrameFromDataSource(filteredDataSources)
|
|
3324
|
+
};
|
|
3325
|
+
}, [dataSources, shouldEvaluateDSL]),
|
|
3326
|
+
dataSourcesWithOnlyOnePoint = _ref2.dataSourcesWithOnlyOnePoint,
|
|
3327
|
+
dataFrameWithOnlyOnePoint = _ref2.dataFrameWithOnlyOnePoint;
|
|
3328
|
+
|
|
3329
|
+
var xAndYFieldsWithTypes = (0, react_1.useMemo)(function () {
|
|
3330
|
+
try {
|
|
3331
|
+
if (!dataSourcesWithOnlyOnePoint || !dataFrameWithOnlyOnePoint) {
|
|
3332
|
+
return options;
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3335
|
+
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)) {
|
|
3336
|
+
return options;
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
var optionsToEvaluate = {
|
|
3340
|
+
x: options.x,
|
|
3341
|
+
xField: '> x | getField()',
|
|
3342
|
+
y: options.y,
|
|
3343
|
+
yFields: options.y ? '> y | getField()' : undefined,
|
|
3344
|
+
y2: options.y2,
|
|
3345
|
+
y2Fields: options.y2 ? '> y2 | getField()' : undefined,
|
|
3346
|
+
fieldTypes: '> primary | getType()'
|
|
3347
|
+
};
|
|
3348
|
+
|
|
3349
|
+
var _Options_1$Options$ev = Options_1.Options.evaluate({
|
|
3350
|
+
options: optionsToEvaluate,
|
|
3351
|
+
context: context
|
|
3352
|
+
}, dataSourcesWithOnlyOnePoint, function () {}, dataFrameWithOnlyOnePoint),
|
|
3353
|
+
_Options_1$Options$ev2 = _Options_1$Options$ev.xField,
|
|
3354
|
+
xField = _Options_1$Options$ev2 === void 0 ? '' : _Options_1$Options$ev2,
|
|
3355
|
+
_Options_1$Options$ev3 = _Options_1$Options$ev.yFields,
|
|
3356
|
+
yFields = _Options_1$Options$ev3 === void 0 ? [] : _Options_1$Options$ev3,
|
|
3357
|
+
_Options_1$Options$ev4 = _Options_1$Options$ev.y2Fields,
|
|
3358
|
+
y2Fields = _Options_1$Options$ev4 === void 0 ? [] : _Options_1$Options$ev4,
|
|
3359
|
+
fieldTypes = _Options_1$Options$ev.fieldTypes;
|
|
3360
|
+
|
|
3361
|
+
return {
|
|
3362
|
+
xField: xField,
|
|
3363
|
+
yFields: [].concat(_toConsumableArray(yFields), _toConsumableArray(y2Fields)),
|
|
3364
|
+
fieldTypes: fieldTypes
|
|
3365
|
+
};
|
|
3366
|
+
} catch (e) {
|
|
3367
|
+
return {
|
|
3368
|
+
xField: undefined,
|
|
3369
|
+
yFields: [],
|
|
3370
|
+
fieldTypes: []
|
|
3371
|
+
};
|
|
3372
|
+
}
|
|
3373
|
+
}, [options, context, dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint]);
|
|
3374
|
+
return xAndYFieldsWithTypes;
|
|
3375
|
+
};
|
|
3376
|
+
|
|
3377
|
+
exports.default = useGetXAndYFields;
|
|
2344
3378
|
|
|
2345
3379
|
/***/ }),
|
|
2346
3380
|
|
|
2347
|
-
/***/
|
|
3381
|
+
/***/ 68:
|
|
2348
3382
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2349
3383
|
|
|
2350
3384
|
"use strict";
|
|
@@ -2353,47 +3387,75 @@ module.exports = require("@babel/runtime/helpers/taggedTemplateLiteral");
|
|
|
2353
3387
|
Object.defineProperty(exports, "__esModule", {
|
|
2354
3388
|
value: true
|
|
2355
3389
|
});
|
|
2356
|
-
exports.
|
|
2357
|
-
var VizBehavior;
|
|
3390
|
+
exports.getFeatureFlag = void 0;
|
|
2358
3391
|
|
|
2359
|
-
|
|
2360
|
-
/**
|
|
2361
|
-
* Dynamic Options Behavior.
|
|
2362
|
-
* This allows visualization options to be powered by data
|
|
2363
|
-
*
|
|
2364
|
-
* **Example**
|
|
2365
|
-
*
|
|
2366
|
-
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
2367
|
-
* would configure sparklineValues with an array of data points
|
|
2368
|
-
* coming from the first series in the primary datasource
|
|
2369
|
-
*
|
|
2370
|
-
*/
|
|
2371
|
-
VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
|
|
2372
|
-
VizBehavior["EVENTS"] = "events";
|
|
2373
|
-
/**
|
|
2374
|
-
* Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
|
|
2375
|
-
* missing.
|
|
2376
|
-
* @type {string}
|
|
2377
|
-
*/
|
|
3392
|
+
var FeatureFlags_1 = __webpack_require__(69);
|
|
2378
3393
|
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
3394
|
+
var getFeatureFlag = function getFeatureFlag(context, flagName) {
|
|
3395
|
+
// look for feature flag in context first
|
|
3396
|
+
if (context && Object.keys(context).find(function (key) {
|
|
3397
|
+
return key === flagName;
|
|
3398
|
+
})) {
|
|
3399
|
+
return context[flagName];
|
|
3400
|
+
} // fall back to defaults
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
if (Object.keys(FeatureFlags_1.default).find(function (key) {
|
|
3404
|
+
return key === flagName;
|
|
3405
|
+
})) {
|
|
3406
|
+
return FeatureFlags_1.default[flagName];
|
|
3407
|
+
} // fall back to false
|
|
3408
|
+
|
|
3409
|
+
|
|
3410
|
+
return false;
|
|
3411
|
+
};
|
|
3412
|
+
|
|
3413
|
+
exports.getFeatureFlag = getFeatureFlag;
|
|
2383
3414
|
|
|
2384
3415
|
/***/ }),
|
|
2385
3416
|
|
|
2386
|
-
/***/
|
|
3417
|
+
/***/ 69:
|
|
2387
3418
|
/***/ (function(module, exports) {
|
|
2388
3419
|
|
|
2389
|
-
module.exports = require("@splunk/
|
|
3420
|
+
module.exports = require("@splunk/visualization-context/FeatureFlags");
|
|
2390
3421
|
|
|
2391
3422
|
/***/ }),
|
|
2392
3423
|
|
|
2393
3424
|
/***/ 7:
|
|
2394
3425
|
/***/ (function(module, exports) {
|
|
2395
3426
|
|
|
2396
|
-
module.exports = require("@babel/runtime/helpers/
|
|
3427
|
+
module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
3428
|
+
|
|
3429
|
+
/***/ }),
|
|
3430
|
+
|
|
3431
|
+
/***/ 75:
|
|
3432
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3433
|
+
|
|
3434
|
+
"use strict";
|
|
3435
|
+
|
|
3436
|
+
|
|
3437
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3438
|
+
value: true
|
|
3439
|
+
});
|
|
3440
|
+
|
|
3441
|
+
var i18n_1 = __webpack_require__(2);
|
|
3442
|
+
|
|
3443
|
+
var background = function background(_ref) {
|
|
3444
|
+
var label = _ref.label,
|
|
3445
|
+
themes = _ref.themes,
|
|
3446
|
+
labelPosition = _ref.labelPosition;
|
|
3447
|
+
return [{
|
|
3448
|
+
label: (0, i18n_1._)(label || 'Background'),
|
|
3449
|
+
option: 'backgroundColor',
|
|
3450
|
+
editor: 'editor.color',
|
|
3451
|
+
editorProps: {
|
|
3452
|
+
labelPosition: labelPosition || 'top',
|
|
3453
|
+
themes: themes
|
|
3454
|
+
}
|
|
3455
|
+
}];
|
|
3456
|
+
};
|
|
3457
|
+
|
|
3458
|
+
exports.default = background;
|
|
2397
3459
|
|
|
2398
3460
|
/***/ }),
|
|
2399
3461
|
|
|
@@ -2404,17 +3466,24 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
2404
3466
|
|
|
2405
3467
|
/***/ }),
|
|
2406
3468
|
|
|
2407
|
-
/***/
|
|
3469
|
+
/***/ 81:
|
|
2408
3470
|
/***/ (function(module, exports) {
|
|
2409
3471
|
|
|
2410
|
-
module.exports = require("@
|
|
3472
|
+
module.exports = require("@babel/runtime/helpers/taggedTemplateLiteral");
|
|
3473
|
+
|
|
3474
|
+
/***/ }),
|
|
3475
|
+
|
|
3476
|
+
/***/ 82:
|
|
3477
|
+
/***/ (function(module, exports) {
|
|
3478
|
+
|
|
3479
|
+
module.exports = require("@splunk/themes");
|
|
2411
3480
|
|
|
2412
3481
|
/***/ }),
|
|
2413
3482
|
|
|
2414
3483
|
/***/ 9:
|
|
2415
3484
|
/***/ (function(module, exports) {
|
|
2416
3485
|
|
|
2417
|
-
module.exports = require("@babel/runtime/helpers/
|
|
3486
|
+
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
2418
3487
|
|
|
2419
3488
|
/***/ })
|
|
2420
3489
|
|