@splunk/visualizations 27.0.0 → 27.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +269 -122
- package/Area.config.js.map +4 -4
- package/Area.js +1065 -209
- package/Area.js.map +4 -4
- package/Bar.config.js +266 -82
- package/Bar.config.js.map +4 -4
- package/Bar.js +1065 -171
- package/Bar.js.map +4 -4
- package/Bubble.config.js +127 -1
- package/Bubble.config.js.map +4 -4
- package/Bubble.js +323 -80
- package/Bubble.js.map +4 -4
- package/ChoroplethSvg.js +60 -30
- package/ChoroplethSvg.js.map +4 -4
- package/Column.config.js +271 -82
- package/Column.config.js.map +4 -4
- package/Column.js +1070 -171
- package/Column.js.map +4 -4
- package/Ellipse.js +44 -14
- package/Ellipse.js.map +4 -4
- package/Events.js +82 -52
- package/Events.js.map +4 -4
- package/FillerGauge.js +44 -14
- package/FillerGauge.js.map +4 -4
- package/Image.js +42 -12
- package/Image.js.map +4 -4
- package/Line.config.js +271 -119
- package/Line.config.js.map +4 -4
- package/Line.js +1067 -206
- package/Line.js.map +4 -4
- package/LinkGraph.js +563 -529
- package/LinkGraph.js.map +4 -4
- package/Map.js +44 -14
- package/Map.js.map +4 -4
- package/Markdown.js +46 -16
- package/Markdown.js.map +4 -4
- package/MarkerGauge.js +42 -12
- package/MarkerGauge.js.map +4 -4
- package/ParallelCoordinates.js +122 -86
- package/ParallelCoordinates.js.map +4 -4
- package/Pie.js +198 -81
- package/Pie.js.map +4 -4
- package/Punchcard.js +54 -24
- package/Punchcard.js.map +4 -4
- package/Rectangle.js +56 -26
- package/Rectangle.js.map +4 -4
- package/Sankey.js +68 -38
- package/Sankey.js.map +4 -4
- package/Scatter.config.js +127 -1
- package/Scatter.config.js.map +4 -4
- package/Scatter.js +323 -80
- package/Scatter.js.map +4 -4
- package/SingleValue.config.js +43 -67
- package/SingleValue.config.js.map +4 -4
- package/SingleValue.js +1419 -1351
- package/SingleValue.js.map +4 -4
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +45 -69
- package/SingleValueIcon.config.js.map +4 -4
- package/SingleValueIcon.js +1307 -1238
- package/SingleValueIcon.js.map +4 -4
- package/SingleValueRadial.config.js +43 -67
- package/SingleValueRadial.config.js.map +4 -4
- package/SingleValueRadial.js +1352 -1266
- package/SingleValueRadial.js.map +4 -4
- package/TRELLIS.md +16 -15
- package/Table.js +52 -22
- package/Table.js.map +4 -4
- package/common/Charting.js +133 -27
- package/common/Charting.js.map +4 -4
- package/common/OptionsDoc.js +6 -1
- package/common/OptionsDoc.js.map +2 -2
- package/common/utils/singleValueUtils.js +8 -7
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/utils/trellisUtils.js +41 -1
- package/common/utils/trellisUtils.js.map +2 -2
- package/common/withDashboardViz.js +42 -12
- package/common/withDashboardViz.js.map +4 -4
- package/package.json +17 -18
package/SingleValue.js
CHANGED
|
@@ -134,6 +134,21 @@ var defaultImport7 = __toESM(require("@splunk/visualizations-shared/SizeAwareWra
|
|
|
134
134
|
__reExport(SizeAwareWrapper_exports, require("@splunk/visualizations-shared/SizeAwareWrapper"));
|
|
135
135
|
var SizeAwareWrapper_default = "default" in defaultImport7 ? defaultImport7.default : defaultImport7;
|
|
136
136
|
|
|
137
|
+
// src/common/components/VizStyleWrapper.jsx
|
|
138
|
+
var VizStyleWrapper = styled_components_default.div.attrs(({ dataTestKey }) => ({
|
|
139
|
+
"data-test": dataTestKey,
|
|
140
|
+
"data-testid": dataTestKey
|
|
141
|
+
}))`
|
|
142
|
+
display: flex;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
width: 100%;
|
|
146
|
+
height: 100%;
|
|
147
|
+
background-color: ${(props) => props.backgroundColor};
|
|
148
|
+
`;
|
|
149
|
+
VizStyleWrapper.displayName = "VizStyleWrapper";
|
|
150
|
+
var VizStyleWrapper_default = VizStyleWrapper;
|
|
151
|
+
|
|
137
152
|
// esm-externals:@splunk/visualization-context/FeatureFlagContext
|
|
138
153
|
var FeatureFlagContext_exports = {};
|
|
139
154
|
__export(FeatureFlagContext_exports, {
|
|
@@ -152,20 +167,15 @@ var defaultImport9 = __toESM(require("@splunk/visualization-schemas"));
|
|
|
152
167
|
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
153
168
|
var visualization_schemas_default = "default" in defaultImport9 ? defaultImport9.default : defaultImport9;
|
|
154
169
|
|
|
155
|
-
// src/common/
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
height: 100%;
|
|
165
|
-
background-color: ${(props) => props.backgroundColor};
|
|
166
|
-
`;
|
|
167
|
-
VizStyleWrapper.displayName = "VizStyleWrapper";
|
|
168
|
-
var VizStyleWrapper_default = VizStyleWrapper;
|
|
170
|
+
// src/common/hooks/useTrellisEnabled.ts
|
|
171
|
+
var useTrellisFeatureFlagOn = () => {
|
|
172
|
+
const context = (0, react_exports.useContext)(FeatureFlagContext_default);
|
|
173
|
+
return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
|
|
174
|
+
};
|
|
175
|
+
var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
|
|
176
|
+
const trellisFeatureEnabled = useTrellisFeatureFlagOn();
|
|
177
|
+
return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
178
|
+
};
|
|
169
179
|
|
|
170
180
|
// src/common/components/TrellisTitle.tsx
|
|
171
181
|
var TRELLIS_TITLE_HEIGHT = 28;
|
|
@@ -635,16 +645,16 @@ var changeColor = (color, ratio) => {
|
|
|
635
645
|
return `#${newR.toString(16).padStart(2, 0)}${newG.toString(16).padStart(2, 0)}${newB.toString(16).padStart(2, 0)}`;
|
|
636
646
|
};
|
|
637
647
|
var darken = (color) => changeColor(color, 0.5);
|
|
638
|
-
var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled = false,
|
|
639
|
-
|
|
648
|
+
var handleValueClickCallback = (ev, majorValue, majorValueField, trendValue, onValueClick, trellisEnabled = false, trellisSplitBy = "", trellisKey = "") => onValueClick(__spreadProps(__spreadValues({}, ev), {
|
|
649
|
+
payload: __spreadValues({
|
|
640
650
|
trendValue,
|
|
641
651
|
value: majorValue,
|
|
642
652
|
name: majorValueField
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
return
|
|
653
|
+
}, trellisEnabled && { "trellis.name": trellisSplitBy, "trellis.value": trellisKey })
|
|
654
|
+
}));
|
|
655
|
+
var getTrendColorWithPercent = (options) => {
|
|
656
|
+
const shouldUsePercentTrendColor = options.trendColor === "> trendValue | rangeValue(trendColorEditorConfig)" && options.trendDisplay === "percent";
|
|
657
|
+
return shouldUsePercentTrendColor ? { trendColor: "> trendValuePercent | rangeValue(trendColorEditorConfig)" } : {};
|
|
648
658
|
};
|
|
649
659
|
|
|
650
660
|
// esm-externals:@splunk/react-icons/enterprise/ArrowUp
|
|
@@ -1731,11 +1741,7 @@ var SingleValue = (_a) => {
|
|
|
1731
1741
|
setContainerWidth(w);
|
|
1732
1742
|
setContainerHeight(h);
|
|
1733
1743
|
}, []);
|
|
1734
|
-
const
|
|
1735
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
1736
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
1737
|
-
);
|
|
1738
|
-
const trellisEnabled = isTrellisFeatureFlagOn && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1744
|
+
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
1739
1745
|
const handleValueClick = (0, react_exports.useCallback)(
|
|
1740
1746
|
(ev) => handleValueClickCallback(
|
|
1741
1747
|
ev,
|
|
@@ -2286,7 +2292,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
2286
2292
|
FixSizeItem,
|
|
2287
2293
|
{
|
|
2288
2294
|
"data-test": "fix-size-item",
|
|
2289
|
-
"data-splunk-visualization-version": "27.
|
|
2295
|
+
"data-splunk-visualization-version": "27.1.0 - fe8b048df",
|
|
2290
2296
|
width,
|
|
2291
2297
|
height,
|
|
2292
2298
|
backgroundColor
|
|
@@ -2352,7 +2358,7 @@ var Cover = styled_components_default.div`
|
|
|
2352
2358
|
bottom: 0;
|
|
2353
2359
|
`;
|
|
2354
2360
|
var Blocker = styled_components_default.div.attrs({
|
|
2355
|
-
"data-splunk-visualization-version": "27.
|
|
2361
|
+
"data-splunk-visualization-version": "27.1.0 - fe8b048df"
|
|
2356
2362
|
})`
|
|
2357
2363
|
position: relative;
|
|
2358
2364
|
width: 100%;
|
|
@@ -2839,1384 +2845,1427 @@ var getFeatureFlag = (context, flagName) => {
|
|
|
2839
2845
|
return false;
|
|
2840
2846
|
};
|
|
2841
2847
|
|
|
2842
|
-
//
|
|
2843
|
-
var
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
} = props;
|
|
2870
|
-
const { serializedTimezone } = react_exports.useContext(TimezoneContext_default);
|
|
2871
|
-
if (serializedTimezone) {
|
|
2872
|
-
if (!moment_default.getDefaultSplunkTimezone()) {
|
|
2873
|
-
moment_default.setDefaultSplunkTimezone(serializedTimezone);
|
|
2848
|
+
// esm-externals:@splunk/visualizations-shared/trellisUtils
|
|
2849
|
+
var trellisUtils_exports = {};
|
|
2850
|
+
__export(trellisUtils_exports, {
|
|
2851
|
+
default: () => trellisUtils_default
|
|
2852
|
+
});
|
|
2853
|
+
var defaultImport33 = __toESM(require("@splunk/visualizations-shared/trellisUtils"));
|
|
2854
|
+
__reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisUtils"));
|
|
2855
|
+
var trellisUtils_default = "default" in defaultImport33 ? defaultImport33.default : defaultImport33;
|
|
2856
|
+
|
|
2857
|
+
// src/common/utils/trellisUtils.ts
|
|
2858
|
+
var AGGREGATIONS = "aggregations";
|
|
2859
|
+
var dataSourcesSplitByAggregationsUnknown = (dataSource) => {
|
|
2860
|
+
var _a, _b, _c, _d;
|
|
2861
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2862
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2863
|
+
let splitDataSources = null;
|
|
2864
|
+
let errorCode = null;
|
|
2865
|
+
if (fields && fields.length) {
|
|
2866
|
+
splitDataSources = {};
|
|
2867
|
+
for (let i = 0; i < fields.length; i += 1) {
|
|
2868
|
+
const fieldName = fields[i].name;
|
|
2869
|
+
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
2870
|
+
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
2871
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2872
|
+
);
|
|
2873
|
+
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
2874
|
+
splitDataSources[fieldName].primary.data.columns = [columns[i]];
|
|
2874
2875
|
}
|
|
2875
2876
|
}
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
[options, context]
|
|
2905
|
-
);
|
|
2906
|
-
const [threshold, setThreshold] = react_exports.useState(Number(width));
|
|
2907
|
-
const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
|
|
2908
|
-
setThreshold(newThreshold);
|
|
2909
|
-
}, []);
|
|
2910
|
-
const isDownsamplingEnabled = react_exports.useMemo(() => {
|
|
2911
|
-
return isDownsamplingEnabledByFeatureFlag && isDownsamplingEnabledForViz({ vizConfig });
|
|
2912
|
-
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
2913
|
-
const downsamplingProps = react_exports.useMemo(() => {
|
|
2914
|
-
if (!isDownsamplingEnabled) {
|
|
2915
|
-
return {};
|
|
2916
|
-
}
|
|
2917
|
-
return {
|
|
2918
|
-
onDownsamplingThresholdChange,
|
|
2919
|
-
originalDataSources: dataSources
|
|
2920
|
-
};
|
|
2921
|
-
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
2922
|
-
const downsampledDataSources = useDownsampleDataSources_default({
|
|
2923
|
-
options: optionsToEvaluate.options,
|
|
2924
|
-
context: optionsToEvaluate.context,
|
|
2925
|
-
dataSources,
|
|
2926
|
-
threshold,
|
|
2927
|
-
isDownsamplingEnabled
|
|
2928
|
-
});
|
|
2929
|
-
evaluatedOptions = useDeepMemo(() => {
|
|
2930
|
-
try {
|
|
2931
|
-
if (useAsyncEvaluatedOptions) {
|
|
2932
|
-
const asyncDynamicOptionsEvaluatorParams = {
|
|
2933
|
-
visualizationID,
|
|
2934
|
-
props,
|
|
2935
|
-
options: optionsToEvaluate,
|
|
2936
|
-
dataSources: downsampledDataSources,
|
|
2937
|
-
theme: vizConfig.themes,
|
|
2938
|
-
bypassCloneDeepOptionScope: Boolean(
|
|
2939
|
-
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
2940
|
-
),
|
|
2941
|
-
lazyLoadingDataFrame: Boolean(
|
|
2942
|
-
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
2943
|
-
)
|
|
2944
|
-
};
|
|
2945
|
-
async_dynamic_options_evaluator_default.evaluate(asyncDynamicOptionsEvaluatorParams).then((results) => {
|
|
2946
|
-
setEvaluatedOptionsAsync(results.results);
|
|
2947
|
-
}).catch(() => {
|
|
2948
|
-
if (isMounted.current) {
|
|
2949
|
-
setUseAsyncEvaluatedOptions(false);
|
|
2950
|
-
}
|
|
2951
|
-
});
|
|
2952
|
-
} else {
|
|
2953
|
-
let dataFrames = dataFramesInState;
|
|
2954
|
-
if (downsampledDataSources !== dataSourcesInState) {
|
|
2955
|
-
setDataSourcesInState(downsampledDataSources);
|
|
2956
|
-
dataFrames = Options_exports.Options.dataFrameFromDataSource(
|
|
2957
|
-
downsampledDataSources,
|
|
2958
|
-
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
2959
|
-
);
|
|
2960
|
-
setDataFramesInState(dataFrames);
|
|
2961
|
-
}
|
|
2962
|
-
const result = Options_exports.Options.evaluate(
|
|
2963
|
-
optionsToEvaluate,
|
|
2964
|
-
downsampledDataSources,
|
|
2965
|
-
themeFunc,
|
|
2966
|
-
dataFrames,
|
|
2967
|
-
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
2968
|
-
);
|
|
2969
|
-
return result;
|
|
2877
|
+
} else {
|
|
2878
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2879
|
+
}
|
|
2880
|
+
return { splitDataSources, errorCode };
|
|
2881
|
+
};
|
|
2882
|
+
var dataSourcesSplitByAggregationsTimechartAndChart = (dataSource) => {
|
|
2883
|
+
var _a, _b, _c, _d;
|
|
2884
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2885
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2886
|
+
let splitDataSources = null;
|
|
2887
|
+
let splitByFields = [];
|
|
2888
|
+
let errorCode = null;
|
|
2889
|
+
if (typeof fields[0] !== "string") {
|
|
2890
|
+
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2891
|
+
}
|
|
2892
|
+
if (splitByFields && splitByFields.length > 0) {
|
|
2893
|
+
splitDataSources = {};
|
|
2894
|
+
splitByFields.forEach((splitByField) => {
|
|
2895
|
+
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
2896
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2897
|
+
);
|
|
2898
|
+
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
2899
|
+
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
2900
|
+
fields.forEach((field, idx) => {
|
|
2901
|
+
const fieldName = field == null ? void 0 : field.name;
|
|
2902
|
+
if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
|
|
2903
|
+
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
2904
|
+
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
2970
2905
|
}
|
|
2971
|
-
} catch (e) {
|
|
2972
|
-
console.error(`unexpected error evaluating options: ${e.message}`);
|
|
2973
|
-
return {};
|
|
2974
|
-
}
|
|
2975
|
-
return {};
|
|
2976
|
-
}, [
|
|
2977
|
-
currentThemeFamily,
|
|
2978
|
-
currentThemeColorScheme,
|
|
2979
|
-
currentThemeDensity,
|
|
2980
|
-
optionsToEvaluate,
|
|
2981
|
-
downsampledDataSources,
|
|
2982
|
-
serializedTimezone,
|
|
2983
|
-
useAsyncEvaluatedOptions
|
|
2984
|
-
]);
|
|
2985
|
-
const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
2986
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
2987
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
2988
|
-
);
|
|
2989
|
-
let clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
2990
|
-
if (isTrellisFeatureFlagOn && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.splitByLayout) === "trellis" /* TRELLIS */) {
|
|
2991
|
-
clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
|
|
2992
|
-
backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
2993
2906
|
});
|
|
2994
|
-
}
|
|
2995
|
-
react_exports.useEffect(() => {
|
|
2996
|
-
onComputedProps(clonedEvaluatedOptions);
|
|
2997
2907
|
});
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
2908
|
+
} else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
|
|
2909
|
+
splitDataSources = {};
|
|
2910
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2911
|
+
const fieldName = fields[i].name;
|
|
2912
|
+
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
2913
|
+
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
2914
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2915
|
+
);
|
|
2916
|
+
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
2917
|
+
splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
} else {
|
|
2921
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2922
|
+
}
|
|
2923
|
+
return { splitDataSources, errorCode };
|
|
2924
|
+
};
|
|
2925
|
+
var dataSourcesSplitByAggregationsStats = (dataSource) => {
|
|
2926
|
+
var _a, _b, _c, _d;
|
|
2927
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2928
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2929
|
+
let splitDataSources = null;
|
|
2930
|
+
let splitByFields = [];
|
|
2931
|
+
let errorCode = null;
|
|
2932
|
+
if (typeof fields[0] !== "string") {
|
|
2933
|
+
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
|
|
2934
|
+
}
|
|
2935
|
+
if (splitByFields && splitByFields.length > 0) {
|
|
2936
|
+
splitDataSources = {};
|
|
2937
|
+
splitByFields.forEach((splitByField) => {
|
|
2938
|
+
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
2939
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2940
|
+
);
|
|
2941
|
+
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
2942
|
+
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
2943
|
+
const idx = fields.findIndex((field) => field.name === splitByField);
|
|
2944
|
+
if (idx > 0) {
|
|
2945
|
+
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
2946
|
+
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2949
|
+
} else {
|
|
2950
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2951
|
+
}
|
|
2952
|
+
return { splitDataSources, errorCode };
|
|
2953
|
+
};
|
|
2954
|
+
var dataSourcesSplitByModeTimechart = (dataSource, splitBy) => {
|
|
2955
|
+
var _a, _b, _c, _d, _e;
|
|
2956
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
2957
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
2958
|
+
let splitDataSources = null;
|
|
2959
|
+
let splitByFields = [];
|
|
2960
|
+
let errorCode = null;
|
|
2961
|
+
if (typeof fields[0] !== "string") {
|
|
2962
|
+
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
2963
|
+
}
|
|
2964
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
2965
|
+
splitDataSources = {};
|
|
2966
|
+
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
2967
|
+
const valueKeys = [];
|
|
2968
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
2969
|
+
if (!((_e = fields[i].name) == null ? void 0 : _e.startsWith("_"))) {
|
|
2970
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
2971
|
+
}
|
|
2972
|
+
}
|
|
2973
|
+
valueKeys.forEach((val) => {
|
|
2974
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
2975
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
2976
|
+
);
|
|
2977
|
+
splitDataSources[val].primary.data.fields = [
|
|
2978
|
+
{ name: fields[0].name },
|
|
2979
|
+
...dataSourceKeys.map((k) => ({
|
|
2980
|
+
name: k
|
|
2981
|
+
}))
|
|
2982
|
+
];
|
|
2983
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
2984
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
2985
|
+
fields.forEach((field, idx) => {
|
|
2986
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
2987
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3043
2988
|
}
|
|
3044
|
-
}
|
|
2989
|
+
});
|
|
3045
2990
|
});
|
|
2991
|
+
});
|
|
2992
|
+
} else {
|
|
2993
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
2994
|
+
}
|
|
2995
|
+
return { splitDataSources, errorCode };
|
|
2996
|
+
};
|
|
2997
|
+
var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
2998
|
+
var _a, _b, _c, _d;
|
|
2999
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3000
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3001
|
+
let splitDataSources = null;
|
|
3002
|
+
let splitByFields = [];
|
|
3003
|
+
let errorCode = null;
|
|
3004
|
+
if (typeof fields[0] !== "string") {
|
|
3005
|
+
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
3006
|
+
}
|
|
3007
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
3008
|
+
splitDataSources = {};
|
|
3009
|
+
const splitByFieldIdx = splitByFields.findIndex((f) => f === splitBy);
|
|
3010
|
+
const otherSplitBy = splitByFields.filter((f) => f !== splitBy);
|
|
3011
|
+
const dataSourceKeys = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
3012
|
+
const nonDataSourceAggregations = [];
|
|
3013
|
+
if (!dataSourceKeys.length && fields[0].groupby_rank === "0" && fields.length && !fields[1].groupby_rank) {
|
|
3014
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
3015
|
+
nonDataSourceAggregations.push(fields[i].name);
|
|
3016
|
+
}
|
|
3046
3017
|
}
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3018
|
+
if (splitByFieldIdx === 0) {
|
|
3019
|
+
const valueKeys = (0, lodash_exports.cloneDeep)(columns[0]);
|
|
3020
|
+
valueKeys.forEach((val, idx) => {
|
|
3021
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3022
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3023
|
+
);
|
|
3024
|
+
splitDataSources[val].primary.data.fields = [];
|
|
3025
|
+
if (otherSplitBy.length) {
|
|
3026
|
+
splitDataSources[val].primary.data.fields = [{ name: otherSplitBy[0] }];
|
|
3027
|
+
}
|
|
3028
|
+
if (dataSourceKeys.length) {
|
|
3029
|
+
const columnValues = [[]];
|
|
3030
|
+
splitDataSources[val].primary.data.fields = [
|
|
3031
|
+
...splitDataSources[val].primary.data.fields,
|
|
3032
|
+
...dataSourceKeys.map((k) => ({
|
|
3033
|
+
name: k
|
|
3034
|
+
}))
|
|
3035
|
+
];
|
|
3036
|
+
dataSourceKeys.forEach(() => {
|
|
3037
|
+
columnValues.push([]);
|
|
3038
|
+
});
|
|
3039
|
+
for (let i = 1; i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); i += 1) {
|
|
3040
|
+
columnValues[0].push(
|
|
3041
|
+
fields[i].splitby_value ? fields[i].splitby_value : fields[i].name
|
|
3042
|
+
);
|
|
3043
|
+
dataSourceKeys.forEach((dskey, dsIndx) => {
|
|
3044
|
+
const mul = (fields.length - 1) / dataSourceKeys.length;
|
|
3045
|
+
columnValues[dsIndx + 1].push(columns[i + dsIndx * mul][idx]);
|
|
3046
|
+
});
|
|
3047
|
+
}
|
|
3048
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
3049
|
+
} else if (nonDataSourceAggregations.length) {
|
|
3050
|
+
const columnValues = [];
|
|
3051
|
+
fields.forEach((aggregationField, fieldIdx) => {
|
|
3052
|
+
if (fieldIdx > 0) {
|
|
3053
|
+
splitDataSources[val].primary.data.fields.push(aggregationField);
|
|
3054
|
+
columnValues.push([columns[fieldIdx][idx]]);
|
|
3055
|
+
}
|
|
3056
|
+
});
|
|
3057
|
+
splitDataSources[val].primary.data.columns = columnValues;
|
|
3058
|
+
}
|
|
3061
3059
|
});
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3060
|
+
} else {
|
|
3061
|
+
const valueKeys = [];
|
|
3062
|
+
for (let i = 1; i < fields.length; i += 1) {
|
|
3063
|
+
valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
|
|
3064
|
+
}
|
|
3065
|
+
valueKeys.forEach((val) => {
|
|
3066
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3067
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3068
|
+
);
|
|
3069
|
+
splitDataSources[val].primary.data.fields = [
|
|
3070
|
+
{ name: otherSplitBy[0] },
|
|
3071
|
+
...dataSourceKeys.map((k) => ({
|
|
3072
|
+
name: k
|
|
3073
|
+
}))
|
|
3074
|
+
];
|
|
3075
|
+
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
3076
|
+
dataSourceKeys.forEach((dsKey) => {
|
|
3077
|
+
fields.forEach((field, idx) => {
|
|
3078
|
+
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
3079
|
+
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
3080
|
+
}
|
|
3081
|
+
});
|
|
3082
|
+
});
|
|
3066
3083
|
});
|
|
3067
|
-
dataSourceMetadata = {
|
|
3068
|
-
sortParams,
|
|
3069
|
-
paginatorParams
|
|
3070
|
-
};
|
|
3071
3084
|
}
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
SanitizedReactViz,
|
|
3077
|
-
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
3078
|
-
mode,
|
|
3079
|
-
width,
|
|
3080
|
-
height
|
|
3081
|
-
}, downsamplingProps), evaluatedOptionsToUse), computedVizProps), eventCallbackProps), dataSourceMetadata)
|
|
3082
|
-
);
|
|
3083
|
-
};
|
|
3084
|
-
DashboardViz.propTypes = __spreadValues(__spreadValues({}, SplunkVisualization_default.propTypes), ReactViz.propTypes);
|
|
3085
|
-
DashboardViz.defaultProps = __spreadProps(__spreadValues(__spreadValues({}, SplunkVisualization_default.defaultProps), ReactViz.defaultProps), {
|
|
3086
|
-
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
3087
|
-
theme: {}
|
|
3088
|
-
});
|
|
3089
|
-
DashboardViz.config = vizConfig;
|
|
3090
|
-
return (0, styled_components_exports.withTheme)(
|
|
3091
|
-
withPlaceholder_default(withEditModeCover_default(DashboardViz, disableEditModeCover), useIconPlaceholder)
|
|
3092
|
-
);
|
|
3085
|
+
} else {
|
|
3086
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3087
|
+
}
|
|
3088
|
+
return { splitDataSources, errorCode };
|
|
3093
3089
|
};
|
|
3094
|
-
var
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
var PresetPalettes_default = "default" in defaultImport33 ? defaultImport33.default : defaultImport33;
|
|
3104
|
-
|
|
3105
|
-
// esm-externals:@splunk/visualization-themes/variables
|
|
3106
|
-
var variables_exports2 = {};
|
|
3107
|
-
__export(variables_exports2, {
|
|
3108
|
-
default: () => variables_default2
|
|
3109
|
-
});
|
|
3110
|
-
var defaultImport34 = __toESM(require("@splunk/visualization-themes/variables"));
|
|
3111
|
-
__reExport(variables_exports2, require("@splunk/visualization-themes/variables"));
|
|
3112
|
-
var variables_default2 = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
|
|
3113
|
-
|
|
3114
|
-
// esm-externals:@splunk/themes/pick
|
|
3115
|
-
var pick_exports2 = {};
|
|
3116
|
-
__export(pick_exports2, {
|
|
3117
|
-
default: () => pick_default2
|
|
3118
|
-
});
|
|
3119
|
-
var defaultImport35 = __toESM(require("@splunk/themes/pick"));
|
|
3120
|
-
__reExport(pick_exports2, require("@splunk/themes/pick"));
|
|
3121
|
-
var pick_default2 = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
|
|
3122
|
-
|
|
3123
|
-
// esm-externals:@splunk/visualization-icons
|
|
3124
|
-
var visualization_icons_exports = {};
|
|
3125
|
-
__export(visualization_icons_exports, {
|
|
3126
|
-
default: () => visualization_icons_default
|
|
3127
|
-
});
|
|
3128
|
-
var defaultImport36 = __toESM(require("@splunk/visualization-icons"));
|
|
3129
|
-
__reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
|
|
3130
|
-
var visualization_icons_default = "default" in defaultImport36 ? defaultImport36.default : defaultImport36;
|
|
3131
|
-
|
|
3132
|
-
// esm-externals:@splunk/visualization-icons/placeholders
|
|
3133
|
-
var placeholders_exports = {};
|
|
3134
|
-
__export(placeholders_exports, {
|
|
3135
|
-
default: () => placeholders_default
|
|
3136
|
-
});
|
|
3137
|
-
var defaultImport37 = __toESM(require("@splunk/visualization-icons/placeholders"));
|
|
3138
|
-
__reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
|
|
3139
|
-
var placeholders_default = "default" in defaultImport37 ? defaultImport37.default : defaultImport37;
|
|
3140
|
-
|
|
3141
|
-
// src/common/configContext/singleValueContext.ts
|
|
3142
|
-
var defaultContext = {
|
|
3143
|
-
trendColorConfig: [
|
|
3144
|
-
{
|
|
3145
|
-
to: 0,
|
|
3146
|
-
value: "#9E2520"
|
|
3147
|
-
},
|
|
3148
|
-
{
|
|
3149
|
-
from: 0,
|
|
3150
|
-
value: "#1C6B2D"
|
|
3151
|
-
}
|
|
3152
|
-
],
|
|
3153
|
-
majorColorConfig: [
|
|
3154
|
-
{ to: 20, value: "#D41F1F" },
|
|
3155
|
-
{ from: 20, to: 40, value: "#D94E17" },
|
|
3156
|
-
{ from: 40, to: 60, value: "#CBA700" },
|
|
3157
|
-
{ from: 60, to: 80, value: "#669922" },
|
|
3158
|
-
{ from: 80, value: "#118832" }
|
|
3159
|
-
],
|
|
3160
|
-
majorColorMatchConfig: [{ match: "", value: "#5C33FF" }]
|
|
3161
|
-
};
|
|
3162
|
-
|
|
3163
|
-
// esm-externals:@splunk/visualizations-shared/configUtils
|
|
3164
|
-
var configUtils_exports = {};
|
|
3165
|
-
__export(configUtils_exports, {
|
|
3166
|
-
default: () => configUtils_default
|
|
3167
|
-
});
|
|
3168
|
-
var defaultImport38 = __toESM(require("@splunk/visualizations-shared/configUtils"));
|
|
3169
|
-
__reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
|
|
3170
|
-
var configUtils_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
|
|
3171
|
-
|
|
3172
|
-
// src/common/editorConfig/DynamicMajorColorEditor.js
|
|
3173
|
-
var getDynamicMajorColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
3174
|
-
label: (0, i18n_exports._)("Major value"),
|
|
3175
|
-
option: "majorColor",
|
|
3176
|
-
context: "majorColorEditorConfig",
|
|
3177
|
-
editor: "editor.dynamicColor",
|
|
3178
|
-
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.majorColor),
|
|
3179
|
-
editorProps: {
|
|
3180
|
-
labelPosition: "top",
|
|
3181
|
-
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: major value"),
|
|
3182
|
-
formatters: [
|
|
3183
|
-
{
|
|
3184
|
-
label: (0, i18n_exports._)("Ranges"),
|
|
3185
|
-
value: "rangeValue",
|
|
3186
|
-
defaults: {
|
|
3187
|
-
majorValue: defaultContext2.majorColorConfig
|
|
3188
|
-
}
|
|
3189
|
-
},
|
|
3190
|
-
{
|
|
3191
|
-
label: (0, i18n_exports._)("Matches"),
|
|
3192
|
-
value: "matchValue",
|
|
3193
|
-
defaults: {
|
|
3194
|
-
majorValue: defaultContext2.majorColorMatchConfig
|
|
3195
|
-
}
|
|
3196
|
-
}
|
|
3197
|
-
],
|
|
3198
|
-
dataSelectors: [
|
|
3199
|
-
{
|
|
3200
|
-
label: (0, i18n_exports._)("Major value"),
|
|
3201
|
-
value: "majorValue"
|
|
3202
|
-
}
|
|
3203
|
-
],
|
|
3204
|
-
defaultPalettesConfig: defaultPalettesConfig2
|
|
3090
|
+
var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
3091
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3092
|
+
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
3093
|
+
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3094
|
+
let splitDataSources = null;
|
|
3095
|
+
let splitByFields = [];
|
|
3096
|
+
let errorCode = null;
|
|
3097
|
+
if (typeof fields[0] !== "string") {
|
|
3098
|
+
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
3205
3099
|
}
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: trend value"),
|
|
3218
|
-
formatters: [
|
|
3219
|
-
{
|
|
3220
|
-
label: (0, i18n_exports._)("Ranges"),
|
|
3221
|
-
value: "rangeValue",
|
|
3222
|
-
defaults: {
|
|
3223
|
-
trendValue: defaultContext2.trendColorConfig
|
|
3224
|
-
}
|
|
3225
|
-
}
|
|
3226
|
-
],
|
|
3227
|
-
dataSelectors: [
|
|
3228
|
-
{
|
|
3229
|
-
label: (0, i18n_exports._)("Trend value"),
|
|
3230
|
-
value: "trendValue"
|
|
3100
|
+
const splitByIndex = fields == null ? void 0 : fields.findIndex(
|
|
3101
|
+
(field) => field === splitBy || field.name === splitBy
|
|
3102
|
+
);
|
|
3103
|
+
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
3104
|
+
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
3105
|
+
splitDataSources = {};
|
|
3106
|
+
splitByColumn.forEach((val, idx) => {
|
|
3107
|
+
if (!splitDataSources[val]) {
|
|
3108
|
+
splitDataSources[val] = [idx];
|
|
3109
|
+
} else {
|
|
3110
|
+
splitDataSources[val].push(idx);
|
|
3231
3111
|
}
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
formatters: [
|
|
3248
|
-
{
|
|
3249
|
-
label: (0, i18n_exports._)("Ranges"),
|
|
3250
|
-
value: "rangeValue",
|
|
3251
|
-
defaults: {
|
|
3252
|
-
majorValue: defaultContext2.majorColorConfig,
|
|
3253
|
-
trendValue: defaultContext2.trendColorConfig
|
|
3254
|
-
}
|
|
3255
|
-
},
|
|
3256
|
-
{
|
|
3257
|
-
label: (0, i18n_exports._)("Matches"),
|
|
3258
|
-
value: "matchValue",
|
|
3259
|
-
defaults: {
|
|
3260
|
-
majorValue: defaultContext2.majorColorMatchConfig
|
|
3112
|
+
});
|
|
3113
|
+
const cloneFields = (0, lodash_exports.cloneDeep)(fields);
|
|
3114
|
+
cloneFields.splice(splitByIndex, 1);
|
|
3115
|
+
const valueKeys = Object.keys(splitDataSources);
|
|
3116
|
+
valueKeys.forEach((val) => {
|
|
3117
|
+
const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
|
|
3118
|
+
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
3119
|
+
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3120
|
+
);
|
|
3121
|
+
splitDataSources[val].primary.data.fields = cloneFields;
|
|
3122
|
+
splitDataSources[val].primary.data.columns = [];
|
|
3123
|
+
columns.forEach((col, idx) => {
|
|
3124
|
+
if (idx !== splitByIndex) {
|
|
3125
|
+
const newCol = valIndices.map((valIdx) => col[valIdx]);
|
|
3126
|
+
splitDataSources[val].primary.data.columns.push(newCol);
|
|
3261
3127
|
}
|
|
3262
|
-
}
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
label: (0, i18n_exports._)("Major Value"),
|
|
3267
|
-
value: "majorValue"
|
|
3268
|
-
},
|
|
3269
|
-
{
|
|
3270
|
-
label: (0, i18n_exports._)("Trend"),
|
|
3271
|
-
value: "trendValue"
|
|
3272
|
-
}
|
|
3273
|
-
],
|
|
3274
|
-
defaultPalettesConfig: defaultPalettesConfig2
|
|
3128
|
+
});
|
|
3129
|
+
});
|
|
3130
|
+
} else {
|
|
3131
|
+
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3275
3132
|
}
|
|
3276
|
-
}
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
{
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
{ label: (0, i18n_exports._)("After"), value: "after" }
|
|
3290
|
-
]
|
|
3291
|
-
},
|
|
3292
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3293
|
-
},
|
|
3294
|
-
{
|
|
3295
|
-
label: (0, i18n_exports._)("Unit label"),
|
|
3296
|
-
option: "unit",
|
|
3297
|
-
editor: "editor.text",
|
|
3298
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3299
|
-
}
|
|
3300
|
-
],
|
|
3301
|
-
[
|
|
3302
|
-
{
|
|
3303
|
-
label: (0, i18n_exports._)("Precision"),
|
|
3304
|
-
option: "numberPrecision",
|
|
3305
|
-
editor: "editor.number",
|
|
3306
|
-
editorProps: {
|
|
3307
|
-
min: 0,
|
|
3308
|
-
max: 20
|
|
3309
|
-
},
|
|
3310
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3133
|
+
return { splitDataSources, errorCode };
|
|
3134
|
+
};
|
|
3135
|
+
var getTrellisDataSourcesBySplitMode = (splitMode, dataSources, trellisSplitBy) => {
|
|
3136
|
+
let result = null;
|
|
3137
|
+
try {
|
|
3138
|
+
if (splitMode === trellisUtils_exports.TIMECHART) {
|
|
3139
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeTimechart(dataSources, trellisSplitBy);
|
|
3140
|
+
} else if (splitMode === trellisUtils_exports.STATS) {
|
|
3141
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsStats(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.STATS);
|
|
3142
|
+
} else if (splitMode === trellisUtils_exports.CHART) {
|
|
3143
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsTimechartAndChart(dataSources) : dataSourcesSplitByModeChart(dataSources, trellisSplitBy);
|
|
3144
|
+
} else if (splitMode === trellisUtils_exports.UNKNOWN) {
|
|
3145
|
+
result = trellisSplitBy === AGGREGATIONS ? dataSourcesSplitByAggregationsUnknown(dataSources) : dataSourcesSplitByModeStatsorUnknown(dataSources, trellisSplitBy, trellisUtils_exports.UNKNOWN);
|
|
3311
3146
|
}
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
var StaticMajorColorEditor = {
|
|
3318
|
-
label: (0, i18n_exports._)("Major value"),
|
|
3319
|
-
option: "majorColor",
|
|
3320
|
-
editor: "editor.color",
|
|
3321
|
-
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.majorColor)
|
|
3147
|
+
} catch (ex) {
|
|
3148
|
+
console.error("getTrellisDataSourcesBySplitMode ", ex);
|
|
3149
|
+
result = { splitDataSources: null, errorCode: "UNKNOWN" };
|
|
3150
|
+
}
|
|
3151
|
+
return result;
|
|
3322
3152
|
};
|
|
3323
|
-
var
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.trendColor),
|
|
3331
|
-
isDisabled: ({ options }) => options.trendDisplay === "off"
|
|
3332
|
-
};
|
|
3333
|
-
var StaticTrendColorEditor_default = StaticTrendColorEditor;
|
|
3334
|
-
|
|
3335
|
-
// src/common/editorConfig/StaticBackgroundColorEditor.js
|
|
3336
|
-
var StaticBackgroundColorEditor = {
|
|
3337
|
-
label: (0, i18n_exports._)("Background color"),
|
|
3338
|
-
option: "backgroundColor",
|
|
3339
|
-
editor: "editor.color",
|
|
3340
|
-
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.backgroundColor)
|
|
3153
|
+
var turnOffLegendDisplayWhenTrellisIsOn = (isTrellisOn, options) => {
|
|
3154
|
+
if (isTrellisOn && !options.legendDisplay) {
|
|
3155
|
+
return {
|
|
3156
|
+
legendDisplay: "off"
|
|
3157
|
+
};
|
|
3158
|
+
}
|
|
3159
|
+
return {};
|
|
3341
3160
|
};
|
|
3342
|
-
var
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
}
|
|
3360
|
-
|
|
3361
|
-
const presetOptionKeys = Object.keys(presetOptions);
|
|
3362
|
-
return presetOptionKeys.every(
|
|
3363
|
-
(optionKey) => (0, configUtils_exports.isDynamicOption)(presetOptions[optionKey]) === (0, configUtils_exports.isDynamicOption)(vizOptions[optionKey])
|
|
3364
|
-
);
|
|
3365
|
-
}
|
|
3366
|
-
function getInitialPreset(vizContext, vizOptions, presets2) {
|
|
3367
|
-
return presets2.find((preset) => {
|
|
3368
|
-
const presetContext = (0, lodash_exports.get)(preset, ["value", "context"], {});
|
|
3369
|
-
const presetOptions = (0, lodash_exports.get)(preset, ["value", "options"], {});
|
|
3370
|
-
const presetContextKeys = Object.keys(presetContext);
|
|
3371
|
-
const presetOptionKeys = Object.keys(presetOptions);
|
|
3372
|
-
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
3373
|
-
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
3161
|
+
var calculateSharedMinMax = (splitData) => {
|
|
3162
|
+
let max2 = -Infinity;
|
|
3163
|
+
let min2 = Infinity;
|
|
3164
|
+
Object.keys(splitData).forEach((splitByKey) => {
|
|
3165
|
+
const datasources = splitData[splitByKey];
|
|
3166
|
+
Object.keys(datasources).forEach((datasourceName) => {
|
|
3167
|
+
const dataColumns = datasources[datasourceName].data.columns;
|
|
3168
|
+
dataColumns.forEach((column) => {
|
|
3169
|
+
column.forEach((point) => {
|
|
3170
|
+
const pointNumber = Number(point);
|
|
3171
|
+
if (pointNumber > max2) {
|
|
3172
|
+
max2 = pointNumber;
|
|
3173
|
+
}
|
|
3174
|
+
if (pointNumber < min2) {
|
|
3175
|
+
min2 = pointNumber;
|
|
3176
|
+
}
|
|
3177
|
+
});
|
|
3178
|
+
});
|
|
3179
|
+
});
|
|
3374
3180
|
});
|
|
3375
|
-
|
|
3181
|
+
return [min2, max2];
|
|
3182
|
+
};
|
|
3183
|
+
var determineMinMax = (splitData, trellisSharedScale, yAxisMin, yAxisMax, stackMode) => {
|
|
3184
|
+
if (!trellisSharedScale || stackMode === "stacked100" || yAxisMin !== "auto" && yAxisMax !== "auto")
|
|
3185
|
+
return [yAxisMin, yAxisMax];
|
|
3186
|
+
const [sharedMin, sharedMax] = calculateSharedMinMax(splitData);
|
|
3187
|
+
const shouldUseSharedMax = sharedMax !== -Infinity && yAxisMax === "auto";
|
|
3188
|
+
const shouldUseSharedMin = sharedMin !== Infinity && yAxisMin === "auto";
|
|
3189
|
+
return [shouldUseSharedMin ? sharedMin : yAxisMin, shouldUseSharedMax ? sharedMax : yAxisMax];
|
|
3190
|
+
};
|
|
3376
3191
|
|
|
3377
|
-
// src/common/
|
|
3378
|
-
var
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
editor: "editor.toggle",
|
|
3384
|
-
showEditor: () => {
|
|
3385
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
3386
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
3387
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3388
|
-
);
|
|
3389
|
-
return isTrellisFeatureFlagOn;
|
|
3390
|
-
}
|
|
3391
|
-
}
|
|
3392
|
-
],
|
|
3393
|
-
[
|
|
3394
|
-
{
|
|
3395
|
-
label: (0, i18n_exports._)("Split by"),
|
|
3396
|
-
option: "trellisSplitBy",
|
|
3397
|
-
editor: "editor.trellisSplitBy",
|
|
3398
|
-
editorProps: {
|
|
3399
|
-
dataSourceKey: "primary"
|
|
3400
|
-
},
|
|
3401
|
-
showEditor: ({ options }) => {
|
|
3402
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
3403
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
3404
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3405
|
-
);
|
|
3406
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
3407
|
-
}
|
|
3408
|
-
}
|
|
3409
|
-
],
|
|
3410
|
-
[
|
|
3411
|
-
{
|
|
3412
|
-
label: (0, i18n_exports._)("Number of columns"),
|
|
3413
|
-
option: "trellisColumns",
|
|
3414
|
-
editor: "editor.number",
|
|
3415
|
-
editorProps: {
|
|
3416
|
-
min: 1
|
|
3417
|
-
},
|
|
3418
|
-
placeholder: (0, i18n_exports._)("Auto"),
|
|
3419
|
-
showEditor: ({ options }) => {
|
|
3420
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
3421
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
3422
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3423
|
-
);
|
|
3424
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
3425
|
-
}
|
|
3426
|
-
}
|
|
3427
|
-
],
|
|
3428
|
-
[
|
|
3429
|
-
{
|
|
3430
|
-
label: (0, i18n_exports._)("Min column width"),
|
|
3431
|
-
option: "trellisMinColumnWidth",
|
|
3432
|
-
editor: "editor.number",
|
|
3433
|
-
editorProps: {
|
|
3434
|
-
min: 1
|
|
3435
|
-
},
|
|
3436
|
-
showEditor: ({ options }) => {
|
|
3437
|
-
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
3438
|
-
const isTrellisFeatureFlagOn = Boolean(
|
|
3439
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3440
|
-
);
|
|
3441
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
3442
|
-
}
|
|
3192
|
+
// src/common/withDashboardViz.tsx
|
|
3193
|
+
var withDashboardViz = (opts) => {
|
|
3194
|
+
const {
|
|
3195
|
+
ReactViz,
|
|
3196
|
+
vizConfig,
|
|
3197
|
+
computeVizProps: computeVizProps2 = () => {
|
|
3443
3198
|
},
|
|
3444
|
-
{
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
}
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3472
|
-
);
|
|
3473
|
-
return isTrellisFeatureFlagOn && options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
3199
|
+
computeVizPropsBeforeEval: computeVizPropsBeforeEval2 = () => {
|
|
3200
|
+
},
|
|
3201
|
+
disableEditModeCover,
|
|
3202
|
+
useIconPlaceholder
|
|
3203
|
+
} = opts;
|
|
3204
|
+
const SanitizedReactViz = (0, SanitizeProps_exports.withSanitizedProps)(ReactViz);
|
|
3205
|
+
const defaultOptions = (0, JSONSchemaUtils_exports.pickFieldFromJSONSchema)(vizConfig.optionsSchema, "default");
|
|
3206
|
+
const DashboardViz = (props) => {
|
|
3207
|
+
var _a;
|
|
3208
|
+
const {
|
|
3209
|
+
mode,
|
|
3210
|
+
hasEventHandlers,
|
|
3211
|
+
dataSources,
|
|
3212
|
+
// type of { [key: string]: DataSource }
|
|
3213
|
+
options,
|
|
3214
|
+
context = {},
|
|
3215
|
+
width,
|
|
3216
|
+
height,
|
|
3217
|
+
onComputedProps,
|
|
3218
|
+
onEventTrigger,
|
|
3219
|
+
theme,
|
|
3220
|
+
onRequestParamsChange
|
|
3221
|
+
} = props;
|
|
3222
|
+
const { serializedTimezone } = react_exports.useContext(TimezoneContext_default);
|
|
3223
|
+
if (serializedTimezone) {
|
|
3224
|
+
if (!moment_default.getDefaultSplunkTimezone()) {
|
|
3225
|
+
moment_default.setDefaultSplunkTimezone(serializedTimezone);
|
|
3474
3226
|
}
|
|
3475
3227
|
}
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3228
|
+
const themeFunc = (themeVar) => {
|
|
3229
|
+
var _a2, _b;
|
|
3230
|
+
return (_b = (_a2 = vizConfig.themes)[themeVar]) == null ? void 0 : _b.call(_a2, props);
|
|
3231
|
+
};
|
|
3232
|
+
const bgColorFromTheme = themeFunc("defaultBackgroundColor");
|
|
3233
|
+
const {
|
|
3234
|
+
family: currentThemeFamily,
|
|
3235
|
+
colorScheme: currentThemeColorScheme,
|
|
3236
|
+
density: currentThemeDensity
|
|
3237
|
+
} = getSettingsFromThemedProps_default({ theme });
|
|
3238
|
+
let evaluatedOptions = {};
|
|
3239
|
+
const [evaluatedOptionsAsync, setEvaluatedOptionsAsync] = react_exports.useState({});
|
|
3483
3240
|
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
3484
|
-
const
|
|
3241
|
+
const [visualizationID] = react_exports.useState(`${vizConfig.name} - ${(0, id_exports.createGUID)()}`);
|
|
3242
|
+
const [dataSourcesInState, setDataSourcesInState] = react_exports.useState({});
|
|
3243
|
+
const [dataFramesInState, setDataFramesInState] = react_exports.useState();
|
|
3244
|
+
const [useAsyncEvaluatedOptions, setUseAsyncEvaluatedOptions] = react_exports.useState(
|
|
3245
|
+
Boolean(getFeatureFlag(featureFlagContext, "visualizations_useWebWorkersForDSL"))
|
|
3246
|
+
);
|
|
3247
|
+
const isDownsamplingEnabledByFeatureFlag = Boolean(
|
|
3248
|
+
featureFlagContext == null ? void 0 : featureFlagContext.visualizations_enableDownsampling
|
|
3249
|
+
);
|
|
3250
|
+
const isTrellisFeatureFlagOn2 = Boolean(
|
|
3485
3251
|
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
3486
3252
|
);
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
};
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
};
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
majorColor: void 0,
|
|
3515
|
-
trendColor: void 0,
|
|
3516
|
-
backgroundColor: void 0
|
|
3517
|
-
};
|
|
3518
|
-
var presets = [
|
|
3519
|
-
{
|
|
3520
|
-
// dummy context variables to allow for resetting of unused context states
|
|
3521
|
-
label: (0, i18n_exports._)("None"),
|
|
3522
|
-
name: "singleValue.none",
|
|
3523
|
-
value: {
|
|
3524
|
-
context: __spreadValues({}, basePresetContext),
|
|
3525
|
-
options: __spreadValues({}, basePresetOptions)
|
|
3526
|
-
}
|
|
3527
|
-
},
|
|
3528
|
-
{
|
|
3529
|
-
label: (0, i18n_exports._)("Major value"),
|
|
3530
|
-
name: "singleValue.majorValue",
|
|
3531
|
-
value: {
|
|
3532
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3533
|
-
majorColorEditorConfig: defaultContext.majorColorConfig
|
|
3534
|
-
}),
|
|
3535
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3536
|
-
majorColor: "> majorValue | rangeValue(majorColorEditorConfig)"
|
|
3537
|
-
})
|
|
3538
|
-
}
|
|
3539
|
-
},
|
|
3540
|
-
{
|
|
3541
|
-
label: (0, i18n_exports._)("Trend value"),
|
|
3542
|
-
name: "singleValue.trend",
|
|
3543
|
-
value: {
|
|
3544
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3545
|
-
trendColorEditorConfig: defaultContext.trendColorConfig
|
|
3546
|
-
}),
|
|
3547
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3548
|
-
trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
|
|
3549
|
-
})
|
|
3550
|
-
}
|
|
3551
|
-
},
|
|
3552
|
-
{
|
|
3553
|
-
label: (0, i18n_exports._)("Major value and Trend value"),
|
|
3554
|
-
name: "singleValue.majorValueAndTrend",
|
|
3555
|
-
value: {
|
|
3556
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3557
|
-
majorColorEditorConfig: defaultContext.majorColorConfig,
|
|
3558
|
-
trendColorEditorConfig: defaultContext.trendColorConfig
|
|
3559
|
-
}),
|
|
3560
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3561
|
-
majorColor: "> majorValue | rangeValue(majorColorEditorConfig)",
|
|
3562
|
-
trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
|
|
3563
|
-
})
|
|
3564
|
-
}
|
|
3565
|
-
},
|
|
3566
|
-
{
|
|
3567
|
-
label: (0, i18n_exports._)("Background"),
|
|
3568
|
-
name: "singleValue.background",
|
|
3569
|
-
value: {
|
|
3570
|
-
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3571
|
-
backgroundColorEditorConfig: defaultContext.majorColorConfig
|
|
3572
|
-
}),
|
|
3573
|
-
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3574
|
-
backgroundColor: "> majorValue | rangeValue(backgroundColorEditorConfig)"
|
|
3575
|
-
})
|
|
3576
|
-
}
|
|
3577
|
-
}
|
|
3578
|
-
];
|
|
3579
|
-
var themes = {
|
|
3580
|
-
defaultFontColor: (props) => pick_default2({
|
|
3581
|
-
enterprise: {
|
|
3582
|
-
dark: variables_default.textColor(props),
|
|
3583
|
-
light: variables_default.gray20(props)
|
|
3584
|
-
},
|
|
3585
|
-
prisma: variables_default.contentColorActive(props)
|
|
3586
|
-
})(props),
|
|
3587
|
-
defaultBlockFontColor: (props) => pick_default2({
|
|
3588
|
-
enterprise: variables_default.white(props),
|
|
3589
|
-
prisma: variables_default.contentColorActive(props)
|
|
3590
|
-
})(props),
|
|
3591
|
-
defaultBackgroundColor: (props) => pick_default2({
|
|
3592
|
-
enterprise: {
|
|
3593
|
-
dark: variables_default.black(props),
|
|
3594
|
-
light: variables_default.backgroundColor(props)
|
|
3595
|
-
},
|
|
3596
|
-
prisma: variables_default.backgroundColorSidebar(props)
|
|
3597
|
-
})(props),
|
|
3598
|
-
defaultSparklineStrokeColor: (props) => pick_default2({
|
|
3599
|
-
enterprise: variables_default.textColor(props),
|
|
3600
|
-
prisma: variables_default.contentColorActive(props)
|
|
3601
|
-
})(props),
|
|
3602
|
-
// TODO(fkurniawan): update with SCP-36839
|
|
3603
|
-
sparklineSeverityColors: (props) => pick_default2({
|
|
3604
|
-
enterprise: {
|
|
3605
|
-
dark: JSON.stringify({
|
|
3606
|
-
none: {
|
|
3607
|
-
background: variables_exports2.enterpriseDark.gray60,
|
|
3608
|
-
// note: may need update later
|
|
3609
|
-
stroke: variables_exports2.enterpriseDark.white
|
|
3610
|
-
},
|
|
3611
|
-
low: {
|
|
3612
|
-
background: variables_exports2.enterpriseDark.successColorD50,
|
|
3613
|
-
stroke: variables_exports2.enterpriseDark.white
|
|
3614
|
-
},
|
|
3615
|
-
guarded: {
|
|
3616
|
-
background: variables_exports2.enterpriseDark.infoColorD50,
|
|
3617
|
-
stroke: variables_exports2.enterpriseDark.white
|
|
3618
|
-
},
|
|
3619
|
-
elevated: {
|
|
3620
|
-
background: variables_exports2.enterpriseDark.warningColorD50,
|
|
3621
|
-
stroke: variables_exports2.enterpriseDark.white
|
|
3622
|
-
},
|
|
3623
|
-
high: {
|
|
3624
|
-
background: variables_exports2.enterpriseDark.alertColorD50,
|
|
3625
|
-
stroke: variables_exports2.enterpriseDark.white
|
|
3626
|
-
},
|
|
3627
|
-
severe: {
|
|
3628
|
-
background: variables_exports2.enterpriseDark.errorColorD50,
|
|
3629
|
-
stroke: variables_exports2.enterpriseDark.white
|
|
3630
|
-
}
|
|
3631
|
-
}),
|
|
3632
|
-
light: JSON.stringify({
|
|
3633
|
-
none: {
|
|
3634
|
-
background: variables_exports2.enterprise.gray60,
|
|
3635
|
-
stroke: variables_exports2.enterprise.gray20
|
|
3636
|
-
},
|
|
3637
|
-
low: {
|
|
3638
|
-
background: variables_exports2.enterprise.successColorD50,
|
|
3639
|
-
stroke: variables_exports2.enterprise.white
|
|
3640
|
-
},
|
|
3641
|
-
guarded: {
|
|
3642
|
-
background: variables_exports2.enterprise.infoColorD50,
|
|
3643
|
-
stroke: variables_exports2.enterprise.white
|
|
3644
|
-
},
|
|
3645
|
-
elevated: {
|
|
3646
|
-
background: variables_exports2.enterprise.warningColorD50,
|
|
3647
|
-
stroke: variables_exports2.enterprise.white
|
|
3648
|
-
},
|
|
3649
|
-
high: {
|
|
3650
|
-
background: variables_exports2.enterprise.alertColorD50,
|
|
3651
|
-
stroke: variables_exports2.enterprise.white
|
|
3652
|
-
},
|
|
3653
|
-
severe: {
|
|
3654
|
-
background: variables_exports2.enterprise.errorColorD50,
|
|
3655
|
-
stroke: variables_exports2.enterprise.white
|
|
3656
|
-
}
|
|
3657
|
-
})
|
|
3658
|
-
},
|
|
3659
|
-
prisma: JSON.stringify({
|
|
3660
|
-
none: {
|
|
3661
|
-
background: variables_exports2.scp.gray52,
|
|
3662
|
-
stroke: variables_exports2.scp.white
|
|
3663
|
-
},
|
|
3664
|
-
low: {
|
|
3665
|
-
background: variables_exports2.scp.successColorD50,
|
|
3666
|
-
stroke: variables_exports2.scp.white
|
|
3667
|
-
},
|
|
3668
|
-
guarded: {
|
|
3669
|
-
background: variables_exports2.scp.infoColorD50,
|
|
3670
|
-
stroke: variables_exports2.scp.white
|
|
3671
|
-
},
|
|
3672
|
-
elevated: {
|
|
3673
|
-
background: variables_exports2.scp.warningColorD50,
|
|
3674
|
-
stroke: variables_exports2.scp.white
|
|
3675
|
-
},
|
|
3676
|
-
high: {
|
|
3677
|
-
background: variables_exports2.scp.alertColorD50,
|
|
3678
|
-
stroke: variables_exports2.scp.white
|
|
3679
|
-
},
|
|
3680
|
-
severe: {
|
|
3681
|
-
background: variables_exports2.scp.errorColorD50,
|
|
3682
|
-
stroke: variables_exports2.scp.white
|
|
3253
|
+
const isTrellisOn = isTrellisFeatureFlagOn2 && ((_a = vizConfig == null ? void 0 : vizConfig.supports) == null ? void 0 : _a.includes("trellis" /* TRELLIS */)) && (options == null ? void 0 : options.splitByLayout) === "trellis" /* TRELLIS */;
|
|
3254
|
+
const isMounted = react_exports.useRef(true);
|
|
3255
|
+
const optionsToEvaluate = react_exports.useMemo(() => {
|
|
3256
|
+
var _a2;
|
|
3257
|
+
const legendDisplay = turnOffLegendDisplayWhenTrellisIsOn(isTrellisOn, options);
|
|
3258
|
+
const computedOptions = (_a2 = computeVizPropsBeforeEval2(options)) != null ? _a2 : {};
|
|
3259
|
+
return {
|
|
3260
|
+
context: (0, lodash_exports.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
3261
|
+
options: (0, hocUtils_exports.deepMergeWithArrayPrimitiveOverrides)(
|
|
3262
|
+
{},
|
|
3263
|
+
legendDisplay,
|
|
3264
|
+
computedOptions,
|
|
3265
|
+
options,
|
|
3266
|
+
defaultOptions
|
|
3267
|
+
)
|
|
3268
|
+
};
|
|
3269
|
+
}, [isTrellisOn, options, context]);
|
|
3270
|
+
const [threshold, setThreshold] = react_exports.useState(Number(width));
|
|
3271
|
+
const onDownsamplingThresholdChange = react_exports.useCallback((newThreshold) => {
|
|
3272
|
+
setThreshold(newThreshold);
|
|
3273
|
+
}, []);
|
|
3274
|
+
const isDownsamplingEnabled = react_exports.useMemo(() => {
|
|
3275
|
+
return isDownsamplingEnabledByFeatureFlag && isDownsamplingEnabledForViz({ vizConfig });
|
|
3276
|
+
}, [isDownsamplingEnabledByFeatureFlag]);
|
|
3277
|
+
const downsamplingProps = react_exports.useMemo(() => {
|
|
3278
|
+
if (!isDownsamplingEnabled) {
|
|
3279
|
+
return {};
|
|
3683
3280
|
}
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3281
|
+
return {
|
|
3282
|
+
onDownsamplingThresholdChange,
|
|
3283
|
+
originalDataSources: dataSources
|
|
3284
|
+
};
|
|
3285
|
+
}, [dataSources, isDownsamplingEnabled, onDownsamplingThresholdChange]);
|
|
3286
|
+
const downsampledDataSources = useDownsampleDataSources_default({
|
|
3287
|
+
options: optionsToEvaluate.options,
|
|
3288
|
+
context: optionsToEvaluate.context,
|
|
3289
|
+
dataSources,
|
|
3290
|
+
threshold,
|
|
3291
|
+
isDownsamplingEnabled
|
|
3292
|
+
});
|
|
3293
|
+
evaluatedOptions = useDeepMemo(() => {
|
|
3294
|
+
try {
|
|
3295
|
+
if (useAsyncEvaluatedOptions) {
|
|
3296
|
+
const asyncDynamicOptionsEvaluatorParams = {
|
|
3297
|
+
visualizationID,
|
|
3298
|
+
props,
|
|
3299
|
+
options: optionsToEvaluate,
|
|
3300
|
+
dataSources: downsampledDataSources,
|
|
3301
|
+
theme: vizConfig.themes,
|
|
3302
|
+
bypassCloneDeepOptionScope: Boolean(
|
|
3303
|
+
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
3304
|
+
),
|
|
3305
|
+
lazyLoadingDataFrame: Boolean(
|
|
3306
|
+
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
3307
|
+
)
|
|
3308
|
+
};
|
|
3309
|
+
async_dynamic_options_evaluator_default.evaluate(asyncDynamicOptionsEvaluatorParams).then((results) => {
|
|
3310
|
+
setEvaluatedOptionsAsync(results.results);
|
|
3311
|
+
}).catch(() => {
|
|
3312
|
+
if (isMounted.current) {
|
|
3313
|
+
setUseAsyncEvaluatedOptions(false);
|
|
3711
3314
|
}
|
|
3712
|
-
}
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
[
|
|
3723
|
-
{
|
|
3724
|
-
label: (0, i18n_exports._)("Trend display"),
|
|
3725
|
-
option: "trendDisplay",
|
|
3726
|
-
editor: "editor.select",
|
|
3727
|
-
editorProps: {
|
|
3728
|
-
values: [
|
|
3729
|
-
{ label: (0, i18n_exports._)("Percent"), value: "percent" },
|
|
3730
|
-
{ label: (0, i18n_exports._)("Absolute"), value: "absolute" },
|
|
3731
|
-
{ label: (0, i18n_exports._)("Off"), value: "off" }
|
|
3732
|
-
]
|
|
3733
|
-
},
|
|
3734
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3735
|
-
},
|
|
3736
|
-
{
|
|
3737
|
-
label: (0, i18n_exports._)("Sparkline display"),
|
|
3738
|
-
option: "sparklineDisplay",
|
|
3739
|
-
editor: "editor.select",
|
|
3740
|
-
editorProps: {
|
|
3741
|
-
values: [
|
|
3742
|
-
{ label: (0, i18n_exports._)("Off"), value: "off" },
|
|
3743
|
-
{ label: (0, i18n_exports._)("Before"), value: "before" },
|
|
3744
|
-
{ label: (0, i18n_exports._)("Below"), value: "below" },
|
|
3745
|
-
{ label: (0, i18n_exports._)("After"), value: "after" }
|
|
3746
|
-
]
|
|
3315
|
+
});
|
|
3316
|
+
} else {
|
|
3317
|
+
let dataFrames = dataFramesInState;
|
|
3318
|
+
if (downsampledDataSources !== dataSourcesInState) {
|
|
3319
|
+
setDataSourcesInState(downsampledDataSources);
|
|
3320
|
+
dataFrames = Options_exports.Options.dataFrameFromDataSource(
|
|
3321
|
+
downsampledDataSources,
|
|
3322
|
+
getFeatureFlag(featureFlagContext, "visualizations_lazyLoadingDataFrame")
|
|
3323
|
+
);
|
|
3324
|
+
setDataFramesInState(dataFrames);
|
|
3747
3325
|
}
|
|
3326
|
+
const result = Options_exports.Options.evaluate(
|
|
3327
|
+
optionsToEvaluate,
|
|
3328
|
+
downsampledDataSources,
|
|
3329
|
+
themeFunc,
|
|
3330
|
+
dataFrames,
|
|
3331
|
+
getFeatureFlag(featureFlagContext, "visualizations_bypassCloneDeepOptionScope")
|
|
3332
|
+
);
|
|
3333
|
+
return result;
|
|
3334
|
+
}
|
|
3335
|
+
} catch (e) {
|
|
3336
|
+
console.error(`unexpected error evaluating options: ${e.message}`);
|
|
3337
|
+
return {};
|
|
3338
|
+
}
|
|
3339
|
+
return {};
|
|
3340
|
+
}, [
|
|
3341
|
+
currentThemeFamily,
|
|
3342
|
+
currentThemeColorScheme,
|
|
3343
|
+
currentThemeDensity,
|
|
3344
|
+
optionsToEvaluate,
|
|
3345
|
+
downsampledDataSources,
|
|
3346
|
+
serializedTimezone,
|
|
3347
|
+
useAsyncEvaluatedOptions
|
|
3348
|
+
]);
|
|
3349
|
+
const evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
3350
|
+
let clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
3351
|
+
if (isTrellisOn) {
|
|
3352
|
+
clonedEvaluatedOptions = __spreadProps(__spreadValues({}, evaluatedOptionsToUse), {
|
|
3353
|
+
backgroundColor: clonedEvaluatedOptions == null ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
react_exports.useEffect(() => {
|
|
3357
|
+
onComputedProps(clonedEvaluatedOptions);
|
|
3358
|
+
});
|
|
3359
|
+
react_exports.useEffect(() => {
|
|
3360
|
+
return () => {
|
|
3361
|
+
if (useAsyncEvaluatedOptions) {
|
|
3362
|
+
isMounted.current = false;
|
|
3363
|
+
async_dynamic_options_evaluator_default.reset(visualizationID);
|
|
3748
3364
|
}
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
]
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
[
|
|
3365
|
+
};
|
|
3366
|
+
}, []);
|
|
3367
|
+
const { requiredProps = [], supports } = vizConfig;
|
|
3368
|
+
const missing = missingKeys(requiredProps, evaluatedOptionsToUse);
|
|
3369
|
+
if (missing.length > 0 && supports.includes("placeholder" /* PLACEHOLDER */) && vizConfig.key !== "splunk.singlevalue") {
|
|
3370
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
3371
|
+
MissingPropsMessage_default,
|
|
3757
3372
|
{
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
value: ({ context, options }) => {
|
|
3764
|
-
const initialPreset = getInitialPreset(context, options, presets);
|
|
3765
|
-
return initialPreset && initialPreset.label || null;
|
|
3766
|
-
}
|
|
3767
|
-
}
|
|
3373
|
+
"data-test": "missing-props-message",
|
|
3374
|
+
width,
|
|
3375
|
+
height,
|
|
3376
|
+
missingProps: missing,
|
|
3377
|
+
backgroundColor: bgColorFromTheme
|
|
3768
3378
|
}
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
[
|
|
3787
|
-
__spreadProps(__spreadValues({}, StaticBackgroundColorEditor_default), {
|
|
3788
|
-
editorProps: {
|
|
3789
|
-
themes
|
|
3379
|
+
);
|
|
3380
|
+
}
|
|
3381
|
+
const eventCallbackProps = {};
|
|
3382
|
+
if (hasEventHandlers && mode === "view" && vizConfig.supports.indexOf("events" /* EVENTS */) > -1) {
|
|
3383
|
+
const supportedEvents = vizConfig.events;
|
|
3384
|
+
Object.keys(supportedEvents).forEach((eventName) => {
|
|
3385
|
+
const { parentKeys, payloadKeys } = supportedEvents[eventName];
|
|
3386
|
+
const eventCallbackPropName = (0, lodash_exports.camelCase)(`on.${eventName}`);
|
|
3387
|
+
let payload = {};
|
|
3388
|
+
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
3389
|
+
payloadKeys.forEach((p) => {
|
|
3390
|
+
payload[p] = evaluatedOptionsToUse[p];
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3393
|
+
eventCallbackProps[eventCallbackPropName] = (ev) => {
|
|
3394
|
+
if (ev && ev.payload) {
|
|
3395
|
+
payload = ev.payload;
|
|
3790
3396
|
}
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3397
|
+
return onEventTrigger({ originalEvent: ev, payload, type: eventName });
|
|
3398
|
+
};
|
|
3399
|
+
if (parentKeys) {
|
|
3400
|
+
for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
3401
|
+
const newObject = {};
|
|
3402
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
3403
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
3797
3404
|
}
|
|
3798
|
-
})
|
|
3799
|
-
],
|
|
3800
|
-
[getDynamicBackgroundColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
|
|
3801
|
-
[
|
|
3802
|
-
{
|
|
3803
|
-
label: (0, i18n_exports._)("Major value size (px)"),
|
|
3804
|
-
option: "majorFontSize",
|
|
3805
|
-
editor: "editor.number",
|
|
3806
|
-
editorProps: {
|
|
3807
|
-
min: 1
|
|
3808
|
-
},
|
|
3809
|
-
placeholder: (0, i18n_exports._)("Auto"),
|
|
3810
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3811
|
-
},
|
|
3812
|
-
{
|
|
3813
|
-
label: (0, i18n_exports._)("Trend value size (px)"),
|
|
3814
|
-
option: "trendFontSize",
|
|
3815
|
-
editor: "editor.number",
|
|
3816
|
-
editorProps: {
|
|
3817
|
-
min: 1
|
|
3818
|
-
},
|
|
3819
|
-
placeholder: (0, i18n_exports._)("Auto"),
|
|
3820
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0,
|
|
3821
|
-
isDisabled: ({ options }) => options.trendDisplay === "off"
|
|
3822
3405
|
}
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3406
|
+
});
|
|
3407
|
+
}
|
|
3408
|
+
const computedVizProps = computeVizProps2(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
3409
|
+
themeFunc
|
|
3410
|
+
}));
|
|
3411
|
+
let dataSourceMetadata = {};
|
|
3412
|
+
const OptionKey = "paginateDataSourceKey";
|
|
3413
|
+
const paginateDataSourceKey = (0, lodash_exports.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || "primary";
|
|
3414
|
+
if (vizConfig.supports.indexOf("page-and-sort" /* PAGE_AND_SORT */) > -1 && (0, lodash_exports.has)(dataSources, paginateDataSourceKey)) {
|
|
3415
|
+
const requestParams = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "requestParams"], {});
|
|
3416
|
+
const meta = (0, lodash_exports.get)(dataSources, [paginateDataSourceKey, "meta"], {});
|
|
3417
|
+
const handleRequestParamsChange = (payload) => onRequestParamsChange(paginateDataSourceKey, payload);
|
|
3418
|
+
const sortParams = getSortingParams({
|
|
3419
|
+
requestParams,
|
|
3420
|
+
meta,
|
|
3421
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
3422
|
+
});
|
|
3423
|
+
const paginatorParams = getPaginationParams({
|
|
3424
|
+
requestParams,
|
|
3425
|
+
meta,
|
|
3426
|
+
onRequestParamsChange: handleRequestParamsChange
|
|
3427
|
+
});
|
|
3428
|
+
dataSourceMetadata = {
|
|
3429
|
+
sortParams,
|
|
3430
|
+
paginatorParams
|
|
3431
|
+
};
|
|
3432
|
+
}
|
|
3433
|
+
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
3434
|
+
return null;
|
|
3435
|
+
}
|
|
3436
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
3437
|
+
SanitizedReactViz,
|
|
3438
|
+
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
3439
|
+
mode,
|
|
3440
|
+
width,
|
|
3441
|
+
height
|
|
3442
|
+
}, downsamplingProps), evaluatedOptionsToUse), computedVizProps), eventCallbackProps), dataSourceMetadata)
|
|
3443
|
+
);
|
|
3444
|
+
};
|
|
3445
|
+
DashboardViz.propTypes = __spreadValues(__spreadValues({}, SplunkVisualization_default.propTypes), ReactViz.propTypes);
|
|
3446
|
+
DashboardViz.defaultProps = __spreadProps(__spreadValues(__spreadValues({}, SplunkVisualization_default.defaultProps), ReactViz.defaultProps), {
|
|
3447
|
+
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
3448
|
+
theme: {}
|
|
3449
|
+
});
|
|
3450
|
+
DashboardViz.config = vizConfig;
|
|
3451
|
+
return (0, styled_components_exports.withTheme)(
|
|
3452
|
+
withPlaceholder_default(withEditModeCover_default(DashboardViz, disableEditModeCover), useIconPlaceholder)
|
|
3453
|
+
);
|
|
3454
|
+
};
|
|
3455
|
+
var withDashboardViz_default = withDashboardViz;
|
|
3456
|
+
|
|
3457
|
+
// esm-externals:@splunk/visualization-color-palettes/editors/PresetPalettes
|
|
3458
|
+
var PresetPalettes_exports = {};
|
|
3459
|
+
__export(PresetPalettes_exports, {
|
|
3460
|
+
default: () => PresetPalettes_default
|
|
3461
|
+
});
|
|
3462
|
+
var defaultImport34 = __toESM(require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
|
|
3463
|
+
__reExport(PresetPalettes_exports, require("@splunk/visualization-color-palettes/editors/PresetPalettes"));
|
|
3464
|
+
var PresetPalettes_default = "default" in defaultImport34 ? defaultImport34.default : defaultImport34;
|
|
3465
|
+
|
|
3466
|
+
// esm-externals:@splunk/visualization-themes/variables
|
|
3467
|
+
var variables_exports2 = {};
|
|
3468
|
+
__export(variables_exports2, {
|
|
3469
|
+
default: () => variables_default2
|
|
3470
|
+
});
|
|
3471
|
+
var defaultImport35 = __toESM(require("@splunk/visualization-themes/variables"));
|
|
3472
|
+
__reExport(variables_exports2, require("@splunk/visualization-themes/variables"));
|
|
3473
|
+
var variables_default2 = "default" in defaultImport35 ? defaultImport35.default : defaultImport35;
|
|
3474
|
+
|
|
3475
|
+
// esm-externals:@splunk/themes/pick
|
|
3476
|
+
var pick_exports2 = {};
|
|
3477
|
+
__export(pick_exports2, {
|
|
3478
|
+
default: () => pick_default2
|
|
3479
|
+
});
|
|
3480
|
+
var defaultImport36 = __toESM(require("@splunk/themes/pick"));
|
|
3481
|
+
__reExport(pick_exports2, require("@splunk/themes/pick"));
|
|
3482
|
+
var pick_default2 = "default" in defaultImport36 ? defaultImport36.default : defaultImport36;
|
|
3483
|
+
|
|
3484
|
+
// esm-externals:@splunk/visualization-icons
|
|
3485
|
+
var visualization_icons_exports = {};
|
|
3486
|
+
__export(visualization_icons_exports, {
|
|
3487
|
+
default: () => visualization_icons_default
|
|
3488
|
+
});
|
|
3489
|
+
var defaultImport37 = __toESM(require("@splunk/visualization-icons"));
|
|
3490
|
+
__reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
|
|
3491
|
+
var visualization_icons_default = "default" in defaultImport37 ? defaultImport37.default : defaultImport37;
|
|
3492
|
+
|
|
3493
|
+
// esm-externals:@splunk/visualization-icons/placeholders
|
|
3494
|
+
var placeholders_exports = {};
|
|
3495
|
+
__export(placeholders_exports, {
|
|
3496
|
+
default: () => placeholders_default
|
|
3497
|
+
});
|
|
3498
|
+
var defaultImport38 = __toESM(require("@splunk/visualization-icons/placeholders"));
|
|
3499
|
+
__reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
|
|
3500
|
+
var placeholders_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
|
|
3501
|
+
|
|
3502
|
+
// src/common/configContext/singleValueContext.ts
|
|
3503
|
+
var defaultContext = {
|
|
3504
|
+
trendColorConfig: [
|
|
3505
|
+
{
|
|
3506
|
+
to: 0,
|
|
3507
|
+
value: "#9E2520"
|
|
3508
|
+
},
|
|
3509
|
+
{
|
|
3510
|
+
from: 0,
|
|
3511
|
+
value: "#1C6B2D"
|
|
3512
|
+
}
|
|
3513
|
+
],
|
|
3514
|
+
majorColorConfig: [
|
|
3515
|
+
{ to: 20, value: "#D41F1F" },
|
|
3516
|
+
{ from: 20, to: 40, value: "#D94E17" },
|
|
3517
|
+
{ from: 40, to: 60, value: "#CBA700" },
|
|
3518
|
+
{ from: 60, to: 80, value: "#669922" },
|
|
3519
|
+
{ from: 80, value: "#118832" }
|
|
3520
|
+
],
|
|
3521
|
+
majorColorMatchConfig: [{ match: "", value: "#5C33FF" }],
|
|
3522
|
+
trendValueCopy: "> trendValue",
|
|
3523
|
+
divisor: "> majorValue | subtract(trendValueCopy) | divideBy(100)",
|
|
3524
|
+
trendValuePercent: "> trendValue | divideBy(divisor)"
|
|
3525
|
+
};
|
|
3526
|
+
|
|
3527
|
+
// esm-externals:@splunk/visualizations-shared/configUtils
|
|
3528
|
+
var configUtils_exports = {};
|
|
3529
|
+
__export(configUtils_exports, {
|
|
3530
|
+
default: () => configUtils_default
|
|
3531
|
+
});
|
|
3532
|
+
var defaultImport39 = __toESM(require("@splunk/visualizations-shared/configUtils"));
|
|
3533
|
+
__reExport(configUtils_exports, require("@splunk/visualizations-shared/configUtils"));
|
|
3534
|
+
var configUtils_default = "default" in defaultImport39 ? defaultImport39.default : defaultImport39;
|
|
3535
|
+
|
|
3536
|
+
// src/common/editorConfig/DynamicMajorColorEditor.js
|
|
3537
|
+
var getDynamicMajorColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
3538
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3539
|
+
option: "majorColor",
|
|
3540
|
+
context: "majorColorEditorConfig",
|
|
3541
|
+
editor: "editor.dynamicColor",
|
|
3542
|
+
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.majorColor),
|
|
3543
|
+
editorProps: {
|
|
3544
|
+
labelPosition: "top",
|
|
3545
|
+
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: major value"),
|
|
3546
|
+
formatters: [
|
|
3547
|
+
{
|
|
3548
|
+
label: (0, i18n_exports._)("Ranges"),
|
|
3549
|
+
value: "rangeValue",
|
|
3550
|
+
defaults: {
|
|
3551
|
+
majorValue: defaultContext2.majorColorConfig
|
|
3552
|
+
}
|
|
3553
|
+
},
|
|
3554
|
+
{
|
|
3555
|
+
label: (0, i18n_exports._)("Matches"),
|
|
3556
|
+
value: "matchValue",
|
|
3557
|
+
defaults: {
|
|
3558
|
+
majorValue: defaultContext2.majorColorMatchConfig
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
],
|
|
3562
|
+
dataSelectors: [
|
|
3563
|
+
{
|
|
3564
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3565
|
+
value: "majorValue"
|
|
3566
|
+
}
|
|
3567
|
+
],
|
|
3568
|
+
defaultPalettesConfig: defaultPalettesConfig2
|
|
3569
|
+
}
|
|
3570
|
+
});
|
|
3571
|
+
|
|
3572
|
+
// src/common/editorConfig/DynamicTrendColorEditor.js
|
|
3573
|
+
var getDynamicTrendColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
3574
|
+
label: (0, i18n_exports._)("Trend value"),
|
|
3575
|
+
option: "trendColor",
|
|
3576
|
+
context: "trendColorEditorConfig",
|
|
3577
|
+
editor: "editor.dynamicColor",
|
|
3578
|
+
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.trendColor),
|
|
3579
|
+
editorProps: {
|
|
3580
|
+
labelPosition: "top",
|
|
3581
|
+
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: trend value"),
|
|
3582
|
+
formatters: [
|
|
3583
|
+
{
|
|
3584
|
+
label: (0, i18n_exports._)("Ranges"),
|
|
3585
|
+
value: "rangeValue",
|
|
3586
|
+
defaults: {
|
|
3587
|
+
trendValue: defaultContext2.trendColorConfig
|
|
3829
3588
|
}
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3589
|
+
}
|
|
3590
|
+
],
|
|
3591
|
+
dataSelectors: [
|
|
3592
|
+
{
|
|
3593
|
+
label: (0, i18n_exports._)("Trend value"),
|
|
3594
|
+
value: "trendValue"
|
|
3595
|
+
}
|
|
3596
|
+
],
|
|
3597
|
+
defaultPalettesConfig: defaultPalettesConfig2
|
|
3598
|
+
}
|
|
3599
|
+
});
|
|
3600
|
+
|
|
3601
|
+
// src/common/editorConfig/DynamicBackgroundColorEditor.js
|
|
3602
|
+
var getDynamicBackgroundColorEditor = ({ defaultContext: defaultContext2, defaultPalettesConfig: defaultPalettesConfig2 }) => ({
|
|
3603
|
+
label: (0, i18n_exports._)("Background color"),
|
|
3604
|
+
option: "backgroundColor",
|
|
3605
|
+
context: "backgroundColorEditorConfig",
|
|
3606
|
+
editor: "editor.dynamicColor",
|
|
3607
|
+
showEditor: ({ options }) => (0, configUtils_exports.isDynamicOption)(options.backgroundColor),
|
|
3608
|
+
editorProps: {
|
|
3609
|
+
labelPosition: "top",
|
|
3610
|
+
flyoutTitle: (0, i18n_exports._)("Dynamic coloring: background"),
|
|
3611
|
+
formatters: [
|
|
3612
|
+
{
|
|
3613
|
+
label: (0, i18n_exports._)("Ranges"),
|
|
3614
|
+
value: "rangeValue",
|
|
3615
|
+
defaults: {
|
|
3616
|
+
majorValue: defaultContext2.majorColorConfig,
|
|
3617
|
+
trendValue: defaultContext2.trendColorConfig
|
|
3836
3618
|
}
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
editorProps: {
|
|
3844
|
-
values: [
|
|
3845
|
-
{ label: (0, i18n_exports._)("Left"), value: "left" },
|
|
3846
|
-
{ label: (0, i18n_exports._)("Center"), value: "center" },
|
|
3847
|
-
{ label: (0, i18n_exports._)("Right"), value: "right" }
|
|
3848
|
-
]
|
|
3849
|
-
},
|
|
3850
|
-
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3619
|
+
},
|
|
3620
|
+
{
|
|
3621
|
+
label: (0, i18n_exports._)("Matches"),
|
|
3622
|
+
value: "matchValue",
|
|
3623
|
+
defaults: {
|
|
3624
|
+
majorValue: defaultContext2.majorColorMatchConfig
|
|
3851
3625
|
}
|
|
3852
|
-
|
|
3853
|
-
]
|
|
3626
|
+
}
|
|
3627
|
+
],
|
|
3628
|
+
dataSelectors: [
|
|
3629
|
+
{
|
|
3630
|
+
label: (0, i18n_exports._)("Major Value"),
|
|
3631
|
+
value: "majorValue"
|
|
3632
|
+
},
|
|
3633
|
+
{
|
|
3634
|
+
label: (0, i18n_exports._)("Trend"),
|
|
3635
|
+
value: "trendValue"
|
|
3636
|
+
}
|
|
3637
|
+
],
|
|
3638
|
+
defaultPalettesConfig: defaultPalettesConfig2
|
|
3854
3639
|
}
|
|
3640
|
+
});
|
|
3641
|
+
|
|
3642
|
+
// src/common/editorConfig/StaticMajorAndTrendLayout.js
|
|
3643
|
+
var StaticMajorAndTrendLayout = [
|
|
3644
|
+
[
|
|
3645
|
+
{
|
|
3646
|
+
label: (0, i18n_exports._)("Unit position"),
|
|
3647
|
+
// todo: we need a new editor combining unit and position
|
|
3648
|
+
option: "unitPosition",
|
|
3649
|
+
editor: "editor.select",
|
|
3650
|
+
editorProps: {
|
|
3651
|
+
values: [
|
|
3652
|
+
{ label: (0, i18n_exports._)("Before"), value: "before" },
|
|
3653
|
+
{ label: (0, i18n_exports._)("After"), value: "after" }
|
|
3654
|
+
]
|
|
3655
|
+
},
|
|
3656
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3657
|
+
},
|
|
3658
|
+
{
|
|
3659
|
+
label: (0, i18n_exports._)("Unit label"),
|
|
3660
|
+
option: "unit",
|
|
3661
|
+
editor: "editor.text",
|
|
3662
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3663
|
+
}
|
|
3664
|
+
],
|
|
3665
|
+
[
|
|
3666
|
+
{
|
|
3667
|
+
label: (0, i18n_exports._)("Precision"),
|
|
3668
|
+
option: "numberPrecision",
|
|
3669
|
+
editor: "editor.number",
|
|
3670
|
+
editorProps: {
|
|
3671
|
+
min: 0,
|
|
3672
|
+
max: 20
|
|
3673
|
+
},
|
|
3674
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
3675
|
+
}
|
|
3676
|
+
]
|
|
3677
|
+
];
|
|
3678
|
+
var StaticMajorAndTrendLayout_default = StaticMajorAndTrendLayout;
|
|
3679
|
+
|
|
3680
|
+
// src/common/editorConfig/StaticMajorColorEditor.js
|
|
3681
|
+
var StaticMajorColorEditor = {
|
|
3682
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3683
|
+
option: "majorColor",
|
|
3684
|
+
editor: "editor.color",
|
|
3685
|
+
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.majorColor)
|
|
3686
|
+
};
|
|
3687
|
+
var StaticMajorColorEditor_default = StaticMajorColorEditor;
|
|
3688
|
+
|
|
3689
|
+
// src/common/editorConfig/StaticTrendColorEditor.js
|
|
3690
|
+
var StaticTrendColorEditor = {
|
|
3691
|
+
label: (0, i18n_exports._)("Trend value"),
|
|
3692
|
+
option: "trendColor",
|
|
3693
|
+
editor: "editor.color",
|
|
3694
|
+
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.trendColor),
|
|
3695
|
+
isDisabled: ({ options }) => options.trendDisplay === "off"
|
|
3696
|
+
};
|
|
3697
|
+
var StaticTrendColorEditor_default = StaticTrendColorEditor;
|
|
3698
|
+
|
|
3699
|
+
// src/common/editorConfig/StaticBackgroundColorEditor.js
|
|
3700
|
+
var StaticBackgroundColorEditor = {
|
|
3701
|
+
label: (0, i18n_exports._)("Background color"),
|
|
3702
|
+
option: "backgroundColor",
|
|
3703
|
+
editor: "editor.color",
|
|
3704
|
+
showEditor: ({ options }) => !(0, configUtils_exports.isDynamicOption)(options.backgroundColor)
|
|
3705
|
+
};
|
|
3706
|
+
var StaticBackgroundColorEditor_default = StaticBackgroundColorEditor;
|
|
3707
|
+
|
|
3708
|
+
// src/common/utils/configUtils.ts
|
|
3709
|
+
function enhanceConfig(vizConfig) {
|
|
3710
|
+
const enhancedConfig = __spreadValues({}, vizConfig);
|
|
3711
|
+
enhancedConfig.editorConfig = vizConfig.editorConfig.map(
|
|
3712
|
+
(config3) => {
|
|
3713
|
+
return __spreadProps(__spreadValues({}, config3), { open: config3.open || false });
|
|
3714
|
+
}
|
|
3715
|
+
);
|
|
3716
|
+
return enhancedConfig;
|
|
3717
|
+
}
|
|
3718
|
+
function hasCompatibleContexts(vizContext, presetContext) {
|
|
3719
|
+
const presetContextKeys = Object.keys(presetContext);
|
|
3720
|
+
return presetContextKeys.every(
|
|
3721
|
+
(contextKey) => presetContext[contextKey] === void 0 && vizContext[contextKey] === void 0 || presetContext[contextKey] !== void 0 && vizContext[contextKey] !== void 0
|
|
3722
|
+
);
|
|
3723
|
+
}
|
|
3724
|
+
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
3725
|
+
const presetOptionKeys = Object.keys(presetOptions);
|
|
3726
|
+
return presetOptionKeys.every(
|
|
3727
|
+
(optionKey) => (0, configUtils_exports.isDynamicOption)(presetOptions[optionKey]) === (0, configUtils_exports.isDynamicOption)(vizOptions[optionKey])
|
|
3728
|
+
);
|
|
3729
|
+
}
|
|
3730
|
+
function getInitialPreset(vizContext, vizOptions, presets2) {
|
|
3731
|
+
return presets2.find((preset) => {
|
|
3732
|
+
const presetContext = (0, lodash_exports.get)(preset, ["value", "context"], {});
|
|
3733
|
+
const presetOptions = (0, lodash_exports.get)(preset, ["value", "options"], {});
|
|
3734
|
+
const presetContextKeys = Object.keys(presetContext);
|
|
3735
|
+
const presetOptionKeys = Object.keys(presetOptions);
|
|
3736
|
+
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
3737
|
+
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
3738
|
+
});
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
// src/common/editorConfig/TrellisEditors.ts
|
|
3742
|
+
var isTrellisFeatureFlagOn = ({ featureFlags }) => {
|
|
3743
|
+
return Boolean(featureFlags == null ? void 0 : featureFlags.visualizations_enableTrellis);
|
|
3744
|
+
};
|
|
3745
|
+
var isTrellisEnabled = ({ options, featureFlags }) => {
|
|
3746
|
+
const { splitByLayout = visualization_schemas_exports.LAYOUT_TYPE.Off } = options;
|
|
3747
|
+
return isTrellisFeatureFlagOn({ featureFlags }) && splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
3748
|
+
};
|
|
3749
|
+
var TrellisEditorConfig = [
|
|
3750
|
+
[
|
|
3751
|
+
{
|
|
3752
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
3753
|
+
option: "splitByLayout",
|
|
3754
|
+
editor: "editor.toggle",
|
|
3755
|
+
showEditor: isTrellisFeatureFlagOn
|
|
3756
|
+
}
|
|
3757
|
+
],
|
|
3758
|
+
[
|
|
3759
|
+
{
|
|
3760
|
+
label: (0, i18n_exports._)("Split by"),
|
|
3761
|
+
option: "trellisSplitBy",
|
|
3762
|
+
editor: "editor.trellisSplitBy",
|
|
3763
|
+
editorProps: {
|
|
3764
|
+
dataSourceKey: "primary"
|
|
3765
|
+
},
|
|
3766
|
+
showEditor: isTrellisEnabled
|
|
3767
|
+
}
|
|
3768
|
+
],
|
|
3769
|
+
[
|
|
3770
|
+
{
|
|
3771
|
+
label: (0, i18n_exports._)("Number of columns"),
|
|
3772
|
+
option: "trellisColumns",
|
|
3773
|
+
editor: "editor.number",
|
|
3774
|
+
editorProps: {
|
|
3775
|
+
min: 1
|
|
3776
|
+
},
|
|
3777
|
+
placeholder: (0, i18n_exports._)("Auto"),
|
|
3778
|
+
showEditor: isTrellisEnabled
|
|
3779
|
+
}
|
|
3780
|
+
],
|
|
3781
|
+
[
|
|
3782
|
+
{
|
|
3783
|
+
label: (0, i18n_exports._)("Min column width"),
|
|
3784
|
+
option: "trellisMinColumnWidth",
|
|
3785
|
+
editor: "editor.number",
|
|
3786
|
+
editorProps: {
|
|
3787
|
+
min: 1
|
|
3788
|
+
},
|
|
3789
|
+
showEditor: isTrellisEnabled
|
|
3790
|
+
},
|
|
3791
|
+
{
|
|
3792
|
+
label: (0, i18n_exports._)("Row height"),
|
|
3793
|
+
option: "trellisRowHeight",
|
|
3794
|
+
editor: "editor.number",
|
|
3795
|
+
editorProps: {
|
|
3796
|
+
min: 1
|
|
3797
|
+
},
|
|
3798
|
+
showEditor: isTrellisEnabled
|
|
3799
|
+
}
|
|
3800
|
+
],
|
|
3801
|
+
[
|
|
3802
|
+
{
|
|
3803
|
+
label: (0, i18n_exports._)("Max number of components per page"),
|
|
3804
|
+
option: "trellisPageCount",
|
|
3805
|
+
editor: "editor.number",
|
|
3806
|
+
editorProps: {
|
|
3807
|
+
min: 1
|
|
3808
|
+
},
|
|
3809
|
+
showEditor: isTrellisEnabled
|
|
3810
|
+
}
|
|
3811
|
+
]
|
|
3855
3812
|
];
|
|
3856
|
-
var
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
placeholderIcon: placeholders_exports.SingleValue,
|
|
3871
|
-
dataContract,
|
|
3872
|
-
size,
|
|
3873
|
-
defaultContext,
|
|
3874
|
-
optionsSchema: visualization_schemas_exports.singleValueOptionsSchema,
|
|
3875
|
-
editorConfig,
|
|
3876
|
-
events: {
|
|
3877
|
-
"value.click": {
|
|
3878
|
-
description: "trigger when user clicks major value",
|
|
3879
|
-
payloadKeys: ["majorValue", "trendValue"]
|
|
3813
|
+
var TimechartTrellisEditorConfig = [
|
|
3814
|
+
[
|
|
3815
|
+
{
|
|
3816
|
+
label: (0, i18n_exports._)("Trellis layout"),
|
|
3817
|
+
option: "splitByLayout",
|
|
3818
|
+
editor: "editor.toggle",
|
|
3819
|
+
showEditor: isTrellisFeatureFlagOn,
|
|
3820
|
+
// add help text for timecharts
|
|
3821
|
+
editorProps: {
|
|
3822
|
+
help: (0, i18n_exports._)(
|
|
3823
|
+
"Y2-axis and overlay field configurations are not supported when trellis is enabled."
|
|
3824
|
+
),
|
|
3825
|
+
helpFormat: "under"
|
|
3826
|
+
}
|
|
3880
3827
|
}
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3828
|
+
],
|
|
3829
|
+
...TrellisEditorConfig.slice(1),
|
|
3830
|
+
[
|
|
3831
|
+
{
|
|
3832
|
+
label: (0, i18n_exports._)("Shared y-axis scale"),
|
|
3833
|
+
option: "trellisSharedScale",
|
|
3834
|
+
editor: "editor.checkbox",
|
|
3835
|
+
showEditor: isTrellisEnabled
|
|
3836
|
+
}
|
|
3837
|
+
]
|
|
3838
|
+
];
|
|
3839
|
+
var TrellisBackgroundColorEditor = {
|
|
3840
|
+
label: (0, i18n_exports._)("Trellis background"),
|
|
3841
|
+
option: "trellisBackgroundColor",
|
|
3842
|
+
editor: "editor.color",
|
|
3843
|
+
showEditor: isTrellisEnabled
|
|
3885
3844
|
};
|
|
3886
|
-
var config_default = enhanceConfig(config);
|
|
3887
|
-
|
|
3888
|
-
// esm-externals:@splunk/react-ui/Paginator
|
|
3889
|
-
var Paginator_exports = {};
|
|
3890
|
-
__export(Paginator_exports, {
|
|
3891
|
-
default: () => Paginator_default
|
|
3892
|
-
});
|
|
3893
|
-
var defaultImport39 = __toESM(require("@splunk/react-ui/Paginator"));
|
|
3894
|
-
__reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
|
|
3895
|
-
var Paginator_default = "default" in defaultImport39 ? defaultImport39.default : defaultImport39;
|
|
3896
|
-
|
|
3897
|
-
// esm-externals:@splunk/themes
|
|
3898
|
-
var themes_exports = {};
|
|
3899
|
-
__export(themes_exports, {
|
|
3900
|
-
default: () => themes_default
|
|
3901
|
-
});
|
|
3902
|
-
var defaultImport40 = __toESM(require("@splunk/themes"));
|
|
3903
|
-
__reExport(themes_exports, require("@splunk/themes"));
|
|
3904
|
-
var themes_default = "default" in defaultImport40 ? defaultImport40.default : defaultImport40;
|
|
3905
|
-
|
|
3906
|
-
// esm-externals:@splunk/themes/useSplunkTheme
|
|
3907
|
-
var useSplunkTheme_exports = {};
|
|
3908
|
-
__export(useSplunkTheme_exports, {
|
|
3909
|
-
default: () => useSplunkTheme_default
|
|
3910
|
-
});
|
|
3911
|
-
var defaultImport41 = __toESM(require("@splunk/themes/useSplunkTheme"));
|
|
3912
|
-
__reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
|
|
3913
|
-
var useSplunkTheme_default = "default" in defaultImport41 ? defaultImport41.default : defaultImport41;
|
|
3914
|
-
|
|
3915
|
-
// esm-externals:@splunk/visualizations-shared/trellisUtils
|
|
3916
|
-
var trellisUtils_exports = {};
|
|
3917
|
-
__export(trellisUtils_exports, {
|
|
3918
|
-
default: () => trellisUtils_default
|
|
3919
|
-
});
|
|
3920
|
-
var defaultImport42 = __toESM(require("@splunk/visualizations-shared/trellisUtils"));
|
|
3921
|
-
__reExport(trellisUtils_exports, require("@splunk/visualizations-shared/trellisUtils"));
|
|
3922
|
-
var trellisUtils_default = "default" in defaultImport42 ? defaultImport42.default : defaultImport42;
|
|
3923
3845
|
|
|
3924
|
-
// src/
|
|
3925
|
-
var
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
let splitDataSources = null;
|
|
3931
|
-
let errorCode = null;
|
|
3932
|
-
if (fields && fields.length) {
|
|
3933
|
-
splitDataSources = {};
|
|
3934
|
-
for (let i = 0; i < fields.length; i += 1) {
|
|
3935
|
-
const fieldName = fields[i].name;
|
|
3936
|
-
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
3937
|
-
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
3938
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3939
|
-
);
|
|
3940
|
-
splitDataSources[fieldName].primary.data.fields = [fields[i]];
|
|
3941
|
-
splitDataSources[fieldName].primary.data.columns = [columns[i]];
|
|
3942
|
-
}
|
|
3846
|
+
// src/SingleValue/config.ts
|
|
3847
|
+
var dataContract = {
|
|
3848
|
+
requiredDataSources: [
|
|
3849
|
+
{
|
|
3850
|
+
name: "primary",
|
|
3851
|
+
description: "DataSource that powers the visualization"
|
|
3943
3852
|
}
|
|
3944
|
-
|
|
3945
|
-
|
|
3853
|
+
],
|
|
3854
|
+
optionalDataSources: [],
|
|
3855
|
+
initialRequestParams: {
|
|
3856
|
+
primary: { offset: 0, count: 1e4 }
|
|
3946
3857
|
}
|
|
3947
|
-
return { splitDataSources, errorCode };
|
|
3948
3858
|
};
|
|
3949
|
-
var
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
3953
|
-
let splitDataSources = null;
|
|
3954
|
-
let splitByFields = [];
|
|
3955
|
-
let errorCode = null;
|
|
3956
|
-
if (typeof fields[0] !== "string") {
|
|
3957
|
-
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysChart)(fields);
|
|
3958
|
-
}
|
|
3959
|
-
if (splitByFields && splitByFields.length > 0) {
|
|
3960
|
-
splitDataSources = {};
|
|
3961
|
-
splitByFields.forEach((splitByField) => {
|
|
3962
|
-
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
3963
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3964
|
-
);
|
|
3965
|
-
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
3966
|
-
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
3967
|
-
fields.forEach((field, idx) => {
|
|
3968
|
-
const fieldName = field == null ? void 0 : field.name;
|
|
3969
|
-
if (fieldName !== "_time" && !(fieldName == null ? void 0 : fieldName.startsWith("_")) && field.data_source === splitByField) {
|
|
3970
|
-
splitDataSources[splitByField].primary.data.fields.push(field);
|
|
3971
|
-
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
3972
|
-
}
|
|
3973
|
-
});
|
|
3974
|
-
});
|
|
3975
|
-
} else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
|
|
3976
|
-
splitDataSources = {};
|
|
3977
|
-
for (let i = 1; i < fields.length; i += 1) {
|
|
3978
|
-
const fieldName = fields[i].name;
|
|
3979
|
-
if (!(fieldName == null ? void 0 : fieldName.startsWith("_"))) {
|
|
3980
|
-
splitDataSources[fieldName] = (0, lodash_exports.cloneDeep)(
|
|
3981
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
3982
|
-
);
|
|
3983
|
-
splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
|
|
3984
|
-
splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
|
|
3985
|
-
}
|
|
3986
|
-
}
|
|
3987
|
-
} else {
|
|
3988
|
-
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
3989
|
-
}
|
|
3990
|
-
return { splitDataSources, errorCode };
|
|
3859
|
+
var size = {
|
|
3860
|
+
initialWidth: 250,
|
|
3861
|
+
initialHeight: 250
|
|
3991
3862
|
};
|
|
3992
|
-
var
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
let splitDataSources = null;
|
|
3997
|
-
let splitByFields = [];
|
|
3998
|
-
let errorCode = null;
|
|
3999
|
-
if (typeof fields[0] !== "string") {
|
|
4000
|
-
splitByFields = (0, trellisUtils_exports.extractDataSourceAggregationKeysStats)(fields);
|
|
4001
|
-
}
|
|
4002
|
-
if (splitByFields && splitByFields.length > 0) {
|
|
4003
|
-
splitDataSources = {};
|
|
4004
|
-
splitByFields.forEach((splitByField) => {
|
|
4005
|
-
splitDataSources[splitByField] = (0, lodash_exports.cloneDeep)(
|
|
4006
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
4007
|
-
);
|
|
4008
|
-
splitDataSources[splitByField].primary.data.fields = [fields[0]];
|
|
4009
|
-
splitDataSources[splitByField].primary.data.columns = [columns[0]];
|
|
4010
|
-
const idx = fields.findIndex((field) => field.name === splitByField);
|
|
4011
|
-
if (idx > 0) {
|
|
4012
|
-
splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
|
|
4013
|
-
splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
|
|
4014
|
-
}
|
|
4015
|
-
});
|
|
4016
|
-
} else {
|
|
4017
|
-
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
4018
|
-
}
|
|
4019
|
-
return { splitDataSources, errorCode };
|
|
3863
|
+
var basePresetContext = {
|
|
3864
|
+
majorColorEditorConfig: void 0,
|
|
3865
|
+
trendColorEditorConfig: void 0,
|
|
3866
|
+
backgroundColorEditorConfig: void 0
|
|
4020
3867
|
};
|
|
4021
|
-
var
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
3868
|
+
var basePresetOptions = {
|
|
3869
|
+
majorColor: void 0,
|
|
3870
|
+
trendColor: void 0,
|
|
3871
|
+
backgroundColor: void 0
|
|
3872
|
+
};
|
|
3873
|
+
var presets = [
|
|
3874
|
+
{
|
|
3875
|
+
// dummy context variables to allow for resetting of unused context states
|
|
3876
|
+
label: (0, i18n_exports._)("None"),
|
|
3877
|
+
name: "singleValue.none",
|
|
3878
|
+
value: {
|
|
3879
|
+
context: __spreadValues({}, basePresetContext),
|
|
3880
|
+
options: __spreadValues({}, basePresetOptions)
|
|
3881
|
+
}
|
|
3882
|
+
},
|
|
3883
|
+
{
|
|
3884
|
+
label: (0, i18n_exports._)("Major value"),
|
|
3885
|
+
name: "singleValue.majorValue",
|
|
3886
|
+
value: {
|
|
3887
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3888
|
+
majorColorEditorConfig: defaultContext.majorColorConfig
|
|
3889
|
+
}),
|
|
3890
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3891
|
+
majorColor: "> majorValue | rangeValue(majorColorEditorConfig)"
|
|
3892
|
+
})
|
|
3893
|
+
}
|
|
3894
|
+
},
|
|
3895
|
+
{
|
|
3896
|
+
label: (0, i18n_exports._)("Trend value"),
|
|
3897
|
+
name: "singleValue.trend",
|
|
3898
|
+
value: {
|
|
3899
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3900
|
+
trendColorEditorConfig: defaultContext.trendColorConfig
|
|
3901
|
+
}),
|
|
3902
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3903
|
+
trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
|
|
3904
|
+
})
|
|
3905
|
+
}
|
|
3906
|
+
},
|
|
3907
|
+
{
|
|
3908
|
+
label: (0, i18n_exports._)("Major value and Trend value"),
|
|
3909
|
+
name: "singleValue.majorValueAndTrend",
|
|
3910
|
+
value: {
|
|
3911
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3912
|
+
majorColorEditorConfig: defaultContext.majorColorConfig,
|
|
3913
|
+
trendColorEditorConfig: defaultContext.trendColorConfig
|
|
3914
|
+
}),
|
|
3915
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3916
|
+
majorColor: "> majorValue | rangeValue(majorColorEditorConfig)",
|
|
3917
|
+
trendColor: "> trendValue | rangeValue(trendColorEditorConfig)"
|
|
3918
|
+
})
|
|
3919
|
+
}
|
|
3920
|
+
},
|
|
3921
|
+
{
|
|
3922
|
+
label: (0, i18n_exports._)("Background"),
|
|
3923
|
+
name: "singleValue.background",
|
|
3924
|
+
value: {
|
|
3925
|
+
context: __spreadProps(__spreadValues({}, basePresetContext), {
|
|
3926
|
+
backgroundColorEditorConfig: defaultContext.majorColorConfig
|
|
3927
|
+
}),
|
|
3928
|
+
options: __spreadProps(__spreadValues({}, basePresetOptions), {
|
|
3929
|
+
backgroundColor: "> majorValue | rangeValue(backgroundColorEditorConfig)"
|
|
3930
|
+
})
|
|
4039
3931
|
}
|
|
4040
|
-
valueKeys.forEach((val) => {
|
|
4041
|
-
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
4042
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
4043
|
-
);
|
|
4044
|
-
splitDataSources[val].primary.data.fields = [
|
|
4045
|
-
{ name: fields[0].name },
|
|
4046
|
-
...dataSourceKeys.map((k) => ({
|
|
4047
|
-
name: k
|
|
4048
|
-
}))
|
|
4049
|
-
];
|
|
4050
|
-
splitDataSources[val].primary.data.columns = [[...columns[0]]];
|
|
4051
|
-
dataSourceKeys.forEach((dsKey) => {
|
|
4052
|
-
fields.forEach((field, idx) => {
|
|
4053
|
-
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
4054
|
-
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
4055
|
-
}
|
|
4056
|
-
});
|
|
4057
|
-
});
|
|
4058
|
-
});
|
|
4059
|
-
} else {
|
|
4060
|
-
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
4061
|
-
}
|
|
4062
|
-
return { splitDataSources, errorCode };
|
|
4063
|
-
};
|
|
4064
|
-
var dataSourcesSplitByModeChart = (dataSource, splitBy) => {
|
|
4065
|
-
var _a, _b, _c, _d;
|
|
4066
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
4067
|
-
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
4068
|
-
let splitDataSources = null;
|
|
4069
|
-
let splitByFields = [];
|
|
4070
|
-
let errorCode = null;
|
|
4071
|
-
if (typeof fields[0] !== "string") {
|
|
4072
|
-
splitByFields = (0, trellisUtils_exports.extractSplitByFieldsChartFields)(fields);
|
|
4073
3932
|
}
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
3933
|
+
];
|
|
3934
|
+
var themes = {
|
|
3935
|
+
defaultFontColor: (props) => pick_default2({
|
|
3936
|
+
enterprise: {
|
|
3937
|
+
dark: variables_default.textColor(props),
|
|
3938
|
+
light: variables_default.gray20(props)
|
|
3939
|
+
},
|
|
3940
|
+
prisma: variables_default.contentColorActive(props)
|
|
3941
|
+
})(props),
|
|
3942
|
+
defaultBlockFontColor: (props) => pick_default2({
|
|
3943
|
+
enterprise: variables_default.white(props),
|
|
3944
|
+
prisma: variables_default.contentColorActive(props)
|
|
3945
|
+
})(props),
|
|
3946
|
+
defaultBackgroundColor: (props) => pick_default2({
|
|
3947
|
+
enterprise: {
|
|
3948
|
+
dark: variables_default.black(props),
|
|
3949
|
+
light: variables_default.backgroundColor(props)
|
|
3950
|
+
},
|
|
3951
|
+
prisma: variables_default.backgroundColorSidebar(props)
|
|
3952
|
+
})(props),
|
|
3953
|
+
defaultSparklineStrokeColor: (props) => pick_default2({
|
|
3954
|
+
enterprise: variables_default.textColor(props),
|
|
3955
|
+
prisma: variables_default.contentColorActive(props)
|
|
3956
|
+
})(props),
|
|
3957
|
+
// TODO(fkurniawan): update with SCP-36839
|
|
3958
|
+
sparklineSeverityColors: (props) => pick_default2({
|
|
3959
|
+
enterprise: {
|
|
3960
|
+
dark: JSON.stringify({
|
|
3961
|
+
none: {
|
|
3962
|
+
background: variables_exports2.enterpriseDark.gray60,
|
|
3963
|
+
// note: may need update later
|
|
3964
|
+
stroke: variables_exports2.enterpriseDark.white
|
|
3965
|
+
},
|
|
3966
|
+
low: {
|
|
3967
|
+
background: variables_exports2.enterpriseDark.successColorD50,
|
|
3968
|
+
stroke: variables_exports2.enterpriseDark.white
|
|
3969
|
+
},
|
|
3970
|
+
guarded: {
|
|
3971
|
+
background: variables_exports2.enterpriseDark.infoColorD50,
|
|
3972
|
+
stroke: variables_exports2.enterpriseDark.white
|
|
3973
|
+
},
|
|
3974
|
+
elevated: {
|
|
3975
|
+
background: variables_exports2.enterpriseDark.warningColorD50,
|
|
3976
|
+
stroke: variables_exports2.enterpriseDark.white
|
|
3977
|
+
},
|
|
3978
|
+
high: {
|
|
3979
|
+
background: variables_exports2.enterpriseDark.alertColorD50,
|
|
3980
|
+
stroke: variables_exports2.enterpriseDark.white
|
|
3981
|
+
},
|
|
3982
|
+
severe: {
|
|
3983
|
+
background: variables_exports2.enterpriseDark.errorColorD50,
|
|
3984
|
+
stroke: variables_exports2.enterpriseDark.white
|
|
3985
|
+
}
|
|
3986
|
+
}),
|
|
3987
|
+
light: JSON.stringify({
|
|
3988
|
+
none: {
|
|
3989
|
+
background: variables_exports2.enterprise.gray60,
|
|
3990
|
+
stroke: variables_exports2.enterprise.gray20
|
|
3991
|
+
},
|
|
3992
|
+
low: {
|
|
3993
|
+
background: variables_exports2.enterprise.successColorD50,
|
|
3994
|
+
stroke: variables_exports2.enterprise.white
|
|
3995
|
+
},
|
|
3996
|
+
guarded: {
|
|
3997
|
+
background: variables_exports2.enterprise.infoColorD50,
|
|
3998
|
+
stroke: variables_exports2.enterprise.white
|
|
3999
|
+
},
|
|
4000
|
+
elevated: {
|
|
4001
|
+
background: variables_exports2.enterprise.warningColorD50,
|
|
4002
|
+
stroke: variables_exports2.enterprise.white
|
|
4003
|
+
},
|
|
4004
|
+
high: {
|
|
4005
|
+
background: variables_exports2.enterprise.alertColorD50,
|
|
4006
|
+
stroke: variables_exports2.enterprise.white
|
|
4007
|
+
},
|
|
4008
|
+
severe: {
|
|
4009
|
+
background: variables_exports2.enterprise.errorColorD50,
|
|
4010
|
+
stroke: variables_exports2.enterprise.white
|
|
4011
|
+
}
|
|
4012
|
+
})
|
|
4013
|
+
},
|
|
4014
|
+
prisma: JSON.stringify({
|
|
4015
|
+
none: {
|
|
4016
|
+
background: variables_exports2.scp.gray52,
|
|
4017
|
+
stroke: variables_exports2.scp.white
|
|
4018
|
+
},
|
|
4019
|
+
low: {
|
|
4020
|
+
background: variables_exports2.scp.successColorD50,
|
|
4021
|
+
stroke: variables_exports2.scp.white
|
|
4022
|
+
},
|
|
4023
|
+
guarded: {
|
|
4024
|
+
background: variables_exports2.scp.infoColorD50,
|
|
4025
|
+
stroke: variables_exports2.scp.white
|
|
4026
|
+
},
|
|
4027
|
+
elevated: {
|
|
4028
|
+
background: variables_exports2.scp.warningColorD50,
|
|
4029
|
+
stroke: variables_exports2.scp.white
|
|
4030
|
+
},
|
|
4031
|
+
high: {
|
|
4032
|
+
background: variables_exports2.scp.alertColorD50,
|
|
4033
|
+
stroke: variables_exports2.scp.white
|
|
4034
|
+
},
|
|
4035
|
+
severe: {
|
|
4036
|
+
background: variables_exports2.scp.errorColorD50,
|
|
4037
|
+
stroke: variables_exports2.scp.white
|
|
4083
4038
|
}
|
|
4084
|
-
}
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4039
|
+
})
|
|
4040
|
+
})(props)
|
|
4041
|
+
};
|
|
4042
|
+
var editorConfig = [
|
|
4043
|
+
{
|
|
4044
|
+
label: (0, i18n_exports._)("Data configurations"),
|
|
4045
|
+
layout: [
|
|
4046
|
+
[
|
|
4047
|
+
{
|
|
4048
|
+
label: (0, i18n_exports._)("Value"),
|
|
4049
|
+
editor: "editor.columnSelector",
|
|
4050
|
+
option: "sparklineValues",
|
|
4051
|
+
context: "sparklineValuesContext",
|
|
4052
|
+
editorProps: {
|
|
4053
|
+
dataSourceKey: "primary",
|
|
4054
|
+
prepareValue: (definition) => {
|
|
4055
|
+
const {
|
|
4056
|
+
options: { sparklineValues }
|
|
4057
|
+
} = definition;
|
|
4058
|
+
return {
|
|
4059
|
+
context: {},
|
|
4060
|
+
options: {
|
|
4061
|
+
majorValue: `> sparklineValues | lastPoint()`,
|
|
4062
|
+
trendValue: `> sparklineValues | delta(-2)`,
|
|
4063
|
+
sparklineValues
|
|
4064
|
+
}
|
|
4065
|
+
};
|
|
4066
|
+
}
|
|
4067
|
+
},
|
|
4068
|
+
isDisabled: ({ options }) => options.splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis
|
|
4094
4069
|
}
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4070
|
+
]
|
|
4071
|
+
]
|
|
4072
|
+
},
|
|
4073
|
+
{
|
|
4074
|
+
label: (0, i18n_exports._)("Data display"),
|
|
4075
|
+
layout: [
|
|
4076
|
+
...StaticMajorAndTrendLayout_default,
|
|
4077
|
+
[
|
|
4078
|
+
{
|
|
4079
|
+
label: (0, i18n_exports._)("Trend display"),
|
|
4080
|
+
option: "trendDisplay",
|
|
4081
|
+
editor: "editor.select",
|
|
4082
|
+
editorProps: {
|
|
4083
|
+
values: [
|
|
4084
|
+
{ label: (0, i18n_exports._)("Percent"), value: "percent" },
|
|
4085
|
+
{ label: (0, i18n_exports._)("Absolute"), value: "absolute" },
|
|
4086
|
+
{ label: (0, i18n_exports._)("Off"), value: "off" }
|
|
4087
|
+
]
|
|
4088
|
+
},
|
|
4089
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
4090
|
+
},
|
|
4091
|
+
{
|
|
4092
|
+
label: (0, i18n_exports._)("Sparkline display"),
|
|
4093
|
+
option: "sparklineDisplay",
|
|
4094
|
+
editor: "editor.select",
|
|
4095
|
+
editorProps: {
|
|
4096
|
+
values: [
|
|
4097
|
+
{ label: (0, i18n_exports._)("Off"), value: "off" },
|
|
4098
|
+
{ label: (0, i18n_exports._)("Before"), value: "before" },
|
|
4099
|
+
{ label: (0, i18n_exports._)("Below"), value: "below" },
|
|
4100
|
+
{ label: (0, i18n_exports._)("After"), value: "after" }
|
|
4101
|
+
]
|
|
4114
4102
|
}
|
|
4115
|
-
splitDataSources[val].primary.data.columns = columnValues;
|
|
4116
|
-
} else if (nonDataSourceAggregations.length) {
|
|
4117
|
-
const columnValues = [];
|
|
4118
|
-
fields.forEach((aggregationField, fieldIdx) => {
|
|
4119
|
-
if (fieldIdx > 0) {
|
|
4120
|
-
splitDataSources[val].primary.data.fields.push(aggregationField);
|
|
4121
|
-
columnValues.push([columns[fieldIdx][idx]]);
|
|
4122
|
-
}
|
|
4123
|
-
});
|
|
4124
|
-
splitDataSources[val].primary.data.columns = columnValues;
|
|
4125
4103
|
}
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
dataSourceKeys.forEach((dsKey) => {
|
|
4144
|
-
fields.forEach((field, idx) => {
|
|
4145
|
-
if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
|
|
4146
|
-
splitDataSources[val].primary.data.columns.push([...columns[idx]]);
|
|
4104
|
+
],
|
|
4105
|
+
...TrellisEditorConfig
|
|
4106
|
+
]
|
|
4107
|
+
},
|
|
4108
|
+
{
|
|
4109
|
+
label: (0, i18n_exports._)("Color and style"),
|
|
4110
|
+
layout: [
|
|
4111
|
+
[
|
|
4112
|
+
{
|
|
4113
|
+
label: (0, i18n_exports._)("Dynamic elements"),
|
|
4114
|
+
key: "presetSelector",
|
|
4115
|
+
editor: "editor.presetSelector",
|
|
4116
|
+
editorProps: {
|
|
4117
|
+
presets,
|
|
4118
|
+
value: ({ context, options }) => {
|
|
4119
|
+
const initialPreset = getInitialPreset(context, options, presets);
|
|
4120
|
+
return initialPreset && initialPreset.label || null;
|
|
4147
4121
|
}
|
|
4148
|
-
}
|
|
4149
|
-
});
|
|
4150
|
-
});
|
|
4151
|
-
}
|
|
4152
|
-
} else {
|
|
4153
|
-
errorCode = "INVALID_SPLIT_BY_FIELD";
|
|
4154
|
-
}
|
|
4155
|
-
return { splitDataSources, errorCode };
|
|
4156
|
-
};
|
|
4157
|
-
var dataSourcesSplitByModeStatsorUnknown = (dataSource, splitBy, splitMode) => {
|
|
4158
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4159
|
-
const fields = (_b = (_a = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _a.data) == null ? void 0 : _b.fields;
|
|
4160
|
-
const columns = (_d = (_c = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _c.data) == null ? void 0 : _d.columns;
|
|
4161
|
-
let splitDataSources = null;
|
|
4162
|
-
let splitByFields = [];
|
|
4163
|
-
let errorCode = null;
|
|
4164
|
-
if (typeof fields[0] !== "string") {
|
|
4165
|
-
splitByFields = splitMode !== trellisUtils_exports.UNKNOWN ? (0, trellisUtils_exports.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_exports.extractSplitByFieldsForUnknown)(fields);
|
|
4166
|
-
}
|
|
4167
|
-
const splitByIndex = fields == null ? void 0 : fields.findIndex(
|
|
4168
|
-
(field) => field === splitBy || field.name === splitBy
|
|
4169
|
-
);
|
|
4170
|
-
if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
|
|
4171
|
-
const splitByColumn = (_f = (_e = dataSource == null ? void 0 : dataSource.primary) == null ? void 0 : _e.data) == null ? void 0 : _f.columns[splitByIndex];
|
|
4172
|
-
splitDataSources = {};
|
|
4173
|
-
splitByColumn.forEach((val, idx) => {
|
|
4174
|
-
if (!splitDataSources[val]) {
|
|
4175
|
-
splitDataSources[val] = [idx];
|
|
4176
|
-
} else {
|
|
4177
|
-
splitDataSources[val].push(idx);
|
|
4178
|
-
}
|
|
4179
|
-
});
|
|
4180
|
-
const cloneFields = (0, lodash_exports.cloneDeep)(fields);
|
|
4181
|
-
cloneFields.splice(splitByIndex, 1);
|
|
4182
|
-
const valueKeys = Object.keys(splitDataSources);
|
|
4183
|
-
valueKeys.forEach((val) => {
|
|
4184
|
-
const valIndices = (0, lodash_exports.cloneDeep)(splitDataSources[val]);
|
|
4185
|
-
splitDataSources[val] = (0, lodash_exports.cloneDeep)(
|
|
4186
|
-
(0, lodash_exports.omit)(dataSource, ["primary.data.fields", "primary.data.columns"])
|
|
4187
|
-
);
|
|
4188
|
-
splitDataSources[val].primary.data.fields = cloneFields;
|
|
4189
|
-
splitDataSources[val].primary.data.columns = [];
|
|
4190
|
-
columns.forEach((col, idx) => {
|
|
4191
|
-
if (idx !== splitByIndex) {
|
|
4192
|
-
const newCol = valIndices.map((valIdx) => col[valIdx]);
|
|
4193
|
-
splitDataSources[val].primary.data.columns.push(newCol);
|
|
4122
|
+
}
|
|
4194
4123
|
}
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4124
|
+
],
|
|
4125
|
+
[
|
|
4126
|
+
__spreadProps(__spreadValues({}, StaticMajorColorEditor_default), {
|
|
4127
|
+
editorProps: {
|
|
4128
|
+
themes
|
|
4129
|
+
}
|
|
4130
|
+
})
|
|
4131
|
+
],
|
|
4132
|
+
[getDynamicMajorColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
|
|
4133
|
+
[
|
|
4134
|
+
__spreadProps(__spreadValues({}, StaticTrendColorEditor_default), {
|
|
4135
|
+
editorProps: {
|
|
4136
|
+
themes
|
|
4137
|
+
}
|
|
4138
|
+
})
|
|
4139
|
+
],
|
|
4140
|
+
[getDynamicTrendColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
|
|
4141
|
+
[
|
|
4142
|
+
__spreadProps(__spreadValues({}, StaticBackgroundColorEditor_default), {
|
|
4143
|
+
editorProps: {
|
|
4144
|
+
themes
|
|
4145
|
+
}
|
|
4146
|
+
})
|
|
4147
|
+
],
|
|
4148
|
+
[
|
|
4149
|
+
__spreadProps(__spreadValues({}, TrellisBackgroundColorEditor), {
|
|
4150
|
+
editorProps: {
|
|
4151
|
+
themes
|
|
4152
|
+
}
|
|
4153
|
+
})
|
|
4154
|
+
],
|
|
4155
|
+
[getDynamicBackgroundColorEditor({ defaultContext, defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig })],
|
|
4156
|
+
[
|
|
4157
|
+
{
|
|
4158
|
+
label: (0, i18n_exports._)("Major value size (px)"),
|
|
4159
|
+
option: "majorFontSize",
|
|
4160
|
+
editor: "editor.number",
|
|
4161
|
+
editorProps: {
|
|
4162
|
+
min: 1
|
|
4163
|
+
},
|
|
4164
|
+
placeholder: (0, i18n_exports._)("Auto"),
|
|
4165
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
4166
|
+
},
|
|
4167
|
+
{
|
|
4168
|
+
label: (0, i18n_exports._)("Trend value size (px)"),
|
|
4169
|
+
option: "trendFontSize",
|
|
4170
|
+
editor: "editor.number",
|
|
4171
|
+
editorProps: {
|
|
4172
|
+
min: 1
|
|
4173
|
+
},
|
|
4174
|
+
placeholder: (0, i18n_exports._)("Auto"),
|
|
4175
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0,
|
|
4176
|
+
isDisabled: ({ options }) => options.trendDisplay === "off"
|
|
4177
|
+
}
|
|
4178
|
+
],
|
|
4179
|
+
[
|
|
4180
|
+
{
|
|
4181
|
+
label: (0, i18n_exports._)("Major value abbreviation"),
|
|
4182
|
+
option: "shouldAbbreviateMajorValue",
|
|
4183
|
+
editor: "editor.checkbox"
|
|
4184
|
+
}
|
|
4185
|
+
],
|
|
4186
|
+
[
|
|
4187
|
+
{
|
|
4188
|
+
label: (0, i18n_exports._)("Trend value abbreviation"),
|
|
4189
|
+
option: "shouldAbbreviateTrendValue",
|
|
4190
|
+
editor: "editor.checkbox"
|
|
4191
|
+
}
|
|
4192
|
+
],
|
|
4193
|
+
[
|
|
4194
|
+
{
|
|
4195
|
+
label: (0, i18n_exports._)("Alignment"),
|
|
4196
|
+
editor: "editor.radioBar",
|
|
4197
|
+
option: "align",
|
|
4198
|
+
editorProps: {
|
|
4199
|
+
values: [
|
|
4200
|
+
{ label: (0, i18n_exports._)("Left"), value: "left" },
|
|
4201
|
+
{ label: (0, i18n_exports._)("Center"), value: "center" },
|
|
4202
|
+
{ label: (0, i18n_exports._)("Right"), value: "right" }
|
|
4203
|
+
]
|
|
4204
|
+
},
|
|
4205
|
+
showEditor: ({ options }) => options.showValue || options.showValue === void 0
|
|
4206
|
+
}
|
|
4207
|
+
]
|
|
4208
|
+
]
|
|
4199
4209
|
}
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4210
|
+
];
|
|
4211
|
+
var config = {
|
|
4212
|
+
/**
|
|
4213
|
+
* unique viz key
|
|
4214
|
+
*/
|
|
4215
|
+
key: "splunk.singlevalue",
|
|
4216
|
+
/**
|
|
4217
|
+
* viz name
|
|
4218
|
+
*/
|
|
4219
|
+
name: (0, i18n_exports._)("Single value"),
|
|
4220
|
+
category: "Single Value" /* SINGLE_VALUE */,
|
|
4221
|
+
/**
|
|
4222
|
+
* viz icon
|
|
4223
|
+
*/
|
|
4224
|
+
icon: visualization_icons_exports.SingleValue,
|
|
4225
|
+
placeholderIcon: placeholders_exports.SingleValue,
|
|
4226
|
+
dataContract,
|
|
4227
|
+
size,
|
|
4228
|
+
defaultContext,
|
|
4229
|
+
optionsSchema: visualization_schemas_exports.singleValueOptionsSchema,
|
|
4230
|
+
editorConfig,
|
|
4231
|
+
events: {
|
|
4232
|
+
"value.click": {
|
|
4233
|
+
description: "trigger when user clicks major value",
|
|
4234
|
+
payloadKeys: ["majorValue", "trendValue"]
|
|
4213
4235
|
}
|
|
4214
|
-
}
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
return result;
|
|
4236
|
+
},
|
|
4237
|
+
supports: ["dynamic-options" /* DYNAMIC_OPTIONS */, "events" /* EVENTS */, "placeholder" /* PLACEHOLDER */, "trellis" /* TRELLIS */],
|
|
4238
|
+
themes,
|
|
4239
|
+
requiredProps: ["majorValue"]
|
|
4219
4240
|
};
|
|
4241
|
+
var config_default = enhanceConfig(config);
|
|
4242
|
+
|
|
4243
|
+
// esm-externals:@splunk/react-ui/Paginator
|
|
4244
|
+
var Paginator_exports = {};
|
|
4245
|
+
__export(Paginator_exports, {
|
|
4246
|
+
default: () => Paginator_default
|
|
4247
|
+
});
|
|
4248
|
+
var defaultImport40 = __toESM(require("@splunk/react-ui/Paginator"));
|
|
4249
|
+
__reExport(Paginator_exports, require("@splunk/react-ui/Paginator"));
|
|
4250
|
+
var Paginator_default = "default" in defaultImport40 ? defaultImport40.default : defaultImport40;
|
|
4251
|
+
|
|
4252
|
+
// esm-externals:@splunk/themes
|
|
4253
|
+
var themes_exports = {};
|
|
4254
|
+
__export(themes_exports, {
|
|
4255
|
+
default: () => themes_default
|
|
4256
|
+
});
|
|
4257
|
+
var defaultImport41 = __toESM(require("@splunk/themes"));
|
|
4258
|
+
__reExport(themes_exports, require("@splunk/themes"));
|
|
4259
|
+
var themes_default = "default" in defaultImport41 ? defaultImport41.default : defaultImport41;
|
|
4260
|
+
|
|
4261
|
+
// esm-externals:@splunk/themes/useSplunkTheme
|
|
4262
|
+
var useSplunkTheme_exports = {};
|
|
4263
|
+
__export(useSplunkTheme_exports, {
|
|
4264
|
+
default: () => useSplunkTheme_default
|
|
4265
|
+
});
|
|
4266
|
+
var defaultImport42 = __toESM(require("@splunk/themes/useSplunkTheme"));
|
|
4267
|
+
__reExport(useSplunkTheme_exports, require("@splunk/themes/useSplunkTheme"));
|
|
4268
|
+
var useSplunkTheme_default = "default" in defaultImport42 ? defaultImport42.default : defaultImport42;
|
|
4220
4269
|
|
|
4221
4270
|
// src/common/hocs/withTrellis.tsx
|
|
4222
4271
|
var TrellisContainer = styled_components_default.div`
|
|
@@ -4280,7 +4329,11 @@ var withTrellis = (Viz) => {
|
|
|
4280
4329
|
trellisMinColumnWidth,
|
|
4281
4330
|
trellisRowHeight,
|
|
4282
4331
|
splitByLayout,
|
|
4283
|
-
trellisSplitBy
|
|
4332
|
+
trellisSplitBy,
|
|
4333
|
+
trellisSharedScale,
|
|
4334
|
+
stackMode,
|
|
4335
|
+
yAxisMin,
|
|
4336
|
+
yAxisMax
|
|
4284
4337
|
} = mergedOptions;
|
|
4285
4338
|
const colCount = trellisColumns > 0 ? trellisColumns : defaultOptions.trellisColumns;
|
|
4286
4339
|
const pageCount = +trellisPageCount > 0 ? +trellisPageCount : defaultOptions.trellisPageCount;
|
|
@@ -4351,10 +4404,10 @@ var withTrellis = (Viz) => {
|
|
|
4351
4404
|
[pageNum, pagedData]
|
|
4352
4405
|
);
|
|
4353
4406
|
const featureFlagContext = react_exports.useContext(FeatureFlagContext_default);
|
|
4354
|
-
const
|
|
4407
|
+
const isTrellisFeatureFlagOn2 = Boolean(
|
|
4355
4408
|
featureFlagContext && featureFlagContext.visualizations_enableTrellis
|
|
4356
4409
|
);
|
|
4357
|
-
if (!
|
|
4410
|
+
if (!isTrellisFeatureFlagOn2 || !splitByLayout || splitByLayout !== visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
4358
4411
|
return /* @__PURE__ */ react_exports.createElement(Viz, __spreadValues({}, opts));
|
|
4359
4412
|
}
|
|
4360
4413
|
if (splitByLayout === visualization_schemas_exports.LAYOUT_TYPE.Trellis) {
|
|
@@ -4383,6 +4436,13 @@ var withTrellis = (Viz) => {
|
|
|
4383
4436
|
splitByKeys = splitByKeysModified;
|
|
4384
4437
|
totalPages = splitByKeysModified ? Math.ceil(splitByKeysModified.length / pageCount) : 0;
|
|
4385
4438
|
}
|
|
4439
|
+
const [calculatedMin, calculatedMax] = determineMinMax(
|
|
4440
|
+
modifiedDataSourceBySplitBy,
|
|
4441
|
+
trellisSharedScale,
|
|
4442
|
+
yAxisMin,
|
|
4443
|
+
yAxisMax,
|
|
4444
|
+
stackMode
|
|
4445
|
+
);
|
|
4386
4446
|
return /* @__PURE__ */ react_exports.createElement(TrellisContainer, { height, width, backgroundColor: trellisBackgroundColor }, /* @__PURE__ */ react_exports.createElement(
|
|
4387
4447
|
TrellisContainerGrid,
|
|
4388
4448
|
{
|
|
@@ -4391,7 +4451,7 @@ var withTrellis = (Viz) => {
|
|
|
4391
4451
|
colMinWidth,
|
|
4392
4452
|
rowHeight
|
|
4393
4453
|
},
|
|
4394
|
-
pagedData
|
|
4454
|
+
pagedData == null ? void 0 : pagedData.map((splitByKey, idx) => /* @__PURE__ */ react_exports.createElement(
|
|
4395
4455
|
"div",
|
|
4396
4456
|
{
|
|
4397
4457
|
className: "child",
|
|
@@ -4412,7 +4472,10 @@ var withTrellis = (Viz) => {
|
|
|
4412
4472
|
trellisKey: splitByKey,
|
|
4413
4473
|
trellisSplitBy: currTrellisSplitBy,
|
|
4414
4474
|
dataSources: modifiedDataSourceBySplitBy[splitByKey],
|
|
4415
|
-
options,
|
|
4475
|
+
options: __spreadProps(__spreadValues({}, options), {
|
|
4476
|
+
yAxisMin: calculatedMin,
|
|
4477
|
+
yAxisMax: calculatedMax
|
|
4478
|
+
}),
|
|
4416
4479
|
key: `viz-${idx.toString()}`,
|
|
4417
4480
|
height: containerHeight,
|
|
4418
4481
|
width: containerWidth
|
|
@@ -4464,11 +4527,16 @@ var computeVizProps = (_a) => {
|
|
|
4464
4527
|
}
|
|
4465
4528
|
return __spreadValues({ defaultThemeColors }, props);
|
|
4466
4529
|
};
|
|
4530
|
+
var computeVizPropsBeforeEval = (options) => {
|
|
4531
|
+
const trendColor = getTrendColorWithPercent(options);
|
|
4532
|
+
return __spreadValues({}, trendColor);
|
|
4533
|
+
};
|
|
4467
4534
|
var viz = withTrellis_default(
|
|
4468
4535
|
withDashboardViz_default({
|
|
4469
4536
|
ReactViz: SingleValue_default,
|
|
4470
4537
|
vizConfig: config_default,
|
|
4471
4538
|
computeVizProps,
|
|
4539
|
+
computeVizPropsBeforeEval,
|
|
4472
4540
|
useIconPlaceholder: (dataSources, loading) => isLoadingOrNoColumns(dataSources, loading)
|
|
4473
4541
|
})
|
|
4474
4542
|
);
|