@splunk/visualizations 26.4.0 → 27.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +1262 -1600
- package/Area.config.js.map +7 -1
- package/Area.js +3002 -4920
- package/Area.js.map +7 -1
- package/Bar.config.js +1247 -1574
- package/Bar.config.js.map +7 -1
- package/Bar.js +2924 -4836
- package/Bar.js.map +7 -1
- package/Bubble.config.js +896 -1213
- package/Bubble.config.js.map +7 -1
- package/Bubble.js +2520 -4476
- package/Bubble.js.map +7 -1
- package/ChoroplethSvg.config.js +282 -582
- package/ChoroplethSvg.config.js.map +7 -1
- package/ChoroplethSvg.js +2004 -3810
- package/ChoroplethSvg.js.map +7 -1
- package/Column.config.js +1208 -1541
- package/Column.config.js.map +7 -1
- package/Column.js +2933 -4879
- package/Column.js.map +7 -1
- package/Ellipse.config.js +443 -774
- package/Ellipse.config.js.map +7 -1
- package/Ellipse.js +1651 -3341
- package/Ellipse.js.map +7 -1
- package/Events.config.js +207 -492
- package/Events.config.js.map +7 -1
- package/Events.js +2615 -4649
- package/Events.js.map +7 -1
- package/FillerGauge.config.js +420 -775
- package/FillerGauge.config.js.map +7 -1
- package/FillerGauge.js +2137 -4578
- package/FillerGauge.js.map +7 -1
- package/Image.config.js +144 -411
- package/Image.config.js.map +7 -1
- package/Image.js +1395 -3048
- package/Image.js.map +7 -1
- package/Line.config.js +1278 -1625
- package/Line.config.js.map +7 -1
- package/Line.js +2957 -4919
- package/Line.js.map +7 -1
- package/LinkGraph.config.js +390 -632
- package/LinkGraph.config.js.map +7 -1
- package/LinkGraph.js +5243 -6190
- package/LinkGraph.js.map +7 -1
- package/MIGRATION.md +12 -0
- package/Map.config.js +501 -801
- package/Map.config.js.map +7 -1
- package/Map.js +3369 -5676
- package/Map.js.map +7 -1
- package/Markdown.config.js +232 -528
- package/Markdown.config.js.map +7 -1
- package/Markdown.js +1645 -3216
- package/Markdown.js.map +7 -1
- package/MarkerGauge.config.js +308 -613
- package/MarkerGauge.config.js.map +7 -1
- package/MarkerGauge.js +2189 -4535
- package/MarkerGauge.js.map +7 -1
- package/ParallelCoordinates.config.js +282 -581
- package/ParallelCoordinates.config.js.map +7 -1
- package/ParallelCoordinates.js +2023 -4720
- package/ParallelCoordinates.js.map +7 -1
- package/Pie.config.js +278 -547
- package/Pie.config.js.map +7 -1
- package/Pie.js +1998 -3982
- package/Pie.js.map +7 -1
- package/Punchcard.config.js +291 -578
- package/Punchcard.config.js.map +7 -1
- package/Punchcard.js +2709 -5042
- package/Punchcard.js.map +7 -1
- package/Rectangle.config.js +455 -770
- package/Rectangle.config.js.map +7 -1
- package/Rectangle.js +1638 -3262
- package/Rectangle.js.map +7 -1
- package/Sankey.config.js +291 -626
- package/Sankey.config.js.map +7 -1
- package/Sankey.js +2737 -4909
- package/Sankey.js.map +7 -1
- package/Scatter.config.js +876 -1194
- package/Scatter.config.js.map +7 -1
- package/Scatter.js +2532 -4470
- package/Scatter.js.map +7 -1
- package/SingleValue.config.js +819 -1251
- package/SingleValue.config.js.map +7 -1
- package/SingleValue.js +4203 -7413
- package/SingleValue.js.map +7 -1
- package/SingleValueBasic.js +382 -1527
- package/SingleValueBasic.js.map +7 -1
- package/SingleValueIcon.config.js +781 -1207
- package/SingleValueIcon.config.js.map +7 -1
- package/SingleValueIcon.js +3350 -6285
- package/SingleValueIcon.js.map +7 -1
- package/SingleValueRadial.config.js +708 -1119
- package/SingleValueRadial.config.js.map +7 -1
- package/SingleValueRadial.js +3808 -6965
- package/SingleValueRadial.js.map +7 -1
- package/SparkLine.js +439 -746
- package/SparkLine.js.map +7 -1
- package/Table.config.js +565 -887
- package/Table.config.js.map +7 -1
- package/Table.js +3277 -5386
- package/Table.js.map +7 -1
- package/common/Charting.js +484 -1462
- package/common/Charting.js.map +7 -1
- package/common/ChartingApi.js +46 -170
- package/common/ChartingApi.js.map +7 -1
- package/common/DocExampleWithVizSandbox.js +270 -473
- package/common/DocExampleWithVizSandbox.js.map +7 -1
- package/common/EventsDoc.js +172 -464
- package/common/EventsDoc.js.map +7 -1
- package/common/GaugeMajorTicks.js +249 -347
- package/common/GaugeMajorTicks.js.map +7 -1
- package/common/GaugeValueMarker.js +201 -311
- package/common/GaugeValueMarker.js.map +7 -1
- package/common/OptionsDoc.js +347 -912
- package/common/OptionsDoc.js.map +7 -1
- package/common/OverviewDoc.js +435 -769
- package/common/OverviewDoc.js.map +7 -1
- package/common/SplunkVisualization.js +116 -259
- package/common/SplunkVisualization.js.map +7 -1
- package/common/SplunkVisualizationApi.js +40 -156
- package/common/SplunkVisualizationApi.js.map +7 -1
- package/common/ThemesDoc.js +271 -420
- package/common/ThemesDoc.js.map +7 -1
- package/common/chartingUtils.js +140 -312
- package/common/chartingUtils.js.map +7 -1
- package/common/docUtils.js +148 -266
- package/common/docUtils.js.map +7 -1
- package/common/gaugeUtils.js +280 -808
- package/common/gaugeUtils.js.map +7 -1
- package/common/shapeUtils.js +106 -211
- package/common/shapeUtils.js.map +7 -1
- package/common/utils/configUtils.js +126 -252
- package/common/utils/configUtils.js.map +7 -1
- package/common/utils/dataUtils.js +217 -812
- package/common/utils/dataUtils.js.map +7 -1
- package/common/utils/featureFlagUtils.js +53 -133
- package/common/utils/featureFlagUtils.js.map +7 -1
- package/common/utils/hocUtils.js +32 -122
- package/common/utils/hocUtils.js.map +7 -1
- package/common/utils/mapUtils.js +502 -1337
- package/common/utils/mapUtils.js.map +7 -1
- package/common/utils/singleValueUtils.js +462 -1010
- package/common/utils/singleValueUtils.js.map +7 -1
- package/common/utils/testHelper.js +92 -146
- package/common/utils/testHelper.js.map +7 -1
- package/common/utils/trellisUtils.js +237 -489
- package/common/utils/trellisUtils.js.map +7 -1
- package/common/utils/urlUtils.js +28 -112
- package/common/utils/urlUtils.js.map +7 -1
- package/common/withDashboardViz.js +1168 -2438
- package/common/withDashboardViz.js.map +7 -1
- package/package.json +52 -43
package/Markdown.js
CHANGED
|
@@ -1,3362 +1,1791 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
60
|
-
/******/ // mode & 4: return value when already ns object
|
|
61
|
-
/******/ // mode & 8|1: behave like require
|
|
62
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
63
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
64
|
-
/******/ if(mode & 8) return value;
|
|
65
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
66
|
-
/******/ var ns = Object.create(null);
|
|
67
|
-
/******/ __webpack_require__.r(ns);
|
|
68
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
69
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
70
|
-
/******/ return ns;
|
|
71
|
-
/******/ };
|
|
72
|
-
/******/
|
|
73
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
74
|
-
/******/ __webpack_require__.n = function(module) {
|
|
75
|
-
/******/ var getter = module && module.__esModule ?
|
|
76
|
-
/******/ function getDefault() { return module['default']; } :
|
|
77
|
-
/******/ function getModuleExports() { return module; };
|
|
78
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
79
|
-
/******/ return getter;
|
|
80
|
-
/******/ };
|
|
81
|
-
/******/
|
|
82
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
83
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
84
|
-
/******/
|
|
85
|
-
/******/ // __webpack_public_path__
|
|
86
|
-
/******/ __webpack_require__.p = "";
|
|
87
|
-
/******/
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s = 433);
|
|
91
|
-
/******/ })
|
|
92
|
-
/************************************************************************/
|
|
93
|
-
/******/ ({
|
|
94
|
-
|
|
95
|
-
/***/ 0:
|
|
96
|
-
/***/ (function(module, exports) {
|
|
97
|
-
|
|
98
|
-
module.exports = require("prop-types");
|
|
99
|
-
|
|
100
|
-
/***/ }),
|
|
101
|
-
|
|
102
|
-
/***/ 1:
|
|
103
|
-
/***/ (function(module, exports) {
|
|
104
|
-
|
|
105
|
-
module.exports = require("react");
|
|
106
|
-
|
|
107
|
-
/***/ }),
|
|
108
|
-
|
|
109
|
-
/***/ 10:
|
|
110
|
-
/***/ (function(module, exports) {
|
|
111
|
-
|
|
112
|
-
module.exports = require("@splunk/visualizations-shared/numberUtils");
|
|
113
|
-
|
|
114
|
-
/***/ }),
|
|
115
|
-
|
|
116
|
-
/***/ 103:
|
|
117
|
-
/***/ (function(module, exports) {
|
|
118
|
-
|
|
119
|
-
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
120
|
-
|
|
121
|
-
/***/ }),
|
|
122
|
-
|
|
123
|
-
/***/ 11:
|
|
124
|
-
/***/ (function(module, exports) {
|
|
125
|
-
|
|
126
|
-
module.exports = require("@splunk/visualizations-shared/Message");
|
|
127
|
-
|
|
128
|
-
/***/ }),
|
|
129
|
-
|
|
130
|
-
/***/ 12:
|
|
131
|
-
/***/ (function(module, exports) {
|
|
132
|
-
|
|
133
|
-
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
134
|
-
|
|
135
|
-
/***/ }),
|
|
136
|
-
|
|
137
|
-
/***/ 13:
|
|
138
|
-
/***/ (function(module, exports) {
|
|
139
|
-
|
|
140
|
-
module.exports = require("@splunk/themes/variables");
|
|
141
|
-
|
|
142
|
-
/***/ }),
|
|
143
|
-
|
|
144
|
-
/***/ 131:
|
|
145
|
-
/***/ (function(module, exports) {
|
|
146
|
-
|
|
147
|
-
module.exports = require("@splunk/react-ui/Paragraph");
|
|
148
|
-
|
|
149
|
-
/***/ }),
|
|
150
|
-
|
|
151
|
-
/***/ 14:
|
|
152
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
153
|
-
|
|
154
|
-
"use strict";
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
Object.defineProperty(exports, "__esModule", {
|
|
158
|
-
value: true
|
|
1
|
+
/* Copyright © 2020 Splunk Inc.
|
|
2
|
+
SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
3
|
+
in part without a valid written license from Splunk Inc. is PROHIBITED. */
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
11
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
14
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
|
+
var __spreadValues = (a, b) => {
|
|
16
|
+
for (var prop in b || (b = {}))
|
|
17
|
+
if (__hasOwnProp.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
if (__getOwnPropSymbols)
|
|
20
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
21
|
+
if (__propIsEnum.call(b, prop))
|
|
22
|
+
__defNormalProp(a, prop, b[prop]);
|
|
23
|
+
}
|
|
24
|
+
return a;
|
|
25
|
+
};
|
|
26
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
27
|
+
var __export = (target, all) => {
|
|
28
|
+
for (var name in all)
|
|
29
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
30
|
+
};
|
|
31
|
+
var __copyProps = (to, from, except, desc) => {
|
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
33
|
+
for (let key of __getOwnPropNames(from))
|
|
34
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
35
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
36
|
+
}
|
|
37
|
+
return to;
|
|
38
|
+
};
|
|
39
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
40
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
41
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
42
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
43
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
44
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
45
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
46
|
+
mod
|
|
47
|
+
));
|
|
48
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
|
+
|
|
50
|
+
// src/Markdown/index.ts
|
|
51
|
+
var Markdown_exports2 = {};
|
|
52
|
+
__export(Markdown_exports2, {
|
|
53
|
+
FONT_SIZES: () => FONT_SIZES,
|
|
54
|
+
computeVizProps: () => computeVizProps,
|
|
55
|
+
config: () => config_default,
|
|
56
|
+
default: () => Markdown_default2,
|
|
57
|
+
getFontMap: () => getFontMap,
|
|
58
|
+
themes: () => themes2
|
|
159
59
|
});
|
|
160
|
-
|
|
60
|
+
module.exports = __toCommonJS(Markdown_exports2);
|
|
161
61
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
62
|
+
// esm-externals:lodash
|
|
63
|
+
var lodash_exports = {};
|
|
64
|
+
__export(lodash_exports, {
|
|
65
|
+
default: () => lodash_default
|
|
66
|
+
});
|
|
67
|
+
var defaultImport = __toESM(require("lodash"));
|
|
68
|
+
__reExport(lodash_exports, require("lodash"));
|
|
69
|
+
var lodash_default = "default" in defaultImport ? defaultImport.default : defaultImport;
|
|
70
|
+
|
|
71
|
+
// esm-externals:@splunk/visualization-encoding/utils/types
|
|
72
|
+
var types_exports = {};
|
|
73
|
+
__export(types_exports, {
|
|
74
|
+
default: () => types_default
|
|
75
|
+
});
|
|
76
|
+
var defaultImport2 = __toESM(require("@splunk/visualization-encoding/utils/types"));
|
|
77
|
+
__reExport(types_exports, require("@splunk/visualization-encoding/utils/types"));
|
|
78
|
+
var types_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
79
|
+
|
|
80
|
+
// esm-externals:react
|
|
81
|
+
var react_exports = {};
|
|
82
|
+
__export(react_exports, {
|
|
83
|
+
default: () => react_default
|
|
84
|
+
});
|
|
85
|
+
var defaultImport3 = __toESM(require("react"));
|
|
86
|
+
__reExport(react_exports, require("react"));
|
|
87
|
+
var react_default = "default" in defaultImport3 ? defaultImport3.default : defaultImport3;
|
|
88
|
+
|
|
89
|
+
// esm-externals:@splunk/visualizations-shared/style
|
|
90
|
+
var style_exports = {};
|
|
91
|
+
__export(style_exports, {
|
|
92
|
+
default: () => style_default
|
|
93
|
+
});
|
|
94
|
+
var defaultImport4 = __toESM(require("@splunk/visualizations-shared/style"));
|
|
95
|
+
__reExport(style_exports, require("@splunk/visualizations-shared/style"));
|
|
96
|
+
var style_default = "default" in defaultImport4 ? defaultImport4.default : defaultImport4;
|
|
97
|
+
|
|
98
|
+
// esm-externals:@splunk/react-ui/Markdown
|
|
99
|
+
var Markdown_exports = {};
|
|
100
|
+
__export(Markdown_exports, {
|
|
101
|
+
default: () => Markdown_default
|
|
102
|
+
});
|
|
103
|
+
var defaultImport5 = __toESM(require("@splunk/react-ui/Markdown"));
|
|
104
|
+
__reExport(Markdown_exports, require("@splunk/react-ui/Markdown"));
|
|
105
|
+
var Markdown_default = "default" in defaultImport5 ? defaultImport5.default : defaultImport5;
|
|
106
|
+
|
|
107
|
+
// esm-externals:styled-components
|
|
108
|
+
var styled_components_exports = {};
|
|
109
|
+
__export(styled_components_exports, {
|
|
110
|
+
default: () => styled_components_default
|
|
111
|
+
});
|
|
112
|
+
var defaultImport6 = __toESM(require("styled-components"));
|
|
113
|
+
__reExport(styled_components_exports, require("styled-components"));
|
|
114
|
+
var styled_components_default = "default" in defaultImport6 ? defaultImport6.default : defaultImport6;
|
|
115
|
+
|
|
116
|
+
// esm-externals:prop-types
|
|
117
|
+
var prop_types_exports = {};
|
|
118
|
+
__export(prop_types_exports, {
|
|
119
|
+
default: () => prop_types_default
|
|
120
|
+
});
|
|
121
|
+
var defaultImport7 = __toESM(require("prop-types"));
|
|
122
|
+
__reExport(prop_types_exports, require("prop-types"));
|
|
123
|
+
var prop_types_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
|
|
124
|
+
|
|
125
|
+
// esm-externals:@splunk/themes
|
|
126
|
+
var themes_exports = {};
|
|
127
|
+
__export(themes_exports, {
|
|
128
|
+
default: () => themes_default
|
|
129
|
+
});
|
|
130
|
+
var defaultImport8 = __toESM(require("@splunk/themes"));
|
|
131
|
+
__reExport(themes_exports, require("@splunk/themes"));
|
|
132
|
+
var themes_default = "default" in defaultImport8 ? defaultImport8.default : defaultImport8;
|
|
133
|
+
|
|
134
|
+
// esm-externals:@splunk/react-ui/Heading
|
|
135
|
+
var Heading_exports = {};
|
|
136
|
+
__export(Heading_exports, {
|
|
137
|
+
default: () => Heading_default
|
|
138
|
+
});
|
|
139
|
+
var defaultImport9 = __toESM(require("@splunk/react-ui/Heading"));
|
|
140
|
+
__reExport(Heading_exports, require("@splunk/react-ui/Heading"));
|
|
141
|
+
var Heading_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
|
|
142
|
+
|
|
143
|
+
// esm-externals:@splunk/react-ui/Paragraph
|
|
144
|
+
var Paragraph_exports = {};
|
|
145
|
+
__export(Paragraph_exports, {
|
|
146
|
+
default: () => Paragraph_default
|
|
147
|
+
});
|
|
148
|
+
var defaultImport10 = __toESM(require("@splunk/react-ui/Paragraph"));
|
|
149
|
+
__reExport(Paragraph_exports, require("@splunk/react-ui/Paragraph"));
|
|
150
|
+
var Paragraph_default = "default" in defaultImport10 ? defaultImport10.default : defaultImport10;
|
|
151
|
+
|
|
152
|
+
// esm-externals:@splunk/react-ui/List
|
|
153
|
+
var List_exports = {};
|
|
154
|
+
__export(List_exports, {
|
|
155
|
+
default: () => List_default
|
|
156
|
+
});
|
|
157
|
+
var defaultImport11 = __toESM(require("@splunk/react-ui/List"));
|
|
158
|
+
__reExport(List_exports, require("@splunk/react-ui/List"));
|
|
159
|
+
var List_default = "default" in defaultImport11 ? defaultImport11.default : defaultImport11;
|
|
160
|
+
|
|
161
|
+
// esm-externals:@splunk/react-ui/Code
|
|
162
|
+
var Code_exports = {};
|
|
163
|
+
__export(Code_exports, {
|
|
164
|
+
default: () => Code_default
|
|
165
|
+
});
|
|
166
|
+
var defaultImport12 = __toESM(require("@splunk/react-ui/Code"));
|
|
167
|
+
__reExport(Code_exports, require("@splunk/react-ui/Code"));
|
|
168
|
+
var Code_default = "default" in defaultImport12 ? defaultImport12.default : defaultImport12;
|
|
169
|
+
|
|
170
|
+
// esm-externals:@splunk/themes/getSettingsFromThemedProps
|
|
171
|
+
var getSettingsFromThemedProps_exports = {};
|
|
172
|
+
__export(getSettingsFromThemedProps_exports, {
|
|
173
|
+
default: () => getSettingsFromThemedProps_default
|
|
174
|
+
});
|
|
175
|
+
var defaultImport13 = __toESM(require("@splunk/themes/getSettingsFromThemedProps"));
|
|
176
|
+
__reExport(getSettingsFromThemedProps_exports, require("@splunk/themes/getSettingsFromThemedProps"));
|
|
177
|
+
var getSettingsFromThemedProps_default = "default" in defaultImport13 ? defaultImport13.default : defaultImport13;
|
|
178
|
+
|
|
179
|
+
// esm-externals:@splunk/visualization-encoding/Options
|
|
180
|
+
var Options_exports = {};
|
|
181
|
+
__export(Options_exports, {
|
|
182
|
+
default: () => Options_default
|
|
183
|
+
});
|
|
184
|
+
var defaultImport14 = __toESM(require("@splunk/visualization-encoding/Options"));
|
|
185
|
+
__reExport(Options_exports, require("@splunk/visualization-encoding/Options"));
|
|
186
|
+
var Options_default = "default" in defaultImport14 ? defaultImport14.default : defaultImport14;
|
|
187
|
+
|
|
188
|
+
// esm-externals:@splunk/visualizations-shared/SanitizeProps
|
|
189
|
+
var SanitizeProps_exports = {};
|
|
190
|
+
__export(SanitizeProps_exports, {
|
|
191
|
+
default: () => SanitizeProps_default
|
|
192
|
+
});
|
|
193
|
+
var defaultImport15 = __toESM(require("@splunk/visualizations-shared/SanitizeProps"));
|
|
194
|
+
__reExport(SanitizeProps_exports, require("@splunk/visualizations-shared/SanitizeProps"));
|
|
195
|
+
var SanitizeProps_default = "default" in defaultImport15 ? defaultImport15.default : defaultImport15;
|
|
196
|
+
|
|
197
|
+
// esm-externals:@splunk/visualization-context/TimezoneContext
|
|
198
|
+
var TimezoneContext_exports = {};
|
|
199
|
+
__export(TimezoneContext_exports, {
|
|
200
|
+
default: () => TimezoneContext_default
|
|
201
|
+
});
|
|
202
|
+
var defaultImport16 = __toESM(require("@splunk/visualization-context/TimezoneContext"));
|
|
203
|
+
__reExport(TimezoneContext_exports, require("@splunk/visualization-context/TimezoneContext"));
|
|
204
|
+
var TimezoneContext_default = "default" in defaultImport16 ? defaultImport16.default : defaultImport16;
|
|
205
|
+
|
|
206
|
+
// esm-externals:@splunk/moment
|
|
207
|
+
var moment_exports = {};
|
|
208
|
+
__export(moment_exports, {
|
|
209
|
+
default: () => moment_default
|
|
210
|
+
});
|
|
211
|
+
var defaultImport17 = __toESM(require("@splunk/moment"));
|
|
212
|
+
__reExport(moment_exports, require("@splunk/moment"));
|
|
213
|
+
var moment_default = "default" in defaultImport17 ? defaultImport17.default : defaultImport17;
|
|
214
|
+
|
|
215
|
+
// esm-externals:@splunk/visualization-context/FeatureFlagContext
|
|
216
|
+
var FeatureFlagContext_exports = {};
|
|
217
|
+
__export(FeatureFlagContext_exports, {
|
|
218
|
+
default: () => FeatureFlagContext_default
|
|
219
|
+
});
|
|
220
|
+
var defaultImport18 = __toESM(require("@splunk/visualization-context/FeatureFlagContext"));
|
|
221
|
+
__reExport(FeatureFlagContext_exports, require("@splunk/visualization-context/FeatureFlagContext"));
|
|
222
|
+
var FeatureFlagContext_default = "default" in defaultImport18 ? defaultImport18.default : defaultImport18;
|
|
223
|
+
|
|
224
|
+
// esm-externals:@splunk/visualizations-shared/hocUtils
|
|
225
|
+
var hocUtils_exports = {};
|
|
226
|
+
__export(hocUtils_exports, {
|
|
227
|
+
default: () => hocUtils_default
|
|
228
|
+
});
|
|
229
|
+
var defaultImport19 = __toESM(require("@splunk/visualizations-shared/hocUtils"));
|
|
230
|
+
__reExport(hocUtils_exports, require("@splunk/visualizations-shared/hocUtils"));
|
|
231
|
+
var hocUtils_default = "default" in defaultImport19 ? defaultImport19.default : defaultImport19;
|
|
232
|
+
|
|
233
|
+
// esm-externals:@splunk/visualizations-shared/JSONSchemaUtils
|
|
234
|
+
var JSONSchemaUtils_exports = {};
|
|
235
|
+
__export(JSONSchemaUtils_exports, {
|
|
236
|
+
default: () => JSONSchemaUtils_default
|
|
237
|
+
});
|
|
238
|
+
var defaultImport20 = __toESM(require("@splunk/visualizations-shared/JSONSchemaUtils"));
|
|
239
|
+
__reExport(JSONSchemaUtils_exports, require("@splunk/visualizations-shared/JSONSchemaUtils"));
|
|
240
|
+
var JSONSchemaUtils_default = "default" in defaultImport20 ? defaultImport20.default : defaultImport20;
|
|
241
|
+
|
|
242
|
+
// esm-externals:@splunk/async-dynamic-options-evaluator
|
|
243
|
+
var async_dynamic_options_evaluator_exports = {};
|
|
244
|
+
__export(async_dynamic_options_evaluator_exports, {
|
|
245
|
+
default: () => async_dynamic_options_evaluator_default
|
|
246
|
+
});
|
|
247
|
+
var defaultImport21 = __toESM(require("@splunk/async-dynamic-options-evaluator"));
|
|
248
|
+
__reExport(async_dynamic_options_evaluator_exports, require("@splunk/async-dynamic-options-evaluator"));
|
|
249
|
+
var async_dynamic_options_evaluator_default = "default" in defaultImport21 ? defaultImport21.default : defaultImport21;
|
|
250
|
+
|
|
251
|
+
// esm-externals:@splunk/ui-utils/id
|
|
252
|
+
var id_exports = {};
|
|
253
|
+
__export(id_exports, {
|
|
254
|
+
default: () => id_default
|
|
255
|
+
});
|
|
256
|
+
var defaultImport22 = __toESM(require("@splunk/ui-utils/id"));
|
|
257
|
+
__reExport(id_exports, require("@splunk/ui-utils/id"));
|
|
258
|
+
var id_default = "default" in defaultImport22 ? defaultImport22.default : defaultImport22;
|
|
165
259
|
|
|
260
|
+
// src/common/interfaces/VizActionHandler.ts
|
|
261
|
+
var DefaultVizActionHandler = class {
|
|
262
|
+
focus() {
|
|
263
|
+
}
|
|
264
|
+
snapshot() {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
166
268
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
269
|
+
// src/common/SplunkVisualization.tsx
|
|
270
|
+
var INITIAL_HEIGHT = 250;
|
|
271
|
+
var SplunkVisualization = class {
|
|
272
|
+
};
|
|
273
|
+
SplunkVisualization.propTypes = {
|
|
274
|
+
/**
|
|
275
|
+
* display mode
|
|
276
|
+
*/
|
|
277
|
+
mode: prop_types_exports.oneOf(["view", "edit", "export"]).isRequired,
|
|
278
|
+
/**
|
|
279
|
+
* width in pixel or string, defaults to 100%
|
|
280
|
+
*/
|
|
281
|
+
width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]).isRequired,
|
|
282
|
+
/**
|
|
283
|
+
* height in pixel or string
|
|
284
|
+
*/
|
|
285
|
+
height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]).isRequired,
|
|
286
|
+
/**
|
|
287
|
+
* visualization context used for dynamic option evaluation
|
|
288
|
+
*/
|
|
289
|
+
context: prop_types_exports.object,
|
|
290
|
+
/**
|
|
291
|
+
* visualization formatting options
|
|
292
|
+
*/
|
|
293
|
+
options: prop_types_exports.object,
|
|
294
|
+
/**
|
|
295
|
+
* A callback to update formatting options
|
|
296
|
+
*/
|
|
297
|
+
onOptionsChange: prop_types_exports.func,
|
|
298
|
+
/**
|
|
299
|
+
* datasource state which include data and request params, object key indicate the datasource type.
|
|
300
|
+
*/
|
|
301
|
+
dataSources: prop_types_exports.objectOf(
|
|
302
|
+
prop_types_exports.shape({
|
|
303
|
+
/**
|
|
304
|
+
* current request params
|
|
305
|
+
*/
|
|
306
|
+
requestParams: prop_types_exports.object,
|
|
307
|
+
/**
|
|
308
|
+
* current dataset
|
|
309
|
+
*/
|
|
310
|
+
data: prop_types_exports.shape({
|
|
311
|
+
fields: prop_types_exports.array,
|
|
312
|
+
columns: prop_types_exports.array
|
|
313
|
+
}),
|
|
314
|
+
/**
|
|
315
|
+
* error
|
|
316
|
+
*/
|
|
317
|
+
error: prop_types_exports.shape({
|
|
318
|
+
level: prop_types_exports.string,
|
|
319
|
+
message: prop_types_exports.string
|
|
320
|
+
}),
|
|
321
|
+
/**
|
|
322
|
+
* meta data that came with the dataset
|
|
323
|
+
*/
|
|
324
|
+
meta: prop_types_exports.object
|
|
325
|
+
})
|
|
326
|
+
),
|
|
327
|
+
/**
|
|
328
|
+
* A callback to trigger event
|
|
329
|
+
*/
|
|
330
|
+
onEventTrigger: prop_types_exports.func,
|
|
331
|
+
/**
|
|
332
|
+
* Inform viz if there are handlers listening to events
|
|
333
|
+
*/
|
|
334
|
+
hasEventHandlers: prop_types_exports.bool,
|
|
335
|
+
/**
|
|
336
|
+
* A callback to communicate computed props to a consumer
|
|
337
|
+
*/
|
|
338
|
+
onComputedProps: prop_types_exports.func,
|
|
339
|
+
/**
|
|
340
|
+
* A callback to obtain visualization api
|
|
341
|
+
*/
|
|
342
|
+
vizActionHandlerRef: prop_types_exports.func,
|
|
343
|
+
loading: prop_types_exports.bool,
|
|
344
|
+
theme: prop_types_exports.object,
|
|
345
|
+
/**
|
|
346
|
+
* A callback to request new data with updated request params
|
|
347
|
+
*/
|
|
348
|
+
onRequestParamsChange: prop_types_exports.func
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
*
|
|
352
|
+
*/
|
|
353
|
+
SplunkVisualization.defaultProps = {
|
|
354
|
+
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
355
|
+
width: "100%",
|
|
356
|
+
height: INITIAL_HEIGHT,
|
|
357
|
+
dataSources: {},
|
|
358
|
+
onEventTrigger: () => ({}),
|
|
359
|
+
mode: "view",
|
|
360
|
+
hasEventHandlers: false,
|
|
361
|
+
options: {},
|
|
362
|
+
context: {},
|
|
363
|
+
onOptionsChange: () => ({}),
|
|
364
|
+
vizActionHandlerRef: () => new DefaultVizActionHandler(),
|
|
365
|
+
onComputedProps: () => ({}),
|
|
366
|
+
loading: false,
|
|
367
|
+
onRequestParamsChange: lodash_exports.noop
|
|
368
|
+
};
|
|
369
|
+
var SplunkVisualization_default = SplunkVisualization;
|
|
170
370
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
fields.forEach(function (field, index) {
|
|
174
|
-
var fieldName = typeof field === 'string' ? field : field.name;
|
|
371
|
+
// src/common/interfaces/DataSource.ts
|
|
372
|
+
var validSortDirs = ["asc", "desc", "none"];
|
|
175
373
|
|
|
176
|
-
|
|
177
|
-
|
|
374
|
+
// src/common/hooks/getSorting.ts
|
|
375
|
+
var SortParamsPropTypes = prop_types_exports.shape({
|
|
376
|
+
currentSortKey: prop_types_exports.string,
|
|
377
|
+
currentSortDir: prop_types_exports.oneOf(validSortDirs),
|
|
378
|
+
onSort: prop_types_exports.func
|
|
379
|
+
});
|
|
380
|
+
var getSortingParams = ({ requestParams, onRequestParamsChange }) => {
|
|
381
|
+
let currentSortKey;
|
|
382
|
+
let currentSortDir;
|
|
383
|
+
const nextSortDirMap = {
|
|
384
|
+
asc: "desc",
|
|
385
|
+
desc: "asc",
|
|
386
|
+
none: "asc"
|
|
387
|
+
};
|
|
388
|
+
let onSort;
|
|
389
|
+
if (typeof onRequestParamsChange === "function") {
|
|
390
|
+
if (requestParams && (0, lodash_exports.has)(requestParams, "sort")) {
|
|
391
|
+
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
392
|
+
currentSortDir = requestParams.sort[currentSortKey];
|
|
393
|
+
}
|
|
394
|
+
onSort = (e, { sortKey, sortDir }) => {
|
|
395
|
+
if (typeof sortKey === "string") {
|
|
396
|
+
const nextSortDir = (0, lodash_exports.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : "none";
|
|
397
|
+
onRequestParamsChange(__spreadValues(__spreadValues({}, requestParams), { offset: 0, sort: { [sortKey]: nextSortDir } }));
|
|
178
398
|
} else {
|
|
179
|
-
|
|
399
|
+
onRequestParamsChange(requestParams);
|
|
180
400
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
currentSortKey,
|
|
405
|
+
currentSortDir,
|
|
406
|
+
onSort
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
// src/common/hooks/getPagination.ts
|
|
411
|
+
var PaginatorParamsPropTypes = prop_types_exports.shape({
|
|
412
|
+
isPaging: prop_types_exports.bool,
|
|
413
|
+
current: prop_types_exports.number,
|
|
414
|
+
totalPages: prop_types_exports.number,
|
|
415
|
+
onChange: prop_types_exports.func
|
|
416
|
+
});
|
|
417
|
+
var getPaginationParams = ({
|
|
418
|
+
requestParams,
|
|
419
|
+
meta,
|
|
420
|
+
onRequestParamsChange
|
|
421
|
+
}) => {
|
|
422
|
+
const totalCount = meta && meta.totalCount || 0;
|
|
423
|
+
const offset = requestParams && requestParams.offset || 0;
|
|
424
|
+
const count = requestParams && requestParams.count;
|
|
425
|
+
const totalPages = typeof count === "number" && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
426
|
+
const current = typeof count === "number" && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
427
|
+
const isPaging = totalPages > 1 && typeof onRequestParamsChange === "function";
|
|
428
|
+
const onChangeHandler = (e, { page, count: countArg }) => {
|
|
429
|
+
const newParams = (0, lodash_exports.cloneDeep)(requestParams);
|
|
430
|
+
if (typeof countArg === "number") {
|
|
431
|
+
newParams.count = countArg;
|
|
432
|
+
newParams.offset = 0;
|
|
433
|
+
}
|
|
434
|
+
const pageCount = typeof newParams.count === "number" ? newParams.count : 10;
|
|
435
|
+
if (typeof page === "number" && page > 0) {
|
|
436
|
+
newParams.count = pageCount;
|
|
437
|
+
newParams.offset = (page - 1) * pageCount;
|
|
438
|
+
}
|
|
439
|
+
onRequestParamsChange(newParams);
|
|
440
|
+
};
|
|
441
|
+
return {
|
|
442
|
+
isPaging,
|
|
443
|
+
current,
|
|
444
|
+
totalPages,
|
|
445
|
+
onChange: typeof onRequestParamsChange === "function" ? onChangeHandler : lodash_exports.noop
|
|
183
446
|
};
|
|
447
|
+
};
|
|
184
448
|
|
|
185
|
-
|
|
186
|
-
|
|
449
|
+
// src/common/hooks/useDeepMemo.ts
|
|
450
|
+
var useDeepMemo = (fn, dependencies) => {
|
|
451
|
+
const ref = (0, react_exports.useRef)();
|
|
452
|
+
if (!ref.current || !(0, lodash_exports.isEqual)(dependencies, ref.current.dependencies)) {
|
|
453
|
+
ref.current = {
|
|
454
|
+
dependencies,
|
|
455
|
+
value: fn()
|
|
456
|
+
};
|
|
187
457
|
}
|
|
458
|
+
return ref.current.value;
|
|
459
|
+
};
|
|
188
460
|
|
|
189
|
-
|
|
461
|
+
// esm-externals:@splunk/ui-utils/i18n
|
|
462
|
+
var i18n_exports = {};
|
|
463
|
+
__export(i18n_exports, {
|
|
464
|
+
default: () => i18n_default
|
|
465
|
+
});
|
|
466
|
+
var defaultImport23 = __toESM(require("@splunk/ui-utils/i18n"));
|
|
467
|
+
__reExport(i18n_exports, require("@splunk/ui-utils/i18n"));
|
|
468
|
+
var i18n_default = "default" in defaultImport23 ? defaultImport23.default : defaultImport23;
|
|
469
|
+
|
|
470
|
+
// esm-externals:@splunk/visualizations-shared/Message
|
|
471
|
+
var Message_exports = {};
|
|
472
|
+
__export(Message_exports, {
|
|
473
|
+
default: () => Message_default
|
|
474
|
+
});
|
|
475
|
+
var defaultImport24 = __toESM(require("@splunk/visualizations-shared/Message"));
|
|
476
|
+
__reExport(Message_exports, require("@splunk/visualizations-shared/Message"));
|
|
477
|
+
var Message_default = "default" in defaultImport24 ? defaultImport24.default : defaultImport24;
|
|
478
|
+
|
|
479
|
+
// esm-externals:@splunk/visualizations-shared/colorUtils
|
|
480
|
+
var colorUtils_exports = {};
|
|
481
|
+
__export(colorUtils_exports, {
|
|
482
|
+
default: () => colorUtils_default
|
|
483
|
+
});
|
|
484
|
+
var defaultImport25 = __toESM(require("@splunk/visualizations-shared/colorUtils"));
|
|
485
|
+
__reExport(colorUtils_exports, require("@splunk/visualizations-shared/colorUtils"));
|
|
486
|
+
var colorUtils_default = "default" in defaultImport25 ? defaultImport25.default : defaultImport25;
|
|
487
|
+
|
|
488
|
+
// esm-externals:@splunk/visualizations-shared/SizeAwareWrapper
|
|
489
|
+
var SizeAwareWrapper_exports = {};
|
|
490
|
+
__export(SizeAwareWrapper_exports, {
|
|
491
|
+
default: () => SizeAwareWrapper_default
|
|
492
|
+
});
|
|
493
|
+
var defaultImport26 = __toESM(require("@splunk/visualizations-shared/SizeAwareWrapper"));
|
|
494
|
+
__reExport(SizeAwareWrapper_exports, require("@splunk/visualizations-shared/SizeAwareWrapper"));
|
|
495
|
+
var SizeAwareWrapper_default = "default" in defaultImport26 ? defaultImport26.default : defaultImport26;
|
|
496
|
+
|
|
497
|
+
// src/common/hocs/FixedSizeContainer.tsx
|
|
498
|
+
var Item = styled_components_default.div.attrs(({ width }) => ({
|
|
499
|
+
style: {
|
|
500
|
+
width: (0, style_exports.toPx)(width)
|
|
501
|
+
}
|
|
502
|
+
}))`
|
|
503
|
+
position: relative;
|
|
504
|
+
background-color: ${(props) => (0, colorUtils_exports.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor}};
|
|
505
|
+
`;
|
|
506
|
+
var FixSizeItem = styled_components_default.div.attrs(({ width, height }) => ({
|
|
507
|
+
style: __spreadValues(__spreadValues({}, width && { width: (0, style_exports.toPx)(width) }), height && { height: (0, style_exports.toPx)(height) })
|
|
508
|
+
}))`
|
|
509
|
+
position: relative;
|
|
510
|
+
flex-direction: column;
|
|
511
|
+
flex: 1;
|
|
512
|
+
display: flex;
|
|
513
|
+
background-color: ${(props) => (0, colorUtils_exports.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor}};
|
|
514
|
+
`;
|
|
515
|
+
var ItemContent = styled_components_default.div`
|
|
516
|
+
position: relative;
|
|
517
|
+
min-height: 100px;
|
|
518
|
+
width: 100%;
|
|
519
|
+
`;
|
|
520
|
+
var FixSizeItemContent = styled_components_default.div`
|
|
521
|
+
min-height: 0px;
|
|
522
|
+
flex: 1;
|
|
523
|
+
position: relative;
|
|
524
|
+
box-sizing: border-box;
|
|
525
|
+
`;
|
|
526
|
+
var withFixedSizeContainer = (Viz) => {
|
|
527
|
+
const FixedSizeContainer = (props) => {
|
|
528
|
+
const { width, height, backgroundColor } = props;
|
|
529
|
+
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
530
|
+
setContainerWidth(w);
|
|
531
|
+
setContainerHeight(h);
|
|
532
|
+
}, []);
|
|
533
|
+
const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
|
|
534
|
+
const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
|
|
535
|
+
if (!height) {
|
|
536
|
+
return /* @__PURE__ */ react_exports.createElement(Item, { "data-test": "item", width, backgroundColor }, /* @__PURE__ */ react_exports.createElement(ItemContent, null, /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, props))));
|
|
537
|
+
}
|
|
538
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
539
|
+
FixSizeItem,
|
|
540
|
+
{
|
|
541
|
+
"data-test": "fix-size-item",
|
|
542
|
+
"data-splunk-visualization-version": "27.0.0 - 9bf093b7d",
|
|
543
|
+
width,
|
|
544
|
+
height,
|
|
545
|
+
backgroundColor
|
|
546
|
+
},
|
|
547
|
+
/* @__PURE__ */ react_exports.createElement(FixSizeItemContent, null, /* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }), /* @__PURE__ */ react_exports.createElement(Viz, __spreadProps(__spreadValues({}, props), { width: containerWidth, height: containerHeight })))
|
|
548
|
+
);
|
|
549
|
+
};
|
|
550
|
+
FixedSizeContainer.displayName = "withFixedSizeContainer";
|
|
551
|
+
return FixedSizeContainer;
|
|
190
552
|
};
|
|
553
|
+
var FixedSizeContainer_default = withFixedSizeContainer;
|
|
191
554
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
//
|
|
555
|
+
// src/common/components/MissingPropsMessage.tsx
|
|
556
|
+
var isMissing = (v) => {
|
|
557
|
+
return v === null || v === void 0;
|
|
558
|
+
};
|
|
559
|
+
var missingKeys = (keys, target) => keys.filter((k) => isMissing(target[k]));
|
|
560
|
+
var propTypes = {
|
|
561
|
+
width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
562
|
+
height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
563
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
564
|
+
backgroundColor: prop_types_exports.string,
|
|
565
|
+
missingProps: prop_types_exports.arrayOf(prop_types_exports.string)
|
|
566
|
+
};
|
|
567
|
+
var MissingPropsMessage = (props) => {
|
|
568
|
+
const { width, height, missingProps } = props;
|
|
569
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
570
|
+
Message_default,
|
|
571
|
+
{
|
|
572
|
+
"data-test": "message",
|
|
573
|
+
width,
|
|
574
|
+
height,
|
|
575
|
+
message: (0, i18n_exports._)(`Missing property: ${missingProps.join(", ")}`)
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
};
|
|
579
|
+
MissingPropsMessage.propTypes = propTypes;
|
|
580
|
+
MissingPropsMessage.defaultProps = {
|
|
581
|
+
width: "100%",
|
|
582
|
+
height: 250
|
|
583
|
+
};
|
|
584
|
+
var MissingPropsMessage_default = FixedSizeContainer_default(MissingPropsMessage);
|
|
585
|
+
|
|
586
|
+
// src/common/utils/hocUtils.ts
|
|
587
|
+
var extendStaticWrapperProps = ({
|
|
588
|
+
Wrapper,
|
|
589
|
+
Visualization
|
|
590
|
+
}) => {
|
|
591
|
+
const extendProperties = ["propTypes", "defaultProps", "config"];
|
|
592
|
+
extendProperties.forEach((prop) => {
|
|
593
|
+
if (Visualization[prop]) {
|
|
594
|
+
Wrapper[prop] = Visualization[prop];
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
};
|
|
201
598
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
599
|
+
// src/common/hocs/withEditModeCover.tsx
|
|
600
|
+
var Cover = styled_components_default.div`
|
|
601
|
+
position: absolute;
|
|
602
|
+
left: 0;
|
|
603
|
+
right: 0;
|
|
604
|
+
top: 0;
|
|
605
|
+
bottom: 0;
|
|
606
|
+
`;
|
|
607
|
+
var Blocker = styled_components_default.div.attrs({
|
|
608
|
+
"data-splunk-visualization-version": "27.0.0 - 9bf093b7d"
|
|
609
|
+
})`
|
|
610
|
+
position: relative;
|
|
611
|
+
width: 100%;
|
|
612
|
+
height: 100%;
|
|
613
|
+
`;
|
|
614
|
+
var withEditModeCover = (Visualization, disableEditModeCover) => {
|
|
615
|
+
const Wrapper = (props) => {
|
|
616
|
+
const { mode } = props;
|
|
617
|
+
const showEditCover = mode === "edit" && !disableEditModeCover;
|
|
618
|
+
return /* @__PURE__ */ react_exports.createElement(Blocker, null, /* @__PURE__ */ react_exports.createElement(Visualization, __spreadValues({}, props)), showEditCover && /* @__PURE__ */ react_exports.createElement(Cover, { "data-test": "edit-mode-cover" }));
|
|
619
|
+
};
|
|
620
|
+
extendStaticWrapperProps({ Wrapper, Visualization });
|
|
621
|
+
return Wrapper;
|
|
622
|
+
};
|
|
623
|
+
var withEditModeCover_default = withEditModeCover;
|
|
205
624
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
625
|
+
// esm-externals:@splunk/themes/variables
|
|
626
|
+
var variables_exports = {};
|
|
627
|
+
__export(variables_exports, {
|
|
628
|
+
default: () => variables_default
|
|
629
|
+
});
|
|
630
|
+
var defaultImport27 = __toESM(require("@splunk/themes/variables"));
|
|
631
|
+
__reExport(variables_exports, require("@splunk/themes/variables"));
|
|
632
|
+
var variables_default = "default" in defaultImport27 ? defaultImport27.default : defaultImport27;
|
|
633
|
+
|
|
634
|
+
// src/common/components/IconPlaceholder.tsx
|
|
635
|
+
var shouldShowIconPlaceholder = (dataSources, loading = false) => {
|
|
636
|
+
const data = (0, lodash_exports.get)(dataSources, "primary.data.columns[0]", void 0);
|
|
637
|
+
const noData = data === void 0;
|
|
638
|
+
const fields = (0, lodash_exports.get)(dataSources, "primary.data.fields[0]", void 0);
|
|
639
|
+
const noFields = fields === void 0;
|
|
640
|
+
return loading || noData || noFields;
|
|
641
|
+
};
|
|
642
|
+
var propTypes2 = {
|
|
643
|
+
icon: prop_types_exports.func,
|
|
644
|
+
width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
645
|
+
height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
646
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
647
|
+
backgroundColor: prop_types_exports.string,
|
|
648
|
+
iconColor: prop_types_exports.string
|
|
649
|
+
};
|
|
650
|
+
var IconPlaceholder = (props) => {
|
|
651
|
+
const { width, height, icon, iconColor } = props;
|
|
652
|
+
if (icon) {
|
|
653
|
+
return react_exports.createElement(icon, {
|
|
654
|
+
style: {
|
|
655
|
+
left: "50%",
|
|
656
|
+
top: "50%",
|
|
657
|
+
color: iconColor,
|
|
658
|
+
opacity: 0.15,
|
|
659
|
+
position: "absolute",
|
|
660
|
+
transform: "translate(-50%, -50%)"
|
|
661
|
+
},
|
|
662
|
+
width: "50%",
|
|
663
|
+
height: "50%",
|
|
664
|
+
"data-test": "icon-placeholder"
|
|
209
665
|
});
|
|
210
|
-
return {
|
|
211
|
-
downsampledData: data,
|
|
212
|
-
downsampledIndices: allIndices
|
|
213
|
-
}; // Nothing to do
|
|
214
666
|
}
|
|
667
|
+
return /* @__PURE__ */ react_exports.createElement(Message_default, { width, height, level: "warning", message: (0, i18n_exports._)("No DataSource Connected") });
|
|
668
|
+
};
|
|
669
|
+
IconPlaceholder.propTypes = propTypes2;
|
|
670
|
+
IconPlaceholder.defaultProps = {
|
|
671
|
+
width: "100%",
|
|
672
|
+
height: 250
|
|
673
|
+
};
|
|
674
|
+
var IconPlaceholder_default = FixedSizeContainer_default(IconPlaceholder);
|
|
215
675
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
676
|
+
// src/common/hocs/withPlaceholder.tsx
|
|
677
|
+
var withPlaceholder = (Visualization, useIconPlaceholder = shouldShowIconPlaceholder) => {
|
|
678
|
+
const { config: config2 } = Visualization;
|
|
679
|
+
const { themes: themes3 } = config2;
|
|
680
|
+
const Wrapper = (props) => {
|
|
681
|
+
var _a, _b;
|
|
682
|
+
const { dataSources, loading, options, height, width } = props;
|
|
683
|
+
const showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
684
|
+
const bgColorFromTheme = (0, colorUtils_exports.isColor)(options == null ? void 0 : options.backgroundColor) ? options == null ? void 0 : options.backgroundColor : (_a = themes3 == null ? void 0 : themes3.defaultBackgroundColor) == null ? void 0 : _a.call(themes3, props);
|
|
685
|
+
const icon = (_b = config2.placeholderIcon) != null ? _b : config2.icon;
|
|
686
|
+
const iconColor = variables_default.contentColorActive(props);
|
|
687
|
+
if (config2.supports.includes("placeholder" /* PLACEHOLDER */) && showPlaceholder) {
|
|
688
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
689
|
+
IconPlaceholder_default,
|
|
690
|
+
{
|
|
691
|
+
"data-test": "icon-placeholder",
|
|
692
|
+
icon,
|
|
693
|
+
width,
|
|
694
|
+
height,
|
|
695
|
+
backgroundColor: bgColorFromTheme,
|
|
696
|
+
iconColor
|
|
697
|
+
}
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
return /* @__PURE__ */ react_exports.createElement(Visualization, __spreadValues({}, props));
|
|
701
|
+
};
|
|
702
|
+
extendStaticWrapperProps({ Wrapper, Visualization });
|
|
703
|
+
return Wrapper;
|
|
704
|
+
};
|
|
705
|
+
var withPlaceholder_default = withPlaceholder;
|
|
229
706
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
707
|
+
// esm-externals:@splunk/visualizations-shared/numberUtils
|
|
708
|
+
var numberUtils_exports = {};
|
|
709
|
+
__export(numberUtils_exports, {
|
|
710
|
+
default: () => numberUtils_default
|
|
711
|
+
});
|
|
712
|
+
var defaultImport28 = __toESM(require("@splunk/visualizations-shared/numberUtils"));
|
|
713
|
+
__reExport(numberUtils_exports, require("@splunk/visualizations-shared/numberUtils"));
|
|
714
|
+
var numberUtils_default = "default" in defaultImport28 ? defaultImport28.default : defaultImport28;
|
|
715
|
+
|
|
716
|
+
// src/common/utils/dataUtils.ts
|
|
717
|
+
var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
|
|
718
|
+
const dataLength = data.length;
|
|
719
|
+
const downsampledIndices = [];
|
|
720
|
+
if (threshold >= dataLength || threshold === 0) {
|
|
721
|
+
const allIndices = data.map((values, index) => index);
|
|
722
|
+
return { downsampledData: data, downsampledIndices: allIndices };
|
|
723
|
+
}
|
|
724
|
+
const sampled = [];
|
|
725
|
+
let sampledIndex = 0;
|
|
726
|
+
const every = (dataLength - 2) / (threshold - 2);
|
|
727
|
+
let a = 0;
|
|
728
|
+
let maxAreaPoint;
|
|
729
|
+
let maxArea;
|
|
730
|
+
let area;
|
|
731
|
+
let nextA;
|
|
732
|
+
sampled.push(data[a]);
|
|
733
|
+
downsampledIndices.push(0);
|
|
734
|
+
for (let i = 0; i < threshold - 2; i++) {
|
|
735
|
+
let avgX = 0;
|
|
736
|
+
let avgY = 0;
|
|
737
|
+
let avgRangeStart = Math.floor((i + 1) * every) + 1;
|
|
738
|
+
let avgRangeEnd = Math.floor((i + 2) * every) + 1;
|
|
236
739
|
avgRangeEnd = avgRangeEnd < dataLength ? avgRangeEnd : dataLength;
|
|
237
|
-
|
|
238
|
-
|
|
740
|
+
const avgRangeLength = avgRangeEnd - avgRangeStart;
|
|
239
741
|
for (; avgRangeStart < avgRangeEnd; avgRangeStart++) {
|
|
240
|
-
avgX += Number(data[avgRangeStart][0]);
|
|
241
|
-
|
|
742
|
+
avgX += Number(data[avgRangeStart][0]);
|
|
242
743
|
avgY += data[avgRangeStart][1] * 1;
|
|
243
744
|
}
|
|
244
|
-
|
|
245
745
|
avgX /= avgRangeLength;
|
|
246
|
-
avgY /= avgRangeLength;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
var pointAX = Number(data[a][0]); // Enforce Number (value may be Date)
|
|
252
|
-
|
|
253
|
-
var pointAY = data[a][1] * 1; // eslint-disable-next-line no-multi-assign
|
|
254
|
-
|
|
746
|
+
avgY /= avgRangeLength;
|
|
747
|
+
let rangeOffs = Math.floor((i + 0) * every) + 1;
|
|
748
|
+
const rangeTo = Math.floor((i + 1) * every) + 1;
|
|
749
|
+
const pointAX = Number(data[a][0]);
|
|
750
|
+
const pointAY = data[a][1] * 1;
|
|
255
751
|
maxArea = area = -1;
|
|
256
|
-
|
|
257
|
-
|
|
752
|
+
let maxAreaIndex = rangeOffs;
|
|
258
753
|
for (; rangeOffs < rangeTo; rangeOffs++) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
// that also existed from another series so we don't add another point unnecessarily.
|
|
263
|
-
// By default LTTB picks the leftmost point in the bucket
|
|
264
|
-
|
|
754
|
+
area = Math.abs(
|
|
755
|
+
(pointAX - avgX) * (data[rangeOffs][1] - pointAY) - (pointAX - Number(data[rangeOffs][0])) * (avgY - pointAY)
|
|
756
|
+
) * 0.5;
|
|
265
757
|
if (area > maxArea || area === maxArea && preferredDownsampleIndices.has(rangeOffs)) {
|
|
266
758
|
maxArea = area;
|
|
267
759
|
maxAreaPoint = data[rangeOffs];
|
|
268
|
-
nextA = rangeOffs;
|
|
269
|
-
// Modification: save the index of the point with the most area
|
|
270
|
-
|
|
760
|
+
nextA = rangeOffs;
|
|
271
761
|
maxAreaIndex = rangeOffs;
|
|
272
762
|
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
sampled[sampledIndex++] = maxAreaPoint; // Pick this point from the bucket
|
|
277
|
-
|
|
763
|
+
}
|
|
764
|
+
sampled[sampledIndex++] = maxAreaPoint;
|
|
278
765
|
downsampledIndices.push(maxAreaIndex);
|
|
279
|
-
a = nextA;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
sampled[sampledIndex++] = data[dataLength - 1]; // Always add last
|
|
284
|
-
|
|
766
|
+
a = nextA;
|
|
767
|
+
}
|
|
768
|
+
sampled[sampledIndex++] = data[dataLength - 1];
|
|
285
769
|
downsampledIndices.push(dataLength - 1);
|
|
286
|
-
return {
|
|
287
|
-
downsampledData: sampled,
|
|
288
|
-
downsampledIndices: downsampledIndices
|
|
289
|
-
};
|
|
770
|
+
return { downsampledData: sampled, downsampledIndices };
|
|
290
771
|
};
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
// Number() does not support and also allows loose coercion of hex numbers (but not other formats)
|
|
302
|
-
// We want to identify columns which contain at least one value that can be loosely coerced
|
|
303
|
-
|
|
304
|
-
var canLooselyCoerceSomeValues = column.findIndex(function (value) {
|
|
305
|
-
return (0, numberUtils_1.startsWithNumber)("".concat(value)) || isNullCoercionEnabled && value === null;
|
|
306
|
-
}) >= 0; // If not all values in column can be strictly coerced to a number, we do not downsample
|
|
307
|
-
|
|
308
|
-
var coercedColumn = [];
|
|
309
|
-
var canDownsampleColumn = !column.some(function (value) {
|
|
310
|
-
var coercedValue = Number(value);
|
|
311
|
-
var coerceValueToZero = isNullCoercionEnabled && value === null; // if it can't be parsed or isn't safe, fail
|
|
312
|
-
|
|
313
|
-
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== 'string' && typeof value !== 'number' && !coerceValueToZero) {
|
|
772
|
+
var strictlyCoerceYColumn = (column, options) => {
|
|
773
|
+
const isNullCoercionEnabled = options.nullValueDisplay === "zero";
|
|
774
|
+
const canLooselyCoerceSomeValues = column.findIndex(
|
|
775
|
+
(value) => (0, numberUtils_exports.startsWithNumber)(`${value}`) || isNullCoercionEnabled && value === null
|
|
776
|
+
) >= 0;
|
|
777
|
+
const coercedColumn = [];
|
|
778
|
+
const canDownsampleColumn = !column.some((value) => {
|
|
779
|
+
const coercedValue = Number(value);
|
|
780
|
+
const coerceValueToZero = isNullCoercionEnabled && value === null;
|
|
781
|
+
if (Number.isNaN(coercedValue) || coercedValue <= Number.MIN_SAFE_INTEGER || coercedValue >= Number.MAX_SAFE_INTEGER || typeof value !== "string" && typeof value !== "number" && !coerceValueToZero) {
|
|
314
782
|
return true;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
783
|
+
}
|
|
318
784
|
coercedColumn.push(coercedValue);
|
|
319
785
|
return false;
|
|
320
786
|
});
|
|
321
787
|
return {
|
|
322
|
-
canDownsampleColumn
|
|
323
|
-
canLooselyCoerceSomeValues
|
|
788
|
+
canDownsampleColumn,
|
|
789
|
+
canLooselyCoerceSomeValues,
|
|
324
790
|
coercedColumn: canDownsampleColumn ? coercedColumn : []
|
|
325
791
|
};
|
|
326
792
|
};
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
* If the column is not eligible for downsampling, returns an empty array.
|
|
331
|
-
*/
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
var strictlyCoerceXColumn = function strictlyCoerceXColumn(column, fieldType) {
|
|
335
|
-
if (fieldType === 'number') {
|
|
336
|
-
var coercedXColumn = column.map(function (xValue) {
|
|
337
|
-
return Number(xValue);
|
|
338
|
-
});
|
|
339
|
-
|
|
793
|
+
var strictlyCoerceXColumn = (column, fieldType) => {
|
|
794
|
+
if (fieldType === "number") {
|
|
795
|
+
const coercedXColumn = column.map((xValue) => Number(xValue));
|
|
340
796
|
if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
|
|
341
797
|
return coercedXColumn;
|
|
342
798
|
}
|
|
343
|
-
} else if (fieldType ===
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
if (isColumnStrictlyIncreasing(_coercedXColumn, fieldType)) {
|
|
349
|
-
return _coercedXColumn;
|
|
799
|
+
} else if (fieldType === "time") {
|
|
800
|
+
const coercedXColumn = column.map((xValue) => new Date(xValue));
|
|
801
|
+
if (isColumnStrictlyIncreasing(coercedXColumn, fieldType)) {
|
|
802
|
+
return coercedXColumn;
|
|
350
803
|
}
|
|
351
804
|
}
|
|
352
|
-
|
|
353
805
|
return [];
|
|
354
806
|
};
|
|
355
|
-
|
|
356
|
-
var isDownsamplingEnabledForViz = function isDownsamplingEnabledForViz(_ref) {
|
|
357
|
-
var vizConfig = _ref.vizConfig;
|
|
358
|
-
|
|
807
|
+
var isDownsamplingEnabledForViz = ({ vizConfig }) => {
|
|
359
808
|
var _a;
|
|
360
|
-
|
|
361
|
-
return (_a = vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(interfaces_1.VizBehavior.DOWNSAMPLING);
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
exports.isDownsamplingEnabledForViz = isDownsamplingEnabledForViz;
|
|
365
|
-
|
|
366
|
-
var calculateThresholdOnRangeSelect = function calculateThresholdOnRangeSelect(_ref2) {
|
|
367
|
-
var firstIndex = _ref2.firstIndex,
|
|
368
|
-
lastIndex = _ref2.lastIndex,
|
|
369
|
-
dataSources = _ref2.dataSources,
|
|
370
|
-
width = _ref2.width;
|
|
371
|
-
|
|
372
|
-
var _a, _b, _c;
|
|
373
|
-
|
|
374
|
-
var window = lastIndex - firstIndex + 1;
|
|
375
|
-
var ratio = Math.round(Number(((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns[0]) === null || _c === void 0 ? void 0 : _c.length) / window) * 10) / 10;
|
|
376
|
-
return Math.round(ratio * Number(width));
|
|
809
|
+
return (_a = vizConfig.supports) == null ? void 0 : _a.includes("downsampling" /* DOWNSAMPLING */);
|
|
377
810
|
};
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
* Calculates the downsampling threshold based on the range selection. If search zoom is enabled or there is no selection,
|
|
382
|
-
* then returns the width of the visualization.
|
|
383
|
-
*
|
|
384
|
-
* Otherwise calculates the threshold based on the ratio of the window selected compared to the size of the non-downsampled
|
|
385
|
-
* data sources. Returns null if the chart event's dataset does not match the passed in primary data source or if the chart is zoomed
|
|
386
|
-
* in for a categorical chart.
|
|
387
|
-
*/
|
|
388
|
-
|
|
389
|
-
var calculateDownsamplingThreshold = function calculateDownsamplingThreshold(_ref3) {
|
|
390
|
-
var enableSearchZoom = _ref3.enableSearchZoom,
|
|
391
|
-
dataSources = _ref3.dataSources,
|
|
392
|
-
selectChartEvent = _ref3.selectChartEvent,
|
|
393
|
-
width = _ref3.width,
|
|
394
|
-
xField = _ref3.xField;
|
|
395
|
-
|
|
396
|
-
var _a, _b, _c;
|
|
397
|
-
|
|
398
|
-
if (enableSearchZoom || !selectChartEvent) {
|
|
399
|
-
return Number(width);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
var primaryDataSource = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary;
|
|
403
|
-
|
|
404
|
-
if (!primaryDataSource) {
|
|
405
|
-
return null;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
var startXIndex = selectChartEvent.startXIndex,
|
|
409
|
-
endXIndex = selectChartEvent.endXIndex,
|
|
410
|
-
currentTarget = selectChartEvent.currentTarget;
|
|
411
|
-
|
|
412
|
-
try {
|
|
413
|
-
var xFieldIndex = (_a = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _a === void 0 ? void 0 : _a.fields.findIndex(function (field) {
|
|
414
|
-
return field.name === xField;
|
|
415
|
-
});
|
|
416
|
-
var downsampledXFieldIndex = (_b = currentTarget.dataSet) === null || _b === void 0 ? void 0 : _b.fields.findIndex(function (field) {
|
|
417
|
-
return field === xField;
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
if (xFieldIndex === -1 || downsampledXFieldIndex === -1) {
|
|
421
|
-
return null;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
var fullSeries = (_c = primaryDataSource === null || primaryDataSource === void 0 ? void 0 : primaryDataSource.data) === null || _c === void 0 ? void 0 : _c.columns[xFieldIndex];
|
|
425
|
-
var downsampledSeries = currentTarget.dataSet.seriesList[downsampledXFieldIndex];
|
|
426
|
-
var firstIndex = fullSeries.findIndex(function (x) {
|
|
427
|
-
return downsampledSeries[startXIndex] === x;
|
|
428
|
-
});
|
|
429
|
-
var lastIndex = fullSeries.findIndex(function (x) {
|
|
430
|
-
return downsampledSeries[endXIndex] === x;
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
if (firstIndex >= 0 && lastIndex >= 0 && firstIndex <= lastIndex) {
|
|
434
|
-
return (0, exports.calculateThresholdOnRangeSelect)({
|
|
435
|
-
firstIndex: firstIndex,
|
|
436
|
-
lastIndex: lastIndex,
|
|
437
|
-
dataSources: dataSources,
|
|
438
|
-
width: width
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
} catch (e) {
|
|
442
|
-
// eslint-disable-next-line no-console
|
|
443
|
-
console.error('Error occurred while setting downsample threshold on range select event', e);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
return null;
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
exports.calculateDownsamplingThreshold = calculateDownsamplingThreshold;
|
|
450
|
-
|
|
451
|
-
var isColumnStrictlyIncreasing = function isColumnStrictlyIncreasing(column, fieldType) {
|
|
452
|
-
return column.every(function (value, index) {
|
|
453
|
-
if (fieldType === 'number') {
|
|
811
|
+
var isColumnStrictlyIncreasing = (column, fieldType) => {
|
|
812
|
+
return column.every((value, index) => {
|
|
813
|
+
if (fieldType === "number") {
|
|
454
814
|
if (Number.isNaN(value)) {
|
|
455
815
|
return false;
|
|
456
816
|
}
|
|
457
817
|
}
|
|
458
|
-
|
|
459
|
-
if (fieldType === 'time') {
|
|
818
|
+
if (fieldType === "time") {
|
|
460
819
|
if (Number.isNaN(value.getTime())) {
|
|
461
820
|
return false;
|
|
462
821
|
}
|
|
463
822
|
}
|
|
464
|
-
|
|
465
823
|
if (index === 0) {
|
|
466
824
|
return true;
|
|
467
825
|
}
|
|
468
|
-
|
|
469
826
|
return value > column[index - 1];
|
|
470
827
|
});
|
|
471
828
|
};
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
* If all columns can be downsampled, returns the x column coerced to time/number and y columns coerced to numbers.
|
|
477
|
-
* If not all columns can be downsampled, then returns empty arrays for both x and y
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
var tryToCoerceAllDisplayedFields = function tryToCoerceAllDisplayedFields(ds, xField, yFields, fieldTypes, options) {
|
|
482
|
-
var xColumn = [];
|
|
483
|
-
var yColumns = [];
|
|
484
|
-
var canDownsample = !ds.data.fields.some(function (field, index) {
|
|
829
|
+
var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) => {
|
|
830
|
+
let xColumn = [];
|
|
831
|
+
const yColumns = [];
|
|
832
|
+
const canDownsample = !ds.data.fields.some((field, index) => {
|
|
485
833
|
var _a, _b;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
var hasDisplayedColumnThatCantBeDownsampled = false;
|
|
491
|
-
|
|
834
|
+
const fieldName = (_a = field.name) != null ? _a : field;
|
|
835
|
+
const fieldType = (_b = fieldTypes[index]) != null ? _b : "unknown";
|
|
836
|
+
const column = ds.data.columns[index];
|
|
837
|
+
let hasDisplayedColumnThatCantBeDownsampled = false;
|
|
492
838
|
if (fieldName === xField) {
|
|
493
839
|
xColumn = strictlyCoerceXColumn(column, fieldType);
|
|
494
840
|
} else if (yFields.has(fieldName)) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
// be downsampled using LTTB
|
|
500
|
-
|
|
501
|
-
|
|
841
|
+
const { coercedColumn, canLooselyCoerceSomeValues, canDownsampleColumn } = strictlyCoerceYColumn(
|
|
842
|
+
ds.data.columns[index],
|
|
843
|
+
options
|
|
844
|
+
);
|
|
502
845
|
hasDisplayedColumnThatCantBeDownsampled = canLooselyCoerceSomeValues && !canDownsampleColumn;
|
|
503
|
-
|
|
504
846
|
if (hasDisplayedColumnThatCantBeDownsampled) {
|
|
505
847
|
return true;
|
|
506
848
|
}
|
|
507
|
-
|
|
508
849
|
if (canDownsampleColumn) {
|
|
509
850
|
yColumns.push(coercedColumn);
|
|
510
851
|
}
|
|
511
852
|
}
|
|
512
|
-
|
|
513
853
|
return false;
|
|
514
854
|
});
|
|
515
|
-
|
|
516
855
|
if (canDownsample) {
|
|
517
|
-
return {
|
|
518
|
-
xColumn: xColumn,
|
|
519
|
-
yColumns: yColumns
|
|
520
|
-
};
|
|
856
|
+
return { xColumn, yColumns };
|
|
521
857
|
}
|
|
522
|
-
|
|
523
|
-
return {
|
|
524
|
-
xColumn: [],
|
|
525
|
-
yColumns: []
|
|
526
|
-
};
|
|
858
|
+
return { xColumn: [], yColumns: [] };
|
|
527
859
|
};
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
ds.data.columns.forEach(function (column) {
|
|
535
|
-
var slicedColumn = [];
|
|
536
|
-
sortedIndices.forEach(function (index) {
|
|
860
|
+
var pickIndicesFromDataSource = (ds, indices) => {
|
|
861
|
+
const sortedIndices = Array.from(indices).sort((a, b) => a - b);
|
|
862
|
+
const slicedColumns = [];
|
|
863
|
+
ds.data.columns.forEach((column) => {
|
|
864
|
+
const slicedColumn = [];
|
|
865
|
+
sortedIndices.forEach((index) => {
|
|
537
866
|
slicedColumn.push(column[index]);
|
|
538
867
|
});
|
|
539
868
|
slicedColumns.push(slicedColumn);
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
data: Object.assign(Object.assign({}, ds.data), {
|
|
869
|
+
});
|
|
870
|
+
return __spreadProps(__spreadValues({}, ds), {
|
|
871
|
+
data: __spreadProps(__spreadValues({}, ds.data), {
|
|
544
872
|
columns: slicedColumns
|
|
545
873
|
})
|
|
546
874
|
});
|
|
547
875
|
};
|
|
548
|
-
|
|
549
|
-
var downsampleDataSources = function downsampleDataSources(_ref4) {
|
|
550
|
-
var dataSources = _ref4.dataSources,
|
|
551
|
-
threshold = _ref4.threshold,
|
|
552
|
-
options = _ref4.options;
|
|
553
|
-
|
|
876
|
+
var downsampleDataSources = ({ dataSources, threshold, options }) => {
|
|
554
877
|
var _a, _b, _c;
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
var numPoints = (_c = (_b = (_a = primaryDS === null || primaryDS === void 0 ? void 0 : primaryDS.data) === null || _a === void 0 ? void 0 : _a.columns[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
559
|
-
|
|
878
|
+
const primaryDS = dataSources == null ? void 0 : dataSources.primary;
|
|
879
|
+
const numPoints = (_c = (_b = (_a = primaryDS == null ? void 0 : primaryDS.data) == null ? void 0 : _a.columns[0]) == null ? void 0 : _b.length) != null ? _c : 0;
|
|
560
880
|
if (Number.isNaN(threshold) || numPoints <= threshold || threshold < 2) {
|
|
561
881
|
return dataSources;
|
|
562
882
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
yFields = options.yFields,
|
|
566
|
-
fieldTypes = options.fieldTypes;
|
|
567
|
-
|
|
568
|
-
if (!xField || !(yFields === null || yFields === void 0 ? void 0 : yFields.length) || !(fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes.length)) {
|
|
883
|
+
const { xField, yFields, fieldTypes } = options;
|
|
884
|
+
if (!xField || !(yFields == null ? void 0 : yFields.length) || !(fieldTypes == null ? void 0 : fieldTypes.length)) {
|
|
569
885
|
return dataSources;
|
|
570
886
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
return !yField.startsWith('_');
|
|
574
|
-
}));
|
|
575
|
-
var maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints); // Do not try to downsample if there are too many downsampled pts
|
|
576
|
-
// At the worst case, each series has non-overlapping downsampled pts
|
|
577
|
-
// which will mean that all points will be included in the downsampled result
|
|
578
|
-
// This will just lead to additional overhead due to coercing each
|
|
579
|
-
// x and y field to number
|
|
580
|
-
|
|
887
|
+
const nonInternalYFields = new Set(yFields.filter((yField) => !yField.startsWith("_")));
|
|
888
|
+
const maxPointsInDownsample = Math.min(nonInternalYFields.size * threshold, numPoints);
|
|
581
889
|
if (maxPointsInDownsample >= numPoints) {
|
|
582
890
|
return dataSources;
|
|
583
891
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
892
|
+
const { xColumn, yColumns } = tryToCoerceAllDisplayedFields(
|
|
893
|
+
primaryDS,
|
|
894
|
+
xField,
|
|
895
|
+
nonInternalYFields,
|
|
896
|
+
fieldTypes,
|
|
897
|
+
options
|
|
898
|
+
);
|
|
589
899
|
if (!yColumns.length || !xColumn.length) {
|
|
590
900
|
return dataSources;
|
|
591
901
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
// perform LTTB downsampling for current series, LTTB takes an [x, y] pair
|
|
597
|
-
var xyPair = yColumn.map(function (yValue, index) {
|
|
902
|
+
const downsampledDataSources = __spreadValues({}, dataSources);
|
|
903
|
+
const downsampledIndices = /* @__PURE__ */ new Set();
|
|
904
|
+
yColumns.forEach((yColumn, columnIndex) => {
|
|
905
|
+
const xyPair = yColumn.map((yValue, index) => {
|
|
598
906
|
return [xColumn[index], yValue];
|
|
599
907
|
});
|
|
600
|
-
|
|
601
908
|
try {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
909
|
+
const { downsampledIndices: downsampledIndicesForSeries } = largestTriangleThreeBuckets(
|
|
910
|
+
xyPair,
|
|
911
|
+
threshold,
|
|
912
|
+
downsampledIndices
|
|
913
|
+
);
|
|
914
|
+
downsampledIndicesForSeries.forEach((downsampleIndex) => downsampledIndices.add(downsampleIndex));
|
|
608
915
|
} catch (e) {
|
|
609
|
-
|
|
610
|
-
console.error("Error occurred while downsampling column ".concat(columnIndex), e);
|
|
916
|
+
console.error(`Error occurred while downsampling column ${columnIndex}`, e);
|
|
611
917
|
}
|
|
612
|
-
});
|
|
613
|
-
|
|
918
|
+
});
|
|
614
919
|
downsampledDataSources.primary = pickIndicesFromDataSource(primaryDS, downsampledIndices);
|
|
615
920
|
return downsampledDataSources;
|
|
616
921
|
};
|
|
617
922
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
/***/ }),
|
|
628
|
-
|
|
629
|
-
/***/ 144:
|
|
630
|
-
/***/ (function(module, exports) {
|
|
631
|
-
|
|
632
|
-
module.exports = require("@splunk/react-ui/Heading");
|
|
633
|
-
|
|
634
|
-
/***/ }),
|
|
635
|
-
|
|
636
|
-
/***/ 15:
|
|
637
|
-
/***/ (function(module, exports) {
|
|
638
|
-
|
|
639
|
-
module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
640
|
-
|
|
641
|
-
/***/ }),
|
|
642
|
-
|
|
643
|
-
/***/ 16:
|
|
644
|
-
/***/ (function(module, exports) {
|
|
645
|
-
|
|
646
|
-
module.exports = require("@splunk/visualization-encoding/Options");
|
|
647
|
-
|
|
648
|
-
/***/ }),
|
|
649
|
-
|
|
650
|
-
/***/ 17:
|
|
651
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
652
|
-
|
|
653
|
-
"use strict";
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
var _slicedToArray = __webpack_require__(5);
|
|
657
|
-
|
|
658
|
-
Object.defineProperty(exports, "__esModule", {
|
|
659
|
-
value: true
|
|
660
|
-
});
|
|
661
|
-
|
|
662
|
-
var React = __webpack_require__(1);
|
|
663
|
-
|
|
664
|
-
var styled_components_1 = __webpack_require__(4);
|
|
665
|
-
|
|
666
|
-
var style_1 = __webpack_require__(18);
|
|
667
|
-
|
|
668
|
-
var colorUtils_1 = __webpack_require__(15);
|
|
669
|
-
|
|
670
|
-
var SizeAwareWrapper_1 = __webpack_require__(25);
|
|
923
|
+
// src/common/hooks/usePrevious.ts
|
|
924
|
+
function usePrevious(value) {
|
|
925
|
+
const ref = (0, react_exports.useRef)();
|
|
926
|
+
(0, react_exports.useEffect)(() => {
|
|
927
|
+
ref.current = value;
|
|
928
|
+
});
|
|
929
|
+
return ref.current;
|
|
930
|
+
}
|
|
671
931
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
932
|
+
// src/common/hooks/useGetXAndYFields.tsx
|
|
933
|
+
var useGetXAndYFields = ({
|
|
934
|
+
shouldEvaluateDSL,
|
|
935
|
+
options,
|
|
936
|
+
context,
|
|
937
|
+
dataSources
|
|
938
|
+
}) => {
|
|
939
|
+
const { dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint } = (0, react_exports.useMemo)(() => {
|
|
940
|
+
var _a, _b, _c;
|
|
941
|
+
if (!shouldEvaluateDSL) {
|
|
942
|
+
return {
|
|
943
|
+
dataSourcesWithOnlyOnePoint: null,
|
|
944
|
+
dataFrameWithOnlyOnePoint: null
|
|
945
|
+
};
|
|
677
946
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
683
|
-
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
684
|
-
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
685
|
-
|
|
686
|
-
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
687
|
-
var width = _ref2.width,
|
|
688
|
-
height = _ref2.height;
|
|
689
|
-
return {
|
|
690
|
-
style: Object.assign(Object.assign({}, width && {
|
|
691
|
-
width: (0, style_1.toPx)(width)
|
|
692
|
-
}), height && {
|
|
693
|
-
height: (0, style_1.toPx)(height)
|
|
694
|
-
})
|
|
695
|
-
};
|
|
696
|
-
}).withConfig({
|
|
697
|
-
displayName: "FixedSizeContainer__FixSizeItem",
|
|
698
|
-
componentId: "sc-1yhgpod-1"
|
|
699
|
-
})(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
|
|
700
|
-
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
701
|
-
});
|
|
702
|
-
var ItemContent = styled_components_1.default.div.withConfig({
|
|
703
|
-
displayName: "FixedSizeContainer__ItemContent",
|
|
704
|
-
componentId: "sc-1yhgpod-2"
|
|
705
|
-
})(["position:relative;min-height:100px;width:100%;"]);
|
|
706
|
-
var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
707
|
-
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
708
|
-
componentId: "sc-1yhgpod-3"
|
|
709
|
-
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
710
|
-
|
|
711
|
-
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
712
|
-
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
713
|
-
var width = props.width,
|
|
714
|
-
height = props.height,
|
|
715
|
-
backgroundColor = props.backgroundColor;
|
|
716
|
-
var cachedHandleResize = React.useCallback(function (w, h) {
|
|
717
|
-
setContainerWidth(w);
|
|
718
|
-
setContainerHeight(h);
|
|
719
|
-
}, []);
|
|
720
|
-
|
|
721
|
-
var _React$useState = React.useState(Number(props.width)),
|
|
722
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
723
|
-
containerWidth = _React$useState2[0],
|
|
724
|
-
setContainerWidth = _React$useState2[1];
|
|
725
|
-
|
|
726
|
-
var _React$useState3 = React.useState(Number(props.height)),
|
|
727
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
728
|
-
containerHeight = _React$useState4[0],
|
|
729
|
-
setContainerHeight = _React$useState4[1];
|
|
730
|
-
|
|
731
|
-
if (!height) {
|
|
732
|
-
return React.createElement(Item, {
|
|
733
|
-
"data-test": "item",
|
|
734
|
-
width: width,
|
|
735
|
-
backgroundColor: backgroundColor
|
|
736
|
-
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
947
|
+
if (!((_c = (_b = (_a = dataSources == null ? void 0 : dataSources.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.columns) == null ? void 0 : _c.length)) {
|
|
948
|
+
return {
|
|
949
|
+
dataSourcesWithOnlyOnePoint: null,
|
|
950
|
+
dataFrameWithOnlyOnePoint: null
|
|
951
|
+
};
|
|
737
952
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
953
|
+
const { primary: primaryDS } = dataSources;
|
|
954
|
+
const columnsWithOnlyOnePoint = primaryDS.data.columns.map((column) => {
|
|
955
|
+
return [column[0]];
|
|
956
|
+
});
|
|
957
|
+
const filteredDataSources = {
|
|
958
|
+
primary: __spreadProps(__spreadValues({}, primaryDS), {
|
|
959
|
+
data: __spreadProps(__spreadValues({}, primaryDS.data), {
|
|
960
|
+
columns: columnsWithOnlyOnePoint
|
|
961
|
+
})
|
|
962
|
+
})
|
|
963
|
+
};
|
|
964
|
+
return {
|
|
965
|
+
dataSourcesWithOnlyOnePoint: filteredDataSources,
|
|
966
|
+
dataFrameWithOnlyOnePoint: Options_exports.Options.dataFrameFromDataSource(filteredDataSources)
|
|
967
|
+
};
|
|
968
|
+
}, [dataSources, shouldEvaluateDSL]);
|
|
969
|
+
const xAndYFieldsWithTypes = (0, react_exports.useMemo)(() => {
|
|
970
|
+
try {
|
|
971
|
+
if (!dataSourcesWithOnlyOnePoint || !dataFrameWithOnlyOnePoint) {
|
|
972
|
+
return options;
|
|
973
|
+
}
|
|
974
|
+
if (!(options == null ? void 0 : options.x) || !(options == null ? void 0 : options.y) && !(options == null ? void 0 : options.y2)) {
|
|
975
|
+
return options;
|
|
976
|
+
}
|
|
977
|
+
const optionsToEvaluate = {
|
|
978
|
+
x: options.x,
|
|
979
|
+
xField: "> x | getField()",
|
|
980
|
+
y: options.y,
|
|
981
|
+
yFields: options.y ? "> y | getField()" : void 0,
|
|
982
|
+
y2: options.y2,
|
|
983
|
+
y2Fields: options.y2 ? "> y2 | getField()" : void 0,
|
|
984
|
+
fieldTypes: "> primary | getType()"
|
|
985
|
+
};
|
|
986
|
+
const { xField = "", yFields = [], y2Fields = [], fieldTypes } = Options_exports.Options.evaluate(
|
|
987
|
+
{ options: optionsToEvaluate, context },
|
|
988
|
+
dataSourcesWithOnlyOnePoint,
|
|
989
|
+
() => {
|
|
990
|
+
},
|
|
991
|
+
dataFrameWithOnlyOnePoint
|
|
992
|
+
);
|
|
993
|
+
return {
|
|
994
|
+
xField,
|
|
995
|
+
yFields: [...yFields, ...y2Fields],
|
|
996
|
+
fieldTypes
|
|
997
|
+
};
|
|
998
|
+
} catch (e) {
|
|
999
|
+
return {
|
|
1000
|
+
xField: void 0,
|
|
1001
|
+
yFields: [],
|
|
1002
|
+
fieldTypes: []
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
}, [options, context, dataSourcesWithOnlyOnePoint, dataFrameWithOnlyOnePoint]);
|
|
1006
|
+
return xAndYFieldsWithTypes;
|
|
757
1007
|
};
|
|
1008
|
+
var useGetXAndYFields_default = useGetXAndYFields;
|
|
1009
|
+
|
|
1010
|
+
// src/common/hooks/useDownsampleDataSources.tsx
|
|
1011
|
+
var downsampleVizOptionProperties = ["nullValueDisplay"];
|
|
1012
|
+
var useDownsampleDataSources = ({
|
|
1013
|
+
dataSources,
|
|
1014
|
+
options,
|
|
1015
|
+
context,
|
|
1016
|
+
threshold,
|
|
1017
|
+
isDownsamplingEnabled
|
|
1018
|
+
}) => {
|
|
1019
|
+
const isFirstUseEffectCall = (0, react_exports.useRef)(true);
|
|
1020
|
+
const xAndYFieldsWithTypes = useGetXAndYFields_default({
|
|
1021
|
+
shouldEvaluateDSL: isDownsamplingEnabled,
|
|
1022
|
+
options,
|
|
1023
|
+
context,
|
|
1024
|
+
dataSources
|
|
1025
|
+
});
|
|
1026
|
+
const downsampleVizOptions = (0, react_exports.useMemo)(() => (0, lodash_exports.pick)(options, downsampleVizOptionProperties), [options]);
|
|
1027
|
+
const downsampleDSOptions = (0, react_exports.useMemo)(
|
|
1028
|
+
() => __spreadValues(__spreadValues({}, downsampleVizOptions), xAndYFieldsWithTypes),
|
|
1029
|
+
[xAndYFieldsWithTypes, downsampleVizOptions]
|
|
1030
|
+
);
|
|
1031
|
+
const previousDownsampleDSOptions = usePrevious(downsampleDSOptions);
|
|
1032
|
+
const previousDataSources = usePrevious(dataSources);
|
|
1033
|
+
const previousThreshold = usePrevious(threshold);
|
|
1034
|
+
const [downsampledDataSources, setDownsampledDataSources] = (0, react_exports.useState)(() => {
|
|
1035
|
+
return isDownsamplingEnabled ? downsampleDataSources({
|
|
1036
|
+
dataSources,
|
|
1037
|
+
threshold,
|
|
1038
|
+
options: downsampleDSOptions
|
|
1039
|
+
}) : dataSources;
|
|
1040
|
+
});
|
|
1041
|
+
const debouncedDownsampleDataSources = (0, react_exports.useMemo)(() => {
|
|
1042
|
+
return (0, lodash_exports.debounce)(
|
|
1043
|
+
(downsampleOptions) => {
|
|
1044
|
+
const downsampledResult = downsampleDataSources(downsampleOptions);
|
|
1045
|
+
setDownsampledDataSources(downsampledResult);
|
|
1046
|
+
},
|
|
1047
|
+
100,
|
|
1048
|
+
{ trailing: true }
|
|
1049
|
+
);
|
|
1050
|
+
}, []);
|
|
1051
|
+
(0, react_exports.useEffect)(() => {
|
|
1052
|
+
if (isFirstUseEffectCall.current) {
|
|
1053
|
+
isFirstUseEffectCall.current = false;
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
if (!isDownsamplingEnabled) {
|
|
1057
|
+
setDownsampledDataSources(dataSources);
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
if ((0, lodash_exports.isEqual)(previousDownsampleDSOptions, downsampleDSOptions) && previousDataSources === dataSources && previousThreshold === threshold) {
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
debouncedDownsampleDataSources({
|
|
1064
|
+
dataSources,
|
|
1065
|
+
options: downsampleDSOptions,
|
|
1066
|
+
// Dont want to re-downsample everytime the options change
|
|
1067
|
+
threshold
|
|
1068
|
+
});
|
|
1069
|
+
}, [
|
|
1070
|
+
dataSources,
|
|
1071
|
+
downsampleDSOptions,
|
|
1072
|
+
debouncedDownsampleDataSources,
|
|
1073
|
+
xAndYFieldsWithTypes,
|
|
1074
|
+
threshold,
|
|
1075
|
+
isDownsamplingEnabled,
|
|
1076
|
+
previousDataSources,
|
|
1077
|
+
previousThreshold,
|
|
1078
|
+
previousDownsampleDSOptions
|
|
1079
|
+
]);
|
|
1080
|
+
return downsampledDataSources;
|
|
1081
|
+
};
|
|
1082
|
+
var useDownsampleDataSources_default = useDownsampleDataSources;
|
|
758
1083
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
/***/ 179:
|
|
764
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
765
|
-
|
|
766
|
-
"use strict";
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
var _taggedTemplateLiteral = __webpack_require__(78);
|
|
770
|
-
|
|
771
|
-
var _templateObject;
|
|
772
|
-
|
|
773
|
-
Object.defineProperty(exports, "__esModule", {
|
|
774
|
-
value: true
|
|
1084
|
+
// esm-externals:@splunk/visualization-context/FeatureFlags
|
|
1085
|
+
var FeatureFlags_exports = {};
|
|
1086
|
+
__export(FeatureFlags_exports, {
|
|
1087
|
+
default: () => FeatureFlags_default
|
|
775
1088
|
});
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
var types_1 = __webpack_require__(103);
|
|
781
|
-
|
|
782
|
-
var React = __webpack_require__(1);
|
|
783
|
-
|
|
784
|
-
var style_1 = __webpack_require__(18);
|
|
785
|
-
|
|
786
|
-
var Markdown_1 = __webpack_require__(142);
|
|
787
|
-
|
|
788
|
-
var styled_components_1 = __webpack_require__(4);
|
|
789
|
-
|
|
790
|
-
var T = __webpack_require__(0);
|
|
791
|
-
|
|
792
|
-
var themes_1 = __webpack_require__(79);
|
|
793
|
-
|
|
794
|
-
var Heading_1 = __webpack_require__(144);
|
|
795
|
-
|
|
796
|
-
var Paragraph_1 = __webpack_require__(131);
|
|
797
|
-
|
|
798
|
-
var List_1 = __webpack_require__(434);
|
|
1089
|
+
var defaultImport29 = __toESM(require("@splunk/visualization-context/FeatureFlags"));
|
|
1090
|
+
__reExport(FeatureFlags_exports, require("@splunk/visualization-context/FeatureFlags"));
|
|
1091
|
+
var FeatureFlags_default = "default" in defaultImport29 ? defaultImport29.default : defaultImport29;
|
|
799
1092
|
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
var config_1 = __webpack_require__(436);
|
|
805
|
-
|
|
806
|
-
exports.config = config_1.default; // map of valid font sizes with elements' respective pixel sizes
|
|
807
|
-
|
|
808
|
-
exports.FONT_SIZES = {
|
|
809
|
-
extraSmall: {
|
|
810
|
-
h1: 18,
|
|
811
|
-
h2: 14,
|
|
812
|
-
h3: 12,
|
|
813
|
-
p: 10
|
|
814
|
-
},
|
|
815
|
-
small: {
|
|
816
|
-
h1: 20,
|
|
817
|
-
h2: 16,
|
|
818
|
-
h3: 14,
|
|
819
|
-
p: 12
|
|
820
|
-
},
|
|
821
|
-
default: {
|
|
822
|
-
h1: 24,
|
|
823
|
-
h2: 18,
|
|
824
|
-
h3: 16,
|
|
825
|
-
p: 14
|
|
826
|
-
},
|
|
827
|
-
large: {
|
|
828
|
-
h1: 32,
|
|
829
|
-
h2: 24,
|
|
830
|
-
h3: 18,
|
|
831
|
-
p: 16
|
|
832
|
-
},
|
|
833
|
-
extraLarge: {
|
|
834
|
-
h1: 48,
|
|
835
|
-
h2: 32,
|
|
836
|
-
h3: 24,
|
|
837
|
-
p: 18
|
|
1093
|
+
// src/common/utils/featureFlagUtils.ts
|
|
1094
|
+
var getFeatureFlag = (context, flagName) => {
|
|
1095
|
+
if (context && Object.keys(context).find((key) => key === flagName)) {
|
|
1096
|
+
return context[flagName];
|
|
838
1097
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
// or the number of heading level;
|
|
842
|
-
// casting heading level below 4 to 4
|
|
843
|
-
// because ReactMarkdown supports heading level 1-4
|
|
844
|
-
|
|
845
|
-
var MarkdownContainer = styled_components_1.default.div.withConfig({
|
|
846
|
-
displayName: "Markdown__MarkdownContainer",
|
|
847
|
-
componentId: "sc-zd3qkg-0"
|
|
848
|
-
})(["overflow:auto;position:relative;box-sizing:border-box;", ";", ";background-color:", ";transform-origin:center;transform:rotate(", "deg);& *:not(code):not(pre):not(code *):not(a){color:", ";}", ";"], function (props) {
|
|
849
|
-
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
850
|
-
}, function (props) {
|
|
851
|
-
return (0, style_1.toPadding)(props.padding);
|
|
852
|
-
}, function (props) {
|
|
853
|
-
return props.backgroundColor;
|
|
854
|
-
}, function (props) {
|
|
855
|
-
return props.rotation || 0;
|
|
856
|
-
}, function (props) {
|
|
857
|
-
return props.fontColor;
|
|
858
|
-
}, function (_ref) {
|
|
859
|
-
var startsWithHeader = _ref.startsWithHeader;
|
|
860
|
-
return startsWithHeader && "\n h".concat(startsWithHeader >= 4 ? 4 : startsWithHeader, ":first-of-type { \n margin-top: 0px;\n }\n ");
|
|
861
|
-
});
|
|
862
|
-
var CodeBlockContainer = styled_components_1.default.div.withConfig({
|
|
863
|
-
displayName: "Markdown__CodeBlockContainer",
|
|
864
|
-
componentId: "sc-zd3qkg-1"
|
|
865
|
-
})(["padding:", ";margin:", " 0;background-color:", ";pre[data-test='code']{margin-bottom:0px;}code{font-size:", "px !important;line-height:", "px !important;}"], (0, themes_1.pick)({
|
|
866
|
-
enterprise: themes_1.variables.spacingHalf,
|
|
867
|
-
prisma: (0, styled_components_1.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["10px ", ""])), themes_1.variables.spacingLarge)
|
|
868
|
-
}), (0, themes_1.pick)({
|
|
869
|
-
enterprise: themes_1.variables.spacingHalf,
|
|
870
|
-
prisma: themes_1.variables.spacingLarge
|
|
871
|
-
}), (0, themes_1.pick)({
|
|
872
|
-
enterprise: {
|
|
873
|
-
light: themes_1.variables.gray96,
|
|
874
|
-
dark: themes_1.variables.gray22
|
|
875
|
-
},
|
|
876
|
-
prisma: themes_1.variables.backgroundColorSection
|
|
877
|
-
}), function (props) {
|
|
878
|
-
return props.fontSize;
|
|
879
|
-
}, function (props) {
|
|
880
|
-
return props.fontSize;
|
|
881
|
-
});
|
|
882
|
-
var CodeInlineContainer = styled_components_1.default.code.withConfig({
|
|
883
|
-
displayName: "Markdown__CodeInlineContainer",
|
|
884
|
-
componentId: "sc-zd3qkg-2"
|
|
885
|
-
})(["", ";font-family:", ";background-color:", ";"], themes_1.mixins.reset('inline'), themes_1.variables.monoFontFamily, (0, themes_1.pick)({
|
|
886
|
-
enterprise: {
|
|
887
|
-
light: themes_1.variables.gray92,
|
|
888
|
-
dark: themes_1.variables.gray22
|
|
889
|
-
},
|
|
890
|
-
prisma: themes_1.variables.neutral200
|
|
891
|
-
})); // retrieves the font map associated with a valid `fontSize` value. If the fontSize
|
|
892
|
-
// passed is invalid (does not exist in FONT_SIZES), the `default` value is used.
|
|
893
|
-
|
|
894
|
-
var getFontMap = function getFontMap(fontSize) {
|
|
895
|
-
var font = fontSize;
|
|
896
|
-
|
|
897
|
-
if (!exports.FONT_SIZES[fontSize] && fontSize !== 'custom') {
|
|
898
|
-
console.error("'".concat(fontSize, "' is not a valid value for Markdown's fontSize option. Using the 'default' font size."));
|
|
899
|
-
font = 'default';
|
|
1098
|
+
if (Object.keys(FeatureFlags_default).find((key) => key === flagName)) {
|
|
1099
|
+
return FeatureFlags_default[flagName];
|
|
900
1100
|
}
|
|
901
|
-
|
|
902
|
-
return exports.FONT_SIZES[font];
|
|
903
|
-
};
|
|
904
|
-
|
|
905
|
-
exports.getFontMap = getFontMap;
|
|
906
|
-
|
|
907
|
-
var handleLinkClick = function handleLinkClick(e) {
|
|
908
|
-
return e.stopPropagation();
|
|
1101
|
+
return false;
|
|
909
1102
|
};
|
|
910
1103
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
// defaults to customFontSize of 14px if value is invalid
|
|
918
|
-
var cleanedCustomFontSize = (0, types_1.isNumber)(customFontSize) ? customFontSize : 14;
|
|
919
|
-
var isCustomFontSize = fontSize === 'custom';
|
|
920
|
-
/* eslint-disable react/display-name, react/prop-types */
|
|
921
|
-
|
|
922
|
-
var fontMap = isCustomFontSize ? {
|
|
923
|
-
h1: cleanedCustomFontSize * 2.0,
|
|
924
|
-
h2: cleanedCustomFontSize * 1.5,
|
|
925
|
-
h3: cleanedCustomFontSize * 1.25,
|
|
926
|
-
p: cleanedCustomFontSize
|
|
927
|
-
} : getFontMap(fontSize);
|
|
928
|
-
return {
|
|
929
|
-
paragraphRenderer: function paragraphRenderer(_ref2) {
|
|
930
|
-
var children = _ref2.children;
|
|
931
|
-
return React.createElement(Paragraph_1.default, {
|
|
932
|
-
style: Object.assign({
|
|
933
|
-
fontSize: fontMap.p,
|
|
934
|
-
lineHeight: "".concat(fontMap.p, "px")
|
|
935
|
-
}, fontFamilyStyle)
|
|
936
|
-
}, children);
|
|
937
|
-
},
|
|
938
|
-
headingRenderer: function headingRenderer(_ref3) {
|
|
939
|
-
var children = _ref3.children,
|
|
940
|
-
level = _ref3.level;
|
|
941
|
-
return React.createElement(Heading_1.default, {
|
|
942
|
-
level: level,
|
|
943
|
-
style: Object.assign({
|
|
944
|
-
fontSize: fontMap["h".concat(level)],
|
|
945
|
-
lineHeight: "".concat(fontMap["h".concat(level)], "px")
|
|
946
|
-
}, fontFamilyStyle)
|
|
947
|
-
}, children);
|
|
1104
|
+
// src/common/withDashboardViz.tsx
|
|
1105
|
+
var withDashboardViz = (opts) => {
|
|
1106
|
+
const {
|
|
1107
|
+
ReactViz,
|
|
1108
|
+
vizConfig,
|
|
1109
|
+
computeVizProps: computeVizProps2 = () => {
|
|
948
1110
|
},
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
style: {
|
|
976
|
-
fontSize: fontMap.p
|
|
977
|
-
}
|
|
978
|
-
}, literal);
|
|
979
|
-
},
|
|
980
|
-
linkRenderer: function linkRenderer(_ref7) {
|
|
981
|
-
var href = _ref7.href,
|
|
982
|
-
children = _ref7.children;
|
|
983
|
-
return React.createElement(StyledA, {
|
|
984
|
-
href: href,
|
|
985
|
-
onClick: handleLinkClick
|
|
986
|
-
}, children);
|
|
1111
|
+
disableEditModeCover,
|
|
1112
|
+
useIconPlaceholder
|
|
1113
|
+
} = opts;
|
|
1114
|
+
const SanitizedReactViz = (0, SanitizeProps_exports.withSanitizedProps)(ReactViz);
|
|
1115
|
+
const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(vizConfig.optionsSchema, "default");
|
|
1116
|
+
const DashboardViz = (props) => {
|
|
1117
|
+
var _a;
|
|
1118
|
+
const {
|
|
1119
|
+
mode,
|
|
1120
|
+
hasEventHandlers,
|
|
1121
|
+
dataSources,
|
|
1122
|
+
// type of { [key: string]: DataSource }
|
|
1123
|
+
options,
|
|
1124
|
+
context = {},
|
|
1125
|
+
width,
|
|
1126
|
+
height,
|
|
1127
|
+
onComputedProps,
|
|
1128
|
+
onEventTrigger,
|
|
1129
|
+
theme,
|
|
1130
|
+
onRequestParamsChange
|
|
1131
|
+
} = props;
|
|
1132
|
+
const { serializedTimezone } = react_exports.useContext(TimezoneContext_default);
|
|
1133
|
+
if (serializedTimezone) {
|
|
1134
|
+
if (!moment_default.getDefaultSplunkTimezone()) {
|
|
1135
|
+
moment_default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1136
|
+
}
|
|
987
1137
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
var MarkdownVisualization = function MarkdownVisualization(_ref8) {
|
|
992
|
-
var height = _ref8.height,
|
|
993
|
-
width = _ref8.width,
|
|
994
|
-
markdown = _ref8.markdown,
|
|
995
|
-
backgroundColor = _ref8.backgroundColor,
|
|
996
|
-
fontColor = _ref8.fontColor,
|
|
997
|
-
fontFamily = _ref8.fontFamily,
|
|
998
|
-
fontSize = _ref8.fontSize,
|
|
999
|
-
customFontSize = _ref8.customFontSize,
|
|
1000
|
-
rotation = _ref8.rotation,
|
|
1001
|
-
hasEventHandlers = _ref8.hasEventHandlers,
|
|
1002
|
-
onMarkdownClick = _ref8.onMarkdownClick;
|
|
1003
|
-
|
|
1004
|
-
var _a;
|
|
1005
|
-
|
|
1006
|
-
var _ref9 = (0, themes_1.useSplunkTheme)(),
|
|
1007
|
-
defaultFontFamily = _ref9.fontFamily; // font-family style for non-code content - default font family appended to custom option value as fallback
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
var markdownContentFontFamilyStyle = {
|
|
1011
|
-
fontFamily: "".concat(fontFamily, ", ").concat(defaultFontFamily)
|
|
1012
|
-
}; // because DSL evaluation is not guaranteed to return string data if `markdown` is powered by DSL, we do a typecast here
|
|
1013
|
-
|
|
1014
|
-
var stringifiedMarkdown = "".concat(markdown);
|
|
1015
|
-
var renderersForFontSize = getMarkdownRenderer(markdownContentFontFamilyStyle, fontSize, customFontSize);
|
|
1016
|
-
return React.createElement(MarkdownContainer, {
|
|
1017
|
-
"data-test": "markdown-container",
|
|
1018
|
-
padding: [5, 5, 5, 5],
|
|
1019
|
-
width: width,
|
|
1020
|
-
height: height,
|
|
1021
|
-
rotation: rotation,
|
|
1022
|
-
backgroundColor: backgroundColor,
|
|
1023
|
-
fontColor: fontColor,
|
|
1024
|
-
startsWithHeader: (_a = stringifiedMarkdown.trim().match(/^#+/)) === null || _a === void 0 ? void 0 : _a[0].length
|
|
1025
|
-
}, React.createElement(Markdown_1.default, Object.assign({
|
|
1026
|
-
text: stringifiedMarkdown
|
|
1027
|
-
}, renderersForFontSize, {
|
|
1028
|
-
style: {
|
|
1029
|
-
height: '100%',
|
|
1030
|
-
cursor: hasEventHandlers ? 'pointer' : 'inherit'
|
|
1031
|
-
},
|
|
1032
|
-
onClick: onMarkdownClick
|
|
1033
|
-
})));
|
|
1034
|
-
};
|
|
1035
|
-
|
|
1036
|
-
var propTypes = {
|
|
1037
|
-
width: T.oneOfType([T.string, T.number]),
|
|
1038
|
-
height: T.oneOfType([T.string, T.number]),
|
|
1039
|
-
markdown: T.string,
|
|
1040
|
-
backgroundColor: T.string,
|
|
1041
|
-
fontColor: T.string,
|
|
1042
|
-
fontFamily: T.string,
|
|
1043
|
-
fontSize: T.string,
|
|
1044
|
-
customFontSize: T.number,
|
|
1045
|
-
rotation: T.number,
|
|
1046
|
-
hasEventHandlers: T.bool,
|
|
1047
|
-
onMarkdownClick: T.func
|
|
1048
|
-
};
|
|
1049
|
-
var defaultProps = {
|
|
1050
|
-
width: '100%',
|
|
1051
|
-
height: undefined,
|
|
1052
|
-
markdown: '',
|
|
1053
|
-
backgroundColor: 'transparent',
|
|
1054
|
-
fontColor: 'rgba(255, 255, 255, 0.7)',
|
|
1055
|
-
fontFamily: 'Splunk Platform Sans',
|
|
1056
|
-
fontSize: 'default',
|
|
1057
|
-
customFontSize: 14,
|
|
1058
|
-
rotation: 0,
|
|
1059
|
-
hasEventHandlers: false,
|
|
1060
|
-
onMarkdownClick: function onMarkdownClick() {}
|
|
1061
|
-
};
|
|
1062
|
-
MarkdownVisualization.propTypes = propTypes;
|
|
1063
|
-
MarkdownVisualization.defaultProps = defaultProps;
|
|
1064
|
-
|
|
1065
|
-
var computeVizProps = function computeVizProps(props) {
|
|
1066
|
-
return props;
|
|
1067
|
-
};
|
|
1068
|
-
|
|
1069
|
-
exports.computeVizProps = computeVizProps;
|
|
1070
|
-
var Markdown = (0, withDashboardViz_1.default)({
|
|
1071
|
-
ReactViz: MarkdownVisualization,
|
|
1072
|
-
vizConfig: config_1.default,
|
|
1073
|
-
computeVizProps: exports.computeVizProps
|
|
1074
|
-
});
|
|
1075
|
-
var themes = config_1.default.themes;
|
|
1076
|
-
exports.themes = themes;
|
|
1077
|
-
exports.default = Markdown;
|
|
1078
|
-
|
|
1079
|
-
/***/ }),
|
|
1080
|
-
|
|
1081
|
-
/***/ 18:
|
|
1082
|
-
/***/ (function(module, exports) {
|
|
1083
|
-
|
|
1084
|
-
module.exports = require("@splunk/visualizations-shared/style");
|
|
1085
|
-
|
|
1086
|
-
/***/ }),
|
|
1087
|
-
|
|
1088
|
-
/***/ 2:
|
|
1089
|
-
/***/ (function(module, exports) {
|
|
1090
|
-
|
|
1091
|
-
module.exports = require("lodash");
|
|
1092
|
-
|
|
1093
|
-
/***/ }),
|
|
1094
|
-
|
|
1095
|
-
/***/ 20:
|
|
1096
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1097
|
-
|
|
1098
|
-
"use strict";
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1102
|
-
value: true
|
|
1103
|
-
});
|
|
1104
|
-
exports.validOutputModes = exports.validSortDirs = void 0;
|
|
1105
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1106
|
-
exports.validOutputModes = ['json_cols', 'json'];
|
|
1107
|
-
|
|
1108
|
-
/***/ }),
|
|
1109
|
-
|
|
1110
|
-
/***/ 21:
|
|
1111
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1112
|
-
|
|
1113
|
-
"use strict";
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
var _classCallCheck = __webpack_require__(8);
|
|
1117
|
-
|
|
1118
|
-
var _createClass = __webpack_require__(24);
|
|
1119
|
-
|
|
1120
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1121
|
-
value: true
|
|
1122
|
-
});
|
|
1123
|
-
exports.DefaultVizActionHandler = void 0;
|
|
1124
|
-
|
|
1125
|
-
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1126
|
-
function DefaultVizActionHandler() {
|
|
1127
|
-
_classCallCheck(this, DefaultVizActionHandler);
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
_createClass(DefaultVizActionHandler, [{
|
|
1131
|
-
key: "focus",
|
|
1132
|
-
value: function focus() {// noop
|
|
1133
|
-
}
|
|
1134
|
-
}, {
|
|
1135
|
-
key: "snapshot",
|
|
1136
|
-
value: function snapshot() {
|
|
1137
|
-
return null; // noop
|
|
1138
|
-
}
|
|
1139
|
-
}]);
|
|
1140
|
-
|
|
1141
|
-
return DefaultVizActionHandler;
|
|
1142
|
-
}();
|
|
1143
|
-
|
|
1144
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1145
|
-
|
|
1146
|
-
/***/ }),
|
|
1147
|
-
|
|
1148
|
-
/***/ 22:
|
|
1149
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1150
|
-
|
|
1151
|
-
"use strict";
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1155
|
-
value: true
|
|
1156
|
-
});
|
|
1157
|
-
exports.VizCategory = void 0;
|
|
1158
|
-
var VizCategory;
|
|
1159
|
-
|
|
1160
|
-
(function (VizCategory) {
|
|
1161
|
-
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1162
|
-
VizCategory["TRENDS"] = "Trends";
|
|
1163
|
-
VizCategory["COMPARISONS"] = "Comparisons";
|
|
1164
|
-
VizCategory["TABLE"] = "Table";
|
|
1165
|
-
VizCategory["GAUGE"] = "Gauge";
|
|
1166
|
-
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
1167
|
-
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
1168
|
-
VizCategory["SHAPES"] = "Shapes";
|
|
1169
|
-
VizCategory["MISC"] = "misc";
|
|
1170
|
-
VizCategory["FLOW"] = "Flow";
|
|
1171
|
-
VizCategory["CORRELATION"] = "Correlation";
|
|
1172
|
-
VizCategory["SPATIAL"] = "Spatial";
|
|
1173
|
-
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
1174
|
-
|
|
1175
|
-
/***/ }),
|
|
1176
|
-
|
|
1177
|
-
/***/ 23:
|
|
1178
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1179
|
-
|
|
1180
|
-
"use strict";
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1184
|
-
value: true
|
|
1185
|
-
});
|
|
1186
|
-
exports.extendStaticWrapperProps = void 0;
|
|
1187
|
-
/**
|
|
1188
|
-
* @method extendStaticWrapperProps
|
|
1189
|
-
* @param {Object} props
|
|
1190
|
-
* @param {DashboardVizType} props.Wrapper
|
|
1191
|
-
* @param {DashboardVizType} props.Visualization
|
|
1192
|
-
*/
|
|
1193
|
-
|
|
1194
|
-
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
1195
|
-
var Wrapper = _ref.Wrapper,
|
|
1196
|
-
Visualization = _ref.Visualization;
|
|
1197
|
-
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
1198
|
-
extendProperties.forEach(function (prop) {
|
|
1199
|
-
if (Visualization[prop]) {
|
|
1200
|
-
// eslint-disable-next-line no-param-reassign
|
|
1201
|
-
Wrapper[prop] = Visualization[prop];
|
|
1202
|
-
}
|
|
1203
|
-
});
|
|
1204
|
-
};
|
|
1205
|
-
|
|
1206
|
-
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
1207
|
-
|
|
1208
|
-
/***/ }),
|
|
1209
|
-
|
|
1210
|
-
/***/ 24:
|
|
1211
|
-
/***/ (function(module, exports) {
|
|
1212
|
-
|
|
1213
|
-
module.exports = require("@babel/runtime/helpers/createClass");
|
|
1214
|
-
|
|
1215
|
-
/***/ }),
|
|
1216
|
-
|
|
1217
|
-
/***/ 25:
|
|
1218
|
-
/***/ (function(module, exports) {
|
|
1219
|
-
|
|
1220
|
-
module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
1221
|
-
|
|
1222
|
-
/***/ }),
|
|
1223
|
-
|
|
1224
|
-
/***/ 26:
|
|
1225
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1226
|
-
|
|
1227
|
-
"use strict";
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
var _toConsumableArray = __webpack_require__(6);
|
|
1231
|
-
|
|
1232
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1233
|
-
value: true
|
|
1234
|
-
});
|
|
1235
|
-
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceConfig = exports.enhanceOptionsSchemaWithDynamicOptions = void 0;
|
|
1236
|
-
|
|
1237
|
-
var lodash_1 = __webpack_require__(2); // included for backwards compatibility
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
var visualization_schemas_1 = __webpack_require__(9);
|
|
1241
|
-
|
|
1242
|
-
Object.defineProperty(exports, "enhanceOptionsSchemaWithDynamicOptions", {
|
|
1243
|
-
enumerable: true,
|
|
1244
|
-
get: function get() {
|
|
1245
|
-
return visualization_schemas_1.enhanceOptionsSchemaWithDynamicOptions;
|
|
1246
|
-
}
|
|
1247
|
-
});
|
|
1248
|
-
/**
|
|
1249
|
-
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
1250
|
-
* this function also collapse all editor panels
|
|
1251
|
-
* @param vizConfig a Visualization Config
|
|
1252
|
-
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
1253
|
-
* and containing `open: false` for all editor panels in editorConfig
|
|
1254
|
-
*/
|
|
1255
|
-
|
|
1256
|
-
function enhanceConfig(vizConfig) {
|
|
1257
|
-
var enhancedConfig = Object.assign({}, vizConfig);
|
|
1258
|
-
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
1259
|
-
return Object.assign(Object.assign({}, config), {
|
|
1260
|
-
open: config.open || false
|
|
1261
|
-
});
|
|
1262
|
-
});
|
|
1263
|
-
return enhancedConfig;
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
exports.enhanceConfig = enhanceConfig;
|
|
1267
|
-
/**
|
|
1268
|
-
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
1269
|
-
* Created for editor unit tests
|
|
1270
|
-
* @param vizConfig a Visualization Config
|
|
1271
|
-
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
1272
|
-
*/
|
|
1273
|
-
|
|
1274
|
-
function uncollapseEditorConfig(vizConfig) {
|
|
1275
|
-
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
1276
|
-
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
1277
|
-
return Object.assign(Object.assign({}, config), {
|
|
1278
|
-
open: true
|
|
1279
|
-
});
|
|
1280
|
-
});
|
|
1281
|
-
return editorPanelUncollapsedConfig;
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
1285
|
-
|
|
1286
|
-
function isDynamicOption(option) {
|
|
1287
|
-
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
1291
|
-
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
1292
|
-
|
|
1293
|
-
/**
|
|
1294
|
-
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
1295
|
-
* 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
|
|
1296
|
-
* the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
|
|
1297
|
-
* the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
|
|
1298
|
-
*
|
|
1299
|
-
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
1300
|
-
*/
|
|
1301
|
-
|
|
1302
|
-
function hasCompatibleContexts(vizContext, presetContext) {
|
|
1303
|
-
var presetContextKeys = Object.keys(presetContext);
|
|
1304
|
-
return presetContextKeys.every(function (contextKey) {
|
|
1305
|
-
return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
/**
|
|
1309
|
-
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
1310
|
-
*/
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
1314
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
1315
|
-
return presetOptionKeys.every(function (optionKey) {
|
|
1316
|
-
return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
|
|
1317
|
-
});
|
|
1318
|
-
}
|
|
1319
|
-
/**
|
|
1320
|
-
* Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
|
|
1321
|
-
* This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
|
|
1322
|
-
*
|
|
1323
|
-
* @param {Object} vizContext - the current vizContext definition
|
|
1324
|
-
* @param {Object} vizOptions - the current vizOptions definition
|
|
1325
|
-
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
1326
|
-
*/
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
1330
|
-
return presets.find(function (preset) {
|
|
1331
|
-
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
1332
|
-
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
1333
|
-
var presetContextKeys = Object.keys(presetContext);
|
|
1334
|
-
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1335
|
-
// if not, then the preset is invalid in config.ts
|
|
1336
|
-
|
|
1337
|
-
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
1338
|
-
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
1339
|
-
});
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
exports.getInitialPreset = getInitialPreset;
|
|
1343
|
-
/**
|
|
1344
|
-
* generates number precision values for a Select editor
|
|
1345
|
-
*
|
|
1346
|
-
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
1347
|
-
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
1348
|
-
*/
|
|
1349
|
-
|
|
1350
|
-
function generatePrecisionValues(numPrecisionValues) {
|
|
1351
|
-
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
1352
|
-
return {
|
|
1353
|
-
label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
|
|
1354
|
-
value: i
|
|
1355
|
-
};
|
|
1356
|
-
});
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
exports.generatePrecisionValues = generatePrecisionValues;
|
|
1360
|
-
/**
|
|
1361
|
-
* insert layout in layout array, return a new layout array instead of updating the original
|
|
1362
|
-
*
|
|
1363
|
-
* @param {EditorLayoutConfig[][]} layout - editor layout
|
|
1364
|
-
* @param {Number} index - the index to insert layout item(s)
|
|
1365
|
-
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
1366
|
-
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
1367
|
-
*/
|
|
1368
|
-
|
|
1369
|
-
var insertLayout = function insertLayout(layout, index) {
|
|
1370
|
-
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1371
|
-
layoutItems[_key - 2] = arguments[_key];
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
1375
|
-
};
|
|
1376
|
-
|
|
1377
|
-
exports.insertLayout = insertLayout;
|
|
1378
|
-
|
|
1379
|
-
/***/ }),
|
|
1380
|
-
|
|
1381
|
-
/***/ 27:
|
|
1382
|
-
/***/ (function(module, exports) {
|
|
1383
|
-
|
|
1384
|
-
module.exports = require("@splunk/visualization-context/FeatureFlagContext");
|
|
1385
|
-
|
|
1386
|
-
/***/ }),
|
|
1387
|
-
|
|
1388
|
-
/***/ 3:
|
|
1389
|
-
/***/ (function(module, exports) {
|
|
1390
|
-
|
|
1391
|
-
module.exports = require("@splunk/ui-utils/i18n");
|
|
1392
|
-
|
|
1393
|
-
/***/ }),
|
|
1394
|
-
|
|
1395
|
-
/***/ 30:
|
|
1396
|
-
/***/ (function(module, exports) {
|
|
1397
|
-
|
|
1398
|
-
module.exports = require("@splunk/ui-utils/id");
|
|
1399
|
-
|
|
1400
|
-
/***/ }),
|
|
1401
|
-
|
|
1402
|
-
/***/ 31:
|
|
1403
|
-
/***/ (function(module, exports) {
|
|
1404
|
-
|
|
1405
|
-
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
1406
|
-
|
|
1407
|
-
/***/ }),
|
|
1408
|
-
|
|
1409
|
-
/***/ 32:
|
|
1410
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1411
|
-
|
|
1412
|
-
"use strict";
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1416
|
-
value: true
|
|
1417
|
-
});
|
|
1418
|
-
|
|
1419
|
-
var react_1 = __webpack_require__(1);
|
|
1420
|
-
|
|
1421
|
-
function usePrevious(value) {
|
|
1422
|
-
var ref = (0, react_1.useRef)();
|
|
1423
|
-
(0, react_1.useEffect)(function () {
|
|
1424
|
-
ref.current = value;
|
|
1425
|
-
});
|
|
1426
|
-
return ref.current;
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
exports.default = usePrevious;
|
|
1430
|
-
|
|
1431
|
-
/***/ }),
|
|
1432
|
-
|
|
1433
|
-
/***/ 33:
|
|
1434
|
-
/***/ (function(module, exports) {
|
|
1435
|
-
|
|
1436
|
-
module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
1437
|
-
|
|
1438
|
-
/***/ }),
|
|
1439
|
-
|
|
1440
|
-
/***/ 34:
|
|
1441
|
-
/***/ (function(module, exports) {
|
|
1442
|
-
|
|
1443
|
-
module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
|
|
1444
|
-
|
|
1445
|
-
/***/ }),
|
|
1446
|
-
|
|
1447
|
-
/***/ 36:
|
|
1448
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1449
|
-
|
|
1450
|
-
"use strict";
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1454
|
-
value: true
|
|
1455
|
-
});
|
|
1456
|
-
exports.shouldShowIconPlaceholder = void 0;
|
|
1457
|
-
|
|
1458
|
-
var React = __webpack_require__(1);
|
|
1459
|
-
|
|
1460
|
-
var T = __webpack_require__(0);
|
|
1461
|
-
|
|
1462
|
-
var lodash_1 = __webpack_require__(2);
|
|
1463
|
-
|
|
1464
|
-
var i18n_1 = __webpack_require__(3);
|
|
1465
|
-
|
|
1466
|
-
var Message_1 = __webpack_require__(11);
|
|
1467
|
-
|
|
1468
|
-
var FixedSizeContainer_1 = __webpack_require__(17);
|
|
1469
|
-
/**
|
|
1470
|
-
* @method shouldShowIconPlaceholder
|
|
1471
|
-
* @param {object} dataSources
|
|
1472
|
-
* @param {boolean} loading
|
|
1473
|
-
* @returns {boolean}
|
|
1474
|
-
*/
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
1478
|
-
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1479
|
-
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
1480
|
-
var noData = data === undefined;
|
|
1481
|
-
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields[0]', undefined);
|
|
1482
|
-
var noFields = fields === undefined;
|
|
1483
|
-
return loading || noData || noFields;
|
|
1484
|
-
};
|
|
1485
|
-
|
|
1486
|
-
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
1487
|
-
var propTypes = {
|
|
1488
|
-
icon: T.func,
|
|
1489
|
-
width: T.oneOfType([T.string, T.number]),
|
|
1490
|
-
height: T.oneOfType([T.string, T.number]),
|
|
1491
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
1492
|
-
backgroundColor: T.string,
|
|
1493
|
-
iconColor: T.string
|
|
1494
|
-
};
|
|
1495
|
-
/**
|
|
1496
|
-
* @method IconPlaceholder
|
|
1497
|
-
* @param {IconPlaceholderProps} props
|
|
1498
|
-
* @returns {React.ReactElement}
|
|
1499
|
-
*/
|
|
1500
|
-
|
|
1501
|
-
var IconPlaceholder = function IconPlaceholder(props) {
|
|
1502
|
-
var width = props.width,
|
|
1503
|
-
height = props.height,
|
|
1504
|
-
icon = props.icon,
|
|
1505
|
-
iconColor = props.iconColor;
|
|
1506
|
-
|
|
1507
|
-
if (icon) {
|
|
1508
|
-
return React.createElement(icon, {
|
|
1509
|
-
style: {
|
|
1510
|
-
left: '50%',
|
|
1511
|
-
top: '50%',
|
|
1512
|
-
color: iconColor,
|
|
1513
|
-
opacity: 0.15,
|
|
1514
|
-
position: 'absolute',
|
|
1515
|
-
transform: 'translate(-50%, -50%)'
|
|
1516
|
-
},
|
|
1517
|
-
width: '50%',
|
|
1518
|
-
height: '50%',
|
|
1519
|
-
'data-test': 'icon-placeholder'
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
return React.createElement(Message_1.default, {
|
|
1524
|
-
width: width,
|
|
1525
|
-
height: height,
|
|
1526
|
-
level: "warning",
|
|
1527
|
-
message: (0, i18n_1._)('No DataSource Connected')
|
|
1528
|
-
});
|
|
1529
|
-
};
|
|
1530
|
-
|
|
1531
|
-
IconPlaceholder.propTypes = propTypes;
|
|
1532
|
-
IconPlaceholder.defaultProps = {
|
|
1533
|
-
width: '100%',
|
|
1534
|
-
height: 250
|
|
1535
|
-
};
|
|
1536
|
-
exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
1537
|
-
|
|
1538
|
-
/***/ }),
|
|
1539
|
-
|
|
1540
|
-
/***/ 37:
|
|
1541
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1542
|
-
|
|
1543
|
-
"use strict";
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
var _defineProperty = __webpack_require__(12);
|
|
1547
|
-
|
|
1548
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1549
|
-
value: true
|
|
1550
|
-
});
|
|
1551
|
-
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
1552
|
-
|
|
1553
|
-
var T = __webpack_require__(0);
|
|
1554
|
-
|
|
1555
|
-
var lodash_1 = __webpack_require__(2);
|
|
1556
|
-
|
|
1557
|
-
var DataSource_1 = __webpack_require__(20);
|
|
1558
|
-
|
|
1559
|
-
exports.SortParamsPropTypes = T.shape({
|
|
1560
|
-
currentSortKey: T.string,
|
|
1561
|
-
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
1562
|
-
onSort: T.func
|
|
1563
|
-
});
|
|
1564
|
-
|
|
1565
|
-
var getSortingParams = function getSortingParams(_ref) {
|
|
1566
|
-
var requestParams = _ref.requestParams,
|
|
1567
|
-
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1568
|
-
var currentSortKey;
|
|
1569
|
-
var currentSortDir;
|
|
1570
|
-
var nextSortDirMap = {
|
|
1571
|
-
asc: 'desc',
|
|
1572
|
-
desc: 'asc',
|
|
1573
|
-
none: 'asc'
|
|
1574
|
-
};
|
|
1575
|
-
var onSort;
|
|
1576
|
-
|
|
1577
|
-
if (typeof onRequestParamsChange === 'function') {
|
|
1578
|
-
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
1579
|
-
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
1580
|
-
currentSortDir = requestParams.sort[currentSortKey];
|
|
1581
|
-
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
onSort = function onSort(e, _ref2) {
|
|
1585
|
-
var sortKey = _ref2.sortKey,
|
|
1586
|
-
sortDir = _ref2.sortDir;
|
|
1587
|
-
|
|
1588
|
-
if (typeof sortKey === 'string') {
|
|
1589
|
-
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
1590
|
-
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
1591
|
-
offset: 0,
|
|
1592
|
-
sort: _defineProperty({}, sortKey, nextSortDir)
|
|
1593
|
-
}));
|
|
1594
|
-
} else {
|
|
1595
|
-
onRequestParamsChange(requestParams);
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
return {
|
|
1601
|
-
currentSortKey: currentSortKey,
|
|
1602
|
-
currentSortDir: currentSortDir,
|
|
1603
|
-
onSort: onSort
|
|
1604
|
-
};
|
|
1605
|
-
};
|
|
1606
|
-
|
|
1607
|
-
exports.getSortingParams = getSortingParams;
|
|
1608
|
-
|
|
1609
|
-
/***/ }),
|
|
1610
|
-
|
|
1611
|
-
/***/ 38:
|
|
1612
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1613
|
-
|
|
1614
|
-
"use strict";
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1618
|
-
value: true
|
|
1619
|
-
});
|
|
1620
|
-
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1621
|
-
|
|
1622
|
-
var T = __webpack_require__(0);
|
|
1623
|
-
|
|
1624
|
-
var lodash_1 = __webpack_require__(2);
|
|
1625
|
-
|
|
1626
|
-
exports.PaginatorParamsPropTypes = T.shape({
|
|
1627
|
-
isPaging: T.bool,
|
|
1628
|
-
current: T.number,
|
|
1629
|
-
totalPages: T.number,
|
|
1630
|
-
onChange: T.func
|
|
1631
|
-
});
|
|
1632
|
-
|
|
1633
|
-
var getPaginationParams = function getPaginationParams(_ref) {
|
|
1634
|
-
var requestParams = _ref.requestParams,
|
|
1635
|
-
meta = _ref.meta,
|
|
1636
|
-
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1637
|
-
var totalCount = meta && meta.totalCount || 0;
|
|
1638
|
-
var offset = requestParams && requestParams.offset || 0;
|
|
1639
|
-
var count = requestParams && requestParams.count;
|
|
1640
|
-
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
1641
|
-
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
1642
|
-
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
1643
|
-
|
|
1644
|
-
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
1645
|
-
var page = _ref2.page,
|
|
1646
|
-
countArg = _ref2.count;
|
|
1647
|
-
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
1648
|
-
|
|
1649
|
-
if (typeof countArg === 'number') {
|
|
1650
|
-
newParams.count = countArg;
|
|
1651
|
-
newParams.offset = 0;
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
1655
|
-
|
|
1656
|
-
if (typeof page === 'number' && page > 0) {
|
|
1657
|
-
newParams.count = pageCount;
|
|
1658
|
-
newParams.offset = (page - 1) * pageCount;
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
onRequestParamsChange(newParams);
|
|
1662
|
-
};
|
|
1663
|
-
|
|
1664
|
-
return {
|
|
1665
|
-
isPaging: isPaging,
|
|
1666
|
-
current: current,
|
|
1667
|
-
totalPages: totalPages,
|
|
1668
|
-
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
1669
|
-
};
|
|
1670
|
-
};
|
|
1671
|
-
|
|
1672
|
-
exports.getPaginationParams = getPaginationParams;
|
|
1673
|
-
|
|
1674
|
-
/***/ }),
|
|
1675
|
-
|
|
1676
|
-
/***/ 39:
|
|
1677
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1678
|
-
|
|
1679
|
-
"use strict";
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1683
|
-
if (k2 === undefined) k2 = k;
|
|
1684
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1685
|
-
|
|
1686
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1687
|
-
desc = {
|
|
1688
|
-
enumerable: true,
|
|
1689
|
-
get: function get() {
|
|
1690
|
-
return m[k];
|
|
1691
|
-
}
|
|
1692
|
-
};
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
Object.defineProperty(o, k2, desc);
|
|
1696
|
-
} : function (o, m, k, k2) {
|
|
1697
|
-
if (k2 === undefined) k2 = k;
|
|
1698
|
-
o[k2] = m[k];
|
|
1699
|
-
});
|
|
1700
|
-
|
|
1701
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1702
|
-
for (var p in m) {
|
|
1703
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1704
|
-
}
|
|
1705
|
-
};
|
|
1706
|
-
|
|
1707
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1708
|
-
value: true
|
|
1709
|
-
});
|
|
1710
|
-
|
|
1711
|
-
__exportStar(__webpack_require__(40), exports);
|
|
1712
|
-
|
|
1713
|
-
__exportStar(__webpack_require__(41), exports);
|
|
1714
|
-
|
|
1715
|
-
__exportStar(__webpack_require__(20), exports);
|
|
1716
|
-
|
|
1717
|
-
__exportStar(__webpack_require__(42), exports);
|
|
1718
|
-
|
|
1719
|
-
__exportStar(__webpack_require__(43), exports);
|
|
1720
|
-
|
|
1721
|
-
__exportStar(__webpack_require__(44), exports);
|
|
1722
|
-
|
|
1723
|
-
__exportStar(__webpack_require__(45), exports);
|
|
1724
|
-
|
|
1725
|
-
__exportStar(__webpack_require__(46), exports);
|
|
1726
|
-
|
|
1727
|
-
__exportStar(__webpack_require__(47), exports);
|
|
1728
|
-
|
|
1729
|
-
__exportStar(__webpack_require__(21), exports);
|
|
1730
|
-
|
|
1731
|
-
__exportStar(__webpack_require__(7), exports);
|
|
1732
|
-
|
|
1733
|
-
__exportStar(__webpack_require__(22), exports);
|
|
1734
|
-
|
|
1735
|
-
__exportStar(__webpack_require__(48), exports);
|
|
1736
|
-
|
|
1737
|
-
__exportStar(__webpack_require__(49), exports);
|
|
1738
|
-
|
|
1739
|
-
__exportStar(__webpack_require__(50), exports);
|
|
1740
|
-
|
|
1741
|
-
__exportStar(__webpack_require__(51), exports);
|
|
1742
|
-
|
|
1743
|
-
__exportStar(__webpack_require__(52), exports);
|
|
1744
|
-
|
|
1745
|
-
__exportStar(__webpack_require__(53), exports);
|
|
1746
|
-
|
|
1747
|
-
/***/ }),
|
|
1748
|
-
|
|
1749
|
-
/***/ 4:
|
|
1750
|
-
/***/ (function(module, exports) {
|
|
1751
|
-
|
|
1752
|
-
module.exports = require("styled-components");
|
|
1753
|
-
|
|
1754
|
-
/***/ }),
|
|
1755
|
-
|
|
1756
|
-
/***/ 40:
|
|
1757
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1758
|
-
|
|
1759
|
-
"use strict";
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1763
|
-
value: true
|
|
1764
|
-
});
|
|
1765
|
-
|
|
1766
|
-
/***/ }),
|
|
1767
|
-
|
|
1768
|
-
/***/ 41:
|
|
1769
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1770
|
-
|
|
1771
|
-
"use strict";
|
|
1772
|
-
|
|
1773
|
-
/**
|
|
1774
|
-
* A data structure used at runtime to wire up a visualization.
|
|
1775
|
-
*/
|
|
1776
|
-
|
|
1777
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1778
|
-
value: true
|
|
1779
|
-
});
|
|
1780
|
-
|
|
1781
|
-
/***/ }),
|
|
1782
|
-
|
|
1783
|
-
/***/ 42:
|
|
1784
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1785
|
-
|
|
1786
|
-
"use strict";
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1790
|
-
value: true
|
|
1791
|
-
});
|
|
1792
|
-
|
|
1793
|
-
/***/ }),
|
|
1794
|
-
|
|
1795
|
-
/***/ 43:
|
|
1796
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1797
|
-
|
|
1798
|
-
"use strict";
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1802
|
-
value: true
|
|
1803
|
-
});
|
|
1804
|
-
|
|
1805
|
-
/***/ }),
|
|
1806
|
-
|
|
1807
|
-
/***/ 433:
|
|
1808
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1809
|
-
|
|
1810
|
-
"use strict";
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1814
|
-
if (k2 === undefined) k2 = k;
|
|
1815
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1816
|
-
|
|
1817
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1818
|
-
desc = {
|
|
1819
|
-
enumerable: true,
|
|
1820
|
-
get: function get() {
|
|
1821
|
-
return m[k];
|
|
1822
|
-
}
|
|
1823
|
-
};
|
|
1824
|
-
}
|
|
1825
|
-
|
|
1826
|
-
Object.defineProperty(o, k2, desc);
|
|
1827
|
-
} : function (o, m, k, k2) {
|
|
1828
|
-
if (k2 === undefined) k2 = k;
|
|
1829
|
-
o[k2] = m[k];
|
|
1830
|
-
});
|
|
1831
|
-
|
|
1832
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1833
|
-
for (var p in m) {
|
|
1834
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1835
|
-
}
|
|
1836
|
-
};
|
|
1837
|
-
|
|
1838
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1839
|
-
value: true
|
|
1840
|
-
});
|
|
1841
|
-
exports.default = void 0;
|
|
1842
|
-
|
|
1843
|
-
__exportStar(__webpack_require__(179), exports);
|
|
1844
|
-
|
|
1845
|
-
var Markdown_1 = __webpack_require__(179);
|
|
1846
|
-
|
|
1847
|
-
Object.defineProperty(exports, "default", {
|
|
1848
|
-
enumerable: true,
|
|
1849
|
-
get: function get() {
|
|
1850
|
-
return Markdown_1.default;
|
|
1851
|
-
}
|
|
1852
|
-
});
|
|
1853
|
-
|
|
1854
|
-
/***/ }),
|
|
1855
|
-
|
|
1856
|
-
/***/ 434:
|
|
1857
|
-
/***/ (function(module, exports) {
|
|
1858
|
-
|
|
1859
|
-
module.exports = require("@splunk/react-ui/List");
|
|
1860
|
-
|
|
1861
|
-
/***/ }),
|
|
1862
|
-
|
|
1863
|
-
/***/ 435:
|
|
1864
|
-
/***/ (function(module, exports) {
|
|
1865
|
-
|
|
1866
|
-
module.exports = require("@splunk/react-ui/Code");
|
|
1867
|
-
|
|
1868
|
-
/***/ }),
|
|
1869
|
-
|
|
1870
|
-
/***/ 436:
|
|
1871
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1872
|
-
|
|
1873
|
-
"use strict";
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
var _toConsumableArray = __webpack_require__(6);
|
|
1877
|
-
|
|
1878
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1879
|
-
value: true
|
|
1880
|
-
});
|
|
1881
|
-
|
|
1882
|
-
var themes_1 = __webpack_require__(79);
|
|
1883
|
-
|
|
1884
|
-
var i18n_1 = __webpack_require__(3);
|
|
1885
|
-
|
|
1886
|
-
var visualization_schemas_1 = __webpack_require__(9);
|
|
1887
|
-
|
|
1888
|
-
var VizBehavior_1 = __webpack_require__(7);
|
|
1889
|
-
|
|
1890
|
-
var VizCategory_1 = __webpack_require__(22);
|
|
1891
|
-
|
|
1892
|
-
var configUtils_1 = __webpack_require__(26);
|
|
1893
|
-
|
|
1894
|
-
var BackgroundColor_1 = __webpack_require__(72);
|
|
1895
|
-
|
|
1896
|
-
var FONT_OPTIONS = new Set(['extraSmall', 'small', 'default', 'large', 'extraLarge']);
|
|
1897
|
-
var dataContract = {
|
|
1898
|
-
requiredDataSources: [],
|
|
1899
|
-
optionalDataSources: [// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1900
|
-
// {
|
|
1901
|
-
// name: 'annotation',
|
|
1902
|
-
// description: 'DataSource that populate event annotations',
|
|
1903
|
-
// },
|
|
1904
|
-
],
|
|
1905
|
-
initialRequestParams: {
|
|
1906
|
-
primary: {
|
|
1907
|
-
offset: 0,
|
|
1908
|
-
count: 10000
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
};
|
|
1912
|
-
var size = {
|
|
1913
|
-
initialWidth: 300,
|
|
1914
|
-
initialHeight: 300
|
|
1915
|
-
};
|
|
1916
|
-
var defaultContext = {};
|
|
1917
|
-
var themes = {
|
|
1918
|
-
defaultFontColor: function defaultFontColor(props) {
|
|
1919
|
-
return (0, themes_1.pick)({
|
|
1920
|
-
enterprise: {
|
|
1921
|
-
dark: themes_1.variables.textColor(props),
|
|
1922
|
-
light: themes_1.variables.textColor(props)
|
|
1923
|
-
},
|
|
1924
|
-
prisma: themes_1.variables.contentColorDefault(props)
|
|
1925
|
-
})(props);
|
|
1926
|
-
}
|
|
1927
|
-
};
|
|
1928
|
-
var editorConfig = [{
|
|
1929
|
-
label: (0, i18n_1._)('Color and style'),
|
|
1930
|
-
layout: [[{
|
|
1931
|
-
label: (0, i18n_1._)('Font'),
|
|
1932
|
-
option: 'fontColor',
|
|
1933
|
-
editor: 'editor.color',
|
|
1934
|
-
editorProps: {
|
|
1935
|
-
labelPosition: 'top',
|
|
1936
|
-
themes: themes
|
|
1937
|
-
}
|
|
1938
|
-
}].concat(_toConsumableArray((0, BackgroundColor_1.default)({
|
|
1939
|
-
label: 'Background',
|
|
1940
|
-
themes: themes
|
|
1941
|
-
}))), [{
|
|
1942
|
-
label: (0, i18n_1._)('Font family'),
|
|
1943
|
-
option: 'fontFamily',
|
|
1944
|
-
editor: 'editor.select',
|
|
1945
|
-
editorProps: {
|
|
1946
|
-
values: [{
|
|
1947
|
-
value: 'Splunk Platform Sans'
|
|
1948
|
-
}, {
|
|
1949
|
-
value: 'Splunk Data Sans'
|
|
1950
|
-
}, {
|
|
1951
|
-
value: 'Splunk Platform Mono'
|
|
1952
|
-
}, {
|
|
1953
|
-
value: 'Arial'
|
|
1954
|
-
}, {
|
|
1955
|
-
value: 'Helvetica'
|
|
1956
|
-
}, {
|
|
1957
|
-
value: 'Times New Roman'
|
|
1958
|
-
}, {
|
|
1959
|
-
value: 'Comic Sans MS'
|
|
1960
|
-
}]
|
|
1961
|
-
}
|
|
1962
|
-
}], [{
|
|
1963
|
-
label: (0, i18n_1._)('Font size'),
|
|
1964
|
-
option: 'fontSize',
|
|
1965
|
-
editor: 'editor.select',
|
|
1966
|
-
editorProps: {
|
|
1967
|
-
values: [{
|
|
1968
|
-
label: (0, i18n_1._)('Extra Small'),
|
|
1969
|
-
value: 'extraSmall'
|
|
1970
|
-
}, {
|
|
1971
|
-
label: (0, i18n_1._)('Small'),
|
|
1972
|
-
value: 'small'
|
|
1973
|
-
}, {
|
|
1974
|
-
label: (0, i18n_1._)('Default'),
|
|
1975
|
-
value: 'default'
|
|
1976
|
-
}, {
|
|
1977
|
-
label: (0, i18n_1._)('Large'),
|
|
1978
|
-
value: 'large'
|
|
1979
|
-
}, {
|
|
1980
|
-
label: (0, i18n_1._)('Extra Large'),
|
|
1981
|
-
value: 'extraLarge'
|
|
1982
|
-
}, {
|
|
1983
|
-
label: (0, i18n_1._)('Custom'),
|
|
1984
|
-
value: 'custom'
|
|
1985
|
-
}]
|
|
1986
|
-
}
|
|
1987
|
-
}, {
|
|
1988
|
-
label: (0, i18n_1._)('Custom font size (px)'),
|
|
1989
|
-
option: 'customFontSize',
|
|
1990
|
-
editor: 'editor.number',
|
|
1991
|
-
editorProps: {
|
|
1992
|
-
min: 0,
|
|
1993
|
-
labelPosition: 'top'
|
|
1994
|
-
},
|
|
1995
|
-
showEditor: function showEditor(_ref) {
|
|
1996
|
-
var options = _ref.options;
|
|
1997
|
-
return options.fontSize && !FONT_OPTIONS.has(options.fontSize);
|
|
1998
|
-
}
|
|
1999
|
-
}], [{
|
|
2000
|
-
label: (0, i18n_1._)('Rotation (degrees)'),
|
|
2001
|
-
option: 'rotation',
|
|
2002
|
-
editor: 'editor.number',
|
|
2003
|
-
editorProps: {
|
|
2004
|
-
min: -360,
|
|
2005
|
-
max: 360
|
|
2006
|
-
}
|
|
2007
|
-
}]]
|
|
2008
|
-
}, {
|
|
2009
|
-
label: (0, i18n_1._)('Markdown content'),
|
|
2010
|
-
open: true,
|
|
2011
|
-
layout: [[{
|
|
2012
|
-
label: '',
|
|
2013
|
-
option: 'markdown',
|
|
2014
|
-
editor: 'editor.markdown'
|
|
2015
|
-
}]]
|
|
2016
|
-
}];
|
|
2017
|
-
/**
|
|
2018
|
-
* visualization configuration
|
|
2019
|
-
*/
|
|
2020
|
-
|
|
2021
|
-
var config = {
|
|
2022
|
-
/**
|
|
2023
|
-
* unique viz key
|
|
2024
|
-
*/
|
|
2025
|
-
key: 'splunk.markdown',
|
|
2026
|
-
|
|
2027
|
-
/**
|
|
2028
|
-
* viz name
|
|
2029
|
-
*/
|
|
2030
|
-
name: (0, i18n_1._)('Markdown'),
|
|
2031
|
-
category: VizCategory_1.VizCategory.COMPARISONS,
|
|
2032
|
-
|
|
2033
|
-
/**
|
|
2034
|
-
* viz icon
|
|
2035
|
-
*/
|
|
2036
|
-
icon: null,
|
|
2037
|
-
dataContract: dataContract,
|
|
2038
|
-
size: size,
|
|
2039
|
-
defaultContext: defaultContext,
|
|
2040
|
-
optionsSchema: visualization_schemas_1.markdownOptionsSchema,
|
|
2041
|
-
editorConfig: editorConfig,
|
|
2042
|
-
events: {
|
|
2043
|
-
'markdown.click': {
|
|
2044
|
-
description: 'triggered when user clicks on markdown area not formatted as a link'
|
|
2045
|
-
}
|
|
2046
|
-
},
|
|
2047
|
-
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS],
|
|
2048
|
-
themes: themes
|
|
2049
|
-
};
|
|
2050
|
-
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
2051
|
-
|
|
2052
|
-
/***/ }),
|
|
2053
|
-
|
|
2054
|
-
/***/ 44:
|
|
2055
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2056
|
-
|
|
2057
|
-
"use strict";
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2061
|
-
value: true
|
|
2062
|
-
});
|
|
2063
|
-
|
|
2064
|
-
/***/ }),
|
|
2065
|
-
|
|
2066
|
-
/***/ 45:
|
|
2067
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2068
|
-
|
|
2069
|
-
"use strict";
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2073
|
-
value: true
|
|
2074
|
-
});
|
|
2075
|
-
|
|
2076
|
-
/***/ }),
|
|
2077
|
-
|
|
2078
|
-
/***/ 46:
|
|
2079
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2080
|
-
|
|
2081
|
-
"use strict";
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2085
|
-
value: true
|
|
2086
|
-
});
|
|
2087
|
-
|
|
2088
|
-
/***/ }),
|
|
2089
|
-
|
|
2090
|
-
/***/ 47:
|
|
2091
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2092
|
-
|
|
2093
|
-
"use strict";
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2097
|
-
value: true
|
|
2098
|
-
});
|
|
2099
|
-
|
|
2100
|
-
/***/ }),
|
|
2101
|
-
|
|
2102
|
-
/***/ 48:
|
|
2103
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2104
|
-
|
|
2105
|
-
"use strict";
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2109
|
-
value: true
|
|
2110
|
-
});
|
|
2111
|
-
|
|
2112
|
-
/***/ }),
|
|
2113
|
-
|
|
2114
|
-
/***/ 49:
|
|
2115
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2116
|
-
|
|
2117
|
-
"use strict";
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2121
|
-
value: true
|
|
2122
|
-
});
|
|
2123
|
-
|
|
2124
|
-
/***/ }),
|
|
2125
|
-
|
|
2126
|
-
/***/ 5:
|
|
2127
|
-
/***/ (function(module, exports) {
|
|
2128
|
-
|
|
2129
|
-
module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
2130
|
-
|
|
2131
|
-
/***/ }),
|
|
2132
|
-
|
|
2133
|
-
/***/ 50:
|
|
2134
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2135
|
-
|
|
2136
|
-
"use strict";
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2140
|
-
value: true
|
|
2141
|
-
});
|
|
2142
|
-
|
|
2143
|
-
/***/ }),
|
|
2144
|
-
|
|
2145
|
-
/***/ 51:
|
|
2146
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2147
|
-
|
|
2148
|
-
"use strict";
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2152
|
-
value: true
|
|
2153
|
-
});
|
|
2154
|
-
|
|
2155
|
-
/***/ }),
|
|
2156
|
-
|
|
2157
|
-
/***/ 52:
|
|
2158
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2159
|
-
|
|
2160
|
-
"use strict";
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2164
|
-
value: true
|
|
2165
|
-
});
|
|
2166
|
-
|
|
2167
|
-
/***/ }),
|
|
2168
|
-
|
|
2169
|
-
/***/ 53:
|
|
2170
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2171
|
-
|
|
2172
|
-
"use strict";
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2176
|
-
value: true
|
|
2177
|
-
});
|
|
2178
|
-
|
|
2179
|
-
/***/ }),
|
|
2180
|
-
|
|
2181
|
-
/***/ 54:
|
|
2182
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2183
|
-
|
|
2184
|
-
"use strict";
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
var _slicedToArray = __webpack_require__(5);
|
|
2188
|
-
|
|
2189
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2190
|
-
value: true
|
|
2191
|
-
});
|
|
2192
|
-
|
|
2193
|
-
var React = __webpack_require__(1);
|
|
2194
|
-
|
|
2195
|
-
var lodash_1 = __webpack_require__(2);
|
|
2196
|
-
|
|
2197
|
-
var getSettingsFromThemedProps_1 = __webpack_require__(55);
|
|
2198
|
-
|
|
2199
|
-
var Options_1 = __webpack_require__(16);
|
|
2200
|
-
|
|
2201
|
-
var SanitizeProps_1 = __webpack_require__(56);
|
|
2202
|
-
|
|
2203
|
-
var TimezoneContext_1 = __webpack_require__(31);
|
|
2204
|
-
|
|
2205
|
-
var moment_1 = __webpack_require__(57);
|
|
2206
|
-
|
|
2207
|
-
var FeatureFlagContext_1 = __webpack_require__(27);
|
|
2208
|
-
|
|
2209
|
-
var styled_components_1 = __webpack_require__(4);
|
|
2210
|
-
|
|
2211
|
-
var hocUtils_1 = __webpack_require__(33);
|
|
2212
|
-
|
|
2213
|
-
var JSONSchemaUtils_1 = __webpack_require__(34);
|
|
2214
|
-
|
|
2215
|
-
var async_dynamic_options_evaluator_1 = __webpack_require__(58);
|
|
2216
|
-
|
|
2217
|
-
var id_1 = __webpack_require__(30);
|
|
2218
|
-
|
|
2219
|
-
var SplunkVisualization_1 = __webpack_require__(59);
|
|
2220
|
-
|
|
2221
|
-
var VizBehavior_1 = __webpack_require__(7);
|
|
2222
|
-
|
|
2223
|
-
var getSorting_1 = __webpack_require__(37);
|
|
2224
|
-
|
|
2225
|
-
var getPagination_1 = __webpack_require__(38);
|
|
2226
|
-
|
|
2227
|
-
var useDeepMemo_1 = __webpack_require__(60);
|
|
2228
|
-
|
|
2229
|
-
var MissingPropsMessage_1 = __webpack_require__(61);
|
|
2230
|
-
|
|
2231
|
-
var withEditModeCover_1 = __webpack_require__(62);
|
|
2232
|
-
|
|
2233
|
-
var withPlaceholder_1 = __webpack_require__(63);
|
|
2234
|
-
|
|
2235
|
-
var useDownsampleDataSources_1 = __webpack_require__(64);
|
|
2236
|
-
|
|
2237
|
-
var dataUtils_1 = __webpack_require__(14);
|
|
2238
|
-
|
|
2239
|
-
var featureFlagUtils_1 = __webpack_require__(66);
|
|
2240
|
-
/**
|
|
2241
|
-
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
2242
|
-
* @param {DashboardVizOpts} opts
|
|
2243
|
-
* @returns {HOC}
|
|
2244
|
-
*/
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
var withDashboardViz = function withDashboardViz(opts) {
|
|
2248
|
-
var ReactViz = opts.ReactViz,
|
|
2249
|
-
vizConfig = opts.vizConfig,
|
|
2250
|
-
_opts$computeVizProps = opts.computeVizProps,
|
|
2251
|
-
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
2252
|
-
disableEditModeCover = opts.disableEditModeCover,
|
|
2253
|
-
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
2254
|
-
|
|
2255
|
-
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
2256
|
-
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
2257
|
-
|
|
2258
|
-
var DashboardViz = function DashboardViz(props) {
|
|
2259
|
-
var _a;
|
|
2260
|
-
|
|
2261
|
-
var mode = props.mode,
|
|
2262
|
-
hasEventHandlers = props.hasEventHandlers,
|
|
2263
|
-
dataSources = props.dataSources,
|
|
2264
|
-
options = props.options,
|
|
2265
|
-
_props$context = props.context,
|
|
2266
|
-
context = _props$context === void 0 ? {} : _props$context,
|
|
2267
|
-
width = props.width,
|
|
2268
|
-
height = props.height,
|
|
2269
|
-
onComputedProps = props.onComputedProps,
|
|
2270
|
-
onEventTrigger = props.onEventTrigger,
|
|
2271
|
-
theme = props.theme,
|
|
2272
|
-
onRequestParamsChange = props.onRequestParamsChange;
|
|
2273
|
-
|
|
2274
|
-
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
2275
|
-
serializedTimezone = _React$useContext.serializedTimezone;
|
|
2276
|
-
|
|
2277
|
-
if (serializedTimezone) {
|
|
2278
|
-
/*
|
|
2279
|
-
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
2280
|
-
This ensures that if a timezone was provided via TimezoneContext @splunk/moment time formatting
|
|
2281
|
-
will use it.
|
|
2282
|
-
@TODO(pwied):
|
|
2283
|
-
- remove when we moved away from @splunk/moment
|
|
2284
|
-
- provide timezone context to dynamic option evaluation phase
|
|
2285
|
-
*/
|
|
2286
|
-
if (!moment_1.default.getDefaultSplunkTimezone()) {
|
|
2287
|
-
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
var themeFunc = function themeFunc(themeVar) {
|
|
2292
|
-
var _a, _b;
|
|
2293
|
-
|
|
2294
|
-
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
2295
|
-
};
|
|
2296
|
-
|
|
2297
|
-
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
2298
|
-
|
|
2299
|
-
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
2300
|
-
theme: theme
|
|
2301
|
-
}),
|
|
2302
|
-
currentThemeFamily = _ref.family,
|
|
2303
|
-
currentThemeColorScheme = _ref.colorScheme,
|
|
2304
|
-
currentThemeDensity = _ref.density;
|
|
2305
|
-
|
|
2306
|
-
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
2307
|
-
|
|
2308
|
-
var _React$useState = React.useState({}),
|
|
2309
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2310
|
-
evaluatedOptionsAsync = _React$useState2[0],
|
|
2311
|
-
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
2315
|
-
|
|
2316
|
-
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
2317
|
-
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
2318
|
-
visualizationID = _React$useState4[0];
|
|
2319
|
-
|
|
2320
|
-
var _React$useState5 = React.useState({}),
|
|
2321
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2322
|
-
dataSourcesInState = _React$useState6[0],
|
|
2323
|
-
setDataSourcesInState = _React$useState6[1];
|
|
2324
|
-
|
|
2325
|
-
var _React$useState7 = React.useState(),
|
|
2326
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
2327
|
-
dataFramesInState = _React$useState8[0],
|
|
2328
|
-
setDataFramesInState = _React$useState8[1];
|
|
2329
|
-
|
|
2330
|
-
var _React$useState9 = React.useState(Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_useWebWorkersForDSL'))),
|
|
2331
|
-
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
2332
|
-
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
2333
|
-
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
2334
|
-
|
|
2335
|
-
var isDownsamplingEnabledByFeatureFlag = Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_enableDownsampling);
|
|
2336
|
-
var isMounted = React.useRef(true);
|
|
2337
|
-
var optionsToEvaluate = React.useMemo(function () {
|
|
2338
|
-
return {
|
|
2339
|
-
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
2340
|
-
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
2341
|
-
};
|
|
2342
|
-
}, [options, context]);
|
|
2343
|
-
|
|
2344
|
-
var _React$useState11 = React.useState(Number(width)),
|
|
2345
|
-
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
2346
|
-
threshold = _React$useState12[0],
|
|
2347
|
-
setThreshold = _React$useState12[1];
|
|
2348
|
-
|
|
2349
|
-
var onDownsamplingThresholdChange = React.useCallback(function (newThreshold) {
|
|
2350
|
-
setThreshold(newThreshold);
|
|
2351
|
-
}, []);
|
|
2352
|
-
var isDownsamplingEnabled = React.useMemo(function () {
|
|
2353
|
-
return isDownsamplingEnabledByFeatureFlag && (0, dataUtils_1.isDownsamplingEnabledForViz)({
|
|
2354
|
-
vizConfig: vizConfig
|
|
2355
|
-
});
|
|
2356
|
-
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
2357
|
-
var downsamplingProps = React.useMemo(function () {
|
|
2358
|
-
if (!isDownsamplingEnabled) {
|
|
2359
|
-
return {};
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
return {
|
|
2363
|
-
onDownsamplingThresholdChange: onDownsamplingThresholdChange,
|
|
2364
|
-
originalDataSources: dataSources
|
|
2365
|
-
};
|
|
2366
|
-
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
2367
|
-
var downsampledDataSources = (0, useDownsampleDataSources_1.default)({
|
|
2368
|
-
options: optionsToEvaluate.options,
|
|
2369
|
-
context: optionsToEvaluate.context,
|
|
2370
|
-
dataSources: dataSources,
|
|
2371
|
-
threshold: threshold,
|
|
2372
|
-
isDownsamplingEnabled: isDownsamplingEnabled
|
|
2373
|
-
});
|
|
2374
|
-
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
2375
|
-
try {
|
|
2376
|
-
if (useAsyncEvaluatedOptions) {
|
|
2377
|
-
var asyncDynamicOptionsEvaluatorParams = {
|
|
2378
|
-
visualizationID: visualizationID,
|
|
2379
|
-
props: props,
|
|
2380
|
-
options: optionsToEvaluate,
|
|
2381
|
-
dataSources: downsampledDataSources,
|
|
2382
|
-
theme: vizConfig.themes,
|
|
2383
|
-
bypassCloneDeepOptionScope: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope')),
|
|
2384
|
-
lazyLoadingDataFrame: Boolean((0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'))
|
|
2385
|
-
};
|
|
2386
|
-
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
2387
|
-
setEvaluatedOptionsAsync(results.results);
|
|
2388
|
-
}).catch(function () {
|
|
2389
|
-
if (isMounted.current) {
|
|
2390
|
-
setUseAsyncEvaluatedOptions(false);
|
|
2391
|
-
}
|
|
2392
|
-
});
|
|
2393
|
-
} else {
|
|
2394
|
-
var dataFrames = dataFramesInState;
|
|
2395
|
-
|
|
2396
|
-
if (downsampledDataSources !== dataSourcesInState) {
|
|
2397
|
-
setDataSourcesInState(downsampledDataSources);
|
|
2398
|
-
dataFrames = Options_1.Options.dataFrameFromDataSource(downsampledDataSources, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_lazyLoadingDataFrame'));
|
|
2399
|
-
setDataFramesInState(dataFrames);
|
|
2400
|
-
}
|
|
2401
|
-
|
|
2402
|
-
var result = Options_1.Options.evaluate(optionsToEvaluate, downsampledDataSources, themeFunc, dataFrames, (0, featureFlagUtils_1.getFeatureFlag)(featureFlagContext, 'visualizations_bypassCloneDeepOptionScope'));
|
|
2403
|
-
return result;
|
|
2404
|
-
}
|
|
2405
|
-
} catch (e) {
|
|
2406
|
-
// eslint-disable-next-line no-console
|
|
2407
|
-
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
2408
|
-
return {};
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
return {};
|
|
2412
|
-
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, optionsToEvaluate, downsampledDataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
2413
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
2414
|
-
// 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
|
|
2415
|
-
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
2416
|
-
|
|
2417
|
-
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
2418
|
-
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
2419
|
-
|
|
2420
|
-
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) {
|
|
2421
|
-
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
2422
|
-
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
2423
|
-
});
|
|
2424
|
-
} // useEffect hook needs to be initialized before any early returns
|
|
2425
|
-
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
React.useEffect(function () {
|
|
2429
|
-
onComputedProps(clonedEvaluatedOptions);
|
|
2430
|
-
});
|
|
2431
|
-
React.useEffect(function () {
|
|
2432
|
-
return function () {
|
|
2433
|
-
if (useAsyncEvaluatedOptions) {
|
|
2434
|
-
isMounted.current = false;
|
|
2435
|
-
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
2436
|
-
}
|
|
2437
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2438
|
-
}, []); // present warning message if any required props are missing
|
|
2439
|
-
|
|
2440
|
-
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
2441
|
-
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
2442
|
-
supports = vizConfig.supports;
|
|
2443
|
-
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
2444
|
-
|
|
2445
|
-
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
|
|
2446
|
-
) {
|
|
2447
|
-
return React.createElement(MissingPropsMessage_1.default, {
|
|
2448
|
-
"data-test": "missing-props-message",
|
|
2449
|
-
width: width,
|
|
2450
|
-
height: height,
|
|
2451
|
-
missingProps: missing,
|
|
2452
|
-
backgroundColor: bgColorFromTheme
|
|
2453
|
-
});
|
|
2454
|
-
} // events
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
var eventCallbackProps = {};
|
|
2458
|
-
|
|
2459
|
-
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
2460
|
-
var supportedEvents = vizConfig.events;
|
|
2461
|
-
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
2462
|
-
var _supportedEvents$even = supportedEvents[eventName],
|
|
2463
|
-
parentKeys = _supportedEvents$even.parentKeys,
|
|
2464
|
-
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
2465
|
-
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
2466
|
-
// then remove these lines
|
|
2467
|
-
|
|
2468
|
-
var payload = {};
|
|
2469
|
-
|
|
2470
|
-
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
2471
|
-
payloadKeys.forEach(function (p) {
|
|
2472
|
-
payload[p] = evaluatedOptionsToUse[p];
|
|
2473
|
-
});
|
|
2474
|
-
}
|
|
2475
|
-
|
|
2476
|
-
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
2477
|
-
if (ev && ev.payload) {
|
|
2478
|
-
payload = ev.payload;
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2481
|
-
return onEventTrigger({
|
|
2482
|
-
originalEvent: ev,
|
|
2483
|
-
payload: payload,
|
|
2484
|
-
type: eventName
|
|
2485
|
-
});
|
|
2486
|
-
};
|
|
2487
|
-
|
|
2488
|
-
if (parentKeys) {
|
|
2489
|
-
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
2490
|
-
var newObject = {};
|
|
2491
|
-
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
2492
|
-
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
2493
|
-
}
|
|
2494
|
-
}
|
|
2495
|
-
});
|
|
2496
|
-
} // compute pure viz props which are not from options
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
2500
|
-
themeFunc: themeFunc
|
|
2501
|
-
}));
|
|
2502
|
-
/**
|
|
2503
|
-
* PAGE_AND_SORT behavior
|
|
2504
|
-
*
|
|
2505
|
-
* Some visualizations, like table, requires metadata about the datasource,
|
|
2506
|
-
* like total number of results, current count, offset, and sort, for rendering
|
|
2507
|
-
* paginator and sorting direction. In this approach, the visualization
|
|
2508
|
-
* allow users to set 'paginateDataSourceKey' to select which datasource
|
|
2509
|
-
* should the visualization extract the metadata from. It defaults to 'primary' datasource.
|
|
2510
|
-
* The visualization config should set the PAGE_AND_SORT behavior to receive
|
|
2511
|
-
* 'requestParams', 'meta' and onRequestParams callback as props.
|
|
2512
|
-
*
|
|
2513
|
-
* In future, we could automatically detect which all datasources are being used
|
|
2514
|
-
* and bind those magically to pagination/sorting behavior.
|
|
2515
|
-
*/
|
|
2516
|
-
|
|
2517
|
-
var dataSourceMetadata = {};
|
|
2518
|
-
var OptionKey = 'paginateDataSourceKey';
|
|
2519
|
-
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
2520
|
-
|
|
2521
|
-
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
2522
|
-
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
2523
|
-
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
2524
|
-
|
|
2525
|
-
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
2526
|
-
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
2527
|
-
};
|
|
2528
|
-
|
|
2529
|
-
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
2530
|
-
requestParams: requestParams,
|
|
2531
|
-
meta: meta,
|
|
2532
|
-
onRequestParamsChange: handleRequestParamsChange
|
|
2533
|
-
});
|
|
2534
|
-
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
2535
|
-
requestParams: requestParams,
|
|
2536
|
-
meta: meta,
|
|
2537
|
-
onRequestParamsChange: handleRequestParamsChange
|
|
2538
|
-
});
|
|
2539
|
-
dataSourceMetadata = {
|
|
2540
|
-
sortParams: sortParams,
|
|
2541
|
-
paginatorParams: paginatorParams
|
|
2542
|
-
};
|
|
2543
|
-
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
2547
|
-
return null;
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
return React.createElement(SanitizedReactViz, Object.assign({
|
|
2551
|
-
mode: mode,
|
|
2552
|
-
width: width,
|
|
2553
|
-
height: height
|
|
2554
|
-
}, downsamplingProps, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
2555
|
-
};
|
|
2556
|
-
|
|
2557
|
-
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
2558
|
-
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
2559
|
-
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
2560
|
-
theme: {}
|
|
2561
|
-
}); // attach viz config
|
|
2562
|
-
|
|
2563
|
-
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
2564
|
-
|
|
2565
|
-
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
2566
|
-
};
|
|
2567
|
-
|
|
2568
|
-
exports.default = withDashboardViz;
|
|
2569
|
-
|
|
2570
|
-
/***/ }),
|
|
2571
|
-
|
|
2572
|
-
/***/ 55:
|
|
2573
|
-
/***/ (function(module, exports) {
|
|
2574
|
-
|
|
2575
|
-
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
2576
|
-
|
|
2577
|
-
/***/ }),
|
|
2578
|
-
|
|
2579
|
-
/***/ 56:
|
|
2580
|
-
/***/ (function(module, exports) {
|
|
2581
|
-
|
|
2582
|
-
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
2583
|
-
|
|
2584
|
-
/***/ }),
|
|
2585
|
-
|
|
2586
|
-
/***/ 57:
|
|
2587
|
-
/***/ (function(module, exports) {
|
|
2588
|
-
|
|
2589
|
-
module.exports = require("@splunk/moment");
|
|
2590
|
-
|
|
2591
|
-
/***/ }),
|
|
2592
|
-
|
|
2593
|
-
/***/ 58:
|
|
2594
|
-
/***/ (function(module, exports) {
|
|
2595
|
-
|
|
2596
|
-
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
2597
|
-
|
|
2598
|
-
/***/ }),
|
|
2599
|
-
|
|
2600
|
-
/***/ 59:
|
|
2601
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2602
|
-
|
|
2603
|
-
"use strict";
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
var _classCallCheck = __webpack_require__(8);
|
|
2607
|
-
|
|
2608
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2609
|
-
value: true
|
|
2610
|
-
});
|
|
2611
|
-
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
2612
|
-
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
2613
|
-
|
|
2614
|
-
var T = __webpack_require__(0);
|
|
2615
|
-
|
|
2616
|
-
var lodash_1 = __webpack_require__(2);
|
|
2617
|
-
|
|
2618
|
-
var VizActionHandler_1 = __webpack_require__(21); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
exports.INITIAL_WIDTH = 250;
|
|
2622
|
-
exports.INITIAL_HEIGHT = 250;
|
|
2623
|
-
/**
|
|
2624
|
-
* A Splunk visualization
|
|
2625
|
-
*/
|
|
2626
|
-
|
|
2627
|
-
var SplunkVisualization = function SplunkVisualization() {
|
|
2628
|
-
_classCallCheck(this, SplunkVisualization);
|
|
2629
|
-
};
|
|
2630
|
-
|
|
2631
|
-
SplunkVisualization.propTypes = {
|
|
2632
|
-
/**
|
|
2633
|
-
* display mode
|
|
2634
|
-
*/
|
|
2635
|
-
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
2636
|
-
|
|
2637
|
-
/**
|
|
2638
|
-
* width in pixel or string, defaults to 100%
|
|
2639
|
-
*/
|
|
2640
|
-
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
2641
|
-
|
|
2642
|
-
/**
|
|
2643
|
-
* height in pixel or string
|
|
2644
|
-
*/
|
|
2645
|
-
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
2646
|
-
|
|
2647
|
-
/**
|
|
2648
|
-
* visualization context used for dynamic option evaluation
|
|
2649
|
-
*/
|
|
2650
|
-
context: T.object,
|
|
2651
|
-
|
|
2652
|
-
/**
|
|
2653
|
-
* visualization formatting options
|
|
2654
|
-
*/
|
|
2655
|
-
options: T.object,
|
|
2656
|
-
|
|
2657
|
-
/**
|
|
2658
|
-
* A callback to update formatting options
|
|
2659
|
-
*/
|
|
2660
|
-
onOptionsChange: T.func,
|
|
2661
|
-
|
|
2662
|
-
/**
|
|
2663
|
-
* datasource state which include data and request params, object key indicate the datasource type.
|
|
2664
|
-
*/
|
|
2665
|
-
dataSources: T.objectOf(T.shape({
|
|
2666
|
-
/**
|
|
2667
|
-
* current request params
|
|
2668
|
-
*/
|
|
2669
|
-
requestParams: T.object,
|
|
2670
|
-
|
|
2671
|
-
/**
|
|
2672
|
-
* current dataset
|
|
2673
|
-
*/
|
|
2674
|
-
data: T.shape({
|
|
2675
|
-
fields: T.array,
|
|
2676
|
-
columns: T.array
|
|
2677
|
-
}),
|
|
2678
|
-
|
|
2679
|
-
/**
|
|
2680
|
-
* error
|
|
2681
|
-
*/
|
|
2682
|
-
error: T.shape({
|
|
2683
|
-
level: T.string,
|
|
2684
|
-
message: T.string
|
|
2685
|
-
}),
|
|
2686
|
-
|
|
2687
|
-
/**
|
|
2688
|
-
* meta data that came with the dataset
|
|
2689
|
-
*/
|
|
2690
|
-
meta: T.object
|
|
2691
|
-
})),
|
|
2692
|
-
|
|
2693
|
-
/**
|
|
2694
|
-
* A callback to trigger event
|
|
2695
|
-
*/
|
|
2696
|
-
onEventTrigger: T.func,
|
|
2697
|
-
|
|
2698
|
-
/**
|
|
2699
|
-
* Inform viz if there are handlers listening to events
|
|
2700
|
-
*/
|
|
2701
|
-
hasEventHandlers: T.bool,
|
|
2702
|
-
|
|
2703
|
-
/**
|
|
2704
|
-
* A callback to communicate computed props to a consumer
|
|
2705
|
-
*/
|
|
2706
|
-
onComputedProps: T.func,
|
|
2707
|
-
|
|
2708
|
-
/**
|
|
2709
|
-
* A callback to obtain visualization api
|
|
2710
|
-
*/
|
|
2711
|
-
vizActionHandlerRef: T.func,
|
|
2712
|
-
loading: T.bool,
|
|
2713
|
-
theme: T.object,
|
|
2714
|
-
|
|
2715
|
-
/**
|
|
2716
|
-
* A callback to request new data with updated request params
|
|
2717
|
-
*/
|
|
2718
|
-
onRequestParamsChange: T.func
|
|
2719
|
-
};
|
|
2720
|
-
/**
|
|
2721
|
-
*
|
|
2722
|
-
*/
|
|
2723
|
-
|
|
2724
|
-
SplunkVisualization.defaultProps = {
|
|
2725
|
-
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
2726
|
-
width: '100%',
|
|
2727
|
-
height: exports.INITIAL_HEIGHT,
|
|
2728
|
-
dataSources: {},
|
|
2729
|
-
onEventTrigger: function onEventTrigger() {
|
|
2730
|
-
return {};
|
|
2731
|
-
},
|
|
2732
|
-
mode: 'view',
|
|
2733
|
-
hasEventHandlers: false,
|
|
2734
|
-
options: {},
|
|
2735
|
-
context: {},
|
|
2736
|
-
onOptionsChange: function onOptionsChange() {
|
|
2737
|
-
return {};
|
|
2738
|
-
},
|
|
2739
|
-
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
2740
|
-
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
2741
|
-
},
|
|
2742
|
-
onComputedProps: function onComputedProps() {
|
|
2743
|
-
return {};
|
|
2744
|
-
},
|
|
2745
|
-
loading: false,
|
|
2746
|
-
onRequestParamsChange: lodash_1.noop
|
|
2747
|
-
};
|
|
2748
|
-
exports.default = SplunkVisualization;
|
|
2749
|
-
|
|
2750
|
-
/***/ }),
|
|
2751
|
-
|
|
2752
|
-
/***/ 6:
|
|
2753
|
-
/***/ (function(module, exports) {
|
|
2754
|
-
|
|
2755
|
-
module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
2756
|
-
|
|
2757
|
-
/***/ }),
|
|
2758
|
-
|
|
2759
|
-
/***/ 60:
|
|
2760
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2761
|
-
|
|
2762
|
-
"use strict";
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2766
|
-
value: true
|
|
2767
|
-
});
|
|
2768
|
-
exports.useDeepMemo = void 0;
|
|
2769
|
-
|
|
2770
|
-
var react_1 = __webpack_require__(1);
|
|
2771
|
-
|
|
2772
|
-
var lodash_1 = __webpack_require__(2);
|
|
2773
|
-
/**
|
|
2774
|
-
* This hook evaluates and stores the result of a passed function and only
|
|
2775
|
-
* re-evaluates the function when passed dependencies change.
|
|
2776
|
-
*
|
|
2777
|
-
* It is different from the internal React useMemo in the following aspects:
|
|
2778
|
-
* - it only stores the last evaluated result
|
|
2779
|
-
* - it uses a deep equality check to determine if dependencies have changed
|
|
2780
|
-
*
|
|
2781
|
-
* Inspired by apollo-client's useDeepMemo
|
|
2782
|
-
*
|
|
2783
|
-
* @param fn the function to be executed and
|
|
2784
|
-
* @param dependencies an array of dependencies
|
|
2785
|
-
*/
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
2789
|
-
var ref = (0, react_1.useRef)();
|
|
2790
|
-
|
|
2791
|
-
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
2792
|
-
ref.current = {
|
|
2793
|
-
dependencies: dependencies,
|
|
2794
|
-
value: fn()
|
|
2795
|
-
};
|
|
2796
|
-
}
|
|
2797
|
-
|
|
2798
|
-
return ref.current.value;
|
|
2799
|
-
};
|
|
2800
|
-
|
|
2801
|
-
exports.useDeepMemo = useDeepMemo;
|
|
2802
|
-
|
|
2803
|
-
/***/ }),
|
|
2804
|
-
|
|
2805
|
-
/***/ 61:
|
|
2806
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2807
|
-
|
|
2808
|
-
"use strict";
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2812
|
-
value: true
|
|
2813
|
-
});
|
|
2814
|
-
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2815
|
-
|
|
2816
|
-
var React = __webpack_require__(1);
|
|
2817
|
-
|
|
2818
|
-
var T = __webpack_require__(0);
|
|
2819
|
-
|
|
2820
|
-
var i18n_1 = __webpack_require__(3);
|
|
2821
|
-
|
|
2822
|
-
var Message_1 = __webpack_require__(11);
|
|
2823
|
-
|
|
2824
|
-
var FixedSizeContainer_1 = __webpack_require__(17);
|
|
2825
|
-
/**
|
|
2826
|
-
* @method isMissing
|
|
2827
|
-
* @param {any} v
|
|
2828
|
-
* @returns {boolean} true if the input value === null or undefined
|
|
2829
|
-
*/
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
var isMissing = function isMissing(v) {
|
|
2833
|
-
return v === null || v === undefined;
|
|
2834
|
-
};
|
|
2835
|
-
|
|
2836
|
-
exports.isMissing = isMissing;
|
|
2837
|
-
/**
|
|
2838
|
-
* @method misskingKeys
|
|
2839
|
-
* @param {string[]} keys
|
|
2840
|
-
* @param {object} target
|
|
2841
|
-
* @returns {string[]} the keys of missing required props
|
|
2842
|
-
*/
|
|
2843
|
-
|
|
2844
|
-
var missingKeys = function missingKeys(keys, target) {
|
|
2845
|
-
return keys.filter(function (k) {
|
|
2846
|
-
return (0, exports.isMissing)(target[k]);
|
|
2847
|
-
});
|
|
2848
|
-
};
|
|
2849
|
-
|
|
2850
|
-
exports.missingKeys = missingKeys;
|
|
2851
|
-
var propTypes = {
|
|
2852
|
-
width: T.oneOfType([T.string, T.number]),
|
|
2853
|
-
height: T.oneOfType([T.string, T.number]),
|
|
2854
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
2855
|
-
backgroundColor: T.string,
|
|
2856
|
-
missingProps: T.arrayOf(T.string)
|
|
2857
|
-
};
|
|
2858
|
-
/**
|
|
2859
|
-
* @method MissingPropsMessage
|
|
2860
|
-
* @param {MissingPropsProps} props
|
|
2861
|
-
* @returns {React.ReactElement}
|
|
2862
|
-
*/
|
|
2863
|
-
|
|
2864
|
-
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
2865
|
-
var width = props.width,
|
|
2866
|
-
height = props.height,
|
|
2867
|
-
missingProps = props.missingProps;
|
|
2868
|
-
return React.createElement(Message_1.default, {
|
|
2869
|
-
"data-test": "message",
|
|
2870
|
-
width: width,
|
|
2871
|
-
height: height,
|
|
2872
|
-
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
2873
|
-
});
|
|
2874
|
-
};
|
|
2875
|
-
|
|
2876
|
-
exports.MissingPropsMessage = MissingPropsMessage;
|
|
2877
|
-
exports.MissingPropsMessage.propTypes = propTypes;
|
|
2878
|
-
exports.MissingPropsMessage.defaultProps = {
|
|
2879
|
-
width: '100%',
|
|
2880
|
-
height: 250
|
|
2881
|
-
};
|
|
2882
|
-
exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
|
|
2883
|
-
|
|
2884
|
-
/***/ }),
|
|
2885
|
-
|
|
2886
|
-
/***/ 62:
|
|
2887
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2888
|
-
|
|
2889
|
-
"use strict";
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2893
|
-
value: true
|
|
2894
|
-
});
|
|
2895
|
-
|
|
2896
|
-
var React = __webpack_require__(1);
|
|
2897
|
-
|
|
2898
|
-
var styled_components_1 = __webpack_require__(4);
|
|
2899
|
-
|
|
2900
|
-
var hocUtils_1 = __webpack_require__(23);
|
|
2901
|
-
|
|
2902
|
-
var Cover = styled_components_1.default.div.withConfig({
|
|
2903
|
-
displayName: "withEditModeCover__Cover",
|
|
2904
|
-
componentId: "sc-1gsbnxb-0"
|
|
2905
|
-
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
2906
|
-
var Blocker = styled_components_1.default.div.attrs({
|
|
2907
|
-
'data-splunk-visualization-version': "26.4.0 - 04078274d"
|
|
2908
|
-
}).withConfig({
|
|
2909
|
-
displayName: "withEditModeCover__Blocker",
|
|
2910
|
-
componentId: "sc-1gsbnxb-1"
|
|
2911
|
-
})(["position:relative;width:100%;height:100%;"]);
|
|
2912
|
-
/**
|
|
2913
|
-
* HOC that renders a cover layer in edit mode
|
|
2914
|
-
* @method withEditModeCover
|
|
2915
|
-
* @param {ExtendedDashViz} Visualization
|
|
2916
|
-
* @returns {ExtendedDashViz} Wrapper
|
|
2917
|
-
*/
|
|
2918
|
-
|
|
2919
|
-
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
2920
|
-
var Wrapper = function Wrapper(props) {
|
|
2921
|
-
var mode = props.mode;
|
|
2922
|
-
var showEditCover = mode === 'edit' && !disableEditModeCover;
|
|
2923
|
-
return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
|
|
2924
|
-
"data-test": "edit-mode-cover"
|
|
2925
|
-
}));
|
|
2926
|
-
};
|
|
2927
|
-
|
|
2928
|
-
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2929
|
-
Wrapper: Wrapper,
|
|
2930
|
-
Visualization: Visualization
|
|
2931
|
-
});
|
|
2932
|
-
return Wrapper;
|
|
2933
|
-
};
|
|
2934
|
-
|
|
2935
|
-
exports.default = withEditModeCover;
|
|
2936
|
-
|
|
2937
|
-
/***/ }),
|
|
2938
|
-
|
|
2939
|
-
/***/ 63:
|
|
2940
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2941
|
-
|
|
2942
|
-
"use strict";
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2946
|
-
value: true
|
|
2947
|
-
});
|
|
2948
|
-
|
|
2949
|
-
var React = __webpack_require__(1);
|
|
2950
|
-
|
|
2951
|
-
var colorUtils_1 = __webpack_require__(15);
|
|
2952
|
-
|
|
2953
|
-
var variables_1 = __webpack_require__(13);
|
|
2954
|
-
|
|
2955
|
-
var IconPlaceholder_1 = __webpack_require__(36);
|
|
2956
|
-
|
|
2957
|
-
var VizBehavior_1 = __webpack_require__(7);
|
|
2958
|
-
|
|
2959
|
-
var hocUtils_1 = __webpack_require__(23);
|
|
2960
|
-
|
|
2961
|
-
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
2962
|
-
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
2963
|
-
var config = Visualization.config;
|
|
2964
|
-
var themes = config.themes;
|
|
2965
|
-
|
|
2966
|
-
var Wrapper = function Wrapper(props) {
|
|
2967
|
-
var _a, _b;
|
|
2968
|
-
|
|
2969
|
-
var dataSources = props.dataSources,
|
|
2970
|
-
loading = props.loading,
|
|
2971
|
-
options = props.options,
|
|
2972
|
-
height = props.height,
|
|
2973
|
-
width = props.width;
|
|
2974
|
-
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
2975
|
-
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);
|
|
2976
|
-
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
2977
|
-
var iconColor = variables_1.default.contentColorActive(props);
|
|
2978
|
-
|
|
2979
|
-
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
2980
|
-
return React.createElement(IconPlaceholder_1.default, {
|
|
2981
|
-
"data-test": "icon-placeholder",
|
|
2982
|
-
icon: icon,
|
|
2983
|
-
width: width,
|
|
2984
|
-
height: height,
|
|
2985
|
-
backgroundColor: bgColorFromTheme,
|
|
2986
|
-
iconColor: iconColor
|
|
2987
|
-
});
|
|
2988
|
-
}
|
|
2989
|
-
|
|
2990
|
-
return React.createElement(Visualization, Object.assign({}, props));
|
|
2991
|
-
};
|
|
2992
|
-
|
|
2993
|
-
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2994
|
-
Wrapper: Wrapper,
|
|
2995
|
-
Visualization: Visualization
|
|
2996
|
-
});
|
|
2997
|
-
return Wrapper;
|
|
2998
|
-
};
|
|
2999
|
-
|
|
3000
|
-
exports.default = withPlaceholder;
|
|
3001
|
-
|
|
3002
|
-
/***/ }),
|
|
3003
|
-
|
|
3004
|
-
/***/ 64:
|
|
3005
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3006
|
-
|
|
3007
|
-
"use strict";
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
var _slicedToArray = __webpack_require__(5);
|
|
3011
|
-
|
|
3012
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3013
|
-
value: true
|
|
3014
|
-
});
|
|
3015
|
-
|
|
3016
|
-
var react_1 = __webpack_require__(1);
|
|
3017
|
-
|
|
3018
|
-
var lodash_1 = __webpack_require__(2);
|
|
3019
|
-
|
|
3020
|
-
var dataUtils_1 = __webpack_require__(14);
|
|
3021
|
-
|
|
3022
|
-
var usePrevious_1 = __webpack_require__(32);
|
|
3023
|
-
|
|
3024
|
-
var useGetXAndYFields_1 = __webpack_require__(65); // Options properties which impact/require re-downsample on change.
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
var downsampleVizOptionProperties = ['nullValueDisplay'];
|
|
3028
|
-
|
|
3029
|
-
var useDownsampleDataSources = function useDownsampleDataSources(_ref) {
|
|
3030
|
-
var dataSources = _ref.dataSources,
|
|
3031
|
-
options = _ref.options,
|
|
3032
|
-
context = _ref.context,
|
|
3033
|
-
threshold = _ref.threshold,
|
|
3034
|
-
isDownsamplingEnabled = _ref.isDownsamplingEnabled;
|
|
3035
|
-
var isFirstUseEffectCall = (0, react_1.useRef)(true);
|
|
3036
|
-
var xAndYFieldsWithTypes = (0, useGetXAndYFields_1.default)({
|
|
3037
|
-
shouldEvaluateDSL: isDownsamplingEnabled,
|
|
3038
|
-
options: options,
|
|
3039
|
-
context: context,
|
|
3040
|
-
dataSources: dataSources
|
|
3041
|
-
}); // Extract viz options that impact downsampling.
|
|
3042
|
-
|
|
3043
|
-
var downsampleVizOptions = (0, react_1.useMemo)(function () {
|
|
3044
|
-
return (0, lodash_1.pick)(options, downsampleVizOptionProperties);
|
|
3045
|
-
}, [options]);
|
|
3046
|
-
var downsampleDSOptions = (0, react_1.useMemo)(function () {
|
|
3047
|
-
return Object.assign(Object.assign({}, downsampleVizOptions), xAndYFieldsWithTypes);
|
|
3048
|
-
}, [xAndYFieldsWithTypes, downsampleVizOptions]);
|
|
3049
|
-
var previousDownsampleDSOptions = (0, usePrevious_1.default)(downsampleDSOptions);
|
|
3050
|
-
var previousDataSources = (0, usePrevious_1.default)(dataSources);
|
|
3051
|
-
var previousThreshold = (0, usePrevious_1.default)(threshold);
|
|
3052
|
-
|
|
3053
|
-
var _ref2 = (0, react_1.useState)(function () {
|
|
3054
|
-
return isDownsamplingEnabled ? (0, dataUtils_1.downsampleDataSources)({
|
|
3055
|
-
dataSources: dataSources,
|
|
3056
|
-
threshold: threshold,
|
|
3057
|
-
options: downsampleDSOptions
|
|
3058
|
-
}) : dataSources;
|
|
3059
|
-
}),
|
|
3060
|
-
_ref3 = _slicedToArray(_ref2, 2),
|
|
3061
|
-
downsampledDataSources = _ref3[0],
|
|
3062
|
-
setDownsampledDataSources = _ref3[1];
|
|
3063
|
-
|
|
3064
|
-
var debouncedDownsampleDataSources = (0, react_1.useMemo)(function () {
|
|
3065
|
-
return (0, lodash_1.debounce)(function (downsampleOptions) {
|
|
3066
|
-
var downsampledResult = (0, dataUtils_1.downsampleDataSources)(downsampleOptions);
|
|
3067
|
-
setDownsampledDataSources(downsampledResult);
|
|
3068
|
-
}, 100, {
|
|
3069
|
-
trailing: true
|
|
3070
|
-
});
|
|
3071
|
-
}, []);
|
|
3072
|
-
(0, react_1.useEffect)(function () {
|
|
3073
|
-
// don't downsample again on the use effect call that happened due to the initial render
|
|
3074
|
-
// this is since we already downsampled as part of the useState call
|
|
3075
|
-
if (isFirstUseEffectCall.current) {
|
|
3076
|
-
isFirstUseEffectCall.current = false;
|
|
3077
|
-
return;
|
|
3078
|
-
}
|
|
3079
|
-
|
|
3080
|
-
if (!isDownsamplingEnabled) {
|
|
3081
|
-
setDownsampledDataSources(dataSources);
|
|
3082
|
-
return;
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3085
|
-
if ((0, lodash_1.isEqual)(previousDownsampleDSOptions, downsampleDSOptions) && previousDataSources === dataSources && previousThreshold === threshold) {
|
|
3086
|
-
return;
|
|
3087
|
-
} // Debounce the downsampling so we don't have to downsample and execute DSL multiple times
|
|
3088
|
-
// while the viz is being resized
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
debouncedDownsampleDataSources({
|
|
3092
|
-
dataSources: dataSources,
|
|
3093
|
-
options: downsampleDSOptions,
|
|
3094
|
-
threshold: threshold
|
|
3095
|
-
}); // need to detect if this runs as part of the initial render
|
|
3096
|
-
}, [dataSources, downsampleDSOptions, debouncedDownsampleDataSources, xAndYFieldsWithTypes, threshold, isDownsamplingEnabled, previousDataSources, previousThreshold, previousDownsampleDSOptions]);
|
|
3097
|
-
return downsampledDataSources;
|
|
3098
|
-
};
|
|
3099
|
-
|
|
3100
|
-
exports.default = useDownsampleDataSources;
|
|
3101
|
-
|
|
3102
|
-
/***/ }),
|
|
3103
|
-
|
|
3104
|
-
/***/ 65:
|
|
3105
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3106
|
-
|
|
3107
|
-
"use strict";
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
var _toConsumableArray = __webpack_require__(6);
|
|
3111
|
-
|
|
3112
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3113
|
-
value: true
|
|
3114
|
-
});
|
|
3115
|
-
|
|
3116
|
-
var react_1 = __webpack_require__(1);
|
|
3117
|
-
|
|
3118
|
-
var Options_1 = __webpack_require__(16);
|
|
3119
|
-
/**
|
|
3120
|
-
* Hook that evaluates the DSL for subset of a viz's options needed to determine
|
|
3121
|
-
* its x and y fields as well as the types of all its fields.
|
|
3122
|
-
*/
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
var useGetXAndYFields = function useGetXAndYFields(_ref) {
|
|
3126
|
-
var shouldEvaluateDSL = _ref.shouldEvaluateDSL,
|
|
3127
|
-
options = _ref.options,
|
|
3128
|
-
context = _ref.context,
|
|
3129
|
-
dataSources = _ref.dataSources;
|
|
3130
|
-
|
|
3131
|
-
var _ref2 = (0, react_1.useMemo)(function () {
|
|
3132
|
-
var _a, _b, _c;
|
|
3133
|
-
|
|
3134
|
-
if (!shouldEvaluateDSL) {
|
|
3135
|
-
return {
|
|
3136
|
-
dataSourcesWithOnlyOnePoint: null,
|
|
3137
|
-
dataFrameWithOnlyOnePoint: null
|
|
3138
|
-
};
|
|
3139
|
-
}
|
|
3140
|
-
|
|
3141
|
-
if (!((_c = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
3142
|
-
return {
|
|
3143
|
-
dataSourcesWithOnlyOnePoint: null,
|
|
3144
|
-
dataFrameWithOnlyOnePoint: null
|
|
3145
|
-
};
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3148
|
-
var primaryDS = dataSources.primary;
|
|
3149
|
-
var columnsWithOnlyOnePoint = primaryDS.data.columns.map(function (column) {
|
|
3150
|
-
return [column[0]];
|
|
3151
|
-
});
|
|
3152
|
-
var filteredDataSources = {
|
|
3153
|
-
primary: Object.assign(Object.assign({}, primaryDS), {
|
|
3154
|
-
data: Object.assign(Object.assign({}, primaryDS.data), {
|
|
3155
|
-
columns: columnsWithOnlyOnePoint
|
|
3156
|
-
})
|
|
3157
|
-
})
|
|
3158
|
-
};
|
|
3159
|
-
return {
|
|
3160
|
-
dataSourcesWithOnlyOnePoint: filteredDataSources,
|
|
3161
|
-
dataFrameWithOnlyOnePoint: Options_1.Options.dataFrameFromDataSource(filteredDataSources)
|
|
1138
|
+
const themeFunc = (themeVar) => {
|
|
1139
|
+
var _a2, _b;
|
|
1140
|
+
return (_b = (_a2 = vizConfig.themes)[themeVar]) == null ? void 0 : _b.call(_a2, props);
|
|
3162
1141
|
};
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
1142
|
+
const bgColorFromTheme = themeFunc("defaultBackgroundColor");
|
|
1143
|
+
const {
|
|
1144
|
+
family: currentThemeFamily,
|
|
1145
|
+
colorScheme: currentThemeColorScheme,
|
|
1146
|
+
density: currentThemeDensity
|
|
1147
|
+
} = getSettingsFromThemedProps_default({ theme });
|
|
1148
|
+
let evaluatedOptions = {};
|
|
1149
|
+
const [evaluatedOptionsAsync, setEvaluatedOptionsAsync] = react_exports.useState({});
|
|
1150
|
+
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
1151
|
+
const [visualizationID] = react_exports.useState(`${vizConfig.name} - ${(0, id_exports.createGUID)()}`);
|
|
1152
|
+
const [dataSourcesInState, setDataSourcesInState] = react_exports.useState({});
|
|
1153
|
+
const [dataFramesInState, setDataFramesInState] = react_exports.useState();
|
|
1154
|
+
const [useAsyncEvaluatedOptions, setUseAsyncEvaluatedOptions] = react_exports.useState(
|
|
1155
|
+
Boolean(getFeatureFlag(featureFlagContext, "visualizations_useWebWorkersForDSL"))
|
|
1156
|
+
);
|
|
1157
|
+
const isDownsamplingEnabledByFeatureFlag = Boolean(
|
|
1158
|
+
featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
|
|
1159
|
+
);
|
|
1160
|
+
const isMounted = react_exports.useRef(true);
|
|
1161
|
+
const optionsToEvaluate = react_exports.useMemo(
|
|
1162
|
+
() => ({
|
|
1163
|
+
context: (0, lodash_exports.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1164
|
+
options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1165
|
+
}),
|
|
1166
|
+
[options, context]
|
|
1167
|
+
);
|
|
1168
|
+
const [threshold, setThreshold] = react_exports.useState(Number(width));
|
|
1169
|
+
const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
|
|
1170
|
+
setThreshold(newThreshold);
|
|
1171
|
+
}, []);
|
|
1172
|
+
const isDownsamplingEnabled = react_exports.useMemo(() => {
|
|
1173
|
+
return isDownsamplingEnabledByFeatureFlag && isDownsamplingEnabledForViz({ vizConfig });
|
|
1174
|
+
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
1175
|
+
const downsamplingProps = react_exports.useMemo(() => {
|
|
1176
|
+
if (!isDownsamplingEnabled) {
|
|
1177
|
+
return {};
|
|
3175
1178
|
}
|
|
3176
|
-
|
|
3177
|
-
var optionsToEvaluate = {
|
|
3178
|
-
x: options.x,
|
|
3179
|
-
xField: '> x | getField()',
|
|
3180
|
-
y: options.y,
|
|
3181
|
-
yFields: options.y ? '> y | getField()' : undefined,
|
|
3182
|
-
y2: options.y2,
|
|
3183
|
-
y2Fields: options.y2 ? '> y2 | getField()' : undefined,
|
|
3184
|
-
fieldTypes: '> primary | getType()'
|
|
3185
|
-
};
|
|
3186
|
-
|
|
3187
|
-
var _Options_1$Options$ev = Options_1.Options.evaluate({
|
|
3188
|
-
options: optionsToEvaluate,
|
|
3189
|
-
context: context
|
|
3190
|
-
}, dataSourcesWithOnlyOnePoint, function () {}, dataFrameWithOnlyOnePoint),
|
|
3191
|
-
_Options_1$Options$ev2 = _Options_1$Options$ev.xField,
|
|
3192
|
-
xField = _Options_1$Options$ev2 === void 0 ? '' : _Options_1$Options$ev2,
|
|
3193
|
-
_Options_1$Options$ev3 = _Options_1$Options$ev.yFields,
|
|
3194
|
-
yFields = _Options_1$Options$ev3 === void 0 ? [] : _Options_1$Options$ev3,
|
|
3195
|
-
_Options_1$Options$ev4 = _Options_1$Options$ev.y2Fields,
|
|
3196
|
-
y2Fields = _Options_1$Options$ev4 === void 0 ? [] : _Options_1$Options$ev4,
|
|
3197
|
-
fieldTypes = _Options_1$Options$ev.fieldTypes;
|
|
3198
|
-
|
|
3199
1179
|
return {
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
fieldTypes: fieldTypes
|
|
1180
|
+
onDownsamplingThresholdChange,
|
|
1181
|
+
originalDataSources: dataSources
|
|
3203
1182
|
};
|
|
3204
|
-
}
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
1183
|
+
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
1184
|
+
const downsampledDataSources = useDownsampleDataSources_default({
|
|
1185
|
+
options: optionsToEvaluate.options,
|
|
1186
|
+
context: optionsToEvaluate.context,
|
|
1187
|
+
dataSources,
|
|
1188
|
+
threshold,
|
|
1189
|
+
isDownsamplingEnabled
|
|
1190
|
+
});
|
|
1191
|
+
evaluatedOptions = useDeepMemo(() => {
|
|
1192
|
+
try {
|
|
1193
|
+
if (useAsyncEvaluatedOptions) {
|
|
1194
|
+
const asyncDynamicOptionsEvaluatorParams = {
|
|
1195
|
+
visualizationID,
|
|
1196
|
+
props,
|
|
1197
|
+
options: optionsToEvaluate,
|
|
1198
|
+
dataSources: downsampledDataSources,
|
|
1199
|
+
theme: vizConfig.themes,
|
|
1200
|
+
bypassCloneDeepOptionScope: Boolean(
|
|
1201
|
+
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
1202
|
+
),
|
|
1203
|
+
lazyLoadingDataFrame: Boolean(
|
|
1204
|
+
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
1205
|
+
)
|
|
1206
|
+
};
|
|
1207
|
+
async_dynamic_options_evaluator_default.evaluate(asyncDynamicOptionsEvaluatorParams).then((results) => {
|
|
1208
|
+
setEvaluatedOptionsAsync(results.results);
|
|
1209
|
+
}).catch(() => {
|
|
1210
|
+
if (isMounted.current) {
|
|
1211
|
+
setUseAsyncEvaluatedOptions(false);
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
} else {
|
|
1215
|
+
let dataFrames = dataFramesInState;
|
|
1216
|
+
if (downsampledDataSources !== dataSourcesInState) {
|
|
1217
|
+
setDataSourcesInState(downsampledDataSources);
|
|
1218
|
+
dataFrames = Options_exports.Options.dataFrameFromDataSource(
|
|
1219
|
+
downsampledDataSources,
|
|
1220
|
+
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
1221
|
+
);
|
|
1222
|
+
setDataFramesInState(dataFrames);
|
|
1223
|
+
}
|
|
1224
|
+
const result = Options_exports.Options.evaluate(
|
|
1225
|
+
optionsToEvaluate,
|
|
1226
|
+
downsampledDataSources,
|
|
1227
|
+
themeFunc,
|
|
1228
|
+
dataFrames,
|
|
1229
|
+
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
1230
|
+
);
|
|
1231
|
+
return result;
|
|
1232
|
+
}
|
|
1233
|
+
} catch (e) {
|
|
1234
|
+
console.error(`unexpected error evaluating options: ${e.message}`);
|
|
1235
|
+
return {};
|
|
1236
|
+
}
|
|
1237
|
+
return {};
|
|
1238
|
+
}, [
|
|
1239
|
+
currentThemeFamily,
|
|
1240
|
+
currentThemeColorScheme,
|
|
1241
|
+
currentThemeDensity,
|
|
1242
|
+
optionsToEvaluate,
|
|
1243
|
+
downsampledDataSources,
|
|
1244
|
+
serializedTimezone,
|
|
1245
|
+
useAsyncEvaluatedOptions
|
|
1246
|
+
]);
|
|
1247
|
+
const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1248
|
+
const isTrellisFeatureFlagOn = Boolean(
|
|
1249
|
+
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
1250
|
+
);
|
|
1251
|
+
let clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1252
|
+
if (isTrellisFeatureFlagOn && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.splitByLayout) === "trellis" /* TRELLIS */) {
|
|
1253
|
+
clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
|
|
1254
|
+
backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
react_exports.useEffect(() => {
|
|
1258
|
+
onComputedProps(clonedEvaluatedOptions);
|
|
1259
|
+
});
|
|
1260
|
+
react_exports.useEffect(() => {
|
|
1261
|
+
return () => {
|
|
1262
|
+
if (useAsyncEvaluatedOptions) {
|
|
1263
|
+
isMounted.current = false;
|
|
1264
|
+
async_dynamic_options_evaluator_default.reset(visualizationID);
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
}, []);
|
|
1268
|
+
const { requiredProps = [], supports } = vizConfig;
|
|
1269
|
+
const missing = missingKeys(requiredProps, evaluatedOptionsToUse);
|
|
1270
|
+
if (missing.length > 0 && supports.includes("placeholder" /* PLACEHOLDER */) && vizConfig.key !== "splunk.singlevalue") {
|
|
1271
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
1272
|
+
MissingPropsMessage_default,
|
|
1273
|
+
{
|
|
1274
|
+
"data-test": "missing-props-message",
|
|
1275
|
+
width,
|
|
1276
|
+
height,
|
|
1277
|
+
missingProps: missing,
|
|
1278
|
+
backgroundColor: bgColorFromTheme
|
|
1279
|
+
}
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
const eventCallbackProps = {};
|
|
1283
|
+
if (hasEventHandlers && mode === "view" && vizConfig.supports.indexOf("events" /* EVENTS */) > -1) {
|
|
1284
|
+
const supportedEvents = vizConfig.events;
|
|
1285
|
+
Object.keys(supportedEvents).forEach((eventName) => {
|
|
1286
|
+
const { parentKeys, payloadKeys } = supportedEvents[eventName];
|
|
1287
|
+
const eventCallbackPropName = (0, lodash_exports.camelCase)(`on.${eventName}`);
|
|
1288
|
+
let payload = {};
|
|
1289
|
+
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1290
|
+
payloadKeys.forEach((p) => {
|
|
1291
|
+
payload[p] = evaluatedOptionsToUse[p];
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
eventCallbackProps[eventCallbackPropName] = (ev) => {
|
|
1295
|
+
if (ev && ev.payload) {
|
|
1296
|
+
payload = ev.payload;
|
|
1297
|
+
}
|
|
1298
|
+
return onEventTrigger({ originalEvent: ev, payload, type: eventName });
|
|
1299
|
+
};
|
|
1300
|
+
if (parentKeys) {
|
|
1301
|
+
for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
1302
|
+
const newObject = {};
|
|
1303
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
1304
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
const computedVizProps = computeVizProps2(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1310
|
+
themeFunc
|
|
1311
|
+
}));
|
|
1312
|
+
let dataSourceMetadata = {};
|
|
1313
|
+
const OptionKey = "paginateDataSourceKey";
|
|
1314
|
+
const paginateDataSourceKey = (0, lodash_exports.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || "primary";
|
|
1315
|
+
if (vizConfig.supports.indexOf("page-and-sort" /* PAGE_AND_SORT */) > -1 && (0, lodash_exports.has)(dataSources, paginateDataSourceKey)) {
|
|
1316
|
+
const requestParams = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "requestParams"], {});
|
|
1317
|
+
const meta = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "meta"], {});
|
|
1318
|
+
const handleRequestParamsChange = (payload) => onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1319
|
+
const sortParams = getSortingParams({
|
|
1320
|
+
requestParams,
|
|
1321
|
+
meta,
|
|
1322
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
1323
|
+
});
|
|
1324
|
+
const paginatorParams = getPaginationParams({
|
|
1325
|
+
requestParams,
|
|
1326
|
+
meta,
|
|
1327
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
1328
|
+
});
|
|
1329
|
+
dataSourceMetadata = {
|
|
1330
|
+
sortParams,
|
|
1331
|
+
paginatorParams
|
|
3209
1332
|
};
|
|
3210
1333
|
}
|
|
3211
|
-
|
|
3212
|
-
|
|
1334
|
+
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1335
|
+
return null;
|
|
1336
|
+
}
|
|
1337
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
1338
|
+
SanitizedReactViz,
|
|
1339
|
+
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
1340
|
+
mode,
|
|
1341
|
+
width,
|
|
1342
|
+
height
|
|
1343
|
+
}, downsamplingProps), evaluatedOptionsToUse), computedVizProps), eventCallbackProps), dataSourceMetadata)
|
|
1344
|
+
);
|
|
1345
|
+
};
|
|
1346
|
+
DashboardViz.propTypes = __spreadValues(__spreadValues({}, SplunkVisualization_default.propTypes), ReactViz.propTypes);
|
|
1347
|
+
DashboardViz.defaultProps = __spreadProps(__spreadValues(__spreadValues({}, SplunkVisualization_default.defaultProps), ReactViz.defaultProps), {
|
|
1348
|
+
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1349
|
+
theme: {}
|
|
1350
|
+
});
|
|
1351
|
+
DashboardViz.config = vizConfig;
|
|
1352
|
+
return (0, styled_components_exports.withTheme)(
|
|
1353
|
+
withPlaceholder_default(withEditModeCover_default(DashboardViz, disableEditModeCover), useIconPlaceholder)
|
|
1354
|
+
);
|
|
3213
1355
|
};
|
|
1356
|
+
var withDashboardViz_default = withDashboardViz;
|
|
3214
1357
|
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
/***/ 66:
|
|
3220
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3221
|
-
|
|
3222
|
-
"use strict";
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3226
|
-
value: true
|
|
1358
|
+
// esm-externals:@splunk/visualization-schemas
|
|
1359
|
+
var visualization_schemas_exports = {};
|
|
1360
|
+
__export(visualization_schemas_exports, {
|
|
1361
|
+
default: () => visualization_schemas_default
|
|
3227
1362
|
});
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
var
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
1363
|
+
var defaultImport30 = __toESM(require("@splunk/visualization-schemas"));
|
|
1364
|
+
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
1365
|
+
var visualization_schemas_default = "default" in defaultImport30 ? defaultImport30.default : defaultImport30;
|
|
1366
|
+
|
|
1367
|
+
// esm-externals:@splunk/visualizations-shared/configUtils
|
|
1368
|
+
var configUtils_exports = {};
|
|
1369
|
+
__export(configUtils_exports, {
|
|
1370
|
+
default: () => configUtils_default
|
|
1371
|
+
});
|
|
1372
|
+
var defaultImport31 = __toESM(require("@splunk/visualizations-shared/configUtils"));
|
|
1373
|
+
__reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
|
|
1374
|
+
var configUtils_default = "default" in defaultImport31 ? defaultImport31.default : defaultImport31;
|
|
3240
1375
|
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
})
|
|
3244
|
-
|
|
3245
|
-
|
|
1376
|
+
// src/common/utils/configUtils.ts
|
|
1377
|
+
function enhanceConfig(vizConfig) {
|
|
1378
|
+
const enhancedConfig = __spreadValues({}, vizConfig);
|
|
1379
|
+
enhancedConfig.editorConfig = vizConfig.editorConfig.map(
|
|
1380
|
+
(config2) => {
|
|
1381
|
+
return __spreadProps(__spreadValues({}, config2), { open: config2.open || false });
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
return enhancedConfig;
|
|
1385
|
+
}
|
|
3246
1386
|
|
|
1387
|
+
// src/common/editorConfig/BackgroundColor.ts
|
|
1388
|
+
var background = ({
|
|
1389
|
+
label,
|
|
1390
|
+
themes: themes3,
|
|
1391
|
+
labelPosition
|
|
1392
|
+
}) => [
|
|
1393
|
+
{
|
|
1394
|
+
label: (0, i18n_exports._)(label || "Background color"),
|
|
1395
|
+
option: "backgroundColor",
|
|
1396
|
+
editor: "editor.color",
|
|
1397
|
+
editorProps: {
|
|
1398
|
+
labelPosition: labelPosition || "top",
|
|
1399
|
+
themes: themes3
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
];
|
|
1403
|
+
var BackgroundColor_default = background;
|
|
3247
1404
|
|
|
3248
|
-
|
|
1405
|
+
// src/Markdown/config.ts
|
|
1406
|
+
var FONT_OPTIONS = /* @__PURE__ */ new Set(["extraSmall", "small", "default", "large", "extraLarge"]);
|
|
1407
|
+
var dataContract = {
|
|
1408
|
+
requiredDataSources: [],
|
|
1409
|
+
optionalDataSources: [
|
|
1410
|
+
// Note: SCP-14090 disable ui for optional datasources. We may need to add it back later
|
|
1411
|
+
// {
|
|
1412
|
+
// name: 'annotation',
|
|
1413
|
+
// description: 'DataSource that populate event annotations',
|
|
1414
|
+
// },
|
|
1415
|
+
],
|
|
1416
|
+
initialRequestParams: {
|
|
1417
|
+
primary: { offset: 0, count: 1e4 }
|
|
1418
|
+
}
|
|
3249
1419
|
};
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
1420
|
+
var size = {
|
|
1421
|
+
initialWidth: 300,
|
|
1422
|
+
initialHeight: 300
|
|
1423
|
+
};
|
|
1424
|
+
var defaultContext = {};
|
|
1425
|
+
var themes = {
|
|
1426
|
+
defaultFontColor: (props) => (0, themes_exports.pick)({
|
|
1427
|
+
enterprise: {
|
|
1428
|
+
dark: themes_exports.variables.textColor(props),
|
|
1429
|
+
light: themes_exports.variables.textColor(props)
|
|
1430
|
+
},
|
|
1431
|
+
prisma: themes_exports.variables.contentColorDefault(props)
|
|
1432
|
+
})(props)
|
|
1433
|
+
};
|
|
1434
|
+
var editorConfig = [
|
|
1435
|
+
{
|
|
1436
|
+
label: (0, i18n_exports._)("Color and style"),
|
|
1437
|
+
layout: [
|
|
1438
|
+
[
|
|
1439
|
+
{
|
|
1440
|
+
label: (0, i18n_exports._)("Font"),
|
|
1441
|
+
option: "fontColor",
|
|
1442
|
+
editor: "editor.color",
|
|
1443
|
+
editorProps: {
|
|
1444
|
+
labelPosition: "top",
|
|
1445
|
+
themes
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
...BackgroundColor_default({ label: "Background", themes })
|
|
1449
|
+
],
|
|
1450
|
+
[
|
|
1451
|
+
{
|
|
1452
|
+
label: (0, i18n_exports._)("Font family"),
|
|
1453
|
+
option: "fontFamily",
|
|
1454
|
+
editor: "editor.select",
|
|
1455
|
+
editorProps: {
|
|
1456
|
+
values: [
|
|
1457
|
+
{ value: "Splunk Platform Sans" },
|
|
1458
|
+
{ value: "Splunk Data Sans" },
|
|
1459
|
+
{ value: "Splunk Platform Mono" },
|
|
1460
|
+
{ value: "Arial" },
|
|
1461
|
+
{ value: "Helvetica" },
|
|
1462
|
+
{ value: "Times New Roman" },
|
|
1463
|
+
{ value: "Comic Sans MS" }
|
|
1464
|
+
]
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
],
|
|
1468
|
+
[
|
|
1469
|
+
{
|
|
1470
|
+
label: (0, i18n_exports._)("Font size"),
|
|
1471
|
+
option: "fontSize",
|
|
1472
|
+
editor: "editor.select",
|
|
1473
|
+
editorProps: {
|
|
1474
|
+
values: [
|
|
1475
|
+
{ label: (0, i18n_exports._)("Extra Small"), value: "extraSmall" },
|
|
1476
|
+
{ label: (0, i18n_exports._)("Small"), value: "small" },
|
|
1477
|
+
{ label: (0, i18n_exports._)("Default"), value: "default" },
|
|
1478
|
+
{ label: (0, i18n_exports._)("Large"), value: "large" },
|
|
1479
|
+
{ label: (0, i18n_exports._)("Extra Large"), value: "extraLarge" },
|
|
1480
|
+
{ label: (0, i18n_exports._)("Custom"), value: "custom" }
|
|
1481
|
+
]
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
{
|
|
1485
|
+
label: (0, i18n_exports._)("Custom font size (px)"),
|
|
1486
|
+
option: "customFontSize",
|
|
1487
|
+
editor: "editor.number",
|
|
1488
|
+
editorProps: {
|
|
1489
|
+
min: 0,
|
|
1490
|
+
labelPosition: "top"
|
|
1491
|
+
},
|
|
1492
|
+
showEditor: ({ options }) => options.fontSize && !FONT_OPTIONS.has(options.fontSize)
|
|
1493
|
+
}
|
|
1494
|
+
],
|
|
1495
|
+
[
|
|
1496
|
+
{
|
|
1497
|
+
label: (0, i18n_exports._)("Rotation (degrees)"),
|
|
1498
|
+
option: "rotation",
|
|
1499
|
+
editor: "editor.number",
|
|
1500
|
+
editorProps: {
|
|
1501
|
+
min: -360,
|
|
1502
|
+
max: 360
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
]
|
|
1506
|
+
]
|
|
1507
|
+
},
|
|
1508
|
+
{
|
|
1509
|
+
label: (0, i18n_exports._)("Markdown content"),
|
|
1510
|
+
open: true,
|
|
1511
|
+
layout: [
|
|
1512
|
+
[
|
|
1513
|
+
{
|
|
1514
|
+
label: "",
|
|
1515
|
+
option: "markdown",
|
|
1516
|
+
editor: "editor.markdown"
|
|
1517
|
+
}
|
|
1518
|
+
]
|
|
1519
|
+
]
|
|
1520
|
+
}
|
|
1521
|
+
];
|
|
1522
|
+
var config = {
|
|
3275
1523
|
/**
|
|
3276
|
-
*
|
|
3277
|
-
* This allows visualization options to be powered by data
|
|
3278
|
-
*
|
|
3279
|
-
* **Example**
|
|
3280
|
-
*
|
|
3281
|
-
* sparklineValues: ">primary|seriesByIndex(0)"
|
|
3282
|
-
* would configure sparklineValues with an array of data points
|
|
3283
|
-
* coming from the first series in the primary datasource
|
|
3284
|
-
*
|
|
1524
|
+
* unique viz key
|
|
3285
1525
|
*/
|
|
3286
|
-
|
|
3287
|
-
VizBehavior["EVENTS"] = "events";
|
|
3288
|
-
VizBehavior["DOWNSAMPLING"] = "downsampling";
|
|
1526
|
+
key: "splunk.markdown",
|
|
3289
1527
|
/**
|
|
3290
|
-
*
|
|
3291
|
-
* missing.
|
|
3292
|
-
* @type {string}
|
|
1528
|
+
* viz name
|
|
3293
1529
|
*/
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3309
|
-
value: true
|
|
3310
|
-
});
|
|
3311
|
-
|
|
3312
|
-
var i18n_1 = __webpack_require__(3);
|
|
3313
|
-
|
|
3314
|
-
var background = function background(_ref) {
|
|
3315
|
-
var label = _ref.label,
|
|
3316
|
-
themes = _ref.themes,
|
|
3317
|
-
labelPosition = _ref.labelPosition;
|
|
3318
|
-
return [{
|
|
3319
|
-
label: (0, i18n_1._)(label || 'Background color'),
|
|
3320
|
-
option: 'backgroundColor',
|
|
3321
|
-
editor: 'editor.color',
|
|
3322
|
-
editorProps: {
|
|
3323
|
-
labelPosition: labelPosition || 'top',
|
|
3324
|
-
themes: themes
|
|
1530
|
+
name: (0, i18n_exports._)("Markdown"),
|
|
1531
|
+
category: "Comparisons" /* COMPARISONS */,
|
|
1532
|
+
/**
|
|
1533
|
+
* viz icon
|
|
1534
|
+
*/
|
|
1535
|
+
icon: null,
|
|
1536
|
+
dataContract,
|
|
1537
|
+
size,
|
|
1538
|
+
defaultContext,
|
|
1539
|
+
optionsSchema: visualization_schemas_exports.markdownOptionsSchema,
|
|
1540
|
+
editorConfig,
|
|
1541
|
+
events: {
|
|
1542
|
+
"markdown.click": {
|
|
1543
|
+
description: "triggered when user clicks on markdown area not formatted as a link"
|
|
3325
1544
|
}
|
|
3326
|
-
}
|
|
1545
|
+
},
|
|
1546
|
+
supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "events" /* EVENTS */],
|
|
1547
|
+
themes
|
|
3327
1548
|
};
|
|
1549
|
+
var config_default = enhanceConfig(config);
|
|
3328
1550
|
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
1551
|
+
// src/Markdown/Markdown.tsx
|
|
1552
|
+
var FONT_SIZES = {
|
|
1553
|
+
extraSmall: {
|
|
1554
|
+
h1: 18,
|
|
1555
|
+
h2: 14,
|
|
1556
|
+
h3: 12,
|
|
1557
|
+
p: 10
|
|
1558
|
+
},
|
|
1559
|
+
small: {
|
|
1560
|
+
h1: 20,
|
|
1561
|
+
h2: 16,
|
|
1562
|
+
h3: 14,
|
|
1563
|
+
p: 12
|
|
1564
|
+
},
|
|
1565
|
+
default: {
|
|
1566
|
+
h1: 24,
|
|
1567
|
+
h2: 18,
|
|
1568
|
+
h3: 16,
|
|
1569
|
+
p: 14
|
|
1570
|
+
},
|
|
1571
|
+
large: {
|
|
1572
|
+
h1: 32,
|
|
1573
|
+
h2: 24,
|
|
1574
|
+
h3: 18,
|
|
1575
|
+
p: 16
|
|
1576
|
+
},
|
|
1577
|
+
extraLarge: {
|
|
1578
|
+
h1: 48,
|
|
1579
|
+
h2: 32,
|
|
1580
|
+
h3: 24,
|
|
1581
|
+
p: 18
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
var MarkdownContainer = styled_components_default.div`
|
|
1585
|
+
overflow: auto;
|
|
1586
|
+
position: relative;
|
|
1587
|
+
box-sizing: border-box;
|
|
1588
|
+
${(props) => (0, style_exports.toDimension)((0, lodash_exports.pick)(props, ["width", "height"]))};
|
|
1589
|
+
${(props) => (0, style_exports.toPadding)(props.padding)};
|
|
1590
|
+
background-color: ${(props) => props.backgroundColor};
|
|
1591
|
+
transform-origin: center;
|
|
1592
|
+
transform: rotate(${(props) => props.rotation || 0}deg);
|
|
1593
|
+
& *:not(code):not(pre):not(code *):not(a) {
|
|
1594
|
+
color: ${(props) => props.fontColor};
|
|
1595
|
+
}
|
|
1596
|
+
${({ startsWithHeader }) => startsWithHeader && `
|
|
1597
|
+
h${startsWithHeader >= 4 ? 4 : startsWithHeader}:first-of-type {
|
|
1598
|
+
margin-top: 0px;
|
|
1599
|
+
}
|
|
1600
|
+
`};
|
|
1601
|
+
`;
|
|
1602
|
+
var CodeBlockContainer = styled_components_default.div`
|
|
1603
|
+
// from: https://cd.splunkdev.com/devplat/splunk-ui/-/blob/develop/packages/react-ui/src/Markdown/MarkdownStyles.ts
|
|
1604
|
+
padding: ${(0, themes_exports.pick)({
|
|
1605
|
+
enterprise: themes_exports.variables.spacingHalf,
|
|
1606
|
+
prisma: styled_components_exports.css`10px ${themes_exports.variables.spacingLarge}`
|
|
1607
|
+
})};
|
|
1608
|
+
margin: ${(0, themes_exports.pick)({
|
|
1609
|
+
enterprise: themes_exports.variables.spacingHalf,
|
|
1610
|
+
prisma: themes_exports.variables.spacingLarge
|
|
1611
|
+
})}
|
|
1612
|
+
0;
|
|
1613
|
+
background-color: ${(0, themes_exports.pick)({
|
|
1614
|
+
enterprise: {
|
|
1615
|
+
light: themes_exports.variables.gray96,
|
|
1616
|
+
dark: themes_exports.variables.gray22
|
|
1617
|
+
},
|
|
1618
|
+
prisma: themes_exports.variables.backgroundColorSection
|
|
1619
|
+
})};
|
|
3358
1620
|
|
|
3359
|
-
|
|
1621
|
+
// remove extraneous bottom margin
|
|
1622
|
+
pre[data-test='code'] {
|
|
1623
|
+
margin-bottom: 0px;
|
|
1624
|
+
}
|
|
3360
1625
|
|
|
3361
|
-
|
|
3362
|
-
|
|
1626
|
+
// add font-size, as span elements did not inherit <code /> font size in SSC testing
|
|
1627
|
+
code {
|
|
1628
|
+
font-size: ${(props) => props.fontSize}px !important;
|
|
1629
|
+
line-height: ${(props) => props.fontSize}px !important;
|
|
1630
|
+
}
|
|
1631
|
+
`;
|
|
1632
|
+
var CodeInlineContainer = styled_components_default.code`
|
|
1633
|
+
// from: https://cd.splunkdev.com/devplat/splunk-ui/-/blob/develop/packages/react-ui/src/Markdown/MarkdownStyles.ts
|
|
1634
|
+
${themes_exports.mixins.reset("inline")};
|
|
1635
|
+
font-family: ${themes_exports.variables.monoFontFamily};
|
|
1636
|
+
background-color: ${(0, themes_exports.pick)({
|
|
1637
|
+
enterprise: {
|
|
1638
|
+
light: themes_exports.variables.gray92,
|
|
1639
|
+
dark: themes_exports.variables.gray22
|
|
1640
|
+
},
|
|
1641
|
+
prisma: themes_exports.variables.neutral200
|
|
1642
|
+
})};
|
|
1643
|
+
`;
|
|
1644
|
+
var getFontMap = (fontSize) => {
|
|
1645
|
+
let font = fontSize;
|
|
1646
|
+
if (!FONT_SIZES[fontSize] && fontSize !== "custom") {
|
|
1647
|
+
console.error(
|
|
1648
|
+
`'${fontSize}' is not a valid value for Markdown's fontSize option. Using the 'default' font size.`
|
|
1649
|
+
);
|
|
1650
|
+
font = "default";
|
|
1651
|
+
}
|
|
1652
|
+
return FONT_SIZES[font];
|
|
1653
|
+
};
|
|
1654
|
+
var handleLinkClick = (e) => e.stopPropagation();
|
|
1655
|
+
var StyledA = styled_components_default.a`
|
|
1656
|
+
text-decoration: underlined;
|
|
1657
|
+
`;
|
|
1658
|
+
var getMarkdownRenderer = (fontFamilyStyle, fontSize, customFontSize) => {
|
|
1659
|
+
const cleanedCustomFontSize = (0, types_exports.isNumber)(customFontSize) ? customFontSize : 14;
|
|
1660
|
+
const isCustomFontSize = fontSize === "custom";
|
|
1661
|
+
const fontMap = isCustomFontSize ? {
|
|
1662
|
+
h1: cleanedCustomFontSize * 2,
|
|
1663
|
+
h2: cleanedCustomFontSize * 1.5,
|
|
1664
|
+
h3: cleanedCustomFontSize * 1.25,
|
|
1665
|
+
p: cleanedCustomFontSize
|
|
1666
|
+
} : getFontMap(fontSize);
|
|
1667
|
+
return {
|
|
1668
|
+
paragraphRenderer: ({ children }) => {
|
|
1669
|
+
return /* @__PURE__ */ react_exports.createElement(Paragraph_default, { style: __spreadValues({ fontSize: fontMap.p, lineHeight: `${fontMap.p}px` }, fontFamilyStyle) }, children);
|
|
1670
|
+
},
|
|
1671
|
+
headingRenderer: ({ children, level }) => {
|
|
1672
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
1673
|
+
Heading_default,
|
|
1674
|
+
{
|
|
1675
|
+
level,
|
|
1676
|
+
style: __spreadValues({
|
|
1677
|
+
fontSize: fontMap[`h${level}`],
|
|
1678
|
+
lineHeight: `${fontMap[`h${level}`]}px`
|
|
1679
|
+
}, fontFamilyStyle)
|
|
1680
|
+
},
|
|
1681
|
+
children
|
|
1682
|
+
);
|
|
1683
|
+
},
|
|
1684
|
+
itemRenderer: ({ children, nodeKey }) => {
|
|
1685
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
1686
|
+
List_default.Item,
|
|
1687
|
+
{
|
|
1688
|
+
style: __spreadValues({ fontSize: fontMap.p, lineHeight: `${fontMap.p}px` }, fontFamilyStyle),
|
|
1689
|
+
key: nodeKey
|
|
1690
|
+
},
|
|
1691
|
+
children
|
|
1692
|
+
);
|
|
1693
|
+
},
|
|
1694
|
+
codeBlockRenderer: ({ language, literal, nodeKey }) => {
|
|
1695
|
+
return /* @__PURE__ */ react_exports.createElement(CodeBlockContainer, { fontSize: fontMap.p }, /* @__PURE__ */ react_exports.createElement(Code_default, { value: literal, language, key: nodeKey }));
|
|
1696
|
+
},
|
|
1697
|
+
codeRenderer: ({ literal }) => {
|
|
1698
|
+
return /* @__PURE__ */ react_exports.createElement(CodeInlineContainer, { style: { fontSize: fontMap.p } }, literal);
|
|
1699
|
+
},
|
|
1700
|
+
linkRenderer: ({ href, children }) => {
|
|
1701
|
+
return /* @__PURE__ */ react_exports.createElement(StyledA, { href, onClick: handleLinkClick }, children);
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
};
|
|
1705
|
+
var MarkdownVisualization = ({
|
|
1706
|
+
height,
|
|
1707
|
+
width,
|
|
1708
|
+
markdown,
|
|
1709
|
+
backgroundColor,
|
|
1710
|
+
fontColor,
|
|
1711
|
+
fontFamily,
|
|
1712
|
+
fontSize,
|
|
1713
|
+
customFontSize,
|
|
1714
|
+
rotation,
|
|
1715
|
+
hasEventHandlers,
|
|
1716
|
+
onMarkdownClick
|
|
1717
|
+
}) => {
|
|
1718
|
+
var _a;
|
|
1719
|
+
const { fontFamily: defaultFontFamily } = (0, themes_exports.useSplunkTheme)();
|
|
1720
|
+
const markdownContentFontFamilyStyle = {
|
|
1721
|
+
fontFamily: `${fontFamily}, ${defaultFontFamily}`
|
|
1722
|
+
};
|
|
1723
|
+
const stringifiedMarkdown = `${markdown}`;
|
|
1724
|
+
const renderersForFontSize = getMarkdownRenderer(
|
|
1725
|
+
markdownContentFontFamilyStyle,
|
|
1726
|
+
fontSize,
|
|
1727
|
+
customFontSize
|
|
1728
|
+
);
|
|
1729
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
1730
|
+
MarkdownContainer,
|
|
1731
|
+
{
|
|
1732
|
+
"data-test": "markdown-container",
|
|
1733
|
+
padding: [5, 5, 5, 5],
|
|
1734
|
+
width,
|
|
1735
|
+
height,
|
|
1736
|
+
rotation,
|
|
1737
|
+
backgroundColor,
|
|
1738
|
+
fontColor,
|
|
1739
|
+
startsWithHeader: (_a = stringifiedMarkdown.trim().match(/^#+/)) == null ? void 0 : _a[0].length
|
|
1740
|
+
},
|
|
1741
|
+
/* @__PURE__ */ react_exports.createElement(
|
|
1742
|
+
Markdown_default,
|
|
1743
|
+
__spreadProps(__spreadValues({
|
|
1744
|
+
text: stringifiedMarkdown
|
|
1745
|
+
}, renderersForFontSize), {
|
|
1746
|
+
style: { height: "100%", cursor: hasEventHandlers ? "pointer" : "inherit" },
|
|
1747
|
+
onClick: onMarkdownClick
|
|
1748
|
+
})
|
|
1749
|
+
)
|
|
1750
|
+
);
|
|
1751
|
+
};
|
|
1752
|
+
var propTypes3 = {
|
|
1753
|
+
width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
1754
|
+
height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
1755
|
+
markdown: prop_types_exports.string,
|
|
1756
|
+
backgroundColor: prop_types_exports.string,
|
|
1757
|
+
fontColor: prop_types_exports.string,
|
|
1758
|
+
fontFamily: prop_types_exports.string,
|
|
1759
|
+
fontSize: prop_types_exports.string,
|
|
1760
|
+
customFontSize: prop_types_exports.number,
|
|
1761
|
+
rotation: prop_types_exports.number,
|
|
1762
|
+
hasEventHandlers: prop_types_exports.bool,
|
|
1763
|
+
onMarkdownClick: prop_types_exports.func
|
|
1764
|
+
};
|
|
1765
|
+
var defaultProps = {
|
|
1766
|
+
width: "100%",
|
|
1767
|
+
height: void 0,
|
|
1768
|
+
markdown: "",
|
|
1769
|
+
backgroundColor: "transparent",
|
|
1770
|
+
fontColor: "rgba(255, 255, 255, 0.7)",
|
|
1771
|
+
fontFamily: "Splunk Platform Sans",
|
|
1772
|
+
fontSize: "default",
|
|
1773
|
+
customFontSize: 14,
|
|
1774
|
+
rotation: 0,
|
|
1775
|
+
hasEventHandlers: false,
|
|
1776
|
+
onMarkdownClick: () => {
|
|
1777
|
+
}
|
|
1778
|
+
};
|
|
1779
|
+
MarkdownVisualization.propTypes = propTypes3;
|
|
1780
|
+
MarkdownVisualization.defaultProps = defaultProps;
|
|
1781
|
+
var computeVizProps = (props) => {
|
|
1782
|
+
return props;
|
|
1783
|
+
};
|
|
1784
|
+
var Markdown = withDashboardViz_default({
|
|
1785
|
+
ReactViz: MarkdownVisualization,
|
|
1786
|
+
vizConfig: config_default,
|
|
1787
|
+
computeVizProps
|
|
1788
|
+
});
|
|
1789
|
+
var { themes: themes2 } = config_default;
|
|
1790
|
+
var Markdown_default2 = Markdown;
|
|
1791
|
+
//# sourceMappingURL=Markdown.js.map
|