@splunk/visualizations 25.13.1 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +318 -234
- package/Area.config.js.map +1 -1
- package/Area.js +1131 -766
- package/Area.js.map +1 -1
- package/Bar.config.js +317 -233
- package/Bar.config.js.map +1 -1
- package/Bar.js +1007 -594
- package/Bar.js.map +1 -1
- package/Bubble.config.js +234 -160
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +912 -509
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +80 -29
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +691 -319
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +308 -223
- package/Column.config.js.map +1 -1
- package/Column.js +1011 -587
- package/Column.js.map +1 -1
- package/Ellipse.config.js +127 -62
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +576 -286
- package/Ellipse.js.map +1 -1
- package/Events.config.js +111 -29
- package/Events.config.js.map +1 -1
- package/Events.js +998 -527
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +142 -73
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +962 -572
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +70 -26
- package/Image.config.js.map +1 -1
- package/Image.js +524 -253
- package/Image.js.map +1 -1
- package/Line.config.js +326 -242
- package/Line.config.js.map +1 -1
- package/Line.js +1022 -606
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +99 -49
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +1184 -762
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +311 -167
- package/Map.config.js.map +1 -1
- package/Map.js +1479 -873
- package/Map.js.map +1 -1
- package/Markdown.config.js +93 -43
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +603 -332
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +163 -105
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +1025 -628
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +95 -41
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +993 -622
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +99 -46
- package/Pie.config.js.map +1 -1
- package/Pie.js +847 -442
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +114 -62
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +1097 -633
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +131 -65
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +580 -288
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +103 -41
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +1128 -586
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +231 -157
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +904 -504
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +212 -142
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1506 -956
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +294 -233
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +208 -138
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +1375 -914
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +252 -137
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +2194 -1069
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +172 -83
- package/SparkLine.js.map +1 -1
- package/Table.config.js +123 -70
- package/Table.config.js.map +1 -1
- package/Table.js +1094 -590
- package/Table.js.map +1 -1
- package/common/Charting.js +147 -75
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +91 -36
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +70 -60
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +45 -36
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +177 -86
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +65 -32
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +34 -7
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +10 -4
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +41 -28
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +56 -24
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +15 -5
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +238 -155
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +34 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +59 -23
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +9 -4
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +5 -3
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +3 -2
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +370 -206
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +243 -198
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +36 -9
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +87 -26
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +4 -2
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +375 -193
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +25 -27
package/Pie.js
CHANGED
|
@@ -87,7 +87,7 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 440);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -136,40 +136,46 @@ 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 {
|
|
147
153
|
style: {
|
|
148
|
-
width: style_1.toPx(width)
|
|
154
|
+
width: (0, style_1.toPx)(width)
|
|
149
155
|
}
|
|
150
156
|
};
|
|
151
157
|
}).withConfig({
|
|
152
158
|
displayName: "FixedSizeContainer__Item",
|
|
153
159
|
componentId: "sc-1yhgpod-0"
|
|
154
160
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
155
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
156
|
-
});
|
|
157
|
-
|
|
161
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
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
|
-
width: style_1.toPx(width)
|
|
169
|
+
width: (0, style_1.toPx)(width)
|
|
164
170
|
}), height && {
|
|
165
|
-
height: style_1.toPx(height)
|
|
171
|
+
height: (0, style_1.toPx)(height)
|
|
166
172
|
})
|
|
167
173
|
};
|
|
168
174
|
}).withConfig({
|
|
169
175
|
displayName: "FixedSizeContainer__FixSizeItem",
|
|
170
176
|
componentId: "sc-1yhgpod-1"
|
|
171
177
|
})(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
|
|
172
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
178
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
173
179
|
});
|
|
174
180
|
var ItemContent = styled_components_1.default.div.withConfig({
|
|
175
181
|
displayName: "FixedSizeContainer__ItemContent",
|
|
@@ -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,29 +199,32 @@ 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": "
|
|
205
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
197
206
|
width: width,
|
|
198
207
|
height: height,
|
|
199
208
|
backgroundColor: backgroundColor
|
|
200
209
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
201
210
|
var newWidth = _ref3.width,
|
|
202
|
-
|
|
211
|
+
newHeight = _ref3.height;
|
|
203
212
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
204
213
|
width: newWidth,
|
|
205
214
|
height: newHeight
|
|
206
215
|
}));
|
|
207
216
|
})));
|
|
208
217
|
};
|
|
218
|
+
|
|
209
219
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
210
220
|
return FixedSizeContainer;
|
|
211
221
|
};
|
|
222
|
+
|
|
212
223
|
exports.default = withFixedSizeContainer;
|
|
213
224
|
|
|
214
225
|
/***/ }),
|
|
215
226
|
|
|
216
|
-
/***/
|
|
227
|
+
/***/ 133:
|
|
217
228
|
/***/ (function(module, exports) {
|
|
218
229
|
|
|
219
230
|
module.exports = require("@splunk/visualization-encoding/utils/dsl");
|
|
@@ -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
|
+
/***/ 164:
|
|
269
282
|
/***/ (function(module, exports, __webpack_require__) {
|
|
270
283
|
|
|
271
284
|
"use strict";
|
|
@@ -273,48 +286,65 @@ 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
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
var
|
|
294
|
-
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
var Charting_1 = __webpack_require__(65);
|
|
310
|
+
|
|
311
|
+
var charting_bundle_1 = __webpack_require__(55);
|
|
312
|
+
|
|
313
|
+
var simpleXMLOptions_1 = __webpack_require__(70);
|
|
314
|
+
|
|
315
|
+
var config_1 = __webpack_require__(441);
|
|
316
|
+
|
|
295
317
|
exports.config = config_1.default;
|
|
296
|
-
|
|
297
|
-
var
|
|
298
|
-
|
|
299
|
-
var
|
|
318
|
+
|
|
319
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
320
|
+
|
|
321
|
+
var pieUtils_1 = __webpack_require__(443);
|
|
322
|
+
|
|
323
|
+
var chartingUtils_1 = __webpack_require__(56);
|
|
324
|
+
|
|
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
|
-
|
|
316
|
-
computedProps.options = lodash_1.chain(otherOptions).pick(validOptions).thru(pieUtils_1.convertToPieSCProperties).thru(function (options) {
|
|
317
|
-
return Object.assign(Object.assign({}, simpleXMLOptions_1.getSimpleXMLOptionsForProps(options)), {
|
|
344
|
+
valueField = otherOptions.valueField,
|
|
345
|
+
hasEventHandlers = otherOptions.hasEventHandlers;
|
|
346
|
+
computedProps.options = (0, lodash_1.chain)(otherOptions).pick(validOptions).thru(pieUtils_1.convertToPieSCProperties).thru(function (options) {
|
|
347
|
+
return Object.assign(Object.assign({}, (0, simpleXMLOptions_1.getSimpleXMLOptionsForProps)(options)), {
|
|
318
348
|
chart: 'pie'
|
|
319
349
|
});
|
|
320
350
|
}).value();
|
|
@@ -327,39 +357,48 @@ 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
|
-
primaryData = chartingUtils_1.truncateData(primaryData, truncationLimit);
|
|
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
|
-
return IconPlaceholder_1.shouldShowIconPlaceholder(dataSources, loading) || pieUtils_1.invalidOptionField('value', dataSources, options, config_1.default) || pieUtils_1.invalidOptionField('label', dataSources, options, config_1.default) || pieUtils_1.allInvalidDataValues(dataSources, options, config_1.default);
|
|
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
|
-
var Pie = withDashboardViz_1.default({
|
|
397
|
+
var Pie = (0, withDashboardViz_1.default)({
|
|
359
398
|
ReactViz: Charting_1.default,
|
|
360
399
|
computeVizProps: exports.computeVizProps,
|
|
361
400
|
useIconPlaceholder: function useIconPlaceholder(dataSources, loading, options) {
|
|
362
|
-
return exports.showPlaceHolderIcon(dataSources, loading, options);
|
|
401
|
+
return (0, exports.showPlaceHolderIcon)(dataSources, loading, options);
|
|
363
402
|
},
|
|
364
403
|
vizConfig: config_1.default
|
|
365
404
|
});
|
|
@@ -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
|
-
var presetContext = lodash_1.get(preset, ['value', 'context'], {});
|
|
561
|
-
var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
|
|
626
|
+
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
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,14 +641,16 @@ 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
|
-
return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
|
|
646
|
+
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
579
647
|
return {
|
|
580
648
|
label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
|
|
581
649
|
value: i
|
|
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
|
/***/ }),
|
|
@@ -618,35 +690,35 @@ module.exports = require("@splunk/themes/pick");
|
|
|
618
690
|
/***/ 25:
|
|
619
691
|
/***/ (function(module, exports) {
|
|
620
692
|
|
|
621
|
-
module.exports = require("@splunk/
|
|
693
|
+
module.exports = require("@splunk/ui-utils/id");
|
|
622
694
|
|
|
623
695
|
/***/ }),
|
|
624
696
|
|
|
625
697
|
/***/ 26:
|
|
626
698
|
/***/ (function(module, exports) {
|
|
627
699
|
|
|
628
|
-
module.exports = require("@splunk/
|
|
700
|
+
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
629
701
|
|
|
630
702
|
/***/ }),
|
|
631
703
|
|
|
632
704
|
/***/ 27:
|
|
633
705
|
/***/ (function(module, exports) {
|
|
634
706
|
|
|
635
|
-
module.exports = require("@splunk/visualizations-shared/
|
|
707
|
+
module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
636
708
|
|
|
637
709
|
/***/ }),
|
|
638
710
|
|
|
639
711
|
/***/ 28:
|
|
640
712
|
/***/ (function(module, exports) {
|
|
641
713
|
|
|
642
|
-
module.exports = require("@splunk/visualizations-shared/
|
|
714
|
+
module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
|
|
643
715
|
|
|
644
716
|
/***/ }),
|
|
645
717
|
|
|
646
718
|
/***/ 29:
|
|
647
719
|
/***/ (function(module, exports) {
|
|
648
720
|
|
|
649
|
-
module.exports = require("@splunk/
|
|
721
|
+
module.exports = require("@splunk/visualizations-shared/propUtils");
|
|
650
722
|
|
|
651
723
|
/***/ }),
|
|
652
724
|
|
|
@@ -657,7 +729,14 @@ module.exports = require("lodash");
|
|
|
657
729
|
|
|
658
730
|
/***/ }),
|
|
659
731
|
|
|
660
|
-
/***/
|
|
732
|
+
/***/ 30:
|
|
733
|
+
/***/ (function(module, exports) {
|
|
734
|
+
|
|
735
|
+
module.exports = require("@splunk/visualization-encoding/Options");
|
|
736
|
+
|
|
737
|
+
/***/ }),
|
|
738
|
+
|
|
739
|
+
/***/ 32:
|
|
661
740
|
/***/ (function(module, exports, __webpack_require__) {
|
|
662
741
|
|
|
663
742
|
"use strict";
|
|
@@ -667,11 +746,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
667
746
|
value: true
|
|
668
747
|
});
|
|
669
748
|
exports.shouldShowIconPlaceholder = void 0;
|
|
749
|
+
|
|
670
750
|
var React = __webpack_require__(1);
|
|
751
|
+
|
|
671
752
|
var T = __webpack_require__(0);
|
|
753
|
+
|
|
672
754
|
var lodash_1 = __webpack_require__(3);
|
|
755
|
+
|
|
673
756
|
var i18n_1 = __webpack_require__(2);
|
|
757
|
+
|
|
674
758
|
var Message_1 = __webpack_require__(10);
|
|
759
|
+
|
|
675
760
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
676
761
|
/**
|
|
677
762
|
* @method shouldShowIconPlaceholder
|
|
@@ -679,14 +764,17 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
679
764
|
* @param {boolean} loading
|
|
680
765
|
* @returns {boolean}
|
|
681
766
|
*/
|
|
767
|
+
|
|
768
|
+
|
|
682
769
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
683
770
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
684
|
-
var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
|
|
771
|
+
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
685
772
|
var noData = data === undefined;
|
|
686
|
-
var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
|
|
773
|
+
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields[0]', undefined);
|
|
687
774
|
var noFields = fields === undefined;
|
|
688
775
|
return loading || noData || noFields;
|
|
689
776
|
};
|
|
777
|
+
|
|
690
778
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
691
779
|
var propTypes = {
|
|
692
780
|
icon: T.func,
|
|
@@ -701,11 +789,13 @@ var propTypes = {
|
|
|
701
789
|
* @param {IconPlaceholderProps} props
|
|
702
790
|
* @returns {React.ReactElement}
|
|
703
791
|
*/
|
|
792
|
+
|
|
704
793
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
705
794
|
var width = props.width,
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
795
|
+
height = props.height,
|
|
796
|
+
icon = props.icon,
|
|
797
|
+
iconColor = props.iconColor;
|
|
798
|
+
|
|
709
799
|
if (icon) {
|
|
710
800
|
return React.createElement(icon, {
|
|
711
801
|
style: {
|
|
@@ -720,26 +810,21 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
720
810
|
height: '50%'
|
|
721
811
|
});
|
|
722
812
|
}
|
|
813
|
+
|
|
723
814
|
return React.createElement(Message_1.default, {
|
|
724
815
|
width: width,
|
|
725
816
|
height: height,
|
|
726
817
|
level: "warning",
|
|
727
|
-
message: i18n_1._('No DataSource Connected')
|
|
818
|
+
message: (0, i18n_1._)('No DataSource Connected')
|
|
728
819
|
});
|
|
729
820
|
};
|
|
821
|
+
|
|
730
822
|
IconPlaceholder.propTypes = propTypes;
|
|
731
823
|
IconPlaceholder.defaultProps = {
|
|
732
824
|
width: '100%',
|
|
733
825
|
height: 250
|
|
734
826
|
};
|
|
735
|
-
exports.default = FixedSizeContainer_1.default(IconPlaceholder);
|
|
736
|
-
|
|
737
|
-
/***/ }),
|
|
738
|
-
|
|
739
|
-
/***/ 32:
|
|
740
|
-
/***/ (function(module, exports) {
|
|
741
|
-
|
|
742
|
-
module.exports = require("@splunk/ui-utils/id");
|
|
827
|
+
exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
743
828
|
|
|
744
829
|
/***/ }),
|
|
745
830
|
|
|
@@ -750,21 +835,27 @@ module.exports = require("@splunk/ui-utils/id");
|
|
|
750
835
|
|
|
751
836
|
|
|
752
837
|
var _defineProperty = __webpack_require__(7);
|
|
838
|
+
|
|
753
839
|
Object.defineProperty(exports, "__esModule", {
|
|
754
840
|
value: true
|
|
755
841
|
});
|
|
756
842
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
843
|
+
|
|
757
844
|
var T = __webpack_require__(0);
|
|
845
|
+
|
|
758
846
|
var lodash_1 = __webpack_require__(3);
|
|
759
|
-
|
|
847
|
+
|
|
848
|
+
var DataSource_1 = __webpack_require__(34);
|
|
849
|
+
|
|
760
850
|
exports.SortParamsPropTypes = T.shape({
|
|
761
851
|
currentSortKey: T.string,
|
|
762
852
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
763
853
|
onSort: T.func
|
|
764
854
|
});
|
|
855
|
+
|
|
765
856
|
var getSortingParams = function getSortingParams(_ref) {
|
|
766
857
|
var requestParams = _ref.requestParams,
|
|
767
|
-
|
|
858
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
768
859
|
var currentSortKey;
|
|
769
860
|
var currentSortDir;
|
|
770
861
|
var nextSortDirMap = {
|
|
@@ -773,17 +864,20 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
773
864
|
none: 'asc'
|
|
774
865
|
};
|
|
775
866
|
var onSort;
|
|
867
|
+
|
|
776
868
|
if (typeof onRequestParamsChange === 'function') {
|
|
777
|
-
if (requestParams && lodash_1.has(requestParams, 'sort')) {
|
|
869
|
+
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
778
870
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
779
871
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
780
|
-
}
|
|
781
|
-
|
|
872
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
873
|
+
|
|
874
|
+
|
|
782
875
|
onSort = function onSort(e, _ref2) {
|
|
783
876
|
var sortKey = _ref2.sortKey,
|
|
784
|
-
|
|
877
|
+
sortDir = _ref2.sortDir;
|
|
878
|
+
|
|
785
879
|
if (typeof sortKey === 'string') {
|
|
786
|
-
var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
880
|
+
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
787
881
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
788
882
|
offset: 0,
|
|
789
883
|
sort: _defineProperty({}, sortKey, nextSortDir)
|
|
@@ -793,12 +887,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
793
887
|
}
|
|
794
888
|
};
|
|
795
889
|
}
|
|
890
|
+
|
|
796
891
|
return {
|
|
797
892
|
currentSortKey: currentSortKey,
|
|
798
893
|
currentSortDir: currentSortDir,
|
|
799
894
|
onSort: onSort
|
|
800
895
|
};
|
|
801
896
|
};
|
|
897
|
+
|
|
802
898
|
exports.getSortingParams = getSortingParams;
|
|
803
899
|
|
|
804
900
|
/***/ }),
|
|
@@ -809,43 +905,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
809
905
|
"use strict";
|
|
810
906
|
|
|
811
907
|
|
|
908
|
+
Object.defineProperty(exports, "__esModule", {
|
|
909
|
+
value: true
|
|
910
|
+
});
|
|
911
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
912
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
913
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
914
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
915
|
+
|
|
916
|
+
/***/ }),
|
|
917
|
+
|
|
918
|
+
/***/ 35:
|
|
919
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
920
|
+
|
|
921
|
+
"use strict";
|
|
922
|
+
|
|
923
|
+
|
|
812
924
|
Object.defineProperty(exports, "__esModule", {
|
|
813
925
|
value: true
|
|
814
926
|
});
|
|
815
927
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
928
|
+
|
|
816
929
|
var T = __webpack_require__(0);
|
|
930
|
+
|
|
817
931
|
var lodash_1 = __webpack_require__(3);
|
|
932
|
+
|
|
818
933
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
819
934
|
isPaging: T.bool,
|
|
820
935
|
current: T.number,
|
|
821
936
|
totalPages: T.number,
|
|
822
937
|
onChange: T.func
|
|
823
938
|
});
|
|
939
|
+
|
|
824
940
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
825
941
|
var requestParams = _ref.requestParams,
|
|
826
|
-
|
|
827
|
-
|
|
942
|
+
meta = _ref.meta,
|
|
943
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
828
944
|
var totalCount = meta && meta.totalCount || 0;
|
|
829
945
|
var offset = requestParams && requestParams.offset || 0;
|
|
830
946
|
var count = requestParams && requestParams.count;
|
|
831
947
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
832
948
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
833
949
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
950
|
+
|
|
834
951
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
835
952
|
var page = _ref2.page,
|
|
836
|
-
|
|
837
|
-
var newParams = lodash_1.cloneDeep(requestParams);
|
|
953
|
+
countArg = _ref2.count;
|
|
954
|
+
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
955
|
+
|
|
838
956
|
if (typeof countArg === 'number') {
|
|
839
957
|
newParams.count = countArg;
|
|
840
958
|
newParams.offset = 0;
|
|
841
959
|
}
|
|
960
|
+
|
|
842
961
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
962
|
+
|
|
843
963
|
if (typeof page === 'number' && page > 0) {
|
|
844
964
|
newParams.count = pageCount;
|
|
845
965
|
newParams.offset = (page - 1) * pageCount;
|
|
846
966
|
}
|
|
967
|
+
|
|
847
968
|
onRequestParamsChange(newParams);
|
|
848
969
|
};
|
|
970
|
+
|
|
849
971
|
return {
|
|
850
972
|
isPaging: isPaging,
|
|
851
973
|
current: current,
|
|
@@ -853,11 +975,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
853
975
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
854
976
|
};
|
|
855
977
|
};
|
|
978
|
+
|
|
856
979
|
exports.getPaginationParams = getPaginationParams;
|
|
857
980
|
|
|
858
981
|
/***/ }),
|
|
859
982
|
|
|
860
|
-
/***/
|
|
983
|
+
/***/ 36:
|
|
861
984
|
/***/ (function(module, exports, __webpack_require__) {
|
|
862
985
|
|
|
863
986
|
"use strict";
|
|
@@ -868,6 +991,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
868
991
|
});
|
|
869
992
|
exports.VizCategory = void 0;
|
|
870
993
|
var VizCategory;
|
|
994
|
+
|
|
871
995
|
(function (VizCategory) {
|
|
872
996
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
873
997
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -885,67 +1009,96 @@ var VizCategory;
|
|
|
885
1009
|
|
|
886
1010
|
/***/ }),
|
|
887
1011
|
|
|
888
|
-
/***/
|
|
1012
|
+
/***/ 37:
|
|
889
1013
|
/***/ (function(module, exports, __webpack_require__) {
|
|
890
1014
|
|
|
891
1015
|
"use strict";
|
|
892
1016
|
|
|
893
1017
|
|
|
894
1018
|
var _slicedToArray = __webpack_require__(17);
|
|
1019
|
+
|
|
895
1020
|
Object.defineProperty(exports, "__esModule", {
|
|
896
1021
|
value: true
|
|
897
1022
|
});
|
|
1023
|
+
|
|
898
1024
|
var React = __webpack_require__(1);
|
|
1025
|
+
|
|
899
1026
|
var lodash_1 = __webpack_require__(3);
|
|
900
|
-
|
|
901
|
-
var
|
|
902
|
-
|
|
903
|
-
var
|
|
904
|
-
|
|
1027
|
+
|
|
1028
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1029
|
+
|
|
1030
|
+
var Options_1 = __webpack_require__(30);
|
|
1031
|
+
|
|
1032
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1033
|
+
|
|
1034
|
+
var TimezoneContext_1 = __webpack_require__(26);
|
|
1035
|
+
|
|
1036
|
+
var moment_1 = __webpack_require__(40);
|
|
1037
|
+
|
|
905
1038
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1039
|
+
|
|
906
1040
|
var styled_components_1 = __webpack_require__(4);
|
|
907
|
-
|
|
908
|
-
var
|
|
909
|
-
|
|
910
|
-
var
|
|
911
|
-
|
|
1041
|
+
|
|
1042
|
+
var hocUtils_1 = __webpack_require__(27);
|
|
1043
|
+
|
|
1044
|
+
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
1045
|
+
|
|
1046
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1047
|
+
|
|
1048
|
+
var id_1 = __webpack_require__(25);
|
|
1049
|
+
|
|
1050
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1051
|
+
|
|
912
1052
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1053
|
+
|
|
913
1054
|
var getSorting_1 = __webpack_require__(33);
|
|
914
|
-
|
|
1055
|
+
|
|
1056
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1057
|
+
|
|
915
1058
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1059
|
+
|
|
916
1060
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1061
|
+
|
|
917
1062
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1063
|
+
|
|
918
1064
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
919
1065
|
/**
|
|
920
1066
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
921
1067
|
* @param {DashboardVizOpts} opts
|
|
922
1068
|
* @returns {HOC}
|
|
923
1069
|
*/
|
|
1070
|
+
|
|
1071
|
+
|
|
924
1072
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
925
1073
|
var ReactViz = opts.ReactViz,
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
var
|
|
1074
|
+
vizConfig = opts.vizConfig,
|
|
1075
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1076
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1077
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1078
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1079
|
+
|
|
1080
|
+
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
1081
|
+
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1082
|
+
|
|
933
1083
|
var DashboardViz = function DashboardViz(props) {
|
|
934
1084
|
var _a;
|
|
1085
|
+
|
|
935
1086
|
var mode = props.mode,
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1087
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1088
|
+
dataSources = props.dataSources,
|
|
1089
|
+
options = props.options,
|
|
1090
|
+
_props$context = props.context,
|
|
1091
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1092
|
+
width = props.width,
|
|
1093
|
+
height = props.height,
|
|
1094
|
+
onComputedProps = props.onComputedProps,
|
|
1095
|
+
onEventTrigger = props.onEventTrigger,
|
|
1096
|
+
theme = props.theme,
|
|
1097
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1098
|
+
|
|
947
1099
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
948
|
-
|
|
1100
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1101
|
+
|
|
949
1102
|
if (serializedTimezone) {
|
|
950
1103
|
/*
|
|
951
1104
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -959,44 +1112,58 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
959
1112
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
960
1113
|
}
|
|
961
1114
|
}
|
|
1115
|
+
|
|
962
1116
|
var themeFunc = function themeFunc(themeVar) {
|
|
963
1117
|
var _a, _b;
|
|
1118
|
+
|
|
964
1119
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
965
1120
|
};
|
|
1121
|
+
|
|
966
1122
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1123
|
+
|
|
1124
|
+
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
1125
|
+
theme: theme
|
|
1126
|
+
}),
|
|
1127
|
+
currentThemeFamily = _ref.family,
|
|
1128
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1129
|
+
currentThemeDensity = _ref.density;
|
|
1130
|
+
|
|
973
1131
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1132
|
+
|
|
974
1133
|
var _React$useState = React.useState({}),
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1134
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1135
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1136
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1137
|
+
|
|
1138
|
+
|
|
978
1139
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1140
|
+
|
|
1141
|
+
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
1142
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1143
|
+
visualizationID = _React$useState4[0];
|
|
1144
|
+
|
|
982
1145
|
var _React$useState5 = React.useState({}),
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1146
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1147
|
+
dataSourcesInState = _React$useState6[0],
|
|
1148
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1149
|
+
|
|
986
1150
|
var _React$useState7 = React.useState(),
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1151
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1152
|
+
dataFramesInState = _React$useState8[0],
|
|
1153
|
+
setDataFramesInState = _React$useState8[1];
|
|
1154
|
+
|
|
1155
|
+
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1156
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1157
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1158
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1159
|
+
|
|
1160
|
+
var isMounted = React.useRef(true);
|
|
1161
|
+
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
995
1162
|
try {
|
|
996
1163
|
if (useAsyncEvaluatedOptions) {
|
|
997
1164
|
var optionsToEvaluate = {
|
|
998
|
-
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
999
|
-
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
1165
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1166
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1000
1167
|
};
|
|
1001
1168
|
var asyncDynamicOptionsEvaluatorParams = {
|
|
1002
1169
|
visualizationID: visualizationID,
|
|
@@ -1007,21 +1174,23 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1007
1174
|
};
|
|
1008
1175
|
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
1009
1176
|
setEvaluatedOptionsAsync(results.results);
|
|
1010
|
-
}).catch(function (
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1177
|
+
}).catch(function () {
|
|
1178
|
+
if (isMounted.current) {
|
|
1179
|
+
setUseAsyncEvaluatedOptions(false);
|
|
1180
|
+
}
|
|
1014
1181
|
});
|
|
1015
1182
|
} else {
|
|
1016
1183
|
var dataFrames = dataFramesInState;
|
|
1184
|
+
|
|
1017
1185
|
if (dataSources !== dataSourcesInState) {
|
|
1018
1186
|
setDataSourcesInState(dataSources);
|
|
1019
1187
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1020
1188
|
setDataFramesInState(dataFrames);
|
|
1021
1189
|
}
|
|
1190
|
+
|
|
1022
1191
|
return Options_1.Options.evaluate({
|
|
1023
|
-
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
1024
|
-
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
1192
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1193
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1025
1194
|
}, dataSources, themeFunc, dataFrames);
|
|
1026
1195
|
}
|
|
1027
1196
|
} catch (e) {
|
|
@@ -1029,67 +1198,76 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1029
1198
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1030
1199
|
return {};
|
|
1031
1200
|
}
|
|
1201
|
+
|
|
1032
1202
|
return {};
|
|
1033
1203
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1034
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1035
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1204
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1036
1205
|
// 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
|
|
1037
1206
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1207
|
+
|
|
1038
1208
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1039
1209
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1210
|
+
|
|
1040
1211
|
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) {
|
|
1041
1212
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1042
1213
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1043
1214
|
});
|
|
1044
|
-
}
|
|
1045
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1215
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1046
1216
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1217
|
+
|
|
1218
|
+
|
|
1047
1219
|
React.useEffect(function () {
|
|
1048
1220
|
onComputedProps(clonedEvaluatedOptions);
|
|
1049
1221
|
});
|
|
1050
1222
|
React.useEffect(function () {
|
|
1051
1223
|
return function () {
|
|
1052
1224
|
if (useAsyncEvaluatedOptions) {
|
|
1225
|
+
isMounted.current = false;
|
|
1053
1226
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1054
1227
|
}
|
|
1055
|
-
};
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
// present warning message if any required props are missing
|
|
1228
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1229
|
+
}, []); // present warning message if any required props are missing
|
|
1230
|
+
|
|
1059
1231
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptionsToUse);
|
|
1232
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1233
|
+
supports = vizConfig.supports;
|
|
1234
|
+
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1235
|
+
|
|
1063
1236
|
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
|
|
1064
1237
|
) {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1238
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1239
|
+
"data-test": "missing-props-message",
|
|
1240
|
+
width: width,
|
|
1241
|
+
height: height,
|
|
1242
|
+
missingProps: missing,
|
|
1243
|
+
backgroundColor: bgColorFromTheme
|
|
1244
|
+
});
|
|
1245
|
+
} // events
|
|
1246
|
+
|
|
1247
|
+
|
|
1074
1248
|
var eventCallbackProps = {};
|
|
1249
|
+
|
|
1075
1250
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1076
1251
|
var supportedEvents = vizConfig.events;
|
|
1077
1252
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1078
|
-
var eventCallbackPropName = lodash_1.camelCase("on.".concat(eventName));
|
|
1079
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1080
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1253
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1254
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1081
1255
|
// then remove these lines
|
|
1256
|
+
|
|
1082
1257
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1083
1258
|
var payload = {};
|
|
1259
|
+
|
|
1084
1260
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1085
1261
|
payloadKeys.forEach(function (p) {
|
|
1086
1262
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1087
1263
|
});
|
|
1088
1264
|
}
|
|
1265
|
+
|
|
1089
1266
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1090
1267
|
if (ev && ev.payload) {
|
|
1091
1268
|
payload = ev.payload;
|
|
1092
1269
|
}
|
|
1270
|
+
|
|
1093
1271
|
return onEventTrigger({
|
|
1094
1272
|
originalEvent: ev,
|
|
1095
1273
|
payload: payload,
|
|
@@ -1097,8 +1275,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1097
1275
|
});
|
|
1098
1276
|
};
|
|
1099
1277
|
});
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1278
|
+
} // compute pure viz props which are not from options
|
|
1279
|
+
|
|
1280
|
+
|
|
1102
1281
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1103
1282
|
themeFunc: themeFunc
|
|
1104
1283
|
}));
|
|
@@ -1116,21 +1295,25 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1116
1295
|
* In future, we could automatically detect which all datasources are being used
|
|
1117
1296
|
* and bind those magically to pagination/sorting behavior.
|
|
1118
1297
|
*/
|
|
1298
|
+
|
|
1119
1299
|
var dataSourceMetadata = {};
|
|
1120
1300
|
var OptionKey = 'paginateDataSourceKey';
|
|
1121
|
-
var paginateDataSourceKey = lodash_1.has(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
var
|
|
1301
|
+
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1302
|
+
|
|
1303
|
+
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1304
|
+
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1305
|
+
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1306
|
+
|
|
1125
1307
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1126
1308
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1127
1309
|
};
|
|
1128
|
-
|
|
1310
|
+
|
|
1311
|
+
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1129
1312
|
requestParams: requestParams,
|
|
1130
1313
|
meta: meta,
|
|
1131
1314
|
onRequestParamsChange: handleRequestParamsChange
|
|
1132
1315
|
});
|
|
1133
|
-
var paginatorParams = getPagination_1.getPaginationParams({
|
|
1316
|
+
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
1134
1317
|
requestParams: requestParams,
|
|
1135
1318
|
meta: meta,
|
|
1136
1319
|
onRequestParamsChange: handleRequestParamsChange
|
|
@@ -1139,115 +1322,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1139
1322
|
sortParams: sortParams,
|
|
1140
1323
|
paginatorParams: paginatorParams
|
|
1141
1324
|
};
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1325
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1326
|
+
|
|
1327
|
+
|
|
1144
1328
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1145
1329
|
return null;
|
|
1146
1330
|
}
|
|
1331
|
+
|
|
1147
1332
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1148
1333
|
mode: mode,
|
|
1149
1334
|
width: width,
|
|
1150
1335
|
height: height
|
|
1151
1336
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1152
1337
|
};
|
|
1338
|
+
|
|
1153
1339
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1154
1340
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1155
1341
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1156
1342
|
theme: {}
|
|
1157
|
-
});
|
|
1158
|
-
|
|
1159
|
-
DashboardViz.config = vizConfig;
|
|
1160
|
-
|
|
1161
|
-
return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1343
|
+
}); // attach viz config
|
|
1344
|
+
|
|
1345
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1346
|
+
|
|
1347
|
+
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1162
1348
|
};
|
|
1349
|
+
|
|
1163
1350
|
exports.default = withDashboardViz;
|
|
1164
1351
|
|
|
1165
1352
|
/***/ }),
|
|
1166
1353
|
|
|
1167
|
-
/***/
|
|
1354
|
+
/***/ 38:
|
|
1168
1355
|
/***/ (function(module, exports) {
|
|
1169
1356
|
|
|
1170
1357
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1171
1358
|
|
|
1172
1359
|
/***/ }),
|
|
1173
1360
|
|
|
1174
|
-
/***/
|
|
1361
|
+
/***/ 39:
|
|
1175
1362
|
/***/ (function(module, exports) {
|
|
1176
1363
|
|
|
1177
1364
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1178
1365
|
|
|
1179
1366
|
/***/ }),
|
|
1180
1367
|
|
|
1181
|
-
/***/
|
|
1368
|
+
/***/ 4:
|
|
1182
1369
|
/***/ (function(module, exports) {
|
|
1183
1370
|
|
|
1184
|
-
module.exports = require("
|
|
1371
|
+
module.exports = require("styled-components");
|
|
1185
1372
|
|
|
1186
1373
|
/***/ }),
|
|
1187
1374
|
|
|
1188
|
-
/***/
|
|
1375
|
+
/***/ 40:
|
|
1189
1376
|
/***/ (function(module, exports) {
|
|
1190
1377
|
|
|
1191
|
-
module.exports = require("
|
|
1378
|
+
module.exports = require("@splunk/moment");
|
|
1192
1379
|
|
|
1193
1380
|
/***/ }),
|
|
1194
1381
|
|
|
1195
|
-
/***/
|
|
1382
|
+
/***/ 41:
|
|
1196
1383
|
/***/ (function(module, exports) {
|
|
1197
1384
|
|
|
1198
1385
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1199
1386
|
|
|
1200
1387
|
/***/ }),
|
|
1201
1388
|
|
|
1202
|
-
/***/
|
|
1389
|
+
/***/ 42:
|
|
1203
1390
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1204
1391
|
|
|
1205
1392
|
"use strict";
|
|
1206
1393
|
|
|
1207
1394
|
|
|
1208
1395
|
var _classCallCheck = __webpack_require__(9);
|
|
1396
|
+
|
|
1209
1397
|
Object.defineProperty(exports, "__esModule", {
|
|
1210
1398
|
value: true
|
|
1211
1399
|
});
|
|
1212
1400
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1213
1401
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1402
|
+
|
|
1214
1403
|
var T = __webpack_require__(0);
|
|
1404
|
+
|
|
1215
1405
|
var lodash_1 = __webpack_require__(3);
|
|
1216
|
-
|
|
1217
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1406
|
+
|
|
1407
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1408
|
+
|
|
1409
|
+
|
|
1218
1410
|
exports.INITIAL_WIDTH = 250;
|
|
1219
1411
|
exports.INITIAL_HEIGHT = 250;
|
|
1220
1412
|
/**
|
|
1221
1413
|
* A Splunk visualization
|
|
1222
1414
|
*/
|
|
1415
|
+
|
|
1223
1416
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1224
1417
|
_classCallCheck(this, SplunkVisualization);
|
|
1225
1418
|
};
|
|
1419
|
+
|
|
1226
1420
|
SplunkVisualization.propTypes = {
|
|
1227
1421
|
/**
|
|
1228
1422
|
* display mode
|
|
1229
1423
|
*/
|
|
1230
1424
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1425
|
+
|
|
1231
1426
|
/**
|
|
1232
1427
|
* width in pixel or string, defaults to 100%
|
|
1233
1428
|
*/
|
|
1234
1429
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1430
|
+
|
|
1235
1431
|
/**
|
|
1236
1432
|
* height in pixel or string
|
|
1237
1433
|
*/
|
|
1238
1434
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1435
|
+
|
|
1239
1436
|
/**
|
|
1240
1437
|
* visualization context used for dynamic option evaluation
|
|
1241
1438
|
*/
|
|
1242
1439
|
context: T.object,
|
|
1440
|
+
|
|
1243
1441
|
/**
|
|
1244
1442
|
* visualization formatting options
|
|
1245
1443
|
*/
|
|
1246
1444
|
options: T.object,
|
|
1445
|
+
|
|
1247
1446
|
/**
|
|
1248
1447
|
* A callback to update formatting options
|
|
1249
1448
|
*/
|
|
1250
1449
|
onOptionsChange: T.func,
|
|
1450
|
+
|
|
1251
1451
|
/**
|
|
1252
1452
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1253
1453
|
*/
|
|
@@ -1256,6 +1456,7 @@ SplunkVisualization.propTypes = {
|
|
|
1256
1456
|
* current request params
|
|
1257
1457
|
*/
|
|
1258
1458
|
requestParams: T.object,
|
|
1459
|
+
|
|
1259
1460
|
/**
|
|
1260
1461
|
* current dataset
|
|
1261
1462
|
*/
|
|
@@ -1263,6 +1464,7 @@ SplunkVisualization.propTypes = {
|
|
|
1263
1464
|
fields: T.array,
|
|
1264
1465
|
columns: T.array
|
|
1265
1466
|
}),
|
|
1467
|
+
|
|
1266
1468
|
/**
|
|
1267
1469
|
* error
|
|
1268
1470
|
*/
|
|
@@ -1270,29 +1472,35 @@ SplunkVisualization.propTypes = {
|
|
|
1270
1472
|
level: T.string,
|
|
1271
1473
|
message: T.string
|
|
1272
1474
|
}),
|
|
1475
|
+
|
|
1273
1476
|
/**
|
|
1274
1477
|
* meta data that came with the dataset
|
|
1275
1478
|
*/
|
|
1276
1479
|
meta: T.object
|
|
1277
1480
|
})),
|
|
1481
|
+
|
|
1278
1482
|
/**
|
|
1279
1483
|
* A callback to trigger event
|
|
1280
1484
|
*/
|
|
1281
1485
|
onEventTrigger: T.func,
|
|
1486
|
+
|
|
1282
1487
|
/**
|
|
1283
1488
|
* Inform viz if there are handlers listening to events
|
|
1284
1489
|
*/
|
|
1285
1490
|
hasEventHandlers: T.bool,
|
|
1491
|
+
|
|
1286
1492
|
/**
|
|
1287
1493
|
* A callback to communicate computed props to a consumer
|
|
1288
1494
|
*/
|
|
1289
1495
|
onComputedProps: T.func,
|
|
1496
|
+
|
|
1290
1497
|
/**
|
|
1291
1498
|
* A callback to obtain visualization api
|
|
1292
1499
|
*/
|
|
1293
1500
|
vizActionHandlerRef: T.func,
|
|
1294
1501
|
loading: T.bool,
|
|
1295
1502
|
theme: T.object,
|
|
1503
|
+
|
|
1296
1504
|
/**
|
|
1297
1505
|
* A callback to request new data with updated request params
|
|
1298
1506
|
*/
|
|
@@ -1301,6 +1509,7 @@ SplunkVisualization.propTypes = {
|
|
|
1301
1509
|
/**
|
|
1302
1510
|
*
|
|
1303
1511
|
*/
|
|
1512
|
+
|
|
1304
1513
|
SplunkVisualization.defaultProps = {
|
|
1305
1514
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1306
1515
|
width: '100%',
|
|
@@ -1329,26 +1538,29 @@ exports.default = SplunkVisualization;
|
|
|
1329
1538
|
|
|
1330
1539
|
/***/ }),
|
|
1331
1540
|
|
|
1332
|
-
/***/
|
|
1541
|
+
/***/ 43:
|
|
1333
1542
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1334
1543
|
|
|
1335
1544
|
"use strict";
|
|
1336
1545
|
|
|
1337
1546
|
|
|
1338
1547
|
var _classCallCheck = __webpack_require__(9);
|
|
1548
|
+
|
|
1339
1549
|
var _createClass = __webpack_require__(18);
|
|
1550
|
+
|
|
1340
1551
|
Object.defineProperty(exports, "__esModule", {
|
|
1341
1552
|
value: true
|
|
1342
1553
|
});
|
|
1343
1554
|
exports.DefaultVizActionHandler = void 0;
|
|
1555
|
+
|
|
1344
1556
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1345
1557
|
function DefaultVizActionHandler() {
|
|
1346
1558
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1347
1559
|
}
|
|
1560
|
+
|
|
1348
1561
|
_createClass(DefaultVizActionHandler, [{
|
|
1349
1562
|
key: "focus",
|
|
1350
|
-
value: function focus() {
|
|
1351
|
-
// noop
|
|
1563
|
+
value: function focus() {// noop
|
|
1352
1564
|
}
|
|
1353
1565
|
}, {
|
|
1354
1566
|
key: "snapshot",
|
|
@@ -1356,13 +1568,15 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1356
1568
|
return null; // noop
|
|
1357
1569
|
}
|
|
1358
1570
|
}]);
|
|
1571
|
+
|
|
1359
1572
|
return DefaultVizActionHandler;
|
|
1360
1573
|
}();
|
|
1574
|
+
|
|
1361
1575
|
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1362
1576
|
|
|
1363
1577
|
/***/ }),
|
|
1364
1578
|
|
|
1365
|
-
/***/
|
|
1579
|
+
/***/ 44:
|
|
1366
1580
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1367
1581
|
|
|
1368
1582
|
"use strict";
|
|
@@ -1371,12 +1585,44 @@ exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
|
1371
1585
|
Object.defineProperty(exports, "__esModule", {
|
|
1372
1586
|
value: true
|
|
1373
1587
|
});
|
|
1374
|
-
exports.
|
|
1375
|
-
|
|
1588
|
+
exports.useDeepMemo = void 0;
|
|
1589
|
+
|
|
1590
|
+
var react_1 = __webpack_require__(1);
|
|
1591
|
+
|
|
1592
|
+
var lodash_1 = __webpack_require__(3);
|
|
1593
|
+
/**
|
|
1594
|
+
* This hook evaluates and stores the result of a passed function and only
|
|
1595
|
+
* re-evaluates the function when passed dependencies change.
|
|
1596
|
+
*
|
|
1597
|
+
* It is different from the internal React useMemo in the following aspects:
|
|
1598
|
+
* - it only stores the last evaluated result
|
|
1599
|
+
* - it uses a deep equality check to determine if dependencies have changed
|
|
1600
|
+
*
|
|
1601
|
+
* Inspired by apollo-client's useDeepMemo
|
|
1602
|
+
*
|
|
1603
|
+
* @param fn the function to be executed and
|
|
1604
|
+
* @param dependencies an array of dependencies
|
|
1605
|
+
*/
|
|
1606
|
+
|
|
1607
|
+
|
|
1608
|
+
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1609
|
+
var ref = (0, react_1.useRef)();
|
|
1610
|
+
|
|
1611
|
+
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1612
|
+
ref.current = {
|
|
1613
|
+
dependencies: dependencies,
|
|
1614
|
+
value: fn()
|
|
1615
|
+
};
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
return ref.current.value;
|
|
1619
|
+
};
|
|
1620
|
+
|
|
1621
|
+
exports.useDeepMemo = useDeepMemo;
|
|
1376
1622
|
|
|
1377
1623
|
/***/ }),
|
|
1378
1624
|
|
|
1379
|
-
/***/
|
|
1625
|
+
/***/ 440:
|
|
1380
1626
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1381
1627
|
|
|
1382
1628
|
"use strict";
|
|
@@ -1384,27 +1630,38 @@ exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
|
1384
1630
|
|
|
1385
1631
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1386
1632
|
if (k2 === undefined) k2 = k;
|
|
1387
|
-
Object.
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1633
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1634
|
+
|
|
1635
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1636
|
+
desc = {
|
|
1637
|
+
enumerable: true,
|
|
1638
|
+
get: function get() {
|
|
1639
|
+
return m[k];
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
Object.defineProperty(o, k2, desc);
|
|
1393
1645
|
} : function (o, m, k, k2) {
|
|
1394
1646
|
if (k2 === undefined) k2 = k;
|
|
1395
1647
|
o[k2] = m[k];
|
|
1396
1648
|
});
|
|
1649
|
+
|
|
1397
1650
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1398
1651
|
for (var p in m) {
|
|
1399
1652
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1400
1653
|
}
|
|
1401
1654
|
};
|
|
1655
|
+
|
|
1402
1656
|
Object.defineProperty(exports, "__esModule", {
|
|
1403
1657
|
value: true
|
|
1404
1658
|
});
|
|
1405
1659
|
exports.default = void 0;
|
|
1406
|
-
|
|
1407
|
-
|
|
1660
|
+
|
|
1661
|
+
__exportStar(__webpack_require__(164), exports);
|
|
1662
|
+
|
|
1663
|
+
var Pie_1 = __webpack_require__(164);
|
|
1664
|
+
|
|
1408
1665
|
Object.defineProperty(exports, "default", {
|
|
1409
1666
|
enumerable: true,
|
|
1410
1667
|
get: function get() {
|
|
@@ -1414,7 +1671,7 @@ Object.defineProperty(exports, "default", {
|
|
|
1414
1671
|
|
|
1415
1672
|
/***/ }),
|
|
1416
1673
|
|
|
1417
|
-
/***/
|
|
1674
|
+
/***/ 441:
|
|
1418
1675
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1419
1676
|
|
|
1420
1677
|
"use strict";
|
|
@@ -1423,24 +1680,35 @@ Object.defineProperty(exports, "default", {
|
|
|
1423
1680
|
Object.defineProperty(exports, "__esModule", {
|
|
1424
1681
|
value: true
|
|
1425
1682
|
});
|
|
1426
|
-
|
|
1427
|
-
var
|
|
1683
|
+
|
|
1684
|
+
var ChartPie_1 = __webpack_require__(442);
|
|
1685
|
+
|
|
1686
|
+
var placeholders_1 = __webpack_require__(50);
|
|
1687
|
+
|
|
1428
1688
|
var i18n_1 = __webpack_require__(2);
|
|
1689
|
+
|
|
1429
1690
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1691
|
+
|
|
1430
1692
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
1693
|
+
|
|
1431
1694
|
var pick_1 = __webpack_require__(23);
|
|
1695
|
+
|
|
1432
1696
|
var variables_1 = __webpack_require__(11);
|
|
1697
|
+
|
|
1433
1698
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1434
|
-
|
|
1699
|
+
|
|
1700
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
1701
|
+
|
|
1435
1702
|
var configUtils_1 = __webpack_require__(20);
|
|
1703
|
+
|
|
1436
1704
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
1705
|
+
|
|
1437
1706
|
var dataContract = {
|
|
1438
1707
|
requiredDataSources: [{
|
|
1439
1708
|
name: 'primary',
|
|
1440
1709
|
description: 'DataSource that powers the visualization'
|
|
1441
1710
|
}],
|
|
1442
|
-
optionalDataSources: [
|
|
1443
|
-
// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1711
|
+
optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1444
1712
|
// {
|
|
1445
1713
|
// name: 'annotation',
|
|
1446
1714
|
// description: 'DataSource that populate event annotations',
|
|
@@ -1491,7 +1759,7 @@ var optionsSchema = {
|
|
|
1491
1759
|
labelDisplay: {
|
|
1492
1760
|
description: 'Specify whether to display the labels and/or slice percentages.',
|
|
1493
1761
|
type: 'string',
|
|
1494
|
-
pattern: schemaUtils_1.getPattern(['values', 'valuesAndPercentage', 'off']),
|
|
1762
|
+
pattern: (0, schemaUtils_1.getPattern)(['values', 'valuesAndPercentage', 'off']),
|
|
1495
1763
|
default: 'values'
|
|
1496
1764
|
},
|
|
1497
1765
|
resultLimit: {
|
|
@@ -1532,7 +1800,7 @@ var optionsSchema = {
|
|
|
1532
1800
|
};
|
|
1533
1801
|
var themes = {
|
|
1534
1802
|
defaultBackgroundColor: function defaultBackgroundColor(props) {
|
|
1535
|
-
return pick_1.default({
|
|
1803
|
+
return (0, pick_1.default)({
|
|
1536
1804
|
enterprise: {
|
|
1537
1805
|
dark: variables_1.default.black(props),
|
|
1538
1806
|
light: variables_1.default.backgroundColor(props)
|
|
@@ -1542,9 +1810,9 @@ var themes = {
|
|
|
1542
1810
|
}
|
|
1543
1811
|
};
|
|
1544
1812
|
var editorConfig = [{
|
|
1545
|
-
label: i18n_1._('Data configurations'),
|
|
1813
|
+
label: (0, i18n_1._)('Data configurations'),
|
|
1546
1814
|
layout: [[{
|
|
1547
|
-
label: i18n_1._('Label'),
|
|
1815
|
+
label: (0, i18n_1._)('Label'),
|
|
1548
1816
|
editor: 'editor.columnSelector',
|
|
1549
1817
|
option: 'label',
|
|
1550
1818
|
context: 'valuesContext',
|
|
@@ -1552,7 +1820,7 @@ var editorConfig = [{
|
|
|
1552
1820
|
dataSourceKey: 'primary'
|
|
1553
1821
|
}
|
|
1554
1822
|
}], [{
|
|
1555
|
-
label: i18n_1._('Value'),
|
|
1823
|
+
label: (0, i18n_1._)('Value'),
|
|
1556
1824
|
editor: 'editor.columnSelector',
|
|
1557
1825
|
option: 'value',
|
|
1558
1826
|
context: 'valuesContext',
|
|
@@ -1561,38 +1829,38 @@ var editorConfig = [{
|
|
|
1561
1829
|
}
|
|
1562
1830
|
}]]
|
|
1563
1831
|
}, {
|
|
1564
|
-
label: i18n_1._('Data display'),
|
|
1832
|
+
label: (0, i18n_1._)('Data display'),
|
|
1565
1833
|
layout: [[{
|
|
1566
|
-
label: i18n_1._('Display type'),
|
|
1834
|
+
label: (0, i18n_1._)('Display type'),
|
|
1567
1835
|
option: 'showDonutHole',
|
|
1568
1836
|
editor: 'editor.radioBar',
|
|
1569
1837
|
editorProps: {
|
|
1570
1838
|
values: [{
|
|
1571
|
-
label: i18n_1._('Pie'),
|
|
1839
|
+
label: (0, i18n_1._)('Pie'),
|
|
1572
1840
|
value: false
|
|
1573
1841
|
}, {
|
|
1574
|
-
label: i18n_1._('Donut'),
|
|
1842
|
+
label: (0, i18n_1._)('Donut'),
|
|
1575
1843
|
value: true
|
|
1576
1844
|
}]
|
|
1577
1845
|
}
|
|
1578
1846
|
}], [{
|
|
1579
|
-
label: i18n_1._('Label display'),
|
|
1847
|
+
label: (0, i18n_1._)('Label display'),
|
|
1580
1848
|
option: 'labelDisplay',
|
|
1581
1849
|
editor: 'editor.select',
|
|
1582
1850
|
editorProps: {
|
|
1583
1851
|
values: [{
|
|
1584
|
-
label: i18n_1._('Values'),
|
|
1852
|
+
label: (0, i18n_1._)('Values'),
|
|
1585
1853
|
value: 'values'
|
|
1586
1854
|
}, {
|
|
1587
|
-
label: i18n_1._('Values & Percent'),
|
|
1855
|
+
label: (0, i18n_1._)('Values & Percent'),
|
|
1588
1856
|
value: 'valuesAndPercentage'
|
|
1589
1857
|
}, {
|
|
1590
|
-
label: i18n_1._('Off'),
|
|
1858
|
+
label: (0, i18n_1._)('Off'),
|
|
1591
1859
|
value: 'off'
|
|
1592
1860
|
}]
|
|
1593
1861
|
}
|
|
1594
1862
|
}], [{
|
|
1595
|
-
label: i18n_1._('Collapse threshold'),
|
|
1863
|
+
label: (0, i18n_1._)('Collapse threshold'),
|
|
1596
1864
|
option: 'collapseThreshold',
|
|
1597
1865
|
editor: 'editor.number',
|
|
1598
1866
|
editorProps: {
|
|
@@ -1601,102 +1869,66 @@ var editorConfig = [{
|
|
|
1601
1869
|
step: 0.01
|
|
1602
1870
|
}
|
|
1603
1871
|
}], [{
|
|
1604
|
-
label: i18n_1._('Collapsed slice label'),
|
|
1872
|
+
label: (0, i18n_1._)('Collapsed slice label'),
|
|
1605
1873
|
option: 'collapseLabel',
|
|
1606
1874
|
editor: 'editor.text'
|
|
1607
1875
|
}]]
|
|
1608
1876
|
}, {
|
|
1609
|
-
label: i18n_1._('Color and style'),
|
|
1877
|
+
label: (0, i18n_1._)('Color and style'),
|
|
1610
1878
|
layout: [[{
|
|
1611
|
-
label: i18n_1._('Series colors'),
|
|
1879
|
+
label: (0, i18n_1._)('Series colors'),
|
|
1612
1880
|
option: 'seriesColors',
|
|
1613
1881
|
editor: 'editor.seriesColors'
|
|
1614
|
-
}], BackgroundColor_1.default({
|
|
1882
|
+
}], (0, BackgroundColor_1.default)({
|
|
1615
1883
|
themes: themes
|
|
1616
1884
|
})]
|
|
1617
1885
|
}];
|
|
1618
1886
|
/**
|
|
1619
1887
|
* visualization configuration
|
|
1620
1888
|
*/
|
|
1889
|
+
|
|
1621
1890
|
var config = {
|
|
1622
1891
|
/**
|
|
1623
1892
|
* unique viz key
|
|
1624
1893
|
*/
|
|
1625
1894
|
key: 'splunk.pie',
|
|
1895
|
+
|
|
1626
1896
|
/**
|
|
1627
1897
|
* viz name
|
|
1628
1898
|
*/
|
|
1629
|
-
name: i18n_1._('Pie'),
|
|
1899
|
+
name: (0, i18n_1._)('Pie'),
|
|
1630
1900
|
category: VizCategory_1.VizCategory.COMPARISONS,
|
|
1631
|
-
/**
|
|
1632
|
-
* viz icon
|
|
1633
|
-
*/
|
|
1634
|
-
icon: ChartPie_1.default,
|
|
1635
|
-
placeholderIcon: placeholders_1.Pie,
|
|
1636
|
-
dataContract: dataContract,
|
|
1637
|
-
size: size,
|
|
1638
|
-
defaultContext: defaultContext,
|
|
1639
|
-
optionsSchema: optionsSchema,
|
|
1640
|
-
editorConfig: editorConfig,
|
|
1641
|
-
events: {
|
|
1642
|
-
'point.click': {
|
|
1643
|
-
description: 'triggered when user clicks on a point in the pie chart'
|
|
1644
|
-
}
|
|
1645
|
-
},
|
|
1646
|
-
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
|
|
1647
|
-
themes: themes
|
|
1648
|
-
};
|
|
1649
|
-
exports.default = configUtils_1.enhanceConfig(config);
|
|
1650
|
-
|
|
1651
|
-
/***/ }),
|
|
1652
1901
|
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
var react_1 = __webpack_require__(1);
|
|
1671
|
-
var lodash_1 = __webpack_require__(3);
|
|
1672
|
-
/**
|
|
1673
|
-
* This hook evaluates and stores the result of a passed function and only
|
|
1674
|
-
* re-evaluates the function when passed dependencies change.
|
|
1675
|
-
*
|
|
1676
|
-
* It is different from the internal React useMemo in the following aspects:
|
|
1677
|
-
* - it only stores the last evaluated result
|
|
1678
|
-
* - it uses a deep equality check to determine if dependencies have changed
|
|
1679
|
-
*
|
|
1680
|
-
* Inspired by apollo-client's useDeepMemo
|
|
1681
|
-
*
|
|
1682
|
-
* @param fn the function to be executed and
|
|
1683
|
-
* @param dependencies an array of dependencies
|
|
1684
|
-
*/
|
|
1685
|
-
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1686
|
-
var ref = react_1.useRef();
|
|
1687
|
-
if (!ref.current || !lodash_1.isEqual(dependencies, ref.current.dependencies)) {
|
|
1688
|
-
ref.current = {
|
|
1689
|
-
dependencies: dependencies,
|
|
1690
|
-
value: fn()
|
|
1691
|
-
};
|
|
1692
|
-
}
|
|
1693
|
-
return ref.current.value;
|
|
1902
|
+
/**
|
|
1903
|
+
* viz icon
|
|
1904
|
+
*/
|
|
1905
|
+
icon: ChartPie_1.default,
|
|
1906
|
+
placeholderIcon: placeholders_1.Pie,
|
|
1907
|
+
dataContract: dataContract,
|
|
1908
|
+
size: size,
|
|
1909
|
+
defaultContext: defaultContext,
|
|
1910
|
+
optionsSchema: optionsSchema,
|
|
1911
|
+
editorConfig: editorConfig,
|
|
1912
|
+
events: {
|
|
1913
|
+
'point.click': {
|
|
1914
|
+
description: 'triggered when user clicks on a point in the pie chart'
|
|
1915
|
+
}
|
|
1916
|
+
},
|
|
1917
|
+
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER, VizBehavior_1.VizBehavior.EVENTS],
|
|
1918
|
+
themes: themes
|
|
1694
1919
|
};
|
|
1695
|
-
exports.
|
|
1920
|
+
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
1696
1921
|
|
|
1697
1922
|
/***/ }),
|
|
1698
1923
|
|
|
1699
|
-
/***/
|
|
1924
|
+
/***/ 442:
|
|
1925
|
+
/***/ (function(module, exports) {
|
|
1926
|
+
|
|
1927
|
+
module.exports = require("@splunk/react-icons/enterprise/ChartPie");
|
|
1928
|
+
|
|
1929
|
+
/***/ }),
|
|
1930
|
+
|
|
1931
|
+
/***/ 443:
|
|
1700
1932
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1701
1933
|
|
|
1702
1934
|
"use strict";
|
|
@@ -1704,25 +1936,34 @@ exports.useDeepMemo = useDeepMemo;
|
|
|
1704
1936
|
|
|
1705
1937
|
var __rest = this && this.__rest || function (s, e) {
|
|
1706
1938
|
var t = {};
|
|
1939
|
+
|
|
1707
1940
|
for (var p in s) {
|
|
1708
1941
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1709
1942
|
}
|
|
1943
|
+
|
|
1710
1944
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1711
1945
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1712
1946
|
}
|
|
1713
1947
|
return t;
|
|
1714
1948
|
};
|
|
1949
|
+
|
|
1715
1950
|
Object.defineProperty(exports, "__esModule", {
|
|
1716
1951
|
value: true
|
|
1717
1952
|
});
|
|
1718
1953
|
exports.allInvalidDataValues = exports.invalidOptionField = exports.getPieOptionFieldIndex = exports.getPieMergedOptions = exports.convertToPieSCProperties = exports.mapToOldKey = exports.mapLabelDisplay = exports.convertToStringValues = void 0;
|
|
1954
|
+
|
|
1719
1955
|
var lodash_1 = __webpack_require__(3);
|
|
1720
|
-
|
|
1721
|
-
var
|
|
1722
|
-
|
|
1723
|
-
var
|
|
1724
|
-
|
|
1956
|
+
|
|
1957
|
+
var propUtils_1 = __webpack_require__(29);
|
|
1958
|
+
|
|
1959
|
+
var dsl_1 = __webpack_require__(133);
|
|
1960
|
+
|
|
1961
|
+
var hocUtils_1 = __webpack_require__(27);
|
|
1962
|
+
|
|
1963
|
+
var JSONSchemaUtils_1 = __webpack_require__(28); // CONVERT THIS TO PIE THEN ADD TO Pie.TSX
|
|
1725
1964
|
// map for key names which are either new or not present in SimpleXML options mapping
|
|
1965
|
+
|
|
1966
|
+
|
|
1726
1967
|
var pieOptionsSCMapping = {
|
|
1727
1968
|
resultLimit: 'resultTruncationLimit',
|
|
1728
1969
|
seriesColorsByField: 'fieldColors',
|
|
@@ -1736,13 +1977,15 @@ var pieOptionsSCMapping = {
|
|
|
1736
1977
|
* @param {Object} options
|
|
1737
1978
|
* @returns {Object}
|
|
1738
1979
|
*/
|
|
1980
|
+
|
|
1739
1981
|
var convertToStringValues = function convertToStringValues(options) {
|
|
1740
|
-
var updatedOptions = propUtils_1.convertPropsToString({
|
|
1982
|
+
var updatedOptions = (0, propUtils_1.convertPropsToString)({
|
|
1741
1983
|
vizProps: options,
|
|
1742
1984
|
propNames: ['seriesColors', 'fieldColors']
|
|
1743
1985
|
});
|
|
1744
1986
|
return Object.assign(Object.assign({}, options), updatedOptions);
|
|
1745
1987
|
};
|
|
1988
|
+
|
|
1746
1989
|
exports.convertToStringValues = convertToStringValues;
|
|
1747
1990
|
/**
|
|
1748
1991
|
* Helper method to map labelDisplay options to jsCharting options
|
|
@@ -1750,21 +1993,26 @@ exports.convertToStringValues = convertToStringValues;
|
|
|
1750
1993
|
* @param {Object} options
|
|
1751
1994
|
* @returns {Object}
|
|
1752
1995
|
*/
|
|
1996
|
+
|
|
1753
1997
|
var mapLabelDisplay = function mapLabelDisplay(_a) {
|
|
1754
1998
|
var labelDisplay = _a.labelDisplay,
|
|
1755
|
-
|
|
1999
|
+
options = __rest(_a, ["labelDisplay"]);
|
|
2000
|
+
|
|
1756
2001
|
var convertedOptions = Object.assign(Object.assign({}, options), {
|
|
1757
2002
|
// default for labelDisplay option is 'values'
|
|
1758
2003
|
'chart.showLabels': true,
|
|
1759
2004
|
'chart.showPercent': false
|
|
1760
2005
|
});
|
|
2006
|
+
|
|
1761
2007
|
if (labelDisplay === 'valuesAndPercentage') {
|
|
1762
2008
|
convertedOptions['chart.showPercent'] = true;
|
|
1763
2009
|
} else if (labelDisplay === 'off') {
|
|
1764
2010
|
convertedOptions['chart.showLabels'] = false;
|
|
1765
2011
|
}
|
|
2012
|
+
|
|
1766
2013
|
return convertedOptions;
|
|
1767
2014
|
};
|
|
2015
|
+
|
|
1768
2016
|
exports.mapLabelDisplay = mapLabelDisplay;
|
|
1769
2017
|
/**
|
|
1770
2018
|
* Helper method to update the option names which can be mapped to SimpleXML options or
|
|
@@ -1773,11 +2021,13 @@ exports.mapLabelDisplay = mapLabelDisplay;
|
|
|
1773
2021
|
* @param {Object} options
|
|
1774
2022
|
* @returns {Object}
|
|
1775
2023
|
*/
|
|
2024
|
+
|
|
1776
2025
|
var mapToOldKey = function mapToOldKey(options) {
|
|
1777
|
-
return lodash_1.mapKeys(options, function (val, key) {
|
|
2026
|
+
return (0, lodash_1.mapKeys)(options, function (val, key) {
|
|
1778
2027
|
return pieOptionsSCMapping[key] ? pieOptionsSCMapping[key] : key;
|
|
1779
2028
|
});
|
|
1780
2029
|
};
|
|
2030
|
+
|
|
1781
2031
|
exports.mapToOldKey = mapToOldKey;
|
|
1782
2032
|
/**
|
|
1783
2033
|
* Chained helper for mapping the option properties (and values) we expose in config.ts into property values that splunk-charting accepts
|
|
@@ -1787,9 +2037,11 @@ exports.mapToOldKey = mapToOldKey;
|
|
|
1787
2037
|
* @param {Object} originalOptions
|
|
1788
2038
|
* @returns {Object}
|
|
1789
2039
|
*/
|
|
2040
|
+
|
|
1790
2041
|
var convertToPieSCProperties = function convertToPieSCProperties(originalOptions) {
|
|
1791
|
-
return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
|
|
2042
|
+
return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru(exports.convertToStringValues).thru(exports.mapLabelDisplay).value();
|
|
1792
2043
|
};
|
|
2044
|
+
|
|
1793
2045
|
exports.convertToPieSCProperties = convertToPieSCProperties;
|
|
1794
2046
|
/**
|
|
1795
2047
|
* Return all merged options (default + config) using vizConfig and options
|
|
@@ -1797,9 +2049,11 @@ exports.convertToPieSCProperties = convertToPieSCProperties;
|
|
|
1797
2049
|
* @param vizConfig
|
|
1798
2050
|
* @returns
|
|
1799
2051
|
*/
|
|
2052
|
+
|
|
1800
2053
|
var getPieMergedOptions = function getPieMergedOptions(options, vizConfig) {
|
|
1801
|
-
return hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default'));
|
|
2054
|
+
return (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default'));
|
|
1802
2055
|
};
|
|
2056
|
+
|
|
1803
2057
|
exports.getPieMergedOptions = getPieMergedOptions;
|
|
1804
2058
|
/**
|
|
1805
2059
|
* Returns option's field index. If not found returns -1
|
|
@@ -1809,16 +2063,19 @@ exports.getPieMergedOptions = getPieMergedOptions;
|
|
|
1809
2063
|
* @param vizConfig
|
|
1810
2064
|
* @returns
|
|
1811
2065
|
*/
|
|
2066
|
+
|
|
1812
2067
|
var getPieOptionFieldIndex = function getPieOptionFieldIndex(optionName, dataSources, options, vizConfig) {
|
|
1813
|
-
var mergedOptions = exports.getPieMergedOptions(options, vizConfig);
|
|
1814
|
-
|
|
1815
|
-
var fieldName = dsl_1.getFieldsFromDSL(mergedOptions[optionName], dataSources)[0];
|
|
2068
|
+
var mergedOptions = (0, exports.getPieMergedOptions)(options, vizConfig); // find the field name configured for pie "value"
|
|
2069
|
+
|
|
2070
|
+
var fieldName = (0, dsl_1.getFieldsFromDSL)(mergedOptions[optionName], dataSources)[0];
|
|
1816
2071
|
var fields = dataSources.primary.data.fields; // find the field index configured for pie "value"
|
|
2072
|
+
|
|
1817
2073
|
var fieldIndex = fields.findIndex(function (field) {
|
|
1818
2074
|
return (typeof field === 'string' ? field : field.name.toString()) === fieldName;
|
|
1819
2075
|
});
|
|
1820
2076
|
return fieldIndex;
|
|
1821
2077
|
};
|
|
2078
|
+
|
|
1822
2079
|
exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
|
|
1823
2080
|
/**
|
|
1824
2081
|
* Returns true if columns data has invalid data format for specified option (label or value)
|
|
@@ -1828,29 +2085,37 @@ exports.getPieOptionFieldIndex = getPieOptionFieldIndex;
|
|
|
1828
2085
|
* @param vizConfig
|
|
1829
2086
|
* @returns
|
|
1830
2087
|
*/
|
|
2088
|
+
|
|
1831
2089
|
var invalidOptionField = function invalidOptionField(optionName, dataSources, options, vizConfig) {
|
|
1832
2090
|
var columns = dataSources.primary.data.columns;
|
|
1833
|
-
var fieldIndex = exports.getPieOptionFieldIndex(optionName, dataSources, options, vizConfig);
|
|
2091
|
+
var fieldIndex = (0, exports.getPieOptionFieldIndex)(optionName, dataSources, options, vizConfig);
|
|
2092
|
+
|
|
1834
2093
|
if (fieldIndex === -1 || !columns[fieldIndex] || !Array.isArray(columns[fieldIndex]) || Array.isArray(columns[fieldIndex]) && !columns[fieldIndex].length) {
|
|
1835
2094
|
return true;
|
|
1836
2095
|
}
|
|
2096
|
+
|
|
1837
2097
|
return false;
|
|
1838
2098
|
};
|
|
2099
|
+
|
|
1839
2100
|
exports.invalidOptionField = invalidOptionField;
|
|
1840
2101
|
/**
|
|
1841
2102
|
* Helper function to evaluate if all data values are invalid (zero or negative)
|
|
1842
2103
|
*/
|
|
2104
|
+
|
|
1843
2105
|
var allInvalidDataValues = function allInvalidDataValues(dataSources, options, vizConfig) {
|
|
1844
2106
|
var columns = dataSources.primary.data.columns; // find the field index configured for pie "value"
|
|
1845
|
-
|
|
1846
|
-
// check if all values are invalid
|
|
2107
|
+
|
|
2108
|
+
var valueFieldIndex = (0, exports.getPieOptionFieldIndex)('value', dataSources, options, vizConfig); // check if all values are invalid
|
|
2109
|
+
|
|
1847
2110
|
if (Array.isArray(columns) && columns[valueFieldIndex] && Array.isArray(columns[valueFieldIndex])) {
|
|
1848
2111
|
return !columns[valueFieldIndex].some(function (value) {
|
|
1849
2112
|
return +value > 0;
|
|
1850
2113
|
});
|
|
1851
2114
|
}
|
|
2115
|
+
|
|
1852
2116
|
return false;
|
|
1853
2117
|
};
|
|
2118
|
+
|
|
1854
2119
|
exports.allInvalidDataValues = allInvalidDataValues;
|
|
1855
2120
|
|
|
1856
2121
|
/***/ }),
|
|
@@ -1865,19 +2130,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1865
2130
|
value: true
|
|
1866
2131
|
});
|
|
1867
2132
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2133
|
+
|
|
1868
2134
|
var React = __webpack_require__(1);
|
|
2135
|
+
|
|
1869
2136
|
var T = __webpack_require__(0);
|
|
2137
|
+
|
|
1870
2138
|
var i18n_1 = __webpack_require__(2);
|
|
2139
|
+
|
|
1871
2140
|
var Message_1 = __webpack_require__(10);
|
|
2141
|
+
|
|
1872
2142
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1873
2143
|
/**
|
|
1874
2144
|
* @method isMissing
|
|
1875
2145
|
* @param {any} v
|
|
1876
2146
|
* @returns {boolean} true if the input value === null or undefined
|
|
1877
2147
|
*/
|
|
2148
|
+
|
|
2149
|
+
|
|
1878
2150
|
var isMissing = function isMissing(v) {
|
|
1879
2151
|
return v === null || v === undefined;
|
|
1880
2152
|
};
|
|
2153
|
+
|
|
1881
2154
|
exports.isMissing = isMissing;
|
|
1882
2155
|
/**
|
|
1883
2156
|
* @method misskingKeys
|
|
@@ -1885,11 +2158,13 @@ exports.isMissing = isMissing;
|
|
|
1885
2158
|
* @param {object} target
|
|
1886
2159
|
* @returns {string[]} the keys of missing required props
|
|
1887
2160
|
*/
|
|
2161
|
+
|
|
1888
2162
|
var missingKeys = function missingKeys(keys, target) {
|
|
1889
2163
|
return keys.filter(function (k) {
|
|
1890
|
-
return exports.isMissing(target[k]);
|
|
2164
|
+
return (0, exports.isMissing)(target[k]);
|
|
1891
2165
|
});
|
|
1892
2166
|
};
|
|
2167
|
+
|
|
1893
2168
|
exports.missingKeys = missingKeys;
|
|
1894
2169
|
var propTypes = {
|
|
1895
2170
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1903,24 +2178,26 @@ var propTypes = {
|
|
|
1903
2178
|
* @param {MissingPropsProps} props
|
|
1904
2179
|
* @returns {React.ReactElement}
|
|
1905
2180
|
*/
|
|
2181
|
+
|
|
1906
2182
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1907
2183
|
var width = props.width,
|
|
1908
|
-
|
|
1909
|
-
|
|
2184
|
+
height = props.height,
|
|
2185
|
+
missingProps = props.missingProps;
|
|
1910
2186
|
return React.createElement(Message_1.default, {
|
|
1911
2187
|
"data-test": "message",
|
|
1912
2188
|
width: width,
|
|
1913
2189
|
height: height,
|
|
1914
|
-
message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
|
|
2190
|
+
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1915
2191
|
});
|
|
1916
2192
|
};
|
|
2193
|
+
|
|
1917
2194
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1918
2195
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1919
2196
|
exports.MissingPropsMessage.defaultProps = {
|
|
1920
2197
|
width: '100%',
|
|
1921
2198
|
height: 250
|
|
1922
2199
|
};
|
|
1923
|
-
exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
2200
|
+
exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
|
|
1924
2201
|
|
|
1925
2202
|
/***/ }),
|
|
1926
2203
|
|
|
@@ -1933,15 +2210,19 @@ exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
|
1933
2210
|
Object.defineProperty(exports, "__esModule", {
|
|
1934
2211
|
value: true
|
|
1935
2212
|
});
|
|
2213
|
+
|
|
1936
2214
|
var React = __webpack_require__(1);
|
|
2215
|
+
|
|
1937
2216
|
var styled_components_1 = __webpack_require__(4);
|
|
2217
|
+
|
|
1938
2218
|
var hocUtils_1 = __webpack_require__(15);
|
|
2219
|
+
|
|
1939
2220
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1940
2221
|
displayName: "withEditModeCover__Cover",
|
|
1941
2222
|
componentId: "sc-1gsbnxb-0"
|
|
1942
2223
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1943
2224
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1944
|
-
'data-splunk-visualization-version': "
|
|
2225
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
1945
2226
|
}).withConfig({
|
|
1946
2227
|
displayName: "withEditModeCover__Blocker",
|
|
1947
2228
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1952,6 +2233,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1952
2233
|
* @param {ExtendedDashViz} Visualization
|
|
1953
2234
|
* @returns {ExtendedDashViz} Wrapper
|
|
1954
2235
|
*/
|
|
2236
|
+
|
|
1955
2237
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1956
2238
|
var Wrapper = function Wrapper(props) {
|
|
1957
2239
|
var mode = props.mode;
|
|
@@ -1960,12 +2242,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1960
2242
|
"data-test": "edit-mode-cover"
|
|
1961
2243
|
}));
|
|
1962
2244
|
};
|
|
1963
|
-
|
|
2245
|
+
|
|
2246
|
+
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1964
2247
|
Wrapper: Wrapper,
|
|
1965
2248
|
Visualization: Visualization
|
|
1966
2249
|
});
|
|
1967
2250
|
return Wrapper;
|
|
1968
2251
|
};
|
|
2252
|
+
|
|
1969
2253
|
exports.default = withEditModeCover;
|
|
1970
2254
|
|
|
1971
2255
|
/***/ }),
|
|
@@ -1979,27 +2263,37 @@ exports.default = withEditModeCover;
|
|
|
1979
2263
|
Object.defineProperty(exports, "__esModule", {
|
|
1980
2264
|
value: true
|
|
1981
2265
|
});
|
|
2266
|
+
|
|
1982
2267
|
var React = __webpack_require__(1);
|
|
2268
|
+
|
|
1983
2269
|
var colorUtils_1 = __webpack_require__(12);
|
|
2270
|
+
|
|
1984
2271
|
var variables_1 = __webpack_require__(11);
|
|
1985
|
-
|
|
2272
|
+
|
|
2273
|
+
var IconPlaceholder_1 = __webpack_require__(32);
|
|
2274
|
+
|
|
1986
2275
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2276
|
+
|
|
1987
2277
|
var hocUtils_1 = __webpack_require__(15);
|
|
2278
|
+
|
|
1988
2279
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1989
2280
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1990
2281
|
var config = Visualization.config;
|
|
1991
2282
|
var themes = config.themes;
|
|
2283
|
+
|
|
1992
2284
|
var Wrapper = function Wrapper(props) {
|
|
1993
2285
|
var _a, _b;
|
|
2286
|
+
|
|
1994
2287
|
var dataSources = props.dataSources,
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2288
|
+
loading = props.loading,
|
|
2289
|
+
options = props.options,
|
|
2290
|
+
height = props.height,
|
|
2291
|
+
width = props.width;
|
|
1999
2292
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
2000
|
-
var bgColorFromTheme = 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);
|
|
2293
|
+
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);
|
|
2001
2294
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
2002
2295
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
2296
|
+
|
|
2003
2297
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
2004
2298
|
return React.createElement(IconPlaceholder_1.default, {
|
|
2005
2299
|
"data-test": "icon-placeholder",
|
|
@@ -2010,19 +2304,22 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
2010
2304
|
iconColor: iconColor
|
|
2011
2305
|
});
|
|
2012
2306
|
}
|
|
2307
|
+
|
|
2013
2308
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
2014
2309
|
};
|
|
2015
|
-
|
|
2310
|
+
|
|
2311
|
+
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2016
2312
|
Wrapper: Wrapper,
|
|
2017
2313
|
Visualization: Visualization
|
|
2018
2314
|
});
|
|
2019
2315
|
return Wrapper;
|
|
2020
2316
|
};
|
|
2317
|
+
|
|
2021
2318
|
exports.default = withPlaceholder;
|
|
2022
2319
|
|
|
2023
2320
|
/***/ }),
|
|
2024
2321
|
|
|
2025
|
-
/***/
|
|
2322
|
+
/***/ 50:
|
|
2026
2323
|
/***/ (function(module, exports) {
|
|
2027
2324
|
|
|
2028
2325
|
module.exports = require("@splunk/visualization-icons/placeholders");
|
|
@@ -2045,13 +2342,15 @@ module.exports = require("@splunk/visualization-color-palettes");
|
|
|
2045
2342
|
Object.defineProperty(exports, "__esModule", {
|
|
2046
2343
|
value: true
|
|
2047
2344
|
});
|
|
2345
|
+
|
|
2048
2346
|
var i18n_1 = __webpack_require__(2);
|
|
2347
|
+
|
|
2049
2348
|
var background = function background(_ref) {
|
|
2050
2349
|
var label = _ref.label,
|
|
2051
|
-
|
|
2052
|
-
|
|
2350
|
+
themes = _ref.themes,
|
|
2351
|
+
labelPosition = _ref.labelPosition;
|
|
2053
2352
|
return [{
|
|
2054
|
-
label: i18n_1._(label || 'Background'),
|
|
2353
|
+
label: (0, i18n_1._)(label || 'Background'),
|
|
2055
2354
|
option: 'backgroundColor',
|
|
2056
2355
|
editor: 'editor.color',
|
|
2057
2356
|
editorProps: {
|
|
@@ -2060,31 +2359,44 @@ var background = function background(_ref) {
|
|
|
2060
2359
|
}
|
|
2061
2360
|
}];
|
|
2062
2361
|
};
|
|
2362
|
+
|
|
2063
2363
|
exports.default = background;
|
|
2064
2364
|
|
|
2065
2365
|
/***/ }),
|
|
2066
2366
|
|
|
2067
2367
|
/***/ 55:
|
|
2368
|
+
/***/ (function(module, exports) {
|
|
2369
|
+
|
|
2370
|
+
module.exports = require("@splunk/charting-bundle");
|
|
2371
|
+
|
|
2372
|
+
/***/ }),
|
|
2373
|
+
|
|
2374
|
+
/***/ 56:
|
|
2068
2375
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2069
2376
|
|
|
2070
2377
|
"use strict";
|
|
2071
2378
|
|
|
2072
2379
|
|
|
2073
2380
|
var _toConsumableArray = __webpack_require__(8);
|
|
2381
|
+
|
|
2074
2382
|
var __rest = this && this.__rest || function (s, e) {
|
|
2075
2383
|
var t = {};
|
|
2384
|
+
|
|
2076
2385
|
for (var p in s) {
|
|
2077
2386
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2078
2387
|
}
|
|
2388
|
+
|
|
2079
2389
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2080
2390
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2081
2391
|
}
|
|
2082
2392
|
return t;
|
|
2083
2393
|
};
|
|
2394
|
+
|
|
2084
2395
|
Object.defineProperty(exports, "__esModule", {
|
|
2085
2396
|
value: true
|
|
2086
2397
|
});
|
|
2087
2398
|
exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
|
|
2399
|
+
|
|
2088
2400
|
var lodash_1 = __webpack_require__(3);
|
|
2089
2401
|
/**
|
|
2090
2402
|
* Get formatted annotations
|
|
@@ -2095,10 +2407,12 @@ var lodash_1 = __webpack_require__(3);
|
|
|
2095
2407
|
* @param {Array} options.annotationLabel
|
|
2096
2408
|
* @returns {Array}
|
|
2097
2409
|
*/
|
|
2410
|
+
|
|
2411
|
+
|
|
2098
2412
|
var getAnnotations = function getAnnotations(_ref) {
|
|
2099
2413
|
var annotationX = _ref.annotationX,
|
|
2100
|
-
|
|
2101
|
-
|
|
2414
|
+
annotationColor = _ref.annotationColor,
|
|
2415
|
+
annotationLabel = _ref.annotationLabel;
|
|
2102
2416
|
return annotationX && annotationX.length ? annotationX.map(function (timestamp, i) {
|
|
2103
2417
|
return {
|
|
2104
2418
|
color: annotationColor && annotationColor[i],
|
|
@@ -2107,6 +2421,7 @@ var getAnnotations = function getAnnotations(_ref) {
|
|
|
2107
2421
|
};
|
|
2108
2422
|
}) : [];
|
|
2109
2423
|
};
|
|
2424
|
+
|
|
2110
2425
|
exports.getAnnotations = getAnnotations;
|
|
2111
2426
|
/**
|
|
2112
2427
|
* Truncate the result set to given limit
|
|
@@ -2115,20 +2430,25 @@ exports.getAnnotations = getAnnotations;
|
|
|
2115
2430
|
* @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']
|
|
2116
2431
|
* @returns {Object}
|
|
2117
2432
|
*/
|
|
2433
|
+
|
|
2118
2434
|
var truncateData = function truncateData(dataSet, truncationLimit) {
|
|
2119
2435
|
if (!dataSet) {
|
|
2120
2436
|
return null;
|
|
2121
2437
|
}
|
|
2438
|
+
|
|
2122
2439
|
var limit = parseInt(truncationLimit, 10);
|
|
2440
|
+
|
|
2123
2441
|
if (!limit || limit <= 0) {
|
|
2124
2442
|
return dataSet;
|
|
2125
2443
|
}
|
|
2444
|
+
|
|
2126
2445
|
var truncatedData = Object.assign({}, dataSet);
|
|
2127
2446
|
truncatedData.columns = truncatedData.columns.map(function (columnData) {
|
|
2128
2447
|
return columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData;
|
|
2129
2448
|
});
|
|
2130
2449
|
return truncatedData;
|
|
2131
2450
|
};
|
|
2451
|
+
|
|
2132
2452
|
exports.truncateData = truncateData;
|
|
2133
2453
|
/**
|
|
2134
2454
|
* Helper method to update the option values into the values that SC accepts
|
|
@@ -2136,13 +2456,15 @@ exports.truncateData = truncateData;
|
|
|
2136
2456
|
* @param {Object} options
|
|
2137
2457
|
* @returns {Object}
|
|
2138
2458
|
*/
|
|
2459
|
+
|
|
2139
2460
|
var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
2140
2461
|
return function (options) {
|
|
2141
2462
|
var convertedOptions = Object.assign({}, options);
|
|
2142
2463
|
Object.keys(optionValuesSCMapping).forEach(function (key) {
|
|
2143
|
-
if (lodash_1.has(options, key)) {
|
|
2464
|
+
if ((0, lodash_1.has)(options, key)) {
|
|
2144
2465
|
var updatedValue = optionValuesSCMapping[key][options[key]];
|
|
2145
|
-
|
|
2466
|
+
|
|
2467
|
+
if (!(0, lodash_1.isUndefined)(updatedValue)) {
|
|
2146
2468
|
convertedOptions[key] = updatedValue;
|
|
2147
2469
|
}
|
|
2148
2470
|
}
|
|
@@ -2150,6 +2472,7 @@ var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
|
2150
2472
|
return convertedOptions;
|
|
2151
2473
|
};
|
|
2152
2474
|
};
|
|
2475
|
+
|
|
2153
2476
|
exports.mapToValues = mapToValues;
|
|
2154
2477
|
/**
|
|
2155
2478
|
* Helper method to process options related to y2Fields
|
|
@@ -2157,18 +2480,23 @@ exports.mapToValues = mapToValues;
|
|
|
2157
2480
|
* @param {Object} originalOptions
|
|
2158
2481
|
* @returns {Object}
|
|
2159
2482
|
*/
|
|
2483
|
+
|
|
2160
2484
|
var convertY2AxisOptions = function convertY2AxisOptions(_a) {
|
|
2161
2485
|
var y2Fields = _a.y2Fields,
|
|
2162
|
-
|
|
2486
|
+
originalOptions = __rest(_a, ["y2Fields"]);
|
|
2487
|
+
|
|
2163
2488
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
2489
|
+
|
|
2164
2490
|
if (y2Fields) {
|
|
2165
2491
|
convertedOptions['axisY2.enabled'] = true;
|
|
2166
|
-
convertedOptions['axisY2.fields'] = lodash_1.isArray(y2Fields) ? y2Fields.filter(function (name) {
|
|
2492
|
+
convertedOptions['axisY2.fields'] = (0, lodash_1.isArray)(y2Fields) ? y2Fields.filter(function (name) {
|
|
2167
2493
|
return name;
|
|
2168
2494
|
}).join(',') : y2Fields;
|
|
2169
2495
|
}
|
|
2496
|
+
|
|
2170
2497
|
return convertedOptions;
|
|
2171
2498
|
};
|
|
2499
|
+
|
|
2172
2500
|
exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
2173
2501
|
/**
|
|
2174
2502
|
* Helper method to format value for overlayFields
|
|
@@ -2176,9 +2504,11 @@ exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
|
2176
2504
|
* @param {Object} originalOptions
|
|
2177
2505
|
* @returns {Object}
|
|
2178
2506
|
*/
|
|
2507
|
+
|
|
2179
2508
|
var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
2180
2509
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
2181
2510
|
var overlayFields = originalOptions.overlayFields;
|
|
2511
|
+
|
|
2182
2512
|
if (overlayFields) {
|
|
2183
2513
|
convertedOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
|
|
2184
2514
|
return field;
|
|
@@ -2186,17 +2516,21 @@ var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
|
2186
2516
|
return field.trim();
|
|
2187
2517
|
}).join(',') : overlayFields;
|
|
2188
2518
|
}
|
|
2519
|
+
|
|
2189
2520
|
return convertedOptions;
|
|
2190
2521
|
};
|
|
2522
|
+
|
|
2191
2523
|
exports.convertOverlayFields = convertOverlayFields;
|
|
2192
2524
|
/**
|
|
2193
2525
|
* checks whether data is multi series data
|
|
2194
2526
|
* @param {array} data array
|
|
2195
2527
|
* @return {Boolean}
|
|
2196
2528
|
*/
|
|
2529
|
+
|
|
2197
2530
|
var isMultiSeriesData = function isMultiSeriesData(data) {
|
|
2198
2531
|
return Array.isArray(data) && Array.isArray(data[0]);
|
|
2199
2532
|
};
|
|
2533
|
+
|
|
2200
2534
|
exports.isMultiSeriesData = isMultiSeriesData;
|
|
2201
2535
|
/**
|
|
2202
2536
|
* checks whether data is multi series data and returns value as array
|
|
@@ -2204,36 +2538,39 @@ exports.isMultiSeriesData = isMultiSeriesData;
|
|
|
2204
2538
|
* @param {*} value to return as array
|
|
2205
2539
|
* @return {array}
|
|
2206
2540
|
*/
|
|
2541
|
+
|
|
2207
2542
|
var toArrayForSeries = function toArrayForSeries(data, value) {
|
|
2208
|
-
return exports.isMultiSeriesData(data) ? value : [value];
|
|
2543
|
+
return (0, exports.isMultiSeriesData)(data) ? value : [value];
|
|
2209
2544
|
};
|
|
2545
|
+
|
|
2210
2546
|
exports.toArrayForSeries = toArrayForSeries;
|
|
2547
|
+
|
|
2211
2548
|
var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
2212
2549
|
var _ref2$x = _ref2.x,
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
var columns = [x.map(String)].concat(_toConsumableArray(exports.toArrayForSeries(y, y).map(function (series) {
|
|
2550
|
+
x = _ref2$x === void 0 ? [] : _ref2$x,
|
|
2551
|
+
_ref2$y = _ref2.y,
|
|
2552
|
+
y = _ref2$y === void 0 ? [] : _ref2$y,
|
|
2553
|
+
xField = _ref2.xField,
|
|
2554
|
+
yFields = _ref2.yFields,
|
|
2555
|
+
y2 = _ref2.y2,
|
|
2556
|
+
y2Fields = _ref2.y2Fields;
|
|
2557
|
+
var columns = [x.map(String)].concat(_toConsumableArray((0, exports.toArrayForSeries)(y, y).map(function (series) {
|
|
2221
2558
|
return series.map(String);
|
|
2222
2559
|
})));
|
|
2223
|
-
var yFieldsArray = exports.toArrayForSeries(y, yFields);
|
|
2560
|
+
var yFieldsArray = (0, exports.toArrayForSeries)(y, yFields);
|
|
2224
2561
|
var fields = [{
|
|
2225
2562
|
name: xField
|
|
2226
2563
|
}].concat(_toConsumableArray(yFieldsArray.map(function (field) {
|
|
2227
2564
|
return {
|
|
2228
2565
|
name: field
|
|
2229
2566
|
};
|
|
2230
|
-
})));
|
|
2231
|
-
// splunk-charting requires y2 to be part of columns
|
|
2567
|
+
}))); // splunk-charting requires y2 to be part of columns
|
|
2232
2568
|
// when y & y2 options are configured with different (mutually exclusive) series
|
|
2233
2569
|
// y2 columns need to be added to columns
|
|
2570
|
+
|
|
2234
2571
|
if (y2Fields) {
|
|
2235
|
-
var y2FieldsArray = exports.toArrayForSeries(y2, y2Fields);
|
|
2236
|
-
var y2AsArray = exports.toArrayForSeries(y2, y2).map(function (series) {
|
|
2572
|
+
var y2FieldsArray = (0, exports.toArrayForSeries)(y2, y2Fields);
|
|
2573
|
+
var y2AsArray = (0, exports.toArrayForSeries)(y2, y2).map(function (series) {
|
|
2237
2574
|
return series === null || series === void 0 ? void 0 : series.map(String);
|
|
2238
2575
|
});
|
|
2239
2576
|
y2FieldsArray.forEach(function (y2Field, index) {
|
|
@@ -2245,19 +2582,14 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
2245
2582
|
}
|
|
2246
2583
|
});
|
|
2247
2584
|
}
|
|
2585
|
+
|
|
2248
2586
|
return {
|
|
2249
2587
|
columns: columns,
|
|
2250
2588
|
fields: fields
|
|
2251
2589
|
};
|
|
2252
2590
|
};
|
|
2253
|
-
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
2254
|
-
|
|
2255
|
-
/***/ }),
|
|
2256
|
-
|
|
2257
|
-
/***/ 56:
|
|
2258
|
-
/***/ (function(module, exports) {
|
|
2259
2591
|
|
|
2260
|
-
|
|
2592
|
+
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
2261
2593
|
|
|
2262
2594
|
/***/ }),
|
|
2263
2595
|
|
|
@@ -2279,6 +2611,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2279
2611
|
});
|
|
2280
2612
|
exports.VizBehavior = void 0;
|
|
2281
2613
|
var VizBehavior;
|
|
2614
|
+
|
|
2282
2615
|
(function (VizBehavior) {
|
|
2283
2616
|
/**
|
|
2284
2617
|
* Dynamic Options Behavior.
|
|
@@ -2298,6 +2631,7 @@ var VizBehavior;
|
|
|
2298
2631
|
* missing.
|
|
2299
2632
|
* @type {string}
|
|
2300
2633
|
*/
|
|
2634
|
+
|
|
2301
2635
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
2302
2636
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
2303
2637
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -2305,7 +2639,7 @@ var VizBehavior;
|
|
|
2305
2639
|
|
|
2306
2640
|
/***/ }),
|
|
2307
2641
|
|
|
2308
|
-
/***/
|
|
2642
|
+
/***/ 65:
|
|
2309
2643
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2310
2644
|
|
|
2311
2645
|
"use strict";
|
|
@@ -2316,23 +2650,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2316
2650
|
});
|
|
2317
2651
|
exports.updateRowPayload = exports.canUpdateInPlace = exports.changedOptions = exports.NO_INPLACE_PROPS = void 0;
|
|
2318
2652
|
/* eslint-disable react/no-unused-prop-types */
|
|
2653
|
+
|
|
2319
2654
|
var lodash_1 = __webpack_require__(3);
|
|
2655
|
+
|
|
2320
2656
|
var i18n_1 = __webpack_require__(2);
|
|
2657
|
+
|
|
2321
2658
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
2659
|
+
|
|
2322
2660
|
var react_1 = __webpack_require__(1);
|
|
2661
|
+
|
|
2323
2662
|
var React = __webpack_require__(1);
|
|
2663
|
+
|
|
2324
2664
|
var T = __webpack_require__(0);
|
|
2325
|
-
|
|
2326
|
-
__webpack_require__(66);
|
|
2327
|
-
|
|
2328
|
-
|
|
2665
|
+
|
|
2666
|
+
var react_event_listener_1 = __webpack_require__(66);
|
|
2667
|
+
|
|
2668
|
+
__webpack_require__(67); // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
var charting_bundle_1 = __webpack_require__(55);
|
|
2672
|
+
|
|
2673
|
+
var TimezoneContext_1 = __webpack_require__(26);
|
|
2674
|
+
|
|
2329
2675
|
var style_1 = __webpack_require__(14);
|
|
2676
|
+
|
|
2330
2677
|
var styled_components_1 = __webpack_require__(4);
|
|
2678
|
+
|
|
2331
2679
|
var Message_1 = __webpack_require__(10);
|
|
2680
|
+
|
|
2332
2681
|
var useSplunkTheme_1 = __webpack_require__(57);
|
|
2333
|
-
|
|
2334
|
-
var
|
|
2682
|
+
|
|
2683
|
+
var themeUtils_1 = __webpack_require__(68);
|
|
2684
|
+
|
|
2685
|
+
var ChartingApi_1 = __webpack_require__(69);
|
|
2686
|
+
|
|
2335
2687
|
exports.NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
|
|
2688
|
+
|
|
2336
2689
|
var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
2337
2690
|
return Object.keys(curOptions).filter(function (key) {
|
|
2338
2691
|
return !(key in nextOptions);
|
|
@@ -2340,30 +2693,34 @@ var changedOptions = function changedOptions(curOptions, nextOptions) {
|
|
|
2340
2693
|
return !(key in curOptions) || curOptions[key] !== nextOptions[key];
|
|
2341
2694
|
}));
|
|
2342
2695
|
};
|
|
2696
|
+
|
|
2343
2697
|
exports.changedOptions = changedOptions;
|
|
2344
|
-
|
|
2698
|
+
|
|
2345
2699
|
function usePrevious(value) {
|
|
2346
|
-
var ref = react_1.useRef();
|
|
2347
|
-
react_1.useEffect(function () {
|
|
2700
|
+
var ref = (0, react_1.useRef)();
|
|
2701
|
+
(0, react_1.useEffect)(function () {
|
|
2348
2702
|
ref.current = value;
|
|
2349
2703
|
});
|
|
2350
2704
|
return ref.current;
|
|
2351
2705
|
}
|
|
2706
|
+
|
|
2352
2707
|
var canUpdateInPlace = function canUpdateInPlace(curOptions, nextOptions) {
|
|
2353
2708
|
// if either of the options are undefined
|
|
2354
2709
|
// it cannot update in place.
|
|
2355
2710
|
if (!curOptions || !nextOptions) {
|
|
2356
2711
|
return false;
|
|
2357
2712
|
}
|
|
2713
|
+
|
|
2358
2714
|
return !exports.NO_INPLACE_PROPS.some(function (p) {
|
|
2359
2715
|
return curOptions[p] !== nextOptions[p];
|
|
2360
|
-
}) && !exports.changedOptions(curOptions, nextOptions).some(function (p) {
|
|
2716
|
+
}) && !(0, exports.changedOptions)(curOptions, nextOptions).some(function (p) {
|
|
2361
2717
|
return p.toLowerCase().endsWith('color');
|
|
2362
2718
|
});
|
|
2363
2719
|
};
|
|
2364
|
-
|
|
2365
|
-
// create 'row' payloads from 'rowContext' in the flattened format:
|
|
2720
|
+
|
|
2721
|
+
exports.canUpdateInPlace = canUpdateInPlace; // create 'row' payloads from 'rowContext' in the flattened format:
|
|
2366
2722
|
// row.<fieldname>.value
|
|
2723
|
+
|
|
2367
2724
|
var updateRowPayload = function updateRowPayload(chartEventRowContext, payload) {
|
|
2368
2725
|
Object.keys(chartEventRowContext || {}).forEach(function (key) {
|
|
2369
2726
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -2371,18 +2728,21 @@ var updateRowPayload = function updateRowPayload(chartEventRowContext, payload)
|
|
|
2371
2728
|
});
|
|
2372
2729
|
return payload;
|
|
2373
2730
|
};
|
|
2731
|
+
|
|
2374
2732
|
exports.updateRowPayload = updateRowPayload;
|
|
2375
2733
|
var VizChartEventType;
|
|
2734
|
+
|
|
2376
2735
|
(function (VizChartEventType) {
|
|
2377
2736
|
VizChartEventType["POINT_CLICK"] = "point.click";
|
|
2378
2737
|
VizChartEventType["POINT_MOUSE_OUT"] = "point.mouseout";
|
|
2379
2738
|
VizChartEventType["POINT_MOUSE_OVER"] = "point.mouseover";
|
|
2380
2739
|
VizChartEventType["LEGEND_CLICK"] = "legend.click";
|
|
2381
|
-
})(VizChartEventType || (VizChartEventType = {}));
|
|
2382
|
-
// @TODO(pwied): remove after HC upgrade to 8+
|
|
2740
|
+
})(VizChartEventType || (VizChartEventType = {})); // @TODO(pwied): remove after HC upgrade to 8+
|
|
2383
2741
|
// .highcharts-a11y-proxy-container rule addresses a HighCharts < 8 bug
|
|
2384
2742
|
// caused by the accessibility plugin
|
|
2385
2743
|
// https://github.com/highcharts/highcharts/issues/12883
|
|
2744
|
+
|
|
2745
|
+
|
|
2386
2746
|
var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
|
|
2387
2747
|
return {
|
|
2388
2748
|
'data-test': 'charting-container',
|
|
@@ -2393,7 +2753,7 @@ var ChartingContainer = styled_components_1.default.div.attrs(function (props) {
|
|
|
2393
2753
|
displayName: "Charting__ChartingContainer",
|
|
2394
2754
|
componentId: "sc-3wbgm0-0"
|
|
2395
2755
|
})(["& .highcharts-a11y-proxy-container{pointer-events:none;}overflow:hidden;position:relative;", ";"], function (props) {
|
|
2396
|
-
return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
|
|
2756
|
+
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
2397
2757
|
});
|
|
2398
2758
|
var propTypes = {
|
|
2399
2759
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -2410,13 +2770,15 @@ var propTypes = {
|
|
|
2410
2770
|
visualizationApiRef: T.func,
|
|
2411
2771
|
themeKey: T.string
|
|
2412
2772
|
};
|
|
2773
|
+
|
|
2413
2774
|
var Charting = function Charting(props) {
|
|
2414
|
-
var container = react_1.useRef(null);
|
|
2415
|
-
var needsInit = react_1.useRef(true);
|
|
2416
|
-
var chart = react_1.useRef();
|
|
2417
|
-
var needsRedraw = react_1.useRef(true);
|
|
2418
|
-
var api = react_1.useRef(new ChartingApi_1.ChartingApiFunctional(chart));
|
|
2419
|
-
var timezone = react_1.useContext(TimezoneContext_1.default);
|
|
2775
|
+
var container = (0, react_1.useRef)(null);
|
|
2776
|
+
var needsInit = (0, react_1.useRef)(true);
|
|
2777
|
+
var chart = (0, react_1.useRef)();
|
|
2778
|
+
var needsRedraw = (0, react_1.useRef)(true);
|
|
2779
|
+
var api = (0, react_1.useRef)(new ChartingApi_1.ChartingApiFunctional(chart));
|
|
2780
|
+
var timezone = (0, react_1.useContext)(TimezoneContext_1.default);
|
|
2781
|
+
|
|
2420
2782
|
var computeChartingSize = function computeChartingSize() {
|
|
2421
2783
|
if (container.current) {
|
|
2422
2784
|
var rect = container.current.getBoundingClientRect();
|
|
@@ -2425,91 +2787,103 @@ var Charting = function Charting(props) {
|
|
|
2425
2787
|
width: rect.width
|
|
2426
2788
|
};
|
|
2427
2789
|
}
|
|
2790
|
+
|
|
2428
2791
|
return {};
|
|
2429
2792
|
};
|
|
2430
|
-
|
|
2431
|
-
var
|
|
2793
|
+
|
|
2794
|
+
var splunkTheme = (0, useSplunkTheme_1.default)();
|
|
2795
|
+
var themeKey = props.themeKey ? props.themeKey : (0, themeUtils_1.getChartingThemeKey)({
|
|
2432
2796
|
splunkThemeV1: splunkTheme
|
|
2433
2797
|
});
|
|
2434
2798
|
var width = props.width,
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2799
|
+
height = props.height,
|
|
2800
|
+
style = props.style,
|
|
2801
|
+
chartData = props.chartData,
|
|
2802
|
+
options = props.options,
|
|
2803
|
+
colorPalette = props.colorPalette,
|
|
2804
|
+
onClick = props.onClick,
|
|
2805
|
+
onSelect = props.onSelect,
|
|
2806
|
+
onPointMouseOut = props.onPointMouseOut,
|
|
2807
|
+
onPointMouseOver = props.onPointMouseOver,
|
|
2808
|
+
onEventTrigger = props.onEventTrigger;
|
|
2445
2809
|
var prevOptions = usePrevious(options);
|
|
2446
2810
|
var prevTimezone = usePrevious(timezone);
|
|
2811
|
+
|
|
2447
2812
|
var handleClick = function handleClick(chartEvent, type) {
|
|
2448
|
-
var payload = lodash_1.pick(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
|
|
2813
|
+
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey');
|
|
2449
2814
|
payload.name = payload.name2;
|
|
2450
2815
|
delete payload.name2;
|
|
2816
|
+
|
|
2451
2817
|
if (type === VizChartEventType.POINT_CLICK) {
|
|
2452
2818
|
payload.value = payload.value2;
|
|
2453
2819
|
delete payload.value2;
|
|
2454
|
-
payload = exports.updateRowPayload(chartEvent.rowContext, payload);
|
|
2820
|
+
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
2455
2821
|
}
|
|
2822
|
+
|
|
2456
2823
|
onClick({
|
|
2457
2824
|
type: type,
|
|
2458
2825
|
originalEvent: chartEvent,
|
|
2459
2826
|
payload: payload
|
|
2460
2827
|
});
|
|
2461
2828
|
};
|
|
2829
|
+
|
|
2462
2830
|
var destroyChart = function destroyChart() {
|
|
2463
2831
|
if (chart.current) {
|
|
2464
2832
|
chart.current.destroy();
|
|
2465
2833
|
chart.current = null;
|
|
2466
2834
|
}
|
|
2835
|
+
|
|
2467
2836
|
needsRedraw.current = true;
|
|
2468
2837
|
needsInit.current = true;
|
|
2469
2838
|
};
|
|
2839
|
+
|
|
2470
2840
|
var handleSelect = function handleSelect(chartEvent) {
|
|
2471
2841
|
// todo: need change this after breaking all visualizations
|
|
2472
2842
|
if (onSelect && typeof onSelect === 'function') {
|
|
2473
2843
|
onSelect({
|
|
2474
2844
|
type: 'range.select',
|
|
2475
2845
|
originalEvent: chartEvent,
|
|
2476
|
-
payload: lodash_1.pick(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2846
|
+
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2477
2847
|
});
|
|
2478
2848
|
return;
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2849
|
+
} // the chartEvent here is a jQuery event
|
|
2850
|
+
|
|
2851
|
+
|
|
2481
2852
|
onEventTrigger({
|
|
2482
2853
|
type: 'range.select',
|
|
2483
2854
|
originalEvent: chartEvent,
|
|
2484
|
-
payload: lodash_1.pick(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2855
|
+
payload: (0, lodash_1.pick)(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
|
|
2485
2856
|
});
|
|
2486
2857
|
};
|
|
2858
|
+
|
|
2487
2859
|
var handlePointMouseOut = function handlePointMouseOut(chartEvent, type) {
|
|
2488
|
-
var payload = lodash_1.pick(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2860
|
+
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2489
2861
|
payload.name = payload.name2;
|
|
2490
2862
|
delete payload.name2;
|
|
2491
2863
|
payload.value = payload.value2;
|
|
2492
2864
|
delete payload.value2;
|
|
2493
|
-
payload = exports.updateRowPayload(chartEvent.rowContext, payload);
|
|
2865
|
+
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
2494
2866
|
onPointMouseOut({
|
|
2495
2867
|
type: type,
|
|
2496
2868
|
originalEvent: chartEvent,
|
|
2497
2869
|
payload: payload
|
|
2498
2870
|
});
|
|
2499
2871
|
};
|
|
2872
|
+
|
|
2500
2873
|
var handlePointMouseOver = function handlePointMouseOver(chartEvent, type) {
|
|
2501
|
-
var payload = lodash_1.pick(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2874
|
+
var payload = (0, lodash_1.pick)(chartEvent, 'name2', 'value2', '_span', 'modifierKey', 'tooltipContext');
|
|
2502
2875
|
payload.name = payload.name2;
|
|
2503
2876
|
delete payload.name2;
|
|
2504
2877
|
payload.value = payload.value2;
|
|
2505
2878
|
delete payload.value2;
|
|
2506
|
-
payload = exports.updateRowPayload(chartEvent.rowContext, payload);
|
|
2879
|
+
payload = (0, exports.updateRowPayload)(chartEvent.rowContext, payload);
|
|
2507
2880
|
onPointMouseOver({
|
|
2508
2881
|
type: type,
|
|
2509
2882
|
originalEvent: chartEvent,
|
|
2510
2883
|
payload: payload
|
|
2511
2884
|
});
|
|
2512
2885
|
};
|
|
2886
|
+
|
|
2513
2887
|
var drawChart = function drawChart() {
|
|
2514
2888
|
var updatedOptions = Object.assign(Object.assign({}, options), {
|
|
2515
2889
|
shouldColorizeTooltipData: false
|
|
@@ -2520,15 +2894,18 @@ var Charting = function Charting(props) {
|
|
|
2520
2894
|
var serializedTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.serializedTimezone;
|
|
2521
2895
|
var ianaTimezone = timezone === null || timezone === void 0 ? void 0 : timezone.ianaTimezone;
|
|
2522
2896
|
var utcOffset = timezone === null || timezone === void 0 ? void 0 : timezone.utcOffset;
|
|
2897
|
+
|
|
2523
2898
|
if (!computedWidth || !computedHeight) {
|
|
2524
2899
|
return;
|
|
2525
2900
|
}
|
|
2901
|
+
|
|
2526
2902
|
if (!chartData || !Object.keys(chartData).length) {
|
|
2527
2903
|
return;
|
|
2528
|
-
}
|
|
2529
|
-
// splunk-charting layers configuration option updates.
|
|
2904
|
+
} // splunk-charting layers configuration option updates.
|
|
2530
2905
|
// when an option is removed it needs to be set to an empty string
|
|
2531
2906
|
// to override the previous configuration
|
|
2907
|
+
|
|
2908
|
+
|
|
2532
2909
|
if (prevOptions) {
|
|
2533
2910
|
Object.keys(prevOptions).forEach(function (key) {
|
|
2534
2911
|
if (updatedOptions[key] === undefined) {
|
|
@@ -2536,13 +2913,16 @@ var Charting = function Charting(props) {
|
|
|
2536
2913
|
}
|
|
2537
2914
|
});
|
|
2538
2915
|
}
|
|
2916
|
+
|
|
2539
2917
|
try {
|
|
2540
2918
|
if (needsInit.current) {
|
|
2541
2919
|
destroyChart();
|
|
2542
2920
|
charting_bundle_1.default.setTheme(themeKey);
|
|
2921
|
+
|
|
2543
2922
|
if (colorPalette.length > 0) {
|
|
2544
2923
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
2545
2924
|
}
|
|
2925
|
+
|
|
2546
2926
|
chart.current = charting_bundle_1.default.createChart(container.current, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedOptions), {
|
|
2547
2927
|
drilldown: 'all'
|
|
2548
2928
|
}), typeof serializedTimezone === 'string' && {
|
|
@@ -2551,8 +2931,8 @@ var Charting = function Charting(props) {
|
|
|
2551
2931
|
'time.ianaTimezone': ianaTimezone
|
|
2552
2932
|
}), typeof utcOffset === 'number' && {
|
|
2553
2933
|
'time.timezoneOffset': utcOffset
|
|
2554
|
-
}));
|
|
2555
|
-
|
|
2934
|
+
})); // bind event handlers
|
|
2935
|
+
|
|
2556
2936
|
chart.current.on('pointClick', function (e) {
|
|
2557
2937
|
handleClick(e, VizChartEventType.POINT_CLICK);
|
|
2558
2938
|
});
|
|
@@ -2567,32 +2947,40 @@ var Charting = function Charting(props) {
|
|
|
2567
2947
|
});
|
|
2568
2948
|
chart.current.on('chartRangeSelect', handleSelect);
|
|
2569
2949
|
}
|
|
2950
|
+
|
|
2570
2951
|
if (needsRedraw.current) {
|
|
2571
2952
|
charting_bundle_1.default.setTheme(themeKey);
|
|
2953
|
+
|
|
2572
2954
|
if (colorPalette.length > 0) {
|
|
2573
2955
|
charting_bundle_1.default.setColorPalette(colorPalette);
|
|
2574
2956
|
}
|
|
2957
|
+
|
|
2575
2958
|
chart.current.prepareAndDraw(chartData, updatedOptions, function () {});
|
|
2576
2959
|
}
|
|
2960
|
+
|
|
2577
2961
|
if (chart.current) {
|
|
2578
2962
|
if (Math.round(chart.current.height) !== Math.round(computedHeight) || Math.round(chart.current.width) !== Math.round(computedWidth)) {
|
|
2579
2963
|
chart.current.resize(computedWidth, computedHeight);
|
|
2580
2964
|
}
|
|
2581
2965
|
}
|
|
2966
|
+
|
|
2582
2967
|
needsInit.current = false;
|
|
2583
2968
|
needsRedraw.current = false;
|
|
2584
2969
|
} catch (e) {
|
|
2585
2970
|
window.console.error('Caught error rendering chart:', e);
|
|
2586
2971
|
}
|
|
2587
2972
|
};
|
|
2588
|
-
|
|
2973
|
+
|
|
2974
|
+
var debouncedDrawChart = (0, lodash_1.debounce)(drawChart, 5);
|
|
2975
|
+
|
|
2589
2976
|
var onContainerMount = function onContainerMount(chartingContainer) {
|
|
2590
2977
|
container.current = chartingContainer;
|
|
2591
2978
|
debouncedDrawChart();
|
|
2592
2979
|
};
|
|
2980
|
+
|
|
2593
2981
|
var prevTheme = usePrevious(themeKey);
|
|
2594
2982
|
var prevOnClick = usePrevious(onClick);
|
|
2595
|
-
react_1.useEffect(function () {
|
|
2983
|
+
(0, react_1.useEffect)(function () {
|
|
2596
2984
|
debouncedDrawChart();
|
|
2597
2985
|
props.visualizationApiRef(api.current);
|
|
2598
2986
|
return function () {
|
|
@@ -2600,17 +2988,17 @@ var Charting = function Charting(props) {
|
|
|
2600
2988
|
destroyChart();
|
|
2601
2989
|
};
|
|
2602
2990
|
}, []);
|
|
2603
|
-
react_1.useEffect(function () {
|
|
2991
|
+
(0, react_1.useEffect)(function () {
|
|
2604
2992
|
// TODO: figure out why re-init is needed for functional components (i.e. PlatformViz) when changing theme
|
|
2605
2993
|
// seems like redraw doesn't suffice to update the background colors
|
|
2606
|
-
if (!chart.current || !exports.canUpdateInPlace(prevOptions, options) ||
|
|
2607
|
-
// timezone is a simple object so this comparison should be fast
|
|
2994
|
+
if (!chart.current || !(0, exports.canUpdateInPlace)(prevOptions, options) || // timezone is a simple object so this comparison should be fast
|
|
2608
2995
|
JSON.stringify(prevTimezone) !== JSON.stringify(timezone) || !props.themeKey && prevTheme !== themeKey || prevOnClick !== onClick) {
|
|
2609
2996
|
needsInit.current = true;
|
|
2610
2997
|
}
|
|
2611
|
-
|
|
2612
|
-
// need to immediately call drawChart upon an option or chartData change
|
|
2998
|
+
|
|
2999
|
+
needsRedraw.current = true; // need to immediately call drawChart upon an option or chartData change
|
|
2613
3000
|
// otherwise a noop would occur if the onContainerMount drawChart is re-invoked when dimensions change
|
|
3001
|
+
|
|
2614
3002
|
drawChart();
|
|
2615
3003
|
}, [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]);
|
|
2616
3004
|
return React.createElement(ChartingContainer, {
|
|
@@ -2623,6 +3011,7 @@ var Charting = function Charting(props) {
|
|
|
2623
3011
|
onResize: debouncedDrawChart
|
|
2624
3012
|
}));
|
|
2625
3013
|
};
|
|
3014
|
+
|
|
2626
3015
|
var defaultProps = {
|
|
2627
3016
|
width: '100%',
|
|
2628
3017
|
height: 250,
|
|
@@ -2640,72 +3029,81 @@ var defaultProps = {
|
|
|
2640
3029
|
themeKey: null
|
|
2641
3030
|
};
|
|
2642
3031
|
Charting.propTypes = propTypes;
|
|
2643
|
-
Charting.defaultProps = defaultProps;
|
|
2644
|
-
|
|
3032
|
+
Charting.defaultProps = defaultProps; // allow for early return in case of empty chartData while still following hook rules
|
|
3033
|
+
|
|
2645
3034
|
var withEmptyChartMessage = function withEmptyChartMessage(Chart) {
|
|
2646
3035
|
var Wrapper = function Wrapper(props) {
|
|
2647
3036
|
var chartData = props.chartData;
|
|
3037
|
+
|
|
2648
3038
|
if (!chartData) {
|
|
2649
3039
|
return React.createElement(Message_1.default, {
|
|
2650
|
-
message: i18n_1._('No DataSource'),
|
|
3040
|
+
message: (0, i18n_1._)('No DataSource'),
|
|
2651
3041
|
level: "warning"
|
|
2652
3042
|
});
|
|
2653
3043
|
}
|
|
3044
|
+
|
|
2654
3045
|
if (chartData && !Object.keys(chartData).length) {
|
|
2655
3046
|
return React.createElement(Message_1.default, {
|
|
2656
|
-
message: i18n_1._('No Result'),
|
|
3047
|
+
message: (0, i18n_1._)('No Result'),
|
|
2657
3048
|
level: "info"
|
|
2658
3049
|
});
|
|
2659
3050
|
}
|
|
3051
|
+
|
|
2660
3052
|
return React.createElement(Chart, Object.assign({}, props));
|
|
2661
3053
|
};
|
|
3054
|
+
|
|
2662
3055
|
Wrapper.displayName = 'ChartingWrapper';
|
|
2663
3056
|
Wrapper.propTypes = propTypes;
|
|
2664
3057
|
Wrapper.defaultProps = defaultProps;
|
|
2665
3058
|
return Wrapper;
|
|
2666
|
-
};
|
|
2667
|
-
|
|
3059
|
+
}; // export default Charting;
|
|
3060
|
+
|
|
3061
|
+
|
|
2668
3062
|
exports.default = withEmptyChartMessage(Charting);
|
|
2669
3063
|
|
|
2670
3064
|
/***/ }),
|
|
2671
3065
|
|
|
2672
|
-
/***/
|
|
3066
|
+
/***/ 66:
|
|
2673
3067
|
/***/ (function(module, exports) {
|
|
2674
3068
|
|
|
2675
3069
|
module.exports = require("react-event-listener");
|
|
2676
3070
|
|
|
2677
3071
|
/***/ }),
|
|
2678
3072
|
|
|
2679
|
-
/***/
|
|
3073
|
+
/***/ 67:
|
|
2680
3074
|
/***/ (function(module, exports) {
|
|
2681
3075
|
|
|
2682
3076
|
module.exports = require("@splunk/visualizations-shared/i18n");
|
|
2683
3077
|
|
|
2684
3078
|
/***/ }),
|
|
2685
3079
|
|
|
2686
|
-
/***/
|
|
3080
|
+
/***/ 68:
|
|
2687
3081
|
/***/ (function(module, exports) {
|
|
2688
3082
|
|
|
2689
3083
|
module.exports = require("@splunk/visualizations-shared/themeUtils");
|
|
2690
3084
|
|
|
2691
3085
|
/***/ }),
|
|
2692
3086
|
|
|
2693
|
-
/***/
|
|
3087
|
+
/***/ 69:
|
|
2694
3088
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2695
3089
|
|
|
2696
3090
|
"use strict";
|
|
2697
3091
|
|
|
2698
3092
|
|
|
2699
3093
|
var _classCallCheck = __webpack_require__(9);
|
|
3094
|
+
|
|
2700
3095
|
var _createClass = __webpack_require__(18);
|
|
3096
|
+
|
|
2701
3097
|
Object.defineProperty(exports, "__esModule", {
|
|
2702
3098
|
value: true
|
|
2703
3099
|
});
|
|
2704
3100
|
exports.ChartingApiFunctional = void 0;
|
|
3101
|
+
|
|
2705
3102
|
var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
2706
3103
|
// eslint-disable-next-line no-useless-constructor
|
|
2707
3104
|
function ChartingApiFunctional(chartRef) {
|
|
2708
3105
|
_classCallCheck(this, ChartingApiFunctional);
|
|
3106
|
+
|
|
2709
3107
|
this.chartRef = chartRef;
|
|
2710
3108
|
}
|
|
2711
3109
|
/**
|
|
@@ -2713,15 +3111,18 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
|
2713
3111
|
*
|
|
2714
3112
|
* @memberof ChartingApiFunctional
|
|
2715
3113
|
*/
|
|
3114
|
+
|
|
3115
|
+
|
|
2716
3116
|
_createClass(ChartingApiFunctional, [{
|
|
2717
3117
|
key: "highlight",
|
|
2718
3118
|
value: function highlight() {
|
|
2719
3119
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
3120
|
+
xValue: '',
|
|
3121
|
+
seriesName: ''
|
|
3122
|
+
},
|
|
3123
|
+
xValue = _ref.xValue,
|
|
3124
|
+
seriesName = _ref.seriesName;
|
|
3125
|
+
|
|
2725
3126
|
this.getChart().highlight(xValue, seriesName);
|
|
2726
3127
|
}
|
|
2727
3128
|
/**
|
|
@@ -2729,36 +3130,40 @@ var ChartingApiFunctional = /*#__PURE__*/function () {
|
|
|
2729
3130
|
*
|
|
2730
3131
|
* @memberof ChartingApiFunctional
|
|
2731
3132
|
*/
|
|
3133
|
+
|
|
2732
3134
|
}, {
|
|
2733
3135
|
key: "unHighlight",
|
|
2734
3136
|
value: function unHighlight() {
|
|
2735
3137
|
this.getChart().unHighlight();
|
|
2736
|
-
}
|
|
2737
|
-
|
|
3138
|
+
} // returns chart object
|
|
3139
|
+
|
|
2738
3140
|
}, {
|
|
2739
3141
|
key: "getChart",
|
|
2740
3142
|
value: function getChart() {
|
|
2741
3143
|
var _a;
|
|
3144
|
+
|
|
2742
3145
|
return (_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.current;
|
|
2743
3146
|
}
|
|
2744
3147
|
}]);
|
|
3148
|
+
|
|
2745
3149
|
return ChartingApiFunctional;
|
|
2746
3150
|
}();
|
|
3151
|
+
|
|
2747
3152
|
exports.ChartingApiFunctional = ChartingApiFunctional;
|
|
2748
3153
|
|
|
2749
3154
|
/***/ }),
|
|
2750
3155
|
|
|
2751
|
-
/***/
|
|
3156
|
+
/***/ 7:
|
|
2752
3157
|
/***/ (function(module, exports) {
|
|
2753
3158
|
|
|
2754
|
-
module.exports = require("@
|
|
3159
|
+
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
2755
3160
|
|
|
2756
3161
|
/***/ }),
|
|
2757
3162
|
|
|
2758
|
-
/***/
|
|
3163
|
+
/***/ 70:
|
|
2759
3164
|
/***/ (function(module, exports) {
|
|
2760
3165
|
|
|
2761
|
-
module.exports = require("@
|
|
3166
|
+
module.exports = require("@splunk/visualizations-shared/simpleXMLOptions");
|
|
2762
3167
|
|
|
2763
3168
|
/***/ }),
|
|
2764
3169
|
|