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