@splunk/visualization-migrations 23.3.0 → 24.0.0

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