@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/Events.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 = 202);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ([
|
|
@@ -133,6 +133,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
133
133
|
});
|
|
134
134
|
exports.VizBehavior = void 0;
|
|
135
135
|
var VizBehavior;
|
|
136
|
+
|
|
136
137
|
(function (VizBehavior) {
|
|
137
138
|
/**
|
|
138
139
|
* Dynamic Options Behavior.
|
|
@@ -152,6 +153,7 @@ var VizBehavior;
|
|
|
152
153
|
* missing.
|
|
153
154
|
* @type {string}
|
|
154
155
|
*/
|
|
156
|
+
|
|
155
157
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
156
158
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
157
159
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -203,40 +205,46 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
203
205
|
Object.defineProperty(exports, "__esModule", {
|
|
204
206
|
value: true
|
|
205
207
|
});
|
|
208
|
+
|
|
206
209
|
var React = __webpack_require__(1);
|
|
210
|
+
|
|
207
211
|
var styled_components_1 = __webpack_require__(4);
|
|
212
|
+
|
|
208
213
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
214
|
+
|
|
209
215
|
var style_1 = __webpack_require__(14);
|
|
216
|
+
|
|
210
217
|
var colorUtils_1 = __webpack_require__(12);
|
|
218
|
+
|
|
211
219
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
212
220
|
var width = _ref.width;
|
|
213
221
|
return {
|
|
214
222
|
style: {
|
|
215
|
-
width: style_1.toPx(width)
|
|
223
|
+
width: (0, style_1.toPx)(width)
|
|
216
224
|
}
|
|
217
225
|
};
|
|
218
226
|
}).withConfig({
|
|
219
227
|
displayName: "FixedSizeContainer__Item",
|
|
220
228
|
componentId: "sc-1yhgpod-0"
|
|
221
229
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
222
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
223
|
-
});
|
|
224
|
-
|
|
230
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
231
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
232
|
+
|
|
225
233
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
226
234
|
var width = _ref2.width,
|
|
227
|
-
|
|
235
|
+
height = _ref2.height;
|
|
228
236
|
return {
|
|
229
237
|
style: Object.assign(Object.assign({}, width && {
|
|
230
|
-
width: style_1.toPx(width)
|
|
238
|
+
width: (0, style_1.toPx)(width)
|
|
231
239
|
}), height && {
|
|
232
|
-
height: style_1.toPx(height)
|
|
240
|
+
height: (0, style_1.toPx)(height)
|
|
233
241
|
})
|
|
234
242
|
};
|
|
235
243
|
}).withConfig({
|
|
236
244
|
displayName: "FixedSizeContainer__FixSizeItem",
|
|
237
245
|
componentId: "sc-1yhgpod-1"
|
|
238
246
|
})(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
|
|
239
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
247
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
240
248
|
});
|
|
241
249
|
var ItemContent = styled_components_1.default.div.withConfig({
|
|
242
250
|
displayName: "FixedSizeContainer__ItemContent",
|
|
@@ -246,11 +254,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
246
254
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
247
255
|
componentId: "sc-1yhgpod-3"
|
|
248
256
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
257
|
+
|
|
249
258
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
250
259
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
251
260
|
var width = props.width,
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
height = props.height,
|
|
262
|
+
backgroundColor = props.backgroundColor;
|
|
263
|
+
|
|
254
264
|
if (!height) {
|
|
255
265
|
return React.createElement(Item, {
|
|
256
266
|
"data-test": "item",
|
|
@@ -258,24 +268,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
258
268
|
backgroundColor: backgroundColor
|
|
259
269
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
260
270
|
}
|
|
271
|
+
|
|
261
272
|
return React.createElement(FixSizeItem, {
|
|
262
273
|
"data-test": "fix-size-item",
|
|
263
|
-
"data-splunk-visualization-version": "
|
|
274
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
264
275
|
width: width,
|
|
265
276
|
height: height,
|
|
266
277
|
backgroundColor: backgroundColor
|
|
267
278
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
268
279
|
var newWidth = _ref3.width,
|
|
269
|
-
|
|
280
|
+
newHeight = _ref3.height;
|
|
270
281
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
271
282
|
width: newWidth,
|
|
272
283
|
height: newHeight
|
|
273
284
|
}));
|
|
274
285
|
})));
|
|
275
286
|
};
|
|
287
|
+
|
|
276
288
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
277
289
|
return FixedSizeContainer;
|
|
278
290
|
};
|
|
291
|
+
|
|
279
292
|
exports.default = withFixedSizeContainer;
|
|
280
293
|
|
|
281
294
|
/***/ }),
|
|
@@ -301,9 +314,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
301
314
|
* @param {DashboardVizType} props.Wrapper
|
|
302
315
|
* @param {DashboardVizType} props.Visualization
|
|
303
316
|
*/
|
|
317
|
+
|
|
304
318
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
305
319
|
var Wrapper = _ref.Wrapper,
|
|
306
|
-
|
|
320
|
+
Visualization = _ref.Visualization;
|
|
307
321
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
308
322
|
extendProperties.forEach(function (prop) {
|
|
309
323
|
if (Visualization[prop]) {
|
|
@@ -312,6 +326,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
312
326
|
}
|
|
313
327
|
});
|
|
314
328
|
};
|
|
329
|
+
|
|
315
330
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
316
331
|
|
|
317
332
|
/***/ }),
|
|
@@ -346,24 +361,33 @@ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
|
346
361
|
|
|
347
362
|
|
|
348
363
|
var _toConsumableArray = __webpack_require__(8);
|
|
364
|
+
|
|
349
365
|
var _defineProperty = __webpack_require__(7);
|
|
366
|
+
|
|
350
367
|
var __rest = this && this.__rest || function (s, e) {
|
|
351
368
|
var t = {};
|
|
369
|
+
|
|
352
370
|
for (var p in s) {
|
|
353
371
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
354
372
|
}
|
|
373
|
+
|
|
355
374
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
356
375
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
357
376
|
}
|
|
358
377
|
return t;
|
|
359
378
|
};
|
|
379
|
+
|
|
360
380
|
Object.defineProperty(exports, "__esModule", {
|
|
361
381
|
value: true
|
|
362
382
|
});
|
|
363
383
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
384
|
+
|
|
364
385
|
var lodash_1 = __webpack_require__(3);
|
|
386
|
+
|
|
365
387
|
var schemaUtils_1 = __webpack_require__(16);
|
|
388
|
+
|
|
366
389
|
var VizBehavior_1 = __webpack_require__(6);
|
|
390
|
+
|
|
367
391
|
var dynamicOptionsDSLType = {
|
|
368
392
|
type: 'string',
|
|
369
393
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -373,20 +397,22 @@ var dynamicOptionsDSLType = {
|
|
|
373
397
|
* @param optionsSchema a visualization's options schema
|
|
374
398
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
375
399
|
*/
|
|
400
|
+
|
|
376
401
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
377
402
|
var enhancedOptionsSchema = {};
|
|
378
403
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
379
404
|
var _a = optionsSchema[key],
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
405
|
+
title = _a.title,
|
|
406
|
+
description = _a.description,
|
|
407
|
+
readOnly = _a.readOnly,
|
|
408
|
+
writeOnly = _a.writeOnly,
|
|
409
|
+
examples = _a.examples,
|
|
410
|
+
defaultValue = _a.default,
|
|
411
|
+
type = _a.type,
|
|
412
|
+
properties = _a.properties,
|
|
413
|
+
patternProperties = _a.patternProperties,
|
|
414
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
415
|
+
|
|
390
416
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
391
417
|
title: title
|
|
392
418
|
}), description !== undefined && {
|
|
@@ -400,12 +426,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
400
426
|
}), defaultValue !== undefined && {
|
|
401
427
|
default: defaultValue
|
|
402
428
|
});
|
|
429
|
+
|
|
403
430
|
if (type === 'object') {
|
|
404
431
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
405
432
|
type: type
|
|
406
433
|
}), properties && {
|
|
407
434
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
408
435
|
});
|
|
436
|
+
|
|
409
437
|
if (patternProperties) {
|
|
410
438
|
var enhancedPatternProperties = {};
|
|
411
439
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -423,6 +451,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
423
451
|
});
|
|
424
452
|
return enhancedOptionsSchema;
|
|
425
453
|
}
|
|
454
|
+
|
|
426
455
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
427
456
|
/**
|
|
428
457
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -431,11 +460,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
431
460
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
432
461
|
* and containing `open: false` for all editor panels in editorConfig
|
|
433
462
|
*/
|
|
463
|
+
|
|
434
464
|
function enhanceConfig(vizConfig) {
|
|
435
465
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
466
|
+
|
|
436
467
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
437
468
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
438
469
|
}
|
|
470
|
+
|
|
439
471
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
440
472
|
return Object.assign(Object.assign({}, config), {
|
|
441
473
|
open: config.open || false
|
|
@@ -443,6 +475,7 @@ function enhanceConfig(vizConfig) {
|
|
|
443
475
|
});
|
|
444
476
|
return enhancedConfig;
|
|
445
477
|
}
|
|
478
|
+
|
|
446
479
|
exports.enhanceConfig = enhanceConfig;
|
|
447
480
|
/**
|
|
448
481
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -450,6 +483,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
450
483
|
* @param vizConfig a Visualization Config
|
|
451
484
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
452
485
|
*/
|
|
486
|
+
|
|
453
487
|
function uncollapseEditorConfig(vizConfig) {
|
|
454
488
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
455
489
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -459,13 +493,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
459
493
|
});
|
|
460
494
|
return editorPanelUncollapsedConfig;
|
|
461
495
|
}
|
|
496
|
+
|
|
462
497
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
498
|
+
|
|
463
499
|
function isDynamicOption(option) {
|
|
464
500
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
465
501
|
}
|
|
466
|
-
|
|
467
|
-
// private helpers to improve readability of getInitialPreset
|
|
502
|
+
|
|
503
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
468
504
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
505
|
+
|
|
469
506
|
/**
|
|
470
507
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
471
508
|
* 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
|
|
@@ -474,6 +511,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
474
511
|
*
|
|
475
512
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
476
513
|
*/
|
|
514
|
+
|
|
477
515
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
478
516
|
var presetContextKeys = Object.keys(presetContext);
|
|
479
517
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -483,6 +521,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
483
521
|
/**
|
|
484
522
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
485
523
|
*/
|
|
524
|
+
|
|
525
|
+
|
|
486
526
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
487
527
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
488
528
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -497,18 +537,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
497
537
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
498
538
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
499
539
|
*/
|
|
540
|
+
|
|
541
|
+
|
|
500
542
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
501
543
|
return presets.find(function (preset) {
|
|
502
|
-
var presetContext = lodash_1.get(preset, ['value', 'context'], {});
|
|
503
|
-
var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
|
|
544
|
+
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
545
|
+
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
504
546
|
var presetContextKeys = Object.keys(presetContext);
|
|
505
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
506
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
547
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
507
548
|
// if not, then the preset is invalid in config.ts
|
|
549
|
+
|
|
508
550
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
509
551
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
510
552
|
});
|
|
511
553
|
}
|
|
554
|
+
|
|
512
555
|
exports.getInitialPreset = getInitialPreset;
|
|
513
556
|
/**
|
|
514
557
|
* generates number precision values for a Select editor
|
|
@@ -516,14 +559,16 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
516
559
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
517
560
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
518
561
|
*/
|
|
562
|
+
|
|
519
563
|
function generatePrecisionValues(numPrecisionValues) {
|
|
520
|
-
return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
|
|
564
|
+
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
521
565
|
return {
|
|
522
566
|
label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
|
|
523
567
|
value: i
|
|
524
568
|
};
|
|
525
569
|
});
|
|
526
570
|
}
|
|
571
|
+
|
|
527
572
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
528
573
|
/**
|
|
529
574
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -533,12 +578,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
533
578
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
534
579
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
535
580
|
*/
|
|
581
|
+
|
|
536
582
|
var insertLayout = function insertLayout(layout, index) {
|
|
537
583
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
538
584
|
layoutItems[_key - 2] = arguments[_key];
|
|
539
585
|
}
|
|
586
|
+
|
|
540
587
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
541
588
|
};
|
|
589
|
+
|
|
542
590
|
exports.insertLayout = insertLayout;
|
|
543
591
|
|
|
544
592
|
/***/ }),
|
|
@@ -559,35 +607,41 @@ module.exports = require("@splunk/themes/pick");
|
|
|
559
607
|
/* 25 */
|
|
560
608
|
/***/ (function(module, exports) {
|
|
561
609
|
|
|
562
|
-
module.exports = require("@splunk/
|
|
610
|
+
module.exports = require("@splunk/ui-utils/id");
|
|
563
611
|
|
|
564
612
|
/***/ }),
|
|
565
613
|
/* 26 */
|
|
566
614
|
/***/ (function(module, exports) {
|
|
567
615
|
|
|
568
|
-
module.exports = require("@splunk/
|
|
616
|
+
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
569
617
|
|
|
570
618
|
/***/ }),
|
|
571
619
|
/* 27 */
|
|
572
620
|
/***/ (function(module, exports) {
|
|
573
621
|
|
|
622
|
+
module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
623
|
+
|
|
624
|
+
/***/ }),
|
|
625
|
+
/* 28 */
|
|
626
|
+
/***/ (function(module, exports) {
|
|
627
|
+
|
|
574
628
|
module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
|
|
575
629
|
|
|
576
630
|
/***/ }),
|
|
577
|
-
/*
|
|
578
|
-
/*
|
|
631
|
+
/* 29 */,
|
|
632
|
+
/* 30 */
|
|
579
633
|
/***/ (function(module, exports) {
|
|
580
634
|
|
|
581
635
|
module.exports = require("@splunk/visualization-encoding/Options");
|
|
582
636
|
|
|
583
637
|
/***/ }),
|
|
584
|
-
/*
|
|
638
|
+
/* 31 */
|
|
585
639
|
/***/ (function(module, exports) {
|
|
586
640
|
|
|
587
641
|
module.exports = require("@splunk/visualizations-shared/numberUtils");
|
|
588
642
|
|
|
589
643
|
/***/ }),
|
|
590
|
-
/*
|
|
644
|
+
/* 32 */
|
|
591
645
|
/***/ (function(module, exports, __webpack_require__) {
|
|
592
646
|
|
|
593
647
|
"use strict";
|
|
@@ -597,11 +651,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
597
651
|
value: true
|
|
598
652
|
});
|
|
599
653
|
exports.shouldShowIconPlaceholder = void 0;
|
|
654
|
+
|
|
600
655
|
var React = __webpack_require__(1);
|
|
656
|
+
|
|
601
657
|
var T = __webpack_require__(0);
|
|
658
|
+
|
|
602
659
|
var lodash_1 = __webpack_require__(3);
|
|
660
|
+
|
|
603
661
|
var i18n_1 = __webpack_require__(2);
|
|
662
|
+
|
|
604
663
|
var Message_1 = __webpack_require__(10);
|
|
664
|
+
|
|
605
665
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
606
666
|
/**
|
|
607
667
|
* @method shouldShowIconPlaceholder
|
|
@@ -609,14 +669,17 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
609
669
|
* @param {boolean} loading
|
|
610
670
|
* @returns {boolean}
|
|
611
671
|
*/
|
|
672
|
+
|
|
673
|
+
|
|
612
674
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
613
675
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
614
|
-
var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
|
|
676
|
+
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
615
677
|
var noData = data === undefined;
|
|
616
|
-
var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
|
|
678
|
+
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields[0]', undefined);
|
|
617
679
|
var noFields = fields === undefined;
|
|
618
680
|
return loading || noData || noFields;
|
|
619
681
|
};
|
|
682
|
+
|
|
620
683
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
621
684
|
var propTypes = {
|
|
622
685
|
icon: T.func,
|
|
@@ -631,11 +694,13 @@ var propTypes = {
|
|
|
631
694
|
* @param {IconPlaceholderProps} props
|
|
632
695
|
* @returns {React.ReactElement}
|
|
633
696
|
*/
|
|
697
|
+
|
|
634
698
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
635
699
|
var width = props.width,
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
700
|
+
height = props.height,
|
|
701
|
+
icon = props.icon,
|
|
702
|
+
iconColor = props.iconColor;
|
|
703
|
+
|
|
639
704
|
if (icon) {
|
|
640
705
|
return React.createElement(icon, {
|
|
641
706
|
style: {
|
|
@@ -650,25 +715,21 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
650
715
|
height: '50%'
|
|
651
716
|
});
|
|
652
717
|
}
|
|
718
|
+
|
|
653
719
|
return React.createElement(Message_1.default, {
|
|
654
720
|
width: width,
|
|
655
721
|
height: height,
|
|
656
722
|
level: "warning",
|
|
657
|
-
message: i18n_1._('No DataSource Connected')
|
|
723
|
+
message: (0, i18n_1._)('No DataSource Connected')
|
|
658
724
|
});
|
|
659
725
|
};
|
|
726
|
+
|
|
660
727
|
IconPlaceholder.propTypes = propTypes;
|
|
661
728
|
IconPlaceholder.defaultProps = {
|
|
662
729
|
width: '100%',
|
|
663
730
|
height: 250
|
|
664
731
|
};
|
|
665
|
-
exports.default = FixedSizeContainer_1.default(IconPlaceholder);
|
|
666
|
-
|
|
667
|
-
/***/ }),
|
|
668
|
-
/* 32 */
|
|
669
|
-
/***/ (function(module, exports) {
|
|
670
|
-
|
|
671
|
-
module.exports = require("@splunk/ui-utils/id");
|
|
732
|
+
exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
672
733
|
|
|
673
734
|
/***/ }),
|
|
674
735
|
/* 33 */
|
|
@@ -678,21 +739,27 @@ module.exports = require("@splunk/ui-utils/id");
|
|
|
678
739
|
|
|
679
740
|
|
|
680
741
|
var _defineProperty = __webpack_require__(7);
|
|
742
|
+
|
|
681
743
|
Object.defineProperty(exports, "__esModule", {
|
|
682
744
|
value: true
|
|
683
745
|
});
|
|
684
746
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
747
|
+
|
|
685
748
|
var T = __webpack_require__(0);
|
|
749
|
+
|
|
686
750
|
var lodash_1 = __webpack_require__(3);
|
|
687
|
-
|
|
751
|
+
|
|
752
|
+
var DataSource_1 = __webpack_require__(34);
|
|
753
|
+
|
|
688
754
|
exports.SortParamsPropTypes = T.shape({
|
|
689
755
|
currentSortKey: T.string,
|
|
690
756
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
691
757
|
onSort: T.func
|
|
692
758
|
});
|
|
759
|
+
|
|
693
760
|
var getSortingParams = function getSortingParams(_ref) {
|
|
694
761
|
var requestParams = _ref.requestParams,
|
|
695
|
-
|
|
762
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
696
763
|
var currentSortKey;
|
|
697
764
|
var currentSortDir;
|
|
698
765
|
var nextSortDirMap = {
|
|
@@ -701,17 +768,20 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
701
768
|
none: 'asc'
|
|
702
769
|
};
|
|
703
770
|
var onSort;
|
|
771
|
+
|
|
704
772
|
if (typeof onRequestParamsChange === 'function') {
|
|
705
|
-
if (requestParams && lodash_1.has(requestParams, 'sort')) {
|
|
773
|
+
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
706
774
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
707
775
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
708
|
-
}
|
|
709
|
-
|
|
776
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
777
|
+
|
|
778
|
+
|
|
710
779
|
onSort = function onSort(e, _ref2) {
|
|
711
780
|
var sortKey = _ref2.sortKey,
|
|
712
|
-
|
|
781
|
+
sortDir = _ref2.sortDir;
|
|
782
|
+
|
|
713
783
|
if (typeof sortKey === 'string') {
|
|
714
|
-
var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
784
|
+
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
715
785
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
716
786
|
offset: 0,
|
|
717
787
|
sort: _defineProperty({}, sortKey, nextSortDir)
|
|
@@ -721,12 +791,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
721
791
|
}
|
|
722
792
|
};
|
|
723
793
|
}
|
|
794
|
+
|
|
724
795
|
return {
|
|
725
796
|
currentSortKey: currentSortKey,
|
|
726
797
|
currentSortDir: currentSortDir,
|
|
727
798
|
onSort: onSort
|
|
728
799
|
};
|
|
729
800
|
};
|
|
801
|
+
|
|
730
802
|
exports.getSortingParams = getSortingParams;
|
|
731
803
|
|
|
732
804
|
/***/ }),
|
|
@@ -736,43 +808,68 @@ exports.getSortingParams = getSortingParams;
|
|
|
736
808
|
"use strict";
|
|
737
809
|
|
|
738
810
|
|
|
811
|
+
Object.defineProperty(exports, "__esModule", {
|
|
812
|
+
value: true
|
|
813
|
+
});
|
|
814
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
815
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
816
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
817
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
818
|
+
|
|
819
|
+
/***/ }),
|
|
820
|
+
/* 35 */
|
|
821
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
822
|
+
|
|
823
|
+
"use strict";
|
|
824
|
+
|
|
825
|
+
|
|
739
826
|
Object.defineProperty(exports, "__esModule", {
|
|
740
827
|
value: true
|
|
741
828
|
});
|
|
742
829
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
830
|
+
|
|
743
831
|
var T = __webpack_require__(0);
|
|
832
|
+
|
|
744
833
|
var lodash_1 = __webpack_require__(3);
|
|
834
|
+
|
|
745
835
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
746
836
|
isPaging: T.bool,
|
|
747
837
|
current: T.number,
|
|
748
838
|
totalPages: T.number,
|
|
749
839
|
onChange: T.func
|
|
750
840
|
});
|
|
841
|
+
|
|
751
842
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
752
843
|
var requestParams = _ref.requestParams,
|
|
753
|
-
|
|
754
|
-
|
|
844
|
+
meta = _ref.meta,
|
|
845
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
755
846
|
var totalCount = meta && meta.totalCount || 0;
|
|
756
847
|
var offset = requestParams && requestParams.offset || 0;
|
|
757
848
|
var count = requestParams && requestParams.count;
|
|
758
849
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
759
850
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
760
851
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
852
|
+
|
|
761
853
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
762
854
|
var page = _ref2.page,
|
|
763
|
-
|
|
764
|
-
var newParams = lodash_1.cloneDeep(requestParams);
|
|
855
|
+
countArg = _ref2.count;
|
|
856
|
+
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
857
|
+
|
|
765
858
|
if (typeof countArg === 'number') {
|
|
766
859
|
newParams.count = countArg;
|
|
767
860
|
newParams.offset = 0;
|
|
768
861
|
}
|
|
862
|
+
|
|
769
863
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
864
|
+
|
|
770
865
|
if (typeof page === 'number' && page > 0) {
|
|
771
866
|
newParams.count = pageCount;
|
|
772
867
|
newParams.offset = (page - 1) * pageCount;
|
|
773
868
|
}
|
|
869
|
+
|
|
774
870
|
onRequestParamsChange(newParams);
|
|
775
871
|
};
|
|
872
|
+
|
|
776
873
|
return {
|
|
777
874
|
isPaging: isPaging,
|
|
778
875
|
current: current,
|
|
@@ -780,10 +877,11 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
780
877
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
781
878
|
};
|
|
782
879
|
};
|
|
880
|
+
|
|
783
881
|
exports.getPaginationParams = getPaginationParams;
|
|
784
882
|
|
|
785
883
|
/***/ }),
|
|
786
|
-
/*
|
|
884
|
+
/* 36 */
|
|
787
885
|
/***/ (function(module, exports, __webpack_require__) {
|
|
788
886
|
|
|
789
887
|
"use strict";
|
|
@@ -794,6 +892,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
794
892
|
});
|
|
795
893
|
exports.VizCategory = void 0;
|
|
796
894
|
var VizCategory;
|
|
895
|
+
|
|
797
896
|
(function (VizCategory) {
|
|
798
897
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
799
898
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -810,67 +909,96 @@ var VizCategory;
|
|
|
810
909
|
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
811
910
|
|
|
812
911
|
/***/ }),
|
|
813
|
-
/*
|
|
912
|
+
/* 37 */
|
|
814
913
|
/***/ (function(module, exports, __webpack_require__) {
|
|
815
914
|
|
|
816
915
|
"use strict";
|
|
817
916
|
|
|
818
917
|
|
|
819
918
|
var _slicedToArray = __webpack_require__(17);
|
|
919
|
+
|
|
820
920
|
Object.defineProperty(exports, "__esModule", {
|
|
821
921
|
value: true
|
|
822
922
|
});
|
|
923
|
+
|
|
823
924
|
var React = __webpack_require__(1);
|
|
925
|
+
|
|
824
926
|
var lodash_1 = __webpack_require__(3);
|
|
825
|
-
|
|
826
|
-
var
|
|
827
|
-
|
|
828
|
-
var
|
|
829
|
-
|
|
927
|
+
|
|
928
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
929
|
+
|
|
930
|
+
var Options_1 = __webpack_require__(30);
|
|
931
|
+
|
|
932
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
933
|
+
|
|
934
|
+
var TimezoneContext_1 = __webpack_require__(26);
|
|
935
|
+
|
|
936
|
+
var moment_1 = __webpack_require__(40);
|
|
937
|
+
|
|
830
938
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
939
|
+
|
|
831
940
|
var styled_components_1 = __webpack_require__(4);
|
|
832
|
-
|
|
833
|
-
var
|
|
834
|
-
|
|
835
|
-
var
|
|
836
|
-
|
|
941
|
+
|
|
942
|
+
var hocUtils_1 = __webpack_require__(27);
|
|
943
|
+
|
|
944
|
+
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
945
|
+
|
|
946
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
947
|
+
|
|
948
|
+
var id_1 = __webpack_require__(25);
|
|
949
|
+
|
|
950
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
951
|
+
|
|
837
952
|
var VizBehavior_1 = __webpack_require__(6);
|
|
953
|
+
|
|
838
954
|
var getSorting_1 = __webpack_require__(33);
|
|
839
|
-
|
|
955
|
+
|
|
956
|
+
var getPagination_1 = __webpack_require__(35);
|
|
957
|
+
|
|
840
958
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
959
|
+
|
|
841
960
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
961
|
+
|
|
842
962
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
963
|
+
|
|
843
964
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
844
965
|
/**
|
|
845
966
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
846
967
|
* @param {DashboardVizOpts} opts
|
|
847
968
|
* @returns {HOC}
|
|
848
969
|
*/
|
|
970
|
+
|
|
971
|
+
|
|
849
972
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
850
973
|
var ReactViz = opts.ReactViz,
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
var
|
|
974
|
+
vizConfig = opts.vizConfig,
|
|
975
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
976
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
977
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
978
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
979
|
+
|
|
980
|
+
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
981
|
+
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
982
|
+
|
|
858
983
|
var DashboardViz = function DashboardViz(props) {
|
|
859
984
|
var _a;
|
|
985
|
+
|
|
860
986
|
var mode = props.mode,
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
987
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
988
|
+
dataSources = props.dataSources,
|
|
989
|
+
options = props.options,
|
|
990
|
+
_props$context = props.context,
|
|
991
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
992
|
+
width = props.width,
|
|
993
|
+
height = props.height,
|
|
994
|
+
onComputedProps = props.onComputedProps,
|
|
995
|
+
onEventTrigger = props.onEventTrigger,
|
|
996
|
+
theme = props.theme,
|
|
997
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
998
|
+
|
|
872
999
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
873
|
-
|
|
1000
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1001
|
+
|
|
874
1002
|
if (serializedTimezone) {
|
|
875
1003
|
/*
|
|
876
1004
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -884,44 +1012,58 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
884
1012
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
885
1013
|
}
|
|
886
1014
|
}
|
|
1015
|
+
|
|
887
1016
|
var themeFunc = function themeFunc(themeVar) {
|
|
888
1017
|
var _a, _b;
|
|
1018
|
+
|
|
889
1019
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
890
1020
|
};
|
|
1021
|
+
|
|
891
1022
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1023
|
+
|
|
1024
|
+
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
1025
|
+
theme: theme
|
|
1026
|
+
}),
|
|
1027
|
+
currentThemeFamily = _ref.family,
|
|
1028
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1029
|
+
currentThemeDensity = _ref.density;
|
|
1030
|
+
|
|
898
1031
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1032
|
+
|
|
899
1033
|
var _React$useState = React.useState({}),
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1034
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1035
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1036
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1037
|
+
|
|
1038
|
+
|
|
903
1039
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1040
|
+
|
|
1041
|
+
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
1042
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1043
|
+
visualizationID = _React$useState4[0];
|
|
1044
|
+
|
|
907
1045
|
var _React$useState5 = React.useState({}),
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1046
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1047
|
+
dataSourcesInState = _React$useState6[0],
|
|
1048
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1049
|
+
|
|
911
1050
|
var _React$useState7 = React.useState(),
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1051
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1052
|
+
dataFramesInState = _React$useState8[0],
|
|
1053
|
+
setDataFramesInState = _React$useState8[1];
|
|
1054
|
+
|
|
1055
|
+
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1056
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1057
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1058
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1059
|
+
|
|
1060
|
+
var isMounted = React.useRef(true);
|
|
1061
|
+
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
920
1062
|
try {
|
|
921
1063
|
if (useAsyncEvaluatedOptions) {
|
|
922
1064
|
var optionsToEvaluate = {
|
|
923
|
-
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
924
|
-
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
1065
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1066
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
925
1067
|
};
|
|
926
1068
|
var asyncDynamicOptionsEvaluatorParams = {
|
|
927
1069
|
visualizationID: visualizationID,
|
|
@@ -932,21 +1074,23 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
932
1074
|
};
|
|
933
1075
|
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
934
1076
|
setEvaluatedOptionsAsync(results.results);
|
|
935
|
-
}).catch(function (
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1077
|
+
}).catch(function () {
|
|
1078
|
+
if (isMounted.current) {
|
|
1079
|
+
setUseAsyncEvaluatedOptions(false);
|
|
1080
|
+
}
|
|
939
1081
|
});
|
|
940
1082
|
} else {
|
|
941
1083
|
var dataFrames = dataFramesInState;
|
|
1084
|
+
|
|
942
1085
|
if (dataSources !== dataSourcesInState) {
|
|
943
1086
|
setDataSourcesInState(dataSources);
|
|
944
1087
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
945
1088
|
setDataFramesInState(dataFrames);
|
|
946
1089
|
}
|
|
1090
|
+
|
|
947
1091
|
return Options_1.Options.evaluate({
|
|
948
|
-
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
949
|
-
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
1092
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1093
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
950
1094
|
}, dataSources, themeFunc, dataFrames);
|
|
951
1095
|
}
|
|
952
1096
|
} catch (e) {
|
|
@@ -954,67 +1098,76 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
954
1098
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
955
1099
|
return {};
|
|
956
1100
|
}
|
|
1101
|
+
|
|
957
1102
|
return {};
|
|
958
1103
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
959
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
960
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1104
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
961
1105
|
// 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
|
|
962
1106
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1107
|
+
|
|
963
1108
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
964
1109
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1110
|
+
|
|
965
1111
|
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) {
|
|
966
1112
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
967
1113
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
968
1114
|
});
|
|
969
|
-
}
|
|
970
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1115
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
971
1116
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1117
|
+
|
|
1118
|
+
|
|
972
1119
|
React.useEffect(function () {
|
|
973
1120
|
onComputedProps(clonedEvaluatedOptions);
|
|
974
1121
|
});
|
|
975
1122
|
React.useEffect(function () {
|
|
976
1123
|
return function () {
|
|
977
1124
|
if (useAsyncEvaluatedOptions) {
|
|
1125
|
+
isMounted.current = false;
|
|
978
1126
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
979
1127
|
}
|
|
980
|
-
};
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
// present warning message if any required props are missing
|
|
1128
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1129
|
+
}, []); // present warning message if any required props are missing
|
|
1130
|
+
|
|
984
1131
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptionsToUse);
|
|
1132
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1133
|
+
supports = vizConfig.supports;
|
|
1134
|
+
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1135
|
+
|
|
988
1136
|
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
|
|
989
1137
|
) {
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1138
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1139
|
+
"data-test": "missing-props-message",
|
|
1140
|
+
width: width,
|
|
1141
|
+
height: height,
|
|
1142
|
+
missingProps: missing,
|
|
1143
|
+
backgroundColor: bgColorFromTheme
|
|
1144
|
+
});
|
|
1145
|
+
} // events
|
|
1146
|
+
|
|
1147
|
+
|
|
999
1148
|
var eventCallbackProps = {};
|
|
1149
|
+
|
|
1000
1150
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1001
1151
|
var supportedEvents = vizConfig.events;
|
|
1002
1152
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1003
|
-
var eventCallbackPropName = lodash_1.camelCase("on.".concat(eventName));
|
|
1004
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1005
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1153
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1154
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1006
1155
|
// then remove these lines
|
|
1156
|
+
|
|
1007
1157
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1008
1158
|
var payload = {};
|
|
1159
|
+
|
|
1009
1160
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1010
1161
|
payloadKeys.forEach(function (p) {
|
|
1011
1162
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1012
1163
|
});
|
|
1013
1164
|
}
|
|
1165
|
+
|
|
1014
1166
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1015
1167
|
if (ev && ev.payload) {
|
|
1016
1168
|
payload = ev.payload;
|
|
1017
1169
|
}
|
|
1170
|
+
|
|
1018
1171
|
return onEventTrigger({
|
|
1019
1172
|
originalEvent: ev,
|
|
1020
1173
|
payload: payload,
|
|
@@ -1022,8 +1175,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1022
1175
|
});
|
|
1023
1176
|
};
|
|
1024
1177
|
});
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1178
|
+
} // compute pure viz props which are not from options
|
|
1179
|
+
|
|
1180
|
+
|
|
1027
1181
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1028
1182
|
themeFunc: themeFunc
|
|
1029
1183
|
}));
|
|
@@ -1041,21 +1195,25 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1041
1195
|
* In future, we could automatically detect which all datasources are being used
|
|
1042
1196
|
* and bind those magically to pagination/sorting behavior.
|
|
1043
1197
|
*/
|
|
1198
|
+
|
|
1044
1199
|
var dataSourceMetadata = {};
|
|
1045
1200
|
var OptionKey = 'paginateDataSourceKey';
|
|
1046
|
-
var paginateDataSourceKey = lodash_1.has(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
var
|
|
1201
|
+
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1202
|
+
|
|
1203
|
+
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1204
|
+
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1205
|
+
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1206
|
+
|
|
1050
1207
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1051
1208
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1052
1209
|
};
|
|
1053
|
-
|
|
1210
|
+
|
|
1211
|
+
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1054
1212
|
requestParams: requestParams,
|
|
1055
1213
|
meta: meta,
|
|
1056
1214
|
onRequestParamsChange: handleRequestParamsChange
|
|
1057
1215
|
});
|
|
1058
|
-
var paginatorParams = getPagination_1.getPaginationParams({
|
|
1216
|
+
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
1059
1217
|
requestParams: requestParams,
|
|
1060
1218
|
meta: meta,
|
|
1061
1219
|
onRequestParamsChange: handleRequestParamsChange
|
|
@@ -1064,103 +1222,120 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1064
1222
|
sortParams: sortParams,
|
|
1065
1223
|
paginatorParams: paginatorParams
|
|
1066
1224
|
};
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1225
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1226
|
+
|
|
1227
|
+
|
|
1069
1228
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1070
1229
|
return null;
|
|
1071
1230
|
}
|
|
1231
|
+
|
|
1072
1232
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1073
1233
|
mode: mode,
|
|
1074
1234
|
width: width,
|
|
1075
1235
|
height: height
|
|
1076
1236
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1077
1237
|
};
|
|
1238
|
+
|
|
1078
1239
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1079
1240
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1080
1241
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1081
1242
|
theme: {}
|
|
1082
|
-
});
|
|
1083
|
-
|
|
1084
|
-
DashboardViz.config = vizConfig;
|
|
1085
|
-
|
|
1086
|
-
return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1243
|
+
}); // attach viz config
|
|
1244
|
+
|
|
1245
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1246
|
+
|
|
1247
|
+
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1087
1248
|
};
|
|
1249
|
+
|
|
1088
1250
|
exports.default = withDashboardViz;
|
|
1089
1251
|
|
|
1090
1252
|
/***/ }),
|
|
1091
|
-
/*
|
|
1253
|
+
/* 38 */
|
|
1092
1254
|
/***/ (function(module, exports) {
|
|
1093
1255
|
|
|
1094
1256
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1095
1257
|
|
|
1096
1258
|
/***/ }),
|
|
1097
|
-
/*
|
|
1259
|
+
/* 39 */
|
|
1098
1260
|
/***/ (function(module, exports) {
|
|
1099
1261
|
|
|
1100
1262
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1101
1263
|
|
|
1102
1264
|
/***/ }),
|
|
1103
|
-
/*
|
|
1265
|
+
/* 40 */
|
|
1104
1266
|
/***/ (function(module, exports) {
|
|
1105
1267
|
|
|
1106
1268
|
module.exports = require("@splunk/moment");
|
|
1107
1269
|
|
|
1108
1270
|
/***/ }),
|
|
1109
|
-
/*
|
|
1271
|
+
/* 41 */
|
|
1110
1272
|
/***/ (function(module, exports) {
|
|
1111
1273
|
|
|
1112
1274
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1113
1275
|
|
|
1114
1276
|
/***/ }),
|
|
1115
|
-
/*
|
|
1277
|
+
/* 42 */
|
|
1116
1278
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1117
1279
|
|
|
1118
1280
|
"use strict";
|
|
1119
1281
|
|
|
1120
1282
|
|
|
1121
1283
|
var _classCallCheck = __webpack_require__(9);
|
|
1284
|
+
|
|
1122
1285
|
Object.defineProperty(exports, "__esModule", {
|
|
1123
1286
|
value: true
|
|
1124
1287
|
});
|
|
1125
1288
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1126
1289
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1290
|
+
|
|
1127
1291
|
var T = __webpack_require__(0);
|
|
1292
|
+
|
|
1128
1293
|
var lodash_1 = __webpack_require__(3);
|
|
1129
|
-
|
|
1130
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1294
|
+
|
|
1295
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1296
|
+
|
|
1297
|
+
|
|
1131
1298
|
exports.INITIAL_WIDTH = 250;
|
|
1132
1299
|
exports.INITIAL_HEIGHT = 250;
|
|
1133
1300
|
/**
|
|
1134
1301
|
* A Splunk visualization
|
|
1135
1302
|
*/
|
|
1303
|
+
|
|
1136
1304
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1137
1305
|
_classCallCheck(this, SplunkVisualization);
|
|
1138
1306
|
};
|
|
1307
|
+
|
|
1139
1308
|
SplunkVisualization.propTypes = {
|
|
1140
1309
|
/**
|
|
1141
1310
|
* display mode
|
|
1142
1311
|
*/
|
|
1143
1312
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1313
|
+
|
|
1144
1314
|
/**
|
|
1145
1315
|
* width in pixel or string, defaults to 100%
|
|
1146
1316
|
*/
|
|
1147
1317
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1318
|
+
|
|
1148
1319
|
/**
|
|
1149
1320
|
* height in pixel or string
|
|
1150
1321
|
*/
|
|
1151
1322
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1323
|
+
|
|
1152
1324
|
/**
|
|
1153
1325
|
* visualization context used for dynamic option evaluation
|
|
1154
1326
|
*/
|
|
1155
1327
|
context: T.object,
|
|
1328
|
+
|
|
1156
1329
|
/**
|
|
1157
1330
|
* visualization formatting options
|
|
1158
1331
|
*/
|
|
1159
1332
|
options: T.object,
|
|
1333
|
+
|
|
1160
1334
|
/**
|
|
1161
1335
|
* A callback to update formatting options
|
|
1162
1336
|
*/
|
|
1163
1337
|
onOptionsChange: T.func,
|
|
1338
|
+
|
|
1164
1339
|
/**
|
|
1165
1340
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1166
1341
|
*/
|
|
@@ -1169,6 +1344,7 @@ SplunkVisualization.propTypes = {
|
|
|
1169
1344
|
* current request params
|
|
1170
1345
|
*/
|
|
1171
1346
|
requestParams: T.object,
|
|
1347
|
+
|
|
1172
1348
|
/**
|
|
1173
1349
|
* current dataset
|
|
1174
1350
|
*/
|
|
@@ -1176,6 +1352,7 @@ SplunkVisualization.propTypes = {
|
|
|
1176
1352
|
fields: T.array,
|
|
1177
1353
|
columns: T.array
|
|
1178
1354
|
}),
|
|
1355
|
+
|
|
1179
1356
|
/**
|
|
1180
1357
|
* error
|
|
1181
1358
|
*/
|
|
@@ -1183,29 +1360,35 @@ SplunkVisualization.propTypes = {
|
|
|
1183
1360
|
level: T.string,
|
|
1184
1361
|
message: T.string
|
|
1185
1362
|
}),
|
|
1363
|
+
|
|
1186
1364
|
/**
|
|
1187
1365
|
* meta data that came with the dataset
|
|
1188
1366
|
*/
|
|
1189
1367
|
meta: T.object
|
|
1190
1368
|
})),
|
|
1369
|
+
|
|
1191
1370
|
/**
|
|
1192
1371
|
* A callback to trigger event
|
|
1193
1372
|
*/
|
|
1194
1373
|
onEventTrigger: T.func,
|
|
1374
|
+
|
|
1195
1375
|
/**
|
|
1196
1376
|
* Inform viz if there are handlers listening to events
|
|
1197
1377
|
*/
|
|
1198
1378
|
hasEventHandlers: T.bool,
|
|
1379
|
+
|
|
1199
1380
|
/**
|
|
1200
1381
|
* A callback to communicate computed props to a consumer
|
|
1201
1382
|
*/
|
|
1202
1383
|
onComputedProps: T.func,
|
|
1384
|
+
|
|
1203
1385
|
/**
|
|
1204
1386
|
* A callback to obtain visualization api
|
|
1205
1387
|
*/
|
|
1206
1388
|
vizActionHandlerRef: T.func,
|
|
1207
1389
|
loading: T.bool,
|
|
1208
1390
|
theme: T.object,
|
|
1391
|
+
|
|
1209
1392
|
/**
|
|
1210
1393
|
* A callback to request new data with updated request params
|
|
1211
1394
|
*/
|
|
@@ -1214,6 +1397,7 @@ SplunkVisualization.propTypes = {
|
|
|
1214
1397
|
/**
|
|
1215
1398
|
*
|
|
1216
1399
|
*/
|
|
1400
|
+
|
|
1217
1401
|
SplunkVisualization.defaultProps = {
|
|
1218
1402
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1219
1403
|
width: '100%',
|
|
@@ -1241,26 +1425,29 @@ SplunkVisualization.defaultProps = {
|
|
|
1241
1425
|
exports.default = SplunkVisualization;
|
|
1242
1426
|
|
|
1243
1427
|
/***/ }),
|
|
1244
|
-
/*
|
|
1428
|
+
/* 43 */
|
|
1245
1429
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1246
1430
|
|
|
1247
1431
|
"use strict";
|
|
1248
1432
|
|
|
1249
1433
|
|
|
1250
1434
|
var _classCallCheck = __webpack_require__(9);
|
|
1435
|
+
|
|
1251
1436
|
var _createClass = __webpack_require__(18);
|
|
1437
|
+
|
|
1252
1438
|
Object.defineProperty(exports, "__esModule", {
|
|
1253
1439
|
value: true
|
|
1254
1440
|
});
|
|
1255
1441
|
exports.DefaultVizActionHandler = void 0;
|
|
1442
|
+
|
|
1256
1443
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1257
1444
|
function DefaultVizActionHandler() {
|
|
1258
1445
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1259
1446
|
}
|
|
1447
|
+
|
|
1260
1448
|
_createClass(DefaultVizActionHandler, [{
|
|
1261
1449
|
key: "focus",
|
|
1262
|
-
value: function focus() {
|
|
1263
|
-
// noop
|
|
1450
|
+
value: function focus() {// noop
|
|
1264
1451
|
}
|
|
1265
1452
|
}, {
|
|
1266
1453
|
key: "snapshot",
|
|
@@ -1268,22 +1455,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1268
1455
|
return null; // noop
|
|
1269
1456
|
}
|
|
1270
1457
|
}]);
|
|
1458
|
+
|
|
1271
1459
|
return DefaultVizActionHandler;
|
|
1272
1460
|
}();
|
|
1273
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1274
|
-
|
|
1275
|
-
/***/ }),
|
|
1276
|
-
/* 43 */
|
|
1277
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1278
1461
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1283
|
-
value: true
|
|
1284
|
-
});
|
|
1285
|
-
exports.validSortDirs = void 0;
|
|
1286
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1462
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1287
1463
|
|
|
1288
1464
|
/***/ }),
|
|
1289
1465
|
/* 44 */
|
|
@@ -1296,7 +1472,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1296
1472
|
value: true
|
|
1297
1473
|
});
|
|
1298
1474
|
exports.useDeepMemo = void 0;
|
|
1475
|
+
|
|
1299
1476
|
var react_1 = __webpack_require__(1);
|
|
1477
|
+
|
|
1300
1478
|
var lodash_1 = __webpack_require__(3);
|
|
1301
1479
|
/**
|
|
1302
1480
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1311,16 +1489,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1311
1489
|
* @param fn the function to be executed and
|
|
1312
1490
|
* @param dependencies an array of dependencies
|
|
1313
1491
|
*/
|
|
1492
|
+
|
|
1493
|
+
|
|
1314
1494
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1315
|
-
var ref = react_1.useRef();
|
|
1316
|
-
|
|
1495
|
+
var ref = (0, react_1.useRef)();
|
|
1496
|
+
|
|
1497
|
+
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1317
1498
|
ref.current = {
|
|
1318
1499
|
dependencies: dependencies,
|
|
1319
1500
|
value: fn()
|
|
1320
1501
|
};
|
|
1321
1502
|
}
|
|
1503
|
+
|
|
1322
1504
|
return ref.current.value;
|
|
1323
1505
|
};
|
|
1506
|
+
|
|
1324
1507
|
exports.useDeepMemo = useDeepMemo;
|
|
1325
1508
|
|
|
1326
1509
|
/***/ }),
|
|
@@ -1334,19 +1517,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1334
1517
|
value: true
|
|
1335
1518
|
});
|
|
1336
1519
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
1520
|
+
|
|
1337
1521
|
var React = __webpack_require__(1);
|
|
1522
|
+
|
|
1338
1523
|
var T = __webpack_require__(0);
|
|
1524
|
+
|
|
1339
1525
|
var i18n_1 = __webpack_require__(2);
|
|
1526
|
+
|
|
1340
1527
|
var Message_1 = __webpack_require__(10);
|
|
1528
|
+
|
|
1341
1529
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1342
1530
|
/**
|
|
1343
1531
|
* @method isMissing
|
|
1344
1532
|
* @param {any} v
|
|
1345
1533
|
* @returns {boolean} true if the input value === null or undefined
|
|
1346
1534
|
*/
|
|
1535
|
+
|
|
1536
|
+
|
|
1347
1537
|
var isMissing = function isMissing(v) {
|
|
1348
1538
|
return v === null || v === undefined;
|
|
1349
1539
|
};
|
|
1540
|
+
|
|
1350
1541
|
exports.isMissing = isMissing;
|
|
1351
1542
|
/**
|
|
1352
1543
|
* @method misskingKeys
|
|
@@ -1354,11 +1545,13 @@ exports.isMissing = isMissing;
|
|
|
1354
1545
|
* @param {object} target
|
|
1355
1546
|
* @returns {string[]} the keys of missing required props
|
|
1356
1547
|
*/
|
|
1548
|
+
|
|
1357
1549
|
var missingKeys = function missingKeys(keys, target) {
|
|
1358
1550
|
return keys.filter(function (k) {
|
|
1359
|
-
return exports.isMissing(target[k]);
|
|
1551
|
+
return (0, exports.isMissing)(target[k]);
|
|
1360
1552
|
});
|
|
1361
1553
|
};
|
|
1554
|
+
|
|
1362
1555
|
exports.missingKeys = missingKeys;
|
|
1363
1556
|
var propTypes = {
|
|
1364
1557
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1372,24 +1565,26 @@ var propTypes = {
|
|
|
1372
1565
|
* @param {MissingPropsProps} props
|
|
1373
1566
|
* @returns {React.ReactElement}
|
|
1374
1567
|
*/
|
|
1568
|
+
|
|
1375
1569
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1376
1570
|
var width = props.width,
|
|
1377
|
-
|
|
1378
|
-
|
|
1571
|
+
height = props.height,
|
|
1572
|
+
missingProps = props.missingProps;
|
|
1379
1573
|
return React.createElement(Message_1.default, {
|
|
1380
1574
|
"data-test": "message",
|
|
1381
1575
|
width: width,
|
|
1382
1576
|
height: height,
|
|
1383
|
-
message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
|
|
1577
|
+
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1384
1578
|
});
|
|
1385
1579
|
};
|
|
1580
|
+
|
|
1386
1581
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1387
1582
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1388
1583
|
exports.MissingPropsMessage.defaultProps = {
|
|
1389
1584
|
width: '100%',
|
|
1390
1585
|
height: 250
|
|
1391
1586
|
};
|
|
1392
|
-
exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
1587
|
+
exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
|
|
1393
1588
|
|
|
1394
1589
|
/***/ }),
|
|
1395
1590
|
/* 46 */
|
|
@@ -1401,15 +1596,19 @@ exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
|
1401
1596
|
Object.defineProperty(exports, "__esModule", {
|
|
1402
1597
|
value: true
|
|
1403
1598
|
});
|
|
1599
|
+
|
|
1404
1600
|
var React = __webpack_require__(1);
|
|
1601
|
+
|
|
1405
1602
|
var styled_components_1 = __webpack_require__(4);
|
|
1603
|
+
|
|
1406
1604
|
var hocUtils_1 = __webpack_require__(15);
|
|
1605
|
+
|
|
1407
1606
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1408
1607
|
displayName: "withEditModeCover__Cover",
|
|
1409
1608
|
componentId: "sc-1gsbnxb-0"
|
|
1410
1609
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1411
1610
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1412
|
-
'data-splunk-visualization-version': "
|
|
1611
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
1413
1612
|
}).withConfig({
|
|
1414
1613
|
displayName: "withEditModeCover__Blocker",
|
|
1415
1614
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1420,6 +1619,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1420
1619
|
* @param {ExtendedDashViz} Visualization
|
|
1421
1620
|
* @returns {ExtendedDashViz} Wrapper
|
|
1422
1621
|
*/
|
|
1622
|
+
|
|
1423
1623
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1424
1624
|
var Wrapper = function Wrapper(props) {
|
|
1425
1625
|
var mode = props.mode;
|
|
@@ -1428,12 +1628,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1428
1628
|
"data-test": "edit-mode-cover"
|
|
1429
1629
|
}));
|
|
1430
1630
|
};
|
|
1431
|
-
|
|
1631
|
+
|
|
1632
|
+
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1432
1633
|
Wrapper: Wrapper,
|
|
1433
1634
|
Visualization: Visualization
|
|
1434
1635
|
});
|
|
1435
1636
|
return Wrapper;
|
|
1436
1637
|
};
|
|
1638
|
+
|
|
1437
1639
|
exports.default = withEditModeCover;
|
|
1438
1640
|
|
|
1439
1641
|
/***/ }),
|
|
@@ -1446,27 +1648,37 @@ exports.default = withEditModeCover;
|
|
|
1446
1648
|
Object.defineProperty(exports, "__esModule", {
|
|
1447
1649
|
value: true
|
|
1448
1650
|
});
|
|
1651
|
+
|
|
1449
1652
|
var React = __webpack_require__(1);
|
|
1653
|
+
|
|
1450
1654
|
var colorUtils_1 = __webpack_require__(12);
|
|
1655
|
+
|
|
1451
1656
|
var variables_1 = __webpack_require__(11);
|
|
1452
|
-
|
|
1657
|
+
|
|
1658
|
+
var IconPlaceholder_1 = __webpack_require__(32);
|
|
1659
|
+
|
|
1453
1660
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1661
|
+
|
|
1454
1662
|
var hocUtils_1 = __webpack_require__(15);
|
|
1663
|
+
|
|
1455
1664
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1456
1665
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1457
1666
|
var config = Visualization.config;
|
|
1458
1667
|
var themes = config.themes;
|
|
1668
|
+
|
|
1459
1669
|
var Wrapper = function Wrapper(props) {
|
|
1460
1670
|
var _a, _b;
|
|
1671
|
+
|
|
1461
1672
|
var dataSources = props.dataSources,
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1673
|
+
loading = props.loading,
|
|
1674
|
+
options = props.options,
|
|
1675
|
+
height = props.height,
|
|
1676
|
+
width = props.width;
|
|
1466
1677
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
1467
|
-
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);
|
|
1678
|
+
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);
|
|
1468
1679
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
1469
1680
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
1681
|
+
|
|
1470
1682
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
1471
1683
|
return React.createElement(IconPlaceholder_1.default, {
|
|
1472
1684
|
"data-test": "icon-placeholder",
|
|
@@ -1477,25 +1689,28 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
1477
1689
|
iconColor: iconColor
|
|
1478
1690
|
});
|
|
1479
1691
|
}
|
|
1692
|
+
|
|
1480
1693
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
1481
1694
|
};
|
|
1482
|
-
|
|
1695
|
+
|
|
1696
|
+
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1483
1697
|
Wrapper: Wrapper,
|
|
1484
1698
|
Visualization: Visualization
|
|
1485
1699
|
});
|
|
1486
1700
|
return Wrapper;
|
|
1487
1701
|
};
|
|
1702
|
+
|
|
1488
1703
|
exports.default = withPlaceholder;
|
|
1489
1704
|
|
|
1490
1705
|
/***/ }),
|
|
1491
1706
|
/* 48 */,
|
|
1492
|
-
/* 49
|
|
1707
|
+
/* 49 */,
|
|
1708
|
+
/* 50 */
|
|
1493
1709
|
/***/ (function(module, exports) {
|
|
1494
1710
|
|
|
1495
1711
|
module.exports = require("@splunk/visualization-icons/placeholders");
|
|
1496
1712
|
|
|
1497
1713
|
/***/ }),
|
|
1498
|
-
/* 50 */,
|
|
1499
1714
|
/* 51 */,
|
|
1500
1715
|
/* 52 */
|
|
1501
1716
|
/***/ (function(module, exports) {
|
|
@@ -1512,13 +1727,15 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
1512
1727
|
Object.defineProperty(exports, "__esModule", {
|
|
1513
1728
|
value: true
|
|
1514
1729
|
});
|
|
1730
|
+
|
|
1515
1731
|
var i18n_1 = __webpack_require__(2);
|
|
1732
|
+
|
|
1516
1733
|
var background = function background(_ref) {
|
|
1517
1734
|
var label = _ref.label,
|
|
1518
|
-
|
|
1519
|
-
|
|
1735
|
+
themes = _ref.themes,
|
|
1736
|
+
labelPosition = _ref.labelPosition;
|
|
1520
1737
|
return [{
|
|
1521
|
-
label: i18n_1._(label || 'Background'),
|
|
1738
|
+
label: (0, i18n_1._)(label || 'Background'),
|
|
1522
1739
|
option: 'backgroundColor',
|
|
1523
1740
|
editor: 'editor.color',
|
|
1524
1741
|
editorProps: {
|
|
@@ -1527,6 +1744,7 @@ var background = function background(_ref) {
|
|
|
1527
1744
|
}
|
|
1528
1745
|
}];
|
|
1529
1746
|
};
|
|
1747
|
+
|
|
1530
1748
|
exports.default = background;
|
|
1531
1749
|
|
|
1532
1750
|
/***/ }),
|
|
@@ -1538,17 +1756,22 @@ exports.default = background;
|
|
|
1538
1756
|
/* 59 */
|
|
1539
1757
|
/***/ (function(module, exports) {
|
|
1540
1758
|
|
|
1759
|
+
module.exports = require("@babel/runtime/helpers/taggedTemplateLiteral");
|
|
1760
|
+
|
|
1761
|
+
/***/ }),
|
|
1762
|
+
/* 60 */
|
|
1763
|
+
/***/ (function(module, exports) {
|
|
1764
|
+
|
|
1541
1765
|
module.exports = require("@splunk/themes");
|
|
1542
1766
|
|
|
1543
1767
|
/***/ }),
|
|
1544
|
-
/*
|
|
1545
|
-
/*
|
|
1768
|
+
/* 61 */,
|
|
1769
|
+
/* 62 */
|
|
1546
1770
|
/***/ (function(module, exports) {
|
|
1547
1771
|
|
|
1548
1772
|
module.exports = require("@splunk/react-ui/Popover");
|
|
1549
1773
|
|
|
1550
1774
|
/***/ }),
|
|
1551
|
-
/* 62 */,
|
|
1552
1775
|
/* 63 */,
|
|
1553
1776
|
/* 64 */,
|
|
1554
1777
|
/* 65 */,
|
|
@@ -1568,7 +1791,12 @@ module.exports = require("@splunk/react-ui/Popover");
|
|
|
1568
1791
|
/* 79 */,
|
|
1569
1792
|
/* 80 */,
|
|
1570
1793
|
/* 81 */,
|
|
1571
|
-
/* 82
|
|
1794
|
+
/* 82 */
|
|
1795
|
+
/***/ (function(module, exports) {
|
|
1796
|
+
|
|
1797
|
+
module.exports = require("@babel/runtime/helpers/typeof");
|
|
1798
|
+
|
|
1799
|
+
/***/ }),
|
|
1572
1800
|
/* 83 */,
|
|
1573
1801
|
/* 84 */,
|
|
1574
1802
|
/* 85 */,
|
|
@@ -1579,21 +1807,16 @@ module.exports = require("@splunk/react-ui/Popover");
|
|
|
1579
1807
|
/* 90 */,
|
|
1580
1808
|
/* 91 */,
|
|
1581
1809
|
/* 92 */,
|
|
1582
|
-
/* 93
|
|
1583
|
-
/***/ (function(module, exports) {
|
|
1584
|
-
|
|
1585
|
-
module.exports = require("@babel/runtime/helpers/typeof");
|
|
1586
|
-
|
|
1587
|
-
/***/ }),
|
|
1810
|
+
/* 93 */,
|
|
1588
1811
|
/* 94 */,
|
|
1589
1812
|
/* 95 */,
|
|
1590
|
-
/* 96
|
|
1813
|
+
/* 96 */,
|
|
1814
|
+
/* 97 */
|
|
1591
1815
|
/***/ (function(module, exports) {
|
|
1592
1816
|
|
|
1593
1817
|
module.exports = require("@splunk/visualizations-shared/dataSourceUtils");
|
|
1594
1818
|
|
|
1595
1819
|
/***/ }),
|
|
1596
|
-
/* 97 */,
|
|
1597
1820
|
/* 98 */,
|
|
1598
1821
|
/* 99 */,
|
|
1599
1822
|
/* 100 */,
|
|
@@ -1614,30 +1837,39 @@ module.exports = require("@splunk/visualizations-shared/dataSourceUtils");
|
|
|
1614
1837
|
/* 115 */,
|
|
1615
1838
|
/* 116 */,
|
|
1616
1839
|
/* 117 */,
|
|
1617
|
-
/* 118
|
|
1840
|
+
/* 118 */,
|
|
1841
|
+
/* 119 */
|
|
1618
1842
|
/***/ (function(module, exports) {
|
|
1619
1843
|
|
|
1620
1844
|
module.exports = require("@splunk/react-ui/Menu");
|
|
1621
1845
|
|
|
1622
1846
|
/***/ }),
|
|
1623
|
-
/*
|
|
1847
|
+
/* 120 */
|
|
1624
1848
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1625
1849
|
|
|
1626
1850
|
"use strict";
|
|
1627
1851
|
|
|
1628
1852
|
|
|
1629
|
-
var _typeof = __webpack_require__(
|
|
1853
|
+
var _typeof = __webpack_require__(82);
|
|
1854
|
+
|
|
1630
1855
|
var _slicedToArray = __webpack_require__(17);
|
|
1856
|
+
|
|
1631
1857
|
var _toConsumableArray = __webpack_require__(8);
|
|
1858
|
+
|
|
1632
1859
|
var _defineProperty = __webpack_require__(7);
|
|
1860
|
+
|
|
1633
1861
|
Object.defineProperty(exports, "__esModule", {
|
|
1634
1862
|
value: true
|
|
1635
1863
|
});
|
|
1636
|
-
exports.truncateString = exports.getCustomTimeInterval = exports.getPredefinedTimeInterval = exports.getEpochTime = exports.generateTokenReplacementMap = exports.replaceTokens = exports.mergeFieldActions = exports.mergeEventActions = exports.getFieldSummaryMapping = exports.convertToPayloadFormat = void 0;
|
|
1637
|
-
|
|
1864
|
+
exports.combineHighlighted = exports.convertToHighlightValuesByFieldMap = exports.truncateString = exports.getCustomTimeInterval = exports.getPredefinedTimeInterval = exports.getEpochTime = exports.generateTokenReplacementMap = exports.replaceTokens = exports.mergeFieldActions = exports.mergeEventActions = exports.getFieldSummaryMapping = exports.convertToPayloadFormat = void 0;
|
|
1865
|
+
|
|
1866
|
+
var time_1 = __webpack_require__(206);
|
|
1867
|
+
|
|
1638
1868
|
var lodash_1 = __webpack_require__(3);
|
|
1639
|
-
|
|
1640
|
-
// util to convert a field-value map into an object with row.<fieldname>.value keys for payloads
|
|
1869
|
+
|
|
1870
|
+
var dataUtils_1 = __webpack_require__(121); // util to convert a field-value map into an object with row.<fieldname>.value keys for payloads
|
|
1871
|
+
|
|
1872
|
+
|
|
1641
1873
|
var convertToPayloadFormat = function convertToPayloadFormat(obj) {
|
|
1642
1874
|
var initialValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1643
1875
|
if (!obj) return {};
|
|
@@ -1646,11 +1878,13 @@ var convertToPayloadFormat = function convertToPayloadFormat(obj) {
|
|
|
1646
1878
|
return Object.assign(Object.assign({}, acc), _defineProperty({}, key, obj[curr]));
|
|
1647
1879
|
}, initialValue);
|
|
1648
1880
|
};
|
|
1881
|
+
|
|
1649
1882
|
exports.convertToPayloadFormat = convertToPayloadFormat;
|
|
1883
|
+
|
|
1650
1884
|
var getFieldSummaryMapping = function getFieldSummaryMapping(columns, fields) {
|
|
1651
1885
|
// convert the `fieldsummary` payload to an array of objects
|
|
1652
|
-
var arr = dataUtils_1.convertToArrOfObjects(columns, fields);
|
|
1653
|
-
|
|
1886
|
+
var arr = (0, dataUtils_1.convertToArrOfObjects)(columns, fields); // forms an array of FieldData elements expected by the @splunk/react-field-summary component
|
|
1887
|
+
|
|
1654
1888
|
var fieldSummaryData = arr.map(function (d) {
|
|
1655
1889
|
return {
|
|
1656
1890
|
name: d.field,
|
|
@@ -1663,13 +1897,14 @@ var getFieldSummaryMapping = function getFieldSummaryMapping(columns, fields) {
|
|
|
1663
1897
|
stdev: d.stdev === null ? null : +d.stdev,
|
|
1664
1898
|
modes: JSON.parse(d.values)
|
|
1665
1899
|
};
|
|
1666
|
-
});
|
|
1667
|
-
|
|
1900
|
+
}); // creates a map of field name to its data for O(1) retrieval in the tooltip component
|
|
1901
|
+
|
|
1668
1902
|
var fieldSummaryMapping = fieldSummaryData.reduce(function (map, fieldData) {
|
|
1669
1903
|
return Object.assign(Object.assign({}, map), _defineProperty({}, fieldData.name, fieldData));
|
|
1670
1904
|
}, {});
|
|
1671
1905
|
return fieldSummaryMapping;
|
|
1672
1906
|
};
|
|
1907
|
+
|
|
1673
1908
|
exports.getFieldSummaryMapping = getFieldSummaryMapping;
|
|
1674
1909
|
/**
|
|
1675
1910
|
* Helper to merge event actions into one array of event actions.
|
|
@@ -1678,9 +1913,11 @@ exports.getFieldSummaryMapping = getFieldSummaryMapping;
|
|
|
1678
1913
|
* @param {EventAction[]} eventActions2
|
|
1679
1914
|
* @returns {EventAction[]} merged event actions
|
|
1680
1915
|
*/
|
|
1916
|
+
|
|
1681
1917
|
var mergeEventActions = function mergeEventActions(eventActions1, eventActions2) {
|
|
1682
1918
|
return eventActions1.concat(eventActions2);
|
|
1683
1919
|
};
|
|
1920
|
+
|
|
1684
1921
|
exports.mergeEventActions = mergeEventActions;
|
|
1685
1922
|
/**
|
|
1686
1923
|
* Helper to merge field actions. If same key exists in both field actions,
|
|
@@ -1695,21 +1932,27 @@ exports.mergeEventActions = mergeEventActions;
|
|
|
1695
1932
|
* @param {FieldActions} fieldActions2
|
|
1696
1933
|
* @returns {FieldActions} merged field actions
|
|
1697
1934
|
*/
|
|
1935
|
+
|
|
1698
1936
|
var mergeFieldActions = function mergeFieldActions(fieldActions1, fieldActions2) {
|
|
1699
1937
|
var fieldActions1WithoutDefault = Object.assign({}, fieldActions1);
|
|
1938
|
+
|
|
1700
1939
|
if ('default' in fieldActions1WithoutDefault) {
|
|
1701
1940
|
fieldActions1WithoutDefault['*'] = '*' in fieldActions1WithoutDefault ? [].concat(_toConsumableArray(fieldActions1WithoutDefault['*']), _toConsumableArray(fieldActions1WithoutDefault.default)) : fieldActions1WithoutDefault.default;
|
|
1702
1941
|
delete fieldActions1WithoutDefault.default;
|
|
1703
1942
|
}
|
|
1943
|
+
|
|
1704
1944
|
var fieldActions2WithoutDefault = Object.assign({}, fieldActions2);
|
|
1945
|
+
|
|
1705
1946
|
if ('default' in fieldActions2WithoutDefault) {
|
|
1706
1947
|
fieldActions2WithoutDefault['*'] = '*' in fieldActions2WithoutDefault ? [].concat(_toConsumableArray(fieldActions2WithoutDefault['*']), _toConsumableArray(fieldActions2WithoutDefault.default)) : fieldActions2WithoutDefault.default;
|
|
1707
1948
|
delete fieldActions2WithoutDefault.default;
|
|
1708
1949
|
}
|
|
1709
|
-
|
|
1710
|
-
|
|
1950
|
+
|
|
1951
|
+
return (0, lodash_1.mergeWith)(fieldActions1WithoutDefault, fieldActions2WithoutDefault, function (fieldAction1value, fieldAction2value) {
|
|
1952
|
+
return Array.isArray(fieldAction1value) && Array.isArray(fieldAction2value) ? (0, lodash_1.union)(fieldAction1value, fieldAction2value) : undefined;
|
|
1711
1953
|
});
|
|
1712
1954
|
};
|
|
1955
|
+
|
|
1713
1956
|
exports.mergeFieldActions = mergeFieldActions;
|
|
1714
1957
|
/**
|
|
1715
1958
|
* Helper to replace all tokens from the tokenReplacementMap in text with their corresponding values.
|
|
@@ -1724,80 +1967,95 @@ exports.mergeFieldActions = mergeFieldActions;
|
|
|
1724
1967
|
* @param {boolean} allowFieldValuesEscape
|
|
1725
1968
|
* @returns {string} text with replaced tokens
|
|
1726
1969
|
*/
|
|
1970
|
+
|
|
1727
1971
|
var replaceTokens = function replaceTokens(_ref) {
|
|
1728
1972
|
var text = _ref.text,
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
var replacedText = text;
|
|
1733
|
-
|
|
1973
|
+
tokenReplacementMap = _ref.tokenReplacementMap,
|
|
1974
|
+
allowSpecialParametersEscape = _ref.allowSpecialParametersEscape,
|
|
1975
|
+
allowFieldValuesEscape = _ref.allowFieldValuesEscape;
|
|
1976
|
+
var replacedText = text; // replace special parameters
|
|
1977
|
+
|
|
1734
1978
|
Object.entries(tokenReplacementMap.specialParameters).forEach(function (_ref2) {
|
|
1735
1979
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
1736
|
-
|
|
1737
|
-
|
|
1980
|
+
tokenName = _ref3[0],
|
|
1981
|
+
tokenValue = _ref3[1];
|
|
1982
|
+
|
|
1738
1983
|
var maybeEscapedTokenValue = allowSpecialParametersEscape ? encodeURIComponent(tokenValue) : tokenValue;
|
|
1739
1984
|
replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue);
|
|
1740
|
-
});
|
|
1741
|
-
|
|
1985
|
+
}); // replace field values
|
|
1986
|
+
|
|
1742
1987
|
Object.entries(tokenReplacementMap.fields).forEach(function (_ref4) {
|
|
1743
1988
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
1744
|
-
|
|
1745
|
-
|
|
1989
|
+
tokenName = _ref5[0],
|
|
1990
|
+
tokenValue = _ref5[1];
|
|
1991
|
+
|
|
1746
1992
|
// when allowFieldValuesEscape is true, replace field with escaped value
|
|
1747
1993
|
var maybeEscapedTokenValue = allowFieldValuesEscape ? encodeURIComponent(tokenValue) : tokenValue;
|
|
1748
|
-
replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue);
|
|
1749
|
-
|
|
1994
|
+
replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue); // If field starts with `!`, always replace with the unescaped value
|
|
1995
|
+
|
|
1750
1996
|
replacedText = replacedText.split("$!".concat(tokenName, "$")).join(tokenValue);
|
|
1751
1997
|
});
|
|
1752
1998
|
return replacedText;
|
|
1753
1999
|
};
|
|
2000
|
+
|
|
1754
2001
|
exports.replaceTokens = replaceTokens;
|
|
1755
2002
|
/**
|
|
1756
2003
|
* Generate a token replacement map taking into account Special Parameters and field replacements.
|
|
1757
2004
|
*/
|
|
2005
|
+
|
|
1758
2006
|
var generateTokenReplacementMap = function generateTokenReplacementMap(_ref6) {
|
|
1759
2007
|
var dataSources = _ref6.dataSources,
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
2008
|
+
rowIndex = _ref6.rowIndex,
|
|
2009
|
+
pageNumber = _ref6.pageNumber,
|
|
2010
|
+
field = _ref6.field,
|
|
2011
|
+
value = _ref6.value,
|
|
2012
|
+
_ref6$event = _ref6.event,
|
|
2013
|
+
event = _ref6$event === void 0 ? {} : _ref6$event;
|
|
2014
|
+
|
|
1766
2015
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2016
|
+
|
|
1767
2017
|
var tokenReplacementMap = {
|
|
1768
2018
|
specialParameters: {},
|
|
1769
2019
|
fields: {}
|
|
1770
|
-
};
|
|
1771
|
-
// Map special parameters for workflow actions with values
|
|
2020
|
+
}; // Map special parameters for workflow actions with values
|
|
1772
2021
|
// Note that @latest_time will not be supported since it does not work in sxml
|
|
1773
2022
|
// https://dev.splunk.com/enterprise/docs/devtools/customworkflowactions/#Special-parameters
|
|
2023
|
+
|
|
1774
2024
|
var count = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.requestParams) === null || _b === void 0 ? void 0 : _b.count;
|
|
1775
2025
|
var offset = rowIndex !== undefined && pageNumber !== undefined && count !== undefined ? rowIndex + count * (pageNumber - 1) : undefined;
|
|
2026
|
+
|
|
1776
2027
|
if (offset !== undefined) {
|
|
1777
2028
|
tokenReplacementMap.specialParameters['@offset'] = String(offset);
|
|
1778
2029
|
}
|
|
2030
|
+
|
|
1779
2031
|
if ((_d = (_c = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _c === void 0 ? void 0 : _c.meta) === null || _d === void 0 ? void 0 : _d.sid) {
|
|
1780
2032
|
tokenReplacementMap.specialParameters['@sid'] = (_f = (_e = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _e === void 0 ? void 0 : _e.meta) === null || _f === void 0 ? void 0 : _f.sid;
|
|
1781
2033
|
}
|
|
2034
|
+
|
|
1782
2035
|
if ((_h = (_g = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _g === void 0 ? void 0 : _g.meta) === null || _h === void 0 ? void 0 : _h.app) {
|
|
1783
2036
|
tokenReplacementMap.specialParameters['@namespace'] = (_k = (_j = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _j === void 0 ? void 0 : _j.meta) === null || _k === void 0 ? void 0 : _k.app;
|
|
1784
2037
|
}
|
|
2038
|
+
|
|
1785
2039
|
if (field) {
|
|
1786
2040
|
tokenReplacementMap.specialParameters['@field_name'] = field;
|
|
1787
2041
|
}
|
|
2042
|
+
|
|
1788
2043
|
if (value) {
|
|
1789
2044
|
tokenReplacementMap.specialParameters['@field_value'] = value;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
2045
|
+
} // Map fields with field values
|
|
2046
|
+
|
|
2047
|
+
|
|
1792
2048
|
Object.entries(event).forEach(function (_ref7) {
|
|
1793
2049
|
var _ref8 = _slicedToArray(_ref7, 2),
|
|
1794
|
-
|
|
1795
|
-
|
|
2050
|
+
fieldName = _ref8[0],
|
|
2051
|
+
fieldValue = _ref8[1];
|
|
2052
|
+
|
|
1796
2053
|
// handling of _raw and _time fields matches SXML behaviour. Implementation is based on fieldSubstitute() from splunkcore-web-ui
|
|
1797
2054
|
var replacedValue;
|
|
2055
|
+
|
|
1798
2056
|
if (fieldName === '_time' && typeof fieldValue === 'string') {
|
|
1799
|
-
var splunkTime = time_1.getISOWithTimeZone(fieldValue);
|
|
1800
|
-
var epochTime = exports.getEpochTime(splunkTime);
|
|
2057
|
+
var splunkTime = (0, time_1.getISOWithTimeZone)(fieldValue);
|
|
2058
|
+
var epochTime = (0, exports.getEpochTime)(splunkTime);
|
|
1801
2059
|
replacedValue = Math.floor(epochTime).toString();
|
|
1802
2060
|
} else if (fieldName === '_raw' && _typeof(fieldValue) === 'object') {
|
|
1803
2061
|
var rawFieldValue = Array.isArray(fieldValue) ? fieldValue[0] : fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.value;
|
|
@@ -1805,21 +2063,25 @@ var generateTokenReplacementMap = function generateTokenReplacementMap(_ref6) {
|
|
|
1805
2063
|
} else {
|
|
1806
2064
|
replacedValue = typeof fieldValue === 'string' ? fieldValue : JSON.stringify(fieldValue);
|
|
1807
2065
|
}
|
|
2066
|
+
|
|
1808
2067
|
tokenReplacementMap.fields["".concat(fieldName)] = replacedValue;
|
|
1809
2068
|
});
|
|
1810
2069
|
return tokenReplacementMap;
|
|
1811
2070
|
};
|
|
1812
|
-
|
|
1813
|
-
// return epoch unix timestamp in seconds
|
|
2071
|
+
|
|
2072
|
+
exports.generateTokenReplacementMap = generateTokenReplacementMap; // return epoch unix timestamp in seconds
|
|
2073
|
+
|
|
1814
2074
|
var getEpochTime = function getEpochTime(time) {
|
|
1815
2075
|
// if not a valid time string, then indicate an error and return NaN.
|
|
1816
|
-
if (!time_1.isISO(time)) {
|
|
2076
|
+
if (!(0, time_1.isISO)(time)) {
|
|
1817
2077
|
console.error("'".concat(time, "' is not a valid time string."));
|
|
1818
2078
|
return NaN;
|
|
1819
|
-
}
|
|
1820
|
-
|
|
2079
|
+
} // retrieves the epoch time in milliseconds, and divides by 1000
|
|
2080
|
+
|
|
2081
|
+
|
|
1821
2082
|
return new Date(time).getTime() / 1000;
|
|
1822
2083
|
};
|
|
2084
|
+
|
|
1823
2085
|
exports.getEpochTime = getEpochTime;
|
|
1824
2086
|
/**
|
|
1825
2087
|
* Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks a predefined control in the Time Controls Popover
|
|
@@ -1832,25 +2094,30 @@ exports.getEpochTime = getEpochTime;
|
|
|
1832
2094
|
* @param {('before'|'after'|'at')} when
|
|
1833
2095
|
* @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time
|
|
1834
2096
|
*/
|
|
2097
|
+
|
|
1835
2098
|
var getPredefinedTimeInterval = function getPredefinedTimeInterval(_ref9) {
|
|
1836
2099
|
var time = _ref9.time,
|
|
1837
|
-
|
|
1838
|
-
var epochTime = exports.getEpochTime(time);
|
|
2100
|
+
when = _ref9.when;
|
|
2101
|
+
var epochTime = (0, exports.getEpochTime)(time);
|
|
2102
|
+
|
|
1839
2103
|
switch (when) {
|
|
1840
2104
|
case 'before':
|
|
1841
2105
|
return {
|
|
1842
2106
|
latest: epochTime + 0.001
|
|
1843
2107
|
};
|
|
2108
|
+
|
|
1844
2109
|
case 'after':
|
|
1845
2110
|
return {
|
|
1846
2111
|
earliest: epochTime,
|
|
1847
2112
|
latest: 'now'
|
|
1848
2113
|
};
|
|
2114
|
+
|
|
1849
2115
|
case 'at':
|
|
1850
2116
|
return {
|
|
1851
2117
|
earliest: epochTime,
|
|
1852
2118
|
latest: epochTime + 0.001
|
|
1853
2119
|
};
|
|
2120
|
+
|
|
1854
2121
|
default:
|
|
1855
2122
|
// returns 'at' interval by default
|
|
1856
2123
|
return {
|
|
@@ -1859,6 +2126,7 @@ var getPredefinedTimeInterval = function getPredefinedTimeInterval(_ref9) {
|
|
|
1859
2126
|
};
|
|
1860
2127
|
}
|
|
1861
2128
|
};
|
|
2129
|
+
|
|
1862
2130
|
exports.getPredefinedTimeInterval = getPredefinedTimeInterval;
|
|
1863
2131
|
/**
|
|
1864
2132
|
* Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks `Apply` in the Time Controls Popover.
|
|
@@ -1873,13 +2141,15 @@ exports.getPredefinedTimeInterval = getPredefinedTimeInterval;
|
|
|
1873
2141
|
* @param {string} rangeUnit
|
|
1874
2142
|
* @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time
|
|
1875
2143
|
*/
|
|
2144
|
+
|
|
1876
2145
|
var getCustomTimeInterval = function getCustomTimeInterval(_ref10) {
|
|
1877
2146
|
var time = _ref10.time,
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
var timeRange = time_1.getAcceleratedTimeRange(time, rangeAmount, rangeUnit);
|
|
2147
|
+
rangeType = _ref10.rangeType,
|
|
2148
|
+
rangeAmount = _ref10.rangeAmount,
|
|
2149
|
+
rangeUnit = _ref10.rangeUnit;
|
|
2150
|
+
var timeRange = (0, time_1.getAcceleratedTimeRange)(time, rangeAmount, rangeUnit);
|
|
1882
2151
|
var timeInterval;
|
|
2152
|
+
|
|
1883
2153
|
if (rangeType === 'plusminus') {
|
|
1884
2154
|
timeInterval = Object.assign({}, timeRange);
|
|
1885
2155
|
} else if (rangeType === 'plus') {
|
|
@@ -1890,13 +2160,15 @@ var getCustomTimeInterval = function getCustomTimeInterval(_ref10) {
|
|
|
1890
2160
|
timeInterval = Object.assign(Object.assign({}, timeRange), {
|
|
1891
2161
|
latest: time
|
|
1892
2162
|
});
|
|
1893
|
-
}
|
|
1894
|
-
|
|
2163
|
+
} // converts to use epoch time in the interval, and adds 0.001 to `latest` per spec
|
|
2164
|
+
|
|
2165
|
+
|
|
1895
2166
|
return {
|
|
1896
|
-
earliest: exports.getEpochTime(timeInterval.earliest),
|
|
1897
|
-
latest: exports.getEpochTime(timeInterval.latest) + 0.001
|
|
2167
|
+
earliest: (0, exports.getEpochTime)(timeInterval.earliest),
|
|
2168
|
+
latest: (0, exports.getEpochTime)(timeInterval.latest) + 0.001
|
|
1898
2169
|
};
|
|
1899
2170
|
};
|
|
2171
|
+
|
|
1900
2172
|
exports.getCustomTimeInterval = getCustomTimeInterval;
|
|
1901
2173
|
/**
|
|
1902
2174
|
* Helper to truncate strings to a maximum length.
|
|
@@ -1905,19 +2177,53 @@ exports.getCustomTimeInterval = getCustomTimeInterval;
|
|
|
1905
2177
|
* @param {string} stringToTruncate
|
|
1906
2178
|
* @returns {string} truncated string
|
|
1907
2179
|
*/
|
|
2180
|
+
|
|
1908
2181
|
var truncateString = function truncateString(stringToTruncate) {
|
|
1909
2182
|
var MAX_LENGTH = 100;
|
|
1910
2183
|
var LEAD_AND_TRAIL_LENGTH = 50;
|
|
1911
2184
|
var truncatedString = stringToTruncate;
|
|
2185
|
+
|
|
1912
2186
|
if (truncatedString.length > MAX_LENGTH) {
|
|
1913
2187
|
truncatedString = "".concat(truncatedString.substring(0, LEAD_AND_TRAIL_LENGTH), "...").concat(truncatedString.substring(truncatedString.length - LEAD_AND_TRAIL_LENGTH));
|
|
1914
2188
|
}
|
|
2189
|
+
|
|
1915
2190
|
return truncatedString;
|
|
1916
2191
|
};
|
|
2192
|
+
|
|
1917
2193
|
exports.truncateString = truncateString;
|
|
1918
2194
|
|
|
2195
|
+
var convertToHighlightValuesByFieldMap = function convertToHighlightValuesByFieldMap(highlighted) {
|
|
2196
|
+
var highlightConfig = {};
|
|
2197
|
+
Object.keys(highlighted).forEach(function (field) {
|
|
2198
|
+
// convert from {field: {value1: true, value2: false}} to {field: [value1]}
|
|
2199
|
+
// this way we can pass it to the Eventsviewer with the highlightValuesByField option.
|
|
2200
|
+
var valuesToHighlight = Object.keys(highlighted[field]).filter(function (value) {
|
|
2201
|
+
return highlighted[field][value];
|
|
2202
|
+
});
|
|
2203
|
+
if (valuesToHighlight.length > 0) highlightConfig[field] = valuesToHighlight;
|
|
2204
|
+
});
|
|
2205
|
+
return highlightConfig;
|
|
2206
|
+
};
|
|
2207
|
+
|
|
2208
|
+
exports.convertToHighlightValuesByFieldMap = convertToHighlightValuesByFieldMap;
|
|
2209
|
+
|
|
2210
|
+
var combineHighlighted = function combineHighlighted(highlightedSource, highlightValuesByField) {
|
|
2211
|
+
var highlightMap = (0, exports.convertToHighlightValuesByFieldMap)(highlightedSource); // deep merge with the highlight obj passed from viz options
|
|
2212
|
+
|
|
2213
|
+
Object.keys(highlightValuesByField).forEach(function (field) {
|
|
2214
|
+
var value = highlightValuesByField[field];
|
|
2215
|
+
var valueArray = typeof value === 'string' ? [value] : value; // merge arrays and dedup
|
|
2216
|
+
|
|
2217
|
+
var combinedValue = highlightMap[field] ? _toConsumableArray(new Set([].concat(_toConsumableArray(highlightMap[field]), _toConsumableArray(valueArray)))) : valueArray;
|
|
2218
|
+
highlightMap[field] = combinedValue;
|
|
2219
|
+
});
|
|
2220
|
+
return highlightMap;
|
|
2221
|
+
};
|
|
2222
|
+
|
|
2223
|
+
exports.combineHighlighted = combineHighlighted;
|
|
2224
|
+
|
|
1919
2225
|
/***/ }),
|
|
1920
|
-
/*
|
|
2226
|
+
/* 121 */
|
|
1921
2227
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1922
2228
|
|
|
1923
2229
|
"use strict";
|
|
@@ -1926,15 +2232,17 @@ exports.truncateString = truncateString;
|
|
|
1926
2232
|
Object.defineProperty(exports, "__esModule", {
|
|
1927
2233
|
value: true
|
|
1928
2234
|
});
|
|
1929
|
-
exports.convertToArrOfObjects = void 0;
|
|
1930
|
-
|
|
2235
|
+
exports.convertToArrOfObjects = void 0; // TODO: utilize this fn in ParallelCoordinates
|
|
2236
|
+
|
|
1931
2237
|
var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
1932
2238
|
if (!columns || !columns[0] || !columns[0].length) return [];
|
|
1933
2239
|
var data = [];
|
|
2240
|
+
|
|
1934
2241
|
var _loop = function _loop(i) {
|
|
1935
2242
|
var newObj = {};
|
|
1936
2243
|
fields.forEach(function (field, index) {
|
|
1937
2244
|
var fieldName = typeof field === 'string' ? field : field.name;
|
|
2245
|
+
|
|
1938
2246
|
if (columns[index][i] === '') {
|
|
1939
2247
|
newObj[fieldName] = null;
|
|
1940
2248
|
} else {
|
|
@@ -1943,39 +2251,41 @@ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
|
1943
2251
|
});
|
|
1944
2252
|
data.push(newObj);
|
|
1945
2253
|
};
|
|
2254
|
+
|
|
1946
2255
|
for (var i = 0; i < columns[0].length; i += 1) {
|
|
1947
2256
|
_loop(i);
|
|
1948
2257
|
}
|
|
2258
|
+
|
|
1949
2259
|
return data;
|
|
1950
2260
|
};
|
|
2261
|
+
|
|
1951
2262
|
exports.convertToArrOfObjects = convertToArrOfObjects;
|
|
1952
2263
|
|
|
1953
2264
|
/***/ }),
|
|
1954
|
-
/*
|
|
2265
|
+
/* 122 */
|
|
1955
2266
|
/***/ (function(module, exports) {
|
|
1956
2267
|
|
|
1957
2268
|
module.exports = require("@splunk/react-ui/Markdown");
|
|
1958
2269
|
|
|
1959
2270
|
/***/ }),
|
|
1960
|
-
/*
|
|
2271
|
+
/* 123 */
|
|
1961
2272
|
/***/ (function(module, exports) {
|
|
1962
2273
|
|
|
1963
2274
|
module.exports = require("@splunk/react-ui/Button");
|
|
1964
2275
|
|
|
1965
2276
|
/***/ }),
|
|
1966
|
-
/*
|
|
2277
|
+
/* 124 */
|
|
1967
2278
|
/***/ (function(module, exports) {
|
|
1968
2279
|
|
|
1969
2280
|
module.exports = require("@splunk/react-ui/Message");
|
|
1970
2281
|
|
|
1971
2282
|
/***/ }),
|
|
1972
|
-
/*
|
|
2283
|
+
/* 125 */
|
|
1973
2284
|
/***/ (function(module, exports) {
|
|
1974
2285
|
|
|
1975
2286
|
module.exports = require("@splunk/react-ui/Heading");
|
|
1976
2287
|
|
|
1977
2288
|
/***/ }),
|
|
1978
|
-
/* 125 */,
|
|
1979
2289
|
/* 126 */,
|
|
1980
2290
|
/* 127 */,
|
|
1981
2291
|
/* 128 */,
|
|
@@ -1997,7 +2307,10 @@ module.exports = require("@splunk/react-ui/Heading");
|
|
|
1997
2307
|
/* 144 */,
|
|
1998
2308
|
/* 145 */,
|
|
1999
2309
|
/* 146 */,
|
|
2000
|
-
/* 147
|
|
2310
|
+
/* 147 */,
|
|
2311
|
+
/* 148 */,
|
|
2312
|
+
/* 149 */,
|
|
2313
|
+
/* 150 */
|
|
2001
2314
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2002
2315
|
|
|
2003
2316
|
"use strict";
|
|
@@ -2005,27 +2318,40 @@ module.exports = require("@splunk/react-ui/Heading");
|
|
|
2005
2318
|
|
|
2006
2319
|
var __rest = this && this.__rest || function (s, e) {
|
|
2007
2320
|
var t = {};
|
|
2321
|
+
|
|
2008
2322
|
for (var p in s) {
|
|
2009
2323
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2010
2324
|
}
|
|
2325
|
+
|
|
2011
2326
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2012
2327
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2013
2328
|
}
|
|
2014
2329
|
return t;
|
|
2015
2330
|
};
|
|
2331
|
+
|
|
2016
2332
|
Object.defineProperty(exports, "__esModule", {
|
|
2017
2333
|
value: true
|
|
2018
2334
|
});
|
|
2019
2335
|
exports.replaceTokens = exports.PureEvents = exports.config = exports.themes = exports.computeVizProps = exports.showPlaceHolderIcon = void 0;
|
|
2336
|
+
|
|
2020
2337
|
var lodash_1 = __webpack_require__(3);
|
|
2021
|
-
|
|
2022
|
-
var
|
|
2023
|
-
|
|
2024
|
-
var
|
|
2338
|
+
|
|
2339
|
+
var dataSourceUtils_1 = __webpack_require__(97);
|
|
2340
|
+
|
|
2341
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
2342
|
+
|
|
2343
|
+
var constants_1 = __webpack_require__(151);
|
|
2344
|
+
|
|
2345
|
+
var config_1 = __webpack_require__(203);
|
|
2346
|
+
|
|
2025
2347
|
exports.config = config_1.default;
|
|
2026
|
-
|
|
2348
|
+
|
|
2349
|
+
var PureEvents_1 = __webpack_require__(204);
|
|
2350
|
+
|
|
2027
2351
|
exports.PureEvents = PureEvents_1.default;
|
|
2028
|
-
|
|
2352
|
+
|
|
2353
|
+
var EventUtils_1 = __webpack_require__(120);
|
|
2354
|
+
|
|
2029
2355
|
Object.defineProperty(exports, "replaceTokens", {
|
|
2030
2356
|
enumerable: true,
|
|
2031
2357
|
get: function get() {
|
|
@@ -2037,31 +2363,37 @@ Object.defineProperty(exports, "replaceTokens", {
|
|
|
2037
2363
|
* @param {Object} dataSources
|
|
2038
2364
|
* @returns {Boolean} return true if loading, error, non existent state or without columns in dataSources
|
|
2039
2365
|
*/
|
|
2366
|
+
|
|
2040
2367
|
var showPlaceHolderIcon = function showPlaceHolderIcon(dataSources) {
|
|
2041
|
-
var columns = lodash_1.get(dataSources, 'primary.data.columns', undefined);
|
|
2368
|
+
var columns = (0, lodash_1.get)(dataSources, 'primary.data.columns', undefined);
|
|
2042
2369
|
var noColumns = columns === undefined;
|
|
2043
|
-
var dataSourceState = dataSourceUtils_1.getDataSourceStateInfo(dataSources);
|
|
2370
|
+
var dataSourceState = (0, dataSourceUtils_1.getDataSourceStateInfo)(dataSources);
|
|
2044
2371
|
return dataSourceState === dataSourceUtils_1.DataSourceState.ERROR || dataSourceState === dataSourceUtils_1.DataSourceState.LOADING || dataSourceState === dataSourceUtils_1.DataSourceState.NONEXISTENT || noColumns;
|
|
2045
2372
|
};
|
|
2373
|
+
|
|
2046
2374
|
exports.showPlaceHolderIcon = showPlaceHolderIcon;
|
|
2375
|
+
|
|
2047
2376
|
var computeVizProps = function computeVizProps(_a) {
|
|
2048
2377
|
// for specific changes to view type (List -> Raw, etc.), can create handling function here that calls onOptionsChange
|
|
2049
2378
|
var _b;
|
|
2050
|
-
|
|
2051
|
-
// defaults to an empty datasource if one isn't provided, which shows the No Results Found UI:
|
|
2379
|
+
|
|
2380
|
+
var props = __rest(_a, []); // defaults to an empty datasource if one isn't provided, which shows the No Results Found UI:
|
|
2381
|
+
|
|
2382
|
+
|
|
2052
2383
|
var dataSources = (_b = props === null || props === void 0 ? void 0 : props.dataSources) !== null && _b !== void 0 ? _b : constants_1.EMPTY_DATASOURCE;
|
|
2053
2384
|
return Object.assign(Object.assign({}, props), {
|
|
2054
2385
|
dataSources: dataSources
|
|
2055
2386
|
});
|
|
2056
2387
|
};
|
|
2388
|
+
|
|
2057
2389
|
exports.computeVizProps = computeVizProps;
|
|
2058
|
-
var Events = withDashboardViz_1.default({
|
|
2390
|
+
var Events = (0, withDashboardViz_1.default)({
|
|
2059
2391
|
ReactViz: PureEvents_1.default,
|
|
2060
2392
|
vizConfig: config_1.default,
|
|
2061
2393
|
computeVizProps: exports.computeVizProps,
|
|
2062
2394
|
disableEditModeCover: true,
|
|
2063
2395
|
useIconPlaceholder: function useIconPlaceholder(dataSources) {
|
|
2064
|
-
return exports.showPlaceHolderIcon(dataSources);
|
|
2396
|
+
return (0, exports.showPlaceHolderIcon)(dataSources);
|
|
2065
2397
|
}
|
|
2066
2398
|
});
|
|
2067
2399
|
var themes = config_1.default.themes;
|
|
@@ -2069,7 +2401,7 @@ exports.themes = themes;
|
|
|
2069
2401
|
exports.default = Events;
|
|
2070
2402
|
|
|
2071
2403
|
/***/ }),
|
|
2072
|
-
/*
|
|
2404
|
+
/* 151 */
|
|
2073
2405
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2074
2406
|
|
|
2075
2407
|
"use strict";
|
|
@@ -2081,8 +2413,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2081
2413
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY_DATASOURCE", function() { return EMPTY_DATASOURCE; });
|
|
2082
2414
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELDSUMMARY_DS_STORYBOOK", function() { return FIELDSUMMARY_DS_STORYBOOK; });
|
|
2083
2415
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELDSUMMARY_DS_DOC_HUB", function() { return FIELDSUMMARY_DS_DOC_HUB; });
|
|
2084
|
-
/* harmony import */ var
|
|
2085
|
-
/* harmony import */ var
|
|
2416
|
+
/* harmony import */ var _splunk_datasource_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(169);
|
|
2417
|
+
/* harmony import */ var _splunk_datasource_utils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_datasource_utils__WEBPACK_IMPORTED_MODULE_0__);
|
|
2086
2418
|
// TODO: convert this file to .ts - created as .js as copied from SUI EventsViewer repo
|
|
2087
2419
|
|
|
2088
2420
|
var rawEventPayload = {
|
|
@@ -2470,20 +2802,17 @@ var rawEventPayload = {
|
|
|
2470
2802
|
}
|
|
2471
2803
|
}
|
|
2472
2804
|
};
|
|
2473
|
-
var rawMultiLineEvent = "10/19/2023 10:29:00 -0700, search_name=KOM_Dashboard_Sear dropped_events=0, search_startup_time=48, dash_epoch=1697737969, search_spl=\"| rest splunk_server=local /services/server/status/installed-file-integrity\n| fields check_failures.*\n| untable splunk_server file_path check_result\n| replace \"check_failures.*\" WITH \"*\" IN file_path\n| fields file_path check_result\n| rename file_path AS \"File path\" check_result AS \"Check result\", shc_member=standalone, rawdata_cache_miss=0, matching_events=0, events_in_matching_bkts=0, total_run_time_sec=\"0.09\", scanned_events=0, bloomfilter_eliminated_bkts=0, sid_search_name=search2, slices_in_matching_bkts=0, savedsearch_name=search2, search_type=dashboard, search_user=gmattia";
|
|
2805
|
+
var rawMultiLineEvent = "10/19/2023 10:29:00 -0700, search_name=KOM_Dashboard_Sear dropped_events=0, search_startup_time=48, dash_epoch=1697737969, search_spl=\"| rest splunk_server=local /services/server/status/installed-file-integrity\n| fields check_failures.*\n| untable splunk_server file_path check_result\n| replace \"check_failures.*\" WITH \"*\" IN file_path\n| fields file_path check_result\n| rename file_path AS \"File path\" check_result AS \"Check result\", shc_member=standalone, rawdata_cache_miss=0, matching_events=0, events_in_matching_bkts=0, total_run_time_sec=\"0.09\", scanned_events=0, bloomfilter_eliminated_bkts=0, sid_search_name=search2, slices_in_matching_bkts=0, savedsearch_name=search2, search_type=dashboard, search_user=gmattia"; // Datasource utilized in example on @splunk/react-events-viewer docs
|
|
2474
2806
|
|
|
2475
|
-
//
|
|
2476
|
-
var originalDataSourceData = _splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0___default.a.fromJSONArray(rawEventPayload.fields, rawEventPayload.results);
|
|
2807
|
+
var originalDataSourceData = _splunk_datasource_utils__WEBPACK_IMPORTED_MODULE_0__["DataSet"].fromJSONArray(rawEventPayload.fields, rawEventPayload.results); // Replaces _raw object with the value of the `value` key - this is the string expected in Dashboard Studio payload
|
|
2477
2808
|
|
|
2478
|
-
// Replaces _raw object with the value of the `value` key - this is the string expected in Dashboard Studio payload
|
|
2479
2809
|
originalDataSourceData.columns[5] = originalDataSourceData.columns[5].map(function (_raw) {
|
|
2480
2810
|
return _raw.value;
|
|
2481
|
-
});
|
|
2482
|
-
|
|
2483
|
-
// Exports payload with expected shape of Dashboard Studio payload - fields as an array of strings, and columns
|
|
2811
|
+
}); // Exports payload with expected shape of Dashboard Studio payload - fields as an array of strings, and columns
|
|
2484
2812
|
// as arrays of data primitives like strings and numbers
|
|
2485
2813
|
// Component works with either [{ name: `field` }, ...] or [`field`,...] format - leaving as array as objects as
|
|
2486
2814
|
// expected in Dashboard Studio payload
|
|
2815
|
+
|
|
2487
2816
|
var dataSourceData = {
|
|
2488
2817
|
fields: rawEventPayload.fields,
|
|
2489
2818
|
columns: originalDataSourceData.columns
|
|
@@ -2565,15 +2894,12 @@ var FIELDSUMMARY_DS_DOC_HUB = {
|
|
|
2565
2894
|
};
|
|
2566
2895
|
|
|
2567
2896
|
/***/ }),
|
|
2568
|
-
/*
|
|
2897
|
+
/* 152 */
|
|
2569
2898
|
/***/ (function(module, exports) {
|
|
2570
2899
|
|
|
2571
2900
|
module.exports = require("@splunk/visualization-context/EventsContext");
|
|
2572
2901
|
|
|
2573
2902
|
/***/ }),
|
|
2574
|
-
/* 150 */,
|
|
2575
|
-
/* 151 */,
|
|
2576
|
-
/* 152 */,
|
|
2577
2903
|
/* 153 */,
|
|
2578
2904
|
/* 154 */,
|
|
2579
2905
|
/* 155 */,
|
|
@@ -2587,15 +2913,15 @@ module.exports = require("@splunk/visualization-context/EventsContext");
|
|
|
2587
2913
|
/* 163 */,
|
|
2588
2914
|
/* 164 */,
|
|
2589
2915
|
/* 165 */,
|
|
2590
|
-
/* 166
|
|
2916
|
+
/* 166 */,
|
|
2917
|
+
/* 167 */,
|
|
2918
|
+
/* 168 */,
|
|
2919
|
+
/* 169 */
|
|
2591
2920
|
/***/ (function(module, exports) {
|
|
2592
2921
|
|
|
2593
|
-
module.exports = require("@splunk/datasource-utils
|
|
2922
|
+
module.exports = require("@splunk/datasource-utils");
|
|
2594
2923
|
|
|
2595
2924
|
/***/ }),
|
|
2596
|
-
/* 167 */,
|
|
2597
|
-
/* 168 */,
|
|
2598
|
-
/* 169 */,
|
|
2599
2925
|
/* 170 */,
|
|
2600
2926
|
/* 171 */,
|
|
2601
2927
|
/* 172 */,
|
|
@@ -2625,7 +2951,10 @@ module.exports = require("@splunk/datasource-utils/DataSet");
|
|
|
2625
2951
|
/* 196 */,
|
|
2626
2952
|
/* 197 */,
|
|
2627
2953
|
/* 198 */,
|
|
2628
|
-
/* 199
|
|
2954
|
+
/* 199 */,
|
|
2955
|
+
/* 200 */,
|
|
2956
|
+
/* 201 */,
|
|
2957
|
+
/* 202 */
|
|
2629
2958
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2630
2959
|
|
|
2631
2960
|
"use strict";
|
|
@@ -2633,27 +2962,38 @@ module.exports = require("@splunk/datasource-utils/DataSet");
|
|
|
2633
2962
|
|
|
2634
2963
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
2635
2964
|
if (k2 === undefined) k2 = k;
|
|
2636
|
-
Object.
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2965
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2966
|
+
|
|
2967
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2968
|
+
desc = {
|
|
2969
|
+
enumerable: true,
|
|
2970
|
+
get: function get() {
|
|
2971
|
+
return m[k];
|
|
2972
|
+
}
|
|
2973
|
+
};
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
Object.defineProperty(o, k2, desc);
|
|
2642
2977
|
} : function (o, m, k, k2) {
|
|
2643
2978
|
if (k2 === undefined) k2 = k;
|
|
2644
2979
|
o[k2] = m[k];
|
|
2645
2980
|
});
|
|
2981
|
+
|
|
2646
2982
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
2647
2983
|
for (var p in m) {
|
|
2648
2984
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2649
2985
|
}
|
|
2650
2986
|
};
|
|
2987
|
+
|
|
2651
2988
|
Object.defineProperty(exports, "__esModule", {
|
|
2652
2989
|
value: true
|
|
2653
2990
|
});
|
|
2654
2991
|
exports.default = void 0;
|
|
2655
|
-
|
|
2656
|
-
|
|
2992
|
+
|
|
2993
|
+
__exportStar(__webpack_require__(150), exports);
|
|
2994
|
+
|
|
2995
|
+
var Events_1 = __webpack_require__(150);
|
|
2996
|
+
|
|
2657
2997
|
Object.defineProperty(exports, "default", {
|
|
2658
2998
|
enumerable: true,
|
|
2659
2999
|
get: function get() {
|
|
@@ -2662,7 +3002,7 @@ Object.defineProperty(exports, "default", {
|
|
|
2662
3002
|
});
|
|
2663
3003
|
|
|
2664
3004
|
/***/ }),
|
|
2665
|
-
/*
|
|
3005
|
+
/* 203 */
|
|
2666
3006
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2667
3007
|
|
|
2668
3008
|
"use strict";
|
|
@@ -2671,15 +3011,27 @@ Object.defineProperty(exports, "default", {
|
|
|
2671
3011
|
Object.defineProperty(exports, "__esModule", {
|
|
2672
3012
|
value: true
|
|
2673
3013
|
});
|
|
3014
|
+
|
|
2674
3015
|
var visualization_icons_1 = __webpack_require__(52);
|
|
2675
|
-
|
|
3016
|
+
|
|
3017
|
+
var placeholders_1 = __webpack_require__(50);
|
|
3018
|
+
|
|
2676
3019
|
var schemaUtils_1 = __webpack_require__(16);
|
|
2677
|
-
|
|
3020
|
+
|
|
3021
|
+
var themes_1 = __webpack_require__(60);
|
|
3022
|
+
|
|
2678
3023
|
var i18n_1 = __webpack_require__(2);
|
|
3024
|
+
|
|
3025
|
+
var DataSource_1 = __webpack_require__(34);
|
|
3026
|
+
|
|
2679
3027
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2680
|
-
|
|
3028
|
+
|
|
3029
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
3030
|
+
|
|
2681
3031
|
var configUtils_1 = __webpack_require__(20);
|
|
3032
|
+
|
|
2682
3033
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
3034
|
+
|
|
2683
3035
|
var defaultContext = {};
|
|
2684
3036
|
var dataContract = {
|
|
2685
3037
|
requiredDataSources: [{
|
|
@@ -2693,10 +3045,16 @@ var dataContract = {
|
|
|
2693
3045
|
initialRequestParams: {
|
|
2694
3046
|
primary: function primary() {
|
|
2695
3047
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3048
|
+
|
|
3049
|
+
var _a;
|
|
3050
|
+
|
|
2696
3051
|
return {
|
|
2697
3052
|
offset: 0,
|
|
2698
3053
|
count: options.count ? options.count : 10,
|
|
2699
|
-
requestTotalCount: true
|
|
3054
|
+
requestTotalCount: true,
|
|
3055
|
+
// this is needed for search-based event highlighting
|
|
3056
|
+
output_mode: 'json',
|
|
3057
|
+
segmentation: (_a = options.highlightFromSource) !== null && _a !== void 0 ? _a : 'none'
|
|
2700
3058
|
};
|
|
2701
3059
|
}
|
|
2702
3060
|
}
|
|
@@ -2806,9 +3164,15 @@ var optionsSchema = {
|
|
|
2806
3164
|
default: []
|
|
2807
3165
|
},
|
|
2808
3166
|
highlightValuesByField: {
|
|
2809
|
-
description: 'Specify the field
|
|
3167
|
+
description: 'Specify the field and value pairs for manual highlighting. For example, `{"source": "$srcToken$", "dest": "12.21.1.11", "tag": ["tag1", "tag2"]}`.',
|
|
2810
3168
|
type: 'object'
|
|
2811
3169
|
},
|
|
3170
|
+
highlightFromSource: {
|
|
3171
|
+
description: 'Specify a segmentation mode to use for search based highlighting. Specifying "none" will turn search based highlighting off. For more about segmentation, search for "event segmentation" in the Getting Data In manual in the Splunk Docs.',
|
|
3172
|
+
type: 'string',
|
|
3173
|
+
pattern: (0, schemaUtils_1.getPattern)(DataSource_1.validSegmentationModes),
|
|
3174
|
+
default: 'none'
|
|
3175
|
+
},
|
|
2812
3176
|
showFieldSummary: {
|
|
2813
3177
|
description: 'Specify that a field summary popup appears when a field is selected. To show field summaries for a search, configure an additional datasource called `fieldsummary` using the original search followed by the `... | fieldsummary maxvals=10` SPL command.',
|
|
2814
3178
|
type: 'boolean',
|
|
@@ -2817,7 +3181,7 @@ var optionsSchema = {
|
|
|
2817
3181
|
};
|
|
2818
3182
|
var themes = {
|
|
2819
3183
|
defaultBackgroundColor: function defaultBackgroundColor(props) {
|
|
2820
|
-
return themes_1.pick({
|
|
3184
|
+
return (0, themes_1.pick)({
|
|
2821
3185
|
enterprise: {
|
|
2822
3186
|
dark: themes_1.variables.black(props),
|
|
2823
3187
|
light: themes_1.variables.backgroundColor(props)
|
|
@@ -2827,9 +3191,9 @@ var themes = {
|
|
|
2827
3191
|
}
|
|
2828
3192
|
};
|
|
2829
3193
|
var editorConfig = [{
|
|
2830
|
-
label: i18n_1._('Data display'),
|
|
3194
|
+
label: (0, i18n_1._)('Data display'),
|
|
2831
3195
|
layout: [[{
|
|
2832
|
-
label: i18n_1._('Show field summary'),
|
|
3196
|
+
label: (0, i18n_1._)('Show field summary'),
|
|
2833
3197
|
option: 'showFieldSummary',
|
|
2834
3198
|
editor: 'editor.checkbox',
|
|
2835
3199
|
editorProps: {
|
|
@@ -2837,25 +3201,28 @@ var editorConfig = [{
|
|
|
2837
3201
|
}
|
|
2838
3202
|
}]]
|
|
2839
3203
|
}, {
|
|
2840
|
-
label: i18n_1._('Color and style'),
|
|
2841
|
-
layout: [BackgroundColor_1.default({
|
|
3204
|
+
label: (0, i18n_1._)('Color and style'),
|
|
3205
|
+
layout: [(0, BackgroundColor_1.default)({
|
|
2842
3206
|
themes: themes
|
|
2843
3207
|
})]
|
|
2844
3208
|
}];
|
|
2845
3209
|
/**
|
|
2846
3210
|
* visualization configuration
|
|
2847
3211
|
*/
|
|
3212
|
+
|
|
2848
3213
|
var config = {
|
|
2849
3214
|
/**
|
|
2850
3215
|
* unique viz key
|
|
2851
3216
|
*/
|
|
2852
3217
|
key: 'splunk.events',
|
|
3218
|
+
|
|
2853
3219
|
/**
|
|
2854
3220
|
* viz name
|
|
2855
3221
|
*/
|
|
2856
|
-
name: i18n_1._('Events'),
|
|
3222
|
+
name: (0, i18n_1._)('Events'),
|
|
2857
3223
|
category: VizCategory_1.VizCategory.TABLE,
|
|
2858
3224
|
status: 'preview',
|
|
3225
|
+
|
|
2859
3226
|
/**
|
|
2860
3227
|
* viz icon
|
|
2861
3228
|
*/
|
|
@@ -2887,63 +3254,83 @@ var config = {
|
|
|
2887
3254
|
themes: themes,
|
|
2888
3255
|
requiredProps: []
|
|
2889
3256
|
};
|
|
2890
|
-
exports.default = configUtils_1.enhanceConfig(config);
|
|
3257
|
+
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
2891
3258
|
|
|
2892
3259
|
/***/ }),
|
|
2893
|
-
/*
|
|
3260
|
+
/* 204 */
|
|
2894
3261
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2895
3262
|
|
|
2896
3263
|
"use strict";
|
|
2897
3264
|
|
|
2898
3265
|
|
|
2899
|
-
var _typeof = __webpack_require__(
|
|
3266
|
+
var _typeof = __webpack_require__(82);
|
|
3267
|
+
|
|
2900
3268
|
var _slicedToArray = __webpack_require__(17);
|
|
3269
|
+
|
|
2901
3270
|
Object.defineProperty(exports, "__esModule", {
|
|
2902
3271
|
value: true
|
|
2903
3272
|
});
|
|
3273
|
+
|
|
2904
3274
|
var React = __webpack_require__(1);
|
|
3275
|
+
|
|
2905
3276
|
var react_1 = __webpack_require__(1);
|
|
3277
|
+
|
|
2906
3278
|
var T = __webpack_require__(0);
|
|
2907
|
-
|
|
3279
|
+
|
|
3280
|
+
var EventsViewer_1 = __webpack_require__(205);
|
|
3281
|
+
|
|
2908
3282
|
var styled_components_1 = __webpack_require__(4);
|
|
3283
|
+
|
|
2909
3284
|
var pick_1 = __webpack_require__(23);
|
|
3285
|
+
|
|
2910
3286
|
var variables_1 = __webpack_require__(11);
|
|
3287
|
+
|
|
2911
3288
|
var colorUtils_1 = __webpack_require__(12);
|
|
3289
|
+
|
|
2912
3290
|
var style_1 = __webpack_require__(14);
|
|
2913
|
-
|
|
3291
|
+
|
|
3292
|
+
var EventsContext_1 = __webpack_require__(152);
|
|
3293
|
+
|
|
2914
3294
|
var lodash_1 = __webpack_require__(3);
|
|
2915
|
-
|
|
2916
|
-
var
|
|
3295
|
+
|
|
3296
|
+
var Menu_1 = __webpack_require__(119);
|
|
3297
|
+
|
|
3298
|
+
var constants_1 = __webpack_require__(151);
|
|
3299
|
+
|
|
2917
3300
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2918
|
-
|
|
2919
|
-
var
|
|
2920
|
-
|
|
2921
|
-
|
|
3301
|
+
|
|
3302
|
+
var EventUtils_1 = __webpack_require__(120);
|
|
3303
|
+
|
|
3304
|
+
var FieldSummaryTooltip_1 = __webpack_require__(207);
|
|
3305
|
+
|
|
3306
|
+
var TimeControlsPopover_1 = __webpack_require__(209); // Inspired by VizTableContainer in PureTable.tsx
|
|
3307
|
+
|
|
3308
|
+
|
|
2922
3309
|
var EventsContainer = styled_components_1.default.div.withConfig({
|
|
2923
3310
|
displayName: "PureEvents__EventsContainer",
|
|
2924
3311
|
componentId: "iniqvm-0"
|
|
2925
|
-
})(["width:", ";height:", ";box-sizing:border-box;padding:", ";display:flex;flex-flow:column nowrap;overflow:hidden;background-color:", ";table[data-test='main-table']{background-color:", ";}table[data-test='main-table']{td:nth-child(3){word-break:break-word;white-space:pre-
|
|
2926
|
-
return lodash_1.isNumber(props.width) ? "".concat(props.width, "px") : props.width;
|
|
3312
|
+
})(["width:", ";height:", ";box-sizing:border-box;padding:", ";display:flex;flex-flow:column nowrap;overflow:hidden;background-color:", ";table[data-test='main-table']{background-color:", ";}table[data-test='main-table']{td:nth-child(3){word-break:break-word;white-space:pre-wrap;}}"], function (props) {
|
|
3313
|
+
return (0, lodash_1.isNumber)(props.width) ? "".concat(props.width, "px") : props.width;
|
|
2927
3314
|
}, function (props) {
|
|
2928
|
-
return lodash_1.isNumber(props.height) ? "".concat(props.height, "px") : props.height;
|
|
2929
|
-
}, pick_1.default({
|
|
3315
|
+
return (0, lodash_1.isNumber)(props.height) ? "".concat(props.height, "px") : props.height;
|
|
3316
|
+
}, (0, pick_1.default)({
|
|
2930
3317
|
enterprise: variables_1.default.spacingHalf,
|
|
2931
3318
|
prisma: variables_1.default.spacingSmall
|
|
2932
3319
|
}), function (props) {
|
|
2933
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
2934
|
-
}, pick_1.default({
|
|
3320
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
3321
|
+
}, (0, pick_1.default)({
|
|
2935
3322
|
enterprise: variables_1.default.backgroundColorPage,
|
|
2936
3323
|
prisma: variables_1.default.backgroundColorPage
|
|
2937
|
-
}));
|
|
2938
|
-
|
|
3324
|
+
})); // Inspired by SUITableContainer in PureTable.tsx
|
|
3325
|
+
|
|
2939
3326
|
var SUIEventsViewerContainer = styled_components_1.default.div.withConfig({
|
|
2940
3327
|
displayName: "PureEvents__SUIEventsViewerContainer",
|
|
2941
3328
|
componentId: "iniqvm-1"
|
|
2942
3329
|
})(["box-sizing:border-box;flex-grow:1;overflow:hidden;", ";"], function (_ref) {
|
|
2943
3330
|
var width = _ref.width,
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
var padding = pick_1.default({
|
|
3331
|
+
height = _ref.height,
|
|
3332
|
+
theme = _ref.theme;
|
|
3333
|
+
var padding = (0, pick_1.default)({
|
|
2947
3334
|
enterprise: variables_1.default.spacingHalf({
|
|
2948
3335
|
theme: theme
|
|
2949
3336
|
}),
|
|
@@ -2954,77 +3341,96 @@ var SUIEventsViewerContainer = styled_components_1.default.div.withConfig({
|
|
|
2954
3341
|
theme: theme
|
|
2955
3342
|
});
|
|
2956
3343
|
var paddingOffset = parseInt(padding, 10) * 2;
|
|
2957
|
-
return style_1.toDimension({
|
|
3344
|
+
return (0, style_1.toDimension)({
|
|
2958
3345
|
width: width - paddingOffset,
|
|
2959
3346
|
height: height - paddingOffset
|
|
2960
3347
|
});
|
|
2961
|
-
});
|
|
2962
|
-
|
|
3348
|
+
}); // Effectively the pure visualization component for Events, passing through the necessary state and callbacks.
|
|
3349
|
+
|
|
2963
3350
|
var PureEvents = function PureEvents(props) {
|
|
2964
3351
|
var width = props.width,
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
3352
|
+
height = props.height,
|
|
3353
|
+
backgroundColor = props.backgroundColor,
|
|
3354
|
+
_props$dataSources = props.dataSources,
|
|
3355
|
+
dataSources = _props$dataSources === void 0 ? {} : _props$dataSources,
|
|
3356
|
+
_props$eventActions = props.eventActions,
|
|
3357
|
+
eventActionsProps = _props$eventActions === void 0 ? [] : _props$eventActions,
|
|
3358
|
+
_props$fieldActions = props.fieldActions,
|
|
3359
|
+
fieldActionsProps = _props$fieldActions === void 0 ? {} : _props$fieldActions,
|
|
3360
|
+
showFieldSummary = props.showFieldSummary,
|
|
3361
|
+
footerFields = props.footerFields,
|
|
3362
|
+
highlightValuesByField = props.highlightValuesByField,
|
|
3363
|
+
onOptionsChange = props.onOptionsChange,
|
|
3364
|
+
onRequestParamsChange = props.onRequestParamsChange,
|
|
3365
|
+
onEventTrigger = props.onEventTrigger;
|
|
3366
|
+
var highlightValuesByFieldCombined = React.useMemo(function () {
|
|
3367
|
+
var _a, _b, _c; // get highlighted values from datasource
|
|
3368
|
+
// remove type casting by adding highlighted and tags to DataSourceMeta in dashboard-types package
|
|
3369
|
+
|
|
3370
|
+
|
|
3371
|
+
var highlightedSource = (_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.highlighted) !== null && _c !== void 0 ? _c : {};
|
|
3372
|
+
return (0, EventUtils_1.combineHighlighted)(highlightedSource, highlightValuesByField);
|
|
3373
|
+
}, [dataSources, highlightValuesByField]);
|
|
2979
3374
|
var fieldSummaryMap = React.useMemo(function () {
|
|
2980
|
-
var _a, _b, _c, _d;
|
|
2981
|
-
|
|
2982
|
-
|
|
3375
|
+
var _a, _b, _c, _d; // if the `fieldsummary` datasource isn't configured, no field summary can be shown
|
|
3376
|
+
|
|
3377
|
+
|
|
3378
|
+
if (!showFieldSummary || !(0, lodash_1.get)(dataSources, 'fieldsummary')) {
|
|
2983
3379
|
return {};
|
|
2984
3380
|
}
|
|
3381
|
+
|
|
2985
3382
|
try {
|
|
2986
|
-
var fieldSummaryMapping = EventUtils_1.getFieldSummaryMapping((_b = (_a = dataSources.fieldsummary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns, (_d = (_c = dataSources.fieldsummary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.fields);
|
|
3383
|
+
var fieldSummaryMapping = (0, EventUtils_1.getFieldSummaryMapping)((_b = (_a = dataSources.fieldsummary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns, (_d = (_c = dataSources.fieldsummary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.fields);
|
|
2987
3384
|
return fieldSummaryMapping;
|
|
2988
3385
|
} catch (e) {
|
|
2989
3386
|
console.error("Unexpected error parsing fieldsummary datasource: + ".concat(e.message));
|
|
2990
3387
|
return {};
|
|
2991
3388
|
}
|
|
2992
3389
|
}, [dataSources, showFieldSummary]);
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3390
|
+
|
|
3391
|
+
var _ref2 = (0, react_1.useContext)(EventsContext_1.default),
|
|
3392
|
+
_ref2$eventActions = _ref2.eventActions,
|
|
3393
|
+
eventActionsContext = _ref2$eventActions === void 0 ? [] : _ref2$eventActions,
|
|
3394
|
+
_ref2$fieldActions = _ref2.fieldActions,
|
|
3395
|
+
fieldActionsContext = _ref2$fieldActions === void 0 ? {} : _ref2$fieldActions;
|
|
3396
|
+
|
|
3397
|
+
var eventActions = (0, EventUtils_1.mergeEventActions)(eventActionsProps, eventActionsContext);
|
|
3398
|
+
var fieldActions = (0, EventUtils_1.mergeFieldActions)(fieldActionsProps, fieldActionsContext);
|
|
3399
|
+
|
|
3000
3400
|
var _React$useState = React.useState(null),
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3401
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3402
|
+
fieldSummaryField = _React$useState2[0],
|
|
3403
|
+
setFieldSummaryField = _React$useState2[1];
|
|
3404
|
+
|
|
3004
3405
|
var _React$useState3 = React.useState(null),
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3406
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3407
|
+
fieldSummaryAnchor = _React$useState4[0],
|
|
3408
|
+
setFieldSummaryAnchor = _React$useState4[1];
|
|
3409
|
+
|
|
3008
3410
|
var _React$useState5 = React.useState(null),
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3411
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3412
|
+
timeValue = _React$useState6[0],
|
|
3413
|
+
setTimeValue = _React$useState6[1];
|
|
3414
|
+
|
|
3012
3415
|
var _React$useState7 = React.useState(null),
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3416
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3417
|
+
timeFieldAnchor = _React$useState8[0],
|
|
3418
|
+
setTimeFieldAnchor = _React$useState8[1]; // An array of objects with eventtypeValues for filtering by eventtype, fieldFilters for filtering by fields,
|
|
3016
3419
|
// and eventActionComponent (needs to be Menu.Item and will be rendered inside a Menu component)
|
|
3017
3420
|
// to display in the Event Actions dropdown
|
|
3421
|
+
|
|
3422
|
+
|
|
3018
3423
|
var renderEventActions = React.useMemo(function () {
|
|
3019
|
-
return !Array.isArray(eventActions) ? [] : eventActions.map(function (
|
|
3020
|
-
var eventType =
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3424
|
+
return !Array.isArray(eventActions) ? [] : eventActions.map(function (_ref3) {
|
|
3425
|
+
var eventType = _ref3.eventType,
|
|
3426
|
+
label = _ref3.label,
|
|
3427
|
+
_ref3$eventtypeValues = _ref3.eventtypeValues,
|
|
3428
|
+
eventtypeValues = _ref3$eventtypeValues === void 0 ? [] : _ref3$eventtypeValues,
|
|
3429
|
+
_ref3$fieldFilters = _ref3.fieldFilters,
|
|
3430
|
+
fieldFilters = _ref3$fieldFilters === void 0 ? [] : _ref3$fieldFilters;
|
|
3431
|
+
|
|
3026
3432
|
var onMenuItemClick = function onMenuItemClick(e, eventActionProps, tokenReplacementMap) {
|
|
3027
|
-
var payload = EventUtils_1.convertToPayloadFormat(eventActionProps.event, {
|
|
3433
|
+
var payload = (0, EventUtils_1.convertToPayloadFormat)(eventActionProps.event, {
|
|
3028
3434
|
tokenReplacementMap: tokenReplacementMap
|
|
3029
3435
|
});
|
|
3030
3436
|
onEventTrigger({
|
|
@@ -3033,23 +3439,24 @@ var PureEvents = function PureEvents(props) {
|
|
|
3033
3439
|
payload: payload
|
|
3034
3440
|
});
|
|
3035
3441
|
};
|
|
3442
|
+
|
|
3036
3443
|
var eventActionComponent = function eventActionComponent(eventActionProps) {
|
|
3037
3444
|
var rowIndex = eventActionProps.rowIndex,
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
var tokenReplacementMap = EventUtils_1.generateTokenReplacementMap({
|
|
3445
|
+
pageNumber = eventActionProps.pageNumber,
|
|
3446
|
+
event = eventActionProps.event;
|
|
3447
|
+
var tokenReplacementMap = (0, EventUtils_1.generateTokenReplacementMap)({
|
|
3041
3448
|
dataSources: dataSources,
|
|
3042
3449
|
rowIndex: rowIndex,
|
|
3043
3450
|
pageNumber: pageNumber,
|
|
3044
3451
|
event: event
|
|
3045
3452
|
});
|
|
3046
|
-
var replacedLabel = EventUtils_1.replaceTokens({
|
|
3453
|
+
var replacedLabel = (0, EventUtils_1.replaceTokens)({
|
|
3047
3454
|
text: label,
|
|
3048
3455
|
tokenReplacementMap: tokenReplacementMap,
|
|
3049
3456
|
allowSpecialParametersEscape: false,
|
|
3050
3457
|
allowFieldValuesEscape: false
|
|
3051
3458
|
});
|
|
3052
|
-
var truncatedLabel = EventUtils_1.truncateString(replacedLabel);
|
|
3459
|
+
var truncatedLabel = (0, EventUtils_1.truncateString)(replacedLabel);
|
|
3053
3460
|
return React.createElement(Menu_1.default.Item, {
|
|
3054
3461
|
key: "event-action-".concat(truncatedLabel),
|
|
3055
3462
|
onClick: function onClick(e) {
|
|
@@ -3057,30 +3464,33 @@ var PureEvents = function PureEvents(props) {
|
|
|
3057
3464
|
}
|
|
3058
3465
|
}, truncatedLabel);
|
|
3059
3466
|
};
|
|
3467
|
+
|
|
3060
3468
|
return {
|
|
3061
3469
|
eventtypeValues: eventtypeValues,
|
|
3062
3470
|
fieldFilters: fieldFilters,
|
|
3063
3471
|
eventActionComponent: eventActionComponent
|
|
3064
3472
|
};
|
|
3065
3473
|
});
|
|
3066
|
-
}, [eventActions]);
|
|
3067
|
-
// A map of fields, each associated with an array of objects with eventtypeValues for filtering by eventtype,
|
|
3474
|
+
}, [eventActions]); // A map of fields, each associated with an array of objects with eventtypeValues for filtering by eventtype,
|
|
3068
3475
|
// and fieldActionComponent (needs to be Menu.Item and will be rendered inside a Menu component)
|
|
3069
3476
|
// to display in its respective dropdown in the Actions column
|
|
3477
|
+
|
|
3070
3478
|
var renderFieldActions = React.useMemo(function () {
|
|
3071
3479
|
if (_typeof(fieldActions) !== 'object') return {};
|
|
3072
3480
|
var fieldActionsMap = {};
|
|
3073
|
-
Object.entries(fieldActions).forEach(function (
|
|
3074
|
-
var
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3481
|
+
Object.entries(fieldActions).forEach(function (_ref4) {
|
|
3482
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
3483
|
+
currentFieldName = _ref5[0],
|
|
3484
|
+
currentFieldActions = _ref5[1];
|
|
3485
|
+
|
|
3486
|
+
fieldActionsMap[currentFieldName] = currentFieldActions.map(function (_ref6) {
|
|
3487
|
+
var eventType = _ref6.eventType,
|
|
3488
|
+
label = _ref6.label,
|
|
3489
|
+
_ref6$eventtypeValues = _ref6.eventtypeValues,
|
|
3490
|
+
eventtypeValues = _ref6$eventtypeValues === void 0 ? [] : _ref6$eventtypeValues;
|
|
3491
|
+
|
|
3082
3492
|
var onMenuItemClick = function onMenuItemClick(e, fieldActionProps, tokenReplacementMap) {
|
|
3083
|
-
var payload = EventUtils_1.convertToPayloadFormat(fieldActionProps.event, {
|
|
3493
|
+
var payload = (0, EventUtils_1.convertToPayloadFormat)(fieldActionProps.event, {
|
|
3084
3494
|
name: fieldActionProps.field,
|
|
3085
3495
|
value: fieldActionProps.value,
|
|
3086
3496
|
tokenReplacementMap: tokenReplacementMap
|
|
@@ -3091,13 +3501,14 @@ var PureEvents = function PureEvents(props) {
|
|
|
3091
3501
|
payload: payload
|
|
3092
3502
|
});
|
|
3093
3503
|
};
|
|
3504
|
+
|
|
3094
3505
|
var fieldActionComponent = function fieldActionComponent(fieldActionProps) {
|
|
3095
3506
|
var field = fieldActionProps.field,
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
var tokenReplacementMap = EventUtils_1.generateTokenReplacementMap({
|
|
3507
|
+
value = fieldActionProps.value,
|
|
3508
|
+
rowIndex = fieldActionProps.rowIndex,
|
|
3509
|
+
pageNumber = fieldActionProps.pageNumber,
|
|
3510
|
+
event = fieldActionProps.event;
|
|
3511
|
+
var tokenReplacementMap = (0, EventUtils_1.generateTokenReplacementMap)({
|
|
3101
3512
|
dataSources: dataSources,
|
|
3102
3513
|
rowIndex: rowIndex,
|
|
3103
3514
|
pageNumber: pageNumber,
|
|
@@ -3105,13 +3516,13 @@ var PureEvents = function PureEvents(props) {
|
|
|
3105
3516
|
value: value,
|
|
3106
3517
|
event: event
|
|
3107
3518
|
});
|
|
3108
|
-
var replacedLabel = EventUtils_1.replaceTokens({
|
|
3519
|
+
var replacedLabel = (0, EventUtils_1.replaceTokens)({
|
|
3109
3520
|
text: label,
|
|
3110
3521
|
tokenReplacementMap: tokenReplacementMap,
|
|
3111
3522
|
allowSpecialParametersEscape: false,
|
|
3112
3523
|
allowFieldValuesEscape: false
|
|
3113
3524
|
});
|
|
3114
|
-
var truncatedLabel = EventUtils_1.truncateString(replacedLabel);
|
|
3525
|
+
var truncatedLabel = (0, EventUtils_1.truncateString)(replacedLabel);
|
|
3115
3526
|
return React.createElement(Menu_1.default.Item, {
|
|
3116
3527
|
key: "".concat(currentFieldName, "-field-action-").concat(truncatedLabel),
|
|
3117
3528
|
onClick: function onClick(e) {
|
|
@@ -3119,6 +3530,7 @@ var PureEvents = function PureEvents(props) {
|
|
|
3119
3530
|
}
|
|
3120
3531
|
}, truncatedLabel);
|
|
3121
3532
|
};
|
|
3533
|
+
|
|
3122
3534
|
return {
|
|
3123
3535
|
eventtypeValues: eventtypeValues,
|
|
3124
3536
|
fieldActionComponent: fieldActionComponent
|
|
@@ -3126,27 +3538,30 @@ var PureEvents = function PureEvents(props) {
|
|
|
3126
3538
|
});
|
|
3127
3539
|
});
|
|
3128
3540
|
return fieldActionsMap;
|
|
3129
|
-
}, [fieldActions]);
|
|
3130
|
-
|
|
3541
|
+
}, [fieldActions]); // formulate the options object required by the SUI EventsViewer component
|
|
3542
|
+
|
|
3131
3543
|
var suiEventsViewerOptions = {
|
|
3132
3544
|
renderEventActions: renderEventActions,
|
|
3133
3545
|
renderFieldActions: renderFieldActions,
|
|
3134
3546
|
footerFields: footerFields,
|
|
3135
|
-
fieldValueHighlightMap:
|
|
3547
|
+
fieldValueHighlightMap: highlightValuesByFieldCombined
|
|
3136
3548
|
};
|
|
3137
|
-
|
|
3138
|
-
|
|
3549
|
+
|
|
3550
|
+
var handleFieldClicked = showFieldSummary && function (e, _ref7) {
|
|
3551
|
+
var field = _ref7.field;
|
|
3139
3552
|
setFieldSummaryField(field);
|
|
3140
3553
|
setFieldSummaryAnchor(e.currentTarget.parentElement);
|
|
3141
3554
|
};
|
|
3142
|
-
|
|
3143
|
-
|
|
3555
|
+
|
|
3556
|
+
var handleTimeClicked = function handleTimeClicked(e, _ref8) {
|
|
3557
|
+
var time = _ref8.time;
|
|
3144
3558
|
setTimeValue(time);
|
|
3145
3559
|
setTimeFieldAnchor(e.currentTarget);
|
|
3146
3560
|
};
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3561
|
+
|
|
3562
|
+
var handleValueClicked = function handleValueClicked(e, _ref9) {
|
|
3563
|
+
var field = _ref9.field,
|
|
3564
|
+
value = _ref9.value;
|
|
3150
3565
|
onEventTrigger({
|
|
3151
3566
|
originalEvent: e,
|
|
3152
3567
|
type: 'value.click',
|
|
@@ -3156,9 +3571,10 @@ var PureEvents = function PureEvents(props) {
|
|
|
3156
3571
|
}
|
|
3157
3572
|
});
|
|
3158
3573
|
};
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3574
|
+
|
|
3575
|
+
var handleTagClicked = function handleTagClicked(e, _ref10) {
|
|
3576
|
+
var field = _ref10.field,
|
|
3577
|
+
value = _ref10.value;
|
|
3162
3578
|
onEventTrigger({
|
|
3163
3579
|
originalEvent: e,
|
|
3164
3580
|
type: 'tag.click',
|
|
@@ -3168,6 +3584,7 @@ var PureEvents = function PureEvents(props) {
|
|
|
3168
3584
|
}
|
|
3169
3585
|
});
|
|
3170
3586
|
};
|
|
3587
|
+
|
|
3171
3588
|
var handleTimeDrilldown = function handleTimeDrilldown(e, timeInterval) {
|
|
3172
3589
|
onEventTrigger({
|
|
3173
3590
|
originalEvent: e,
|
|
@@ -3175,14 +3592,15 @@ var PureEvents = function PureEvents(props) {
|
|
|
3175
3592
|
payload: {
|
|
3176
3593
|
name: '_time',
|
|
3177
3594
|
value: timeValue,
|
|
3178
|
-
epochTime: EventUtils_1.getEpochTime(timeValue),
|
|
3595
|
+
epochTime: (0, EventUtils_1.getEpochTime)(timeValue),
|
|
3179
3596
|
window: timeInterval
|
|
3180
3597
|
}
|
|
3181
3598
|
});
|
|
3182
3599
|
};
|
|
3600
|
+
|
|
3183
3601
|
var handleActionClicked = function handleActionClicked(event, data) {
|
|
3184
3602
|
var actionType = data.action,
|
|
3185
|
-
|
|
3603
|
+
field = data.field;
|
|
3186
3604
|
onEventTrigger({
|
|
3187
3605
|
originalEvent: event,
|
|
3188
3606
|
type: "events.search.".concat(actionType),
|
|
@@ -3191,6 +3609,7 @@ var PureEvents = function PureEvents(props) {
|
|
|
3191
3609
|
}
|
|
3192
3610
|
});
|
|
3193
3611
|
};
|
|
3612
|
+
|
|
3194
3613
|
return React.createElement(EventsContainer, {
|
|
3195
3614
|
backgroundColor: backgroundColor,
|
|
3196
3615
|
width: width,
|
|
@@ -3229,6 +3648,7 @@ var PureEvents = function PureEvents(props) {
|
|
|
3229
3648
|
}
|
|
3230
3649
|
})));
|
|
3231
3650
|
};
|
|
3651
|
+
|
|
3232
3652
|
PureEvents.propTypes = {
|
|
3233
3653
|
width: T.oneOfType([T.string, T.number]),
|
|
3234
3654
|
height: T.oneOfType([T.string, T.number]),
|
|
@@ -3273,101 +3693,117 @@ PureEvents.defaultProps = {
|
|
|
3273
3693
|
onRequestParamsChange: lodash_1.noop,
|
|
3274
3694
|
onEventTrigger: lodash_1.noop
|
|
3275
3695
|
};
|
|
3276
|
-
exports.default = FixedSizeContainer_1.default(PureEvents);
|
|
3696
|
+
exports.default = (0, FixedSizeContainer_1.default)(PureEvents);
|
|
3277
3697
|
|
|
3278
3698
|
/***/ }),
|
|
3279
|
-
/*
|
|
3699
|
+
/* 205 */
|
|
3280
3700
|
/***/ (function(module, exports) {
|
|
3281
3701
|
|
|
3282
3702
|
module.exports = require("@splunk/react-events-viewer/components/EventsViewer");
|
|
3283
3703
|
|
|
3284
3704
|
/***/ }),
|
|
3285
|
-
/*
|
|
3705
|
+
/* 206 */
|
|
3286
3706
|
/***/ (function(module, exports) {
|
|
3287
3707
|
|
|
3288
3708
|
module.exports = require("@splunk/time-range-utils/time");
|
|
3289
3709
|
|
|
3290
3710
|
/***/ }),
|
|
3291
|
-
/*
|
|
3711
|
+
/* 207 */
|
|
3292
3712
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3293
3713
|
|
|
3294
3714
|
"use strict";
|
|
3295
3715
|
|
|
3296
3716
|
|
|
3717
|
+
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
3718
|
+
|
|
3719
|
+
var _templateObject;
|
|
3720
|
+
|
|
3297
3721
|
Object.defineProperty(exports, "__esModule", {
|
|
3298
3722
|
value: true
|
|
3299
3723
|
});
|
|
3724
|
+
|
|
3300
3725
|
var React = __webpack_require__(1);
|
|
3726
|
+
|
|
3301
3727
|
var react_1 = __webpack_require__(1);
|
|
3302
|
-
|
|
3303
|
-
var
|
|
3304
|
-
|
|
3728
|
+
|
|
3729
|
+
var Popover_1 = __webpack_require__(62);
|
|
3730
|
+
|
|
3731
|
+
var Markdown_1 = __webpack_require__(122);
|
|
3732
|
+
|
|
3733
|
+
var FieldSummary_1 = __webpack_require__(208);
|
|
3734
|
+
|
|
3305
3735
|
var lodash_1 = __webpack_require__(3);
|
|
3736
|
+
|
|
3306
3737
|
var i18n_1 = __webpack_require__(2);
|
|
3738
|
+
|
|
3307
3739
|
var styled_components_1 = __webpack_require__(4);
|
|
3308
|
-
|
|
3740
|
+
|
|
3741
|
+
var EventsContext_1 = __webpack_require__(152);
|
|
3742
|
+
|
|
3309
3743
|
var popoverContainerStyle = {
|
|
3310
3744
|
padding: '20px',
|
|
3311
3745
|
width: 500
|
|
3312
3746
|
};
|
|
3313
|
-
var StyledMarkdown = styled_components_1.default(Markdown_1.default)
|
|
3314
|
-
|
|
3315
|
-
componentId: "sc-1k26kpm-0"
|
|
3316
|
-
})(["p{margin:0;}"]);
|
|
3747
|
+
var StyledMarkdown = (0, styled_components_1.default)(Markdown_1.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* removes unnecessary margin on the internal paragraph component */\n p {\n margin: 0;\n }\n"])));
|
|
3748
|
+
|
|
3317
3749
|
var actionsForField = function actionsForField(field) {
|
|
3318
|
-
var actions = [];
|
|
3319
|
-
|
|
3750
|
+
var actions = []; // this logic is used in determining whether to display numeric stats in ui-platform (FieldStats.tsx)
|
|
3751
|
+
|
|
3320
3752
|
if (typeof field.mean === 'number') {
|
|
3321
3753
|
actions.push({
|
|
3322
3754
|
name: 'avgByTime',
|
|
3323
|
-
label: i18n_1._('Average over time')
|
|
3755
|
+
label: (0, i18n_1._)('Average over time')
|
|
3324
3756
|
});
|
|
3325
3757
|
actions.push({
|
|
3326
3758
|
name: 'maxByTime',
|
|
3327
|
-
label: i18n_1._('Max value over time')
|
|
3759
|
+
label: (0, i18n_1._)('Max value over time')
|
|
3328
3760
|
});
|
|
3329
3761
|
actions.push({
|
|
3330
3762
|
name: 'minByTime',
|
|
3331
|
-
label: i18n_1._('Min value over time')
|
|
3763
|
+
label: (0, i18n_1._)('Min value over time')
|
|
3332
3764
|
});
|
|
3333
3765
|
}
|
|
3766
|
+
|
|
3334
3767
|
actions.push({
|
|
3335
3768
|
name: 'topValues',
|
|
3336
|
-
label: i18n_1._('Top values')
|
|
3769
|
+
label: (0, i18n_1._)('Top values')
|
|
3337
3770
|
});
|
|
3338
3771
|
actions.push({
|
|
3339
3772
|
name: 'topValuesByTime',
|
|
3340
|
-
label: i18n_1._('Top values by time')
|
|
3773
|
+
label: (0, i18n_1._)('Top values by time')
|
|
3341
3774
|
});
|
|
3342
3775
|
actions.push({
|
|
3343
3776
|
name: 'rareValues',
|
|
3344
|
-
label: i18n_1._('Rare values')
|
|
3777
|
+
label: (0, i18n_1._)('Rare values')
|
|
3345
3778
|
});
|
|
3346
3779
|
actions.push({
|
|
3347
3780
|
name: 'allValues',
|
|
3348
|
-
label: i18n_1._('Events with this field')
|
|
3781
|
+
label: (0, i18n_1._)('Events with this field')
|
|
3349
3782
|
});
|
|
3350
3783
|
return actions;
|
|
3351
3784
|
};
|
|
3785
|
+
|
|
3352
3786
|
var FieldSummaryTooltip = function FieldSummaryTooltip(props) {
|
|
3353
3787
|
var open = props.open,
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3788
|
+
anchor = props.anchor,
|
|
3789
|
+
handleTooltipClose = props.handleTooltipClose,
|
|
3790
|
+
fieldName = props.fieldName,
|
|
3791
|
+
fieldSummaryMap = props.fieldSummaryMap,
|
|
3792
|
+
onActionClicked = props.onActionClicked,
|
|
3793
|
+
onFieldValueClicked = props.onFieldValueClicked;
|
|
3794
|
+
|
|
3795
|
+
var _ref = (0, react_1.useContext)(EventsContext_1.default),
|
|
3796
|
+
isSplunkWebAvailable = _ref.isSplunkWebAvailable;
|
|
3797
|
+
|
|
3798
|
+
var getActionsForField = (0, react_1.useCallback)(function (field) {
|
|
3363
3799
|
return isSplunkWebAvailable ? actionsForField(field) : [];
|
|
3364
|
-
}, [isSplunkWebAvailable]);
|
|
3365
|
-
|
|
3366
|
-
if (!open) return null;
|
|
3367
|
-
|
|
3800
|
+
}, [isSplunkWebAvailable]); // if the anchor is null or no field has been clicked, do not render the tooltip
|
|
3801
|
+
|
|
3802
|
+
if (!open) return null; // retrieve the field summary for this field. if there is no field data, show fallback messaging
|
|
3803
|
+
|
|
3368
3804
|
var field = fieldSummaryMap[fieldName];
|
|
3369
3805
|
var fieldSummaryExists = !!field;
|
|
3370
|
-
var fallbackText = i18n_1._("Please configure an additional datasource called `fieldsummary` using the `... | fieldsummary maxvals=10` SPL command for field summaries to be shown.");
|
|
3806
|
+
var fallbackText = (0, i18n_1._)("Please configure an additional datasource called `fieldsummary` using the `... | fieldsummary maxvals=10` SPL command for field summaries to be shown.");
|
|
3371
3807
|
return React.createElement(Popover_1.default, {
|
|
3372
3808
|
open: open,
|
|
3373
3809
|
defaultPlacement: "below",
|
|
@@ -3386,6 +3822,7 @@ var FieldSummaryTooltip = function FieldSummaryTooltip(props) {
|
|
|
3386
3822
|
text: fallbackText
|
|
3387
3823
|
})));
|
|
3388
3824
|
};
|
|
3825
|
+
|
|
3389
3826
|
FieldSummaryTooltip.defaultProps = {
|
|
3390
3827
|
open: false,
|
|
3391
3828
|
anchor: null,
|
|
@@ -3398,48 +3835,69 @@ FieldSummaryTooltip.defaultProps = {
|
|
|
3398
3835
|
exports.default = FieldSummaryTooltip;
|
|
3399
3836
|
|
|
3400
3837
|
/***/ }),
|
|
3401
|
-
/*
|
|
3838
|
+
/* 208 */
|
|
3402
3839
|
/***/ (function(module, exports) {
|
|
3403
3840
|
|
|
3404
3841
|
module.exports = require("@splunk/react-field-summary/components/FieldSummary");
|
|
3405
3842
|
|
|
3406
3843
|
/***/ }),
|
|
3407
|
-
/*
|
|
3844
|
+
/* 209 */
|
|
3408
3845
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3409
3846
|
|
|
3410
3847
|
"use strict";
|
|
3411
3848
|
|
|
3412
3849
|
|
|
3413
3850
|
var _slicedToArray = __webpack_require__(17);
|
|
3851
|
+
|
|
3852
|
+
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
3853
|
+
|
|
3854
|
+
var _templateObject;
|
|
3855
|
+
|
|
3414
3856
|
Object.defineProperty(exports, "__esModule", {
|
|
3415
3857
|
value: true
|
|
3416
3858
|
});
|
|
3859
|
+
|
|
3417
3860
|
var React = __webpack_require__(1);
|
|
3418
|
-
|
|
3419
|
-
var
|
|
3420
|
-
|
|
3421
|
-
var
|
|
3422
|
-
|
|
3423
|
-
var
|
|
3424
|
-
|
|
3425
|
-
var
|
|
3861
|
+
|
|
3862
|
+
var Popover_1 = __webpack_require__(62);
|
|
3863
|
+
|
|
3864
|
+
var ControlGroup_1 = __webpack_require__(210);
|
|
3865
|
+
|
|
3866
|
+
var Button_1 = __webpack_require__(123);
|
|
3867
|
+
|
|
3868
|
+
var Text_1 = __webpack_require__(211);
|
|
3869
|
+
|
|
3870
|
+
var Message_1 = __webpack_require__(124);
|
|
3871
|
+
|
|
3872
|
+
var Select_1 = __webpack_require__(212);
|
|
3873
|
+
|
|
3874
|
+
var Link_1 = __webpack_require__(213);
|
|
3875
|
+
|
|
3876
|
+
var Heading_1 = __webpack_require__(125);
|
|
3877
|
+
|
|
3426
3878
|
var lodash_1 = __webpack_require__(3);
|
|
3879
|
+
|
|
3427
3880
|
var i18n_1 = __webpack_require__(2);
|
|
3881
|
+
|
|
3428
3882
|
var styled_components_1 = __webpack_require__(4);
|
|
3429
|
-
|
|
3883
|
+
|
|
3884
|
+
var numberUtils_1 = __webpack_require__(31);
|
|
3885
|
+
|
|
3430
3886
|
var pick_1 = __webpack_require__(23);
|
|
3431
|
-
|
|
3432
|
-
// custom popover sizing for Enterprise vs. Prisma themes - additional px for Prisma theme to fit controls
|
|
3887
|
+
|
|
3888
|
+
var EventUtils_1 = __webpack_require__(120); // custom popover sizing for Enterprise vs. Prisma themes - additional px for Prisma theme to fit controls
|
|
3889
|
+
|
|
3890
|
+
|
|
3433
3891
|
var TimePopoverContainer = styled_components_1.default.div.withConfig({
|
|
3434
3892
|
displayName: "TimeControlsPopover__TimePopoverContainer",
|
|
3435
3893
|
componentId: "fj32ze-0"
|
|
3436
3894
|
})(["padding:20px;width:", ";.time-drilldown-header{margin:0px;}[data-test='nearby-controls']{margin:0px;width:", ";}"], function (props) {
|
|
3437
|
-
return pick_1.default({
|
|
3895
|
+
return (0, pick_1.default)({
|
|
3438
3896
|
enterprise: '372px',
|
|
3439
3897
|
prisma: '422px'
|
|
3440
3898
|
})(props);
|
|
3441
3899
|
}, function (props) {
|
|
3442
|
-
return pick_1.default({
|
|
3900
|
+
return (0, pick_1.default)({
|
|
3443
3901
|
enterprise: '289.75px',
|
|
3444
3902
|
prisma: '329.75px'
|
|
3445
3903
|
})(props);
|
|
@@ -3452,10 +3910,7 @@ var NearbyValueRow = styled_components_1.default.div.withConfig({
|
|
|
3452
3910
|
displayName: "TimeControlsPopover__NearbyValueRow",
|
|
3453
3911
|
componentId: "fj32ze-2"
|
|
3454
3912
|
})(["display:flex;align-items:flex-start;justify-content:center;"]);
|
|
3455
|
-
var SectionHeading = styled_components_1.default(Heading_1.default)
|
|
3456
|
-
displayName: "TimeControlsPopover__SectionHeading",
|
|
3457
|
-
componentId: "fj32ze-3"
|
|
3458
|
-
})(["margin-top:20px;"]);
|
|
3913
|
+
var SectionHeading = (0, styled_components_1.default)(Heading_1.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-top: 20px;\n"])));
|
|
3459
3914
|
var rangeTypeInputStyle = {
|
|
3460
3915
|
minWidth: 80
|
|
3461
3916
|
};
|
|
@@ -3470,50 +3925,63 @@ var rangeUnitInputStyle = {
|
|
|
3470
3925
|
var applyButtonStyle = {
|
|
3471
3926
|
marginLeft: 10
|
|
3472
3927
|
};
|
|
3928
|
+
|
|
3473
3929
|
var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
3474
3930
|
var open = props.open,
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3931
|
+
anchor = props.anchor,
|
|
3932
|
+
time = props.time,
|
|
3933
|
+
handleTooltipClose = props.handleTooltipClose,
|
|
3934
|
+
onTimeDrilldown = props.onTimeDrilldown; // nearby events controls default to +/- 5 second(s)
|
|
3935
|
+
|
|
3479
3936
|
var _React$useState = React.useState('plusminus'),
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3937
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3938
|
+
rangeType = _React$useState2[0],
|
|
3939
|
+
setRangeType = _React$useState2[1];
|
|
3940
|
+
|
|
3483
3941
|
var _React$useState3 = React.useState('5'),
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3942
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3943
|
+
rangeAmount = _React$useState4[0],
|
|
3944
|
+
setRangeAmount = _React$useState4[1];
|
|
3945
|
+
|
|
3487
3946
|
var _React$useState5 = React.useState('s'),
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3947
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3948
|
+
rangeUnit = _React$useState6[0],
|
|
3949
|
+
setRangeUnit = _React$useState6[1]; // if validation fails, this triggers the error state on the controls to show
|
|
3950
|
+
|
|
3951
|
+
|
|
3491
3952
|
var _React$useState7 = React.useState(false),
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3953
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3954
|
+
isInvalidInput = _React$useState8[0],
|
|
3955
|
+
setInvalidInput = _React$useState8[1];
|
|
3956
|
+
|
|
3957
|
+
var errorMessage = (0, i18n_1._)('Value must be an integer greater than 0');
|
|
3958
|
+
|
|
3496
3959
|
var handleRangeTypeChange = function handleRangeTypeChange(e, _ref) {
|
|
3497
3960
|
var value = _ref.value;
|
|
3498
3961
|
setRangeType(value);
|
|
3499
3962
|
};
|
|
3963
|
+
|
|
3500
3964
|
var handleRangeAmountChange = function handleRangeAmountChange(e, _ref2) {
|
|
3501
3965
|
var value = _ref2.value;
|
|
3502
3966
|
setRangeAmount(value);
|
|
3503
3967
|
};
|
|
3968
|
+
|
|
3504
3969
|
var handleRangeUnitChange = function handleRangeUnitChange(e, _ref3) {
|
|
3505
3970
|
var value = _ref3.value;
|
|
3506
3971
|
setRangeUnit(value);
|
|
3507
3972
|
};
|
|
3973
|
+
|
|
3508
3974
|
var handleSubmit = function handleSubmit(e) {
|
|
3509
3975
|
// if the entered range amount is not a number, is not greater than 0, or is not an integer, then it is invalid
|
|
3510
|
-
var parsedIntervalAmount = numberUtils_1.parseNumber(rangeAmount);
|
|
3976
|
+
var parsedIntervalAmount = (0, numberUtils_1.parseNumber)(rangeAmount);
|
|
3977
|
+
|
|
3511
3978
|
if (Number.isNaN(parsedIntervalAmount) || parsedIntervalAmount <= 0 || !Number.isInteger(parsedIntervalAmount)) {
|
|
3512
3979
|
setInvalidInput(true);
|
|
3513
3980
|
return;
|
|
3514
3981
|
}
|
|
3982
|
+
|
|
3515
3983
|
setInvalidInput(false);
|
|
3516
|
-
var timeInterval = EventUtils_1.getCustomTimeInterval({
|
|
3984
|
+
var timeInterval = (0, EventUtils_1.getCustomTimeInterval)({
|
|
3517
3985
|
time: time,
|
|
3518
3986
|
rangeType: rangeType,
|
|
3519
3987
|
rangeAmount: rangeAmount,
|
|
@@ -3521,14 +3989,16 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
|
3521
3989
|
});
|
|
3522
3990
|
onTimeDrilldown(e, timeInterval);
|
|
3523
3991
|
};
|
|
3992
|
+
|
|
3524
3993
|
var handleEventIntervalClick = function handleEventIntervalClick(e, when) {
|
|
3525
3994
|
e.preventDefault();
|
|
3526
|
-
var timeInterval = EventUtils_1.getPredefinedTimeInterval({
|
|
3995
|
+
var timeInterval = (0, EventUtils_1.getPredefinedTimeInterval)({
|
|
3527
3996
|
time: time,
|
|
3528
3997
|
when: when
|
|
3529
3998
|
});
|
|
3530
3999
|
onTimeDrilldown(e, timeInterval);
|
|
3531
4000
|
};
|
|
4001
|
+
|
|
3532
4002
|
return React.createElement(Popover_1.default, {
|
|
3533
4003
|
open: open,
|
|
3534
4004
|
defaultPlacement: "below",
|
|
@@ -3545,7 +4015,7 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
|
3545
4015
|
"data-test": "invalid-time-input-message"
|
|
3546
4016
|
}, errorMessage), React.createElement(SectionHeading, {
|
|
3547
4017
|
level: 4
|
|
3548
|
-
}, i18n_1._('Events Before or After')), React.createElement(TimeTable, null, React.createElement("tbody", null, React.createElement("tr", {
|
|
4018
|
+
}, (0, i18n_1._)('Events Before or After')), React.createElement(TimeTable, null, React.createElement("tbody", null, React.createElement("tr", {
|
|
3549
4019
|
className: "before-after-values"
|
|
3550
4020
|
}, React.createElement("td", null, React.createElement(Link_1.default, {
|
|
3551
4021
|
"data-test": "before-time",
|
|
@@ -3553,22 +4023,22 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
|
3553
4023
|
onClick: function onClick(e) {
|
|
3554
4024
|
handleEventIntervalClick(e, 'before');
|
|
3555
4025
|
}
|
|
3556
|
-
}, i18n_1._('Before this time'))), React.createElement("td", null, React.createElement(Link_1.default, {
|
|
4026
|
+
}, (0, i18n_1._)('Before this time'))), React.createElement("td", null, React.createElement(Link_1.default, {
|
|
3557
4027
|
"data-test": "after-time",
|
|
3558
4028
|
to: "#",
|
|
3559
4029
|
onClick: function onClick(e) {
|
|
3560
4030
|
handleEventIntervalClick(e, 'after');
|
|
3561
4031
|
}
|
|
3562
|
-
}, i18n_1._('After this time'))), React.createElement("td", null, React.createElement(Link_1.default, {
|
|
4032
|
+
}, (0, i18n_1._)('After this time'))), React.createElement("td", null, React.createElement(Link_1.default, {
|
|
3563
4033
|
"data-test": "at-time",
|
|
3564
4034
|
to: "#",
|
|
3565
4035
|
onClick: function onClick(e) {
|
|
3566
4036
|
handleEventIntervalClick(e, 'at');
|
|
3567
4037
|
}
|
|
3568
|
-
}, i18n_1._('At this time')))))), React.createElement(SectionHeading, {
|
|
4038
|
+
}, (0, i18n_1._)('At this time')))))), React.createElement(SectionHeading, {
|
|
3569
4039
|
level: 4,
|
|
3570
4040
|
className: "nearby-header"
|
|
3571
|
-
}, i18n_1._('Nearby Events')), React.createElement(NearbyValueRow, {
|
|
4041
|
+
}, (0, i18n_1._)('Nearby Events')), React.createElement(NearbyValueRow, {
|
|
3572
4042
|
className: "nearby-value"
|
|
3573
4043
|
}, React.createElement(ControlGroup_1.default, {
|
|
3574
4044
|
"data-test": "nearby-controls",
|
|
@@ -3625,12 +4095,13 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
|
3625
4095
|
label: "millisecond(s)",
|
|
3626
4096
|
value: "ms"
|
|
3627
4097
|
}))), React.createElement(Button_1.default, {
|
|
3628
|
-
label: i18n_1._('Apply'),
|
|
4098
|
+
label: (0, i18n_1._)('Apply'),
|
|
3629
4099
|
onClick: handleSubmit,
|
|
3630
4100
|
style: applyButtonStyle,
|
|
3631
4101
|
"data-test": "apply-custom-time"
|
|
3632
4102
|
}))));
|
|
3633
4103
|
};
|
|
4104
|
+
|
|
3634
4105
|
TimeControlsPopover.defaultProps = {
|
|
3635
4106
|
open: false,
|
|
3636
4107
|
anchor: null,
|
|
@@ -3641,25 +4112,25 @@ TimeControlsPopover.defaultProps = {
|
|
|
3641
4112
|
exports.default = TimeControlsPopover;
|
|
3642
4113
|
|
|
3643
4114
|
/***/ }),
|
|
3644
|
-
/*
|
|
4115
|
+
/* 210 */
|
|
3645
4116
|
/***/ (function(module, exports) {
|
|
3646
4117
|
|
|
3647
4118
|
module.exports = require("@splunk/react-ui/ControlGroup");
|
|
3648
4119
|
|
|
3649
4120
|
/***/ }),
|
|
3650
|
-
/*
|
|
4121
|
+
/* 211 */
|
|
3651
4122
|
/***/ (function(module, exports) {
|
|
3652
4123
|
|
|
3653
4124
|
module.exports = require("@splunk/react-ui/Text");
|
|
3654
4125
|
|
|
3655
4126
|
/***/ }),
|
|
3656
|
-
/*
|
|
4127
|
+
/* 212 */
|
|
3657
4128
|
/***/ (function(module, exports) {
|
|
3658
4129
|
|
|
3659
4130
|
module.exports = require("@splunk/react-ui/Select");
|
|
3660
4131
|
|
|
3661
4132
|
/***/ }),
|
|
3662
|
-
/*
|
|
4133
|
+
/* 213 */
|
|
3663
4134
|
/***/ (function(module, exports) {
|
|
3664
4135
|
|
|
3665
4136
|
module.exports = require("@splunk/react-ui/Link");
|