@splunk/visualization-migrations 23.5.0 → 24.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/index.js +1964 -181
- package/index.js.map +1 -1
- package/package.json +11 -5
- package/types/utils/gauges.d.ts +9 -0
- package/types/utils/migrationUtils.d.ts +29 -0
- package/types/utils/singlevalue.d.ts +10 -0
- package/types/visualizations/choroplethSvg.d.ts +2 -0
- package/types/visualizations/choroplethSvgTestImages.d.ts +7 -0
- package/types/visualizations/ellipse.d.ts +2 -0
- package/types/visualizations/fillergauge.d.ts +2 -0
- package/types/visualizations/image.d.ts +2 -0
- package/types/visualizations/index.d.ts +13 -0
- package/types/visualizations/markdown.d.ts +2 -0
- package/types/visualizations/markergauge.d.ts +2 -0
- package/types/visualizations/punchcard.d.ts +2 -0
- package/types/visualizations/rectangle.d.ts +3 -0
- package/types/visualizations/singlevalue.d.ts +2 -0
- package/types/visualizations/singlevalueicon.d.ts +2 -0
- package/types/visualizations/singlevalueradial.d.ts +2 -0
- package/types/visualizations/splunk-charting.d.ts +1 -1
- package/types/visualizations/table.d.ts +3 -0
- package/types/visualizations/text.d.ts +2 -0
package/index.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 = 10);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ([
|
|
@@ -97,7 +97,148 @@ module.exports =
|
|
|
97
97
|
"use strict";
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
var
|
|
100
|
+
var _slicedToArray = __webpack_require__(6);
|
|
101
|
+
|
|
102
|
+
Object.defineProperty(exports, "__esModule", {
|
|
103
|
+
value: true
|
|
104
|
+
});
|
|
105
|
+
exports.addsDataSelectorToOptions = exports.preserveDataSelectionForValueOption = exports.renameVizOptions = exports.removeInvalidOptions = void 0;
|
|
106
|
+
|
|
107
|
+
var dsl_1 = __webpack_require__(23);
|
|
108
|
+
/**
|
|
109
|
+
* Removes invalid keys in the options
|
|
110
|
+
* @param currentOptions - Current visualization options
|
|
111
|
+
* @param validOptions - Valid visualization option keys
|
|
112
|
+
* @returns void
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
var removeInvalidOptions = function removeInvalidOptions(currentOptions, validOptions) {
|
|
117
|
+
if (!currentOptions || !validOptions) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var copiedCurrOptions = currentOptions;
|
|
122
|
+
Object.keys(copiedCurrOptions).forEach(function (key) {
|
|
123
|
+
if (!(key in validOptions)) {
|
|
124
|
+
delete copiedCurrOptions[key];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
exports.removeInvalidOptions = removeInvalidOptions;
|
|
130
|
+
/**
|
|
131
|
+
* Renames viz options by looking up their migration mapping
|
|
132
|
+
* @param oldOptions - Current visualization options
|
|
133
|
+
* @param optionRenames - Mapping of old options in viz.X to their migrated counterparts in splunk.X
|
|
134
|
+
* @returns updatedOptions
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
var renameVizOptions = function renameVizOptions(oldOptions, optionRenames) {
|
|
138
|
+
var updatedOptions = {};
|
|
139
|
+
if (!oldOptions) return {};
|
|
140
|
+
if (!optionRenames) return oldOptions;
|
|
141
|
+
Object.entries(oldOptions).forEach(function (_ref) {
|
|
142
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
143
|
+
oldOptName = _ref2[0],
|
|
144
|
+
val = _ref2[1];
|
|
145
|
+
|
|
146
|
+
var _a;
|
|
147
|
+
|
|
148
|
+
var optionName = (_a = optionRenames[oldOptName]) !== null && _a !== void 0 ? _a : oldOptName;
|
|
149
|
+
updatedOptions[optionName] = val;
|
|
150
|
+
});
|
|
151
|
+
return updatedOptions;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
exports.renameVizOptions = renameVizOptions;
|
|
155
|
+
/**
|
|
156
|
+
* Appends appropriate series selector to DSL string to add viz-specific implicit logic
|
|
157
|
+
* @param valueOption - the value of an option
|
|
158
|
+
* @param selector - the selector to append
|
|
159
|
+
* @returns string | void
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
var preserveDataSelectionForValueOption = function preserveDataSelectionForValueOption(valueOption, selector) {
|
|
163
|
+
if (valueOption) {
|
|
164
|
+
// if the last data selector starts with seriesBy, append appropriate selector to it
|
|
165
|
+
var dataSelectors = dsl_1.getDataSelectorsFromDSL(valueOption);
|
|
166
|
+
var lastDataSelector = dataSelectors[dataSelectors.length - 1];
|
|
167
|
+
|
|
168
|
+
if (lastDataSelector.includes('seriesByIndex') || lastDataSelector.includes('seriesByName')) {
|
|
169
|
+
return "".concat(valueOption, " | ").concat(selector);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return null;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
exports.preserveDataSelectionForValueOption = preserveDataSelectionForValueOption;
|
|
177
|
+
/**
|
|
178
|
+
* For all data options, calls preserveDataSelectionForValueOption with relevant selector and
|
|
179
|
+
* updates dataOptions object
|
|
180
|
+
* @param dataOptions - an object reflecting all data options
|
|
181
|
+
* @param selector - the selector to append
|
|
182
|
+
* @returns void
|
|
183
|
+
*/
|
|
184
|
+
|
|
185
|
+
var addsDataSelectorToOptions = function addsDataSelectorToOptions(dataOptions, selector) {
|
|
186
|
+
var updatedDataOptions = {};
|
|
187
|
+
Object.keys(dataOptions).forEach(function (key) {
|
|
188
|
+
var statement = dataOptions[key];
|
|
189
|
+
var updatedDSL = exports.preserveDataSelectionForValueOption(statement, selector);
|
|
190
|
+
|
|
191
|
+
if (updatedDSL) {
|
|
192
|
+
updatedDataOptions[key] = updatedDSL;
|
|
193
|
+
} else {
|
|
194
|
+
updatedDataOptions[key] = statement;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
return updatedDataOptions;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
exports.addsDataSelectorToOptions = addsDataSelectorToOptions;
|
|
201
|
+
|
|
202
|
+
/***/ }),
|
|
203
|
+
/* 1 */
|
|
204
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
205
|
+
|
|
206
|
+
"use strict";
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
210
|
+
if (k2 === undefined) k2 = k;
|
|
211
|
+
Object.defineProperty(o, k2, {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
get: function get() {
|
|
214
|
+
return m[k];
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
} : function (o, m, k, k2) {
|
|
218
|
+
if (k2 === undefined) k2 = k;
|
|
219
|
+
o[k2] = m[k];
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
223
|
+
for (var p in m) {
|
|
224
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
Object.defineProperty(exports, "__esModule", {
|
|
229
|
+
value: true
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
__exportStar(__webpack_require__(15), exports);
|
|
233
|
+
|
|
234
|
+
/***/ }),
|
|
235
|
+
/* 2 */
|
|
236
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
237
|
+
|
|
238
|
+
"use strict";
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
var _typeof = __webpack_require__(4);
|
|
101
242
|
|
|
102
243
|
var __rest = this && this.__rest || function (s, e) {
|
|
103
244
|
var t = {};
|
|
@@ -117,7 +258,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
117
258
|
});
|
|
118
259
|
exports.otherValueReplacements = exports.migrateChartingOptions = exports.migrateBaseChartingVizDefinition = void 0;
|
|
119
260
|
|
|
120
|
-
var encoding_1 = __webpack_require__(
|
|
261
|
+
var encoding_1 = __webpack_require__(1);
|
|
121
262
|
/**
|
|
122
263
|
* map of splunk charting based @splunk/dashboard-visualization option names
|
|
123
264
|
* to updated @splunk/visualization option names
|
|
@@ -287,7 +428,8 @@ var otherValueReplacements = {
|
|
|
287
428
|
* setting chart.showMarkers to true is the equivalent of `markerDisplay: 'outlined'`
|
|
288
429
|
*/
|
|
289
430
|
markerDisplay: function markerDisplay(oldValue) {
|
|
290
|
-
if (oldValue === false) return 'off';
|
|
431
|
+
if (oldValue === false) return 'off';
|
|
432
|
+
if (oldValue === true) return 'outlined';
|
|
291
433
|
return oldValue;
|
|
292
434
|
}
|
|
293
435
|
};
|
|
@@ -322,7 +464,7 @@ var migrateChartingOptions = function migrateChartingOptions(options) {
|
|
|
322
464
|
exports.migrateChartingOptions = migrateChartingOptions;
|
|
323
465
|
/**
|
|
324
466
|
* helper that encapsulates shared migration logic across most charting-based viz
|
|
325
|
-
* @param {Object} defaultChanges - map
|
|
467
|
+
* @param {Object} defaultChanges - map consisting of default value changes from viz.* to splunk.*
|
|
326
468
|
* @param {Object} validOptions - the list of options that the new splunk.* viz supports
|
|
327
469
|
* @param {VisualizationDefinition} vizDefinition - the viz definition to migrate
|
|
328
470
|
* @param {String} vizType - the value of splunk.*
|
|
@@ -365,45 +507,115 @@ var migrateBaseChartingVizDefinition = function migrateBaseChartingVizDefinition
|
|
|
365
507
|
exports.migrateBaseChartingVizDefinition = migrateBaseChartingVizDefinition;
|
|
366
508
|
|
|
367
509
|
/***/ }),
|
|
368
|
-
/*
|
|
510
|
+
/* 3 */
|
|
511
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
512
|
+
|
|
513
|
+
"use strict";
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
Object.defineProperty(exports, "__esModule", {
|
|
517
|
+
value: true
|
|
518
|
+
});
|
|
519
|
+
exports.consolidateTrendDisplay = void 0;
|
|
520
|
+
/**
|
|
521
|
+
* Helper function to consolidate `trendDisplayMode` - percent/absolute
|
|
522
|
+
* and `showTrendIndicator` - true/false into `trendDisplay` - off/percent/absolute for Single Value Variations
|
|
523
|
+
* 1. if `showTrendIndicator` is explicitly false, `trendDisplay` is off
|
|
524
|
+
* 2. if `showTrendIndicator` is undefined (defaults to true), return `trendDisplayMode` value if present
|
|
525
|
+
* 3. if `showTrendIndicator` is explicitly true, return 'absolute'
|
|
526
|
+
* 4. if both the old options are undefined, return nothing as their defaults (true and `absolute`)
|
|
527
|
+
* correspond to `trendDisplay` default - absolute
|
|
528
|
+
*/
|
|
529
|
+
|
|
530
|
+
var consolidateTrendDisplay = function consolidateTrendDisplay(trendDisplayMode, showTrendIndicator) {
|
|
531
|
+
if (showTrendIndicator === false) {
|
|
532
|
+
return 'off';
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (['absolute', 'percent'].includes(trendDisplayMode)) {
|
|
536
|
+
return trendDisplayMode;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (showTrendIndicator === true) {
|
|
540
|
+
return 'absolute';
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return null;
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
exports.consolidateTrendDisplay = consolidateTrendDisplay;
|
|
547
|
+
|
|
548
|
+
/***/ }),
|
|
549
|
+
/* 4 */
|
|
369
550
|
/***/ (function(module, exports) {
|
|
370
551
|
|
|
371
552
|
module.exports = require("@babel/runtime/helpers/typeof");
|
|
372
553
|
|
|
373
554
|
/***/ }),
|
|
374
|
-
/*
|
|
555
|
+
/* 5 */
|
|
556
|
+
/***/ (function(module, exports) {
|
|
557
|
+
|
|
558
|
+
module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
559
|
+
|
|
560
|
+
/***/ }),
|
|
561
|
+
/* 6 */
|
|
562
|
+
/***/ (function(module, exports) {
|
|
563
|
+
|
|
564
|
+
module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
565
|
+
|
|
566
|
+
/***/ }),
|
|
567
|
+
/* 7 */
|
|
375
568
|
/***/ (function(module, exports, __webpack_require__) {
|
|
376
569
|
|
|
377
570
|
"use strict";
|
|
378
571
|
|
|
379
572
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
Object.defineProperty(o, k2, {
|
|
383
|
-
enumerable: true,
|
|
384
|
-
get: function get() {
|
|
385
|
-
return m[k];
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
} : function (o, m, k, k2) {
|
|
389
|
-
if (k2 === undefined) k2 = k;
|
|
390
|
-
o[k2] = m[k];
|
|
573
|
+
Object.defineProperty(exports, "__esModule", {
|
|
574
|
+
value: true
|
|
391
575
|
});
|
|
576
|
+
exports.consolidateDisplayOption = void 0;
|
|
577
|
+
/**
|
|
578
|
+
* Helper to convert old label and value options into consolidated labelDisplay and valueDisplay
|
|
579
|
+
* If the `showOption` is explicitly false, then we return 'off'
|
|
580
|
+
* If the `showOption` is undefined (which corresponds to a default of `true`), we return nothing to avoid conflating the viz definition (since this corresponds to `number` in the new display)
|
|
581
|
+
* @param {Boolean} showOption - either one of `showLabel` or `showValue` in the old gauges
|
|
582
|
+
* @param {Boolean} percentageOption - either one of `usePercentageRange` or `usePercentageValue` in the old gauges
|
|
583
|
+
* @returns {String}
|
|
584
|
+
*/
|
|
392
585
|
|
|
393
|
-
var
|
|
394
|
-
|
|
395
|
-
|
|
586
|
+
var consolidateDisplayOption = function consolidateDisplayOption(showOption, percentageOption) {
|
|
587
|
+
if (showOption === false) {
|
|
588
|
+
return 'off';
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
if (percentageOption === true) {
|
|
592
|
+
return 'percentage';
|
|
396
593
|
}
|
|
594
|
+
|
|
595
|
+
if (showOption === true) {
|
|
596
|
+
return 'number';
|
|
597
|
+
} // if showOption is undefined and percentageOption is false, we don't need to return an explicit value (since 'number' is passed in implicitly)
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
return null;
|
|
397
601
|
};
|
|
398
602
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
})
|
|
603
|
+
exports.consolidateDisplayOption = consolidateDisplayOption;
|
|
604
|
+
|
|
605
|
+
/***/ }),
|
|
606
|
+
/* 8 */
|
|
607
|
+
/***/ (function(module, exports) {
|
|
402
608
|
|
|
403
|
-
|
|
609
|
+
module.exports = require("@splunk/visualizations/Markdown.config");
|
|
404
610
|
|
|
405
611
|
/***/ }),
|
|
406
|
-
/*
|
|
612
|
+
/* 9 */
|
|
613
|
+
/***/ (function(module, exports) {
|
|
614
|
+
|
|
615
|
+
module.exports = require("lodash");
|
|
616
|
+
|
|
617
|
+
/***/ }),
|
|
618
|
+
/* 10 */
|
|
407
619
|
/***/ (function(module, exports, __webpack_require__) {
|
|
408
620
|
|
|
409
621
|
"use strict";
|
|
@@ -432,10 +644,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
432
644
|
value: true
|
|
433
645
|
});
|
|
434
646
|
|
|
435
|
-
__exportStar(__webpack_require__(
|
|
647
|
+
__exportStar(__webpack_require__(11), exports);
|
|
436
648
|
|
|
437
649
|
/***/ }),
|
|
438
|
-
/*
|
|
650
|
+
/* 11 */
|
|
439
651
|
/***/ (function(module, exports, __webpack_require__) {
|
|
440
652
|
|
|
441
653
|
"use strict";
|
|
@@ -446,7 +658,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
446
658
|
});
|
|
447
659
|
exports.inferToType = exports.canMigrate = exports.migrate = void 0;
|
|
448
660
|
|
|
449
|
-
var visualizations_1 = __webpack_require__(
|
|
661
|
+
var visualizations_1 = __webpack_require__(12);
|
|
450
662
|
|
|
451
663
|
var supportedMigrations = {
|
|
452
664
|
'viz.area': {
|
|
@@ -461,14 +673,53 @@ var supportedMigrations = {
|
|
|
461
673
|
'viz.column': {
|
|
462
674
|
'splunk.column': visualizations_1.migrateVizToSplunkColumn
|
|
463
675
|
},
|
|
676
|
+
'viz.choropleth.svg': {
|
|
677
|
+
'splunk.choropleth.svg': visualizations_1.migrateVizToSplunkChoroplethSvg
|
|
678
|
+
},
|
|
679
|
+
'viz.ellipse': {
|
|
680
|
+
'splunk.ellipse': visualizations_1.migrateVizToSplunkEllipse
|
|
681
|
+
},
|
|
682
|
+
'viz.fillergauge': {
|
|
683
|
+
'splunk.fillergauge': visualizations_1.migrateVizToSplunkFillerGauge
|
|
684
|
+
},
|
|
464
685
|
'viz.line': {
|
|
465
686
|
'splunk.line': visualizations_1.migrateVizToSplunkLine
|
|
466
687
|
},
|
|
688
|
+
'viz.img': {
|
|
689
|
+
'splunk.image': visualizations_1.migrateVizToSplunkImage
|
|
690
|
+
},
|
|
691
|
+
'viz.markdown': {
|
|
692
|
+
'splunk.markdown': visualizations_1.migrateVizToSplunkMarkdown
|
|
693
|
+
},
|
|
694
|
+
'viz.markergauge': {
|
|
695
|
+
'splunk.markergauge': visualizations_1.migrateVizToSplunkMarkerGauge
|
|
696
|
+
},
|
|
467
697
|
'viz.pie': {
|
|
468
698
|
'splunk.pie': visualizations_1.migrateVizToSplunkPie
|
|
469
699
|
},
|
|
700
|
+
'viz.rectangle': {
|
|
701
|
+
'splunk.rectangle': visualizations_1.migrateVizToSplunkRectangle
|
|
702
|
+
},
|
|
703
|
+
'viz.singlevalue': {
|
|
704
|
+
'splunk.singlevalue': visualizations_1.migrateVizToSplunkSingleValue
|
|
705
|
+
},
|
|
706
|
+
'viz.singlevalueicon': {
|
|
707
|
+
'splunk.singlevalueicon': visualizations_1.migrateVizToSplunkSingleValueIcon
|
|
708
|
+
},
|
|
709
|
+
'viz.singlevalueradial': {
|
|
710
|
+
'splunk.singlevalueradial': visualizations_1.migrateVizToSplunkSingleValueRadial
|
|
711
|
+
},
|
|
470
712
|
'viz.scatter': {
|
|
471
713
|
'splunk.scatter': visualizations_1.migrateVizToSplunkScatter
|
|
714
|
+
},
|
|
715
|
+
'viz.table': {
|
|
716
|
+
'splunk.table': visualizations_1.migrateVizToSplunkTable
|
|
717
|
+
},
|
|
718
|
+
'viz.text': {
|
|
719
|
+
'splunk.markdown': visualizations_1.migrateVizTextToSplunkMarkdown
|
|
720
|
+
},
|
|
721
|
+
'viz.punchcard': {
|
|
722
|
+
'splunk.punchcard': visualizations_1.migrateVizToSplunkPunchcard
|
|
472
723
|
}
|
|
473
724
|
};
|
|
474
725
|
|
|
@@ -477,6 +728,10 @@ var inferToType = function inferToType(typeFromDefinition) {
|
|
|
477
728
|
return 'splunk.image';
|
|
478
729
|
}
|
|
479
730
|
|
|
731
|
+
if (typeFromDefinition === 'viz.text') {
|
|
732
|
+
return 'splunk.markdown';
|
|
733
|
+
}
|
|
734
|
+
|
|
480
735
|
return typeFromDefinition.replace(/^viz\./, 'splunk.');
|
|
481
736
|
};
|
|
482
737
|
|
|
@@ -515,7 +770,7 @@ var canMigrate = function canMigrate(_ref2) {
|
|
|
515
770
|
exports.canMigrate = canMigrate;
|
|
516
771
|
|
|
517
772
|
/***/ }),
|
|
518
|
-
/*
|
|
773
|
+
/* 12 */
|
|
519
774
|
/***/ (function(module, exports, __webpack_require__) {
|
|
520
775
|
|
|
521
776
|
"use strict";
|
|
@@ -544,22 +799,48 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
544
799
|
value: true
|
|
545
800
|
});
|
|
546
801
|
|
|
547
|
-
__exportStar(__webpack_require__(
|
|
802
|
+
__exportStar(__webpack_require__(13), exports);
|
|
803
|
+
|
|
804
|
+
__exportStar(__webpack_require__(17), exports);
|
|
805
|
+
|
|
806
|
+
__exportStar(__webpack_require__(19), exports);
|
|
807
|
+
|
|
808
|
+
__exportStar(__webpack_require__(21), exports);
|
|
548
809
|
|
|
549
|
-
__exportStar(__webpack_require__(
|
|
810
|
+
__exportStar(__webpack_require__(24), exports);
|
|
550
811
|
|
|
551
|
-
__exportStar(__webpack_require__(
|
|
812
|
+
__exportStar(__webpack_require__(26), exports);
|
|
552
813
|
|
|
553
|
-
__exportStar(__webpack_require__(
|
|
814
|
+
__exportStar(__webpack_require__(28), exports);
|
|
554
815
|
|
|
555
|
-
__exportStar(__webpack_require__(
|
|
816
|
+
__exportStar(__webpack_require__(30), exports);
|
|
556
817
|
|
|
557
|
-
__exportStar(__webpack_require__(
|
|
818
|
+
__exportStar(__webpack_require__(32), exports);
|
|
558
819
|
|
|
559
|
-
__exportStar(__webpack_require__(
|
|
820
|
+
__exportStar(__webpack_require__(34), exports);
|
|
821
|
+
|
|
822
|
+
__exportStar(__webpack_require__(35), exports);
|
|
823
|
+
|
|
824
|
+
__exportStar(__webpack_require__(37), exports);
|
|
825
|
+
|
|
826
|
+
__exportStar(__webpack_require__(39), exports);
|
|
827
|
+
|
|
828
|
+
__exportStar(__webpack_require__(41), exports);
|
|
829
|
+
|
|
830
|
+
__exportStar(__webpack_require__(43), exports);
|
|
831
|
+
|
|
832
|
+
__exportStar(__webpack_require__(45), exports);
|
|
833
|
+
|
|
834
|
+
__exportStar(__webpack_require__(47), exports);
|
|
835
|
+
|
|
836
|
+
__exportStar(__webpack_require__(49), exports);
|
|
837
|
+
|
|
838
|
+
__exportStar(__webpack_require__(52), exports);
|
|
839
|
+
|
|
840
|
+
__exportStar(__webpack_require__(53), exports);
|
|
560
841
|
|
|
561
842
|
/***/ }),
|
|
562
|
-
/*
|
|
843
|
+
/* 13 */
|
|
563
844
|
/***/ (function(module, exports, __webpack_require__) {
|
|
564
845
|
|
|
565
846
|
"use strict";
|
|
@@ -570,11 +851,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
570
851
|
});
|
|
571
852
|
exports.migrateVizToSplunkArea = void 0;
|
|
572
853
|
|
|
573
|
-
var
|
|
854
|
+
var Area_config_1 = __webpack_require__(14);
|
|
574
855
|
|
|
575
|
-
var
|
|
856
|
+
var splunk_charting_1 = __webpack_require__(2);
|
|
576
857
|
|
|
577
|
-
var validOptions = Object.assign({},
|
|
858
|
+
var validOptions = Object.assign({}, Area_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
578
859
|
|
|
579
860
|
var defaultChanges = {
|
|
580
861
|
yAxisAbbreviation: 'off',
|
|
@@ -596,20 +877,28 @@ var migrateVizToSplunkArea = function migrateVizToSplunkArea(vizDefinition) {
|
|
|
596
877
|
exports.migrateVizToSplunkArea = migrateVizToSplunkArea;
|
|
597
878
|
|
|
598
879
|
/***/ }),
|
|
599
|
-
/*
|
|
880
|
+
/* 14 */
|
|
881
|
+
/***/ (function(module, exports) {
|
|
882
|
+
|
|
883
|
+
module.exports = require("@splunk/visualizations/Area.config");
|
|
884
|
+
|
|
885
|
+
/***/ }),
|
|
886
|
+
/* 15 */
|
|
600
887
|
/***/ (function(module, exports, __webpack_require__) {
|
|
601
888
|
|
|
602
889
|
"use strict";
|
|
603
890
|
|
|
604
891
|
|
|
605
|
-
var _typeof = __webpack_require__(
|
|
892
|
+
var _typeof = __webpack_require__(4);
|
|
893
|
+
|
|
894
|
+
var _toConsumableArray = __webpack_require__(5);
|
|
606
895
|
|
|
607
896
|
Object.defineProperty(exports, "__esModule", {
|
|
608
897
|
value: true
|
|
609
898
|
});
|
|
610
899
|
exports.encodingToDynamicOptionsDSL = void 0;
|
|
611
900
|
|
|
612
|
-
var Base_1 = __webpack_require__(
|
|
901
|
+
var Base_1 = __webpack_require__(16); // @TODO(pwied): move the parsing helpers so we can deprecate visualization-encoding-parsers package
|
|
613
902
|
// index based references are defined by <dataSource>[<index>]
|
|
614
903
|
// this regex matches <text with numbers>[<anything>]
|
|
615
904
|
// the "[" "]" part makes it an index based reference
|
|
@@ -627,6 +916,49 @@ var isIndexBasedReference = function isIndexBasedReference(ref) {
|
|
|
627
916
|
var isNameBasedReference = function isNameBasedReference(ref) {
|
|
628
917
|
return nameBasedRegx.test(ref);
|
|
629
918
|
};
|
|
919
|
+
|
|
920
|
+
var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key, translatedValue) {
|
|
921
|
+
var _a, _b, _c, _d, _e, _f;
|
|
922
|
+
|
|
923
|
+
switch ((_a = fieldReference === null || fieldReference === void 0 ? void 0 : fieldReference.format) === null || _a === void 0 ? void 0 : _a.type) {
|
|
924
|
+
case 'gradient':
|
|
925
|
+
return {
|
|
926
|
+
contextConfig: Object.assign(Object.assign({}, Array.isArray((_b = fieldReference.format) === null || _b === void 0 ? void 0 : _b.ranges) && {
|
|
927
|
+
stops: _toConsumableArray(fieldReference.format.ranges)
|
|
928
|
+
}), Array.isArray((_c = fieldReference.format) === null || _c === void 0 ? void 0 : _c.values) && {
|
|
929
|
+
colors: _toConsumableArray(fieldReference.format.values)
|
|
930
|
+
}),
|
|
931
|
+
contextKey: "".concat(key, "GradientContext"),
|
|
932
|
+
dsl: "".concat(translatedValue, " | gradient(").concat(key, "GradientContext)")
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
case 'rangevalue':
|
|
936
|
+
{
|
|
937
|
+
var contextKey = "".concat(key, "RangeValueContext");
|
|
938
|
+
return {
|
|
939
|
+
contextConfig: ((_d = fieldReference.format) === null || _d === void 0 ? void 0 : _d.ranges) || [],
|
|
940
|
+
contextKey: contextKey,
|
|
941
|
+
dsl: "".concat(translatedValue, " | rangeValue(").concat(contextKey, ")")
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
case 'matchvalue':
|
|
946
|
+
{
|
|
947
|
+
var defaultValue = (_e = fieldReference.format) === null || _e === void 0 ? void 0 : _e.defaultValue;
|
|
948
|
+
var matchValueContextKey = "".concat(key, "MatchValueContext");
|
|
949
|
+
return {
|
|
950
|
+
contextConfig: ((_f = fieldReference.format) === null || _f === void 0 ? void 0 : _f.matches) || [],
|
|
951
|
+
contextKey: matchValueContextKey,
|
|
952
|
+
dsl: "".concat(translatedValue, " | matchValue(").concat(matchValueContextKey).concat(defaultValue !== null && defaultValue !== undefined ? ", ".concat(typeof defaultValue === 'string' ? "\"".concat(defaultValue, "\"") : defaultValue) : '', ")")
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
default:
|
|
957
|
+
break;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
return null;
|
|
961
|
+
};
|
|
630
962
|
/**
|
|
631
963
|
* Translates encoding data selections in array format
|
|
632
964
|
*
|
|
@@ -647,7 +979,7 @@ var isNameBasedReference = function isNameBasedReference(ref) {
|
|
|
647
979
|
|
|
648
980
|
var translateArrayFormatDataReference = function translateArrayFormatDataReference(encodingDataReference) {
|
|
649
981
|
if (encodingDataReference.length === 0) {
|
|
650
|
-
return;
|
|
982
|
+
return null;
|
|
651
983
|
}
|
|
652
984
|
|
|
653
985
|
var allIndexBased = encodingDataReference.every(isIndexBasedReference);
|
|
@@ -655,39 +987,41 @@ var translateArrayFormatDataReference = function translateArrayFormatDataReferen
|
|
|
655
987
|
|
|
656
988
|
if (allIndexBased) {
|
|
657
989
|
var _Base_1$parseIndexBas = Base_1.parseIndexBasedFieldReference(encodingDataReference[0]),
|
|
658
|
-
|
|
990
|
+
_dataSourceName = _Base_1$parseIndexBas.dataSourceName;
|
|
659
991
|
|
|
660
992
|
var indexesStr = encodingDataReference.map(function (ref) {
|
|
661
993
|
var _a;
|
|
662
994
|
|
|
663
995
|
return (_a = Base_1.parseIndexBasedFieldReference(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex;
|
|
664
996
|
}).join(',');
|
|
665
|
-
return "> ".concat(
|
|
666
|
-
}
|
|
997
|
+
return "> ".concat(_dataSourceName, " | frameBySeriesIndexes(").concat(indexesStr, ")");
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
if (allNameBased) {
|
|
667
1001
|
var _Base_1$parseNameBase = Base_1.parseNameBasedFieldReference(encodingDataReference[0]),
|
|
668
|
-
|
|
1002
|
+
_dataSourceName2 = _Base_1$parseNameBase.dataSourceName;
|
|
669
1003
|
|
|
670
1004
|
var namesStr = encodingDataReference.map(function (ref) {
|
|
671
1005
|
var _a;
|
|
672
1006
|
|
|
673
|
-
return
|
|
1007
|
+
return "\"".concat((_a = Base_1.parseNameBasedFieldReference(ref)) === null || _a === void 0 ? void 0 : _a.fieldName, "\"");
|
|
674
1008
|
}).join(',');
|
|
675
|
-
return "> ".concat(
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// get the first ref to extract the dataSource
|
|
679
|
-
var firstEntry = encodingDataReference[0];
|
|
1009
|
+
return "> ".concat(_dataSourceName2, " | frameBySeriesNames(").concat(namesStr, ")");
|
|
1010
|
+
} // it's a mix of name and index based references
|
|
1011
|
+
// get the first ref to extract the dataSource
|
|
680
1012
|
|
|
681
|
-
var _ref = isIndexBasedReference(firstEntry) ? Base_1.parseIndexBasedFieldReference(firstEntry) : Base_1.parseNameBasedFieldReference(firstEntry),
|
|
682
|
-
_dataSourceName2 = _ref.dataSourceName;
|
|
683
1013
|
|
|
684
|
-
|
|
685
|
-
var _a, _b;
|
|
1014
|
+
var firstEntry = encodingDataReference[0];
|
|
686
1015
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
1016
|
+
var _ref = isIndexBasedReference(firstEntry) ? Base_1.parseIndexBasedFieldReference(firstEntry) : Base_1.parseNameBasedFieldReference(firstEntry),
|
|
1017
|
+
dataSourceName = _ref.dataSourceName;
|
|
1018
|
+
|
|
1019
|
+
var paramStr = encodingDataReference.map(function (ref) {
|
|
1020
|
+
var _a, _b;
|
|
1021
|
+
|
|
1022
|
+
return isIndexBasedReference(ref) ? (_a = Base_1.parseIndexBasedFieldReference(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex : "\"".concat((_b = Base_1.parseNameBasedFieldReference(ref)) === null || _b === void 0 ? void 0 : _b.fieldName, "\"");
|
|
1023
|
+
}).join(',');
|
|
1024
|
+
return "> ".concat(dataSourceName, " | frameBySeriesNamesOrIndexes(").concat(paramStr, ")");
|
|
691
1025
|
};
|
|
692
1026
|
/**
|
|
693
1027
|
* Translates an encoding data selection string to a dynamic options data selection
|
|
@@ -717,7 +1051,7 @@ var translateDataReference = function translateDataReference(encodingDataReferen
|
|
|
717
1051
|
|
|
718
1052
|
if (!isIndexBasedRef && !isNameBasedRef) {
|
|
719
1053
|
console.warn('Unable to parse the encoding. Please verify the encoding format is correct');
|
|
720
|
-
return;
|
|
1054
|
+
return null;
|
|
721
1055
|
}
|
|
722
1056
|
|
|
723
1057
|
if (isNameBasedRef) {
|
|
@@ -755,16 +1089,18 @@ var translateDataReference = function translateDataReference(encodingDataReferen
|
|
|
755
1089
|
}
|
|
756
1090
|
|
|
757
1091
|
return "> ".concat(_dataSourceName3, " | frameBySeriesIndexRange(").concat(fromFieldIndex).concat(dslToIndexString, ")");
|
|
758
|
-
}
|
|
759
|
-
var _returnString = "> ".concat(_dataSourceName3, " | seriesByIndex(").concat(fieldIndex, ")");
|
|
1092
|
+
}
|
|
760
1093
|
|
|
761
|
-
|
|
762
|
-
_returnString += " | pointByIndex(".concat(_columnIndex, ")");
|
|
763
|
-
}
|
|
1094
|
+
var _returnString = "> ".concat(_dataSourceName3, " | seriesByIndex(").concat(fieldIndex, ")");
|
|
764
1095
|
|
|
765
|
-
|
|
1096
|
+
if (_columnIndex) {
|
|
1097
|
+
_returnString += " | pointByIndex(".concat(_columnIndex, ")");
|
|
766
1098
|
}
|
|
1099
|
+
|
|
1100
|
+
return _returnString;
|
|
767
1101
|
}
|
|
1102
|
+
|
|
1103
|
+
return null;
|
|
768
1104
|
};
|
|
769
1105
|
/**
|
|
770
1106
|
* An encoding configuration can come in various different forms:
|
|
@@ -823,6 +1159,12 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
|
|
|
823
1159
|
|
|
824
1160
|
if (translatedValue) {
|
|
825
1161
|
translatedOptions[key] = translatedValue;
|
|
1162
|
+
var convertedFormatterObject = convertFormatterToDSL(fieldReference, key, translatedValue);
|
|
1163
|
+
|
|
1164
|
+
if (convertedFormatterObject) {
|
|
1165
|
+
translatedOptions[key] = convertedFormatterObject.dsl;
|
|
1166
|
+
dynamicOptions.context[convertedFormatterObject.contextKey] = convertedFormatterObject.contextConfig;
|
|
1167
|
+
}
|
|
826
1168
|
}
|
|
827
1169
|
});
|
|
828
1170
|
dynamicOptions.options = translatedOptions;
|
|
@@ -832,19 +1174,13 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
|
|
|
832
1174
|
exports.encodingToDynamicOptionsDSL = encodingToDynamicOptionsDSL;
|
|
833
1175
|
|
|
834
1176
|
/***/ }),
|
|
835
|
-
/*
|
|
1177
|
+
/* 16 */
|
|
836
1178
|
/***/ (function(module, exports) {
|
|
837
1179
|
|
|
838
1180
|
module.exports = require("@splunk/visualization-encoding-parsers/Base");
|
|
839
1181
|
|
|
840
1182
|
/***/ }),
|
|
841
|
-
/*
|
|
842
|
-
/***/ (function(module, exports) {
|
|
843
|
-
|
|
844
|
-
module.exports = require("@splunk/visualizations/Area");
|
|
845
|
-
|
|
846
|
-
/***/ }),
|
|
847
|
-
/* 10 */
|
|
1183
|
+
/* 17 */
|
|
848
1184
|
/***/ (function(module, exports, __webpack_require__) {
|
|
849
1185
|
|
|
850
1186
|
"use strict";
|
|
@@ -855,11 +1191,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
855
1191
|
});
|
|
856
1192
|
exports.migrateVizToSplunkBar = void 0;
|
|
857
1193
|
|
|
858
|
-
var
|
|
1194
|
+
var Bar_config_1 = __webpack_require__(18);
|
|
859
1195
|
|
|
860
|
-
var
|
|
1196
|
+
var splunk_charting_1 = __webpack_require__(2);
|
|
861
1197
|
|
|
862
|
-
var validOptions = Object.assign({},
|
|
1198
|
+
var validOptions = Object.assign({}, Bar_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
863
1199
|
|
|
864
1200
|
var defaultChanges = {
|
|
865
1201
|
yAxisAbbreviation: 'off',
|
|
@@ -881,13 +1217,13 @@ var migrateVizToSplunkBar = function migrateVizToSplunkBar(vizDefinition) {
|
|
|
881
1217
|
exports.migrateVizToSplunkBar = migrateVizToSplunkBar;
|
|
882
1218
|
|
|
883
1219
|
/***/ }),
|
|
884
|
-
/*
|
|
1220
|
+
/* 18 */
|
|
885
1221
|
/***/ (function(module, exports) {
|
|
886
1222
|
|
|
887
|
-
module.exports = require("@splunk/visualizations/Bar");
|
|
1223
|
+
module.exports = require("@splunk/visualizations/Bar.config");
|
|
888
1224
|
|
|
889
1225
|
/***/ }),
|
|
890
|
-
/*
|
|
1226
|
+
/* 19 */
|
|
891
1227
|
/***/ (function(module, exports, __webpack_require__) {
|
|
892
1228
|
|
|
893
1229
|
"use strict";
|
|
@@ -898,11 +1234,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
898
1234
|
});
|
|
899
1235
|
exports.migrateVizToSplunkBubble = void 0;
|
|
900
1236
|
|
|
901
|
-
var
|
|
1237
|
+
var Bubble_config_1 = __webpack_require__(20);
|
|
902
1238
|
|
|
903
|
-
var
|
|
1239
|
+
var splunk_charting_1 = __webpack_require__(2);
|
|
904
1240
|
|
|
905
|
-
var validOptions = Object.assign({},
|
|
1241
|
+
var validOptions = Object.assign({}, Bubble_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
906
1242
|
|
|
907
1243
|
var defaultChanges = {
|
|
908
1244
|
yAxisAbbreviation: 'off',
|
|
@@ -921,34 +1257,130 @@ var migrateVizToSplunkBubble = function migrateVizToSplunkBubble(vizDefinition)
|
|
|
921
1257
|
exports.migrateVizToSplunkBubble = migrateVizToSplunkBubble;
|
|
922
1258
|
|
|
923
1259
|
/***/ }),
|
|
924
|
-
/*
|
|
1260
|
+
/* 20 */
|
|
925
1261
|
/***/ (function(module, exports) {
|
|
926
1262
|
|
|
927
|
-
module.exports = require("@splunk/visualizations/Bubble");
|
|
1263
|
+
module.exports = require("@splunk/visualizations/Bubble.config");
|
|
928
1264
|
|
|
929
1265
|
/***/ }),
|
|
930
|
-
/*
|
|
1266
|
+
/* 21 */
|
|
931
1267
|
/***/ (function(module, exports, __webpack_require__) {
|
|
932
1268
|
|
|
933
1269
|
"use strict";
|
|
934
1270
|
|
|
935
1271
|
|
|
1272
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
1273
|
+
var t = {};
|
|
1274
|
+
|
|
1275
|
+
for (var p in s) {
|
|
1276
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1280
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1281
|
+
}
|
|
1282
|
+
return t;
|
|
1283
|
+
};
|
|
1284
|
+
|
|
936
1285
|
Object.defineProperty(exports, "__esModule", {
|
|
937
1286
|
value: true
|
|
938
1287
|
});
|
|
939
|
-
exports.
|
|
1288
|
+
exports.migrateVizToSplunkChoroplethSvg = void 0;
|
|
940
1289
|
|
|
941
|
-
var
|
|
1290
|
+
var ChoroplethSvg_config_1 = __webpack_require__(22);
|
|
942
1291
|
|
|
943
|
-
var
|
|
1292
|
+
var encoding_1 = __webpack_require__(1);
|
|
944
1293
|
|
|
945
|
-
var
|
|
1294
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
946
1295
|
|
|
947
|
-
var
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1296
|
+
var validOptions = Object.assign({}, ChoroplethSvg_config_1.default.optionsSchema);
|
|
1297
|
+
var optionRenames = {
|
|
1298
|
+
featureId: 'areaIds',
|
|
1299
|
+
value: 'areaValues',
|
|
1300
|
+
fill: 'areaColors'
|
|
1301
|
+
}; // old default encoding configurations should be retained in migrated configuration
|
|
1302
|
+
|
|
1303
|
+
var defaultOptionChanges = {
|
|
1304
|
+
areaIds: '> primary | seriesByIndex(0)',
|
|
1305
|
+
areaValues: '> primary | seriesByIndex(1)',
|
|
1306
|
+
areaColors: '> primary | seriesByIndex(1) | gradient(fillGradientContext)'
|
|
1307
|
+
};
|
|
1308
|
+
var defaultContextChanges = {
|
|
1309
|
+
fillGradientContext: {
|
|
1310
|
+
colors: ['#7EEFDA', '#6484F6', '#C093F9', '#293873']
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
var migrateVizToSplunkChoroplethSvg = function migrateVizToSplunkChoroplethSvg(vizDefinition) {
|
|
1315
|
+
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
1316
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1317
|
+
_vizDefinition$option = vizDefinition.options,
|
|
1318
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1319
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]); // translate encoding to dynamic options equivalent
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
1323
|
+
dataOptions = _encoding_1$encodingT.options,
|
|
1324
|
+
dataContext = _encoding_1$encodingT.context;
|
|
1325
|
+
|
|
1326
|
+
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1327
|
+
type: 'splunk.choropleth.svg',
|
|
1328
|
+
options: {},
|
|
1329
|
+
context: {}
|
|
1330
|
+
}); // add migrated option names and values
|
|
1331
|
+
|
|
1332
|
+
var migratedOptions = Object.assign({}, options);
|
|
1333
|
+
Object.keys(dataOptions).forEach(function (key) {
|
|
1334
|
+
var _a;
|
|
1335
|
+
|
|
1336
|
+
var updatedKey = (_a = optionRenames[key]) !== null && _a !== void 0 ? _a : key;
|
|
1337
|
+
migratedOptions[updatedKey] = dataOptions[key];
|
|
1338
|
+
}); // update migrated options and context
|
|
1339
|
+
|
|
1340
|
+
migratedDefinition.options = Object.assign(Object.assign({}, defaultOptionChanges), migratedOptions);
|
|
1341
|
+
migratedDefinition.context = encoding.fill ? dataContext : defaultContextChanges; // remove invalid options
|
|
1342
|
+
|
|
1343
|
+
migrationUtils_1.removeInvalidOptions(migratedDefinition.options, validOptions);
|
|
1344
|
+
return migratedDefinition;
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
exports.migrateVizToSplunkChoroplethSvg = migrateVizToSplunkChoroplethSvg;
|
|
1348
|
+
|
|
1349
|
+
/***/ }),
|
|
1350
|
+
/* 22 */
|
|
1351
|
+
/***/ (function(module, exports) {
|
|
1352
|
+
|
|
1353
|
+
module.exports = require("@splunk/visualizations/ChoroplethSvg.config");
|
|
1354
|
+
|
|
1355
|
+
/***/ }),
|
|
1356
|
+
/* 23 */
|
|
1357
|
+
/***/ (function(module, exports) {
|
|
1358
|
+
|
|
1359
|
+
module.exports = require("@splunk/visualization-encoding/utils/dsl");
|
|
1360
|
+
|
|
1361
|
+
/***/ }),
|
|
1362
|
+
/* 24 */
|
|
1363
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1364
|
+
|
|
1365
|
+
"use strict";
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1369
|
+
value: true
|
|
1370
|
+
});
|
|
1371
|
+
exports.migrateVizToSplunkColumn = void 0;
|
|
1372
|
+
|
|
1373
|
+
var Column_config_1 = __webpack_require__(25);
|
|
1374
|
+
|
|
1375
|
+
var splunk_charting_1 = __webpack_require__(2);
|
|
1376
|
+
|
|
1377
|
+
var validOptions = Object.assign({}, Column_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1378
|
+
|
|
1379
|
+
var defaultChanges = {
|
|
1380
|
+
yAxisAbbreviation: 'off',
|
|
1381
|
+
y2AxisAbbreviation: 'off',
|
|
1382
|
+
showRoundedY2AxisLabels: false,
|
|
1383
|
+
legendTruncation: 'ellipsisMiddle',
|
|
952
1384
|
showY2MajorGridLines: true
|
|
953
1385
|
};
|
|
954
1386
|
|
|
@@ -961,65 +1393,1021 @@ var migrateVizToSplunkColumn = function migrateVizToSplunkColumn(vizDefinition)
|
|
|
961
1393
|
});
|
|
962
1394
|
};
|
|
963
1395
|
|
|
964
|
-
exports.migrateVizToSplunkColumn = migrateVizToSplunkColumn;
|
|
1396
|
+
exports.migrateVizToSplunkColumn = migrateVizToSplunkColumn;
|
|
1397
|
+
|
|
1398
|
+
/***/ }),
|
|
1399
|
+
/* 25 */
|
|
1400
|
+
/***/ (function(module, exports) {
|
|
1401
|
+
|
|
1402
|
+
module.exports = require("@splunk/visualizations/Column.config");
|
|
1403
|
+
|
|
1404
|
+
/***/ }),
|
|
1405
|
+
/* 26 */
|
|
1406
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1407
|
+
|
|
1408
|
+
"use strict";
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
1412
|
+
var t = {};
|
|
1413
|
+
|
|
1414
|
+
for (var p in s) {
|
|
1415
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1419
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1420
|
+
}
|
|
1421
|
+
return t;
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1425
|
+
value: true
|
|
1426
|
+
});
|
|
1427
|
+
exports.migrateVizToSplunkEllipse = void 0;
|
|
1428
|
+
|
|
1429
|
+
var Ellipse_config_1 = __webpack_require__(27);
|
|
1430
|
+
|
|
1431
|
+
var encoding_1 = __webpack_require__(1);
|
|
1432
|
+
|
|
1433
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
1434
|
+
|
|
1435
|
+
var validOptions = Object.assign({}, Ellipse_config_1.default.optionsSchema);
|
|
1436
|
+
var optionsToRename = {
|
|
1437
|
+
fill: 'fillColor',
|
|
1438
|
+
stroke: 'strokeColor',
|
|
1439
|
+
strokeDasharray: 'strokeDashStyle'
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
var migrateVizToSplunkEllipse = function migrateVizToSplunkEllipse(vizDefinition) {
|
|
1443
|
+
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
1444
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1445
|
+
_vizDefinition$option = vizDefinition.options,
|
|
1446
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1447
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
1448
|
+
|
|
1449
|
+
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1450
|
+
type: 'splunk.ellipse',
|
|
1451
|
+
options: options,
|
|
1452
|
+
context: {}
|
|
1453
|
+
});
|
|
1454
|
+
|
|
1455
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
1456
|
+
dataOptions = _encoding_1$encodingT.options,
|
|
1457
|
+
dataContext = _encoding_1$encodingT.context; // To simulate the implicit logic in the shape parser that Ellipse utilizes, append
|
|
1458
|
+
// the lastPoint() DataSeries selector.
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
var updatedDataOptions = migrationUtils_1.addsDataSelectorToOptions(dataOptions, 'lastPoint()');
|
|
1462
|
+
migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions); // perform any option renaming
|
|
1463
|
+
|
|
1464
|
+
migratedDefinition.options = migrationUtils_1.renameVizOptions(migratedDefinition.options, optionsToRename); // remove invalid options from new definition
|
|
1465
|
+
|
|
1466
|
+
migrationUtils_1.removeInvalidOptions(migratedDefinition.options, validOptions);
|
|
1467
|
+
migratedDefinition.context = dataContext;
|
|
1468
|
+
return migratedDefinition;
|
|
1469
|
+
};
|
|
1470
|
+
|
|
1471
|
+
exports.migrateVizToSplunkEllipse = migrateVizToSplunkEllipse;
|
|
1472
|
+
|
|
1473
|
+
/***/ }),
|
|
1474
|
+
/* 27 */
|
|
1475
|
+
/***/ (function(module, exports) {
|
|
1476
|
+
|
|
1477
|
+
module.exports = require("@splunk/visualizations/Ellipse.config");
|
|
1478
|
+
|
|
1479
|
+
/***/ }),
|
|
1480
|
+
/* 28 */
|
|
1481
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1482
|
+
|
|
1483
|
+
"use strict";
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
1487
|
+
var t = {};
|
|
1488
|
+
|
|
1489
|
+
for (var p in s) {
|
|
1490
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1494
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1495
|
+
}
|
|
1496
|
+
return t;
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1500
|
+
value: true
|
|
1501
|
+
});
|
|
1502
|
+
exports.migrateVizToSplunkFillerGauge = void 0;
|
|
1503
|
+
|
|
1504
|
+
var FillerGauge_config_1 = __webpack_require__(29);
|
|
1505
|
+
|
|
1506
|
+
var encoding_1 = __webpack_require__(1);
|
|
1507
|
+
|
|
1508
|
+
var gauges_1 = __webpack_require__(7);
|
|
1509
|
+
|
|
1510
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
1511
|
+
|
|
1512
|
+
var validOptions = Object.assign({}, FillerGauge_config_1.default.optionsSchema);
|
|
1513
|
+
var optionRenames = {
|
|
1514
|
+
majorUnit: 'majorTickInterval'
|
|
1515
|
+
};
|
|
1516
|
+
var previousRangeValueConfig = [{
|
|
1517
|
+
to: 10,
|
|
1518
|
+
value: '#5fbcff'
|
|
1519
|
+
}, {
|
|
1520
|
+
from: 10,
|
|
1521
|
+
to: 30,
|
|
1522
|
+
value: '#4beba8'
|
|
1523
|
+
}, {
|
|
1524
|
+
from: 30,
|
|
1525
|
+
to: 50,
|
|
1526
|
+
value: '#f4df7a'
|
|
1527
|
+
}, {
|
|
1528
|
+
from: 50,
|
|
1529
|
+
to: 70,
|
|
1530
|
+
value: '#fc9850'
|
|
1531
|
+
}, {
|
|
1532
|
+
from: 70,
|
|
1533
|
+
to: 100,
|
|
1534
|
+
value: '#ff7152'
|
|
1535
|
+
}];
|
|
1536
|
+
var defaultChanges = {
|
|
1537
|
+
gaugeColor: '> value | rangeValue(gaugeColorRangeValueContext)',
|
|
1538
|
+
value: '> primary | seriesByIndex(0) | lastPoint()'
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1541
|
+
var migrateVizToSplunkFillerGauge = function migrateVizToSplunkFillerGauge(vizDefinition) {
|
|
1542
|
+
var _a;
|
|
1543
|
+
|
|
1544
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
1545
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1546
|
+
encoding = vizDefinition.encoding,
|
|
1547
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
1548
|
+
|
|
1549
|
+
var migratedVisualization = Object.assign(Object.assign({
|
|
1550
|
+
options: options
|
|
1551
|
+
}, otherDefinitionParts), {
|
|
1552
|
+
type: 'splunk.fillergauge',
|
|
1553
|
+
context: {}
|
|
1554
|
+
});
|
|
1555
|
+
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
1556
|
+
|
|
1557
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
1558
|
+
encodingOptions = _encoding_1$encodingT.options,
|
|
1559
|
+
gaugeColorContext = _encoding_1$encodingT.context; // if a viz.fillergauge receives an entire column for `value` (e.g. primary[0]), it will select the last value of the column
|
|
1560
|
+
// this contrasts with viz.markergauge (which takes the first point of the column)
|
|
1561
|
+
// this is due to differing behavior in the FillerGaugeParser, which explicitly retrieves the last point in a received array
|
|
1562
|
+
// https://cd.splunkdev.com/devplat/vision/-/blob/main/packages/visualization-encoding-parsers/src/FillerGaugeParser.js#L79
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
var originalGaugeValue = encodingOptions.value;
|
|
1566
|
+
|
|
1567
|
+
if (typeof originalGaugeValue === 'string') {
|
|
1568
|
+
encodingOptions.value = (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalGaugeValue, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
if (encodingOptions === null || encodingOptions === void 0 ? void 0 : encodingOptions.gaugeColor) {
|
|
1572
|
+
migratedVisualization.context = gaugeColorContext;
|
|
1573
|
+
} else {
|
|
1574
|
+
// preserve the default context if no gaugeColor encoding was configured
|
|
1575
|
+
migratedVisualization.context = {
|
|
1576
|
+
gaugeColorRangeValueContext: previousRangeValueConfig
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
var showLabels = options.showLabels,
|
|
1581
|
+
usePercentageRange = options.usePercentageRange,
|
|
1582
|
+
showValue = options.showValue,
|
|
1583
|
+
usePercentageValue = options.usePercentageValue;
|
|
1584
|
+
var labelDisplay = gauges_1.consolidateDisplayOption(showLabels, usePercentageRange);
|
|
1585
|
+
var valueDisplay = gauges_1.consolidateDisplayOption(showValue, usePercentageValue);
|
|
1586
|
+
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultChanges), renamedOptions), encodingOptions), typeof labelDisplay === 'string' && {
|
|
1587
|
+
labelDisplay: labelDisplay
|
|
1588
|
+
}), typeof valueDisplay === 'string' && {
|
|
1589
|
+
valueDisplay: valueDisplay
|
|
1590
|
+
}); // remove invalid options using the optionsSchema for splunk.fillergauge as reference
|
|
1591
|
+
|
|
1592
|
+
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
1593
|
+
return migratedVisualization;
|
|
1594
|
+
};
|
|
1595
|
+
|
|
1596
|
+
exports.migrateVizToSplunkFillerGauge = migrateVizToSplunkFillerGauge;
|
|
1597
|
+
|
|
1598
|
+
/***/ }),
|
|
1599
|
+
/* 29 */
|
|
1600
|
+
/***/ (function(module, exports) {
|
|
1601
|
+
|
|
1602
|
+
module.exports = require("@splunk/visualizations/FillerGauge.config");
|
|
1603
|
+
|
|
1604
|
+
/***/ }),
|
|
1605
|
+
/* 30 */
|
|
1606
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1607
|
+
|
|
1608
|
+
"use strict";
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1612
|
+
value: true
|
|
1613
|
+
});
|
|
1614
|
+
exports.migrateVizToSplunkLine = void 0;
|
|
1615
|
+
|
|
1616
|
+
var Line_config_1 = __webpack_require__(31);
|
|
1617
|
+
|
|
1618
|
+
var splunk_charting_1 = __webpack_require__(2);
|
|
1619
|
+
|
|
1620
|
+
var validOptions = Object.assign({}, Line_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1621
|
+
|
|
1622
|
+
var defaultChanges = {
|
|
1623
|
+
yAxisAbbreviation: 'off',
|
|
1624
|
+
y2AxisAbbreviation: 'off',
|
|
1625
|
+
showRoundedY2AxisLabels: false,
|
|
1626
|
+
legendTruncation: 'ellipsisMiddle',
|
|
1627
|
+
showY2MajorGridLines: true,
|
|
1628
|
+
markerDisplay: 'outlined'
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1631
|
+
var migrateVizToSplunkLine = function migrateVizToSplunkLine(vizDefinition) {
|
|
1632
|
+
return splunk_charting_1.migrateBaseChartingVizDefinition({
|
|
1633
|
+
defaultChanges: defaultChanges,
|
|
1634
|
+
validOptions: validOptions,
|
|
1635
|
+
vizDefinition: vizDefinition,
|
|
1636
|
+
vizType: 'splunk.line'
|
|
1637
|
+
});
|
|
1638
|
+
};
|
|
1639
|
+
|
|
1640
|
+
exports.migrateVizToSplunkLine = migrateVizToSplunkLine;
|
|
1641
|
+
|
|
1642
|
+
/***/ }),
|
|
1643
|
+
/* 31 */
|
|
1644
|
+
/***/ (function(module, exports) {
|
|
1645
|
+
|
|
1646
|
+
module.exports = require("@splunk/visualizations/Line.config");
|
|
1647
|
+
|
|
1648
|
+
/***/ }),
|
|
1649
|
+
/* 32 */
|
|
1650
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1651
|
+
|
|
1652
|
+
"use strict";
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
1656
|
+
var t = {};
|
|
1657
|
+
|
|
1658
|
+
for (var p in s) {
|
|
1659
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1663
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1664
|
+
}
|
|
1665
|
+
return t;
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1669
|
+
value: true
|
|
1670
|
+
});
|
|
1671
|
+
exports.migrateVizToSplunkImage = void 0;
|
|
1672
|
+
|
|
1673
|
+
var Image_config_1 = __webpack_require__(33);
|
|
1674
|
+
|
|
1675
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
1676
|
+
|
|
1677
|
+
var validOptions = Object.assign({}, Image_config_1.default.optionsSchema);
|
|
1678
|
+
|
|
1679
|
+
var migrateVizToSplunkImage = function migrateVizToSplunkImage(vizDefinition) {
|
|
1680
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
1681
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1682
|
+
otherDefinitionParts = __rest(vizDefinition, ["options"]);
|
|
1683
|
+
|
|
1684
|
+
var migratedVisualization = Object.assign(Object.assign({
|
|
1685
|
+
options: options
|
|
1686
|
+
}, otherDefinitionParts), {
|
|
1687
|
+
type: 'splunk.image',
|
|
1688
|
+
context: {}
|
|
1689
|
+
}); // remove invalid options using the optionsSchema for splunk.image as reference
|
|
1690
|
+
|
|
1691
|
+
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
1692
|
+
return migratedVisualization;
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
exports.migrateVizToSplunkImage = migrateVizToSplunkImage;
|
|
1696
|
+
|
|
1697
|
+
/***/ }),
|
|
1698
|
+
/* 33 */
|
|
1699
|
+
/***/ (function(module, exports) {
|
|
1700
|
+
|
|
1701
|
+
module.exports = require("@splunk/visualizations/Image.config");
|
|
1702
|
+
|
|
1703
|
+
/***/ }),
|
|
1704
|
+
/* 34 */
|
|
1705
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1706
|
+
|
|
1707
|
+
"use strict";
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
1711
|
+
var t = {};
|
|
1712
|
+
|
|
1713
|
+
for (var p in s) {
|
|
1714
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1718
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1719
|
+
}
|
|
1720
|
+
return t;
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1723
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1724
|
+
value: true
|
|
1725
|
+
});
|
|
1726
|
+
exports.migrateVizToSplunkMarkdown = void 0;
|
|
1727
|
+
|
|
1728
|
+
var Markdown_config_1 = __webpack_require__(8);
|
|
1729
|
+
|
|
1730
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
1731
|
+
|
|
1732
|
+
var validOptions = Object.assign({}, Markdown_config_1.default.optionsSchema);
|
|
1733
|
+
|
|
1734
|
+
var migrateVizToSplunkMarkdown = function migrateVizToSplunkMarkdown(vizDefinition) {
|
|
1735
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
1736
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1737
|
+
otherDefinitionParts = __rest(vizDefinition, ["options"]);
|
|
1738
|
+
|
|
1739
|
+
var migratedVisualization = Object.assign(Object.assign({
|
|
1740
|
+
options: options
|
|
1741
|
+
}, otherDefinitionParts), {
|
|
1742
|
+
type: 'splunk.markdown',
|
|
1743
|
+
context: {}
|
|
1744
|
+
}); // remove invalid options using the optionsSchema for splunk.markdown as reference
|
|
1745
|
+
|
|
1746
|
+
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
1747
|
+
return migratedVisualization;
|
|
1748
|
+
};
|
|
1749
|
+
|
|
1750
|
+
exports.migrateVizToSplunkMarkdown = migrateVizToSplunkMarkdown;
|
|
1751
|
+
|
|
1752
|
+
/***/ }),
|
|
1753
|
+
/* 35 */
|
|
1754
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1755
|
+
|
|
1756
|
+
"use strict";
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
1760
|
+
var t = {};
|
|
1761
|
+
|
|
1762
|
+
for (var p in s) {
|
|
1763
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1767
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1768
|
+
}
|
|
1769
|
+
return t;
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1773
|
+
value: true
|
|
1774
|
+
});
|
|
1775
|
+
exports.migrateVizToSplunkMarkerGauge = void 0;
|
|
1776
|
+
|
|
1777
|
+
var MarkerGauge_config_1 = __webpack_require__(36);
|
|
1778
|
+
|
|
1779
|
+
var encoding_1 = __webpack_require__(1);
|
|
1780
|
+
|
|
1781
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
1782
|
+
|
|
1783
|
+
var gauges_1 = __webpack_require__(7);
|
|
1784
|
+
|
|
1785
|
+
var validOptions = Object.assign({}, MarkerGauge_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1786
|
+
|
|
1787
|
+
var defaultChanges = {
|
|
1788
|
+
gaugeRanges: [{
|
|
1789
|
+
from: 90,
|
|
1790
|
+
to: 100,
|
|
1791
|
+
value: '#CB3B43'
|
|
1792
|
+
}, {
|
|
1793
|
+
from: 50,
|
|
1794
|
+
to: 90,
|
|
1795
|
+
value: '#F4DF7A'
|
|
1796
|
+
}, {
|
|
1797
|
+
from: 0,
|
|
1798
|
+
to: 50,
|
|
1799
|
+
value: '#4BEBA8'
|
|
1800
|
+
}],
|
|
1801
|
+
value: '> primary | seriesByIndex(0) | lastPoint()'
|
|
1802
|
+
};
|
|
1803
|
+
var optionRenames = {
|
|
1804
|
+
majorUnit: 'majorTickInterval',
|
|
1805
|
+
ranges: 'gaugeRanges'
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1808
|
+
var migrateVizToSplunkMarkerGauge = function migrateVizToSplunkMarkerGauge(vizDefinition) {
|
|
1809
|
+
var _a;
|
|
1810
|
+
|
|
1811
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
1812
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1813
|
+
encoding = vizDefinition.encoding,
|
|
1814
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
1815
|
+
|
|
1816
|
+
var migratedVisualization = Object.assign(Object.assign({
|
|
1817
|
+
options: options
|
|
1818
|
+
}, otherDefinitionParts), {
|
|
1819
|
+
type: 'splunk.markergauge',
|
|
1820
|
+
context: {}
|
|
1821
|
+
});
|
|
1822
|
+
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
1823
|
+
|
|
1824
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
1825
|
+
dataOptions = _encoding_1$encodingT.options; // viz.markergauge has behavior where if a column without a specific point (e.g. primary[1]) is selected,
|
|
1826
|
+
// the markerGauge will only display the first point of the column
|
|
1827
|
+
// the following logic accounts for this and appends firstPoint() to the DSL statement
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
var originalGaugeValue = dataOptions.value;
|
|
1831
|
+
|
|
1832
|
+
if (typeof originalGaugeValue === 'string') {
|
|
1833
|
+
dataOptions.value = (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalGaugeValue, 'firstPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
var showLabels = renamedOptions.showLabels,
|
|
1837
|
+
usePercentageRange = renamedOptions.usePercentageRange,
|
|
1838
|
+
showValue = renamedOptions.showValue,
|
|
1839
|
+
usePercentageValue = renamedOptions.usePercentageValue;
|
|
1840
|
+
var labelDisplay = gauges_1.consolidateDisplayOption(showLabels, usePercentageRange);
|
|
1841
|
+
var valueDisplay = gauges_1.consolidateDisplayOption(showValue, usePercentageValue);
|
|
1842
|
+
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultChanges), renamedOptions), dataOptions), typeof labelDisplay === 'string' && {
|
|
1843
|
+
labelDisplay: labelDisplay
|
|
1844
|
+
}), typeof valueDisplay === 'string' && {
|
|
1845
|
+
valueDisplay: valueDisplay
|
|
1846
|
+
}); // remove invalid options using the optionsSchema for splunk.markergauge as reference
|
|
1847
|
+
|
|
1848
|
+
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
1849
|
+
return migratedVisualization;
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
exports.migrateVizToSplunkMarkerGauge = migrateVizToSplunkMarkerGauge;
|
|
1853
|
+
|
|
1854
|
+
/***/ }),
|
|
1855
|
+
/* 36 */
|
|
1856
|
+
/***/ (function(module, exports) {
|
|
1857
|
+
|
|
1858
|
+
module.exports = require("@splunk/visualizations/MarkerGauge.config");
|
|
1859
|
+
|
|
1860
|
+
/***/ }),
|
|
1861
|
+
/* 37 */
|
|
1862
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1863
|
+
|
|
1864
|
+
"use strict";
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
1868
|
+
var t = {};
|
|
1869
|
+
|
|
1870
|
+
for (var p in s) {
|
|
1871
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1875
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1876
|
+
}
|
|
1877
|
+
return t;
|
|
1878
|
+
};
|
|
1879
|
+
|
|
1880
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1881
|
+
value: true
|
|
1882
|
+
});
|
|
1883
|
+
exports.migrateVizToSplunkPie = void 0;
|
|
1884
|
+
|
|
1885
|
+
var Pie_config_1 = __webpack_require__(38);
|
|
1886
|
+
|
|
1887
|
+
var encoding_1 = __webpack_require__(1);
|
|
1888
|
+
|
|
1889
|
+
var splunk_charting_1 = __webpack_require__(2);
|
|
1890
|
+
|
|
1891
|
+
var validOptions = Object.assign({}, Pie_config_1.default.optionsSchema);
|
|
1892
|
+
|
|
1893
|
+
var migratePieChartLabelAndPercent = function migratePieChartLabelAndPercent(options) {
|
|
1894
|
+
// if neither chart.showLabels or chart.showPercent is specified in viz.pie,
|
|
1895
|
+
// splunk.pie use the default labelDisplay value
|
|
1896
|
+
if (!('chart.showLabels' in options) && !('chart.showPercent' in options)) {
|
|
1897
|
+
return {};
|
|
1898
|
+
} // if only chart.showPercent is specified in viz.pie
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
if (!('chart.showLabels' in options) && 'chart.showPercent' in options) {
|
|
1902
|
+
return {
|
|
1903
|
+
labelDisplay: options['chart.showPercent'] ? 'valuesAndPercentage' : 'values'
|
|
1904
|
+
};
|
|
1905
|
+
} // if only chart.showLabels is specified in viz.pie
|
|
1906
|
+
|
|
1907
|
+
|
|
1908
|
+
if ('chart.showLabels' in options && !('chart.showPercent' in options)) {
|
|
1909
|
+
return {
|
|
1910
|
+
labelDisplay: options['chart.showLabels'] ? 'values' : 'off'
|
|
1911
|
+
};
|
|
1912
|
+
} // if both chart.showLabels and chart.showPercent are specified in viz.pie
|
|
1913
|
+
|
|
1914
|
+
|
|
1915
|
+
var labelOption = {
|
|
1916
|
+
labelDisplay: 'values'
|
|
1917
|
+
};
|
|
1918
|
+
|
|
1919
|
+
if (options['chart.showLabels'] && options['chart.showPercent']) {
|
|
1920
|
+
labelOption.labelDisplay = 'valuesAndPercentage';
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
if (!options['chart.showLabels']) {
|
|
1924
|
+
labelOption.labelDisplay = 'off';
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
return labelOption;
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
var migrateFieldColors = function migrateFieldColors(options) {
|
|
1931
|
+
if ('fieldColors' in options) {
|
|
1932
|
+
return {
|
|
1933
|
+
seriesColorsByField: splunk_charting_1.otherValueReplacements.seriesColorsByField(options.fieldColors)
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
return {};
|
|
1938
|
+
};
|
|
1939
|
+
|
|
1940
|
+
var migrateVizToSplunkPie = function migrateVizToSplunkPie(vizDefinition) {
|
|
1941
|
+
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
1942
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1943
|
+
_vizDefinition$option = vizDefinition.options,
|
|
1944
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1945
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
1946
|
+
|
|
1947
|
+
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1948
|
+
type: 'splunk.pie',
|
|
1949
|
+
options: {},
|
|
1950
|
+
context: {}
|
|
1951
|
+
}); // translate encoding to dynamic options equivalent
|
|
1952
|
+
|
|
1953
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
1954
|
+
dataOptions = _encoding_1$encodingT.options,
|
|
1955
|
+
dataContext = _encoding_1$encodingT.context;
|
|
1956
|
+
|
|
1957
|
+
var migratedOptions = Object.assign(Object.assign(Object.assign(Object.assign({}, migratePieChartLabelAndPercent(options)), splunk_charting_1.migrateChartingOptions(options)), migrateFieldColors(options)), dataOptions); // remove invalid options
|
|
1958
|
+
|
|
1959
|
+
Object.keys(migratedOptions).forEach(function (key) {
|
|
1960
|
+
if (!validOptions[key]) {
|
|
1961
|
+
delete migratedOptions[key];
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
migratedDefinition.options = migratedOptions;
|
|
1965
|
+
migratedDefinition.context = dataContext;
|
|
1966
|
+
return migratedDefinition;
|
|
1967
|
+
};
|
|
1968
|
+
|
|
1969
|
+
exports.migrateVizToSplunkPie = migrateVizToSplunkPie;
|
|
1970
|
+
|
|
1971
|
+
/***/ }),
|
|
1972
|
+
/* 38 */
|
|
1973
|
+
/***/ (function(module, exports) {
|
|
1974
|
+
|
|
1975
|
+
module.exports = require("@splunk/visualizations/Pie.config");
|
|
1976
|
+
|
|
1977
|
+
/***/ }),
|
|
1978
|
+
/* 39 */
|
|
1979
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1980
|
+
|
|
1981
|
+
"use strict";
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1985
|
+
value: true
|
|
1986
|
+
});
|
|
1987
|
+
exports.migrateVizToSplunkScatter = void 0;
|
|
1988
|
+
|
|
1989
|
+
var Scatter_config_1 = __webpack_require__(40);
|
|
1990
|
+
|
|
1991
|
+
var splunk_charting_1 = __webpack_require__(2);
|
|
1992
|
+
|
|
1993
|
+
var validOptions = Object.assign({}, Scatter_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1994
|
+
|
|
1995
|
+
var defaultChanges = {
|
|
1996
|
+
yAxisAbbreviation: 'off',
|
|
1997
|
+
legendTruncation: 'ellipsisMiddle'
|
|
1998
|
+
};
|
|
1999
|
+
|
|
2000
|
+
var migrateVizToSplunkScatter = function migrateVizToSplunkScatter(vizDefinition) {
|
|
2001
|
+
return splunk_charting_1.migrateBaseChartingVizDefinition({
|
|
2002
|
+
defaultChanges: defaultChanges,
|
|
2003
|
+
validOptions: validOptions,
|
|
2004
|
+
vizDefinition: vizDefinition,
|
|
2005
|
+
vizType: 'splunk.scatter'
|
|
2006
|
+
});
|
|
2007
|
+
};
|
|
2008
|
+
|
|
2009
|
+
exports.migrateVizToSplunkScatter = migrateVizToSplunkScatter;
|
|
2010
|
+
|
|
2011
|
+
/***/ }),
|
|
2012
|
+
/* 40 */
|
|
2013
|
+
/***/ (function(module, exports) {
|
|
2014
|
+
|
|
2015
|
+
module.exports = require("@splunk/visualizations/Scatter.config");
|
|
2016
|
+
|
|
2017
|
+
/***/ }),
|
|
2018
|
+
/* 41 */
|
|
2019
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2020
|
+
|
|
2021
|
+
"use strict";
|
|
2022
|
+
|
|
2023
|
+
|
|
2024
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2025
|
+
var t = {};
|
|
2026
|
+
|
|
2027
|
+
for (var p in s) {
|
|
2028
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2032
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2033
|
+
}
|
|
2034
|
+
return t;
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2038
|
+
value: true
|
|
2039
|
+
});
|
|
2040
|
+
exports.migrateVizToSplunkRectangle = void 0;
|
|
2041
|
+
|
|
2042
|
+
var Rectangle_config_1 = __webpack_require__(42);
|
|
2043
|
+
|
|
2044
|
+
var encoding_1 = __webpack_require__(1);
|
|
2045
|
+
|
|
2046
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
2047
|
+
|
|
2048
|
+
var optionsToRename = {
|
|
2049
|
+
fill: 'fillColor',
|
|
2050
|
+
stroke: 'strokeColor',
|
|
2051
|
+
strokeDasharray: 'strokeDashStyle',
|
|
2052
|
+
strokeLinejoin: 'strokeJoinStyle'
|
|
2053
|
+
};
|
|
2054
|
+
var validOptions = Object.assign({}, Rectangle_config_1.default.optionsSchema);
|
|
2055
|
+
|
|
2056
|
+
var migrateVizToSplunkRectangle = function migrateVizToSplunkRectangle(vizDefinition) {
|
|
2057
|
+
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
2058
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2059
|
+
options = vizDefinition.options,
|
|
2060
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
2061
|
+
|
|
2062
|
+
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
2063
|
+
type: 'splunk.rectangle',
|
|
2064
|
+
options: {},
|
|
2065
|
+
context: {}
|
|
2066
|
+
}); // translate encoding to dynamic options equivalent
|
|
2067
|
+
|
|
2068
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
2069
|
+
dataOptions = _encoding_1$encodingT.options,
|
|
2070
|
+
dataContext = _encoding_1$encodingT.context; // To simulate the implicit logic in the shape parser that Rectangle utilizes, append
|
|
2071
|
+
// the lastPoint() DataSeries selector.
|
|
2072
|
+
|
|
2073
|
+
|
|
2074
|
+
var updatedDataOptions = migrationUtils_1.addsDataSelectorToOptions(dataOptions, 'lastPoint()');
|
|
2075
|
+
migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions); // perform option rename
|
|
2076
|
+
|
|
2077
|
+
migratedDefinition.options = migrationUtils_1.renameVizOptions(migratedDefinition.options, optionsToRename); // remove invalid options, validOptions is taken from the config.optionsSchema
|
|
2078
|
+
|
|
2079
|
+
migrationUtils_1.removeInvalidOptions(migratedDefinition.options, validOptions);
|
|
2080
|
+
migratedDefinition.context = dataContext;
|
|
2081
|
+
return migratedDefinition;
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
exports.migrateVizToSplunkRectangle = migrateVizToSplunkRectangle;
|
|
2085
|
+
|
|
2086
|
+
/***/ }),
|
|
2087
|
+
/* 42 */
|
|
2088
|
+
/***/ (function(module, exports) {
|
|
2089
|
+
|
|
2090
|
+
module.exports = require("@splunk/visualizations/Rectangle.config");
|
|
2091
|
+
|
|
2092
|
+
/***/ }),
|
|
2093
|
+
/* 43 */
|
|
2094
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2095
|
+
|
|
2096
|
+
"use strict";
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2100
|
+
var t = {};
|
|
2101
|
+
|
|
2102
|
+
for (var p in s) {
|
|
2103
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2107
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2108
|
+
}
|
|
2109
|
+
return t;
|
|
2110
|
+
};
|
|
2111
|
+
|
|
2112
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2113
|
+
value: true
|
|
2114
|
+
});
|
|
2115
|
+
exports.migrateVizToSplunkSingleValue = void 0;
|
|
2116
|
+
|
|
2117
|
+
var SingleValue_config_1 = __webpack_require__(44);
|
|
2118
|
+
|
|
2119
|
+
var encoding_1 = __webpack_require__(1);
|
|
2120
|
+
|
|
2121
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
2122
|
+
|
|
2123
|
+
var singlevalue_1 = __webpack_require__(3);
|
|
2124
|
+
|
|
2125
|
+
var validOptions = Object.assign({}, SingleValue_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
2126
|
+
|
|
2127
|
+
var defaultsToRetain = {
|
|
2128
|
+
showSparklineAreaGraph: false,
|
|
2129
|
+
sparklineValues: '> primary | seriesByTypes("number", "string")'
|
|
2130
|
+
};
|
|
2131
|
+
var optionRenames = {
|
|
2132
|
+
useTrendUnits: 'shouldAbbreviateTrendValue',
|
|
2133
|
+
useThousandSeparators: 'shouldUseThousandSeparators',
|
|
2134
|
+
sparklineAreaGraph: 'showSparklineAreaGraph',
|
|
2135
|
+
sparklineFillColor: 'sparklineAreaColor',
|
|
2136
|
+
sparklineAcceptNullData: 'shouldSparklineAcceptNullData',
|
|
2137
|
+
deltaFontSize: 'trendFontSize'
|
|
2138
|
+
};
|
|
2139
|
+
/**
|
|
2140
|
+
* Helper function to consolidate `sparklinePosition` - before/after/below
|
|
2141
|
+
* and `showSparkline` - true/false into `sparklineDisplay` - off/before/after/below
|
|
2142
|
+
* 1. if `showSparkline` is explicitly false, `sparklineDisplay` is off
|
|
2143
|
+
* 2. if `showSparkline` is undefined (defaults to true), return `sparklinePosition` value if present
|
|
2144
|
+
* 3. if `showSparkline` is explicitly true, return 'below'
|
|
2145
|
+
* 4. if both the old options are undefined, return nothing as their defaults (true and `below`)
|
|
2146
|
+
* correspond to `sparklineDisplay` default - below
|
|
2147
|
+
*/
|
|
2148
|
+
|
|
2149
|
+
var consolidateSparklineDisplay = function consolidateSparklineDisplay(sparklinePosition, showSparkline) {
|
|
2150
|
+
if (showSparkline === false) {
|
|
2151
|
+
return 'off';
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
if (['before', 'after', 'below'].includes(sparklinePosition)) {
|
|
2155
|
+
return sparklinePosition;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
if (showSparkline === true) {
|
|
2159
|
+
return 'below';
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
return null;
|
|
2163
|
+
};
|
|
2164
|
+
|
|
2165
|
+
var migrateVizToSplunkSingleValue = function migrateVizToSplunkSingleValue(vizDefinition) {
|
|
2166
|
+
var _a, _b, _c;
|
|
2167
|
+
|
|
2168
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
2169
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2170
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
2171
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2172
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
2173
|
+
|
|
2174
|
+
var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
2175
|
+
type: 'splunk.singlevalue',
|
|
2176
|
+
context: {},
|
|
2177
|
+
options: {}
|
|
2178
|
+
});
|
|
2179
|
+
|
|
2180
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
2181
|
+
dataOptions = _encoding_1$encodingT.options,
|
|
2182
|
+
dataContext = _encoding_1$encodingT.context;
|
|
2183
|
+
|
|
2184
|
+
var migratedDataOptions = Object.assign(Object.assign(Object.assign(Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.trend) && {
|
|
2185
|
+
sparklineValues: dataOptions.trend
|
|
2186
|
+
}), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.majorColor) && {
|
|
2187
|
+
majorColor: (_a = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.majorColor, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.majorColor
|
|
2188
|
+
}), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.deltaColor) && {
|
|
2189
|
+
trendColor: (_b = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.deltaColor, 'lastPoint()')) !== null && _b !== void 0 ? _b : dataOptions.deltaColor
|
|
2190
|
+
}), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.fill) && {
|
|
2191
|
+
backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.fill, 'lastPoint()')) !== null && _c !== void 0 ? _c : dataOptions.fill
|
|
2192
|
+
});
|
|
2193
|
+
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
2194
|
+
var trendDisplayMode = renamedOptions.trendDisplayMode,
|
|
2195
|
+
showTrendIndicator = renamedOptions.showTrendIndicator,
|
|
2196
|
+
showSparkline = renamedOptions.showSparkline,
|
|
2197
|
+
sparklinePosition = renamedOptions.sparklinePosition;
|
|
2198
|
+
var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
|
|
2199
|
+
var sparklineDisplay = consolidateSparklineDisplay(sparklinePosition, showSparkline);
|
|
2200
|
+
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
|
|
2201
|
+
trendDisplay: trendDisplay
|
|
2202
|
+
}), typeof sparklineDisplay === 'string' && {
|
|
2203
|
+
sparklineDisplay: sparklineDisplay
|
|
2204
|
+
});
|
|
2205
|
+
migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalue as reference
|
|
2206
|
+
|
|
2207
|
+
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
2208
|
+
return migratedVisualization;
|
|
2209
|
+
};
|
|
2210
|
+
|
|
2211
|
+
exports.migrateVizToSplunkSingleValue = migrateVizToSplunkSingleValue;
|
|
2212
|
+
|
|
2213
|
+
/***/ }),
|
|
2214
|
+
/* 44 */
|
|
2215
|
+
/***/ (function(module, exports) {
|
|
2216
|
+
|
|
2217
|
+
module.exports = require("@splunk/visualizations/SingleValue.config");
|
|
2218
|
+
|
|
2219
|
+
/***/ }),
|
|
2220
|
+
/* 45 */
|
|
2221
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2222
|
+
|
|
2223
|
+
"use strict";
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2227
|
+
var t = {};
|
|
2228
|
+
|
|
2229
|
+
for (var p in s) {
|
|
2230
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2234
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2235
|
+
}
|
|
2236
|
+
return t;
|
|
2237
|
+
};
|
|
2238
|
+
|
|
2239
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2240
|
+
value: true
|
|
2241
|
+
});
|
|
2242
|
+
exports.migrateVizToSplunkSingleValueIcon = void 0;
|
|
2243
|
+
|
|
2244
|
+
var SingleValueIcon_config_1 = __webpack_require__(46);
|
|
2245
|
+
|
|
2246
|
+
var encoding_1 = __webpack_require__(1);
|
|
2247
|
+
|
|
2248
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
2249
|
+
|
|
2250
|
+
var singlevalue_1 = __webpack_require__(3);
|
|
2251
|
+
|
|
2252
|
+
var validOptions = Object.assign({}, SingleValueIcon_config_1.default.optionsSchema);
|
|
2253
|
+
var defaultsToRetain = {
|
|
2254
|
+
majorValue: '> primary | seriesByIndex(0) | lastPoint()',
|
|
2255
|
+
trendValue: '> primary | seriesByIndex(0) | delta(-2)'
|
|
2256
|
+
};
|
|
2257
|
+
var optionsToRename = {
|
|
2258
|
+
useTrendUnits: 'shouldAbbreviateTrendValue',
|
|
2259
|
+
useThousandSeparators: 'shouldUseThousandSeparators',
|
|
2260
|
+
deltaColor: 'trendColor',
|
|
2261
|
+
color: 'iconColor'
|
|
2262
|
+
};
|
|
2263
|
+
|
|
2264
|
+
var migrateVizToSplunkSingleValueIcon = function migrateVizToSplunkSingleValueIcon(vizDefinition) {
|
|
2265
|
+
var _a, _b, _c;
|
|
2266
|
+
|
|
2267
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
2268
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2269
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
2270
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2271
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
2272
|
+
|
|
2273
|
+
var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
2274
|
+
type: 'splunk.singlevalueicon',
|
|
2275
|
+
context: {},
|
|
2276
|
+
options: {}
|
|
2277
|
+
});
|
|
2278
|
+
|
|
2279
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
2280
|
+
dataOptions = _encoding_1$encodingT.options,
|
|
2281
|
+
dataContext = _encoding_1$encodingT.context;
|
|
2282
|
+
|
|
2283
|
+
var migratedDataOptions = Object.assign(Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.trend) && {
|
|
2284
|
+
majorValue: (_a = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.trend, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.trend,
|
|
2285
|
+
trendValue: (_b = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.trend, 'delta(-2)')) !== null && _b !== void 0 ? _b : dataOptions.trend
|
|
2286
|
+
}), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.fill) && {
|
|
2287
|
+
backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.fill, 'lastPoint()')) !== null && _c !== void 0 ? _c : dataOptions.fill
|
|
2288
|
+
});
|
|
2289
|
+
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionsToRename);
|
|
2290
|
+
var trendDisplayMode = renamedOptions.trendDisplayMode,
|
|
2291
|
+
showTrendIndicator = renamedOptions.showTrendIndicator;
|
|
2292
|
+
var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
|
|
2293
|
+
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
|
|
2294
|
+
trendDisplay: trendDisplay
|
|
2295
|
+
});
|
|
2296
|
+
migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueicon as reference
|
|
2297
|
+
|
|
2298
|
+
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
2299
|
+
return migratedVisualization;
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2302
|
+
exports.migrateVizToSplunkSingleValueIcon = migrateVizToSplunkSingleValueIcon;
|
|
965
2303
|
|
|
966
2304
|
/***/ }),
|
|
967
|
-
/*
|
|
2305
|
+
/* 46 */
|
|
968
2306
|
/***/ (function(module, exports) {
|
|
969
2307
|
|
|
970
|
-
module.exports = require("@splunk/visualizations/
|
|
2308
|
+
module.exports = require("@splunk/visualizations/SingleValueIcon.config");
|
|
971
2309
|
|
|
972
2310
|
/***/ }),
|
|
973
|
-
/*
|
|
2311
|
+
/* 47 */
|
|
974
2312
|
/***/ (function(module, exports, __webpack_require__) {
|
|
975
2313
|
|
|
976
2314
|
"use strict";
|
|
977
2315
|
|
|
978
2316
|
|
|
2317
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2318
|
+
var t = {};
|
|
2319
|
+
|
|
2320
|
+
for (var p in s) {
|
|
2321
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2325
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2326
|
+
}
|
|
2327
|
+
return t;
|
|
2328
|
+
};
|
|
2329
|
+
|
|
979
2330
|
Object.defineProperty(exports, "__esModule", {
|
|
980
2331
|
value: true
|
|
981
2332
|
});
|
|
982
|
-
exports.
|
|
2333
|
+
exports.migrateVizToSplunkSingleValueRadial = void 0;
|
|
983
2334
|
|
|
984
|
-
var
|
|
2335
|
+
var SingleValueRadial_config_1 = __webpack_require__(48);
|
|
985
2336
|
|
|
986
|
-
var
|
|
2337
|
+
var encoding_1 = __webpack_require__(1);
|
|
987
2338
|
|
|
988
|
-
var
|
|
2339
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
989
2340
|
|
|
990
|
-
var
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
2341
|
+
var singlevalue_1 = __webpack_require__(3);
|
|
2342
|
+
|
|
2343
|
+
var validOptions = Object.assign({}, SingleValueRadial_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
2344
|
+
|
|
2345
|
+
var defaultsToRetain = {
|
|
2346
|
+
majorValue: '> primary | seriesByIndex(0) | lastPoint()',
|
|
2347
|
+
trendValue: '> primary | seriesByIndex(0) | delta(-2)'
|
|
2348
|
+
};
|
|
2349
|
+
var optionRenames = {
|
|
2350
|
+
useTrendUnits: 'shouldAbbreviateTrendValue',
|
|
2351
|
+
useThousandSeparators: 'shouldUseThousandSeparators'
|
|
997
2352
|
};
|
|
998
2353
|
|
|
999
|
-
var
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
2354
|
+
var migrateVizToSplunkSingleValueRadial = function migrateVizToSplunkSingleValueRadial(vizDefinition) {
|
|
2355
|
+
var _a, _b, _c;
|
|
2356
|
+
|
|
2357
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
2358
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2359
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
2360
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2361
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
2362
|
+
|
|
2363
|
+
var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
2364
|
+
type: 'splunk.singlevalueradial',
|
|
2365
|
+
context: {},
|
|
2366
|
+
options: {}
|
|
2367
|
+
});
|
|
2368
|
+
|
|
2369
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
2370
|
+
dataOptions = _encoding_1$encodingT.options,
|
|
2371
|
+
dataContext = _encoding_1$encodingT.context;
|
|
2372
|
+
|
|
2373
|
+
var originalTrend = dataOptions.trend,
|
|
2374
|
+
originalFill = dataOptions.fill;
|
|
2375
|
+
var migratedDataOptions = Object.assign(Object.assign({}, originalTrend && {
|
|
2376
|
+
majorValue: (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalTrend, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalTrend,
|
|
2377
|
+
trendValue: (_b = migrationUtils_1.preserveDataSelectionForValueOption(originalTrend, 'delta(-2)')) !== null && _b !== void 0 ? _b : originalTrend
|
|
2378
|
+
}), originalFill && {
|
|
2379
|
+
backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(originalFill, 'lastPoint()')) !== null && _c !== void 0 ? _c : originalFill
|
|
1005
2380
|
});
|
|
2381
|
+
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
2382
|
+
var trendDisplayMode = renamedOptions.trendDisplayMode,
|
|
2383
|
+
showTrendIndicator = renamedOptions.showTrendIndicator;
|
|
2384
|
+
var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
|
|
2385
|
+
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
|
|
2386
|
+
trendDisplay: trendDisplay
|
|
2387
|
+
});
|
|
2388
|
+
migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueradial as reference
|
|
2389
|
+
|
|
2390
|
+
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
2391
|
+
return migratedVisualization;
|
|
1006
2392
|
};
|
|
1007
2393
|
|
|
1008
|
-
exports.
|
|
2394
|
+
exports.migrateVizToSplunkSingleValueRadial = migrateVizToSplunkSingleValueRadial;
|
|
1009
2395
|
|
|
1010
2396
|
/***/ }),
|
|
1011
|
-
/*
|
|
2397
|
+
/* 48 */
|
|
1012
2398
|
/***/ (function(module, exports) {
|
|
1013
2399
|
|
|
1014
|
-
module.exports = require("@splunk/visualizations/
|
|
2400
|
+
module.exports = require("@splunk/visualizations/SingleValueRadial.config");
|
|
1015
2401
|
|
|
1016
2402
|
/***/ }),
|
|
1017
|
-
/*
|
|
2403
|
+
/* 49 */
|
|
1018
2404
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1019
2405
|
|
|
1020
2406
|
"use strict";
|
|
1021
2407
|
|
|
1022
2408
|
|
|
2409
|
+
var _slicedToArray = __webpack_require__(6);
|
|
2410
|
+
|
|
1023
2411
|
var __rest = this && this.__rest || function (s, e) {
|
|
1024
2412
|
var t = {};
|
|
1025
2413
|
|
|
@@ -1036,64 +2424,213 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
1036
2424
|
Object.defineProperty(exports, "__esModule", {
|
|
1037
2425
|
value: true
|
|
1038
2426
|
});
|
|
1039
|
-
exports.
|
|
2427
|
+
exports.migrateVizToSplunkTable = void 0;
|
|
1040
2428
|
|
|
1041
|
-
var
|
|
2429
|
+
var lodash_1 = __webpack_require__(9);
|
|
1042
2430
|
|
|
1043
|
-
var
|
|
2431
|
+
var Table_config_1 = __webpack_require__(50);
|
|
1044
2432
|
|
|
1045
|
-
var
|
|
2433
|
+
var hocUtils_1 = __webpack_require__(51);
|
|
1046
2434
|
|
|
1047
|
-
var
|
|
2435
|
+
var encoding_1 = __webpack_require__(1);
|
|
1048
2436
|
|
|
1049
|
-
var
|
|
1050
|
-
// if neither chart.showLabels or chart.showPercent is specified in viz.pie,
|
|
1051
|
-
// splunk.pie use the default labelDisplay value
|
|
1052
|
-
if (!('chart.showLabels' in options) && !('chart.showPercent' in options)) {
|
|
1053
|
-
return {};
|
|
1054
|
-
} // if only chart.showPercent is specified in viz.pie
|
|
2437
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
1055
2438
|
|
|
2439
|
+
var validOptions = Object.assign({}, Table_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1056
2440
|
|
|
1057
|
-
|
|
2441
|
+
var defaultChanges = {
|
|
2442
|
+
count: 20
|
|
2443
|
+
};
|
|
2444
|
+
var optionRenames = {
|
|
2445
|
+
rowNumbers: 'showRowNumbers'
|
|
2446
|
+
};
|
|
2447
|
+
|
|
2448
|
+
var migrateHeaderVisibility = function migrateHeaderVisibility(oldHeaderVisibility) {
|
|
2449
|
+
if (oldHeaderVisibility === undefined) {
|
|
2450
|
+
// headerVisibility: 'inline' is the default in splunk.table
|
|
2451
|
+
// this corresponds to `showHeader: true`, which is the default in viz.table
|
|
2452
|
+
return undefined;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
return oldHeaderVisibility ? 'inline' : 'none';
|
|
2456
|
+
};
|
|
2457
|
+
/**
|
|
2458
|
+
* Helper to migrate alternating color options (text and background) to their corresponding DSL and context configs
|
|
2459
|
+
*/
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
var migrateAlternatingColors = function migrateAlternatingColors(colors, optionToConvert, contextConfigName) {
|
|
2463
|
+
// default alternating themed color values as defined in table config
|
|
2464
|
+
var themedAlternatingColors = {
|
|
2465
|
+
rowBackgroundColors: {
|
|
2466
|
+
even: '> themes.rowBackgroundColorEven',
|
|
2467
|
+
odd: '> themes.rowBackgroundColorOdd'
|
|
2468
|
+
},
|
|
2469
|
+
rowColors: {
|
|
2470
|
+
even: '> themes.inverseTextColor',
|
|
2471
|
+
odd: '> themes.textColor'
|
|
2472
|
+
}
|
|
2473
|
+
};
|
|
2474
|
+
var colorsContext = [];
|
|
2475
|
+
var oddColor = colors.oddColor,
|
|
2476
|
+
evenColor = colors.evenColor;
|
|
2477
|
+
|
|
2478
|
+
if (oddColor && evenColor) {
|
|
2479
|
+
colorsContext.push.apply(colorsContext, [oddColor, evenColor]);
|
|
2480
|
+
} else if (oddColor) {
|
|
2481
|
+
colorsContext.push.apply(colorsContext, [oddColor, themedAlternatingColors[optionToConvert].even]);
|
|
2482
|
+
} else if (evenColor) {
|
|
2483
|
+
colorsContext.push.apply(colorsContext, [themedAlternatingColors[optionToConvert].odd, evenColor]);
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
if (colorsContext.length) {
|
|
1058
2487
|
return {
|
|
1059
|
-
|
|
2488
|
+
contextConfigName: contextConfigName,
|
|
2489
|
+
context: colorsContext,
|
|
2490
|
+
dsl: "> table | pick(".concat(contextConfigName, ")")
|
|
1060
2491
|
};
|
|
1061
|
-
}
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
return {};
|
|
2495
|
+
};
|
|
2496
|
+
/**
|
|
2497
|
+
* Intermediate helper to translate column-specific formatting in viz.table to their DSL equivalents
|
|
2498
|
+
* viz.table defines column-specific formatting via entries specified in options.fields.<columnName>
|
|
2499
|
+
*
|
|
2500
|
+
* This requires moving numberPrecision, useThousandSeparators, unitPosition, and other formatting options to the config
|
|
2501
|
+
* The resultant config is used as the argument for formatByType
|
|
2502
|
+
*/
|
|
1062
2503
|
|
|
1063
2504
|
|
|
1064
|
-
|
|
2505
|
+
var migrateToColumnFormat = function migrateToColumnFormat(fieldsOption) {
|
|
2506
|
+
var columnFormat = {};
|
|
2507
|
+
var columnFormatContext = {};
|
|
2508
|
+
|
|
2509
|
+
if (!fieldsOption) {
|
|
1065
2510
|
return {
|
|
1066
|
-
|
|
2511
|
+
columnFormat: columnFormat,
|
|
2512
|
+
columnFormatContext: columnFormatContext
|
|
1067
2513
|
};
|
|
1068
|
-
}
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
Object.entries(fieldsOption).forEach(function (_ref) {
|
|
2517
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
2518
|
+
column = _ref2[0],
|
|
2519
|
+
formatting = _ref2[1];
|
|
2520
|
+
|
|
2521
|
+
// need to prepend `formatted` in case the column has leading digits, which the nearley parser cannot account for
|
|
2522
|
+
var contextEntry = "formatted".concat(column, "Config");
|
|
2523
|
+
columnFormatContext[contextEntry] = {};
|
|
2524
|
+
columnFormat[column] = {
|
|
2525
|
+
data: "> table | seriesByName(\"".concat(column, "\") | formatByType(").concat(contextEntry, ")")
|
|
2526
|
+
}; // all columnFormatting options are optional; if they are not present in the original config, tableFormat should take precedence
|
|
2527
|
+
|
|
2528
|
+
var unit = formatting.unit,
|
|
2529
|
+
unitPosition = formatting.unitPosition,
|
|
2530
|
+
numberPrecision = formatting.numberPrecision,
|
|
2531
|
+
useThousandSeparators = formatting.useThousandSeparators;
|
|
2532
|
+
|
|
2533
|
+
if (typeof unitPosition === 'string') {
|
|
2534
|
+
lodash_1.set(columnFormatContext, [contextEntry, 'number', 'unitPosition'], unitPosition);
|
|
2535
|
+
lodash_1.set(columnFormatContext, [contextEntry, 'string', 'unitPosition'], unitPosition);
|
|
2536
|
+
}
|
|
1069
2537
|
|
|
2538
|
+
if (typeof unit === 'string' || typeof unit === 'number') {
|
|
2539
|
+
lodash_1.set(columnFormatContext, [contextEntry, 'number', 'unit'], unit);
|
|
2540
|
+
lodash_1.set(columnFormatContext, [contextEntry, 'string', 'unit'], unit);
|
|
2541
|
+
}
|
|
1070
2542
|
|
|
1071
|
-
|
|
1072
|
-
|
|
2543
|
+
if (numberPrecision != null) {
|
|
2544
|
+
lodash_1.set(columnFormatContext, [contextEntry, 'number', 'precision'], numberPrecision);
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
if (useThousandSeparators != null) {
|
|
2548
|
+
lodash_1.set(columnFormatContext, [contextEntry, 'number', 'thousandSeparated'], useThousandSeparators);
|
|
2549
|
+
}
|
|
2550
|
+
});
|
|
2551
|
+
return {
|
|
2552
|
+
columnFormat: columnFormat,
|
|
2553
|
+
columnFormatContext: columnFormatContext
|
|
1073
2554
|
};
|
|
2555
|
+
};
|
|
2556
|
+
/**
|
|
2557
|
+
* Intermediate helper to translate table-wide formatting and coloring in viz.table to their DSL equivalents
|
|
2558
|
+
*
|
|
2559
|
+
* This requires moving numberPrecision, useThousandSeparators, unitPosition, and other formatting/coloring options to the config
|
|
2560
|
+
* The resultant formatting and coloring config is used as the argument for the formatByType() and pick() DSL formatters respectively
|
|
2561
|
+
*/
|
|
1074
2562
|
|
|
1075
|
-
|
|
1076
|
-
|
|
2563
|
+
|
|
2564
|
+
var migrateToTableFormat = function migrateToTableFormat() {
|
|
2565
|
+
var oldOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2566
|
+
var tableFormat = {};
|
|
2567
|
+
var tableFormatContext = {
|
|
2568
|
+
formattedConfig: {}
|
|
2569
|
+
};
|
|
2570
|
+
var unit = oldOptions.unit,
|
|
2571
|
+
oldUnitPosition = oldOptions.unitPosition,
|
|
2572
|
+
oldNumberPrecision = oldOptions.numberPrecision,
|
|
2573
|
+
oldUseThousandSeparators = oldOptions.useThousandSeparators;
|
|
2574
|
+
var unitPosition = typeof oldUnitPosition === 'string' ? oldUnitPosition : 'after';
|
|
2575
|
+
var numberPrecision = typeof oldNumberPrecision === 'number' ? oldNumberPrecision : 0;
|
|
2576
|
+
var useThousandSeparators = typeof oldUseThousandSeparators === 'boolean' ? oldUseThousandSeparators : false;
|
|
2577
|
+
lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'precision'], numberPrecision);
|
|
2578
|
+
lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'thousandSeparated'], useThousandSeparators);
|
|
2579
|
+
lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'unitPosition'], unitPosition);
|
|
2580
|
+
lodash_1.set(tableFormatContext, ['formattedConfig', 'string', 'unitPosition'], unitPosition);
|
|
2581
|
+
|
|
2582
|
+
if (typeof unit === 'string' || typeof unit === 'number') {
|
|
2583
|
+
lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'unit'], unit);
|
|
2584
|
+
lodash_1.set(tableFormatContext, ['formattedConfig', 'string', 'unit'], unit);
|
|
1077
2585
|
}
|
|
1078
2586
|
|
|
1079
|
-
|
|
1080
|
-
|
|
2587
|
+
tableFormat.data = "> table | formatByType(formattedConfig)";
|
|
2588
|
+
var rowBackgroundColorEven = oldOptions.rowBackgroundColorEven,
|
|
2589
|
+
rowBackgroundColorOdd = oldOptions.rowBackgroundColorOdd,
|
|
2590
|
+
rowTextColorOdd = oldOptions.rowTextColorOdd,
|
|
2591
|
+
rowTextColorEven = oldOptions.rowTextColorEven,
|
|
2592
|
+
headerTextColor = oldOptions.headerTextColor,
|
|
2593
|
+
headerBackgroundColor = oldOptions.headerBackgroundColor;
|
|
2594
|
+
|
|
2595
|
+
var _migrateAlternatingCo = migrateAlternatingColors({
|
|
2596
|
+
oddColor: rowTextColorOdd,
|
|
2597
|
+
evenColor: rowTextColorEven
|
|
2598
|
+
}, 'rowColors', 'rowColorsConfig'),
|
|
2599
|
+
rowColorsContext = _migrateAlternatingCo.context,
|
|
2600
|
+
rowColorsDSL = _migrateAlternatingCo.dsl;
|
|
2601
|
+
|
|
2602
|
+
if (rowColorsContext && rowColorsDSL) {
|
|
2603
|
+
tableFormatContext.rowColorsConfig = rowColorsContext;
|
|
2604
|
+
tableFormat.rowColors = rowColorsDSL;
|
|
1081
2605
|
}
|
|
1082
2606
|
|
|
1083
|
-
|
|
1084
|
-
|
|
2607
|
+
var _migrateAlternatingCo2 = migrateAlternatingColors({
|
|
2608
|
+
oddColor: rowBackgroundColorOdd,
|
|
2609
|
+
evenColor: rowBackgroundColorEven
|
|
2610
|
+
}, 'rowBackgroundColors', 'rowBackgroundColorsConfig'),
|
|
2611
|
+
rowBackgroundColorsContext = _migrateAlternatingCo2.context,
|
|
2612
|
+
rowBackgroundColorsDSL = _migrateAlternatingCo2.dsl;
|
|
1085
2613
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
2614
|
+
if (rowBackgroundColorsContext && rowBackgroundColorsDSL) {
|
|
2615
|
+
tableFormat.rowBackgroundColors = rowBackgroundColorsDSL;
|
|
2616
|
+
tableFormatContext.rowBackgroundColorsConfig = rowBackgroundColorsContext;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
if (headerTextColor) {
|
|
2620
|
+
tableFormat.headerColor = headerTextColor;
|
|
1093
2621
|
}
|
|
2622
|
+
|
|
2623
|
+
if (headerBackgroundColor) {
|
|
2624
|
+
tableFormat.headerBackgroundColor = headerBackgroundColor;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
return {
|
|
2628
|
+
tableFormat: tableFormat,
|
|
2629
|
+
tableFormatContext: tableFormatContext
|
|
2630
|
+
};
|
|
1094
2631
|
};
|
|
1095
2632
|
|
|
1096
|
-
var
|
|
2633
|
+
var migrateVizToSplunkTable = function migrateVizToSplunkTable(vizDefinition) {
|
|
1097
2634
|
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
1098
2635
|
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1099
2636
|
_vizDefinition$option = vizDefinition.options,
|
|
@@ -1101,74 +2638,320 @@ var migrateVizToSplunkPie = function migrateVizToSplunkPie(vizDefinition) {
|
|
|
1101
2638
|
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
1102
2639
|
|
|
1103
2640
|
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1104
|
-
type: 'splunk.
|
|
2641
|
+
type: 'splunk.table',
|
|
1105
2642
|
options: {},
|
|
1106
2643
|
context: {}
|
|
1107
|
-
});
|
|
2644
|
+
});
|
|
1108
2645
|
|
|
1109
2646
|
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
1110
2647
|
dataOptions = _encoding_1$encodingT.options,
|
|
1111
2648
|
dataContext = _encoding_1$encodingT.context;
|
|
1112
2649
|
|
|
1113
|
-
var
|
|
2650
|
+
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
2651
|
+
var headerVisibility = migrateHeaderVisibility(renamedOptions.showHeader);
|
|
2652
|
+
|
|
2653
|
+
var _migrateToTableFormat = migrateToTableFormat(renamedOptions),
|
|
2654
|
+
tableFormat = _migrateToTableFormat.tableFormat,
|
|
2655
|
+
tableFormatContext = _migrateToTableFormat.tableFormatContext;
|
|
2656
|
+
|
|
2657
|
+
var _migrateToColumnForma = migrateToColumnFormat(renamedOptions.fields),
|
|
2658
|
+
columnFormat = _migrateToColumnForma.columnFormat,
|
|
2659
|
+
columnFormatContext = _migrateToColumnForma.columnFormatContext;
|
|
2660
|
+
|
|
2661
|
+
var migratedDataOptions = Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.columns) && {
|
|
2662
|
+
table: dataOptions.columns
|
|
2663
|
+
});
|
|
2664
|
+
var formattingOptions = Object.assign(Object.assign(Object.assign({}, !lodash_1.isEmpty(columnFormat) && {
|
|
2665
|
+
columnFormat: columnFormat
|
|
2666
|
+
}), typeof headerVisibility === 'string' && {
|
|
2667
|
+
headerVisibility: headerVisibility
|
|
2668
|
+
}), {
|
|
2669
|
+
tableFormat: tableFormat
|
|
2670
|
+
});
|
|
2671
|
+
var migratedOptions = hocUtils_1.deepMergeWithArrayOverrides({}, defaultChanges, formattingOptions, migratedDataOptions, renamedOptions); // remove invalid options
|
|
1114
2672
|
|
|
1115
2673
|
Object.keys(migratedOptions).forEach(function (key) {
|
|
1116
2674
|
if (!validOptions[key]) {
|
|
1117
2675
|
delete migratedOptions[key];
|
|
1118
2676
|
}
|
|
1119
2677
|
});
|
|
2678
|
+
migratedDefinition.context = Object.assign(Object.assign(Object.assign({}, dataContext), !lodash_1.isEmpty(columnFormatContext) && Object.assign({}, columnFormatContext)), tableFormatContext);
|
|
1120
2679
|
migratedDefinition.options = migratedOptions;
|
|
1121
|
-
migratedDefinition.context = dataContext;
|
|
1122
2680
|
return migratedDefinition;
|
|
1123
2681
|
};
|
|
1124
2682
|
|
|
1125
|
-
exports.
|
|
2683
|
+
exports.migrateVizToSplunkTable = migrateVizToSplunkTable;
|
|
1126
2684
|
|
|
1127
2685
|
/***/ }),
|
|
1128
|
-
/*
|
|
2686
|
+
/* 50 */
|
|
1129
2687
|
/***/ (function(module, exports) {
|
|
1130
2688
|
|
|
1131
|
-
module.exports = require("@splunk/visualizations/
|
|
2689
|
+
module.exports = require("@splunk/visualizations/Table.config");
|
|
1132
2690
|
|
|
1133
2691
|
/***/ }),
|
|
1134
|
-
/*
|
|
2692
|
+
/* 51 */
|
|
2693
|
+
/***/ (function(module, exports) {
|
|
2694
|
+
|
|
2695
|
+
module.exports = require("@splunk/visualizations/common/utils/hocUtils");
|
|
2696
|
+
|
|
2697
|
+
/***/ }),
|
|
2698
|
+
/* 52 */
|
|
1135
2699
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1136
2700
|
|
|
1137
2701
|
"use strict";
|
|
1138
2702
|
|
|
1139
2703
|
|
|
2704
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2705
|
+
var t = {};
|
|
2706
|
+
|
|
2707
|
+
for (var p in s) {
|
|
2708
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2712
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2713
|
+
}
|
|
2714
|
+
return t;
|
|
2715
|
+
};
|
|
2716
|
+
|
|
1140
2717
|
Object.defineProperty(exports, "__esModule", {
|
|
1141
2718
|
value: true
|
|
1142
2719
|
});
|
|
1143
|
-
exports.
|
|
2720
|
+
exports.migrateVizTextToSplunkMarkdown = void 0;
|
|
1144
2721
|
|
|
1145
|
-
var
|
|
2722
|
+
var _ = __webpack_require__(9);
|
|
1146
2723
|
|
|
1147
|
-
var
|
|
2724
|
+
var Markdown_config_1 = __webpack_require__(8);
|
|
1148
2725
|
|
|
1149
|
-
var
|
|
2726
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
1150
2727
|
|
|
1151
|
-
var
|
|
1152
|
-
|
|
1153
|
-
|
|
2728
|
+
var validOptions = Object.assign({}, Markdown_config_1.default.optionsSchema);
|
|
2729
|
+
var optionsToRename = {
|
|
2730
|
+
textColor: 'fontColor',
|
|
2731
|
+
content: 'markdown'
|
|
1154
2732
|
};
|
|
1155
2733
|
|
|
1156
|
-
var
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
2734
|
+
var convertFontWeightToMarkdownTag = function convertFontWeightToMarkdownTag(markdownContent, fontWeight, fontSize) {
|
|
2735
|
+
// Wrap around with bold ** only if fontSize < 16 (for non header types)
|
|
2736
|
+
return fontWeight === 'bold' && _.isNumber(fontSize) && fontSize < 16 ? "**".concat(markdownContent, "**") : markdownContent;
|
|
2737
|
+
};
|
|
2738
|
+
|
|
2739
|
+
var convertFontSizeToMarkdownTag = function convertFontSizeToMarkdownTag(markdownContent, fontSize) {
|
|
2740
|
+
if (!_.isNumber(fontSize)) {
|
|
2741
|
+
return markdownContent;
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
switch (true) {
|
|
2745
|
+
case fontSize >= 24:
|
|
2746
|
+
{
|
|
2747
|
+
return "# ".concat(markdownContent);
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
case fontSize >= 18 && fontSize < 24:
|
|
2751
|
+
{
|
|
2752
|
+
return "## ".concat(markdownContent);
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
case fontSize >= 16 && fontSize < 18:
|
|
2756
|
+
{
|
|
2757
|
+
return "### ".concat(markdownContent);
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
default:
|
|
2761
|
+
{
|
|
2762
|
+
return markdownContent;
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
};
|
|
2766
|
+
|
|
2767
|
+
var migrateVizTextToSplunkMarkdown = function migrateVizTextToSplunkMarkdown(vizDefinition) {
|
|
2768
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
2769
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2770
|
+
otherDefinitionParts = __rest(vizDefinition, ["options"]);
|
|
2771
|
+
|
|
2772
|
+
var fontSize = options.fontSize,
|
|
2773
|
+
fontWeight = options.fontWeight;
|
|
2774
|
+
var migratedVisualization = Object.assign(Object.assign({
|
|
2775
|
+
options: options
|
|
2776
|
+
}, otherDefinitionParts), {
|
|
2777
|
+
type: 'splunk.markdown',
|
|
2778
|
+
context: {}
|
|
2779
|
+
}); // perform any option renames
|
|
2780
|
+
|
|
2781
|
+
migratedVisualization.options = migrationUtils_1.renameVizOptions(migratedVisualization.options, optionsToRename); // Convert text fontWeight option to corresponding markdown tag
|
|
2782
|
+
|
|
2783
|
+
var migratedVizOptions = migratedVisualization.options;
|
|
2784
|
+
migratedVizOptions.markdown = convertFontWeightToMarkdownTag(migratedVizOptions.markdown, fontWeight, fontSize); // Convert text fontSize option to corresponding markdown tag
|
|
2785
|
+
|
|
2786
|
+
migratedVizOptions.markdown = convertFontSizeToMarkdownTag(migratedVizOptions.markdown, fontSize); // remove invalid options using the optionsSchema for splunk.markdown as reference
|
|
2787
|
+
|
|
2788
|
+
migrationUtils_1.removeInvalidOptions(migratedVizOptions, validOptions);
|
|
2789
|
+
return migratedVisualization;
|
|
2790
|
+
};
|
|
2791
|
+
|
|
2792
|
+
exports.migrateVizTextToSplunkMarkdown = migrateVizTextToSplunkMarkdown;
|
|
2793
|
+
|
|
2794
|
+
/***/ }),
|
|
2795
|
+
/* 53 */
|
|
2796
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2797
|
+
|
|
2798
|
+
"use strict";
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
var _toConsumableArray = __webpack_require__(5);
|
|
2802
|
+
|
|
2803
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2804
|
+
var t = {};
|
|
2805
|
+
|
|
2806
|
+
for (var p in s) {
|
|
2807
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2811
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2812
|
+
}
|
|
2813
|
+
return t;
|
|
2814
|
+
};
|
|
2815
|
+
|
|
2816
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2817
|
+
value: true
|
|
2818
|
+
});
|
|
2819
|
+
exports.migrateVizToSplunkPunchcard = void 0;
|
|
2820
|
+
|
|
2821
|
+
var Punchcard_config_1 = __webpack_require__(54);
|
|
2822
|
+
|
|
2823
|
+
var encoding_1 = __webpack_require__(1);
|
|
2824
|
+
|
|
2825
|
+
var migrationUtils_1 = __webpack_require__(0);
|
|
2826
|
+
|
|
2827
|
+
var validOptions = Object.assign({}, Punchcard_config_1.default.optionsSchema);
|
|
2828
|
+
var defaultContext = Object.assign({}, Punchcard_config_1.default.defaultContext);
|
|
2829
|
+
var optionsToRename = {
|
|
2830
|
+
showBubbleLabels: 'bubbleLabelDisplay',
|
|
2831
|
+
bubbleScale: 'bubbleSizeMethod',
|
|
2832
|
+
isBubbleSizeDynamic: 'showDynamicBubbleSize',
|
|
2833
|
+
maxBubbleRadius: 'bubbleRadiusMax',
|
|
2834
|
+
minBubbleRadius: 'bubbleRadiusMin',
|
|
2835
|
+
maxBubbleSize: 'bubbleSizeMax',
|
|
2836
|
+
minBubbleSize: 'bubbleSizeMin',
|
|
2837
|
+
showLegend: 'legendDisplay',
|
|
2838
|
+
useDefaultSort: 'showDefaultSort'
|
|
2839
|
+
};
|
|
2840
|
+
|
|
2841
|
+
var consolidateLegendDisplay = function consolidateLegendDisplay(vizOptions) {
|
|
2842
|
+
if (!vizOptions) {
|
|
2843
|
+
return;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
var options = vizOptions;
|
|
2847
|
+
|
|
2848
|
+
if (options.legendDisplay) {
|
|
2849
|
+
options.legendDisplay = 'right';
|
|
2850
|
+
} else if (options.legendDisplay === false) {
|
|
2851
|
+
options.legendDisplay = 'off'; // legenddisplay set explicitly to false
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
|
|
2855
|
+
var consolidateBubbleLabelDisplay = function consolidateBubbleLabelDisplay(vizOptions) {
|
|
2856
|
+
if (!vizOptions) {
|
|
2857
|
+
return;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
var options = vizOptions;
|
|
2861
|
+
|
|
2862
|
+
if (options.bubbleLabelDisplay === 'none') {
|
|
2863
|
+
options.bubbleLabelDisplay = 'off';
|
|
2864
|
+
}
|
|
2865
|
+
}; // Updates the first color of the bubbleColorConfig with the minBubbleColorIntensity
|
|
2866
|
+
|
|
2867
|
+
|
|
2868
|
+
var convertGradientConfig = function convertGradientConfig(minBubbleColorIntensity, defaultBubbleColorConfig) {
|
|
2869
|
+
if (!defaultBubbleColorConfig || !defaultBubbleColorConfig.colors || !defaultBubbleColorConfig.colors[0] || typeof minBubbleColorIntensity !== 'number') {
|
|
2870
|
+
return null;
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
var firstColor = defaultBubbleColorConfig.colors[0];
|
|
2874
|
+
var firstColorUpdated = "".concat(firstColor.substring(0, firstColor.lastIndexOf(',')), ",").concat(minBubbleColorIntensity, ")");
|
|
2875
|
+
|
|
2876
|
+
var colors = _toConsumableArray(defaultBubbleColorConfig.colors);
|
|
2877
|
+
|
|
2878
|
+
colors[0] = firstColorUpdated;
|
|
2879
|
+
var bubbleColorConfigUpdated = Object.assign(Object.assign({}, defaultBubbleColorConfig), {
|
|
2880
|
+
colors: colors
|
|
1162
2881
|
});
|
|
2882
|
+
return bubbleColorConfigUpdated;
|
|
1163
2883
|
};
|
|
1164
2884
|
|
|
1165
|
-
|
|
2885
|
+
var convertColorModeOption = function convertColorModeOption(visualizationDefinition) {
|
|
2886
|
+
var visualizationDef = visualizationDefinition;
|
|
2887
|
+
|
|
2888
|
+
if (!visualizationDef || !visualizationDef.options) {
|
|
2889
|
+
return;
|
|
2890
|
+
} // Rename the colorMode option from 'sequential' to 'dynamic' if specified
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
if (visualizationDef.options.colorMode === 'sequential') {
|
|
2894
|
+
visualizationDef.options.colorMode = 'dynamic';
|
|
2895
|
+
} // If no colorMode was specified the default in viz.punchcard used to be 'categorical'.
|
|
2896
|
+
// But in splunk.punchcard default is 'dynamic', we need to preserve the original default.
|
|
2897
|
+
// Set colorMode to 'categorical' if no colorMode was specified in viz
|
|
2898
|
+
|
|
2899
|
+
|
|
2900
|
+
if (!visualizationDef.options.colorMode) {
|
|
2901
|
+
visualizationDef.options.colorMode = 'categorical';
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
var minBubbleColorIntensity = visualizationDef.options.minBubbleColorIntensity; // If there is no category option set or if the colorMode is not categorical, then the colorMode will to 'dynamic'
|
|
2905
|
+
// In both cases we need to update the gradient config bubbleColorConfig with the minBubbleColorIntensity for first color
|
|
2906
|
+
|
|
2907
|
+
if ((!visualizationDef.options.category || visualizationDef.options.colorMode !== 'categorical') && minBubbleColorIntensity && typeof minBubbleColorIntensity === 'number') {
|
|
2908
|
+
var bubbleColorConfig = convertGradientConfig(minBubbleColorIntensity, defaultContext.bubbleColorConfig);
|
|
2909
|
+
|
|
2910
|
+
if (bubbleColorConfig) {
|
|
2911
|
+
visualizationDef.context = Object.assign(Object.assign({}, visualizationDef.context), {
|
|
2912
|
+
bubbleColorConfig: bubbleColorConfig
|
|
2913
|
+
});
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
};
|
|
2917
|
+
|
|
2918
|
+
var migrateVizToSplunkPunchcard = function migrateVizToSplunkPunchcard(vizDefinition) {
|
|
2919
|
+
var _vizDefinition$option = vizDefinition.options,
|
|
2920
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2921
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
2922
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2923
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
2924
|
+
|
|
2925
|
+
var migratedVisualization = Object.assign(Object.assign({
|
|
2926
|
+
options: options
|
|
2927
|
+
}, otherDefinitionParts), {
|
|
2928
|
+
type: 'splunk.punchcard',
|
|
2929
|
+
context: {}
|
|
2930
|
+
});
|
|
2931
|
+
|
|
2932
|
+
var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
|
|
2933
|
+
dataOptions = _encoding_1$encodingT.options,
|
|
2934
|
+
dataContext = _encoding_1$encodingT.context; // perform any option renames
|
|
2935
|
+
|
|
2936
|
+
|
|
2937
|
+
var renamedOptions = migrationUtils_1.renameVizOptions(migratedVisualization.options, optionsToRename);
|
|
2938
|
+
consolidateLegendDisplay(renamedOptions);
|
|
2939
|
+
consolidateBubbleLabelDisplay(renamedOptions);
|
|
2940
|
+
migratedVisualization.options = Object.assign(Object.assign({}, renamedOptions), dataOptions);
|
|
2941
|
+
migratedVisualization.context = dataContext;
|
|
2942
|
+
convertColorModeOption(migratedVisualization); // remove invalid options using the optionsSchema for splunk.punchcard as reference
|
|
2943
|
+
|
|
2944
|
+
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
2945
|
+
return migratedVisualization;
|
|
2946
|
+
};
|
|
2947
|
+
|
|
2948
|
+
exports.migrateVizToSplunkPunchcard = migrateVizToSplunkPunchcard;
|
|
1166
2949
|
|
|
1167
2950
|
/***/ }),
|
|
1168
|
-
/*
|
|
2951
|
+
/* 54 */
|
|
1169
2952
|
/***/ (function(module, exports) {
|
|
1170
2953
|
|
|
1171
|
-
module.exports = require("@splunk/visualizations/
|
|
2954
|
+
module.exports = require("@splunk/visualizations/Punchcard.config");
|
|
1172
2955
|
|
|
1173
2956
|
/***/ })
|
|
1174
2957
|
/******/ ]);
|