@splunk/visualizations 26.0.0 → 26.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/Area.config.js +103 -19
  2. package/Area.config.js.map +1 -1
  3. package/Area.js +646 -243
  4. package/Area.js.map +1 -1
  5. package/Bar.config.js +105 -21
  6. package/Bar.config.js.map +1 -1
  7. package/Bar.js +653 -237
  8. package/Bar.js.map +1 -1
  9. package/Bubble.config.js +95 -21
  10. package/Bubble.config.js.map +1 -1
  11. package/Bubble.js +635 -229
  12. package/Bubble.js.map +1 -1
  13. package/ChoroplethSvg.config.js +66 -15
  14. package/ChoroplethSvg.config.js.map +1 -1
  15. package/ChoroplethSvg.js +589 -211
  16. package/ChoroplethSvg.js.map +1 -1
  17. package/Column.config.js +104 -19
  18. package/Column.config.js.map +1 -1
  19. package/Column.js +666 -239
  20. package/Column.js.map +1 -1
  21. package/Ellipse.config.js +83 -18
  22. package/Ellipse.config.js.map +1 -1
  23. package/Ellipse.js +444 -156
  24. package/Ellipse.js.map +1 -1
  25. package/Events.config.js +101 -19
  26. package/Events.config.js.map +1 -1
  27. package/Events.js +792 -322
  28. package/Events.js.map +1 -1
  29. package/FillerGauge.config.js +97 -28
  30. package/FillerGauge.config.js.map +1 -1
  31. package/FillerGauge.js +786 -390
  32. package/FillerGauge.js.map +1 -1
  33. package/Image.config.js +63 -19
  34. package/Image.config.js.map +1 -1
  35. package/Image.js +439 -164
  36. package/Image.js.map +1 -1
  37. package/Line.config.js +107 -23
  38. package/Line.config.js.map +1 -1
  39. package/Line.js +841 -456
  40. package/Line.js.map +1 -1
  41. package/LinkGraph.config.js +73 -23
  42. package/LinkGraph.config.js.map +1 -1
  43. package/LinkGraph.js +653 -230
  44. package/LinkGraph.js.map +1 -1
  45. package/MIGRATION.md +1082 -0
  46. package/Map.config.js +244 -99
  47. package/Map.config.js.map +1 -1
  48. package/Map.js +1223 -612
  49. package/Map.js.map +1 -1
  50. package/Markdown.config.js +71 -21
  51. package/Markdown.config.js.map +1 -1
  52. package/Markdown.js +477 -202
  53. package/Markdown.js.map +1 -1
  54. package/MarkerGauge.config.js +80 -22
  55. package/MarkerGauge.config.js.map +1 -1
  56. package/MarkerGauge.js +819 -418
  57. package/MarkerGauge.js.map +1 -1
  58. package/ParallelCoordinates.config.js +73 -19
  59. package/ParallelCoordinates.config.js.map +1 -1
  60. package/ParallelCoordinates.js +870 -491
  61. package/ParallelCoordinates.js.map +1 -1
  62. package/Pie.config.js +76 -23
  63. package/Pie.config.js.map +1 -1
  64. package/Pie.js +643 -233
  65. package/Pie.js.map +1 -1
  66. package/Punchcard.config.js +82 -30
  67. package/Punchcard.config.js.map +1 -1
  68. package/Punchcard.js +863 -387
  69. package/Punchcard.js.map +1 -1
  70. package/Rectangle.config.js +86 -20
  71. package/Rectangle.config.js.map +1 -1
  72. package/Rectangle.js +449 -159
  73. package/Rectangle.js.map +1 -1
  74. package/Sankey.config.js +85 -23
  75. package/Sankey.config.js.map +1 -1
  76. package/Sankey.js +895 -349
  77. package/Sankey.js.map +1 -1
  78. package/Scatter.config.js +97 -23
  79. package/Scatter.config.js.map +1 -1
  80. package/Scatter.js +639 -234
  81. package/Scatter.js.map +1 -1
  82. package/SingleValue.config.js +95 -25
  83. package/SingleValue.config.js.map +1 -1
  84. package/SingleValue.js +1198 -656
  85. package/SingleValue.js.map +1 -1
  86. package/SingleValueBasic.js +287 -226
  87. package/SingleValueBasic.js.map +1 -1
  88. package/SingleValueIcon.config.js +93 -23
  89. package/SingleValueIcon.config.js.map +1 -1
  90. package/SingleValueIcon.js +991 -522
  91. package/SingleValueIcon.js.map +1 -1
  92. package/SingleValueRadial.config.js +100 -27
  93. package/SingleValueRadial.config.js.map +1 -1
  94. package/SingleValueRadial.js +1185 -624
  95. package/SingleValueRadial.js.map +1 -1
  96. package/SparkLine.js +127 -68
  97. package/SparkLine.js.map +1 -1
  98. package/Table.config.js +74 -21
  99. package/Table.config.js.map +1 -1
  100. package/Table.js +827 -329
  101. package/Table.js.map +1 -1
  102. package/common/Charting.js +152 -69
  103. package/common/Charting.js.map +1 -1
  104. package/common/ChartingApi.js +25 -14
  105. package/common/ChartingApi.js.map +1 -1
  106. package/common/DocExampleWithVizSandbox.js +530 -0
  107. package/common/DocExampleWithVizSandbox.js.map +1 -0
  108. package/common/EventsDoc.js +139 -104
  109. package/common/EventsDoc.js.map +1 -1
  110. package/common/GaugeMajorTicks.js +79 -69
  111. package/common/GaugeMajorTicks.js.map +1 -1
  112. package/common/GaugeValueMarker.js +54 -45
  113. package/common/GaugeValueMarker.js.map +1 -1
  114. package/common/OptionsDoc.js +178 -87
  115. package/common/OptionsDoc.js.map +1 -1
  116. package/common/OverviewDoc.js +530 -68
  117. package/common/OverviewDoc.js.map +1 -1
  118. package/common/SplunkVisualization.js +47 -20
  119. package/common/SplunkVisualization.js.map +1 -1
  120. package/common/SplunkVisualizationApi.js +15 -9
  121. package/common/SplunkVisualizationApi.js.map +1 -1
  122. package/common/ThemesDoc.js +57 -44
  123. package/common/ThemesDoc.js.map +1 -1
  124. package/common/chartingUtils.js +52 -20
  125. package/common/chartingUtils.js.map +1 -1
  126. package/common/docUtils.js +139 -7
  127. package/common/docUtils.js.map +1 -1
  128. package/common/gaugeUtils.js +185 -102
  129. package/common/gaugeUtils.js.map +1 -1
  130. package/common/shapeUtils.js +28 -16
  131. package/common/shapeUtils.js.map +1 -1
  132. package/common/utils/configUtils.js +50 -15
  133. package/common/utils/configUtils.js.map +1 -1
  134. package/common/utils/dataUtils.js +8 -3
  135. package/common/utils/dataUtils.js.map +1 -1
  136. package/common/utils/hocUtils.js +4 -2
  137. package/common/utils/hocUtils.js.map +1 -1
  138. package/common/utils/layoutUtils.js +2 -1
  139. package/common/utils/layoutUtils.js.map +1 -1
  140. package/common/utils/mapUtils.js +288 -128
  141. package/common/utils/mapUtils.js.map +1 -1
  142. package/common/utils/singleValueUtils.js +242 -197
  143. package/common/utils/singleValueUtils.js.map +1 -1
  144. package/common/utils/testHelper.js +10 -1
  145. package/common/utils/testHelper.js.map +1 -1
  146. package/common/utils/trellisUtils.js +62 -1
  147. package/common/utils/trellisUtils.js.map +1 -1
  148. package/common/utils/urlUtils.js +3 -1
  149. package/common/utils/urlUtils.js.map +1 -1
  150. package/common/withDashboardViz.js +389 -192
  151. package/common/withDashboardViz.js.map +1 -1
  152. package/package.json +18 -26
package/Events.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright © 2018 Splunk Inc.
2
+ * Copyright © 2024 Splunk Inc.
3
3
  * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
4
  * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
5
  */
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 202);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 203);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -133,6 +133,7 @@ Object.defineProperty(exports, "__esModule", {
133
133
  });
134
134
  exports.VizBehavior = void 0;
135
135
  var VizBehavior;
136
+
136
137
  (function (VizBehavior) {
137
138
  /**
138
139
  * Dynamic Options Behavior.
@@ -152,6 +153,7 @@ var VizBehavior;
152
153
  * missing.
153
154
  * @type {string}
154
155
  */
156
+
155
157
  VizBehavior["PLACEHOLDER"] = "placeholder";
156
158
  VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
157
159
  VizBehavior["TRELLIS"] = "trellis";
@@ -203,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
- // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
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
- height = _ref2.height;
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
- height = props.height,
253
- backgroundColor = props.backgroundColor;
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.0.0 - 2f7458907",
274
+ "data-splunk-visualization-version": "26.1.1 - b6df0a015",
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
- newHeight = _ref3.height;
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
- Visualization = _ref.Visualization;
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
- title = _a.title,
381
- description = _a.description,
382
- readOnly = _a.readOnly,
383
- writeOnly = _a.writeOnly,
384
- examples = _a.examples,
385
- defaultValue = _a.default,
386
- type = _a.type,
387
- properties = _a.properties,
388
- patternProperties = _a.patternProperties,
389
- remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
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
- exports.isDynamicOption = isDynamicOption;
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
- height = props.height,
643
- icon = props.icon,
644
- iconColor = props.iconColor;
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: {
@@ -653,9 +712,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
653
712
  transform: 'translate(-50%, -50%)'
654
713
  },
655
714
  width: '50%',
656
- height: '50%'
715
+ height: '50%',
716
+ 'data-test': 'icon-placeholder'
657
717
  });
658
718
  }
719
+
659
720
  return React.createElement(Message_1.default, {
660
721
  width: width,
661
722
  height: height,
@@ -663,6 +724,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
663
724
  message: (0, i18n_1._)('No DataSource Connected')
664
725
  });
665
726
  };
727
+
666
728
  IconPlaceholder.propTypes = propTypes;
667
729
  IconPlaceholder.defaultProps = {
668
730
  width: '100%',
@@ -678,21 +740,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
678
740
 
679
741
 
680
742
  var _defineProperty = __webpack_require__(7);
743
+
681
744
  Object.defineProperty(exports, "__esModule", {
682
745
  value: true
683
746
  });
684
747
  exports.getSortingParams = exports.SortParamsPropTypes = void 0;
748
+
685
749
  var T = __webpack_require__(0);
750
+
686
751
  var lodash_1 = __webpack_require__(3);
687
- var DataSource_1 = __webpack_require__(43);
752
+
753
+ var DataSource_1 = __webpack_require__(34);
754
+
688
755
  exports.SortParamsPropTypes = T.shape({
689
756
  currentSortKey: T.string,
690
757
  currentSortDir: T.oneOf(DataSource_1.validSortDirs),
691
758
  onSort: T.func
692
759
  });
760
+
693
761
  var getSortingParams = function getSortingParams(_ref) {
694
762
  var requestParams = _ref.requestParams,
695
- onRequestParamsChange = _ref.onRequestParamsChange;
763
+ onRequestParamsChange = _ref.onRequestParamsChange;
696
764
  var currentSortKey;
697
765
  var currentSortDir;
698
766
  var nextSortDirMap = {
@@ -701,15 +769,18 @@ var getSortingParams = function getSortingParams(_ref) {
701
769
  none: 'asc'
702
770
  };
703
771
  var onSort;
772
+
704
773
  if (typeof onRequestParamsChange === 'function') {
705
774
  if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
706
775
  currentSortKey = Object.keys(requestParams.sort).shift();
707
776
  currentSortDir = requestParams.sort[currentSortKey];
708
- }
709
- // undid memoization since there is a dependency on requestParams, which is a deeply nested object
777
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
778
+
779
+
710
780
  onSort = function onSort(e, _ref2) {
711
781
  var sortKey = _ref2.sortKey,
712
- sortDir = _ref2.sortDir;
782
+ sortDir = _ref2.sortDir;
783
+
713
784
  if (typeof sortKey === 'string') {
714
785
  var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
715
786
  onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
@@ -721,12 +792,14 @@ var getSortingParams = function getSortingParams(_ref) {
721
792
  }
722
793
  };
723
794
  }
795
+
724
796
  return {
725
797
  currentSortKey: currentSortKey,
726
798
  currentSortDir: currentSortDir,
727
799
  onSort: onSort
728
800
  };
729
801
  };
802
+
730
803
  exports.getSortingParams = getSortingParams;
731
804
 
732
805
  /***/ }),
@@ -736,43 +809,68 @@ exports.getSortingParams = getSortingParams;
736
809
  "use strict";
737
810
 
738
811
 
812
+ Object.defineProperty(exports, "__esModule", {
813
+ value: true
814
+ });
815
+ exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
816
+ exports.validSortDirs = ['asc', 'desc', 'none'];
817
+ exports.validSegmentationModes = ['none', 'inner'];
818
+ exports.validOutputModes = ['json_cols', 'json'];
819
+
820
+ /***/ }),
821
+ /* 35 */
822
+ /***/ (function(module, exports, __webpack_require__) {
823
+
824
+ "use strict";
825
+
826
+
739
827
  Object.defineProperty(exports, "__esModule", {
740
828
  value: true
741
829
  });
742
830
  exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
831
+
743
832
  var T = __webpack_require__(0);
833
+
744
834
  var lodash_1 = __webpack_require__(3);
835
+
745
836
  exports.PaginatorParamsPropTypes = T.shape({
746
837
  isPaging: T.bool,
747
838
  current: T.number,
748
839
  totalPages: T.number,
749
840
  onChange: T.func
750
841
  });
842
+
751
843
  var getPaginationParams = function getPaginationParams(_ref) {
752
844
  var requestParams = _ref.requestParams,
753
- meta = _ref.meta,
754
- onRequestParamsChange = _ref.onRequestParamsChange;
845
+ meta = _ref.meta,
846
+ onRequestParamsChange = _ref.onRequestParamsChange;
755
847
  var totalCount = meta && meta.totalCount || 0;
756
848
  var offset = requestParams && requestParams.offset || 0;
757
849
  var count = requestParams && requestParams.count;
758
850
  var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
759
851
  var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
760
852
  var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
853
+
761
854
  var onChangeHandler = function onChangeHandler(e, _ref2) {
762
855
  var page = _ref2.page,
763
- countArg = _ref2.count;
856
+ countArg = _ref2.count;
764
857
  var newParams = (0, lodash_1.cloneDeep)(requestParams);
858
+
765
859
  if (typeof countArg === 'number') {
766
860
  newParams.count = countArg;
767
861
  newParams.offset = 0;
768
862
  }
863
+
769
864
  var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
865
+
770
866
  if (typeof page === 'number' && page > 0) {
771
867
  newParams.count = pageCount;
772
868
  newParams.offset = (page - 1) * pageCount;
773
869
  }
870
+
774
871
  onRequestParamsChange(newParams);
775
872
  };
873
+
776
874
  return {
777
875
  isPaging: isPaging,
778
876
  current: current,
@@ -780,10 +878,11 @@ var getPaginationParams = function getPaginationParams(_ref) {
780
878
  onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
781
879
  };
782
880
  };
881
+
783
882
  exports.getPaginationParams = getPaginationParams;
784
883
 
785
884
  /***/ }),
786
- /* 35 */
885
+ /* 36 */
787
886
  /***/ (function(module, exports, __webpack_require__) {
788
887
 
789
888
  "use strict";
@@ -794,6 +893,7 @@ Object.defineProperty(exports, "__esModule", {
794
893
  });
795
894
  exports.VizCategory = void 0;
796
895
  var VizCategory;
896
+
797
897
  (function (VizCategory) {
798
898
  VizCategory["SINGLE_VALUE"] = "Single Value";
799
899
  VizCategory["TRENDS"] = "Trends";
@@ -810,67 +910,96 @@ var VizCategory;
810
910
  })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
811
911
 
812
912
  /***/ }),
813
- /* 36 */
913
+ /* 37 */
814
914
  /***/ (function(module, exports, __webpack_require__) {
815
915
 
816
916
  "use strict";
817
917
 
818
918
 
819
919
  var _slicedToArray = __webpack_require__(17);
920
+
820
921
  Object.defineProperty(exports, "__esModule", {
821
922
  value: true
822
923
  });
924
+
823
925
  var React = __webpack_require__(1);
926
+
824
927
  var lodash_1 = __webpack_require__(3);
825
- var getSettingsFromThemedProps_1 = __webpack_require__(37);
928
+
929
+ var getSettingsFromThemedProps_1 = __webpack_require__(38);
930
+
826
931
  var Options_1 = __webpack_require__(30);
827
- var SanitizeProps_1 = __webpack_require__(38);
932
+
933
+ var SanitizeProps_1 = __webpack_require__(39);
934
+
828
935
  var TimezoneContext_1 = __webpack_require__(26);
829
- var moment_1 = __webpack_require__(39);
936
+
937
+ var moment_1 = __webpack_require__(40);
938
+
830
939
  var FeatureFlagContext_1 = __webpack_require__(21);
940
+
831
941
  var styled_components_1 = __webpack_require__(4);
942
+
832
943
  var hocUtils_1 = __webpack_require__(27);
944
+
833
945
  var JSONSchemaUtils_1 = __webpack_require__(28);
834
- var async_dynamic_options_evaluator_1 = __webpack_require__(40);
946
+
947
+ var async_dynamic_options_evaluator_1 = __webpack_require__(41);
948
+
835
949
  var id_1 = __webpack_require__(25);
836
- var SplunkVisualization_1 = __webpack_require__(41);
950
+
951
+ var SplunkVisualization_1 = __webpack_require__(42);
952
+
837
953
  var VizBehavior_1 = __webpack_require__(6);
954
+
838
955
  var getSorting_1 = __webpack_require__(33);
839
- var getPagination_1 = __webpack_require__(34);
956
+
957
+ var getPagination_1 = __webpack_require__(35);
958
+
840
959
  var useDeepMemo_1 = __webpack_require__(44);
960
+
841
961
  var MissingPropsMessage_1 = __webpack_require__(45);
962
+
842
963
  var withEditModeCover_1 = __webpack_require__(46);
964
+
843
965
  var withPlaceholder_1 = __webpack_require__(47);
844
966
  /**
845
967
  * hoc that wraps a pure react visualization in a Dashboard visualization
846
968
  * @param {DashboardVizOpts} opts
847
969
  * @returns {HOC}
848
970
  */
971
+
972
+
849
973
  var withDashboardViz = function withDashboardViz(opts) {
850
974
  var ReactViz = opts.ReactViz,
851
- vizConfig = opts.vizConfig,
852
- _opts$computeVizProps = opts.computeVizProps,
853
- computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
854
- disableEditModeCover = opts.disableEditModeCover,
855
- useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
975
+ vizConfig = opts.vizConfig,
976
+ _opts$computeVizProps = opts.computeVizProps,
977
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
978
+ disableEditModeCover = opts.disableEditModeCover,
979
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
980
+
856
981
  var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
857
982
  var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
983
+
858
984
  var DashboardViz = function DashboardViz(props) {
859
985
  var _a;
986
+
860
987
  var mode = props.mode,
861
- hasEventHandlers = props.hasEventHandlers,
862
- dataSources = props.dataSources,
863
- options = props.options,
864
- _props$context = props.context,
865
- context = _props$context === void 0 ? {} : _props$context,
866
- width = props.width,
867
- height = props.height,
868
- onComputedProps = props.onComputedProps,
869
- onEventTrigger = props.onEventTrigger,
870
- theme = props.theme,
871
- onRequestParamsChange = props.onRequestParamsChange;
988
+ hasEventHandlers = props.hasEventHandlers,
989
+ dataSources = props.dataSources,
990
+ options = props.options,
991
+ _props$context = props.context,
992
+ context = _props$context === void 0 ? {} : _props$context,
993
+ width = props.width,
994
+ height = props.height,
995
+ onComputedProps = props.onComputedProps,
996
+ onEventTrigger = props.onEventTrigger,
997
+ theme = props.theme,
998
+ onRequestParamsChange = props.onRequestParamsChange;
999
+
872
1000
  var _React$useContext = React.useContext(TimezoneContext_1.default),
873
- serializedTimezone = _React$useContext.serializedTimezone;
1001
+ serializedTimezone = _React$useContext.serializedTimezone;
1002
+
874
1003
  if (serializedTimezone) {
875
1004
  /*
876
1005
  @splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
@@ -884,38 +1013,51 @@ var withDashboardViz = function withDashboardViz(opts) {
884
1013
  moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
885
1014
  }
886
1015
  }
1016
+
887
1017
  var themeFunc = function themeFunc(themeVar) {
888
1018
  var _a, _b;
1019
+
889
1020
  return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
890
1021
  };
1022
+
891
1023
  var bgColorFromTheme = themeFunc('defaultBackgroundColor');
1024
+
892
1025
  var _ref = (0, getSettingsFromThemedProps_1.default)({
893
- theme: theme
894
- }),
895
- currentThemeFamily = _ref.family,
896
- currentThemeColorScheme = _ref.colorScheme,
897
- currentThemeDensity = _ref.density;
1026
+ theme: theme
1027
+ }),
1028
+ currentThemeFamily = _ref.family,
1029
+ currentThemeColorScheme = _ref.colorScheme,
1030
+ currentThemeDensity = _ref.density;
1031
+
898
1032
  var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
1033
+
899
1034
  var _React$useState = React.useState({}),
900
- _React$useState2 = _slicedToArray(_React$useState, 2),
901
- evaluatedOptionsAsync = _React$useState2[0],
902
- setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1035
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1036
+ evaluatedOptionsAsync = _React$useState2[0],
1037
+ setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1038
+
1039
+
903
1040
  var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
1041
+
904
1042
  var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
905
- _React$useState4 = _slicedToArray(_React$useState3, 1),
906
- visualizationID = _React$useState4[0];
1043
+ _React$useState4 = _slicedToArray(_React$useState3, 1),
1044
+ visualizationID = _React$useState4[0];
1045
+
907
1046
  var _React$useState5 = React.useState({}),
908
- _React$useState6 = _slicedToArray(_React$useState5, 2),
909
- dataSourcesInState = _React$useState6[0],
910
- setDataSourcesInState = _React$useState6[1];
1047
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
1048
+ dataSourcesInState = _React$useState6[0],
1049
+ setDataSourcesInState = _React$useState6[1];
1050
+
911
1051
  var _React$useState7 = React.useState(),
912
- _React$useState8 = _slicedToArray(_React$useState7, 2),
913
- dataFramesInState = _React$useState8[0],
914
- setDataFramesInState = _React$useState8[1];
1052
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
1053
+ dataFramesInState = _React$useState8[0],
1054
+ setDataFramesInState = _React$useState8[1];
1055
+
915
1056
  var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
916
- _React$useState10 = _slicedToArray(_React$useState9, 2),
917
- useAsyncEvaluatedOptions = _React$useState10[0],
918
- setUseAsyncEvaluatedOptions = _React$useState10[1];
1057
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
1058
+ useAsyncEvaluatedOptions = _React$useState10[0],
1059
+ setUseAsyncEvaluatedOptions = _React$useState10[1];
1060
+
919
1061
  var isMounted = React.useRef(true);
920
1062
  evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
921
1063
  try {
@@ -940,11 +1082,13 @@ var withDashboardViz = function withDashboardViz(opts) {
940
1082
  });
941
1083
  } else {
942
1084
  var dataFrames = dataFramesInState;
1085
+
943
1086
  if (dataSources !== dataSourcesInState) {
944
1087
  setDataSourcesInState(dataSources);
945
1088
  dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
946
1089
  setDataFramesInState(dataFrames);
947
1090
  }
1091
+
948
1092
  return Options_1.Options.evaluate({
949
1093
  context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
950
1094
  options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
@@ -955,21 +1099,24 @@ var withDashboardViz = function withDashboardViz(opts) {
955
1099
  console.error("unexpected error evaluating options: ".concat(e.message));
956
1100
  return {};
957
1101
  }
1102
+
958
1103
  return {};
959
1104
  }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
960
- var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
961
- // trellis specific backgroundColor update for onComputedProps
1105
+ var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
962
1106
  // 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
1107
  // onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
1108
+
964
1109
  var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
965
1110
  var clonedEvaluatedOptions = evaluatedOptionsToUse;
1111
+
966
1112
  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
1113
  clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
968
1114
  backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
969
1115
  });
970
- }
971
- // useEffect hook needs to be initialized before any early returns
1116
+ } // useEffect hook needs to be initialized before any early returns
972
1117
  // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
1118
+
1119
+
973
1120
  React.useEffect(function () {
974
1121
  onComputedProps(clonedEvaluatedOptions);
975
1122
  });
@@ -979,53 +1126,68 @@ var withDashboardViz = function withDashboardViz(opts) {
979
1126
  isMounted.current = false;
980
1127
  async_dynamic_options_evaluator_1.default.reset(visualizationID);
981
1128
  }
982
- };
983
- // eslint-disable-next-line react-hooks/exhaustive-deps
984
- }, []);
985
- // present warning message if any required props are missing
1129
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
1130
+ }, []); // present warning message if any required props are missing
1131
+
986
1132
  var _vizConfig$requiredPr = vizConfig.requiredProps,
987
- requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
988
- supports = vizConfig.supports;
1133
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
1134
+ supports = vizConfig.supports;
989
1135
  var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
1136
+
990
1137
  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
1138
  ) {
992
- return React.createElement(MissingPropsMessage_1.default, {
993
- "data-test": "missing-props-message",
994
- width: width,
995
- height: height,
996
- missingProps: missing,
997
- backgroundColor: bgColorFromTheme
998
- });
999
- }
1000
- // events
1139
+ return React.createElement(MissingPropsMessage_1.default, {
1140
+ "data-test": "missing-props-message",
1141
+ width: width,
1142
+ height: height,
1143
+ missingProps: missing,
1144
+ backgroundColor: bgColorFromTheme
1145
+ });
1146
+ } // events
1147
+
1148
+
1001
1149
  var eventCallbackProps = {};
1150
+
1002
1151
  if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
1003
1152
  var supportedEvents = vizConfig.events;
1004
1153
  Object.keys(supportedEvents).forEach(function (eventName) {
1005
- 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
+ var _supportedEvents$even = supportedEvents[eventName],
1155
+ parentKeys = _supportedEvents$even.parentKeys,
1156
+ payloadKeys = _supportedEvents$even.payloadKeys;
1157
+ var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
1008
1158
  // then remove these lines
1009
- var payloadKeys = supportedEvents[eventName].payloadKeys;
1159
+
1010
1160
  var payload = {};
1161
+
1011
1162
  if (Array.isArray(payloadKeys) && payloadKeys.length) {
1012
1163
  payloadKeys.forEach(function (p) {
1013
1164
  payload[p] = evaluatedOptionsToUse[p];
1014
1165
  });
1015
1166
  }
1167
+
1016
1168
  eventCallbackProps[eventCallbackPropName] = function (ev) {
1017
1169
  if (ev && ev.payload) {
1018
1170
  payload = ev.payload;
1019
1171
  }
1172
+
1020
1173
  return onEventTrigger({
1021
1174
  originalEvent: ev,
1022
1175
  payload: payload,
1023
1176
  type: eventName
1024
1177
  });
1025
1178
  };
1179
+
1180
+ if (parentKeys) {
1181
+ for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
1182
+ var newObject = {};
1183
+ newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
1184
+ eventCallbackProps[eventCallbackPropName] = newObject;
1185
+ }
1186
+ }
1026
1187
  });
1027
- }
1028
- // compute pure viz props which are not from options
1188
+ } // compute pure viz props which are not from options
1189
+
1190
+
1029
1191
  var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
1030
1192
  themeFunc: themeFunc
1031
1193
  }));
@@ -1043,15 +1205,19 @@ var withDashboardViz = function withDashboardViz(opts) {
1043
1205
  * In future, we could automatically detect which all datasources are being used
1044
1206
  * and bind those magically to pagination/sorting behavior.
1045
1207
  */
1208
+
1046
1209
  var dataSourceMetadata = {};
1047
1210
  var OptionKey = 'paginateDataSourceKey';
1048
1211
  var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
1212
+
1049
1213
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
1050
1214
  var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
1051
1215
  var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
1216
+
1052
1217
  var handleRequestParamsChange = function handleRequestParamsChange(payload) {
1053
1218
  return onRequestParamsChange(paginateDataSourceKey, payload);
1054
1219
  };
1220
+
1055
1221
  var sortParams = (0, getSorting_1.getSortingParams)({
1056
1222
  requestParams: requestParams,
1057
1223
  meta: meta,
@@ -1066,103 +1232,120 @@ var withDashboardViz = function withDashboardViz(opts) {
1066
1232
  sortParams: sortParams,
1067
1233
  paginatorParams: paginatorParams
1068
1234
  };
1069
- }
1070
- // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
1235
+ } // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
1236
+
1237
+
1071
1238
  if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
1072
1239
  return null;
1073
1240
  }
1241
+
1074
1242
  return React.createElement(SanitizedReactViz, Object.assign({
1075
1243
  mode: mode,
1076
1244
  width: width,
1077
1245
  height: height
1078
1246
  }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1079
1247
  };
1248
+
1080
1249
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
1081
1250
  DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
1082
1251
  // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
1083
1252
  theme: {}
1084
- });
1085
- // attach viz config
1086
- DashboardViz.config = vizConfig;
1087
- // @ts-ignore: TODO fix sc upgrade TS issues
1253
+ }); // attach viz config
1254
+
1255
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1256
+
1088
1257
  return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
1089
1258
  };
1259
+
1090
1260
  exports.default = withDashboardViz;
1091
1261
 
1092
1262
  /***/ }),
1093
- /* 37 */
1263
+ /* 38 */
1094
1264
  /***/ (function(module, exports) {
1095
1265
 
1096
1266
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1097
1267
 
1098
1268
  /***/ }),
1099
- /* 38 */
1269
+ /* 39 */
1100
1270
  /***/ (function(module, exports) {
1101
1271
 
1102
1272
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1103
1273
 
1104
1274
  /***/ }),
1105
- /* 39 */
1275
+ /* 40 */
1106
1276
  /***/ (function(module, exports) {
1107
1277
 
1108
1278
  module.exports = require("@splunk/moment");
1109
1279
 
1110
1280
  /***/ }),
1111
- /* 40 */
1281
+ /* 41 */
1112
1282
  /***/ (function(module, exports) {
1113
1283
 
1114
1284
  module.exports = require("@splunk/async-dynamic-options-evaluator");
1115
1285
 
1116
1286
  /***/ }),
1117
- /* 41 */
1287
+ /* 42 */
1118
1288
  /***/ (function(module, exports, __webpack_require__) {
1119
1289
 
1120
1290
  "use strict";
1121
1291
 
1122
1292
 
1123
1293
  var _classCallCheck = __webpack_require__(9);
1294
+
1124
1295
  Object.defineProperty(exports, "__esModule", {
1125
1296
  value: true
1126
1297
  });
1127
1298
  exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1128
1299
  /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1300
+
1129
1301
  var T = __webpack_require__(0);
1302
+
1130
1303
  var lodash_1 = __webpack_require__(3);
1131
- var VizActionHandler_1 = __webpack_require__(42);
1132
- // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1304
+
1305
+ var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1306
+
1307
+
1133
1308
  exports.INITIAL_WIDTH = 250;
1134
1309
  exports.INITIAL_HEIGHT = 250;
1135
1310
  /**
1136
1311
  * A Splunk visualization
1137
1312
  */
1313
+
1138
1314
  var SplunkVisualization = function SplunkVisualization() {
1139
1315
  _classCallCheck(this, SplunkVisualization);
1140
1316
  };
1317
+
1141
1318
  SplunkVisualization.propTypes = {
1142
1319
  /**
1143
1320
  * display mode
1144
1321
  */
1145
1322
  mode: T.oneOf(['view', 'edit', 'export']).isRequired,
1323
+
1146
1324
  /**
1147
1325
  * width in pixel or string, defaults to 100%
1148
1326
  */
1149
1327
  width: T.oneOfType([T.string, T.number]).isRequired,
1328
+
1150
1329
  /**
1151
1330
  * height in pixel or string
1152
1331
  */
1153
1332
  height: T.oneOfType([T.string, T.number]).isRequired,
1333
+
1154
1334
  /**
1155
1335
  * visualization context used for dynamic option evaluation
1156
1336
  */
1157
1337
  context: T.object,
1338
+
1158
1339
  /**
1159
1340
  * visualization formatting options
1160
1341
  */
1161
1342
  options: T.object,
1343
+
1162
1344
  /**
1163
1345
  * A callback to update formatting options
1164
1346
  */
1165
1347
  onOptionsChange: T.func,
1348
+
1166
1349
  /**
1167
1350
  * datasource state which include data and request params, object key indicate the datasource type.
1168
1351
  */
@@ -1171,6 +1354,7 @@ SplunkVisualization.propTypes = {
1171
1354
  * current request params
1172
1355
  */
1173
1356
  requestParams: T.object,
1357
+
1174
1358
  /**
1175
1359
  * current dataset
1176
1360
  */
@@ -1178,6 +1362,7 @@ SplunkVisualization.propTypes = {
1178
1362
  fields: T.array,
1179
1363
  columns: T.array
1180
1364
  }),
1365
+
1181
1366
  /**
1182
1367
  * error
1183
1368
  */
@@ -1185,29 +1370,35 @@ SplunkVisualization.propTypes = {
1185
1370
  level: T.string,
1186
1371
  message: T.string
1187
1372
  }),
1373
+
1188
1374
  /**
1189
1375
  * meta data that came with the dataset
1190
1376
  */
1191
1377
  meta: T.object
1192
1378
  })),
1379
+
1193
1380
  /**
1194
1381
  * A callback to trigger event
1195
1382
  */
1196
1383
  onEventTrigger: T.func,
1384
+
1197
1385
  /**
1198
1386
  * Inform viz if there are handlers listening to events
1199
1387
  */
1200
1388
  hasEventHandlers: T.bool,
1389
+
1201
1390
  /**
1202
1391
  * A callback to communicate computed props to a consumer
1203
1392
  */
1204
1393
  onComputedProps: T.func,
1394
+
1205
1395
  /**
1206
1396
  * A callback to obtain visualization api
1207
1397
  */
1208
1398
  vizActionHandlerRef: T.func,
1209
1399
  loading: T.bool,
1210
1400
  theme: T.object,
1401
+
1211
1402
  /**
1212
1403
  * A callback to request new data with updated request params
1213
1404
  */
@@ -1216,6 +1407,7 @@ SplunkVisualization.propTypes = {
1216
1407
  /**
1217
1408
  *
1218
1409
  */
1410
+
1219
1411
  SplunkVisualization.defaultProps = {
1220
1412
  // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1221
1413
  width: '100%',
@@ -1243,26 +1435,29 @@ SplunkVisualization.defaultProps = {
1243
1435
  exports.default = SplunkVisualization;
1244
1436
 
1245
1437
  /***/ }),
1246
- /* 42 */
1438
+ /* 43 */
1247
1439
  /***/ (function(module, exports, __webpack_require__) {
1248
1440
 
1249
1441
  "use strict";
1250
1442
 
1251
1443
 
1252
1444
  var _classCallCheck = __webpack_require__(9);
1445
+
1253
1446
  var _createClass = __webpack_require__(18);
1447
+
1254
1448
  Object.defineProperty(exports, "__esModule", {
1255
1449
  value: true
1256
1450
  });
1257
1451
  exports.DefaultVizActionHandler = void 0;
1452
+
1258
1453
  var DefaultVizActionHandler = /*#__PURE__*/function () {
1259
1454
  function DefaultVizActionHandler() {
1260
1455
  _classCallCheck(this, DefaultVizActionHandler);
1261
1456
  }
1457
+
1262
1458
  _createClass(DefaultVizActionHandler, [{
1263
1459
  key: "focus",
1264
- value: function focus() {
1265
- // noop
1460
+ value: function focus() {// noop
1266
1461
  }
1267
1462
  }, {
1268
1463
  key: "snapshot",
@@ -1270,22 +1465,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
1270
1465
  return null; // noop
1271
1466
  }
1272
1467
  }]);
1468
+
1273
1469
  return DefaultVizActionHandler;
1274
1470
  }();
1275
- exports.DefaultVizActionHandler = DefaultVizActionHandler;
1276
-
1277
- /***/ }),
1278
- /* 43 */
1279
- /***/ (function(module, exports, __webpack_require__) {
1280
-
1281
- "use strict";
1282
-
1283
1471
 
1284
- Object.defineProperty(exports, "__esModule", {
1285
- value: true
1286
- });
1287
- exports.validSortDirs = void 0;
1288
- exports.validSortDirs = ['asc', 'desc', 'none'];
1472
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
1289
1473
 
1290
1474
  /***/ }),
1291
1475
  /* 44 */
@@ -1298,7 +1482,9 @@ Object.defineProperty(exports, "__esModule", {
1298
1482
  value: true
1299
1483
  });
1300
1484
  exports.useDeepMemo = void 0;
1485
+
1301
1486
  var react_1 = __webpack_require__(1);
1487
+
1302
1488
  var lodash_1 = __webpack_require__(3);
1303
1489
  /**
1304
1490
  * This hook evaluates and stores the result of a passed function and only
@@ -1313,16 +1499,21 @@ var lodash_1 = __webpack_require__(3);
1313
1499
  * @param fn the function to be executed and
1314
1500
  * @param dependencies an array of dependencies
1315
1501
  */
1502
+
1503
+
1316
1504
  var useDeepMemo = function useDeepMemo(fn, dependencies) {
1317
1505
  var ref = (0, react_1.useRef)();
1506
+
1318
1507
  if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
1319
1508
  ref.current = {
1320
1509
  dependencies: dependencies,
1321
1510
  value: fn()
1322
1511
  };
1323
1512
  }
1513
+
1324
1514
  return ref.current.value;
1325
1515
  };
1516
+
1326
1517
  exports.useDeepMemo = useDeepMemo;
1327
1518
 
1328
1519
  /***/ }),
@@ -1336,19 +1527,27 @@ Object.defineProperty(exports, "__esModule", {
1336
1527
  value: true
1337
1528
  });
1338
1529
  exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1530
+
1339
1531
  var React = __webpack_require__(1);
1532
+
1340
1533
  var T = __webpack_require__(0);
1534
+
1341
1535
  var i18n_1 = __webpack_require__(2);
1536
+
1342
1537
  var Message_1 = __webpack_require__(10);
1538
+
1343
1539
  var FixedSizeContainer_1 = __webpack_require__(13);
1344
1540
  /**
1345
1541
  * @method isMissing
1346
1542
  * @param {any} v
1347
1543
  * @returns {boolean} true if the input value === null or undefined
1348
1544
  */
1545
+
1546
+
1349
1547
  var isMissing = function isMissing(v) {
1350
1548
  return v === null || v === undefined;
1351
1549
  };
1550
+
1352
1551
  exports.isMissing = isMissing;
1353
1552
  /**
1354
1553
  * @method misskingKeys
@@ -1356,11 +1555,13 @@ exports.isMissing = isMissing;
1356
1555
  * @param {object} target
1357
1556
  * @returns {string[]} the keys of missing required props
1358
1557
  */
1558
+
1359
1559
  var missingKeys = function missingKeys(keys, target) {
1360
1560
  return keys.filter(function (k) {
1361
1561
  return (0, exports.isMissing)(target[k]);
1362
1562
  });
1363
1563
  };
1564
+
1364
1565
  exports.missingKeys = missingKeys;
1365
1566
  var propTypes = {
1366
1567
  width: T.oneOfType([T.string, T.number]),
@@ -1374,10 +1575,11 @@ var propTypes = {
1374
1575
  * @param {MissingPropsProps} props
1375
1576
  * @returns {React.ReactElement}
1376
1577
  */
1578
+
1377
1579
  var MissingPropsMessage = function MissingPropsMessage(props) {
1378
1580
  var width = props.width,
1379
- height = props.height,
1380
- missingProps = props.missingProps;
1581
+ height = props.height,
1582
+ missingProps = props.missingProps;
1381
1583
  return React.createElement(Message_1.default, {
1382
1584
  "data-test": "message",
1383
1585
  width: width,
@@ -1385,6 +1587,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
1385
1587
  message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
1386
1588
  });
1387
1589
  };
1590
+
1388
1591
  exports.MissingPropsMessage = MissingPropsMessage;
1389
1592
  exports.MissingPropsMessage.propTypes = propTypes;
1390
1593
  exports.MissingPropsMessage.defaultProps = {
@@ -1403,15 +1606,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
1403
1606
  Object.defineProperty(exports, "__esModule", {
1404
1607
  value: true
1405
1608
  });
1609
+
1406
1610
  var React = __webpack_require__(1);
1611
+
1407
1612
  var styled_components_1 = __webpack_require__(4);
1613
+
1408
1614
  var hocUtils_1 = __webpack_require__(15);
1615
+
1409
1616
  var Cover = styled_components_1.default.div.withConfig({
1410
1617
  displayName: "withEditModeCover__Cover",
1411
1618
  componentId: "sc-1gsbnxb-0"
1412
1619
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1413
1620
  var Blocker = styled_components_1.default.div.attrs({
1414
- 'data-splunk-visualization-version': "26.0.0 - 2f7458907"
1621
+ 'data-splunk-visualization-version': "26.1.1 - b6df0a015"
1415
1622
  }).withConfig({
1416
1623
  displayName: "withEditModeCover__Blocker",
1417
1624
  componentId: "sc-1gsbnxb-1"
@@ -1422,6 +1629,7 @@ var Blocker = styled_components_1.default.div.attrs({
1422
1629
  * @param {ExtendedDashViz} Visualization
1423
1630
  * @returns {ExtendedDashViz} Wrapper
1424
1631
  */
1632
+
1425
1633
  var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
1426
1634
  var Wrapper = function Wrapper(props) {
1427
1635
  var mode = props.mode;
@@ -1430,12 +1638,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1430
1638
  "data-test": "edit-mode-cover"
1431
1639
  }));
1432
1640
  };
1641
+
1433
1642
  (0, hocUtils_1.extendStaticWrapperProps)({
1434
1643
  Wrapper: Wrapper,
1435
1644
  Visualization: Visualization
1436
1645
  });
1437
1646
  return Wrapper;
1438
1647
  };
1648
+
1439
1649
  exports.default = withEditModeCover;
1440
1650
 
1441
1651
  /***/ }),
@@ -1448,27 +1658,37 @@ exports.default = withEditModeCover;
1448
1658
  Object.defineProperty(exports, "__esModule", {
1449
1659
  value: true
1450
1660
  });
1661
+
1451
1662
  var React = __webpack_require__(1);
1663
+
1452
1664
  var colorUtils_1 = __webpack_require__(12);
1665
+
1453
1666
  var variables_1 = __webpack_require__(11);
1667
+
1454
1668
  var IconPlaceholder_1 = __webpack_require__(32);
1669
+
1455
1670
  var VizBehavior_1 = __webpack_require__(6);
1671
+
1456
1672
  var hocUtils_1 = __webpack_require__(15);
1673
+
1457
1674
  var withPlaceholder = function withPlaceholder(Visualization) {
1458
1675
  var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
1459
1676
  var config = Visualization.config;
1460
1677
  var themes = config.themes;
1678
+
1461
1679
  var Wrapper = function Wrapper(props) {
1462
1680
  var _a, _b;
1681
+
1463
1682
  var dataSources = props.dataSources,
1464
- loading = props.loading,
1465
- options = props.options,
1466
- height = props.height,
1467
- width = props.width;
1683
+ loading = props.loading,
1684
+ options = props.options,
1685
+ height = props.height,
1686
+ width = props.width;
1468
1687
  var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
1469
1688
  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
1689
  var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
1471
1690
  var iconColor = variables_1.default.contentColorActive(props);
1691
+
1472
1692
  if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
1473
1693
  return React.createElement(IconPlaceholder_1.default, {
1474
1694
  "data-test": "icon-placeholder",
@@ -1479,14 +1699,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1479
1699
  iconColor: iconColor
1480
1700
  });
1481
1701
  }
1702
+
1482
1703
  return React.createElement(Visualization, Object.assign({}, props));
1483
1704
  };
1705
+
1484
1706
  (0, hocUtils_1.extendStaticWrapperProps)({
1485
1707
  Wrapper: Wrapper,
1486
1708
  Visualization: Visualization
1487
1709
  });
1488
1710
  return Wrapper;
1489
1711
  };
1712
+
1490
1713
  exports.default = withPlaceholder;
1491
1714
 
1492
1715
  /***/ }),
@@ -1514,11 +1737,13 @@ module.exports = require("@splunk/visualization-icons");
1514
1737
  Object.defineProperty(exports, "__esModule", {
1515
1738
  value: true
1516
1739
  });
1740
+
1517
1741
  var i18n_1 = __webpack_require__(2);
1742
+
1518
1743
  var background = function background(_ref) {
1519
1744
  var label = _ref.label,
1520
- themes = _ref.themes,
1521
- labelPosition = _ref.labelPosition;
1745
+ themes = _ref.themes,
1746
+ labelPosition = _ref.labelPosition;
1522
1747
  return [{
1523
1748
  label: (0, i18n_1._)(label || 'Background'),
1524
1749
  option: 'backgroundColor',
@@ -1529,6 +1754,7 @@ var background = function background(_ref) {
1529
1754
  }
1530
1755
  }];
1531
1756
  };
1757
+
1532
1758
  exports.default = background;
1533
1759
 
1534
1760
  /***/ }),
@@ -1635,17 +1861,25 @@ module.exports = require("@splunk/react-ui/Menu");
1635
1861
 
1636
1862
 
1637
1863
  var _typeof = __webpack_require__(82);
1864
+
1638
1865
  var _slicedToArray = __webpack_require__(17);
1866
+
1639
1867
  var _toConsumableArray = __webpack_require__(8);
1868
+
1640
1869
  var _defineProperty = __webpack_require__(7);
1870
+
1641
1871
  Object.defineProperty(exports, "__esModule", {
1642
1872
  value: true
1643
1873
  });
1644
- exports.truncateString = exports.getCustomTimeInterval = exports.getPredefinedTimeInterval = exports.getEpochTime = exports.generateTokenReplacementMap = exports.replaceTokens = exports.mergeFieldActions = exports.mergeEventActions = exports.getFieldSummaryMapping = exports.convertToPayloadFormat = void 0;
1645
- var time_1 = __webpack_require__(206);
1874
+ 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;
1875
+
1876
+ var time_1 = __webpack_require__(207);
1877
+
1646
1878
  var lodash_1 = __webpack_require__(3);
1647
- var dataUtils_1 = __webpack_require__(121);
1648
- // util to convert a field-value map into an object with row.<fieldname>.value keys for payloads
1879
+
1880
+ var dataUtils_1 = __webpack_require__(121); // util to convert a field-value map into an object with row.<fieldname>.value keys for payloads
1881
+
1882
+
1649
1883
  var convertToPayloadFormat = function convertToPayloadFormat(obj) {
1650
1884
  var initialValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1651
1885
  if (!obj) return {};
@@ -1654,11 +1888,13 @@ var convertToPayloadFormat = function convertToPayloadFormat(obj) {
1654
1888
  return Object.assign(Object.assign({}, acc), _defineProperty({}, key, obj[curr]));
1655
1889
  }, initialValue);
1656
1890
  };
1891
+
1657
1892
  exports.convertToPayloadFormat = convertToPayloadFormat;
1893
+
1658
1894
  var getFieldSummaryMapping = function getFieldSummaryMapping(columns, fields) {
1659
1895
  // convert the `fieldsummary` payload to an array of objects
1660
- var arr = (0, dataUtils_1.convertToArrOfObjects)(columns, fields);
1661
- // forms an array of FieldData elements expected by the @splunk/react-field-summary component
1896
+ var arr = (0, dataUtils_1.convertToArrOfObjects)(columns, fields); // forms an array of FieldData elements expected by the @splunk/react-field-summary component
1897
+
1662
1898
  var fieldSummaryData = arr.map(function (d) {
1663
1899
  return {
1664
1900
  name: d.field,
@@ -1671,13 +1907,14 @@ var getFieldSummaryMapping = function getFieldSummaryMapping(columns, fields) {
1671
1907
  stdev: d.stdev === null ? null : +d.stdev,
1672
1908
  modes: JSON.parse(d.values)
1673
1909
  };
1674
- });
1675
- // creates a map of field name to its data for O(1) retrieval in the tooltip component
1910
+ }); // creates a map of field name to its data for O(1) retrieval in the tooltip component
1911
+
1676
1912
  var fieldSummaryMapping = fieldSummaryData.reduce(function (map, fieldData) {
1677
1913
  return Object.assign(Object.assign({}, map), _defineProperty({}, fieldData.name, fieldData));
1678
1914
  }, {});
1679
1915
  return fieldSummaryMapping;
1680
1916
  };
1917
+
1681
1918
  exports.getFieldSummaryMapping = getFieldSummaryMapping;
1682
1919
  /**
1683
1920
  * Helper to merge event actions into one array of event actions.
@@ -1686,9 +1923,11 @@ exports.getFieldSummaryMapping = getFieldSummaryMapping;
1686
1923
  * @param {EventAction[]} eventActions2
1687
1924
  * @returns {EventAction[]} merged event actions
1688
1925
  */
1926
+
1689
1927
  var mergeEventActions = function mergeEventActions(eventActions1, eventActions2) {
1690
1928
  return eventActions1.concat(eventActions2);
1691
1929
  };
1930
+
1692
1931
  exports.mergeEventActions = mergeEventActions;
1693
1932
  /**
1694
1933
  * Helper to merge field actions. If same key exists in both field actions,
@@ -1703,21 +1942,27 @@ exports.mergeEventActions = mergeEventActions;
1703
1942
  * @param {FieldActions} fieldActions2
1704
1943
  * @returns {FieldActions} merged field actions
1705
1944
  */
1945
+
1706
1946
  var mergeFieldActions = function mergeFieldActions(fieldActions1, fieldActions2) {
1707
1947
  var fieldActions1WithoutDefault = Object.assign({}, fieldActions1);
1948
+
1708
1949
  if ('default' in fieldActions1WithoutDefault) {
1709
1950
  fieldActions1WithoutDefault['*'] = '*' in fieldActions1WithoutDefault ? [].concat(_toConsumableArray(fieldActions1WithoutDefault['*']), _toConsumableArray(fieldActions1WithoutDefault.default)) : fieldActions1WithoutDefault.default;
1710
1951
  delete fieldActions1WithoutDefault.default;
1711
1952
  }
1953
+
1712
1954
  var fieldActions2WithoutDefault = Object.assign({}, fieldActions2);
1955
+
1713
1956
  if ('default' in fieldActions2WithoutDefault) {
1714
1957
  fieldActions2WithoutDefault['*'] = '*' in fieldActions2WithoutDefault ? [].concat(_toConsumableArray(fieldActions2WithoutDefault['*']), _toConsumableArray(fieldActions2WithoutDefault.default)) : fieldActions2WithoutDefault.default;
1715
1958
  delete fieldActions2WithoutDefault.default;
1716
1959
  }
1960
+
1717
1961
  return (0, lodash_1.mergeWith)(fieldActions1WithoutDefault, fieldActions2WithoutDefault, function (fieldAction1value, fieldAction2value) {
1718
1962
  return Array.isArray(fieldAction1value) && Array.isArray(fieldAction2value) ? (0, lodash_1.union)(fieldAction1value, fieldAction2value) : undefined;
1719
1963
  });
1720
1964
  };
1965
+
1721
1966
  exports.mergeFieldActions = mergeFieldActions;
1722
1967
  /**
1723
1968
  * Helper to replace all tokens from the tokenReplacementMap in text with their corresponding values.
@@ -1732,77 +1977,92 @@ exports.mergeFieldActions = mergeFieldActions;
1732
1977
  * @param {boolean} allowFieldValuesEscape
1733
1978
  * @returns {string} text with replaced tokens
1734
1979
  */
1980
+
1735
1981
  var replaceTokens = function replaceTokens(_ref) {
1736
1982
  var text = _ref.text,
1737
- tokenReplacementMap = _ref.tokenReplacementMap,
1738
- allowSpecialParametersEscape = _ref.allowSpecialParametersEscape,
1739
- allowFieldValuesEscape = _ref.allowFieldValuesEscape;
1740
- var replacedText = text;
1741
- // replace special parameters
1983
+ tokenReplacementMap = _ref.tokenReplacementMap,
1984
+ allowSpecialParametersEscape = _ref.allowSpecialParametersEscape,
1985
+ allowFieldValuesEscape = _ref.allowFieldValuesEscape;
1986
+ var replacedText = text; // replace special parameters
1987
+
1742
1988
  Object.entries(tokenReplacementMap.specialParameters).forEach(function (_ref2) {
1743
1989
  var _ref3 = _slicedToArray(_ref2, 2),
1744
- tokenName = _ref3[0],
1745
- tokenValue = _ref3[1];
1990
+ tokenName = _ref3[0],
1991
+ tokenValue = _ref3[1];
1992
+
1746
1993
  var maybeEscapedTokenValue = allowSpecialParametersEscape ? encodeURIComponent(tokenValue) : tokenValue;
1747
1994
  replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue);
1748
- });
1749
- // replace field values
1995
+ }); // replace field values
1996
+
1750
1997
  Object.entries(tokenReplacementMap.fields).forEach(function (_ref4) {
1751
1998
  var _ref5 = _slicedToArray(_ref4, 2),
1752
- tokenName = _ref5[0],
1753
- tokenValue = _ref5[1];
1999
+ tokenName = _ref5[0],
2000
+ tokenValue = _ref5[1];
2001
+
1754
2002
  // when allowFieldValuesEscape is true, replace field with escaped value
1755
2003
  var maybeEscapedTokenValue = allowFieldValuesEscape ? encodeURIComponent(tokenValue) : tokenValue;
1756
- replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue);
1757
- // If field starts with `!`, always replace with the unescaped value
2004
+ replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue); // If field starts with `!`, always replace with the unescaped value
2005
+
1758
2006
  replacedText = replacedText.split("$!".concat(tokenName, "$")).join(tokenValue);
1759
2007
  });
1760
2008
  return replacedText;
1761
2009
  };
2010
+
1762
2011
  exports.replaceTokens = replaceTokens;
1763
2012
  /**
1764
2013
  * Generate a token replacement map taking into account Special Parameters and field replacements.
1765
2014
  */
2015
+
1766
2016
  var generateTokenReplacementMap = function generateTokenReplacementMap(_ref6) {
1767
2017
  var dataSources = _ref6.dataSources,
1768
- rowIndex = _ref6.rowIndex,
1769
- pageNumber = _ref6.pageNumber,
1770
- field = _ref6.field,
1771
- value = _ref6.value,
1772
- _ref6$event = _ref6.event,
1773
- event = _ref6$event === void 0 ? {} : _ref6$event;
2018
+ rowIndex = _ref6.rowIndex,
2019
+ pageNumber = _ref6.pageNumber,
2020
+ field = _ref6.field,
2021
+ value = _ref6.value,
2022
+ _ref6$event = _ref6.event,
2023
+ event = _ref6$event === void 0 ? {} : _ref6$event;
2024
+
1774
2025
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2026
+
1775
2027
  var tokenReplacementMap = {
1776
2028
  specialParameters: {},
1777
2029
  fields: {}
1778
- };
1779
- // Map special parameters for workflow actions with values
2030
+ }; // Map special parameters for workflow actions with values
1780
2031
  // Note that @latest_time will not be supported since it does not work in sxml
1781
2032
  // https://dev.splunk.com/enterprise/docs/devtools/customworkflowactions/#Special-parameters
2033
+
1782
2034
  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
2035
  var offset = rowIndex !== undefined && pageNumber !== undefined && count !== undefined ? rowIndex + count * (pageNumber - 1) : undefined;
2036
+
1784
2037
  if (offset !== undefined) {
1785
2038
  tokenReplacementMap.specialParameters['@offset'] = String(offset);
1786
2039
  }
2040
+
1787
2041
  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
2042
  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
2043
  }
2044
+
1790
2045
  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
2046
  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
2047
  }
2048
+
1793
2049
  if (field) {
1794
2050
  tokenReplacementMap.specialParameters['@field_name'] = field;
1795
2051
  }
2052
+
1796
2053
  if (value) {
1797
2054
  tokenReplacementMap.specialParameters['@field_value'] = value;
1798
- }
1799
- // Map fields with field values
2055
+ } // Map fields with field values
2056
+
2057
+
1800
2058
  Object.entries(event).forEach(function (_ref7) {
1801
2059
  var _ref8 = _slicedToArray(_ref7, 2),
1802
- fieldName = _ref8[0],
1803
- fieldValue = _ref8[1];
2060
+ fieldName = _ref8[0],
2061
+ fieldValue = _ref8[1];
2062
+
1804
2063
  // handling of _raw and _time fields matches SXML behaviour. Implementation is based on fieldSubstitute() from splunkcore-web-ui
1805
2064
  var replacedValue;
2065
+
1806
2066
  if (fieldName === '_time' && typeof fieldValue === 'string') {
1807
2067
  var splunkTime = (0, time_1.getISOWithTimeZone)(fieldValue);
1808
2068
  var epochTime = (0, exports.getEpochTime)(splunkTime);
@@ -1813,21 +2073,25 @@ var generateTokenReplacementMap = function generateTokenReplacementMap(_ref6) {
1813
2073
  } else {
1814
2074
  replacedValue = typeof fieldValue === 'string' ? fieldValue : JSON.stringify(fieldValue);
1815
2075
  }
2076
+
1816
2077
  tokenReplacementMap.fields["".concat(fieldName)] = replacedValue;
1817
2078
  });
1818
2079
  return tokenReplacementMap;
1819
2080
  };
1820
- exports.generateTokenReplacementMap = generateTokenReplacementMap;
1821
- // return epoch unix timestamp in seconds
2081
+
2082
+ exports.generateTokenReplacementMap = generateTokenReplacementMap; // return epoch unix timestamp in seconds
2083
+
1822
2084
  var getEpochTime = function getEpochTime(time) {
1823
2085
  // if not a valid time string, then indicate an error and return NaN.
1824
2086
  if (!(0, time_1.isISO)(time)) {
1825
2087
  console.error("'".concat(time, "' is not a valid time string."));
1826
2088
  return NaN;
1827
- }
1828
- // retrieves the epoch time in milliseconds, and divides by 1000
2089
+ } // retrieves the epoch time in milliseconds, and divides by 1000
2090
+
2091
+
1829
2092
  return new Date(time).getTime() / 1000;
1830
2093
  };
2094
+
1831
2095
  exports.getEpochTime = getEpochTime;
1832
2096
  /**
1833
2097
  * Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks a predefined control in the Time Controls Popover
@@ -1840,25 +2104,30 @@ exports.getEpochTime = getEpochTime;
1840
2104
  * @param {('before'|'after'|'at')} when
1841
2105
  * @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time
1842
2106
  */
2107
+
1843
2108
  var getPredefinedTimeInterval = function getPredefinedTimeInterval(_ref9) {
1844
2109
  var time = _ref9.time,
1845
- when = _ref9.when;
2110
+ when = _ref9.when;
1846
2111
  var epochTime = (0, exports.getEpochTime)(time);
2112
+
1847
2113
  switch (when) {
1848
2114
  case 'before':
1849
2115
  return {
1850
2116
  latest: epochTime + 0.001
1851
2117
  };
2118
+
1852
2119
  case 'after':
1853
2120
  return {
1854
2121
  earliest: epochTime,
1855
2122
  latest: 'now'
1856
2123
  };
2124
+
1857
2125
  case 'at':
1858
2126
  return {
1859
2127
  earliest: epochTime,
1860
2128
  latest: epochTime + 0.001
1861
2129
  };
2130
+
1862
2131
  default:
1863
2132
  // returns 'at' interval by default
1864
2133
  return {
@@ -1867,6 +2136,7 @@ var getPredefinedTimeInterval = function getPredefinedTimeInterval(_ref9) {
1867
2136
  };
1868
2137
  }
1869
2138
  };
2139
+
1870
2140
  exports.getPredefinedTimeInterval = getPredefinedTimeInterval;
1871
2141
  /**
1872
2142
  * Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks `Apply` in the Time Controls Popover.
@@ -1881,13 +2151,15 @@ exports.getPredefinedTimeInterval = getPredefinedTimeInterval;
1881
2151
  * @param {string} rangeUnit
1882
2152
  * @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time
1883
2153
  */
2154
+
1884
2155
  var getCustomTimeInterval = function getCustomTimeInterval(_ref10) {
1885
2156
  var time = _ref10.time,
1886
- rangeType = _ref10.rangeType,
1887
- rangeAmount = _ref10.rangeAmount,
1888
- rangeUnit = _ref10.rangeUnit;
2157
+ rangeType = _ref10.rangeType,
2158
+ rangeAmount = _ref10.rangeAmount,
2159
+ rangeUnit = _ref10.rangeUnit;
1889
2160
  var timeRange = (0, time_1.getAcceleratedTimeRange)(time, rangeAmount, rangeUnit);
1890
2161
  var timeInterval;
2162
+
1891
2163
  if (rangeType === 'plusminus') {
1892
2164
  timeInterval = Object.assign({}, timeRange);
1893
2165
  } else if (rangeType === 'plus') {
@@ -1898,13 +2170,15 @@ var getCustomTimeInterval = function getCustomTimeInterval(_ref10) {
1898
2170
  timeInterval = Object.assign(Object.assign({}, timeRange), {
1899
2171
  latest: time
1900
2172
  });
1901
- }
1902
- // converts to use epoch time in the interval, and adds 0.001 to `latest` per spec
2173
+ } // converts to use epoch time in the interval, and adds 0.001 to `latest` per spec
2174
+
2175
+
1903
2176
  return {
1904
2177
  earliest: (0, exports.getEpochTime)(timeInterval.earliest),
1905
2178
  latest: (0, exports.getEpochTime)(timeInterval.latest) + 0.001
1906
2179
  };
1907
2180
  };
2181
+
1908
2182
  exports.getCustomTimeInterval = getCustomTimeInterval;
1909
2183
  /**
1910
2184
  * Helper to truncate strings to a maximum length.
@@ -1913,17 +2187,51 @@ exports.getCustomTimeInterval = getCustomTimeInterval;
1913
2187
  * @param {string} stringToTruncate
1914
2188
  * @returns {string} truncated string
1915
2189
  */
2190
+
1916
2191
  var truncateString = function truncateString(stringToTruncate) {
1917
2192
  var MAX_LENGTH = 100;
1918
2193
  var LEAD_AND_TRAIL_LENGTH = 50;
1919
2194
  var truncatedString = stringToTruncate;
2195
+
1920
2196
  if (truncatedString.length > MAX_LENGTH) {
1921
2197
  truncatedString = "".concat(truncatedString.substring(0, LEAD_AND_TRAIL_LENGTH), "...").concat(truncatedString.substring(truncatedString.length - LEAD_AND_TRAIL_LENGTH));
1922
2198
  }
2199
+
1923
2200
  return truncatedString;
1924
2201
  };
2202
+
1925
2203
  exports.truncateString = truncateString;
1926
2204
 
2205
+ var convertToHighlightValuesByFieldMap = function convertToHighlightValuesByFieldMap(highlighted) {
2206
+ var highlightConfig = {};
2207
+ Object.keys(highlighted).forEach(function (field) {
2208
+ // convert from {field: {value1: true, value2: false}} to {field: [value1]}
2209
+ // this way we can pass it to the Eventsviewer with the highlightValuesByField option.
2210
+ var valuesToHighlight = Object.keys(highlighted[field]).filter(function (value) {
2211
+ return highlighted[field][value];
2212
+ });
2213
+ if (valuesToHighlight.length > 0) highlightConfig[field] = valuesToHighlight;
2214
+ });
2215
+ return highlightConfig;
2216
+ };
2217
+
2218
+ exports.convertToHighlightValuesByFieldMap = convertToHighlightValuesByFieldMap;
2219
+
2220
+ var combineHighlighted = function combineHighlighted(highlightedSource, highlightValuesByField) {
2221
+ var highlightMap = (0, exports.convertToHighlightValuesByFieldMap)(highlightedSource); // deep merge with the highlight obj passed from viz options
2222
+
2223
+ Object.keys(highlightValuesByField).forEach(function (field) {
2224
+ var value = highlightValuesByField[field];
2225
+ var valueArray = typeof value === 'string' ? [value] : value; // merge arrays and dedup
2226
+
2227
+ var combinedValue = highlightMap[field] ? _toConsumableArray(new Set([].concat(_toConsumableArray(highlightMap[field]), _toConsumableArray(valueArray)))) : valueArray;
2228
+ highlightMap[field] = combinedValue;
2229
+ });
2230
+ return highlightMap;
2231
+ };
2232
+
2233
+ exports.combineHighlighted = combineHighlighted;
2234
+
1927
2235
  /***/ }),
1928
2236
  /* 121 */
1929
2237
  /***/ (function(module, exports, __webpack_require__) {
@@ -1934,15 +2242,17 @@ exports.truncateString = truncateString;
1934
2242
  Object.defineProperty(exports, "__esModule", {
1935
2243
  value: true
1936
2244
  });
1937
- exports.convertToArrOfObjects = void 0;
1938
- // TODO: utilize this fn in ParallelCoordinates
2245
+ exports.convertToArrOfObjects = void 0; // TODO: utilize this fn in ParallelCoordinates
2246
+
1939
2247
  var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
1940
2248
  if (!columns || !columns[0] || !columns[0].length) return [];
1941
2249
  var data = [];
2250
+
1942
2251
  var _loop = function _loop(i) {
1943
2252
  var newObj = {};
1944
2253
  fields.forEach(function (field, index) {
1945
2254
  var fieldName = typeof field === 'string' ? field : field.name;
2255
+
1946
2256
  if (columns[index][i] === '') {
1947
2257
  newObj[fieldName] = null;
1948
2258
  } else {
@@ -1951,11 +2261,14 @@ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
1951
2261
  });
1952
2262
  data.push(newObj);
1953
2263
  };
2264
+
1954
2265
  for (var i = 0; i < columns[0].length; i += 1) {
1955
2266
  _loop(i);
1956
2267
  }
2268
+
1957
2269
  return data;
1958
2270
  };
2271
+
1959
2272
  exports.convertToArrOfObjects = convertToArrOfObjects;
1960
2273
 
1961
2274
  /***/ }),
@@ -2015,27 +2328,40 @@ module.exports = require("@splunk/react-ui/Heading");
2015
2328
 
2016
2329
  var __rest = this && this.__rest || function (s, e) {
2017
2330
  var t = {};
2331
+
2018
2332
  for (var p in s) {
2019
2333
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2020
2334
  }
2335
+
2021
2336
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2022
2337
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2023
2338
  }
2024
2339
  return t;
2025
2340
  };
2341
+
2026
2342
  Object.defineProperty(exports, "__esModule", {
2027
2343
  value: true
2028
2344
  });
2029
2345
  exports.replaceTokens = exports.PureEvents = exports.config = exports.themes = exports.computeVizProps = exports.showPlaceHolderIcon = void 0;
2346
+
2030
2347
  var lodash_1 = __webpack_require__(3);
2348
+
2031
2349
  var dataSourceUtils_1 = __webpack_require__(97);
2032
- var withDashboardViz_1 = __webpack_require__(36);
2350
+
2351
+ var withDashboardViz_1 = __webpack_require__(37);
2352
+
2033
2353
  var constants_1 = __webpack_require__(151);
2034
- var config_1 = __webpack_require__(203);
2354
+
2355
+ var config_1 = __webpack_require__(204);
2356
+
2035
2357
  exports.config = config_1.default;
2036
- var PureEvents_1 = __webpack_require__(204);
2358
+
2359
+ var PureEvents_1 = __webpack_require__(205);
2360
+
2037
2361
  exports.PureEvents = PureEvents_1.default;
2362
+
2038
2363
  var EventUtils_1 = __webpack_require__(120);
2364
+
2039
2365
  Object.defineProperty(exports, "replaceTokens", {
2040
2366
  enumerable: true,
2041
2367
  get: function get() {
@@ -2047,23 +2373,29 @@ Object.defineProperty(exports, "replaceTokens", {
2047
2373
  * @param {Object} dataSources
2048
2374
  * @returns {Boolean} return true if loading, error, non existent state or without columns in dataSources
2049
2375
  */
2376
+
2050
2377
  var showPlaceHolderIcon = function showPlaceHolderIcon(dataSources) {
2051
2378
  var columns = (0, lodash_1.get)(dataSources, 'primary.data.columns', undefined);
2052
2379
  var noColumns = columns === undefined;
2053
2380
  var dataSourceState = (0, dataSourceUtils_1.getDataSourceStateInfo)(dataSources);
2054
2381
  return dataSourceState === dataSourceUtils_1.DataSourceState.ERROR || dataSourceState === dataSourceUtils_1.DataSourceState.LOADING || dataSourceState === dataSourceUtils_1.DataSourceState.NONEXISTENT || noColumns;
2055
2382
  };
2383
+
2056
2384
  exports.showPlaceHolderIcon = showPlaceHolderIcon;
2385
+
2057
2386
  var computeVizProps = function computeVizProps(_a) {
2058
2387
  // for specific changes to view type (List -> Raw, etc.), can create handling function here that calls onOptionsChange
2059
2388
  var _b;
2060
- var props = __rest(_a, []);
2061
- // defaults to an empty datasource if one isn't provided, which shows the No Results Found UI:
2389
+
2390
+ var props = __rest(_a, []); // defaults to an empty datasource if one isn't provided, which shows the No Results Found UI:
2391
+
2392
+
2062
2393
  var dataSources = (_b = props === null || props === void 0 ? void 0 : props.dataSources) !== null && _b !== void 0 ? _b : constants_1.EMPTY_DATASOURCE;
2063
2394
  return Object.assign(Object.assign({}, props), {
2064
2395
  dataSources: dataSources
2065
2396
  });
2066
2397
  };
2398
+
2067
2399
  exports.computeVizProps = computeVizProps;
2068
2400
  var Events = (0, withDashboardViz_1.default)({
2069
2401
  ReactViz: PureEvents_1.default,
@@ -2091,8 +2423,8 @@ __webpack_require__.r(__webpack_exports__);
2091
2423
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY_DATASOURCE", function() { return EMPTY_DATASOURCE; });
2092
2424
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELDSUMMARY_DS_STORYBOOK", function() { return FIELDSUMMARY_DS_STORYBOOK; });
2093
2425
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELDSUMMARY_DS_DOC_HUB", function() { return FIELDSUMMARY_DS_DOC_HUB; });
2094
- /* harmony import */ var _splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(169);
2095
- /* harmony import */ var _splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0__);
2426
+ /* harmony import */ var _splunk_datasource_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(170);
2427
+ /* harmony import */ var _splunk_datasource_utils__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_datasource_utils__WEBPACK_IMPORTED_MODULE_0__);
2096
2428
  // TODO: convert this file to .ts - created as .js as copied from SUI EventsViewer repo
2097
2429
 
2098
2430
  var rawEventPayload = {
@@ -2480,20 +2812,17 @@ var rawEventPayload = {
2480
2812
  }
2481
2813
  }
2482
2814
  };
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";
2815
+ 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
2816
 
2485
- // Datasource utilized in example on @splunk/react-events-viewer docs
2486
- var originalDataSourceData = _splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0___default.a.fromJSONArray(rawEventPayload.fields, rawEventPayload.results);
2817
+ 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
2818
 
2488
- // Replaces _raw object with the value of the `value` key - this is the string expected in Dashboard Studio payload
2489
2819
  originalDataSourceData.columns[5] = originalDataSourceData.columns[5].map(function (_raw) {
2490
2820
  return _raw.value;
2491
- });
2492
-
2493
- // Exports payload with expected shape of Dashboard Studio payload - fields as an array of strings, and columns
2821
+ }); // Exports payload with expected shape of Dashboard Studio payload - fields as an array of strings, and columns
2494
2822
  // as arrays of data primitives like strings and numbers
2495
2823
  // Component works with either [{ name: `field` }, ...] or [`field`,...] format - leaving as array as objects as
2496
2824
  // expected in Dashboard Studio payload
2825
+
2497
2826
  var dataSourceData = {
2498
2827
  fields: rawEventPayload.fields,
2499
2828
  columns: originalDataSourceData.columns
@@ -2597,13 +2926,13 @@ module.exports = require("@splunk/visualization-context/EventsContext");
2597
2926
  /* 166 */,
2598
2927
  /* 167 */,
2599
2928
  /* 168 */,
2600
- /* 169 */
2929
+ /* 169 */,
2930
+ /* 170 */
2601
2931
  /***/ (function(module, exports) {
2602
2932
 
2603
- module.exports = require("@splunk/datasource-utils/DataSet");
2933
+ module.exports = require("@splunk/datasource-utils");
2604
2934
 
2605
2935
  /***/ }),
2606
- /* 170 */,
2607
2936
  /* 171 */,
2608
2937
  /* 172 */,
2609
2938
  /* 173 */,
@@ -2635,7 +2964,8 @@ module.exports = require("@splunk/datasource-utils/DataSet");
2635
2964
  /* 199 */,
2636
2965
  /* 200 */,
2637
2966
  /* 201 */,
2638
- /* 202 */
2967
+ /* 202 */,
2968
+ /* 203 */
2639
2969
  /***/ (function(module, exports, __webpack_require__) {
2640
2970
 
2641
2971
  "use strict";
@@ -2644,6 +2974,7 @@ module.exports = require("@splunk/datasource-utils/DataSet");
2644
2974
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
2645
2975
  if (k2 === undefined) k2 = k;
2646
2976
  var desc = Object.getOwnPropertyDescriptor(m, k);
2977
+
2647
2978
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2648
2979
  desc = {
2649
2980
  enumerable: true,
@@ -2652,22 +2983,28 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
2652
2983
  }
2653
2984
  };
2654
2985
  }
2986
+
2655
2987
  Object.defineProperty(o, k2, desc);
2656
2988
  } : function (o, m, k, k2) {
2657
2989
  if (k2 === undefined) k2 = k;
2658
2990
  o[k2] = m[k];
2659
2991
  });
2992
+
2660
2993
  var __exportStar = this && this.__exportStar || function (m, exports) {
2661
2994
  for (var p in m) {
2662
2995
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2663
2996
  }
2664
2997
  };
2998
+
2665
2999
  Object.defineProperty(exports, "__esModule", {
2666
3000
  value: true
2667
3001
  });
2668
3002
  exports.default = void 0;
3003
+
2669
3004
  __exportStar(__webpack_require__(150), exports);
3005
+
2670
3006
  var Events_1 = __webpack_require__(150);
3007
+
2671
3008
  Object.defineProperty(exports, "default", {
2672
3009
  enumerable: true,
2673
3010
  get: function get() {
@@ -2676,7 +3013,7 @@ Object.defineProperty(exports, "default", {
2676
3013
  });
2677
3014
 
2678
3015
  /***/ }),
2679
- /* 203 */
3016
+ /* 204 */
2680
3017
  /***/ (function(module, exports, __webpack_require__) {
2681
3018
 
2682
3019
  "use strict";
@@ -2685,15 +3022,27 @@ Object.defineProperty(exports, "default", {
2685
3022
  Object.defineProperty(exports, "__esModule", {
2686
3023
  value: true
2687
3024
  });
3025
+
2688
3026
  var visualization_icons_1 = __webpack_require__(52);
3027
+
2689
3028
  var placeholders_1 = __webpack_require__(50);
3029
+
2690
3030
  var schemaUtils_1 = __webpack_require__(16);
3031
+
2691
3032
  var themes_1 = __webpack_require__(60);
3033
+
2692
3034
  var i18n_1 = __webpack_require__(2);
3035
+
3036
+ var DataSource_1 = __webpack_require__(34);
3037
+
2693
3038
  var VizBehavior_1 = __webpack_require__(6);
2694
- var VizCategory_1 = __webpack_require__(35);
3039
+
3040
+ var VizCategory_1 = __webpack_require__(36);
3041
+
2695
3042
  var configUtils_1 = __webpack_require__(20);
3043
+
2696
3044
  var BackgroundColor_1 = __webpack_require__(53);
3045
+
2697
3046
  var defaultContext = {};
2698
3047
  var dataContract = {
2699
3048
  requiredDataSources: [{
@@ -2707,10 +3056,16 @@ var dataContract = {
2707
3056
  initialRequestParams: {
2708
3057
  primary: function primary() {
2709
3058
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3059
+
3060
+ var _a;
3061
+
2710
3062
  return {
2711
3063
  offset: 0,
2712
3064
  count: options.count ? options.count : 10,
2713
- requestTotalCount: true
3065
+ requestTotalCount: true,
3066
+ // this is needed for search-based event highlighting
3067
+ output_mode: 'json',
3068
+ segmentation: (_a = options.highlightFromSource) !== null && _a !== void 0 ? _a : 'none'
2714
3069
  };
2715
3070
  }
2716
3071
  }
@@ -2820,9 +3175,15 @@ var optionsSchema = {
2820
3175
  default: []
2821
3176
  },
2822
3177
  highlightValuesByField: {
2823
- description: 'Specify the field-value pairs to highlight. For example, `{"source": "$srcToken$", "dest": "12.21.1.11", "tag": ["tag1", "tag2"]}`',
3178
+ description: 'Specify the field and value pairs for manual highlighting. For example, `{"source": "$srcToken$", "dest": "12.21.1.11", "tag": ["tag1", "tag2"]}`.',
2824
3179
  type: 'object'
2825
3180
  },
3181
+ highlightFromSource: {
3182
+ 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.',
3183
+ type: 'string',
3184
+ pattern: (0, schemaUtils_1.getPattern)(DataSource_1.validSegmentationModes),
3185
+ default: 'none'
3186
+ },
2826
3187
  showFieldSummary: {
2827
3188
  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
3189
  type: 'boolean',
@@ -2859,17 +3220,20 @@ var editorConfig = [{
2859
3220
  /**
2860
3221
  * visualization configuration
2861
3222
  */
3223
+
2862
3224
  var config = {
2863
3225
  /**
2864
3226
  * unique viz key
2865
3227
  */
2866
3228
  key: 'splunk.events',
3229
+
2867
3230
  /**
2868
3231
  * viz name
2869
3232
  */
2870
3233
  name: (0, i18n_1._)('Events'),
2871
3234
  category: VizCategory_1.VizCategory.TABLE,
2872
3235
  status: 'preview',
3236
+
2873
3237
  /**
2874
3238
  * viz icon
2875
3239
  */
@@ -2904,35 +3268,55 @@ var config = {
2904
3268
  exports.default = (0, configUtils_1.enhanceConfig)(config);
2905
3269
 
2906
3270
  /***/ }),
2907
- /* 204 */
3271
+ /* 205 */
2908
3272
  /***/ (function(module, exports, __webpack_require__) {
2909
3273
 
2910
3274
  "use strict";
2911
3275
 
2912
3276
 
2913
3277
  var _typeof = __webpack_require__(82);
3278
+
2914
3279
  var _slicedToArray = __webpack_require__(17);
3280
+
2915
3281
  Object.defineProperty(exports, "__esModule", {
2916
3282
  value: true
2917
3283
  });
3284
+
2918
3285
  var React = __webpack_require__(1);
3286
+
2919
3287
  var react_1 = __webpack_require__(1);
3288
+
2920
3289
  var T = __webpack_require__(0);
2921
- var EventsViewer_1 = __webpack_require__(205);
3290
+
3291
+ var EventsViewer_1 = __webpack_require__(206);
3292
+
2922
3293
  var styled_components_1 = __webpack_require__(4);
3294
+
2923
3295
  var pick_1 = __webpack_require__(23);
3296
+
2924
3297
  var variables_1 = __webpack_require__(11);
3298
+
2925
3299
  var colorUtils_1 = __webpack_require__(12);
3300
+
2926
3301
  var style_1 = __webpack_require__(14);
3302
+
2927
3303
  var EventsContext_1 = __webpack_require__(152);
3304
+
2928
3305
  var lodash_1 = __webpack_require__(3);
3306
+
2929
3307
  var Menu_1 = __webpack_require__(119);
3308
+
2930
3309
  var constants_1 = __webpack_require__(151);
3310
+
2931
3311
  var FixedSizeContainer_1 = __webpack_require__(13);
3312
+
2932
3313
  var EventUtils_1 = __webpack_require__(120);
2933
- var FieldSummaryTooltip_1 = __webpack_require__(207);
2934
- var TimeControlsPopover_1 = __webpack_require__(209);
2935
- // Inspired by VizTableContainer in PureTable.tsx
3314
+
3315
+ var FieldSummaryTooltip_1 = __webpack_require__(208);
3316
+
3317
+ var TimeControlsPopover_1 = __webpack_require__(210); // Inspired by VizTableContainer in PureTable.tsx
3318
+
3319
+
2936
3320
  var EventsContainer = styled_components_1.default.div.withConfig({
2937
3321
  displayName: "PureEvents__EventsContainer",
2938
3322
  componentId: "iniqvm-0"
@@ -2948,15 +3332,15 @@ var EventsContainer = styled_components_1.default.div.withConfig({
2948
3332
  }, (0, pick_1.default)({
2949
3333
  enterprise: variables_1.default.backgroundColorPage,
2950
3334
  prisma: variables_1.default.backgroundColorPage
2951
- }));
2952
- // Inspired by SUITableContainer in PureTable.tsx
3335
+ })); // Inspired by SUITableContainer in PureTable.tsx
3336
+
2953
3337
  var SUIEventsViewerContainer = styled_components_1.default.div.withConfig({
2954
3338
  displayName: "PureEvents__SUIEventsViewerContainer",
2955
3339
  componentId: "iniqvm-1"
2956
3340
  })(["box-sizing:border-box;flex-grow:1;overflow:hidden;", ";"], function (_ref) {
2957
3341
  var width = _ref.width,
2958
- height = _ref.height,
2959
- theme = _ref.theme;
3342
+ height = _ref.height,
3343
+ theme = _ref.theme;
2960
3344
  var padding = (0, pick_1.default)({
2961
3345
  enterprise: variables_1.default.spacingHalf({
2962
3346
  theme: theme
@@ -2972,30 +3356,40 @@ var SUIEventsViewerContainer = styled_components_1.default.div.withConfig({
2972
3356
  width: width - paddingOffset,
2973
3357
  height: height - paddingOffset
2974
3358
  });
2975
- });
2976
- // Effectively the pure visualization component for Events, passing through the necessary state and callbacks.
3359
+ }); // Effectively the pure visualization component for Events, passing through the necessary state and callbacks.
3360
+
2977
3361
  var PureEvents = function PureEvents(props) {
2978
3362
  var width = props.width,
2979
- height = props.height,
2980
- backgroundColor = props.backgroundColor,
2981
- _props$dataSources = props.dataSources,
2982
- dataSources = _props$dataSources === void 0 ? {} : _props$dataSources,
2983
- _props$eventActions = props.eventActions,
2984
- eventActionsProps = _props$eventActions === void 0 ? [] : _props$eventActions,
2985
- _props$fieldActions = props.fieldActions,
2986
- fieldActionsProps = _props$fieldActions === void 0 ? {} : _props$fieldActions,
2987
- showFieldSummary = props.showFieldSummary,
2988
- footerFields = props.footerFields,
2989
- highlightValuesByField = props.highlightValuesByField,
2990
- onOptionsChange = props.onOptionsChange,
2991
- onRequestParamsChange = props.onRequestParamsChange,
2992
- onEventTrigger = props.onEventTrigger;
3363
+ height = props.height,
3364
+ backgroundColor = props.backgroundColor,
3365
+ _props$dataSources = props.dataSources,
3366
+ dataSources = _props$dataSources === void 0 ? {} : _props$dataSources,
3367
+ _props$eventActions = props.eventActions,
3368
+ eventActionsProps = _props$eventActions === void 0 ? [] : _props$eventActions,
3369
+ _props$fieldActions = props.fieldActions,
3370
+ fieldActionsProps = _props$fieldActions === void 0 ? {} : _props$fieldActions,
3371
+ showFieldSummary = props.showFieldSummary,
3372
+ footerFields = props.footerFields,
3373
+ highlightValuesByField = props.highlightValuesByField,
3374
+ onOptionsChange = props.onOptionsChange,
3375
+ onRequestParamsChange = props.onRequestParamsChange,
3376
+ onEventTrigger = props.onEventTrigger;
3377
+ var highlightValuesByFieldCombined = React.useMemo(function () {
3378
+ var _a, _b, _c; // get highlighted values from datasource
3379
+ // remove type casting by adding highlighted and tags to DataSourceMeta in dashboard-types package
3380
+
3381
+
3382
+ 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 : {};
3383
+ return (0, EventUtils_1.combineHighlighted)(highlightedSource, highlightValuesByField);
3384
+ }, [dataSources, highlightValuesByField]);
2993
3385
  var fieldSummaryMap = React.useMemo(function () {
2994
- var _a, _b, _c, _d;
2995
- // if the `fieldsummary` datasource isn't configured, no field summary can be shown
3386
+ var _a, _b, _c, _d; // if the `fieldsummary` datasource isn't configured, no field summary can be shown
3387
+
3388
+
2996
3389
  if (!showFieldSummary || !(0, lodash_1.get)(dataSources, 'fieldsummary')) {
2997
3390
  return {};
2998
3391
  }
3392
+
2999
3393
  try {
3000
3394
  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
3395
  return fieldSummaryMapping;
@@ -3004,39 +3398,48 @@ var PureEvents = function PureEvents(props) {
3004
3398
  return {};
3005
3399
  }
3006
3400
  }, [dataSources, showFieldSummary]);
3401
+
3007
3402
  var _ref2 = (0, react_1.useContext)(EventsContext_1.default),
3008
- _ref2$eventActions = _ref2.eventActions,
3009
- eventActionsContext = _ref2$eventActions === void 0 ? [] : _ref2$eventActions,
3010
- _ref2$fieldActions = _ref2.fieldActions,
3011
- fieldActionsContext = _ref2$fieldActions === void 0 ? {} : _ref2$fieldActions;
3403
+ _ref2$eventActions = _ref2.eventActions,
3404
+ eventActionsContext = _ref2$eventActions === void 0 ? [] : _ref2$eventActions,
3405
+ _ref2$fieldActions = _ref2.fieldActions,
3406
+ fieldActionsContext = _ref2$fieldActions === void 0 ? {} : _ref2$fieldActions;
3407
+
3012
3408
  var eventActions = (0, EventUtils_1.mergeEventActions)(eventActionsProps, eventActionsContext);
3013
3409
  var fieldActions = (0, EventUtils_1.mergeFieldActions)(fieldActionsProps, fieldActionsContext);
3410
+
3014
3411
  var _React$useState = React.useState(null),
3015
- _React$useState2 = _slicedToArray(_React$useState, 2),
3016
- fieldSummaryField = _React$useState2[0],
3017
- setFieldSummaryField = _React$useState2[1];
3412
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3413
+ fieldSummaryField = _React$useState2[0],
3414
+ setFieldSummaryField = _React$useState2[1];
3415
+
3018
3416
  var _React$useState3 = React.useState(null),
3019
- _React$useState4 = _slicedToArray(_React$useState3, 2),
3020
- fieldSummaryAnchor = _React$useState4[0],
3021
- setFieldSummaryAnchor = _React$useState4[1];
3417
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
3418
+ fieldSummaryAnchor = _React$useState4[0],
3419
+ setFieldSummaryAnchor = _React$useState4[1];
3420
+
3022
3421
  var _React$useState5 = React.useState(null),
3023
- _React$useState6 = _slicedToArray(_React$useState5, 2),
3024
- timeValue = _React$useState6[0],
3025
- setTimeValue = _React$useState6[1];
3422
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
3423
+ timeValue = _React$useState6[0],
3424
+ setTimeValue = _React$useState6[1];
3425
+
3026
3426
  var _React$useState7 = React.useState(null),
3027
- _React$useState8 = _slicedToArray(_React$useState7, 2),
3028
- timeFieldAnchor = _React$useState8[0],
3029
- setTimeFieldAnchor = _React$useState8[1]; // An array of objects with eventtypeValues for filtering by eventtype, fieldFilters for filtering by fields,
3427
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
3428
+ timeFieldAnchor = _React$useState8[0],
3429
+ setTimeFieldAnchor = _React$useState8[1]; // An array of objects with eventtypeValues for filtering by eventtype, fieldFilters for filtering by fields,
3030
3430
  // and eventActionComponent (needs to be Menu.Item and will be rendered inside a Menu component)
3031
3431
  // to display in the Event Actions dropdown
3432
+
3433
+
3032
3434
  var renderEventActions = React.useMemo(function () {
3033
3435
  return !Array.isArray(eventActions) ? [] : eventActions.map(function (_ref3) {
3034
3436
  var eventType = _ref3.eventType,
3035
- label = _ref3.label,
3036
- _ref3$eventtypeValues = _ref3.eventtypeValues,
3037
- eventtypeValues = _ref3$eventtypeValues === void 0 ? [] : _ref3$eventtypeValues,
3038
- _ref3$fieldFilters = _ref3.fieldFilters,
3039
- fieldFilters = _ref3$fieldFilters === void 0 ? [] : _ref3$fieldFilters;
3437
+ label = _ref3.label,
3438
+ _ref3$eventtypeValues = _ref3.eventtypeValues,
3439
+ eventtypeValues = _ref3$eventtypeValues === void 0 ? [] : _ref3$eventtypeValues,
3440
+ _ref3$fieldFilters = _ref3.fieldFilters,
3441
+ fieldFilters = _ref3$fieldFilters === void 0 ? [] : _ref3$fieldFilters;
3442
+
3040
3443
  var onMenuItemClick = function onMenuItemClick(e, eventActionProps, tokenReplacementMap) {
3041
3444
  var payload = (0, EventUtils_1.convertToPayloadFormat)(eventActionProps.event, {
3042
3445
  tokenReplacementMap: tokenReplacementMap
@@ -3047,10 +3450,11 @@ var PureEvents = function PureEvents(props) {
3047
3450
  payload: payload
3048
3451
  });
3049
3452
  };
3453
+
3050
3454
  var eventActionComponent = function eventActionComponent(eventActionProps) {
3051
3455
  var rowIndex = eventActionProps.rowIndex,
3052
- pageNumber = eventActionProps.pageNumber,
3053
- event = eventActionProps.event;
3456
+ pageNumber = eventActionProps.pageNumber,
3457
+ event = eventActionProps.event;
3054
3458
  var tokenReplacementMap = (0, EventUtils_1.generateTokenReplacementMap)({
3055
3459
  dataSources: dataSources,
3056
3460
  rowIndex: rowIndex,
@@ -3071,28 +3475,31 @@ var PureEvents = function PureEvents(props) {
3071
3475
  }
3072
3476
  }, truncatedLabel);
3073
3477
  };
3478
+
3074
3479
  return {
3075
3480
  eventtypeValues: eventtypeValues,
3076
3481
  fieldFilters: fieldFilters,
3077
3482
  eventActionComponent: eventActionComponent
3078
3483
  };
3079
3484
  });
3080
- }, [eventActions]);
3081
- // A map of fields, each associated with an array of objects with eventtypeValues for filtering by eventtype,
3485
+ }, [eventActions]); // A map of fields, each associated with an array of objects with eventtypeValues for filtering by eventtype,
3082
3486
  // and fieldActionComponent (needs to be Menu.Item and will be rendered inside a Menu component)
3083
3487
  // to display in its respective dropdown in the Actions column
3488
+
3084
3489
  var renderFieldActions = React.useMemo(function () {
3085
3490
  if (_typeof(fieldActions) !== 'object') return {};
3086
3491
  var fieldActionsMap = {};
3087
3492
  Object.entries(fieldActions).forEach(function (_ref4) {
3088
3493
  var _ref5 = _slicedToArray(_ref4, 2),
3089
- currentFieldName = _ref5[0],
3090
- currentFieldActions = _ref5[1];
3494
+ currentFieldName = _ref5[0],
3495
+ currentFieldActions = _ref5[1];
3496
+
3091
3497
  fieldActionsMap[currentFieldName] = currentFieldActions.map(function (_ref6) {
3092
3498
  var eventType = _ref6.eventType,
3093
- label = _ref6.label,
3094
- _ref6$eventtypeValues = _ref6.eventtypeValues,
3095
- eventtypeValues = _ref6$eventtypeValues === void 0 ? [] : _ref6$eventtypeValues;
3499
+ label = _ref6.label,
3500
+ _ref6$eventtypeValues = _ref6.eventtypeValues,
3501
+ eventtypeValues = _ref6$eventtypeValues === void 0 ? [] : _ref6$eventtypeValues;
3502
+
3096
3503
  var onMenuItemClick = function onMenuItemClick(e, fieldActionProps, tokenReplacementMap) {
3097
3504
  var payload = (0, EventUtils_1.convertToPayloadFormat)(fieldActionProps.event, {
3098
3505
  name: fieldActionProps.field,
@@ -3105,12 +3512,13 @@ var PureEvents = function PureEvents(props) {
3105
3512
  payload: payload
3106
3513
  });
3107
3514
  };
3515
+
3108
3516
  var fieldActionComponent = function fieldActionComponent(fieldActionProps) {
3109
3517
  var field = fieldActionProps.field,
3110
- value = fieldActionProps.value,
3111
- rowIndex = fieldActionProps.rowIndex,
3112
- pageNumber = fieldActionProps.pageNumber,
3113
- event = fieldActionProps.event;
3518
+ value = fieldActionProps.value,
3519
+ rowIndex = fieldActionProps.rowIndex,
3520
+ pageNumber = fieldActionProps.pageNumber,
3521
+ event = fieldActionProps.event;
3114
3522
  var tokenReplacementMap = (0, EventUtils_1.generateTokenReplacementMap)({
3115
3523
  dataSources: dataSources,
3116
3524
  rowIndex: rowIndex,
@@ -3133,6 +3541,7 @@ var PureEvents = function PureEvents(props) {
3133
3541
  }
3134
3542
  }, truncatedLabel);
3135
3543
  };
3544
+
3136
3545
  return {
3137
3546
  eventtypeValues: eventtypeValues,
3138
3547
  fieldActionComponent: fieldActionComponent
@@ -3140,27 +3549,30 @@ var PureEvents = function PureEvents(props) {
3140
3549
  });
3141
3550
  });
3142
3551
  return fieldActionsMap;
3143
- }, [fieldActions]);
3144
- // formulate the options object required by the SUI EventsViewer component
3552
+ }, [fieldActions]); // formulate the options object required by the SUI EventsViewer component
3553
+
3145
3554
  var suiEventsViewerOptions = {
3146
3555
  renderEventActions: renderEventActions,
3147
3556
  renderFieldActions: renderFieldActions,
3148
3557
  footerFields: footerFields,
3149
- fieldValueHighlightMap: highlightValuesByField
3558
+ fieldValueHighlightMap: highlightValuesByFieldCombined
3150
3559
  };
3560
+
3151
3561
  var handleFieldClicked = showFieldSummary && function (e, _ref7) {
3152
3562
  var field = _ref7.field;
3153
3563
  setFieldSummaryField(field);
3154
3564
  setFieldSummaryAnchor(e.currentTarget.parentElement);
3155
3565
  };
3566
+
3156
3567
  var handleTimeClicked = function handleTimeClicked(e, _ref8) {
3157
3568
  var time = _ref8.time;
3158
3569
  setTimeValue(time);
3159
3570
  setTimeFieldAnchor(e.currentTarget);
3160
3571
  };
3572
+
3161
3573
  var handleValueClicked = function handleValueClicked(e, _ref9) {
3162
3574
  var field = _ref9.field,
3163
- value = _ref9.value;
3575
+ value = _ref9.value;
3164
3576
  onEventTrigger({
3165
3577
  originalEvent: e,
3166
3578
  type: 'value.click',
@@ -3170,9 +3582,10 @@ var PureEvents = function PureEvents(props) {
3170
3582
  }
3171
3583
  });
3172
3584
  };
3585
+
3173
3586
  var handleTagClicked = function handleTagClicked(e, _ref10) {
3174
3587
  var field = _ref10.field,
3175
- value = _ref10.value;
3588
+ value = _ref10.value;
3176
3589
  onEventTrigger({
3177
3590
  originalEvent: e,
3178
3591
  type: 'tag.click',
@@ -3182,6 +3595,7 @@ var PureEvents = function PureEvents(props) {
3182
3595
  }
3183
3596
  });
3184
3597
  };
3598
+
3185
3599
  var handleTimeDrilldown = function handleTimeDrilldown(e, timeInterval) {
3186
3600
  onEventTrigger({
3187
3601
  originalEvent: e,
@@ -3194,9 +3608,10 @@ var PureEvents = function PureEvents(props) {
3194
3608
  }
3195
3609
  });
3196
3610
  };
3611
+
3197
3612
  var handleActionClicked = function handleActionClicked(event, data) {
3198
3613
  var actionType = data.action,
3199
- field = data.field;
3614
+ field = data.field;
3200
3615
  onEventTrigger({
3201
3616
  originalEvent: event,
3202
3617
  type: "events.search.".concat(actionType),
@@ -3205,6 +3620,7 @@ var PureEvents = function PureEvents(props) {
3205
3620
  }
3206
3621
  });
3207
3622
  };
3623
+
3208
3624
  return React.createElement(EventsContainer, {
3209
3625
  backgroundColor: backgroundColor,
3210
3626
  width: width,
@@ -3243,6 +3659,7 @@ var PureEvents = function PureEvents(props) {
3243
3659
  }
3244
3660
  })));
3245
3661
  };
3662
+
3246
3663
  PureEvents.propTypes = {
3247
3664
  width: T.oneOfType([T.string, T.number]),
3248
3665
  height: T.oneOfType([T.string, T.number]),
@@ -3290,46 +3707,59 @@ PureEvents.defaultProps = {
3290
3707
  exports.default = (0, FixedSizeContainer_1.default)(PureEvents);
3291
3708
 
3292
3709
  /***/ }),
3293
- /* 205 */
3710
+ /* 206 */
3294
3711
  /***/ (function(module, exports) {
3295
3712
 
3296
3713
  module.exports = require("@splunk/react-events-viewer/components/EventsViewer");
3297
3714
 
3298
3715
  /***/ }),
3299
- /* 206 */
3716
+ /* 207 */
3300
3717
  /***/ (function(module, exports) {
3301
3718
 
3302
3719
  module.exports = require("@splunk/time-range-utils/time");
3303
3720
 
3304
3721
  /***/ }),
3305
- /* 207 */
3722
+ /* 208 */
3306
3723
  /***/ (function(module, exports, __webpack_require__) {
3307
3724
 
3308
3725
  "use strict";
3309
3726
 
3310
3727
 
3311
3728
  var _taggedTemplateLiteral = __webpack_require__(59);
3729
+
3312
3730
  var _templateObject;
3731
+
3313
3732
  Object.defineProperty(exports, "__esModule", {
3314
3733
  value: true
3315
3734
  });
3735
+
3316
3736
  var React = __webpack_require__(1);
3737
+
3317
3738
  var react_1 = __webpack_require__(1);
3739
+
3318
3740
  var Popover_1 = __webpack_require__(62);
3741
+
3319
3742
  var Markdown_1 = __webpack_require__(122);
3320
- var FieldSummary_1 = __webpack_require__(208);
3743
+
3744
+ var FieldSummary_1 = __webpack_require__(209);
3745
+
3321
3746
  var lodash_1 = __webpack_require__(3);
3747
+
3322
3748
  var i18n_1 = __webpack_require__(2);
3749
+
3323
3750
  var styled_components_1 = __webpack_require__(4);
3751
+
3324
3752
  var EventsContext_1 = __webpack_require__(152);
3753
+
3325
3754
  var popoverContainerStyle = {
3326
3755
  padding: '20px',
3327
3756
  width: 500
3328
3757
  };
3329
3758
  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"])));
3759
+
3330
3760
  var actionsForField = function actionsForField(field) {
3331
- var actions = [];
3332
- // this logic is used in determining whether to display numeric stats in ui-platform (FieldStats.tsx)
3761
+ var actions = []; // this logic is used in determining whether to display numeric stats in ui-platform (FieldStats.tsx)
3762
+
3333
3763
  if (typeof field.mean === 'number') {
3334
3764
  actions.push({
3335
3765
  name: 'avgByTime',
@@ -3344,6 +3774,7 @@ var actionsForField = function actionsForField(field) {
3344
3774
  label: (0, i18n_1._)('Min value over time')
3345
3775
  });
3346
3776
  }
3777
+
3347
3778
  actions.push({
3348
3779
  name: 'topValues',
3349
3780
  label: (0, i18n_1._)('Top values')
@@ -3362,22 +3793,25 @@ var actionsForField = function actionsForField(field) {
3362
3793
  });
3363
3794
  return actions;
3364
3795
  };
3796
+
3365
3797
  var FieldSummaryTooltip = function FieldSummaryTooltip(props) {
3366
3798
  var open = props.open,
3367
- anchor = props.anchor,
3368
- handleTooltipClose = props.handleTooltipClose,
3369
- fieldName = props.fieldName,
3370
- fieldSummaryMap = props.fieldSummaryMap,
3371
- onActionClicked = props.onActionClicked,
3372
- onFieldValueClicked = props.onFieldValueClicked;
3799
+ anchor = props.anchor,
3800
+ handleTooltipClose = props.handleTooltipClose,
3801
+ fieldName = props.fieldName,
3802
+ fieldSummaryMap = props.fieldSummaryMap,
3803
+ onActionClicked = props.onActionClicked,
3804
+ onFieldValueClicked = props.onFieldValueClicked;
3805
+
3373
3806
  var _ref = (0, react_1.useContext)(EventsContext_1.default),
3374
- isSplunkWebAvailable = _ref.isSplunkWebAvailable;
3807
+ isSplunkWebAvailable = _ref.isSplunkWebAvailable;
3808
+
3375
3809
  var getActionsForField = (0, react_1.useCallback)(function (field) {
3376
3810
  return isSplunkWebAvailable ? actionsForField(field) : [];
3377
- }, [isSplunkWebAvailable]);
3378
- // if the anchor is null or no field has been clicked, do not render the tooltip
3379
- if (!open) return null;
3380
- // retrieve the field summary for this field. if there is no field data, show fallback messaging
3811
+ }, [isSplunkWebAvailable]); // if the anchor is null or no field has been clicked, do not render the tooltip
3812
+
3813
+ if (!open) return null; // retrieve the field summary for this field. if there is no field data, show fallback messaging
3814
+
3381
3815
  var field = fieldSummaryMap[fieldName];
3382
3816
  var fieldSummaryExists = !!field;
3383
3817
  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 +3833,7 @@ var FieldSummaryTooltip = function FieldSummaryTooltip(props) {
3399
3833
  text: fallbackText
3400
3834
  })));
3401
3835
  };
3836
+
3402
3837
  FieldSummaryTooltip.defaultProps = {
3403
3838
  open: false,
3404
3839
  anchor: null,
@@ -3411,40 +3846,59 @@ FieldSummaryTooltip.defaultProps = {
3411
3846
  exports.default = FieldSummaryTooltip;
3412
3847
 
3413
3848
  /***/ }),
3414
- /* 208 */
3849
+ /* 209 */
3415
3850
  /***/ (function(module, exports) {
3416
3851
 
3417
3852
  module.exports = require("@splunk/react-field-summary/components/FieldSummary");
3418
3853
 
3419
3854
  /***/ }),
3420
- /* 209 */
3855
+ /* 210 */
3421
3856
  /***/ (function(module, exports, __webpack_require__) {
3422
3857
 
3423
3858
  "use strict";
3424
3859
 
3425
3860
 
3426
3861
  var _slicedToArray = __webpack_require__(17);
3862
+
3427
3863
  var _taggedTemplateLiteral = __webpack_require__(59);
3864
+
3428
3865
  var _templateObject;
3866
+
3429
3867
  Object.defineProperty(exports, "__esModule", {
3430
3868
  value: true
3431
3869
  });
3870
+
3432
3871
  var React = __webpack_require__(1);
3872
+
3433
3873
  var Popover_1 = __webpack_require__(62);
3434
- var ControlGroup_1 = __webpack_require__(210);
3874
+
3875
+ var ControlGroup_1 = __webpack_require__(211);
3876
+
3435
3877
  var Button_1 = __webpack_require__(123);
3436
- var Text_1 = __webpack_require__(211);
3878
+
3879
+ var Text_1 = __webpack_require__(212);
3880
+
3437
3881
  var Message_1 = __webpack_require__(124);
3438
- var Select_1 = __webpack_require__(212);
3439
- var Link_1 = __webpack_require__(213);
3882
+
3883
+ var Select_1 = __webpack_require__(213);
3884
+
3885
+ var Link_1 = __webpack_require__(214);
3886
+
3440
3887
  var Heading_1 = __webpack_require__(125);
3888
+
3441
3889
  var lodash_1 = __webpack_require__(3);
3890
+
3442
3891
  var i18n_1 = __webpack_require__(2);
3892
+
3443
3893
  var styled_components_1 = __webpack_require__(4);
3894
+
3444
3895
  var numberUtils_1 = __webpack_require__(31);
3896
+
3445
3897
  var pick_1 = __webpack_require__(23);
3446
- var EventUtils_1 = __webpack_require__(120);
3447
- // custom popover sizing for Enterprise vs. Prisma themes - additional px for Prisma theme to fit controls
3898
+
3899
+ var EventUtils_1 = __webpack_require__(120); // custom popover sizing for Enterprise vs. Prisma themes - additional px for Prisma theme to fit controls
3900
+
3901
+
3448
3902
  var TimePopoverContainer = styled_components_1.default.div.withConfig({
3449
3903
  displayName: "TimeControlsPopover__TimePopoverContainer",
3450
3904
  componentId: "fj32ze-0"
@@ -3482,48 +3936,61 @@ var rangeUnitInputStyle = {
3482
3936
  var applyButtonStyle = {
3483
3937
  marginLeft: 10
3484
3938
  };
3939
+
3485
3940
  var TimeControlsPopover = function TimeControlsPopover(props) {
3486
3941
  var open = props.open,
3487
- anchor = props.anchor,
3488
- time = props.time,
3489
- handleTooltipClose = props.handleTooltipClose,
3490
- onTimeDrilldown = props.onTimeDrilldown; // nearby events controls default to +/- 5 second(s)
3942
+ anchor = props.anchor,
3943
+ time = props.time,
3944
+ handleTooltipClose = props.handleTooltipClose,
3945
+ onTimeDrilldown = props.onTimeDrilldown; // nearby events controls default to +/- 5 second(s)
3946
+
3491
3947
  var _React$useState = React.useState('plusminus'),
3492
- _React$useState2 = _slicedToArray(_React$useState, 2),
3493
- rangeType = _React$useState2[0],
3494
- setRangeType = _React$useState2[1];
3948
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3949
+ rangeType = _React$useState2[0],
3950
+ setRangeType = _React$useState2[1];
3951
+
3495
3952
  var _React$useState3 = React.useState('5'),
3496
- _React$useState4 = _slicedToArray(_React$useState3, 2),
3497
- rangeAmount = _React$useState4[0],
3498
- setRangeAmount = _React$useState4[1];
3953
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
3954
+ rangeAmount = _React$useState4[0],
3955
+ setRangeAmount = _React$useState4[1];
3956
+
3499
3957
  var _React$useState5 = React.useState('s'),
3500
- _React$useState6 = _slicedToArray(_React$useState5, 2),
3501
- rangeUnit = _React$useState6[0],
3502
- setRangeUnit = _React$useState6[1]; // if validation fails, this triggers the error state on the controls to show
3958
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
3959
+ rangeUnit = _React$useState6[0],
3960
+ setRangeUnit = _React$useState6[1]; // if validation fails, this triggers the error state on the controls to show
3961
+
3962
+
3503
3963
  var _React$useState7 = React.useState(false),
3504
- _React$useState8 = _slicedToArray(_React$useState7, 2),
3505
- isInvalidInput = _React$useState8[0],
3506
- setInvalidInput = _React$useState8[1];
3964
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
3965
+ isInvalidInput = _React$useState8[0],
3966
+ setInvalidInput = _React$useState8[1];
3967
+
3507
3968
  var errorMessage = (0, i18n_1._)('Value must be an integer greater than 0');
3969
+
3508
3970
  var handleRangeTypeChange = function handleRangeTypeChange(e, _ref) {
3509
3971
  var value = _ref.value;
3510
3972
  setRangeType(value);
3511
3973
  };
3974
+
3512
3975
  var handleRangeAmountChange = function handleRangeAmountChange(e, _ref2) {
3513
3976
  var value = _ref2.value;
3514
3977
  setRangeAmount(value);
3515
3978
  };
3979
+
3516
3980
  var handleRangeUnitChange = function handleRangeUnitChange(e, _ref3) {
3517
3981
  var value = _ref3.value;
3518
3982
  setRangeUnit(value);
3519
3983
  };
3984
+
3520
3985
  var handleSubmit = function handleSubmit(e) {
3521
3986
  // if the entered range amount is not a number, is not greater than 0, or is not an integer, then it is invalid
3522
3987
  var parsedIntervalAmount = (0, numberUtils_1.parseNumber)(rangeAmount);
3988
+
3523
3989
  if (Number.isNaN(parsedIntervalAmount) || parsedIntervalAmount <= 0 || !Number.isInteger(parsedIntervalAmount)) {
3524
3990
  setInvalidInput(true);
3525
3991
  return;
3526
3992
  }
3993
+
3527
3994
  setInvalidInput(false);
3528
3995
  var timeInterval = (0, EventUtils_1.getCustomTimeInterval)({
3529
3996
  time: time,
@@ -3533,6 +4000,7 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
3533
4000
  });
3534
4001
  onTimeDrilldown(e, timeInterval);
3535
4002
  };
4003
+
3536
4004
  var handleEventIntervalClick = function handleEventIntervalClick(e, when) {
3537
4005
  e.preventDefault();
3538
4006
  var timeInterval = (0, EventUtils_1.getPredefinedTimeInterval)({
@@ -3541,6 +4009,7 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
3541
4009
  });
3542
4010
  onTimeDrilldown(e, timeInterval);
3543
4011
  };
4012
+
3544
4013
  return React.createElement(Popover_1.default, {
3545
4014
  open: open,
3546
4015
  defaultPlacement: "below",
@@ -3643,6 +4112,7 @@ var TimeControlsPopover = function TimeControlsPopover(props) {
3643
4112
  "data-test": "apply-custom-time"
3644
4113
  }))));
3645
4114
  };
4115
+
3646
4116
  TimeControlsPopover.defaultProps = {
3647
4117
  open: false,
3648
4118
  anchor: null,
@@ -3653,25 +4123,25 @@ TimeControlsPopover.defaultProps = {
3653
4123
  exports.default = TimeControlsPopover;
3654
4124
 
3655
4125
  /***/ }),
3656
- /* 210 */
4126
+ /* 211 */
3657
4127
  /***/ (function(module, exports) {
3658
4128
 
3659
4129
  module.exports = require("@splunk/react-ui/ControlGroup");
3660
4130
 
3661
4131
  /***/ }),
3662
- /* 211 */
4132
+ /* 212 */
3663
4133
  /***/ (function(module, exports) {
3664
4134
 
3665
4135
  module.exports = require("@splunk/react-ui/Text");
3666
4136
 
3667
4137
  /***/ }),
3668
- /* 212 */
4138
+ /* 213 */
3669
4139
  /***/ (function(module, exports) {
3670
4140
 
3671
4141
  module.exports = require("@splunk/react-ui/Select");
3672
4142
 
3673
4143
  /***/ }),
3674
- /* 213 */
4144
+ /* 214 */
3675
4145
  /***/ (function(module, exports) {
3676
4146
 
3677
4147
  module.exports = require("@splunk/react-ui/Link");