@splunk/visualizations 25.5.0 → 25.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_TimeControlsPopover_Dark.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_TimeControlsPopover_DarkPrisma.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureEvents_TimeControlsPopover_Light.png +0 -0
  4. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Background_Color_Light_Blue.png +0 -0
  5. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Basic_Events.png +0 -0
  6. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Event_Actions.png +0 -0
  7. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Actions.png +0 -0
  8. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Summary.png +0 -0
  9. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Field_Summary_Simulated_Instance.png +0 -0
  10. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Footer_Fields.png +0 -0
  11. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Value_Highlighting.png +0 -0
  12. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Width_Height.png +0 -0
  13. package/.loki/reference/chrome_docker_Visualizations_Events_Events_Width_Percentage_50.png +0 -0
  14. package/Area.js +226 -143
  15. package/Area.js.map +1 -1
  16. package/Bar.js +226 -143
  17. package/Bar.js.map +1 -1
  18. package/Bubble.js +218 -135
  19. package/Bubble.js.map +1 -1
  20. package/ChoroplethSvg.js +217 -139
  21. package/ChoroplethSvg.js.map +1 -1
  22. package/Column.js +226 -143
  23. package/Column.js.map +1 -1
  24. package/Ellipse.js +188 -105
  25. package/Ellipse.js.map +1 -1
  26. package/Events.config.js +3 -0
  27. package/Events.config.js.map +1 -1
  28. package/Events.js +967 -267
  29. package/Events.js.map +1 -1
  30. package/FillerGauge.js +214 -126
  31. package/FillerGauge.js.map +1 -1
  32. package/Image.js +210 -125
  33. package/Image.js.map +1 -1
  34. package/Line.js +231 -143
  35. package/Line.js.map +1 -1
  36. package/LinkGraph.js +601 -524
  37. package/LinkGraph.js.map +1 -1
  38. package/Map.js +484 -406
  39. package/Map.js.map +1 -1
  40. package/Markdown.js +295 -210
  41. package/Markdown.js.map +1 -1
  42. package/MarkerGauge.js +388 -310
  43. package/MarkerGauge.js.map +1 -1
  44. package/ParallelCoordinates.js +469 -391
  45. package/ParallelCoordinates.js.map +1 -1
  46. package/Pie.js +428 -343
  47. package/Pie.js.map +1 -1
  48. package/Punchcard.js +480 -402
  49. package/Punchcard.js.map +1 -1
  50. package/Rectangle.js +437 -352
  51. package/Rectangle.js.map +1 -1
  52. package/Sankey.js +497 -419
  53. package/Sankey.js.map +1 -1
  54. package/Scatter.js +361 -276
  55. package/Scatter.js.map +1 -1
  56. package/SingleValue.js +386 -301
  57. package/SingleValue.js.map +1 -1
  58. package/SingleValueBasic.js +23 -23
  59. package/SingleValueBasic.js.map +1 -1
  60. package/SingleValueIcon.js +385 -300
  61. package/SingleValueIcon.js.map +1 -1
  62. package/SingleValueRadial.js +319 -234
  63. package/SingleValueRadial.js.map +1 -1
  64. package/Table.js +309 -231
  65. package/Table.js.map +1 -1
  66. package/common/EventsDoc.js +3 -3
  67. package/common/EventsDoc.js.map +1 -1
  68. package/common/GaugeMajorTicks.js +2 -2
  69. package/common/GaugeValueMarker.js +2 -2
  70. package/common/OptionsDoc.js +14 -14
  71. package/common/OptionsDoc.js.map +1 -1
  72. package/common/ThemesDoc.js +10 -10
  73. package/common/ThemesDoc.js.map +1 -1
  74. package/common/withDashboardViz.js +122 -42
  75. package/common/withDashboardViz.js.map +1 -1
  76. package/package.json +13 -11
package/Events.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 183);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 189);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -209,7 +209,7 @@ var React = __webpack_require__(1);
209
209
 
210
210
  var styled_components_1 = __webpack_require__(4);
211
211
 
212
- var SizeAwareWrapper_1 = __webpack_require__(20);
212
+ var SizeAwareWrapper_1 = __webpack_require__(21);
213
213
 
214
214
  var style_1 = __webpack_require__(15);
215
215
 
@@ -270,7 +270,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
270
270
 
271
271
  return React.createElement(FixSizeItem, {
272
272
  "data-test": "fix-size-item",
273
- "data-splunk-visualization-version": "25.5.0 - 12c0447a7",
273
+ "data-splunk-visualization-version": "25.6.0 - f5eb3abf9",
274
274
  width: width,
275
275
  height: height,
276
276
  backgroundColor: backgroundColor
@@ -336,6 +336,12 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
336
336
 
337
337
  /***/ }),
338
338
  /* 17 */
339
+ /***/ (function(module, exports) {
340
+
341
+ module.exports = require("@babel/runtime/helpers/slicedToArray");
342
+
343
+ /***/ }),
344
+ /* 18 */
339
345
  /***/ (function(module, exports, __webpack_require__) {
340
346
 
341
347
  "use strict";
@@ -571,46 +577,58 @@ var insertLayout = function insertLayout(layout, index) {
571
577
  exports.insertLayout = insertLayout;
572
578
 
573
579
  /***/ }),
574
- /* 18 */,
575
- /* 19 */
580
+ /* 19 */,
581
+ /* 20 */
576
582
  /***/ (function(module, exports) {
577
583
 
578
584
  module.exports = require("@babel/runtime/helpers/createClass");
579
585
 
580
586
  /***/ }),
581
- /* 20 */
587
+ /* 21 */
582
588
  /***/ (function(module, exports) {
583
589
 
584
590
  module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
585
591
 
586
592
  /***/ }),
587
- /* 21 */
593
+ /* 22 */
588
594
  /***/ (function(module, exports) {
589
595
 
590
596
  module.exports = require("@splunk/themes/pick");
591
597
 
592
598
  /***/ }),
593
- /* 22 */,
594
- /* 23 */
599
+ /* 23 */,
600
+ /* 24 */
595
601
  /***/ (function(module, exports) {
596
602
 
597
603
  module.exports = require("@splunk/visualization-context/TimezoneContext");
598
604
 
599
605
  /***/ }),
600
- /* 24 */,
601
- /* 25 */
606
+ /* 25 */,
607
+ /* 26 */
608
+ /***/ (function(module, exports) {
609
+
610
+ module.exports = require("@splunk/visualization-context/FeatureFlagContext");
611
+
612
+ /***/ }),
613
+ /* 27 */
602
614
  /***/ (function(module, exports) {
603
615
 
604
616
  module.exports = require("@splunk/visualizations-shared/hocUtils");
605
617
 
606
618
  /***/ }),
607
- /* 26 */
619
+ /* 28 */
608
620
  /***/ (function(module, exports) {
609
621
 
610
622
  module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
611
623
 
612
624
  /***/ }),
613
- /* 27 */
625
+ /* 29 */
626
+ /***/ (function(module, exports) {
627
+
628
+ module.exports = require("@splunk/visualizations-shared/numberUtils");
629
+
630
+ /***/ }),
631
+ /* 30 */
614
632
  /***/ (function(module, exports, __webpack_require__) {
615
633
 
616
634
  "use strict";
@@ -701,7 +719,13 @@ IconPlaceholder.defaultProps = {
701
719
  exports.default = FixedSizeContainer_1.default(IconPlaceholder);
702
720
 
703
721
  /***/ }),
704
- /* 28 */
722
+ /* 31 */
723
+ /***/ (function(module, exports) {
724
+
725
+ module.exports = require("@splunk/ui-utils/id");
726
+
727
+ /***/ }),
728
+ /* 32 */
705
729
  /***/ (function(module, exports, __webpack_require__) {
706
730
 
707
731
  "use strict";
@@ -718,7 +742,7 @@ var T = __webpack_require__(0);
718
742
 
719
743
  var lodash_1 = __webpack_require__(3);
720
744
 
721
- var DataSource_1 = __webpack_require__(39);
745
+ var DataSource_1 = __webpack_require__(43);
722
746
 
723
747
  exports.SortParamsPropTypes = T.shape({
724
748
  currentSortKey: T.string,
@@ -771,7 +795,7 @@ var getSortingParams = function getSortingParams(_ref) {
771
795
  exports.getSortingParams = getSortingParams;
772
796
 
773
797
  /***/ }),
774
- /* 29 */
798
+ /* 33 */
775
799
  /***/ (function(module, exports, __webpack_require__) {
776
800
 
777
801
  "use strict";
@@ -835,8 +859,7 @@ var getPaginationParams = function getPaginationParams(_ref) {
835
859
  exports.getPaginationParams = getPaginationParams;
836
860
 
837
861
  /***/ }),
838
- /* 30 */,
839
- /* 31 */
862
+ /* 34 */
840
863
  /***/ (function(module, exports, __webpack_require__) {
841
864
 
842
865
  "use strict";
@@ -864,12 +887,14 @@ var VizCategory;
864
887
  })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
865
888
 
866
889
  /***/ }),
867
- /* 32 */
890
+ /* 35 */
868
891
  /***/ (function(module, exports, __webpack_require__) {
869
892
 
870
893
  "use strict";
871
894
 
872
895
 
896
+ var _slicedToArray = __webpack_require__(17);
897
+
873
898
  Object.defineProperty(exports, "__esModule", {
874
899
  value: true
875
900
  });
@@ -878,44 +903,51 @@ var React = __webpack_require__(1);
878
903
 
879
904
  var lodash_1 = __webpack_require__(3);
880
905
 
881
- var getSettingsFromThemedProps_1 = __webpack_require__(33);
906
+ var getSettingsFromThemedProps_1 = __webpack_require__(36);
882
907
 
883
- var Options_1 = __webpack_require__(34);
908
+ var Options_1 = __webpack_require__(37);
884
909
 
885
- var SanitizeProps_1 = __webpack_require__(35);
910
+ var SanitizeProps_1 = __webpack_require__(38);
886
911
 
887
- var TimezoneContext_1 = __webpack_require__(23);
912
+ var TimezoneContext_1 = __webpack_require__(24);
888
913
 
889
- var moment_1 = __webpack_require__(36);
914
+ var moment_1 = __webpack_require__(39);
915
+
916
+ var FeatureFlagContext_1 = __webpack_require__(26);
890
917
 
891
918
  var styled_components_1 = __webpack_require__(4);
892
919
 
893
- var hocUtils_1 = __webpack_require__(25);
920
+ var hocUtils_1 = __webpack_require__(27);
921
+
922
+ var JSONSchemaUtils_1 = __webpack_require__(28);
894
923
 
895
- var JSONSchemaUtils_1 = __webpack_require__(26);
924
+ var async_dynamic_options_evaluator_1 = __webpack_require__(40);
896
925
 
897
- var SplunkVisualization_1 = __webpack_require__(37);
926
+ var id_1 = __webpack_require__(31);
927
+
928
+ var SplunkVisualization_1 = __webpack_require__(41);
898
929
 
899
930
  var VizBehavior_1 = __webpack_require__(6);
900
931
 
901
- var getSorting_1 = __webpack_require__(28);
932
+ var getSorting_1 = __webpack_require__(32);
933
+
934
+ var getPagination_1 = __webpack_require__(33);
902
935
 
903
- var getPagination_1 = __webpack_require__(29);
936
+ var useDeepMemo_1 = __webpack_require__(44);
904
937
 
905
- var useDeepMemo_1 = __webpack_require__(40);
938
+ var MissingPropsMessage_1 = __webpack_require__(45);
906
939
 
907
- var MissingPropsMessage_1 = __webpack_require__(41);
940
+ var withEditModeCover_1 = __webpack_require__(46);
908
941
 
909
- var withEditModeCover_1 = __webpack_require__(42);
942
+ var withPlaceholder_1 = __webpack_require__(47);
910
943
 
911
- var withPlaceholder_1 = __webpack_require__(43);
944
+ var UUID = id_1.createGUID();
912
945
  /**
913
946
  * hoc that wraps a pure react visualization in a Dashboard visualization
914
947
  * @param {DashboardVizOpts} opts
915
948
  * @returns {HOC}
916
949
  */
917
950
 
918
-
919
951
  var withDashboardViz = function withDashboardViz(opts) {
920
952
  var ReactViz = opts.ReactViz,
921
953
  vizConfig = opts.vizConfig,
@@ -975,28 +1007,76 @@ var withDashboardViz = function withDashboardViz(opts) {
975
1007
 
976
1008
  var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
977
1009
 
1010
+ var _React$useState = React.useState({}),
1011
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1012
+ evaluatedOptionsAsync = _React$useState2[0],
1013
+ setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
1014
+
1015
+
1016
+ var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
1017
+
1018
+ var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat(UUID)),
1019
+ _React$useState4 = _slicedToArray(_React$useState3, 1),
1020
+ visualizationID = _React$useState4[0];
1021
+
1022
+ var _React$useState5 = React.useState(Boolean(featureFlagContext && featureFlagContext['visualizations.useWebWorkersForDSL'] && typeof Worker !== 'undefined')),
1023
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
1024
+ useAsyncEvaluatedOptions = _React$useState6[0],
1025
+ setUseAsyncEvaluatedOptions = _React$useState6[1];
1026
+
978
1027
  evaluatedOptions = useDeepMemo_1.useDeepMemo(function () {
979
1028
  try {
980
- return Options_1.Options.evaluate({
981
- context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
982
- options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
983
- }, dataSources, themeFunc);
1029
+ if (useAsyncEvaluatedOptions) {
1030
+ var optionsToEvaluate = {
1031
+ context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
1032
+ options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
1033
+ };
1034
+ var asyncDynamicOptionsEvaluatorParams = {
1035
+ visualizationID: visualizationID,
1036
+ props: props,
1037
+ options: optionsToEvaluate,
1038
+ dataSources: dataSources,
1039
+ theme: vizConfig.themes
1040
+ };
1041
+ async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
1042
+ setEvaluatedOptionsAsync(results.results);
1043
+ }).catch(function (e) {
1044
+ // eslint-disable-next-line no-console
1045
+ console.error("unexpected error evaluating options - async: ".concat(e.message));
1046
+ setUseAsyncEvaluatedOptions(false);
1047
+ });
1048
+ } else {
1049
+ return Options_1.Options.evaluate({
1050
+ context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
1051
+ options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
1052
+ }, dataSources, themeFunc);
1053
+ }
984
1054
  } catch (e) {
985
1055
  // eslint-disable-next-line no-console
986
- console.error("unexpected error evaluating options: + ".concat(e.message));
1056
+ console.error("unexpected error evaluating options: ".concat(e.message));
987
1057
  return {};
988
1058
  }
989
- }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone]); // useEffect hook needs to be initialized before any early returns
1059
+
1060
+ return {};
1061
+ }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
1062
+ var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // useEffect hook needs to be initialized before any early returns
990
1063
  // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
991
1064
 
992
1065
  React.useEffect(function () {
993
- onComputedProps(evaluatedOptions);
994
- }); // present warning message if any required props are missing
1066
+ onComputedProps(evaluatedOptionsToUse);
1067
+ });
1068
+ React.useEffect(function () {
1069
+ return function () {
1070
+ if (useAsyncEvaluatedOptions) {
1071
+ async_dynamic_options_evaluator_1.default.reset(visualizationID);
1072
+ }
1073
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
1074
+ }, []); // present warning message if any required props are missing
995
1075
 
996
1076
  var _vizConfig$requiredPr = vizConfig.requiredProps,
997
1077
  requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
998
1078
  supports = vizConfig.supports;
999
- var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptions);
1079
+ var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptionsToUse);
1000
1080
 
1001
1081
  if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER)) {
1002
1082
  return React.createElement(MissingPropsMessage_1.default, {
@@ -1023,7 +1103,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1023
1103
 
1024
1104
  if (Array.isArray(payloadKeys) && payloadKeys.length) {
1025
1105
  payloadKeys.forEach(function (p) {
1026
- payload[p] = evaluatedOptions[p];
1106
+ payload[p] = evaluatedOptionsToUse[p];
1027
1107
  });
1028
1108
  }
1029
1109
 
@@ -1042,7 +1122,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1042
1122
  } // compute pure viz props which are not from options
1043
1123
 
1044
1124
 
1045
- var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptions), eventCallbackProps), {
1125
+ var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
1046
1126
  themeFunc: themeFunc
1047
1127
  }));
1048
1128
  /**
@@ -1062,7 +1142,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1062
1142
 
1063
1143
  var dataSourceMetadata = {};
1064
1144
  var OptionKey = 'paginateDataSourceKey';
1065
- var paginateDataSourceKey = lodash_1.has(evaluatedOptions, OptionKey) && evaluatedOptions[OptionKey] || 'primary';
1145
+ var paginateDataSourceKey = lodash_1.has(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
1066
1146
 
1067
1147
  if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && lodash_1.has(dataSources, paginateDataSourceKey)) {
1068
1148
  var requestParams = lodash_1.get(dataSources, [paginateDataSourceKey, 'requestParams'], {});
@@ -1092,7 +1172,7 @@ var withDashboardViz = function withDashboardViz(opts) {
1092
1172
  mode: mode,
1093
1173
  width: width,
1094
1174
  height: height
1095
- }, evaluatedOptions, computedVizProps, eventCallbackProps, dataSourceMetadata));
1175
+ }, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
1096
1176
  };
1097
1177
 
1098
1178
  DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
@@ -1109,31 +1189,37 @@ var withDashboardViz = function withDashboardViz(opts) {
1109
1189
  exports.default = withDashboardViz;
1110
1190
 
1111
1191
  /***/ }),
1112
- /* 33 */
1192
+ /* 36 */
1113
1193
  /***/ (function(module, exports) {
1114
1194
 
1115
1195
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1116
1196
 
1117
1197
  /***/ }),
1118
- /* 34 */
1198
+ /* 37 */
1119
1199
  /***/ (function(module, exports) {
1120
1200
 
1121
1201
  module.exports = require("@splunk/visualization-encoding/Options");
1122
1202
 
1123
1203
  /***/ }),
1124
- /* 35 */
1204
+ /* 38 */
1125
1205
  /***/ (function(module, exports) {
1126
1206
 
1127
1207
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1128
1208
 
1129
1209
  /***/ }),
1130
- /* 36 */
1210
+ /* 39 */
1131
1211
  /***/ (function(module, exports) {
1132
1212
 
1133
1213
  module.exports = require("@splunk/moment");
1134
1214
 
1135
1215
  /***/ }),
1136
- /* 37 */
1216
+ /* 40 */
1217
+ /***/ (function(module, exports) {
1218
+
1219
+ module.exports = require("@splunk/async-dynamic-options-evaluator");
1220
+
1221
+ /***/ }),
1222
+ /* 41 */
1137
1223
  /***/ (function(module, exports, __webpack_require__) {
1138
1224
 
1139
1225
  "use strict";
@@ -1151,7 +1237,7 @@ var T = __webpack_require__(0);
1151
1237
 
1152
1238
  var lodash_1 = __webpack_require__(3);
1153
1239
 
1154
- var VizActionHandler_1 = __webpack_require__(38); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1240
+ var VizActionHandler_1 = __webpack_require__(42); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1155
1241
 
1156
1242
 
1157
1243
  exports.INITIAL_WIDTH = 250;
@@ -1284,7 +1370,7 @@ SplunkVisualization.defaultProps = {
1284
1370
  exports.default = SplunkVisualization;
1285
1371
 
1286
1372
  /***/ }),
1287
- /* 38 */
1373
+ /* 42 */
1288
1374
  /***/ (function(module, exports, __webpack_require__) {
1289
1375
 
1290
1376
  "use strict";
@@ -1292,7 +1378,7 @@ exports.default = SplunkVisualization;
1292
1378
 
1293
1379
  var _classCallCheck = __webpack_require__(11);
1294
1380
 
1295
- var _createClass = __webpack_require__(19);
1381
+ var _createClass = __webpack_require__(20);
1296
1382
 
1297
1383
  Object.defineProperty(exports, "__esModule", {
1298
1384
  value: true
@@ -1321,7 +1407,7 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
1321
1407
  exports.DefaultVizActionHandler = DefaultVizActionHandler;
1322
1408
 
1323
1409
  /***/ }),
1324
- /* 39 */
1410
+ /* 43 */
1325
1411
  /***/ (function(module, exports, __webpack_require__) {
1326
1412
 
1327
1413
  "use strict";
@@ -1334,7 +1420,7 @@ exports.validSortDirs = void 0;
1334
1420
  exports.validSortDirs = ['asc', 'desc', 'none'];
1335
1421
 
1336
1422
  /***/ }),
1337
- /* 40 */
1423
+ /* 44 */
1338
1424
  /***/ (function(module, exports, __webpack_require__) {
1339
1425
 
1340
1426
  "use strict";
@@ -1379,7 +1465,7 @@ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1379
1465
  exports.useDeepMemo = useDeepMemo;
1380
1466
 
1381
1467
  /***/ }),
1382
- /* 41 */
1468
+ /* 45 */
1383
1469
  /***/ (function(module, exports, __webpack_require__) {
1384
1470
 
1385
1471
  "use strict";
@@ -1459,7 +1545,7 @@ exports.MissingPropsMessage.defaultProps = {
1459
1545
  exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
1460
1546
 
1461
1547
  /***/ }),
1462
- /* 42 */
1548
+ /* 46 */
1463
1549
  /***/ (function(module, exports, __webpack_require__) {
1464
1550
 
1465
1551
  "use strict";
@@ -1480,7 +1566,7 @@ var Cover = styled_components_1.default.div.withConfig({
1480
1566
  componentId: "sc-1gsbnxb-0"
1481
1567
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1482
1568
  var Blocker = styled_components_1.default.div.attrs({
1483
- 'data-splunk-visualization-version': "25.5.0 - 12c0447a7"
1569
+ 'data-splunk-visualization-version': "25.6.0 - f5eb3abf9"
1484
1570
  }).withConfig({
1485
1571
  displayName: "withEditModeCover__Blocker",
1486
1572
  componentId: "sc-1gsbnxb-1"
@@ -1511,7 +1597,7 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
1511
1597
  exports.default = withEditModeCover;
1512
1598
 
1513
1599
  /***/ }),
1514
- /* 43 */
1600
+ /* 47 */
1515
1601
  /***/ (function(module, exports, __webpack_require__) {
1516
1602
 
1517
1603
  "use strict";
@@ -1527,7 +1613,7 @@ var colorUtils_1 = __webpack_require__(12);
1527
1613
 
1528
1614
  var variables_1 = __webpack_require__(9);
1529
1615
 
1530
- var IconPlaceholder_1 = __webpack_require__(27);
1616
+ var IconPlaceholder_1 = __webpack_require__(30);
1531
1617
 
1532
1618
  var VizBehavior_1 = __webpack_require__(6);
1533
1619
 
@@ -1575,22 +1661,22 @@ var withPlaceholder = function withPlaceholder(Visualization) {
1575
1661
  exports.default = withPlaceholder;
1576
1662
 
1577
1663
  /***/ }),
1578
- /* 44 */
1664
+ /* 48 */
1579
1665
  /***/ (function(module, exports) {
1580
1666
 
1581
1667
  module.exports = require("@splunk/visualization-icons/placeholders");
1582
1668
 
1583
1669
  /***/ }),
1584
- /* 45 */,
1585
- /* 46 */,
1586
- /* 47 */
1670
+ /* 49 */,
1671
+ /* 50 */,
1672
+ /* 51 */
1587
1673
  /***/ (function(module, exports) {
1588
1674
 
1589
1675
  module.exports = require("@splunk/visualization-icons");
1590
1676
 
1591
1677
  /***/ }),
1592
- /* 48 */,
1593
- /* 49 */
1678
+ /* 52 */,
1679
+ /* 53 */
1594
1680
  /***/ (function(module, exports, __webpack_require__) {
1595
1681
 
1596
1682
  "use strict";
@@ -1620,15 +1706,6 @@ var background = function background(_ref) {
1620
1706
  exports.default = background;
1621
1707
 
1622
1708
  /***/ }),
1623
- /* 50 */,
1624
- /* 51 */
1625
- /***/ (function(module, exports) {
1626
-
1627
- module.exports = require("@babel/runtime/helpers/slicedToArray");
1628
-
1629
- /***/ }),
1630
- /* 52 */,
1631
- /* 53 */,
1632
1709
  /* 54 */,
1633
1710
  /* 55 */,
1634
1711
  /* 56 */,
@@ -1644,15 +1721,15 @@ module.exports = require("@babel/runtime/helpers/slicedToArray");
1644
1721
  /* 66 */,
1645
1722
  /* 67 */,
1646
1723
  /* 68 */,
1647
- /* 69 */
1724
+ /* 69 */,
1725
+ /* 70 */,
1726
+ /* 71 */,
1727
+ /* 72 */
1648
1728
  /***/ (function(module, exports) {
1649
1729
 
1650
1730
  module.exports = require("@splunk/themes");
1651
1731
 
1652
1732
  /***/ }),
1653
- /* 70 */,
1654
- /* 71 */,
1655
- /* 72 */,
1656
1733
  /* 73 */,
1657
1734
  /* 74 */,
1658
1735
  /* 75 */,
@@ -1662,27 +1739,27 @@ module.exports = require("@splunk/themes");
1662
1739
  /* 79 */,
1663
1740
  /* 80 */,
1664
1741
  /* 81 */,
1665
- /* 82 */
1742
+ /* 82 */,
1743
+ /* 83 */,
1744
+ /* 84 */
1666
1745
  /***/ (function(module, exports) {
1667
1746
 
1668
- module.exports = require("@splunk/visualizations-shared/dataSourceUtils");
1747
+ module.exports = require("@splunk/react-ui/Popover");
1669
1748
 
1670
1749
  /***/ }),
1671
- /* 83 */
1750
+ /* 85 */,
1751
+ /* 86 */
1672
1752
  /***/ (function(module, exports) {
1673
1753
 
1674
- module.exports = require("@babel/runtime/helpers/typeof");
1754
+ module.exports = require("@splunk/visualizations-shared/dataSourceUtils");
1675
1755
 
1676
1756
  /***/ }),
1677
- /* 84 */
1757
+ /* 87 */
1678
1758
  /***/ (function(module, exports) {
1679
1759
 
1680
- module.exports = require("@splunk/react-ui/Popover");
1760
+ module.exports = require("@babel/runtime/helpers/typeof");
1681
1761
 
1682
1762
  /***/ }),
1683
- /* 85 */,
1684
- /* 86 */,
1685
- /* 87 */,
1686
1763
  /* 88 */,
1687
1764
  /* 89 */,
1688
1765
  /* 90 */,
@@ -1704,13 +1781,308 @@ module.exports = require("@splunk/react-ui/Popover");
1704
1781
  /* 106 */,
1705
1782
  /* 107 */,
1706
1783
  /* 108 */,
1707
- /* 109 */
1784
+ /* 109 */,
1785
+ /* 110 */,
1786
+ /* 111 */
1708
1787
  /***/ (function(module, exports) {
1709
1788
 
1710
1789
  module.exports = require("@splunk/react-ui/Menu");
1711
1790
 
1712
1791
  /***/ }),
1713
- /* 110 */
1792
+ /* 112 */
1793
+ /***/ (function(module, exports, __webpack_require__) {
1794
+
1795
+ "use strict";
1796
+
1797
+
1798
+ var _slicedToArray = __webpack_require__(17);
1799
+
1800
+ var _defineProperty = __webpack_require__(7);
1801
+
1802
+ Object.defineProperty(exports, "__esModule", {
1803
+ value: true
1804
+ });
1805
+ exports.getCustomTimeInterval = exports.getPredefinedTimeInterval = exports.getEpochTime = exports.generateTokenReplacementMap = exports.replaceTokens = exports.mergeFieldActions = exports.mergeEventActions = exports.getFieldSummaryMapping = exports.convertToPayloadFormat = void 0;
1806
+
1807
+ var time_1 = __webpack_require__(193);
1808
+
1809
+ var lodash_1 = __webpack_require__(3);
1810
+
1811
+ var dataUtils_1 = __webpack_require__(113); // util to convert a field-value map into an object with row.<fieldname>.value keys for payloads
1812
+
1813
+
1814
+ var convertToPayloadFormat = function convertToPayloadFormat(obj) {
1815
+ var initialValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1816
+ if (!obj) return {};
1817
+ return Object.keys(obj).reduce(function (acc, curr) {
1818
+ var key = "row.".concat(curr, ".value");
1819
+ return Object.assign(Object.assign({}, acc), _defineProperty({}, key, obj[curr]));
1820
+ }, initialValue);
1821
+ };
1822
+
1823
+ exports.convertToPayloadFormat = convertToPayloadFormat;
1824
+
1825
+ var getFieldSummaryMapping = function getFieldSummaryMapping(columns, fields) {
1826
+ // convert the `fieldsummary` payload to an array of objects
1827
+ var arr = dataUtils_1.convertToArrOfObjects(columns, fields); // forms an array of FieldData elements expected by the @splunk/react-field-summary component
1828
+
1829
+ var fieldSummaryData = arr.map(function (d) {
1830
+ return {
1831
+ name: d.field,
1832
+ count: +d.count,
1833
+ distinctCount: +d.distinct_count,
1834
+ numericCount: +d.numeric_count,
1835
+ max: d.max === null ? null : +d.max,
1836
+ mean: d.mean === null ? null : +d.mean,
1837
+ min: d.min === null ? null : +d.min,
1838
+ stdev: d.stdev === null ? null : +d.stdev,
1839
+ modes: JSON.parse(d.values)
1840
+ };
1841
+ }); // creates a map of field name to its data for O(1) retrieval in the tooltip component
1842
+
1843
+ var fieldSummaryMapping = fieldSummaryData.reduce(function (map, fieldData) {
1844
+ return Object.assign(Object.assign({}, map), _defineProperty({}, fieldData.name, fieldData));
1845
+ }, {});
1846
+ return fieldSummaryMapping;
1847
+ };
1848
+
1849
+ exports.getFieldSummaryMapping = getFieldSummaryMapping;
1850
+ /**
1851
+ * Helper to merge event actions into one array of event actions.
1852
+ * @method mergeEventActions
1853
+ * @param {Action[]} fieldActions1
1854
+ * @param {Action[]} fieldActions2
1855
+ * @returns {Action[]} merged event actions
1856
+ */
1857
+
1858
+ var mergeEventActions = function mergeEventActions(eventActions1, eventActions2) {
1859
+ return eventActions1.concat(eventActions2);
1860
+ };
1861
+
1862
+ exports.mergeEventActions = mergeEventActions;
1863
+ /**
1864
+ * Helper to merge field actions. If same key exists in both field actions,
1865
+ * combine each array of actions under one key.
1866
+ * @method mergeFieldActions
1867
+ * @param {Record<string, Action[]>} fieldActions1
1868
+ * @param {Record<string, Action[]>} fieldActions2
1869
+ * @returns {Record<string, Action[]>} merged field actions
1870
+ */
1871
+
1872
+ var mergeFieldActions = function mergeFieldActions(fieldActions1, fieldActions2) {
1873
+ return lodash_1.mergeWith(Object.assign({}, fieldActions1), fieldActions2, function (fieldAction1value, fieldAction2value) {
1874
+ return Array.isArray(fieldAction1value) && Array.isArray(fieldAction2value) ? lodash_1.union(fieldAction1value, fieldAction2value) : undefined;
1875
+ });
1876
+ };
1877
+
1878
+ exports.mergeFieldActions = mergeFieldActions;
1879
+ /**
1880
+ * Helper to replace all tokens from the tokenReplacementMap in text with their corresponding values.
1881
+ * Special parameters will only be escaped if allowSpecialParametersEscape is true.
1882
+ * Field values will only be escaped if allowFieldValuesEscape is true, and the field does not begin with `!`.
1883
+ * https://dev.splunk.com/enterprise/docs/devtools/customworkflowactions/#Prevent-field-value-escape
1884
+ *
1885
+ * @method replaceTokens
1886
+ * @param {string} text
1887
+ * @param {TokenReplacementMap} tokenReplacementMap
1888
+ * @param {boolean} allowSpecialParametersEscape
1889
+ * @param {boolean} allowFieldValuesEscape
1890
+ * @returns {string} text with replaced tokens
1891
+ */
1892
+
1893
+ var replaceTokens = function replaceTokens(_ref) {
1894
+ var text = _ref.text,
1895
+ tokenReplacementMap = _ref.tokenReplacementMap,
1896
+ allowSpecialParametersEscape = _ref.allowSpecialParametersEscape,
1897
+ allowFieldValuesEscape = _ref.allowFieldValuesEscape;
1898
+ var replacedText = text; // replace special parameters
1899
+
1900
+ Object.entries(tokenReplacementMap.specialParameters).forEach(function (_ref2) {
1901
+ var _ref3 = _slicedToArray(_ref2, 2),
1902
+ tokenName = _ref3[0],
1903
+ tokenValue = _ref3[1];
1904
+
1905
+ var maybeEscapedTokenValue = allowSpecialParametersEscape ? encodeURIComponent(tokenValue) : tokenValue;
1906
+ replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue);
1907
+ }); // replace field values
1908
+
1909
+ Object.entries(tokenReplacementMap.fields).forEach(function (_ref4) {
1910
+ var _ref5 = _slicedToArray(_ref4, 2),
1911
+ tokenName = _ref5[0],
1912
+ tokenValue = _ref5[1];
1913
+
1914
+ // when allowFieldValuesEscape is true, replace field with escaped value
1915
+ var maybeEscapedTokenValue = allowFieldValuesEscape ? encodeURIComponent(tokenValue) : tokenValue;
1916
+ replacedText = replacedText.split("$".concat(tokenName, "$")).join(maybeEscapedTokenValue); // If field starts with `!`, always replace with the unescaped value
1917
+
1918
+ replacedText = replacedText.split("$!".concat(tokenName, "$")).join(tokenValue);
1919
+ });
1920
+ return replacedText;
1921
+ };
1922
+
1923
+ exports.replaceTokens = replaceTokens;
1924
+ /**
1925
+ * Generate a token replacement map taking into account Special Parameters and field replacements.
1926
+ */
1927
+
1928
+ var generateTokenReplacementMap = function generateTokenReplacementMap(_ref6) {
1929
+ var dataSources = _ref6.dataSources,
1930
+ rowIndex = _ref6.rowIndex,
1931
+ pageNumber = _ref6.pageNumber,
1932
+ field = _ref6.field,
1933
+ value = _ref6.value,
1934
+ _ref6$event = _ref6.event,
1935
+ event = _ref6$event === void 0 ? {} : _ref6$event;
1936
+
1937
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1938
+
1939
+ var tokenReplacementMap = {
1940
+ specialParameters: {},
1941
+ fields: {}
1942
+ }; // Map special parameters for workflow actions with values
1943
+ // Note that @latest_time will not be supported since it does not work in sxml
1944
+ // https://dev.splunk.com/enterprise/docs/devtools/customworkflowactions/#Special-parameters
1945
+
1946
+ 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;
1947
+ var offset = rowIndex !== undefined && pageNumber !== undefined && count !== undefined ? rowIndex + count * (pageNumber - 1) : undefined;
1948
+
1949
+ if (offset !== undefined) {
1950
+ tokenReplacementMap.specialParameters['@offset'] = String(offset);
1951
+ }
1952
+
1953
+ 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) {
1954
+ 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;
1955
+ }
1956
+
1957
+ 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) {
1958
+ 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;
1959
+ }
1960
+
1961
+ if (field) {
1962
+ tokenReplacementMap.specialParameters['@field_name'] = field;
1963
+ }
1964
+
1965
+ if (value) {
1966
+ tokenReplacementMap.specialParameters['@field_value'] = value;
1967
+ } // Map fields with field values
1968
+
1969
+
1970
+ Object.entries(event).forEach(function (_ref7) {
1971
+ var _ref8 = _slicedToArray(_ref7, 2),
1972
+ fieldName = _ref8[0],
1973
+ fieldValue = _ref8[1];
1974
+
1975
+ // TODO handle _raw and _time cases
1976
+ // https://cd.splunkdev.com/eui/splunkcore-web-ui/-/blob/develop/web_v2/search_mrsparkle/exposed/js/models/services/data/ui/WorkflowAction.js#L32
1977
+ tokenReplacementMap.fields["".concat(fieldName)] = typeof fieldValue === 'string' ? fieldValue : JSON.stringify(fieldValue);
1978
+ });
1979
+ return tokenReplacementMap;
1980
+ };
1981
+
1982
+ exports.generateTokenReplacementMap = generateTokenReplacementMap; // return epoch unix timestamp in seconds
1983
+
1984
+ var getEpochTime = function getEpochTime(time) {
1985
+ // if not a valid time string, then indicate an error and return NaN.
1986
+ if (!time_1.isISO(time)) {
1987
+ console.error("'".concat(time, "' is not a valid time string."));
1988
+ return NaN;
1989
+ } // retrieves the epoch time in milliseconds, and divides by 1000
1990
+
1991
+
1992
+ return new Date(time).getTime() / 1000;
1993
+ };
1994
+
1995
+ exports.getEpochTime = getEpochTime;
1996
+ /**
1997
+ * Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks a predefined control in the Time Controls Popover
1998
+ * (Before this time/After this time/At this time). If `Before this time` is selected, the time window only includes `latest`, as there is
1999
+ * no `earliest` start time, and adds a 0.001 increment is order to capture all events at `time`. If `After this time` is selected, the
2000
+ * window is from `time` to `now`. If `At this time` is selected, the window starts at `time` (in epoch time) and ends at `time` plus 0.001
2001
+ * in order to include all events at `time`.
2002
+ * @method getPredefinedTimeInterval
2003
+ * @param {string} time
2004
+ * @param {('before'|'after'|'at')} when
2005
+ * @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time
2006
+ */
2007
+
2008
+ var getPredefinedTimeInterval = function getPredefinedTimeInterval(_ref9) {
2009
+ var time = _ref9.time,
2010
+ when = _ref9.when;
2011
+ var epochTime = exports.getEpochTime(time);
2012
+
2013
+ switch (when) {
2014
+ case 'before':
2015
+ return {
2016
+ latest: epochTime + 0.001
2017
+ };
2018
+
2019
+ case 'after':
2020
+ return {
2021
+ earliest: epochTime,
2022
+ latest: 'now'
2023
+ };
2024
+
2025
+ case 'at':
2026
+ return {
2027
+ earliest: epochTime,
2028
+ latest: epochTime + 0.001
2029
+ };
2030
+
2031
+ default:
2032
+ // returns 'at' interval by default
2033
+ return {
2034
+ earliest: epochTime,
2035
+ latest: epochTime + 0.001
2036
+ };
2037
+ }
2038
+ };
2039
+
2040
+ exports.getPredefinedTimeInterval = getPredefinedTimeInterval;
2041
+ /**
2042
+ * Helper to calculate the start (`earliest`) and end (`latest`) times when user clicks `Apply` in the Time Controls Popover.
2043
+ * If the `plusminus` type is selected, the window expands either way with the `time` as a midpoint, and amount and interval length
2044
+ * dependent on `rangeAmount` and `rangeUnit`. `plus` indicates starting at `time` and `minus` indicates ending at `time`.
2045
+ * To match sXML behavior, the time interval is converted to epoch time and 0.001 is added to the `latest` time to ensure the
2046
+ * time window is inclusive of the end time.
2047
+ * @method getCustomTimeInterval
2048
+ * @param {string} time
2049
+ * @param {string} rangeType
2050
+ * @param {string} rangeAmount
2051
+ * @param {string} rangeUnit
2052
+ * @returns {TimeInterval} interval with `earliest` and `latest` defined in epoch time
2053
+ */
2054
+
2055
+ var getCustomTimeInterval = function getCustomTimeInterval(_ref10) {
2056
+ var time = _ref10.time,
2057
+ rangeType = _ref10.rangeType,
2058
+ rangeAmount = _ref10.rangeAmount,
2059
+ rangeUnit = _ref10.rangeUnit;
2060
+ var timeRange = time_1.getAcceleratedTimeRange(time, rangeAmount, rangeUnit);
2061
+ var timeInterval;
2062
+
2063
+ if (rangeType === 'plusminus') {
2064
+ timeInterval = Object.assign({}, timeRange);
2065
+ } else if (rangeType === 'plus') {
2066
+ timeInterval = Object.assign(Object.assign({}, timeRange), {
2067
+ earliest: time
2068
+ });
2069
+ } else if (rangeType === 'minus') {
2070
+ timeInterval = Object.assign(Object.assign({}, timeRange), {
2071
+ latest: time
2072
+ });
2073
+ } // converts to use epoch time in the interval, and adds 0.001 to `latest` per spec
2074
+
2075
+
2076
+ return {
2077
+ earliest: exports.getEpochTime(timeInterval.earliest),
2078
+ latest: exports.getEpochTime(timeInterval.latest) + 0.001
2079
+ };
2080
+ };
2081
+
2082
+ exports.getCustomTimeInterval = getCustomTimeInterval;
2083
+
2084
+ /***/ }),
2085
+ /* 113 */
1714
2086
  /***/ (function(module, exports, __webpack_require__) {
1715
2087
 
1716
2088
  "use strict";
@@ -1749,18 +2121,30 @@ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
1749
2121
  exports.convertToArrOfObjects = convertToArrOfObjects;
1750
2122
 
1751
2123
  /***/ }),
1752
- /* 111 */
2124
+ /* 114 */
1753
2125
  /***/ (function(module, exports) {
1754
2126
 
1755
2127
  module.exports = require("@splunk/react-ui/Markdown");
1756
2128
 
1757
2129
  /***/ }),
1758
- /* 112 */,
1759
- /* 113 */,
1760
- /* 114 */,
1761
- /* 115 */,
1762
- /* 116 */,
1763
- /* 117 */,
2130
+ /* 115 */
2131
+ /***/ (function(module, exports) {
2132
+
2133
+ module.exports = require("@splunk/react-ui/Button");
2134
+
2135
+ /***/ }),
2136
+ /* 116 */
2137
+ /***/ (function(module, exports) {
2138
+
2139
+ module.exports = require("@splunk/react-ui/Message");
2140
+
2141
+ /***/ }),
2142
+ /* 117 */
2143
+ /***/ (function(module, exports) {
2144
+
2145
+ module.exports = require("@splunk/react-ui/Heading");
2146
+
2147
+ /***/ }),
1764
2148
  /* 118 */,
1765
2149
  /* 119 */,
1766
2150
  /* 120 */,
@@ -1775,7 +2159,13 @@ module.exports = require("@splunk/react-ui/Markdown");
1775
2159
  /* 129 */,
1776
2160
  /* 130 */,
1777
2161
  /* 131 */,
1778
- /* 132 */
2162
+ /* 132 */,
2163
+ /* 133 */,
2164
+ /* 134 */,
2165
+ /* 135 */,
2166
+ /* 136 */,
2167
+ /* 137 */,
2168
+ /* 138 */
1779
2169
  /***/ (function(module, exports, __webpack_require__) {
1780
2170
 
1781
2171
  "use strict";
@@ -1797,23 +2187,32 @@ var __rest = this && this.__rest || function (s, e) {
1797
2187
  Object.defineProperty(exports, "__esModule", {
1798
2188
  value: true
1799
2189
  });
1800
- exports.PureEvents = exports.config = exports.themes = exports.computeVizProps = exports.showPlaceHolderIcon = void 0;
2190
+ exports.replaceTokens = exports.PureEvents = exports.config = exports.themes = exports.computeVizProps = exports.showPlaceHolderIcon = void 0;
1801
2191
 
1802
2192
  var lodash_1 = __webpack_require__(3);
1803
2193
 
1804
- var dataSourceUtils_1 = __webpack_require__(82);
2194
+ var dataSourceUtils_1 = __webpack_require__(86);
1805
2195
 
1806
- var withDashboardViz_1 = __webpack_require__(32);
2196
+ var withDashboardViz_1 = __webpack_require__(35);
1807
2197
 
1808
- var constants_1 = __webpack_require__(133);
2198
+ var constants_1 = __webpack_require__(139);
1809
2199
 
1810
- var config_1 = __webpack_require__(184);
2200
+ var config_1 = __webpack_require__(190);
1811
2201
 
1812
2202
  exports.config = config_1.default;
1813
2203
 
1814
- var PureEvents_1 = __webpack_require__(185);
2204
+ var PureEvents_1 = __webpack_require__(191);
1815
2205
 
1816
2206
  exports.PureEvents = PureEvents_1.default;
2207
+
2208
+ var EventUtils_1 = __webpack_require__(112);
2209
+
2210
+ Object.defineProperty(exports, "replaceTokens", {
2211
+ enumerable: true,
2212
+ get: function get() {
2213
+ return EventUtils_1.replaceTokens;
2214
+ }
2215
+ });
1817
2216
  /**
1818
2217
  * @method showPlaceHolderIcon
1819
2218
  * @param {Object} dataSources
@@ -1856,7 +2255,7 @@ exports.themes = themes;
1856
2255
  exports.default = Events;
1857
2256
 
1858
2257
  /***/ }),
1859
- /* 133 */
2258
+ /* 139 */
1860
2259
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1861
2260
 
1862
2261
  "use strict";
@@ -1867,7 +2266,7 @@ __webpack_require__.r(__webpack_exports__);
1867
2266
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY_DATASOURCE", function() { return EMPTY_DATASOURCE; });
1868
2267
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELDSUMMARY_DS_STORYBOOK", function() { return FIELDSUMMARY_DS_STORYBOOK; });
1869
2268
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELDSUMMARY_DS_DOC_HUB", function() { return FIELDSUMMARY_DS_DOC_HUB; });
1870
- /* harmony import */ var _splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(152);
2269
+ /* harmony import */ var _splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(158);
1871
2270
  /* harmony import */ var _splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_splunk_datasource_utils_DataSet__WEBPACK_IMPORTED_MODULE_0__);
1872
2271
  // TODO: convert this file to .ts - created as .js as copied from SUI EventsViewer repo
1873
2272
 
@@ -2316,18 +2715,12 @@ var FIELDSUMMARY_DS_DOC_HUB = {
2316
2715
  };
2317
2716
 
2318
2717
  /***/ }),
2319
- /* 134 */
2718
+ /* 140 */
2320
2719
  /***/ (function(module, exports) {
2321
2720
 
2322
2721
  module.exports = require("@splunk/visualization-context/EventsContext");
2323
2722
 
2324
2723
  /***/ }),
2325
- /* 135 */,
2326
- /* 136 */,
2327
- /* 137 */,
2328
- /* 138 */,
2329
- /* 139 */,
2330
- /* 140 */,
2331
2724
  /* 141 */,
2332
2725
  /* 142 */,
2333
2726
  /* 143 */,
@@ -2339,18 +2732,18 @@ module.exports = require("@splunk/visualization-context/EventsContext");
2339
2732
  /* 149 */,
2340
2733
  /* 150 */,
2341
2734
  /* 151 */,
2342
- /* 152 */
2343
- /***/ (function(module, exports) {
2344
-
2345
- module.exports = require("@splunk/datasource-utils/DataSet");
2346
-
2347
- /***/ }),
2735
+ /* 152 */,
2348
2736
  /* 153 */,
2349
2737
  /* 154 */,
2350
2738
  /* 155 */,
2351
2739
  /* 156 */,
2352
2740
  /* 157 */,
2353
- /* 158 */,
2741
+ /* 158 */
2742
+ /***/ (function(module, exports) {
2743
+
2744
+ module.exports = require("@splunk/datasource-utils/DataSet");
2745
+
2746
+ /***/ }),
2354
2747
  /* 159 */,
2355
2748
  /* 160 */,
2356
2749
  /* 161 */,
@@ -2375,7 +2768,13 @@ module.exports = require("@splunk/datasource-utils/DataSet");
2375
2768
  /* 180 */,
2376
2769
  /* 181 */,
2377
2770
  /* 182 */,
2378
- /* 183 */
2771
+ /* 183 */,
2772
+ /* 184 */,
2773
+ /* 185 */,
2774
+ /* 186 */,
2775
+ /* 187 */,
2776
+ /* 188 */,
2777
+ /* 189 */
2379
2778
  /***/ (function(module, exports, __webpack_require__) {
2380
2779
 
2381
2780
  "use strict";
@@ -2405,9 +2804,9 @@ Object.defineProperty(exports, "__esModule", {
2405
2804
  });
2406
2805
  exports.default = void 0;
2407
2806
 
2408
- __exportStar(__webpack_require__(132), exports);
2807
+ __exportStar(__webpack_require__(138), exports);
2409
2808
 
2410
- var Events_1 = __webpack_require__(132);
2809
+ var Events_1 = __webpack_require__(138);
2411
2810
 
2412
2811
  Object.defineProperty(exports, "default", {
2413
2812
  enumerable: true,
@@ -2417,7 +2816,7 @@ Object.defineProperty(exports, "default", {
2417
2816
  });
2418
2817
 
2419
2818
  /***/ }),
2420
- /* 184 */
2819
+ /* 190 */
2421
2820
  /***/ (function(module, exports, __webpack_require__) {
2422
2821
 
2423
2822
  "use strict";
@@ -2427,23 +2826,23 @@ Object.defineProperty(exports, "__esModule", {
2427
2826
  value: true
2428
2827
  });
2429
2828
 
2430
- var visualization_icons_1 = __webpack_require__(47);
2829
+ var visualization_icons_1 = __webpack_require__(51);
2431
2830
 
2432
- var placeholders_1 = __webpack_require__(44);
2831
+ var placeholders_1 = __webpack_require__(48);
2433
2832
 
2434
2833
  var schemaUtils_1 = __webpack_require__(16);
2435
2834
 
2436
- var themes_1 = __webpack_require__(69);
2835
+ var themes_1 = __webpack_require__(72);
2437
2836
 
2438
2837
  var i18n_1 = __webpack_require__(2);
2439
2838
 
2440
2839
  var VizBehavior_1 = __webpack_require__(6);
2441
2840
 
2442
- var VizCategory_1 = __webpack_require__(31);
2841
+ var VizCategory_1 = __webpack_require__(34);
2443
2842
 
2444
- var configUtils_1 = __webpack_require__(17);
2843
+ var configUtils_1 = __webpack_require__(18);
2445
2844
 
2446
- var BackgroundColor_1 = __webpack_require__(49);
2845
+ var BackgroundColor_1 = __webpack_require__(53);
2447
2846
 
2448
2847
  var defaultContext = {};
2449
2848
  var dataContract = {
@@ -2587,6 +2986,9 @@ var config = {
2587
2986
  },
2588
2987
  'value.click': {
2589
2988
  description: 'Triggered when a user clicks a value in an event.'
2989
+ },
2990
+ 'time.click': {
2991
+ description: 'Triggered when a user clicks to drilldown in the time controls popover.'
2590
2992
  }
2591
2993
  },
2592
2994
  supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS, VizBehavior_1.VizBehavior.PLACEHOLDER],
@@ -2596,15 +2998,15 @@ var config = {
2596
2998
  exports.default = configUtils_1.enhanceConfig(config);
2597
2999
 
2598
3000
  /***/ }),
2599
- /* 185 */
3001
+ /* 191 */
2600
3002
  /***/ (function(module, exports, __webpack_require__) {
2601
3003
 
2602
3004
  "use strict";
2603
3005
 
2604
3006
 
2605
- var _typeof = __webpack_require__(83);
3007
+ var _typeof = __webpack_require__(87);
2606
3008
 
2607
- var _slicedToArray = __webpack_require__(51);
3009
+ var _slicedToArray = __webpack_require__(17);
2608
3010
 
2609
3011
  Object.defineProperty(exports, "__esModule", {
2610
3012
  value: true
@@ -2616,11 +3018,11 @@ var react_1 = __webpack_require__(1);
2616
3018
 
2617
3019
  var T = __webpack_require__(0);
2618
3020
 
2619
- var EventsViewer_1 = __webpack_require__(186);
3021
+ var EventsViewer_1 = __webpack_require__(192);
2620
3022
 
2621
3023
  var styled_components_1 = __webpack_require__(4);
2622
3024
 
2623
- var pick_1 = __webpack_require__(21);
3025
+ var pick_1 = __webpack_require__(22);
2624
3026
 
2625
3027
  var variables_1 = __webpack_require__(9);
2626
3028
 
@@ -2628,19 +3030,21 @@ var colorUtils_1 = __webpack_require__(12);
2628
3030
 
2629
3031
  var style_1 = __webpack_require__(15);
2630
3032
 
2631
- var EventsContext_1 = __webpack_require__(134);
3033
+ var EventsContext_1 = __webpack_require__(140);
2632
3034
 
2633
3035
  var lodash_1 = __webpack_require__(3);
2634
3036
 
2635
- var Menu_1 = __webpack_require__(109);
3037
+ var Menu_1 = __webpack_require__(111);
2636
3038
 
2637
- var constants_1 = __webpack_require__(133);
3039
+ var constants_1 = __webpack_require__(139);
2638
3040
 
2639
3041
  var FixedSizeContainer_1 = __webpack_require__(13);
2640
3042
 
2641
- var EventUtils_1 = __webpack_require__(187);
3043
+ var EventUtils_1 = __webpack_require__(112);
2642
3044
 
2643
- var FieldSummaryTooltip_1 = __webpack_require__(188); // Inspired by VizTableContainer in PureTable.tsx
3045
+ var FieldSummaryTooltip_1 = __webpack_require__(194);
3046
+
3047
+ var TimeControlsPopover_1 = __webpack_require__(196); // Inspired by VizTableContainer in PureTable.tsx
2644
3048
 
2645
3049
 
2646
3050
  var EventsContainer = styled_components_1.default.div.withConfig({
@@ -2688,9 +3092,12 @@ var PureEvents = function PureEvents(props) {
2688
3092
  var width = props.width,
2689
3093
  height = props.height,
2690
3094
  backgroundColor = props.backgroundColor,
2691
- dataSources = props.dataSources,
2692
- eventActionsProps = props.eventActions,
2693
- fieldActionsProps = props.fieldActions,
3095
+ _props$dataSources = props.dataSources,
3096
+ dataSources = _props$dataSources === void 0 ? {} : _props$dataSources,
3097
+ _props$eventActions = props.eventActions,
3098
+ eventActionsProps = _props$eventActions === void 0 ? [] : _props$eventActions,
3099
+ _props$fieldActions = props.fieldActions,
3100
+ fieldActionsProps = _props$fieldActions === void 0 ? {} : _props$fieldActions,
2694
3101
  showFieldSummary = props.showFieldSummary,
2695
3102
  footerFields = props.footerFields,
2696
3103
  highlightValuesByField = props.highlightValuesByField,
@@ -2731,16 +3138,28 @@ var PureEvents = function PureEvents(props) {
2731
3138
  var _React$useState3 = React.useState(null),
2732
3139
  _React$useState4 = _slicedToArray(_React$useState3, 2),
2733
3140
  fieldSummaryAnchor = _React$useState4[0],
2734
- setFieldSummaryAnchor = _React$useState4[1]; // creates array menu components to display in the Event Actions dropdown
3141
+ setFieldSummaryAnchor = _React$useState4[1];
3142
+
3143
+ var _React$useState5 = React.useState(null),
3144
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
3145
+ timeValue = _React$useState6[0],
3146
+ setTimeValue = _React$useState6[1];
3147
+
3148
+ var _React$useState7 = React.useState(null),
3149
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
3150
+ timeFieldAnchor = _React$useState8[0],
3151
+ setTimeFieldAnchor = _React$useState8[1]; // creates array menu components to display in the Event Actions dropdown
2735
3152
 
2736
3153
 
2737
3154
  var renderEventActions = React.useMemo(function () {
2738
- return !Array.isArray(eventActions) || eventActions.length === 0 ? null : eventActions.map(function (_ref2) {
3155
+ return !Array.isArray(eventActions) ? [] : eventActions.map(function (_ref2) {
2739
3156
  var eventType = _ref2.eventType,
2740
3157
  label = _ref2.label;
2741
3158
 
2742
- var onMenuItemClick = function onMenuItemClick(e) {
2743
- var payload = EventUtils_1.convertToPayloadFormat(e.event);
3159
+ var onMenuItemClick = function onMenuItemClick(e, eventActionProps, tokenReplacementMap) {
3160
+ var payload = EventUtils_1.convertToPayloadFormat(eventActionProps.event, {
3161
+ tokenReplacementMap: tokenReplacementMap
3162
+ });
2744
3163
  onEventTrigger({
2745
3164
  originalEvent: e,
2746
3165
  type: eventType,
@@ -2749,31 +3168,50 @@ var PureEvents = function PureEvents(props) {
2749
3168
  }; // eslint-disable-next-line react/display-name
2750
3169
 
2751
3170
 
2752
- return function (event) {
3171
+ return function (eventActionProps) {
3172
+ var rowIndex = eventActionProps.rowIndex,
3173
+ pageNumber = eventActionProps.pageNumber,
3174
+ event = eventActionProps.event;
3175
+ var tokenReplacementMap = EventUtils_1.generateTokenReplacementMap({
3176
+ dataSources: dataSources,
3177
+ rowIndex: rowIndex,
3178
+ pageNumber: pageNumber,
3179
+ event: event
3180
+ });
3181
+ var replacedLabel = EventUtils_1.replaceTokens({
3182
+ text: label,
3183
+ tokenReplacementMap: tokenReplacementMap,
3184
+ allowSpecialParametersEscape: false,
3185
+ allowFieldValuesEscape: false
3186
+ });
2753
3187
  return React.createElement(Menu_1.default.Item, {
2754
- key: "event-action-".concat(label),
2755
- onClick: function onClick() {
2756
- return onMenuItemClick(event);
3188
+ key: "event-action-".concat(replacedLabel),
3189
+ onClick: function onClick(e) {
3190
+ return onMenuItemClick(e, eventActionProps, tokenReplacementMap);
2757
3191
  }
2758
- }, label);
3192
+ }, replacedLabel);
2759
3193
  };
2760
3194
  });
2761
3195
  }, [eventActions]); // creates map of field names to array of menu components to display in its respective dropdown
2762
3196
  // in the Actions column
2763
3197
 
2764
3198
  var renderFieldActions = React.useMemo(function () {
2765
- // undefined hides the Actions column, per logic in SUI EventsViewer
2766
- if (_typeof(fieldActions) !== 'object' || Object.keys(fieldActions).length === 0) return undefined;
2767
- var fieldActionsMap = Object.keys(fieldActions).reduce(function (currFieldActionsMap, fieldName) {
2768
- // eslint-disable-next-line no-param-reassign
2769
- currFieldActionsMap[fieldName] = fieldActions[fieldName].map(function (_ref3) {
2770
- var eventType = _ref3.eventType,
2771
- label = _ref3.label;
2772
-
2773
- var onMenuItemClick = function onMenuItemClick(e) {
2774
- var payload = EventUtils_1.convertToPayloadFormat(e.event, {
2775
- name: e.field,
2776
- value: e.value
3199
+ if (_typeof(fieldActions) !== 'object') return {};
3200
+ var fieldActionsMap = {};
3201
+ Object.entries(fieldActions).forEach(function (_ref3) {
3202
+ var _ref4 = _slicedToArray(_ref3, 2),
3203
+ currentFieldName = _ref4[0],
3204
+ currentFieldActions = _ref4[1];
3205
+
3206
+ fieldActionsMap[currentFieldName] = currentFieldActions.map(function (_ref5) {
3207
+ var eventType = _ref5.eventType,
3208
+ label = _ref5.label;
3209
+
3210
+ var onMenuItemClick = function onMenuItemClick(e, fieldActionProps, tokenReplacementMap) {
3211
+ var payload = EventUtils_1.convertToPayloadFormat(fieldActionProps.event, {
3212
+ name: fieldActionProps.field,
3213
+ value: fieldActionProps.value,
3214
+ tokenReplacementMap: tokenReplacementMap
2777
3215
  });
2778
3216
  onEventTrigger({
2779
3217
  originalEvent: e,
@@ -2783,17 +3221,35 @@ var PureEvents = function PureEvents(props) {
2783
3221
  }; // eslint-disable-next-line react/display-name
2784
3222
 
2785
3223
 
2786
- return function (event) {
3224
+ return function (fieldActionProps) {
3225
+ var field = fieldActionProps.field,
3226
+ value = fieldActionProps.value,
3227
+ rowIndex = fieldActionProps.rowIndex,
3228
+ pageNumber = fieldActionProps.pageNumber,
3229
+ event = fieldActionProps.event;
3230
+ var tokenReplacementMap = EventUtils_1.generateTokenReplacementMap({
3231
+ dataSources: dataSources,
3232
+ rowIndex: rowIndex,
3233
+ pageNumber: pageNumber,
3234
+ field: field,
3235
+ value: value,
3236
+ event: event
3237
+ });
3238
+ var replacedLabel = EventUtils_1.replaceTokens({
3239
+ text: label,
3240
+ tokenReplacementMap: tokenReplacementMap,
3241
+ allowSpecialParametersEscape: false,
3242
+ allowFieldValuesEscape: false
3243
+ });
2787
3244
  return React.createElement(Menu_1.default.Item, {
2788
- key: "".concat(fieldName, "-field-action-").concat(label),
2789
- onClick: function onClick() {
2790
- return onMenuItemClick(event);
3245
+ key: "".concat(currentFieldName, "-field-action-").concat(replacedLabel),
3246
+ onClick: function onClick(e) {
3247
+ return onMenuItemClick(e, fieldActionProps, tokenReplacementMap);
2791
3248
  }
2792
- }, label);
3249
+ }, replacedLabel);
2793
3250
  };
2794
3251
  });
2795
- return currFieldActionsMap;
2796
- }, {});
3252
+ });
2797
3253
  return fieldActionsMap;
2798
3254
  }, [fieldActions]); // formulate the options object required by the SUI EventsViewer component
2799
3255
 
@@ -2804,15 +3260,21 @@ var PureEvents = function PureEvents(props) {
2804
3260
  fieldValueHighlightMap: highlightValuesByField
2805
3261
  };
2806
3262
 
2807
- var handleFieldClicked = showFieldSummary && function (e, _ref4) {
2808
- var field = _ref4.field;
3263
+ var handleFieldClicked = showFieldSummary && function (e, _ref6) {
3264
+ var field = _ref6.field;
2809
3265
  setFieldSummaryField(field);
2810
3266
  setFieldSummaryAnchor(e.currentTarget.parentElement);
2811
3267
  };
2812
3268
 
2813
- var handleValueClicked = function handleValueClicked(e, _ref5) {
2814
- var field = _ref5.field,
2815
- value = _ref5.value;
3269
+ var handleTimeClicked = function handleTimeClicked(e, _ref7) {
3270
+ var time = _ref7.time;
3271
+ setTimeValue(time);
3272
+ setTimeFieldAnchor(e.currentTarget);
3273
+ };
3274
+
3275
+ var handleValueClicked = function handleValueClicked(e, _ref8) {
3276
+ var field = _ref8.field,
3277
+ value = _ref8.value;
2816
3278
  onEventTrigger({
2817
3279
  originalEvent: e,
2818
3280
  type: 'value.click',
@@ -2823,6 +3285,19 @@ var PureEvents = function PureEvents(props) {
2823
3285
  });
2824
3286
  };
2825
3287
 
3288
+ var handleTimeDrilldown = function handleTimeDrilldown(e, timeInterval) {
3289
+ onEventTrigger({
3290
+ originalEvent: e,
3291
+ type: 'time.click',
3292
+ payload: {
3293
+ name: '_time',
3294
+ value: timeValue,
3295
+ epochTime: EventUtils_1.getEpochTime(timeValue),
3296
+ window: timeInterval
3297
+ }
3298
+ });
3299
+ };
3300
+
2826
3301
  var handleActionClicked = function handleActionClicked(event, data) {
2827
3302
  var actionType = data.action,
2828
3303
  field = data.field;
@@ -2848,7 +3323,8 @@ var PureEvents = function PureEvents(props) {
2848
3323
  dataSources: dataSources,
2849
3324
  onRequestParamsChange: onRequestParamsChange,
2850
3325
  onFieldClicked: handleFieldClicked,
2851
- onFieldValueClicked: handleValueClicked
3326
+ onFieldValueClicked: handleValueClicked,
3327
+ onTimeClicked: handleTimeClicked
2852
3328
  }), React.createElement(FieldSummaryTooltip_1.default, {
2853
3329
  open: !!fieldSummaryAnchor && !!fieldSummaryField,
2854
3330
  anchor: fieldSummaryAnchor,
@@ -2860,6 +3336,15 @@ var PureEvents = function PureEvents(props) {
2860
3336
  fieldSummaryMap: fieldSummaryMap,
2861
3337
  onActionClicked: handleActionClicked,
2862
3338
  onFieldValueClicked: handleValueClicked
3339
+ }), React.createElement(TimeControlsPopover_1.default, {
3340
+ open: !!timeFieldAnchor,
3341
+ anchor: timeFieldAnchor,
3342
+ time: timeValue,
3343
+ onTimeDrilldown: handleTimeDrilldown,
3344
+ handleTooltipClose: function handleTooltipClose() {
3345
+ setTimeValue(null);
3346
+ setTimeFieldAnchor(null);
3347
+ }
2863
3348
  })));
2864
3349
  };
2865
3350
 
@@ -2907,98 +3392,19 @@ PureEvents.defaultProps = {
2907
3392
  exports.default = FixedSizeContainer_1.default(PureEvents);
2908
3393
 
2909
3394
  /***/ }),
2910
- /* 186 */
3395
+ /* 192 */
2911
3396
  /***/ (function(module, exports) {
2912
3397
 
2913
3398
  module.exports = require("@splunk/react-events-viewer/components/EventsViewer");
2914
3399
 
2915
3400
  /***/ }),
2916
- /* 187 */
2917
- /***/ (function(module, exports, __webpack_require__) {
2918
-
2919
- "use strict";
2920
-
2921
-
2922
- var _defineProperty = __webpack_require__(7);
2923
-
2924
- Object.defineProperty(exports, "__esModule", {
2925
- value: true
2926
- });
2927
- exports.mergeFieldActions = exports.mergeEventActions = exports.getFieldSummaryMapping = exports.convertToPayloadFormat = void 0;
2928
-
2929
- var lodash_1 = __webpack_require__(3);
2930
-
2931
- var dataUtils_1 = __webpack_require__(110); // util to convert a field-value map into an object with row.<fieldname>.value keys for payloads
2932
-
2933
-
2934
- var convertToPayloadFormat = function convertToPayloadFormat(obj) {
2935
- var initialValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2936
- if (!obj) return {};
2937
- return Object.keys(obj).reduce(function (acc, curr) {
2938
- var key = "row.".concat(curr, ".value");
2939
- return Object.assign(Object.assign({}, acc), _defineProperty({}, key, obj[curr]));
2940
- }, initialValue);
2941
- };
2942
-
2943
- exports.convertToPayloadFormat = convertToPayloadFormat;
2944
-
2945
- var getFieldSummaryMapping = function getFieldSummaryMapping(columns, fields) {
2946
- // convert the `fieldsummary` payload to an array of objects
2947
- var arr = dataUtils_1.convertToArrOfObjects(columns, fields); // forms an array of FieldData elements expected by the @splunk/react-field-summary component
2948
-
2949
- var fieldSummaryData = arr.map(function (d) {
2950
- return {
2951
- name: d.field,
2952
- count: +d.count,
2953
- distinctCount: +d.distinct_count,
2954
- numericCount: +d.numeric_count,
2955
- max: d.max === null ? null : +d.max,
2956
- mean: d.mean === null ? null : +d.mean,
2957
- min: d.min === null ? null : +d.min,
2958
- stdev: d.stdev === null ? null : +d.stdev,
2959
- modes: JSON.parse(d.values)
2960
- };
2961
- }); // creates a map of field name to its data for O(1) retrieval in the tooltip component
2962
-
2963
- var fieldSummaryMapping = fieldSummaryData.reduce(function (map, fieldData) {
2964
- return Object.assign(Object.assign({}, map), _defineProperty({}, fieldData.name, fieldData));
2965
- }, {});
2966
- return fieldSummaryMapping;
2967
- };
2968
-
2969
- exports.getFieldSummaryMapping = getFieldSummaryMapping;
2970
- /**
2971
- * Helper to merge event actions into one array of event actions.
2972
- * @method mergeEventActions
2973
- * @param {Action[]} fieldActions1
2974
- * @param {Action[]} fieldActions2
2975
- * @returns {Action[]} merged event actions
2976
- */
2977
-
2978
- var mergeEventActions = function mergeEventActions(eventActions1, eventActions2) {
2979
- return eventActions1.concat(eventActions2);
2980
- };
2981
-
2982
- exports.mergeEventActions = mergeEventActions;
2983
- /**
2984
- * Helper to merge field actions. If same key exists in both field actions,
2985
- * combine each array of actions under one key.
2986
- * @method mergeFieldActions
2987
- * @param {Record<string, Action[]>} fieldActions1
2988
- * @param {Record<string, Action[]>} fieldActions2
2989
- * @returns {Record<string, Action[]>} merged field actions
2990
- */
2991
-
2992
- var mergeFieldActions = function mergeFieldActions(fieldActions1, fieldActions2) {
2993
- return lodash_1.mergeWith(fieldActions1, fieldActions2, function (fieldAction1value, fieldAction2value) {
2994
- return Array.isArray(fieldAction1value) && Array.isArray(fieldAction2value) ? lodash_1.union(fieldAction1value, fieldAction2value) : undefined;
2995
- });
2996
- };
3401
+ /* 193 */
3402
+ /***/ (function(module, exports) {
2997
3403
 
2998
- exports.mergeFieldActions = mergeFieldActions;
3404
+ module.exports = require("@splunk/time-range-utils/time");
2999
3405
 
3000
3406
  /***/ }),
3001
- /* 188 */
3407
+ /* 194 */
3002
3408
  /***/ (function(module, exports, __webpack_require__) {
3003
3409
 
3004
3410
  "use strict";
@@ -3014,9 +3420,9 @@ var react_1 = __webpack_require__(1);
3014
3420
 
3015
3421
  var Popover_1 = __webpack_require__(84);
3016
3422
 
3017
- var Markdown_1 = __webpack_require__(111);
3423
+ var Markdown_1 = __webpack_require__(114);
3018
3424
 
3019
- var FieldSummary_1 = __webpack_require__(189);
3425
+ var FieldSummary_1 = __webpack_require__(195);
3020
3426
 
3021
3427
  var lodash_1 = __webpack_require__(3);
3022
3428
 
@@ -3024,7 +3430,7 @@ var i18n_1 = __webpack_require__(2);
3024
3430
 
3025
3431
  var styled_components_1 = __webpack_require__(4);
3026
3432
 
3027
- var EventsContext_1 = __webpack_require__(134);
3433
+ var EventsContext_1 = __webpack_require__(140);
3028
3434
 
3029
3435
  var popoverContainerStyle = {
3030
3436
  padding: '20px',
@@ -3126,11 +3532,305 @@ FieldSummaryTooltip.defaultProps = {
3126
3532
  exports.default = FieldSummaryTooltip;
3127
3533
 
3128
3534
  /***/ }),
3129
- /* 189 */
3535
+ /* 195 */
3130
3536
  /***/ (function(module, exports) {
3131
3537
 
3132
3538
  module.exports = require("@splunk/react-field-summary/components/FieldSummary");
3133
3539
 
3540
+ /***/ }),
3541
+ /* 196 */
3542
+ /***/ (function(module, exports, __webpack_require__) {
3543
+
3544
+ "use strict";
3545
+
3546
+
3547
+ var _slicedToArray = __webpack_require__(17);
3548
+
3549
+ Object.defineProperty(exports, "__esModule", {
3550
+ value: true
3551
+ });
3552
+
3553
+ var React = __webpack_require__(1);
3554
+
3555
+ var Popover_1 = __webpack_require__(84);
3556
+
3557
+ var ControlGroup_1 = __webpack_require__(197);
3558
+
3559
+ var Button_1 = __webpack_require__(115);
3560
+
3561
+ var Text_1 = __webpack_require__(198);
3562
+
3563
+ var Message_1 = __webpack_require__(116);
3564
+
3565
+ var Select_1 = __webpack_require__(199);
3566
+
3567
+ var Link_1 = __webpack_require__(200);
3568
+
3569
+ var Heading_1 = __webpack_require__(117);
3570
+
3571
+ var lodash_1 = __webpack_require__(3);
3572
+
3573
+ var i18n_1 = __webpack_require__(2);
3574
+
3575
+ var styled_components_1 = __webpack_require__(4);
3576
+
3577
+ var numberUtils_1 = __webpack_require__(29);
3578
+
3579
+ var pick_1 = __webpack_require__(22);
3580
+
3581
+ var EventUtils_1 = __webpack_require__(112); // custom popover sizing for Enterprise vs. Prisma themes - additional px for Prisma theme to fit controls
3582
+
3583
+
3584
+ var TimePopoverContainer = styled_components_1.default.div.withConfig({
3585
+ displayName: "TimeControlsPopover__TimePopoverContainer",
3586
+ componentId: "fj32ze-0"
3587
+ })(["padding:20px;width:", ";.time-drilldown-header{margin:0px;}[data-test='nearby-controls']{margin:0px;width:", ";}"], function (props) {
3588
+ return pick_1.default({
3589
+ enterprise: '372px',
3590
+ prisma: '422px'
3591
+ })(props);
3592
+ }, function (props) {
3593
+ return pick_1.default({
3594
+ enterprise: '289.75px',
3595
+ prisma: '329.75px'
3596
+ })(props);
3597
+ });
3598
+ var TimeTable = styled_components_1.default.table.withConfig({
3599
+ displayName: "TimeControlsPopover__TimeTable",
3600
+ componentId: "fj32ze-1"
3601
+ })(["width:100%;display:table;border-collapse:separate;box-sizing:border-box;text-indent:initial;border-spacing:2px;border-color:grey;"]);
3602
+ var NearbyValueRow = styled_components_1.default.div.withConfig({
3603
+ displayName: "TimeControlsPopover__NearbyValueRow",
3604
+ componentId: "fj32ze-2"
3605
+ })(["display:flex;align-items:flex-start;justify-content:center;"]);
3606
+ var SectionHeading = styled_components_1.default(Heading_1.default).withConfig({
3607
+ displayName: "TimeControlsPopover__SectionHeading",
3608
+ componentId: "fj32ze-3"
3609
+ })(["margin-top:20px;"]);
3610
+ var rangeTypeInputStyle = {
3611
+ minWidth: 80
3612
+ };
3613
+ var rangeAmountInputStyle = {
3614
+ width: 54.88,
3615
+ minWidth: 48
3616
+ };
3617
+ var rangeUnitInputStyle = {
3618
+ width: 154.88,
3619
+ textAlign: 'center'
3620
+ };
3621
+ var applyButtonStyle = {
3622
+ marginLeft: 10
3623
+ };
3624
+
3625
+ var TimeControlsPopover = function TimeControlsPopover(props) {
3626
+ var open = props.open,
3627
+ anchor = props.anchor,
3628
+ time = props.time,
3629
+ handleTooltipClose = props.handleTooltipClose,
3630
+ onTimeDrilldown = props.onTimeDrilldown; // nearby events controls default to +/- 5 second(s)
3631
+
3632
+ var _React$useState = React.useState('plusminus'),
3633
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3634
+ rangeType = _React$useState2[0],
3635
+ setRangeType = _React$useState2[1];
3636
+
3637
+ var _React$useState3 = React.useState('5'),
3638
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
3639
+ rangeAmount = _React$useState4[0],
3640
+ setRangeAmount = _React$useState4[1];
3641
+
3642
+ var _React$useState5 = React.useState('s'),
3643
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
3644
+ rangeUnit = _React$useState6[0],
3645
+ setRangeUnit = _React$useState6[1]; // if validation fails, this triggers the error state on the controls to show
3646
+
3647
+
3648
+ var _React$useState7 = React.useState(false),
3649
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
3650
+ isInvalidInput = _React$useState8[0],
3651
+ setInvalidInput = _React$useState8[1];
3652
+
3653
+ var errorMessage = i18n_1._('Value must be an integer greater than 0');
3654
+
3655
+ var handleRangeTypeChange = function handleRangeTypeChange(e, _ref) {
3656
+ var value = _ref.value;
3657
+ setRangeType(value);
3658
+ };
3659
+
3660
+ var handleRangeAmountChange = function handleRangeAmountChange(e, _ref2) {
3661
+ var value = _ref2.value;
3662
+ setRangeAmount(value);
3663
+ };
3664
+
3665
+ var handleRangeUnitChange = function handleRangeUnitChange(e, _ref3) {
3666
+ var value = _ref3.value;
3667
+ setRangeUnit(value);
3668
+ };
3669
+
3670
+ var handleSubmit = function handleSubmit(e) {
3671
+ // if the entered range amount is not a number, is not greater than 0, or is not an integer, then it is invalid
3672
+ var parsedIntervalAmount = numberUtils_1.parseNumber(rangeAmount);
3673
+
3674
+ if (Number.isNaN(parsedIntervalAmount) || parsedIntervalAmount <= 0 || !Number.isInteger(parsedIntervalAmount)) {
3675
+ setInvalidInput(true);
3676
+ return;
3677
+ }
3678
+
3679
+ setInvalidInput(false);
3680
+ var timeInterval = EventUtils_1.getCustomTimeInterval({
3681
+ time: time,
3682
+ rangeType: rangeType,
3683
+ rangeAmount: rangeAmount,
3684
+ rangeUnit: rangeUnit
3685
+ });
3686
+ onTimeDrilldown(e, timeInterval);
3687
+ };
3688
+
3689
+ var handleEventIntervalClick = function handleEventIntervalClick(e, when) {
3690
+ e.preventDefault();
3691
+ var timeInterval = EventUtils_1.getPredefinedTimeInterval({
3692
+ time: time,
3693
+ when: when
3694
+ });
3695
+ onTimeDrilldown(e, timeInterval);
3696
+ };
3697
+
3698
+ return React.createElement(Popover_1.default, {
3699
+ open: open,
3700
+ defaultPlacement: "below",
3701
+ anchor: anchor,
3702
+ takeFocus: true,
3703
+ onRequestClose: handleTooltipClose
3704
+ }, React.createElement(TimePopoverContainer, {
3705
+ "data-test": "time-controls"
3706
+ }, React.createElement(Heading_1.default, {
3707
+ level: 2,
3708
+ className: "time-drilldown-header"
3709
+ }, "_time"), isInvalidInput && React.createElement(Message_1.default, {
3710
+ type: "error",
3711
+ "data-test": "invalid-time-input-message"
3712
+ }, errorMessage), React.createElement(SectionHeading, {
3713
+ level: 4
3714
+ }, i18n_1._('Events Before or After')), React.createElement(TimeTable, null, React.createElement("tbody", null, React.createElement("tr", {
3715
+ className: "before-after-values"
3716
+ }, React.createElement("td", null, React.createElement(Link_1.default, {
3717
+ "data-test": "before-time",
3718
+ to: "#",
3719
+ onClick: function onClick(e) {
3720
+ handleEventIntervalClick(e, 'before');
3721
+ }
3722
+ }, i18n_1._('Before this time'))), React.createElement("td", null, React.createElement(Link_1.default, {
3723
+ "data-test": "after-time",
3724
+ to: "#",
3725
+ onClick: function onClick(e) {
3726
+ handleEventIntervalClick(e, 'after');
3727
+ }
3728
+ }, i18n_1._('After this time'))), React.createElement("td", null, React.createElement(Link_1.default, {
3729
+ "data-test": "at-time",
3730
+ to: "#",
3731
+ onClick: function onClick(e) {
3732
+ handleEventIntervalClick(e, 'at');
3733
+ }
3734
+ }, i18n_1._('At this time')))))), React.createElement(SectionHeading, {
3735
+ level: 4,
3736
+ className: "nearby-header"
3737
+ }, i18n_1._('Nearby Events')), React.createElement(NearbyValueRow, {
3738
+ className: "nearby-value"
3739
+ }, React.createElement(ControlGroup_1.default, {
3740
+ "data-test": "nearby-controls",
3741
+ controlsLayout: "fillJoin",
3742
+ label: "Time controls",
3743
+ labelPosition: "top",
3744
+ hideLabel: true
3745
+ }, React.createElement(Select_1.default, {
3746
+ inline: true,
3747
+ value: rangeType,
3748
+ onChange: handleRangeTypeChange,
3749
+ error: isInvalidInput,
3750
+ style: rangeTypeInputStyle,
3751
+ "data-test": "type-selection"
3752
+ }, React.createElement(Select_1.default.Option, {
3753
+ label: "+",
3754
+ value: "plus"
3755
+ }), React.createElement(Select_1.default.Option, {
3756
+ label: "-",
3757
+ value: "minus"
3758
+ }), React.createElement(Select_1.default.Option, {
3759
+ label: "+/-",
3760
+ value: "plusminus"
3761
+ })), React.createElement(Text_1.default, {
3762
+ inline: true,
3763
+ value: rangeAmount,
3764
+ onChange: handleRangeAmountChange,
3765
+ error: isInvalidInput,
3766
+ style: rangeAmountInputStyle,
3767
+ "data-test": "amount-input"
3768
+ }), React.createElement(Select_1.default, {
3769
+ "data-test": "unit-selection",
3770
+ inline: true,
3771
+ value: rangeUnit,
3772
+ onChange: handleRangeUnitChange,
3773
+ error: isInvalidInput,
3774
+ style: rangeUnitInputStyle
3775
+ }, React.createElement(Select_1.default.Option, {
3776
+ label: "week(s)",
3777
+ value: "w"
3778
+ }), React.createElement(Select_1.default.Option, {
3779
+ label: "day(s)",
3780
+ value: "d"
3781
+ }), React.createElement(Select_1.default.Option, {
3782
+ label: "hour(s)",
3783
+ value: "h"
3784
+ }), React.createElement(Select_1.default.Option, {
3785
+ label: "minute(s)",
3786
+ value: "m"
3787
+ }), React.createElement(Select_1.default.Option, {
3788
+ label: "second(s)",
3789
+ value: "s"
3790
+ }), React.createElement(Select_1.default.Option, {
3791
+ label: "millisecond(s)",
3792
+ value: "ms"
3793
+ }))), React.createElement(Button_1.default, {
3794
+ label: i18n_1._('Apply'),
3795
+ onClick: handleSubmit,
3796
+ style: applyButtonStyle,
3797
+ "data-test": "apply-custom-time"
3798
+ }))));
3799
+ };
3800
+
3801
+ TimeControlsPopover.defaultProps = {
3802
+ open: false,
3803
+ anchor: null,
3804
+ time: null,
3805
+ handleTooltipClose: lodash_1.noop,
3806
+ onTimeDrilldown: lodash_1.noop
3807
+ };
3808
+ exports.default = TimeControlsPopover;
3809
+
3810
+ /***/ }),
3811
+ /* 197 */
3812
+ /***/ (function(module, exports) {
3813
+
3814
+ module.exports = require("@splunk/react-ui/ControlGroup");
3815
+
3816
+ /***/ }),
3817
+ /* 198 */
3818
+ /***/ (function(module, exports) {
3819
+
3820
+ module.exports = require("@splunk/react-ui/Text");
3821
+
3822
+ /***/ }),
3823
+ /* 199 */
3824
+ /***/ (function(module, exports) {
3825
+
3826
+ module.exports = require("@splunk/react-ui/Select");
3827
+
3828
+ /***/ }),
3829
+ /* 200 */
3830
+ /***/ (function(module, exports) {
3831
+
3832
+ module.exports = require("@splunk/react-ui/Link");
3833
+
3134
3834
  /***/ })
3135
3835
  /******/ ]);
3136
3836
  //# sourceMappingURL=Events.js.map