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