@splunk/visualizations 26.0.0 → 26.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +103 -19
- package/Area.config.js.map +1 -1
- package/Area.js +646 -243
- package/Area.js.map +1 -1
- package/Bar.config.js +105 -21
- package/Bar.config.js.map +1 -1
- package/Bar.js +653 -237
- package/Bar.js.map +1 -1
- package/Bubble.config.js +95 -21
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +635 -229
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +66 -15
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +589 -211
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +104 -19
- package/Column.config.js.map +1 -1
- package/Column.js +666 -239
- package/Column.js.map +1 -1
- package/Ellipse.config.js +83 -18
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +444 -156
- package/Ellipse.js.map +1 -1
- package/Events.config.js +101 -19
- package/Events.config.js.map +1 -1
- package/Events.js +792 -322
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +97 -28
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +786 -390
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +63 -19
- package/Image.config.js.map +1 -1
- package/Image.js +439 -164
- package/Image.js.map +1 -1
- package/Line.config.js +107 -23
- package/Line.config.js.map +1 -1
- package/Line.js +841 -456
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +73 -23
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +653 -230
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +244 -99
- package/Map.config.js.map +1 -1
- package/Map.js +1223 -612
- package/Map.js.map +1 -1
- package/Markdown.config.js +71 -21
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +477 -202
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +80 -22
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +819 -418
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +73 -19
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +870 -491
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +76 -23
- package/Pie.config.js.map +1 -1
- package/Pie.js +643 -233
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +82 -30
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +863 -387
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +86 -20
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +449 -159
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +85 -23
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +895 -349
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +97 -23
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +639 -234
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +95 -25
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1198 -656
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +287 -226
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +93 -23
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +991 -522
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +100 -27
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1185 -624
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +127 -68
- package/SparkLine.js.map +1 -1
- package/Table.config.js +74 -21
- package/Table.config.js.map +1 -1
- package/Table.js +827 -329
- package/Table.js.map +1 -1
- package/common/Charting.js +152 -69
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +25 -14
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +530 -0
- package/common/DocExampleWithVizSandbox.js.map +1 -0
- package/common/EventsDoc.js +139 -104
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +79 -69
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +54 -45
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +178 -87
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +530 -68
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +47 -20
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +15 -9
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +57 -44
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +52 -20
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +139 -7
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +185 -102
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +28 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +50 -15
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +8 -3
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +4 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -1
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +288 -128
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +242 -197
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -1
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +62 -1
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +3 -1
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +389 -192
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +18 -26
package/Pie.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -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.1 - b6df0a015",
|
|
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
|
/***/ }),
|
|
@@ -243,9 +254,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
243
254
|
* @param {DashboardVizType} props.Wrapper
|
|
244
255
|
* @param {DashboardVizType} props.Visualization
|
|
245
256
|
*/
|
|
257
|
+
|
|
246
258
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
247
259
|
var Wrapper = _ref.Wrapper,
|
|
248
|
-
|
|
260
|
+
Visualization = _ref.Visualization;
|
|
249
261
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
250
262
|
extendProperties.forEach(function (prop) {
|
|
251
263
|
if (Visualization[prop]) {
|
|
@@ -254,6 +266,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
254
266
|
}
|
|
255
267
|
});
|
|
256
268
|
};
|
|
269
|
+
|
|
257
270
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
258
271
|
|
|
259
272
|
/***/ }),
|
|
@@ -265,7 +278,7 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
|
265
278
|
|
|
266
279
|
/***/ }),
|
|
267
280
|
|
|
268
|
-
/***/
|
|
281
|
+
/***/ 165:
|
|
269
282
|
/***/ (function(module, exports, __webpack_require__) {
|
|
270
283
|
|
|
271
284
|
"use strict";
|
|
@@ -273,46 +286,63 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
|
273
286
|
|
|
274
287
|
var __rest = this && this.__rest || function (s, e) {
|
|
275
288
|
var t = {};
|
|
289
|
+
|
|
276
290
|
for (var p in s) {
|
|
277
291
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
278
292
|
}
|
|
293
|
+
|
|
279
294
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
280
295
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
281
296
|
}
|
|
282
297
|
return t;
|
|
283
298
|
};
|
|
299
|
+
|
|
284
300
|
Object.defineProperty(exports, "__esModule", {
|
|
285
301
|
value: true
|
|
286
302
|
});
|
|
287
303
|
exports.config = exports.themes = exports.showPlaceHolderIcon = exports.computeVizProps = exports.PieInnerSize = void 0;
|
|
288
|
-
|
|
289
|
-
// Charting imports i18n which needs to be run to instantiate window globals in the
|
|
304
|
+
|
|
305
|
+
var lodash_1 = __webpack_require__(3); // Charting imports i18n which needs to be run to instantiate window globals in the
|
|
290
306
|
// eslint-disable-next-line import/order
|
|
307
|
+
|
|
308
|
+
|
|
291
309
|
var Charting_1 = __webpack_require__(65);
|
|
310
|
+
|
|
292
311
|
var charting_bundle_1 = __webpack_require__(55);
|
|
312
|
+
|
|
293
313
|
var simpleXMLOptions_1 = __webpack_require__(70);
|
|
314
|
+
|
|
294
315
|
var config_1 = __webpack_require__(441);
|
|
316
|
+
|
|
295
317
|
exports.config = config_1.default;
|
|
296
|
-
|
|
318
|
+
|
|
319
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
320
|
+
|
|
297
321
|
var pieUtils_1 = __webpack_require__(443);
|
|
298
|
-
|
|
322
|
+
|
|
323
|
+
var chartingUtils_1 = __webpack_require__(57);
|
|
324
|
+
|
|
299
325
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
326
|
+
|
|
300
327
|
var validOptions = Object.keys(config_1.default.optionsSchema);
|
|
301
328
|
exports.PieInnerSize = 0.7;
|
|
329
|
+
|
|
302
330
|
var computeVizProps = function computeVizProps(_a) {
|
|
303
331
|
var dataSources = _a.dataSources,
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
332
|
+
onEventTrigger = _a.onEventTrigger,
|
|
333
|
+
label = _a.label,
|
|
334
|
+
value = _a.value,
|
|
335
|
+
showDonutHole = _a.showDonutHole,
|
|
336
|
+
visualizationApiRef = _a.visualizationApiRef,
|
|
337
|
+
otherOptions = __rest(_a, ["dataSources", "onEventTrigger", "label", "value", "showDonutHole", "visualizationApiRef"]); // options to be passed as props
|
|
338
|
+
|
|
339
|
+
|
|
310
340
|
var computedProps = {
|
|
311
341
|
visualizationApiRef: visualizationApiRef
|
|
312
342
|
};
|
|
313
343
|
var labelField = otherOptions.labelField,
|
|
314
|
-
|
|
315
|
-
|
|
344
|
+
valueField = otherOptions.valueField,
|
|
345
|
+
hasEventHandlers = otherOptions.hasEventHandlers;
|
|
316
346
|
computedProps.options = (0, lodash_1.chain)(otherOptions).pick(validOptions).thru(pieUtils_1.convertToPieSCProperties).thru(function (options) {
|
|
317
347
|
return Object.assign(Object.assign({}, (0, simpleXMLOptions_1.getSimpleXMLOptionsForProps)(options)), {
|
|
318
348
|
chart: 'pie'
|
|
@@ -327,33 +357,42 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
327
357
|
}, {
|
|
328
358
|
name: valueField
|
|
329
359
|
}];
|
|
360
|
+
|
|
330
361
|
if (!value) {
|
|
331
362
|
primaryData.columns = [label, []];
|
|
332
363
|
}
|
|
364
|
+
|
|
333
365
|
primaryData.columns.forEach(function (column, index) {
|
|
334
366
|
if (column) {
|
|
335
367
|
primaryData.columns[index] = column.map(String);
|
|
336
368
|
}
|
|
337
369
|
});
|
|
370
|
+
|
|
338
371
|
if (truncationLimit) {
|
|
339
372
|
primaryData = (0, chartingUtils_1.truncateData)(primaryData, truncationLimit);
|
|
340
373
|
}
|
|
374
|
+
|
|
341
375
|
computedProps.chartData = charting_bundle_1.default.extractChartReadyData(Object.assign({}, primaryData));
|
|
376
|
+
|
|
342
377
|
if (showDonutHole) {
|
|
343
378
|
computedProps.options['chart.pieInnerSize'] = exports.PieInnerSize;
|
|
344
379
|
} else {
|
|
345
380
|
computedProps.options['chart.pieInnerSize'] = 0;
|
|
346
381
|
}
|
|
382
|
+
|
|
347
383
|
if (hasEventHandlers) {
|
|
348
384
|
computedProps.onClick = onEventTrigger;
|
|
349
385
|
}
|
|
386
|
+
|
|
350
387
|
return computedProps;
|
|
351
388
|
};
|
|
352
|
-
|
|
353
|
-
// Returns true to display the placeholder icon, if invalid datasource condition or invalid data value/labels condition is met
|
|
389
|
+
|
|
390
|
+
exports.computeVizProps = computeVizProps; // Returns true to display the placeholder icon, if invalid datasource condition or invalid data value/labels condition is met
|
|
391
|
+
|
|
354
392
|
var showPlaceHolderIcon = function showPlaceHolderIcon(dataSources, loading, options) {
|
|
355
393
|
return (0, IconPlaceholder_1.shouldShowIconPlaceholder)(dataSources, loading) || (0, pieUtils_1.invalidOptionField)('value', dataSources, options, config_1.default) || (0, pieUtils_1.invalidOptionField)('label', dataSources, options, config_1.default) || (0, pieUtils_1.allInvalidDataValues)(dataSources, options, config_1.default);
|
|
356
394
|
};
|
|
395
|
+
|
|
357
396
|
exports.showPlaceHolderIcon = showPlaceHolderIcon;
|
|
358
397
|
var Pie = (0, withDashboardViz_1.default)({
|
|
359
398
|
ReactViz: Charting_1.default,
|
|
@@ -404,24 +443,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
404
443
|
|
|
405
444
|
|
|
406
445
|
var _toConsumableArray = __webpack_require__(8);
|
|
446
|
+
|
|
407
447
|
var _defineProperty = __webpack_require__(7);
|
|
448
|
+
|
|
408
449
|
var __rest = this && this.__rest || function (s, e) {
|
|
409
450
|
var t = {};
|
|
451
|
+
|
|
410
452
|
for (var p in s) {
|
|
411
453
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
412
454
|
}
|
|
455
|
+
|
|
413
456
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
414
457
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
415
458
|
}
|
|
416
459
|
return t;
|
|
417
460
|
};
|
|
461
|
+
|
|
418
462
|
Object.defineProperty(exports, "__esModule", {
|
|
419
463
|
value: true
|
|
420
464
|
});
|
|
421
465
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
466
|
+
|
|
422
467
|
var lodash_1 = __webpack_require__(3);
|
|
468
|
+
|
|
423
469
|
var schemaUtils_1 = __webpack_require__(16);
|
|
470
|
+
|
|
424
471
|
var VizBehavior_1 = __webpack_require__(6);
|
|
472
|
+
|
|
425
473
|
var dynamicOptionsDSLType = {
|
|
426
474
|
type: 'string',
|
|
427
475
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -431,20 +479,22 @@ var dynamicOptionsDSLType = {
|
|
|
431
479
|
* @param optionsSchema a visualization's options schema
|
|
432
480
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
433
481
|
*/
|
|
482
|
+
|
|
434
483
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
435
484
|
var enhancedOptionsSchema = {};
|
|
436
485
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
437
486
|
var _a = optionsSchema[key],
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
487
|
+
title = _a.title,
|
|
488
|
+
description = _a.description,
|
|
489
|
+
readOnly = _a.readOnly,
|
|
490
|
+
writeOnly = _a.writeOnly,
|
|
491
|
+
examples = _a.examples,
|
|
492
|
+
defaultValue = _a.default,
|
|
493
|
+
type = _a.type,
|
|
494
|
+
properties = _a.properties,
|
|
495
|
+
patternProperties = _a.patternProperties,
|
|
496
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
497
|
+
|
|
448
498
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
449
499
|
title: title
|
|
450
500
|
}), description !== undefined && {
|
|
@@ -458,12 +508,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
458
508
|
}), defaultValue !== undefined && {
|
|
459
509
|
default: defaultValue
|
|
460
510
|
});
|
|
511
|
+
|
|
461
512
|
if (type === 'object') {
|
|
462
513
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
463
514
|
type: type
|
|
464
515
|
}), properties && {
|
|
465
516
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
466
517
|
});
|
|
518
|
+
|
|
467
519
|
if (patternProperties) {
|
|
468
520
|
var enhancedPatternProperties = {};
|
|
469
521
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -481,6 +533,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
481
533
|
});
|
|
482
534
|
return enhancedOptionsSchema;
|
|
483
535
|
}
|
|
536
|
+
|
|
484
537
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
485
538
|
/**
|
|
486
539
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -489,11 +542,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
489
542
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
490
543
|
* and containing `open: false` for all editor panels in editorConfig
|
|
491
544
|
*/
|
|
545
|
+
|
|
492
546
|
function enhanceConfig(vizConfig) {
|
|
493
547
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
548
|
+
|
|
494
549
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
495
550
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
496
551
|
}
|
|
552
|
+
|
|
497
553
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
498
554
|
return Object.assign(Object.assign({}, config), {
|
|
499
555
|
open: config.open || false
|
|
@@ -501,6 +557,7 @@ function enhanceConfig(vizConfig) {
|
|
|
501
557
|
});
|
|
502
558
|
return enhancedConfig;
|
|
503
559
|
}
|
|
560
|
+
|
|
504
561
|
exports.enhanceConfig = enhanceConfig;
|
|
505
562
|
/**
|
|
506
563
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -508,6 +565,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
508
565
|
* @param vizConfig a Visualization Config
|
|
509
566
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
510
567
|
*/
|
|
568
|
+
|
|
511
569
|
function uncollapseEditorConfig(vizConfig) {
|
|
512
570
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
513
571
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -517,13 +575,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
517
575
|
});
|
|
518
576
|
return editorPanelUncollapsedConfig;
|
|
519
577
|
}
|
|
578
|
+
|
|
520
579
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
580
|
+
|
|
521
581
|
function isDynamicOption(option) {
|
|
522
582
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
523
583
|
}
|
|
524
|
-
|
|
525
|
-
// private helpers to improve readability of getInitialPreset
|
|
584
|
+
|
|
585
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
526
586
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
587
|
+
|
|
527
588
|
/**
|
|
528
589
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
529
590
|
* 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
|
|
@@ -532,6 +593,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
532
593
|
*
|
|
533
594
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
534
595
|
*/
|
|
596
|
+
|
|
535
597
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
536
598
|
var presetContextKeys = Object.keys(presetContext);
|
|
537
599
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -541,6 +603,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
541
603
|
/**
|
|
542
604
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
543
605
|
*/
|
|
606
|
+
|
|
607
|
+
|
|
544
608
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
545
609
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
546
610
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -555,18 +619,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
555
619
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
556
620
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
557
621
|
*/
|
|
622
|
+
|
|
623
|
+
|
|
558
624
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
559
625
|
return presets.find(function (preset) {
|
|
560
626
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
561
627
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
562
628
|
var presetContextKeys = Object.keys(presetContext);
|
|
563
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
564
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
629
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
565
630
|
// if not, then the preset is invalid in config.ts
|
|
631
|
+
|
|
566
632
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
567
633
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
568
634
|
});
|
|
569
635
|
}
|
|
636
|
+
|
|
570
637
|
exports.getInitialPreset = getInitialPreset;
|
|
571
638
|
/**
|
|
572
639
|
* generates number precision values for a Select editor
|
|
@@ -574,6 +641,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
574
641
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
575
642
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
576
643
|
*/
|
|
644
|
+
|
|
577
645
|
function generatePrecisionValues(numPrecisionValues) {
|
|
578
646
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
579
647
|
return {
|
|
@@ -582,6 +650,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
582
650
|
};
|
|
583
651
|
});
|
|
584
652
|
}
|
|
653
|
+
|
|
585
654
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
586
655
|
/**
|
|
587
656
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -591,12 +660,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
591
660
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
592
661
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
593
662
|
*/
|
|
663
|
+
|
|
594
664
|
var insertLayout = function insertLayout(layout, index) {
|
|
595
665
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
596
666
|
layoutItems[_key - 2] = arguments[_key];
|
|
597
667
|
}
|
|
668
|
+
|
|
598
669
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
599
670
|
};
|
|
671
|
+
|
|
600
672
|
exports.insertLayout = insertLayout;
|
|
601
673
|
|
|
602
674
|
/***/ }),
|
|
@@ -674,11 +746,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
674
746
|
value: true
|
|
675
747
|
});
|
|
676
748
|
exports.shouldShowIconPlaceholder = void 0;
|
|
749
|
+
|
|
677
750
|
var React = __webpack_require__(1);
|
|
751
|
+
|
|
678
752
|
var T = __webpack_require__(0);
|
|
753
|
+
|
|
679
754
|
var lodash_1 = __webpack_require__(3);
|
|
755
|
+
|
|
680
756
|
var i18n_1 = __webpack_require__(2);
|
|
757
|
+
|
|
681
758
|
var Message_1 = __webpack_require__(10);
|
|
759
|
+
|
|
682
760
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
683
761
|
/**
|
|
684
762
|
* @method shouldShowIconPlaceholder
|
|
@@ -686,6 +764,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
686
764
|
* @param {boolean} loading
|
|
687
765
|
* @returns {boolean}
|
|
688
766
|
*/
|
|
767
|
+
|
|
768
|
+
|
|
689
769
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
690
770
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
691
771
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -694,6 +774,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
694
774
|
var noFields = fields === undefined;
|
|
695
775
|
return loading || noData || noFields;
|
|
696
776
|
};
|
|
777
|
+
|
|
697
778
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
698
779
|
var propTypes = {
|
|
699
780
|
icon: T.func,
|
|
@@ -708,11 +789,13 @@ var propTypes = {
|
|
|
708
789
|
* @param {IconPlaceholderProps} props
|
|
709
790
|
* @returns {React.ReactElement}
|
|
710
791
|
*/
|
|
792
|
+
|
|
711
793
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
712
794
|
var width = props.width,
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
795
|
+
height = props.height,
|
|
796
|
+
icon = props.icon,
|
|
797
|
+
iconColor = props.iconColor;
|
|
798
|
+
|
|
716
799
|
if (icon) {
|
|
717
800
|
return React.createElement(icon, {
|
|
718
801
|
style: {
|
|
@@ -724,9 +807,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
724
807
|
transform: 'translate(-50%, -50%)'
|
|
725
808
|
},
|
|
726
809
|
width: '50%',
|
|
727
|
-
height: '50%'
|
|
810
|
+
height: '50%',
|
|
811
|
+
'data-test': 'icon-placeholder'
|
|
728
812
|
});
|
|
729
813
|
}
|
|
814
|
+
|
|
730
815
|
return React.createElement(Message_1.default, {
|
|
731
816
|
width: width,
|
|
732
817
|
height: height,
|
|
@@ -734,6 +819,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
734
819
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
735
820
|
});
|
|
736
821
|
};
|
|
822
|
+
|
|
737
823
|
IconPlaceholder.propTypes = propTypes;
|
|
738
824
|
IconPlaceholder.defaultProps = {
|
|
739
825
|
width: '100%',
|
|
@@ -750,21 +836,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
750
836
|
|
|
751
837
|
|
|
752
838
|
var _defineProperty = __webpack_require__(7);
|
|
839
|
+
|
|
753
840
|
Object.defineProperty(exports, "__esModule", {
|
|
754
841
|
value: true
|
|
755
842
|
});
|
|
756
843
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
844
|
+
|
|
757
845
|
var T = __webpack_require__(0);
|
|
846
|
+
|
|
758
847
|
var lodash_1 = __webpack_require__(3);
|
|
759
|
-
|
|
848
|
+
|
|
849
|
+
var DataSource_1 = __webpack_require__(34);
|
|
850
|
+
|
|
760
851
|
exports.SortParamsPropTypes = T.shape({
|
|
761
852
|
currentSortKey: T.string,
|
|
762
853
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
763
854
|
onSort: T.func
|
|
764
855
|
});
|
|
856
|
+
|
|
765
857
|
var getSortingParams = function getSortingParams(_ref) {
|
|
766
858
|
var requestParams = _ref.requestParams,
|
|
767
|
-
|
|
859
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
768
860
|
var currentSortKey;
|
|
769
861
|
var currentSortDir;
|
|
770
862
|
var nextSortDirMap = {
|
|
@@ -773,15 +865,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
773
865
|
none: 'asc'
|
|
774
866
|
};
|
|
775
867
|
var onSort;
|
|
868
|
+
|
|
776
869
|
if (typeof onRequestParamsChange === 'function') {
|
|
777
870
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
778
871
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
779
872
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
780
|
-
}
|
|
781
|
-
|
|
873
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
874
|
+
|
|
875
|
+
|
|
782
876
|
onSort = function onSort(e, _ref2) {
|
|
783
877
|
var sortKey = _ref2.sortKey,
|
|
784
|
-
|
|
878
|
+
sortDir = _ref2.sortDir;
|
|
879
|
+
|
|
785
880
|
if (typeof sortKey === 'string') {
|
|
786
881
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
787
882
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -793,12 +888,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
793
888
|
}
|
|
794
889
|
};
|
|
795
890
|
}
|
|
891
|
+
|
|
796
892
|
return {
|
|
797
893
|
currentSortKey: currentSortKey,
|
|
798
894
|
currentSortDir: currentSortDir,
|
|
799
895
|
onSort: onSort
|
|
800
896
|
};
|
|
801
897
|
};
|
|
898
|
+
|
|
802
899
|
exports.getSortingParams = getSortingParams;
|
|
803
900
|
|
|
804
901
|
/***/ }),
|
|
@@ -809,43 +906,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
809
906
|
"use strict";
|
|
810
907
|
|
|
811
908
|
|
|
909
|
+
Object.defineProperty(exports, "__esModule", {
|
|
910
|
+
value: true
|
|
911
|
+
});
|
|
912
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
913
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
914
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
915
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
916
|
+
|
|
917
|
+
/***/ }),
|
|
918
|
+
|
|
919
|
+
/***/ 35:
|
|
920
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
921
|
+
|
|
922
|
+
"use strict";
|
|
923
|
+
|
|
924
|
+
|
|
812
925
|
Object.defineProperty(exports, "__esModule", {
|
|
813
926
|
value: true
|
|
814
927
|
});
|
|
815
928
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
929
|
+
|
|
816
930
|
var T = __webpack_require__(0);
|
|
931
|
+
|
|
817
932
|
var lodash_1 = __webpack_require__(3);
|
|
933
|
+
|
|
818
934
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
819
935
|
isPaging: T.bool,
|
|
820
936
|
current: T.number,
|
|
821
937
|
totalPages: T.number,
|
|
822
938
|
onChange: T.func
|
|
823
939
|
});
|
|
940
|
+
|
|
824
941
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
825
942
|
var requestParams = _ref.requestParams,
|
|
826
|
-
|
|
827
|
-
|
|
943
|
+
meta = _ref.meta,
|
|
944
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
828
945
|
var totalCount = meta && meta.totalCount || 0;
|
|
829
946
|
var offset = requestParams && requestParams.offset || 0;
|
|
830
947
|
var count = requestParams && requestParams.count;
|
|
831
948
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
832
949
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
833
950
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
951
|
+
|
|
834
952
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
835
953
|
var page = _ref2.page,
|
|
836
|
-
|
|
954
|
+
countArg = _ref2.count;
|
|
837
955
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
956
|
+
|
|
838
957
|
if (typeof countArg === 'number') {
|
|
839
958
|
newParams.count = countArg;
|
|
840
959
|
newParams.offset = 0;
|
|
841
960
|
}
|
|
961
|
+
|
|
842
962
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
963
|
+
|
|
843
964
|
if (typeof page === 'number' && page > 0) {
|
|
844
965
|
newParams.count = pageCount;
|
|
845
966
|
newParams.offset = (page - 1) * pageCount;
|
|
846
967
|
}
|
|
968
|
+
|
|
847
969
|
onRequestParamsChange(newParams);
|
|
848
970
|
};
|
|
971
|
+
|
|
849
972
|
return {
|
|
850
973
|
isPaging: isPaging,
|
|
851
974
|
current: current,
|
|
@@ -853,11 +976,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
853
976
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
854
977
|
};
|
|
855
978
|
};
|
|
979
|
+
|
|
856
980
|
exports.getPaginationParams = getPaginationParams;
|
|
857
981
|
|
|
858
982
|
/***/ }),
|
|
859
983
|
|
|
860
|
-
/***/
|
|
984
|
+
/***/ 36:
|
|
861
985
|
/***/ (function(module, exports, __webpack_require__) {
|
|
862
986
|
|
|
863
987
|
"use strict";
|
|
@@ -868,6 +992,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
868
992
|
});
|
|
869
993
|
exports.VizCategory = void 0;
|
|
870
994
|
var VizCategory;
|
|
995
|
+
|
|
871
996
|
(function (VizCategory) {
|
|
872
997
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
873
998
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -885,67 +1010,96 @@ var VizCategory;
|
|
|
885
1010
|
|
|
886
1011
|
/***/ }),
|
|
887
1012
|
|
|
888
|
-
/***/
|
|
1013
|
+
/***/ 37:
|
|
889
1014
|
/***/ (function(module, exports, __webpack_require__) {
|
|
890
1015
|
|
|
891
1016
|
"use strict";
|
|
892
1017
|
|
|
893
1018
|
|
|
894
1019
|
var _slicedToArray = __webpack_require__(17);
|
|
1020
|
+
|
|
895
1021
|
Object.defineProperty(exports, "__esModule", {
|
|
896
1022
|
value: true
|
|
897
1023
|
});
|
|
1024
|
+
|
|
898
1025
|
var React = __webpack_require__(1);
|
|
1026
|
+
|
|
899
1027
|
var lodash_1 = __webpack_require__(3);
|
|
900
|
-
|
|
1028
|
+
|
|
1029
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1030
|
+
|
|
901
1031
|
var Options_1 = __webpack_require__(30);
|
|
902
|
-
|
|
1032
|
+
|
|
1033
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1034
|
+
|
|
903
1035
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
904
|
-
|
|
1036
|
+
|
|
1037
|
+
var moment_1 = __webpack_require__(40);
|
|
1038
|
+
|
|
905
1039
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1040
|
+
|
|
906
1041
|
var styled_components_1 = __webpack_require__(4);
|
|
1042
|
+
|
|
907
1043
|
var hocUtils_1 = __webpack_require__(27);
|
|
1044
|
+
|
|
908
1045
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
909
|
-
|
|
1046
|
+
|
|
1047
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1048
|
+
|
|
910
1049
|
var id_1 = __webpack_require__(25);
|
|
911
|
-
|
|
1050
|
+
|
|
1051
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1052
|
+
|
|
912
1053
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1054
|
+
|
|
913
1055
|
var getSorting_1 = __webpack_require__(33);
|
|
914
|
-
|
|
1056
|
+
|
|
1057
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1058
|
+
|
|
915
1059
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1060
|
+
|
|
916
1061
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1062
|
+
|
|
917
1063
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1064
|
+
|
|
918
1065
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
919
1066
|
/**
|
|
920
1067
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
921
1068
|
* @param {DashboardVizOpts} opts
|
|
922
1069
|
* @returns {HOC}
|
|
923
1070
|
*/
|
|
1071
|
+
|
|
1072
|
+
|
|
924
1073
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
925
1074
|
var ReactViz = opts.ReactViz,
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1075
|
+
vizConfig = opts.vizConfig,
|
|
1076
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1077
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1078
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1079
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1080
|
+
|
|
931
1081
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
932
1082
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1083
|
+
|
|
933
1084
|
var DashboardViz = function DashboardViz(props) {
|
|
934
1085
|
var _a;
|
|
1086
|
+
|
|
935
1087
|
var mode = props.mode,
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1088
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1089
|
+
dataSources = props.dataSources,
|
|
1090
|
+
options = props.options,
|
|
1091
|
+
_props$context = props.context,
|
|
1092
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1093
|
+
width = props.width,
|
|
1094
|
+
height = props.height,
|
|
1095
|
+
onComputedProps = props.onComputedProps,
|
|
1096
|
+
onEventTrigger = props.onEventTrigger,
|
|
1097
|
+
theme = props.theme,
|
|
1098
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1099
|
+
|
|
947
1100
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
948
|
-
|
|
1101
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1102
|
+
|
|
949
1103
|
if (serializedTimezone) {
|
|
950
1104
|
/*
|
|
951
1105
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -959,38 +1113,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
959
1113
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
960
1114
|
}
|
|
961
1115
|
}
|
|
1116
|
+
|
|
962
1117
|
var themeFunc = function themeFunc(themeVar) {
|
|
963
1118
|
var _a, _b;
|
|
1119
|
+
|
|
964
1120
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
965
1121
|
};
|
|
1122
|
+
|
|
966
1123
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1124
|
+
|
|
967
1125
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1126
|
+
theme: theme
|
|
1127
|
+
}),
|
|
1128
|
+
currentThemeFamily = _ref.family,
|
|
1129
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1130
|
+
currentThemeDensity = _ref.density;
|
|
1131
|
+
|
|
973
1132
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1133
|
+
|
|
974
1134
|
var _React$useState = React.useState({}),
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1135
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1136
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1137
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1138
|
+
|
|
1139
|
+
|
|
978
1140
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1141
|
+
|
|
979
1142
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
980
|
-
|
|
981
|
-
|
|
1143
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1144
|
+
visualizationID = _React$useState4[0];
|
|
1145
|
+
|
|
982
1146
|
var _React$useState5 = React.useState({}),
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1147
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1148
|
+
dataSourcesInState = _React$useState6[0],
|
|
1149
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1150
|
+
|
|
986
1151
|
var _React$useState7 = React.useState(),
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1152
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1153
|
+
dataFramesInState = _React$useState8[0],
|
|
1154
|
+
setDataFramesInState = _React$useState8[1];
|
|
1155
|
+
|
|
990
1156
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1157
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1158
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1159
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1160
|
+
|
|
994
1161
|
var isMounted = React.useRef(true);
|
|
995
1162
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
996
1163
|
try {
|
|
@@ -1015,11 +1182,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1015
1182
|
});
|
|
1016
1183
|
} else {
|
|
1017
1184
|
var dataFrames = dataFramesInState;
|
|
1185
|
+
|
|
1018
1186
|
if (dataSources !== dataSourcesInState) {
|
|
1019
1187
|
setDataSourcesInState(dataSources);
|
|
1020
1188
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1021
1189
|
setDataFramesInState(dataFrames);
|
|
1022
1190
|
}
|
|
1191
|
+
|
|
1023
1192
|
return Options_1.Options.evaluate({
|
|
1024
1193
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1025
1194
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -1030,21 +1199,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1030
1199
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1031
1200
|
return {};
|
|
1032
1201
|
}
|
|
1202
|
+
|
|
1033
1203
|
return {};
|
|
1034
1204
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1035
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1036
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1205
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1037
1206
|
// if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
|
|
1038
1207
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1208
|
+
|
|
1039
1209
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1040
1210
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1211
|
+
|
|
1041
1212
|
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) {
|
|
1042
1213
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1043
1214
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1044
1215
|
});
|
|
1045
|
-
}
|
|
1046
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1216
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1047
1217
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1218
|
+
|
|
1219
|
+
|
|
1048
1220
|
React.useEffect(function () {
|
|
1049
1221
|
onComputedProps(clonedEvaluatedOptions);
|
|
1050
1222
|
});
|
|
@@ -1054,53 +1226,68 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1054
1226
|
isMounted.current = false;
|
|
1055
1227
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1056
1228
|
}
|
|
1057
|
-
};
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
// present warning message if any required props are missing
|
|
1229
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1230
|
+
}, []); // present warning message if any required props are missing
|
|
1231
|
+
|
|
1061
1232
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1062
|
-
|
|
1063
|
-
|
|
1233
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1234
|
+
supports = vizConfig.supports;
|
|
1064
1235
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1236
|
+
|
|
1065
1237
|
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
|
|
1066
1238
|
) {
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1239
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1240
|
+
"data-test": "missing-props-message",
|
|
1241
|
+
width: width,
|
|
1242
|
+
height: height,
|
|
1243
|
+
missingProps: missing,
|
|
1244
|
+
backgroundColor: bgColorFromTheme
|
|
1245
|
+
});
|
|
1246
|
+
} // events
|
|
1247
|
+
|
|
1248
|
+
|
|
1076
1249
|
var eventCallbackProps = {};
|
|
1250
|
+
|
|
1077
1251
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1078
1252
|
var supportedEvents = vizConfig.events;
|
|
1079
1253
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1080
|
-
var
|
|
1081
|
-
|
|
1082
|
-
|
|
1254
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
1255
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
1256
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
1257
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
1083
1258
|
// then remove these lines
|
|
1084
|
-
|
|
1259
|
+
|
|
1085
1260
|
var payload = {};
|
|
1261
|
+
|
|
1086
1262
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1087
1263
|
payloadKeys.forEach(function (p) {
|
|
1088
1264
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1089
1265
|
});
|
|
1090
1266
|
}
|
|
1267
|
+
|
|
1091
1268
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1092
1269
|
if (ev && ev.payload) {
|
|
1093
1270
|
payload = ev.payload;
|
|
1094
1271
|
}
|
|
1272
|
+
|
|
1095
1273
|
return onEventTrigger({
|
|
1096
1274
|
originalEvent: ev,
|
|
1097
1275
|
payload: payload,
|
|
1098
1276
|
type: eventName
|
|
1099
1277
|
});
|
|
1100
1278
|
};
|
|
1279
|
+
|
|
1280
|
+
if (parentKeys) {
|
|
1281
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
1282
|
+
var newObject = {};
|
|
1283
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
1284
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1101
1287
|
});
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1288
|
+
} // compute pure viz props which are not from options
|
|
1289
|
+
|
|
1290
|
+
|
|
1104
1291
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1105
1292
|
themeFunc: themeFunc
|
|
1106
1293
|
}));
|
|
@@ -1118,15 +1305,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1118
1305
|
* In future, we could automatically detect which all datasources are being used
|
|
1119
1306
|
* and bind those magically to pagination/sorting behavior.
|
|
1120
1307
|
*/
|
|
1308
|
+
|
|
1121
1309
|
var dataSourceMetadata = {};
|
|
1122
1310
|
var OptionKey = 'paginateDataSourceKey';
|
|
1123
1311
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1312
|
+
|
|
1124
1313
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1125
1314
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1126
1315
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1316
|
+
|
|
1127
1317
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1128
1318
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1129
1319
|
};
|
|
1320
|
+
|
|
1130
1321
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1131
1322
|
requestParams: requestParams,
|
|
1132
1323
|
meta: meta,
|
|
@@ -1141,115 +1332,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1141
1332
|
sortParams: sortParams,
|
|
1142
1333
|
paginatorParams: paginatorParams
|
|
1143
1334
|
};
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1335
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1336
|
+
|
|
1337
|
+
|
|
1146
1338
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1147
1339
|
return null;
|
|
1148
1340
|
}
|
|
1341
|
+
|
|
1149
1342
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1150
1343
|
mode: mode,
|
|
1151
1344
|
width: width,
|
|
1152
1345
|
height: height
|
|
1153
1346
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1154
1347
|
};
|
|
1348
|
+
|
|
1155
1349
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1156
1350
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1157
1351
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1158
1352
|
theme: {}
|
|
1159
|
-
});
|
|
1160
|
-
|
|
1161
|
-
DashboardViz.config = vizConfig;
|
|
1162
|
-
|
|
1353
|
+
}); // attach viz config
|
|
1354
|
+
|
|
1355
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1356
|
+
|
|
1163
1357
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1164
1358
|
};
|
|
1359
|
+
|
|
1165
1360
|
exports.default = withDashboardViz;
|
|
1166
1361
|
|
|
1167
1362
|
/***/ }),
|
|
1168
1363
|
|
|
1169
|
-
/***/
|
|
1364
|
+
/***/ 38:
|
|
1170
1365
|
/***/ (function(module, exports) {
|
|
1171
1366
|
|
|
1172
1367
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1173
1368
|
|
|
1174
1369
|
/***/ }),
|
|
1175
1370
|
|
|
1176
|
-
/***/
|
|
1371
|
+
/***/ 39:
|
|
1177
1372
|
/***/ (function(module, exports) {
|
|
1178
1373
|
|
|
1179
1374
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1180
1375
|
|
|
1181
1376
|
/***/ }),
|
|
1182
1377
|
|
|
1183
|
-
/***/
|
|
1378
|
+
/***/ 4:
|
|
1184
1379
|
/***/ (function(module, exports) {
|
|
1185
1380
|
|
|
1186
|
-
module.exports = require("
|
|
1381
|
+
module.exports = require("styled-components");
|
|
1187
1382
|
|
|
1188
1383
|
/***/ }),
|
|
1189
1384
|
|
|
1190
|
-
/***/
|
|
1385
|
+
/***/ 40:
|
|
1191
1386
|
/***/ (function(module, exports) {
|
|
1192
1387
|
|
|
1193
|
-
module.exports = require("
|
|
1388
|
+
module.exports = require("@splunk/moment");
|
|
1194
1389
|
|
|
1195
1390
|
/***/ }),
|
|
1196
1391
|
|
|
1197
|
-
/***/
|
|
1392
|
+
/***/ 41:
|
|
1198
1393
|
/***/ (function(module, exports) {
|
|
1199
1394
|
|
|
1200
1395
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1201
1396
|
|
|
1202
1397
|
/***/ }),
|
|
1203
1398
|
|
|
1204
|
-
/***/
|
|
1399
|
+
/***/ 42:
|
|
1205
1400
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1206
1401
|
|
|
1207
1402
|
"use strict";
|
|
1208
1403
|
|
|
1209
1404
|
|
|
1210
1405
|
var _classCallCheck = __webpack_require__(9);
|
|
1406
|
+
|
|
1211
1407
|
Object.defineProperty(exports, "__esModule", {
|
|
1212
1408
|
value: true
|
|
1213
1409
|
});
|
|
1214
1410
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1215
1411
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1412
|
+
|
|
1216
1413
|
var T = __webpack_require__(0);
|
|
1414
|
+
|
|
1217
1415
|
var lodash_1 = __webpack_require__(3);
|
|
1218
|
-
|
|
1219
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1416
|
+
|
|
1417
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1418
|
+
|
|
1419
|
+
|
|
1220
1420
|
exports.INITIAL_WIDTH = 250;
|
|
1221
1421
|
exports.INITIAL_HEIGHT = 250;
|
|
1222
1422
|
/**
|
|
1223
1423
|
* A Splunk visualization
|
|
1224
1424
|
*/
|
|
1425
|
+
|
|
1225
1426
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1226
1427
|
_classCallCheck(this, SplunkVisualization);
|
|
1227
1428
|
};
|
|
1429
|
+
|
|
1228
1430
|
SplunkVisualization.propTypes = {
|
|
1229
1431
|
/**
|
|
1230
1432
|
* display mode
|
|
1231
1433
|
*/
|
|
1232
1434
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1435
|
+
|
|
1233
1436
|
/**
|
|
1234
1437
|
* width in pixel or string, defaults to 100%
|
|
1235
1438
|
*/
|
|
1236
1439
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1440
|
+
|
|
1237
1441
|
/**
|
|
1238
1442
|
* height in pixel or string
|
|
1239
1443
|
*/
|
|
1240
1444
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1445
|
+
|
|
1241
1446
|
/**
|
|
1242
1447
|
* visualization context used for dynamic option evaluation
|
|
1243
1448
|
*/
|
|
1244
1449
|
context: T.object,
|
|
1450
|
+
|
|
1245
1451
|
/**
|
|
1246
1452
|
* visualization formatting options
|
|
1247
1453
|
*/
|
|
1248
1454
|
options: T.object,
|
|
1455
|
+
|
|
1249
1456
|
/**
|
|
1250
1457
|
* A callback to update formatting options
|
|
1251
1458
|
*/
|
|
1252
1459
|
onOptionsChange: T.func,
|
|
1460
|
+
|
|
1253
1461
|
/**
|
|
1254
1462
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1255
1463
|
*/
|
|
@@ -1258,6 +1466,7 @@ SplunkVisualization.propTypes = {
|
|
|
1258
1466
|
* current request params
|
|
1259
1467
|
*/
|
|
1260
1468
|
requestParams: T.object,
|
|
1469
|
+
|
|
1261
1470
|
/**
|
|
1262
1471
|
* current dataset
|
|
1263
1472
|
*/
|
|
@@ -1265,6 +1474,7 @@ SplunkVisualization.propTypes = {
|
|
|
1265
1474
|
fields: T.array,
|
|
1266
1475
|
columns: T.array
|
|
1267
1476
|
}),
|
|
1477
|
+
|
|
1268
1478
|
/**
|
|
1269
1479
|
* error
|
|
1270
1480
|
*/
|
|
@@ -1272,29 +1482,35 @@ SplunkVisualization.propTypes = {
|
|
|
1272
1482
|
level: T.string,
|
|
1273
1483
|
message: T.string
|
|
1274
1484
|
}),
|
|
1485
|
+
|
|
1275
1486
|
/**
|
|
1276
1487
|
* meta data that came with the dataset
|
|
1277
1488
|
*/
|
|
1278
1489
|
meta: T.object
|
|
1279
1490
|
})),
|
|
1491
|
+
|
|
1280
1492
|
/**
|
|
1281
1493
|
* A callback to trigger event
|
|
1282
1494
|
*/
|
|
1283
1495
|
onEventTrigger: T.func,
|
|
1496
|
+
|
|
1284
1497
|
/**
|
|
1285
1498
|
* Inform viz if there are handlers listening to events
|
|
1286
1499
|
*/
|
|
1287
1500
|
hasEventHandlers: T.bool,
|
|
1501
|
+
|
|
1288
1502
|
/**
|
|
1289
1503
|
* A callback to communicate computed props to a consumer
|
|
1290
1504
|
*/
|
|
1291
1505
|
onComputedProps: T.func,
|
|
1506
|
+
|
|
1292
1507
|
/**
|
|
1293
1508
|
* A callback to obtain visualization api
|
|
1294
1509
|
*/
|
|
1295
1510
|
vizActionHandlerRef: T.func,
|
|
1296
1511
|
loading: T.bool,
|
|
1297
1512
|
theme: T.object,
|
|
1513
|
+
|
|
1298
1514
|
/**
|
|
1299
1515
|
* A callback to request new data with updated request params
|
|
1300
1516
|
*/
|
|
@@ -1303,6 +1519,7 @@ SplunkVisualization.propTypes = {
|
|
|
1303
1519
|
/**
|
|
1304
1520
|
*
|
|
1305
1521
|
*/
|
|
1522
|
+
|
|
1306
1523
|
SplunkVisualization.defaultProps = {
|
|
1307
1524
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1308
1525
|
width: '100%',
|
|
@@ -1331,50 +1548,41 @@ exports.default = SplunkVisualization;
|
|
|
1331
1548
|
|
|
1332
1549
|
/***/ }),
|
|
1333
1550
|
|
|
1334
|
-
/***/
|
|
1551
|
+
/***/ 43:
|
|
1335
1552
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1336
1553
|
|
|
1337
1554
|
"use strict";
|
|
1338
1555
|
|
|
1339
1556
|
|
|
1340
1557
|
var _classCallCheck = __webpack_require__(9);
|
|
1558
|
+
|
|
1341
1559
|
var _createClass = __webpack_require__(18);
|
|
1560
|
+
|
|
1342
1561
|
Object.defineProperty(exports, "__esModule", {
|
|
1343
1562
|
value: true
|
|
1344
1563
|
});
|
|
1345
1564
|
exports.DefaultVizActionHandler = void 0;
|
|
1565
|
+
|
|
1346
1566
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1347
1567
|
function DefaultVizActionHandler() {
|
|
1348
1568
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1349
1569
|
}
|
|
1570
|
+
|
|
1350
1571
|
_createClass(DefaultVizActionHandler, [{
|
|
1351
1572
|
key: "focus",
|
|
1352
|
-
value: function focus() {
|
|
1353
|
-
// noop
|
|
1573
|
+
value: function focus() {// noop
|
|
1354
1574
|
}
|
|
1355
1575
|
}, {
|
|
1356
1576
|
key: "snapshot",
|
|
1357
|
-
value: function snapshot() {
|
|
1358
|
-
return null; // noop
|
|
1359
|
-
}
|
|
1360
|
-
}]);
|
|
1361
|
-
return DefaultVizActionHandler;
|
|
1362
|
-
}();
|
|
1363
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1364
|
-
|
|
1365
|
-
/***/ }),
|
|
1366
|
-
|
|
1367
|
-
/***/ 43:
|
|
1368
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1369
|
-
|
|
1370
|
-
"use strict";
|
|
1577
|
+
value: function snapshot() {
|
|
1578
|
+
return null; // noop
|
|
1579
|
+
}
|
|
1580
|
+
}]);
|
|
1371
1581
|
|
|
1582
|
+
return DefaultVizActionHandler;
|
|
1583
|
+
}();
|
|
1372
1584
|
|
|
1373
|
-
|
|
1374
|
-
value: true
|
|
1375
|
-
});
|
|
1376
|
-
exports.validSortDirs = void 0;
|
|
1377
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1585
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1378
1586
|
|
|
1379
1587
|
/***/ }),
|
|
1380
1588
|
|
|
@@ -1388,7 +1596,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1388
1596
|
value: true
|
|
1389
1597
|
});
|
|
1390
1598
|
exports.useDeepMemo = void 0;
|
|
1599
|
+
|
|
1391
1600
|
var react_1 = __webpack_require__(1);
|
|
1601
|
+
|
|
1392
1602
|
var lodash_1 = __webpack_require__(3);
|
|
1393
1603
|
/**
|
|
1394
1604
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1403,16 +1613,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1403
1613
|
* @param fn the function to be executed and
|
|
1404
1614
|
* @param dependencies an array of dependencies
|
|
1405
1615
|
*/
|
|
1616
|
+
|
|
1617
|
+
|
|
1406
1618
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1407
1619
|
var ref = (0, react_1.useRef)();
|
|
1620
|
+
|
|
1408
1621
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1409
1622
|
ref.current = {
|
|
1410
1623
|
dependencies: dependencies,
|
|
1411
1624
|
value: fn()
|
|
1412
1625
|
};
|
|
1413
1626
|
}
|
|
1627
|
+
|
|
1414
1628
|
return ref.current.value;
|
|
1415
1629
|
};
|
|
1630
|
+
|
|
1416
1631
|
exports.useDeepMemo = useDeepMemo;
|
|
1417
1632
|
|
|
1418
1633
|
/***/ }),
|
|
@@ -1426,6 +1641,7 @@ exports.useDeepMemo = useDeepMemo;
|
|
|
1426
1641
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1427
1642
|
if (k2 === undefined) k2 = k;
|
|
1428
1643
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1644
|
+
|
|
1429
1645
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1430
1646
|
desc = {
|
|
1431
1647
|
enumerable: true,
|
|
@@ -1434,22 +1650,28 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
1434
1650
|
}
|
|
1435
1651
|
};
|
|
1436
1652
|
}
|
|
1653
|
+
|
|
1437
1654
|
Object.defineProperty(o, k2, desc);
|
|
1438
1655
|
} : function (o, m, k, k2) {
|
|
1439
1656
|
if (k2 === undefined) k2 = k;
|
|
1440
1657
|
o[k2] = m[k];
|
|
1441
1658
|
});
|
|
1659
|
+
|
|
1442
1660
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1443
1661
|
for (var p in m) {
|
|
1444
1662
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1445
1663
|
}
|
|
1446
1664
|
};
|
|
1665
|
+
|
|
1447
1666
|
Object.defineProperty(exports, "__esModule", {
|
|
1448
1667
|
value: true
|
|
1449
1668
|
});
|
|
1450
1669
|
exports.default = void 0;
|
|
1451
|
-
|
|
1452
|
-
|
|
1670
|
+
|
|
1671
|
+
__exportStar(__webpack_require__(165), exports);
|
|
1672
|
+
|
|
1673
|
+
var Pie_1 = __webpack_require__(165);
|
|
1674
|
+
|
|
1453
1675
|
Object.defineProperty(exports, "default", {
|
|
1454
1676
|
enumerable: true,
|
|
1455
1677
|
get: function get() {
|
|
@@ -1468,24 +1690,35 @@ Object.defineProperty(exports, "default", {
|
|
|
1468
1690
|
Object.defineProperty(exports, "__esModule", {
|
|
1469
1691
|
value: true
|
|
1470
1692
|
});
|
|
1693
|
+
|
|
1471
1694
|
var ChartPie_1 = __webpack_require__(442);
|
|
1695
|
+
|
|
1472
1696
|
var placeholders_1 = __webpack_require__(50);
|
|
1697
|
+
|
|
1473
1698
|
var i18n_1 = __webpack_require__(2);
|
|
1699
|
+
|
|
1474
1700
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1701
|
+
|
|
1475
1702
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1703
|
+
|
|
1476
1704
|
var pick_1 = __webpack_require__(23);
|
|
1705
|
+
|
|
1477
1706
|
var variables_1 = __webpack_require__(11);
|
|
1707
|
+
|
|
1478
1708
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1479
|
-
|
|
1709
|
+
|
|
1710
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
1711
|
+
|
|
1480
1712
|
var configUtils_1 = __webpack_require__(20);
|
|
1713
|
+
|
|
1481
1714
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
1715
|
+
|
|
1482
1716
|
var dataContract = {
|
|
1483
1717
|
requiredDataSources: [{
|
|
1484
1718
|
name: 'primary',
|
|
1485
1719
|
description: 'DataSource that powers the visualization'
|
|
1486
1720
|
}],
|
|
1487
|
-
optionalDataSources: [
|
|
1488
|
-
// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1721
|
+
optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1489
1722
|
// {
|
|
1490
1723
|
// name: 'annotation',
|
|
1491
1724
|
// description: 'DataSource that populate event annotations',
|
|
@@ -1663,16 +1896,19 @@ var editorConfig = [{
|
|
|
1663
1896
|
/**
|
|
1664
1897
|
* visualization configuration
|
|
1665
1898
|
*/
|
|
1899
|
+
|
|
1666
1900
|
var config = {
|
|
1667
1901
|
/**
|
|
1668
1902
|
* unique viz key
|
|
1669
1903
|
*/
|
|
1670
1904
|
key: 'splunk.pie',
|
|
1905
|
+
|
|
1671
1906
|
/**
|
|
1672
1907
|
* viz name
|
|
1673
1908
|
*/
|
|
1674
1909
|
name: (0, i18n_1._)('Pie'),
|
|
1675
1910
|
category: VizCategory_1.VizCategory.COMPARISONS,
|
|
1911
|
+
|
|
1676
1912
|
/**
|
|
1677
1913
|
* viz icon
|
|
1678
1914
|
*/
|
|
@@ -1710,25 +1946,34 @@ module.exports = require("@splunk/react-icons/enterprise/ChartPie");
|
|
|
1710
1946
|
|
|
1711
1947
|
var __rest = this && this.__rest || function (s, e) {
|
|
1712
1948
|
var t = {};
|
|
1949
|
+
|
|
1713
1950
|
for (var p in s) {
|
|
1714
1951
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1715
1952
|
}
|
|
1953
|
+
|
|
1716
1954
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1717
1955
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1718
1956
|
}
|
|
1719
1957
|
return t;
|
|
1720
1958
|
};
|
|
1959
|
+
|
|
1721
1960
|
Object.defineProperty(exports, "__esModule", {
|
|
1722
1961
|
value: true
|
|
1723
1962
|
});
|
|
1724
1963
|
exports.allInvalidDataValues = exports.invalidOptionField = exports.getPieOptionFieldIndex = exports.getPieMergedOptions = exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
|
|
1964
|
+
|
|
1725
1965
|
var lodash_1 = __webpack_require__(3);
|
|
1966
|
+
|
|
1726
1967
|
var propUtils_1 = __webpack_require__(29);
|
|
1968
|
+
|
|
1727
1969
|
var dsl_1 = __webpack_require__(133);
|
|
1970
|
+
|
|
1728
1971
|
var hocUtils_1 = __webpack_require__(27);
|
|
1729
|
-
|
|
1730
|
-
// CONVERT THIS TO PIE THEN ADD TO Pie.TSX
|
|
1972
|
+
|
|
1973
|
+
var JSONSchemaUtils_1 = __webpack_require__(28); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
|
|
1731
1974
|
// map for key names which are either new or not present in SimpleXML options mapping
|
|
1975
|
+
|
|
1976
|
+
|
|
1732
1977
|
var pieOptionsSCMapping = {
|
|
1733
1978
|
resultLimit: 'resultTruncationLimit',
|
|
1734
1979
|
seriesColorsByField: 'fieldColors',
|
|
@@ -1742,6 +1987,7 @@ var pieOptionsSCMapping = {
|
|
|
1742
1987
|
* @param {Object} options
|
|
1743
1988
|
* @returns {Object}
|
|
1744
1989
|
*/
|
|
1990
|
+
|
|
1745
1991
|
var convertToStringValues = function convertToStringValues(options) {
|
|
1746
1992
|
var updatedOptions = (0, propUtils_1.convertPropsToString)({
|
|
1747
1993
|
vizProps: options,
|
|
@@ -1749,6 +1995,7 @@ var convertToStringValues = function convertToStringValues(options) {
|
|
|
1749
1995
|
});
|
|
1750
1996
|
return Object.assign(Object.assign({}, options), updatedOptions);
|
|
1751
1997
|
};
|
|
1998
|
+
|
|
1752
1999
|
exports.convertToStringValues = convertToStringValues;
|
|
1753
2000
|
/**
|
|
1754
2001
|
* Helper method to map labelDisplay options to jsCharting options
|
|
@@ -1756,21 +2003,26 @@ exports.convertToStringValues = convertToStringValues;
|
|
|
1756
2003
|
* @param {Object} options
|
|
1757
2004
|
* @returns {Object}
|
|
1758
2005
|
*/
|
|
2006
|
+
|
|
1759
2007
|
var mapLabelDisplay = function mapLabelDisplay(_a) {
|
|
1760
2008
|
var labelDisplay = _a.labelDisplay,
|
|
1761
|
-
|
|
2009
|
+
options = __rest(_a, ["labelDisplay"]);
|
|
2010
|
+
|
|
1762
2011
|
var convertedOptions = Object.assign(Object.assign({}, options), {
|
|
1763
2012
|
// default for labelDisplay option is 'values'
|
|
1764
2013
|
'chart.showLabels': true,
|
|
1765
2014
|
'chart.showPercent': false
|
|
1766
2015
|
});
|
|
2016
|
+
|
|
1767
2017
|
if (labelDisplay === 'valuesAndPercentage') {
|
|
1768
2018
|
convertedOptions['chart.showPercent'] = true;
|
|
1769
2019
|
} else if (labelDisplay === 'off') {
|
|
1770
2020
|
convertedOptions['chart.showLabels'] = false;
|
|
1771
2021
|
}
|
|
2022
|
+
|
|
1772
2023
|
return convertedOptions;
|
|
1773
2024
|
};
|
|
2025
|
+
|
|
1774
2026
|
exports.mapLabelDisplay = mapLabelDisplay;
|
|
1775
2027
|
/**
|
|
1776
2028
|
* Helper method to update the option names which can be mapped to SimpleXML options or
|
|
@@ -1779,11 +2031,13 @@ exports.mapLabelDisplay = mapLabelDisplay;
|
|
|
1779
2031
|
* @param {Object} options
|
|
1780
2032
|
* @returns {Object}
|
|
1781
2033
|
*/
|
|
2034
|
+
|
|
1782
2035
|
var mapToOldKey = function mapToOldKey(options) {
|
|
1783
2036
|
return (0, lodash_1.mapKeys)(options, function (val, key) {
|
|
1784
2037
|
return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
|
|
1785
2038
|
});
|
|
1786
2039
|
};
|
|
2040
|
+
|
|
1787
2041
|
exports.mapToOldKey = mapToOldKey;
|
|
1788
2042
|
/**
|
|
1789
2043
|
* Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
|
|
@@ -1793,9 +2047,11 @@ exports.mapToOldKey = mapToOldKey;
|
|
|
1793
2047
|
* @param {Object} originalOptions
|
|
1794
2048
|
* @returns {Object}
|
|
1795
2049
|
*/
|
|
2050
|
+
|
|
1796
2051
|
var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
|
|
1797
2052
|
return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
|
|
1798
2053
|
};
|
|
2054
|
+
|
|
1799
2055
|
exports.convertToPieSCProperties = convertToPieSCProperties;
|
|
1800
2056
|
/**
|
|
1801
2057
|
* Return all merged options (default + config) using vizConfig and options
|
|
@@ -1803,9 +2059,11 @@ exports.convertToPieSCProperties = convertToPieSCProperties;
|
|
|
1803
2059
|
* @param vizConfig
|
|
1804
2060
|
* @returns
|
|
1805
2061
|
*/
|
|
2062
|
+
|
|
1806
2063
|
var getPieMergedOptions = function getPieMergedOptions(options, vizConfig) {
|
|
1807
2064
|
return (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default'));
|
|
1808
2065
|
};
|
|
2066
|
+
|
|
1809
2067
|
exports.getPieMergedOptions = getPieMergedOptions;
|
|
1810
2068
|
/**
|
|
1811
2069
|
* Returns option's field index. If not found returns -1
|
|
@@ -1815,16 +2073,19 @@ exports.getPieMergedOptions = getPieMergedOptions;
|
|
|
1815
2073
|
* @param vizConfig
|
|
1816
2074
|
* @returns
|
|
1817
2075
|
*/
|
|
2076
|
+
|
|
1818
2077
|
var getPieOptionFieldIndex = function getPieOptionFieldIndex(optionName, dataSources, options, vizConfig) {
|
|
1819
|
-
var mergedOptions = (0, exports.getPieMergedOptions)(options, vizConfig);
|
|
1820
|
-
|
|
2078
|
+
var mergedOptions = (0, exports.getPieMergedOptions)(options, vizConfig); // find the field name configured for pie "value"
|
|
2079
|
+
|
|
1821
2080
|
var fieldName = (0, dsl_1.getFieldsFromDSL)(mergedOptions[optionName], dataSources)[0];
|
|
1822
2081
|
var fields = dataSources.primary.data.fields; // find the field index configured for pie "value"
|
|
2082
|
+
|
|
1823
2083
|
var fieldIndex = fields.findIndex(function (field) {
|
|
1824
2084
|
return (typeof field === 'string' ? field : field.name.toString()) === fieldName;
|
|
1825
2085
|
});
|
|
1826
2086
|
return fieldIndex;
|
|
1827
2087
|
};
|
|
2088
|
+
|
|
1828
2089
|
exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
|
|
1829
2090
|
/**
|
|
1830
2091
|
* Returns true if columns data has invalid data format for specified option (label or value)
|
|
@@ -1834,29 +2095,37 @@ exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
|
|
|
1834
2095
|
* @param vizConfig
|
|
1835
2096
|
* @returns
|
|
1836
2097
|
*/
|
|
2098
|
+
|
|
1837
2099
|
var invalidOptionField = function invalidOptionField(optionName, dataSources, options, vizConfig) {
|
|
1838
2100
|
var columns = dataSources.primary.data.columns;
|
|
1839
2101
|
var fieldIndex = (0, exports.getPieOptionFieldIndex)(optionName, dataSources, options, vizConfig);
|
|
2102
|
+
|
|
1840
2103
|
if (fieldIndex === -1 || !columns[fieldIndex] || !Array.isArray(columns[fieldIndex]) || Array.isArray(columns[fieldIndex]) && !columns[fieldIndex].length) {
|
|
1841
2104
|
return true;
|
|
1842
2105
|
}
|
|
2106
|
+
|
|
1843
2107
|
return false;
|
|
1844
2108
|
};
|
|
2109
|
+
|
|
1845
2110
|
exports.invalidOptionField = invalidOptionField;
|
|
1846
2111
|
/**
|
|
1847
2112
|
* Helper function to evaluate if all data values are invalid (zero or negative)
|
|
1848
2113
|
*/
|
|
2114
|
+
|
|
1849
2115
|
var allInvalidDataValues = function allInvalidDataValues(dataSources, options, vizConfig) {
|
|
1850
2116
|
var columns = dataSources.primary.data.columns; // find the field index configured for pie "value"
|
|
1851
|
-
|
|
1852
|
-
// check if all values are invalid
|
|
2117
|
+
|
|
2118
|
+
var valueFieldIndex = (0, exports.getPieOptionFieldIndex)('value', dataSources, options, vizConfig); // check if all values are invalid
|
|
2119
|
+
|
|
1853
2120
|
if (Array.isArray(columns) && columns[valueFieldIndex] && Array.isArray(columns[valueFieldIndex])) {
|
|
1854
2121
|
return !columns[valueFieldIndex].some(function (value) {
|
|
1855
2122
|
return +value > 0;
|
|
1856
2123
|
});
|
|
1857
2124
|
}
|
|
2125
|
+
|
|
1858
2126
|
return false;
|
|
1859
2127
|
};
|
|
2128
|
+
|
|
1860
2129
|
exports.allInvalidDataValues = allInvalidDataValues;
|
|
1861
2130
|
|
|
1862
2131
|
/***/ }),
|
|
@@ -1871,19 +2140,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1871
2140
|
value: true
|
|
1872
2141
|
});
|
|
1873
2142
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2143
|
+
|
|
1874
2144
|
var React = __webpack_require__(1);
|
|
2145
|
+
|
|
1875
2146
|
var T = __webpack_require__(0);
|
|
2147
|
+
|
|
1876
2148
|
var i18n_1 = __webpack_require__(2);
|
|
2149
|
+
|
|
1877
2150
|
var Message_1 = __webpack_require__(10);
|
|
2151
|
+
|
|
1878
2152
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1879
2153
|
/**
|
|
1880
2154
|
* @method isMissing
|
|
1881
2155
|
* @param {any} v
|
|
1882
2156
|
* @returns {boolean} true if the input value === null or undefined
|
|
1883
2157
|
*/
|
|
2158
|
+
|
|
2159
|
+
|
|
1884
2160
|
var isMissing = function isMissing(v) {
|
|
1885
2161
|
return v === null || v === undefined;
|
|
1886
2162
|
};
|
|
2163
|
+
|
|
1887
2164
|
exports.isMissing = isMissing;
|
|
1888
2165
|
/**
|
|
1889
2166
|
* @method misskingKeys
|
|
@@ -1891,11 +2168,13 @@ exports.isMissing = isMissing;
|
|
|
1891
2168
|
* @param {object} target
|
|
1892
2169
|
* @returns {string[]} the keys of missing required props
|
|
1893
2170
|
*/
|
|
2171
|
+
|
|
1894
2172
|
var missingKeys = function missingKeys(keys, target) {
|
|
1895
2173
|
return keys.filter(function (k) {
|
|
1896
2174
|
return (0, exports.isMissing)(target[k]);
|
|
1897
2175
|
});
|
|
1898
2176
|
};
|
|
2177
|
+
|
|
1899
2178
|
exports.missingKeys = missingKeys;
|
|
1900
2179
|
var propTypes = {
|
|
1901
2180
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1909,10 +2188,11 @@ var propTypes = {
|
|
|
1909
2188
|
* @param {MissingPropsProps} props
|
|
1910
2189
|
* @returns {React.ReactElement}
|
|
1911
2190
|
*/
|
|
2191
|
+
|
|
1912
2192
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1913
2193
|
var width = props.width,
|
|
1914
|
-
|
|
1915
|
-
|
|
2194
|
+
height = props.height,
|
|
2195
|
+
missingProps = props.missingProps;
|
|
1916
2196
|
return React.createElement(Message_1.default, {
|
|
1917
2197
|
"data-test": "message",
|
|
1918
2198
|
width: width,
|
|
@@ -1920,6 +2200,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
1920
2200
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1921
2201
|
});
|
|
1922
2202
|
};
|
|
2203
|
+
|
|
1923
2204
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1924
2205
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1925
2206
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -1939,15 +2220,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
1939
2220
|
Object.defineProperty(exports, "__esModule", {
|
|
1940
2221
|
value: true
|
|
1941
2222
|
});
|
|
2223
|
+
|
|
1942
2224
|
var React = __webpack_require__(1);
|
|
2225
|
+
|
|
1943
2226
|
var styled_components_1 = __webpack_require__(4);
|
|
2227
|
+
|
|
1944
2228
|
var hocUtils_1 = __webpack_require__(15);
|
|
2229
|
+
|
|
1945
2230
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1946
2231
|
displayName: "withEditModeCover__Cover",
|
|
1947
2232
|
componentId: "sc-1gsbnxb-0"
|
|
1948
2233
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1949
2234
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1950
|
-
'data-splunk-visualization-version': "26.
|
|
2235
|
+
'data-splunk-visualization-version': "26.1.1 - b6df0a015"
|
|
1951
2236
|
}).withConfig({
|
|
1952
2237
|
displayName: "withEditModeCover__Blocker",
|
|
1953
2238
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1958,6 +2243,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1958
2243
|
* @param {ExtendedDashViz} Visualization
|
|
1959
2244
|
* @returns {ExtendedDashViz} Wrapper
|
|
1960
2245
|
*/
|
|
2246
|
+
|
|
1961
2247
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1962
2248
|
var Wrapper = function Wrapper(props) {
|
|
1963
2249
|
var mode = props.mode;
|
|
@@ -1966,12 +2252,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1966
2252
|
"data-test": "edit-mode-cover"
|
|
1967
2253
|
}));
|
|
1968
2254
|
};
|
|
2255
|
+
|
|
1969
2256
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1970
2257
|
Wrapper: Wrapper,
|
|
1971
2258
|
Visualization: Visualization
|
|
1972
2259
|
});
|
|
1973
2260
|
return Wrapper;
|
|
1974
2261
|
};
|
|
2262
|
+
|
|
1975
2263
|
exports.default = withEditModeCover;
|
|
1976
2264
|
|
|
1977
2265
|
/***/ }),
|
|
@@ -1985,27 +2273,37 @@ exports.default = withEditModeCover;
|
|
|
1985
2273
|
Object.defineProperty(exports, "__esModule", {
|
|
1986
2274
|
value: true
|
|
1987
2275
|
});
|
|
2276
|
+
|
|
1988
2277
|
var React = __webpack_require__(1);
|
|
2278
|
+
|
|
1989
2279
|
var colorUtils_1 = __webpack_require__(12);
|
|
2280
|
+
|
|
1990
2281
|
var variables_1 = __webpack_require__(11);
|
|
2282
|
+
|
|
1991
2283
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
2284
|
+
|
|
1992
2285
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2286
|
+
|
|
1993
2287
|
var hocUtils_1 = __webpack_require__(15);
|
|
2288
|
+
|
|
1994
2289
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1995
2290
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1996
2291
|
var config = Visualization.config;
|
|
1997
2292
|
var themes = config.themes;
|
|
2293
|
+
|
|
1998
2294
|
var Wrapper = function Wrapper(props) {
|
|
1999
2295
|
var _a, _b;
|
|
2296
|
+
|
|
2000
2297
|
var dataSources = props.dataSources,
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2298
|
+
loading = props.loading,
|
|
2299
|
+
options = props.options,
|
|
2300
|
+
height = props.height,
|
|
2301
|
+
width = props.width;
|
|
2005
2302
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
2006
2303
|
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);
|
|
2007
2304
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
2008
2305
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
2306
|
+
|
|
2009
2307
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
2010
2308
|
return React.createElement(IconPlaceholder_1.default, {
|
|
2011
2309
|
"data-test": "icon-placeholder",
|
|
@@ -2016,14 +2314,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
2016
2314
|
iconColor: iconColor
|
|
2017
2315
|
});
|
|
2018
2316
|
}
|
|
2317
|
+
|
|
2019
2318
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
2020
2319
|
};
|
|
2320
|
+
|
|
2021
2321
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2022
2322
|
Wrapper: Wrapper,
|
|
2023
2323
|
Visualization: Visualization
|
|
2024
2324
|
});
|
|
2025
2325
|
return Wrapper;
|
|
2026
2326
|
};
|
|
2327
|
+
|
|
2027
2328
|
exports.default = withPlaceholder;
|
|
2028
2329
|
|
|
2029
2330
|
/***/ }),
|
|
@@ -2051,11 +2352,13 @@ module.exports = require("@splunk/visualization-color-palettes");
|
|
|
2051
2352
|
Object.defineProperty(exports, "__esModule", {
|
|
2052
2353
|
value: true
|
|
2053
2354
|
});
|
|
2355
|
+
|
|
2054
2356
|
var i18n_1 = __webpack_require__(2);
|
|
2357
|
+
|
|
2055
2358
|
var background = function background(_ref) {
|
|
2056
2359
|
var label = _ref.label,
|
|
2057
|
-
|
|
2058
|
-
|
|
2360
|
+
themes = _ref.themes,
|
|
2361
|
+
labelPosition = _ref.labelPosition;
|
|
2059
2362
|
return [{
|
|
2060
2363
|
label: (0, i18n_1._)(label || 'Background'),
|
|
2061
2364
|
option: 'backgroundColor',
|
|
@@ -2066,6 +2369,7 @@ var background = function background(_ref) {
|
|
|
2066
2369
|
}
|
|
2067
2370
|
}];
|
|
2068
2371
|
};
|
|
2372
|
+
|
|
2069
2373
|
exports.default = background;
|
|
2070
2374
|
|
|
2071
2375
|
/***/ }),
|
|
@@ -2078,26 +2382,38 @@ module.exports = require("@splunk/charting-bundle");
|
|
|
2078
2382
|
/***/ }),
|
|
2079
2383
|
|
|
2080
2384
|
/***/ 56:
|
|
2385
|
+
/***/ (function(module, exports) {
|
|
2386
|
+
|
|
2387
|
+
module.exports = require("@splunk/themes/useSplunkTheme");
|
|
2388
|
+
|
|
2389
|
+
/***/ }),
|
|
2390
|
+
|
|
2391
|
+
/***/ 57:
|
|
2081
2392
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2082
2393
|
|
|
2083
2394
|
"use strict";
|
|
2084
2395
|
|
|
2085
2396
|
|
|
2086
2397
|
var _toConsumableArray = __webpack_require__(8);
|
|
2398
|
+
|
|
2087
2399
|
var __rest = this && this.__rest || function (s, e) {
|
|
2088
2400
|
var t = {};
|
|
2401
|
+
|
|
2089
2402
|
for (var p in s) {
|
|
2090
2403
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2091
2404
|
}
|
|
2405
|
+
|
|
2092
2406
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2093
2407
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2094
2408
|
}
|
|
2095
2409
|
return t;
|
|
2096
2410
|
};
|
|
2411
|
+
|
|
2097
2412
|
Object.defineProperty(exports, "__esModule", {
|
|
2098
2413
|
value: true
|
|
2099
2414
|
});
|
|
2100
2415
|
exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
|
|
2416
|
+
|
|
2101
2417
|
var lodash_1 = __webpack_require__(3);
|
|
2102
2418
|
/**
|
|
2103
2419
|
* Get formatted annotations
|
|
@@ -2108,10 +2424,12 @@ var lodash_1 = __webpack_require__(3);
|
|
|
2108
2424
|
* @param {Array} options.annotationLabel
|
|
2109
2425
|
* @returns {Array}
|
|
2110
2426
|
*/
|
|
2427
|
+
|
|
2428
|
+
|
|
2111
2429
|
var getAnnotations = function getAnnotations(_ref) {
|
|
2112
2430
|
var annotationX = _ref.annotationX,
|
|
2113
|
-
|
|
2114
|
-
|
|
2431
|
+
annotationColor = _ref.annotationColor,
|
|
2432
|
+
annotationLabel = _ref.annotationLabel;
|
|
2115
2433
|
return annotationX && annotationX.length ? annotationX.map(function (timestamp, i) {
|
|
2116
2434
|
return {
|
|
2117
2435
|
color: annotationColor && annotationColor[i],
|
|
@@ -2120,6 +2438,7 @@ var getAnnotations = function getAnnotations(_ref) {
|
|
|
2120
2438
|
};
|
|
2121
2439
|
}) : [];
|
|
2122
2440
|
};
|
|
2441
|
+
|
|
2123
2442
|
exports.getAnnotations = getAnnotations;
|
|
2124
2443
|
/**
|
|
2125
2444
|
* Truncate the result set to given limit
|
|
@@ -2128,20 +2447,25 @@ exports.getAnnotations = getAnnotations;
|
|
|
2128
2447
|
* @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']
|
|
2129
2448
|
* @returns {Object}
|
|
2130
2449
|
*/
|
|
2450
|
+
|
|
2131
2451
|
var truncateData = function truncateData(dataSet, truncationLimit) {
|
|
2132
2452
|
if (!dataSet) {
|
|
2133
2453
|
return null;
|
|
2134
2454
|
}
|
|
2455
|
+
|
|
2135
2456
|
var limit = parseInt(truncationLimit, 10);
|
|
2457
|
+
|
|
2136
2458
|
if (!limit || limit <= 0) {
|
|
2137
2459
|
return dataSet;
|
|
2138
2460
|
}
|
|
2461
|
+
|
|
2139
2462
|
var truncatedData = Object.assign({}, dataSet);
|
|
2140
2463
|
truncatedData.columns = truncatedData.columns.map(function (columnData) {
|
|
2141
2464
|
return columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData;
|
|
2142
2465
|
});
|
|
2143
2466
|
return truncatedData;
|
|
2144
2467
|
};
|
|
2468
|
+
|
|
2145
2469
|
exports.truncateData = truncateData;
|
|
2146
2470
|
/**
|
|
2147
2471
|
* Helper method to update the option values into the values that SC accepts
|
|
@@ -2149,12 +2473,14 @@ exports.truncateData = truncateData;
|
|
|
2149
2473
|
* @param {Object} options
|
|
2150
2474
|
* @returns {Object}
|
|
2151
2475
|
*/
|
|
2476
|
+
|
|
2152
2477
|
var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
2153
2478
|
return function (options) {
|
|
2154
2479
|
var convertedOptions = Object.assign({}, options);
|
|
2155
2480
|
Object.keys(optionValuesSCMapping).forEach(function (key) {
|
|
2156
2481
|
if ((0, lodash_1.has)(options, key)) {
|
|
2157
2482
|
var updatedValue = optionValuesSCMapping[key][options[key]];
|
|
2483
|
+
|
|
2158
2484
|
if (!(0, lodash_1.isUndefined)(updatedValue)) {
|
|
2159
2485
|
convertedOptions[key] = updatedValue;
|
|
2160
2486
|
}
|
|
@@ -2163,6 +2489,7 @@ var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
|
2163
2489
|
return convertedOptions;
|
|
2164
2490
|
};
|
|
2165
2491
|
};
|
|
2492
|
+
|
|
2166
2493
|
exports.mapToValues = mapToValues;
|
|
2167
2494
|
/**
|
|
2168
2495
|
* Helper method to process options related to y2Fields
|
|
@@ -2170,18 +2497,23 @@ exports.mapToValues = mapToValues;
|
|
|
2170
2497
|
* @param {Object} originalOptions
|
|
2171
2498
|
* @returns {Object}
|
|
2172
2499
|
*/
|
|
2500
|
+
|
|
2173
2501
|
var convertY2AxisOptions = function convertY2AxisOptions(_a) {
|
|
2174
2502
|
var y2Fields = _a.y2Fields,
|
|
2175
|
-
|
|
2503
|
+
originalOptions = __rest(_a, ["y2Fields"]);
|
|
2504
|
+
|
|
2176
2505
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
2506
|
+
|
|
2177
2507
|
if (y2Fields) {
|
|
2178
2508
|
convertedOptions['axisY2.enabled'] = true;
|
|
2179
2509
|
convertedOptions['axisY2.fields'] = (0, lodash_1.isArray)(y2Fields) ? y2Fields.filter(function (name) {
|
|
2180
2510
|
return name;
|
|
2181
2511
|
}).join(',') : y2Fields;
|
|
2182
2512
|
}
|
|
2513
|
+
|
|
2183
2514
|
return convertedOptions;
|
|
2184
2515
|
};
|
|
2516
|
+
|
|
2185
2517
|
exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
2186
2518
|
/**
|
|
2187
2519
|
* Helper method to format value for overlayFields
|
|
@@ -2189,9 +2521,11 @@ exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
|
2189
2521
|
* @param {Object} originalOptions
|
|
2190
2522
|
* @returns {Object}
|
|
2191
2523
|
*/
|
|
2524
|
+
|
|
2192
2525
|
var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
2193
2526
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
2194
2527
|
var overlayFields = originalOptions.overlayFields;
|
|
2528
|
+
|
|
2195
2529
|
if (overlayFields) {
|
|
2196
2530
|
convertedOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
|
|
2197
2531
|
return field;
|
|
@@ -2199,17 +2533,21 @@ var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
|
2199
2533
|
return field.trim();
|
|
2200
2534
|
}).join(',') : overlayFields;
|
|
2201
2535
|
}
|
|
2536
|
+
|
|
2202
2537
|
return convertedOptions;
|
|
2203
2538
|
};
|
|
2539
|
+
|
|
2204
2540
|
exports.convertOverlayFields = convertOverlayFields;
|
|
2205
2541
|
/**
|
|
2206
2542
|
* checks whether data is multi series data
|
|
2207
2543
|
* @param {array} data array
|
|
2208
2544
|
* @return {Boolean}
|
|
2209
2545
|
*/
|
|
2546
|
+
|
|
2210
2547
|
var isMultiSeriesData = function isMultiSeriesData(data) {
|
|
2211
2548
|
return Array.isArray(data) && Array.isArray(data[0]);
|
|
2212
2549
|
};
|
|
2550
|
+
|
|
2213
2551
|
exports.isMultiSeriesData = isMultiSeriesData;
|
|
2214
2552
|
/**
|
|
2215
2553
|
* checks whether data is multi series data and returns value as array
|
|
@@ -2217,19 +2555,22 @@ exports.isMultiSeriesData = isMultiSeriesData;
|
|
|
2217
2555
|
* @param {*} value to return as array
|
|
2218
2556
|
* @return {array}
|
|
2219
2557
|
*/
|
|
2558
|
+
|
|
2220
2559
|
var toArrayForSeries = function toArrayForSeries(data, value) {
|
|
2221
2560
|
return (0, exports.isMultiSeriesData)(data) ? value : [value];
|
|
2222
2561
|
};
|
|
2562
|
+
|
|
2223
2563
|
exports.toArrayForSeries = toArrayForSeries;
|
|
2564
|
+
|
|
2224
2565
|
var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
2225
2566
|
var _ref2$x = _ref2.x,
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2567
|
+
x = _ref2$x === void 0 ? [] : _ref2$x,
|
|
2568
|
+
_ref2$y = _ref2.y,
|
|
2569
|
+
y = _ref2$y === void 0 ? [] : _ref2$y,
|
|
2570
|
+
xField = _ref2.xField,
|
|
2571
|
+
yFields = _ref2.yFields,
|
|
2572
|
+
y2 = _ref2.y2,
|
|
2573
|
+
y2Fields = _ref2.y2Fields;
|
|
2233
2574
|
var columns = [x.map(String)].concat(_toConsumableArray((0, exports.toArrayForSeries)(y, y).map(function (series) {
|
|
2234
2575
|
return series.map(String);
|
|
2235
2576
|
})));
|
|
@@ -2240,10 +2581,10 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
2240
2581
|
return {
|
|
2241
2582
|
name: field
|
|
2242
2583
|
};
|
|
2243
|
-
})));
|
|
2244
|
-
// splunk-charting requires y2 to be part of columns
|
|
2584
|
+
}))); // splunk-charting requires y2 to be part of columns
|
|
2245
2585
|
// when y & y2 options are configured with different (mutually exclusive) series
|
|
2246
2586
|
// y2 columns need to be added to columns
|
|
2587
|
+
|
|
2247
2588
|
if (y2Fields) {
|
|
2248
2589
|
var y2FieldsArray = (0, exports.toArrayForSeries)(y2, y2Fields);
|
|
2249
2590
|
var y2AsArray = (0, exports.toArrayForSeries)(y2, y2).map(function (series) {
|
|
@@ -2258,19 +2599,14 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
2258
2599
|
}
|
|
2259
2600
|
});
|
|
2260
2601
|
}
|
|
2602
|
+
|
|
2261
2603
|
return {
|
|
2262
2604
|
columns: columns,
|
|
2263
2605
|
fields: fields
|
|
2264
2606
|
};
|
|
2265
2607
|
};
|
|
2266
|
-
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
2267
|
-
|
|
2268
|
-
/***/ }),
|
|
2269
|
-
|
|
2270
|
-
/***/ 57:
|
|
2271
|
-
/***/ (function(module, exports) {
|
|
2272
2608
|
|
|
2273
|
-
|
|
2609
|
+
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
2274
2610
|
|
|
2275
2611
|
/***/ }),
|
|
2276
2612
|
|
|
@@ -2285,6 +2621,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2285
2621
|
});
|
|
2286
2622
|
exports.VizBehavior = void 0;
|
|
2287
2623
|
var VizBehavior;
|
|
2624
|
+
|
|
2288
2625
|
(function (VizBehavior) {
|
|
2289
2626
|
/**
|
|
2290
2627
|
* Dynamic Options Behavior.
|
|
@@ -2304,6 +2641,7 @@ var VizBehavior;
|
|
|
2304
2641
|
* missing.
|
|
2305
2642
|
* @type {string}
|
|
2306
2643
|
*/
|
|
2644
|
+
|
|
2307
2645
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
2308
2646
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
2309
2647
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -2322,23 +2660,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2322
2660
|
});
|
|
2323
2661
|
exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
|
|
2324
2662
|
/* eslint-disable react/no-unused-prop-types */
|
|
2663
|
+
|
|
2325
2664
|
var lodash_1 = __webpack_require__(3);
|
|
2665
|
+
|
|
2326
2666
|
var i18n_1 = __webpack_require__(2);
|
|
2667
|
+
|
|
2327
2668
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
2669
|
+
|
|
2328
2670
|
var react_1 = __webpack_require__(1);
|
|
2671
|
+
|
|
2329
2672
|
var React = __webpack_require__(1);
|
|
2673
|
+
|
|
2330
2674
|
var T = __webpack_require__(0);
|
|
2675
|
+
|
|
2331
2676
|
var react_event_listener_1 = __webpack_require__(66);
|
|
2677
|
+
|
|
2332
2678
|
__webpack_require__(67); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
|
|
2679
|
+
|
|
2680
|
+
|
|
2333
2681
|
var charting_bundle_1 = __webpack_require__(55);
|
|
2682
|
+
|
|
2334
2683
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
2684
|
+
|
|
2335
2685
|
var style_1 = __webpack_require__(14);
|
|
2686
|
+
|
|
2336
2687
|
var styled_components_1 = __webpack_require__(4);
|
|
2688
|
+
|
|
2337
2689
|
var Message_1 = __webpack_require__(10);
|
|
2338
|
-
|
|
2690
|
+
|
|
2691
|
+
var useSplunkTheme_1 = __webpack_require__(56);
|
|
2692
|
+
|
|
2339
2693
|
var themeUtils_1 = __webpack_require__(68);
|
|
2694
|
+
|
|
2340
2695
|
var ChartingApi_1 = __webpack_require__(69);
|
|
2696
|
+
|
|
2341
2697
|
exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
|
|
2698
|
+
|
|
2342
2699
|
var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
2343
2700
|
return Object.keys(curOptions).filter(function (key) {
|
|
2344
2701
|
return !(key in nextOptions);
|
|
@@ -2346,7 +2703,9 @@ var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
|
2346
2703
|
return !(key in curOptions) || curOptions[key] !== nextOptions[key];
|
|
2347
2704
|
}));
|
|
2348
2705
|
};
|
|
2706
|
+
|
|
2349
2707
|
exports.changedOptions = changedOptions;
|
|
2708
|
+
|
|
2350
2709
|
function usePrevious(value) {
|
|
2351
2710
|
var ref = (0, react_1.useRef)();
|
|
2352
2711
|
(0, react_1.useEffect)(function () {
|
|
@@ -2354,21 +2713,24 @@ function usePrevious(value) {
|
|
|
2354
2713
|
});
|
|
2355
2714
|
return ref.current;
|
|
2356
2715
|
}
|
|
2716
|
+
|
|
2357
2717
|
var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
|
|
2358
2718
|
// if either of the options are undefined
|
|
2359
2719
|
// it cannot update in place.
|
|
2360
2720
|
if (!curOptions || !nextOptions) {
|
|
2361
2721
|
return false;
|
|
2362
2722
|
}
|
|
2723
|
+
|
|
2363
2724
|
return !exports.NO_INPLACE_PROPS.some(function (p) {
|
|
2364
2725
|
return curOptions[p] !== nextOptions[p];
|
|
2365
2726
|
}) && !(0, exports.changedOptions)(curOptions, nextOptions).some(function (p) {
|
|
2366
2727
|
return p.toLowerCase().endsWith('color');
|
|
2367
2728
|
});
|
|
2368
2729
|
};
|
|
2369
|
-
|
|
2370
|
-
// create 'row' payloads from 'rowContext' in the flattened format:
|
|
2730
|
+
|
|
2731
|
+
exports.canUpdateInPlace = canUpdateInPlace; // create 'row' payloads from 'rowContext' in the flattened format:
|
|
2371
2732
|
// row.<fieldname>.value
|
|
2733
|
+
|
|
2372
2734
|
var updateRowPayload = function updateRowPayload(chartEventRowContext, payload) {
|
|
2373
2735
|
Object.keys(chartEventRowContext || {}).forEach(function (key) {
|
|
2374
2736
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -2376,18 +2738,21 @@ var updateRowPayload = function updateRowPayload(chartEventRowContext, payload)
|
|
|
2376
2738
|
});
|
|
2377
2739
|
return payload;
|
|
2378
2740
|
};
|
|
2741
|
+
|
|
2379
2742
|
exports.updateRowPayload = updateRowPayload;
|
|
2380
2743
|
var VizChartEventType;
|
|
2744
|
+
|
|
2381
2745
|
(function (VizChartEventType) {
|
|
2382
2746
|
VizChartEventType["POINT_CLICK"] = "point.click";
|
|
2383
2747
|
VizChartEventType["POINT_MOUSE_OUT"] = "point.mouseout";
|
|
2384
2748
|
VizChartEventType["POINT_MOUSE_OVER"] = "point.mouseover";
|
|
2385
2749
|
VizChartEventType["LEGEND_CLICK"] = "legend.click";
|
|
2386
|
-
})(VizChartEventType || (VizChartEventType = {}));
|
|
2387
|
-
// @TODO(pwied): remove after HC upgrade to 8+
|
|
2750
|
+
})(VizChartEventType || (VizChartEventType = {})); // @TODO(pwied): remove after HC upgrade to 8+
|
|
2388
2751
|
// .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug
|
|
2389
2752
|
// caused by the accessibility plugin
|
|
2390
2753
|
// https://github.com/highcharts/highcharts/issues/12883
|
|
2754
|
+
|
|
2755
|
+
|
|
2391
2756
|
var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
|
|
2392
2757
|
return {
|
|
2393
2758
|
'data-test': 'charting-container',
|
|
@@ -2415,6 +2780,7 @@ var propTypes = {
|
|
|
2415
2780
|
visualizationApiRef: T.func,
|
|
2416
2781
|
themeKey: T.string
|
|
2417
2782
|
};
|
|
2783
|
+
|
|
2418
2784
|
var Charting = function Charting(props) {
|
|
2419
2785
|
var container = (0, react_1.useRef)(null);
|
|
2420
2786
|
var needsInit = (0, react_1.useRef)(true);
|
|
@@ -2422,6 +2788,7 @@ var Charting = function Charting(props) {
|
|
|
2422
2788
|
var needsRedraw = (0, react_1.useRef)(true);
|
|
2423
2789
|
var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
|
|
2424
2790
|
var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
|
|
2791
|
+
|
|
2425
2792
|
var computeChartingSize = function computeChartingSize() {
|
|
2426
2793
|
if (container.current) {
|
|
2427
2794
|
var rect = container.current.getBoundingClientRect();
|
|
@@ -2430,48 +2797,56 @@ var Charting = function Charting(props) {
|
|
|
2430
2797
|
width: rect.width
|
|
2431
2798
|
};
|
|
2432
2799
|
}
|
|
2800
|
+
|
|
2433
2801
|
return {};
|
|
2434
2802
|
};
|
|
2803
|
+
|
|
2435
2804
|
var splunkTheme = (0, useSplunkTheme_1.default)();
|
|
2436
2805
|
var themeKey = props.themeKey ? props.themeKey : (0, themeUtils_1.getChartingThemeKey)({
|
|
2437
2806
|
splunkThemeV1: splunkTheme
|
|
2438
2807
|
});
|
|
2439
2808
|
var width = props.width,
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2809
|
+
height = props.height,
|
|
2810
|
+
style = props.style,
|
|
2811
|
+
chartData = props.chartData,
|
|
2812
|
+
options = props.options,
|
|
2813
|
+
colorPalette = props.colorPalette,
|
|
2814
|
+
onClick = props.onClick,
|
|
2815
|
+
onSelect = props.onSelect,
|
|
2816
|
+
onPointMouseOut = props.onPointMouseOut,
|
|
2817
|
+
onPointMouseOver = props.onPointMouseOver,
|
|
2818
|
+
onEventTrigger = props.onEventTrigger;
|
|
2450
2819
|
var prevOptions = usePrevious(options);
|
|
2451
2820
|
var prevTimezone = usePrevious(timezone);
|
|
2821
|
+
|
|
2452
2822
|
var handleClick = function handleClick(chartEvent, type) {
|
|
2453
2823
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
|
|
2454
2824
|
payload.name = payload.name2;
|
|
2455
2825
|
delete payload.name2;
|
|
2826
|
+
|
|
2456
2827
|
if (type === VizChartEventType.POINT_CLICK) {
|
|
2457
2828
|
payload.value = payload.value2;
|
|
2458
2829
|
delete payload.value2;
|
|
2459
2830
|
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
2460
2831
|
}
|
|
2832
|
+
|
|
2461
2833
|
onClick({
|
|
2462
2834
|
type: type,
|
|
2463
2835
|
originalEvent: chartEvent,
|
|
2464
2836
|
payload: payload
|
|
2465
2837
|
});
|
|
2466
2838
|
};
|
|
2839
|
+
|
|
2467
2840
|
var destroyChart = function destroyChart() {
|
|
2468
2841
|
if (chart.current) {
|
|
2469
2842
|
chart.current.destroy();
|
|
2470
2843
|
chart.current = null;
|
|
2471
2844
|
}
|
|
2845
|
+
|
|
2472
2846
|
needsRedraw.current = true;
|
|
2473
2847
|
needsInit.current = true;
|
|
2474
2848
|
};
|
|
2849
|
+
|
|
2475
2850
|
var handleSelect = function handleSelect(chartEvent) {
|
|
2476
2851
|
// todo: need change this after breaking all visualizations
|
|
2477
2852
|
if (onSelect && typeof onSelect === 'function') {
|
|
@@ -2481,14 +2856,16 @@ var Charting = function Charting(props) {
|
|
|
2481
2856
|
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2482
2857
|
});
|
|
2483
2858
|
return;
|
|
2484
|
-
}
|
|
2485
|
-
|
|
2859
|
+
} // the chartEvent here is a jQuery event
|
|
2860
|
+
|
|
2861
|
+
|
|
2486
2862
|
onEventTrigger({
|
|
2487
2863
|
type: 'range.select',
|
|
2488
2864
|
originalEvent: chartEvent,
|
|
2489
2865
|
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2490
2866
|
});
|
|
2491
2867
|
};
|
|
2868
|
+
|
|
2492
2869
|
var handlePointMouseOut = function handlePointMouseOut(chartEvent, type) {
|
|
2493
2870
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2494
2871
|
payload.name = payload.name2;
|
|
@@ -2502,6 +2879,7 @@ var Charting = function Charting(props) {
|
|
|
2502
2879
|
payload: payload
|
|
2503
2880
|
});
|
|
2504
2881
|
};
|
|
2882
|
+
|
|
2505
2883
|
var handlePointMouseOver = function handlePointMouseOver(chartEvent, type) {
|
|
2506
2884
|
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2507
2885
|
payload.name = payload.name2;
|
|
@@ -2515,6 +2893,7 @@ var Charting = function Charting(props) {
|
|
|
2515
2893
|
payload: payload
|
|
2516
2894
|
});
|
|
2517
2895
|
};
|
|
2896
|
+
|
|
2518
2897
|
var drawChart = function drawChart() {
|
|
2519
2898
|
var updatedOptions = Object.assign(Object.assign({}, options), {
|
|
2520
2899
|
shouldColorizeTooltipData: false
|
|
@@ -2525,15 +2904,18 @@ var Charting = function Charting(props) {
|
|
|
2525
2904
|
var serializedTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone;
|
|
2526
2905
|
var ianaTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone;
|
|
2527
2906
|
var utcOffset = timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset;
|
|
2907
|
+
|
|
2528
2908
|
if (!computedWidth || !computedHeight) {
|
|
2529
2909
|
return;
|
|
2530
2910
|
}
|
|
2911
|
+
|
|
2531
2912
|
if (!chartData || !Object.keys(chartData).length) {
|
|
2532
2913
|
return;
|
|
2533
|
-
}
|
|
2534
|
-
// splunk-charting layers configuration option updates.
|
|
2914
|
+
} // splunk-charting layers configuration option updates.
|
|
2535
2915
|
// when an option is removed it needs to be set to an empty string
|
|
2536
2916
|
// to override the previous configuration
|
|
2917
|
+
|
|
2918
|
+
|
|
2537
2919
|
if (prevOptions) {
|
|
2538
2920
|
Object.keys(prevOptions).forEach(function (key) {
|
|
2539
2921
|
if (updatedOptions[key] === undefined) {
|
|
@@ -2541,13 +2923,16 @@ var Charting = function Charting(props) {
|
|
|
2541
2923
|
}
|
|
2542
2924
|
});
|
|
2543
2925
|
}
|
|
2926
|
+
|
|
2544
2927
|
try {
|
|
2545
2928
|
if (needsInit.current) {
|
|
2546
2929
|
destroyChart();
|
|
2547
2930
|
charting_bundle_1.default.setTheme(themeKey);
|
|
2931
|
+
|
|
2548
2932
|
if (colorPalette.length > 0) {
|
|
2549
2933
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
2550
2934
|
}
|
|
2935
|
+
|
|
2551
2936
|
chart.current = charting_bundle_1.default.createChart(container.current, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedOptions), {
|
|
2552
2937
|
drilldown: 'all'
|
|
2553
2938
|
}), typeof serializedTimezone === 'string' && {
|
|
@@ -2556,8 +2941,8 @@ var Charting = function Charting(props) {
|
|
|
2556
2941
|
'time.ianaTimezone': ianaTimezone
|
|
2557
2942
|
}), typeof utcOffset === 'number' && {
|
|
2558
2943
|
'time.timezoneOffset': utcOffset
|
|
2559
|
-
}));
|
|
2560
|
-
|
|
2944
|
+
})); // bind event handlers
|
|
2945
|
+
|
|
2561
2946
|
chart.current.on('pointClick', function (e) {
|
|
2562
2947
|
handleClick(e, VizChartEventType.POINT_CLICK);
|
|
2563
2948
|
});
|
|
@@ -2572,29 +2957,37 @@ var Charting = function Charting(props) {
|
|
|
2572
2957
|
});
|
|
2573
2958
|
chart.current.on('chartRangeSelect', handleSelect);
|
|
2574
2959
|
}
|
|
2960
|
+
|
|
2575
2961
|
if (needsRedraw.current) {
|
|
2576
2962
|
charting_bundle_1.default.setTheme(themeKey);
|
|
2963
|
+
|
|
2577
2964
|
if (colorPalette.length > 0) {
|
|
2578
2965
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
2579
2966
|
}
|
|
2967
|
+
|
|
2580
2968
|
chart.current.prepareAndDraw(chartData, updatedOptions, function () {});
|
|
2581
2969
|
}
|
|
2970
|
+
|
|
2582
2971
|
if (chart.current) {
|
|
2583
2972
|
if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
|
|
2584
2973
|
chart.current.resize(computedWidth, computedHeight);
|
|
2585
2974
|
}
|
|
2586
2975
|
}
|
|
2976
|
+
|
|
2587
2977
|
needsInit.current = false;
|
|
2588
2978
|
needsRedraw.current = false;
|
|
2589
2979
|
} catch (e) {
|
|
2590
2980
|
window.console.error('Caught error rendering chart:', e);
|
|
2591
2981
|
}
|
|
2592
2982
|
};
|
|
2983
|
+
|
|
2593
2984
|
var debouncedDrawChart = (0, lodash_1.debounce)(drawChart, 5);
|
|
2985
|
+
|
|
2594
2986
|
var onContainerMount = function onContainerMount(chartingContainer) {
|
|
2595
2987
|
container.current = chartingContainer;
|
|
2596
2988
|
debouncedDrawChart();
|
|
2597
2989
|
};
|
|
2990
|
+
|
|
2598
2991
|
var prevTheme = usePrevious(themeKey);
|
|
2599
2992
|
var prevOnClick = usePrevious(onClick);
|
|
2600
2993
|
(0, react_1.useEffect)(function () {
|
|
@@ -2608,14 +3001,14 @@ var Charting = function Charting(props) {
|
|
|
2608
3001
|
(0, react_1.useEffect)(function () {
|
|
2609
3002
|
// TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme
|
|
2610
3003
|
// seems like redraw doesn't suffice to update the background colors
|
|
2611
|
-
if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) ||
|
|
2612
|
-
// timezone is a simple object so this comparison should be fast
|
|
3004
|
+
if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
|
|
2613
3005
|
JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
|
|
2614
3006
|
needsInit.current = true;
|
|
2615
3007
|
}
|
|
2616
|
-
|
|
2617
|
-
// need to immediately call drawChart upon an option or chartData change
|
|
3008
|
+
|
|
3009
|
+
needsRedraw.current = true; // need to immediately call drawChart upon an option or chartData change
|
|
2618
3010
|
// otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
|
|
3011
|
+
|
|
2619
3012
|
drawChart();
|
|
2620
3013
|
}, [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]);
|
|
2621
3014
|
return React.createElement(ChartingContainer, {
|
|
@@ -2628,6 +3021,7 @@ var Charting = function Charting(props) {
|
|
|
2628
3021
|
onResize: debouncedDrawChart
|
|
2629
3022
|
}));
|
|
2630
3023
|
};
|
|
3024
|
+
|
|
2631
3025
|
var defaultProps = {
|
|
2632
3026
|
width: '100%',
|
|
2633
3027
|
height: 250,
|
|
@@ -2645,31 +3039,36 @@ var defaultProps = {
|
|
|
2645
3039
|
themeKey: null
|
|
2646
3040
|
};
|
|
2647
3041
|
Charting.propTypes = propTypes;
|
|
2648
|
-
Charting.defaultProps = defaultProps;
|
|
2649
|
-
|
|
3042
|
+
Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
|
|
3043
|
+
|
|
2650
3044
|
var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
|
|
2651
3045
|
var Wrapper = function Wrapper(props) {
|
|
2652
3046
|
var chartData = props.chartData;
|
|
3047
|
+
|
|
2653
3048
|
if (!chartData) {
|
|
2654
3049
|
return React.createElement(Message_1.default, {
|
|
2655
3050
|
message: (0, i18n_1._)('No DataSource'),
|
|
2656
3051
|
level: "warning"
|
|
2657
3052
|
});
|
|
2658
3053
|
}
|
|
3054
|
+
|
|
2659
3055
|
if (chartData && !Object.keys(chartData).length) {
|
|
2660
3056
|
return React.createElement(Message_1.default, {
|
|
2661
3057
|
message: (0, i18n_1._)('No Result'),
|
|
2662
3058
|
level: "info"
|
|
2663
3059
|
});
|
|
2664
3060
|
}
|
|
3061
|
+
|
|
2665
3062
|
return React.createElement(Chart, Object.assign({}, props));
|
|
2666
3063
|
};
|
|
3064
|
+
|
|
2667
3065
|
Wrapper.displayName = 'ChartingWrapper';
|
|
2668
3066
|
Wrapper.propTypes = propTypes;
|
|
2669
3067
|
Wrapper.defaultProps = defaultProps;
|
|
2670
3068
|
return Wrapper;
|
|
2671
|
-
};
|
|
2672
|
-
|
|
3069
|
+
}; // export default Charting;
|
|
3070
|
+
|
|
3071
|
+
|
|
2673
3072
|
exports.default = withEmptyChartMessage(Charting);
|
|
2674
3073
|
|
|
2675
3074
|
/***/ }),
|
|
@@ -2702,15 +3101,19 @@ module.exports = require("@splunk/visualizations-shared/themeUtils");
|
|
|
2702
3101
|
|
|
2703
3102
|
|
|
2704
3103
|
var _classCallCheck = __webpack_require__(9);
|
|
3104
|
+
|
|
2705
3105
|
var _createClass = __webpack_require__(18);
|
|
3106
|
+
|
|
2706
3107
|
Object.defineProperty(exports, "__esModule", {
|
|
2707
3108
|
value: true
|
|
2708
3109
|
});
|
|
2709
3110
|
exports.ChartingApiFunctional = void 0;
|
|
3111
|
+
|
|
2710
3112
|
var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
2711
3113
|
// eslint-disable-next-line no-useless-constructor
|
|
2712
3114
|
function ChartingApiFunctional(chartRef) {
|
|
2713
3115
|
_classCallCheck(this, ChartingApiFunctional);
|
|
3116
|
+
|
|
2714
3117
|
this.chartRef = chartRef;
|
|
2715
3118
|
}
|
|
2716
3119
|
/**
|
|
@@ -2718,15 +3121,18 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
|
2718
3121
|
*
|
|
2719
3122
|
* @memberof ChartingApiFunctional
|
|
2720
3123
|
*/
|
|
3124
|
+
|
|
3125
|
+
|
|
2721
3126
|
_createClass(ChartingApiFunctional, [{
|
|
2722
3127
|
key: "highlight",
|
|
2723
3128
|
value: function highlight() {
|
|
2724
3129
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
3130
|
+
xValue: '',
|
|
3131
|
+
seriesName: ''
|
|
3132
|
+
},
|
|
3133
|
+
xValue = _ref.xValue,
|
|
3134
|
+
seriesName = _ref.seriesName;
|
|
3135
|
+
|
|
2730
3136
|
this.getChart().highlight(xValue, seriesName);
|
|
2731
3137
|
}
|
|
2732
3138
|
/**
|
|
@@ -2734,21 +3140,25 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
|
2734
3140
|
*
|
|
2735
3141
|
* @memberof ChartingApiFunctional
|
|
2736
3142
|
*/
|
|
3143
|
+
|
|
2737
3144
|
}, {
|
|
2738
3145
|
key: "unHighlight",
|
|
2739
3146
|
value: function unHighlight() {
|
|
2740
3147
|
this.getChart().unHighlight();
|
|
2741
|
-
}
|
|
2742
|
-
|
|
3148
|
+
} // returns chart object
|
|
3149
|
+
|
|
2743
3150
|
}, {
|
|
2744
3151
|
key: "getChart",
|
|
2745
3152
|
value: function getChart() {
|
|
2746
3153
|
var _a;
|
|
3154
|
+
|
|
2747
3155
|
return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
|
|
2748
3156
|
}
|
|
2749
3157
|
}]);
|
|
3158
|
+
|
|
2750
3159
|
return ChartingApiFunctional;
|
|
2751
3160
|
}();
|
|
3161
|
+
|
|
2752
3162
|
exports.ChartingApiFunctional = ChartingApiFunctional;
|
|
2753
3163
|
|
|
2754
3164
|
/***/ }),
|