@splunk/visualizations 26.0.0 → 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 +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
|
@@ -187,48 +187,61 @@ module.exports = require("@splunk/visualizations-shared/style");
|
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
var _classCallCheck = __webpack_require__(4);
|
|
190
|
+
|
|
190
191
|
Object.defineProperty(exports, "__esModule", {
|
|
191
192
|
value: true
|
|
192
193
|
});
|
|
193
194
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
194
195
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
196
|
+
|
|
195
197
|
var T = __webpack_require__(1);
|
|
198
|
+
|
|
196
199
|
var lodash_1 = __webpack_require__(3);
|
|
197
|
-
|
|
198
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
200
|
+
|
|
201
|
+
var VizActionHandler_1 = __webpack_require__(25); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
202
|
+
|
|
203
|
+
|
|
199
204
|
exports.INITIAL_WIDTH = 250;
|
|
200
205
|
exports.INITIAL_HEIGHT = 250;
|
|
201
206
|
/**
|
|
202
207
|
* A Splunk visualization
|
|
203
208
|
*/
|
|
209
|
+
|
|
204
210
|
var SplunkVisualization = function SplunkVisualization() {
|
|
205
211
|
_classCallCheck(this, SplunkVisualization);
|
|
206
212
|
};
|
|
213
|
+
|
|
207
214
|
SplunkVisualization.propTypes = {
|
|
208
215
|
/**
|
|
209
216
|
* display mode
|
|
210
217
|
*/
|
|
211
218
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
219
|
+
|
|
212
220
|
/**
|
|
213
221
|
* width in pixel or string, defaults to 100%
|
|
214
222
|
*/
|
|
215
223
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
224
|
+
|
|
216
225
|
/**
|
|
217
226
|
* height in pixel or string
|
|
218
227
|
*/
|
|
219
228
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
229
|
+
|
|
220
230
|
/**
|
|
221
231
|
* visualization context used for dynamic option evaluation
|
|
222
232
|
*/
|
|
223
233
|
context: T.object,
|
|
234
|
+
|
|
224
235
|
/**
|
|
225
236
|
* visualization formatting options
|
|
226
237
|
*/
|
|
227
238
|
options: T.object,
|
|
239
|
+
|
|
228
240
|
/**
|
|
229
241
|
* A callback to update formatting options
|
|
230
242
|
*/
|
|
231
243
|
onOptionsChange: T.func,
|
|
244
|
+
|
|
232
245
|
/**
|
|
233
246
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
234
247
|
*/
|
|
@@ -237,6 +250,7 @@ SplunkVisualization.propTypes = {
|
|
|
237
250
|
* current request params
|
|
238
251
|
*/
|
|
239
252
|
requestParams: T.object,
|
|
253
|
+
|
|
240
254
|
/**
|
|
241
255
|
* current dataset
|
|
242
256
|
*/
|
|
@@ -244,6 +258,7 @@ SplunkVisualization.propTypes = {
|
|
|
244
258
|
fields: T.array,
|
|
245
259
|
columns: T.array
|
|
246
260
|
}),
|
|
261
|
+
|
|
247
262
|
/**
|
|
248
263
|
* error
|
|
249
264
|
*/
|
|
@@ -251,29 +266,35 @@ SplunkVisualization.propTypes = {
|
|
|
251
266
|
level: T.string,
|
|
252
267
|
message: T.string
|
|
253
268
|
}),
|
|
269
|
+
|
|
254
270
|
/**
|
|
255
271
|
* meta data that came with the dataset
|
|
256
272
|
*/
|
|
257
273
|
meta: T.object
|
|
258
274
|
})),
|
|
275
|
+
|
|
259
276
|
/**
|
|
260
277
|
* A callback to trigger event
|
|
261
278
|
*/
|
|
262
279
|
onEventTrigger: T.func,
|
|
280
|
+
|
|
263
281
|
/**
|
|
264
282
|
* Inform viz if there are handlers listening to events
|
|
265
283
|
*/
|
|
266
284
|
hasEventHandlers: T.bool,
|
|
285
|
+
|
|
267
286
|
/**
|
|
268
287
|
* A callback to communicate computed props to a consumer
|
|
269
288
|
*/
|
|
270
289
|
onComputedProps: T.func,
|
|
290
|
+
|
|
271
291
|
/**
|
|
272
292
|
* A callback to obtain visualization api
|
|
273
293
|
*/
|
|
274
294
|
vizActionHandlerRef: T.func,
|
|
275
295
|
loading: T.bool,
|
|
276
296
|
theme: T.object,
|
|
297
|
+
|
|
277
298
|
/**
|
|
278
299
|
* A callback to request new data with updated request params
|
|
279
300
|
*/
|
|
@@ -282,6 +303,7 @@ SplunkVisualization.propTypes = {
|
|
|
282
303
|
/**
|
|
283
304
|
*
|
|
284
305
|
*/
|
|
306
|
+
|
|
285
307
|
SplunkVisualization.defaultProps = {
|
|
286
308
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
287
309
|
width: '100%',
|
|
@@ -316,19 +338,22 @@ exports.default = SplunkVisualization;
|
|
|
316
338
|
|
|
317
339
|
|
|
318
340
|
var _classCallCheck = __webpack_require__(4);
|
|
341
|
+
|
|
319
342
|
var _createClass = __webpack_require__(6);
|
|
343
|
+
|
|
320
344
|
Object.defineProperty(exports, "__esModule", {
|
|
321
345
|
value: true
|
|
322
346
|
});
|
|
323
347
|
exports.DefaultVizActionHandler = void 0;
|
|
348
|
+
|
|
324
349
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
325
350
|
function DefaultVizActionHandler() {
|
|
326
351
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
327
352
|
}
|
|
353
|
+
|
|
328
354
|
_createClass(DefaultVizActionHandler, [{
|
|
329
355
|
key: "focus",
|
|
330
|
-
value: function focus() {
|
|
331
|
-
// noop
|
|
356
|
+
value: function focus() {// noop
|
|
332
357
|
}
|
|
333
358
|
}, {
|
|
334
359
|
key: "snapshot",
|
|
@@ -336,8 +361,10 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
336
361
|
return null; // noop
|
|
337
362
|
}
|
|
338
363
|
}]);
|
|
364
|
+
|
|
339
365
|
return DefaultVizActionHandler;
|
|
340
366
|
}();
|
|
367
|
+
|
|
341
368
|
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
342
369
|
|
|
343
370
|
/***/ }),
|
|
@@ -362,6 +389,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
362
389
|
});
|
|
363
390
|
exports.VizBehavior = void 0;
|
|
364
391
|
var VizBehavior;
|
|
392
|
+
|
|
365
393
|
(function (VizBehavior) {
|
|
366
394
|
/**
|
|
367
395
|
* Dynamic Options Behavior.
|
|
@@ -381,6 +409,7 @@ var VizBehavior;
|
|
|
381
409
|
* missing.
|
|
382
410
|
* @type {string}
|
|
383
411
|
*/
|
|
412
|
+
|
|
384
413
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
385
414
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
386
415
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -396,11 +425,17 @@ var VizBehavior;
|
|
|
396
425
|
Object.defineProperty(exports, "__esModule", {
|
|
397
426
|
value: true
|
|
398
427
|
});
|
|
428
|
+
|
|
399
429
|
var React = __webpack_require__(0);
|
|
430
|
+
|
|
400
431
|
var styled_components_1 = __webpack_require__(2);
|
|
432
|
+
|
|
401
433
|
var SizeAwareWrapper_1 = __webpack_require__(90);
|
|
434
|
+
|
|
402
435
|
var style_1 = __webpack_require__(21);
|
|
436
|
+
|
|
403
437
|
var colorUtils_1 = __webpack_require__(14);
|
|
438
|
+
|
|
404
439
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
405
440
|
var width = _ref.width;
|
|
406
441
|
return {
|
|
@@ -413,11 +448,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
413
448
|
componentId: "sc-1yhgpod-0"
|
|
414
449
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
415
450
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
416
|
-
});
|
|
417
|
-
|
|
451
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
452
|
+
|
|
418
453
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
419
454
|
var width = _ref2.width,
|
|
420
|
-
|
|
455
|
+
height = _ref2.height;
|
|
421
456
|
return {
|
|
422
457
|
style: Object.assign(Object.assign({}, width && {
|
|
423
458
|
width: (0, style_1.toPx)(width)
|
|
@@ -439,11 +474,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
439
474
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
440
475
|
componentId: "sc-1yhgpod-3"
|
|
441
476
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
477
|
+
|
|
442
478
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
443
479
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
444
480
|
var width = props.width,
|
|
445
|
-
|
|
446
|
-
|
|
481
|
+
height = props.height,
|
|
482
|
+
backgroundColor = props.backgroundColor;
|
|
483
|
+
|
|
447
484
|
if (!height) {
|
|
448
485
|
return React.createElement(Item, {
|
|
449
486
|
"data-test": "item",
|
|
@@ -451,24 +488,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
451
488
|
backgroundColor: backgroundColor
|
|
452
489
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
453
490
|
}
|
|
491
|
+
|
|
454
492
|
return React.createElement(FixSizeItem, {
|
|
455
493
|
"data-test": "fix-size-item",
|
|
456
|
-
"data-splunk-visualization-version": "26.
|
|
494
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
457
495
|
width: width,
|
|
458
496
|
height: height,
|
|
459
497
|
backgroundColor: backgroundColor
|
|
460
498
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
461
499
|
var newWidth = _ref3.width,
|
|
462
|
-
|
|
500
|
+
newHeight = _ref3.height;
|
|
463
501
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
464
502
|
width: newWidth,
|
|
465
503
|
height: newHeight
|
|
466
504
|
}));
|
|
467
505
|
})));
|
|
468
506
|
};
|
|
507
|
+
|
|
469
508
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
470
509
|
return FixedSizeContainer;
|
|
471
510
|
};
|
|
511
|
+
|
|
472
512
|
exports.default = withFixedSizeContainer;
|
|
473
513
|
|
|
474
514
|
/***/ }),
|
|
@@ -488,9 +528,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
488
528
|
* @param {DashboardVizType} props.Wrapper
|
|
489
529
|
* @param {DashboardVizType} props.Visualization
|
|
490
530
|
*/
|
|
531
|
+
|
|
491
532
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
492
533
|
var Wrapper = _ref.Wrapper,
|
|
493
|
-
|
|
534
|
+
Visualization = _ref.Visualization;
|
|
494
535
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
495
536
|
extendProperties.forEach(function (prop) {
|
|
496
537
|
if (Visualization[prop]) {
|
|
@@ -499,6 +540,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
499
540
|
}
|
|
500
541
|
});
|
|
501
542
|
};
|
|
543
|
+
|
|
502
544
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
503
545
|
|
|
504
546
|
/***/ }),
|
|
@@ -550,60 +592,89 @@ exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
|
550
592
|
|
|
551
593
|
|
|
552
594
|
var _slicedToArray = __webpack_require__(10);
|
|
595
|
+
|
|
553
596
|
Object.defineProperty(exports, "__esModule", {
|
|
554
597
|
value: true
|
|
555
598
|
});
|
|
599
|
+
|
|
556
600
|
var React = __webpack_require__(0);
|
|
601
|
+
|
|
557
602
|
var lodash_1 = __webpack_require__(3);
|
|
603
|
+
|
|
558
604
|
var getSettingsFromThemedProps_1 = __webpack_require__(76);
|
|
605
|
+
|
|
559
606
|
var Options_1 = __webpack_require__(77);
|
|
607
|
+
|
|
560
608
|
var SanitizeProps_1 = __webpack_require__(78);
|
|
609
|
+
|
|
561
610
|
var TimezoneContext_1 = __webpack_require__(20);
|
|
611
|
+
|
|
562
612
|
var moment_1 = __webpack_require__(79);
|
|
613
|
+
|
|
563
614
|
var FeatureFlagContext_1 = __webpack_require__(80);
|
|
615
|
+
|
|
564
616
|
var styled_components_1 = __webpack_require__(2);
|
|
617
|
+
|
|
565
618
|
var hocUtils_1 = __webpack_require__(81);
|
|
619
|
+
|
|
566
620
|
var JSONSchemaUtils_1 = __webpack_require__(82);
|
|
621
|
+
|
|
567
622
|
var async_dynamic_options_evaluator_1 = __webpack_require__(83);
|
|
623
|
+
|
|
568
624
|
var id_1 = __webpack_require__(84);
|
|
625
|
+
|
|
569
626
|
var SplunkVisualization_1 = __webpack_require__(24);
|
|
627
|
+
|
|
570
628
|
var VizBehavior_1 = __webpack_require__(31);
|
|
629
|
+
|
|
571
630
|
var getSorting_1 = __webpack_require__(85);
|
|
631
|
+
|
|
572
632
|
var getPagination_1 = __webpack_require__(87);
|
|
633
|
+
|
|
573
634
|
var useDeepMemo_1 = __webpack_require__(88);
|
|
635
|
+
|
|
574
636
|
var MissingPropsMessage_1 = __webpack_require__(89);
|
|
637
|
+
|
|
575
638
|
var withEditModeCover_1 = __webpack_require__(91);
|
|
639
|
+
|
|
576
640
|
var withPlaceholder_1 = __webpack_require__(92);
|
|
577
641
|
/**
|
|
578
642
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
579
643
|
* @param {DashboardVizOpts} opts
|
|
580
644
|
* @returns {HOC}
|
|
581
645
|
*/
|
|
646
|
+
|
|
647
|
+
|
|
582
648
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
583
649
|
var ReactViz = opts.ReactViz,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
650
|
+
vizConfig = opts.vizConfig,
|
|
651
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
652
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
653
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
654
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
655
|
+
|
|
589
656
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
590
657
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
658
|
+
|
|
591
659
|
var DashboardViz = function DashboardViz(props) {
|
|
592
660
|
var _a;
|
|
661
|
+
|
|
593
662
|
var mode = props.mode,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
663
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
664
|
+
dataSources = props.dataSources,
|
|
665
|
+
options = props.options,
|
|
666
|
+
_props$context = props.context,
|
|
667
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
668
|
+
width = props.width,
|
|
669
|
+
height = props.height,
|
|
670
|
+
onComputedProps = props.onComputedProps,
|
|
671
|
+
onEventTrigger = props.onEventTrigger,
|
|
672
|
+
theme = props.theme,
|
|
673
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
674
|
+
|
|
605
675
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
606
|
-
|
|
676
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
677
|
+
|
|
607
678
|
if (serializedTimezone) {
|
|
608
679
|
/*
|
|
609
680
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -617,38 +688,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
617
688
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
618
689
|
}
|
|
619
690
|
}
|
|
691
|
+
|
|
620
692
|
var themeFunc = function themeFunc(themeVar) {
|
|
621
693
|
var _a, _b;
|
|
694
|
+
|
|
622
695
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
623
696
|
};
|
|
697
|
+
|
|
624
698
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
699
|
+
|
|
625
700
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
701
|
+
theme: theme
|
|
702
|
+
}),
|
|
703
|
+
currentThemeFamily = _ref.family,
|
|
704
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
705
|
+
currentThemeDensity = _ref.density;
|
|
706
|
+
|
|
631
707
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
708
|
+
|
|
632
709
|
var _React$useState = React.useState({}),
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
710
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
711
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
712
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
713
|
+
|
|
714
|
+
|
|
636
715
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
716
|
+
|
|
637
717
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
638
|
-
|
|
639
|
-
|
|
718
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
719
|
+
visualizationID = _React$useState4[0];
|
|
720
|
+
|
|
640
721
|
var _React$useState5 = React.useState({}),
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
722
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
723
|
+
dataSourcesInState = _React$useState6[0],
|
|
724
|
+
setDataSourcesInState = _React$useState6[1];
|
|
725
|
+
|
|
644
726
|
var _React$useState7 = React.useState(),
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
727
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
728
|
+
dataFramesInState = _React$useState8[0],
|
|
729
|
+
setDataFramesInState = _React$useState8[1];
|
|
730
|
+
|
|
648
731
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
732
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
733
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
734
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
735
|
+
|
|
652
736
|
var isMounted = React.useRef(true);
|
|
653
737
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
654
738
|
try {
|
|
@@ -673,11 +757,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
673
757
|
});
|
|
674
758
|
} else {
|
|
675
759
|
var dataFrames = dataFramesInState;
|
|
760
|
+
|
|
676
761
|
if (dataSources !== dataSourcesInState) {
|
|
677
762
|
setDataSourcesInState(dataSources);
|
|
678
763
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
679
764
|
setDataFramesInState(dataFrames);
|
|
680
765
|
}
|
|
766
|
+
|
|
681
767
|
return Options_1.Options.evaluate({
|
|
682
768
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
683
769
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -688,21 +774,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
688
774
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
689
775
|
return {};
|
|
690
776
|
}
|
|
777
|
+
|
|
691
778
|
return {};
|
|
692
779
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
693
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
694
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
780
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
695
781
|
// 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
|
|
696
782
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
783
|
+
|
|
697
784
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
698
785
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
786
|
+
|
|
699
787
|
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) {
|
|
700
788
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
701
789
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
702
790
|
});
|
|
703
|
-
}
|
|
704
|
-
// useEffect hook needs to be initialized before any early returns
|
|
791
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
705
792
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
793
|
+
|
|
794
|
+
|
|
706
795
|
React.useEffect(function () {
|
|
707
796
|
onComputedProps(clonedEvaluatedOptions);
|
|
708
797
|
});
|
|
@@ -712,44 +801,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
712
801
|
isMounted.current = false;
|
|
713
802
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
714
803
|
}
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
// present warning message if any required props are missing
|
|
804
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
805
|
+
}, []); // present warning message if any required props are missing
|
|
806
|
+
|
|
719
807
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
720
|
-
|
|
721
|
-
|
|
808
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
809
|
+
supports = vizConfig.supports;
|
|
722
810
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
811
|
+
|
|
723
812
|
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
|
|
724
813
|
) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
814
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
815
|
+
"data-test": "missing-props-message",
|
|
816
|
+
width: width,
|
|
817
|
+
height: height,
|
|
818
|
+
missingProps: missing,
|
|
819
|
+
backgroundColor: bgColorFromTheme
|
|
820
|
+
});
|
|
821
|
+
} // events
|
|
822
|
+
|
|
823
|
+
|
|
734
824
|
var eventCallbackProps = {};
|
|
825
|
+
|
|
735
826
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
736
827
|
var supportedEvents = vizConfig.events;
|
|
737
828
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
738
829
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
739
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
740
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
830
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
741
831
|
// then remove these lines
|
|
832
|
+
|
|
742
833
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
743
834
|
var payload = {};
|
|
835
|
+
|
|
744
836
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
745
837
|
payloadKeys.forEach(function (p) {
|
|
746
838
|
payload[p] = evaluatedOptionsToUse[p];
|
|
747
839
|
});
|
|
748
840
|
}
|
|
841
|
+
|
|
749
842
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
750
843
|
if (ev && ev.payload) {
|
|
751
844
|
payload = ev.payload;
|
|
752
845
|
}
|
|
846
|
+
|
|
753
847
|
return onEventTrigger({
|
|
754
848
|
originalEvent: ev,
|
|
755
849
|
payload: payload,
|
|
@@ -757,8 +851,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
757
851
|
});
|
|
758
852
|
};
|
|
759
853
|
});
|
|
760
|
-
}
|
|
761
|
-
|
|
854
|
+
} // compute pure viz props which are not from options
|
|
855
|
+
|
|
856
|
+
|
|
762
857
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
763
858
|
themeFunc: themeFunc
|
|
764
859
|
}));
|
|
@@ -776,15 +871,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
776
871
|
* In future, we could automatically detect which all datasources are being used
|
|
777
872
|
* and bind those magically to pagination/sorting behavior.
|
|
778
873
|
*/
|
|
874
|
+
|
|
779
875
|
var dataSourceMetadata = {};
|
|
780
876
|
var OptionKey = 'paginateDataSourceKey';
|
|
781
877
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
878
|
+
|
|
782
879
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
783
880
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
784
881
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
882
|
+
|
|
785
883
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
786
884
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
787
885
|
};
|
|
886
|
+
|
|
788
887
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
789
888
|
requestParams: requestParams,
|
|
790
889
|
meta: meta,
|
|
@@ -799,27 +898,31 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
799
898
|
sortParams: sortParams,
|
|
800
899
|
paginatorParams: paginatorParams
|
|
801
900
|
};
|
|
802
|
-
}
|
|
803
|
-
|
|
901
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
902
|
+
|
|
903
|
+
|
|
804
904
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
805
905
|
return null;
|
|
806
906
|
}
|
|
907
|
+
|
|
807
908
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
808
909
|
mode: mode,
|
|
809
910
|
width: width,
|
|
810
911
|
height: height
|
|
811
912
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
812
913
|
};
|
|
914
|
+
|
|
813
915
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
814
916
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
815
917
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
816
918
|
theme: {}
|
|
817
|
-
});
|
|
818
|
-
|
|
819
|
-
DashboardViz.config = vizConfig;
|
|
820
|
-
|
|
919
|
+
}); // attach viz config
|
|
920
|
+
|
|
921
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
922
|
+
|
|
821
923
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
822
924
|
};
|
|
925
|
+
|
|
823
926
|
exports.default = withDashboardViz;
|
|
824
927
|
|
|
825
928
|
/***/ }),
|
|
@@ -884,21 +987,27 @@ module.exports = require("@splunk/ui-utils/id");
|
|
|
884
987
|
|
|
885
988
|
|
|
886
989
|
var _defineProperty = __webpack_require__(8);
|
|
990
|
+
|
|
887
991
|
Object.defineProperty(exports, "__esModule", {
|
|
888
992
|
value: true
|
|
889
993
|
});
|
|
890
994
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
995
|
+
|
|
891
996
|
var T = __webpack_require__(1);
|
|
997
|
+
|
|
892
998
|
var lodash_1 = __webpack_require__(3);
|
|
999
|
+
|
|
893
1000
|
var DataSource_1 = __webpack_require__(86);
|
|
1001
|
+
|
|
894
1002
|
exports.SortParamsPropTypes = T.shape({
|
|
895
1003
|
currentSortKey: T.string,
|
|
896
1004
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
897
1005
|
onSort: T.func
|
|
898
1006
|
});
|
|
1007
|
+
|
|
899
1008
|
var getSortingParams = function getSortingParams(_ref) {
|
|
900
1009
|
var requestParams = _ref.requestParams,
|
|
901
|
-
|
|
1010
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
902
1011
|
var currentSortKey;
|
|
903
1012
|
var currentSortDir;
|
|
904
1013
|
var nextSortDirMap = {
|
|
@@ -907,15 +1016,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
907
1016
|
none: 'asc'
|
|
908
1017
|
};
|
|
909
1018
|
var onSort;
|
|
1019
|
+
|
|
910
1020
|
if (typeof onRequestParamsChange === 'function') {
|
|
911
1021
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
912
1022
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
913
1023
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
914
|
-
}
|
|
915
|
-
|
|
1024
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
1025
|
+
|
|
1026
|
+
|
|
916
1027
|
onSort = function onSort(e, _ref2) {
|
|
917
1028
|
var sortKey = _ref2.sortKey,
|
|
918
|
-
|
|
1029
|
+
sortDir = _ref2.sortDir;
|
|
1030
|
+
|
|
919
1031
|
if (typeof sortKey === 'string') {
|
|
920
1032
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
921
1033
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -927,12 +1039,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
927
1039
|
}
|
|
928
1040
|
};
|
|
929
1041
|
}
|
|
1042
|
+
|
|
930
1043
|
return {
|
|
931
1044
|
currentSortKey: currentSortKey,
|
|
932
1045
|
currentSortDir: currentSortDir,
|
|
933
1046
|
onSort: onSort
|
|
934
1047
|
};
|
|
935
1048
|
};
|
|
1049
|
+
|
|
936
1050
|
exports.getSortingParams = getSortingParams;
|
|
937
1051
|
|
|
938
1052
|
/***/ }),
|
|
@@ -945,8 +1059,10 @@ exports.getSortingParams = getSortingParams;
|
|
|
945
1059
|
Object.defineProperty(exports, "__esModule", {
|
|
946
1060
|
value: true
|
|
947
1061
|
});
|
|
948
|
-
exports.validSortDirs = void 0;
|
|
1062
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
949
1063
|
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1064
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
1065
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
950
1066
|
|
|
951
1067
|
/***/ }),
|
|
952
1068
|
/* 87 */
|
|
@@ -959,39 +1075,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
959
1075
|
value: true
|
|
960
1076
|
});
|
|
961
1077
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1078
|
+
|
|
962
1079
|
var T = __webpack_require__(1);
|
|
1080
|
+
|
|
963
1081
|
var lodash_1 = __webpack_require__(3);
|
|
1082
|
+
|
|
964
1083
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
965
1084
|
isPaging: T.bool,
|
|
966
1085
|
current: T.number,
|
|
967
1086
|
totalPages: T.number,
|
|
968
1087
|
onChange: T.func
|
|
969
1088
|
});
|
|
1089
|
+
|
|
970
1090
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
971
1091
|
var requestParams = _ref.requestParams,
|
|
972
|
-
|
|
973
|
-
|
|
1092
|
+
meta = _ref.meta,
|
|
1093
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
974
1094
|
var totalCount = meta && meta.totalCount || 0;
|
|
975
1095
|
var offset = requestParams && requestParams.offset || 0;
|
|
976
1096
|
var count = requestParams && requestParams.count;
|
|
977
1097
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
978
1098
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
979
1099
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
1100
|
+
|
|
980
1101
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
981
1102
|
var page = _ref2.page,
|
|
982
|
-
|
|
1103
|
+
countArg = _ref2.count;
|
|
983
1104
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
1105
|
+
|
|
984
1106
|
if (typeof countArg === 'number') {
|
|
985
1107
|
newParams.count = countArg;
|
|
986
1108
|
newParams.offset = 0;
|
|
987
1109
|
}
|
|
1110
|
+
|
|
988
1111
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
1112
|
+
|
|
989
1113
|
if (typeof page === 'number' && page > 0) {
|
|
990
1114
|
newParams.count = pageCount;
|
|
991
1115
|
newParams.offset = (page - 1) * pageCount;
|
|
992
1116
|
}
|
|
1117
|
+
|
|
993
1118
|
onRequestParamsChange(newParams);
|
|
994
1119
|
};
|
|
1120
|
+
|
|
995
1121
|
return {
|
|
996
1122
|
isPaging: isPaging,
|
|
997
1123
|
current: current,
|
|
@@ -999,6 +1125,7 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
999
1125
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
1000
1126
|
};
|
|
1001
1127
|
};
|
|
1128
|
+
|
|
1002
1129
|
exports.getPaginationParams = getPaginationParams;
|
|
1003
1130
|
|
|
1004
1131
|
/***/ }),
|
|
@@ -1012,7 +1139,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1012
1139
|
value: true
|
|
1013
1140
|
});
|
|
1014
1141
|
exports.useDeepMemo = void 0;
|
|
1142
|
+
|
|
1015
1143
|
var react_1 = __webpack_require__(0);
|
|
1144
|
+
|
|
1016
1145
|
var lodash_1 = __webpack_require__(3);
|
|
1017
1146
|
/**
|
|
1018
1147
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1027,16 +1156,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1027
1156
|
* @param fn the function to be executed and
|
|
1028
1157
|
* @param dependencies an array of dependencies
|
|
1029
1158
|
*/
|
|
1159
|
+
|
|
1160
|
+
|
|
1030
1161
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1031
1162
|
var ref = (0, react_1.useRef)();
|
|
1163
|
+
|
|
1032
1164
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1033
1165
|
ref.current = {
|
|
1034
1166
|
dependencies: dependencies,
|
|
1035
1167
|
value: fn()
|
|
1036
1168
|
};
|
|
1037
1169
|
}
|
|
1170
|
+
|
|
1038
1171
|
return ref.current.value;
|
|
1039
1172
|
};
|
|
1173
|
+
|
|
1040
1174
|
exports.useDeepMemo = useDeepMemo;
|
|
1041
1175
|
|
|
1042
1176
|
/***/ }),
|
|
@@ -1050,19 +1184,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1050
1184
|
value: true
|
|
1051
1185
|
});
|
|
1052
1186
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
1187
|
+
|
|
1053
1188
|
var React = __webpack_require__(0);
|
|
1189
|
+
|
|
1054
1190
|
var T = __webpack_require__(1);
|
|
1191
|
+
|
|
1055
1192
|
var i18n_1 = __webpack_require__(7);
|
|
1193
|
+
|
|
1056
1194
|
var Message_1 = __webpack_require__(18);
|
|
1195
|
+
|
|
1057
1196
|
var FixedSizeContainer_1 = __webpack_require__(32);
|
|
1058
1197
|
/**
|
|
1059
1198
|
* @method isMissing
|
|
1060
1199
|
* @param {any} v
|
|
1061
1200
|
* @returns {boolean} true if the input value === null or undefined
|
|
1062
1201
|
*/
|
|
1202
|
+
|
|
1203
|
+
|
|
1063
1204
|
var isMissing = function isMissing(v) {
|
|
1064
1205
|
return v === null || v === undefined;
|
|
1065
1206
|
};
|
|
1207
|
+
|
|
1066
1208
|
exports.isMissing = isMissing;
|
|
1067
1209
|
/**
|
|
1068
1210
|
* @method misskingKeys
|
|
@@ -1070,11 +1212,13 @@ exports.isMissing = isMissing;
|
|
|
1070
1212
|
* @param {object} target
|
|
1071
1213
|
* @returns {string[]} the keys of missing required props
|
|
1072
1214
|
*/
|
|
1215
|
+
|
|
1073
1216
|
var missingKeys = function missingKeys(keys, target) {
|
|
1074
1217
|
return keys.filter(function (k) {
|
|
1075
1218
|
return (0, exports.isMissing)(target[k]);
|
|
1076
1219
|
});
|
|
1077
1220
|
};
|
|
1221
|
+
|
|
1078
1222
|
exports.missingKeys = missingKeys;
|
|
1079
1223
|
var propTypes = {
|
|
1080
1224
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1088,10 +1232,11 @@ var propTypes = {
|
|
|
1088
1232
|
* @param {MissingPropsProps} props
|
|
1089
1233
|
* @returns {React.ReactElement}
|
|
1090
1234
|
*/
|
|
1235
|
+
|
|
1091
1236
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1092
1237
|
var width = props.width,
|
|
1093
|
-
|
|
1094
|
-
|
|
1238
|
+
height = props.height,
|
|
1239
|
+
missingProps = props.missingProps;
|
|
1095
1240
|
return React.createElement(Message_1.default, {
|
|
1096
1241
|
"data-test": "message",
|
|
1097
1242
|
width: width,
|
|
@@ -1099,6 +1244,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
1099
1244
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1100
1245
|
});
|
|
1101
1246
|
};
|
|
1247
|
+
|
|
1102
1248
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1103
1249
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1104
1250
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -1123,15 +1269,19 @@ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
|
1123
1269
|
Object.defineProperty(exports, "__esModule", {
|
|
1124
1270
|
value: true
|
|
1125
1271
|
});
|
|
1272
|
+
|
|
1126
1273
|
var React = __webpack_require__(0);
|
|
1274
|
+
|
|
1127
1275
|
var styled_components_1 = __webpack_require__(2);
|
|
1276
|
+
|
|
1128
1277
|
var hocUtils_1 = __webpack_require__(33);
|
|
1278
|
+
|
|
1129
1279
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1130
1280
|
displayName: "withEditModeCover__Cover",
|
|
1131
1281
|
componentId: "sc-1gsbnxb-0"
|
|
1132
1282
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1133
1283
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1134
|
-
'data-splunk-visualization-version': "26.
|
|
1284
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
1135
1285
|
}).withConfig({
|
|
1136
1286
|
displayName: "withEditModeCover__Blocker",
|
|
1137
1287
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1142,6 +1292,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1142
1292
|
* @param {ExtendedDashViz} Visualization
|
|
1143
1293
|
* @returns {ExtendedDashViz} Wrapper
|
|
1144
1294
|
*/
|
|
1295
|
+
|
|
1145
1296
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1146
1297
|
var Wrapper = function Wrapper(props) {
|
|
1147
1298
|
var mode = props.mode;
|
|
@@ -1150,12 +1301,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1150
1301
|
"data-test": "edit-mode-cover"
|
|
1151
1302
|
}));
|
|
1152
1303
|
};
|
|
1304
|
+
|
|
1153
1305
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1154
1306
|
Wrapper: Wrapper,
|
|
1155
1307
|
Visualization: Visualization
|
|
1156
1308
|
});
|
|
1157
1309
|
return Wrapper;
|
|
1158
1310
|
};
|
|
1311
|
+
|
|
1159
1312
|
exports.default = withEditModeCover;
|
|
1160
1313
|
|
|
1161
1314
|
/***/ }),
|
|
@@ -1168,27 +1321,37 @@ exports.default = withEditModeCover;
|
|
|
1168
1321
|
Object.defineProperty(exports, "__esModule", {
|
|
1169
1322
|
value: true
|
|
1170
1323
|
});
|
|
1324
|
+
|
|
1171
1325
|
var React = __webpack_require__(0);
|
|
1326
|
+
|
|
1172
1327
|
var colorUtils_1 = __webpack_require__(14);
|
|
1328
|
+
|
|
1173
1329
|
var variables_1 = __webpack_require__(27);
|
|
1330
|
+
|
|
1174
1331
|
var IconPlaceholder_1 = __webpack_require__(93);
|
|
1332
|
+
|
|
1175
1333
|
var VizBehavior_1 = __webpack_require__(31);
|
|
1334
|
+
|
|
1176
1335
|
var hocUtils_1 = __webpack_require__(33);
|
|
1336
|
+
|
|
1177
1337
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1178
1338
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1179
1339
|
var config = Visualization.config;
|
|
1180
1340
|
var themes = config.themes;
|
|
1341
|
+
|
|
1181
1342
|
var Wrapper = function Wrapper(props) {
|
|
1182
1343
|
var _a, _b;
|
|
1344
|
+
|
|
1183
1345
|
var dataSources = props.dataSources,
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1346
|
+
loading = props.loading,
|
|
1347
|
+
options = props.options,
|
|
1348
|
+
height = props.height,
|
|
1349
|
+
width = props.width;
|
|
1188
1350
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
1189
1351
|
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);
|
|
1190
1352
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
1191
1353
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
1354
|
+
|
|
1192
1355
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
1193
1356
|
return React.createElement(IconPlaceholder_1.default, {
|
|
1194
1357
|
"data-test": "icon-placeholder",
|
|
@@ -1199,14 +1362,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
1199
1362
|
iconColor: iconColor
|
|
1200
1363
|
});
|
|
1201
1364
|
}
|
|
1365
|
+
|
|
1202
1366
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
1203
1367
|
};
|
|
1368
|
+
|
|
1204
1369
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1205
1370
|
Wrapper: Wrapper,
|
|
1206
1371
|
Visualization: Visualization
|
|
1207
1372
|
});
|
|
1208
1373
|
return Wrapper;
|
|
1209
1374
|
};
|
|
1375
|
+
|
|
1210
1376
|
exports.default = withPlaceholder;
|
|
1211
1377
|
|
|
1212
1378
|
/***/ }),
|
|
@@ -1220,11 +1386,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1220
1386
|
value: true
|
|
1221
1387
|
});
|
|
1222
1388
|
exports.shouldShowIconPlaceholder = void 0;
|
|
1389
|
+
|
|
1223
1390
|
var React = __webpack_require__(0);
|
|
1391
|
+
|
|
1224
1392
|
var T = __webpack_require__(1);
|
|
1393
|
+
|
|
1225
1394
|
var lodash_1 = __webpack_require__(3);
|
|
1395
|
+
|
|
1226
1396
|
var i18n_1 = __webpack_require__(7);
|
|
1397
|
+
|
|
1227
1398
|
var Message_1 = __webpack_require__(18);
|
|
1399
|
+
|
|
1228
1400
|
var FixedSizeContainer_1 = __webpack_require__(32);
|
|
1229
1401
|
/**
|
|
1230
1402
|
* @method shouldShowIconPlaceholder
|
|
@@ -1232,6 +1404,8 @@ var FixedSizeContainer_1 = __webpack_require__(32);
|
|
|
1232
1404
|
* @param {boolean} loading
|
|
1233
1405
|
* @returns {boolean}
|
|
1234
1406
|
*/
|
|
1407
|
+
|
|
1408
|
+
|
|
1235
1409
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
1236
1410
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1237
1411
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -1240,6 +1414,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
1240
1414
|
var noFields = fields === undefined;
|
|
1241
1415
|
return loading || noData || noFields;
|
|
1242
1416
|
};
|
|
1417
|
+
|
|
1243
1418
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
1244
1419
|
var propTypes = {
|
|
1245
1420
|
icon: T.func,
|
|
@@ -1254,11 +1429,13 @@ var propTypes = {
|
|
|
1254
1429
|
* @param {IconPlaceholderProps} props
|
|
1255
1430
|
* @returns {React.ReactElement}
|
|
1256
1431
|
*/
|
|
1432
|
+
|
|
1257
1433
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
1258
1434
|
var width = props.width,
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1435
|
+
height = props.height,
|
|
1436
|
+
icon = props.icon,
|
|
1437
|
+
iconColor = props.iconColor;
|
|
1438
|
+
|
|
1262
1439
|
if (icon) {
|
|
1263
1440
|
return React.createElement(icon, {
|
|
1264
1441
|
style: {
|
|
@@ -1273,6 +1450,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1273
1450
|
height: '50%'
|
|
1274
1451
|
});
|
|
1275
1452
|
}
|
|
1453
|
+
|
|
1276
1454
|
return React.createElement(Message_1.default, {
|
|
1277
1455
|
width: width,
|
|
1278
1456
|
height: height,
|
|
@@ -1280,6 +1458,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1280
1458
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
1281
1459
|
});
|
|
1282
1460
|
};
|
|
1461
|
+
|
|
1283
1462
|
IconPlaceholder.propTypes = propTypes;
|
|
1284
1463
|
IconPlaceholder.defaultProps = {
|
|
1285
1464
|
width: '100%',
|