@splunk/visualizations 26.0.0 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
package/Scatter.js
CHANGED
|
@@ -136,11 +136,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
136
136
|
Object.defineProperty(exports, "__esModule", {
|
|
137
137
|
value: true
|
|
138
138
|
});
|
|
139
|
+
|
|
139
140
|
var React = __webpack_require__(1);
|
|
141
|
+
|
|
140
142
|
var styled_components_1 = __webpack_require__(4);
|
|
143
|
+
|
|
141
144
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
145
|
+
|
|
142
146
|
var style_1 = __webpack_require__(14);
|
|
147
|
+
|
|
143
148
|
var colorUtils_1 = __webpack_require__(12);
|
|
149
|
+
|
|
144
150
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
145
151
|
var width = _ref.width;
|
|
146
152
|
return {
|
|
@@ -153,11 +159,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
153
159
|
componentId: "sc-1yhgpod-0"
|
|
154
160
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
155
161
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
156
|
-
});
|
|
157
|
-
|
|
162
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
163
|
+
|
|
158
164
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
159
165
|
var width = _ref2.width,
|
|
160
|
-
|
|
166
|
+
height = _ref2.height;
|
|
161
167
|
return {
|
|
162
168
|
style: Object.assign(Object.assign({}, width && {
|
|
163
169
|
width: (0, style_1.toPx)(width)
|
|
@@ -179,11 +185,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
179
185
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
180
186
|
componentId: "sc-1yhgpod-3"
|
|
181
187
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
188
|
+
|
|
182
189
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
183
190
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
184
191
|
var width = props.width,
|
|
185
|
-
|
|
186
|
-
|
|
192
|
+
height = props.height,
|
|
193
|
+
backgroundColor = props.backgroundColor;
|
|
194
|
+
|
|
187
195
|
if (!height) {
|
|
188
196
|
return React.createElement(Item, {
|
|
189
197
|
"data-test": "item",
|
|
@@ -191,24 +199,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
191
199
|
backgroundColor: backgroundColor
|
|
192
200
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
193
201
|
}
|
|
202
|
+
|
|
194
203
|
return React.createElement(FixSizeItem, {
|
|
195
204
|
"data-test": "fix-size-item",
|
|
196
|
-
"data-splunk-visualization-version": "26.
|
|
205
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
197
206
|
width: width,
|
|
198
207
|
height: height,
|
|
199
208
|
backgroundColor: backgroundColor
|
|
200
209
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
201
210
|
var newWidth = _ref3.width,
|
|
202
|
-
|
|
211
|
+
newHeight = _ref3.height;
|
|
203
212
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
204
213
|
width: newWidth,
|
|
205
214
|
height: newHeight
|
|
206
215
|
}));
|
|
207
216
|
})));
|
|
208
217
|
};
|
|
218
|
+
|
|
209
219
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
210
220
|
return FixedSizeContainer;
|
|
211
221
|
};
|
|
222
|
+
|
|
212
223
|
exports.default = withFixedSizeContainer;
|
|
213
224
|
|
|
214
225
|
/***/ }),
|
|
@@ -236,9 +247,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
236
247
|
* @param {DashboardVizType} props.Wrapper
|
|
237
248
|
* @param {DashboardVizType} props.Visualization
|
|
238
249
|
*/
|
|
250
|
+
|
|
239
251
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
240
252
|
var Wrapper = _ref.Wrapper,
|
|
241
|
-
|
|
253
|
+
Visualization = _ref.Visualization;
|
|
242
254
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
243
255
|
extendProperties.forEach(function (prop) {
|
|
244
256
|
if (Visualization[prop]) {
|
|
@@ -247,6 +259,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
247
259
|
}
|
|
248
260
|
});
|
|
249
261
|
};
|
|
262
|
+
|
|
250
263
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
251
264
|
|
|
252
265
|
/***/ }),
|
|
@@ -266,43 +279,59 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
|
266
279
|
|
|
267
280
|
var __rest = this && this.__rest || function (s, e) {
|
|
268
281
|
var t = {};
|
|
282
|
+
|
|
269
283
|
for (var p in s) {
|
|
270
284
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
271
285
|
}
|
|
286
|
+
|
|
272
287
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
273
288
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
274
289
|
}
|
|
275
290
|
return t;
|
|
276
291
|
};
|
|
292
|
+
|
|
277
293
|
Object.defineProperty(exports, "__esModule", {
|
|
278
294
|
value: true
|
|
279
295
|
});
|
|
280
296
|
exports.config = exports.themes = exports.computeVizProps = void 0;
|
|
281
|
-
|
|
282
|
-
// Charting imports i18n which needs to be run to instantiate window globals in the tests
|
|
297
|
+
|
|
298
|
+
var lodash_1 = __webpack_require__(3); // Charting imports i18n which needs to be run to instantiate window globals in the tests
|
|
283
299
|
// eslint-disable-next-line import/order
|
|
300
|
+
|
|
301
|
+
|
|
284
302
|
var Charting_1 = __webpack_require__(65);
|
|
303
|
+
|
|
285
304
|
var charting_bundle_1 = __webpack_require__(55);
|
|
305
|
+
|
|
286
306
|
var simpleXMLOptions_1 = __webpack_require__(70);
|
|
307
|
+
|
|
287
308
|
var config_1 = __webpack_require__(465);
|
|
309
|
+
|
|
288
310
|
exports.config = config_1.default;
|
|
289
|
-
|
|
311
|
+
|
|
312
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
313
|
+
|
|
290
314
|
var scatterUtils_1 = __webpack_require__(466);
|
|
315
|
+
|
|
291
316
|
var chartingUtils_1 = __webpack_require__(56);
|
|
317
|
+
|
|
292
318
|
var validOptions = Object.keys(config_1.default.optionsSchema);
|
|
319
|
+
|
|
293
320
|
var computeVizProps = function computeVizProps(_a) {
|
|
294
321
|
var dataSources = _a.dataSources,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
322
|
+
onEventTrigger = _a.onEventTrigger,
|
|
323
|
+
visualizationApiRef = _a.visualizationApiRef,
|
|
324
|
+
_a$x = _a.x,
|
|
325
|
+
x = _a$x === void 0 ? [] : _a$x,
|
|
326
|
+
_a$y = _a.y,
|
|
327
|
+
y = _a$y === void 0 ? [] : _a$y,
|
|
328
|
+
category = _a.category,
|
|
329
|
+
xField = _a.xField,
|
|
330
|
+
yField = _a.yField,
|
|
331
|
+
categoryField = _a.categoryField,
|
|
332
|
+
otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "visualizationApiRef", "x", "y", "category", "xField", "yField", "categoryField"]); // options to be passed as props
|
|
333
|
+
|
|
334
|
+
|
|
306
335
|
var computedProps = {
|
|
307
336
|
visualizationApiRef: visualizationApiRef
|
|
308
337
|
};
|
|
@@ -319,19 +348,24 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
319
348
|
}, {
|
|
320
349
|
name: yField
|
|
321
350
|
}];
|
|
351
|
+
|
|
322
352
|
if (category && categoryField) {
|
|
323
353
|
columns.unshift(category.map(String));
|
|
324
354
|
fields.unshift({
|
|
325
355
|
name: categoryField
|
|
326
356
|
});
|
|
327
357
|
}
|
|
358
|
+
|
|
328
359
|
primaryData.columns = columns;
|
|
329
360
|
primaryData.fields = fields;
|
|
330
361
|
var truncationLimit = computedProps.options['chart.resultTruncationLimit'];
|
|
362
|
+
|
|
331
363
|
if (truncationLimit) {
|
|
332
364
|
primaryData = (0, chartingUtils_1.truncateData)(primaryData, truncationLimit);
|
|
333
365
|
}
|
|
366
|
+
|
|
334
367
|
computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign({}, primaryData));
|
|
368
|
+
|
|
335
369
|
if (hasEventHandlers) {
|
|
336
370
|
computedProps.onClick = function (event) {
|
|
337
371
|
onEventTrigger(Object.assign(Object.assign({}, event), {
|
|
@@ -341,8 +375,10 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
341
375
|
}));
|
|
342
376
|
};
|
|
343
377
|
}
|
|
378
|
+
|
|
344
379
|
return computedProps;
|
|
345
380
|
};
|
|
381
|
+
|
|
346
382
|
exports.computeVizProps = computeVizProps;
|
|
347
383
|
var Column = (0, withDashboardViz_1.default)({
|
|
348
384
|
ReactViz: Charting_1.default,
|
|
@@ -390,24 +426,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
390
426
|
|
|
391
427
|
|
|
392
428
|
var _toConsumableArray = __webpack_require__(8);
|
|
429
|
+
|
|
393
430
|
var _defineProperty = __webpack_require__(7);
|
|
431
|
+
|
|
394
432
|
var __rest = this && this.__rest || function (s, e) {
|
|
395
433
|
var t = {};
|
|
434
|
+
|
|
396
435
|
for (var p in s) {
|
|
397
436
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
398
437
|
}
|
|
438
|
+
|
|
399
439
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
400
440
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
401
441
|
}
|
|
402
442
|
return t;
|
|
403
443
|
};
|
|
444
|
+
|
|
404
445
|
Object.defineProperty(exports, "__esModule", {
|
|
405
446
|
value: true
|
|
406
447
|
});
|
|
407
448
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
449
|
+
|
|
408
450
|
var lodash_1 = __webpack_require__(3);
|
|
451
|
+
|
|
409
452
|
var schemaUtils_1 = __webpack_require__(16);
|
|
453
|
+
|
|
410
454
|
var VizBehavior_1 = __webpack_require__(6);
|
|
455
|
+
|
|
411
456
|
var dynamicOptionsDSLType = {
|
|
412
457
|
type: 'string',
|
|
413
458
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -417,20 +462,22 @@ var dynamicOptionsDSLType = {
|
|
|
417
462
|
* @param optionsSchema a visualization's options schema
|
|
418
463
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
419
464
|
*/
|
|
465
|
+
|
|
420
466
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
421
467
|
var enhancedOptionsSchema = {};
|
|
422
468
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
423
469
|
var _a = optionsSchema[key],
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
470
|
+
title = _a.title,
|
|
471
|
+
description = _a.description,
|
|
472
|
+
readOnly = _a.readOnly,
|
|
473
|
+
writeOnly = _a.writeOnly,
|
|
474
|
+
examples = _a.examples,
|
|
475
|
+
defaultValue = _a.default,
|
|
476
|
+
type = _a.type,
|
|
477
|
+
properties = _a.properties,
|
|
478
|
+
patternProperties = _a.patternProperties,
|
|
479
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
480
|
+
|
|
434
481
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
435
482
|
title: title
|
|
436
483
|
}), description !== undefined && {
|
|
@@ -444,12 +491,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
444
491
|
}), defaultValue !== undefined && {
|
|
445
492
|
default: defaultValue
|
|
446
493
|
});
|
|
494
|
+
|
|
447
495
|
if (type === 'object') {
|
|
448
496
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
449
497
|
type: type
|
|
450
498
|
}), properties && {
|
|
451
499
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
452
500
|
});
|
|
501
|
+
|
|
453
502
|
if (patternProperties) {
|
|
454
503
|
var enhancedPatternProperties = {};
|
|
455
504
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -467,6 +516,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
467
516
|
});
|
|
468
517
|
return enhancedOptionsSchema;
|
|
469
518
|
}
|
|
519
|
+
|
|
470
520
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
471
521
|
/**
|
|
472
522
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -475,11 +525,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
475
525
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
476
526
|
* and containing `open: false` for all editor panels in editorConfig
|
|
477
527
|
*/
|
|
528
|
+
|
|
478
529
|
function enhanceConfig(vizConfig) {
|
|
479
530
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
531
|
+
|
|
480
532
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
481
533
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
482
534
|
}
|
|
535
|
+
|
|
483
536
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
484
537
|
return Object.assign(Object.assign({}, config), {
|
|
485
538
|
open: config.open || false
|
|
@@ -487,6 +540,7 @@ function enhanceConfig(vizConfig) {
|
|
|
487
540
|
});
|
|
488
541
|
return enhancedConfig;
|
|
489
542
|
}
|
|
543
|
+
|
|
490
544
|
exports.enhanceConfig = enhanceConfig;
|
|
491
545
|
/**
|
|
492
546
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -494,6 +548,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
494
548
|
* @param vizConfig a Visualization Config
|
|
495
549
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
496
550
|
*/
|
|
551
|
+
|
|
497
552
|
function uncollapseEditorConfig(vizConfig) {
|
|
498
553
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
499
554
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -503,13 +558,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
503
558
|
});
|
|
504
559
|
return editorPanelUncollapsedConfig;
|
|
505
560
|
}
|
|
561
|
+
|
|
506
562
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
563
|
+
|
|
507
564
|
function isDynamicOption(option) {
|
|
508
565
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
509
566
|
}
|
|
510
|
-
|
|
511
|
-
// private helpers to improve readability of getInitialPreset
|
|
567
|
+
|
|
568
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
512
569
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
570
|
+
|
|
513
571
|
/**
|
|
514
572
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
515
573
|
* if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
|
|
@@ -518,6 +576,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
518
576
|
*
|
|
519
577
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
520
578
|
*/
|
|
579
|
+
|
|
521
580
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
522
581
|
var presetContextKeys = Object.keys(presetContext);
|
|
523
582
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -527,6 +586,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
527
586
|
/**
|
|
528
587
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
529
588
|
*/
|
|
589
|
+
|
|
590
|
+
|
|
530
591
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
531
592
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
532
593
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -541,18 +602,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
541
602
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
542
603
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
543
604
|
*/
|
|
605
|
+
|
|
606
|
+
|
|
544
607
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
545
608
|
return presets.find(function (preset) {
|
|
546
609
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
547
610
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
548
611
|
var presetContextKeys = Object.keys(presetContext);
|
|
549
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
550
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
612
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
551
613
|
// if not, then the preset is invalid in config.ts
|
|
614
|
+
|
|
552
615
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
553
616
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
554
617
|
});
|
|
555
618
|
}
|
|
619
|
+
|
|
556
620
|
exports.getInitialPreset = getInitialPreset;
|
|
557
621
|
/**
|
|
558
622
|
* generates number precision values for a Select editor
|
|
@@ -560,6 +624,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
560
624
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
561
625
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
562
626
|
*/
|
|
627
|
+
|
|
563
628
|
function generatePrecisionValues(numPrecisionValues) {
|
|
564
629
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
565
630
|
return {
|
|
@@ -568,6 +633,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
568
633
|
};
|
|
569
634
|
});
|
|
570
635
|
}
|
|
636
|
+
|
|
571
637
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
572
638
|
/**
|
|
573
639
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -577,12 +643,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
577
643
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
578
644
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
579
645
|
*/
|
|
646
|
+
|
|
580
647
|
var insertLayout = function insertLayout(layout, index) {
|
|
581
648
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
582
649
|
layoutItems[_key - 2] = arguments[_key];
|
|
583
650
|
}
|
|
651
|
+
|
|
584
652
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
585
653
|
};
|
|
654
|
+
|
|
586
655
|
exports.insertLayout = insertLayout;
|
|
587
656
|
|
|
588
657
|
/***/ }),
|
|
@@ -660,11 +729,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
660
729
|
value: true
|
|
661
730
|
});
|
|
662
731
|
exports.shouldShowIconPlaceholder = void 0;
|
|
732
|
+
|
|
663
733
|
var React = __webpack_require__(1);
|
|
734
|
+
|
|
664
735
|
var T = __webpack_require__(0);
|
|
736
|
+
|
|
665
737
|
var lodash_1 = __webpack_require__(3);
|
|
738
|
+
|
|
666
739
|
var i18n_1 = __webpack_require__(2);
|
|
740
|
+
|
|
667
741
|
var Message_1 = __webpack_require__(10);
|
|
742
|
+
|
|
668
743
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
669
744
|
/**
|
|
670
745
|
* @method shouldShowIconPlaceholder
|
|
@@ -672,6 +747,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
672
747
|
* @param {boolean} loading
|
|
673
748
|
* @returns {boolean}
|
|
674
749
|
*/
|
|
750
|
+
|
|
751
|
+
|
|
675
752
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
676
753
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
677
754
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -680,6 +757,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
680
757
|
var noFields = fields === undefined;
|
|
681
758
|
return loading || noData || noFields;
|
|
682
759
|
};
|
|
760
|
+
|
|
683
761
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
684
762
|
var propTypes = {
|
|
685
763
|
icon: T.func,
|
|
@@ -694,11 +772,13 @@ var propTypes = {
|
|
|
694
772
|
* @param {IconPlaceholderProps} props
|
|
695
773
|
* @returns {React.ReactElement}
|
|
696
774
|
*/
|
|
775
|
+
|
|
697
776
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
698
777
|
var width = props.width,
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
778
|
+
height = props.height,
|
|
779
|
+
icon = props.icon,
|
|
780
|
+
iconColor = props.iconColor;
|
|
781
|
+
|
|
702
782
|
if (icon) {
|
|
703
783
|
return React.createElement(icon, {
|
|
704
784
|
style: {
|
|
@@ -713,6 +793,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
713
793
|
height: '50%'
|
|
714
794
|
});
|
|
715
795
|
}
|
|
796
|
+
|
|
716
797
|
return React.createElement(Message_1.default, {
|
|
717
798
|
width: width,
|
|
718
799
|
height: height,
|
|
@@ -720,6 +801,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
720
801
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
721
802
|
});
|
|
722
803
|
};
|
|
804
|
+
|
|
723
805
|
IconPlaceholder.propTypes = propTypes;
|
|
724
806
|
IconPlaceholder.defaultProps = {
|
|
725
807
|
width: '100%',
|
|
@@ -736,21 +818,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
736
818
|
|
|
737
819
|
|
|
738
820
|
var _defineProperty = __webpack_require__(7);
|
|
821
|
+
|
|
739
822
|
Object.defineProperty(exports, "__esModule", {
|
|
740
823
|
value: true
|
|
741
824
|
});
|
|
742
825
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
826
|
+
|
|
743
827
|
var T = __webpack_require__(0);
|
|
828
|
+
|
|
744
829
|
var lodash_1 = __webpack_require__(3);
|
|
745
|
-
|
|
830
|
+
|
|
831
|
+
var DataSource_1 = __webpack_require__(34);
|
|
832
|
+
|
|
746
833
|
exports.SortParamsPropTypes = T.shape({
|
|
747
834
|
currentSortKey: T.string,
|
|
748
835
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
749
836
|
onSort: T.func
|
|
750
837
|
});
|
|
838
|
+
|
|
751
839
|
var getSortingParams = function getSortingParams(_ref) {
|
|
752
840
|
var requestParams = _ref.requestParams,
|
|
753
|
-
|
|
841
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
754
842
|
var currentSortKey;
|
|
755
843
|
var currentSortDir;
|
|
756
844
|
var nextSortDirMap = {
|
|
@@ -759,15 +847,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
759
847
|
none: 'asc'
|
|
760
848
|
};
|
|
761
849
|
var onSort;
|
|
850
|
+
|
|
762
851
|
if (typeof onRequestParamsChange === 'function') {
|
|
763
852
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
764
853
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
765
854
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
766
|
-
}
|
|
767
|
-
|
|
855
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
856
|
+
|
|
857
|
+
|
|
768
858
|
onSort = function onSort(e, _ref2) {
|
|
769
859
|
var sortKey = _ref2.sortKey,
|
|
770
|
-
|
|
860
|
+
sortDir = _ref2.sortDir;
|
|
861
|
+
|
|
771
862
|
if (typeof sortKey === 'string') {
|
|
772
863
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
773
864
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -779,12 +870,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
779
870
|
}
|
|
780
871
|
};
|
|
781
872
|
}
|
|
873
|
+
|
|
782
874
|
return {
|
|
783
875
|
currentSortKey: currentSortKey,
|
|
784
876
|
currentSortDir: currentSortDir,
|
|
785
877
|
onSort: onSort
|
|
786
878
|
};
|
|
787
879
|
};
|
|
880
|
+
|
|
788
881
|
exports.getSortingParams = getSortingParams;
|
|
789
882
|
|
|
790
883
|
/***/ }),
|
|
@@ -795,43 +888,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
795
888
|
"use strict";
|
|
796
889
|
|
|
797
890
|
|
|
891
|
+
Object.defineProperty(exports, "__esModule", {
|
|
892
|
+
value: true
|
|
893
|
+
});
|
|
894
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
895
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
896
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
897
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
898
|
+
|
|
899
|
+
/***/ }),
|
|
900
|
+
|
|
901
|
+
/***/ 35:
|
|
902
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
903
|
+
|
|
904
|
+
"use strict";
|
|
905
|
+
|
|
906
|
+
|
|
798
907
|
Object.defineProperty(exports, "__esModule", {
|
|
799
908
|
value: true
|
|
800
909
|
});
|
|
801
910
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
911
|
+
|
|
802
912
|
var T = __webpack_require__(0);
|
|
913
|
+
|
|
803
914
|
var lodash_1 = __webpack_require__(3);
|
|
915
|
+
|
|
804
916
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
805
917
|
isPaging: T.bool,
|
|
806
918
|
current: T.number,
|
|
807
919
|
totalPages: T.number,
|
|
808
920
|
onChange: T.func
|
|
809
921
|
});
|
|
922
|
+
|
|
810
923
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
811
924
|
var requestParams = _ref.requestParams,
|
|
812
|
-
|
|
813
|
-
|
|
925
|
+
meta = _ref.meta,
|
|
926
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
814
927
|
var totalCount = meta && meta.totalCount || 0;
|
|
815
928
|
var offset = requestParams && requestParams.offset || 0;
|
|
816
929
|
var count = requestParams && requestParams.count;
|
|
817
930
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
818
931
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
819
932
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
933
|
+
|
|
820
934
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
821
935
|
var page = _ref2.page,
|
|
822
|
-
|
|
936
|
+
countArg = _ref2.count;
|
|
823
937
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
938
|
+
|
|
824
939
|
if (typeof countArg === 'number') {
|
|
825
940
|
newParams.count = countArg;
|
|
826
941
|
newParams.offset = 0;
|
|
827
942
|
}
|
|
943
|
+
|
|
828
944
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
945
|
+
|
|
829
946
|
if (typeof page === 'number' && page > 0) {
|
|
830
947
|
newParams.count = pageCount;
|
|
831
948
|
newParams.offset = (page - 1) * pageCount;
|
|
832
949
|
}
|
|
950
|
+
|
|
833
951
|
onRequestParamsChange(newParams);
|
|
834
952
|
};
|
|
953
|
+
|
|
835
954
|
return {
|
|
836
955
|
isPaging: isPaging,
|
|
837
956
|
current: current,
|
|
@@ -839,11 +958,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
839
958
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
840
959
|
};
|
|
841
960
|
};
|
|
961
|
+
|
|
842
962
|
exports.getPaginationParams = getPaginationParams;
|
|
843
963
|
|
|
844
964
|
/***/ }),
|
|
845
965
|
|
|
846
|
-
/***/
|
|
966
|
+
/***/ 36:
|
|
847
967
|
/***/ (function(module, exports, __webpack_require__) {
|
|
848
968
|
|
|
849
969
|
"use strict";
|
|
@@ -854,6 +974,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
854
974
|
});
|
|
855
975
|
exports.VizCategory = void 0;
|
|
856
976
|
var VizCategory;
|
|
977
|
+
|
|
857
978
|
(function (VizCategory) {
|
|
858
979
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
859
980
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -871,67 +992,96 @@ var VizCategory;
|
|
|
871
992
|
|
|
872
993
|
/***/ }),
|
|
873
994
|
|
|
874
|
-
/***/
|
|
995
|
+
/***/ 37:
|
|
875
996
|
/***/ (function(module, exports, __webpack_require__) {
|
|
876
997
|
|
|
877
998
|
"use strict";
|
|
878
999
|
|
|
879
1000
|
|
|
880
1001
|
var _slicedToArray = __webpack_require__(17);
|
|
1002
|
+
|
|
881
1003
|
Object.defineProperty(exports, "__esModule", {
|
|
882
1004
|
value: true
|
|
883
1005
|
});
|
|
1006
|
+
|
|
884
1007
|
var React = __webpack_require__(1);
|
|
1008
|
+
|
|
885
1009
|
var lodash_1 = __webpack_require__(3);
|
|
886
|
-
|
|
1010
|
+
|
|
1011
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1012
|
+
|
|
887
1013
|
var Options_1 = __webpack_require__(30);
|
|
888
|
-
|
|
1014
|
+
|
|
1015
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1016
|
+
|
|
889
1017
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
890
|
-
|
|
1018
|
+
|
|
1019
|
+
var moment_1 = __webpack_require__(40);
|
|
1020
|
+
|
|
891
1021
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1022
|
+
|
|
892
1023
|
var styled_components_1 = __webpack_require__(4);
|
|
1024
|
+
|
|
893
1025
|
var hocUtils_1 = __webpack_require__(27);
|
|
1026
|
+
|
|
894
1027
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
895
|
-
|
|
1028
|
+
|
|
1029
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1030
|
+
|
|
896
1031
|
var id_1 = __webpack_require__(25);
|
|
897
|
-
|
|
1032
|
+
|
|
1033
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1034
|
+
|
|
898
1035
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1036
|
+
|
|
899
1037
|
var getSorting_1 = __webpack_require__(33);
|
|
900
|
-
|
|
1038
|
+
|
|
1039
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1040
|
+
|
|
901
1041
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1042
|
+
|
|
902
1043
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1044
|
+
|
|
903
1045
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1046
|
+
|
|
904
1047
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
905
1048
|
/**
|
|
906
1049
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
907
1050
|
* @param {DashboardVizOpts} opts
|
|
908
1051
|
* @returns {HOC}
|
|
909
1052
|
*/
|
|
1053
|
+
|
|
1054
|
+
|
|
910
1055
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
911
1056
|
var ReactViz = opts.ReactViz,
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1057
|
+
vizConfig = opts.vizConfig,
|
|
1058
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1059
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1060
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1061
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1062
|
+
|
|
917
1063
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
918
1064
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1065
|
+
|
|
919
1066
|
var DashboardViz = function DashboardViz(props) {
|
|
920
1067
|
var _a;
|
|
1068
|
+
|
|
921
1069
|
var mode = props.mode,
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1070
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1071
|
+
dataSources = props.dataSources,
|
|
1072
|
+
options = props.options,
|
|
1073
|
+
_props$context = props.context,
|
|
1074
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1075
|
+
width = props.width,
|
|
1076
|
+
height = props.height,
|
|
1077
|
+
onComputedProps = props.onComputedProps,
|
|
1078
|
+
onEventTrigger = props.onEventTrigger,
|
|
1079
|
+
theme = props.theme,
|
|
1080
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1081
|
+
|
|
933
1082
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
934
|
-
|
|
1083
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1084
|
+
|
|
935
1085
|
if (serializedTimezone) {
|
|
936
1086
|
/*
|
|
937
1087
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -945,38 +1095,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
945
1095
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
946
1096
|
}
|
|
947
1097
|
}
|
|
1098
|
+
|
|
948
1099
|
var themeFunc = function themeFunc(themeVar) {
|
|
949
1100
|
var _a, _b;
|
|
1101
|
+
|
|
950
1102
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
951
1103
|
};
|
|
1104
|
+
|
|
952
1105
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1106
|
+
|
|
953
1107
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1108
|
+
theme: theme
|
|
1109
|
+
}),
|
|
1110
|
+
currentThemeFamily = _ref.family,
|
|
1111
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1112
|
+
currentThemeDensity = _ref.density;
|
|
1113
|
+
|
|
959
1114
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1115
|
+
|
|
960
1116
|
var _React$useState = React.useState({}),
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1117
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1118
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1119
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1120
|
+
|
|
1121
|
+
|
|
964
1122
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1123
|
+
|
|
965
1124
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
966
|
-
|
|
967
|
-
|
|
1125
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1126
|
+
visualizationID = _React$useState4[0];
|
|
1127
|
+
|
|
968
1128
|
var _React$useState5 = React.useState({}),
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1129
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1130
|
+
dataSourcesInState = _React$useState6[0],
|
|
1131
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1132
|
+
|
|
972
1133
|
var _React$useState7 = React.useState(),
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1134
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1135
|
+
dataFramesInState = _React$useState8[0],
|
|
1136
|
+
setDataFramesInState = _React$useState8[1];
|
|
1137
|
+
|
|
976
1138
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1139
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1140
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1141
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1142
|
+
|
|
980
1143
|
var isMounted = React.useRef(true);
|
|
981
1144
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
982
1145
|
try {
|
|
@@ -1001,11 +1164,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1001
1164
|
});
|
|
1002
1165
|
} else {
|
|
1003
1166
|
var dataFrames = dataFramesInState;
|
|
1167
|
+
|
|
1004
1168
|
if (dataSources !== dataSourcesInState) {
|
|
1005
1169
|
setDataSourcesInState(dataSources);
|
|
1006
1170
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1007
1171
|
setDataFramesInState(dataFrames);
|
|
1008
1172
|
}
|
|
1173
|
+
|
|
1009
1174
|
return Options_1.Options.evaluate({
|
|
1010
1175
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1011
1176
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -1016,21 +1181,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1016
1181
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1017
1182
|
return {};
|
|
1018
1183
|
}
|
|
1184
|
+
|
|
1019
1185
|
return {};
|
|
1020
1186
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1021
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1022
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1187
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1023
1188
|
// 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
|
|
1024
1189
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1190
|
+
|
|
1025
1191
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1026
1192
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1193
|
+
|
|
1027
1194
|
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) {
|
|
1028
1195
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1029
1196
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1030
1197
|
});
|
|
1031
|
-
}
|
|
1032
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1198
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1033
1199
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1200
|
+
|
|
1201
|
+
|
|
1034
1202
|
React.useEffect(function () {
|
|
1035
1203
|
onComputedProps(clonedEvaluatedOptions);
|
|
1036
1204
|
});
|
|
@@ -1040,44 +1208,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1040
1208
|
isMounted.current = false;
|
|
1041
1209
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1042
1210
|
}
|
|
1043
|
-
};
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
// present warning message if any required props are missing
|
|
1211
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1212
|
+
}, []); // present warning message if any required props are missing
|
|
1213
|
+
|
|
1047
1214
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1048
|
-
|
|
1049
|
-
|
|
1215
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1216
|
+
supports = vizConfig.supports;
|
|
1050
1217
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1218
|
+
|
|
1051
1219
|
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
|
|
1052
1220
|
) {
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1221
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1222
|
+
"data-test": "missing-props-message",
|
|
1223
|
+
width: width,
|
|
1224
|
+
height: height,
|
|
1225
|
+
missingProps: missing,
|
|
1226
|
+
backgroundColor: bgColorFromTheme
|
|
1227
|
+
});
|
|
1228
|
+
} // events
|
|
1229
|
+
|
|
1230
|
+
|
|
1062
1231
|
var eventCallbackProps = {};
|
|
1232
|
+
|
|
1063
1233
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1064
1234
|
var supportedEvents = vizConfig.events;
|
|
1065
1235
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1066
1236
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1067
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1068
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1237
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1069
1238
|
// then remove these lines
|
|
1239
|
+
|
|
1070
1240
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1071
1241
|
var payload = {};
|
|
1242
|
+
|
|
1072
1243
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1073
1244
|
payloadKeys.forEach(function (p) {
|
|
1074
1245
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1075
1246
|
});
|
|
1076
1247
|
}
|
|
1248
|
+
|
|
1077
1249
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1078
1250
|
if (ev && ev.payload) {
|
|
1079
1251
|
payload = ev.payload;
|
|
1080
1252
|
}
|
|
1253
|
+
|
|
1081
1254
|
return onEventTrigger({
|
|
1082
1255
|
originalEvent: ev,
|
|
1083
1256
|
payload: payload,
|
|
@@ -1085,8 +1258,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1085
1258
|
});
|
|
1086
1259
|
};
|
|
1087
1260
|
});
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1261
|
+
} // compute pure viz props which are not from options
|
|
1262
|
+
|
|
1263
|
+
|
|
1090
1264
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1091
1265
|
themeFunc: themeFunc
|
|
1092
1266
|
}));
|
|
@@ -1104,15 +1278,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1104
1278
|
* In future, we could automatically detect which all datasources are being used
|
|
1105
1279
|
* and bind those magically to pagination/sorting behavior.
|
|
1106
1280
|
*/
|
|
1281
|
+
|
|
1107
1282
|
var dataSourceMetadata = {};
|
|
1108
1283
|
var OptionKey = 'paginateDataSourceKey';
|
|
1109
1284
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1285
|
+
|
|
1110
1286
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1111
1287
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1112
1288
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1289
|
+
|
|
1113
1290
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1114
1291
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1115
1292
|
};
|
|
1293
|
+
|
|
1116
1294
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1117
1295
|
requestParams: requestParams,
|
|
1118
1296
|
meta: meta,
|
|
@@ -1127,115 +1305,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1127
1305
|
sortParams: sortParams,
|
|
1128
1306
|
paginatorParams: paginatorParams
|
|
1129
1307
|
};
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1308
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1309
|
+
|
|
1310
|
+
|
|
1132
1311
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1133
1312
|
return null;
|
|
1134
1313
|
}
|
|
1314
|
+
|
|
1135
1315
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1136
1316
|
mode: mode,
|
|
1137
1317
|
width: width,
|
|
1138
1318
|
height: height
|
|
1139
1319
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1140
1320
|
};
|
|
1321
|
+
|
|
1141
1322
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1142
1323
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1143
1324
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1144
1325
|
theme: {}
|
|
1145
|
-
});
|
|
1146
|
-
|
|
1147
|
-
DashboardViz.config = vizConfig;
|
|
1148
|
-
|
|
1326
|
+
}); // attach viz config
|
|
1327
|
+
|
|
1328
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1329
|
+
|
|
1149
1330
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1150
1331
|
};
|
|
1332
|
+
|
|
1151
1333
|
exports.default = withDashboardViz;
|
|
1152
1334
|
|
|
1153
1335
|
/***/ }),
|
|
1154
1336
|
|
|
1155
|
-
/***/
|
|
1337
|
+
/***/ 38:
|
|
1156
1338
|
/***/ (function(module, exports) {
|
|
1157
1339
|
|
|
1158
1340
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1159
1341
|
|
|
1160
1342
|
/***/ }),
|
|
1161
1343
|
|
|
1162
|
-
/***/
|
|
1344
|
+
/***/ 39:
|
|
1163
1345
|
/***/ (function(module, exports) {
|
|
1164
1346
|
|
|
1165
1347
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1166
1348
|
|
|
1167
1349
|
/***/ }),
|
|
1168
1350
|
|
|
1169
|
-
/***/
|
|
1351
|
+
/***/ 4:
|
|
1170
1352
|
/***/ (function(module, exports) {
|
|
1171
1353
|
|
|
1172
|
-
module.exports = require("
|
|
1354
|
+
module.exports = require("styled-components");
|
|
1173
1355
|
|
|
1174
1356
|
/***/ }),
|
|
1175
1357
|
|
|
1176
|
-
/***/
|
|
1358
|
+
/***/ 40:
|
|
1177
1359
|
/***/ (function(module, exports) {
|
|
1178
1360
|
|
|
1179
|
-
module.exports = require("
|
|
1361
|
+
module.exports = require("@splunk/moment");
|
|
1180
1362
|
|
|
1181
1363
|
/***/ }),
|
|
1182
1364
|
|
|
1183
|
-
/***/
|
|
1365
|
+
/***/ 41:
|
|
1184
1366
|
/***/ (function(module, exports) {
|
|
1185
1367
|
|
|
1186
1368
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1187
1369
|
|
|
1188
1370
|
/***/ }),
|
|
1189
1371
|
|
|
1190
|
-
/***/
|
|
1372
|
+
/***/ 42:
|
|
1191
1373
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1192
1374
|
|
|
1193
1375
|
"use strict";
|
|
1194
1376
|
|
|
1195
1377
|
|
|
1196
1378
|
var _classCallCheck = __webpack_require__(9);
|
|
1379
|
+
|
|
1197
1380
|
Object.defineProperty(exports, "__esModule", {
|
|
1198
1381
|
value: true
|
|
1199
1382
|
});
|
|
1200
1383
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1201
1384
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1385
|
+
|
|
1202
1386
|
var T = __webpack_require__(0);
|
|
1387
|
+
|
|
1203
1388
|
var lodash_1 = __webpack_require__(3);
|
|
1204
|
-
|
|
1205
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1389
|
+
|
|
1390
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1391
|
+
|
|
1392
|
+
|
|
1206
1393
|
exports.INITIAL_WIDTH = 250;
|
|
1207
1394
|
exports.INITIAL_HEIGHT = 250;
|
|
1208
1395
|
/**
|
|
1209
1396
|
* A Splunk visualization
|
|
1210
1397
|
*/
|
|
1398
|
+
|
|
1211
1399
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1212
1400
|
_classCallCheck(this, SplunkVisualization);
|
|
1213
1401
|
};
|
|
1402
|
+
|
|
1214
1403
|
SplunkVisualization.propTypes = {
|
|
1215
1404
|
/**
|
|
1216
1405
|
* display mode
|
|
1217
1406
|
*/
|
|
1218
1407
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1408
|
+
|
|
1219
1409
|
/**
|
|
1220
1410
|
* width in pixel or string, defaults to 100%
|
|
1221
1411
|
*/
|
|
1222
1412
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1413
|
+
|
|
1223
1414
|
/**
|
|
1224
1415
|
* height in pixel or string
|
|
1225
1416
|
*/
|
|
1226
1417
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1418
|
+
|
|
1227
1419
|
/**
|
|
1228
1420
|
* visualization context used for dynamic option evaluation
|
|
1229
1421
|
*/
|
|
1230
1422
|
context: T.object,
|
|
1423
|
+
|
|
1231
1424
|
/**
|
|
1232
1425
|
* visualization formatting options
|
|
1233
1426
|
*/
|
|
1234
1427
|
options: T.object,
|
|
1428
|
+
|
|
1235
1429
|
/**
|
|
1236
1430
|
* A callback to update formatting options
|
|
1237
1431
|
*/
|
|
1238
1432
|
onOptionsChange: T.func,
|
|
1433
|
+
|
|
1239
1434
|
/**
|
|
1240
1435
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1241
1436
|
*/
|
|
@@ -1244,6 +1439,7 @@ SplunkVisualization.propTypes = {
|
|
|
1244
1439
|
* current request params
|
|
1245
1440
|
*/
|
|
1246
1441
|
requestParams: T.object,
|
|
1442
|
+
|
|
1247
1443
|
/**
|
|
1248
1444
|
* current dataset
|
|
1249
1445
|
*/
|
|
@@ -1251,6 +1447,7 @@ SplunkVisualization.propTypes = {
|
|
|
1251
1447
|
fields: T.array,
|
|
1252
1448
|
columns: T.array
|
|
1253
1449
|
}),
|
|
1450
|
+
|
|
1254
1451
|
/**
|
|
1255
1452
|
* error
|
|
1256
1453
|
*/
|
|
@@ -1258,29 +1455,35 @@ SplunkVisualization.propTypes = {
|
|
|
1258
1455
|
level: T.string,
|
|
1259
1456
|
message: T.string
|
|
1260
1457
|
}),
|
|
1458
|
+
|
|
1261
1459
|
/**
|
|
1262
1460
|
* meta data that came with the dataset
|
|
1263
1461
|
*/
|
|
1264
1462
|
meta: T.object
|
|
1265
1463
|
})),
|
|
1464
|
+
|
|
1266
1465
|
/**
|
|
1267
1466
|
* A callback to trigger event
|
|
1268
1467
|
*/
|
|
1269
1468
|
onEventTrigger: T.func,
|
|
1469
|
+
|
|
1270
1470
|
/**
|
|
1271
1471
|
* Inform viz if there are handlers listening to events
|
|
1272
1472
|
*/
|
|
1273
1473
|
hasEventHandlers: T.bool,
|
|
1474
|
+
|
|
1274
1475
|
/**
|
|
1275
1476
|
* A callback to communicate computed props to a consumer
|
|
1276
1477
|
*/
|
|
1277
1478
|
onComputedProps: T.func,
|
|
1479
|
+
|
|
1278
1480
|
/**
|
|
1279
1481
|
* A callback to obtain visualization api
|
|
1280
1482
|
*/
|
|
1281
1483
|
vizActionHandlerRef: T.func,
|
|
1282
1484
|
loading: T.bool,
|
|
1283
1485
|
theme: T.object,
|
|
1486
|
+
|
|
1284
1487
|
/**
|
|
1285
1488
|
* A callback to request new data with updated request params
|
|
1286
1489
|
*/
|
|
@@ -1289,6 +1492,7 @@ SplunkVisualization.propTypes = {
|
|
|
1289
1492
|
/**
|
|
1290
1493
|
*
|
|
1291
1494
|
*/
|
|
1495
|
+
|
|
1292
1496
|
SplunkVisualization.defaultProps = {
|
|
1293
1497
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1294
1498
|
width: '100%',
|
|
@@ -1317,26 +1521,29 @@ exports.default = SplunkVisualization;
|
|
|
1317
1521
|
|
|
1318
1522
|
/***/ }),
|
|
1319
1523
|
|
|
1320
|
-
/***/
|
|
1524
|
+
/***/ 43:
|
|
1321
1525
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1322
1526
|
|
|
1323
1527
|
"use strict";
|
|
1324
1528
|
|
|
1325
1529
|
|
|
1326
1530
|
var _classCallCheck = __webpack_require__(9);
|
|
1531
|
+
|
|
1327
1532
|
var _createClass = __webpack_require__(18);
|
|
1533
|
+
|
|
1328
1534
|
Object.defineProperty(exports, "__esModule", {
|
|
1329
1535
|
value: true
|
|
1330
1536
|
});
|
|
1331
1537
|
exports.DefaultVizActionHandler = void 0;
|
|
1538
|
+
|
|
1332
1539
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1333
1540
|
function DefaultVizActionHandler() {
|
|
1334
1541
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1335
1542
|
}
|
|
1543
|
+
|
|
1336
1544
|
_createClass(DefaultVizActionHandler, [{
|
|
1337
1545
|
key: "focus",
|
|
1338
|
-
value: function focus() {
|
|
1339
|
-
// noop
|
|
1546
|
+
value: function focus() {// noop
|
|
1340
1547
|
}
|
|
1341
1548
|
}, {
|
|
1342
1549
|
key: "snapshot",
|
|
@@ -1344,23 +1551,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1344
1551
|
return null; // noop
|
|
1345
1552
|
}
|
|
1346
1553
|
}]);
|
|
1554
|
+
|
|
1347
1555
|
return DefaultVizActionHandler;
|
|
1348
1556
|
}();
|
|
1349
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1350
|
-
|
|
1351
|
-
/***/ }),
|
|
1352
|
-
|
|
1353
|
-
/***/ 43:
|
|
1354
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1355
|
-
|
|
1356
|
-
"use strict";
|
|
1357
1557
|
|
|
1358
|
-
|
|
1359
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1360
|
-
value: true
|
|
1361
|
-
});
|
|
1362
|
-
exports.validSortDirs = void 0;
|
|
1363
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1558
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1364
1559
|
|
|
1365
1560
|
/***/ }),
|
|
1366
1561
|
|
|
@@ -1374,7 +1569,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1374
1569
|
value: true
|
|
1375
1570
|
});
|
|
1376
1571
|
exports.useDeepMemo = void 0;
|
|
1572
|
+
|
|
1377
1573
|
var react_1 = __webpack_require__(1);
|
|
1574
|
+
|
|
1378
1575
|
var lodash_1 = __webpack_require__(3);
|
|
1379
1576
|
/**
|
|
1380
1577
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1389,16 +1586,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1389
1586
|
* @param fn the function to be executed and
|
|
1390
1587
|
* @param dependencies an array of dependencies
|
|
1391
1588
|
*/
|
|
1589
|
+
|
|
1590
|
+
|
|
1392
1591
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1393
1592
|
var ref = (0, react_1.useRef)();
|
|
1593
|
+
|
|
1394
1594
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1395
1595
|
ref.current = {
|
|
1396
1596
|
dependencies: dependencies,
|
|
1397
1597
|
value: fn()
|
|
1398
1598
|
};
|
|
1399
1599
|
}
|
|
1600
|
+
|
|
1400
1601
|
return ref.current.value;
|
|
1401
1602
|
};
|
|
1603
|
+
|
|
1402
1604
|
exports.useDeepMemo = useDeepMemo;
|
|
1403
1605
|
|
|
1404
1606
|
/***/ }),
|
|
@@ -1413,19 +1615,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1413
1615
|
value: true
|
|
1414
1616
|
});
|
|
1415
1617
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
1618
|
+
|
|
1416
1619
|
var React = __webpack_require__(1);
|
|
1620
|
+
|
|
1417
1621
|
var T = __webpack_require__(0);
|
|
1622
|
+
|
|
1418
1623
|
var i18n_1 = __webpack_require__(2);
|
|
1624
|
+
|
|
1419
1625
|
var Message_1 = __webpack_require__(10);
|
|
1626
|
+
|
|
1420
1627
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1421
1628
|
/**
|
|
1422
1629
|
* @method isMissing
|
|
1423
1630
|
* @param {any} v
|
|
1424
1631
|
* @returns {boolean} true if the input value === null or undefined
|
|
1425
1632
|
*/
|
|
1633
|
+
|
|
1634
|
+
|
|
1426
1635
|
var isMissing = function isMissing(v) {
|
|
1427
1636
|
return v === null || v === undefined;
|
|
1428
1637
|
};
|
|
1638
|
+
|
|
1429
1639
|
exports.isMissing = isMissing;
|
|
1430
1640
|
/**
|
|
1431
1641
|
* @method misskingKeys
|
|
@@ -1433,11 +1643,13 @@ exports.isMissing = isMissing;
|
|
|
1433
1643
|
* @param {object} target
|
|
1434
1644
|
* @returns {string[]} the keys of missing required props
|
|
1435
1645
|
*/
|
|
1646
|
+
|
|
1436
1647
|
var missingKeys = function missingKeys(keys, target) {
|
|
1437
1648
|
return keys.filter(function (k) {
|
|
1438
1649
|
return (0, exports.isMissing)(target[k]);
|
|
1439
1650
|
});
|
|
1440
1651
|
};
|
|
1652
|
+
|
|
1441
1653
|
exports.missingKeys = missingKeys;
|
|
1442
1654
|
var propTypes = {
|
|
1443
1655
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1451,10 +1663,11 @@ var propTypes = {
|
|
|
1451
1663
|
* @param {MissingPropsProps} props
|
|
1452
1664
|
* @returns {React.ReactElement}
|
|
1453
1665
|
*/
|
|
1666
|
+
|
|
1454
1667
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1455
1668
|
var width = props.width,
|
|
1456
|
-
|
|
1457
|
-
|
|
1669
|
+
height = props.height,
|
|
1670
|
+
missingProps = props.missingProps;
|
|
1458
1671
|
return React.createElement(Message_1.default, {
|
|
1459
1672
|
"data-test": "message",
|
|
1460
1673
|
width: width,
|
|
@@ -1462,6 +1675,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
1462
1675
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1463
1676
|
});
|
|
1464
1677
|
};
|
|
1678
|
+
|
|
1465
1679
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1466
1680
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1467
1681
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -1481,15 +1695,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
1481
1695
|
Object.defineProperty(exports, "__esModule", {
|
|
1482
1696
|
value: true
|
|
1483
1697
|
});
|
|
1698
|
+
|
|
1484
1699
|
var React = __webpack_require__(1);
|
|
1700
|
+
|
|
1485
1701
|
var styled_components_1 = __webpack_require__(4);
|
|
1702
|
+
|
|
1486
1703
|
var hocUtils_1 = __webpack_require__(15);
|
|
1704
|
+
|
|
1487
1705
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1488
1706
|
displayName: "withEditModeCover__Cover",
|
|
1489
1707
|
componentId: "sc-1gsbnxb-0"
|
|
1490
1708
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1491
1709
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1492
|
-
'data-splunk-visualization-version': "26.
|
|
1710
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
1493
1711
|
}).withConfig({
|
|
1494
1712
|
displayName: "withEditModeCover__Blocker",
|
|
1495
1713
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1500,6 +1718,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1500
1718
|
* @param {ExtendedDashViz} Visualization
|
|
1501
1719
|
* @returns {ExtendedDashViz} Wrapper
|
|
1502
1720
|
*/
|
|
1721
|
+
|
|
1503
1722
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1504
1723
|
var Wrapper = function Wrapper(props) {
|
|
1505
1724
|
var mode = props.mode;
|
|
@@ -1508,12 +1727,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1508
1727
|
"data-test": "edit-mode-cover"
|
|
1509
1728
|
}));
|
|
1510
1729
|
};
|
|
1730
|
+
|
|
1511
1731
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1512
1732
|
Wrapper: Wrapper,
|
|
1513
1733
|
Visualization: Visualization
|
|
1514
1734
|
});
|
|
1515
1735
|
return Wrapper;
|
|
1516
1736
|
};
|
|
1737
|
+
|
|
1517
1738
|
exports.default = withEditModeCover;
|
|
1518
1739
|
|
|
1519
1740
|
/***/ }),
|
|
@@ -1527,6 +1748,7 @@ exports.default = withEditModeCover;
|
|
|
1527
1748
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1528
1749
|
if (k2 === undefined) k2 = k;
|
|
1529
1750
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1751
|
+
|
|
1530
1752
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1531
1753
|
desc = {
|
|
1532
1754
|
enumerable: true,
|
|
@@ -1535,22 +1757,28 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
1535
1757
|
}
|
|
1536
1758
|
};
|
|
1537
1759
|
}
|
|
1760
|
+
|
|
1538
1761
|
Object.defineProperty(o, k2, desc);
|
|
1539
1762
|
} : function (o, m, k, k2) {
|
|
1540
1763
|
if (k2 === undefined) k2 = k;
|
|
1541
1764
|
o[k2] = m[k];
|
|
1542
1765
|
});
|
|
1766
|
+
|
|
1543
1767
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1544
1768
|
for (var p in m) {
|
|
1545
1769
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1546
1770
|
}
|
|
1547
1771
|
};
|
|
1772
|
+
|
|
1548
1773
|
Object.defineProperty(exports, "__esModule", {
|
|
1549
1774
|
value: true
|
|
1550
1775
|
});
|
|
1551
1776
|
exports.default = void 0;
|
|
1777
|
+
|
|
1552
1778
|
__exportStar(__webpack_require__(167), exports);
|
|
1779
|
+
|
|
1553
1780
|
var Scatter_1 = __webpack_require__(167);
|
|
1781
|
+
|
|
1554
1782
|
Object.defineProperty(exports, "default", {
|
|
1555
1783
|
enumerable: true,
|
|
1556
1784
|
get: function get() {
|
|
@@ -1567,32 +1795,48 @@ Object.defineProperty(exports, "default", {
|
|
|
1567
1795
|
|
|
1568
1796
|
|
|
1569
1797
|
var _toConsumableArray = __webpack_require__(8);
|
|
1798
|
+
|
|
1570
1799
|
Object.defineProperty(exports, "__esModule", {
|
|
1571
1800
|
value: true
|
|
1572
1801
|
});
|
|
1573
1802
|
exports.optionsSchema = void 0;
|
|
1803
|
+
|
|
1574
1804
|
var visualization_icons_1 = __webpack_require__(52);
|
|
1805
|
+
|
|
1575
1806
|
var placeholders_1 = __webpack_require__(50);
|
|
1807
|
+
|
|
1576
1808
|
var pick_1 = __webpack_require__(23);
|
|
1809
|
+
|
|
1577
1810
|
var variables_1 = __webpack_require__(11);
|
|
1811
|
+
|
|
1578
1812
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1813
|
+
|
|
1579
1814
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1815
|
+
|
|
1580
1816
|
var i18n_1 = __webpack_require__(2);
|
|
1817
|
+
|
|
1581
1818
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1582
|
-
|
|
1819
|
+
|
|
1820
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
1821
|
+
|
|
1583
1822
|
var configUtils_1 = __webpack_require__(20);
|
|
1823
|
+
|
|
1584
1824
|
var AxesChartDataConfig_1 = __webpack_require__(74);
|
|
1825
|
+
|
|
1585
1826
|
var AxesChartXGridAndLabels_1 = __webpack_require__(77);
|
|
1827
|
+
|
|
1586
1828
|
var AxesChartColorAndStyle_1 = __webpack_require__(75);
|
|
1829
|
+
|
|
1587
1830
|
var AxesChartLegend_1 = __webpack_require__(76);
|
|
1831
|
+
|
|
1588
1832
|
var AxesChartYGridAndLabels_1 = __webpack_require__(78);
|
|
1833
|
+
|
|
1589
1834
|
var dataContract = {
|
|
1590
1835
|
requiredDataSources: [{
|
|
1591
1836
|
name: 'primary',
|
|
1592
1837
|
description: 'DataSource that powers the visualization'
|
|
1593
1838
|
}],
|
|
1594
|
-
optionalDataSources: [
|
|
1595
|
-
// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1839
|
+
optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1596
1840
|
// {
|
|
1597
1841
|
// name: 'annotation',
|
|
1598
1842
|
// description: 'DataSource that populates event annotations',
|
|
@@ -1929,16 +2173,19 @@ var editorConfig = [AxesChartDataConfig_1.AxesChartDataConfigScatter, {
|
|
|
1929
2173
|
/**
|
|
1930
2174
|
* visualization configuration
|
|
1931
2175
|
*/
|
|
2176
|
+
|
|
1932
2177
|
var config = {
|
|
1933
2178
|
/**
|
|
1934
2179
|
* unique viz key
|
|
1935
2180
|
*/
|
|
1936
2181
|
key: 'splunk.scatter',
|
|
2182
|
+
|
|
1937
2183
|
/**
|
|
1938
2184
|
* viz name
|
|
1939
2185
|
*/
|
|
1940
2186
|
name: (0, i18n_1._)('Scatter'),
|
|
1941
2187
|
category: VizCategory_1.VizCategory.CORRELATION,
|
|
2188
|
+
|
|
1942
2189
|
/**
|
|
1943
2190
|
* viz icon
|
|
1944
2191
|
*/
|
|
@@ -1974,10 +2221,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1974
2221
|
value: true
|
|
1975
2222
|
});
|
|
1976
2223
|
exports.convertToScatterSCProperties = exports.mapToOldKey = exports.convertToStringValues = exports.scatterOptionValuesSCMapping = void 0;
|
|
2224
|
+
|
|
1977
2225
|
var lodash_1 = __webpack_require__(3);
|
|
2226
|
+
|
|
1978
2227
|
var propUtils_1 = __webpack_require__(29);
|
|
1979
|
-
|
|
1980
|
-
// map for key names which are either new or not present in SimpleXML options mapping
|
|
2228
|
+
|
|
2229
|
+
var chartingUtils_1 = __webpack_require__(56); // map for key names which are either new or not present in SimpleXML options mapping
|
|
2230
|
+
|
|
2231
|
+
|
|
1981
2232
|
var scatterOptionsSCMapping = {
|
|
1982
2233
|
xAxisLabelRotation: 'xAxisMajorLabelRotation',
|
|
1983
2234
|
xAxisLabelVisibility: 'xAxisMajorLabelVisibility',
|
|
@@ -2001,8 +2252,8 @@ var scatterOptionsSCMapping = {
|
|
|
2001
2252
|
bubbleSizeMax: 'bubbleMaxSize',
|
|
2002
2253
|
bubbleSizeMin: 'bubbleMinSize',
|
|
2003
2254
|
bubbleSizeMethod: 'bubbleSizeBy'
|
|
2004
|
-
};
|
|
2005
|
-
|
|
2255
|
+
}; // key value mapping of what options (and their corresponding values) which we expose in config.ts to property values SC understands
|
|
2256
|
+
|
|
2006
2257
|
exports.scatterOptionValuesSCMapping = {
|
|
2007
2258
|
xAxisTitleVisibility: {
|
|
2008
2259
|
hide: 'collapsed'
|
|
@@ -2027,6 +2278,7 @@ exports.scatterOptionValuesSCMapping = {
|
|
|
2027
2278
|
* @param {Object} options
|
|
2028
2279
|
* @returns {Object}
|
|
2029
2280
|
*/
|
|
2281
|
+
|
|
2030
2282
|
var convertToStringValues = function convertToStringValues(options) {
|
|
2031
2283
|
var updatedOptions = (0, propUtils_1.convertPropsToString)({
|
|
2032
2284
|
vizProps: options,
|
|
@@ -2034,6 +2286,7 @@ var convertToStringValues = function convertToStringValues(options) {
|
|
|
2034
2286
|
});
|
|
2035
2287
|
return Object.assign(Object.assign({}, options), updatedOptions);
|
|
2036
2288
|
};
|
|
2289
|
+
|
|
2037
2290
|
exports.convertToStringValues = convertToStringValues;
|
|
2038
2291
|
/**
|
|
2039
2292
|
* Helper method to update the option names which can be mapped to SimpleXML options or
|
|
@@ -2042,11 +2295,13 @@ exports.convertToStringValues = convertToStringValues;
|
|
|
2042
2295
|
* @param {Object} options
|
|
2043
2296
|
* @returns {Object}
|
|
2044
2297
|
*/
|
|
2298
|
+
|
|
2045
2299
|
var mapToOldKey = function mapToOldKey(options) {
|
|
2046
2300
|
return (0, lodash_1.mapKeys)(options, function (val, key) {
|
|
2047
2301
|
return scatterOptionsSCMapping[key] ? scatterOptionsSCMapping[key] : key;
|
|
2048
2302
|
});
|
|
2049
2303
|
};
|
|
2304
|
+
|
|
2050
2305
|
exports.mapToOldKey = mapToOldKey;
|
|
2051
2306
|
/**
|
|
2052
2307
|
* Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
|
|
@@ -2056,9 +2311,11 @@ exports.mapToOldKey = mapToOldKey;
|
|
|
2056
2311
|
* @param {Object} originalOptions
|
|
2057
2312
|
* @returns {Object}
|
|
2058
2313
|
*/
|
|
2314
|
+
|
|
2059
2315
|
var convertToScatterSCProperties = function convertToScatterSCProperties(originalOptions) {
|
|
2060
2316
|
return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru((0, chartingUtils_1.mapToValues)(exports.scatterOptionValuesSCMapping)).thru(exports.convertToStringValues).value();
|
|
2061
2317
|
};
|
|
2318
|
+
|
|
2062
2319
|
exports.convertToScatterSCProperties = convertToScatterSCProperties;
|
|
2063
2320
|
|
|
2064
2321
|
/***/ }),
|
|
@@ -2072,27 +2329,37 @@ exports.convertToScatterSCProperties = convertToScatterSCProperties;
|
|
|
2072
2329
|
Object.defineProperty(exports, "__esModule", {
|
|
2073
2330
|
value: true
|
|
2074
2331
|
});
|
|
2332
|
+
|
|
2075
2333
|
var React = __webpack_require__(1);
|
|
2334
|
+
|
|
2076
2335
|
var colorUtils_1 = __webpack_require__(12);
|
|
2336
|
+
|
|
2077
2337
|
var variables_1 = __webpack_require__(11);
|
|
2338
|
+
|
|
2078
2339
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
2340
|
+
|
|
2079
2341
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2342
|
+
|
|
2080
2343
|
var hocUtils_1 = __webpack_require__(15);
|
|
2344
|
+
|
|
2081
2345
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
2082
2346
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
2083
2347
|
var config = Visualization.config;
|
|
2084
2348
|
var themes = config.themes;
|
|
2349
|
+
|
|
2085
2350
|
var Wrapper = function Wrapper(props) {
|
|
2086
2351
|
var _a, _b;
|
|
2352
|
+
|
|
2087
2353
|
var dataSources = props.dataSources,
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2354
|
+
loading = props.loading,
|
|
2355
|
+
options = props.options,
|
|
2356
|
+
height = props.height,
|
|
2357
|
+
width = props.width;
|
|
2092
2358
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
2093
2359
|
var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
|
|
2094
2360
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
2095
2361
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
2362
|
+
|
|
2096
2363
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
2097
2364
|
return React.createElement(IconPlaceholder_1.default, {
|
|
2098
2365
|
"data-test": "icon-placeholder",
|
|
@@ -2103,14 +2370,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
2103
2370
|
iconColor: iconColor
|
|
2104
2371
|
});
|
|
2105
2372
|
}
|
|
2373
|
+
|
|
2106
2374
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
2107
2375
|
};
|
|
2376
|
+
|
|
2108
2377
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2109
2378
|
Wrapper: Wrapper,
|
|
2110
2379
|
Visualization: Visualization
|
|
2111
2380
|
});
|
|
2112
2381
|
return Wrapper;
|
|
2113
2382
|
};
|
|
2383
|
+
|
|
2114
2384
|
exports.default = withPlaceholder;
|
|
2115
2385
|
|
|
2116
2386
|
/***/ }),
|
|
@@ -2145,11 +2415,13 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
2145
2415
|
Object.defineProperty(exports, "__esModule", {
|
|
2146
2416
|
value: true
|
|
2147
2417
|
});
|
|
2418
|
+
|
|
2148
2419
|
var i18n_1 = __webpack_require__(2);
|
|
2420
|
+
|
|
2149
2421
|
var background = function background(_ref) {
|
|
2150
2422
|
var label = _ref.label,
|
|
2151
|
-
|
|
2152
|
-
|
|
2423
|
+
themes = _ref.themes,
|
|
2424
|
+
labelPosition = _ref.labelPosition;
|
|
2153
2425
|
return [{
|
|
2154
2426
|
label: (0, i18n_1._)(label || 'Background'),
|
|
2155
2427
|
option: 'backgroundColor',
|
|
@@ -2160,6 +2432,7 @@ var background = function background(_ref) {
|
|
|
2160
2432
|
}
|
|
2161
2433
|
}];
|
|
2162
2434
|
};
|
|
2435
|
+
|
|
2163
2436
|
exports.default = background;
|
|
2164
2437
|
|
|
2165
2438
|
/***/ }),
|
|
@@ -2178,20 +2451,25 @@ module.exports = require("@splunk/charting-bundle");
|
|
|
2178
2451
|
|
|
2179
2452
|
|
|
2180
2453
|
var _toConsumableArray = __webpack_require__(8);
|
|
2454
|
+
|
|
2181
2455
|
var __rest = this && this.__rest || function (s, e) {
|
|
2182
2456
|
var t = {};
|
|
2457
|
+
|
|
2183
2458
|
for (var p in s) {
|
|
2184
2459
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2185
2460
|
}
|
|
2461
|
+
|
|
2186
2462
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2187
2463
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2188
2464
|
}
|
|
2189
2465
|
return t;
|
|
2190
2466
|
};
|
|
2467
|
+
|
|
2191
2468
|
Object.defineProperty(exports, "__esModule", {
|
|
2192
2469
|
value: true
|
|
2193
2470
|
});
|
|
2194
2471
|
exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
|
|
2472
|
+
|
|
2195
2473
|
var lodash_1 = __webpack_require__(3);
|
|
2196
2474
|
/**
|
|
2197
2475
|
* Get formatted annotations
|
|
@@ -2202,10 +2480,12 @@ var lodash_1 = __webpack_require__(3);
|
|
|
2202
2480
|
* @param {Array} options.annotationLabel
|
|
2203
2481
|
* @returns {Array}
|
|
2204
2482
|
*/
|
|
2483
|
+
|
|
2484
|
+
|
|
2205
2485
|
var getAnnotations = function getAnnotations(_ref) {
|
|
2206
2486
|
var annotationX = _ref.annotationX,
|
|
2207
|
-
|
|
2208
|
-
|
|
2487
|
+
annotationColor = _ref.annotationColor,
|
|
2488
|
+
annotationLabel = _ref.annotationLabel;
|
|
2209
2489
|
return annotationX && annotationX.length ? annotationX.map(function (timestamp, i) {
|
|
2210
2490
|
return {
|
|
2211
2491
|
color: annotationColor && annotationColor[i],
|
|
@@ -2214,6 +2494,7 @@ var getAnnotations = function getAnnotations(_ref) {
|
|
|
2214
2494
|
};
|
|
2215
2495
|
}) : [];
|
|
2216
2496
|
};
|
|
2497
|
+
|
|
2217
2498
|
exports.getAnnotations = getAnnotations;
|
|
2218
2499
|
/**
|
|
2219
2500
|
* Truncate the result set to given limit
|
|
@@ -2222,20 +2503,25 @@ exports.getAnnotations = getAnnotations;
|
|
|
2222
2503
|
* @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']
|
|
2223
2504
|
* @returns {Object}
|
|
2224
2505
|
*/
|
|
2506
|
+
|
|
2225
2507
|
var truncateData = function truncateData(dataSet, truncationLimit) {
|
|
2226
2508
|
if (!dataSet) {
|
|
2227
2509
|
return null;
|
|
2228
2510
|
}
|
|
2511
|
+
|
|
2229
2512
|
var limit = parseInt(truncationLimit, 10);
|
|
2513
|
+
|
|
2230
2514
|
if (!limit || limit <= 0) {
|
|
2231
2515
|
return dataSet;
|
|
2232
2516
|
}
|
|
2517
|
+
|
|
2233
2518
|
var truncatedData = Object.assign({}, dataSet);
|
|
2234
2519
|
truncatedData.columns = truncatedData.columns.map(function (columnData) {
|
|
2235
2520
|
return columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData;
|
|
2236
2521
|
});
|
|
2237
2522
|
return truncatedData;
|
|
2238
2523
|
};
|
|
2524
|
+
|
|
2239
2525
|
exports.truncateData = truncateData;
|
|
2240
2526
|
/**
|
|
2241
2527
|
* Helper method to update the option values into the values that SC accepts
|
|
@@ -2243,12 +2529,14 @@ exports.truncateData = truncateData;
|
|
|
2243
2529
|
* @param {Object} options
|
|
2244
2530
|
* @returns {Object}
|
|
2245
2531
|
*/
|
|
2532
|
+
|
|
2246
2533
|
var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
2247
2534
|
return function (options) {
|
|
2248
2535
|
var convertedOptions = Object.assign({}, options);
|
|
2249
2536
|
Object.keys(optionValuesSCMapping).forEach(function (key) {
|
|
2250
2537
|
if ((0, lodash_1.has)(options, key)) {
|
|
2251
2538
|
var updatedValue = optionValuesSCMapping[key][options[key]];
|
|
2539
|
+
|
|
2252
2540
|
if (!(0, lodash_1.isUndefined)(updatedValue)) {
|
|
2253
2541
|
convertedOptions[key] = updatedValue;
|
|
2254
2542
|
}
|
|
@@ -2257,6 +2545,7 @@ var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
|
2257
2545
|
return convertedOptions;
|
|
2258
2546
|
};
|
|
2259
2547
|
};
|
|
2548
|
+
|
|
2260
2549
|
exports.mapToValues = mapToValues;
|
|
2261
2550
|
/**
|
|
2262
2551
|
* Helper method to process options related to y2Fields
|
|
@@ -2264,18 +2553,23 @@ exports.mapToValues = mapToValues;
|
|
|
2264
2553
|
* @param {Object} originalOptions
|
|
2265
2554
|
* @returns {Object}
|
|
2266
2555
|
*/
|
|
2556
|
+
|
|
2267
2557
|
var convertY2AxisOptions = function convertY2AxisOptions(_a) {
|
|
2268
2558
|
var y2Fields = _a.y2Fields,
|
|
2269
|
-
|
|
2559
|
+
originalOptions = __rest(_a, ["y2Fields"]);
|
|
2560
|
+
|
|
2270
2561
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
2562
|
+
|
|
2271
2563
|
if (y2Fields) {
|
|
2272
2564
|
convertedOptions['axisY2.enabled'] = true;
|
|
2273
2565
|
convertedOptions['axisY2.fields'] = (0, lodash_1.isArray)(y2Fields) ? y2Fields.filter(function (name) {
|
|
2274
2566
|
return name;
|
|
2275
2567
|
}).join(',') : y2Fields;
|
|
2276
2568
|
}
|
|
2569
|
+
|
|
2277
2570
|
return convertedOptions;
|
|
2278
2571
|
};
|
|
2572
|
+
|
|
2279
2573
|
exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
2280
2574
|
/**
|
|
2281
2575
|
* Helper method to format value for overlayFields
|
|
@@ -2283,9 +2577,11 @@ exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
|
2283
2577
|
* @param {Object} originalOptions
|
|
2284
2578
|
* @returns {Object}
|
|
2285
2579
|
*/
|
|
2580
|
+
|
|
2286
2581
|
var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
2287
2582
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
2288
2583
|
var overlayFields = originalOptions.overlayFields;
|
|
2584
|
+
|
|
2289
2585
|
if (overlayFields) {
|
|
2290
2586
|
convertedOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
|
|
2291
2587
|
return field;
|
|
@@ -2293,17 +2589,21 @@ var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
|
2293
2589
|
return field.trim();
|
|
2294
2590
|
}).join(',') : overlayFields;
|
|
2295
2591
|
}
|
|
2592
|
+
|
|
2296
2593
|
return convertedOptions;
|
|
2297
2594
|
};
|
|
2595
|
+
|
|
2298
2596
|
exports.convertOverlayFields = convertOverlayFields;
|
|
2299
2597
|
/**
|
|
2300
2598
|
* checks whether data is multi series data
|
|
2301
2599
|
* @param {array} data array
|
|
2302
2600
|
* @return {Boolean}
|
|
2303
2601
|
*/
|
|
2602
|
+
|
|
2304
2603
|
var isMultiSeriesData = function isMultiSeriesData(data) {
|
|
2305
2604
|
return Array.isArray(data) && Array.isArray(data[0]);
|
|
2306
2605
|
};
|
|
2606
|
+
|
|
2307
2607
|
exports.isMultiSeriesData = isMultiSeriesData;
|
|
2308
2608
|
/**
|
|
2309
2609
|
* checks whether data is multi series data and returns value as array
|
|
@@ -2311,19 +2611,22 @@ exports.isMultiSeriesData = isMultiSeriesData;
|
|
|
2311
2611
|
* @param {*} value to return as array
|
|
2312
2612
|
* @return {array}
|
|
2313
2613
|
*/
|
|
2614
|
+
|
|
2314
2615
|
var toArrayForSeries = function toArrayForSeries(data, value) {
|
|
2315
2616
|
return (0, exports.isMultiSeriesData)(data) ? value : [value];
|
|
2316
2617
|
};
|
|
2618
|
+
|
|
2317
2619
|
exports.toArrayForSeries = toArrayForSeries;
|
|
2620
|
+
|
|
2318
2621
|
var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
2319
2622
|
var _ref2$x = _ref2.x,
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2623
|
+
x = _ref2$x === void 0 ? [] : _ref2$x,
|
|
2624
|
+
_ref2$y = _ref2.y,
|
|
2625
|
+
y = _ref2$y === void 0 ? [] : _ref2$y,
|
|
2626
|
+
xField = _ref2.xField,
|
|
2627
|
+
yFields = _ref2.yFields,
|
|
2628
|
+
y2 = _ref2.y2,
|
|
2629
|
+
y2Fields = _ref2.y2Fields;
|
|
2327
2630
|
var columns = [x.map(String)].concat(_toConsumableArray((0, exports.toArrayForSeries)(y, y).map(function (series) {
|
|
2328
2631
|
return series.map(String);
|
|
2329
2632
|
})));
|
|
@@ -2334,10 +2637,10 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
2334
2637
|
return {
|
|
2335
2638
|
name: field
|
|
2336
2639
|
};
|
|
2337
|
-
})));
|
|
2338
|
-
// splunk-charting requires y2 to be part of columns
|
|
2640
|
+
}))); // splunk-charting requires y2 to be part of columns
|
|
2339
2641
|
// when y & y2 options are configured with different (mutually exclusive) series
|
|
2340
2642
|
// y2 columns need to be added to columns
|
|
2643
|
+
|
|
2341
2644
|
if (y2Fields) {
|
|
2342
2645
|
var y2FieldsArray = (0, exports.toArrayForSeries)(y2, y2Fields);
|
|
2343
2646
|
var y2AsArray = (0, exports.toArrayForSeries)(y2, y2).map(function (series) {
|
|
@@ -2352,11 +2655,13 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
2352
2655
|
}
|
|
2353
2656
|
});
|
|
2354
2657
|
}
|
|
2658
|
+
|
|
2355
2659
|
return {
|
|
2356
2660
|
columns: columns,
|
|
2357
2661
|
fields: fields
|
|
2358
2662
|
};
|
|
2359
2663
|
};
|
|
2664
|
+
|
|
2360
2665
|
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
2361
2666
|
|
|
2362
2667
|
/***/ }),
|
|
@@ -2379,6 +2684,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2379
2684
|
});
|
|
2380
2685
|
exports.VizBehavior = void 0;
|
|
2381
2686
|
var VizBehavior;
|
|
2687
|
+
|
|
2382
2688
|
(function (VizBehavior) {
|
|
2383
2689
|
/**
|
|
2384
2690
|
* Dynamic Options Behavior.
|
|
@@ -2398,6 +2704,7 @@ var VizBehavior;
|
|
|
2398
2704
|
* missing.
|
|
2399
2705
|
* @type {string}
|
|
2400
2706
|
*/
|
|
2707
|
+
|
|
2401
2708
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
2402
2709
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
2403
2710
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -2416,23 +2723,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2416
2723
|
});
|
|
2417
2724
|
exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
|
|
2418
2725
|
/* eslint-disable react/no-unused-prop-types */
|
|
2726
|
+
|
|
2419
2727
|
var lodash_1 = __webpack_require__(3);
|
|
2728
|
+
|
|
2420
2729
|
var i18n_1 = __webpack_require__(2);
|
|
2730
|
+
|
|
2421
2731
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
2732
|
+
|
|
2422
2733
|
var react_1 = __webpack_require__(1);
|
|
2734
|
+
|
|
2423
2735
|
var React = __webpack_require__(1);
|
|
2736
|
+
|
|
2424
2737
|
var T = __webpack_require__(0);
|
|
2738
|
+
|
|
2425
2739
|
var react_event_listener_1 = __webpack_require__(66);
|
|
2740
|
+
|
|
2426
2741
|
__webpack_require__(67); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
|
|
2742
|
+
|
|
2743
|
+
|
|
2427
2744
|
var charting_bundle_1 = __webpack_require__(55);
|
|
2745
|
+
|
|
2428
2746
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
2747
|
+
|
|
2429
2748
|
var style_1 = __webpack_require__(14);
|
|
2749
|
+
|
|
2430
2750
|
var styled_components_1 = __webpack_require__(4);
|
|
2751
|
+
|
|
2431
2752
|
var Message_1 = __webpack_require__(10);
|
|
2753
|
+
|
|
2432
2754
|
var useSplunkTheme_1 = __webpack_require__(57);
|
|
2755
|
+
|
|
2433
2756
|
var themeUtils_1 = __webpack_require__(68);
|
|
2757
|
+
|
|
2434
2758
|
var ChartingApi_1 = __webpack_require__(69);
|
|
2759
|
+
|
|
2435
2760
|
exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
|
|
2761
|
+
|
|
2436
2762
|
var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
2437
2763
|
return Object.keys(curOptions).filter(function (key) {
|
|
2438
2764
|
return !(key in nextOptions);
|
|
@@ -2440,7 +2766,9 @@ var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
|
2440
2766
|
return !(key in curOptions) || curOptions[key] !== nextOptions[key];
|
|
2441
2767
|
}));
|
|
2442
2768
|
};
|
|
2769
|
+
|
|
2443
2770
|
exports.changedOptions = changedOptions;
|
|
2771
|
+
|
|
2444
2772
|
function usePrevious(value) {
|
|
2445
2773
|
var ref = (0, react_1.useRef)();
|
|
2446
2774
|
(0, react_1.useEffect)(function () {
|
|
@@ -2448,21 +2776,24 @@ function usePrevious(value) {
|
|
|
2448
2776
|
});
|
|
2449
2777
|
return ref.current;
|
|
2450
2778
|
}
|
|
2779
|
+
|
|
2451
2780
|
var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
|
|
2452
2781
|
// if either of the options are undefined
|
|
2453
2782
|
// it cannot update in place.
|
|
2454
2783
|
if (!curOptions || !nextOptions) {
|
|
2455
2784
|
return false;
|
|
2456
2785
|
}
|
|
2786
|
+
|
|
2457
2787
|
return !exports.NO_INPLACE_PROPS.some(function (p) {
|
|
2458
2788
|
return curOptions[p] !== nextOptions[p];
|
|
2459
2789
|
}) && !(0, exports.changedOptions)(curOptions, nextOptions).some(function (p) {
|
|
2460
2790
|
return p.toLowerCase().endsWith('color');
|
|
2461
2791
|
});
|
|
2462
2792
|
};
|
|
2463
|
-
|
|
2464
|
-
// create 'row' payloads from 'rowContext' in the flattened format:
|
|
2793
|
+
|
|
2794
|
+
exports.canUpdateInPlace = canUpdateInPlace; // create 'row' payloads from 'rowContext' in the flattened format:
|
|
2465
2795
|
// row.<fieldname>.value
|
|
2796
|
+
|
|
2466
2797
|
var updateRowPayload = function updateRowPayload(chartEventRowContext, payload) {
|
|
2467
2798
|
Object.keys(chartEventRowContext || {}).forEach(function (key) {
|
|
2468
2799
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -2470,18 +2801,21 @@ var updateRowPayload = function updateRowPayload(chartEventRowContext, payload)
|
|
|
2470
2801
|
});
|
|
2471
2802
|
return payload;
|
|
2472
2803
|
};
|
|
2804
|
+
|
|
2473
2805
|
exports.updateRowPayload = updateRowPayload;
|
|
2474
2806
|
var VizChartEventType;
|
|
2807
|
+
|
|
2475
2808
|
(function (VizChartEventType) {
|
|
2476
2809
|
VizChartEventType["POINT_CLICK"] = "point.click";
|
|
2477
2810
|
VizChartEventType["POINT_MOUSE_OUT"] = "point.mouseout";
|
|
2478
2811
|
VizChartEventType["POINT_MOUSE_OVER"] = "point.mouseover";
|
|
2479
2812
|
VizChartEventType["LEGEND_CLICK"] = "legend.click";
|
|
2480
|
-
})(VizChartEventType || (VizChartEventType = {}));
|
|
2481
|
-
// @TODO(pwied): remove after HC upgrade to 8+
|
|
2813
|
+
})(VizChartEventType || (VizChartEventType = {})); // @TODO(pwied): remove after HC upgrade to 8+
|
|
2482
2814
|
// .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug
|
|
2483
2815
|
// caused by the accessibility plugin
|
|
2484
2816
|
// https://github.com/highcharts/highcharts/issues/12883
|
|
2817
|
+
|
|
2818
|
+
|
|
2485
2819
|
var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
|
|
2486
2820
|
return {
|
|
2487
2821
|
'data-test': 'charting-container',
|
|
@@ -2509,6 +2843,7 @@ var propTypes = {
|
|
|
2509
2843
|
visualizationApiRef: T.func,
|
|
2510
2844
|
themeKey: T.string
|
|
2511
2845
|
};
|
|
2846
|
+
|
|
2512
2847
|
var Charting = function Charting(props) {
|
|
2513
2848
|
var container = (0, react_1.useRef)(null);
|
|
2514
2849
|
var needsInit = (0, react_1.useRef)(true);
|
|
@@ -2516,6 +2851,7 @@ var Charting = function Charting(props) {
|
|
|
2516
2851
|
var needsRedraw = (0, react_1.useRef)(true);
|
|
2517
2852
|
var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
|
|
2518
2853
|
var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
|
|
2854
|
+
|
|
2519
2855
|
var computeChartingSize = function computeChartingSize() {
|
|
2520
2856
|
if (container.current) {
|
|
2521
2857
|
var rect = container.current.getBoundingClientRect();
|
|
@@ -2524,48 +2860,56 @@ var Charting = function Charting(props) {
|
|
|
2524
2860
|
width: rect.width
|
|
2525
2861
|
};
|
|
2526
2862
|
}
|
|
2863
|
+
|
|
2527
2864
|
return {};
|
|
2528
2865
|
};
|
|
2866
|
+
|
|
2529
2867
|
var splunkTheme = (0, useSplunkTheme_1.default)();
|
|
2530
2868
|
var themeKey = props.themeKey ? props.themeKey : (0, themeUtils_1.getChartingThemeKey)({
|
|
2531
2869
|
splunkThemeV1: splunkTheme
|
|
2532
2870
|
});
|
|
2533
2871
|
var width = props.width,
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2872
|
+
height = props.height,
|
|
2873
|
+
style = props.style,
|
|
2874
|
+
chartData = props.chartData,
|
|
2875
|
+
options = props.options,
|
|
2876
|
+
colorPalette = props.colorPalette,
|
|
2877
|
+
onClick = props.onClick,
|
|
2878
|
+
onSelect = props.onSelect,
|
|
2879
|
+
onPointMouseOut = props.onPointMouseOut,
|
|
2880
|
+
onPointMouseOver = props.onPointMouseOver,
|
|
2881
|
+
onEventTrigger = props.onEventTrigger;
|
|
2544
2882
|
var prevOptions = usePrevious(options);
|
|
2545
2883
|
var prevTimezone = usePrevious(timezone);
|
|
2884
|
+
|
|
2546
2885
|
var handleClick = function handleClick(chartEvent, type) {
|
|
2547
2886
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
|
|
2548
2887
|
payload.name = payload.name2;
|
|
2549
2888
|
delete payload.name2;
|
|
2889
|
+
|
|
2550
2890
|
if (type === VizChartEventType.POINT_CLICK) {
|
|
2551
2891
|
payload.value = payload.value2;
|
|
2552
2892
|
delete payload.value2;
|
|
2553
2893
|
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
2554
2894
|
}
|
|
2895
|
+
|
|
2555
2896
|
onClick({
|
|
2556
2897
|
type: type,
|
|
2557
2898
|
originalEvent: chartEvent,
|
|
2558
2899
|
payload: payload
|
|
2559
2900
|
});
|
|
2560
2901
|
};
|
|
2902
|
+
|
|
2561
2903
|
var destroyChart = function destroyChart() {
|
|
2562
2904
|
if (chart.current) {
|
|
2563
2905
|
chart.current.destroy();
|
|
2564
2906
|
chart.current = null;
|
|
2565
2907
|
}
|
|
2908
|
+
|
|
2566
2909
|
needsRedraw.current = true;
|
|
2567
2910
|
needsInit.current = true;
|
|
2568
2911
|
};
|
|
2912
|
+
|
|
2569
2913
|
var handleSelect = function handleSelect(chartEvent) {
|
|
2570
2914
|
// todo: need change this after breaking all visualizations
|
|
2571
2915
|
if (onSelect && typeof onSelect === 'function') {
|
|
@@ -2575,14 +2919,16 @@ var Charting = function Charting(props) {
|
|
|
2575
2919
|
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2576
2920
|
});
|
|
2577
2921
|
return;
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2922
|
+
} // the chartEvent here is a jQuery event
|
|
2923
|
+
|
|
2924
|
+
|
|
2580
2925
|
onEventTrigger({
|
|
2581
2926
|
type: 'range.select',
|
|
2582
2927
|
originalEvent: chartEvent,
|
|
2583
2928
|
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2584
2929
|
});
|
|
2585
2930
|
};
|
|
2931
|
+
|
|
2586
2932
|
var handlePointMouseOut = function handlePointMouseOut(chartEvent, type) {
|
|
2587
2933
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2588
2934
|
payload.name = payload.name2;
|
|
@@ -2596,6 +2942,7 @@ var Charting = function Charting(props) {
|
|
|
2596
2942
|
payload: payload
|
|
2597
2943
|
});
|
|
2598
2944
|
};
|
|
2945
|
+
|
|
2599
2946
|
var handlePointMouseOver = function handlePointMouseOver(chartEvent, type) {
|
|
2600
2947
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2601
2948
|
payload.name = payload.name2;
|
|
@@ -2609,6 +2956,7 @@ var Charting = function Charting(props) {
|
|
|
2609
2956
|
payload: payload
|
|
2610
2957
|
});
|
|
2611
2958
|
};
|
|
2959
|
+
|
|
2612
2960
|
var drawChart = function drawChart() {
|
|
2613
2961
|
var updatedOptions = Object.assign(Object.assign({}, options), {
|
|
2614
2962
|
shouldColorizeTooltipData: false
|
|
@@ -2619,15 +2967,18 @@ var Charting = function Charting(props) {
|
|
|
2619
2967
|
var serializedTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone;
|
|
2620
2968
|
var ianaTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone;
|
|
2621
2969
|
var utcOffset = timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset;
|
|
2970
|
+
|
|
2622
2971
|
if (!computedWidth || !computedHeight) {
|
|
2623
2972
|
return;
|
|
2624
2973
|
}
|
|
2974
|
+
|
|
2625
2975
|
if (!chartData || !Object.keys(chartData).length) {
|
|
2626
2976
|
return;
|
|
2627
|
-
}
|
|
2628
|
-
// splunk-charting layers configuration option updates.
|
|
2977
|
+
} // splunk-charting layers configuration option updates.
|
|
2629
2978
|
// when an option is removed it needs to be set to an empty string
|
|
2630
2979
|
// to override the previous configuration
|
|
2980
|
+
|
|
2981
|
+
|
|
2631
2982
|
if (prevOptions) {
|
|
2632
2983
|
Object.keys(prevOptions).forEach(function (key) {
|
|
2633
2984
|
if (updatedOptions[key] === undefined) {
|
|
@@ -2635,13 +2986,16 @@ var Charting = function Charting(props) {
|
|
|
2635
2986
|
}
|
|
2636
2987
|
});
|
|
2637
2988
|
}
|
|
2989
|
+
|
|
2638
2990
|
try {
|
|
2639
2991
|
if (needsInit.current) {
|
|
2640
2992
|
destroyChart();
|
|
2641
2993
|
charting_bundle_1.default.setTheme(themeKey);
|
|
2994
|
+
|
|
2642
2995
|
if (colorPalette.length > 0) {
|
|
2643
2996
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
2644
2997
|
}
|
|
2998
|
+
|
|
2645
2999
|
chart.current = charting_bundle_1.default.createChart(container.current, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedOptions), {
|
|
2646
3000
|
drilldown: 'all'
|
|
2647
3001
|
}), typeof serializedTimezone === 'string' && {
|
|
@@ -2650,8 +3004,8 @@ var Charting = function Charting(props) {
|
|
|
2650
3004
|
'time.ianaTimezone': ianaTimezone
|
|
2651
3005
|
}), typeof utcOffset === 'number' && {
|
|
2652
3006
|
'time.timezoneOffset': utcOffset
|
|
2653
|
-
}));
|
|
2654
|
-
|
|
3007
|
+
})); // bind event handlers
|
|
3008
|
+
|
|
2655
3009
|
chart.current.on('pointClick', function (e) {
|
|
2656
3010
|
handleClick(e, VizChartEventType.POINT_CLICK);
|
|
2657
3011
|
});
|
|
@@ -2666,29 +3020,37 @@ var Charting = function Charting(props) {
|
|
|
2666
3020
|
});
|
|
2667
3021
|
chart.current.on('chartRangeSelect', handleSelect);
|
|
2668
3022
|
}
|
|
3023
|
+
|
|
2669
3024
|
if (needsRedraw.current) {
|
|
2670
3025
|
charting_bundle_1.default.setTheme(themeKey);
|
|
3026
|
+
|
|
2671
3027
|
if (colorPalette.length > 0) {
|
|
2672
3028
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
2673
3029
|
}
|
|
3030
|
+
|
|
2674
3031
|
chart.current.prepareAndDraw(chartData, updatedOptions, function () {});
|
|
2675
3032
|
}
|
|
3033
|
+
|
|
2676
3034
|
if (chart.current) {
|
|
2677
3035
|
if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
|
|
2678
3036
|
chart.current.resize(computedWidth, computedHeight);
|
|
2679
3037
|
}
|
|
2680
3038
|
}
|
|
3039
|
+
|
|
2681
3040
|
needsInit.current = false;
|
|
2682
3041
|
needsRedraw.current = false;
|
|
2683
3042
|
} catch (e) {
|
|
2684
3043
|
window.console.error('Caught error rendering chart:', e);
|
|
2685
3044
|
}
|
|
2686
3045
|
};
|
|
3046
|
+
|
|
2687
3047
|
var debouncedDrawChart = (0, lodash_1.debounce)(drawChart, 5);
|
|
3048
|
+
|
|
2688
3049
|
var onContainerMount = function onContainerMount(chartingContainer) {
|
|
2689
3050
|
container.current = chartingContainer;
|
|
2690
3051
|
debouncedDrawChart();
|
|
2691
3052
|
};
|
|
3053
|
+
|
|
2692
3054
|
var prevTheme = usePrevious(themeKey);
|
|
2693
3055
|
var prevOnClick = usePrevious(onClick);
|
|
2694
3056
|
(0, react_1.useEffect)(function () {
|
|
@@ -2702,14 +3064,14 @@ var Charting = function Charting(props) {
|
|
|
2702
3064
|
(0, react_1.useEffect)(function () {
|
|
2703
3065
|
// TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme
|
|
2704
3066
|
// seems like redraw doesn't suffice to update the background colors
|
|
2705
|
-
if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) ||
|
|
2706
|
-
// timezone is a simple object so this comparison should be fast
|
|
3067
|
+
if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
|
|
2707
3068
|
JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
|
|
2708
3069
|
needsInit.current = true;
|
|
2709
3070
|
}
|
|
2710
|
-
|
|
2711
|
-
// need to immediately call drawChart upon an option or chartData change
|
|
3071
|
+
|
|
3072
|
+
needsRedraw.current = true; // need to immediately call drawChart upon an option or chartData change
|
|
2712
3073
|
// otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
|
|
3074
|
+
|
|
2713
3075
|
drawChart();
|
|
2714
3076
|
}, [JSON.stringify(options), JSON.stringify(chartData.toJSON()), JSON.stringify(chartData.annotations), timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone, timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset, timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone, themeKey, onClick]);
|
|
2715
3077
|
return React.createElement(ChartingContainer, {
|
|
@@ -2722,6 +3084,7 @@ var Charting = function Charting(props) {
|
|
|
2722
3084
|
onResize: debouncedDrawChart
|
|
2723
3085
|
}));
|
|
2724
3086
|
};
|
|
3087
|
+
|
|
2725
3088
|
var defaultProps = {
|
|
2726
3089
|
width: '100%',
|
|
2727
3090
|
height: 250,
|
|
@@ -2739,31 +3102,36 @@ var defaultProps = {
|
|
|
2739
3102
|
themeKey: null
|
|
2740
3103
|
};
|
|
2741
3104
|
Charting.propTypes = propTypes;
|
|
2742
|
-
Charting.defaultProps = defaultProps;
|
|
2743
|
-
|
|
3105
|
+
Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
|
|
3106
|
+
|
|
2744
3107
|
var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
|
|
2745
3108
|
var Wrapper = function Wrapper(props) {
|
|
2746
3109
|
var chartData = props.chartData;
|
|
3110
|
+
|
|
2747
3111
|
if (!chartData) {
|
|
2748
3112
|
return React.createElement(Message_1.default, {
|
|
2749
3113
|
message: (0, i18n_1._)('No DataSource'),
|
|
2750
3114
|
level: "warning"
|
|
2751
3115
|
});
|
|
2752
3116
|
}
|
|
3117
|
+
|
|
2753
3118
|
if (chartData && !Object.keys(chartData).length) {
|
|
2754
3119
|
return React.createElement(Message_1.default, {
|
|
2755
3120
|
message: (0, i18n_1._)('No Result'),
|
|
2756
3121
|
level: "info"
|
|
2757
3122
|
});
|
|
2758
3123
|
}
|
|
3124
|
+
|
|
2759
3125
|
return React.createElement(Chart, Object.assign({}, props));
|
|
2760
3126
|
};
|
|
3127
|
+
|
|
2761
3128
|
Wrapper.displayName = 'ChartingWrapper';
|
|
2762
3129
|
Wrapper.propTypes = propTypes;
|
|
2763
3130
|
Wrapper.defaultProps = defaultProps;
|
|
2764
3131
|
return Wrapper;
|
|
2765
|
-
};
|
|
2766
|
-
|
|
3132
|
+
}; // export default Charting;
|
|
3133
|
+
|
|
3134
|
+
|
|
2767
3135
|
exports.default = withEmptyChartMessage(Charting);
|
|
2768
3136
|
|
|
2769
3137
|
/***/ }),
|
|
@@ -2796,15 +3164,19 @@ module.exports = require("@splunk/visualizations-shared/themeUtils");
|
|
|
2796
3164
|
|
|
2797
3165
|
|
|
2798
3166
|
var _classCallCheck = __webpack_require__(9);
|
|
3167
|
+
|
|
2799
3168
|
var _createClass = __webpack_require__(18);
|
|
3169
|
+
|
|
2800
3170
|
Object.defineProperty(exports, "__esModule", {
|
|
2801
3171
|
value: true
|
|
2802
3172
|
});
|
|
2803
3173
|
exports.ChartingApiFunctional = void 0;
|
|
3174
|
+
|
|
2804
3175
|
var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
2805
3176
|
// eslint-disable-next-line no-useless-constructor
|
|
2806
3177
|
function ChartingApiFunctional(chartRef) {
|
|
2807
3178
|
_classCallCheck(this, ChartingApiFunctional);
|
|
3179
|
+
|
|
2808
3180
|
this.chartRef = chartRef;
|
|
2809
3181
|
}
|
|
2810
3182
|
/**
|
|
@@ -2812,15 +3184,18 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
|
2812
3184
|
*
|
|
2813
3185
|
* @memberof ChartingApiFunctional
|
|
2814
3186
|
*/
|
|
3187
|
+
|
|
3188
|
+
|
|
2815
3189
|
_createClass(ChartingApiFunctional, [{
|
|
2816
3190
|
key: "highlight",
|
|
2817
3191
|
value: function highlight() {
|
|
2818
3192
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
3193
|
+
xValue: '',
|
|
3194
|
+
seriesName: ''
|
|
3195
|
+
},
|
|
3196
|
+
xValue = _ref.xValue,
|
|
3197
|
+
seriesName = _ref.seriesName;
|
|
3198
|
+
|
|
2824
3199
|
this.getChart().highlight(xValue, seriesName);
|
|
2825
3200
|
}
|
|
2826
3201
|
/**
|
|
@@ -2828,21 +3203,25 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
|
2828
3203
|
*
|
|
2829
3204
|
* @memberof ChartingApiFunctional
|
|
2830
3205
|
*/
|
|
3206
|
+
|
|
2831
3207
|
}, {
|
|
2832
3208
|
key: "unHighlight",
|
|
2833
3209
|
value: function unHighlight() {
|
|
2834
3210
|
this.getChart().unHighlight();
|
|
2835
|
-
}
|
|
2836
|
-
|
|
3211
|
+
} // returns chart object
|
|
3212
|
+
|
|
2837
3213
|
}, {
|
|
2838
3214
|
key: "getChart",
|
|
2839
3215
|
value: function getChart() {
|
|
2840
3216
|
var _a;
|
|
3217
|
+
|
|
2841
3218
|
return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
|
|
2842
3219
|
}
|
|
2843
3220
|
}]);
|
|
3221
|
+
|
|
2844
3222
|
return ChartingApiFunctional;
|
|
2845
3223
|
}();
|
|
3224
|
+
|
|
2846
3225
|
exports.ChartingApiFunctional = ChartingApiFunctional;
|
|
2847
3226
|
|
|
2848
3227
|
/***/ }),
|
|
@@ -2868,12 +3247,16 @@ module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
|
|
|
2868
3247
|
|
|
2869
3248
|
|
|
2870
3249
|
var _toConsumableArray = __webpack_require__(8);
|
|
3250
|
+
|
|
2871
3251
|
Object.defineProperty(exports, "__esModule", {
|
|
2872
3252
|
value: true
|
|
2873
3253
|
});
|
|
2874
3254
|
exports.AxesChartDataConfigAreaColumnLine = exports.AxesChartDataConfigBubble = exports.AxesChartDataConfigScatter = exports.AxesChartDataConfigBar = void 0;
|
|
3255
|
+
|
|
2875
3256
|
var i18n_1 = __webpack_require__(2);
|
|
3257
|
+
|
|
2876
3258
|
var configUtils_1 = __webpack_require__(20);
|
|
3259
|
+
|
|
2877
3260
|
var AxesChartDataConfig = {
|
|
2878
3261
|
label: (0, i18n_1._)('Data configurations'),
|
|
2879
3262
|
layout: [[{
|
|
@@ -3007,10 +3390,15 @@ exports.default = AxesChartDataConfig;
|
|
|
3007
3390
|
Object.defineProperty(exports, "__esModule", {
|
|
3008
3391
|
value: true
|
|
3009
3392
|
});
|
|
3393
|
+
|
|
3010
3394
|
var i18n_1 = __webpack_require__(2);
|
|
3395
|
+
|
|
3011
3396
|
var pick_1 = __webpack_require__(23);
|
|
3397
|
+
|
|
3012
3398
|
var variables_1 = __webpack_require__(11);
|
|
3399
|
+
|
|
3013
3400
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
3401
|
+
|
|
3014
3402
|
var themes = {
|
|
3015
3403
|
defaultBackgroundColor: function defaultBackgroundColor(props) {
|
|
3016
3404
|
return (0, pick_1.default)({
|
|
@@ -3049,7 +3437,9 @@ exports.default = AxesChartColorAndStyle;
|
|
|
3049
3437
|
Object.defineProperty(exports, "__esModule", {
|
|
3050
3438
|
value: true
|
|
3051
3439
|
});
|
|
3440
|
+
|
|
3052
3441
|
var i18n_1 = __webpack_require__(2);
|
|
3442
|
+
|
|
3053
3443
|
var AxesChartLegend = {
|
|
3054
3444
|
label: (0, i18n_1._)('Legend'),
|
|
3055
3445
|
layout: [[{
|
|
@@ -3110,12 +3500,16 @@ exports.default = AxesChartLegend;
|
|
|
3110
3500
|
|
|
3111
3501
|
|
|
3112
3502
|
var _toConsumableArray = __webpack_require__(8);
|
|
3503
|
+
|
|
3113
3504
|
Object.defineProperty(exports, "__esModule", {
|
|
3114
3505
|
value: true
|
|
3115
3506
|
});
|
|
3116
3507
|
exports.AxesChartXGridAndLabelsBubbleScatter = exports.AxesChartXGridAndLabelsCommon = void 0;
|
|
3508
|
+
|
|
3117
3509
|
var i18n_1 = __webpack_require__(2);
|
|
3510
|
+
|
|
3118
3511
|
var configUtils_1 = __webpack_require__(20);
|
|
3512
|
+
|
|
3119
3513
|
exports.AxesChartXGridAndLabelsCommon = {
|
|
3120
3514
|
label: (0, i18n_1._)('X-axis grid and labels'),
|
|
3121
3515
|
layout: [[{
|
|
@@ -3304,8 +3698,7 @@ exports.AxesChartXGridAndLabelsBubbleScatter = {
|
|
|
3304
3698
|
label: (0, i18n_1._)('Axis line visibility'),
|
|
3305
3699
|
option: 'xAxisLineVisibility',
|
|
3306
3700
|
editor: 'editor.checkbox'
|
|
3307
|
-
}],
|
|
3308
|
-
// this option is disabled for bubble and scatter
|
|
3701
|
+
}], // this option is disabled for bubble and scatter
|
|
3309
3702
|
// [
|
|
3310
3703
|
// {
|
|
3311
3704
|
// label: _('Major gridlines'),
|
|
@@ -3398,7 +3791,9 @@ exports.default = AxesChartXGridAndLabels;
|
|
|
3398
3791
|
Object.defineProperty(exports, "__esModule", {
|
|
3399
3792
|
value: true
|
|
3400
3793
|
});
|
|
3794
|
+
|
|
3401
3795
|
var i18n_1 = __webpack_require__(2);
|
|
3796
|
+
|
|
3402
3797
|
var AxesChartYGridAndLabels = {
|
|
3403
3798
|
label: (0, i18n_1._)('Y-axis grid and labels'),
|
|
3404
3799
|
layout: [[{
|