@splunk/visualization-migrations 28.7.0 → 28.9.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 +22 -10
- package/index.js.map +2 -2
- package/migrate.js +22 -10
- package/migrate.js.map +2 -2
- package/package.json +4 -4
- package/types/visualizations/splunk-charting.d.ts +6 -0
package/index.js
CHANGED
|
@@ -98,7 +98,7 @@ var serializeForDslLiteral = (value) => {
|
|
|
98
98
|
}
|
|
99
99
|
try {
|
|
100
100
|
return JSON.stringify(value);
|
|
101
|
-
} catch (
|
|
101
|
+
} catch (e) {
|
|
102
102
|
return String(value);
|
|
103
103
|
}
|
|
104
104
|
};
|
|
@@ -371,12 +371,24 @@ var parseObjects = (oldValue) => {
|
|
|
371
371
|
}
|
|
372
372
|
return nuValue;
|
|
373
373
|
};
|
|
374
|
+
var replaceNumericBoolean = (oldValue) => {
|
|
375
|
+
if (oldValue === 0) return false;
|
|
376
|
+
if (oldValue === 1) return true;
|
|
377
|
+
return oldValue;
|
|
378
|
+
};
|
|
379
|
+
var replaceInheritedScale = (oldValue) => oldValue === "inherit" ? "linear" : oldValue;
|
|
374
380
|
var otherValueReplacements = {
|
|
375
381
|
y2Fields: splitValue,
|
|
376
382
|
overlayFields: splitValue,
|
|
377
383
|
legendLabels: splitValue,
|
|
378
384
|
seriesColorsByField: parseObjects,
|
|
379
385
|
lineDashStylesByField: parseObjects,
|
|
386
|
+
showIndependentYRanges: replaceNumericBoolean,
|
|
387
|
+
showOverlayY2Axis: replaceNumericBoolean,
|
|
388
|
+
showRoundedY2AxisLabels: replaceNumericBoolean,
|
|
389
|
+
showSplitSeries: replaceNumericBoolean,
|
|
390
|
+
yAxisScale: replaceInheritedScale,
|
|
391
|
+
y2AxisScale: replaceInheritedScale,
|
|
380
392
|
/**
|
|
381
393
|
* the original markerDisplay was only exposed as `chart.showMarkers`
|
|
382
394
|
* setting chart.showMarkers to true is the equivalent of `markerDisplay: 'outlined'`
|
|
@@ -1032,11 +1044,11 @@ var migrateAlternatingColors = (colors, optionToConvert, contextConfigName) => {
|
|
|
1032
1044
|
const colorsContext = [];
|
|
1033
1045
|
const { oddColor, evenColor } = colors;
|
|
1034
1046
|
if (oddColor && evenColor) {
|
|
1035
|
-
colorsContext.push(
|
|
1047
|
+
colorsContext.push(oddColor, evenColor);
|
|
1036
1048
|
} else if (oddColor) {
|
|
1037
|
-
colorsContext.push(
|
|
1049
|
+
colorsContext.push(oddColor, themedAlternatingColors[optionToConvert].even);
|
|
1038
1050
|
} else if (evenColor) {
|
|
1039
|
-
colorsContext.push(
|
|
1051
|
+
colorsContext.push(themedAlternatingColors[optionToConvert].odd, evenColor);
|
|
1040
1052
|
}
|
|
1041
1053
|
if (colorsContext.length) {
|
|
1042
1054
|
return {
|
|
@@ -1207,7 +1219,7 @@ var convertTextContentToMarkDown = (fontWeight, fontSize, textContent = "") => {
|
|
|
1207
1219
|
}
|
|
1208
1220
|
return stringsTrimmed.join("\\\n");
|
|
1209
1221
|
}
|
|
1210
|
-
markdownContent = markdownContent.
|
|
1222
|
+
markdownContent = markdownContent.replaceAll(regex, "\\\n");
|
|
1211
1223
|
return markdownContent;
|
|
1212
1224
|
};
|
|
1213
1225
|
var convertFontSize = (fontSize) => {
|
|
@@ -1377,17 +1389,17 @@ var migrateVizToSplunkMapChoropleth = (vizDefinition) => {
|
|
|
1377
1389
|
}
|
|
1378
1390
|
let { choroplethEmptyAreaColor, choroplethStrokeColor } = renamedOptions;
|
|
1379
1391
|
const { source } = renamedOptions;
|
|
1380
|
-
const layerOptions = ["choroplethEmptyAreaColor", "choroplethStrokeColor", "source"];
|
|
1381
|
-
const renamedOptionsFiltered = Object.keys(renamedOptions).filter((key) => !layerOptions.
|
|
1392
|
+
const layerOptions = /* @__PURE__ */ new Set(["choroplethEmptyAreaColor", "choroplethStrokeColor", "source"]);
|
|
1393
|
+
const renamedOptionsFiltered = Object.keys(renamedOptions).filter((key) => !layerOptions.has(key)).reduce((obj, key) => {
|
|
1382
1394
|
obj[key] = renamedOptions[key];
|
|
1383
1395
|
return obj;
|
|
1384
1396
|
}, {});
|
|
1385
1397
|
if (choroplethStrokeColor === defaultStrokeColor && choroplethEmptyAreaColor !== "transparent") {
|
|
1386
1398
|
if ("backgroundColor" in renamedOptionsFiltered) {
|
|
1387
|
-
if (renamedOptionsFiltered["backgroundColor"]
|
|
1388
|
-
choroplethStrokeColor = renamedOptionsFiltered.backgroundColor;
|
|
1389
|
-
} else {
|
|
1399
|
+
if (renamedOptionsFiltered["backgroundColor"] === "transparent") {
|
|
1390
1400
|
choroplethStrokeColor = "> themes.defaultBackgroundColor";
|
|
1401
|
+
} else {
|
|
1402
|
+
choroplethStrokeColor = renamedOptionsFiltered.backgroundColor;
|
|
1391
1403
|
}
|
|
1392
1404
|
} else {
|
|
1393
1405
|
choroplethStrokeColor = "> themes.defaultBackgroundColor";
|