@splunk/visualizations 25.13.1 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +318 -234
- package/Area.config.js.map +1 -1
- package/Area.js +1131 -766
- package/Area.js.map +1 -1
- package/Bar.config.js +317 -233
- package/Bar.config.js.map +1 -1
- package/Bar.js +1007 -594
- package/Bar.js.map +1 -1
- package/Bubble.config.js +234 -160
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +912 -509
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +80 -29
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +691 -319
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +308 -223
- package/Column.config.js.map +1 -1
- package/Column.js +1011 -587
- package/Column.js.map +1 -1
- package/Ellipse.config.js +127 -62
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +576 -286
- package/Ellipse.js.map +1 -1
- package/Events.config.js +111 -29
- package/Events.config.js.map +1 -1
- package/Events.js +998 -527
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +142 -73
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +962 -572
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +70 -26
- package/Image.config.js.map +1 -1
- package/Image.js +524 -253
- package/Image.js.map +1 -1
- package/Line.config.js +326 -242
- package/Line.config.js.map +1 -1
- package/Line.js +1022 -606
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +99 -49
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +1184 -762
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +311 -167
- package/Map.config.js.map +1 -1
- package/Map.js +1479 -873
- package/Map.js.map +1 -1
- package/Markdown.config.js +93 -43
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +603 -332
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +163 -105
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +1025 -628
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +95 -41
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +993 -622
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +99 -46
- package/Pie.config.js.map +1 -1
- package/Pie.js +847 -442
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +114 -62
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +1097 -633
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +131 -65
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +580 -288
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +103 -41
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +1128 -586
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +231 -157
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +904 -504
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +212 -142
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1506 -956
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +294 -233
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +208 -138
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +1375 -914
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +252 -137
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +2194 -1069
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +172 -83
- package/SparkLine.js.map +1 -1
- package/Table.config.js +123 -70
- package/Table.config.js.map +1 -1
- package/Table.js +1094 -590
- package/Table.js.map +1 -1
- package/common/Charting.js +147 -75
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +91 -36
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +70 -60
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +45 -36
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +177 -86
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +65 -32
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +34 -7
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +10 -4
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +41 -28
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +56 -24
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +15 -5
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +238 -155
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +34 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +59 -23
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +9 -4
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +5 -3
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +3 -2
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +370 -206
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +243 -198
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +36 -9
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +87 -26
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +4 -2
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +375 -193
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +25 -27
package/MarkerGauge.js
CHANGED
|
@@ -87,7 +87,7 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 427);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -127,7 +127,7 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
127
127
|
|
|
128
128
|
/***/ }),
|
|
129
129
|
|
|
130
|
-
/***/
|
|
130
|
+
/***/ 126:
|
|
131
131
|
/***/ (function(module, exports, __webpack_require__) {
|
|
132
132
|
|
|
133
133
|
"use strict";
|
|
@@ -136,51 +136,53 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
136
136
|
Object.defineProperty(exports, "__esModule", {
|
|
137
137
|
value: true
|
|
138
138
|
});
|
|
139
|
+
|
|
139
140
|
var i18n_1 = __webpack_require__(2);
|
|
141
|
+
|
|
140
142
|
var gauge = {
|
|
141
|
-
label: i18n_1._('Data display'),
|
|
143
|
+
label: (0, i18n_1._)('Data display'),
|
|
142
144
|
layout: [[{
|
|
143
|
-
label: i18n_1._('Value display'),
|
|
145
|
+
label: (0, i18n_1._)('Value display'),
|
|
144
146
|
option: 'valueDisplay',
|
|
145
147
|
editor: 'editor.radioBar',
|
|
146
148
|
editorProps: {
|
|
147
149
|
values: [{
|
|
148
|
-
label: i18n_1._('Number'),
|
|
150
|
+
label: (0, i18n_1._)('Number'),
|
|
149
151
|
value: 'number'
|
|
150
152
|
}, {
|
|
151
|
-
label: i18n_1._('Percentage'),
|
|
153
|
+
label: (0, i18n_1._)('Percentage'),
|
|
152
154
|
value: 'percentage'
|
|
153
155
|
}, {
|
|
154
|
-
label: i18n_1._('Off'),
|
|
156
|
+
label: (0, i18n_1._)('Off'),
|
|
155
157
|
value: 'off'
|
|
156
158
|
}]
|
|
157
159
|
}
|
|
158
160
|
}], [{
|
|
159
|
-
label: i18n_1._('Label display'),
|
|
161
|
+
label: (0, i18n_1._)('Label display'),
|
|
160
162
|
option: 'labelDisplay',
|
|
161
163
|
editor: 'editor.radioBar',
|
|
162
164
|
editorProps: {
|
|
163
165
|
values: [{
|
|
164
|
-
label: i18n_1._('Numbers'),
|
|
166
|
+
label: (0, i18n_1._)('Numbers'),
|
|
165
167
|
value: 'number'
|
|
166
168
|
}, {
|
|
167
|
-
label: i18n_1._('Percentages'),
|
|
169
|
+
label: (0, i18n_1._)('Percentages'),
|
|
168
170
|
value: 'percentage'
|
|
169
171
|
}, {
|
|
170
|
-
label: i18n_1._('Off'),
|
|
172
|
+
label: (0, i18n_1._)('Off'),
|
|
171
173
|
value: 'off'
|
|
172
174
|
}]
|
|
173
175
|
}
|
|
174
176
|
}], [{
|
|
175
|
-
label: i18n_1._('Orientation'),
|
|
177
|
+
label: (0, i18n_1._)('Orientation'),
|
|
176
178
|
option: 'orientation',
|
|
177
179
|
editor: 'editor.radioBar',
|
|
178
180
|
editorProps: {
|
|
179
181
|
values: [{
|
|
180
|
-
label: i18n_1._('Vertical'),
|
|
182
|
+
label: (0, i18n_1._)('Vertical'),
|
|
181
183
|
value: 'vertical'
|
|
182
184
|
}, {
|
|
183
|
-
label: i18n_1._('Horizontal'),
|
|
185
|
+
label: (0, i18n_1._)('Horizontal'),
|
|
184
186
|
value: 'horizontal'
|
|
185
187
|
}]
|
|
186
188
|
}
|
|
@@ -190,7 +192,7 @@ exports.default = gauge;
|
|
|
190
192
|
|
|
191
193
|
/***/ }),
|
|
192
194
|
|
|
193
|
-
/***/
|
|
195
|
+
/***/ 127:
|
|
194
196
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
195
197
|
|
|
196
198
|
"use strict";
|
|
@@ -205,7 +207,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
205
207
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
|
|
206
208
|
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
|
|
207
209
|
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
|
|
208
|
-
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
210
|
+
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31);
|
|
209
211
|
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
|
|
210
212
|
|
|
211
213
|
|
|
@@ -231,16 +233,16 @@ var MajorTickLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.te
|
|
|
231
233
|
});
|
|
232
234
|
var MajorTick = function MajorTick(_ref) {
|
|
233
235
|
var index = _ref.index,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
236
|
+
x1 = _ref.x1,
|
|
237
|
+
y1 = _ref.y1,
|
|
238
|
+
x2 = _ref.x2,
|
|
239
|
+
y2 = _ref.y2,
|
|
240
|
+
showLabels = _ref.showLabels,
|
|
241
|
+
label = _ref.label,
|
|
242
|
+
labelX = _ref.labelX,
|
|
243
|
+
labelY = _ref.labelY,
|
|
244
|
+
majorTickStrokeColor = _ref.majorTickStrokeColor,
|
|
245
|
+
majorTickFillColor = _ref.majorTickFillColor;
|
|
244
246
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTickLine, {
|
|
245
247
|
index: index,
|
|
246
248
|
x1: x1,
|
|
@@ -270,7 +272,6 @@ MajorTick.propTypes = {
|
|
|
270
272
|
majorTickStrokeColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string,
|
|
271
273
|
majorTickFillColor: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.string
|
|
272
274
|
};
|
|
273
|
-
|
|
274
275
|
/**
|
|
275
276
|
* calculate position for each major tick
|
|
276
277
|
* @method positionMajorTick
|
|
@@ -284,20 +285,22 @@ MajorTick.propTypes = {
|
|
|
284
285
|
* @param {Number} input.i index of major tick
|
|
285
286
|
* @return {Object} MajorTick positions
|
|
286
287
|
*/
|
|
288
|
+
|
|
287
289
|
var positionMajorTick = function positionMajorTick(_ref2) {
|
|
288
290
|
var width = _ref2.width,
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
291
|
+
height = _ref2.height,
|
|
292
|
+
startX = _ref2.startX,
|
|
293
|
+
startY = _ref2.startY,
|
|
294
|
+
orientation = _ref2.orientation,
|
|
295
|
+
numOfTicks = _ref2.numOfTicks,
|
|
296
|
+
i = _ref2.i;
|
|
295
297
|
var x1 = startX;
|
|
296
298
|
var y1 = startY;
|
|
297
299
|
var x2 = startX;
|
|
298
300
|
var y2 = startY;
|
|
299
301
|
var labelX = startX;
|
|
300
302
|
var labelY;
|
|
303
|
+
|
|
301
304
|
if (orientation === 'vertical') {
|
|
302
305
|
var y = height / numOfTicks * (numOfTicks - i) + startY;
|
|
303
306
|
x1 -= TICK_LENGTH_DELTA;
|
|
@@ -315,6 +318,7 @@ var positionMajorTick = function positionMajorTick(_ref2) {
|
|
|
315
318
|
labelX = x;
|
|
316
319
|
labelY = y2 + 16;
|
|
317
320
|
}
|
|
321
|
+
|
|
318
322
|
return {
|
|
319
323
|
x1: x1,
|
|
320
324
|
y1: y1,
|
|
@@ -324,39 +328,43 @@ var positionMajorTick = function positionMajorTick(_ref2) {
|
|
|
324
328
|
labelY: labelY
|
|
325
329
|
};
|
|
326
330
|
};
|
|
331
|
+
|
|
327
332
|
var MajorTicks = function MajorTicks(_ref3) {
|
|
328
333
|
var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
|
|
334
|
+
|
|
329
335
|
var width = props.width,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
336
|
+
height = props.height,
|
|
337
|
+
startX = props.startX,
|
|
338
|
+
startY = props.startY,
|
|
339
|
+
min = props.min,
|
|
340
|
+
max = props.max,
|
|
341
|
+
majorUnit = props.majorUnit,
|
|
342
|
+
orientation = props.orientation,
|
|
343
|
+
showLabels = props.showLabels,
|
|
344
|
+
usePercentageRange = props.usePercentageRange,
|
|
345
|
+
majorTickFillColor = props.majorTickFillColor,
|
|
346
|
+
majorTickStrokeColor = props.majorTickStrokeColor;
|
|
341
347
|
var range = max - min;
|
|
342
348
|
var numOfTicks = majorUnit === 'auto' || Number.isNaN(Number(majorUnit)) || majorUnit <= 0 ? DEFAULT_NUM_OF_TICKS : range / majorUnit;
|
|
343
349
|
var majorTicks = [];
|
|
350
|
+
|
|
344
351
|
for (var i = 0; i <= numOfTicks; i += 1) {
|
|
345
352
|
var _positionMajorTick = positionMajorTick({
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
353
|
+
width: width,
|
|
354
|
+
height: height,
|
|
355
|
+
startX: startX,
|
|
356
|
+
startY: startY,
|
|
357
|
+
orientation: orientation,
|
|
358
|
+
numOfTicks: numOfTicks,
|
|
359
|
+
i: i
|
|
360
|
+
}),
|
|
361
|
+
x1 = _positionMajorTick.x1,
|
|
362
|
+
y1 = _positionMajorTick.y1,
|
|
363
|
+
x2 = _positionMajorTick.x2,
|
|
364
|
+
y2 = _positionMajorTick.y2,
|
|
365
|
+
labelX = _positionMajorTick.labelX,
|
|
366
|
+
labelY = _positionMajorTick.labelY;
|
|
367
|
+
|
|
360
368
|
var label = usePercentageRange ? "".concat(parseInt((i / numOfTicks - min / range) * 100, 10), "%") : parseInt(min + range / numOfTicks * i, 10);
|
|
361
369
|
majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
|
|
362
370
|
key: i,
|
|
@@ -372,26 +380,28 @@ var MajorTicks = function MajorTicks(_ref3) {
|
|
|
372
380
|
majorTickFillColor: majorTickFillColor,
|
|
373
381
|
majorTickStrokeColor: majorTickStrokeColor
|
|
374
382
|
}));
|
|
375
|
-
}
|
|
383
|
+
} // if the gauge is not divided evenly, put the last tick at the end of the gauge
|
|
384
|
+
|
|
376
385
|
|
|
377
|
-
// if the gauge is not divided evenly, put the last tick at the end of the gauge
|
|
378
386
|
if (!Number.isInteger(numOfTicks)) {
|
|
379
387
|
var extraNumOfTicks = Math.ceil(numOfTicks);
|
|
388
|
+
|
|
380
389
|
var _positionMajorTick2 = positionMajorTick({
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
390
|
+
width: width,
|
|
391
|
+
height: height,
|
|
392
|
+
startX: startX,
|
|
393
|
+
startY: startY,
|
|
394
|
+
orientation: orientation,
|
|
395
|
+
numOfTicks: extraNumOfTicks,
|
|
396
|
+
i: extraNumOfTicks
|
|
397
|
+
}),
|
|
398
|
+
_x = _positionMajorTick2.x1,
|
|
399
|
+
_y = _positionMajorTick2.y1,
|
|
400
|
+
_x2 = _positionMajorTick2.x2,
|
|
401
|
+
_y2 = _positionMajorTick2.y2,
|
|
402
|
+
_labelX = _positionMajorTick2.labelX,
|
|
403
|
+
_labelY = _positionMajorTick2.labelY;
|
|
404
|
+
|
|
395
405
|
majorTicks.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(MajorTick, {
|
|
396
406
|
key: extraNumOfTicks,
|
|
397
407
|
id: extraNumOfTicks,
|
|
@@ -407,8 +417,10 @@ var MajorTicks = function MajorTicks(_ref3) {
|
|
|
407
417
|
majorTickStrokeColor: majorTickStrokeColor
|
|
408
418
|
}));
|
|
409
419
|
}
|
|
420
|
+
|
|
410
421
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, majorTicks);
|
|
411
422
|
};
|
|
423
|
+
|
|
412
424
|
MajorTicks.propTypes = {
|
|
413
425
|
width: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
414
426
|
height: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
@@ -435,7 +447,7 @@ MajorTicks.defaultProps = {
|
|
|
435
447
|
|
|
436
448
|
/***/ }),
|
|
437
449
|
|
|
438
|
-
/***/
|
|
450
|
+
/***/ 128:
|
|
439
451
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
440
452
|
|
|
441
453
|
"use strict";
|
|
@@ -450,7 +462,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
450
462
|
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__);
|
|
451
463
|
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
|
|
452
464
|
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_3__);
|
|
453
|
-
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
|
|
465
|
+
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(31);
|
|
454
466
|
/* harmony import */ var _splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_numberUtils__WEBPACK_IMPORTED_MODULE_4__);
|
|
455
467
|
|
|
456
468
|
|
|
@@ -481,7 +493,6 @@ var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.
|
|
|
481
493
|
})(["fill:", ";font-size:14px;font-family:Splunk Platform Sans,sans-serif;line-height:16px;text-anchor:middle;text-align:center;dominant-baseline:middle;"], function (props) {
|
|
482
494
|
return props.valueMarkerLabelFillColor;
|
|
483
495
|
});
|
|
484
|
-
|
|
485
496
|
/**
|
|
486
497
|
* calculate the path of Value Marker shape
|
|
487
498
|
* @method positionValueMarkerRect
|
|
@@ -492,13 +503,14 @@ var ValueMarkerLabel = styled_components__WEBPACK_IMPORTED_MODULE_3___default.a.
|
|
|
492
503
|
* @param {Number} input.valueMarkerRectLength
|
|
493
504
|
* @return {String} d containing a series of path commands that define the path to be
|
|
494
505
|
*/
|
|
506
|
+
|
|
495
507
|
var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
|
|
496
508
|
var x = _ref.x,
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
509
|
+
y = _ref.y,
|
|
510
|
+
orientation = _ref.orientation,
|
|
511
|
+
valueMarkerRectLength = _ref.valueMarkerRectLength,
|
|
512
|
+
_ref$alignCenter = _ref.alignCenter,
|
|
513
|
+
alignCenter = _ref$alignCenter === void 0 ? false : _ref$alignCenter;
|
|
502
514
|
var hLength = MARKER_THICKNESS;
|
|
503
515
|
var vLength = valueMarkerRectLength;
|
|
504
516
|
var markerStartX = alignCenter ? x - MARKER_THICKNESS / 2 : x - MARKER_THICKNESS;
|
|
@@ -507,6 +519,7 @@ var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
|
|
|
507
519
|
var innerVLength = MARKER_INNER_LENGTH;
|
|
508
520
|
var innerStartX = markerStartX + innerHLength;
|
|
509
521
|
var innerStartY = markerStartY + 7;
|
|
522
|
+
|
|
510
523
|
if (orientation === 'vertical') {
|
|
511
524
|
hLength = valueMarkerRectLength;
|
|
512
525
|
vLength = MARKER_THICKNESS;
|
|
@@ -517,9 +530,9 @@ var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
|
|
|
517
530
|
innerStartX = markerStartX + 7;
|
|
518
531
|
innerStartY = markerStartY + innerVLength;
|
|
519
532
|
}
|
|
533
|
+
|
|
520
534
|
return "M".concat(markerStartX, ",").concat(markerStartY, "h").concat(hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(RADIUS, "v").concat(vLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(RADIUS, "h").concat(-hLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(-RADIUS, ",").concat(-RADIUS, "v").concat(2 * RADIUS - vLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 1 ").concat(RADIUS, ",").concat(-RADIUS, "z") + "M".concat(innerStartX, ",").concat(innerStartY, "v").concat(innerVLength - RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(RADIUS, "h").concat(innerHLength - 2 * RADIUS, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(RADIUS, ",").concat(-RADIUS, "v").concat(RADIUS - innerVLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(-RADIUS, "h").concat(2 * RADIUS - innerHLength, "a").concat(RADIUS, ",").concat(RADIUS, " 0 0 0 ").concat(-RADIUS, ",").concat(RADIUS, "z");
|
|
521
535
|
};
|
|
522
|
-
|
|
523
536
|
/**
|
|
524
537
|
* calculate the position of value marker label
|
|
525
538
|
* @method positionLabel
|
|
@@ -534,20 +547,23 @@ var positionValueMarkerRect = function positionValueMarkerRect(_ref) {
|
|
|
534
547
|
* @return {Number} positions.labelX x of value marker label text
|
|
535
548
|
* @return {Number} positions.labelY y of value marker label text
|
|
536
549
|
*/
|
|
550
|
+
|
|
537
551
|
var positionLabel = function positionLabel(_ref2) {
|
|
538
552
|
var x = _ref2.x,
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
553
|
+
y = _ref2.y,
|
|
554
|
+
length = _ref2.length,
|
|
555
|
+
orientation = _ref2.orientation,
|
|
556
|
+
_ref2$alignCenter = _ref2.alignCenter,
|
|
557
|
+
alignCenter = _ref2$alignCenter === void 0 ? false : _ref2$alignCenter; // for horizontal view
|
|
558
|
+
|
|
545
559
|
var labelRectX = alignCenter ? x - MARKER_LABEL_WIDTH / 2 : x - MARKER_THICKNESS / 2 - MARKER_LABEL_WIDTH / 2;
|
|
546
560
|
var labelRectY = y + length;
|
|
561
|
+
|
|
547
562
|
if (orientation === 'vertical') {
|
|
548
563
|
labelRectX = x + length;
|
|
549
564
|
labelRectY = alignCenter ? y - MARKER_LABEL_HEIGHT / 2 : y - (MARKER_LABEL_HEIGHT - MARKER_THICKNESS) / 2;
|
|
550
565
|
}
|
|
566
|
+
|
|
551
567
|
var labelX = labelRectX + MARKER_LABEL_WIDTH / 2;
|
|
552
568
|
var labelY = labelRectY + MARKER_LABEL_HEIGHT / 2;
|
|
553
569
|
return {
|
|
@@ -557,32 +573,36 @@ var positionLabel = function positionLabel(_ref2) {
|
|
|
557
573
|
labelY: labelY
|
|
558
574
|
};
|
|
559
575
|
};
|
|
576
|
+
|
|
560
577
|
var ValueMarker = function ValueMarker(_ref3) {
|
|
561
578
|
var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, _ref3);
|
|
579
|
+
|
|
562
580
|
var x = props.x,
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
581
|
+
y = props.y,
|
|
582
|
+
length = props.length,
|
|
583
|
+
min = props.min,
|
|
584
|
+
max = props.max,
|
|
585
|
+
value = props.value,
|
|
586
|
+
orientation = props.orientation,
|
|
587
|
+
showValue = props.showValue,
|
|
588
|
+
usePercentageValue = props.usePercentageValue,
|
|
589
|
+
valueMarkerFillColor = props.valueMarkerFillColor,
|
|
590
|
+
valueMarkerLabelFillColor = props.valueMarkerLabelFillColor,
|
|
591
|
+
alignCenter = props.alignCenter;
|
|
574
592
|
var valueMarkerRectLength = length + DELTA_LENGTH;
|
|
593
|
+
|
|
575
594
|
var _positionLabel = positionLabel({
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
595
|
+
x: x,
|
|
596
|
+
y: y,
|
|
597
|
+
length: length,
|
|
598
|
+
orientation: orientation,
|
|
599
|
+
alignCenter: alignCenter
|
|
600
|
+
}),
|
|
601
|
+
labelRectX = _positionLabel.labelRectX,
|
|
602
|
+
labelRectY = _positionLabel.labelRectY,
|
|
603
|
+
labelX = _positionLabel.labelX,
|
|
604
|
+
labelY = _positionLabel.labelY;
|
|
605
|
+
|
|
586
606
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ValueMarkerRect, {
|
|
587
607
|
"data-test": "value-marker-rect",
|
|
588
608
|
d: positionValueMarkerRect({
|
|
@@ -612,6 +632,7 @@ var ValueMarker = function ValueMarker(_ref3) {
|
|
|
612
632
|
useTrendUnits: true
|
|
613
633
|
}))));
|
|
614
634
|
};
|
|
635
|
+
|
|
615
636
|
ValueMarker.propTypes = {
|
|
616
637
|
x: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
617
638
|
y: prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.number,
|
|
@@ -647,40 +668,46 @@ ValueMarker.defaultProps = {
|
|
|
647
668
|
Object.defineProperty(exports, "__esModule", {
|
|
648
669
|
value: true
|
|
649
670
|
});
|
|
671
|
+
|
|
650
672
|
var React = __webpack_require__(1);
|
|
673
|
+
|
|
651
674
|
var styled_components_1 = __webpack_require__(4);
|
|
675
|
+
|
|
652
676
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
677
|
+
|
|
653
678
|
var style_1 = __webpack_require__(14);
|
|
679
|
+
|
|
654
680
|
var colorUtils_1 = __webpack_require__(12);
|
|
681
|
+
|
|
655
682
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
656
683
|
var width = _ref.width;
|
|
657
684
|
return {
|
|
658
685
|
style: {
|
|
659
|
-
width: style_1.toPx(width)
|
|
686
|
+
width: (0, style_1.toPx)(width)
|
|
660
687
|
}
|
|
661
688
|
};
|
|
662
689
|
}).withConfig({
|
|
663
690
|
displayName: "FixedSizeContainer__Item",
|
|
664
691
|
componentId: "sc-1yhgpod-0"
|
|
665
692
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
666
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
667
|
-
});
|
|
668
|
-
|
|
693
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
694
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
695
|
+
|
|
669
696
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
670
697
|
var width = _ref2.width,
|
|
671
|
-
|
|
698
|
+
height = _ref2.height;
|
|
672
699
|
return {
|
|
673
700
|
style: Object.assign(Object.assign({}, width && {
|
|
674
|
-
width: style_1.toPx(width)
|
|
701
|
+
width: (0, style_1.toPx)(width)
|
|
675
702
|
}), height && {
|
|
676
|
-
height: style_1.toPx(height)
|
|
703
|
+
height: (0, style_1.toPx)(height)
|
|
677
704
|
})
|
|
678
705
|
};
|
|
679
706
|
}).withConfig({
|
|
680
707
|
displayName: "FixedSizeContainer__FixSizeItem",
|
|
681
708
|
componentId: "sc-1yhgpod-1"
|
|
682
709
|
})(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
|
|
683
|
-
return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
710
|
+
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
684
711
|
});
|
|
685
712
|
var ItemContent = styled_components_1.default.div.withConfig({
|
|
686
713
|
displayName: "FixedSizeContainer__ItemContent",
|
|
@@ -690,11 +717,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
690
717
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
691
718
|
componentId: "sc-1yhgpod-3"
|
|
692
719
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
720
|
+
|
|
693
721
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
694
722
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
695
723
|
var width = props.width,
|
|
696
|
-
|
|
697
|
-
|
|
724
|
+
height = props.height,
|
|
725
|
+
backgroundColor = props.backgroundColor;
|
|
726
|
+
|
|
698
727
|
if (!height) {
|
|
699
728
|
return React.createElement(Item, {
|
|
700
729
|
"data-test": "item",
|
|
@@ -702,24 +731,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
702
731
|
backgroundColor: backgroundColor
|
|
703
732
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
704
733
|
}
|
|
734
|
+
|
|
705
735
|
return React.createElement(FixSizeItem, {
|
|
706
736
|
"data-test": "fix-size-item",
|
|
707
|
-
"data-splunk-visualization-version": "
|
|
737
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
708
738
|
width: width,
|
|
709
739
|
height: height,
|
|
710
740
|
backgroundColor: backgroundColor
|
|
711
741
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
712
742
|
var newWidth = _ref3.width,
|
|
713
|
-
|
|
743
|
+
newHeight = _ref3.height;
|
|
714
744
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
715
745
|
width: newWidth,
|
|
716
746
|
height: newHeight
|
|
717
747
|
}));
|
|
718
748
|
})));
|
|
719
749
|
};
|
|
750
|
+
|
|
720
751
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
721
752
|
return FixedSizeContainer;
|
|
722
753
|
};
|
|
754
|
+
|
|
723
755
|
exports.default = withFixedSizeContainer;
|
|
724
756
|
|
|
725
757
|
/***/ }),
|
|
@@ -747,9 +779,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
747
779
|
* @param {DashboardVizType} props.Wrapper
|
|
748
780
|
* @param {DashboardVizType} props.Visualization
|
|
749
781
|
*/
|
|
782
|
+
|
|
750
783
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
751
784
|
var Wrapper = _ref.Wrapper,
|
|
752
|
-
|
|
785
|
+
Visualization = _ref.Visualization;
|
|
753
786
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
754
787
|
extendProperties.forEach(function (prop) {
|
|
755
788
|
if (Visualization[prop]) {
|
|
@@ -758,11 +791,19 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
758
791
|
}
|
|
759
792
|
});
|
|
760
793
|
};
|
|
794
|
+
|
|
761
795
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
762
796
|
|
|
763
797
|
/***/ }),
|
|
764
798
|
|
|
765
|
-
/***/
|
|
799
|
+
/***/ 16:
|
|
800
|
+
/***/ (function(module, exports) {
|
|
801
|
+
|
|
802
|
+
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
803
|
+
|
|
804
|
+
/***/ }),
|
|
805
|
+
|
|
806
|
+
/***/ 162:
|
|
766
807
|
/***/ (function(module, exports, __webpack_require__) {
|
|
767
808
|
|
|
768
809
|
"use strict";
|
|
@@ -770,29 +811,41 @@ exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
|
770
811
|
|
|
771
812
|
var __rest = this && this.__rest || function (s, e) {
|
|
772
813
|
var t = {};
|
|
814
|
+
|
|
773
815
|
for (var p in s) {
|
|
774
816
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
775
817
|
}
|
|
818
|
+
|
|
776
819
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
777
820
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
778
821
|
}
|
|
779
822
|
return t;
|
|
780
823
|
};
|
|
824
|
+
|
|
781
825
|
Object.defineProperty(exports, "__esModule", {
|
|
782
826
|
value: true
|
|
783
827
|
});
|
|
784
828
|
exports.config = exports.computeVizProps = exports.PureMarkerGauge = void 0;
|
|
829
|
+
|
|
785
830
|
var lodash_1 = __webpack_require__(3);
|
|
786
|
-
|
|
787
|
-
var
|
|
831
|
+
|
|
832
|
+
var MarkerGauge_1 = __webpack_require__(428);
|
|
833
|
+
|
|
834
|
+
var config_1 = __webpack_require__(429);
|
|
835
|
+
|
|
788
836
|
exports.config = config_1.default;
|
|
789
|
-
|
|
790
|
-
var
|
|
837
|
+
|
|
838
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
839
|
+
|
|
840
|
+
var gaugeUtils_1 = __webpack_require__(98);
|
|
841
|
+
|
|
791
842
|
exports.PureMarkerGauge = MarkerGauge_1.default;
|
|
792
843
|
var validOptions = Object.keys(config_1.default.optionsSchema);
|
|
844
|
+
|
|
793
845
|
var computeVizProps = function computeVizProps(_a) {
|
|
794
846
|
var props = __rest(_a, []);
|
|
795
|
-
|
|
847
|
+
|
|
848
|
+
var options = (0, lodash_1.chain)(props).pick(validOptions).thru(gaugeUtils_1.convertToGaugeProperties).value();
|
|
796
849
|
var defaultColors = {
|
|
797
850
|
fillColor: config_1.default.themes.defaultFillColor(props),
|
|
798
851
|
majorTickFillColor: config_1.default.themes.majorTickFillColor(props),
|
|
@@ -802,8 +855,9 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
802
855
|
};
|
|
803
856
|
return Object.assign(Object.assign({}, options), defaultColors);
|
|
804
857
|
};
|
|
858
|
+
|
|
805
859
|
exports.computeVizProps = computeVizProps;
|
|
806
|
-
var viz = withDashboardViz_1.default({
|
|
860
|
+
var viz = (0, withDashboardViz_1.default)({
|
|
807
861
|
ReactViz: MarkerGauge_1.default,
|
|
808
862
|
computeVizProps: exports.computeVizProps,
|
|
809
863
|
vizConfig: config_1.default
|
|
@@ -812,13 +866,6 @@ exports.default = viz;
|
|
|
812
866
|
|
|
813
867
|
/***/ }),
|
|
814
868
|
|
|
815
|
-
/***/ 16:
|
|
816
|
-
/***/ (function(module, exports) {
|
|
817
|
-
|
|
818
|
-
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
819
|
-
|
|
820
|
-
/***/ }),
|
|
821
|
-
|
|
822
869
|
/***/ 17:
|
|
823
870
|
/***/ (function(module, exports) {
|
|
824
871
|
|
|
@@ -854,24 +901,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
854
901
|
|
|
855
902
|
|
|
856
903
|
var _toConsumableArray = __webpack_require__(8);
|
|
904
|
+
|
|
857
905
|
var _defineProperty = __webpack_require__(7);
|
|
906
|
+
|
|
858
907
|
var __rest = this && this.__rest || function (s, e) {
|
|
859
908
|
var t = {};
|
|
909
|
+
|
|
860
910
|
for (var p in s) {
|
|
861
911
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
862
912
|
}
|
|
913
|
+
|
|
863
914
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
864
915
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
865
916
|
}
|
|
866
917
|
return t;
|
|
867
918
|
};
|
|
919
|
+
|
|
868
920
|
Object.defineProperty(exports, "__esModule", {
|
|
869
921
|
value: true
|
|
870
922
|
});
|
|
871
923
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
924
|
+
|
|
872
925
|
var lodash_1 = __webpack_require__(3);
|
|
926
|
+
|
|
873
927
|
var schemaUtils_1 = __webpack_require__(16);
|
|
928
|
+
|
|
874
929
|
var VizBehavior_1 = __webpack_require__(6);
|
|
930
|
+
|
|
875
931
|
var dynamicOptionsDSLType = {
|
|
876
932
|
type: 'string',
|
|
877
933
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -881,20 +937,22 @@ var dynamicOptionsDSLType = {
|
|
|
881
937
|
* @param optionsSchema a visualization's options schema
|
|
882
938
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
883
939
|
*/
|
|
940
|
+
|
|
884
941
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
885
942
|
var enhancedOptionsSchema = {};
|
|
886
943
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
887
944
|
var _a = optionsSchema[key],
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
945
|
+
title = _a.title,
|
|
946
|
+
description = _a.description,
|
|
947
|
+
readOnly = _a.readOnly,
|
|
948
|
+
writeOnly = _a.writeOnly,
|
|
949
|
+
examples = _a.examples,
|
|
950
|
+
defaultValue = _a.default,
|
|
951
|
+
type = _a.type,
|
|
952
|
+
properties = _a.properties,
|
|
953
|
+
patternProperties = _a.patternProperties,
|
|
954
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
955
|
+
|
|
898
956
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
899
957
|
title: title
|
|
900
958
|
}), description !== undefined && {
|
|
@@ -908,12 +966,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
908
966
|
}), defaultValue !== undefined && {
|
|
909
967
|
default: defaultValue
|
|
910
968
|
});
|
|
969
|
+
|
|
911
970
|
if (type === 'object') {
|
|
912
971
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
913
972
|
type: type
|
|
914
973
|
}), properties && {
|
|
915
974
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
916
975
|
});
|
|
976
|
+
|
|
917
977
|
if (patternProperties) {
|
|
918
978
|
var enhancedPatternProperties = {};
|
|
919
979
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -931,6 +991,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
931
991
|
});
|
|
932
992
|
return enhancedOptionsSchema;
|
|
933
993
|
}
|
|
994
|
+
|
|
934
995
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
935
996
|
/**
|
|
936
997
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -939,11 +1000,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
939
1000
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
940
1001
|
* and containing `open: false` for all editor panels in editorConfig
|
|
941
1002
|
*/
|
|
1003
|
+
|
|
942
1004
|
function enhanceConfig(vizConfig) {
|
|
943
1005
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
1006
|
+
|
|
944
1007
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
945
1008
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
946
1009
|
}
|
|
1010
|
+
|
|
947
1011
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
948
1012
|
return Object.assign(Object.assign({}, config), {
|
|
949
1013
|
open: config.open || false
|
|
@@ -951,6 +1015,7 @@ function enhanceConfig(vizConfig) {
|
|
|
951
1015
|
});
|
|
952
1016
|
return enhancedConfig;
|
|
953
1017
|
}
|
|
1018
|
+
|
|
954
1019
|
exports.enhanceConfig = enhanceConfig;
|
|
955
1020
|
/**
|
|
956
1021
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -958,6 +1023,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
958
1023
|
* @param vizConfig a Visualization Config
|
|
959
1024
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
960
1025
|
*/
|
|
1026
|
+
|
|
961
1027
|
function uncollapseEditorConfig(vizConfig) {
|
|
962
1028
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
963
1029
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -967,13 +1033,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
967
1033
|
});
|
|
968
1034
|
return editorPanelUncollapsedConfig;
|
|
969
1035
|
}
|
|
1036
|
+
|
|
970
1037
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
1038
|
+
|
|
971
1039
|
function isDynamicOption(option) {
|
|
972
1040
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
973
1041
|
}
|
|
974
|
-
|
|
975
|
-
// private helpers to improve readability of getInitialPreset
|
|
1042
|
+
|
|
1043
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
976
1044
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
1045
|
+
|
|
977
1046
|
/**
|
|
978
1047
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
979
1048
|
* 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
|
|
@@ -982,6 +1051,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
982
1051
|
*
|
|
983
1052
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
984
1053
|
*/
|
|
1054
|
+
|
|
985
1055
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
986
1056
|
var presetContextKeys = Object.keys(presetContext);
|
|
987
1057
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -991,6 +1061,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
991
1061
|
/**
|
|
992
1062
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
993
1063
|
*/
|
|
1064
|
+
|
|
1065
|
+
|
|
994
1066
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
995
1067
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
996
1068
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -1005,18 +1077,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
1005
1077
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
1006
1078
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
1007
1079
|
*/
|
|
1080
|
+
|
|
1081
|
+
|
|
1008
1082
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
1009
1083
|
return presets.find(function (preset) {
|
|
1010
|
-
var presetContext = lodash_1.get(preset, ['value', 'context'], {});
|
|
1011
|
-
var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
|
|
1084
|
+
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
1085
|
+
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
1012
1086
|
var presetContextKeys = Object.keys(presetContext);
|
|
1013
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
1014
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1087
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1015
1088
|
// if not, then the preset is invalid in config.ts
|
|
1089
|
+
|
|
1016
1090
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
1017
1091
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
1018
1092
|
});
|
|
1019
1093
|
}
|
|
1094
|
+
|
|
1020
1095
|
exports.getInitialPreset = getInitialPreset;
|
|
1021
1096
|
/**
|
|
1022
1097
|
* generates number precision values for a Select editor
|
|
@@ -1024,14 +1099,16 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
1024
1099
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
1025
1100
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
1026
1101
|
*/
|
|
1102
|
+
|
|
1027
1103
|
function generatePrecisionValues(numPrecisionValues) {
|
|
1028
|
-
return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
|
|
1104
|
+
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
1029
1105
|
return {
|
|
1030
1106
|
label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
|
|
1031
1107
|
value: i
|
|
1032
1108
|
};
|
|
1033
1109
|
});
|
|
1034
1110
|
}
|
|
1111
|
+
|
|
1035
1112
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
1036
1113
|
/**
|
|
1037
1114
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -1041,12 +1118,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
1041
1118
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
1042
1119
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
1043
1120
|
*/
|
|
1121
|
+
|
|
1044
1122
|
var insertLayout = function insertLayout(layout, index) {
|
|
1045
1123
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1046
1124
|
layoutItems[_key - 2] = arguments[_key];
|
|
1047
1125
|
}
|
|
1126
|
+
|
|
1048
1127
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
1049
1128
|
};
|
|
1129
|
+
|
|
1050
1130
|
exports.insertLayout = insertLayout;
|
|
1051
1131
|
|
|
1052
1132
|
/***/ }),
|
|
@@ -1068,28 +1148,28 @@ module.exports = require("@splunk/themes/pick");
|
|
|
1068
1148
|
/***/ 25:
|
|
1069
1149
|
/***/ (function(module, exports) {
|
|
1070
1150
|
|
|
1071
|
-
module.exports = require("@splunk/
|
|
1151
|
+
module.exports = require("@splunk/ui-utils/id");
|
|
1072
1152
|
|
|
1073
1153
|
/***/ }),
|
|
1074
1154
|
|
|
1075
1155
|
/***/ 26:
|
|
1076
1156
|
/***/ (function(module, exports) {
|
|
1077
1157
|
|
|
1078
|
-
module.exports = require("@splunk/
|
|
1158
|
+
module.exports = require("@splunk/visualization-context/TimezoneContext");
|
|
1079
1159
|
|
|
1080
1160
|
/***/ }),
|
|
1081
1161
|
|
|
1082
1162
|
/***/ 27:
|
|
1083
1163
|
/***/ (function(module, exports) {
|
|
1084
1164
|
|
|
1085
|
-
module.exports = require("@splunk/visualizations-shared/
|
|
1165
|
+
module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
1086
1166
|
|
|
1087
1167
|
/***/ }),
|
|
1088
1168
|
|
|
1089
|
-
/***/
|
|
1169
|
+
/***/ 28:
|
|
1090
1170
|
/***/ (function(module, exports) {
|
|
1091
1171
|
|
|
1092
|
-
module.exports = require("@splunk/
|
|
1172
|
+
module.exports = require("@splunk/visualizations-shared/JSONSchemaUtils");
|
|
1093
1173
|
|
|
1094
1174
|
/***/ }),
|
|
1095
1175
|
|
|
@@ -1103,11 +1183,18 @@ module.exports = require("lodash");
|
|
|
1103
1183
|
/***/ 30:
|
|
1104
1184
|
/***/ (function(module, exports) {
|
|
1105
1185
|
|
|
1106
|
-
module.exports = require("@splunk/
|
|
1186
|
+
module.exports = require("@splunk/visualization-encoding/Options");
|
|
1107
1187
|
|
|
1108
1188
|
/***/ }),
|
|
1109
1189
|
|
|
1110
1190
|
/***/ 31:
|
|
1191
|
+
/***/ (function(module, exports) {
|
|
1192
|
+
|
|
1193
|
+
module.exports = require("@splunk/visualizations-shared/numberUtils");
|
|
1194
|
+
|
|
1195
|
+
/***/ }),
|
|
1196
|
+
|
|
1197
|
+
/***/ 32:
|
|
1111
1198
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1112
1199
|
|
|
1113
1200
|
"use strict";
|
|
@@ -1117,11 +1204,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1117
1204
|
value: true
|
|
1118
1205
|
});
|
|
1119
1206
|
exports.shouldShowIconPlaceholder = void 0;
|
|
1207
|
+
|
|
1120
1208
|
var React = __webpack_require__(1);
|
|
1209
|
+
|
|
1121
1210
|
var T = __webpack_require__(0);
|
|
1211
|
+
|
|
1122
1212
|
var lodash_1 = __webpack_require__(3);
|
|
1213
|
+
|
|
1123
1214
|
var i18n_1 = __webpack_require__(2);
|
|
1215
|
+
|
|
1124
1216
|
var Message_1 = __webpack_require__(10);
|
|
1217
|
+
|
|
1125
1218
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1126
1219
|
/**
|
|
1127
1220
|
* @method shouldShowIconPlaceholder
|
|
@@ -1129,14 +1222,17 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
1129
1222
|
* @param {boolean} loading
|
|
1130
1223
|
* @returns {boolean}
|
|
1131
1224
|
*/
|
|
1225
|
+
|
|
1226
|
+
|
|
1132
1227
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
1133
1228
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1134
|
-
var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
|
|
1229
|
+
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
1135
1230
|
var noData = data === undefined;
|
|
1136
|
-
var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
|
|
1231
|
+
var fields = (0, lodash_1.get)(dataSources, 'primary.data.fields[0]', undefined);
|
|
1137
1232
|
var noFields = fields === undefined;
|
|
1138
1233
|
return loading || noData || noFields;
|
|
1139
1234
|
};
|
|
1235
|
+
|
|
1140
1236
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
1141
1237
|
var propTypes = {
|
|
1142
1238
|
icon: T.func,
|
|
@@ -1151,11 +1247,13 @@ var propTypes = {
|
|
|
1151
1247
|
* @param {IconPlaceholderProps} props
|
|
1152
1248
|
* @returns {React.ReactElement}
|
|
1153
1249
|
*/
|
|
1250
|
+
|
|
1154
1251
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
1155
1252
|
var width = props.width,
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1253
|
+
height = props.height,
|
|
1254
|
+
icon = props.icon,
|
|
1255
|
+
iconColor = props.iconColor;
|
|
1256
|
+
|
|
1159
1257
|
if (icon) {
|
|
1160
1258
|
return React.createElement(icon, {
|
|
1161
1259
|
style: {
|
|
@@ -1170,26 +1268,21 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1170
1268
|
height: '50%'
|
|
1171
1269
|
});
|
|
1172
1270
|
}
|
|
1271
|
+
|
|
1173
1272
|
return React.createElement(Message_1.default, {
|
|
1174
1273
|
width: width,
|
|
1175
1274
|
height: height,
|
|
1176
1275
|
level: "warning",
|
|
1177
|
-
message: i18n_1._('No DataSource Connected')
|
|
1276
|
+
message: (0, i18n_1._)('No DataSource Connected')
|
|
1178
1277
|
});
|
|
1179
1278
|
};
|
|
1279
|
+
|
|
1180
1280
|
IconPlaceholder.propTypes = propTypes;
|
|
1181
1281
|
IconPlaceholder.defaultProps = {
|
|
1182
1282
|
width: '100%',
|
|
1183
1283
|
height: 250
|
|
1184
1284
|
};
|
|
1185
|
-
exports.default = FixedSizeContainer_1.default(IconPlaceholder);
|
|
1186
|
-
|
|
1187
|
-
/***/ }),
|
|
1188
|
-
|
|
1189
|
-
/***/ 32:
|
|
1190
|
-
/***/ (function(module, exports) {
|
|
1191
|
-
|
|
1192
|
-
module.exports = require("@splunk/ui-utils/id");
|
|
1285
|
+
exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
1193
1286
|
|
|
1194
1287
|
/***/ }),
|
|
1195
1288
|
|
|
@@ -1200,21 +1293,27 @@ module.exports = require("@splunk/ui-utils/id");
|
|
|
1200
1293
|
|
|
1201
1294
|
|
|
1202
1295
|
var _defineProperty = __webpack_require__(7);
|
|
1296
|
+
|
|
1203
1297
|
Object.defineProperty(exports, "__esModule", {
|
|
1204
1298
|
value: true
|
|
1205
1299
|
});
|
|
1206
1300
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
1301
|
+
|
|
1207
1302
|
var T = __webpack_require__(0);
|
|
1303
|
+
|
|
1208
1304
|
var lodash_1 = __webpack_require__(3);
|
|
1209
|
-
|
|
1305
|
+
|
|
1306
|
+
var DataSource_1 = __webpack_require__(34);
|
|
1307
|
+
|
|
1210
1308
|
exports.SortParamsPropTypes = T.shape({
|
|
1211
1309
|
currentSortKey: T.string,
|
|
1212
1310
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
1213
1311
|
onSort: T.func
|
|
1214
1312
|
});
|
|
1313
|
+
|
|
1215
1314
|
var getSortingParams = function getSortingParams(_ref) {
|
|
1216
1315
|
var requestParams = _ref.requestParams,
|
|
1217
|
-
|
|
1316
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1218
1317
|
var currentSortKey;
|
|
1219
1318
|
var currentSortDir;
|
|
1220
1319
|
var nextSortDirMap = {
|
|
@@ -1223,17 +1322,20 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1223
1322
|
none: 'asc'
|
|
1224
1323
|
};
|
|
1225
1324
|
var onSort;
|
|
1325
|
+
|
|
1226
1326
|
if (typeof onRequestParamsChange === 'function') {
|
|
1227
|
-
if (requestParams && lodash_1.has(requestParams, 'sort')) {
|
|
1327
|
+
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
1228
1328
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
1229
1329
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1330
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
1331
|
+
|
|
1332
|
+
|
|
1232
1333
|
onSort = function onSort(e, _ref2) {
|
|
1233
1334
|
var sortKey = _ref2.sortKey,
|
|
1234
|
-
|
|
1335
|
+
sortDir = _ref2.sortDir;
|
|
1336
|
+
|
|
1235
1337
|
if (typeof sortKey === 'string') {
|
|
1236
|
-
var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
1338
|
+
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
1237
1339
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
1238
1340
|
offset: 0,
|
|
1239
1341
|
sort: _defineProperty({}, sortKey, nextSortDir)
|
|
@@ -1243,12 +1345,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1243
1345
|
}
|
|
1244
1346
|
};
|
|
1245
1347
|
}
|
|
1348
|
+
|
|
1246
1349
|
return {
|
|
1247
1350
|
currentSortKey: currentSortKey,
|
|
1248
1351
|
currentSortDir: currentSortDir,
|
|
1249
1352
|
onSort: onSort
|
|
1250
1353
|
};
|
|
1251
1354
|
};
|
|
1355
|
+
|
|
1252
1356
|
exports.getSortingParams = getSortingParams;
|
|
1253
1357
|
|
|
1254
1358
|
/***/ }),
|
|
@@ -1259,43 +1363,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
1259
1363
|
"use strict";
|
|
1260
1364
|
|
|
1261
1365
|
|
|
1366
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1367
|
+
value: true
|
|
1368
|
+
});
|
|
1369
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1370
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1371
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
1372
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
1373
|
+
|
|
1374
|
+
/***/ }),
|
|
1375
|
+
|
|
1376
|
+
/***/ 35:
|
|
1377
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1378
|
+
|
|
1379
|
+
"use strict";
|
|
1380
|
+
|
|
1381
|
+
|
|
1262
1382
|
Object.defineProperty(exports, "__esModule", {
|
|
1263
1383
|
value: true
|
|
1264
1384
|
});
|
|
1265
1385
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1386
|
+
|
|
1266
1387
|
var T = __webpack_require__(0);
|
|
1388
|
+
|
|
1267
1389
|
var lodash_1 = __webpack_require__(3);
|
|
1390
|
+
|
|
1268
1391
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
1269
1392
|
isPaging: T.bool,
|
|
1270
1393
|
current: T.number,
|
|
1271
1394
|
totalPages: T.number,
|
|
1272
1395
|
onChange: T.func
|
|
1273
1396
|
});
|
|
1397
|
+
|
|
1274
1398
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
1275
1399
|
var requestParams = _ref.requestParams,
|
|
1276
|
-
|
|
1277
|
-
|
|
1400
|
+
meta = _ref.meta,
|
|
1401
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1278
1402
|
var totalCount = meta && meta.totalCount || 0;
|
|
1279
1403
|
var offset = requestParams && requestParams.offset || 0;
|
|
1280
1404
|
var count = requestParams && requestParams.count;
|
|
1281
1405
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
1282
1406
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
1283
1407
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
1408
|
+
|
|
1284
1409
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
1285
1410
|
var page = _ref2.page,
|
|
1286
|
-
|
|
1287
|
-
var newParams = lodash_1.cloneDeep(requestParams);
|
|
1411
|
+
countArg = _ref2.count;
|
|
1412
|
+
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
1413
|
+
|
|
1288
1414
|
if (typeof countArg === 'number') {
|
|
1289
1415
|
newParams.count = countArg;
|
|
1290
1416
|
newParams.offset = 0;
|
|
1291
1417
|
}
|
|
1418
|
+
|
|
1292
1419
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
1420
|
+
|
|
1293
1421
|
if (typeof page === 'number' && page > 0) {
|
|
1294
1422
|
newParams.count = pageCount;
|
|
1295
1423
|
newParams.offset = (page - 1) * pageCount;
|
|
1296
1424
|
}
|
|
1425
|
+
|
|
1297
1426
|
onRequestParamsChange(newParams);
|
|
1298
1427
|
};
|
|
1428
|
+
|
|
1299
1429
|
return {
|
|
1300
1430
|
isPaging: isPaging,
|
|
1301
1431
|
current: current,
|
|
@@ -1303,11 +1433,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
1303
1433
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
1304
1434
|
};
|
|
1305
1435
|
};
|
|
1436
|
+
|
|
1306
1437
|
exports.getPaginationParams = getPaginationParams;
|
|
1307
1438
|
|
|
1308
1439
|
/***/ }),
|
|
1309
1440
|
|
|
1310
|
-
/***/
|
|
1441
|
+
/***/ 36:
|
|
1311
1442
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1312
1443
|
|
|
1313
1444
|
"use strict";
|
|
@@ -1318,6 +1449,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1318
1449
|
});
|
|
1319
1450
|
exports.VizCategory = void 0;
|
|
1320
1451
|
var VizCategory;
|
|
1452
|
+
|
|
1321
1453
|
(function (VizCategory) {
|
|
1322
1454
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1323
1455
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -1335,67 +1467,96 @@ var VizCategory;
|
|
|
1335
1467
|
|
|
1336
1468
|
/***/ }),
|
|
1337
1469
|
|
|
1338
|
-
/***/
|
|
1470
|
+
/***/ 37:
|
|
1339
1471
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1340
1472
|
|
|
1341
1473
|
"use strict";
|
|
1342
1474
|
|
|
1343
1475
|
|
|
1344
1476
|
var _slicedToArray = __webpack_require__(17);
|
|
1477
|
+
|
|
1345
1478
|
Object.defineProperty(exports, "__esModule", {
|
|
1346
1479
|
value: true
|
|
1347
1480
|
});
|
|
1481
|
+
|
|
1348
1482
|
var React = __webpack_require__(1);
|
|
1483
|
+
|
|
1349
1484
|
var lodash_1 = __webpack_require__(3);
|
|
1350
|
-
|
|
1351
|
-
var
|
|
1352
|
-
|
|
1353
|
-
var
|
|
1354
|
-
|
|
1485
|
+
|
|
1486
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1487
|
+
|
|
1488
|
+
var Options_1 = __webpack_require__(30);
|
|
1489
|
+
|
|
1490
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1491
|
+
|
|
1492
|
+
var TimezoneContext_1 = __webpack_require__(26);
|
|
1493
|
+
|
|
1494
|
+
var moment_1 = __webpack_require__(40);
|
|
1495
|
+
|
|
1355
1496
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1497
|
+
|
|
1356
1498
|
var styled_components_1 = __webpack_require__(4);
|
|
1357
|
-
|
|
1358
|
-
var
|
|
1359
|
-
|
|
1360
|
-
var
|
|
1361
|
-
|
|
1499
|
+
|
|
1500
|
+
var hocUtils_1 = __webpack_require__(27);
|
|
1501
|
+
|
|
1502
|
+
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
1503
|
+
|
|
1504
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1505
|
+
|
|
1506
|
+
var id_1 = __webpack_require__(25);
|
|
1507
|
+
|
|
1508
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1509
|
+
|
|
1362
1510
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1511
|
+
|
|
1363
1512
|
var getSorting_1 = __webpack_require__(33);
|
|
1364
|
-
|
|
1513
|
+
|
|
1514
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1515
|
+
|
|
1365
1516
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1517
|
+
|
|
1366
1518
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1519
|
+
|
|
1367
1520
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1521
|
+
|
|
1368
1522
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
1369
1523
|
/**
|
|
1370
1524
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
1371
1525
|
* @param {DashboardVizOpts} opts
|
|
1372
1526
|
* @returns {HOC}
|
|
1373
1527
|
*/
|
|
1528
|
+
|
|
1529
|
+
|
|
1374
1530
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
1375
1531
|
var ReactViz = opts.ReactViz,
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
var
|
|
1532
|
+
vizConfig = opts.vizConfig,
|
|
1533
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1534
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1535
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1536
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1537
|
+
|
|
1538
|
+
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
1539
|
+
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1540
|
+
|
|
1383
1541
|
var DashboardViz = function DashboardViz(props) {
|
|
1384
1542
|
var _a;
|
|
1543
|
+
|
|
1385
1544
|
var mode = props.mode,
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1545
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1546
|
+
dataSources = props.dataSources,
|
|
1547
|
+
options = props.options,
|
|
1548
|
+
_props$context = props.context,
|
|
1549
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1550
|
+
width = props.width,
|
|
1551
|
+
height = props.height,
|
|
1552
|
+
onComputedProps = props.onComputedProps,
|
|
1553
|
+
onEventTrigger = props.onEventTrigger,
|
|
1554
|
+
theme = props.theme,
|
|
1555
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1556
|
+
|
|
1397
1557
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
1398
|
-
|
|
1558
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1559
|
+
|
|
1399
1560
|
if (serializedTimezone) {
|
|
1400
1561
|
/*
|
|
1401
1562
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -1409,44 +1570,58 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1409
1570
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1410
1571
|
}
|
|
1411
1572
|
}
|
|
1573
|
+
|
|
1412
1574
|
var themeFunc = function themeFunc(themeVar) {
|
|
1413
1575
|
var _a, _b;
|
|
1576
|
+
|
|
1414
1577
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
1415
1578
|
};
|
|
1579
|
+
|
|
1416
1580
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1581
|
+
|
|
1582
|
+
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
1583
|
+
theme: theme
|
|
1584
|
+
}),
|
|
1585
|
+
currentThemeFamily = _ref.family,
|
|
1586
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1587
|
+
currentThemeDensity = _ref.density;
|
|
1588
|
+
|
|
1423
1589
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1590
|
+
|
|
1424
1591
|
var _React$useState = React.useState({}),
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1592
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1593
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1594
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1595
|
+
|
|
1596
|
+
|
|
1428
1597
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1598
|
+
|
|
1599
|
+
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
1600
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1601
|
+
visualizationID = _React$useState4[0];
|
|
1602
|
+
|
|
1432
1603
|
var _React$useState5 = React.useState({}),
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1604
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1605
|
+
dataSourcesInState = _React$useState6[0],
|
|
1606
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1607
|
+
|
|
1436
1608
|
var _React$useState7 = React.useState(),
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1609
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1610
|
+
dataFramesInState = _React$useState8[0],
|
|
1611
|
+
setDataFramesInState = _React$useState8[1];
|
|
1612
|
+
|
|
1613
|
+
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1614
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1615
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1616
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1617
|
+
|
|
1618
|
+
var isMounted = React.useRef(true);
|
|
1619
|
+
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
1445
1620
|
try {
|
|
1446
1621
|
if (useAsyncEvaluatedOptions) {
|
|
1447
1622
|
var optionsToEvaluate = {
|
|
1448
|
-
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
1449
|
-
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
1623
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1624
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1450
1625
|
};
|
|
1451
1626
|
var asyncDynamicOptionsEvaluatorParams = {
|
|
1452
1627
|
visualizationID: visualizationID,
|
|
@@ -1457,21 +1632,23 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1457
1632
|
};
|
|
1458
1633
|
async_dynamic_options_evaluator_1.default.evaluate(asyncDynamicOptionsEvaluatorParams).then(function (results) {
|
|
1459
1634
|
setEvaluatedOptionsAsync(results.results);
|
|
1460
|
-
}).catch(function (
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1635
|
+
}).catch(function () {
|
|
1636
|
+
if (isMounted.current) {
|
|
1637
|
+
setUseAsyncEvaluatedOptions(false);
|
|
1638
|
+
}
|
|
1464
1639
|
});
|
|
1465
1640
|
} else {
|
|
1466
1641
|
var dataFrames = dataFramesInState;
|
|
1642
|
+
|
|
1467
1643
|
if (dataSources !== dataSourcesInState) {
|
|
1468
1644
|
setDataSourcesInState(dataSources);
|
|
1469
1645
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1470
1646
|
setDataFramesInState(dataFrames);
|
|
1471
1647
|
}
|
|
1648
|
+
|
|
1472
1649
|
return Options_1.Options.evaluate({
|
|
1473
|
-
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
1474
|
-
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
1650
|
+
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1651
|
+
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
1475
1652
|
}, dataSources, themeFunc, dataFrames);
|
|
1476
1653
|
}
|
|
1477
1654
|
} catch (e) {
|
|
@@ -1479,67 +1656,76 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1479
1656
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1480
1657
|
return {};
|
|
1481
1658
|
}
|
|
1659
|
+
|
|
1482
1660
|
return {};
|
|
1483
1661
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1484
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1485
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1662
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1486
1663
|
// 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
|
|
1487
1664
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1665
|
+
|
|
1488
1666
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1489
1667
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1668
|
+
|
|
1490
1669
|
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) {
|
|
1491
1670
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1492
1671
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1493
1672
|
});
|
|
1494
|
-
}
|
|
1495
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1673
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1496
1674
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1675
|
+
|
|
1676
|
+
|
|
1497
1677
|
React.useEffect(function () {
|
|
1498
1678
|
onComputedProps(clonedEvaluatedOptions);
|
|
1499
1679
|
});
|
|
1500
1680
|
React.useEffect(function () {
|
|
1501
1681
|
return function () {
|
|
1502
1682
|
if (useAsyncEvaluatedOptions) {
|
|
1683
|
+
isMounted.current = false;
|
|
1503
1684
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1504
1685
|
}
|
|
1505
|
-
};
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
// present warning message if any required props are missing
|
|
1686
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1687
|
+
}, []); // present warning message if any required props are missing
|
|
1688
|
+
|
|
1509
1689
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptionsToUse);
|
|
1690
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1691
|
+
supports = vizConfig.supports;
|
|
1692
|
+
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1693
|
+
|
|
1513
1694
|
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
|
|
1514
1695
|
) {
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1696
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1697
|
+
"data-test": "missing-props-message",
|
|
1698
|
+
width: width,
|
|
1699
|
+
height: height,
|
|
1700
|
+
missingProps: missing,
|
|
1701
|
+
backgroundColor: bgColorFromTheme
|
|
1702
|
+
});
|
|
1703
|
+
} // events
|
|
1704
|
+
|
|
1705
|
+
|
|
1524
1706
|
var eventCallbackProps = {};
|
|
1707
|
+
|
|
1525
1708
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1526
1709
|
var supportedEvents = vizConfig.events;
|
|
1527
1710
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1528
|
-
var eventCallbackPropName = lodash_1.camelCase("on.".concat(eventName));
|
|
1529
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1530
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1711
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1712
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1531
1713
|
// then remove these lines
|
|
1714
|
+
|
|
1532
1715
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1533
1716
|
var payload = {};
|
|
1717
|
+
|
|
1534
1718
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1535
1719
|
payloadKeys.forEach(function (p) {
|
|
1536
1720
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1537
1721
|
});
|
|
1538
1722
|
}
|
|
1723
|
+
|
|
1539
1724
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1540
1725
|
if (ev && ev.payload) {
|
|
1541
1726
|
payload = ev.payload;
|
|
1542
1727
|
}
|
|
1728
|
+
|
|
1543
1729
|
return onEventTrigger({
|
|
1544
1730
|
originalEvent: ev,
|
|
1545
1731
|
payload: payload,
|
|
@@ -1547,8 +1733,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1547
1733
|
});
|
|
1548
1734
|
};
|
|
1549
1735
|
});
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1736
|
+
} // compute pure viz props which are not from options
|
|
1737
|
+
|
|
1738
|
+
|
|
1552
1739
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1553
1740
|
themeFunc: themeFunc
|
|
1554
1741
|
}));
|
|
@@ -1566,21 +1753,25 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1566
1753
|
* In future, we could automatically detect which all datasources are being used
|
|
1567
1754
|
* and bind those magically to pagination/sorting behavior.
|
|
1568
1755
|
*/
|
|
1756
|
+
|
|
1569
1757
|
var dataSourceMetadata = {};
|
|
1570
1758
|
var OptionKey = 'paginateDataSourceKey';
|
|
1571
|
-
var paginateDataSourceKey = lodash_1.has(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
var
|
|
1759
|
+
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1760
|
+
|
|
1761
|
+
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1762
|
+
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1763
|
+
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1764
|
+
|
|
1575
1765
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1576
1766
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1577
1767
|
};
|
|
1578
|
-
|
|
1768
|
+
|
|
1769
|
+
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1579
1770
|
requestParams: requestParams,
|
|
1580
1771
|
meta: meta,
|
|
1581
1772
|
onRequestParamsChange: handleRequestParamsChange
|
|
1582
1773
|
});
|
|
1583
|
-
var paginatorParams = getPagination_1.getPaginationParams({
|
|
1774
|
+
var paginatorParams = (0, getPagination_1.getPaginationParams)({
|
|
1584
1775
|
requestParams: requestParams,
|
|
1585
1776
|
meta: meta,
|
|
1586
1777
|
onRequestParamsChange: handleRequestParamsChange
|
|
@@ -1589,115 +1780,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1589
1780
|
sortParams: sortParams,
|
|
1590
1781
|
paginatorParams: paginatorParams
|
|
1591
1782
|
};
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1783
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1784
|
+
|
|
1785
|
+
|
|
1594
1786
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1595
1787
|
return null;
|
|
1596
1788
|
}
|
|
1789
|
+
|
|
1597
1790
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1598
1791
|
mode: mode,
|
|
1599
1792
|
width: width,
|
|
1600
1793
|
height: height
|
|
1601
1794
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1602
1795
|
};
|
|
1796
|
+
|
|
1603
1797
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1604
1798
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1605
1799
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1606
1800
|
theme: {}
|
|
1607
|
-
});
|
|
1608
|
-
|
|
1609
|
-
DashboardViz.config = vizConfig;
|
|
1610
|
-
|
|
1611
|
-
return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1801
|
+
}); // attach viz config
|
|
1802
|
+
|
|
1803
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1804
|
+
|
|
1805
|
+
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1612
1806
|
};
|
|
1807
|
+
|
|
1613
1808
|
exports.default = withDashboardViz;
|
|
1614
1809
|
|
|
1615
1810
|
/***/ }),
|
|
1616
1811
|
|
|
1617
|
-
/***/
|
|
1812
|
+
/***/ 38:
|
|
1618
1813
|
/***/ (function(module, exports) {
|
|
1619
1814
|
|
|
1620
1815
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1621
1816
|
|
|
1622
1817
|
/***/ }),
|
|
1623
1818
|
|
|
1624
|
-
/***/
|
|
1819
|
+
/***/ 39:
|
|
1625
1820
|
/***/ (function(module, exports) {
|
|
1626
1821
|
|
|
1627
1822
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1628
1823
|
|
|
1629
1824
|
/***/ }),
|
|
1630
1825
|
|
|
1631
|
-
/***/
|
|
1826
|
+
/***/ 4:
|
|
1632
1827
|
/***/ (function(module, exports) {
|
|
1633
1828
|
|
|
1634
|
-
module.exports = require("
|
|
1829
|
+
module.exports = require("styled-components");
|
|
1635
1830
|
|
|
1636
1831
|
/***/ }),
|
|
1637
1832
|
|
|
1638
|
-
/***/
|
|
1833
|
+
/***/ 40:
|
|
1639
1834
|
/***/ (function(module, exports) {
|
|
1640
1835
|
|
|
1641
|
-
module.exports = require("
|
|
1836
|
+
module.exports = require("@splunk/moment");
|
|
1642
1837
|
|
|
1643
1838
|
/***/ }),
|
|
1644
1839
|
|
|
1645
|
-
/***/
|
|
1840
|
+
/***/ 41:
|
|
1646
1841
|
/***/ (function(module, exports) {
|
|
1647
1842
|
|
|
1648
1843
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1649
1844
|
|
|
1650
1845
|
/***/ }),
|
|
1651
1846
|
|
|
1652
|
-
/***/
|
|
1847
|
+
/***/ 42:
|
|
1653
1848
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1654
1849
|
|
|
1655
1850
|
"use strict";
|
|
1656
1851
|
|
|
1657
1852
|
|
|
1658
1853
|
var _classCallCheck = __webpack_require__(9);
|
|
1854
|
+
|
|
1659
1855
|
Object.defineProperty(exports, "__esModule", {
|
|
1660
1856
|
value: true
|
|
1661
1857
|
});
|
|
1662
1858
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1663
1859
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1860
|
+
|
|
1664
1861
|
var T = __webpack_require__(0);
|
|
1862
|
+
|
|
1665
1863
|
var lodash_1 = __webpack_require__(3);
|
|
1666
|
-
|
|
1667
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1864
|
+
|
|
1865
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1866
|
+
|
|
1867
|
+
|
|
1668
1868
|
exports.INITIAL_WIDTH = 250;
|
|
1669
1869
|
exports.INITIAL_HEIGHT = 250;
|
|
1670
1870
|
/**
|
|
1671
1871
|
* A Splunk visualization
|
|
1672
1872
|
*/
|
|
1873
|
+
|
|
1673
1874
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1674
1875
|
_classCallCheck(this, SplunkVisualization);
|
|
1675
1876
|
};
|
|
1877
|
+
|
|
1676
1878
|
SplunkVisualization.propTypes = {
|
|
1677
1879
|
/**
|
|
1678
1880
|
* display mode
|
|
1679
1881
|
*/
|
|
1680
1882
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1883
|
+
|
|
1681
1884
|
/**
|
|
1682
1885
|
* width in pixel or string, defaults to 100%
|
|
1683
1886
|
*/
|
|
1684
1887
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1888
|
+
|
|
1685
1889
|
/**
|
|
1686
1890
|
* height in pixel or string
|
|
1687
1891
|
*/
|
|
1688
1892
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1893
|
+
|
|
1689
1894
|
/**
|
|
1690
1895
|
* visualization context used for dynamic option evaluation
|
|
1691
1896
|
*/
|
|
1692
1897
|
context: T.object,
|
|
1898
|
+
|
|
1693
1899
|
/**
|
|
1694
1900
|
* visualization formatting options
|
|
1695
1901
|
*/
|
|
1696
1902
|
options: T.object,
|
|
1903
|
+
|
|
1697
1904
|
/**
|
|
1698
1905
|
* A callback to update formatting options
|
|
1699
1906
|
*/
|
|
1700
1907
|
onOptionsChange: T.func,
|
|
1908
|
+
|
|
1701
1909
|
/**
|
|
1702
1910
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1703
1911
|
*/
|
|
@@ -1706,6 +1914,7 @@ SplunkVisualization.propTypes = {
|
|
|
1706
1914
|
* current request params
|
|
1707
1915
|
*/
|
|
1708
1916
|
requestParams: T.object,
|
|
1917
|
+
|
|
1709
1918
|
/**
|
|
1710
1919
|
* current dataset
|
|
1711
1920
|
*/
|
|
@@ -1713,6 +1922,7 @@ SplunkVisualization.propTypes = {
|
|
|
1713
1922
|
fields: T.array,
|
|
1714
1923
|
columns: T.array
|
|
1715
1924
|
}),
|
|
1925
|
+
|
|
1716
1926
|
/**
|
|
1717
1927
|
* error
|
|
1718
1928
|
*/
|
|
@@ -1720,29 +1930,35 @@ SplunkVisualization.propTypes = {
|
|
|
1720
1930
|
level: T.string,
|
|
1721
1931
|
message: T.string
|
|
1722
1932
|
}),
|
|
1933
|
+
|
|
1723
1934
|
/**
|
|
1724
1935
|
* meta data that came with the dataset
|
|
1725
1936
|
*/
|
|
1726
1937
|
meta: T.object
|
|
1727
1938
|
})),
|
|
1939
|
+
|
|
1728
1940
|
/**
|
|
1729
1941
|
* A callback to trigger event
|
|
1730
1942
|
*/
|
|
1731
1943
|
onEventTrigger: T.func,
|
|
1944
|
+
|
|
1732
1945
|
/**
|
|
1733
1946
|
* Inform viz if there are handlers listening to events
|
|
1734
1947
|
*/
|
|
1735
1948
|
hasEventHandlers: T.bool,
|
|
1949
|
+
|
|
1736
1950
|
/**
|
|
1737
1951
|
* A callback to communicate computed props to a consumer
|
|
1738
1952
|
*/
|
|
1739
1953
|
onComputedProps: T.func,
|
|
1954
|
+
|
|
1740
1955
|
/**
|
|
1741
1956
|
* A callback to obtain visualization api
|
|
1742
1957
|
*/
|
|
1743
1958
|
vizActionHandlerRef: T.func,
|
|
1744
1959
|
loading: T.bool,
|
|
1745
1960
|
theme: T.object,
|
|
1961
|
+
|
|
1746
1962
|
/**
|
|
1747
1963
|
* A callback to request new data with updated request params
|
|
1748
1964
|
*/
|
|
@@ -1751,6 +1967,7 @@ SplunkVisualization.propTypes = {
|
|
|
1751
1967
|
/**
|
|
1752
1968
|
*
|
|
1753
1969
|
*/
|
|
1970
|
+
|
|
1754
1971
|
SplunkVisualization.defaultProps = {
|
|
1755
1972
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1756
1973
|
width: '100%',
|
|
@@ -1779,40 +1996,7 @@ exports.default = SplunkVisualization;
|
|
|
1779
1996
|
|
|
1780
1997
|
/***/ }),
|
|
1781
1998
|
|
|
1782
|
-
/***/
|
|
1783
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1784
|
-
|
|
1785
|
-
"use strict";
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
var _classCallCheck = __webpack_require__(9);
|
|
1789
|
-
var _createClass = __webpack_require__(18);
|
|
1790
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1791
|
-
value: true
|
|
1792
|
-
});
|
|
1793
|
-
exports.DefaultVizActionHandler = void 0;
|
|
1794
|
-
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1795
|
-
function DefaultVizActionHandler() {
|
|
1796
|
-
_classCallCheck(this, DefaultVizActionHandler);
|
|
1797
|
-
}
|
|
1798
|
-
_createClass(DefaultVizActionHandler, [{
|
|
1799
|
-
key: "focus",
|
|
1800
|
-
value: function focus() {
|
|
1801
|
-
// noop
|
|
1802
|
-
}
|
|
1803
|
-
}, {
|
|
1804
|
-
key: "snapshot",
|
|
1805
|
-
value: function snapshot() {
|
|
1806
|
-
return null; // noop
|
|
1807
|
-
}
|
|
1808
|
-
}]);
|
|
1809
|
-
return DefaultVizActionHandler;
|
|
1810
|
-
}();
|
|
1811
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1812
|
-
|
|
1813
|
-
/***/ }),
|
|
1814
|
-
|
|
1815
|
-
/***/ 424:
|
|
1999
|
+
/***/ 427:
|
|
1816
2000
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1817
2001
|
|
|
1818
2002
|
"use strict";
|
|
@@ -1820,27 +2004,38 @@ exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
|
1820
2004
|
|
|
1821
2005
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1822
2006
|
if (k2 === undefined) k2 = k;
|
|
1823
|
-
Object.
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
2007
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2008
|
+
|
|
2009
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2010
|
+
desc = {
|
|
2011
|
+
enumerable: true,
|
|
2012
|
+
get: function get() {
|
|
2013
|
+
return m[k];
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
Object.defineProperty(o, k2, desc);
|
|
1829
2019
|
} : function (o, m, k, k2) {
|
|
1830
2020
|
if (k2 === undefined) k2 = k;
|
|
1831
2021
|
o[k2] = m[k];
|
|
1832
2022
|
});
|
|
2023
|
+
|
|
1833
2024
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1834
2025
|
for (var p in m) {
|
|
1835
2026
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1836
2027
|
}
|
|
1837
2028
|
};
|
|
2029
|
+
|
|
1838
2030
|
Object.defineProperty(exports, "__esModule", {
|
|
1839
2031
|
value: true
|
|
1840
2032
|
});
|
|
1841
2033
|
exports.default = void 0;
|
|
1842
|
-
|
|
1843
|
-
|
|
2034
|
+
|
|
2035
|
+
__exportStar(__webpack_require__(162), exports);
|
|
2036
|
+
|
|
2037
|
+
var MarkerGauge_1 = __webpack_require__(162);
|
|
2038
|
+
|
|
1844
2039
|
Object.defineProperty(exports, "default", {
|
|
1845
2040
|
enumerable: true,
|
|
1846
2041
|
get: function get() {
|
|
@@ -1850,7 +2045,7 @@ Object.defineProperty(exports, "default", {
|
|
|
1850
2045
|
|
|
1851
2046
|
/***/ }),
|
|
1852
2047
|
|
|
1853
|
-
/***/
|
|
2048
|
+
/***/ 428:
|
|
1854
2049
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1855
2050
|
|
|
1856
2051
|
"use strict";
|
|
@@ -1858,30 +2053,47 @@ Object.defineProperty(exports, "default", {
|
|
|
1858
2053
|
|
|
1859
2054
|
var __rest = this && this.__rest || function (s, e) {
|
|
1860
2055
|
var t = {};
|
|
2056
|
+
|
|
1861
2057
|
for (var p in s) {
|
|
1862
2058
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1863
2059
|
}
|
|
2060
|
+
|
|
1864
2061
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1865
2062
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1866
2063
|
}
|
|
1867
2064
|
return t;
|
|
1868
2065
|
};
|
|
2066
|
+
|
|
1869
2067
|
Object.defineProperty(exports, "__esModule", {
|
|
1870
2068
|
value: true
|
|
1871
2069
|
});
|
|
2070
|
+
|
|
1872
2071
|
var React = __webpack_require__(1);
|
|
2072
|
+
|
|
1873
2073
|
var react_1 = __webpack_require__(1);
|
|
2074
|
+
|
|
1874
2075
|
var T = __webpack_require__(0);
|
|
2076
|
+
|
|
1875
2077
|
var styled_components_1 = __webpack_require__(4);
|
|
2078
|
+
|
|
1876
2079
|
var lodash_1 = __webpack_require__(3);
|
|
2080
|
+
|
|
1877
2081
|
var i18n_1 = __webpack_require__(2);
|
|
2082
|
+
|
|
1878
2083
|
var style_1 = __webpack_require__(14);
|
|
2084
|
+
|
|
1879
2085
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
2086
|
+
|
|
1880
2087
|
var Message_1 = __webpack_require__(10);
|
|
1881
|
-
|
|
1882
|
-
var
|
|
1883
|
-
|
|
1884
|
-
var
|
|
2088
|
+
|
|
2089
|
+
var id_1 = __webpack_require__(25);
|
|
2090
|
+
|
|
2091
|
+
var gaugeUtils_1 = __webpack_require__(98);
|
|
2092
|
+
|
|
2093
|
+
var GaugeMajorTicks_1 = __webpack_require__(127);
|
|
2094
|
+
|
|
2095
|
+
var GaugeValueMarker_1 = __webpack_require__(128);
|
|
2096
|
+
|
|
1885
2097
|
var MAX_VERTICAL_CONTAINER_WIDTH = 200;
|
|
1886
2098
|
var MIN_VERTICAL_CONTAINER_HEIGHT = 200;
|
|
1887
2099
|
var MIN_HORIZONTAL_CONTAINER_WIDTH = 200;
|
|
@@ -1890,7 +2102,7 @@ var Container = styled_components_1.default.div.withConfig({
|
|
|
1890
2102
|
displayName: "MarkerGauge__Container",
|
|
1891
2103
|
componentId: "sc-10z02va-0"
|
|
1892
2104
|
})(["overflow:hidden;", ";background-color:", ";"], function (props) {
|
|
1893
|
-
return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
|
|
2105
|
+
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
1894
2106
|
}, function (props) {
|
|
1895
2107
|
return props.backgroundColor;
|
|
1896
2108
|
});
|
|
@@ -1904,13 +2116,13 @@ var MarkerGaugeContainer = styled_components_1.default.div.withConfig({
|
|
|
1904
2116
|
displayName: "MarkerGauge__MarkerGaugeContainer",
|
|
1905
2117
|
componentId: "sc-10z02va-2"
|
|
1906
2118
|
})(["overflow:hidden;position:relative;", ";"], function (props) {
|
|
1907
|
-
return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
|
|
2119
|
+
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
1908
2120
|
});
|
|
1909
2121
|
var MarkerGaugeSVG = styled_components_1.default.svg.withConfig({
|
|
1910
2122
|
displayName: "MarkerGauge__MarkerGaugeSVG",
|
|
1911
2123
|
componentId: "sc-10z02va-3"
|
|
1912
2124
|
})(["", ";"], function (props) {
|
|
1913
|
-
return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
|
|
2125
|
+
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
1914
2126
|
});
|
|
1915
2127
|
var BackgroundBar = styled_components_1.default.rect.attrs({
|
|
1916
2128
|
'data-test': 'background-bar-rect'
|
|
@@ -1926,28 +2138,31 @@ var MarkerBar = styled_components_1.default.rect.attrs({
|
|
|
1926
2138
|
displayName: "MarkerGauge__MarkerBar",
|
|
1927
2139
|
componentId: "sc-10z02va-5"
|
|
1928
2140
|
})([""]);
|
|
2141
|
+
|
|
1929
2142
|
var MarkerGauge = function MarkerGauge(_a) {
|
|
1930
2143
|
var props = __rest(_a, []);
|
|
2144
|
+
|
|
1931
2145
|
var width = props.width,
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
2146
|
+
height = props.height,
|
|
2147
|
+
value = props.value,
|
|
2148
|
+
orientation = props.orientation,
|
|
2149
|
+
majorUnit = props.majorUnit,
|
|
2150
|
+
showLabels = props.showLabels,
|
|
2151
|
+
showValue = props.showValue,
|
|
2152
|
+
usePercentageRange = props.usePercentageRange,
|
|
2153
|
+
usePercentageValue = props.usePercentageValue,
|
|
2154
|
+
backgroundColor = props.backgroundColor,
|
|
2155
|
+
fillColor = props.fillColor,
|
|
2156
|
+
ranges = props.ranges,
|
|
2157
|
+
majorTickFillColor = props.majorTickFillColor,
|
|
2158
|
+
majorTickStrokeColor = props.majorTickStrokeColor,
|
|
2159
|
+
valueMarkerFillColor = props.valueMarkerFillColor,
|
|
2160
|
+
valueMarkerLabelFillColor = props.valueMarkerLabelFillColor;
|
|
1947
2161
|
/**
|
|
1948
2162
|
* Standard error message render
|
|
1949
2163
|
*/
|
|
1950
|
-
|
|
2164
|
+
|
|
2165
|
+
var errorMessage = (0, react_1.useCallback)(function (containerWidth, containerHeight, err, errID) {
|
|
1951
2166
|
return React.createElement(Message_1.default, {
|
|
1952
2167
|
width: containerWidth,
|
|
1953
2168
|
height: containerHeight,
|
|
@@ -1956,36 +2171,41 @@ var MarkerGauge = function MarkerGauge(_a) {
|
|
|
1956
2171
|
id: errID
|
|
1957
2172
|
});
|
|
1958
2173
|
}, []);
|
|
1959
|
-
var errorId = react_1.useMemo(function () {
|
|
1960
|
-
return id_1.createDOMID();
|
|
2174
|
+
var errorId = (0, react_1.useMemo)(function () {
|
|
2175
|
+
return (0, id_1.createDOMID)();
|
|
1961
2176
|
}, []);
|
|
1962
2177
|
/**
|
|
1963
2178
|
* Pre-calculate linearGradientId, error, sortedRanges, gauge range and linear gradient
|
|
1964
2179
|
*/
|
|
1965
|
-
|
|
1966
|
-
|
|
2180
|
+
|
|
2181
|
+
var error = (0, react_1.useMemo)(function () {
|
|
2182
|
+
return (0, gaugeUtils_1.validateRanges)(ranges);
|
|
1967
2183
|
}, [ranges]);
|
|
1968
|
-
var sortedRanges = react_1.useMemo(function () {
|
|
1969
|
-
return gaugeUtils_1.getSortedRanges(ranges);
|
|
2184
|
+
var sortedRanges = (0, react_1.useMemo)(function () {
|
|
2185
|
+
return (0, gaugeUtils_1.getSortedRanges)(ranges);
|
|
1970
2186
|
}, [ranges]);
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
2187
|
+
|
|
2188
|
+
var _ref = (0, react_1.useMemo)(function () {
|
|
2189
|
+
return (0, gaugeUtils_1.getGaugeRange)(sortedRanges);
|
|
2190
|
+
}, [sortedRanges]),
|
|
2191
|
+
min = _ref.min,
|
|
2192
|
+
max = _ref.max;
|
|
2193
|
+
|
|
2194
|
+
var linearGradientId = (0, react_1.useMemo)(function () {
|
|
2195
|
+
return (0, id_1.createDOMID)('marker');
|
|
1978
2196
|
}, []);
|
|
1979
|
-
var linearGradient = react_1.useMemo(function () {
|
|
1980
|
-
var stops = gaugeUtils_1.getGradientStops({
|
|
2197
|
+
var linearGradient = (0, react_1.useMemo)(function () {
|
|
2198
|
+
var stops = (0, gaugeUtils_1.getGradientStops)({
|
|
1981
2199
|
ranges: sortedRanges,
|
|
1982
2200
|
orientation: orientation
|
|
1983
2201
|
});
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
2202
|
+
|
|
2203
|
+
var _ref2 = (0, gaugeUtils_1.getGradientDimensions)(orientation),
|
|
2204
|
+
x1 = _ref2.x1,
|
|
2205
|
+
y1 = _ref2.y1,
|
|
2206
|
+
x2 = _ref2.x2,
|
|
2207
|
+
y2 = _ref2.y2;
|
|
2208
|
+
|
|
1989
2209
|
var linearGradientStops = stops.map(function (stop) {
|
|
1990
2210
|
return React.createElement("stop", {
|
|
1991
2211
|
key: "".concat(stop.offset, "_").concat(stop.stopColor),
|
|
@@ -2004,42 +2224,46 @@ var MarkerGauge = function MarkerGauge(_a) {
|
|
|
2004
2224
|
/**
|
|
2005
2225
|
* Calculate marker gauge dimensions
|
|
2006
2226
|
*/
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2227
|
+
|
|
2228
|
+
var calculateMarkerGaugeDimensions = (0, react_1.useCallback)(function (containerWidth, containerHeight) {
|
|
2229
|
+
var _ref3 = (0, gaugeUtils_1.getGaugeDimensions)({
|
|
2230
|
+
containerWidth: containerWidth,
|
|
2231
|
+
containerHeight: containerHeight,
|
|
2232
|
+
orientation: orientation
|
|
2233
|
+
}),
|
|
2234
|
+
gaugeLength = _ref3.gaugeLength,
|
|
2235
|
+
gaugeStartX = _ref3.gaugeStartX,
|
|
2236
|
+
gaugeStartY = _ref3.gaugeStartY,
|
|
2237
|
+
gaugeWidth = _ref3.gaugeWidth,
|
|
2238
|
+
gaugeHeight = _ref3.gaugeHeight;
|
|
2239
|
+
|
|
2240
|
+
var _ref4 = (0, gaugeUtils_1.getMarkerBarDimensions)({
|
|
2241
|
+
gaugeLength: gaugeLength,
|
|
2242
|
+
gaugeStartX: gaugeStartX,
|
|
2243
|
+
gaugeStartY: gaugeStartY,
|
|
2244
|
+
gaugeWidth: gaugeWidth,
|
|
2245
|
+
gaugeHeight: gaugeHeight,
|
|
2246
|
+
orientation: orientation
|
|
2247
|
+
}),
|
|
2248
|
+
markerBarLength = _ref4.markerBarLength,
|
|
2249
|
+
markerBarX = _ref4.markerBarX,
|
|
2250
|
+
markerBarY = _ref4.markerBarY,
|
|
2251
|
+
markerBarWidth = _ref4.markerBarWidth,
|
|
2252
|
+
markerBarHeight = _ref4.markerBarHeight;
|
|
2253
|
+
|
|
2254
|
+
var _ref5 = (0, gaugeUtils_1.getMarkerGaugeValueMarkerPositions)({
|
|
2255
|
+
markerBarX: markerBarX,
|
|
2256
|
+
markerBarY: markerBarY,
|
|
2257
|
+
markerBarHeight: markerBarHeight,
|
|
2258
|
+
markerBarLength: markerBarLength,
|
|
2259
|
+
orientation: orientation,
|
|
2260
|
+
value: value,
|
|
2261
|
+
min: min,
|
|
2262
|
+
max: max
|
|
2263
|
+
}),
|
|
2264
|
+
valueMarkerX = _ref5.valueMarkerX,
|
|
2265
|
+
valueMarkerY = _ref5.valueMarkerY;
|
|
2266
|
+
|
|
2043
2267
|
return {
|
|
2044
2268
|
markerBarX: markerBarX,
|
|
2045
2269
|
markerBarY: markerBarY,
|
|
@@ -2053,28 +2277,32 @@ var MarkerGauge = function MarkerGauge(_a) {
|
|
|
2053
2277
|
gaugeHeight: gaugeHeight
|
|
2054
2278
|
};
|
|
2055
2279
|
}, [orientation, value, min, max]);
|
|
2056
|
-
var renderVisualization = react_1.useCallback(function (
|
|
2057
|
-
var containerWidth =
|
|
2058
|
-
|
|
2280
|
+
var renderVisualization = (0, react_1.useCallback)(function (_ref6) {
|
|
2281
|
+
var containerWidth = _ref6.width,
|
|
2282
|
+
containerHeight = _ref6.height;
|
|
2283
|
+
|
|
2059
2284
|
// todo: need change the size when get design for smaller space
|
|
2060
2285
|
// 58 is the title & description header height in dashboard visualization
|
|
2061
2286
|
if ((containerWidth < MAX_VERTICAL_CONTAINER_WIDTH || containerHeight + 58 < MIN_VERTICAL_CONTAINER_HEIGHT) && orientation === 'vertical' || (containerWidth < MIN_HORIZONTAL_CONTAINER_WIDTH || containerHeight < MIN_HORIZONTAL_CONTAINER_HEIGHT) && orientation === 'horizontal') {
|
|
2062
|
-
return errorMessage(containerWidth, containerHeight, i18n_1._('Too small to render content'), errorId);
|
|
2287
|
+
return errorMessage(containerWidth, containerHeight, (0, i18n_1._)('Too small to render content'), errorId);
|
|
2063
2288
|
}
|
|
2289
|
+
|
|
2064
2290
|
if (error) {
|
|
2065
2291
|
return errorMessage(containerWidth, containerHeight, error, errorId);
|
|
2066
2292
|
}
|
|
2293
|
+
|
|
2067
2294
|
var _calculateMarkerGauge = calculateMarkerGaugeDimensions(containerWidth, containerHeight),
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2295
|
+
markerBarX = _calculateMarkerGauge.markerBarX,
|
|
2296
|
+
markerBarY = _calculateMarkerGauge.markerBarY,
|
|
2297
|
+
markerBarWidth = _calculateMarkerGauge.markerBarWidth,
|
|
2298
|
+
markerBarHeight = _calculateMarkerGauge.markerBarHeight,
|
|
2299
|
+
valueMarkerX = _calculateMarkerGauge.valueMarkerX,
|
|
2300
|
+
valueMarkerY = _calculateMarkerGauge.valueMarkerY,
|
|
2301
|
+
gaugeStartX = _calculateMarkerGauge.gaugeStartX,
|
|
2302
|
+
gaugeStartY = _calculateMarkerGauge.gaugeStartY,
|
|
2303
|
+
gaugeWidth = _calculateMarkerGauge.gaugeWidth,
|
|
2304
|
+
gaugeHeight = _calculateMarkerGauge.gaugeHeight;
|
|
2305
|
+
|
|
2078
2306
|
return React.createElement(MarkerGaugeWrapper, {
|
|
2079
2307
|
backgroundColor: backgroundColor
|
|
2080
2308
|
}, React.createElement(MarkerGaugeContainer, {
|
|
@@ -2131,6 +2359,7 @@ var MarkerGauge = function MarkerGauge(_a) {
|
|
|
2131
2359
|
return renderVisualization(containerDimension);
|
|
2132
2360
|
}));
|
|
2133
2361
|
};
|
|
2362
|
+
|
|
2134
2363
|
MarkerGauge.propTypes = {
|
|
2135
2364
|
width: T.oneOfType([T.string, T.number]),
|
|
2136
2365
|
height: T.oneOfType([T.string, T.number]),
|
|
@@ -2188,7 +2417,7 @@ exports.default = MarkerGauge;
|
|
|
2188
2417
|
|
|
2189
2418
|
/***/ }),
|
|
2190
2419
|
|
|
2191
|
-
/***/
|
|
2420
|
+
/***/ 429:
|
|
2192
2421
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2193
2422
|
|
|
2194
2423
|
"use strict";
|
|
@@ -2197,17 +2426,29 @@ exports.default = MarkerGauge;
|
|
|
2197
2426
|
Object.defineProperty(exports, "__esModule", {
|
|
2198
2427
|
value: true
|
|
2199
2428
|
});
|
|
2429
|
+
|
|
2200
2430
|
var i18n_1 = __webpack_require__(2);
|
|
2201
|
-
|
|
2202
|
-
var
|
|
2431
|
+
|
|
2432
|
+
var GaugeMarker_1 = __webpack_require__(430);
|
|
2433
|
+
|
|
2434
|
+
var placeholders_1 = __webpack_require__(50);
|
|
2435
|
+
|
|
2203
2436
|
var schemaUtils_1 = __webpack_require__(16);
|
|
2437
|
+
|
|
2204
2438
|
var variables_1 = __webpack_require__(11);
|
|
2439
|
+
|
|
2205
2440
|
var pick_1 = __webpack_require__(23);
|
|
2206
|
-
|
|
2441
|
+
|
|
2442
|
+
var Gauge_1 = __webpack_require__(126);
|
|
2443
|
+
|
|
2207
2444
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2208
|
-
|
|
2445
|
+
|
|
2446
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
2447
|
+
|
|
2209
2448
|
var configUtils_1 = __webpack_require__(20);
|
|
2449
|
+
|
|
2210
2450
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
2451
|
+
|
|
2211
2452
|
var dataContract = {
|
|
2212
2453
|
requiredDataSources: [{
|
|
2213
2454
|
name: 'primary',
|
|
@@ -2274,7 +2515,7 @@ var optionsSchema = {
|
|
|
2274
2515
|
description: 'Specify whether to display the labels as numbers, percentages, or off. The label center aligns to the value.',
|
|
2275
2516
|
default: 'number',
|
|
2276
2517
|
type: 'string',
|
|
2277
|
-
pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
|
|
2518
|
+
pattern: (0, schemaUtils_1.getPattern)(['number', 'percentage', 'off'])
|
|
2278
2519
|
},
|
|
2279
2520
|
majorTickInterval: {
|
|
2280
2521
|
description: 'Specify, in pixels, the spacing between major tick marks.',
|
|
@@ -2285,7 +2526,7 @@ var optionsSchema = {
|
|
|
2285
2526
|
description: 'Specify the axis orientation of the gauge.',
|
|
2286
2527
|
default: 'vertical',
|
|
2287
2528
|
type: 'string',
|
|
2288
|
-
pattern: schemaUtils_1.getPattern(['horizontal', 'vertical'])
|
|
2529
|
+
pattern: (0, schemaUtils_1.getPattern)(['horizontal', 'vertical'])
|
|
2289
2530
|
},
|
|
2290
2531
|
value: {
|
|
2291
2532
|
description: 'Specify the dataSource applied to the value of the marker gauge.',
|
|
@@ -2296,18 +2537,18 @@ var optionsSchema = {
|
|
|
2296
2537
|
description: 'Specify whether to display the value as a number, percentage, or off.',
|
|
2297
2538
|
default: 'number',
|
|
2298
2539
|
type: 'string',
|
|
2299
|
-
pattern: schemaUtils_1.getPattern(['number', 'percentage', 'off'])
|
|
2540
|
+
pattern: (0, schemaUtils_1.getPattern)(['number', 'percentage', 'off'])
|
|
2300
2541
|
}
|
|
2301
2542
|
};
|
|
2302
2543
|
var themes = {
|
|
2303
2544
|
defaultFillColor: function defaultFillColor(props) {
|
|
2304
|
-
return pick_1.default({
|
|
2545
|
+
return (0, pick_1.default)({
|
|
2305
2546
|
enterprise: variables_1.default.backgroundColorHover(props),
|
|
2306
2547
|
prisma: variables_1.default.neutral100(props)
|
|
2307
2548
|
})(props);
|
|
2308
2549
|
},
|
|
2309
2550
|
defaultBackgroundColor: function defaultBackgroundColor(props) {
|
|
2310
|
-
return pick_1.default({
|
|
2551
|
+
return (0, pick_1.default)({
|
|
2311
2552
|
enterprise: {
|
|
2312
2553
|
dark: variables_1.default.black(props),
|
|
2313
2554
|
light: variables_1.default.backgroundColor(props)
|
|
@@ -2316,21 +2557,22 @@ var themes = {
|
|
|
2316
2557
|
})(props);
|
|
2317
2558
|
},
|
|
2318
2559
|
majorTickFillColor: function majorTickFillColor(props) {
|
|
2319
|
-
return pick_1.default({
|
|
2560
|
+
return (0, pick_1.default)({
|
|
2320
2561
|
enterprise: {
|
|
2321
2562
|
light: variables_1.default.gray30(props),
|
|
2322
2563
|
dark: variables_1.default.textGray(props) // was #D7DAE0
|
|
2323
|
-
},
|
|
2324
2564
|
|
|
2565
|
+
},
|
|
2325
2566
|
prisma: {
|
|
2326
2567
|
// TODO: missed colors :(
|
|
2327
2568
|
light: variables_1.default.neutral100(props),
|
|
2328
2569
|
dark: variables_1.default.contentColorMuted(props) // was #D7DAE0; contentColor
|
|
2570
|
+
|
|
2329
2571
|
}
|
|
2330
2572
|
})(props);
|
|
2331
2573
|
},
|
|
2332
2574
|
majorTickStrokeColor: function majorTickStrokeColor(props) {
|
|
2333
|
-
return pick_1.default({
|
|
2575
|
+
return (0, pick_1.default)({
|
|
2334
2576
|
enterprise: {
|
|
2335
2577
|
light: variables_1.default.textGray(props),
|
|
2336
2578
|
dark: variables_1.default.contentColorMuted(props)
|
|
@@ -2339,7 +2581,7 @@ var themes = {
|
|
|
2339
2581
|
})(props);
|
|
2340
2582
|
},
|
|
2341
2583
|
valueMarkerFillColor: function valueMarkerFillColor(props) {
|
|
2342
|
-
return pick_1.default({
|
|
2584
|
+
return (0, pick_1.default)({
|
|
2343
2585
|
enterprise: variables_1.default.textColor(props),
|
|
2344
2586
|
prisma: {
|
|
2345
2587
|
dark: variables_1.default.white(props),
|
|
@@ -2348,7 +2590,7 @@ var themes = {
|
|
|
2348
2590
|
})(props);
|
|
2349
2591
|
},
|
|
2350
2592
|
valueMarkerLabelFillColor: function valueMarkerLabelFillColor(props) {
|
|
2351
|
-
return pick_1.default({
|
|
2593
|
+
return (0, pick_1.default)({
|
|
2352
2594
|
enterprise: {
|
|
2353
2595
|
light: variables_1.default.gray96(props),
|
|
2354
2596
|
dark: variables_1.default.black(props)
|
|
@@ -2358,9 +2600,9 @@ var themes = {
|
|
|
2358
2600
|
}
|
|
2359
2601
|
};
|
|
2360
2602
|
var editorConfig = [{
|
|
2361
|
-
label: i18n_1._('Data configurations'),
|
|
2603
|
+
label: (0, i18n_1._)('Data configurations'),
|
|
2362
2604
|
layout: [[{
|
|
2363
|
-
label: i18n_1._('Value'),
|
|
2605
|
+
label: (0, i18n_1._)('Value'),
|
|
2364
2606
|
editor: 'editor.columnSelector',
|
|
2365
2607
|
option: 'value',
|
|
2366
2608
|
context: 'defaultContext',
|
|
@@ -2378,16 +2620,17 @@ var editorConfig = [{
|
|
|
2378
2620
|
}
|
|
2379
2621
|
}]]
|
|
2380
2622
|
}, Gauge_1.default, {
|
|
2381
|
-
label: i18n_1._('Color and style'),
|
|
2623
|
+
label: (0, i18n_1._)('Color and style'),
|
|
2382
2624
|
layout: [[{
|
|
2383
|
-
label: i18n_1._('Gauge ranges'),
|
|
2625
|
+
label: (0, i18n_1._)('Gauge ranges'),
|
|
2384
2626
|
option: 'gaugeRanges',
|
|
2385
2627
|
editor: 'editor.threshold',
|
|
2386
2628
|
editorProps: {
|
|
2387
2629
|
openRanges: false,
|
|
2388
2630
|
isTogglable: false // Can not disable thresholds
|
|
2631
|
+
|
|
2389
2632
|
}
|
|
2390
|
-
}], BackgroundColor_1.default({
|
|
2633
|
+
}], (0, BackgroundColor_1.default)({
|
|
2391
2634
|
themes: themes,
|
|
2392
2635
|
labelPosition: 'top'
|
|
2393
2636
|
})]
|
|
@@ -2395,16 +2638,19 @@ var editorConfig = [{
|
|
|
2395
2638
|
/**
|
|
2396
2639
|
* visualization configuration
|
|
2397
2640
|
*/
|
|
2641
|
+
|
|
2398
2642
|
var config = {
|
|
2399
2643
|
/**
|
|
2400
2644
|
* unique viz key
|
|
2401
2645
|
*/
|
|
2402
2646
|
key: 'splunk.markergauge',
|
|
2647
|
+
|
|
2403
2648
|
/**
|
|
2404
2649
|
* viz name
|
|
2405
2650
|
*/
|
|
2406
|
-
name: i18n_1._('Marker gauge'),
|
|
2651
|
+
name: (0, i18n_1._)('Marker gauge'),
|
|
2407
2652
|
category: VizCategory_1.VizCategory.GAUGE,
|
|
2653
|
+
|
|
2408
2654
|
/**
|
|
2409
2655
|
* viz icon
|
|
2410
2656
|
*/
|
|
@@ -2418,14 +2664,7 @@ var config = {
|
|
|
2418
2664
|
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.PLACEHOLDER],
|
|
2419
2665
|
themes: themes
|
|
2420
2666
|
};
|
|
2421
|
-
exports.default = configUtils_1.enhanceConfig(config);
|
|
2422
|
-
|
|
2423
|
-
/***/ }),
|
|
2424
|
-
|
|
2425
|
-
/***/ 427:
|
|
2426
|
-
/***/ (function(module, exports) {
|
|
2427
|
-
|
|
2428
|
-
module.exports = require("@splunk/react-icons/enterprise/GaugeMarker");
|
|
2667
|
+
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
2429
2668
|
|
|
2430
2669
|
/***/ }),
|
|
2431
2670
|
|
|
@@ -2435,11 +2674,42 @@ module.exports = require("@splunk/react-icons/enterprise/GaugeMarker");
|
|
|
2435
2674
|
"use strict";
|
|
2436
2675
|
|
|
2437
2676
|
|
|
2677
|
+
var _classCallCheck = __webpack_require__(9);
|
|
2678
|
+
|
|
2679
|
+
var _createClass = __webpack_require__(18);
|
|
2680
|
+
|
|
2438
2681
|
Object.defineProperty(exports, "__esModule", {
|
|
2439
2682
|
value: true
|
|
2440
2683
|
});
|
|
2441
|
-
exports.
|
|
2442
|
-
|
|
2684
|
+
exports.DefaultVizActionHandler = void 0;
|
|
2685
|
+
|
|
2686
|
+
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
2687
|
+
function DefaultVizActionHandler() {
|
|
2688
|
+
_classCallCheck(this, DefaultVizActionHandler);
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
_createClass(DefaultVizActionHandler, [{
|
|
2692
|
+
key: "focus",
|
|
2693
|
+
value: function focus() {// noop
|
|
2694
|
+
}
|
|
2695
|
+
}, {
|
|
2696
|
+
key: "snapshot",
|
|
2697
|
+
value: function snapshot() {
|
|
2698
|
+
return null; // noop
|
|
2699
|
+
}
|
|
2700
|
+
}]);
|
|
2701
|
+
|
|
2702
|
+
return DefaultVizActionHandler;
|
|
2703
|
+
}();
|
|
2704
|
+
|
|
2705
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
2706
|
+
|
|
2707
|
+
/***/ }),
|
|
2708
|
+
|
|
2709
|
+
/***/ 430:
|
|
2710
|
+
/***/ (function(module, exports) {
|
|
2711
|
+
|
|
2712
|
+
module.exports = require("@splunk/react-icons/enterprise/GaugeMarker");
|
|
2443
2713
|
|
|
2444
2714
|
/***/ }),
|
|
2445
2715
|
|
|
@@ -2453,7 +2723,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2453
2723
|
value: true
|
|
2454
2724
|
});
|
|
2455
2725
|
exports.useDeepMemo = void 0;
|
|
2726
|
+
|
|
2456
2727
|
var react_1 = __webpack_require__(1);
|
|
2728
|
+
|
|
2457
2729
|
var lodash_1 = __webpack_require__(3);
|
|
2458
2730
|
/**
|
|
2459
2731
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -2468,16 +2740,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
2468
2740
|
* @param fn the function to be executed and
|
|
2469
2741
|
* @param dependencies an array of dependencies
|
|
2470
2742
|
*/
|
|
2743
|
+
|
|
2744
|
+
|
|
2471
2745
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
2472
|
-
var ref = react_1.useRef();
|
|
2473
|
-
|
|
2746
|
+
var ref = (0, react_1.useRef)();
|
|
2747
|
+
|
|
2748
|
+
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
2474
2749
|
ref.current = {
|
|
2475
2750
|
dependencies: dependencies,
|
|
2476
2751
|
value: fn()
|
|
2477
2752
|
};
|
|
2478
2753
|
}
|
|
2754
|
+
|
|
2479
2755
|
return ref.current.value;
|
|
2480
2756
|
};
|
|
2757
|
+
|
|
2481
2758
|
exports.useDeepMemo = useDeepMemo;
|
|
2482
2759
|
|
|
2483
2760
|
/***/ }),
|
|
@@ -2492,19 +2769,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2492
2769
|
value: true
|
|
2493
2770
|
});
|
|
2494
2771
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2772
|
+
|
|
2495
2773
|
var React = __webpack_require__(1);
|
|
2774
|
+
|
|
2496
2775
|
var T = __webpack_require__(0);
|
|
2776
|
+
|
|
2497
2777
|
var i18n_1 = __webpack_require__(2);
|
|
2778
|
+
|
|
2498
2779
|
var Message_1 = __webpack_require__(10);
|
|
2780
|
+
|
|
2499
2781
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2500
2782
|
/**
|
|
2501
2783
|
* @method isMissing
|
|
2502
2784
|
* @param {any} v
|
|
2503
2785
|
* @returns {boolean} true if the input value === null or undefined
|
|
2504
2786
|
*/
|
|
2787
|
+
|
|
2788
|
+
|
|
2505
2789
|
var isMissing = function isMissing(v) {
|
|
2506
2790
|
return v === null || v === undefined;
|
|
2507
2791
|
};
|
|
2792
|
+
|
|
2508
2793
|
exports.isMissing = isMissing;
|
|
2509
2794
|
/**
|
|
2510
2795
|
* @method misskingKeys
|
|
@@ -2512,11 +2797,13 @@ exports.isMissing = isMissing;
|
|
|
2512
2797
|
* @param {object} target
|
|
2513
2798
|
* @returns {string[]} the keys of missing required props
|
|
2514
2799
|
*/
|
|
2800
|
+
|
|
2515
2801
|
var missingKeys = function missingKeys(keys, target) {
|
|
2516
2802
|
return keys.filter(function (k) {
|
|
2517
|
-
return exports.isMissing(target[k]);
|
|
2803
|
+
return (0, exports.isMissing)(target[k]);
|
|
2518
2804
|
});
|
|
2519
2805
|
};
|
|
2806
|
+
|
|
2520
2807
|
exports.missingKeys = missingKeys;
|
|
2521
2808
|
var propTypes = {
|
|
2522
2809
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -2530,24 +2817,26 @@ var propTypes = {
|
|
|
2530
2817
|
* @param {MissingPropsProps} props
|
|
2531
2818
|
* @returns {React.ReactElement}
|
|
2532
2819
|
*/
|
|
2820
|
+
|
|
2533
2821
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
2534
2822
|
var width = props.width,
|
|
2535
|
-
|
|
2536
|
-
|
|
2823
|
+
height = props.height,
|
|
2824
|
+
missingProps = props.missingProps;
|
|
2537
2825
|
return React.createElement(Message_1.default, {
|
|
2538
2826
|
"data-test": "message",
|
|
2539
2827
|
width: width,
|
|
2540
2828
|
height: height,
|
|
2541
|
-
message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
|
|
2829
|
+
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
2542
2830
|
});
|
|
2543
2831
|
};
|
|
2832
|
+
|
|
2544
2833
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
2545
2834
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
2546
2835
|
exports.MissingPropsMessage.defaultProps = {
|
|
2547
2836
|
width: '100%',
|
|
2548
2837
|
height: 250
|
|
2549
2838
|
};
|
|
2550
|
-
exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
2839
|
+
exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage);
|
|
2551
2840
|
|
|
2552
2841
|
/***/ }),
|
|
2553
2842
|
|
|
@@ -2560,15 +2849,19 @@ exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
|
|
|
2560
2849
|
Object.defineProperty(exports, "__esModule", {
|
|
2561
2850
|
value: true
|
|
2562
2851
|
});
|
|
2852
|
+
|
|
2563
2853
|
var React = __webpack_require__(1);
|
|
2854
|
+
|
|
2564
2855
|
var styled_components_1 = __webpack_require__(4);
|
|
2856
|
+
|
|
2565
2857
|
var hocUtils_1 = __webpack_require__(15);
|
|
2858
|
+
|
|
2566
2859
|
var Cover = styled_components_1.default.div.withConfig({
|
|
2567
2860
|
displayName: "withEditModeCover__Cover",
|
|
2568
2861
|
componentId: "sc-1gsbnxb-0"
|
|
2569
2862
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
2570
2863
|
var Blocker = styled_components_1.default.div.attrs({
|
|
2571
|
-
'data-splunk-visualization-version': "
|
|
2864
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
2572
2865
|
}).withConfig({
|
|
2573
2866
|
displayName: "withEditModeCover__Blocker",
|
|
2574
2867
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -2579,6 +2872,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
2579
2872
|
* @param {ExtendedDashViz} Visualization
|
|
2580
2873
|
* @returns {ExtendedDashViz} Wrapper
|
|
2581
2874
|
*/
|
|
2875
|
+
|
|
2582
2876
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
2583
2877
|
var Wrapper = function Wrapper(props) {
|
|
2584
2878
|
var mode = props.mode;
|
|
@@ -2587,12 +2881,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
2587
2881
|
"data-test": "edit-mode-cover"
|
|
2588
2882
|
}));
|
|
2589
2883
|
};
|
|
2590
|
-
|
|
2884
|
+
|
|
2885
|
+
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2591
2886
|
Wrapper: Wrapper,
|
|
2592
2887
|
Visualization: Visualization
|
|
2593
2888
|
});
|
|
2594
2889
|
return Wrapper;
|
|
2595
2890
|
};
|
|
2891
|
+
|
|
2596
2892
|
exports.default = withEditModeCover;
|
|
2597
2893
|
|
|
2598
2894
|
/***/ }),
|
|
@@ -2606,27 +2902,37 @@ exports.default = withEditModeCover;
|
|
|
2606
2902
|
Object.defineProperty(exports, "__esModule", {
|
|
2607
2903
|
value: true
|
|
2608
2904
|
});
|
|
2905
|
+
|
|
2609
2906
|
var React = __webpack_require__(1);
|
|
2907
|
+
|
|
2610
2908
|
var colorUtils_1 = __webpack_require__(12);
|
|
2909
|
+
|
|
2611
2910
|
var variables_1 = __webpack_require__(11);
|
|
2612
|
-
|
|
2911
|
+
|
|
2912
|
+
var IconPlaceholder_1 = __webpack_require__(32);
|
|
2913
|
+
|
|
2613
2914
|
var VizBehavior_1 = __webpack_require__(6);
|
|
2915
|
+
|
|
2614
2916
|
var hocUtils_1 = __webpack_require__(15);
|
|
2917
|
+
|
|
2615
2918
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
2616
2919
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
2617
2920
|
var config = Visualization.config;
|
|
2618
2921
|
var themes = config.themes;
|
|
2922
|
+
|
|
2619
2923
|
var Wrapper = function Wrapper(props) {
|
|
2620
2924
|
var _a, _b;
|
|
2925
|
+
|
|
2621
2926
|
var dataSources = props.dataSources,
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2927
|
+
loading = props.loading,
|
|
2928
|
+
options = props.options,
|
|
2929
|
+
height = props.height,
|
|
2930
|
+
width = props.width;
|
|
2626
2931
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
2627
|
-
var bgColorFromTheme = colorUtils_1.isColor(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
|
|
2932
|
+
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);
|
|
2628
2933
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
2629
2934
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
2935
|
+
|
|
2630
2936
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
2631
2937
|
return React.createElement(IconPlaceholder_1.default, {
|
|
2632
2938
|
"data-test": "icon-placeholder",
|
|
@@ -2637,14 +2943,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
2637
2943
|
iconColor: iconColor
|
|
2638
2944
|
});
|
|
2639
2945
|
}
|
|
2946
|
+
|
|
2640
2947
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
2641
2948
|
};
|
|
2642
|
-
|
|
2949
|
+
|
|
2950
|
+
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2643
2951
|
Wrapper: Wrapper,
|
|
2644
2952
|
Visualization: Visualization
|
|
2645
2953
|
});
|
|
2646
2954
|
return Wrapper;
|
|
2647
2955
|
};
|
|
2956
|
+
|
|
2648
2957
|
exports.default = withPlaceholder;
|
|
2649
2958
|
|
|
2650
2959
|
/***/ }),
|
|
@@ -2659,14 +2968,14 @@ module.exports = require("@babel/runtime/helpers/extends");
|
|
|
2659
2968
|
/***/ 49:
|
|
2660
2969
|
/***/ (function(module, exports) {
|
|
2661
2970
|
|
|
2662
|
-
module.exports = require("@splunk/
|
|
2971
|
+
module.exports = require("@splunk/visualizations-shared/colorConstants");
|
|
2663
2972
|
|
|
2664
2973
|
/***/ }),
|
|
2665
2974
|
|
|
2666
2975
|
/***/ 50:
|
|
2667
2976
|
/***/ (function(module, exports) {
|
|
2668
2977
|
|
|
2669
|
-
module.exports = require("@splunk/
|
|
2978
|
+
module.exports = require("@splunk/visualization-icons/placeholders");
|
|
2670
2979
|
|
|
2671
2980
|
/***/ }),
|
|
2672
2981
|
|
|
@@ -2679,13 +2988,15 @@ module.exports = require("@splunk/visualizations-shared/colorConstants");
|
|
|
2679
2988
|
Object.defineProperty(exports, "__esModule", {
|
|
2680
2989
|
value: true
|
|
2681
2990
|
});
|
|
2991
|
+
|
|
2682
2992
|
var i18n_1 = __webpack_require__(2);
|
|
2993
|
+
|
|
2683
2994
|
var background = function background(_ref) {
|
|
2684
2995
|
var label = _ref.label,
|
|
2685
|
-
|
|
2686
|
-
|
|
2996
|
+
themes = _ref.themes,
|
|
2997
|
+
labelPosition = _ref.labelPosition;
|
|
2687
2998
|
return [{
|
|
2688
|
-
label: i18n_1._(label || 'Background'),
|
|
2999
|
+
label: (0, i18n_1._)(label || 'Background'),
|
|
2689
3000
|
option: 'backgroundColor',
|
|
2690
3001
|
editor: 'editor.color',
|
|
2691
3002
|
editorProps: {
|
|
@@ -2694,6 +3005,7 @@ var background = function background(_ref) {
|
|
|
2694
3005
|
}
|
|
2695
3006
|
}];
|
|
2696
3007
|
};
|
|
3008
|
+
|
|
2697
3009
|
exports.default = background;
|
|
2698
3010
|
|
|
2699
3011
|
/***/ }),
|
|
@@ -2709,6 +3021,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2709
3021
|
});
|
|
2710
3022
|
exports.VizBehavior = void 0;
|
|
2711
3023
|
var VizBehavior;
|
|
3024
|
+
|
|
2712
3025
|
(function (VizBehavior) {
|
|
2713
3026
|
/**
|
|
2714
3027
|
* Dynamic Options Behavior.
|
|
@@ -2728,6 +3041,7 @@ var VizBehavior;
|
|
|
2728
3041
|
* missing.
|
|
2729
3042
|
* @type {string}
|
|
2730
3043
|
*/
|
|
3044
|
+
|
|
2731
3045
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
2732
3046
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
2733
3047
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -2756,20 +3070,25 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
2756
3070
|
|
|
2757
3071
|
/***/ }),
|
|
2758
3072
|
|
|
2759
|
-
/***/
|
|
3073
|
+
/***/ 98:
|
|
2760
3074
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2761
3075
|
|
|
2762
3076
|
"use strict";
|
|
2763
3077
|
|
|
2764
3078
|
|
|
2765
3079
|
var _toConsumableArray = __webpack_require__(8);
|
|
3080
|
+
|
|
2766
3081
|
Object.defineProperty(exports, "__esModule", {
|
|
2767
3082
|
value: true
|
|
2768
3083
|
});
|
|
2769
3084
|
exports.convertToGaugeProperties = exports.mapValueLabelDisplay = exports.mapToOldKey = exports.getGradientDimensions = exports.getGradientStops = exports.getGradientStopColors = exports.getGradientStopOffsets = exports.getGaugeRange = exports.validateRanges = exports.getSortedRanges = exports.getMarkerGaugeValueMarkerPositions = exports.getMarkerBarDimensions = exports.getFillerGaugeValueMarkerPositions = exports.getFillBarDimensions = exports.getGaugeBarHeight = exports.getGaugeBarWidth = exports.getGaugeBarStartPositions = exports.getGaugeBarLength = exports.assignGaugeColor = exports.getGaugeDimensions = exports.getGaugeStartPosition = exports.getGaugeLength = exports.getGaugeHeight = exports.getGaugeWidth = exports.FILL_THICKNESS = exports.GAUGE_THICKNESS = void 0;
|
|
3085
|
+
|
|
2770
3086
|
var lodash_1 = __webpack_require__(3);
|
|
2771
|
-
|
|
3087
|
+
|
|
3088
|
+
var colorConstants_1 = __webpack_require__(49);
|
|
3089
|
+
|
|
2772
3090
|
var i18n_1 = __webpack_require__(2);
|
|
3091
|
+
|
|
2773
3092
|
exports.GAUGE_THICKNESS = 50;
|
|
2774
3093
|
exports.FILL_THICKNESS = 38;
|
|
2775
3094
|
var GRADIENT_STOP_OFFSET_MIN = 0;
|
|
@@ -2782,11 +3101,13 @@ var GRADIENT_STOP_OFFSET_MAX = 100;
|
|
|
2782
3101
|
* @param {String} orientation
|
|
2783
3102
|
* @return {Number} width
|
|
2784
3103
|
*/
|
|
3104
|
+
|
|
2785
3105
|
var getGaugeWidth = function getGaugeWidth(_ref) {
|
|
2786
3106
|
var containerWidth = _ref.containerWidth,
|
|
2787
|
-
|
|
3107
|
+
orientation = _ref.orientation;
|
|
2788
3108
|
return orientation === 'vertical' ? exports.GAUGE_THICKNESS : containerWidth * 0.8;
|
|
2789
3109
|
};
|
|
3110
|
+
|
|
2790
3111
|
exports.getGaugeWidth = getGaugeWidth;
|
|
2791
3112
|
/**
|
|
2792
3113
|
* get height for the whole gauge viz for horizontal or vertical view
|
|
@@ -2796,11 +3117,13 @@ exports.getGaugeWidth = getGaugeWidth;
|
|
|
2796
3117
|
* @param {String} orientation
|
|
2797
3118
|
* @return {Number} height
|
|
2798
3119
|
*/
|
|
3120
|
+
|
|
2799
3121
|
var getGaugeHeight = function getGaugeHeight(_ref2) {
|
|
2800
3122
|
var containerHeight = _ref2.containerHeight,
|
|
2801
|
-
|
|
3123
|
+
orientation = _ref2.orientation;
|
|
2802
3124
|
return orientation === 'vertical' ? containerHeight * 0.8 : exports.GAUGE_THICKNESS;
|
|
2803
3125
|
};
|
|
3126
|
+
|
|
2804
3127
|
exports.getGaugeHeight = getGaugeHeight;
|
|
2805
3128
|
/**
|
|
2806
3129
|
* get how long the gauge shoud be.
|
|
@@ -2812,18 +3135,20 @@ exports.getGaugeHeight = getGaugeHeight;
|
|
|
2812
3135
|
* @param {String} input.orientation
|
|
2813
3136
|
* @return {Number} gaugeLength
|
|
2814
3137
|
*/
|
|
3138
|
+
|
|
2815
3139
|
var getGaugeLength = function getGaugeLength(_ref3) {
|
|
2816
3140
|
var containerWidth = _ref3.containerWidth,
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
return orientation === 'vertical' ? exports.getGaugeHeight({
|
|
3141
|
+
containerHeight = _ref3.containerHeight,
|
|
3142
|
+
orientation = _ref3.orientation;
|
|
3143
|
+
return orientation === 'vertical' ? (0, exports.getGaugeHeight)({
|
|
2820
3144
|
containerHeight: containerHeight,
|
|
2821
3145
|
orientation: orientation
|
|
2822
|
-
}) : exports.getGaugeWidth({
|
|
3146
|
+
}) : (0, exports.getGaugeWidth)({
|
|
2823
3147
|
containerWidth: containerWidth,
|
|
2824
3148
|
orientation: orientation
|
|
2825
3149
|
});
|
|
2826
3150
|
};
|
|
3151
|
+
|
|
2827
3152
|
exports.getGaugeLength = getGaugeLength;
|
|
2828
3153
|
/**
|
|
2829
3154
|
* get start x and y for rendering gauge
|
|
@@ -2837,23 +3162,27 @@ exports.getGaugeLength = getGaugeLength;
|
|
|
2837
3162
|
* @return {Number} position.gaugeStartX
|
|
2838
3163
|
* @return {Number} position.gaugeStartY
|
|
2839
3164
|
*/
|
|
3165
|
+
|
|
2840
3166
|
var getGaugeStartPosition = function getGaugeStartPosition(_ref4) {
|
|
2841
3167
|
var containerWidth = _ref4.containerWidth,
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
3168
|
+
containerHeight = _ref4.containerHeight,
|
|
3169
|
+
gaugeLength = _ref4.gaugeLength,
|
|
3170
|
+
orientation = _ref4.orientation;
|
|
2845
3171
|
// for horizontal view
|
|
2846
3172
|
var gaugeStartX = (containerWidth - gaugeLength) / 2.0;
|
|
2847
3173
|
var gaugeStartY = (containerHeight - exports.GAUGE_THICKNESS) / 2.0;
|
|
3174
|
+
|
|
2848
3175
|
if (orientation === 'vertical') {
|
|
2849
3176
|
gaugeStartX = (containerWidth - exports.GAUGE_THICKNESS) / 2.0;
|
|
2850
3177
|
gaugeStartY = (containerHeight - gaugeLength) / 2.0;
|
|
2851
3178
|
}
|
|
3179
|
+
|
|
2852
3180
|
return {
|
|
2853
3181
|
gaugeStartX: gaugeStartX,
|
|
2854
3182
|
gaugeStartY: gaugeStartY
|
|
2855
3183
|
};
|
|
2856
3184
|
};
|
|
3185
|
+
|
|
2857
3186
|
exports.getGaugeStartPosition = getGaugeStartPosition;
|
|
2858
3187
|
/**
|
|
2859
3188
|
* get dimensions for the whole gauge viz,
|
|
@@ -2870,28 +3199,31 @@ exports.getGaugeStartPosition = getGaugeStartPosition;
|
|
|
2870
3199
|
* @return {Number} gaugeDimensions.gaugeWidth natural width of gauge
|
|
2871
3200
|
* @return {Number} gaugeDimensions.gaugeHeight natural height of gauge
|
|
2872
3201
|
*/
|
|
3202
|
+
|
|
2873
3203
|
var getGaugeDimensions = function getGaugeDimensions(_ref5) {
|
|
2874
3204
|
var containerWidth = _ref5.containerWidth,
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
var gaugeLength = exports.getGaugeLength({
|
|
3205
|
+
containerHeight = _ref5.containerHeight,
|
|
3206
|
+
orientation = _ref5.orientation;
|
|
3207
|
+
var gaugeLength = (0, exports.getGaugeLength)({
|
|
2878
3208
|
containerWidth: containerWidth,
|
|
2879
3209
|
containerHeight: containerHeight,
|
|
2880
3210
|
orientation: orientation
|
|
2881
3211
|
});
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
3212
|
+
|
|
3213
|
+
var _ref6 = (0, exports.getGaugeStartPosition)({
|
|
3214
|
+
containerWidth: containerWidth,
|
|
3215
|
+
containerHeight: containerHeight,
|
|
3216
|
+
gaugeLength: gaugeLength,
|
|
3217
|
+
orientation: orientation
|
|
3218
|
+
}),
|
|
3219
|
+
gaugeStartX = _ref6.gaugeStartX,
|
|
3220
|
+
gaugeStartY = _ref6.gaugeStartY;
|
|
3221
|
+
|
|
3222
|
+
var gaugeWidth = (0, exports.getGaugeWidth)({
|
|
2891
3223
|
containerWidth: containerWidth,
|
|
2892
3224
|
orientation: orientation
|
|
2893
3225
|
});
|
|
2894
|
-
var gaugeHeight = exports.getGaugeHeight({
|
|
3226
|
+
var gaugeHeight = (0, exports.getGaugeHeight)({
|
|
2895
3227
|
containerHeight: containerHeight,
|
|
2896
3228
|
orientation: orientation
|
|
2897
3229
|
});
|
|
@@ -2903,6 +3235,7 @@ var getGaugeDimensions = function getGaugeDimensions(_ref5) {
|
|
|
2903
3235
|
gaugeHeight: gaugeHeight
|
|
2904
3236
|
};
|
|
2905
3237
|
};
|
|
3238
|
+
|
|
2906
3239
|
exports.getGaugeDimensions = getGaugeDimensions;
|
|
2907
3240
|
/**
|
|
2908
3241
|
* if gaugeColor is not specified, auto assign a gauge color to the fill bar
|
|
@@ -2910,19 +3243,24 @@ exports.getGaugeDimensions = getGaugeDimensions;
|
|
|
2910
3243
|
* @method assignGaugeColor
|
|
2911
3244
|
* @params
|
|
2912
3245
|
* */
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
3246
|
+
|
|
3247
|
+
var assignGaugeColor = function assignGaugeColor(_ref7) {
|
|
3248
|
+
var value = _ref7.value,
|
|
3249
|
+
min = _ref7.min,
|
|
3250
|
+
max = _ref7.max;
|
|
2917
3251
|
var rate = (value - min) / (max - min);
|
|
3252
|
+
|
|
2918
3253
|
if (rate <= 0.3) {
|
|
2919
3254
|
return colorConstants_1.SEMANTIC_SUCCESS;
|
|
2920
3255
|
}
|
|
3256
|
+
|
|
2921
3257
|
if (rate > 0.3 && rate <= 0.6) {
|
|
2922
3258
|
return colorConstants_1.SEMANTIC_WARNING;
|
|
2923
3259
|
}
|
|
3260
|
+
|
|
2924
3261
|
return colorConstants_1.SEMANTIC_ERROR;
|
|
2925
3262
|
};
|
|
3263
|
+
|
|
2926
3264
|
exports.assignGaugeColor = assignGaugeColor;
|
|
2927
3265
|
/**
|
|
2928
3266
|
* get inner bar length in gauge
|
|
@@ -2934,22 +3272,28 @@ exports.assignGaugeColor = assignGaugeColor;
|
|
|
2934
3272
|
* @param {Number} input.max
|
|
2935
3273
|
* @return {Number} gaugeBarLength
|
|
2936
3274
|
*/
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
3275
|
+
|
|
3276
|
+
var getGaugeBarLength = function getGaugeBarLength(_ref8) {
|
|
3277
|
+
var gaugeLength = _ref8.gaugeLength,
|
|
3278
|
+
value = _ref8.value,
|
|
3279
|
+
min = _ref8.min,
|
|
3280
|
+
max = _ref8.max;
|
|
3281
|
+
|
|
2942
3282
|
if (max < min) {
|
|
2943
3283
|
return null;
|
|
2944
3284
|
}
|
|
3285
|
+
|
|
2945
3286
|
if (value >= max) {
|
|
2946
3287
|
return gaugeLength;
|
|
2947
3288
|
}
|
|
3289
|
+
|
|
2948
3290
|
if (value < min) {
|
|
2949
3291
|
return 0;
|
|
2950
3292
|
}
|
|
3293
|
+
|
|
2951
3294
|
return gaugeLength * (value - min) / (max - min);
|
|
2952
3295
|
};
|
|
3296
|
+
|
|
2953
3297
|
exports.getGaugeBarLength = getGaugeBarLength;
|
|
2954
3298
|
/**
|
|
2955
3299
|
* get x and y position for rendering inner bar in gauge
|
|
@@ -2965,26 +3309,30 @@ exports.getGaugeBarLength = getGaugeBarLength;
|
|
|
2965
3309
|
* @return {Number} position.gaugeBarX
|
|
2966
3310
|
* @return {Number} position.gaugeBarY
|
|
2967
3311
|
*/
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
3312
|
+
|
|
3313
|
+
var getGaugeBarStartPositions = function getGaugeBarStartPositions(_ref9) {
|
|
3314
|
+
var gaugeStartX = _ref9.gaugeStartX,
|
|
3315
|
+
gaugeStartY = _ref9.gaugeStartY,
|
|
3316
|
+
gaugeWidth = _ref9.gaugeWidth,
|
|
3317
|
+
gaugeHeight = _ref9.gaugeHeight,
|
|
3318
|
+
gaugeBarLength = _ref9.gaugeBarLength,
|
|
3319
|
+
orientation = _ref9.orientation;
|
|
2975
3320
|
var gaugeBarX = gaugeStartX;
|
|
2976
3321
|
var gaugeBarY = gaugeStartY;
|
|
3322
|
+
|
|
2977
3323
|
if (orientation === 'vertical') {
|
|
2978
3324
|
gaugeBarX += (gaugeWidth - exports.FILL_THICKNESS) / 2;
|
|
2979
3325
|
gaugeBarY += gaugeHeight - gaugeBarLength;
|
|
2980
3326
|
} else {
|
|
2981
3327
|
gaugeBarY += (gaugeHeight - exports.FILL_THICKNESS) / 2;
|
|
2982
3328
|
}
|
|
3329
|
+
|
|
2983
3330
|
return {
|
|
2984
3331
|
gaugeBarX: gaugeBarX,
|
|
2985
3332
|
gaugeBarY: gaugeBarY
|
|
2986
3333
|
};
|
|
2987
3334
|
};
|
|
3335
|
+
|
|
2988
3336
|
exports.getGaugeBarStartPositions = getGaugeBarStartPositions;
|
|
2989
3337
|
/**
|
|
2990
3338
|
* get width of inner bar in gauge
|
|
@@ -2994,11 +3342,13 @@ exports.getGaugeBarStartPositions = getGaugeBarStartPositions;
|
|
|
2994
3342
|
* @param {String} orientation
|
|
2995
3343
|
* @return {Number} gaugeBarWidth
|
|
2996
3344
|
*/
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3345
|
+
|
|
3346
|
+
var getGaugeBarWidth = function getGaugeBarWidth(_ref10) {
|
|
3347
|
+
var gaugeBarLength = _ref10.gaugeBarLength,
|
|
3348
|
+
orientation = _ref10.orientation;
|
|
3000
3349
|
return orientation === 'vertical' ? exports.FILL_THICKNESS : gaugeBarLength;
|
|
3001
3350
|
};
|
|
3351
|
+
|
|
3002
3352
|
exports.getGaugeBarWidth = getGaugeBarWidth;
|
|
3003
3353
|
/**
|
|
3004
3354
|
* get height of inner bar in gauge
|
|
@@ -3008,11 +3358,13 @@ exports.getGaugeBarWidth = getGaugeBarWidth;
|
|
|
3008
3358
|
* @param {String} orientation
|
|
3009
3359
|
* @return {Number} gaugeBarHeight
|
|
3010
3360
|
*/
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3361
|
+
|
|
3362
|
+
var getGaugeBarHeight = function getGaugeBarHeight(_ref11) {
|
|
3363
|
+
var gaugeBarLength = _ref11.gaugeBarLength,
|
|
3364
|
+
orientation = _ref11.orientation;
|
|
3014
3365
|
return orientation === 'vertical' ? gaugeBarLength : exports.FILL_THICKNESS;
|
|
3015
3366
|
};
|
|
3367
|
+
|
|
3016
3368
|
exports.getGaugeBarHeight = getGaugeBarHeight;
|
|
3017
3369
|
/**
|
|
3018
3370
|
* get dimensions for the fill bar in the gauge
|
|
@@ -3034,37 +3386,40 @@ exports.getGaugeBarHeight = getGaugeBarHeight;
|
|
|
3034
3386
|
* @return {Number} fillBarDimensions.fillBarWidth
|
|
3035
3387
|
* @return {Number} fillBarDimensions.fillBarHeight
|
|
3036
3388
|
*/
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3389
|
+
|
|
3390
|
+
var getFillBarDimensions = function getFillBarDimensions(_ref12) {
|
|
3391
|
+
var gaugeLength = _ref12.gaugeLength,
|
|
3392
|
+
gaugeStartX = _ref12.gaugeStartX,
|
|
3393
|
+
gaugeStartY = _ref12.gaugeStartY,
|
|
3394
|
+
gaugeWidth = _ref12.gaugeWidth,
|
|
3395
|
+
gaugeHeight = _ref12.gaugeHeight,
|
|
3396
|
+
value = _ref12.value,
|
|
3397
|
+
min = _ref12.min,
|
|
3398
|
+
max = _ref12.max,
|
|
3399
|
+
orientation = _ref12.orientation;
|
|
3400
|
+
var gaugeBarLength = (0, exports.getGaugeBarLength)({
|
|
3048
3401
|
gaugeLength: gaugeLength,
|
|
3049
3402
|
value: value,
|
|
3050
3403
|
max: max,
|
|
3051
3404
|
min: min
|
|
3052
3405
|
});
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3406
|
+
|
|
3407
|
+
var _ref13 = (0, exports.getGaugeBarStartPositions)({
|
|
3408
|
+
gaugeStartX: gaugeStartX,
|
|
3409
|
+
gaugeStartY: gaugeStartY,
|
|
3410
|
+
gaugeWidth: gaugeWidth,
|
|
3411
|
+
gaugeHeight: gaugeHeight,
|
|
3412
|
+
gaugeBarLength: gaugeBarLength,
|
|
3413
|
+
orientation: orientation
|
|
3414
|
+
}),
|
|
3415
|
+
fillBarX = _ref13.gaugeBarX,
|
|
3416
|
+
fillBarY = _ref13.gaugeBarY;
|
|
3417
|
+
|
|
3418
|
+
var fillBarWidth = (0, exports.getGaugeBarWidth)({
|
|
3064
3419
|
gaugeBarLength: gaugeBarLength,
|
|
3065
3420
|
orientation: orientation
|
|
3066
3421
|
});
|
|
3067
|
-
var fillBarHeight = exports.getGaugeBarHeight({
|
|
3422
|
+
var fillBarHeight = (0, exports.getGaugeBarHeight)({
|
|
3068
3423
|
gaugeBarLength: gaugeBarLength,
|
|
3069
3424
|
orientation: orientation
|
|
3070
3425
|
});
|
|
@@ -3076,6 +3431,7 @@ var getFillBarDimensions = function getFillBarDimensions(_ref11) {
|
|
|
3076
3431
|
fillBarHeight: fillBarHeight
|
|
3077
3432
|
};
|
|
3078
3433
|
};
|
|
3434
|
+
|
|
3079
3435
|
exports.getFillBarDimensions = getFillBarDimensions;
|
|
3080
3436
|
/**
|
|
3081
3437
|
* get position x and y for value marker in filler gauge
|
|
@@ -3089,24 +3445,28 @@ exports.getFillBarDimensions = getFillBarDimensions;
|
|
|
3089
3445
|
* @return {Number} position.valueMarkerX
|
|
3090
3446
|
* @return {Number} position.valueMarkerY
|
|
3091
3447
|
*/
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3448
|
+
|
|
3449
|
+
var getFillerGaugeValueMarkerPositions = function getFillerGaugeValueMarkerPositions(_ref14) {
|
|
3450
|
+
var fillBarX = _ref14.fillBarX,
|
|
3451
|
+
fillBarY = _ref14.fillBarY,
|
|
3452
|
+
fillBarLength = _ref14.fillBarLength,
|
|
3453
|
+
orientation = _ref14.orientation;
|
|
3097
3454
|
var valueMarkerX = fillBarX;
|
|
3098
3455
|
var valueMarkerY = fillBarY;
|
|
3456
|
+
|
|
3099
3457
|
if (orientation === 'vertical') {
|
|
3100
3458
|
valueMarkerX -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
|
|
3101
3459
|
} else {
|
|
3102
3460
|
valueMarkerX += fillBarLength;
|
|
3103
3461
|
valueMarkerY -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
|
|
3104
3462
|
}
|
|
3463
|
+
|
|
3105
3464
|
return {
|
|
3106
3465
|
valueMarkerX: valueMarkerX,
|
|
3107
3466
|
valueMarkerY: valueMarkerY
|
|
3108
3467
|
};
|
|
3109
3468
|
};
|
|
3469
|
+
|
|
3110
3470
|
exports.getFillerGaugeValueMarkerPositions = getFillerGaugeValueMarkerPositions;
|
|
3111
3471
|
/**
|
|
3112
3472
|
* get dimensions for the marker bar in the gauge
|
|
@@ -3125,29 +3485,32 @@ exports.getFillerGaugeValueMarkerPositions = getFillerGaugeValueMarkerPositions;
|
|
|
3125
3485
|
* @return {Number} markerBarDimensions.markerBarWidth
|
|
3126
3486
|
* @return {Number} markerBarDimensions.markerBarHeight
|
|
3127
3487
|
*/
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3488
|
+
|
|
3489
|
+
var getMarkerBarDimensions = function getMarkerBarDimensions(_ref15) {
|
|
3490
|
+
var gaugeLength = _ref15.gaugeLength,
|
|
3491
|
+
gaugeStartX = _ref15.gaugeStartX,
|
|
3492
|
+
gaugeStartY = _ref15.gaugeStartY,
|
|
3493
|
+
gaugeWidth = _ref15.gaugeWidth,
|
|
3494
|
+
gaugeHeight = _ref15.gaugeHeight,
|
|
3495
|
+
orientation = _ref15.orientation;
|
|
3135
3496
|
var gaugeBarLength = gaugeLength; // For marker gauge, inner marker bar spans the entire gauge
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3497
|
+
|
|
3498
|
+
var _ref16 = (0, exports.getGaugeBarStartPositions)({
|
|
3499
|
+
gaugeStartX: gaugeStartX,
|
|
3500
|
+
gaugeStartY: gaugeStartY,
|
|
3501
|
+
gaugeWidth: gaugeWidth,
|
|
3502
|
+
gaugeHeight: gaugeHeight,
|
|
3503
|
+
gaugeBarLength: gaugeBarLength,
|
|
3504
|
+
orientation: orientation
|
|
3505
|
+
}),
|
|
3506
|
+
markerBarX = _ref16.gaugeBarX,
|
|
3507
|
+
markerBarY = _ref16.gaugeBarY;
|
|
3508
|
+
|
|
3509
|
+
var markerBarWidth = (0, exports.getGaugeBarWidth)({
|
|
3147
3510
|
gaugeBarLength: gaugeBarLength,
|
|
3148
3511
|
orientation: orientation
|
|
3149
3512
|
});
|
|
3150
|
-
var markerBarHeight = exports.getGaugeBarHeight({
|
|
3513
|
+
var markerBarHeight = (0, exports.getGaugeBarHeight)({
|
|
3151
3514
|
gaugeBarLength: gaugeBarLength,
|
|
3152
3515
|
orientation: orientation
|
|
3153
3516
|
});
|
|
@@ -3159,6 +3522,7 @@ var getMarkerBarDimensions = function getMarkerBarDimensions(_ref13) {
|
|
|
3159
3522
|
markerBarHeight: markerBarHeight
|
|
3160
3523
|
};
|
|
3161
3524
|
};
|
|
3525
|
+
|
|
3162
3526
|
exports.getMarkerBarDimensions = getMarkerBarDimensions;
|
|
3163
3527
|
/**
|
|
3164
3528
|
* get position x and y for value marker in marker gauge
|
|
@@ -3176,19 +3540,21 @@ exports.getMarkerBarDimensions = getMarkerBarDimensions;
|
|
|
3176
3540
|
* @return {Number} position.valueMarkerX
|
|
3177
3541
|
* @return {Number} position.valueMarkerY
|
|
3178
3542
|
*/
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3543
|
+
|
|
3544
|
+
var getMarkerGaugeValueMarkerPositions = function getMarkerGaugeValueMarkerPositions(_ref17) {
|
|
3545
|
+
var markerBarX = _ref17.markerBarX,
|
|
3546
|
+
markerBarY = _ref17.markerBarY,
|
|
3547
|
+
markerBarHeight = _ref17.markerBarHeight,
|
|
3548
|
+
gaugeLength = _ref17.markerBarLength,
|
|
3549
|
+
orientation = _ref17.orientation,
|
|
3550
|
+
value = _ref17.value,
|
|
3551
|
+
min = _ref17.min,
|
|
3552
|
+
max = _ref17.max;
|
|
3188
3553
|
var valueMarkerX = markerBarX;
|
|
3189
3554
|
var valueMarkerY = markerBarY;
|
|
3555
|
+
|
|
3190
3556
|
if (orientation === 'vertical') {
|
|
3191
|
-
valueMarkerY += markerBarHeight - exports.getGaugeBarLength({
|
|
3557
|
+
valueMarkerY += markerBarHeight - (0, exports.getGaugeBarLength)({
|
|
3192
3558
|
gaugeLength: gaugeLength,
|
|
3193
3559
|
value: value,
|
|
3194
3560
|
max: max,
|
|
@@ -3196,7 +3562,7 @@ var getMarkerGaugeValueMarkerPositions = function getMarkerGaugeValueMarkerPosit
|
|
|
3196
3562
|
});
|
|
3197
3563
|
valueMarkerX -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
|
|
3198
3564
|
} else {
|
|
3199
|
-
valueMarkerX += exports.getGaugeBarLength({
|
|
3565
|
+
valueMarkerX += (0, exports.getGaugeBarLength)({
|
|
3200
3566
|
gaugeLength: gaugeLength,
|
|
3201
3567
|
value: value,
|
|
3202
3568
|
max: max,
|
|
@@ -3204,11 +3570,13 @@ var getMarkerGaugeValueMarkerPositions = function getMarkerGaugeValueMarkerPosit
|
|
|
3204
3570
|
});
|
|
3205
3571
|
valueMarkerY -= (exports.GAUGE_THICKNESS - exports.FILL_THICKNESS) / 4;
|
|
3206
3572
|
}
|
|
3573
|
+
|
|
3207
3574
|
return {
|
|
3208
3575
|
valueMarkerX: valueMarkerX,
|
|
3209
3576
|
valueMarkerY: valueMarkerY
|
|
3210
3577
|
};
|
|
3211
3578
|
};
|
|
3579
|
+
|
|
3212
3580
|
exports.getMarkerGaugeValueMarkerPositions = getMarkerGaugeValueMarkerPositions;
|
|
3213
3581
|
/**
|
|
3214
3582
|
* sort the ranges in ascending order
|
|
@@ -3216,11 +3584,13 @@ exports.getMarkerGaugeValueMarkerPositions = getMarkerGaugeValueMarkerPositions;
|
|
|
3216
3584
|
* @param {Array} ranges
|
|
3217
3585
|
* @return {Array} sortedRanges
|
|
3218
3586
|
*/
|
|
3587
|
+
|
|
3219
3588
|
var getSortedRanges = function getSortedRanges(ranges) {
|
|
3220
3589
|
return ranges.sort(function (a, b) {
|
|
3221
3590
|
return a.from - b.from;
|
|
3222
3591
|
});
|
|
3223
3592
|
};
|
|
3593
|
+
|
|
3224
3594
|
exports.getSortedRanges = getSortedRanges;
|
|
3225
3595
|
/**
|
|
3226
3596
|
* validate whether ranges prop is valid - continuous ranges, range.to < range.from, range.from != range.to
|
|
@@ -3228,29 +3598,35 @@ exports.getSortedRanges = getSortedRanges;
|
|
|
3228
3598
|
* @param {Array} ranges
|
|
3229
3599
|
* @return {String} error
|
|
3230
3600
|
*/
|
|
3601
|
+
|
|
3231
3602
|
var validateRanges = function validateRanges(ranges) {
|
|
3232
3603
|
if (!ranges.length) {
|
|
3233
|
-
return i18n_1._('Prop "ranges" is missing entries');
|
|
3234
|
-
}
|
|
3235
|
-
|
|
3604
|
+
return (0, i18n_1._)('Prop "ranges" is missing entries');
|
|
3605
|
+
} // check whether a range has "from" >= "to" eg: 10 - 10, 100 - 10, -20 - -10 are invalid
|
|
3606
|
+
|
|
3607
|
+
|
|
3236
3608
|
if (ranges.some(function (range) {
|
|
3237
3609
|
return range.from >= range.to;
|
|
3238
3610
|
})) {
|
|
3239
|
-
return i18n_1._('Prop "ranges" has invalid entries: invalid range');
|
|
3240
|
-
}
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3611
|
+
return (0, i18n_1._)('Prop "ranges" has invalid entries: invalid range');
|
|
3612
|
+
} // check whether ranges have duplicate "from/to" eg: 0 - 50, 25 - 50
|
|
3613
|
+
|
|
3614
|
+
|
|
3615
|
+
if (ranges.length !== (0, lodash_1.uniqBy)(ranges, 'to').length || ranges.length !== (0, lodash_1.uniqBy)(ranges, 'from').length) {
|
|
3616
|
+
return (0, i18n_1._)('Prop "ranges" has invalid entries: duplicate values');
|
|
3244
3617
|
}
|
|
3245
|
-
|
|
3246
|
-
// check whether ranges are continuous eg: 0 - 10, 10 - 20, 20 - 30
|
|
3618
|
+
|
|
3619
|
+
var sortedRanges = (0, exports.getSortedRanges)(ranges); // check whether ranges are continuous eg: 0 - 10, 10 - 20, 20 - 30
|
|
3620
|
+
|
|
3247
3621
|
for (var i = 1; i < sortedRanges.length; i += 1) {
|
|
3248
3622
|
if (sortedRanges[i].from !== sortedRanges[i - 1].to) {
|
|
3249
|
-
return i18n_1._('Prop "ranges" has invalid entries: discontinuous ranges');
|
|
3623
|
+
return (0, i18n_1._)('Prop "ranges" has invalid entries: discontinuous ranges');
|
|
3250
3624
|
}
|
|
3251
3625
|
}
|
|
3626
|
+
|
|
3252
3627
|
return null;
|
|
3253
3628
|
};
|
|
3629
|
+
|
|
3254
3630
|
exports.validateRanges = validateRanges;
|
|
3255
3631
|
/**
|
|
3256
3632
|
* calculate min and max value of gauge
|
|
@@ -3260,6 +3636,7 @@ exports.validateRanges = validateRanges;
|
|
|
3260
3636
|
* @return {Number} gaugeRange.min
|
|
3261
3637
|
* @return {Number} gaugeRange.max
|
|
3262
3638
|
*/
|
|
3639
|
+
|
|
3263
3640
|
var getGaugeRange = function getGaugeRange(ranges) {
|
|
3264
3641
|
var min = Math.min.apply(Math, _toConsumableArray(ranges.map(function (range) {
|
|
3265
3642
|
return range.from;
|
|
@@ -3272,6 +3649,7 @@ var getGaugeRange = function getGaugeRange(ranges) {
|
|
|
3272
3649
|
max: max
|
|
3273
3650
|
};
|
|
3274
3651
|
};
|
|
3652
|
+
|
|
3275
3653
|
exports.getGaugeRange = getGaugeRange;
|
|
3276
3654
|
/**
|
|
3277
3655
|
* calculate stop offsets for linear gradient
|
|
@@ -3280,17 +3658,20 @@ exports.getGaugeRange = getGaugeRange;
|
|
|
3280
3658
|
* @param {String} orientation
|
|
3281
3659
|
* @return {Array} cumulativeOffsets
|
|
3282
3660
|
*/
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3661
|
+
|
|
3662
|
+
var getGradientStopOffsets = function getGradientStopOffsets(_ref18) {
|
|
3663
|
+
var ranges = _ref18.ranges,
|
|
3664
|
+
orientation = _ref18.orientation;
|
|
3665
|
+
|
|
3666
|
+
var _ref19 = (0, exports.getGaugeRange)(ranges),
|
|
3667
|
+
min = _ref19.min,
|
|
3668
|
+
max = _ref19.max;
|
|
3669
|
+
|
|
3289
3670
|
var offsetScale = (GRADIENT_STOP_OFFSET_MAX - GRADIENT_STOP_OFFSET_MIN) / (max - min);
|
|
3290
3671
|
var offsets = ranges.map(function (range) {
|
|
3291
3672
|
return Math.abs(range.from - range.to) * offsetScale;
|
|
3292
|
-
});
|
|
3293
|
-
|
|
3673
|
+
}); // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
|
|
3674
|
+
|
|
3294
3675
|
offsets = orientation === 'vertical' ? offsets.reverse() : offsets;
|
|
3295
3676
|
var cumulativeOffsets = [];
|
|
3296
3677
|
offsets.reduce(function (accumulator, currentValue, idx) {
|
|
@@ -3299,6 +3680,7 @@ var getGradientStopOffsets = function getGradientStopOffsets(_ref15) {
|
|
|
3299
3680
|
}, 0);
|
|
3300
3681
|
return cumulativeOffsets;
|
|
3301
3682
|
};
|
|
3683
|
+
|
|
3302
3684
|
exports.getGradientStopOffsets = getGradientStopOffsets;
|
|
3303
3685
|
/**
|
|
3304
3686
|
* calculate stop colors for linear gradient
|
|
@@ -3307,15 +3689,17 @@ exports.getGradientStopOffsets = getGradientStopOffsets;
|
|
|
3307
3689
|
* @param {String} orientation
|
|
3308
3690
|
* @return {Array} stopColors
|
|
3309
3691
|
*/
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3692
|
+
|
|
3693
|
+
var getGradientStopColors = function getGradientStopColors(_ref20) {
|
|
3694
|
+
var ranges = _ref20.ranges,
|
|
3695
|
+
orientation = _ref20.orientation;
|
|
3313
3696
|
var stopColors = ranges.map(function (range) {
|
|
3314
3697
|
return range.value;
|
|
3315
|
-
});
|
|
3316
|
-
|
|
3698
|
+
}); // When orientation is vertical, since the gauge starts from bottom to top, linear gradient should be reversed
|
|
3699
|
+
|
|
3317
3700
|
return orientation === 'vertical' ? stopColors.reverse() : stopColors;
|
|
3318
3701
|
};
|
|
3702
|
+
|
|
3319
3703
|
exports.getGradientStopColors = getGradientStopColors;
|
|
3320
3704
|
/**
|
|
3321
3705
|
* calculate linear gradient stops from ranges
|
|
@@ -3325,24 +3709,25 @@ exports.getGradientStopColors = getGradientStopColors;
|
|
|
3325
3709
|
* @param {String} orientation
|
|
3326
3710
|
* @return {Array} stops
|
|
3327
3711
|
*/
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3712
|
+
|
|
3713
|
+
var getGradientStops = function getGradientStops(_ref21) {
|
|
3714
|
+
var ranges = _ref21.ranges,
|
|
3715
|
+
orientation = _ref21.orientation;
|
|
3331
3716
|
var stops = [];
|
|
3332
|
-
var offsets = exports.getGradientStopOffsets({
|
|
3717
|
+
var offsets = (0, exports.getGradientStopOffsets)({
|
|
3333
3718
|
ranges: ranges,
|
|
3334
3719
|
orientation: orientation
|
|
3335
3720
|
});
|
|
3336
|
-
var stopColors = exports.getGradientStopColors({
|
|
3721
|
+
var stopColors = (0, exports.getGradientStopColors)({
|
|
3337
3722
|
ranges: ranges,
|
|
3338
3723
|
orientation: orientation
|
|
3339
|
-
});
|
|
3340
|
-
|
|
3724
|
+
}); // Initialize stops with the first color stop
|
|
3725
|
+
|
|
3341
3726
|
stops.push({
|
|
3342
3727
|
offset: "".concat(offsets[0], "%"),
|
|
3343
3728
|
stopColor: stopColors[0]
|
|
3344
|
-
});
|
|
3345
|
-
|
|
3729
|
+
}); // Add the remaining color stops with gradient change at each stop
|
|
3730
|
+
|
|
3346
3731
|
for (var i = 1; i < ranges.length; i += 1) {
|
|
3347
3732
|
stops.push({
|
|
3348
3733
|
offset: "".concat(offsets[i - 1], "%"),
|
|
@@ -3353,8 +3738,10 @@ var getGradientStops = function getGradientStops(_ref17) {
|
|
|
3353
3738
|
stopColor: stopColors[i]
|
|
3354
3739
|
});
|
|
3355
3740
|
}
|
|
3741
|
+
|
|
3356
3742
|
return stops;
|
|
3357
3743
|
};
|
|
3744
|
+
|
|
3358
3745
|
exports.getGradientStops = getGradientStops;
|
|
3359
3746
|
/**
|
|
3360
3747
|
* calculate linear gradient dimensions
|
|
@@ -3366,6 +3753,7 @@ exports.getGradientStops = getGradientStops;
|
|
|
3366
3753
|
* @return {String} dimensions.x2
|
|
3367
3754
|
* @return {String} dimensions.y2
|
|
3368
3755
|
*/
|
|
3756
|
+
|
|
3369
3757
|
var getGradientDimensions = function getGradientDimensions(orientation) {
|
|
3370
3758
|
var x1 = '0%';
|
|
3371
3759
|
var y1 = '0%';
|
|
@@ -3378,8 +3766,9 @@ var getGradientDimensions = function getGradientDimensions(orientation) {
|
|
|
3378
3766
|
y2: y2
|
|
3379
3767
|
};
|
|
3380
3768
|
};
|
|
3381
|
-
|
|
3382
|
-
// map for new options names to old option names
|
|
3769
|
+
|
|
3770
|
+
exports.getGradientDimensions = getGradientDimensions; // map for new options names to old option names
|
|
3771
|
+
|
|
3383
3772
|
var gaugeOptionsMapping = {
|
|
3384
3773
|
majorTickInterval: 'majorUnit',
|
|
3385
3774
|
gaugeRanges: 'ranges'
|
|
@@ -3390,11 +3779,13 @@ var gaugeOptionsMapping = {
|
|
|
3390
3779
|
* @param {Object} options
|
|
3391
3780
|
* @returns {Object}
|
|
3392
3781
|
*/
|
|
3782
|
+
|
|
3393
3783
|
var mapToOldKey = function mapToOldKey(options) {
|
|
3394
|
-
return lodash_1.mapKeys(options, function (val, key) {
|
|
3784
|
+
return (0, lodash_1.mapKeys)(options, function (val, key) {
|
|
3395
3785
|
return gaugeOptionsMapping[key] ? gaugeOptionsMapping[key] : key;
|
|
3396
3786
|
});
|
|
3397
3787
|
};
|
|
3788
|
+
|
|
3398
3789
|
exports.mapToOldKey = mapToOldKey;
|
|
3399
3790
|
/**
|
|
3400
3791
|
* Helper method to map labelDisplay and valueDisplay options to pure component option names
|
|
@@ -3403,12 +3794,14 @@ exports.mapToOldKey = mapToOldKey;
|
|
|
3403
3794
|
* @param {Object} options
|
|
3404
3795
|
* @returns {Object}
|
|
3405
3796
|
*/
|
|
3797
|
+
|
|
3406
3798
|
var mapValueLabelDisplay = function mapValueLabelDisplay(labelOrValue, options) {
|
|
3407
3799
|
var rangeOrValue = labelOrValue === 'value' ? 'Value' : 'Range';
|
|
3408
3800
|
var showKey = labelOrValue === 'value' ? 'showValue' : 'showLabels';
|
|
3409
3801
|
var percentKey = "usePercentage".concat(rangeOrValue);
|
|
3410
3802
|
var optionString = "".concat(labelOrValue, "Display");
|
|
3411
3803
|
var newOptions = Object.assign({}, options);
|
|
3804
|
+
|
|
3412
3805
|
if (newOptions[optionString]) {
|
|
3413
3806
|
if (newOptions[optionString] === 'number') {
|
|
3414
3807
|
newOptions[showKey] = true;
|
|
@@ -3421,8 +3814,10 @@ var mapValueLabelDisplay = function mapValueLabelDisplay(labelOrValue, options)
|
|
|
3421
3814
|
newOptions[percentKey] = false;
|
|
3422
3815
|
}
|
|
3423
3816
|
}
|
|
3424
|
-
|
|
3817
|
+
|
|
3818
|
+
return (0, lodash_1.omit)(newOptions, [optionString]);
|
|
3425
3819
|
};
|
|
3820
|
+
|
|
3426
3821
|
exports.mapValueLabelDisplay = mapValueLabelDisplay;
|
|
3427
3822
|
/**
|
|
3428
3823
|
* Chained helper for mapping the option properties (and values) we expose in config.ts into property values that pure component accepts
|
|
@@ -3431,13 +3826,15 @@ exports.mapValueLabelDisplay = mapValueLabelDisplay;
|
|
|
3431
3826
|
* @param {Object} originalOptions
|
|
3432
3827
|
* @returns {Object}
|
|
3433
3828
|
*/
|
|
3829
|
+
|
|
3434
3830
|
var convertToGaugeProperties = function convertToGaugeProperties(originalOptions) {
|
|
3435
|
-
return lodash_1.chain(exports.mapToOldKey(originalOptions)).thru(function (options) {
|
|
3436
|
-
return exports.mapValueLabelDisplay('label', options);
|
|
3831
|
+
return (0, lodash_1.chain)((0, exports.mapToOldKey)(originalOptions)).thru(function (options) {
|
|
3832
|
+
return (0, exports.mapValueLabelDisplay)('label', options);
|
|
3437
3833
|
}).thru(function (options) {
|
|
3438
|
-
return exports.mapValueLabelDisplay('value', options);
|
|
3834
|
+
return (0, exports.mapValueLabelDisplay)('value', options);
|
|
3439
3835
|
}).value();
|
|
3440
3836
|
};
|
|
3837
|
+
|
|
3441
3838
|
exports.convertToGaugeProperties = convertToGaugeProperties;
|
|
3442
3839
|
|
|
3443
3840
|
/***/ })
|