@grafana/scenes 4.11.1 → 4.11.2--canary.687.8737546972.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/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 +8 -1
- package/dist/index.js +150 -77
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2840,79 +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
|
-
onChange: (newValue) => {
|
|
2861
|
-
model.changeValueTo(newValue.value, newValue.label);
|
|
2862
|
-
}
|
|
2863
|
-
});
|
|
2864
|
-
}
|
|
2865
|
-
function VariableValueSelectMulti({ model }) {
|
|
2866
|
-
const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
|
|
2867
|
-
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
2868
|
-
const options = model.getOptionsForSelect();
|
|
2869
|
-
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
2870
|
-
React.useEffect(() => {
|
|
2871
|
-
setUncommittedValue(arrayValue);
|
|
2872
|
-
}, [arrayValue]);
|
|
2873
|
-
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
2874
|
-
if (meta.action === "input-change") {
|
|
2875
|
-
model.onSearchChange(value2);
|
|
2876
|
-
}
|
|
2877
|
-
} : void 0;
|
|
2878
|
-
const placeholder = options.length > 0 ? "Select value" : "";
|
|
2879
|
-
return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
|
|
2880
|
-
id: key,
|
|
2881
|
-
placeholder,
|
|
2882
|
-
width: "auto",
|
|
2883
|
-
value: uncommittedValue,
|
|
2884
|
-
noMultiValueWrap: true,
|
|
2885
|
-
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
|
2886
|
-
tabSelectsValue: false,
|
|
2887
|
-
virtualized: true,
|
|
2888
|
-
allowCustomValue: true,
|
|
2889
|
-
options: model.getOptionsForSelect(),
|
|
2890
|
-
closeMenuOnSelect: false,
|
|
2891
|
-
isClearable: true,
|
|
2892
|
-
onInputChange,
|
|
2893
|
-
onBlur: () => {
|
|
2894
|
-
model.changeValueTo(uncommittedValue);
|
|
2895
|
-
},
|
|
2896
|
-
onChange: (newValue, action) => {
|
|
2897
|
-
if (action.action === "clear" && noValueOnClear) {
|
|
2898
|
-
model.changeValueTo([]);
|
|
2899
|
-
}
|
|
2900
|
-
setUncommittedValue(newValue.map((x) => x.value));
|
|
2901
|
-
}
|
|
2902
|
-
});
|
|
2903
|
-
}
|
|
2904
|
-
function renderSelectForVariable(model) {
|
|
2905
|
-
if (model.state.isMulti) {
|
|
2906
|
-
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelectMulti, {
|
|
2907
|
-
model
|
|
2908
|
-
});
|
|
2909
|
-
} else {
|
|
2910
|
-
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelect, {
|
|
2911
|
-
model
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
|
-
}
|
|
2915
|
-
|
|
2916
2843
|
var __defProp$z = Object.defineProperty;
|
|
2917
2844
|
var __defProps$n = Object.defineProperties;
|
|
2918
2845
|
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
|
@@ -2948,6 +2875,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
2948
2875
|
}, initialState), {
|
|
2949
2876
|
noValueOnClear: true
|
|
2950
2877
|
}));
|
|
2878
|
+
this.isLazy = true;
|
|
2951
2879
|
this._getKeys = async (ds) => {
|
|
2952
2880
|
var _a, _b, _c;
|
|
2953
2881
|
const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, null));
|
|
@@ -3033,7 +2961,56 @@ class GroupByVariable extends MultiValueVariable {
|
|
|
3033
2961
|
}
|
|
3034
2962
|
GroupByVariable.Component = GroupByVariableRenderer;
|
|
3035
2963
|
function GroupByVariableRenderer({ model }) {
|
|
3036
|
-
|
|
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
|
+
});
|
|
3037
3014
|
}
|
|
3038
3015
|
|
|
3039
3016
|
function LoadingIndicator(props) {
|
|
@@ -4049,9 +4026,9 @@ function escapeLokiRegexp(value) {
|
|
|
4049
4026
|
function getQueriesForVariables(sourceObject) {
|
|
4050
4027
|
const runners = sceneGraph.findAllObjects(
|
|
4051
4028
|
sourceObject.getRoot(),
|
|
4052
|
-
(o) => o instanceof SceneQueryRunner
|
|
4029
|
+
(o) => o instanceof SceneQueryRunner
|
|
4053
4030
|
);
|
|
4054
|
-
const applicableRunners = runners.filter((r) => {
|
|
4031
|
+
const applicableRunners = filterOutInactiveRunnerDuplicates(runners).filter((r) => {
|
|
4055
4032
|
var _a, _b;
|
|
4056
4033
|
return ((_a = r.state.datasource) == null ? void 0 : _a.uid) === ((_b = sourceObject.state.datasource) == null ? void 0 : _b.uid);
|
|
4057
4034
|
});
|
|
@@ -4064,6 +4041,24 @@ function getQueriesForVariables(sourceObject) {
|
|
|
4064
4041
|
});
|
|
4065
4042
|
return result;
|
|
4066
4043
|
}
|
|
4044
|
+
function filterOutInactiveRunnerDuplicates(runners) {
|
|
4045
|
+
const groupedItems = {};
|
|
4046
|
+
for (const item of runners) {
|
|
4047
|
+
if (item.state.key) {
|
|
4048
|
+
if (!(item.state.key in groupedItems)) {
|
|
4049
|
+
groupedItems[item.state.key] = [];
|
|
4050
|
+
}
|
|
4051
|
+
groupedItems[item.state.key].push(item);
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
return Object.values(groupedItems).flatMap((group) => {
|
|
4055
|
+
const activeItems = group.filter((item) => item.isActive);
|
|
4056
|
+
if (activeItems.length === 0 && group.length === 1) {
|
|
4057
|
+
return group;
|
|
4058
|
+
}
|
|
4059
|
+
return activeItems;
|
|
4060
|
+
});
|
|
4061
|
+
}
|
|
4067
4062
|
|
|
4068
4063
|
function isAdHocVariable(variable) {
|
|
4069
4064
|
return variable.state.type === "adhoc";
|
|
@@ -6135,6 +6130,9 @@ class SceneVariableSet extends SceneObjectBase {
|
|
|
6135
6130
|
}
|
|
6136
6131
|
}
|
|
6137
6132
|
_variableNeedsUpdate(variable) {
|
|
6133
|
+
if (variable.isLazy) {
|
|
6134
|
+
return false;
|
|
6135
|
+
}
|
|
6138
6136
|
if (!variable.validateAndUpdate) {
|
|
6139
6137
|
return false;
|
|
6140
6138
|
}
|
|
@@ -6312,6 +6310,79 @@ class ConstantVariable extends SceneObjectBase {
|
|
|
6312
6310
|
}
|
|
6313
6311
|
}
|
|
6314
6312
|
|
|
6313
|
+
function VariableValueSelect({ model }) {
|
|
6314
|
+
const { value, key } = model.useState();
|
|
6315
|
+
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
6316
|
+
if (meta.action === "input-change") {
|
|
6317
|
+
model.onSearchChange(value2);
|
|
6318
|
+
}
|
|
6319
|
+
} : void 0;
|
|
6320
|
+
return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
|
|
6321
|
+
id: key,
|
|
6322
|
+
placeholder: "Select value",
|
|
6323
|
+
width: "auto",
|
|
6324
|
+
value,
|
|
6325
|
+
allowCustomValue: true,
|
|
6326
|
+
virtualized: true,
|
|
6327
|
+
tabSelectsValue: false,
|
|
6328
|
+
onInputChange,
|
|
6329
|
+
options: model.getOptionsForSelect(),
|
|
6330
|
+
onChange: (newValue) => {
|
|
6331
|
+
model.changeValueTo(newValue.value, newValue.label);
|
|
6332
|
+
}
|
|
6333
|
+
});
|
|
6334
|
+
}
|
|
6335
|
+
function VariableValueSelectMulti({ model }) {
|
|
6336
|
+
const { value, key, maxVisibleValues, noValueOnClear } = model.useState();
|
|
6337
|
+
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
6338
|
+
const options = model.getOptionsForSelect();
|
|
6339
|
+
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
6340
|
+
React.useEffect(() => {
|
|
6341
|
+
setUncommittedValue(arrayValue);
|
|
6342
|
+
}, [arrayValue]);
|
|
6343
|
+
const onInputChange = model.onSearchChange ? (value2, meta) => {
|
|
6344
|
+
if (meta.action === "input-change") {
|
|
6345
|
+
model.onSearchChange(value2);
|
|
6346
|
+
}
|
|
6347
|
+
} : void 0;
|
|
6348
|
+
const placeholder = options.length > 0 ? "Select value" : "";
|
|
6349
|
+
return /* @__PURE__ */ React__default["default"].createElement(ui.MultiSelect, {
|
|
6350
|
+
id: key,
|
|
6351
|
+
placeholder,
|
|
6352
|
+
width: "auto",
|
|
6353
|
+
value: uncommittedValue,
|
|
6354
|
+
noMultiValueWrap: true,
|
|
6355
|
+
maxVisibleValues: maxVisibleValues != null ? maxVisibleValues : 5,
|
|
6356
|
+
tabSelectsValue: false,
|
|
6357
|
+
virtualized: true,
|
|
6358
|
+
allowCustomValue: true,
|
|
6359
|
+
options: model.getOptionsForSelect(),
|
|
6360
|
+
closeMenuOnSelect: false,
|
|
6361
|
+
isClearable: true,
|
|
6362
|
+
onInputChange,
|
|
6363
|
+
onBlur: () => {
|
|
6364
|
+
model.changeValueTo(uncommittedValue);
|
|
6365
|
+
},
|
|
6366
|
+
onChange: (newValue, action) => {
|
|
6367
|
+
if (action.action === "clear" && noValueOnClear) {
|
|
6368
|
+
model.changeValueTo([]);
|
|
6369
|
+
}
|
|
6370
|
+
setUncommittedValue(newValue.map((x) => x.value));
|
|
6371
|
+
}
|
|
6372
|
+
});
|
|
6373
|
+
}
|
|
6374
|
+
function renderSelectForVariable(model) {
|
|
6375
|
+
if (model.state.isMulti) {
|
|
6376
|
+
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelectMulti, {
|
|
6377
|
+
model
|
|
6378
|
+
});
|
|
6379
|
+
} else {
|
|
6380
|
+
return /* @__PURE__ */ React__default["default"].createElement(VariableValueSelect, {
|
|
6381
|
+
model
|
|
6382
|
+
});
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6315
6386
|
var __defProp$i = Object.defineProperty;
|
|
6316
6387
|
var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
|
|
6317
6388
|
var __hasOwnProp$i = Object.prototype.hasOwnProperty;
|
|
@@ -6986,7 +7057,7 @@ var __spreadValues$e = (a, b) => {
|
|
|
6986
7057
|
return a;
|
|
6987
7058
|
};
|
|
6988
7059
|
class TestVariable extends MultiValueVariable {
|
|
6989
|
-
constructor(initialState) {
|
|
7060
|
+
constructor(initialState, isLazy = false) {
|
|
6990
7061
|
super(__spreadValues$e({
|
|
6991
7062
|
type: "custom",
|
|
6992
7063
|
name: "Test",
|
|
@@ -6999,9 +7070,11 @@ class TestVariable extends MultiValueVariable {
|
|
|
6999
7070
|
this.completeUpdate = new rxjs.Subject();
|
|
7000
7071
|
this.isGettingValues = true;
|
|
7001
7072
|
this.getValueOptionsCount = 0;
|
|
7073
|
+
this.isLazy = false;
|
|
7002
7074
|
this._variableDependency = new VariableDependencyConfig(this, {
|
|
7003
7075
|
statePaths: ["query"]
|
|
7004
7076
|
});
|
|
7077
|
+
this.isLazy = isLazy;
|
|
7005
7078
|
}
|
|
7006
7079
|
getValueOptions(args) {
|
|
7007
7080
|
const { delayMs } = this.state;
|