@grafana/scenes 4.11.2--canary.648.8738574184.0 → 4.11.3--canary.690.8783271240.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/CHANGELOG.md +13 -0
- package/dist/esm/components/VizPanel/VizPanelMenu.js +1 -3
- package/dist/esm/components/VizPanel/VizPanelMenu.js.map +1 -1
- package/dist/esm/components/layout/grid/SceneGridRow.js +1 -3
- package/dist/esm/components/layout/grid/SceneGridRow.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +12 -20
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +8 -5
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js +36 -12
- package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js.map +1 -1
- package/dist/esm/variables/components/VariableValueSelect.js +0 -3
- package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
- package/dist/esm/variables/components/VariableValueSelectors.js +2 -5
- package/dist/esm/variables/components/VariableValueSelectors.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js +55 -3
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/esm/variables/sets/SceneVariableSet.js +3 -0
- package/dist/esm/variables/sets/SceneVariableSet.js.map +1 -1
- package/dist/esm/variables/types.js.map +1 -1
- package/dist/esm/variables/utils.js +20 -2
- package/dist/esm/variables/utils.js.map +1 -1
- package/dist/esm/variables/variants/TestVariable.js +3 -1
- package/dist/esm/variables/variants/TestVariable.js.map +1 -1
- package/dist/index.d.ts +20 -9
- package/dist/index.js +209 -121
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2840,81 +2840,6 @@ class CustomAllValue {
|
|
|
2840
2840
|
}
|
|
2841
2841
|
}
|
|
2842
2842
|
|
|
2843
|
-
function VariableValueSelect({ model }) {
|
|
2844
|
-
const { value, key } = model.useState();
|
|
2845
|
-
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
2846
|
-
if (meta.action === "input-change") {
|
|
2847
|
-
model.onSearchChange(value2);
|
|
2848
|
-
}
|
|
2849
|
-
} : void 0;
|
|
2850
|
-
return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
|
|
2851
|
-
id: key,
|
|
2852
|
-
placeholder: "Select value",
|
|
2853
|
-
width: "auto",
|
|
2854
|
-
value,
|
|
2855
|
-
allowCustomValue: true,
|
|
2856
|
-
virtualized: true,
|
|
2857
|
-
tabSelectsValue: false,
|
|
2858
|
-
onInputChange,
|
|
2859
|
-
options: model.getOptionsForSelect(),
|
|
2860
|
-
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
|
|
2861
|
-
onChange: (newValue) => {
|
|
2862
|
-
model.changeValueTo(newValue.value, newValue.label);
|
|
2863
|
-
}
|
|
2864
|
-
});
|
|
2865
|
-
}
|
|
2866
|
-
function VariableValueSelectMulti({ model }) {
|
|
2867
|
-
const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
|
|
2868
|
-
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
2869
|
-
const options = model.getOptionsForSelect();
|
|
2870
|
-
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
2871
|
-
React.useEffect(() => {
|
|
2872
|
-
setUncommittedValue(arrayValue);
|
|
2873
|
-
}, [arrayValue]);
|
|
2874
|
-
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
2875
|
-
if (meta.action === "input-change") {
|
|
2876
|
-
model.onSearchChange(value2);
|
|
2877
|
-
}
|
|
2878
|
-
} : void 0;
|
|
2879
|
-
const placeholder = options.length > 0 ? "Select value" : "";
|
|
2880
|
-
return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
|
|
2881
|
-
id: key,
|
|
2882
|
-
placeholder,
|
|
2883
|
-
width: "auto",
|
|
2884
|
-
value: uncommittedValue,
|
|
2885
|
-
noMultiValueWrap: true,
|
|
2886
|
-
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
|
2887
|
-
tabSelectsValue: false,
|
|
2888
|
-
virtualized: true,
|
|
2889
|
-
allowCustomValue: true,
|
|
2890
|
-
options: model.getOptionsForSelect(),
|
|
2891
|
-
closeMenuOnSelect: false,
|
|
2892
|
-
isClearable: true,
|
|
2893
|
-
onInputChange,
|
|
2894
|
-
onBlur: () => {
|
|
2895
|
-
model.changeValueTo(uncommittedValue);
|
|
2896
|
-
},
|
|
2897
|
-
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
|
|
2898
|
-
onChange: (newValue, action) => {
|
|
2899
|
-
if (action.action === "clear" && noValueOnClear) {
|
|
2900
|
-
model.changeValueTo([]);
|
|
2901
|
-
}
|
|
2902
|
-
setUncommittedValue(newValue.map((x) => x.value));
|
|
2903
|
-
}
|
|
2904
|
-
});
|
|
2905
|
-
}
|
|
2906
|
-
function renderSelectForVariable(model) {
|
|
2907
|
-
if (model.state.isMulti) {
|
|
2908
|
-
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelectMulti, {
|
|
2909
|
-
model
|
|
2910
|
-
});
|
|
2911
|
-
} else {
|
|
2912
|
-
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelect, {
|
|
2913
|
-
model
|
|
2914
|
-
});
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
|
|
2918
2843
|
var __defProp$z = Object.defineProperty;
|
|
2919
2844
|
var __defProps$n = Object.defineProperties;
|
|
2920
2845
|
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
|
@@ -2950,6 +2875,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
2950
2875
|
}, initialState), {
|
|
2951
2876
|
noValueOnClear: true
|
|
2952
2877
|
}));
|
|
2878
|
+
this.isLazy = true;
|
|
2953
2879
|
this._getKeys = async (ds) => {
|
|
2954
2880
|
var _a, _b, _c;
|
|
2955
2881
|
const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, null));
|
|
@@ -3035,7 +2961,56 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
3035
2961
|
}
|
|
3036
2962
|
GroupByVariable.Component = GroupByVariableRenderer;
|
|
3037
2963
|
function GroupByVariableRenderer({ model }) {
|
|
3038
|
-
|
|
2964
|
+
const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
|
|
2965
|
+
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
2966
|
+
const [isFetchingOptions, setIsFetchingOptions] = React.useState(false);
|
|
2967
|
+
const [isOptionsOpen, setIsOptionsOpen] = React.useState(false);
|
|
2968
|
+
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
2969
|
+
React.useEffect(() => {
|
|
2970
|
+
setUncommittedValue(arrayValue);
|
|
2971
|
+
}, [arrayValue]);
|
|
2972
|
+
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
2973
|
+
if (meta.action === "input-change") {
|
|
2974
|
+
model.onSearchChange(value2);
|
|
2975
|
+
}
|
|
2976
|
+
} : void 0;
|
|
2977
|
+
const placeholder = "Select value";
|
|
2978
|
+
return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
|
|
2979
|
+
"data-testid": `GroupBySelect-${key}`,
|
|
2980
|
+
id: key,
|
|
2981
|
+
placeholder,
|
|
2982
|
+
width: "auto",
|
|
2983
|
+
value: uncommittedValue,
|
|
2984
|
+
noMultiValueWrap: true,
|
|
2985
|
+
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
|
2986
|
+
tabSelectsValue: false,
|
|
2987
|
+
virtualized: true,
|
|
2988
|
+
allowCustomValue: true,
|
|
2989
|
+
options: model.getOptionsForSelect(),
|
|
2990
|
+
closeMenuOnSelect: false,
|
|
2991
|
+
isOpen: isOptionsOpen,
|
|
2992
|
+
isClearable: true,
|
|
2993
|
+
isLoading: isFetchingOptions,
|
|
2994
|
+
onInputChange,
|
|
2995
|
+
onBlur: () => {
|
|
2996
|
+
model.changeValueTo(uncommittedValue);
|
|
2997
|
+
},
|
|
2998
|
+
onChange: (newValue, action) => {
|
|
2999
|
+
if (action.action === "clear" && noValueOnClear) {
|
|
3000
|
+
model.changeValueTo([]);
|
|
3001
|
+
}
|
|
3002
|
+
setUncommittedValue(newValue.map((x) => x.value));
|
|
3003
|
+
},
|
|
3004
|
+
onOpenMenu: async () => {
|
|
3005
|
+
setIsFetchingOptions(true);
|
|
3006
|
+
await rxjs.lastValueFrom(model.validateAndUpdate());
|
|
3007
|
+
setIsFetchingOptions(false);
|
|
3008
|
+
setIsOptionsOpen(true);
|
|
3009
|
+
},
|
|
3010
|
+
onCloseMenu: () => {
|
|
3011
|
+
setIsOptionsOpen(false);
|
|
3012
|
+
}
|
|
3013
|
+
});
|
|
3039
3014
|
}
|
|
3040
3015
|
|
|
3041
3016
|
function LoadingIndicator(props) {
|
|
@@ -3170,24 +3145,18 @@ var __spreadValues$y = (a, b) => {
|
|
|
3170
3145
|
return a;
|
|
3171
3146
|
};
|
|
3172
3147
|
var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
|
|
3148
|
+
function keyLabelToOption(key, label) {
|
|
3149
|
+
return key !== "" ? {
|
|
3150
|
+
value: key,
|
|
3151
|
+
label: label || key
|
|
3152
|
+
} : null;
|
|
3153
|
+
}
|
|
3173
3154
|
function AdHocFilterRenderer({ filter, model }) {
|
|
3174
3155
|
var _a, _b;
|
|
3175
3156
|
const styles = ui.useStyles2(getStyles$7);
|
|
3176
3157
|
const [state, setState] = React.useState({});
|
|
3177
|
-
const keyValue =
|
|
3178
|
-
|
|
3179
|
-
if (model.state.defaultKeys) {
|
|
3180
|
-
const matchingDefaultKey = model.state.defaultKeys.find((option) => option.value === filter.key);
|
|
3181
|
-
if (matchingDefaultKey) {
|
|
3182
|
-
return toSelectableValue(matchingDefaultKey);
|
|
3183
|
-
}
|
|
3184
|
-
} else {
|
|
3185
|
-
return data.toOption(filter.key);
|
|
3186
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
return null;
|
|
3189
|
-
}, [filter.key, model.state.defaultKeys]);
|
|
3190
|
-
const valueValue = filter.value !== "" ? data.toOption(filter.value) : null;
|
|
3158
|
+
const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
|
|
3159
|
+
const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
|
|
3191
3160
|
const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
|
|
3192
3161
|
allowCustomValue: true,
|
|
3193
3162
|
formatCreateLabel: (inputValue) => `Use custom value: ${inputValue}`,
|
|
@@ -3197,7 +3166,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
|
3197
3166
|
value: valueValue,
|
|
3198
3167
|
placeholder: "Select value",
|
|
3199
3168
|
options: state.values,
|
|
3200
|
-
onChange: (v) => model._updateFilter(filter, "value", v
|
|
3169
|
+
onChange: (v) => model._updateFilter(filter, "value", v),
|
|
3201
3170
|
isOpen: state.isValuesOpen,
|
|
3202
3171
|
isLoading: state.isValuesLoading,
|
|
3203
3172
|
autoFocus: filter.key !== "" && filter.value === "",
|
|
@@ -3219,7 +3188,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
|
3219
3188
|
value: keyValue,
|
|
3220
3189
|
placeholder: "Select label",
|
|
3221
3190
|
options: state.keys,
|
|
3222
|
-
onChange: (v) => model._updateFilter(filter, "key", v
|
|
3191
|
+
onChange: (v) => model._updateFilter(filter, "key", v),
|
|
3223
3192
|
autoFocus: filter.key === "",
|
|
3224
3193
|
isOpen: state.isKeysOpen,
|
|
3225
3194
|
isLoading: state.isKeysLoading,
|
|
@@ -3266,7 +3235,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
|
3266
3235
|
disabled: model.state.readOnly,
|
|
3267
3236
|
options: model._getOperators(),
|
|
3268
3237
|
width: "auto",
|
|
3269
|
-
onChange: (v) => model._updateFilter(filter, "operator", v
|
|
3238
|
+
onChange: (v) => model._updateFilter(filter, "operator", v)
|
|
3270
3239
|
}), valueSelect, /* @__PURE__ */ React__default["default"].createElement(ui.Button, {
|
|
3271
3240
|
variant: "secondary",
|
|
3272
3241
|
"aria-label": "Remove filter",
|
|
@@ -3353,7 +3322,7 @@ class AdHocFiltersVariableUrlSyncHandler {
|
|
|
3353
3322
|
if (filters.length === 0) {
|
|
3354
3323
|
return { [this.getKey()]: [""] };
|
|
3355
3324
|
}
|
|
3356
|
-
const value = filters.map((filter) => toArray(filter).map(
|
|
3325
|
+
const value = filters.map((filter) => toArray(filter).map(escapePipeDelimiters).join("|"));
|
|
3357
3326
|
return { [this.getKey()]: value };
|
|
3358
3327
|
}
|
|
3359
3328
|
updateFromUrl(values) {
|
|
@@ -3373,30 +3342,54 @@ function deserializeUrlToFilters(value) {
|
|
|
3373
3342
|
const filter = toFilter(value);
|
|
3374
3343
|
return filter === null ? [] : [filter];
|
|
3375
3344
|
}
|
|
3376
|
-
function
|
|
3345
|
+
function escapePipeDelimiters(value) {
|
|
3377
3346
|
if (value === null || value === void 0) {
|
|
3378
3347
|
return "";
|
|
3379
3348
|
}
|
|
3380
|
-
return /\|/g[Symbol.replace](value, "__gfp__");
|
|
3349
|
+
return value = /\|/g[Symbol.replace](value, "__gfp__");
|
|
3381
3350
|
}
|
|
3382
|
-
function
|
|
3351
|
+
function escapeCommaDelimiters(value) {
|
|
3383
3352
|
if (value === null || value === void 0) {
|
|
3384
3353
|
return "";
|
|
3385
3354
|
}
|
|
3386
|
-
return
|
|
3355
|
+
return /,/g[Symbol.replace](value, "__gfc__");
|
|
3356
|
+
}
|
|
3357
|
+
function unescapeDelimiters(value) {
|
|
3358
|
+
if (value === null || value === void 0) {
|
|
3359
|
+
return "";
|
|
3360
|
+
}
|
|
3361
|
+
value = /__gfp__/g[Symbol.replace](value, "|");
|
|
3362
|
+
value = /__gfc__/g[Symbol.replace](value, ",");
|
|
3363
|
+
return value;
|
|
3387
3364
|
}
|
|
3388
3365
|
function toArray(filter) {
|
|
3389
|
-
return [
|
|
3366
|
+
return [
|
|
3367
|
+
toCommaDelimitedString(filter.key, filter.keyLabel),
|
|
3368
|
+
filter.operator,
|
|
3369
|
+
toCommaDelimitedString(filter.value, filter.valueLabel)
|
|
3370
|
+
];
|
|
3371
|
+
}
|
|
3372
|
+
function toCommaDelimitedString(key, label) {
|
|
3373
|
+
if (!label || key === label) {
|
|
3374
|
+
return escapeCommaDelimiters(key);
|
|
3375
|
+
}
|
|
3376
|
+
return [key, label].map(escapeCommaDelimiters).join(",");
|
|
3390
3377
|
}
|
|
3391
|
-
function toFilter(
|
|
3392
|
-
if (typeof
|
|
3378
|
+
function toFilter(urlValue) {
|
|
3379
|
+
if (typeof urlValue !== "string" || urlValue.length === 0) {
|
|
3393
3380
|
return null;
|
|
3394
3381
|
}
|
|
3395
|
-
const
|
|
3382
|
+
const [key, keyLabel, operator, _operatorLabel, value, valueLabel] = urlValue.split("|").reduce((acc, v) => {
|
|
3383
|
+
const [key2, label] = v.split(",");
|
|
3384
|
+
acc.push(key2, label != null ? label : key2);
|
|
3385
|
+
return acc;
|
|
3386
|
+
}, []).map(unescapeDelimiters);
|
|
3396
3387
|
return {
|
|
3397
|
-
key
|
|
3398
|
-
|
|
3399
|
-
|
|
3388
|
+
key,
|
|
3389
|
+
keyLabel,
|
|
3390
|
+
operator,
|
|
3391
|
+
value,
|
|
3392
|
+
valueLabel,
|
|
3400
3393
|
condition: ""
|
|
3401
3394
|
};
|
|
3402
3395
|
}
|
|
@@ -3455,22 +3448,23 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
3455
3448
|
getValue() {
|
|
3456
3449
|
return this.state.filterExpression;
|
|
3457
3450
|
}
|
|
3458
|
-
_updateFilter(filter, prop, value) {
|
|
3451
|
+
_updateFilter(filter, prop, { value, label }) {
|
|
3459
3452
|
if (value == null) {
|
|
3460
3453
|
return;
|
|
3461
3454
|
}
|
|
3462
3455
|
const { filters, _wip } = this.state;
|
|
3456
|
+
const propLabelKey = `${prop}Label`;
|
|
3463
3457
|
if (filter === _wip) {
|
|
3464
3458
|
if (prop === "value") {
|
|
3465
|
-
this.setState({ filters: [...filters, __spreadProps$l(__spreadValues$x({}, _wip), { [prop]: value })], _wip: void 0 });
|
|
3459
|
+
this.setState({ filters: [...filters, __spreadProps$l(__spreadValues$x({}, _wip), { [prop]: value, [propLabelKey]: label })], _wip: void 0 });
|
|
3466
3460
|
} else {
|
|
3467
|
-
this.setState({ _wip: __spreadProps$l(__spreadValues$x({}, filter), { [prop]: value }) });
|
|
3461
|
+
this.setState({ _wip: __spreadProps$l(__spreadValues$x({}, filter), { [prop]: value, [propLabelKey]: label }) });
|
|
3468
3462
|
}
|
|
3469
3463
|
return;
|
|
3470
3464
|
}
|
|
3471
3465
|
const updatedFilters = this.state.filters.map((f) => {
|
|
3472
3466
|
if (f === filter) {
|
|
3473
|
-
return __spreadProps$l(__spreadValues$x({}, f), { [prop]: value });
|
|
3467
|
+
return __spreadProps$l(__spreadValues$x({}, f), { [prop]: value, [propLabelKey]: label });
|
|
3474
3468
|
}
|
|
3475
3469
|
return f;
|
|
3476
3470
|
});
|
|
@@ -3529,7 +3523,9 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
3529
3523
|
return values.map(toSelectableValue);
|
|
3530
3524
|
}
|
|
3531
3525
|
_addWip() {
|
|
3532
|
-
this.setState({
|
|
3526
|
+
this.setState({
|
|
3527
|
+
_wip: { key: "", keyLabel: "", value: "", valueLabel: "", operator: "=", condition: "" }
|
|
3528
|
+
});
|
|
3533
3529
|
}
|
|
3534
3530
|
_getOperators() {
|
|
3535
3531
|
return ["=", "!=", "<", ">", "=~", "!~"].map((value) => ({
|
|
@@ -4051,9 +4047,9 @@ function escapeLokiRegexp(value) {
|
|
|
4051
4047
|
function getQueriesForVariables(sourceObject) {
|
|
4052
4048
|
const runners = sceneGraph.findAllObjects(
|
|
4053
4049
|
sourceObject.getRoot(),
|
|
4054
|
-
(o) => o instanceof SceneQueryRunner
|
|
4050
|
+
(o) => o instanceof SceneQueryRunner
|
|
4055
4051
|
);
|
|
4056
|
-
const applicableRunners = runners.filter((r) => {
|
|
4052
|
+
const applicableRunners = filterOutInactiveRunnerDuplicates(runners).filter((r) => {
|
|
4057
4053
|
var _a, _b;
|
|
4058
4054
|
return ((_a = r.state.datasource) == null ? void 0 : _a.uid) === ((_b = sourceObject.state.datasource) == null ? void 0 : _b.uid);
|
|
4059
4055
|
});
|
|
@@ -4066,6 +4062,24 @@ function getQueriesForVariables(sourceObject) {
|
|
|
4066
4062
|
});
|
|
4067
4063
|
return result;
|
|
4068
4064
|
}
|
|
4065
|
+
function filterOutInactiveRunnerDuplicates(runners) {
|
|
4066
|
+
const groupedItems = {};
|
|
4067
|
+
for (const item of runners) {
|
|
4068
|
+
if (item.state.key) {
|
|
4069
|
+
if (!(item.state.key in groupedItems)) {
|
|
4070
|
+
groupedItems[item.state.key] = [];
|
|
4071
|
+
}
|
|
4072
|
+
groupedItems[item.state.key].push(item);
|
|
4073
|
+
}
|
|
4074
|
+
}
|
|
4075
|
+
return Object.values(groupedItems).flatMap((group) => {
|
|
4076
|
+
const activeItems = group.filter((item) => item.isActive);
|
|
4077
|
+
if (activeItems.length === 0 && group.length === 1) {
|
|
4078
|
+
return group;
|
|
4079
|
+
}
|
|
4080
|
+
return activeItems;
|
|
4081
|
+
});
|
|
4082
|
+
}
|
|
4069
4083
|
|
|
4070
4084
|
function isAdHocVariable(variable) {
|
|
4071
4085
|
return variable.state.type === "adhoc";
|
|
@@ -5990,8 +6004,7 @@ function VariableValueSelectWrapper({ variable, layout, showAlways }) {
|
|
|
5990
6004
|
}
|
|
5991
6005
|
if (layout === "vertical") {
|
|
5992
6006
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5993
|
-
className: verticalContainer
|
|
5994
|
-
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItem
|
|
6007
|
+
className: verticalContainer
|
|
5995
6008
|
}, /* @__PURE__ */ React__default["default"].createElement(VariableLabel, {
|
|
5996
6009
|
variable,
|
|
5997
6010
|
layout
|
|
@@ -6000,8 +6013,7 @@ function VariableValueSelectWrapper({ variable, layout, showAlways }) {
|
|
|
6000
6013
|
}));
|
|
6001
6014
|
}
|
|
6002
6015
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
6003
|
-
className: containerStyle
|
|
6004
|
-
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItem
|
|
6016
|
+
className: containerStyle
|
|
6005
6017
|
}, /* @__PURE__ */ React__default["default"].createElement(VariableLabel, {
|
|
6006
6018
|
variable
|
|
6007
6019
|
}), /* @__PURE__ */ React__default["default"].createElement(variable.Component, {
|
|
@@ -6139,6 +6151,9 @@ class SceneVariableSet extends SceneObjectBase {
|
|
|
6139
6151
|
}
|
|
6140
6152
|
}
|
|
6141
6153
|
_variableNeedsUpdate(variable) {
|
|
6154
|
+
if (variable.isLazy) {
|
|
6155
|
+
return false;
|
|
6156
|
+
}
|
|
6142
6157
|
if (!variable.validateAndUpdate) {
|
|
6143
6158
|
return false;
|
|
6144
6159
|
}
|
|
@@ -6316,6 +6331,79 @@ class ConstantVariable extends SceneObjectBase {
|
|
|
6316
6331
|
}
|
|
6317
6332
|
}
|
|
6318
6333
|
|
|
6334
|
+
function VariableValueSelect({ model }) {
|
|
6335
|
+
const { value, key } = model.useState();
|
|
6336
|
+
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
6337
|
+
if (meta.action === "input-change") {
|
|
6338
|
+
model.onSearchChange(value2);
|
|
6339
|
+
}
|
|
6340
|
+
} : void 0;
|
|
6341
|
+
return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
|
|
6342
|
+
id: key,
|
|
6343
|
+
placeholder: "Select value",
|
|
6344
|
+
width: "auto",
|
|
6345
|
+
value,
|
|
6346
|
+
allowCustomValue: true,
|
|
6347
|
+
virtualized: true,
|
|
6348
|
+
tabSelectsValue: false,
|
|
6349
|
+
onInputChange,
|
|
6350
|
+
options: model.getOptionsForSelect(),
|
|
6351
|
+
onChange: (newValue) => {
|
|
6352
|
+
model.changeValueTo(newValue.value, newValue.label);
|
|
6353
|
+
}
|
|
6354
|
+
});
|
|
6355
|
+
}
|
|
6356
|
+
function VariableValueSelectMulti({ model }) {
|
|
6357
|
+
const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
|
|
6358
|
+
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
6359
|
+
const options = model.getOptionsForSelect();
|
|
6360
|
+
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
6361
|
+
React.useEffect(() => {
|
|
6362
|
+
setUncommittedValue(arrayValue);
|
|
6363
|
+
}, [arrayValue]);
|
|
6364
|
+
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
6365
|
+
if (meta.action === "input-change") {
|
|
6366
|
+
model.onSearchChange(value2);
|
|
6367
|
+
}
|
|
6368
|
+
} : void 0;
|
|
6369
|
+
const placeholder = options.length > 0 ? "Select value" : "";
|
|
6370
|
+
return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
|
|
6371
|
+
id: key,
|
|
6372
|
+
placeholder,
|
|
6373
|
+
width: "auto",
|
|
6374
|
+
value: uncommittedValue,
|
|
6375
|
+
noMultiValueWrap: true,
|
|
6376
|
+
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
|
6377
|
+
tabSelectsValue: false,
|
|
6378
|
+
virtualized: true,
|
|
6379
|
+
allowCustomValue: true,
|
|
6380
|
+
options: model.getOptionsForSelect(),
|
|
6381
|
+
closeMenuOnSelect: false,
|
|
6382
|
+
isClearable: true,
|
|
6383
|
+
onInputChange,
|
|
6384
|
+
onBlur: () => {
|
|
6385
|
+
model.changeValueTo(uncommittedValue);
|
|
6386
|
+
},
|
|
6387
|
+
onChange: (newValue, action) => {
|
|
6388
|
+
if (action.action === "clear" && noValueOnClear) {
|
|
6389
|
+
model.changeValueTo([]);
|
|
6390
|
+
}
|
|
6391
|
+
setUncommittedValue(newValue.map((x) => x.value));
|
|
6392
|
+
}
|
|
6393
|
+
});
|
|
6394
|
+
}
|
|
6395
|
+
function renderSelectForVariable(model) {
|
|
6396
|
+
if (model.state.isMulti) {
|
|
6397
|
+
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelectMulti, {
|
|
6398
|
+
model
|
|
6399
|
+
});
|
|
6400
|
+
} else {
|
|
6401
|
+
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelect, {
|
|
6402
|
+
model
|
|
6403
|
+
});
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
|
|
6319
6407
|
var __defProp$i = Object.defineProperty;
|
|
6320
6408
|
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
6321
6409
|
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
@@ -6990,7 +7078,7 @@ var __spreadValues$e = (a, b) => {
|
|
|
6990
7078
|
return a;
|
|
6991
7079
|
};
|
|
6992
7080
|
class TestVariable extends MultiValueVariable {
|
|
6993
|
-
constructor(initialState) {
|
|
7081
|
+
constructor(initialState, isLazy = false) {
|
|
6994
7082
|
super(__spreadValues$e({
|
|
6995
7083
|
type: "custom",
|
|
6996
7084
|
name: "Test",
|
|
@@ -7003,9 +7091,11 @@ class TestVariable extends MultiValueVariable {
|
|
|
7003
7091
|
this.completeUpdate = new rxjs.Subject();
|
|
7004
7092
|
this.isGettingValues = true;
|
|
7005
7093
|
this.getValueOptionsCount = 0;
|
|
7094
|
+
this.isLazy = false;
|
|
7006
7095
|
this._variableDependency = new VariableDependencyConfig(this, {
|
|
7007
7096
|
statePaths: ["query"]
|
|
7008
7097
|
});
|
|
7098
|
+
this.isLazy = isLazy;
|
|
7009
7099
|
}
|
|
7010
7100
|
getValueOptions(args) {
|
|
7011
7101
|
const { delayMs } = this.state;
|
|
@@ -7501,8 +7591,7 @@ function VizPanelMenuRenderer({ model }) {
|
|
|
7501
7591
|
childItems: item.subMenu ? renderItems(item.subMenu) : void 0,
|
|
7502
7592
|
url: item.href,
|
|
7503
7593
|
onClick: item.onClick,
|
|
7504
|
-
shortcut: item.shortcut
|
|
7505
|
-
testId: e2eSelectors.selectors.components.Panels.Panel.menuItems(item.text)
|
|
7594
|
+
shortcut: item.shortcut
|
|
7506
7595
|
})
|
|
7507
7596
|
);
|
|
7508
7597
|
};
|
|
@@ -8128,8 +8217,7 @@ function SceneGridRowRenderer({ model }) {
|
|
|
8128
8217
|
}, /* @__PURE__ */ React__default["default"].createElement("button", {
|
|
8129
8218
|
onClick: model.onCollapseToggle,
|
|
8130
8219
|
className: styles.rowTitleButton,
|
|
8131
|
-
"aria-label": isCollapsed ? "Expand row" : "Collapse row"
|
|
8132
|
-
"data-testid": e2eSelectors.selectors.components.DashboardRow.title(sceneGraph.interpolate(model, title, void 0, "text"))
|
|
8220
|
+
"aria-label": isCollapsed ? "Expand row" : "Collapse row"
|
|
8133
8221
|
}, isCollapsible && /* @__PURE__ */ React__default["default"].createElement(ui.Icon, {
|
|
8134
8222
|
name: isCollapsed ? "angle-right" : "angle-down"
|
|
8135
8223
|
}), /* @__PURE__ */ React__default["default"].createElement("span", {
|