@splunk/visualizations 26.0.0 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
package/Events.js
CHANGED
|
@@ -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,11 +205,17 @@ 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 {
|
|
@@ -220,11 +228,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
220
228
|
componentId: "sc-1yhgpod-0"
|
|
221
229
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
222
230
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
223
|
-
});
|
|
224
|
-
|
|
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
238
|
width: (0, style_1.toPx)(width)
|
|
@@ -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": "26.
|
|
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
544
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
503
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,6 +559,7 @@ 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
564
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
521
565
|
return {
|
|
@@ -524,6 +568,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
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
|
/***/ }),
|
|
@@ -603,11 +651,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
603
651
|
value: true
|
|
604
652
|
});
|
|
605
653
|
exports.shouldShowIconPlaceholder = void 0;
|
|
654
|
+
|
|
606
655
|
var React = __webpack_require__(1);
|
|
656
|
+
|
|
607
657
|
var T = __webpack_require__(0);
|
|
658
|
+
|
|
608
659
|
var lodash_1 = __webpack_require__(3);
|
|
660
|
+
|
|
609
661
|
var i18n_1 = __webpack_require__(2);
|
|
662
|
+
|
|
610
663
|
var Message_1 = __webpack_require__(10);
|
|
664
|
+
|
|
611
665
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
612
666
|
/**
|
|
613
667
|
* @method shouldShowIconPlaceholder
|
|
@@ -615,6 +669,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
615
669
|
* @param {boolean} loading
|
|
616
670
|
* @returns {boolean}
|
|
617
671
|
*/
|
|
672
|
+
|
|
673
|
+
|
|
618
674
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
619
675
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
620
676
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -623,6 +679,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
623
679
|
var noFields = fields === undefined;
|
|
624
680
|
return loading || noData || noFields;
|
|
625
681
|
};
|
|
682
|
+
|
|
626
683
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
627
684
|
var propTypes = {
|
|
628
685
|
icon: T.func,
|
|
@@ -637,11 +694,13 @@ var propTypes = {
|
|
|
637
694
|
* @param {IconPlaceholderProps} props
|
|
638
695
|
* @returns {React.ReactElement}
|
|
639
696
|
*/
|
|
697
|
+
|
|
640
698
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
641
699
|
var width = props.width,
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
700
|
+
height = props.height,
|
|
701
|
+
icon = props.icon,
|
|
702
|
+
iconColor = props.iconColor;
|
|
703
|
+
|
|
645
704
|
if (icon) {
|
|
646
705
|
return React.createElement(icon, {
|
|
647
706
|
style: {
|
|
@@ -656,6 +715,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
656
715
|
height: '50%'
|
|
657
716
|
});
|
|
658
717
|
}
|
|
718
|
+
|
|
659
719
|
return React.createElement(Message_1.default, {
|
|
660
720
|
width: width,
|
|
661
721
|
height: height,
|
|
@@ -663,6 +723,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
663
723
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
664
724
|
});
|
|
665
725
|
};
|
|
726
|
+
|
|
666
727
|
IconPlaceholder.propTypes = propTypes;
|
|
667
728
|
IconPlaceholder.defaultProps = {
|
|
668
729
|
width: '100%',
|
|
@@ -678,21 +739,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
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,15 +768,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
701
768
|
none: 'asc'
|
|
702
769
|
};
|
|
703
770
|
var onSort;
|
|
771
|
+
|
|
704
772
|
if (typeof onRequestParamsChange === 'function') {
|
|
705
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
784
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
715
785
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -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
|
-
|
|
855
|
+
countArg = _ref2.count;
|
|
764
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
|
-
|
|
927
|
+
|
|
928
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
929
|
+
|
|
826
930
|
var Options_1 = __webpack_require__(30);
|
|
827
|
-
|
|
931
|
+
|
|
932
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
933
|
+
|
|
828
934
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
829
|
-
|
|
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);
|
|
941
|
+
|
|
832
942
|
var hocUtils_1 = __webpack_require__(27);
|
|
943
|
+
|
|
833
944
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
834
|
-
|
|
945
|
+
|
|
946
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
947
|
+
|
|
835
948
|
var id_1 = __webpack_require__(25);
|
|
836
|
-
|
|
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
|
-
|
|
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
|
+
|
|
856
980
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
857
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,38 +1012,51 @@ 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');
|
|
1023
|
+
|
|
892
1024
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
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);
|
|
1040
|
+
|
|
904
1041
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
905
|
-
|
|
906
|
-
|
|
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
|
-
|
|
1051
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1052
|
+
dataFramesInState = _React$useState8[0],
|
|
1053
|
+
setDataFramesInState = _React$useState8[1];
|
|
1054
|
+
|
|
915
1055
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1056
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1057
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1058
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1059
|
+
|
|
919
1060
|
var isMounted = React.useRef(true);
|
|
920
1061
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
921
1062
|
try {
|
|
@@ -940,11 +1081,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
940
1081
|
});
|
|
941
1082
|
} else {
|
|
942
1083
|
var dataFrames = dataFramesInState;
|
|
1084
|
+
|
|
943
1085
|
if (dataSources !== dataSourcesInState) {
|
|
944
1086
|
setDataSourcesInState(dataSources);
|
|
945
1087
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
946
1088
|
setDataFramesInState(dataFrames);
|
|
947
1089
|
}
|
|
1090
|
+
|
|
948
1091
|
return Options_1.Options.evaluate({
|
|
949
1092
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
950
1093
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -955,21 +1098,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
955
1098
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
956
1099
|
return {};
|
|
957
1100
|
}
|
|
1101
|
+
|
|
958
1102
|
return {};
|
|
959
1103
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
960
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
961
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1104
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
962
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
|
|
963
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
|
+
|
|
964
1108
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
965
1109
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1110
|
+
|
|
966
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) {
|
|
967
1112
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
968
1113
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
969
1114
|
});
|
|
970
|
-
}
|
|
971
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1115
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
972
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
|
+
|
|
973
1119
|
React.useEffect(function () {
|
|
974
1120
|
onComputedProps(clonedEvaluatedOptions);
|
|
975
1121
|
});
|
|
@@ -979,44 +1125,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
979
1125
|
isMounted.current = false;
|
|
980
1126
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
981
1127
|
}
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
// 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
|
+
|
|
986
1131
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
987
|
-
|
|
988
|
-
|
|
1132
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1133
|
+
supports = vizConfig.supports;
|
|
989
1134
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1135
|
+
|
|
990
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
|
|
991
1137
|
) {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
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
|
+
|
|
1001
1148
|
var eventCallbackProps = {};
|
|
1149
|
+
|
|
1002
1150
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1003
1151
|
var supportedEvents = vizConfig.events;
|
|
1004
1152
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1005
1153
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1006
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1007
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1154
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1008
1155
|
// then remove these lines
|
|
1156
|
+
|
|
1009
1157
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1010
1158
|
var payload = {};
|
|
1159
|
+
|
|
1011
1160
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1012
1161
|
payloadKeys.forEach(function (p) {
|
|
1013
1162
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1014
1163
|
});
|
|
1015
1164
|
}
|
|
1165
|
+
|
|
1016
1166
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1017
1167
|
if (ev && ev.payload) {
|
|
1018
1168
|
payload = ev.payload;
|
|
1019
1169
|
}
|
|
1170
|
+
|
|
1020
1171
|
return onEventTrigger({
|
|
1021
1172
|
originalEvent: ev,
|
|
1022
1173
|
payload: payload,
|
|
@@ -1024,8 +1175,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1024
1175
|
});
|
|
1025
1176
|
};
|
|
1026
1177
|
});
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1178
|
+
} // compute pure viz props which are not from options
|
|
1179
|
+
|
|
1180
|
+
|
|
1029
1181
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1030
1182
|
themeFunc: themeFunc
|
|
1031
1183
|
}));
|
|
@@ -1043,15 +1195,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1043
1195
|
* In future, we could automatically detect which all datasources are being used
|
|
1044
1196
|
* and bind those magically to pagination/sorting behavior.
|
|
1045
1197
|
*/
|
|
1198
|
+
|
|
1046
1199
|
var dataSourceMetadata = {};
|
|
1047
1200
|
var OptionKey = 'paginateDataSourceKey';
|
|
1048
1201
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1202
|
+
|
|
1049
1203
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1050
1204
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1051
1205
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1206
|
+
|
|
1052
1207
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1053
1208
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1054
1209
|
};
|
|
1210
|
+
|
|
1055
1211
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1056
1212
|
requestParams: requestParams,
|
|
1057
1213
|
meta: meta,
|
|
@@ -1066,103 +1222,120 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1066
1222
|
sortParams: sortParams,
|
|
1067
1223
|
paginatorParams: paginatorParams
|
|
1068
1224
|
};
|
|
1069
|
-
}
|
|
1070
|
-
|
|
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
|
+
|
|
1071
1228
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1072
1229
|
return null;
|
|
1073
1230
|
}
|
|
1231
|
+
|
|
1074
1232
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1075
1233
|
mode: mode,
|
|
1076
1234
|
width: width,
|
|
1077
1235
|
height: height
|
|
1078
1236
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1079
1237
|
};
|
|
1238
|
+
|
|
1080
1239
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1081
1240
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1082
1241
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1083
1242
|
theme: {}
|
|
1084
|
-
});
|
|
1085
|
-
|
|
1086
|
-
DashboardViz.config = vizConfig;
|
|
1087
|
-
|
|
1243
|
+
}); // attach viz config
|
|
1244
|
+
|
|
1245
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1246
|
+
|
|
1088
1247
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1089
1248
|
};
|
|
1249
|
+
|
|
1090
1250
|
exports.default = withDashboardViz;
|
|
1091
1251
|
|
|
1092
1252
|
/***/ }),
|
|
1093
|
-
/*
|
|
1253
|
+
/* 38 */
|
|
1094
1254
|
/***/ (function(module, exports) {
|
|
1095
1255
|
|
|
1096
1256
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1097
1257
|
|
|
1098
1258
|
/***/ }),
|
|
1099
|
-
/*
|
|
1259
|
+
/* 39 */
|
|
1100
1260
|
/***/ (function(module, exports) {
|
|
1101
1261
|
|
|
1102
1262
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1103
1263
|
|
|
1104
1264
|
/***/ }),
|
|
1105
|
-
/*
|
|
1265
|
+
/* 40 */
|
|
1106
1266
|
/***/ (function(module, exports) {
|
|
1107
1267
|
|
|
1108
1268
|
module.exports = require("@splunk/moment");
|
|
1109
1269
|
|
|
1110
1270
|
/***/ }),
|
|
1111
|
-
/*
|
|
1271
|
+
/* 41 */
|
|
1112
1272
|
/***/ (function(module, exports) {
|
|
1113
1273
|
|
|
1114
1274
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1115
1275
|
|
|
1116
1276
|
/***/ }),
|
|
1117
|
-
/*
|
|
1277
|
+
/* 42 */
|
|
1118
1278
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1119
1279
|
|
|
1120
1280
|
"use strict";
|
|
1121
1281
|
|
|
1122
1282
|
|
|
1123
1283
|
var _classCallCheck = __webpack_require__(9);
|
|
1284
|
+
|
|
1124
1285
|
Object.defineProperty(exports, "__esModule", {
|
|
1125
1286
|
value: true
|
|
1126
1287
|
});
|
|
1127
1288
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1128
1289
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1290
|
+
|
|
1129
1291
|
var T = __webpack_require__(0);
|
|
1292
|
+
|
|
1130
1293
|
var lodash_1 = __webpack_require__(3);
|
|
1131
|
-
|
|
1132
|
-
// 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
|
+
|
|
1133
1298
|
exports.INITIAL_WIDTH = 250;
|
|
1134
1299
|
exports.INITIAL_HEIGHT = 250;
|
|
1135
1300
|
/**
|
|
1136
1301
|
* A Splunk visualization
|
|
1137
1302
|
*/
|
|
1303
|
+
|
|
1138
1304
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1139
1305
|
_classCallCheck(this, SplunkVisualization);
|
|
1140
1306
|
};
|
|
1307
|
+
|
|
1141
1308
|
SplunkVisualization.propTypes = {
|
|
1142
1309
|
/**
|
|
1143
1310
|
* display mode
|
|
1144
1311
|
*/
|
|
1145
1312
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1313
|
+
|
|
1146
1314
|
/**
|
|
1147
1315
|
* width in pixel or string, defaults to 100%
|
|
1148
1316
|
*/
|
|
1149
1317
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1318
|
+
|
|
1150
1319
|
/**
|
|
1151
1320
|
* height in pixel or string
|
|
1152
1321
|
*/
|
|
1153
1322
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1323
|
+
|
|
1154
1324
|
/**
|
|
1155
1325
|
* visualization context used for dynamic option evaluation
|
|
1156
1326
|
*/
|
|
1157
1327
|
context: T.object,
|
|
1328
|
+
|
|
1158
1329
|
/**
|
|
1159
1330
|
* visualization formatting options
|
|
1160
1331
|
*/
|
|
1161
1332
|
options: T.object,
|
|
1333
|
+
|
|
1162
1334
|
/**
|
|
1163
1335
|
* A callback to update formatting options
|
|
1164
1336
|
*/
|
|
1165
1337
|
onOptionsChange: T.func,
|
|
1338
|
+
|
|
1166
1339
|
/**
|
|
1167
1340
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1168
1341
|
*/
|
|
@@ -1171,6 +1344,7 @@ SplunkVisualization.propTypes = {
|
|
|
1171
1344
|
* current request params
|
|
1172
1345
|
*/
|
|
1173
1346
|
requestParams: T.object,
|
|
1347
|
+
|
|
1174
1348
|
/**
|
|
1175
1349
|
* current dataset
|
|
1176
1350
|
*/
|
|
@@ -1178,6 +1352,7 @@ SplunkVisualization.propTypes = {
|
|
|
1178
1352
|
fields: T.array,
|
|
1179
1353
|
columns: T.array
|
|
1180
1354
|
}),
|
|
1355
|
+
|
|
1181
1356
|
/**
|
|
1182
1357
|
* error
|
|
1183
1358
|
*/
|
|
@@ -1185,29 +1360,35 @@ SplunkVisualization.propTypes = {
|
|
|
1185
1360
|
level: T.string,
|
|
1186
1361
|
message: T.string
|
|
1187
1362
|
}),
|
|
1363
|
+
|
|
1188
1364
|
/**
|
|
1189
1365
|
* meta data that came with the dataset
|
|
1190
1366
|
*/
|
|
1191
1367
|
meta: T.object
|
|
1192
1368
|
})),
|
|
1369
|
+
|
|
1193
1370
|
/**
|
|
1194
1371
|
* A callback to trigger event
|
|
1195
1372
|
*/
|
|
1196
1373
|
onEventTrigger: T.func,
|
|
1374
|
+
|
|
1197
1375
|
/**
|
|
1198
1376
|
* Inform viz if there are handlers listening to events
|
|
1199
1377
|
*/
|
|
1200
1378
|
hasEventHandlers: T.bool,
|
|
1379
|
+
|
|
1201
1380
|
/**
|
|
1202
1381
|
* A callback to communicate computed props to a consumer
|
|
1203
1382
|
*/
|
|
1204
1383
|
onComputedProps: T.func,
|
|
1384
|
+
|
|
1205
1385
|
/**
|
|
1206
1386
|
* A callback to obtain visualization api
|
|
1207
1387
|
*/
|
|
1208
1388
|
vizActionHandlerRef: T.func,
|
|
1209
1389
|
loading: T.bool,
|
|
1210
1390
|
theme: T.object,
|
|
1391
|
+
|
|
1211
1392
|
/**
|
|
1212
1393
|
* A callback to request new data with updated request params
|
|
1213
1394
|
*/
|
|
@@ -1216,6 +1397,7 @@ SplunkVisualization.propTypes = {
|
|
|
1216
1397
|
/**
|
|
1217
1398
|
*
|
|
1218
1399
|
*/
|
|
1400
|
+
|
|
1219
1401
|
SplunkVisualization.defaultProps = {
|
|
1220
1402
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1221
1403
|
width: '100%',
|
|
@@ -1243,26 +1425,29 @@ SplunkVisualization.defaultProps = {
|
|
|
1243
1425
|
exports.default = SplunkVisualization;
|
|
1244
1426
|
|
|
1245
1427
|
/***/ }),
|
|
1246
|
-
/*
|
|
1428
|
+
/* 43 */
|
|
1247
1429
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1248
1430
|
|
|
1249
1431
|
"use strict";
|
|
1250
1432
|
|
|
1251
1433
|
|
|
1252
1434
|
var _classCallCheck = __webpack_require__(9);
|
|
1435
|
+
|
|
1253
1436
|
var _createClass = __webpack_require__(18);
|
|
1437
|
+
|
|
1254
1438
|
Object.defineProperty(exports, "__esModule", {
|
|
1255
1439
|
value: true
|
|
1256
1440
|
});
|
|
1257
1441
|
exports.DefaultVizActionHandler = void 0;
|
|
1442
|
+
|
|
1258
1443
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1259
1444
|
function DefaultVizActionHandler() {
|
|
1260
1445
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1261
1446
|
}
|
|
1447
|
+
|
|
1262
1448
|
_createClass(DefaultVizActionHandler, [{
|
|
1263
1449
|
key: "focus",
|
|
1264
|
-
value: function focus() {
|
|
1265
|
-
// noop
|
|
1450
|
+
value: function focus() {// noop
|
|
1266
1451
|
}
|
|
1267
1452
|
}, {
|
|
1268
1453
|
key: "snapshot",
|
|
@@ -1270,22 +1455,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1270
1455
|
return null; // noop
|
|
1271
1456
|
}
|
|
1272
1457
|
}]);
|
|
1458
|
+
|
|
1273
1459
|
return DefaultVizActionHandler;
|
|
1274
1460
|
}();
|
|
1275
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1276
|
-
|
|
1277
|
-
/***/ }),
|
|
1278
|
-
/* 43 */
|
|
1279
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1280
|
-
|
|
1281
|
-
"use strict";
|
|
1282
|
-
|
|
1283
1461
|
|
|
1284
|
-
|
|
1285
|
-
value: true
|
|
1286
|
-
});
|
|
1287
|
-
exports.validSortDirs = void 0;
|
|
1288
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1462
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1289
1463
|
|
|
1290
1464
|
/***/ }),
|
|
1291
1465
|
/* 44 */
|
|
@@ -1298,7 +1472,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1298
1472
|
value: true
|
|
1299
1473
|
});
|
|
1300
1474
|
exports.useDeepMemo = void 0;
|
|
1475
|
+
|
|
1301
1476
|
var react_1 = __webpack_require__(1);
|
|
1477
|
+
|
|
1302
1478
|
var lodash_1 = __webpack_require__(3);
|
|
1303
1479
|
/**
|
|
1304
1480
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1313,16 +1489,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1313
1489
|
* @param fn the function to be executed and
|
|
1314
1490
|
* @param dependencies an array of dependencies
|
|
1315
1491
|
*/
|
|
1492
|
+
|
|
1493
|
+
|
|
1316
1494
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1317
1495
|
var ref = (0, react_1.useRef)();
|
|
1496
|
+
|
|
1318
1497
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1319
1498
|
ref.current = {
|
|
1320
1499
|
dependencies: dependencies,
|
|
1321
1500
|
value: fn()
|
|
1322
1501
|
};
|
|
1323
1502
|
}
|
|
1503
|
+
|
|
1324
1504
|
return ref.current.value;
|
|
1325
1505
|
};
|
|
1506
|
+
|
|
1326
1507
|
exports.useDeepMemo = useDeepMemo;
|
|
1327
1508
|
|
|
1328
1509
|
/***/ }),
|
|
@@ -1336,19 +1517,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1336
1517
|
value: true
|
|
1337
1518
|
});
|
|
1338
1519
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
1520
|
+
|
|
1339
1521
|
var React = __webpack_require__(1);
|
|
1522
|
+
|
|
1340
1523
|
var T = __webpack_require__(0);
|
|
1524
|
+
|
|
1341
1525
|
var i18n_1 = __webpack_require__(2);
|
|
1526
|
+
|
|
1342
1527
|
var Message_1 = __webpack_require__(10);
|
|
1528
|
+
|
|
1343
1529
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1344
1530
|
/**
|
|
1345
1531
|
* @method isMissing
|
|
1346
1532
|
* @param {any} v
|
|
1347
1533
|
* @returns {boolean} true if the input value === null or undefined
|
|
1348
1534
|
*/
|
|
1535
|
+
|
|
1536
|
+
|
|
1349
1537
|
var isMissing = function isMissing(v) {
|
|
1350
1538
|
return v === null || v === undefined;
|
|
1351
1539
|
};
|
|
1540
|
+
|
|
1352
1541
|
exports.isMissing = isMissing;
|
|
1353
1542
|
/**
|
|
1354
1543
|
* @method misskingKeys
|
|
@@ -1356,11 +1545,13 @@ exports.isMissing = isMissing;
|
|
|
1356
1545
|
* @param {object} target
|
|
1357
1546
|
* @returns {string[]} the keys of missing required props
|
|
1358
1547
|
*/
|
|
1548
|
+
|
|
1359
1549
|
var missingKeys = function missingKeys(keys, target) {
|
|
1360
1550
|
return keys.filter(function (k) {
|
|
1361
1551
|
return (0, exports.isMissing)(target[k]);
|
|
1362
1552
|
});
|
|
1363
1553
|
};
|
|
1554
|
+
|
|
1364
1555
|
exports.missingKeys = missingKeys;
|
|
1365
1556
|
var propTypes = {
|
|
1366
1557
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1374,10 +1565,11 @@ var propTypes = {
|
|
|
1374
1565
|
* @param {MissingPropsProps} props
|
|
1375
1566
|
* @returns {React.ReactElement}
|
|
1376
1567
|
*/
|
|
1568
|
+
|
|
1377
1569
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1378
1570
|
var width = props.width,
|
|
1379
|
-
|
|
1380
|
-
|
|
1571
|
+
height = props.height,
|
|
1572
|
+
missingProps = props.missingProps;
|
|
1381
1573
|
return React.createElement(Message_1.default, {
|
|
1382
1574
|
"data-test": "message",
|
|
1383
1575
|
width: width,
|
|
@@ -1385,6 +1577,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
1385
1577
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1386
1578
|
});
|
|
1387
1579
|
};
|
|
1580
|
+
|
|
1388
1581
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1389
1582
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1390
1583
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -1403,15 +1596,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
1403
1596
|
Object.defineProperty(exports, "__esModule", {
|
|
1404
1597
|
value: true
|
|
1405
1598
|
});
|
|
1599
|
+
|
|
1406
1600
|
var React = __webpack_require__(1);
|
|
1601
|
+
|
|
1407
1602
|
var styled_components_1 = __webpack_require__(4);
|
|
1603
|
+
|
|
1408
1604
|
var hocUtils_1 = __webpack_require__(15);
|
|
1605
|
+
|
|
1409
1606
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1410
1607
|
displayName: "withEditModeCover__Cover",
|
|
1411
1608
|
componentId: "sc-1gsbnxb-0"
|
|
1412
1609
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1413
1610
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1414
|
-
'data-splunk-visualization-version': "26.
|
|
1611
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
1415
1612
|
}).withConfig({
|
|
1416
1613
|
displayName: "withEditModeCover__Blocker",
|
|
1417
1614
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1422,6 +1619,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1422
1619
|
* @param {ExtendedDashViz} Visualization
|
|
1423
1620
|
* @returns {ExtendedDashViz} Wrapper
|
|
1424
1621
|
*/
|
|
1622
|
+
|
|
1425
1623
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1426
1624
|
var Wrapper = function Wrapper(props) {
|
|
1427
1625
|
var mode = props.mode;
|
|
@@ -1430,12 +1628,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1430
1628
|
"data-test": "edit-mode-cover"
|
|
1431
1629
|
}));
|
|
1432
1630
|
};
|
|
1631
|
+
|
|
1433
1632
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1434
1633
|
Wrapper: Wrapper,
|
|
1435
1634
|
Visualization: Visualization
|
|
1436
1635
|
});
|
|
1437
1636
|
return Wrapper;
|
|
1438
1637
|
};
|
|
1638
|
+
|
|
1439
1639
|
exports.default = withEditModeCover;
|
|
1440
1640
|
|
|
1441
1641
|
/***/ }),
|
|
@@ -1448,27 +1648,37 @@ exports.default = withEditModeCover;
|
|
|
1448
1648
|
Object.defineProperty(exports, "__esModule", {
|
|
1449
1649
|
value: true
|
|
1450
1650
|
});
|
|
1651
|
+
|
|
1451
1652
|
var React = __webpack_require__(1);
|
|
1653
|
+
|
|
1452
1654
|
var colorUtils_1 = __webpack_require__(12);
|
|
1655
|
+
|
|
1453
1656
|
var variables_1 = __webpack_require__(11);
|
|
1657
|
+
|
|
1454
1658
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
1659
|
+
|
|
1455
1660
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1661
|
+
|
|
1456
1662
|
var hocUtils_1 = __webpack_require__(15);
|
|
1663
|
+
|
|
1457
1664
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1458
1665
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1459
1666
|
var config = Visualization.config;
|
|
1460
1667
|
var themes = config.themes;
|
|
1668
|
+
|
|
1461
1669
|
var Wrapper = function Wrapper(props) {
|
|
1462
1670
|
var _a, _b;
|
|
1671
|
+
|
|
1463
1672
|
var dataSources = props.dataSources,
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1673
|
+
loading = props.loading,
|
|
1674
|
+
options = props.options,
|
|
1675
|
+
height = props.height,
|
|
1676
|
+
width = props.width;
|
|
1468
1677
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
1469
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);
|
|
1470
1679
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
1471
1680
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
1681
|
+
|
|
1472
1682
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
1473
1683
|
return React.createElement(IconPlaceholder_1.default, {
|
|
1474
1684
|
"data-test": "icon-placeholder",
|
|
@@ -1479,14 +1689,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
1479
1689
|
iconColor: iconColor
|
|
1480
1690
|
});
|
|
1481
1691
|
}
|
|
1692
|
+
|
|
1482
1693
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
1483
1694
|
};
|
|
1695
|
+
|
|
1484
1696
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1485
1697
|
Wrapper: Wrapper,
|
|
1486
1698
|
Visualization: Visualization
|
|
1487
1699
|
});
|
|
1488
1700
|
return Wrapper;
|
|
1489
1701
|
};
|
|
1702
|
+
|
|
1490
1703
|
exports.default = withPlaceholder;
|
|
1491
1704
|
|
|
1492
1705
|
/***/ }),
|
|
@@ -1514,11 +1727,13 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
1514
1727
|
Object.defineProperty(exports, "__esModule", {
|
|
1515
1728
|
value: true
|
|
1516
1729
|
});
|
|
1730
|
+
|
|
1517
1731
|
var i18n_1 = __webpack_require__(2);
|
|
1732
|
+
|
|
1518
1733
|
var background = function background(_ref) {
|
|
1519
1734
|
var label = _ref.label,
|
|
1520
|
-
|
|
1521
|
-
|
|
1735
|
+
themes = _ref.themes,
|
|
1736
|
+
labelPosition = _ref.labelPosition;
|
|
1522
1737
|
return [{
|
|
1523
1738
|
label: (0, i18n_1._)(label || 'Background'),
|
|
1524
1739
|
option: 'backgroundColor',
|
|
@@ -1529,6 +1744,7 @@ var background = function background(_ref) {
|
|
|
1529
1744
|
}
|
|
1530
1745
|
}];
|
|
1531
1746
|
};
|
|
1747
|
+
|
|
1532
1748
|
exports.default = background;
|
|
1533
1749
|
|
|
1534
1750
|
/***/ }),
|
|
@@ -1635,17 +1851,25 @@ module.exports = require("@splunk/react-ui/Menu");
|
|
|
1635
1851
|
|
|
1636
1852
|
|
|
1637
1853
|
var _typeof = __webpack_require__(82);
|
|
1854
|
+
|
|
1638
1855
|
var _slicedToArray = __webpack_require__(17);
|
|
1856
|
+
|
|
1639
1857
|
var _toConsumableArray = __webpack_require__(8);
|
|
1858
|
+
|
|
1640
1859
|
var _defineProperty = __webpack_require__(7);
|
|
1860
|
+
|
|
1641
1861
|
Object.defineProperty(exports, "__esModule", {
|
|
1642
1862
|
value: true
|
|
1643
1863
|
});
|
|
1644
|
-
exports.truncateString = exports.getCustomTimeInterval = exports.getPredefinedTimeInterval = exports.getEpochTime = exports.generateTokenReplacementMap = exports.replaceTokens = exports.mergeFieldActions = exports.mergeEventActions = exports.getFieldSummaryMapping = exports.convertToPayloadFormat = void 0;
|
|
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
|
+
|
|
1645
1866
|
var time_1 = __webpack_require__(206);
|
|
1867
|
+
|
|
1646
1868
|
var lodash_1 = __webpack_require__(3);
|
|
1647
|
-
|
|
1648
|
-
// 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
|
+
|
|
1649
1873
|
var convertToPayloadFormat = function convertToPayloadFormat(obj) {
|
|
1650
1874
|
var initialValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1651
1875
|
if (!obj) return {};
|
|
@@ -1654,11 +1878,13 @@ var convertToPayloadFormat = function convertToPayloadFormat(obj) {
|
|
|
1654
1878
|
return Object.assign(Object.assign({}, acc), _defineProperty({}, key, obj[curr]));
|
|
1655
1879
|
}, initialValue);
|
|
1656
1880
|
};
|
|
1881
|
+
|
|
1657
1882
|
exports.convertToPayloadFormat = convertToPayloadFormat;
|
|
1883
|
+
|
|
1658
1884
|
var getFieldSummaryMapping = function getFieldSummaryMapping(columns, fields) {
|
|
1659
1885
|
// convert the `fieldsummary` payload to an array of objects
|
|
1660
|
-
var arr = (0, dataUtils_1.convertToArrOfObjects)(columns, fields);
|
|
1661
|
-
|
|
1886
|
+
var arr = (0, dataUtils_1.convertToArrOfObjects)(columns, fields); // forms an array of FieldData elements expected by the @splunk/react-field-summary component
|
|
1887
|
+
|
|
1662
1888
|
var fieldSummaryData = arr.map(function (d) {
|
|
1663
1889
|
return {
|
|
1664
1890
|
name: d.field,
|
|
@@ -1671,13 +1897,14 @@ var getFieldSummaryMapping = function getFieldSummaryMapping(columns, fields) {
|
|
|
1671
1897
|
stdev: d.stdev === null ? null : +d.stdev,
|
|
1672
1898
|
modes: JSON.parse(d.values)
|
|
1673
1899
|
};
|
|
1674
|
-
});
|
|
1675
|
-
|
|
1900
|
+
}); // creates a map of field name to its data for O(1) retrieval in the tooltip component
|
|
1901
|
+
|
|
1676
1902
|
var fieldSummaryMapping = fieldSummaryData.reduce(function (map, fieldData) {
|
|
1677
1903
|
return Object.assign(Object.assign({}, map), _defineProperty({}, fieldData.name, fieldData));
|
|
1678
1904
|
}, {});
|
|
1679
1905
|
return fieldSummaryMapping;
|
|
1680
1906
|
};
|
|
1907
|
+
|
|
1681
1908
|
exports.getFieldSummaryMapping = getFieldSummaryMapping;
|
|
1682
1909
|
/**
|
|
1683
1910
|
* Helper to merge event actions into one array of event actions.
|
|
@@ -1686,9 +1913,11 @@ exports.getFieldSummaryMapping = getFieldSummaryMapping;
|
|
|
1686
1913
|
* @param {EventAction[]} eventActions2
|
|
1687
1914
|
* @returns {EventAction[]} merged event actions
|
|
1688
1915
|
*/
|
|
1916
|
+
|
|
1689
1917
|
var mergeEventActions = function mergeEventActions(eventActions1, eventActions2) {
|
|
1690
1918
|
return eventActions1.concat(eventActions2);
|
|
1691
1919
|
};
|
|
1920
|
+
|
|
1692
1921
|
exports.mergeEventActions = mergeEventActions;
|
|
1693
1922
|
/**
|
|
1694
1923
|
* Helper to merge field actions. If same key exists in both field actions,
|
|
@@ -1703,21 +1932,27 @@ exports.mergeEventActions = mergeEventActions;
|
|
|
1703
1932
|
* @param {FieldActions} fieldActions2
|
|
1704
1933
|
* @returns {FieldActions} merged field actions
|
|
1705
1934
|
*/
|
|
1935
|
+
|
|
1706
1936
|
var mergeFieldActions = function mergeFieldActions(fieldActions1, fieldActions2) {
|
|
1707
1937
|
var fieldActions1WithoutDefault = Object.assign({}, fieldActions1);
|
|
1938
|
+
|
|
1708
1939
|
if ('default' in fieldActions1WithoutDefault) {
|
|
1709
1940
|
fieldActions1WithoutDefault['*'] = '*' in fieldActions1WithoutDefault ? [].concat(_toConsumableArray(fieldActions1WithoutDefault['*']), _toConsumableArray(fieldActions1WithoutDefault.default)) : fieldActions1WithoutDefault.default;
|
|
1710
1941
|
delete fieldActions1WithoutDefault.default;
|
|
1711
1942
|
}
|
|
1943
|
+
|
|
1712
1944
|
var fieldActions2WithoutDefault = Object.assign({}, fieldActions2);
|
|
1945
|
+
|
|
1713
1946
|
if ('default' in fieldActions2WithoutDefault) {
|
|
1714
1947
|
fieldActions2WithoutDefault['*'] = '*' in fieldActions2WithoutDefault ? [].concat(_toConsumableArray(fieldActions2WithoutDefault['*']), _toConsumableArray(fieldActions2WithoutDefault.default)) : fieldActions2WithoutDefault.default;
|
|
1715
1948
|
delete fieldActions2WithoutDefault.default;
|
|
1716
1949
|
}
|
|
1950
|
+
|
|
1717
1951
|
return (0, lodash_1.mergeWith)(fieldActions1WithoutDefault, fieldActions2WithoutDefault, function (fieldAction1value, fieldAction2value) {
|
|
1718
1952
|
return Array.isArray(fieldAction1value) && Array.isArray(fieldAction2value) ? (0, lodash_1.union)(fieldAction1value, fieldAction2value) : undefined;
|
|
1719
1953
|
});
|
|
1720
1954
|
};
|
|
1955
|
+
|
|
1721
1956
|
exports.mergeFieldActions = mergeFieldActions;
|
|
1722
1957
|
/**
|
|
1723
1958
|
* Helper to replace all tokens from the tokenReplacementMap in text with their corresponding values.
|
|
@@ -1732,77 +1967,92 @@ exports.mergeFieldActions = mergeFieldActions;
|
|
|
1732
1967
|
* @param {boolean} allowFieldValuesEscape
|
|
1733
1968
|
* @returns {string} text with replaced tokens
|
|
1734
1969
|
*/
|
|
1970
|
+
|
|
1735
1971
|
var replaceTokens = function replaceTokens(_ref) {
|
|
1736
1972
|
var text = _ref.text,
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
var replacedText = text;
|
|
1741
|
-
|
|
1973
|
+
tokenReplacementMap = _ref.tokenReplacementMap,
|
|
1974
|
+
allowSpecialParametersEscape = _ref.allowSpecialParametersEscape,
|
|
1975
|
+
allowFieldValuesEscape = _ref.allowFieldValuesEscape;
|
|
1976
|
+
var replacedText = text; // replace special parameters
|
|
1977
|
+
|
|
1742
1978
|
Object.entries(tokenReplacementMap.specialParameters).forEach(function (_ref2) {
|
|
1743
1979
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
1744
|
-
|
|
1745
|
-
|
|
1980
|
+
tokenName = _ref3[0],
|
|
1981
|
+
tokenValue = _ref3[1];
|
|
1982
|
+
|
|
1746
1983
|
var maybeEscapedTokenValue = allowSpecialParametersEscape ? encodeURIComponent(tokenValue) : tokenValue;
|
|
1747
1984
|
replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue);
|
|
1748
|
-
});
|
|
1749
|
-
|
|
1985
|
+
}); // replace field values
|
|
1986
|
+
|
|
1750
1987
|
Object.entries(tokenReplacementMap.fields).forEach(function (_ref4) {
|
|
1751
1988
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
1752
|
-
|
|
1753
|
-
|
|
1989
|
+
tokenName = _ref5[0],
|
|
1990
|
+
tokenValue = _ref5[1];
|
|
1991
|
+
|
|
1754
1992
|
// when allowFieldValuesEscape is true, replace field with escaped value
|
|
1755
1993
|
var maybeEscapedTokenValue = allowFieldValuesEscape ? encodeURIComponent(tokenValue) : tokenValue;
|
|
1756
|
-
replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue);
|
|
1757
|
-
|
|
1994
|
+
replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue); // If field starts with `!`, always replace with the unescaped value
|
|
1995
|
+
|
|
1758
1996
|
replacedText = replacedText.split("$!".concat(tokenName, "$")).join(tokenValue);
|
|
1759
1997
|
});
|
|
1760
1998
|
return replacedText;
|
|
1761
1999
|
};
|
|
2000
|
+
|
|
1762
2001
|
exports.replaceTokens = replaceTokens;
|
|
1763
2002
|
/**
|
|
1764
2003
|
* Generate a token replacement map taking into account Special Parameters and field replacements.
|
|
1765
2004
|
*/
|
|
2005
|
+
|
|
1766
2006
|
var generateTokenReplacementMap = function generateTokenReplacementMap(_ref6) {
|
|
1767
2007
|
var dataSources = _ref6.dataSources,
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
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
|
+
|
|
1774
2015
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2016
|
+
|
|
1775
2017
|
var tokenReplacementMap = {
|
|
1776
2018
|
specialParameters: {},
|
|
1777
2019
|
fields: {}
|
|
1778
|
-
};
|
|
1779
|
-
// Map special parameters for workflow actions with values
|
|
2020
|
+
}; // Map special parameters for workflow actions with values
|
|
1780
2021
|
// Note that @latest_time will not be supported since it does not work in sxml
|
|
1781
2022
|
// https://dev.splunk.com/enterprise/docs/devtools/customworkflowactions/#Special-parameters
|
|
2023
|
+
|
|
1782
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;
|
|
1783
2025
|
var offset = rowIndex !== undefined && pageNumber !== undefined && count !== undefined ? rowIndex + count * (pageNumber - 1) : undefined;
|
|
2026
|
+
|
|
1784
2027
|
if (offset !== undefined) {
|
|
1785
2028
|
tokenReplacementMap.specialParameters['@offset'] = String(offset);
|
|
1786
2029
|
}
|
|
2030
|
+
|
|
1787
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) {
|
|
1788
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;
|
|
1789
2033
|
}
|
|
2034
|
+
|
|
1790
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) {
|
|
1791
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;
|
|
1792
2037
|
}
|
|
2038
|
+
|
|
1793
2039
|
if (field) {
|
|
1794
2040
|
tokenReplacementMap.specialParameters['@field_name'] = field;
|
|
1795
2041
|
}
|
|
2042
|
+
|
|
1796
2043
|
if (value) {
|
|
1797
2044
|
tokenReplacementMap.specialParameters['@field_value'] = value;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
2045
|
+
} // Map fields with field values
|
|
2046
|
+
|
|
2047
|
+
|
|
1800
2048
|
Object.entries(event).forEach(function (_ref7) {
|
|
1801
2049
|
var _ref8 = _slicedToArray(_ref7, 2),
|
|
1802
|
-
|
|
1803
|
-
|
|
2050
|
+
fieldName = _ref8[0],
|
|
2051
|
+
fieldValue = _ref8[1];
|
|
2052
|
+
|
|
1804
2053
|
// handling of _raw and _time fields matches SXML behaviour. Implementation is based on fieldSubstitute() from splunkcore-web-ui
|
|
1805
2054
|
var replacedValue;
|
|
2055
|
+
|
|
1806
2056
|
if (fieldName === '_time' && typeof fieldValue === 'string') {
|
|
1807
2057
|
var splunkTime = (0, time_1.getISOWithTimeZone)(fieldValue);
|
|
1808
2058
|
var epochTime = (0, exports.getEpochTime)(splunkTime);
|
|
@@ -1813,21 +2063,25 @@ var generateTokenReplacementMap = function generateTokenReplacementMap(_ref6) {
|
|
|
1813
2063
|
} else {
|
|
1814
2064
|
replacedValue = typeof fieldValue === 'string' ? fieldValue : JSON.stringify(fieldValue);
|
|
1815
2065
|
}
|
|
2066
|
+
|
|
1816
2067
|
tokenReplacementMap.fields["".concat(fieldName)] = replacedValue;
|
|
1817
2068
|
});
|
|
1818
2069
|
return tokenReplacementMap;
|
|
1819
2070
|
};
|
|
1820
|
-
|
|
1821
|
-
// return epoch unix timestamp in seconds
|
|
2071
|
+
|
|
2072
|
+
exports.generateTokenReplacementMap = generateTokenReplacementMap; // return epoch unix timestamp in seconds
|
|
2073
|
+
|
|
1822
2074
|
var getEpochTime = function getEpochTime(time) {
|
|
1823
2075
|
// if not a valid time string, then indicate an error and return NaN.
|
|
1824
2076
|
if (!(0, time_1.isISO)(time)) {
|
|
1825
2077
|
console.error("'".concat(time, "' is not a valid time string."));
|
|
1826
2078
|
return NaN;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
2079
|
+
} // retrieves the epoch time in milliseconds, and divides by 1000
|
|
2080
|
+
|
|
2081
|
+
|
|
1829
2082
|
return new Date(time).getTime() / 1000;
|
|
1830
2083
|
};
|
|
2084
|
+
|
|
1831
2085
|
exports.getEpochTime = getEpochTime;
|
|
1832
2086
|
/**
|
|
1833
2087
|
* Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks a predefined control in the Time Controls Popover
|
|
@@ -1840,25 +2094,30 @@ exports.getEpochTime = getEpochTime;
|
|
|
1840
2094
|
* @param {('before'|'after'|'at')} when
|
|
1841
2095
|
* @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time
|
|
1842
2096
|
*/
|
|
2097
|
+
|
|
1843
2098
|
var getPredefinedTimeInterval = function getPredefinedTimeInterval(_ref9) {
|
|
1844
2099
|
var time = _ref9.time,
|
|
1845
|
-
|
|
2100
|
+
when = _ref9.when;
|
|
1846
2101
|
var epochTime = (0, exports.getEpochTime)(time);
|
|
2102
|
+
|
|
1847
2103
|
switch (when) {
|
|
1848
2104
|
case 'before':
|
|
1849
2105
|
return {
|
|
1850
2106
|
latest: epochTime + 0.001
|
|
1851
2107
|
};
|
|
2108
|
+
|
|
1852
2109
|
case 'after':
|
|
1853
2110
|
return {
|
|
1854
2111
|
earliest: epochTime,
|
|
1855
2112
|
latest: 'now'
|
|
1856
2113
|
};
|
|
2114
|
+
|
|
1857
2115
|
case 'at':
|
|
1858
2116
|
return {
|
|
1859
2117
|
earliest: epochTime,
|
|
1860
2118
|
latest: epochTime + 0.001
|
|
1861
2119
|
};
|
|
2120
|
+
|
|
1862
2121
|
default:
|
|
1863
2122
|
// returns 'at' interval by default
|
|
1864
2123
|
return {
|
|
@@ -1867,6 +2126,7 @@ var getPredefinedTimeInterval = function getPredefinedTimeInterval(_ref9) {
|
|
|
1867
2126
|
};
|
|
1868
2127
|
}
|
|
1869
2128
|
};
|
|
2129
|
+
|
|
1870
2130
|
exports.getPredefinedTimeInterval = getPredefinedTimeInterval;
|
|
1871
2131
|
/**
|
|
1872
2132
|
* Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks `Apply` in the Time Controls Popover.
|
|
@@ -1881,13 +2141,15 @@ exports.getPredefinedTimeInterval = getPredefinedTimeInterval;
|
|
|
1881
2141
|
* @param {string} rangeUnit
|
|
1882
2142
|
* @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time
|
|
1883
2143
|
*/
|
|
2144
|
+
|
|
1884
2145
|
var getCustomTimeInterval = function getCustomTimeInterval(_ref10) {
|
|
1885
2146
|
var time = _ref10.time,
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
2147
|
+
rangeType = _ref10.rangeType,
|
|
2148
|
+
rangeAmount = _ref10.rangeAmount,
|
|
2149
|
+
rangeUnit = _ref10.rangeUnit;
|
|
1889
2150
|
var timeRange = (0, time_1.getAcceleratedTimeRange)(time, rangeAmount, rangeUnit);
|
|
1890
2151
|
var timeInterval;
|
|
2152
|
+
|
|
1891
2153
|
if (rangeType === 'plusminus') {
|
|
1892
2154
|
timeInterval = Object.assign({}, timeRange);
|
|
1893
2155
|
} else if (rangeType === 'plus') {
|
|
@@ -1898,13 +2160,15 @@ var getCustomTimeInterval = function getCustomTimeInterval(_ref10) {
|
|
|
1898
2160
|
timeInterval = Object.assign(Object.assign({}, timeRange), {
|
|
1899
2161
|
latest: time
|
|
1900
2162
|
});
|
|
1901
|
-
}
|
|
1902
|
-
|
|
2163
|
+
} // converts to use epoch time in the interval, and adds 0.001 to `latest` per spec
|
|
2164
|
+
|
|
2165
|
+
|
|
1903
2166
|
return {
|
|
1904
2167
|
earliest: (0, exports.getEpochTime)(timeInterval.earliest),
|
|
1905
2168
|
latest: (0, exports.getEpochTime)(timeInterval.latest) + 0.001
|
|
1906
2169
|
};
|
|
1907
2170
|
};
|
|
2171
|
+
|
|
1908
2172
|
exports.getCustomTimeInterval = getCustomTimeInterval;
|
|
1909
2173
|
/**
|
|
1910
2174
|
* Helper to truncate strings to a maximum length.
|
|
@@ -1913,17 +2177,51 @@ exports.getCustomTimeInterval = getCustomTimeInterval;
|
|
|
1913
2177
|
* @param {string} stringToTruncate
|
|
1914
2178
|
* @returns {string} truncated string
|
|
1915
2179
|
*/
|
|
2180
|
+
|
|
1916
2181
|
var truncateString = function truncateString(stringToTruncate) {
|
|
1917
2182
|
var MAX_LENGTH = 100;
|
|
1918
2183
|
var LEAD_AND_TRAIL_LENGTH = 50;
|
|
1919
2184
|
var truncatedString = stringToTruncate;
|
|
2185
|
+
|
|
1920
2186
|
if (truncatedString.length > MAX_LENGTH) {
|
|
1921
2187
|
truncatedString = "".concat(truncatedString.substring(0, LEAD_AND_TRAIL_LENGTH), "...").concat(truncatedString.substring(truncatedString.length - LEAD_AND_TRAIL_LENGTH));
|
|
1922
2188
|
}
|
|
2189
|
+
|
|
1923
2190
|
return truncatedString;
|
|
1924
2191
|
};
|
|
2192
|
+
|
|
1925
2193
|
exports.truncateString = truncateString;
|
|
1926
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
|
+
|
|
1927
2225
|
/***/ }),
|
|
1928
2226
|
/* 121 */
|
|
1929
2227
|
/***/ (function(module, exports, __webpack_require__) {
|
|
@@ -1934,15 +2232,17 @@ exports.truncateString = truncateString;
|
|
|
1934
2232
|
Object.defineProperty(exports, "__esModule", {
|
|
1935
2233
|
value: true
|
|
1936
2234
|
});
|
|
1937
|
-
exports.convertToArrOfObjects = void 0;
|
|
1938
|
-
|
|
2235
|
+
exports.convertToArrOfObjects = void 0; // TODO: utilize this fn in ParallelCoordinates
|
|
2236
|
+
|
|
1939
2237
|
var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
1940
2238
|
if (!columns || !columns[0] || !columns[0].length) return [];
|
|
1941
2239
|
var data = [];
|
|
2240
|
+
|
|
1942
2241
|
var _loop = function _loop(i) {
|
|
1943
2242
|
var newObj = {};
|
|
1944
2243
|
fields.forEach(function (field, index) {
|
|
1945
2244
|
var fieldName = typeof field === 'string' ? field : field.name;
|
|
2245
|
+
|
|
1946
2246
|
if (columns[index][i] === '') {
|
|
1947
2247
|
newObj[fieldName] = null;
|
|
1948
2248
|
} else {
|
|
@@ -1951,11 +2251,14 @@ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
|
1951
2251
|
});
|
|
1952
2252
|
data.push(newObj);
|
|
1953
2253
|
};
|
|
2254
|
+
|
|
1954
2255
|
for (var i = 0; i < columns[0].length; i += 1) {
|
|
1955
2256
|
_loop(i);
|
|
1956
2257
|
}
|
|
2258
|
+
|
|
1957
2259
|
return data;
|
|
1958
2260
|
};
|
|
2261
|
+
|
|
1959
2262
|
exports.convertToArrOfObjects = convertToArrOfObjects;
|
|
1960
2263
|
|
|
1961
2264
|
/***/ }),
|
|
@@ -2015,27 +2318,40 @@ module.exports = require("@splunk/react-ui/Heading");
|
|
|
2015
2318
|
|
|
2016
2319
|
var __rest = this && this.__rest || function (s, e) {
|
|
2017
2320
|
var t = {};
|
|
2321
|
+
|
|
2018
2322
|
for (var p in s) {
|
|
2019
2323
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2020
2324
|
}
|
|
2325
|
+
|
|
2021
2326
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2022
2327
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2023
2328
|
}
|
|
2024
2329
|
return t;
|
|
2025
2330
|
};
|
|
2331
|
+
|
|
2026
2332
|
Object.defineProperty(exports, "__esModule", {
|
|
2027
2333
|
value: true
|
|
2028
2334
|
});
|
|
2029
2335
|
exports.replaceTokens = exports.PureEvents = exports.config = exports.themes = exports.computeVizProps = exports.showPlaceHolderIcon = void 0;
|
|
2336
|
+
|
|
2030
2337
|
var lodash_1 = __webpack_require__(3);
|
|
2338
|
+
|
|
2031
2339
|
var dataSourceUtils_1 = __webpack_require__(97);
|
|
2032
|
-
|
|
2340
|
+
|
|
2341
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
2342
|
+
|
|
2033
2343
|
var constants_1 = __webpack_require__(151);
|
|
2344
|
+
|
|
2034
2345
|
var config_1 = __webpack_require__(203);
|
|
2346
|
+
|
|
2035
2347
|
exports.config = config_1.default;
|
|
2348
|
+
|
|
2036
2349
|
var PureEvents_1 = __webpack_require__(204);
|
|
2350
|
+
|
|
2037
2351
|
exports.PureEvents = PureEvents_1.default;
|
|
2352
|
+
|
|
2038
2353
|
var EventUtils_1 = __webpack_require__(120);
|
|
2354
|
+
|
|
2039
2355
|
Object.defineProperty(exports, "replaceTokens", {
|
|
2040
2356
|
enumerable: true,
|
|
2041
2357
|
get: function get() {
|
|
@@ -2047,23 +2363,29 @@ Object.defineProperty(exports, "replaceTokens", {
|
|
|
2047
2363
|
* @param {Object} dataSources
|
|
2048
2364
|
* @returns {Boolean} return true if loading, error, non existent state or without columns in dataSources
|
|
2049
2365
|
*/
|
|
2366
|
+
|
|
2050
2367
|
var showPlaceHolderIcon = function showPlaceHolderIcon(dataSources) {
|
|
2051
2368
|
var columns = (0, lodash_1.get)(dataSources, 'primary.data.columns', undefined);
|
|
2052
2369
|
var noColumns = columns === undefined;
|
|
2053
2370
|
var dataSourceState = (0, dataSourceUtils_1.getDataSourceStateInfo)(dataSources);
|
|
2054
2371
|
return dataSourceState === dataSourceUtils_1.DataSourceState.ERROR || dataSourceState === dataSourceUtils_1.DataSourceState.LOADING || dataSourceState === dataSourceUtils_1.DataSourceState.NONEXISTENT || noColumns;
|
|
2055
2372
|
};
|
|
2373
|
+
|
|
2056
2374
|
exports.showPlaceHolderIcon = showPlaceHolderIcon;
|
|
2375
|
+
|
|
2057
2376
|
var computeVizProps = function computeVizProps(_a) {
|
|
2058
2377
|
// for specific changes to view type (List -> Raw, etc.), can create handling function here that calls onOptionsChange
|
|
2059
2378
|
var _b;
|
|
2060
|
-
|
|
2061
|
-
// 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
|
+
|
|
2062
2383
|
var dataSources = (_b = props === null || props === void 0 ? void 0 : props.dataSources) !== null && _b !== void 0 ? _b : constants_1.EMPTY_DATASOURCE;
|
|
2063
2384
|
return Object.assign(Object.assign({}, props), {
|
|
2064
2385
|
dataSources: dataSources
|
|
2065
2386
|
});
|
|
2066
2387
|
};
|
|
2388
|
+
|
|
2067
2389
|
exports.computeVizProps = computeVizProps;
|
|
2068
2390
|
var Events = (0, withDashboardViz_1.default)({
|
|
2069
2391
|
ReactViz: PureEvents_1.default,
|
|
@@ -2091,8 +2413,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2091
2413
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY_DATASOURCE", function() { return EMPTY_DATASOURCE; });
|
|
2092
2414
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELDSUMMARY_DS_STORYBOOK", function() { return FIELDSUMMARY_DS_STORYBOOK; });
|
|
2093
2415
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELDSUMMARY_DS_DOC_HUB", function() { return FIELDSUMMARY_DS_DOC_HUB; });
|
|
2094
|
-
/* harmony import */ var
|
|
2095
|
-
/* 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__);
|
|
2096
2418
|
// TODO: convert this file to .ts - created as .js as copied from SUI EventsViewer repo
|
|
2097
2419
|
|
|
2098
2420
|
var rawEventPayload = {
|
|
@@ -2480,20 +2802,17 @@ var rawEventPayload = {
|
|
|
2480
2802
|
}
|
|
2481
2803
|
}
|
|
2482
2804
|
};
|
|
2483
|
-
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
|
|
2484
2806
|
|
|
2485
|
-
//
|
|
2486
|
-
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
|
|
2487
2808
|
|
|
2488
|
-
// Replaces _raw object with the value of the `value` key - this is the string expected in Dashboard Studio payload
|
|
2489
2809
|
originalDataSourceData.columns[5] = originalDataSourceData.columns[5].map(function (_raw) {
|
|
2490
2810
|
return _raw.value;
|
|
2491
|
-
});
|
|
2492
|
-
|
|
2493
|
-
// 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
|
|
2494
2812
|
// as arrays of data primitives like strings and numbers
|
|
2495
2813
|
// Component works with either [{ name: `field` }, ...] or [`field`,...] format - leaving as array as objects as
|
|
2496
2814
|
// expected in Dashboard Studio payload
|
|
2815
|
+
|
|
2497
2816
|
var dataSourceData = {
|
|
2498
2817
|
fields: rawEventPayload.fields,
|
|
2499
2818
|
columns: originalDataSourceData.columns
|
|
@@ -2600,7 +2919,7 @@ module.exports = require("@splunk/visualization-context/EventsContext");
|
|
|
2600
2919
|
/* 169 */
|
|
2601
2920
|
/***/ (function(module, exports) {
|
|
2602
2921
|
|
|
2603
|
-
module.exports = require("@splunk/datasource-utils
|
|
2922
|
+
module.exports = require("@splunk/datasource-utils");
|
|
2604
2923
|
|
|
2605
2924
|
/***/ }),
|
|
2606
2925
|
/* 170 */,
|
|
@@ -2644,6 +2963,7 @@ module.exports = require("@splunk/datasource-utils/DataSet");
|
|
|
2644
2963
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
2645
2964
|
if (k2 === undefined) k2 = k;
|
|
2646
2965
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2966
|
+
|
|
2647
2967
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2648
2968
|
desc = {
|
|
2649
2969
|
enumerable: true,
|
|
@@ -2652,22 +2972,28 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
2652
2972
|
}
|
|
2653
2973
|
};
|
|
2654
2974
|
}
|
|
2975
|
+
|
|
2655
2976
|
Object.defineProperty(o, k2, desc);
|
|
2656
2977
|
} : function (o, m, k, k2) {
|
|
2657
2978
|
if (k2 === undefined) k2 = k;
|
|
2658
2979
|
o[k2] = m[k];
|
|
2659
2980
|
});
|
|
2981
|
+
|
|
2660
2982
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
2661
2983
|
for (var p in m) {
|
|
2662
2984
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2663
2985
|
}
|
|
2664
2986
|
};
|
|
2987
|
+
|
|
2665
2988
|
Object.defineProperty(exports, "__esModule", {
|
|
2666
2989
|
value: true
|
|
2667
2990
|
});
|
|
2668
2991
|
exports.default = void 0;
|
|
2992
|
+
|
|
2669
2993
|
__exportStar(__webpack_require__(150), exports);
|
|
2994
|
+
|
|
2670
2995
|
var Events_1 = __webpack_require__(150);
|
|
2996
|
+
|
|
2671
2997
|
Object.defineProperty(exports, "default", {
|
|
2672
2998
|
enumerable: true,
|
|
2673
2999
|
get: function get() {
|
|
@@ -2685,15 +3011,27 @@ Object.defineProperty(exports, "default", {
|
|
|
2685
3011
|
Object.defineProperty(exports, "__esModule", {
|
|
2686
3012
|
value: true
|
|
2687
3013
|
});
|
|
3014
|
+
|
|
2688
3015
|
var visualization_icons_1 = __webpack_require__(52);
|
|
3016
|
+
|
|
2689
3017
|
var placeholders_1 = __webpack_require__(50);
|
|
3018
|
+
|
|
2690
3019
|
var schemaUtils_1 = __webpack_require__(16);
|
|
3020
|
+
|
|
2691
3021
|
var themes_1 = __webpack_require__(60);
|
|
3022
|
+
|
|
2692
3023
|
var i18n_1 = __webpack_require__(2);
|
|
3024
|
+
|
|
3025
|
+
var DataSource_1 = __webpack_require__(34);
|
|
3026
|
+
|
|
2693
3027
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2694
|
-
|
|
3028
|
+
|
|
3029
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
3030
|
+
|
|
2695
3031
|
var configUtils_1 = __webpack_require__(20);
|
|
3032
|
+
|
|
2696
3033
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
3034
|
+
|
|
2697
3035
|
var defaultContext = {};
|
|
2698
3036
|
var dataContract = {
|
|
2699
3037
|
requiredDataSources: [{
|
|
@@ -2707,10 +3045,16 @@ var dataContract = {
|
|
|
2707
3045
|
initialRequestParams: {
|
|
2708
3046
|
primary: function primary() {
|
|
2709
3047
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3048
|
+
|
|
3049
|
+
var _a;
|
|
3050
|
+
|
|
2710
3051
|
return {
|
|
2711
3052
|
offset: 0,
|
|
2712
3053
|
count: options.count ? options.count : 10,
|
|
2713
|
-
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'
|
|
2714
3058
|
};
|
|
2715
3059
|
}
|
|
2716
3060
|
}
|
|
@@ -2820,9 +3164,15 @@ var optionsSchema = {
|
|
|
2820
3164
|
default: []
|
|
2821
3165
|
},
|
|
2822
3166
|
highlightValuesByField: {
|
|
2823
|
-
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"]}`.',
|
|
2824
3168
|
type: 'object'
|
|
2825
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
|
+
},
|
|
2826
3176
|
showFieldSummary: {
|
|
2827
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.',
|
|
2828
3178
|
type: 'boolean',
|
|
@@ -2859,17 +3209,20 @@ var editorConfig = [{
|
|
|
2859
3209
|
/**
|
|
2860
3210
|
* visualization configuration
|
|
2861
3211
|
*/
|
|
3212
|
+
|
|
2862
3213
|
var config = {
|
|
2863
3214
|
/**
|
|
2864
3215
|
* unique viz key
|
|
2865
3216
|
*/
|
|
2866
3217
|
key: 'splunk.events',
|
|
3218
|
+
|
|
2867
3219
|
/**
|
|
2868
3220
|
* viz name
|
|
2869
3221
|
*/
|
|
2870
3222
|
name: (0, i18n_1._)('Events'),
|
|
2871
3223
|
category: VizCategory_1.VizCategory.TABLE,
|
|
2872
3224
|
status: 'preview',
|
|
3225
|
+
|
|
2873
3226
|
/**
|
|
2874
3227
|
* viz icon
|
|
2875
3228
|
*/
|
|
@@ -2911,28 +3264,48 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
|
2911
3264
|
|
|
2912
3265
|
|
|
2913
3266
|
var _typeof = __webpack_require__(82);
|
|
3267
|
+
|
|
2914
3268
|
var _slicedToArray = __webpack_require__(17);
|
|
3269
|
+
|
|
2915
3270
|
Object.defineProperty(exports, "__esModule", {
|
|
2916
3271
|
value: true
|
|
2917
3272
|
});
|
|
3273
|
+
|
|
2918
3274
|
var React = __webpack_require__(1);
|
|
3275
|
+
|
|
2919
3276
|
var react_1 = __webpack_require__(1);
|
|
3277
|
+
|
|
2920
3278
|
var T = __webpack_require__(0);
|
|
3279
|
+
|
|
2921
3280
|
var EventsViewer_1 = __webpack_require__(205);
|
|
3281
|
+
|
|
2922
3282
|
var styled_components_1 = __webpack_require__(4);
|
|
3283
|
+
|
|
2923
3284
|
var pick_1 = __webpack_require__(23);
|
|
3285
|
+
|
|
2924
3286
|
var variables_1 = __webpack_require__(11);
|
|
3287
|
+
|
|
2925
3288
|
var colorUtils_1 = __webpack_require__(12);
|
|
3289
|
+
|
|
2926
3290
|
var style_1 = __webpack_require__(14);
|
|
3291
|
+
|
|
2927
3292
|
var EventsContext_1 = __webpack_require__(152);
|
|
3293
|
+
|
|
2928
3294
|
var lodash_1 = __webpack_require__(3);
|
|
3295
|
+
|
|
2929
3296
|
var Menu_1 = __webpack_require__(119);
|
|
3297
|
+
|
|
2930
3298
|
var constants_1 = __webpack_require__(151);
|
|
3299
|
+
|
|
2931
3300
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
3301
|
+
|
|
2932
3302
|
var EventUtils_1 = __webpack_require__(120);
|
|
3303
|
+
|
|
2933
3304
|
var FieldSummaryTooltip_1 = __webpack_require__(207);
|
|
2934
|
-
|
|
2935
|
-
// Inspired by VizTableContainer in PureTable.tsx
|
|
3305
|
+
|
|
3306
|
+
var TimeControlsPopover_1 = __webpack_require__(209); // Inspired by VizTableContainer in PureTable.tsx
|
|
3307
|
+
|
|
3308
|
+
|
|
2936
3309
|
var EventsContainer = styled_components_1.default.div.withConfig({
|
|
2937
3310
|
displayName: "PureEvents__EventsContainer",
|
|
2938
3311
|
componentId: "iniqvm-0"
|
|
@@ -2948,15 +3321,15 @@ var EventsContainer = styled_components_1.default.div.withConfig({
|
|
|
2948
3321
|
}, (0, pick_1.default)({
|
|
2949
3322
|
enterprise: variables_1.default.backgroundColorPage,
|
|
2950
3323
|
prisma: variables_1.default.backgroundColorPage
|
|
2951
|
-
}));
|
|
2952
|
-
|
|
3324
|
+
})); // Inspired by SUITableContainer in PureTable.tsx
|
|
3325
|
+
|
|
2953
3326
|
var SUIEventsViewerContainer = styled_components_1.default.div.withConfig({
|
|
2954
3327
|
displayName: "PureEvents__SUIEventsViewerContainer",
|
|
2955
3328
|
componentId: "iniqvm-1"
|
|
2956
3329
|
})(["box-sizing:border-box;flex-grow:1;overflow:hidden;", ";"], function (_ref) {
|
|
2957
3330
|
var width = _ref.width,
|
|
2958
|
-
|
|
2959
|
-
|
|
3331
|
+
height = _ref.height,
|
|
3332
|
+
theme = _ref.theme;
|
|
2960
3333
|
var padding = (0, pick_1.default)({
|
|
2961
3334
|
enterprise: variables_1.default.spacingHalf({
|
|
2962
3335
|
theme: theme
|
|
@@ -2972,30 +3345,40 @@ var SUIEventsViewerContainer = styled_components_1.default.div.withConfig({
|
|
|
2972
3345
|
width: width - paddingOffset,
|
|
2973
3346
|
height: height - paddingOffset
|
|
2974
3347
|
});
|
|
2975
|
-
});
|
|
2976
|
-
|
|
3348
|
+
}); // Effectively the pure visualization component for Events, passing through the necessary state and callbacks.
|
|
3349
|
+
|
|
2977
3350
|
var PureEvents = function PureEvents(props) {
|
|
2978
3351
|
var width = props.width,
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
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]);
|
|
2993
3374
|
var fieldSummaryMap = React.useMemo(function () {
|
|
2994
|
-
var _a, _b, _c, _d;
|
|
2995
|
-
|
|
3375
|
+
var _a, _b, _c, _d; // if the `fieldsummary` datasource isn't configured, no field summary can be shown
|
|
3376
|
+
|
|
3377
|
+
|
|
2996
3378
|
if (!showFieldSummary || !(0, lodash_1.get)(dataSources, 'fieldsummary')) {
|
|
2997
3379
|
return {};
|
|
2998
3380
|
}
|
|
3381
|
+
|
|
2999
3382
|
try {
|
|
3000
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);
|
|
3001
3384
|
return fieldSummaryMapping;
|
|
@@ -3004,39 +3387,48 @@ var PureEvents = function PureEvents(props) {
|
|
|
3004
3387
|
return {};
|
|
3005
3388
|
}
|
|
3006
3389
|
}, [dataSources, showFieldSummary]);
|
|
3390
|
+
|
|
3007
3391
|
var _ref2 = (0, react_1.useContext)(EventsContext_1.default),
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
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
|
+
|
|
3012
3397
|
var eventActions = (0, EventUtils_1.mergeEventActions)(eventActionsProps, eventActionsContext);
|
|
3013
3398
|
var fieldActions = (0, EventUtils_1.mergeFieldActions)(fieldActionsProps, fieldActionsContext);
|
|
3399
|
+
|
|
3014
3400
|
var _React$useState = React.useState(null),
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3401
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3402
|
+
fieldSummaryField = _React$useState2[0],
|
|
3403
|
+
setFieldSummaryField = _React$useState2[1];
|
|
3404
|
+
|
|
3018
3405
|
var _React$useState3 = React.useState(null),
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3406
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3407
|
+
fieldSummaryAnchor = _React$useState4[0],
|
|
3408
|
+
setFieldSummaryAnchor = _React$useState4[1];
|
|
3409
|
+
|
|
3022
3410
|
var _React$useState5 = React.useState(null),
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3411
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3412
|
+
timeValue = _React$useState6[0],
|
|
3413
|
+
setTimeValue = _React$useState6[1];
|
|
3414
|
+
|
|
3026
3415
|
var _React$useState7 = React.useState(null),
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
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,
|
|
3030
3419
|
// and eventActionComponent (needs to be Menu.Item and will be rendered inside a Menu component)
|
|
3031
3420
|
// to display in the Event Actions dropdown
|
|
3421
|
+
|
|
3422
|
+
|
|
3032
3423
|
var renderEventActions = React.useMemo(function () {
|
|
3033
3424
|
return !Array.isArray(eventActions) ? [] : eventActions.map(function (_ref3) {
|
|
3034
3425
|
var eventType = _ref3.eventType,
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
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
|
+
|
|
3040
3432
|
var onMenuItemClick = function onMenuItemClick(e, eventActionProps, tokenReplacementMap) {
|
|
3041
3433
|
var payload = (0, EventUtils_1.convertToPayloadFormat)(eventActionProps.event, {
|
|
3042
3434
|
tokenReplacementMap: tokenReplacementMap
|
|
@@ -3047,10 +3439,11 @@ var PureEvents = function PureEvents(props) {
|
|
|
3047
3439
|
payload: payload
|
|
3048
3440
|
});
|
|
3049
3441
|
};
|
|
3442
|
+
|
|
3050
3443
|
var eventActionComponent = function eventActionComponent(eventActionProps) {
|
|
3051
3444
|
var rowIndex = eventActionProps.rowIndex,
|
|
3052
|
-
|
|
3053
|
-
|
|
3445
|
+
pageNumber = eventActionProps.pageNumber,
|
|
3446
|
+
event = eventActionProps.event;
|
|
3054
3447
|
var tokenReplacementMap = (0, EventUtils_1.generateTokenReplacementMap)({
|
|
3055
3448
|
dataSources: dataSources,
|
|
3056
3449
|
rowIndex: rowIndex,
|
|
@@ -3071,28 +3464,31 @@ var PureEvents = function PureEvents(props) {
|
|
|
3071
3464
|
}
|
|
3072
3465
|
}, truncatedLabel);
|
|
3073
3466
|
};
|
|
3467
|
+
|
|
3074
3468
|
return {
|
|
3075
3469
|
eventtypeValues: eventtypeValues,
|
|
3076
3470
|
fieldFilters: fieldFilters,
|
|
3077
3471
|
eventActionComponent: eventActionComponent
|
|
3078
3472
|
};
|
|
3079
3473
|
});
|
|
3080
|
-
}, [eventActions]);
|
|
3081
|
-
// 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,
|
|
3082
3475
|
// and fieldActionComponent (needs to be Menu.Item and will be rendered inside a Menu component)
|
|
3083
3476
|
// to display in its respective dropdown in the Actions column
|
|
3477
|
+
|
|
3084
3478
|
var renderFieldActions = React.useMemo(function () {
|
|
3085
3479
|
if (_typeof(fieldActions) !== 'object') return {};
|
|
3086
3480
|
var fieldActionsMap = {};
|
|
3087
3481
|
Object.entries(fieldActions).forEach(function (_ref4) {
|
|
3088
3482
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
3089
|
-
|
|
3090
|
-
|
|
3483
|
+
currentFieldName = _ref5[0],
|
|
3484
|
+
currentFieldActions = _ref5[1];
|
|
3485
|
+
|
|
3091
3486
|
fieldActionsMap[currentFieldName] = currentFieldActions.map(function (_ref6) {
|
|
3092
3487
|
var eventType = _ref6.eventType,
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3488
|
+
label = _ref6.label,
|
|
3489
|
+
_ref6$eventtypeValues = _ref6.eventtypeValues,
|
|
3490
|
+
eventtypeValues = _ref6$eventtypeValues === void 0 ? [] : _ref6$eventtypeValues;
|
|
3491
|
+
|
|
3096
3492
|
var onMenuItemClick = function onMenuItemClick(e, fieldActionProps, tokenReplacementMap) {
|
|
3097
3493
|
var payload = (0, EventUtils_1.convertToPayloadFormat)(fieldActionProps.event, {
|
|
3098
3494
|
name: fieldActionProps.field,
|
|
@@ -3105,12 +3501,13 @@ var PureEvents = function PureEvents(props) {
|
|
|
3105
3501
|
payload: payload
|
|
3106
3502
|
});
|
|
3107
3503
|
};
|
|
3504
|
+
|
|
3108
3505
|
var fieldActionComponent = function fieldActionComponent(fieldActionProps) {
|
|
3109
3506
|
var field = fieldActionProps.field,
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3507
|
+
value = fieldActionProps.value,
|
|
3508
|
+
rowIndex = fieldActionProps.rowIndex,
|
|
3509
|
+
pageNumber = fieldActionProps.pageNumber,
|
|
3510
|
+
event = fieldActionProps.event;
|
|
3114
3511
|
var tokenReplacementMap = (0, EventUtils_1.generateTokenReplacementMap)({
|
|
3115
3512
|
dataSources: dataSources,
|
|
3116
3513
|
rowIndex: rowIndex,
|
|
@@ -3133,6 +3530,7 @@ var PureEvents = function PureEvents(props) {
|
|
|
3133
3530
|
}
|
|
3134
3531
|
}, truncatedLabel);
|
|
3135
3532
|
};
|
|
3533
|
+
|
|
3136
3534
|
return {
|
|
3137
3535
|
eventtypeValues: eventtypeValues,
|
|
3138
3536
|
fieldActionComponent: fieldActionComponent
|
|
@@ -3140,27 +3538,30 @@ var PureEvents = function PureEvents(props) {
|
|
|
3140
3538
|
});
|
|
3141
3539
|
});
|
|
3142
3540
|
return fieldActionsMap;
|
|
3143
|
-
}, [fieldActions]);
|
|
3144
|
-
|
|
3541
|
+
}, [fieldActions]); // formulate the options object required by the SUI EventsViewer component
|
|
3542
|
+
|
|
3145
3543
|
var suiEventsViewerOptions = {
|
|
3146
3544
|
renderEventActions: renderEventActions,
|
|
3147
3545
|
renderFieldActions: renderFieldActions,
|
|
3148
3546
|
footerFields: footerFields,
|
|
3149
|
-
fieldValueHighlightMap:
|
|
3547
|
+
fieldValueHighlightMap: highlightValuesByFieldCombined
|
|
3150
3548
|
};
|
|
3549
|
+
|
|
3151
3550
|
var handleFieldClicked = showFieldSummary && function (e, _ref7) {
|
|
3152
3551
|
var field = _ref7.field;
|
|
3153
3552
|
setFieldSummaryField(field);
|
|
3154
3553
|
setFieldSummaryAnchor(e.currentTarget.parentElement);
|
|
3155
3554
|
};
|
|
3555
|
+
|
|
3156
3556
|
var handleTimeClicked = function handleTimeClicked(e, _ref8) {
|
|
3157
3557
|
var time = _ref8.time;
|
|
3158
3558
|
setTimeValue(time);
|
|
3159
3559
|
setTimeFieldAnchor(e.currentTarget);
|
|
3160
3560
|
};
|
|
3561
|
+
|
|
3161
3562
|
var handleValueClicked = function handleValueClicked(e, _ref9) {
|
|
3162
3563
|
var field = _ref9.field,
|
|
3163
|
-
|
|
3564
|
+
value = _ref9.value;
|
|
3164
3565
|
onEventTrigger({
|
|
3165
3566
|
originalEvent: e,
|
|
3166
3567
|
type: 'value.click',
|
|
@@ -3170,9 +3571,10 @@ var PureEvents = function PureEvents(props) {
|
|
|
3170
3571
|
}
|
|
3171
3572
|
});
|
|
3172
3573
|
};
|
|
3574
|
+
|
|
3173
3575
|
var handleTagClicked = function handleTagClicked(e, _ref10) {
|
|
3174
3576
|
var field = _ref10.field,
|
|
3175
|
-
|
|
3577
|
+
value = _ref10.value;
|
|
3176
3578
|
onEventTrigger({
|
|
3177
3579
|
originalEvent: e,
|
|
3178
3580
|
type: 'tag.click',
|
|
@@ -3182,6 +3584,7 @@ var PureEvents = function PureEvents(props) {
|
|
|
3182
3584
|
}
|
|
3183
3585
|
});
|
|
3184
3586
|
};
|
|
3587
|
+
|
|
3185
3588
|
var handleTimeDrilldown = function handleTimeDrilldown(e, timeInterval) {
|
|
3186
3589
|
onEventTrigger({
|
|
3187
3590
|
originalEvent: e,
|
|
@@ -3194,9 +3597,10 @@ var PureEvents = function PureEvents(props) {
|
|
|
3194
3597
|
}
|
|
3195
3598
|
});
|
|
3196
3599
|
};
|
|
3600
|
+
|
|
3197
3601
|
var handleActionClicked = function handleActionClicked(event, data) {
|
|
3198
3602
|
var actionType = data.action,
|
|
3199
|
-
|
|
3603
|
+
field = data.field;
|
|
3200
3604
|
onEventTrigger({
|
|
3201
3605
|
originalEvent: event,
|
|
3202
3606
|
type: "events.search.".concat(actionType),
|
|
@@ -3205,6 +3609,7 @@ var PureEvents = function PureEvents(props) {
|
|
|
3205
3609
|
}
|
|
3206
3610
|
});
|
|
3207
3611
|
};
|
|
3612
|
+
|
|
3208
3613
|
return React.createElement(EventsContainer, {
|
|
3209
3614
|
backgroundColor: backgroundColor,
|
|
3210
3615
|
width: width,
|
|
@@ -3243,6 +3648,7 @@ var PureEvents = function PureEvents(props) {
|
|
|
3243
3648
|
}
|
|
3244
3649
|
})));
|
|
3245
3650
|
};
|
|
3651
|
+
|
|
3246
3652
|
PureEvents.propTypes = {
|
|
3247
3653
|
width: T.oneOfType([T.string, T.number]),
|
|
3248
3654
|
height: T.oneOfType([T.string, T.number]),
|
|
@@ -3309,27 +3715,40 @@ module.exports = require("@splunk/time-range-utils/time");
|
|
|
3309
3715
|
|
|
3310
3716
|
|
|
3311
3717
|
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
3718
|
+
|
|
3312
3719
|
var _templateObject;
|
|
3720
|
+
|
|
3313
3721
|
Object.defineProperty(exports, "__esModule", {
|
|
3314
3722
|
value: true
|
|
3315
3723
|
});
|
|
3724
|
+
|
|
3316
3725
|
var React = __webpack_require__(1);
|
|
3726
|
+
|
|
3317
3727
|
var react_1 = __webpack_require__(1);
|
|
3728
|
+
|
|
3318
3729
|
var Popover_1 = __webpack_require__(62);
|
|
3730
|
+
|
|
3319
3731
|
var Markdown_1 = __webpack_require__(122);
|
|
3732
|
+
|
|
3320
3733
|
var FieldSummary_1 = __webpack_require__(208);
|
|
3734
|
+
|
|
3321
3735
|
var lodash_1 = __webpack_require__(3);
|
|
3736
|
+
|
|
3322
3737
|
var i18n_1 = __webpack_require__(2);
|
|
3738
|
+
|
|
3323
3739
|
var styled_components_1 = __webpack_require__(4);
|
|
3740
|
+
|
|
3324
3741
|
var EventsContext_1 = __webpack_require__(152);
|
|
3742
|
+
|
|
3325
3743
|
var popoverContainerStyle = {
|
|
3326
3744
|
padding: '20px',
|
|
3327
3745
|
width: 500
|
|
3328
3746
|
};
|
|
3329
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
|
+
|
|
3330
3749
|
var actionsForField = function actionsForField(field) {
|
|
3331
|
-
var actions = [];
|
|
3332
|
-
|
|
3750
|
+
var actions = []; // this logic is used in determining whether to display numeric stats in ui-platform (FieldStats.tsx)
|
|
3751
|
+
|
|
3333
3752
|
if (typeof field.mean === 'number') {
|
|
3334
3753
|
actions.push({
|
|
3335
3754
|
name: 'avgByTime',
|
|
@@ -3344,6 +3763,7 @@ var actionsForField = function actionsForField(field) {
|
|
|
3344
3763
|
label: (0, i18n_1._)('Min value over time')
|
|
3345
3764
|
});
|
|
3346
3765
|
}
|
|
3766
|
+
|
|
3347
3767
|
actions.push({
|
|
3348
3768
|
name: 'topValues',
|
|
3349
3769
|
label: (0, i18n_1._)('Top values')
|
|
@@ -3362,22 +3782,25 @@ var actionsForField = function actionsForField(field) {
|
|
|
3362
3782
|
});
|
|
3363
3783
|
return actions;
|
|
3364
3784
|
};
|
|
3785
|
+
|
|
3365
3786
|
var FieldSummaryTooltip = function FieldSummaryTooltip(props) {
|
|
3366
3787
|
var open = props.open,
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
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
|
+
|
|
3373
3795
|
var _ref = (0, react_1.useContext)(EventsContext_1.default),
|
|
3374
|
-
|
|
3796
|
+
isSplunkWebAvailable = _ref.isSplunkWebAvailable;
|
|
3797
|
+
|
|
3375
3798
|
var getActionsForField = (0, react_1.useCallback)(function (field) {
|
|
3376
3799
|
return isSplunkWebAvailable ? actionsForField(field) : [];
|
|
3377
|
-
}, [isSplunkWebAvailable]);
|
|
3378
|
-
|
|
3379
|
-
if (!open) return null;
|
|
3380
|
-
|
|
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
|
+
|
|
3381
3804
|
var field = fieldSummaryMap[fieldName];
|
|
3382
3805
|
var fieldSummaryExists = !!field;
|
|
3383
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.");
|
|
@@ -3399,6 +3822,7 @@ var FieldSummaryTooltip = function FieldSummaryTooltip(props) {
|
|
|
3399
3822
|
text: fallbackText
|
|
3400
3823
|
})));
|
|
3401
3824
|
};
|
|
3825
|
+
|
|
3402
3826
|
FieldSummaryTooltip.defaultProps = {
|
|
3403
3827
|
open: false,
|
|
3404
3828
|
anchor: null,
|
|
@@ -3424,27 +3848,46 @@ module.exports = require("@splunk/react-field-summary/components/FieldSummary");
|
|
|
3424
3848
|
|
|
3425
3849
|
|
|
3426
3850
|
var _slicedToArray = __webpack_require__(17);
|
|
3851
|
+
|
|
3427
3852
|
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
3853
|
+
|
|
3428
3854
|
var _templateObject;
|
|
3855
|
+
|
|
3429
3856
|
Object.defineProperty(exports, "__esModule", {
|
|
3430
3857
|
value: true
|
|
3431
3858
|
});
|
|
3859
|
+
|
|
3432
3860
|
var React = __webpack_require__(1);
|
|
3861
|
+
|
|
3433
3862
|
var Popover_1 = __webpack_require__(62);
|
|
3863
|
+
|
|
3434
3864
|
var ControlGroup_1 = __webpack_require__(210);
|
|
3865
|
+
|
|
3435
3866
|
var Button_1 = __webpack_require__(123);
|
|
3867
|
+
|
|
3436
3868
|
var Text_1 = __webpack_require__(211);
|
|
3869
|
+
|
|
3437
3870
|
var Message_1 = __webpack_require__(124);
|
|
3871
|
+
|
|
3438
3872
|
var Select_1 = __webpack_require__(212);
|
|
3873
|
+
|
|
3439
3874
|
var Link_1 = __webpack_require__(213);
|
|
3875
|
+
|
|
3440
3876
|
var Heading_1 = __webpack_require__(125);
|
|
3877
|
+
|
|
3441
3878
|
var lodash_1 = __webpack_require__(3);
|
|
3879
|
+
|
|
3442
3880
|
var i18n_1 = __webpack_require__(2);
|
|
3881
|
+
|
|
3443
3882
|
var styled_components_1 = __webpack_require__(4);
|
|
3883
|
+
|
|
3444
3884
|
var numberUtils_1 = __webpack_require__(31);
|
|
3885
|
+
|
|
3445
3886
|
var pick_1 = __webpack_require__(23);
|
|
3446
|
-
|
|
3447
|
-
// 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
|
+
|
|
3448
3891
|
var TimePopoverContainer = styled_components_1.default.div.withConfig({
|
|
3449
3892
|
displayName: "TimeControlsPopover__TimePopoverContainer",
|
|
3450
3893
|
componentId: "fj32ze-0"
|
|
@@ -3482,48 +3925,61 @@ var rangeUnitInputStyle = {
|
|
|
3482
3925
|
var applyButtonStyle = {
|
|
3483
3926
|
marginLeft: 10
|
|
3484
3927
|
};
|
|
3928
|
+
|
|
3485
3929
|
var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
3486
3930
|
var open = props.open,
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
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
|
+
|
|
3491
3936
|
var _React$useState = React.useState('plusminus'),
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3937
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3938
|
+
rangeType = _React$useState2[0],
|
|
3939
|
+
setRangeType = _React$useState2[1];
|
|
3940
|
+
|
|
3495
3941
|
var _React$useState3 = React.useState('5'),
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3942
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3943
|
+
rangeAmount = _React$useState4[0],
|
|
3944
|
+
setRangeAmount = _React$useState4[1];
|
|
3945
|
+
|
|
3499
3946
|
var _React$useState5 = React.useState('s'),
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
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
|
+
|
|
3503
3952
|
var _React$useState7 = React.useState(false),
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3953
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
3954
|
+
isInvalidInput = _React$useState8[0],
|
|
3955
|
+
setInvalidInput = _React$useState8[1];
|
|
3956
|
+
|
|
3507
3957
|
var errorMessage = (0, i18n_1._)('Value must be an integer greater than 0');
|
|
3958
|
+
|
|
3508
3959
|
var handleRangeTypeChange = function handleRangeTypeChange(e, _ref) {
|
|
3509
3960
|
var value = _ref.value;
|
|
3510
3961
|
setRangeType(value);
|
|
3511
3962
|
};
|
|
3963
|
+
|
|
3512
3964
|
var handleRangeAmountChange = function handleRangeAmountChange(e, _ref2) {
|
|
3513
3965
|
var value = _ref2.value;
|
|
3514
3966
|
setRangeAmount(value);
|
|
3515
3967
|
};
|
|
3968
|
+
|
|
3516
3969
|
var handleRangeUnitChange = function handleRangeUnitChange(e, _ref3) {
|
|
3517
3970
|
var value = _ref3.value;
|
|
3518
3971
|
setRangeUnit(value);
|
|
3519
3972
|
};
|
|
3973
|
+
|
|
3520
3974
|
var handleSubmit = function handleSubmit(e) {
|
|
3521
3975
|
// if the entered range amount is not a number, is not greater than 0, or is not an integer, then it is invalid
|
|
3522
3976
|
var parsedIntervalAmount = (0, numberUtils_1.parseNumber)(rangeAmount);
|
|
3977
|
+
|
|
3523
3978
|
if (Number.isNaN(parsedIntervalAmount) || parsedIntervalAmount <= 0 || !Number.isInteger(parsedIntervalAmount)) {
|
|
3524
3979
|
setInvalidInput(true);
|
|
3525
3980
|
return;
|
|
3526
3981
|
}
|
|
3982
|
+
|
|
3527
3983
|
setInvalidInput(false);
|
|
3528
3984
|
var timeInterval = (0, EventUtils_1.getCustomTimeInterval)({
|
|
3529
3985
|
time: time,
|
|
@@ -3533,6 +3989,7 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
|
3533
3989
|
});
|
|
3534
3990
|
onTimeDrilldown(e, timeInterval);
|
|
3535
3991
|
};
|
|
3992
|
+
|
|
3536
3993
|
var handleEventIntervalClick = function handleEventIntervalClick(e, when) {
|
|
3537
3994
|
e.preventDefault();
|
|
3538
3995
|
var timeInterval = (0, EventUtils_1.getPredefinedTimeInterval)({
|
|
@@ -3541,6 +3998,7 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
|
3541
3998
|
});
|
|
3542
3999
|
onTimeDrilldown(e, timeInterval);
|
|
3543
4000
|
};
|
|
4001
|
+
|
|
3544
4002
|
return React.createElement(Popover_1.default, {
|
|
3545
4003
|
open: open,
|
|
3546
4004
|
defaultPlacement: "below",
|
|
@@ -3643,6 +4101,7 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
|
|
|
3643
4101
|
"data-test": "apply-custom-time"
|
|
3644
4102
|
}))));
|
|
3645
4103
|
};
|
|
4104
|
+
|
|
3646
4105
|
TimeControlsPopover.defaultProps = {
|
|
3647
4106
|
open: false,
|
|
3648
4107
|
anchor: null,
|