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