@splunk/visualization-migrations 25.13.1 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +843 -368
- package/index.js.map +1 -1
- package/package.json +12 -9
- package/types/encoding/encoding.d.ts +1 -1
package/index.js
CHANGED
|
@@ -98,10 +98,12 @@ module.exports =
|
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
var _slicedToArray = __webpack_require__(6);
|
|
101
|
+
|
|
101
102
|
Object.defineProperty(exports, "__esModule", {
|
|
102
103
|
value: true
|
|
103
104
|
});
|
|
104
105
|
exports.addsDataSelectorToOptions = exports.preserveDataSelectionForValueOption = exports.renameVizOptions = exports.removeInvalidOptions = void 0;
|
|
106
|
+
|
|
105
107
|
var dsl_1 = __webpack_require__(23);
|
|
106
108
|
/**
|
|
107
109
|
* Removes invalid keys in the options
|
|
@@ -109,10 +111,13 @@ var dsl_1 = __webpack_require__(23);
|
|
|
109
111
|
* @param validOptions - Valid visualization option keys
|
|
110
112
|
* @returns void
|
|
111
113
|
*/
|
|
114
|
+
|
|
115
|
+
|
|
112
116
|
var removeInvalidOptions = function removeInvalidOptions(currentOptions, validOptions) {
|
|
113
117
|
if (!currentOptions || !validOptions) {
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
120
|
+
|
|
116
121
|
var copiedCurrOptions = currentOptions;
|
|
117
122
|
Object.keys(copiedCurrOptions).forEach(function (key) {
|
|
118
123
|
if (!(key in validOptions)) {
|
|
@@ -120,6 +125,7 @@ var removeInvalidOptions = function removeInvalidOptions(currentOptions, validOp
|
|
|
120
125
|
}
|
|
121
126
|
});
|
|
122
127
|
};
|
|
128
|
+
|
|
123
129
|
exports.removeInvalidOptions = removeInvalidOptions;
|
|
124
130
|
/**
|
|
125
131
|
* Renames viz options by looking up their migration mapping
|
|
@@ -127,20 +133,24 @@ exports.removeInvalidOptions = removeInvalidOptions;
|
|
|
127
133
|
* @param optionRenames - Mapping of old options in viz.X to their migrated counterparts in splunk.X
|
|
128
134
|
* @returns updatedOptions
|
|
129
135
|
*/
|
|
136
|
+
|
|
130
137
|
var renameVizOptions = function renameVizOptions(oldOptions, optionRenames) {
|
|
131
138
|
var updatedOptions = {};
|
|
132
139
|
if (!oldOptions) return {};
|
|
133
140
|
if (!optionRenames) return oldOptions;
|
|
134
141
|
Object.entries(oldOptions).forEach(function (_ref) {
|
|
135
142
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
oldOptName = _ref2[0],
|
|
144
|
+
val = _ref2[1];
|
|
145
|
+
|
|
138
146
|
var _a;
|
|
147
|
+
|
|
139
148
|
var optionName = (_a = optionRenames[oldOptName]) !== null && _a !== void 0 ? _a : oldOptName;
|
|
140
149
|
updatedOptions[optionName] = val;
|
|
141
150
|
});
|
|
142
151
|
return updatedOptions;
|
|
143
152
|
};
|
|
153
|
+
|
|
144
154
|
exports.renameVizOptions = renameVizOptions;
|
|
145
155
|
/**
|
|
146
156
|
* Appends appropriate series selector to DSL string to add viz-specific implicit logic
|
|
@@ -148,17 +158,21 @@ exports.renameVizOptions = renameVizOptions;
|
|
|
148
158
|
* @param selector - the selector to append
|
|
149
159
|
* @returns string | void
|
|
150
160
|
*/
|
|
161
|
+
|
|
151
162
|
var preserveDataSelectionForValueOption = function preserveDataSelectionForValueOption(valueOption, selector) {
|
|
152
163
|
if (valueOption) {
|
|
153
164
|
// if the last data selector starts with seriesBy, append appropriate selector to it
|
|
154
|
-
var dataSelectors = dsl_1.getDataSelectorsFromDSL(valueOption);
|
|
165
|
+
var dataSelectors = (0, dsl_1.getDataSelectorsFromDSL)(valueOption);
|
|
155
166
|
var lastDataSelector = dataSelectors[dataSelectors.length - 1];
|
|
167
|
+
|
|
156
168
|
if (lastDataSelector.includes('seriesByIndex') || lastDataSelector.includes('seriesByName')) {
|
|
157
169
|
return "".concat(valueOption, " | ").concat(selector);
|
|
158
170
|
}
|
|
159
171
|
}
|
|
172
|
+
|
|
160
173
|
return null;
|
|
161
174
|
};
|
|
175
|
+
|
|
162
176
|
exports.preserveDataSelectionForValueOption = preserveDataSelectionForValueOption;
|
|
163
177
|
/**
|
|
164
178
|
* For all data options, calls preserveDataSelectionForValueOption with relevant selector and
|
|
@@ -167,11 +181,13 @@ exports.preserveDataSelectionForValueOption = preserveDataSelectionForValueOptio
|
|
|
167
181
|
* @param selector - the selector to append
|
|
168
182
|
* @returns void
|
|
169
183
|
*/
|
|
184
|
+
|
|
170
185
|
var addsDataSelectorToOptions = function addsDataSelectorToOptions(dataOptions, selector) {
|
|
171
186
|
var updatedDataOptions = {};
|
|
172
187
|
Object.keys(dataOptions).forEach(function (key) {
|
|
173
188
|
var statement = dataOptions[key];
|
|
174
|
-
var updatedDSL = exports.preserveDataSelectionForValueOption(statement, selector);
|
|
189
|
+
var updatedDSL = (0, exports.preserveDataSelectionForValueOption)(statement, selector);
|
|
190
|
+
|
|
175
191
|
if (updatedDSL) {
|
|
176
192
|
updatedDataOptions[key] = updatedDSL;
|
|
177
193
|
} else {
|
|
@@ -180,6 +196,7 @@ var addsDataSelectorToOptions = function addsDataSelectorToOptions(dataOptions,
|
|
|
180
196
|
});
|
|
181
197
|
return updatedDataOptions;
|
|
182
198
|
};
|
|
199
|
+
|
|
183
200
|
exports.addsDataSelectorToOptions = addsDataSelectorToOptions;
|
|
184
201
|
|
|
185
202
|
/***/ }),
|
|
@@ -191,24 +208,33 @@ exports.addsDataSelectorToOptions = addsDataSelectorToOptions;
|
|
|
191
208
|
|
|
192
209
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
193
210
|
if (k2 === undefined) k2 = k;
|
|
194
|
-
Object.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
211
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
212
|
+
|
|
213
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
214
|
+
desc = {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
get: function get() {
|
|
217
|
+
return m[k];
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
Object.defineProperty(o, k2, desc);
|
|
200
223
|
} : function (o, m, k, k2) {
|
|
201
224
|
if (k2 === undefined) k2 = k;
|
|
202
225
|
o[k2] = m[k];
|
|
203
226
|
});
|
|
227
|
+
|
|
204
228
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
205
229
|
for (var p in m) {
|
|
206
230
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
207
231
|
}
|
|
208
232
|
};
|
|
233
|
+
|
|
209
234
|
Object.defineProperty(exports, "__esModule", {
|
|
210
235
|
value: true
|
|
211
236
|
});
|
|
237
|
+
|
|
212
238
|
__exportStar(__webpack_require__(15), exports);
|
|
213
239
|
|
|
214
240
|
/***/ }),
|
|
@@ -219,25 +245,32 @@ __exportStar(__webpack_require__(15), exports);
|
|
|
219
245
|
|
|
220
246
|
|
|
221
247
|
var _typeof = __webpack_require__(4);
|
|
248
|
+
|
|
222
249
|
var __rest = this && this.__rest || function (s, e) {
|
|
223
250
|
var t = {};
|
|
251
|
+
|
|
224
252
|
for (var p in s) {
|
|
225
253
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
226
254
|
}
|
|
255
|
+
|
|
227
256
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
228
257
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
229
258
|
}
|
|
230
259
|
return t;
|
|
231
260
|
};
|
|
261
|
+
|
|
232
262
|
Object.defineProperty(exports, "__esModule", {
|
|
233
263
|
value: true
|
|
234
264
|
});
|
|
235
265
|
exports.otherValueReplacements = exports.migrateChartingOptions = exports.migrateBaseChartingVizDefinition = void 0;
|
|
266
|
+
|
|
236
267
|
var encoding_1 = __webpack_require__(1);
|
|
237
268
|
/**
|
|
238
269
|
* map of splunk charting based @splunk/dashboard-visualization option names
|
|
239
270
|
* to updated @splunk/visualization option names
|
|
240
271
|
*/
|
|
272
|
+
|
|
273
|
+
|
|
241
274
|
var optionRenames = {
|
|
242
275
|
'axisTitleX.text': 'xAxisTitleText',
|
|
243
276
|
'axisTitleY.text': 'yAxisTitleText',
|
|
@@ -340,6 +373,7 @@ var abbreviationEnumReplacements = {
|
|
|
340
373
|
* for some options the valid values changed.
|
|
341
374
|
* this maps enum values that need to be changed
|
|
342
375
|
*/
|
|
376
|
+
|
|
343
377
|
var enumReplacements = {
|
|
344
378
|
xAxisTitleVisibility: visibilityEnumReplacements,
|
|
345
379
|
yAxisTitleVisibility: visibilityEnumReplacements,
|
|
@@ -355,9 +389,9 @@ var enumReplacements = {
|
|
|
355
389
|
stackMode: {
|
|
356
390
|
default: 'auto'
|
|
357
391
|
}
|
|
358
|
-
};
|
|
359
|
-
// splits a string with multiple fields separated by comma
|
|
392
|
+
}; // splits a string with multiple fields separated by comma
|
|
360
393
|
// returns the same value if it's already an array
|
|
394
|
+
|
|
361
395
|
var splitValue = function splitValue(oldValue) {
|
|
362
396
|
return Array.isArray(oldValue) ? oldValue : oldValue.split(',');
|
|
363
397
|
};
|
|
@@ -367,16 +401,21 @@ var splitValue = function splitValue(oldValue) {
|
|
|
367
401
|
* @param {string | Object} oldValue stringified object to parse
|
|
368
402
|
* @returns {Object}
|
|
369
403
|
*/
|
|
404
|
+
|
|
405
|
+
|
|
370
406
|
var parseObjects = function parseObjects(oldValue) {
|
|
371
407
|
if (_typeof(oldValue) === 'object' && !Array.isArray(oldValue)) {
|
|
372
408
|
return oldValue;
|
|
373
409
|
}
|
|
410
|
+
|
|
374
411
|
var nuValue = {};
|
|
412
|
+
|
|
375
413
|
try {
|
|
376
414
|
nuValue = JSON.parse(oldValue);
|
|
377
415
|
} catch (e) {
|
|
378
416
|
/* noop */
|
|
379
417
|
}
|
|
418
|
+
|
|
380
419
|
return nuValue;
|
|
381
420
|
};
|
|
382
421
|
/**
|
|
@@ -384,12 +423,15 @@ var parseObjects = function parseObjects(oldValue) {
|
|
|
384
423
|
* (e.g. if the type of the updated option changed)
|
|
385
424
|
* "legendLabels": "test,test2" => "legendLabels": ["test", "test2"]
|
|
386
425
|
*/
|
|
426
|
+
|
|
427
|
+
|
|
387
428
|
var otherValueReplacements = {
|
|
388
429
|
y2Fields: splitValue,
|
|
389
430
|
overlayFields: splitValue,
|
|
390
431
|
legendLabels: splitValue,
|
|
391
432
|
seriesColorsByField: parseObjects,
|
|
392
433
|
lineDashStylesByField: parseObjects,
|
|
434
|
+
|
|
393
435
|
/**
|
|
394
436
|
* the original markerDisplay was only exposed as `chart.showMarkers`
|
|
395
437
|
* setting chart.showMarkers to true is the equivalent of `markerDisplay: 'outlined'`
|
|
@@ -409,20 +451,25 @@ exports.otherValueReplacements = otherValueReplacements;
|
|
|
409
451
|
* @param {object} options dashboard-viz charting options
|
|
410
452
|
* @returns {object} migratedOptions viz charting options
|
|
411
453
|
*/
|
|
454
|
+
|
|
412
455
|
var migrateChartingOptions = function migrateChartingOptions(options) {
|
|
413
456
|
var migratedOptions = {};
|
|
414
457
|
Object.keys(options).forEach(function (key) {
|
|
415
458
|
var _a, _b, _c;
|
|
459
|
+
|
|
416
460
|
var value = options[key];
|
|
417
461
|
var updatedKey = (_a = optionRenames[key]) !== null && _a !== void 0 ? _a : key;
|
|
418
462
|
var updatedValue = (_c = (_b = enumReplacements === null || enumReplacements === void 0 ? void 0 : enumReplacements[updatedKey]) === null || _b === void 0 ? void 0 : _b[value]) !== null && _c !== void 0 ? _c : value;
|
|
463
|
+
|
|
419
464
|
if (otherValueReplacements[updatedKey]) {
|
|
420
465
|
updatedValue = otherValueReplacements[updatedKey](updatedValue);
|
|
421
466
|
}
|
|
467
|
+
|
|
422
468
|
migratedOptions[updatedKey] = updatedValue;
|
|
423
469
|
});
|
|
424
470
|
return migratedOptions;
|
|
425
471
|
};
|
|
472
|
+
|
|
426
473
|
exports.migrateChartingOptions = migrateChartingOptions;
|
|
427
474
|
/**
|
|
428
475
|
* helper that encapsulates shared migration logic across most charting-based viz
|
|
@@ -431,27 +478,31 @@ exports.migrateChartingOptions = migrateChartingOptions;
|
|
|
431
478
|
* @param {VisualizationDefinition} vizDefinition - the viz definition to migrate
|
|
432
479
|
* @param {String} vizType - the value of splunk.*
|
|
433
480
|
*/
|
|
481
|
+
|
|
434
482
|
var migrateBaseChartingVizDefinition = function migrateBaseChartingVizDefinition(_ref) {
|
|
435
483
|
var defaultChanges = _ref.defaultChanges,
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
484
|
+
validOptions = _ref.validOptions,
|
|
485
|
+
vizDefinition = _ref.vizDefinition,
|
|
486
|
+
vizType = _ref.vizType;
|
|
487
|
+
|
|
439
488
|
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
489
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
490
|
+
_vizDefinition$option = vizDefinition.options,
|
|
491
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
492
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
493
|
+
|
|
444
494
|
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
445
495
|
type: vizType,
|
|
446
496
|
options: {},
|
|
447
497
|
context: {}
|
|
448
|
-
});
|
|
449
|
-
|
|
450
|
-
var
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
// remove invalid options
|
|
498
|
+
}); // translate encoding to dynamic options equivalent
|
|
499
|
+
|
|
500
|
+
var _ref2 = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
501
|
+
dataOptions = _ref2.options,
|
|
502
|
+
dataContext = _ref2.context;
|
|
503
|
+
|
|
504
|
+
var migratedOptions = Object.assign(Object.assign(Object.assign({}, defaultChanges), migrateChartingOptions(options)), dataOptions); // remove invalid options
|
|
505
|
+
|
|
455
506
|
Object.keys(migratedOptions).forEach(function (key) {
|
|
456
507
|
if (!validOptions[key]) {
|
|
457
508
|
delete migratedOptions[key];
|
|
@@ -461,6 +512,7 @@ var migrateBaseChartingVizDefinition = function migrateBaseChartingVizDefinition
|
|
|
461
512
|
migratedDefinition.context = dataContext;
|
|
462
513
|
return migratedDefinition;
|
|
463
514
|
};
|
|
515
|
+
|
|
464
516
|
exports.migrateBaseChartingVizDefinition = migrateBaseChartingVizDefinition;
|
|
465
517
|
|
|
466
518
|
/***/ }),
|
|
@@ -483,18 +535,23 @@ exports.consolidateTrendDisplay = void 0;
|
|
|
483
535
|
* 4. if both the old options are undefined, return nothing as their defaults (true and `absolute`)
|
|
484
536
|
* correspond to `trendDisplay` default - absolute
|
|
485
537
|
*/
|
|
538
|
+
|
|
486
539
|
var consolidateTrendDisplay = function consolidateTrendDisplay(trendDisplayMode, showTrendIndicator) {
|
|
487
540
|
if (showTrendIndicator === false) {
|
|
488
541
|
return 'off';
|
|
489
542
|
}
|
|
543
|
+
|
|
490
544
|
if (['absolute', 'percent'].includes(trendDisplayMode)) {
|
|
491
545
|
return trendDisplayMode;
|
|
492
546
|
}
|
|
547
|
+
|
|
493
548
|
if (showTrendIndicator === true) {
|
|
494
549
|
return 'absolute';
|
|
495
550
|
}
|
|
551
|
+
|
|
496
552
|
return null;
|
|
497
553
|
};
|
|
554
|
+
|
|
498
555
|
exports.consolidateTrendDisplay = consolidateTrendDisplay;
|
|
499
556
|
|
|
500
557
|
/***/ }),
|
|
@@ -534,19 +591,24 @@ exports.consolidateDisplayOption = void 0;
|
|
|
534
591
|
* @param {Boolean} percentageOption - either one of `usePercentageRange` or `usePercentageValue` in the old gauges
|
|
535
592
|
* @returns {String}
|
|
536
593
|
*/
|
|
594
|
+
|
|
537
595
|
var consolidateDisplayOption = function consolidateDisplayOption(showOption, percentageOption) {
|
|
538
596
|
if (showOption === false) {
|
|
539
597
|
return 'off';
|
|
540
598
|
}
|
|
599
|
+
|
|
541
600
|
if (percentageOption === true) {
|
|
542
601
|
return 'percentage';
|
|
543
602
|
}
|
|
603
|
+
|
|
544
604
|
if (showOption === true) {
|
|
545
605
|
return 'number';
|
|
546
|
-
}
|
|
547
|
-
|
|
606
|
+
} // if showOption is undefined and percentageOption is false, we don't need to return an explicit value (since 'number' is passed in implicitly)
|
|
607
|
+
|
|
608
|
+
|
|
548
609
|
return null;
|
|
549
610
|
};
|
|
611
|
+
|
|
550
612
|
exports.consolidateDisplayOption = consolidateDisplayOption;
|
|
551
613
|
|
|
552
614
|
/***/ }),
|
|
@@ -570,24 +632,33 @@ module.exports = require("lodash");
|
|
|
570
632
|
|
|
571
633
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
572
634
|
if (k2 === undefined) k2 = k;
|
|
573
|
-
Object.
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
635
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
636
|
+
|
|
637
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
638
|
+
desc = {
|
|
639
|
+
enumerable: true,
|
|
640
|
+
get: function get() {
|
|
641
|
+
return m[k];
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
Object.defineProperty(o, k2, desc);
|
|
579
647
|
} : function (o, m, k, k2) {
|
|
580
648
|
if (k2 === undefined) k2 = k;
|
|
581
649
|
o[k2] = m[k];
|
|
582
650
|
});
|
|
651
|
+
|
|
583
652
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
584
653
|
for (var p in m) {
|
|
585
654
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
586
655
|
}
|
|
587
656
|
};
|
|
657
|
+
|
|
588
658
|
Object.defineProperty(exports, "__esModule", {
|
|
589
659
|
value: true
|
|
590
660
|
});
|
|
661
|
+
|
|
591
662
|
__exportStar(__webpack_require__(11), exports);
|
|
592
663
|
|
|
593
664
|
/***/ }),
|
|
@@ -601,7 +672,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
601
672
|
value: true
|
|
602
673
|
});
|
|
603
674
|
exports.inferToType = exports.canMigrate = exports.migrate = void 0;
|
|
675
|
+
|
|
604
676
|
var visualizations_1 = __webpack_require__(12);
|
|
677
|
+
|
|
605
678
|
var supportedMigrations = {
|
|
606
679
|
'viz.area': {
|
|
607
680
|
'splunk.area': visualizations_1.migrateVizToSplunkArea
|
|
@@ -670,39 +743,55 @@ var supportedMigrations = {
|
|
|
670
743
|
'splunk.punchcard': visualizations_1.migrateVizToSplunkPunchcard
|
|
671
744
|
}
|
|
672
745
|
};
|
|
746
|
+
|
|
673
747
|
var inferToType = function inferToType(typeFromDefinition) {
|
|
674
748
|
if (typeFromDefinition === 'viz.img') {
|
|
675
749
|
return 'splunk.image';
|
|
676
750
|
}
|
|
751
|
+
|
|
677
752
|
if (typeFromDefinition === 'viz.text') {
|
|
678
753
|
return 'splunk.markdown';
|
|
679
754
|
}
|
|
755
|
+
|
|
680
756
|
if (typeFromDefinition === 'viz.geojson.us' || typeFromDefinition === 'viz.geojson.world') {
|
|
681
757
|
return 'splunk.map';
|
|
682
758
|
}
|
|
759
|
+
|
|
683
760
|
return typeFromDefinition.replace(/^viz\./, 'splunk.');
|
|
684
761
|
};
|
|
762
|
+
|
|
685
763
|
exports.inferToType = inferToType;
|
|
764
|
+
|
|
686
765
|
var migrate = function migrate(_ref) {
|
|
687
766
|
var definition = _ref.definition,
|
|
688
|
-
|
|
767
|
+
toTypeFromParams = _ref.toType;
|
|
768
|
+
|
|
689
769
|
var _a;
|
|
770
|
+
|
|
690
771
|
var toType = toTypeFromParams !== null && toTypeFromParams !== void 0 ? toTypeFromParams : inferToType(definition.type);
|
|
772
|
+
|
|
691
773
|
if (!((_a = supportedMigrations === null || supportedMigrations === void 0 ? void 0 : supportedMigrations[definition === null || definition === void 0 ? void 0 : definition.type]) === null || _a === void 0 ? void 0 : _a[toType])) {
|
|
692
774
|
throw new Error('Migration currently not supported');
|
|
693
775
|
}
|
|
776
|
+
|
|
694
777
|
return supportedMigrations[definition.type][toType](definition);
|
|
695
778
|
};
|
|
779
|
+
|
|
696
780
|
exports.migrate = migrate;
|
|
781
|
+
|
|
697
782
|
var canMigrate = function canMigrate(_ref2) {
|
|
698
783
|
var fromType = _ref2.fromType,
|
|
699
|
-
|
|
784
|
+
toType = _ref2.toType;
|
|
785
|
+
|
|
700
786
|
var _a;
|
|
787
|
+
|
|
701
788
|
if ((_a = supportedMigrations === null || supportedMigrations === void 0 ? void 0 : supportedMigrations[fromType]) === null || _a === void 0 ? void 0 : _a[toType]) {
|
|
702
789
|
return true;
|
|
703
790
|
}
|
|
791
|
+
|
|
704
792
|
return false;
|
|
705
793
|
};
|
|
794
|
+
|
|
706
795
|
exports.canMigrate = canMigrate;
|
|
707
796
|
|
|
708
797
|
/***/ }),
|
|
@@ -714,44 +803,73 @@ exports.canMigrate = canMigrate;
|
|
|
714
803
|
|
|
715
804
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
716
805
|
if (k2 === undefined) k2 = k;
|
|
717
|
-
Object.
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
806
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
807
|
+
|
|
808
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
809
|
+
desc = {
|
|
810
|
+
enumerable: true,
|
|
811
|
+
get: function get() {
|
|
812
|
+
return m[k];
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
Object.defineProperty(o, k2, desc);
|
|
723
818
|
} : function (o, m, k, k2) {
|
|
724
819
|
if (k2 === undefined) k2 = k;
|
|
725
820
|
o[k2] = m[k];
|
|
726
821
|
});
|
|
822
|
+
|
|
727
823
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
728
824
|
for (var p in m) {
|
|
729
825
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
730
826
|
}
|
|
731
827
|
};
|
|
828
|
+
|
|
732
829
|
Object.defineProperty(exports, "__esModule", {
|
|
733
830
|
value: true
|
|
734
831
|
});
|
|
832
|
+
|
|
735
833
|
__exportStar(__webpack_require__(13), exports);
|
|
834
|
+
|
|
736
835
|
__exportStar(__webpack_require__(17), exports);
|
|
836
|
+
|
|
737
837
|
__exportStar(__webpack_require__(19), exports);
|
|
838
|
+
|
|
738
839
|
__exportStar(__webpack_require__(21), exports);
|
|
840
|
+
|
|
739
841
|
__exportStar(__webpack_require__(24), exports);
|
|
842
|
+
|
|
740
843
|
__exportStar(__webpack_require__(26), exports);
|
|
844
|
+
|
|
741
845
|
__exportStar(__webpack_require__(28), exports);
|
|
846
|
+
|
|
742
847
|
__exportStar(__webpack_require__(30), exports);
|
|
848
|
+
|
|
743
849
|
__exportStar(__webpack_require__(32), exports);
|
|
850
|
+
|
|
744
851
|
__exportStar(__webpack_require__(34), exports);
|
|
852
|
+
|
|
745
853
|
__exportStar(__webpack_require__(35), exports);
|
|
854
|
+
|
|
746
855
|
__exportStar(__webpack_require__(37), exports);
|
|
856
|
+
|
|
747
857
|
__exportStar(__webpack_require__(39), exports);
|
|
858
|
+
|
|
748
859
|
__exportStar(__webpack_require__(41), exports);
|
|
860
|
+
|
|
749
861
|
__exportStar(__webpack_require__(43), exports);
|
|
862
|
+
|
|
750
863
|
__exportStar(__webpack_require__(45), exports);
|
|
864
|
+
|
|
751
865
|
__exportStar(__webpack_require__(47), exports);
|
|
866
|
+
|
|
752
867
|
__exportStar(__webpack_require__(49), exports);
|
|
868
|
+
|
|
753
869
|
__exportStar(__webpack_require__(52), exports);
|
|
870
|
+
|
|
754
871
|
__exportStar(__webpack_require__(53), exports);
|
|
872
|
+
|
|
755
873
|
__exportStar(__webpack_require__(55), exports);
|
|
756
874
|
|
|
757
875
|
/***/ }),
|
|
@@ -765,10 +883,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
765
883
|
value: true
|
|
766
884
|
});
|
|
767
885
|
exports.migrateVizToSplunkArea = void 0;
|
|
886
|
+
|
|
768
887
|
var Area_config_1 = __webpack_require__(14);
|
|
888
|
+
|
|
769
889
|
var splunk_charting_1 = __webpack_require__(2);
|
|
770
|
-
|
|
771
|
-
// old default configurations should be retained in migrated configuration
|
|
890
|
+
|
|
891
|
+
var validOptions = Object.assign({}, Area_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
892
|
+
|
|
772
893
|
var defaultChanges = {
|
|
773
894
|
yAxisAbbreviation: 'off',
|
|
774
895
|
y2AxisAbbreviation: 'off',
|
|
@@ -776,14 +897,16 @@ var defaultChanges = {
|
|
|
776
897
|
legendTruncation: 'ellipsisMiddle',
|
|
777
898
|
showY2MajorGridLines: true
|
|
778
899
|
};
|
|
900
|
+
|
|
779
901
|
var migrateVizToSplunkArea = function migrateVizToSplunkArea(vizDefinition) {
|
|
780
|
-
return splunk_charting_1.migrateBaseChartingVizDefinition({
|
|
902
|
+
return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
|
|
781
903
|
defaultChanges: defaultChanges,
|
|
782
904
|
validOptions: validOptions,
|
|
783
905
|
vizDefinition: vizDefinition,
|
|
784
906
|
vizType: 'splunk.area'
|
|
785
907
|
});
|
|
786
908
|
};
|
|
909
|
+
|
|
787
910
|
exports.migrateVizToSplunkArea = migrateVizToSplunkArea;
|
|
788
911
|
|
|
789
912
|
/***/ }),
|
|
@@ -800,28 +923,36 @@ module.exports = require("@splunk/visualizations/Area.config");
|
|
|
800
923
|
|
|
801
924
|
|
|
802
925
|
var _typeof = __webpack_require__(4);
|
|
926
|
+
|
|
803
927
|
var _toConsumableArray = __webpack_require__(5);
|
|
928
|
+
|
|
804
929
|
Object.defineProperty(exports, "__esModule", {
|
|
805
930
|
value: true
|
|
806
931
|
});
|
|
807
932
|
exports.encodingToDynamicOptionsDSL = void 0;
|
|
808
|
-
|
|
809
|
-
// @TODO(pwied): move the parsing helpers so we can deprecate visualization-encoding-parsers package
|
|
933
|
+
|
|
934
|
+
var Base_1 = __webpack_require__(16); // @TODO(pwied): move the parsing helpers so we can deprecate visualization-encoding-parsers package
|
|
810
935
|
// index based references are defined by <dataSource>[<index>]
|
|
811
936
|
// this regex matches <text with numbers>[<anything>]
|
|
812
937
|
// the "[" "]" part makes it an index based reference
|
|
813
|
-
|
|
814
|
-
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
var indexBasedRegx = /^[A-Za-z0-9_]+\[.*\].*$/; // name based references are defined by <dataSource>.<columnName>
|
|
815
941
|
// the "." access makes it a name based reference
|
|
942
|
+
|
|
816
943
|
var nameBasedRegx = /^[A-Za-z0-9_]+\..*$/;
|
|
944
|
+
|
|
817
945
|
var isIndexBasedReference = function isIndexBasedReference(ref) {
|
|
818
946
|
return indexBasedRegx.test(ref);
|
|
819
947
|
};
|
|
948
|
+
|
|
820
949
|
var isNameBasedReference = function isNameBasedReference(ref) {
|
|
821
950
|
return nameBasedRegx.test(ref);
|
|
822
951
|
};
|
|
952
|
+
|
|
823
953
|
var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key, translatedValue) {
|
|
824
954
|
var _a, _b, _c, _d, _e, _f;
|
|
955
|
+
|
|
825
956
|
switch ((_a = fieldReference === null || fieldReference === void 0 ? void 0 : fieldReference.format) === null || _a === void 0 ? void 0 : _a.type) {
|
|
826
957
|
case 'gradient':
|
|
827
958
|
return {
|
|
@@ -833,6 +964,7 @@ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key,
|
|
|
833
964
|
contextKey: "".concat(key, "GradientContext"),
|
|
834
965
|
dsl: "".concat(translatedValue, " | gradient(").concat(key, "GradientContext)")
|
|
835
966
|
};
|
|
967
|
+
|
|
836
968
|
case 'rangevalue':
|
|
837
969
|
{
|
|
838
970
|
var contextKey = "".concat(key, "RangeValueContext");
|
|
@@ -842,6 +974,7 @@ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key,
|
|
|
842
974
|
dsl: "".concat(translatedValue, " | rangeValue(").concat(contextKey, ")")
|
|
843
975
|
};
|
|
844
976
|
}
|
|
977
|
+
|
|
845
978
|
case 'matchvalue':
|
|
846
979
|
{
|
|
847
980
|
var defaultValue = (_e = fieldReference.format) === null || _e === void 0 ? void 0 : _e.defaultValue;
|
|
@@ -852,9 +985,11 @@ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key,
|
|
|
852
985
|
dsl: "".concat(translatedValue, " | matchValue(").concat(matchValueContextKey).concat(defaultValue !== null && defaultValue !== undefined ? ", ".concat(typeof defaultValue === 'string' ? "\"".concat(defaultValue, "\"") : defaultValue) : '', ")")
|
|
853
986
|
};
|
|
854
987
|
}
|
|
988
|
+
|
|
855
989
|
default:
|
|
856
990
|
break;
|
|
857
991
|
}
|
|
992
|
+
|
|
858
993
|
return null;
|
|
859
994
|
};
|
|
860
995
|
/**
|
|
@@ -873,38 +1008,51 @@ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key,
|
|
|
873
1008
|
* 3. index or name based selections
|
|
874
1009
|
* ['primary.foo', 'primary[1]'] => '> primary | frameBySeriesNamesOrIndexes("foo",1)'
|
|
875
1010
|
*/
|
|
1011
|
+
|
|
1012
|
+
|
|
876
1013
|
var translateArrayFormatDataReference = function translateArrayFormatDataReference(encodingDataReference) {
|
|
877
1014
|
if (encodingDataReference.length === 0) {
|
|
878
1015
|
return null;
|
|
879
1016
|
}
|
|
1017
|
+
|
|
880
1018
|
var allIndexBased = encodingDataReference.every(isIndexBasedReference);
|
|
881
1019
|
var allNameBased = encodingDataReference.every(isNameBasedReference);
|
|
1020
|
+
|
|
882
1021
|
if (allIndexBased) {
|
|
883
|
-
var
|
|
884
|
-
|
|
1022
|
+
var _ref = (0, Base_1.parseIndexBasedFieldReference)(encodingDataReference[0]),
|
|
1023
|
+
_dataSourceName = _ref.dataSourceName;
|
|
1024
|
+
|
|
885
1025
|
var indexesStr = encodingDataReference.map(function (ref) {
|
|
886
1026
|
var _a;
|
|
887
|
-
|
|
1027
|
+
|
|
1028
|
+
return (_a = (0, Base_1.parseIndexBasedFieldReference)(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex;
|
|
888
1029
|
}).join(',');
|
|
889
1030
|
return "> ".concat(_dataSourceName, " | frameBySeriesIndexes(").concat(indexesStr, ")");
|
|
890
1031
|
}
|
|
1032
|
+
|
|
891
1033
|
if (allNameBased) {
|
|
892
|
-
var
|
|
893
|
-
|
|
1034
|
+
var _ref2 = (0, Base_1.parseNameBasedFieldReference)(encodingDataReference[0]),
|
|
1035
|
+
_dataSourceName2 = _ref2.dataSourceName;
|
|
1036
|
+
|
|
894
1037
|
var namesStr = encodingDataReference.map(function (ref) {
|
|
895
1038
|
var _a;
|
|
896
|
-
|
|
1039
|
+
|
|
1040
|
+
return "\"".concat((_a = (0, Base_1.parseNameBasedFieldReference)(ref)) === null || _a === void 0 ? void 0 : _a.fieldName, "\"");
|
|
897
1041
|
}).join(',');
|
|
898
1042
|
return "> ".concat(_dataSourceName2, " | frameBySeriesNames(").concat(namesStr, ")");
|
|
899
|
-
}
|
|
900
|
-
// it's a mix of name and index based references
|
|
1043
|
+
} // it's a mix of name and index based references
|
|
901
1044
|
// get the first ref to extract the dataSource
|
|
1045
|
+
|
|
1046
|
+
|
|
902
1047
|
var firstEntry = encodingDataReference[0];
|
|
903
|
-
|
|
904
|
-
|
|
1048
|
+
|
|
1049
|
+
var _ref3 = isIndexBasedReference(firstEntry) ? (0, Base_1.parseIndexBasedFieldReference)(firstEntry) : (0, Base_1.parseNameBasedFieldReference)(firstEntry),
|
|
1050
|
+
dataSourceName = _ref3.dataSourceName;
|
|
1051
|
+
|
|
905
1052
|
var paramStr = encodingDataReference.map(function (ref) {
|
|
906
1053
|
var _a, _b;
|
|
907
|
-
|
|
1054
|
+
|
|
1055
|
+
return isIndexBasedReference(ref) ? (_a = (0, Base_1.parseIndexBasedFieldReference)(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex : "\"".concat((_b = (0, Base_1.parseNameBasedFieldReference)(ref)) === null || _b === void 0 ? void 0 : _b.fieldName, "\"");
|
|
908
1056
|
}).join(',');
|
|
909
1057
|
return "> ".concat(dataSourceName, " | frameBySeriesNamesOrIndexes(").concat(paramStr, ")");
|
|
910
1058
|
};
|
|
@@ -924,51 +1072,67 @@ var translateArrayFormatDataReference = function translateArrayFormatDataReferen
|
|
|
924
1072
|
* Encoding references
|
|
925
1073
|
* 'encoding.x' => '> x'
|
|
926
1074
|
*/
|
|
1075
|
+
|
|
1076
|
+
|
|
927
1077
|
var translateDataReference = function translateDataReference(encodingDataReference) {
|
|
928
1078
|
if (encodingDataReference.indexOf('encoding.') === 0) {
|
|
929
1079
|
return "> ".concat(encodingDataReference.replace('encoding.', ''));
|
|
930
1080
|
}
|
|
1081
|
+
|
|
931
1082
|
var isIndexBasedRef = isIndexBasedReference(encodingDataReference);
|
|
932
1083
|
var isNameBasedRef = isNameBasedReference(encodingDataReference);
|
|
1084
|
+
|
|
933
1085
|
if (!isIndexBasedRef && !isNameBasedRef) {
|
|
934
1086
|
console.warn('Unable to parse the encoding. Please verify the encoding format is correct');
|
|
935
1087
|
return null;
|
|
936
1088
|
}
|
|
1089
|
+
|
|
937
1090
|
if (isNameBasedRef) {
|
|
938
|
-
var
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1091
|
+
var _ref4 = (0, Base_1.parseNameBasedFieldReference)(encodingDataReference),
|
|
1092
|
+
dataSourceName = _ref4.dataSourceName,
|
|
1093
|
+
fieldName = _ref4.fieldName,
|
|
1094
|
+
columnIndex = _ref4.columnIndex;
|
|
1095
|
+
|
|
942
1096
|
var returnString = "> ".concat(dataSourceName, " | seriesByName(\"").concat(fieldName, "\")");
|
|
1097
|
+
|
|
943
1098
|
if (columnIndex) {
|
|
944
1099
|
returnString += " | pointByIndex(".concat(columnIndex, ")");
|
|
945
1100
|
}
|
|
1101
|
+
|
|
946
1102
|
return returnString;
|
|
947
1103
|
}
|
|
1104
|
+
|
|
948
1105
|
if (isIndexBasedRef) {
|
|
949
|
-
var
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1106
|
+
var _ref5 = (0, Base_1.parseIndexBasedFieldReference)(encodingDataReference),
|
|
1107
|
+
_dataSourceName3 = _ref5.dataSourceName,
|
|
1108
|
+
fieldIndex = _ref5.fieldIndex,
|
|
1109
|
+
_columnIndex = _ref5.columnIndex,
|
|
1110
|
+
isFieldIndexRange = _ref5.isFieldIndexRange,
|
|
1111
|
+
fromFieldIndex = _ref5.fromFieldIndex,
|
|
1112
|
+
toFieldIndex = _ref5.toFieldIndex;
|
|
1113
|
+
|
|
956
1114
|
if (isFieldIndexRange) {
|
|
957
1115
|
var dslToIndexString;
|
|
1116
|
+
|
|
958
1117
|
if (toFieldIndex === -1) {
|
|
959
1118
|
dslToIndexString = '';
|
|
960
1119
|
} else {
|
|
961
1120
|
// adjust index, DSL is using default slice behavior whereas encoding behaved differently
|
|
962
1121
|
dslToIndexString = ",".concat(toFieldIndex + 1);
|
|
963
1122
|
}
|
|
1123
|
+
|
|
964
1124
|
return "> ".concat(_dataSourceName3, " | frameBySeriesIndexRange(").concat(fromFieldIndex).concat(dslToIndexString, ")");
|
|
965
1125
|
}
|
|
1126
|
+
|
|
966
1127
|
var _returnString = "> ".concat(_dataSourceName3, " | seriesByIndex(").concat(fieldIndex, ")");
|
|
1128
|
+
|
|
967
1129
|
if (_columnIndex) {
|
|
968
1130
|
_returnString += " | pointByIndex(".concat(_columnIndex, ")");
|
|
969
1131
|
}
|
|
1132
|
+
|
|
970
1133
|
return _returnString;
|
|
971
1134
|
}
|
|
1135
|
+
|
|
972
1136
|
return null;
|
|
973
1137
|
};
|
|
974
1138
|
/**
|
|
@@ -997,6 +1161,8 @@ var translateDataReference = function translateDataReference(encodingDataReferen
|
|
|
997
1161
|
* }
|
|
998
1162
|
* }
|
|
999
1163
|
*/
|
|
1164
|
+
|
|
1165
|
+
|
|
1000
1166
|
var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding) {
|
|
1001
1167
|
var dynamicOptions = {
|
|
1002
1168
|
options: {},
|
|
@@ -1007,23 +1173,28 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
|
|
|
1007
1173
|
Object.keys(encodingObj).forEach(function (key) {
|
|
1008
1174
|
var fieldReference = encoding[key];
|
|
1009
1175
|
var fieldReferenceStr = fieldReference;
|
|
1176
|
+
|
|
1010
1177
|
if (_typeof(fieldReference) === 'object' && !Array.isArray(fieldReference)) {
|
|
1011
1178
|
var field = fieldReference.field;
|
|
1179
|
+
|
|
1012
1180
|
if (field && !Array.isArray(field)) {
|
|
1013
1181
|
fieldReferenceStr = field;
|
|
1014
1182
|
}
|
|
1015
1183
|
}
|
|
1016
|
-
|
|
1017
|
-
// field reference is either in form of array or string
|
|
1184
|
+
|
|
1185
|
+
var translatedValue; // field reference is either in form of array or string
|
|
1186
|
+
|
|
1018
1187
|
if (Array.isArray(fieldReference)) {
|
|
1019
1188
|
translatedValue = translateArrayFormatDataReference(fieldReference);
|
|
1020
1189
|
} else {
|
|
1021
1190
|
translatedValue = translateDataReference(fieldReferenceStr);
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1191
|
+
} // omit if translated value is not set
|
|
1192
|
+
|
|
1193
|
+
|
|
1024
1194
|
if (translatedValue) {
|
|
1025
1195
|
translatedOptions[key] = translatedValue;
|
|
1026
1196
|
var convertedFormatterObject = convertFormatterToDSL(fieldReference, key, translatedValue);
|
|
1197
|
+
|
|
1027
1198
|
if (convertedFormatterObject) {
|
|
1028
1199
|
translatedOptions[key] = convertedFormatterObject.dsl;
|
|
1029
1200
|
dynamicOptions.context[convertedFormatterObject.contextKey] = convertedFormatterObject.contextConfig;
|
|
@@ -1033,6 +1204,7 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
|
|
|
1033
1204
|
dynamicOptions.options = translatedOptions;
|
|
1034
1205
|
return dynamicOptions;
|
|
1035
1206
|
};
|
|
1207
|
+
|
|
1036
1208
|
exports.encodingToDynamicOptionsDSL = encodingToDynamicOptionsDSL;
|
|
1037
1209
|
|
|
1038
1210
|
/***/ }),
|
|
@@ -1052,10 +1224,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1052
1224
|
value: true
|
|
1053
1225
|
});
|
|
1054
1226
|
exports.migrateVizToSplunkBar = void 0;
|
|
1227
|
+
|
|
1055
1228
|
var Bar_config_1 = __webpack_require__(18);
|
|
1229
|
+
|
|
1056
1230
|
var splunk_charting_1 = __webpack_require__(2);
|
|
1057
|
-
|
|
1058
|
-
// old default configurations should be retained in migrated configuration
|
|
1231
|
+
|
|
1232
|
+
var validOptions = Object.assign({}, Bar_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1233
|
+
|
|
1059
1234
|
var defaultChanges = {
|
|
1060
1235
|
yAxisAbbreviation: 'off',
|
|
1061
1236
|
y2AxisAbbreviation: 'off',
|
|
@@ -1063,14 +1238,16 @@ var defaultChanges = {
|
|
|
1063
1238
|
legendTruncation: 'ellipsisMiddle',
|
|
1064
1239
|
showY2MajorGridLines: true
|
|
1065
1240
|
};
|
|
1241
|
+
|
|
1066
1242
|
var migrateVizToSplunkBar = function migrateVizToSplunkBar(vizDefinition) {
|
|
1067
|
-
return splunk_charting_1.migrateBaseChartingVizDefinition({
|
|
1243
|
+
return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
|
|
1068
1244
|
defaultChanges: defaultChanges,
|
|
1069
1245
|
validOptions: validOptions,
|
|
1070
1246
|
vizDefinition: vizDefinition,
|
|
1071
1247
|
vizType: 'splunk.bar'
|
|
1072
1248
|
});
|
|
1073
1249
|
};
|
|
1250
|
+
|
|
1074
1251
|
exports.migrateVizToSplunkBar = migrateVizToSplunkBar;
|
|
1075
1252
|
|
|
1076
1253
|
/***/ }),
|
|
@@ -1090,22 +1267,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1090
1267
|
value: true
|
|
1091
1268
|
});
|
|
1092
1269
|
exports.migrateVizToSplunkBubble = void 0;
|
|
1270
|
+
|
|
1093
1271
|
var Bubble_config_1 = __webpack_require__(20);
|
|
1272
|
+
|
|
1094
1273
|
var splunk_charting_1 = __webpack_require__(2);
|
|
1095
|
-
|
|
1096
|
-
// old default configurations should be retained in migrated configuration
|
|
1274
|
+
|
|
1275
|
+
var validOptions = Object.assign({}, Bubble_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1276
|
+
|
|
1097
1277
|
var defaultChanges = {
|
|
1098
1278
|
yAxisAbbreviation: 'off',
|
|
1099
1279
|
legendTruncation: 'ellipsisMiddle'
|
|
1100
1280
|
};
|
|
1281
|
+
|
|
1101
1282
|
var migrateVizToSplunkBubble = function migrateVizToSplunkBubble(vizDefinition) {
|
|
1102
|
-
return splunk_charting_1.migrateBaseChartingVizDefinition({
|
|
1283
|
+
return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
|
|
1103
1284
|
defaultChanges: defaultChanges,
|
|
1104
1285
|
validOptions: validOptions,
|
|
1105
1286
|
vizDefinition: vizDefinition,
|
|
1106
1287
|
vizType: 'splunk.bubble'
|
|
1107
1288
|
});
|
|
1108
1289
|
};
|
|
1290
|
+
|
|
1109
1291
|
exports.migrateVizToSplunkBubble = migrateVizToSplunkBubble;
|
|
1110
1292
|
|
|
1111
1293
|
/***/ }),
|
|
@@ -1123,28 +1305,35 @@ module.exports = require("@splunk/visualizations/Bubble.config");
|
|
|
1123
1305
|
|
|
1124
1306
|
var __rest = this && this.__rest || function (s, e) {
|
|
1125
1307
|
var t = {};
|
|
1308
|
+
|
|
1126
1309
|
for (var p in s) {
|
|
1127
1310
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1128
1311
|
}
|
|
1312
|
+
|
|
1129
1313
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1130
1314
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1131
1315
|
}
|
|
1132
1316
|
return t;
|
|
1133
1317
|
};
|
|
1318
|
+
|
|
1134
1319
|
Object.defineProperty(exports, "__esModule", {
|
|
1135
1320
|
value: true
|
|
1136
1321
|
});
|
|
1137
1322
|
exports.migrateVizToSplunkChoroplethSvg = void 0;
|
|
1323
|
+
|
|
1138
1324
|
var ChoroplethSvg_config_1 = __webpack_require__(22);
|
|
1325
|
+
|
|
1139
1326
|
var encoding_1 = __webpack_require__(1);
|
|
1327
|
+
|
|
1140
1328
|
var migrationUtils_1 = __webpack_require__(0);
|
|
1329
|
+
|
|
1141
1330
|
var validOptions = Object.assign({}, ChoroplethSvg_config_1.default.optionsSchema);
|
|
1142
1331
|
var optionRenames = {
|
|
1143
1332
|
featureId: 'areaIds',
|
|
1144
1333
|
value: 'areaValues',
|
|
1145
1334
|
fill: 'areaColors'
|
|
1146
|
-
};
|
|
1147
|
-
|
|
1335
|
+
}; // old default encoding configurations should be retained in migrated configuration
|
|
1336
|
+
|
|
1148
1337
|
var defaultOptionChanges = {
|
|
1149
1338
|
areaIds: '> primary | seriesByIndex(0)',
|
|
1150
1339
|
areaValues: '> primary | seriesByIndex(1)',
|
|
@@ -1155,34 +1344,40 @@ var defaultContextChanges = {
|
|
|
1155
1344
|
colors: ['#7EEFDA', '#6484F6', '#C093F9', '#293873']
|
|
1156
1345
|
}
|
|
1157
1346
|
};
|
|
1347
|
+
|
|
1158
1348
|
var migrateVizToSplunkChoroplethSvg = function migrateVizToSplunkChoroplethSvg(vizDefinition) {
|
|
1159
1349
|
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1350
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1351
|
+
_vizDefinition$option = vizDefinition.options,
|
|
1352
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1353
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]); // translate encoding to dynamic options equivalent
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
1357
|
+
dataOptions = _ref.options,
|
|
1358
|
+
dataContext = _ref.context;
|
|
1359
|
+
|
|
1167
1360
|
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1168
1361
|
type: 'splunk.choropleth.svg',
|
|
1169
1362
|
options: {},
|
|
1170
1363
|
context: {}
|
|
1171
|
-
});
|
|
1172
|
-
|
|
1364
|
+
}); // add migrated option names and values
|
|
1365
|
+
|
|
1173
1366
|
var migratedOptions = Object.assign({}, options);
|
|
1174
1367
|
Object.keys(dataOptions).forEach(function (key) {
|
|
1175
1368
|
var _a;
|
|
1369
|
+
|
|
1176
1370
|
var updatedKey = (_a = optionRenames[key]) !== null && _a !== void 0 ? _a : key;
|
|
1177
1371
|
migratedOptions[updatedKey] = dataOptions[key];
|
|
1178
|
-
});
|
|
1179
|
-
|
|
1372
|
+
}); // update migrated options and context
|
|
1373
|
+
|
|
1180
1374
|
migratedDefinition.options = Object.assign(Object.assign({}, defaultOptionChanges), migratedOptions);
|
|
1181
|
-
migratedDefinition.context = encoding.fill ? dataContext : defaultContextChanges;
|
|
1182
|
-
|
|
1183
|
-
migrationUtils_1.removeInvalidOptions(migratedDefinition.options, validOptions);
|
|
1375
|
+
migratedDefinition.context = encoding.fill ? dataContext : defaultContextChanges; // remove invalid options
|
|
1376
|
+
|
|
1377
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedDefinition.options, validOptions);
|
|
1184
1378
|
return migratedDefinition;
|
|
1185
1379
|
};
|
|
1380
|
+
|
|
1186
1381
|
exports.migrateVizToSplunkChoroplethSvg = migrateVizToSplunkChoroplethSvg;
|
|
1187
1382
|
|
|
1188
1383
|
/***/ }),
|
|
@@ -1208,10 +1403,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1208
1403
|
value: true
|
|
1209
1404
|
});
|
|
1210
1405
|
exports.migrateVizToSplunkColumn = void 0;
|
|
1406
|
+
|
|
1211
1407
|
var Column_config_1 = __webpack_require__(25);
|
|
1408
|
+
|
|
1212
1409
|
var splunk_charting_1 = __webpack_require__(2);
|
|
1213
|
-
|
|
1214
|
-
// old default configurations should be retained in migrated configuration
|
|
1410
|
+
|
|
1411
|
+
var validOptions = Object.assign({}, Column_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1412
|
+
|
|
1215
1413
|
var defaultChanges = {
|
|
1216
1414
|
yAxisAbbreviation: 'off',
|
|
1217
1415
|
y2AxisAbbreviation: 'off',
|
|
@@ -1219,14 +1417,16 @@ var defaultChanges = {
|
|
|
1219
1417
|
legendTruncation: 'ellipsisMiddle',
|
|
1220
1418
|
showY2MajorGridLines: true
|
|
1221
1419
|
};
|
|
1420
|
+
|
|
1222
1421
|
var migrateVizToSplunkColumn = function migrateVizToSplunkColumn(vizDefinition) {
|
|
1223
|
-
return splunk_charting_1.migrateBaseChartingVizDefinition({
|
|
1422
|
+
return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
|
|
1224
1423
|
defaultChanges: defaultChanges,
|
|
1225
1424
|
validOptions: validOptions,
|
|
1226
1425
|
vizDefinition: vizDefinition,
|
|
1227
1426
|
vizType: 'splunk.column'
|
|
1228
1427
|
});
|
|
1229
1428
|
};
|
|
1429
|
+
|
|
1230
1430
|
exports.migrateVizToSplunkColumn = migrateVizToSplunkColumn;
|
|
1231
1431
|
|
|
1232
1432
|
/***/ }),
|
|
@@ -1244,51 +1444,64 @@ module.exports = require("@splunk/visualizations/Column.config");
|
|
|
1244
1444
|
|
|
1245
1445
|
var __rest = this && this.__rest || function (s, e) {
|
|
1246
1446
|
var t = {};
|
|
1447
|
+
|
|
1247
1448
|
for (var p in s) {
|
|
1248
1449
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1249
1450
|
}
|
|
1451
|
+
|
|
1250
1452
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1251
1453
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1252
1454
|
}
|
|
1253
1455
|
return t;
|
|
1254
1456
|
};
|
|
1457
|
+
|
|
1255
1458
|
Object.defineProperty(exports, "__esModule", {
|
|
1256
1459
|
value: true
|
|
1257
1460
|
});
|
|
1258
1461
|
exports.migrateVizToSplunkEllipse = void 0;
|
|
1462
|
+
|
|
1259
1463
|
var Ellipse_config_1 = __webpack_require__(27);
|
|
1464
|
+
|
|
1260
1465
|
var encoding_1 = __webpack_require__(1);
|
|
1466
|
+
|
|
1261
1467
|
var migrationUtils_1 = __webpack_require__(0);
|
|
1468
|
+
|
|
1262
1469
|
var validOptions = Object.assign({}, Ellipse_config_1.default.optionsSchema);
|
|
1263
1470
|
var optionsToRename = {
|
|
1264
1471
|
fill: 'fillColor',
|
|
1265
1472
|
stroke: 'strokeColor',
|
|
1266
1473
|
strokeDasharray: 'strokeDashStyle'
|
|
1267
1474
|
};
|
|
1475
|
+
|
|
1268
1476
|
var migrateVizToSplunkEllipse = function migrateVizToSplunkEllipse(vizDefinition) {
|
|
1269
1477
|
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1478
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1479
|
+
_vizDefinition$option = vizDefinition.options,
|
|
1480
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1481
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
1482
|
+
|
|
1274
1483
|
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1275
1484
|
type: 'splunk.ellipse',
|
|
1276
1485
|
options: options,
|
|
1277
1486
|
context: {}
|
|
1278
1487
|
});
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1488
|
+
|
|
1489
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
1490
|
+
dataOptions = _ref.options,
|
|
1491
|
+
dataContext = _ref.context; // To simulate the implicit logic in the shape parser that Ellipse utilizes, append
|
|
1282
1492
|
// the lastPoint() DataSeries selector.
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
migratedDefinition.options =
|
|
1287
|
-
|
|
1288
|
-
migrationUtils_1.
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
var updatedDataOptions = (0, migrationUtils_1.addsDataSelectorToOptions)(dataOptions, 'lastPoint()');
|
|
1496
|
+
migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions); // perform any option renaming
|
|
1497
|
+
|
|
1498
|
+
migratedDefinition.options = (0, migrationUtils_1.renameVizOptions)(migratedDefinition.options, optionsToRename); // remove invalid options from new definition
|
|
1499
|
+
|
|
1500
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedDefinition.options, validOptions);
|
|
1289
1501
|
migratedDefinition.context = dataContext;
|
|
1290
1502
|
return migratedDefinition;
|
|
1291
1503
|
};
|
|
1504
|
+
|
|
1292
1505
|
exports.migrateVizToSplunkEllipse = migrateVizToSplunkEllipse;
|
|
1293
1506
|
|
|
1294
1507
|
/***/ }),
|
|
@@ -1306,22 +1519,30 @@ module.exports = require("@splunk/visualizations/Ellipse.config");
|
|
|
1306
1519
|
|
|
1307
1520
|
var __rest = this && this.__rest || function (s, e) {
|
|
1308
1521
|
var t = {};
|
|
1522
|
+
|
|
1309
1523
|
for (var p in s) {
|
|
1310
1524
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1311
1525
|
}
|
|
1526
|
+
|
|
1312
1527
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1313
1528
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1314
1529
|
}
|
|
1315
1530
|
return t;
|
|
1316
1531
|
};
|
|
1532
|
+
|
|
1317
1533
|
Object.defineProperty(exports, "__esModule", {
|
|
1318
1534
|
value: true
|
|
1319
1535
|
});
|
|
1320
1536
|
exports.migrateVizToSplunkFillerGauge = void 0;
|
|
1537
|
+
|
|
1321
1538
|
var FillerGauge_config_1 = __webpack_require__(29);
|
|
1539
|
+
|
|
1322
1540
|
var encoding_1 = __webpack_require__(1);
|
|
1541
|
+
|
|
1323
1542
|
var gauges_1 = __webpack_require__(7);
|
|
1543
|
+
|
|
1324
1544
|
var migrationUtils_1 = __webpack_require__(0);
|
|
1545
|
+
|
|
1325
1546
|
var validOptions = Object.assign({}, FillerGauge_config_1.default.optionsSchema);
|
|
1326
1547
|
var optionRenames = {
|
|
1327
1548
|
majorUnit: 'majorTickInterval'
|
|
@@ -1350,30 +1571,38 @@ var defaultChanges = {
|
|
|
1350
1571
|
gaugeColor: '> value | rangeValue(gaugeColorRangeValueContext)',
|
|
1351
1572
|
value: '> primary | seriesByIndex(0) | lastPoint()'
|
|
1352
1573
|
};
|
|
1574
|
+
|
|
1353
1575
|
var migrateVizToSplunkFillerGauge = function migrateVizToSplunkFillerGauge(vizDefinition) {
|
|
1354
1576
|
var _a;
|
|
1577
|
+
|
|
1355
1578
|
var _vizDefinition$option = vizDefinition.options,
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1579
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1580
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
1581
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1582
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
1583
|
+
|
|
1360
1584
|
var migratedVisualization = Object.assign(Object.assign({
|
|
1361
1585
|
options: options
|
|
1362
1586
|
}, otherDefinitionParts), {
|
|
1363
1587
|
type: 'splunk.fillergauge',
|
|
1364
1588
|
context: {}
|
|
1365
1589
|
});
|
|
1366
|
-
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1590
|
+
var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
|
|
1591
|
+
|
|
1592
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
1593
|
+
encodingOptions = _ref.options,
|
|
1594
|
+
gaugeColorContext = _ref.context; // if a viz.fillergauge receives an entire column for `value` (e.g. primary[0]), it will select the last value of the column
|
|
1370
1595
|
// this contrasts with viz.markergauge (which takes the first point of the column)
|
|
1371
1596
|
// this is due to differing behavior in the FillerGaugeParser, which explicitly retrieves the last point in a received array
|
|
1372
1597
|
// https://cd.splunkdev.com/devplat/vision/-/blob/main/packages/visualization-encoding-parsers/src/FillerGaugeParser.js#L79
|
|
1598
|
+
|
|
1599
|
+
|
|
1373
1600
|
var originalGaugeValue = encodingOptions.value;
|
|
1601
|
+
|
|
1374
1602
|
if (typeof originalGaugeValue === 'string') {
|
|
1375
|
-
encodingOptions.value = (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalGaugeValue, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
|
|
1603
|
+
encodingOptions.value = (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalGaugeValue, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
|
|
1376
1604
|
}
|
|
1605
|
+
|
|
1377
1606
|
if (encodingOptions === null || encodingOptions === void 0 ? void 0 : encodingOptions.gaugeColor) {
|
|
1378
1607
|
migratedVisualization.context = gaugeColorContext;
|
|
1379
1608
|
} else {
|
|
@@ -1382,21 +1611,23 @@ var migrateVizToSplunkFillerGauge = function migrateVizToSplunkFillerGauge(vizDe
|
|
|
1382
1611
|
gaugeColorRangeValueContext: previousRangeValueConfig
|
|
1383
1612
|
};
|
|
1384
1613
|
}
|
|
1614
|
+
|
|
1385
1615
|
var showLabels = options.showLabels,
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
var labelDisplay = gauges_1.consolidateDisplayOption(showLabels, usePercentageRange);
|
|
1390
|
-
var valueDisplay = gauges_1.consolidateDisplayOption(showValue, usePercentageValue);
|
|
1616
|
+
usePercentageRange = options.usePercentageRange,
|
|
1617
|
+
showValue = options.showValue,
|
|
1618
|
+
usePercentageValue = options.usePercentageValue;
|
|
1619
|
+
var labelDisplay = (0, gauges_1.consolidateDisplayOption)(showLabels, usePercentageRange);
|
|
1620
|
+
var valueDisplay = (0, gauges_1.consolidateDisplayOption)(showValue, usePercentageValue);
|
|
1391
1621
|
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultChanges), renamedOptions), encodingOptions), typeof labelDisplay === 'string' && {
|
|
1392
1622
|
labelDisplay: labelDisplay
|
|
1393
1623
|
}), typeof valueDisplay === 'string' && {
|
|
1394
1624
|
valueDisplay: valueDisplay
|
|
1395
|
-
});
|
|
1396
|
-
|
|
1397
|
-
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
1625
|
+
}); // remove invalid options using the optionsSchema for splunk.fillergauge as reference
|
|
1626
|
+
|
|
1627
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
|
|
1398
1628
|
return migratedVisualization;
|
|
1399
1629
|
};
|
|
1630
|
+
|
|
1400
1631
|
exports.migrateVizToSplunkFillerGauge = migrateVizToSplunkFillerGauge;
|
|
1401
1632
|
|
|
1402
1633
|
/***/ }),
|
|
@@ -1416,11 +1647,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1416
1647
|
value: true
|
|
1417
1648
|
});
|
|
1418
1649
|
exports.migrateVizToSplunkLine = void 0;
|
|
1650
|
+
|
|
1419
1651
|
var Line_config_1 = __webpack_require__(31);
|
|
1652
|
+
|
|
1420
1653
|
var splunk_charting_1 = __webpack_require__(2);
|
|
1421
|
-
|
|
1422
|
-
// old default configurations should be retained in migrated configuration
|
|
1654
|
+
|
|
1655
|
+
var validOptions = Object.assign({}, Line_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1423
1656
|
// except for markerDisplay which migrates to the new default 'off'
|
|
1657
|
+
|
|
1424
1658
|
var defaultChanges = {
|
|
1425
1659
|
yAxisAbbreviation: 'off',
|
|
1426
1660
|
y2AxisAbbreviation: 'off',
|
|
@@ -1428,14 +1662,16 @@ var defaultChanges = {
|
|
|
1428
1662
|
legendTruncation: 'ellipsisMiddle',
|
|
1429
1663
|
showY2MajorGridLines: true
|
|
1430
1664
|
};
|
|
1665
|
+
|
|
1431
1666
|
var migrateVizToSplunkLine = function migrateVizToSplunkLine(vizDefinition) {
|
|
1432
|
-
return splunk_charting_1.migrateBaseChartingVizDefinition({
|
|
1667
|
+
return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
|
|
1433
1668
|
defaultChanges: defaultChanges,
|
|
1434
1669
|
validOptions: validOptions,
|
|
1435
1670
|
vizDefinition: vizDefinition,
|
|
1436
1671
|
vizType: 'splunk.line'
|
|
1437
1672
|
});
|
|
1438
1673
|
};
|
|
1674
|
+
|
|
1439
1675
|
exports.migrateVizToSplunkLine = migrateVizToSplunkLine;
|
|
1440
1676
|
|
|
1441
1677
|
/***/ }),
|
|
@@ -1453,35 +1689,44 @@ module.exports = require("@splunk/visualizations/Line.config");
|
|
|
1453
1689
|
|
|
1454
1690
|
var __rest = this && this.__rest || function (s, e) {
|
|
1455
1691
|
var t = {};
|
|
1692
|
+
|
|
1456
1693
|
for (var p in s) {
|
|
1457
1694
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1458
1695
|
}
|
|
1696
|
+
|
|
1459
1697
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1460
1698
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1461
1699
|
}
|
|
1462
1700
|
return t;
|
|
1463
1701
|
};
|
|
1702
|
+
|
|
1464
1703
|
Object.defineProperty(exports, "__esModule", {
|
|
1465
1704
|
value: true
|
|
1466
1705
|
});
|
|
1467
1706
|
exports.migrateVizToSplunkImage = void 0;
|
|
1707
|
+
|
|
1468
1708
|
var Image_config_1 = __webpack_require__(33);
|
|
1709
|
+
|
|
1469
1710
|
var migrationUtils_1 = __webpack_require__(0);
|
|
1711
|
+
|
|
1470
1712
|
var validOptions = Object.assign({}, Image_config_1.default.optionsSchema);
|
|
1713
|
+
|
|
1471
1714
|
var migrateVizToSplunkImage = function migrateVizToSplunkImage(vizDefinition) {
|
|
1472
1715
|
var _vizDefinition$option = vizDefinition.options,
|
|
1473
|
-
|
|
1474
|
-
|
|
1716
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1717
|
+
otherDefinitionParts = __rest(vizDefinition, ["options"]);
|
|
1718
|
+
|
|
1475
1719
|
var migratedVisualization = Object.assign(Object.assign({
|
|
1476
1720
|
options: options
|
|
1477
1721
|
}, otherDefinitionParts), {
|
|
1478
1722
|
type: 'splunk.image',
|
|
1479
1723
|
context: {}
|
|
1480
|
-
});
|
|
1481
|
-
|
|
1482
|
-
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
1724
|
+
}); // remove invalid options using the optionsSchema for splunk.image as reference
|
|
1725
|
+
|
|
1726
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
|
|
1483
1727
|
return migratedVisualization;
|
|
1484
1728
|
};
|
|
1729
|
+
|
|
1485
1730
|
exports.migrateVizToSplunkImage = migrateVizToSplunkImage;
|
|
1486
1731
|
|
|
1487
1732
|
/***/ }),
|
|
@@ -1499,35 +1744,44 @@ module.exports = require("@splunk/visualizations/Image.config");
|
|
|
1499
1744
|
|
|
1500
1745
|
var __rest = this && this.__rest || function (s, e) {
|
|
1501
1746
|
var t = {};
|
|
1747
|
+
|
|
1502
1748
|
for (var p in s) {
|
|
1503
1749
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1504
1750
|
}
|
|
1751
|
+
|
|
1505
1752
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1506
1753
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1507
1754
|
}
|
|
1508
1755
|
return t;
|
|
1509
1756
|
};
|
|
1757
|
+
|
|
1510
1758
|
Object.defineProperty(exports, "__esModule", {
|
|
1511
1759
|
value: true
|
|
1512
1760
|
});
|
|
1513
1761
|
exports.migrateVizToSplunkMarkdown = void 0;
|
|
1762
|
+
|
|
1514
1763
|
var Markdown_config_1 = __webpack_require__(8);
|
|
1764
|
+
|
|
1515
1765
|
var migrationUtils_1 = __webpack_require__(0);
|
|
1766
|
+
|
|
1516
1767
|
var validOptions = Object.assign({}, Markdown_config_1.default.optionsSchema);
|
|
1768
|
+
|
|
1517
1769
|
var migrateVizToSplunkMarkdown = function migrateVizToSplunkMarkdown(vizDefinition) {
|
|
1518
1770
|
var _vizDefinition$option = vizDefinition.options,
|
|
1519
|
-
|
|
1520
|
-
|
|
1771
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1772
|
+
otherDefinitionParts = __rest(vizDefinition, ["options"]);
|
|
1773
|
+
|
|
1521
1774
|
var migratedVisualization = Object.assign(Object.assign({
|
|
1522
1775
|
options: options
|
|
1523
1776
|
}, otherDefinitionParts), {
|
|
1524
1777
|
type: 'splunk.markdown',
|
|
1525
1778
|
context: {}
|
|
1526
|
-
});
|
|
1527
|
-
|
|
1528
|
-
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
1779
|
+
}); // remove invalid options using the optionsSchema for splunk.markdown as reference
|
|
1780
|
+
|
|
1781
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
|
|
1529
1782
|
return migratedVisualization;
|
|
1530
1783
|
};
|
|
1784
|
+
|
|
1531
1785
|
exports.migrateVizToSplunkMarkdown = migrateVizToSplunkMarkdown;
|
|
1532
1786
|
|
|
1533
1787
|
/***/ }),
|
|
@@ -1539,24 +1793,32 @@ exports.migrateVizToSplunkMarkdown = migrateVizToSplunkMarkdown;
|
|
|
1539
1793
|
|
|
1540
1794
|
var __rest = this && this.__rest || function (s, e) {
|
|
1541
1795
|
var t = {};
|
|
1796
|
+
|
|
1542
1797
|
for (var p in s) {
|
|
1543
1798
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1544
1799
|
}
|
|
1800
|
+
|
|
1545
1801
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1546
1802
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1547
1803
|
}
|
|
1548
1804
|
return t;
|
|
1549
1805
|
};
|
|
1806
|
+
|
|
1550
1807
|
Object.defineProperty(exports, "__esModule", {
|
|
1551
1808
|
value: true
|
|
1552
1809
|
});
|
|
1553
1810
|
exports.migrateVizToSplunkMarkerGauge = void 0;
|
|
1811
|
+
|
|
1554
1812
|
var MarkerGauge_config_1 = __webpack_require__(36);
|
|
1813
|
+
|
|
1555
1814
|
var encoding_1 = __webpack_require__(1);
|
|
1815
|
+
|
|
1556
1816
|
var migrationUtils_1 = __webpack_require__(0);
|
|
1817
|
+
|
|
1557
1818
|
var gauges_1 = __webpack_require__(7);
|
|
1558
|
-
|
|
1559
|
-
// old default configurations should be retained in migrated configuration
|
|
1819
|
+
|
|
1820
|
+
var validOptions = Object.assign({}, MarkerGauge_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
1821
|
+
|
|
1560
1822
|
var defaultChanges = {
|
|
1561
1823
|
gaugeRanges: [{
|
|
1562
1824
|
from: 90,
|
|
@@ -1577,43 +1839,52 @@ var optionRenames = {
|
|
|
1577
1839
|
majorUnit: 'majorTickInterval',
|
|
1578
1840
|
ranges: 'gaugeRanges'
|
|
1579
1841
|
};
|
|
1842
|
+
|
|
1580
1843
|
var migrateVizToSplunkMarkerGauge = function migrateVizToSplunkMarkerGauge(vizDefinition) {
|
|
1581
1844
|
var _a;
|
|
1845
|
+
|
|
1582
1846
|
var _vizDefinition$option = vizDefinition.options,
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1847
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1848
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
1849
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1850
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
1851
|
+
|
|
1587
1852
|
var migratedVisualization = Object.assign(Object.assign({
|
|
1588
1853
|
options: options
|
|
1589
1854
|
}, otherDefinitionParts), {
|
|
1590
1855
|
type: 'splunk.markergauge',
|
|
1591
1856
|
context: {}
|
|
1592
1857
|
});
|
|
1593
|
-
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
1594
|
-
|
|
1595
|
-
|
|
1858
|
+
var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
|
|
1859
|
+
|
|
1860
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
1861
|
+
dataOptions = _ref.options; // viz.markergauge has behavior where if a column without a specific point (e.g. primary[1]) is selected,
|
|
1596
1862
|
// the markerGauge will only display the first point of the column
|
|
1597
1863
|
// the following logic accounts for this and appends firstPoint() to the DSL statement
|
|
1864
|
+
|
|
1865
|
+
|
|
1598
1866
|
var originalGaugeValue = dataOptions.value;
|
|
1867
|
+
|
|
1599
1868
|
if (typeof originalGaugeValue === 'string') {
|
|
1600
|
-
dataOptions.value = (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalGaugeValue, 'firstPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
|
|
1869
|
+
dataOptions.value = (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalGaugeValue, 'firstPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
|
|
1601
1870
|
}
|
|
1871
|
+
|
|
1602
1872
|
var showLabels = renamedOptions.showLabels,
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
var labelDisplay = gauges_1.consolidateDisplayOption(showLabels, usePercentageRange);
|
|
1607
|
-
var valueDisplay = gauges_1.consolidateDisplayOption(showValue, usePercentageValue);
|
|
1873
|
+
usePercentageRange = renamedOptions.usePercentageRange,
|
|
1874
|
+
showValue = renamedOptions.showValue,
|
|
1875
|
+
usePercentageValue = renamedOptions.usePercentageValue;
|
|
1876
|
+
var labelDisplay = (0, gauges_1.consolidateDisplayOption)(showLabels, usePercentageRange);
|
|
1877
|
+
var valueDisplay = (0, gauges_1.consolidateDisplayOption)(showValue, usePercentageValue);
|
|
1608
1878
|
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultChanges), renamedOptions), dataOptions), typeof labelDisplay === 'string' && {
|
|
1609
1879
|
labelDisplay: labelDisplay
|
|
1610
1880
|
}), typeof valueDisplay === 'string' && {
|
|
1611
1881
|
valueDisplay: valueDisplay
|
|
1612
|
-
});
|
|
1613
|
-
|
|
1614
|
-
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
1882
|
+
}); // remove invalid options using the optionsSchema for splunk.markergauge as reference
|
|
1883
|
+
|
|
1884
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
|
|
1615
1885
|
return migratedVisualization;
|
|
1616
1886
|
};
|
|
1887
|
+
|
|
1617
1888
|
exports.migrateVizToSplunkMarkerGauge = migrateVizToSplunkMarkerGauge;
|
|
1618
1889
|
|
|
1619
1890
|
/***/ }),
|
|
@@ -1631,53 +1902,68 @@ module.exports = require("@splunk/visualizations/MarkerGauge.config");
|
|
|
1631
1902
|
|
|
1632
1903
|
var __rest = this && this.__rest || function (s, e) {
|
|
1633
1904
|
var t = {};
|
|
1905
|
+
|
|
1634
1906
|
for (var p in s) {
|
|
1635
1907
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1636
1908
|
}
|
|
1909
|
+
|
|
1637
1910
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1638
1911
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1639
1912
|
}
|
|
1640
1913
|
return t;
|
|
1641
1914
|
};
|
|
1915
|
+
|
|
1642
1916
|
Object.defineProperty(exports, "__esModule", {
|
|
1643
1917
|
value: true
|
|
1644
1918
|
});
|
|
1645
1919
|
exports.migrateVizToSplunkPie = void 0;
|
|
1920
|
+
|
|
1646
1921
|
var Pie_config_1 = __webpack_require__(38);
|
|
1922
|
+
|
|
1647
1923
|
var encoding_1 = __webpack_require__(1);
|
|
1924
|
+
|
|
1648
1925
|
var splunk_charting_1 = __webpack_require__(2);
|
|
1926
|
+
|
|
1649
1927
|
var validOptions = Object.assign({}, Pie_config_1.default.optionsSchema);
|
|
1928
|
+
|
|
1650
1929
|
var migratePieChartLabelAndPercent = function migratePieChartLabelAndPercent(options) {
|
|
1651
1930
|
// if neither chart.showLabels or chart.showPercent is specified in viz.pie,
|
|
1652
1931
|
// splunk.pie use the default labelDisplay value
|
|
1653
1932
|
if (!('chart.showLabels' in options) && !('chart.showPercent' in options)) {
|
|
1654
1933
|
return {};
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1934
|
+
} // if only chart.showPercent is specified in viz.pie
|
|
1935
|
+
|
|
1936
|
+
|
|
1657
1937
|
if (!('chart.showLabels' in options) && 'chart.showPercent' in options) {
|
|
1658
1938
|
return {
|
|
1659
1939
|
labelDisplay: options['chart.showPercent'] ? 'valuesAndPercentage' : 'values'
|
|
1660
1940
|
};
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1941
|
+
} // if only chart.showLabels is specified in viz.pie
|
|
1942
|
+
|
|
1943
|
+
|
|
1663
1944
|
if ('chart.showLabels' in options && !('chart.showPercent' in options)) {
|
|
1664
1945
|
return {
|
|
1665
1946
|
labelDisplay: options['chart.showLabels'] ? 'values' : 'off'
|
|
1666
1947
|
};
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1948
|
+
} // if both chart.showLabels and chart.showPercent are specified in viz.pie
|
|
1949
|
+
|
|
1950
|
+
|
|
1669
1951
|
var labelOption = {
|
|
1670
1952
|
labelDisplay: 'values'
|
|
1671
1953
|
};
|
|
1954
|
+
|
|
1672
1955
|
if (options['chart.showLabels'] && options['chart.showPercent']) {
|
|
1673
1956
|
labelOption.labelDisplay = 'valuesAndPercentage';
|
|
1674
1957
|
}
|
|
1958
|
+
|
|
1675
1959
|
if (!options['chart.showLabels']) {
|
|
1676
1960
|
labelOption.labelDisplay = 'off';
|
|
1677
1961
|
}
|
|
1962
|
+
|
|
1678
1963
|
return labelOption;
|
|
1679
|
-
};
|
|
1680
|
-
|
|
1964
|
+
}; // retain the pie position when converting viz.pie to splunk.pie - SCP-48658
|
|
1965
|
+
|
|
1966
|
+
|
|
1681
1967
|
var migrateDonutChart = function migrateDonutChart(options) {
|
|
1682
1968
|
if (options.hasDonutHole) {
|
|
1683
1969
|
if (options['legend.placement'] === 'none') {
|
|
@@ -1685,37 +1971,44 @@ var migrateDonutChart = function migrateDonutChart(options) {
|
|
|
1685
1971
|
labelDisplay: 'off'
|
|
1686
1972
|
};
|
|
1687
1973
|
}
|
|
1974
|
+
|
|
1688
1975
|
return {
|
|
1689
1976
|
labelDisplay: 'values'
|
|
1690
1977
|
};
|
|
1691
1978
|
}
|
|
1979
|
+
|
|
1692
1980
|
return {};
|
|
1693
1981
|
};
|
|
1982
|
+
|
|
1694
1983
|
var migrateFieldColors = function migrateFieldColors(options) {
|
|
1695
1984
|
if ('fieldColors' in options) {
|
|
1696
1985
|
return {
|
|
1697
1986
|
seriesColorsByField: splunk_charting_1.otherValueReplacements.seriesColorsByField(options.fieldColors)
|
|
1698
1987
|
};
|
|
1699
1988
|
}
|
|
1989
|
+
|
|
1700
1990
|
return {};
|
|
1701
1991
|
};
|
|
1992
|
+
|
|
1702
1993
|
var migrateVizToSplunkPie = function migrateVizToSplunkPie(vizDefinition) {
|
|
1703
1994
|
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1995
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
1996
|
+
_vizDefinition$option = vizDefinition.options,
|
|
1997
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
1998
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
1999
|
+
|
|
1708
2000
|
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1709
2001
|
type: 'splunk.pie',
|
|
1710
2002
|
options: {},
|
|
1711
2003
|
context: {}
|
|
1712
|
-
});
|
|
1713
|
-
|
|
1714
|
-
var
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
// remove invalid options
|
|
2004
|
+
}); // translate encoding to dynamic options equivalent
|
|
2005
|
+
|
|
2006
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
2007
|
+
dataOptions = _ref.options,
|
|
2008
|
+
dataContext = _ref.context;
|
|
2009
|
+
|
|
2010
|
+
var migratedOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, migratePieChartLabelAndPercent(options)), (0, splunk_charting_1.migrateChartingOptions)(options)), migrateFieldColors(options)), migrateDonutChart(options)), dataOptions); // remove invalid options
|
|
2011
|
+
|
|
1719
2012
|
Object.keys(migratedOptions).forEach(function (key) {
|
|
1720
2013
|
if (!validOptions[key]) {
|
|
1721
2014
|
delete migratedOptions[key];
|
|
@@ -1725,6 +2018,7 @@ var migrateVizToSplunkPie = function migrateVizToSplunkPie(vizDefinition) {
|
|
|
1725
2018
|
migratedDefinition.context = dataContext;
|
|
1726
2019
|
return migratedDefinition;
|
|
1727
2020
|
};
|
|
2021
|
+
|
|
1728
2022
|
exports.migrateVizToSplunkPie = migrateVizToSplunkPie;
|
|
1729
2023
|
|
|
1730
2024
|
/***/ }),
|
|
@@ -1744,22 +2038,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1744
2038
|
value: true
|
|
1745
2039
|
});
|
|
1746
2040
|
exports.migrateVizToSplunkScatter = void 0;
|
|
2041
|
+
|
|
1747
2042
|
var Scatter_config_1 = __webpack_require__(40);
|
|
2043
|
+
|
|
1748
2044
|
var splunk_charting_1 = __webpack_require__(2);
|
|
1749
|
-
|
|
1750
|
-
// old default configurations should be retained in migrated configuration
|
|
2045
|
+
|
|
2046
|
+
var validOptions = Object.assign({}, Scatter_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
2047
|
+
|
|
1751
2048
|
var defaultChanges = {
|
|
1752
2049
|
yAxisAbbreviation: 'off',
|
|
1753
2050
|
legendTruncation: 'ellipsisMiddle'
|
|
1754
2051
|
};
|
|
2052
|
+
|
|
1755
2053
|
var migrateVizToSplunkScatter = function migrateVizToSplunkScatter(vizDefinition) {
|
|
1756
|
-
return splunk_charting_1.migrateBaseChartingVizDefinition({
|
|
2054
|
+
return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
|
|
1757
2055
|
defaultChanges: defaultChanges,
|
|
1758
2056
|
validOptions: validOptions,
|
|
1759
2057
|
vizDefinition: vizDefinition,
|
|
1760
2058
|
vizType: 'splunk.scatter'
|
|
1761
2059
|
});
|
|
1762
2060
|
};
|
|
2061
|
+
|
|
1763
2062
|
exports.migrateVizToSplunkScatter = migrateVizToSplunkScatter;
|
|
1764
2063
|
|
|
1765
2064
|
/***/ }),
|
|
@@ -1777,21 +2076,28 @@ module.exports = require("@splunk/visualizations/Scatter.config");
|
|
|
1777
2076
|
|
|
1778
2077
|
var __rest = this && this.__rest || function (s, e) {
|
|
1779
2078
|
var t = {};
|
|
2079
|
+
|
|
1780
2080
|
for (var p in s) {
|
|
1781
2081
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1782
2082
|
}
|
|
2083
|
+
|
|
1783
2084
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1784
2085
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1785
2086
|
}
|
|
1786
2087
|
return t;
|
|
1787
2088
|
};
|
|
2089
|
+
|
|
1788
2090
|
Object.defineProperty(exports, "__esModule", {
|
|
1789
2091
|
value: true
|
|
1790
2092
|
});
|
|
1791
2093
|
exports.migrateVizToSplunkRectangle = void 0;
|
|
2094
|
+
|
|
1792
2095
|
var Rectangle_config_1 = __webpack_require__(42);
|
|
2096
|
+
|
|
1793
2097
|
var encoding_1 = __webpack_require__(1);
|
|
2098
|
+
|
|
1794
2099
|
var migrationUtils_1 = __webpack_require__(0);
|
|
2100
|
+
|
|
1795
2101
|
var optionsToRename = {
|
|
1796
2102
|
fill: 'fillColor',
|
|
1797
2103
|
stroke: 'strokeColor',
|
|
@@ -1799,30 +2105,35 @@ var optionsToRename = {
|
|
|
1799
2105
|
strokeLinejoin: 'strokeJoinStyle'
|
|
1800
2106
|
};
|
|
1801
2107
|
var validOptions = Object.assign({}, Rectangle_config_1.default.optionsSchema);
|
|
2108
|
+
|
|
1802
2109
|
var migrateVizToSplunkRectangle = function migrateVizToSplunkRectangle(vizDefinition) {
|
|
1803
2110
|
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
2111
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2112
|
+
options = vizDefinition.options,
|
|
2113
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
2114
|
+
|
|
1807
2115
|
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1808
2116
|
type: 'splunk.rectangle',
|
|
1809
2117
|
options: {},
|
|
1810
2118
|
context: {}
|
|
1811
|
-
});
|
|
1812
|
-
|
|
1813
|
-
var
|
|
1814
|
-
|
|
1815
|
-
|
|
2119
|
+
}); // translate encoding to dynamic options equivalent
|
|
2120
|
+
|
|
2121
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
2122
|
+
dataOptions = _ref.options,
|
|
2123
|
+
dataContext = _ref.context; // To simulate the implicit logic in the shape parser that Rectangle utilizes, append
|
|
1816
2124
|
// the lastPoint() DataSeries selector.
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
migratedDefinition.options =
|
|
1821
|
-
|
|
1822
|
-
migrationUtils_1.
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
var updatedDataOptions = (0, migrationUtils_1.addsDataSelectorToOptions)(dataOptions, 'lastPoint()');
|
|
2128
|
+
migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions); // perform option rename
|
|
2129
|
+
|
|
2130
|
+
migratedDefinition.options = (0, migrationUtils_1.renameVizOptions)(migratedDefinition.options, optionsToRename); // remove invalid options, validOptions is taken from the config.optionsSchema
|
|
2131
|
+
|
|
2132
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedDefinition.options, validOptions);
|
|
1823
2133
|
migratedDefinition.context = dataContext;
|
|
1824
2134
|
return migratedDefinition;
|
|
1825
2135
|
};
|
|
2136
|
+
|
|
1826
2137
|
exports.migrateVizToSplunkRectangle = migrateVizToSplunkRectangle;
|
|
1827
2138
|
|
|
1828
2139
|
/***/ }),
|
|
@@ -1840,24 +2151,32 @@ module.exports = require("@splunk/visualizations/Rectangle.config");
|
|
|
1840
2151
|
|
|
1841
2152
|
var __rest = this && this.__rest || function (s, e) {
|
|
1842
2153
|
var t = {};
|
|
2154
|
+
|
|
1843
2155
|
for (var p in s) {
|
|
1844
2156
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1845
2157
|
}
|
|
2158
|
+
|
|
1846
2159
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1847
2160
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1848
2161
|
}
|
|
1849
2162
|
return t;
|
|
1850
2163
|
};
|
|
2164
|
+
|
|
1851
2165
|
Object.defineProperty(exports, "__esModule", {
|
|
1852
2166
|
value: true
|
|
1853
2167
|
});
|
|
1854
2168
|
exports.migrateVizToSplunkSingleValue = void 0;
|
|
2169
|
+
|
|
1855
2170
|
var SingleValue_config_1 = __webpack_require__(44);
|
|
2171
|
+
|
|
1856
2172
|
var encoding_1 = __webpack_require__(1);
|
|
2173
|
+
|
|
1857
2174
|
var migrationUtils_1 = __webpack_require__(0);
|
|
2175
|
+
|
|
1858
2176
|
var singlevalue_1 = __webpack_require__(3);
|
|
1859
|
-
|
|
1860
|
-
// old default configurations should be retained in migrated configuration
|
|
2177
|
+
|
|
2178
|
+
var validOptions = Object.assign({}, SingleValue_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
2179
|
+
|
|
1861
2180
|
var defaultsToRetain = {
|
|
1862
2181
|
showSparklineAreaGraph: false,
|
|
1863
2182
|
sparklineValues: '> primary | seriesByTypes("number", "string")'
|
|
@@ -1879,59 +2198,69 @@ var optionRenames = {
|
|
|
1879
2198
|
* 4. if both the old options are undefined, return nothing as their defaults (true and `below`)
|
|
1880
2199
|
* correspond to `sparklineDisplay` default - below
|
|
1881
2200
|
*/
|
|
2201
|
+
|
|
1882
2202
|
var consolidateSparklineDisplay = function consolidateSparklineDisplay(sparklinePosition, showSparkline) {
|
|
1883
2203
|
if (showSparkline === false) {
|
|
1884
2204
|
return 'off';
|
|
1885
2205
|
}
|
|
2206
|
+
|
|
1886
2207
|
if (['before', 'after', 'below'].includes(sparklinePosition)) {
|
|
1887
2208
|
return sparklinePosition;
|
|
1888
2209
|
}
|
|
2210
|
+
|
|
1889
2211
|
if (showSparkline === true) {
|
|
1890
2212
|
return 'below';
|
|
1891
2213
|
}
|
|
2214
|
+
|
|
1892
2215
|
return null;
|
|
1893
2216
|
};
|
|
2217
|
+
|
|
1894
2218
|
var migrateVizToSplunkSingleValue = function migrateVizToSplunkSingleValue(vizDefinition) {
|
|
1895
2219
|
var _a, _b, _c;
|
|
2220
|
+
|
|
1896
2221
|
var _vizDefinition$option = vizDefinition.options,
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
2222
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2223
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
2224
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2225
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
2226
|
+
|
|
1901
2227
|
var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1902
2228
|
type: 'splunk.singlevalue',
|
|
1903
2229
|
context: {},
|
|
1904
2230
|
options: {}
|
|
1905
2231
|
});
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
2232
|
+
|
|
2233
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
2234
|
+
dataOptions = _ref.options,
|
|
2235
|
+
dataContext = _ref.context;
|
|
2236
|
+
|
|
1909
2237
|
var migratedDataOptions = Object.assign(Object.assign(Object.assign(Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.trend) && {
|
|
1910
2238
|
sparklineValues: dataOptions.trend
|
|
1911
2239
|
}), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.majorColor) && {
|
|
1912
|
-
majorColor: (_a = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.majorColor, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.majorColor
|
|
2240
|
+
majorColor: (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(dataOptions.majorColor, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.majorColor
|
|
1913
2241
|
}), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.deltaColor) && {
|
|
1914
|
-
trendColor: (_b = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.deltaColor, 'lastPoint()')) !== null && _b !== void 0 ? _b : dataOptions.deltaColor
|
|
2242
|
+
trendColor: (_b = (0, migrationUtils_1.preserveDataSelectionForValueOption)(dataOptions.deltaColor, 'lastPoint()')) !== null && _b !== void 0 ? _b : dataOptions.deltaColor
|
|
1915
2243
|
}), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.fill) && {
|
|
1916
|
-
backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.fill, 'lastPoint()')) !== null && _c !== void 0 ? _c : dataOptions.fill
|
|
2244
|
+
backgroundColor: (_c = (0, migrationUtils_1.preserveDataSelectionForValueOption)(dataOptions.fill, 'lastPoint()')) !== null && _c !== void 0 ? _c : dataOptions.fill
|
|
1917
2245
|
});
|
|
1918
|
-
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
2246
|
+
var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
|
|
1919
2247
|
var trendDisplayMode = renamedOptions.trendDisplayMode,
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
|
|
2248
|
+
showTrendIndicator = renamedOptions.showTrendIndicator,
|
|
2249
|
+
showSparkline = renamedOptions.showSparkline,
|
|
2250
|
+
sparklinePosition = renamedOptions.sparklinePosition;
|
|
2251
|
+
var trendDisplay = (0, singlevalue_1.consolidateTrendDisplay)(trendDisplayMode, showTrendIndicator);
|
|
1924
2252
|
var sparklineDisplay = consolidateSparklineDisplay(sparklinePosition, showSparkline);
|
|
1925
2253
|
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
|
|
1926
2254
|
trendDisplay: trendDisplay
|
|
1927
2255
|
}), typeof sparklineDisplay === 'string' && {
|
|
1928
2256
|
sparklineDisplay: sparklineDisplay
|
|
1929
2257
|
});
|
|
1930
|
-
migratedVisualization.context = dataContext;
|
|
1931
|
-
|
|
1932
|
-
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
2258
|
+
migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalue as reference
|
|
2259
|
+
|
|
2260
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
|
|
1933
2261
|
return migratedVisualization;
|
|
1934
2262
|
};
|
|
2263
|
+
|
|
1935
2264
|
exports.migrateVizToSplunkSingleValue = migrateVizToSplunkSingleValue;
|
|
1936
2265
|
|
|
1937
2266
|
/***/ }),
|
|
@@ -1949,22 +2278,30 @@ module.exports = require("@splunk/visualizations/SingleValue.config");
|
|
|
1949
2278
|
|
|
1950
2279
|
var __rest = this && this.__rest || function (s, e) {
|
|
1951
2280
|
var t = {};
|
|
2281
|
+
|
|
1952
2282
|
for (var p in s) {
|
|
1953
2283
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1954
2284
|
}
|
|
2285
|
+
|
|
1955
2286
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1956
2287
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1957
2288
|
}
|
|
1958
2289
|
return t;
|
|
1959
2290
|
};
|
|
2291
|
+
|
|
1960
2292
|
Object.defineProperty(exports, "__esModule", {
|
|
1961
2293
|
value: true
|
|
1962
2294
|
});
|
|
1963
2295
|
exports.migrateVizToSplunkSingleValueIcon = void 0;
|
|
2296
|
+
|
|
1964
2297
|
var SingleValueIcon_config_1 = __webpack_require__(46);
|
|
2298
|
+
|
|
1965
2299
|
var encoding_1 = __webpack_require__(1);
|
|
2300
|
+
|
|
1966
2301
|
var migrationUtils_1 = __webpack_require__(0);
|
|
2302
|
+
|
|
1967
2303
|
var singlevalue_1 = __webpack_require__(3);
|
|
2304
|
+
|
|
1968
2305
|
var validOptions = Object.assign({}, SingleValueIcon_config_1.default.optionsSchema);
|
|
1969
2306
|
var defaultsToRetain = {
|
|
1970
2307
|
majorValue: '> primary | seriesByIndex(0) | lastPoint()',
|
|
@@ -1976,39 +2313,45 @@ var optionsToRename = {
|
|
|
1976
2313
|
deltaColor: 'trendColor',
|
|
1977
2314
|
color: 'iconColor'
|
|
1978
2315
|
};
|
|
2316
|
+
|
|
1979
2317
|
var migrateVizToSplunkSingleValueIcon = function migrateVizToSplunkSingleValueIcon(vizDefinition) {
|
|
1980
2318
|
var _a, _b, _c;
|
|
2319
|
+
|
|
1981
2320
|
var _vizDefinition$option = vizDefinition.options,
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
2321
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2322
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
2323
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2324
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
2325
|
+
|
|
1986
2326
|
var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
1987
2327
|
type: 'splunk.singlevalueicon',
|
|
1988
2328
|
context: {},
|
|
1989
2329
|
options: {}
|
|
1990
2330
|
});
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
2331
|
+
|
|
2332
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
2333
|
+
dataOptions = _ref.options,
|
|
2334
|
+
dataContext = _ref.context;
|
|
2335
|
+
|
|
1994
2336
|
var migratedDataOptions = Object.assign(Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.trend) && {
|
|
1995
|
-
majorValue: (_a = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.trend, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.trend,
|
|
1996
|
-
trendValue: (_b = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.trend, 'delta(-2)')) !== null && _b !== void 0 ? _b : dataOptions.trend
|
|
2337
|
+
majorValue: (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(dataOptions.trend, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.trend,
|
|
2338
|
+
trendValue: (_b = (0, migrationUtils_1.preserveDataSelectionForValueOption)(dataOptions.trend, 'delta(-2)')) !== null && _b !== void 0 ? _b : dataOptions.trend
|
|
1997
2339
|
}), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.fill) && {
|
|
1998
|
-
backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.fill, 'lastPoint()')) !== null && _c !== void 0 ? _c : dataOptions.fill
|
|
2340
|
+
backgroundColor: (_c = (0, migrationUtils_1.preserveDataSelectionForValueOption)(dataOptions.fill, 'lastPoint()')) !== null && _c !== void 0 ? _c : dataOptions.fill
|
|
1999
2341
|
});
|
|
2000
|
-
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionsToRename);
|
|
2342
|
+
var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionsToRename);
|
|
2001
2343
|
var trendDisplayMode = renamedOptions.trendDisplayMode,
|
|
2002
|
-
|
|
2003
|
-
var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
|
|
2344
|
+
showTrendIndicator = renamedOptions.showTrendIndicator;
|
|
2345
|
+
var trendDisplay = (0, singlevalue_1.consolidateTrendDisplay)(trendDisplayMode, showTrendIndicator);
|
|
2004
2346
|
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
|
|
2005
2347
|
trendDisplay: trendDisplay
|
|
2006
2348
|
});
|
|
2007
|
-
migratedVisualization.context = dataContext;
|
|
2008
|
-
|
|
2009
|
-
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
2349
|
+
migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueicon as reference
|
|
2350
|
+
|
|
2351
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
|
|
2010
2352
|
return migratedVisualization;
|
|
2011
2353
|
};
|
|
2354
|
+
|
|
2012
2355
|
exports.migrateVizToSplunkSingleValueIcon = migrateVizToSplunkSingleValueIcon;
|
|
2013
2356
|
|
|
2014
2357
|
/***/ }),
|
|
@@ -2026,24 +2369,32 @@ module.exports = require("@splunk/visualizations/SingleValueIcon.config");
|
|
|
2026
2369
|
|
|
2027
2370
|
var __rest = this && this.__rest || function (s, e) {
|
|
2028
2371
|
var t = {};
|
|
2372
|
+
|
|
2029
2373
|
for (var p in s) {
|
|
2030
2374
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2031
2375
|
}
|
|
2376
|
+
|
|
2032
2377
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2033
2378
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2034
2379
|
}
|
|
2035
2380
|
return t;
|
|
2036
2381
|
};
|
|
2382
|
+
|
|
2037
2383
|
Object.defineProperty(exports, "__esModule", {
|
|
2038
2384
|
value: true
|
|
2039
2385
|
});
|
|
2040
2386
|
exports.migrateVizToSplunkSingleValueRadial = void 0;
|
|
2387
|
+
|
|
2041
2388
|
var SingleValueRadial_config_1 = __webpack_require__(48);
|
|
2389
|
+
|
|
2042
2390
|
var encoding_1 = __webpack_require__(1);
|
|
2391
|
+
|
|
2043
2392
|
var migrationUtils_1 = __webpack_require__(0);
|
|
2393
|
+
|
|
2044
2394
|
var singlevalue_1 = __webpack_require__(3);
|
|
2045
|
-
|
|
2046
|
-
// old default configurations should be retained in migrated configuration
|
|
2395
|
+
|
|
2396
|
+
var validOptions = Object.assign({}, SingleValueRadial_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
2397
|
+
|
|
2047
2398
|
var defaultsToRetain = {
|
|
2048
2399
|
majorValue: '> primary | seriesByIndex(0) | lastPoint()',
|
|
2049
2400
|
trendValue: '> primary | seriesByIndex(0) | delta(-2)'
|
|
@@ -2052,41 +2403,47 @@ var optionRenames = {
|
|
|
2052
2403
|
useTrendUnits: 'shouldAbbreviateTrendValue',
|
|
2053
2404
|
useThousandSeparators: 'shouldUseThousandSeparators'
|
|
2054
2405
|
};
|
|
2406
|
+
|
|
2055
2407
|
var migrateVizToSplunkSingleValueRadial = function migrateVizToSplunkSingleValueRadial(vizDefinition) {
|
|
2056
2408
|
var _a, _b, _c;
|
|
2409
|
+
|
|
2057
2410
|
var _vizDefinition$option = vizDefinition.options,
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2411
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2412
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
2413
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2414
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
2415
|
+
|
|
2062
2416
|
var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
2063
2417
|
type: 'splunk.singlevalueradial',
|
|
2064
2418
|
context: {},
|
|
2065
2419
|
options: {}
|
|
2066
2420
|
});
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2421
|
+
|
|
2422
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
2423
|
+
dataOptions = _ref.options,
|
|
2424
|
+
dataContext = _ref.context;
|
|
2425
|
+
|
|
2070
2426
|
var originalTrend = dataOptions.trend,
|
|
2071
|
-
|
|
2427
|
+
originalFill = dataOptions.fill;
|
|
2072
2428
|
var migratedDataOptions = Object.assign(Object.assign({}, originalTrend && {
|
|
2073
|
-
majorValue: (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalTrend, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalTrend,
|
|
2074
|
-
trendValue: (_b = migrationUtils_1.preserveDataSelectionForValueOption(originalTrend, 'delta(-2)')) !== null && _b !== void 0 ? _b : originalTrend
|
|
2429
|
+
majorValue: (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalTrend, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalTrend,
|
|
2430
|
+
trendValue: (_b = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalTrend, 'delta(-2)')) !== null && _b !== void 0 ? _b : originalTrend
|
|
2075
2431
|
}), originalFill && {
|
|
2076
|
-
backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(originalFill, 'lastPoint()')) !== null && _c !== void 0 ? _c : originalFill
|
|
2432
|
+
backgroundColor: (_c = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalFill, 'lastPoint()')) !== null && _c !== void 0 ? _c : originalFill
|
|
2077
2433
|
});
|
|
2078
|
-
var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
|
|
2434
|
+
var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
|
|
2079
2435
|
var trendDisplayMode = renamedOptions.trendDisplayMode,
|
|
2080
|
-
|
|
2081
|
-
var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
|
|
2436
|
+
showTrendIndicator = renamedOptions.showTrendIndicator;
|
|
2437
|
+
var trendDisplay = (0, singlevalue_1.consolidateTrendDisplay)(trendDisplayMode, showTrendIndicator);
|
|
2082
2438
|
migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
|
|
2083
2439
|
trendDisplay: trendDisplay
|
|
2084
2440
|
});
|
|
2085
|
-
migratedVisualization.context = dataContext;
|
|
2086
|
-
|
|
2087
|
-
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
2441
|
+
migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueradial as reference
|
|
2442
|
+
|
|
2443
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
|
|
2088
2444
|
return migratedVisualization;
|
|
2089
2445
|
};
|
|
2446
|
+
|
|
2090
2447
|
exports.migrateVizToSplunkSingleValueRadial = migrateVizToSplunkSingleValueRadial;
|
|
2091
2448
|
|
|
2092
2449
|
/***/ }),
|
|
@@ -2103,44 +2460,58 @@ module.exports = require("@splunk/visualizations/SingleValueRadial.config");
|
|
|
2103
2460
|
|
|
2104
2461
|
|
|
2105
2462
|
var _slicedToArray = __webpack_require__(6);
|
|
2463
|
+
|
|
2106
2464
|
var __rest = this && this.__rest || function (s, e) {
|
|
2107
2465
|
var t = {};
|
|
2466
|
+
|
|
2108
2467
|
for (var p in s) {
|
|
2109
2468
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2110
2469
|
}
|
|
2470
|
+
|
|
2111
2471
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2112
2472
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2113
2473
|
}
|
|
2114
2474
|
return t;
|
|
2115
2475
|
};
|
|
2476
|
+
|
|
2116
2477
|
Object.defineProperty(exports, "__esModule", {
|
|
2117
2478
|
value: true
|
|
2118
2479
|
});
|
|
2119
2480
|
exports.migrateVizToSplunkTable = void 0;
|
|
2481
|
+
|
|
2120
2482
|
var lodash_1 = __webpack_require__(9);
|
|
2483
|
+
|
|
2121
2484
|
var Table_config_1 = __webpack_require__(50);
|
|
2485
|
+
|
|
2122
2486
|
var hocUtils_1 = __webpack_require__(51);
|
|
2487
|
+
|
|
2123
2488
|
var encoding_1 = __webpack_require__(1);
|
|
2489
|
+
|
|
2124
2490
|
var migrationUtils_1 = __webpack_require__(0);
|
|
2125
|
-
|
|
2126
|
-
// old default configurations should be retained in migrated configuration
|
|
2491
|
+
|
|
2492
|
+
var validOptions = Object.assign({}, Table_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
|
|
2493
|
+
|
|
2127
2494
|
var defaultChanges = {
|
|
2128
2495
|
count: 20
|
|
2129
2496
|
};
|
|
2130
2497
|
var optionRenames = {
|
|
2131
2498
|
rowNumbers: 'showRowNumbers'
|
|
2132
2499
|
};
|
|
2500
|
+
|
|
2133
2501
|
var migrateHeaderVisibility = function migrateHeaderVisibility(oldHeaderVisibility) {
|
|
2134
2502
|
if (oldHeaderVisibility === undefined) {
|
|
2135
2503
|
// headerVisibility: 'inline' is the default in splunk.table
|
|
2136
2504
|
// this corresponds to `showHeader: true`, which is the default in viz.table
|
|
2137
2505
|
return undefined;
|
|
2138
2506
|
}
|
|
2507
|
+
|
|
2139
2508
|
return oldHeaderVisibility ? 'inline' : 'none';
|
|
2140
2509
|
};
|
|
2141
2510
|
/**
|
|
2142
2511
|
* Helper to migrate alternating color options (text and background) to their corresponding DSL and context configs
|
|
2143
2512
|
*/
|
|
2513
|
+
|
|
2514
|
+
|
|
2144
2515
|
var migrateAlternatingColors = function migrateAlternatingColors(colors, optionToConvert, contextConfigName) {
|
|
2145
2516
|
// default alternating themed color values as defined in table config
|
|
2146
2517
|
var themedAlternatingColors = {
|
|
@@ -2155,7 +2526,8 @@ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionT
|
|
|
2155
2526
|
};
|
|
2156
2527
|
var colorsContext = [];
|
|
2157
2528
|
var oddColor = colors.oddColor,
|
|
2158
|
-
|
|
2529
|
+
evenColor = colors.evenColor;
|
|
2530
|
+
|
|
2159
2531
|
if (oddColor && evenColor) {
|
|
2160
2532
|
colorsContext.push.apply(colorsContext, [oddColor, evenColor]);
|
|
2161
2533
|
} else if (oddColor) {
|
|
@@ -2163,6 +2535,7 @@ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionT
|
|
|
2163
2535
|
} else if (evenColor) {
|
|
2164
2536
|
colorsContext.push.apply(colorsContext, [themedAlternatingColors[optionToConvert].odd, evenColor]);
|
|
2165
2537
|
}
|
|
2538
|
+
|
|
2166
2539
|
if (colorsContext.length) {
|
|
2167
2540
|
return {
|
|
2168
2541
|
contextConfigName: contextConfigName,
|
|
@@ -2170,6 +2543,7 @@ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionT
|
|
|
2170
2543
|
dsl: "> table | pick(".concat(contextConfigName, ")")
|
|
2171
2544
|
};
|
|
2172
2545
|
}
|
|
2546
|
+
|
|
2173
2547
|
return {};
|
|
2174
2548
|
};
|
|
2175
2549
|
/**
|
|
@@ -2179,43 +2553,52 @@ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionT
|
|
|
2179
2553
|
* This requires moving numberPrecision, useThousandSeparators, unitPosition, and other formatting options to the config
|
|
2180
2554
|
* The resultant config is used as the argument for formatByType
|
|
2181
2555
|
*/
|
|
2556
|
+
|
|
2557
|
+
|
|
2182
2558
|
var migrateToColumnFormat = function migrateToColumnFormat(fieldsOption) {
|
|
2183
2559
|
var columnFormat = {};
|
|
2184
2560
|
var columnFormatContext = {};
|
|
2561
|
+
|
|
2185
2562
|
if (!fieldsOption) {
|
|
2186
2563
|
return {
|
|
2187
2564
|
columnFormat: columnFormat,
|
|
2188
2565
|
columnFormatContext: columnFormatContext
|
|
2189
2566
|
};
|
|
2190
2567
|
}
|
|
2568
|
+
|
|
2191
2569
|
Object.entries(fieldsOption).forEach(function (_ref) {
|
|
2192
2570
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
2193
|
-
|
|
2194
|
-
|
|
2571
|
+
column = _ref2[0],
|
|
2572
|
+
formatting = _ref2[1];
|
|
2573
|
+
|
|
2195
2574
|
// need to prepend `formatted` in case the column has leading digits, which the nearley parser cannot account for
|
|
2196
2575
|
var contextEntry = "formatted".concat(column, "Config");
|
|
2197
2576
|
columnFormatContext[contextEntry] = {};
|
|
2198
2577
|
columnFormat[column] = {
|
|
2199
2578
|
data: "> table | seriesByName(\"".concat(column, "\") | formatByType(").concat(contextEntry, ")")
|
|
2200
|
-
};
|
|
2201
|
-
|
|
2579
|
+
}; // all columnFormatting options are optional; if they are not present in the original config, tableFormat should take precedence
|
|
2580
|
+
|
|
2202
2581
|
var unit = formatting.unit,
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2582
|
+
unitPosition = formatting.unitPosition,
|
|
2583
|
+
numberPrecision = formatting.numberPrecision,
|
|
2584
|
+
useThousandSeparators = formatting.useThousandSeparators;
|
|
2585
|
+
|
|
2206
2586
|
if (typeof unitPosition === 'string') {
|
|
2207
|
-
lodash_1.set(columnFormatContext, [contextEntry, 'number', 'unitPosition'], unitPosition);
|
|
2208
|
-
lodash_1.set(columnFormatContext, [contextEntry, 'string', 'unitPosition'], unitPosition);
|
|
2587
|
+
(0, lodash_1.set)(columnFormatContext, [contextEntry, 'number', 'unitPosition'], unitPosition);
|
|
2588
|
+
(0, lodash_1.set)(columnFormatContext, [contextEntry, 'string', 'unitPosition'], unitPosition);
|
|
2209
2589
|
}
|
|
2590
|
+
|
|
2210
2591
|
if (typeof unit === 'string' || typeof unit === 'number') {
|
|
2211
|
-
lodash_1.set(columnFormatContext, [contextEntry, 'number', 'unit'], unit);
|
|
2212
|
-
lodash_1.set(columnFormatContext, [contextEntry, 'string', 'unit'], unit);
|
|
2592
|
+
(0, lodash_1.set)(columnFormatContext, [contextEntry, 'number', 'unit'], unit);
|
|
2593
|
+
(0, lodash_1.set)(columnFormatContext, [contextEntry, 'string', 'unit'], unit);
|
|
2213
2594
|
}
|
|
2595
|
+
|
|
2214
2596
|
if (numberPrecision != null) {
|
|
2215
|
-
lodash_1.set(columnFormatContext, [contextEntry, 'number', 'precision'], numberPrecision);
|
|
2597
|
+
(0, lodash_1.set)(columnFormatContext, [contextEntry, 'number', 'precision'], numberPrecision);
|
|
2216
2598
|
}
|
|
2599
|
+
|
|
2217
2600
|
if (useThousandSeparators != null) {
|
|
2218
|
-
lodash_1.set(columnFormatContext, [contextEntry, 'number', 'thousandSeparated'], useThousandSeparators);
|
|
2601
|
+
(0, lodash_1.set)(columnFormatContext, [contextEntry, 'number', 'thousandSeparated'], useThousandSeparators);
|
|
2219
2602
|
}
|
|
2220
2603
|
});
|
|
2221
2604
|
return {
|
|
@@ -2229,6 +2612,8 @@ var migrateToColumnFormat = function migrateToColumnFormat(fieldsOption) {
|
|
|
2229
2612
|
* This requires moving numberPrecision, useThousandSeparators, unitPosition, and other formatting/coloring options to the config
|
|
2230
2613
|
* The resultant formatting and coloring config is used as the argument for the formatByType() and pick() DSL formatters respectively
|
|
2231
2614
|
*/
|
|
2615
|
+
|
|
2616
|
+
|
|
2232
2617
|
var migrateToTableFormat = function migrateToTableFormat() {
|
|
2233
2618
|
var oldOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2234
2619
|
var tableFormat = {};
|
|
@@ -2236,101 +2621,118 @@ var migrateToTableFormat = function migrateToTableFormat() {
|
|
|
2236
2621
|
formattedConfig: {}
|
|
2237
2622
|
};
|
|
2238
2623
|
var unit = oldOptions.unit,
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2624
|
+
oldUnitPosition = oldOptions.unitPosition,
|
|
2625
|
+
oldNumberPrecision = oldOptions.numberPrecision,
|
|
2626
|
+
oldUseThousandSeparators = oldOptions.useThousandSeparators;
|
|
2242
2627
|
var unitPosition = typeof oldUnitPosition === 'string' ? oldUnitPosition : 'after';
|
|
2243
2628
|
var numberPrecision = typeof oldNumberPrecision === 'number' ? oldNumberPrecision : 0;
|
|
2244
2629
|
var useThousandSeparators = typeof oldUseThousandSeparators === 'boolean' ? oldUseThousandSeparators : false;
|
|
2245
|
-
lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'precision'], numberPrecision);
|
|
2246
|
-
lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'thousandSeparated'], useThousandSeparators);
|
|
2247
|
-
lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'unitPosition'], unitPosition);
|
|
2248
|
-
lodash_1.set(tableFormatContext, ['formattedConfig', 'string', 'unitPosition'], unitPosition);
|
|
2630
|
+
(0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'number', 'precision'], numberPrecision);
|
|
2631
|
+
(0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'number', 'thousandSeparated'], useThousandSeparators);
|
|
2632
|
+
(0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'number', 'unitPosition'], unitPosition);
|
|
2633
|
+
(0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'string', 'unitPosition'], unitPosition);
|
|
2634
|
+
|
|
2249
2635
|
if (typeof unit === 'string' || typeof unit === 'number') {
|
|
2250
|
-
lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'unit'], unit);
|
|
2251
|
-
lodash_1.set(tableFormatContext, ['formattedConfig', 'string', 'unit'], unit);
|
|
2636
|
+
(0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'number', 'unit'], unit);
|
|
2637
|
+
(0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'string', 'unit'], unit);
|
|
2252
2638
|
}
|
|
2639
|
+
|
|
2253
2640
|
tableFormat.data = "> table | formatByType(formattedConfig)";
|
|
2254
2641
|
var rowBackgroundColorEven = oldOptions.rowBackgroundColorEven,
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2642
|
+
rowBackgroundColorOdd = oldOptions.rowBackgroundColorOdd,
|
|
2643
|
+
rowTextColorOdd = oldOptions.rowTextColorOdd,
|
|
2644
|
+
rowTextColorEven = oldOptions.rowTextColorEven,
|
|
2645
|
+
headerTextColor = oldOptions.headerTextColor,
|
|
2646
|
+
headerBackgroundColor = oldOptions.headerBackgroundColor;
|
|
2647
|
+
|
|
2260
2648
|
var _migrateAlternatingCo = migrateAlternatingColors({
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2649
|
+
oddColor: rowTextColorOdd,
|
|
2650
|
+
evenColor: rowTextColorEven
|
|
2651
|
+
}, 'rowColors', 'rowColorsConfig'),
|
|
2652
|
+
rowColorsContext = _migrateAlternatingCo.context,
|
|
2653
|
+
rowColorsDSL = _migrateAlternatingCo.dsl;
|
|
2654
|
+
|
|
2266
2655
|
if (rowColorsContext && rowColorsDSL) {
|
|
2267
2656
|
tableFormatContext.rowColorsConfig = rowColorsContext;
|
|
2268
2657
|
tableFormat.rowColors = rowColorsDSL;
|
|
2269
2658
|
}
|
|
2659
|
+
|
|
2270
2660
|
var _migrateAlternatingCo2 = migrateAlternatingColors({
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2661
|
+
oddColor: rowBackgroundColorOdd,
|
|
2662
|
+
evenColor: rowBackgroundColorEven
|
|
2663
|
+
}, 'rowBackgroundColors', 'rowBackgroundColorsConfig'),
|
|
2664
|
+
rowBackgroundColorsContext = _migrateAlternatingCo2.context,
|
|
2665
|
+
rowBackgroundColorsDSL = _migrateAlternatingCo2.dsl;
|
|
2666
|
+
|
|
2276
2667
|
if (rowBackgroundColorsContext && rowBackgroundColorsDSL) {
|
|
2277
2668
|
tableFormat.rowBackgroundColors = rowBackgroundColorsDSL;
|
|
2278
2669
|
tableFormatContext.rowBackgroundColorsConfig = rowBackgroundColorsContext;
|
|
2279
2670
|
}
|
|
2671
|
+
|
|
2280
2672
|
if (headerTextColor) {
|
|
2281
2673
|
tableFormat.headerColor = headerTextColor;
|
|
2282
2674
|
}
|
|
2675
|
+
|
|
2283
2676
|
if (headerBackgroundColor) {
|
|
2284
2677
|
tableFormat.headerBackgroundColor = headerBackgroundColor;
|
|
2285
2678
|
}
|
|
2679
|
+
|
|
2286
2680
|
return {
|
|
2287
2681
|
tableFormat: tableFormat,
|
|
2288
2682
|
tableFormatContext: tableFormatContext
|
|
2289
2683
|
};
|
|
2290
2684
|
};
|
|
2685
|
+
|
|
2291
2686
|
var migrateVizToSplunkTable = function migrateVizToSplunkTable(vizDefinition) {
|
|
2292
2687
|
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2688
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
2689
|
+
_vizDefinition$option = vizDefinition.options,
|
|
2690
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2691
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
2692
|
+
|
|
2297
2693
|
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
2298
2694
|
type: 'splunk.table',
|
|
2299
2695
|
options: {},
|
|
2300
2696
|
context: {}
|
|
2301
2697
|
});
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2698
|
+
|
|
2699
|
+
var _ref3 = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
2700
|
+
dataOptions = _ref3.options,
|
|
2701
|
+
dataContext = _ref3.context;
|
|
2702
|
+
|
|
2703
|
+
var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
|
|
2306
2704
|
var headerVisibility = migrateHeaderVisibility(renamedOptions.showHeader);
|
|
2705
|
+
|
|
2307
2706
|
var _migrateToTableFormat = migrateToTableFormat(renamedOptions),
|
|
2308
|
-
|
|
2309
|
-
|
|
2707
|
+
tableFormat = _migrateToTableFormat.tableFormat,
|
|
2708
|
+
tableFormatContext = _migrateToTableFormat.tableFormatContext;
|
|
2709
|
+
|
|
2310
2710
|
var _migrateToColumnForma = migrateToColumnFormat(renamedOptions.fields),
|
|
2311
|
-
|
|
2312
|
-
|
|
2711
|
+
columnFormat = _migrateToColumnForma.columnFormat,
|
|
2712
|
+
columnFormatContext = _migrateToColumnForma.columnFormatContext;
|
|
2713
|
+
|
|
2313
2714
|
var migratedDataOptions = Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.columns) && {
|
|
2314
2715
|
table: dataOptions.columns
|
|
2315
2716
|
});
|
|
2316
|
-
var formattingOptions = Object.assign(Object.assign(Object.assign({}, !lodash_1.isEmpty(columnFormat) && {
|
|
2717
|
+
var formattingOptions = Object.assign(Object.assign(Object.assign({}, !(0, lodash_1.isEmpty)(columnFormat) && {
|
|
2317
2718
|
columnFormat: columnFormat
|
|
2318
2719
|
}), typeof headerVisibility === 'string' && {
|
|
2319
2720
|
headerVisibility: headerVisibility
|
|
2320
2721
|
}), {
|
|
2321
2722
|
tableFormat: tableFormat
|
|
2322
2723
|
});
|
|
2323
|
-
var migratedOptions = hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, defaultChanges, formattingOptions, migratedDataOptions, renamedOptions);
|
|
2324
|
-
|
|
2724
|
+
var migratedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, defaultChanges, formattingOptions, migratedDataOptions, renamedOptions); // remove invalid options
|
|
2725
|
+
|
|
2325
2726
|
Object.keys(migratedOptions).forEach(function (key) {
|
|
2326
2727
|
if (!validOptions[key]) {
|
|
2327
2728
|
delete migratedOptions[key];
|
|
2328
2729
|
}
|
|
2329
2730
|
});
|
|
2330
|
-
migratedDefinition.context = Object.assign(Object.assign(Object.assign({}, dataContext), !lodash_1.isEmpty(columnFormatContext) && Object.assign({}, columnFormatContext)), tableFormatContext);
|
|
2731
|
+
migratedDefinition.context = Object.assign(Object.assign(Object.assign({}, dataContext), !(0, lodash_1.isEmpty)(columnFormatContext) && Object.assign({}, columnFormatContext)), tableFormatContext);
|
|
2331
2732
|
migratedDefinition.options = migratedOptions;
|
|
2332
2733
|
return migratedDefinition;
|
|
2333
2734
|
};
|
|
2735
|
+
|
|
2334
2736
|
exports.migrateVizToSplunkTable = migrateVizToSplunkTable;
|
|
2335
2737
|
|
|
2336
2738
|
/***/ }),
|
|
@@ -2354,107 +2756,129 @@ module.exports = require("@splunk/visualizations-shared/hocUtils");
|
|
|
2354
2756
|
|
|
2355
2757
|
var __rest = this && this.__rest || function (s, e) {
|
|
2356
2758
|
var t = {};
|
|
2759
|
+
|
|
2357
2760
|
for (var p in s) {
|
|
2358
2761
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2359
2762
|
}
|
|
2763
|
+
|
|
2360
2764
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2361
2765
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2362
2766
|
}
|
|
2363
2767
|
return t;
|
|
2364
2768
|
};
|
|
2769
|
+
|
|
2365
2770
|
Object.defineProperty(exports, "__esModule", {
|
|
2366
2771
|
value: true
|
|
2367
2772
|
});
|
|
2368
2773
|
exports.migrateVizTextToSplunkMarkdown = exports.convertFontSize = void 0;
|
|
2774
|
+
|
|
2369
2775
|
var _ = __webpack_require__(9);
|
|
2776
|
+
|
|
2370
2777
|
var Markdown_config_1 = __webpack_require__(8);
|
|
2778
|
+
|
|
2371
2779
|
var migrationUtils_1 = __webpack_require__(0);
|
|
2780
|
+
|
|
2372
2781
|
var validOptions = Object.assign({}, Markdown_config_1.default.optionsSchema);
|
|
2373
2782
|
var optionsToRename = {
|
|
2374
2783
|
textColor: 'fontColor',
|
|
2375
2784
|
content: 'markdown'
|
|
2376
2785
|
};
|
|
2786
|
+
|
|
2377
2787
|
var convertTextContentToMarkDown = function convertTextContentToMarkDown(fontWeight, fontSize) {
|
|
2378
2788
|
var textContent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2789
|
+
|
|
2379
2790
|
if (!_.isNumber(fontSize)) {
|
|
2380
2791
|
return textContent;
|
|
2381
2792
|
}
|
|
2793
|
+
|
|
2382
2794
|
if (textContent.trim().length === 0) {
|
|
2383
2795
|
return textContent;
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
// Handle text conversion to marker tags based on fontSize and fontWeight
|
|
2796
|
+
} // Remove any trailing newline chars from the content
|
|
2797
|
+
|
|
2798
|
+
|
|
2799
|
+
var markdownContent = textContent.replace(/\n*$/, ''); // Handle text conversion to marker tags based on fontSize and fontWeight
|
|
2800
|
+
|
|
2388
2801
|
var regex = /\n/g; // regex to match /n with global scope across the string
|
|
2389
2802
|
// Convert to paragraph in markdown, if fontSize < 20,
|
|
2390
2803
|
// If text has fontWeight set to 'bold', add bold tag (**{markdown}**)
|
|
2804
|
+
|
|
2391
2805
|
if (fontWeight === 'bold') {
|
|
2392
2806
|
// Here direct regex replace doesnt work, as we need to remove the
|
|
2393
2807
|
// extra trailing space if any exist before appending **{markdown}** to the text
|
|
2394
2808
|
var contentStrings = markdownContent.split('\n');
|
|
2395
2809
|
var stringsTrimmed = contentStrings.map(function (str) {
|
|
2396
2810
|
return str && str.trim().length ? "**".concat(str.trim(), "**") : '';
|
|
2397
|
-
});
|
|
2398
|
-
// Remove all blank entries from the end of the trimmed string array,
|
|
2811
|
+
}); // Remove all blank entries from the end of the trimmed string array,
|
|
2399
2812
|
// to avoid `\` to get rendered, which happens if following line after `\\n` is empty)
|
|
2813
|
+
|
|
2400
2814
|
var idx = stringsTrimmed.length - 1;
|
|
2815
|
+
|
|
2401
2816
|
while (idx >= 0 && stringsTrimmed[idx].length === 0) {
|
|
2402
2817
|
stringsTrimmed.pop();
|
|
2403
2818
|
idx -= 1;
|
|
2404
2819
|
}
|
|
2820
|
+
|
|
2405
2821
|
return stringsTrimmed.join('\\\n');
|
|
2406
|
-
}
|
|
2407
|
-
|
|
2822
|
+
} // If fontWeight is not bold, replace '\n' with '\\n` using regex
|
|
2823
|
+
|
|
2824
|
+
|
|
2408
2825
|
markdownContent = markdownContent.replace(regex, '\\\n');
|
|
2409
2826
|
return markdownContent;
|
|
2410
2827
|
};
|
|
2828
|
+
|
|
2411
2829
|
var convertFontSize = function convertFontSize(fontSize) {
|
|
2412
2830
|
if (!_.isNumber(fontSize)) {
|
|
2413
2831
|
return {
|
|
2414
2832
|
fontSize: 'default'
|
|
2415
2833
|
};
|
|
2416
2834
|
}
|
|
2835
|
+
|
|
2417
2836
|
return {
|
|
2418
2837
|
fontSize: 'custom',
|
|
2419
2838
|
customFontSize: fontSize
|
|
2420
2839
|
};
|
|
2421
2840
|
};
|
|
2841
|
+
|
|
2422
2842
|
exports.convertFontSize = convertFontSize;
|
|
2843
|
+
|
|
2423
2844
|
var migrateVizTextToSplunkMarkdown = function migrateVizTextToSplunkMarkdown(vizDefinition) {
|
|
2424
2845
|
var _vizDefinition$option = vizDefinition.options,
|
|
2425
|
-
|
|
2426
|
-
|
|
2846
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
2847
|
+
otherDefinitionParts = __rest(vizDefinition, ["options"]);
|
|
2848
|
+
|
|
2427
2849
|
var _options$fontSize = options.fontSize,
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2850
|
+
fontSize = _options$fontSize === void 0 ? 24 : _options$fontSize,
|
|
2851
|
+
_options$fontWeight = options.fontWeight,
|
|
2852
|
+
fontWeight = _options$fontWeight === void 0 ? 'normal' : _options$fontWeight,
|
|
2853
|
+
_options$fontFamily = options.fontFamily,
|
|
2854
|
+
fontFamily = _options$fontFamily === void 0 ? 'Splunk Platform Sans' : _options$fontFamily,
|
|
2855
|
+
_options$rotation = options.rotation,
|
|
2856
|
+
rotation = _options$rotation === void 0 ? 0 : _options$rotation;
|
|
2435
2857
|
var migratedVisualization = Object.assign(Object.assign({
|
|
2436
2858
|
options: options
|
|
2437
2859
|
}, otherDefinitionParts), {
|
|
2438
2860
|
type: 'splunk.markdown',
|
|
2439
2861
|
context: {}
|
|
2440
|
-
});
|
|
2441
|
-
|
|
2442
|
-
migratedVisualization.options = migrationUtils_1.renameVizOptions(migratedVisualization.options, optionsToRename);
|
|
2443
|
-
var migratedVizOptions = migratedVisualization.options;
|
|
2444
|
-
|
|
2445
|
-
migratedVizOptions.markdown = convertTextContentToMarkDown(fontWeight, fontSize, migratedVizOptions.markdown);
|
|
2446
|
-
|
|
2447
|
-
var
|
|
2448
|
-
|
|
2449
|
-
|
|
2862
|
+
}); // perform any option renames
|
|
2863
|
+
|
|
2864
|
+
migratedVisualization.options = (0, migrationUtils_1.renameVizOptions)(migratedVisualization.options, optionsToRename);
|
|
2865
|
+
var migratedVizOptions = migratedVisualization.options; // convert text content to respective markdown
|
|
2866
|
+
|
|
2867
|
+
migratedVizOptions.markdown = convertTextContentToMarkDown(fontWeight, fontSize, migratedVizOptions.markdown); // convert text fontSize to markdown fontSize
|
|
2868
|
+
|
|
2869
|
+
var _ref = (0, exports.convertFontSize)(fontSize),
|
|
2870
|
+
fontSizeValue = _ref.fontSize,
|
|
2871
|
+
customFontSize = _ref.customFontSize;
|
|
2872
|
+
|
|
2450
2873
|
migratedVizOptions.fontSize = fontSizeValue;
|
|
2451
2874
|
migratedVizOptions.customFontSize = customFontSize;
|
|
2452
2875
|
migratedVizOptions.fontFamily = fontFamily;
|
|
2453
|
-
migratedVizOptions.rotation = rotation;
|
|
2454
|
-
|
|
2455
|
-
migrationUtils_1.removeInvalidOptions(migratedVizOptions, validOptions);
|
|
2876
|
+
migratedVizOptions.rotation = rotation; // remove invalid options using the optionsSchema for splunk.markdown as reference
|
|
2877
|
+
|
|
2878
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVizOptions, validOptions);
|
|
2456
2879
|
return migratedVisualization;
|
|
2457
2880
|
};
|
|
2881
|
+
|
|
2458
2882
|
exports.migrateVizTextToSplunkMarkdown = migrateVizTextToSplunkMarkdown;
|
|
2459
2883
|
|
|
2460
2884
|
/***/ }),
|
|
@@ -2465,23 +2889,31 @@ exports.migrateVizTextToSplunkMarkdown = migrateVizTextToSplunkMarkdown;
|
|
|
2465
2889
|
|
|
2466
2890
|
|
|
2467
2891
|
var _toConsumableArray = __webpack_require__(5);
|
|
2892
|
+
|
|
2468
2893
|
var __rest = this && this.__rest || function (s, e) {
|
|
2469
2894
|
var t = {};
|
|
2895
|
+
|
|
2470
2896
|
for (var p in s) {
|
|
2471
2897
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2472
2898
|
}
|
|
2899
|
+
|
|
2473
2900
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2474
2901
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2475
2902
|
}
|
|
2476
2903
|
return t;
|
|
2477
2904
|
};
|
|
2905
|
+
|
|
2478
2906
|
Object.defineProperty(exports, "__esModule", {
|
|
2479
2907
|
value: true
|
|
2480
2908
|
});
|
|
2481
2909
|
exports.migrateVizToSplunkPunchcard = void 0;
|
|
2910
|
+
|
|
2482
2911
|
var Punchcard_config_1 = __webpack_require__(54);
|
|
2912
|
+
|
|
2483
2913
|
var encoding_1 = __webpack_require__(1);
|
|
2914
|
+
|
|
2484
2915
|
var migrationUtils_1 = __webpack_require__(0);
|
|
2916
|
+
|
|
2485
2917
|
var validOptions = Object.assign({}, Punchcard_config_1.default.optionsSchema);
|
|
2486
2918
|
var defaultContext = Object.assign({}, Punchcard_config_1.default.defaultContext);
|
|
2487
2919
|
var optionsToRename = {
|
|
@@ -2495,11 +2927,14 @@ var optionsToRename = {
|
|
|
2495
2927
|
showLegend: 'legendDisplay',
|
|
2496
2928
|
useDefaultSort: 'showDefaultSort'
|
|
2497
2929
|
};
|
|
2930
|
+
|
|
2498
2931
|
var consolidateLegendDisplay = function consolidateLegendDisplay(vizOptions) {
|
|
2499
2932
|
if (!vizOptions) {
|
|
2500
2933
|
return;
|
|
2501
2934
|
}
|
|
2935
|
+
|
|
2502
2936
|
var options = vizOptions;
|
|
2937
|
+
|
|
2503
2938
|
if (options.legendDisplay) {
|
|
2504
2939
|
options.legendDisplay = 'right';
|
|
2505
2940
|
} else if (options.legendDisplay === false) {
|
|
@@ -2511,44 +2946,57 @@ var consolidateBubbleLabelDisplay = function consolidateBubbleLabelDisplay(vizOp
|
|
|
2511
2946
|
if (!vizOptions) {
|
|
2512
2947
|
return;
|
|
2513
2948
|
}
|
|
2949
|
+
|
|
2514
2950
|
var options = vizOptions;
|
|
2951
|
+
|
|
2515
2952
|
if (options.bubbleLabelDisplay === 'none') {
|
|
2516
2953
|
options.bubbleLabelDisplay = 'off';
|
|
2517
2954
|
}
|
|
2518
|
-
};
|
|
2519
|
-
|
|
2955
|
+
}; // Updates the first color of the bubbleColorConfig with the minBubbleColorIntensity
|
|
2956
|
+
|
|
2957
|
+
|
|
2520
2958
|
var convertGradientConfig = function convertGradientConfig(minBubbleColorIntensity, defaultBubbleColorConfig) {
|
|
2521
2959
|
if (!defaultBubbleColorConfig || !defaultBubbleColorConfig.colors || !defaultBubbleColorConfig.colors[0] || typeof minBubbleColorIntensity !== 'number') {
|
|
2522
2960
|
return null;
|
|
2523
2961
|
}
|
|
2962
|
+
|
|
2524
2963
|
var firstColor = defaultBubbleColorConfig.colors[0];
|
|
2525
2964
|
var firstColorUpdated = "".concat(firstColor.substring(0, firstColor.lastIndexOf(',')), ",").concat(minBubbleColorIntensity, ")");
|
|
2965
|
+
|
|
2526
2966
|
var colors = _toConsumableArray(defaultBubbleColorConfig.colors);
|
|
2967
|
+
|
|
2527
2968
|
colors[0] = firstColorUpdated;
|
|
2528
2969
|
var bubbleColorConfigUpdated = Object.assign(Object.assign({}, defaultBubbleColorConfig), {
|
|
2529
2970
|
colors: colors
|
|
2530
2971
|
});
|
|
2531
2972
|
return bubbleColorConfigUpdated;
|
|
2532
2973
|
};
|
|
2974
|
+
|
|
2533
2975
|
var convertColorModeOption = function convertColorModeOption(visualizationDefinition) {
|
|
2534
2976
|
var visualizationDef = visualizationDefinition;
|
|
2977
|
+
|
|
2535
2978
|
if (!visualizationDef || !visualizationDef.options) {
|
|
2536
2979
|
return;
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2980
|
+
} // Rename the colorMode option from 'sequential' to 'dynamic' if specified
|
|
2981
|
+
|
|
2982
|
+
|
|
2539
2983
|
if (visualizationDef.options.colorMode === 'sequential') {
|
|
2540
2984
|
visualizationDef.options.colorMode = 'dynamic';
|
|
2541
|
-
}
|
|
2542
|
-
// If no colorMode was specified the default in viz.punchcard used to be 'categorical'.
|
|
2985
|
+
} // If no colorMode was specified the default in viz.punchcard used to be 'categorical'.
|
|
2543
2986
|
// But in splunk.punchcard default is 'dynamic', we need to preserve the original default.
|
|
2544
2987
|
// Set colorMode to 'categorical' if no colorMode was specified in viz
|
|
2988
|
+
|
|
2989
|
+
|
|
2545
2990
|
if (!visualizationDef.options.colorMode) {
|
|
2546
2991
|
visualizationDef.options.colorMode = 'categorical';
|
|
2547
2992
|
}
|
|
2993
|
+
|
|
2548
2994
|
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'
|
|
2549
2995
|
// In both cases we need to update the gradient config bubbleColorConfig with the minBubbleColorIntensity for first color
|
|
2996
|
+
|
|
2550
2997
|
if ((!visualizationDef.options.category || visualizationDef.options.colorMode !== 'categorical') && minBubbleColorIntensity && typeof minBubbleColorIntensity === 'number') {
|
|
2551
2998
|
var bubbleColorConfig = convertGradientConfig(minBubbleColorIntensity, defaultContext.bubbleColorConfig);
|
|
2999
|
+
|
|
2552
3000
|
if (bubbleColorConfig) {
|
|
2553
3001
|
visualizationDef.context = Object.assign(Object.assign({}, visualizationDef.context), {
|
|
2554
3002
|
bubbleColorConfig: bubbleColorConfig
|
|
@@ -2556,31 +3004,37 @@ var convertColorModeOption = function convertColorModeOption(visualizationDefini
|
|
|
2556
3004
|
}
|
|
2557
3005
|
}
|
|
2558
3006
|
};
|
|
3007
|
+
|
|
2559
3008
|
var migrateVizToSplunkPunchcard = function migrateVizToSplunkPunchcard(vizDefinition) {
|
|
2560
3009
|
var _vizDefinition$option = vizDefinition.options,
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
3010
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
3011
|
+
_vizDefinition$encodi = vizDefinition.encoding,
|
|
3012
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
3013
|
+
otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
|
|
3014
|
+
|
|
2565
3015
|
var migratedVisualization = Object.assign(Object.assign({
|
|
2566
3016
|
options: options
|
|
2567
3017
|
}, otherDefinitionParts), {
|
|
2568
3018
|
type: 'splunk.punchcard',
|
|
2569
3019
|
context: {}
|
|
2570
3020
|
});
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
3021
|
+
|
|
3022
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
3023
|
+
dataOptions = _ref.options,
|
|
3024
|
+
dataContext = _ref.context; // perform any option renames
|
|
3025
|
+
|
|
3026
|
+
|
|
3027
|
+
var renamedOptions = (0, migrationUtils_1.renameVizOptions)(migratedVisualization.options, optionsToRename);
|
|
2575
3028
|
consolidateLegendDisplay(renamedOptions);
|
|
2576
3029
|
consolidateBubbleLabelDisplay(renamedOptions);
|
|
2577
3030
|
migratedVisualization.options = Object.assign(Object.assign({}, renamedOptions), dataOptions);
|
|
2578
3031
|
migratedVisualization.context = dataContext;
|
|
2579
|
-
convertColorModeOption(migratedVisualization);
|
|
2580
|
-
|
|
2581
|
-
migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
|
|
3032
|
+
convertColorModeOption(migratedVisualization); // remove invalid options using the optionsSchema for splunk.punchcard as reference
|
|
3033
|
+
|
|
3034
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
|
|
2582
3035
|
return migratedVisualization;
|
|
2583
3036
|
};
|
|
3037
|
+
|
|
2584
3038
|
exports.migrateVizToSplunkPunchcard = migrateVizToSplunkPunchcard;
|
|
2585
3039
|
|
|
2586
3040
|
/***/ }),
|
|
@@ -2598,21 +3052,28 @@ module.exports = require("@splunk/visualizations/Punchcard.config");
|
|
|
2598
3052
|
|
|
2599
3053
|
var __rest = this && this.__rest || function (s, e) {
|
|
2600
3054
|
var t = {};
|
|
3055
|
+
|
|
2601
3056
|
for (var p in s) {
|
|
2602
3057
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2603
3058
|
}
|
|
3059
|
+
|
|
2604
3060
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2605
3061
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2606
3062
|
}
|
|
2607
3063
|
return t;
|
|
2608
3064
|
};
|
|
3065
|
+
|
|
2609
3066
|
Object.defineProperty(exports, "__esModule", {
|
|
2610
3067
|
value: true
|
|
2611
3068
|
});
|
|
2612
3069
|
exports.migrateVizToSplunkMapChoropleth = exports.defaultEmptyAreaColor = exports.defaultStrokeColor = void 0;
|
|
3070
|
+
|
|
2613
3071
|
var Map_config_1 = __webpack_require__(56);
|
|
3072
|
+
|
|
2614
3073
|
var encoding_1 = __webpack_require__(1);
|
|
3074
|
+
|
|
2615
3075
|
var migrationUtils_1 = __webpack_require__(0);
|
|
3076
|
+
|
|
2616
3077
|
var validOptions = Object.assign({}, Map_config_1.default.optionsSchema);
|
|
2617
3078
|
var optionRenames = {
|
|
2618
3079
|
fillColor: 'choroplethEmptyAreaColor',
|
|
@@ -2628,29 +3089,35 @@ var defaultContextChanges = {
|
|
|
2628
3089
|
};
|
|
2629
3090
|
exports.defaultStrokeColor = '#689C8D';
|
|
2630
3091
|
exports.defaultEmptyAreaColor = '#EAEFF2';
|
|
3092
|
+
|
|
2631
3093
|
var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(vizDefinition) {
|
|
2632
3094
|
var _vizDefinition$encodi = vizDefinition.encoding,
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
3095
|
+
encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
|
|
3096
|
+
_vizDefinition$option = vizDefinition.options,
|
|
3097
|
+
options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
|
|
3098
|
+
otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
|
|
3099
|
+
|
|
2637
3100
|
var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
|
|
2638
3101
|
type: 'splunk.map',
|
|
2639
3102
|
options: {},
|
|
2640
3103
|
context: {}
|
|
2641
3104
|
});
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
3105
|
+
|
|
3106
|
+
var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
|
|
3107
|
+
dataOptions = _ref.options,
|
|
3108
|
+
dataContext = _ref.context;
|
|
3109
|
+
|
|
3110
|
+
var dynamicOptions = (0, migrationUtils_1.renameVizOptions)(dataOptions, optionRenames);
|
|
3111
|
+
var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
|
|
3112
|
+
|
|
2647
3113
|
if (!('dataColors' in dynamicOptions)) {
|
|
2648
3114
|
Object.assign(dynamicOptions, {
|
|
2649
3115
|
dataColors: '> areaValues | gradient(fillGradientContext)'
|
|
2650
3116
|
});
|
|
2651
3117
|
}
|
|
3118
|
+
|
|
2652
3119
|
var choroplethEmptyAreaColor = renamedOptions.choroplethEmptyAreaColor,
|
|
2653
|
-
|
|
3120
|
+
choroplethStrokeColor = renamedOptions.choroplethStrokeColor;
|
|
2654
3121
|
var source = renamedOptions.source;
|
|
2655
3122
|
var layerOptions = ['choroplethEmptyAreaColor', 'choroplethStrokeColor', 'source'];
|
|
2656
3123
|
var renamedOptionsFiltered = Object.keys(renamedOptions).filter(function (key) {
|
|
@@ -2661,6 +3128,7 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
|
|
|
2661
3128
|
return obj;
|
|
2662
3129
|
}, {});
|
|
2663
3130
|
/* migrate default strokeColor in viz.geojson to either the backgroundColor if configured and non-transparent or defaultBackgroundColor in splunk.map */
|
|
3131
|
+
|
|
2664
3132
|
if (choroplethStrokeColor === exports.defaultStrokeColor && choroplethEmptyAreaColor !== 'transparent') {
|
|
2665
3133
|
if ('backgroundColor' in renamedOptionsFiltered) {
|
|
2666
3134
|
/* eslint-disable-next-line dot-notation */
|
|
@@ -2674,10 +3142,12 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
|
|
|
2674
3142
|
choroplethStrokeColor = '> themes.defaultBackgroundColor';
|
|
2675
3143
|
}
|
|
2676
3144
|
}
|
|
3145
|
+
|
|
2677
3146
|
if (choroplethEmptyAreaColor === exports.defaultEmptyAreaColor) {
|
|
2678
3147
|
choroplethEmptyAreaColor = '> themes.defaultChoroplethEmptyAreaColor';
|
|
2679
|
-
}
|
|
2680
|
-
|
|
3148
|
+
} // update migrated options and context
|
|
3149
|
+
|
|
3150
|
+
|
|
2681
3151
|
migratedDefinition.options = Object.assign(Object.assign({}, renamedOptionsFiltered), {
|
|
2682
3152
|
layers: [Object.assign(Object.assign({
|
|
2683
3153
|
type: 'choropleth',
|
|
@@ -2691,6 +3161,7 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
|
|
|
2691
3161
|
showBaseLayer: false,
|
|
2692
3162
|
showZoomControls: false
|
|
2693
3163
|
});
|
|
3164
|
+
|
|
2694
3165
|
if (vizDefinition.type === 'viz.geojson.us') {
|
|
2695
3166
|
migratedDefinition.options.center = [39.83, -97];
|
|
2696
3167
|
migratedDefinition.options.zoom = 3;
|
|
@@ -2698,7 +3169,9 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
|
|
|
2698
3169
|
migratedDefinition.options.center = [46.56, 10.35];
|
|
2699
3170
|
migratedDefinition.options.zoom = 0;
|
|
2700
3171
|
}
|
|
3172
|
+
|
|
2701
3173
|
migratedDefinition.context = encoding.fill ? dataContext : defaultContextChanges;
|
|
3174
|
+
|
|
2702
3175
|
if (JSON.stringify(dataContext) === JSON.stringify({
|
|
2703
3176
|
fillGradientContext: {}
|
|
2704
3177
|
})) {
|
|
@@ -2706,9 +3179,11 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
|
|
|
2706
3179
|
context: defaultContextChanges
|
|
2707
3180
|
});
|
|
2708
3181
|
}
|
|
2709
|
-
|
|
3182
|
+
|
|
3183
|
+
(0, migrationUtils_1.removeInvalidOptions)(migratedDefinition.options, validOptions);
|
|
2710
3184
|
return migratedDefinition;
|
|
2711
3185
|
};
|
|
3186
|
+
|
|
2712
3187
|
exports.migrateVizToSplunkMapChoropleth = migrateVizToSplunkMapChoropleth;
|
|
2713
3188
|
|
|
2714
3189
|
/***/ }),
|