@grafana/scenes 5.4.1 → 5.4.2--canary.830.9989651797.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/variables/adhoc/AdHocCombobox.js +471 -0
- package/dist/esm/variables/adhoc/AdHocCombobox.js.map +1 -0
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +1 -4
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +59 -4
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +713 -197
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
@@ -14,6 +14,8 @@ var ui = require('@grafana/ui');
|
|
14
14
|
var e2eSelectors = require('@grafana/e2e-selectors');
|
15
15
|
var css = require('@emotion/css');
|
16
16
|
var uFuzzy = require('@leeoniya/ufuzzy');
|
17
|
+
var react = require('@floating-ui/react');
|
18
|
+
var reactDom = require('react-dom');
|
17
19
|
var reactUse = require('react-use');
|
18
20
|
var operators = require('rxjs/operators');
|
19
21
|
var ReactGridLayout = require('react-grid-layout');
|
@@ -41,19 +43,19 @@ var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
|
|
41
43
|
var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
|
42
44
|
var AutoSizer__default = /*#__PURE__*/_interopDefaultLegacy(AutoSizer);
|
43
45
|
|
44
|
-
var __defProp$
|
45
|
-
var __getOwnPropSymbols$
|
46
|
-
var __hasOwnProp$
|
47
|
-
var __propIsEnum$
|
48
|
-
var __defNormalProp$
|
49
|
-
var __spreadValues$
|
46
|
+
var __defProp$L = Object.defineProperty;
|
47
|
+
var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
|
48
|
+
var __hasOwnProp$L = Object.prototype.hasOwnProperty;
|
49
|
+
var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
|
50
|
+
var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
51
|
+
var __spreadValues$L = (a, b) => {
|
50
52
|
for (var prop in b || (b = {}))
|
51
|
-
if (__hasOwnProp$
|
52
|
-
__defNormalProp$
|
53
|
-
if (__getOwnPropSymbols$
|
54
|
-
for (var prop of __getOwnPropSymbols$
|
55
|
-
if (__propIsEnum$
|
56
|
-
__defNormalProp$
|
53
|
+
if (__hasOwnProp$L.call(b, prop))
|
54
|
+
__defNormalProp$L(a, prop, b[prop]);
|
55
|
+
if (__getOwnPropSymbols$L)
|
56
|
+
for (var prop of __getOwnPropSymbols$L(b)) {
|
57
|
+
if (__propIsEnum$L.call(b, prop))
|
58
|
+
__defNormalProp$L(a, prop, b[prop]);
|
57
59
|
}
|
58
60
|
return a;
|
59
61
|
};
|
@@ -62,7 +64,7 @@ function useAppQueryParams() {
|
|
62
64
|
return runtime.locationSearchToObject(location.search || "");
|
63
65
|
}
|
64
66
|
function getUrlWithAppState(path, preserveParams) {
|
65
|
-
const paramsCopy = __spreadValues$
|
67
|
+
const paramsCopy = __spreadValues$L({}, runtime.locationService.getSearchObject());
|
66
68
|
if (preserveParams) {
|
67
69
|
for (const key of Object.keys(paramsCopy)) {
|
68
70
|
if (!preserveParams.includes(key)) {
|
@@ -76,31 +78,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
|
|
76
78
|
return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
|
77
79
|
}
|
78
80
|
|
79
|
-
var __defProp$
|
80
|
-
var __defProps$
|
81
|
-
var __getOwnPropDescs$
|
82
|
-
var __getOwnPropSymbols$
|
83
|
-
var __hasOwnProp$
|
84
|
-
var __propIsEnum$
|
85
|
-
var __defNormalProp$
|
86
|
-
var __spreadValues$
|
81
|
+
var __defProp$K = Object.defineProperty;
|
82
|
+
var __defProps$u = Object.defineProperties;
|
83
|
+
var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
|
84
|
+
var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
|
85
|
+
var __hasOwnProp$K = Object.prototype.hasOwnProperty;
|
86
|
+
var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
|
87
|
+
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
88
|
+
var __spreadValues$K = (a, b) => {
|
87
89
|
for (var prop in b || (b = {}))
|
88
|
-
if (__hasOwnProp$
|
89
|
-
__defNormalProp$
|
90
|
-
if (__getOwnPropSymbols$
|
91
|
-
for (var prop of __getOwnPropSymbols$
|
92
|
-
if (__propIsEnum$
|
93
|
-
__defNormalProp$
|
90
|
+
if (__hasOwnProp$K.call(b, prop))
|
91
|
+
__defNormalProp$K(a, prop, b[prop]);
|
92
|
+
if (__getOwnPropSymbols$K)
|
93
|
+
for (var prop of __getOwnPropSymbols$K(b)) {
|
94
|
+
if (__propIsEnum$K.call(b, prop))
|
95
|
+
__defNormalProp$K(a, prop, b[prop]);
|
94
96
|
}
|
95
97
|
return a;
|
96
98
|
};
|
97
|
-
var __spreadProps$
|
99
|
+
var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(b));
|
98
100
|
const runtimePanelPlugins = /* @__PURE__ */ new Map();
|
99
101
|
function registerRuntimePanelPlugin({ pluginId, plugin }) {
|
100
102
|
if (runtimePanelPlugins.has(pluginId)) {
|
101
103
|
throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
|
102
104
|
}
|
103
|
-
plugin.meta = __spreadProps$
|
105
|
+
plugin.meta = __spreadProps$u(__spreadValues$K({}, plugin.meta), {
|
104
106
|
id: pluginId,
|
105
107
|
name: pluginId,
|
106
108
|
module: "runtime plugin",
|
@@ -128,39 +130,39 @@ function loadPanelPluginSync(pluginId) {
|
|
128
130
|
return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
|
129
131
|
}
|
130
132
|
|
131
|
-
var __defProp$
|
132
|
-
var __defProps$
|
133
|
-
var __getOwnPropDescs$
|
134
|
-
var __getOwnPropSymbols$
|
135
|
-
var __hasOwnProp$
|
136
|
-
var __propIsEnum$
|
137
|
-
var __defNormalProp$
|
138
|
-
var __spreadValues$
|
133
|
+
var __defProp$J = Object.defineProperty;
|
134
|
+
var __defProps$t = Object.defineProperties;
|
135
|
+
var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
|
136
|
+
var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
|
137
|
+
var __hasOwnProp$J = Object.prototype.hasOwnProperty;
|
138
|
+
var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
|
139
|
+
var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
140
|
+
var __spreadValues$J = (a, b) => {
|
139
141
|
for (var prop in b || (b = {}))
|
140
|
-
if (__hasOwnProp$
|
141
|
-
__defNormalProp$
|
142
|
-
if (__getOwnPropSymbols$
|
143
|
-
for (var prop of __getOwnPropSymbols$
|
144
|
-
if (__propIsEnum$
|
145
|
-
__defNormalProp$
|
142
|
+
if (__hasOwnProp$J.call(b, prop))
|
143
|
+
__defNormalProp$J(a, prop, b[prop]);
|
144
|
+
if (__getOwnPropSymbols$J)
|
145
|
+
for (var prop of __getOwnPropSymbols$J(b)) {
|
146
|
+
if (__propIsEnum$J.call(b, prop))
|
147
|
+
__defNormalProp$J(a, prop, b[prop]);
|
146
148
|
}
|
147
149
|
return a;
|
148
150
|
};
|
149
|
-
var __spreadProps$
|
150
|
-
var __objRest$
|
151
|
+
var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
|
152
|
+
var __objRest$5 = (source, exclude) => {
|
151
153
|
var target = {};
|
152
154
|
for (var prop in source)
|
153
|
-
if (__hasOwnProp$
|
155
|
+
if (__hasOwnProp$J.call(source, prop) && exclude.indexOf(prop) < 0)
|
154
156
|
target[prop] = source[prop];
|
155
|
-
if (source != null && __getOwnPropSymbols$
|
156
|
-
for (var prop of __getOwnPropSymbols$
|
157
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
157
|
+
if (source != null && __getOwnPropSymbols$J)
|
158
|
+
for (var prop of __getOwnPropSymbols$J(source)) {
|
159
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$J.call(source, prop))
|
158
160
|
target[prop] = source[prop];
|
159
161
|
}
|
160
162
|
return target;
|
161
163
|
};
|
162
164
|
function SceneComponentWrapperWithoutMemo(_a) {
|
163
|
-
var _b = _a, { model } = _b, otherProps = __objRest$
|
165
|
+
var _b = _a, { model } = _b, otherProps = __objRest$5(_b, ["model"]);
|
164
166
|
var _a2;
|
165
167
|
const Component = (_a2 = model.constructor["Component"]) != null ? _a2 : EmptyRenderer;
|
166
168
|
const [_, setValue] = React.useState(0);
|
@@ -172,7 +174,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
|
|
172
174
|
if (!model.isActive) {
|
173
175
|
return null;
|
174
176
|
}
|
175
|
-
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$
|
177
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$t(__spreadValues$J({}, otherProps), {
|
176
178
|
model
|
177
179
|
}));
|
178
180
|
}
|
@@ -218,19 +220,19 @@ class SceneObjectRef {
|
|
218
220
|
}
|
219
221
|
_ref = new WeakMap();
|
220
222
|
|
221
|
-
var __defProp$
|
222
|
-
var __getOwnPropSymbols$
|
223
|
-
var __hasOwnProp$
|
224
|
-
var __propIsEnum$
|
225
|
-
var __defNormalProp$
|
226
|
-
var __spreadValues$
|
223
|
+
var __defProp$I = Object.defineProperty;
|
224
|
+
var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
|
225
|
+
var __hasOwnProp$I = Object.prototype.hasOwnProperty;
|
226
|
+
var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
|
227
|
+
var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
228
|
+
var __spreadValues$I = (a, b) => {
|
227
229
|
for (var prop in b || (b = {}))
|
228
|
-
if (__hasOwnProp$
|
229
|
-
__defNormalProp$
|
230
|
-
if (__getOwnPropSymbols$
|
231
|
-
for (var prop of __getOwnPropSymbols$
|
232
|
-
if (__propIsEnum$
|
233
|
-
__defNormalProp$
|
230
|
+
if (__hasOwnProp$I.call(b, prop))
|
231
|
+
__defNormalProp$I(a, prop, b[prop]);
|
232
|
+
if (__getOwnPropSymbols$I)
|
233
|
+
for (var prop of __getOwnPropSymbols$I(b)) {
|
234
|
+
if (__propIsEnum$I.call(b, prop))
|
235
|
+
__defNormalProp$I(a, prop, b[prop]);
|
234
236
|
}
|
235
237
|
return a;
|
236
238
|
};
|
@@ -290,7 +292,7 @@ class SceneObjectBase {
|
|
290
292
|
}
|
291
293
|
setState(update) {
|
292
294
|
const prevState = this._state;
|
293
|
-
const newState = __spreadValues$
|
295
|
+
const newState = __spreadValues$I(__spreadValues$I({}, this._state), update);
|
294
296
|
this._state = Object.freeze(newState);
|
295
297
|
this._setParent(update);
|
296
298
|
this._handleActivationOfChangedStateProps(prevState, newState);
|
@@ -486,19 +488,19 @@ function forEachChild(state, callback) {
|
|
486
488
|
}
|
487
489
|
}
|
488
490
|
|
489
|
-
var __defProp$
|
490
|
-
var __getOwnPropSymbols$
|
491
|
-
var __hasOwnProp$
|
492
|
-
var __propIsEnum$
|
493
|
-
var __defNormalProp$
|
494
|
-
var __spreadValues$
|
491
|
+
var __defProp$H = Object.defineProperty;
|
492
|
+
var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
|
493
|
+
var __hasOwnProp$H = Object.prototype.hasOwnProperty;
|
494
|
+
var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
|
495
|
+
var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
496
|
+
var __spreadValues$H = (a, b) => {
|
495
497
|
for (var prop in b || (b = {}))
|
496
|
-
if (__hasOwnProp$
|
497
|
-
__defNormalProp$
|
498
|
-
if (__getOwnPropSymbols$
|
499
|
-
for (var prop of __getOwnPropSymbols$
|
500
|
-
if (__propIsEnum$
|
501
|
-
__defNormalProp$
|
498
|
+
if (__hasOwnProp$H.call(b, prop))
|
499
|
+
__defNormalProp$H(a, prop, b[prop]);
|
500
|
+
if (__getOwnPropSymbols$H)
|
501
|
+
for (var prop of __getOwnPropSymbols$H(b)) {
|
502
|
+
if (__propIsEnum$H.call(b, prop))
|
503
|
+
__defNormalProp$H(a, prop, b[prop]);
|
502
504
|
}
|
503
505
|
return a;
|
504
506
|
};
|
@@ -507,7 +509,7 @@ function cloneSceneObject(sceneObject, withState) {
|
|
507
509
|
return new sceneObject.constructor(clonedState);
|
508
510
|
}
|
509
511
|
function cloneSceneObjectState(sceneState, withState) {
|
510
|
-
const clonedState = __spreadValues$
|
512
|
+
const clonedState = __spreadValues$H({}, sceneState);
|
511
513
|
for (const key in clonedState) {
|
512
514
|
const propValue = clonedState[key];
|
513
515
|
if (propValue instanceof SceneObjectBase) {
|
@@ -604,25 +606,25 @@ function lookupVariable(name, sceneObject) {
|
|
604
606
|
return null;
|
605
607
|
}
|
606
608
|
|
607
|
-
var __defProp$
|
608
|
-
var __getOwnPropSymbols$
|
609
|
-
var __hasOwnProp$
|
610
|
-
var __propIsEnum$
|
611
|
-
var __defNormalProp$
|
612
|
-
var __spreadValues$
|
609
|
+
var __defProp$G = Object.defineProperty;
|
610
|
+
var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
|
611
|
+
var __hasOwnProp$G = Object.prototype.hasOwnProperty;
|
612
|
+
var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
|
613
|
+
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
614
|
+
var __spreadValues$G = (a, b) => {
|
613
615
|
for (var prop in b || (b = {}))
|
614
|
-
if (__hasOwnProp$
|
615
|
-
__defNormalProp$
|
616
|
-
if (__getOwnPropSymbols$
|
617
|
-
for (var prop of __getOwnPropSymbols$
|
618
|
-
if (__propIsEnum$
|
619
|
-
__defNormalProp$
|
616
|
+
if (__hasOwnProp$G.call(b, prop))
|
617
|
+
__defNormalProp$G(a, prop, b[prop]);
|
618
|
+
if (__getOwnPropSymbols$G)
|
619
|
+
for (var prop of __getOwnPropSymbols$G(b)) {
|
620
|
+
if (__propIsEnum$G.call(b, prop))
|
621
|
+
__defNormalProp$G(a, prop, b[prop]);
|
620
622
|
}
|
621
623
|
return a;
|
622
624
|
};
|
623
625
|
class SceneDataNode extends SceneObjectBase {
|
624
626
|
constructor(state) {
|
625
|
-
super(__spreadValues$
|
627
|
+
super(__spreadValues$G({
|
626
628
|
data: emptyPanelData
|
627
629
|
}, state));
|
628
630
|
}
|
@@ -703,19 +705,19 @@ function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay) {
|
|
703
705
|
};
|
704
706
|
}
|
705
707
|
|
706
|
-
var __defProp$
|
707
|
-
var __getOwnPropSymbols$
|
708
|
-
var __hasOwnProp$
|
709
|
-
var __propIsEnum$
|
710
|
-
var __defNormalProp$
|
711
|
-
var __spreadValues$
|
708
|
+
var __defProp$F = Object.defineProperty;
|
709
|
+
var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
|
710
|
+
var __hasOwnProp$F = Object.prototype.hasOwnProperty;
|
711
|
+
var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
|
712
|
+
var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
713
|
+
var __spreadValues$F = (a, b) => {
|
712
714
|
for (var prop in b || (b = {}))
|
713
|
-
if (__hasOwnProp$
|
714
|
-
__defNormalProp$
|
715
|
-
if (__getOwnPropSymbols$
|
716
|
-
for (var prop of __getOwnPropSymbols$
|
717
|
-
if (__propIsEnum$
|
718
|
-
__defNormalProp$
|
715
|
+
if (__hasOwnProp$F.call(b, prop))
|
716
|
+
__defNormalProp$F(a, prop, b[prop]);
|
717
|
+
if (__getOwnPropSymbols$F)
|
718
|
+
for (var prop of __getOwnPropSymbols$F(b)) {
|
719
|
+
if (__propIsEnum$F.call(b, prop))
|
720
|
+
__defNormalProp$F(a, prop, b[prop]);
|
719
721
|
}
|
720
722
|
return a;
|
721
723
|
};
|
@@ -732,7 +734,7 @@ class SceneTimeRange extends SceneObjectBase {
|
|
732
734
|
state.fiscalYearStartMonth,
|
733
735
|
state.UNSAFE_nowDelay
|
734
736
|
);
|
735
|
-
super(__spreadValues$
|
737
|
+
super(__spreadValues$F({ from, to, timeZone, value }, state));
|
736
738
|
this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["from", "to", "timezone"] });
|
737
739
|
this.onTimeRangeChange = (timeRange) => {
|
738
740
|
const update = {};
|
@@ -1362,25 +1364,25 @@ function collectAllVariables(sceneObject, record = {}) {
|
|
1362
1364
|
return record;
|
1363
1365
|
}
|
1364
1366
|
|
1365
|
-
var __defProp$
|
1366
|
-
var __defProps$
|
1367
|
-
var __getOwnPropDescs$
|
1368
|
-
var __getOwnPropSymbols$
|
1369
|
-
var __hasOwnProp$
|
1370
|
-
var __propIsEnum$
|
1371
|
-
var __defNormalProp$
|
1372
|
-
var __spreadValues$
|
1367
|
+
var __defProp$E = Object.defineProperty;
|
1368
|
+
var __defProps$s = Object.defineProperties;
|
1369
|
+
var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
|
1370
|
+
var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
|
1371
|
+
var __hasOwnProp$E = Object.prototype.hasOwnProperty;
|
1372
|
+
var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
|
1373
|
+
var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
1374
|
+
var __spreadValues$E = (a, b) => {
|
1373
1375
|
for (var prop in b || (b = {}))
|
1374
|
-
if (__hasOwnProp$
|
1375
|
-
__defNormalProp$
|
1376
|
-
if (__getOwnPropSymbols$
|
1377
|
-
for (var prop of __getOwnPropSymbols$
|
1378
|
-
if (__propIsEnum$
|
1379
|
-
__defNormalProp$
|
1376
|
+
if (__hasOwnProp$E.call(b, prop))
|
1377
|
+
__defNormalProp$E(a, prop, b[prop]);
|
1378
|
+
if (__getOwnPropSymbols$E)
|
1379
|
+
for (var prop of __getOwnPropSymbols$E(b)) {
|
1380
|
+
if (__propIsEnum$E.call(b, prop))
|
1381
|
+
__defNormalProp$E(a, prop, b[prop]);
|
1380
1382
|
}
|
1381
1383
|
return a;
|
1382
1384
|
};
|
1383
|
-
var __spreadProps$
|
1385
|
+
var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
|
1384
1386
|
function getTemplateProxyForField(field, frame, frames) {
|
1385
1387
|
return new Proxy(
|
1386
1388
|
{},
|
@@ -1396,7 +1398,7 @@ function getTemplateProxyForField(field, frame, frames) {
|
|
1396
1398
|
if (!field.labels) {
|
1397
1399
|
return "";
|
1398
1400
|
}
|
1399
|
-
return __spreadProps$
|
1401
|
+
return __spreadProps$s(__spreadValues$E({}, field.labels), {
|
1400
1402
|
__values: Object.values(field.labels).sort().join(", "),
|
1401
1403
|
toString: () => {
|
1402
1404
|
return data.formatLabels(field.labels, "", true);
|
@@ -2281,25 +2283,25 @@ function isExtraQueryProvider(obj) {
|
|
2281
2283
|
return typeof obj === "object" && "getExtraQueries" in obj;
|
2282
2284
|
}
|
2283
2285
|
|
2284
|
-
var __defProp$
|
2285
|
-
var __defProps$
|
2286
|
-
var __getOwnPropDescs$
|
2287
|
-
var __getOwnPropSymbols$
|
2288
|
-
var __hasOwnProp$
|
2289
|
-
var __propIsEnum$
|
2290
|
-
var __defNormalProp$
|
2291
|
-
var __spreadValues$
|
2286
|
+
var __defProp$D = Object.defineProperty;
|
2287
|
+
var __defProps$r = Object.defineProperties;
|
2288
|
+
var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
|
2289
|
+
var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
|
2290
|
+
var __hasOwnProp$D = Object.prototype.hasOwnProperty;
|
2291
|
+
var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
|
2292
|
+
var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2293
|
+
var __spreadValues$D = (a, b) => {
|
2292
2294
|
for (var prop in b || (b = {}))
|
2293
|
-
if (__hasOwnProp$
|
2294
|
-
__defNormalProp$
|
2295
|
-
if (__getOwnPropSymbols$
|
2296
|
-
for (var prop of __getOwnPropSymbols$
|
2297
|
-
if (__propIsEnum$
|
2298
|
-
__defNormalProp$
|
2295
|
+
if (__hasOwnProp$D.call(b, prop))
|
2296
|
+
__defNormalProp$D(a, prop, b[prop]);
|
2297
|
+
if (__getOwnPropSymbols$D)
|
2298
|
+
for (var prop of __getOwnPropSymbols$D(b)) {
|
2299
|
+
if (__propIsEnum$D.call(b, prop))
|
2300
|
+
__defNormalProp$D(a, prop, b[prop]);
|
2299
2301
|
}
|
2300
2302
|
return a;
|
2301
2303
|
};
|
2302
|
-
var __spreadProps$
|
2304
|
+
var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
|
2303
2305
|
const passthroughProcessor = (_, secondary) => rxjs.of(secondary);
|
2304
2306
|
const extraQueryProcessingOperator = (processors) => (data) => {
|
2305
2307
|
return data.pipe(
|
@@ -2312,7 +2314,7 @@ const extraQueryProcessingOperator = (processors) => (data) => {
|
|
2312
2314
|
}),
|
2313
2315
|
rxjs.map(([primary, ...processedSecondaries]) => {
|
2314
2316
|
var _a;
|
2315
|
-
return __spreadProps$
|
2317
|
+
return __spreadProps$r(__spreadValues$D({}, primary), {
|
2316
2318
|
series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
|
2317
2319
|
annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
|
2318
2320
|
var _a2;
|
@@ -2323,25 +2325,25 @@ const extraQueryProcessingOperator = (processors) => (data) => {
|
|
2323
2325
|
);
|
2324
2326
|
};
|
2325
2327
|
|
2326
|
-
var __defProp$
|
2327
|
-
var __defProps$
|
2328
|
-
var __getOwnPropDescs$
|
2329
|
-
var __getOwnPropSymbols$
|
2330
|
-
var __hasOwnProp$
|
2331
|
-
var __propIsEnum$
|
2332
|
-
var __defNormalProp$
|
2333
|
-
var __spreadValues$
|
2328
|
+
var __defProp$C = Object.defineProperty;
|
2329
|
+
var __defProps$q = Object.defineProperties;
|
2330
|
+
var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
|
2331
|
+
var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
|
2332
|
+
var __hasOwnProp$C = Object.prototype.hasOwnProperty;
|
2333
|
+
var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
|
2334
|
+
var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2335
|
+
var __spreadValues$C = (a, b) => {
|
2334
2336
|
for (var prop in b || (b = {}))
|
2335
|
-
if (__hasOwnProp$
|
2336
|
-
__defNormalProp$
|
2337
|
-
if (__getOwnPropSymbols$
|
2338
|
-
for (var prop of __getOwnPropSymbols$
|
2339
|
-
if (__propIsEnum$
|
2340
|
-
__defNormalProp$
|
2337
|
+
if (__hasOwnProp$C.call(b, prop))
|
2338
|
+
__defNormalProp$C(a, prop, b[prop]);
|
2339
|
+
if (__getOwnPropSymbols$C)
|
2340
|
+
for (var prop of __getOwnPropSymbols$C(b)) {
|
2341
|
+
if (__propIsEnum$C.call(b, prop))
|
2342
|
+
__defNormalProp$C(a, prop, b[prop]);
|
2341
2343
|
}
|
2342
2344
|
return a;
|
2343
2345
|
};
|
2344
|
-
var __spreadProps$
|
2346
|
+
var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
|
2345
2347
|
function filterAnnotations(data, filters) {
|
2346
2348
|
var _a;
|
2347
2349
|
if (!Array.isArray(data) || data.length === 0) {
|
@@ -2392,11 +2394,11 @@ function filterAnnotations(data, filters) {
|
|
2392
2394
|
continue;
|
2393
2395
|
}
|
2394
2396
|
}
|
2395
|
-
fields.push(__spreadProps$
|
2397
|
+
fields.push(__spreadProps$q(__spreadValues$C({}, field), {
|
2396
2398
|
values: buffer
|
2397
2399
|
}));
|
2398
2400
|
}
|
2399
|
-
processed.push(__spreadProps$
|
2401
|
+
processed.push(__spreadProps$q(__spreadValues$C({}, frame), {
|
2400
2402
|
fields,
|
2401
2403
|
length: frameLength
|
2402
2404
|
}));
|
@@ -2822,33 +2824,33 @@ function getOptionSearcher(options, includeAll) {
|
|
2822
2824
|
};
|
2823
2825
|
}
|
2824
2826
|
|
2825
|
-
var __defProp$
|
2826
|
-
var __defProps$
|
2827
|
-
var __getOwnPropDescs$
|
2828
|
-
var __getOwnPropSymbols$
|
2829
|
-
var __hasOwnProp$
|
2830
|
-
var __propIsEnum$
|
2831
|
-
var __defNormalProp$
|
2832
|
-
var __spreadValues$
|
2827
|
+
var __defProp$B = Object.defineProperty;
|
2828
|
+
var __defProps$p = Object.defineProperties;
|
2829
|
+
var __getOwnPropDescs$p = Object.getOwnPropertyDescriptors;
|
2830
|
+
var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
|
2831
|
+
var __hasOwnProp$B = Object.prototype.hasOwnProperty;
|
2832
|
+
var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
|
2833
|
+
var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2834
|
+
var __spreadValues$B = (a, b) => {
|
2833
2835
|
for (var prop in b || (b = {}))
|
2834
|
-
if (__hasOwnProp$
|
2835
|
-
__defNormalProp$
|
2836
|
-
if (__getOwnPropSymbols$
|
2837
|
-
for (var prop of __getOwnPropSymbols$
|
2838
|
-
if (__propIsEnum$
|
2839
|
-
__defNormalProp$
|
2836
|
+
if (__hasOwnProp$B.call(b, prop))
|
2837
|
+
__defNormalProp$B(a, prop, b[prop]);
|
2838
|
+
if (__getOwnPropSymbols$B)
|
2839
|
+
for (var prop of __getOwnPropSymbols$B(b)) {
|
2840
|
+
if (__propIsEnum$B.call(b, prop))
|
2841
|
+
__defNormalProp$B(a, prop, b[prop]);
|
2840
2842
|
}
|
2841
2843
|
return a;
|
2842
2844
|
};
|
2843
|
-
var __spreadProps$
|
2844
|
-
var __objRest$
|
2845
|
+
var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
|
2846
|
+
var __objRest$4 = (source, exclude) => {
|
2845
2847
|
var target = {};
|
2846
2848
|
for (var prop in source)
|
2847
|
-
if (__hasOwnProp$
|
2849
|
+
if (__hasOwnProp$B.call(source, prop) && exclude.indexOf(prop) < 0)
|
2848
2850
|
target[prop] = source[prop];
|
2849
|
-
if (source != null && __getOwnPropSymbols$
|
2850
|
-
for (var prop of __getOwnPropSymbols$
|
2851
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
2851
|
+
if (source != null && __getOwnPropSymbols$B)
|
2852
|
+
for (var prop of __getOwnPropSymbols$B(source)) {
|
2853
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$B.call(source, prop))
|
2852
2854
|
target[prop] = source[prop];
|
2853
2855
|
}
|
2854
2856
|
return target;
|
@@ -2976,11 +2978,11 @@ const OptionWithCheckbox = ({
|
|
2976
2978
|
renderOptionLabel
|
2977
2979
|
}) => {
|
2978
2980
|
var _b;
|
2979
|
-
const _a = innerProps, rest = __objRest$
|
2981
|
+
const _a = innerProps, rest = __objRest$4(_a, ["onMouseMove", "onMouseOver"]);
|
2980
2982
|
const theme = ui.useTheme2();
|
2981
2983
|
const selectStyles = ui.getSelectStyles(theme);
|
2982
2984
|
const optionStyles = ui.useStyles2(getOptionStyles);
|
2983
|
-
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$
|
2985
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$p(__spreadValues$B({
|
2984
2986
|
ref: innerRef,
|
2985
2987
|
className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
|
2986
2988
|
}, rest), {
|
@@ -3082,28 +3084,28 @@ function getEnrichedFiltersRequest(sourceRunner) {
|
|
3082
3084
|
return null;
|
3083
3085
|
}
|
3084
3086
|
|
3085
|
-
var __defProp$
|
3086
|
-
var __defProps$
|
3087
|
-
var __getOwnPropDescs$
|
3088
|
-
var __getOwnPropSymbols$
|
3089
|
-
var __hasOwnProp$
|
3090
|
-
var __propIsEnum$
|
3091
|
-
var __defNormalProp$
|
3092
|
-
var __spreadValues$
|
3087
|
+
var __defProp$A = Object.defineProperty;
|
3088
|
+
var __defProps$o = Object.defineProperties;
|
3089
|
+
var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
|
3090
|
+
var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
|
3091
|
+
var __hasOwnProp$A = Object.prototype.hasOwnProperty;
|
3092
|
+
var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
|
3093
|
+
var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3094
|
+
var __spreadValues$A = (a, b) => {
|
3093
3095
|
for (var prop in b || (b = {}))
|
3094
|
-
if (__hasOwnProp$
|
3095
|
-
__defNormalProp$
|
3096
|
-
if (__getOwnPropSymbols$
|
3097
|
-
for (var prop of __getOwnPropSymbols$
|
3098
|
-
if (__propIsEnum$
|
3099
|
-
__defNormalProp$
|
3096
|
+
if (__hasOwnProp$A.call(b, prop))
|
3097
|
+
__defNormalProp$A(a, prop, b[prop]);
|
3098
|
+
if (__getOwnPropSymbols$A)
|
3099
|
+
for (var prop of __getOwnPropSymbols$A(b)) {
|
3100
|
+
if (__propIsEnum$A.call(b, prop))
|
3101
|
+
__defNormalProp$A(a, prop, b[prop]);
|
3100
3102
|
}
|
3101
3103
|
return a;
|
3102
3104
|
};
|
3103
|
-
var __spreadProps$
|
3105
|
+
var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
|
3104
3106
|
class GroupByVariable extends MultiValueVariable {
|
3105
3107
|
constructor(initialState) {
|
3106
|
-
super(__spreadProps$
|
3108
|
+
super(__spreadProps$o(__spreadValues$A({
|
3107
3109
|
isMulti: true,
|
3108
3110
|
name: "",
|
3109
3111
|
value: [],
|
@@ -3136,7 +3138,7 @@ class GroupByVariable extends MultiValueVariable {
|
|
3136
3138
|
const queries = getQueriesForVariables(this);
|
3137
3139
|
const otherFilters = this.state.baseFilters || [];
|
3138
3140
|
const timeRange = sceneGraph.getTimeRange(this).state.value;
|
3139
|
-
const response = await ds.getTagKeys(__spreadValues$
|
3141
|
+
const response = await ds.getTagKeys(__spreadValues$A({ filters: otherFilters, queries, timeRange }, getEnrichedFiltersRequest(this)));
|
3140
3142
|
if (responseHasError(response)) {
|
3141
3143
|
this.setState({ error: response.error.message });
|
3142
3144
|
}
|
@@ -3481,10 +3483,7 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
3481
3483
|
const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
|
3482
3484
|
const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
|
3483
3485
|
const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
|
3484
|
-
const optionSearcher = React.useMemo(
|
3485
|
-
() => getAdhocOptionSearcher(values),
|
3486
|
-
[values]
|
3487
|
-
);
|
3486
|
+
const optionSearcher = React.useMemo(() => getAdhocOptionSearcher(values), [values]);
|
3488
3487
|
const onValueInputChange = (value, { action }) => {
|
3489
3488
|
if (action === "input-change") {
|
3490
3489
|
setValueInputValue(value);
|
@@ -3752,6 +3751,469 @@ function isFilter(filter) {
|
|
3752
3751
|
return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
|
3753
3752
|
}
|
3754
3753
|
|
3754
|
+
var __defProp$z = Object.defineProperty;
|
3755
|
+
var __defProps$n = Object.defineProperties;
|
3756
|
+
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
3757
|
+
var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
|
3758
|
+
var __hasOwnProp$z = Object.prototype.hasOwnProperty;
|
3759
|
+
var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
|
3760
|
+
var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3761
|
+
var __spreadValues$z = (a, b) => {
|
3762
|
+
for (var prop in b || (b = {}))
|
3763
|
+
if (__hasOwnProp$z.call(b, prop))
|
3764
|
+
__defNormalProp$z(a, prop, b[prop]);
|
3765
|
+
if (__getOwnPropSymbols$z)
|
3766
|
+
for (var prop of __getOwnPropSymbols$z(b)) {
|
3767
|
+
if (__propIsEnum$z.call(b, prop))
|
3768
|
+
__defNormalProp$z(a, prop, b[prop]);
|
3769
|
+
}
|
3770
|
+
return a;
|
3771
|
+
};
|
3772
|
+
var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
|
3773
|
+
var __objRest$3 = (source, exclude) => {
|
3774
|
+
var target = {};
|
3775
|
+
for (var prop in source)
|
3776
|
+
if (__hasOwnProp$z.call(source, prop) && exclude.indexOf(prop) < 0)
|
3777
|
+
target[prop] = source[prop];
|
3778
|
+
if (source != null && __getOwnPropSymbols$z)
|
3779
|
+
for (var prop of __getOwnPropSymbols$z(source)) {
|
3780
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$z.call(source, prop))
|
3781
|
+
target[prop] = source[prop];
|
3782
|
+
}
|
3783
|
+
return target;
|
3784
|
+
};
|
3785
|
+
const Item = React.forwardRef(
|
3786
|
+
(_a, ref) => {
|
3787
|
+
var _b = _a, { children, active } = _b, rest = __objRest$3(_b, ["children", "active"]);
|
3788
|
+
const theme = ui.useTheme2();
|
3789
|
+
const selectStyles = ui.getSelectStyles(theme);
|
3790
|
+
const id = react.useId();
|
3791
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$z({
|
3792
|
+
ref,
|
3793
|
+
role: "option",
|
3794
|
+
id,
|
3795
|
+
"aria-selected": active,
|
3796
|
+
className: css.cx(selectStyles.option, active && selectStyles.optionFocused)
|
3797
|
+
}, rest), /* @__PURE__ */ React__default["default"].createElement("div", {
|
3798
|
+
className: selectStyles.optionBody,
|
3799
|
+
"data-testid": `data-testid ad hoc filter option value ${children}`
|
3800
|
+
}, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
|
3801
|
+
}
|
3802
|
+
);
|
3803
|
+
const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model, wip, handleChangeViewMode }, parentRef) {
|
3804
|
+
var _a;
|
3805
|
+
const [open, setOpen] = React.useState(false);
|
3806
|
+
const [options, setOptions] = React.useState([]);
|
3807
|
+
const [inputValue, setInputValue] = React.useState("");
|
3808
|
+
const [activeIndex, setActiveIndex] = React.useState(null);
|
3809
|
+
const [inputType, setInputType] = React.useState(!wip ? "value" : "key");
|
3810
|
+
const styles = ui.useStyles2(getStyles2);
|
3811
|
+
const listRef = React.useRef([]);
|
3812
|
+
const { _wip } = model.useState();
|
3813
|
+
const handleResetWip = React.useCallback(() => {
|
3814
|
+
if (wip) {
|
3815
|
+
model._addWip();
|
3816
|
+
setInputType("key");
|
3817
|
+
setInputValue("");
|
3818
|
+
}
|
3819
|
+
}, [model, wip]);
|
3820
|
+
const filterToUse = filter || _wip;
|
3821
|
+
const operatorIdentifier = `${(_a = filterToUse == null ? void 0 : filterToUse.key) != null ? _a : ""}-operator`;
|
3822
|
+
const { refs, floatingStyles, context } = react.useFloating({
|
3823
|
+
whileElementsMounted: react.autoUpdate,
|
3824
|
+
open,
|
3825
|
+
onOpenChange: (nextOpen, _, reason) => {
|
3826
|
+
setOpen(nextOpen);
|
3827
|
+
if (["outside-press", "escape-key"].includes(reason || "")) {
|
3828
|
+
handleResetWip();
|
3829
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3830
|
+
}
|
3831
|
+
},
|
3832
|
+
middleware: [
|
3833
|
+
react.flip({ padding: 10 }),
|
3834
|
+
react.size({
|
3835
|
+
apply({ rects, availableHeight, elements }) {
|
3836
|
+
Object.assign(elements.floating.style, {
|
3837
|
+
width: `${rects.reference.width}px`,
|
3838
|
+
maxHeight: `${availableHeight > 256 ? 256 : availableHeight}px`
|
3839
|
+
});
|
3840
|
+
},
|
3841
|
+
padding: 10
|
3842
|
+
})
|
3843
|
+
]
|
3844
|
+
});
|
3845
|
+
const role = react.useRole(context, { role: "listbox" });
|
3846
|
+
const dismiss = react.useDismiss(context, {
|
3847
|
+
outsidePress: (event) => {
|
3848
|
+
return !event.currentTarget.classList.contains(
|
3849
|
+
operatorIdentifier
|
3850
|
+
);
|
3851
|
+
}
|
3852
|
+
});
|
3853
|
+
const listNav = react.useListNavigation(context, {
|
3854
|
+
listRef,
|
3855
|
+
activeIndex,
|
3856
|
+
onNavigate: setActiveIndex,
|
3857
|
+
virtual: true,
|
3858
|
+
loop: true
|
3859
|
+
});
|
3860
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = react.useInteractions([role, dismiss, listNav]);
|
3861
|
+
React.useImperativeHandle(parentRef, () => () => {
|
3862
|
+
var _a2;
|
3863
|
+
return (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
3864
|
+
}, [refs.domReference]);
|
3865
|
+
function onChange(event) {
|
3866
|
+
var _a2, _b;
|
3867
|
+
if (inputType === "key") {
|
3868
|
+
const lastChar = event.target.value.slice(-1);
|
3869
|
+
if (["=", "!", "<", ">"].includes(lastChar)) {
|
3870
|
+
const key = event.target.value.slice(0, -1);
|
3871
|
+
const optionIndex = options.findIndex((option) => option.value === key);
|
3872
|
+
if (optionIndex >= 0) {
|
3873
|
+
model._updateFilter(filterToUse, inputType, options[optionIndex]);
|
3874
|
+
setInputValue(lastChar);
|
3875
|
+
}
|
3876
|
+
reactDom.flushSync(() => {
|
3877
|
+
setInputType("operator");
|
3878
|
+
});
|
3879
|
+
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
3880
|
+
return;
|
3881
|
+
}
|
3882
|
+
}
|
3883
|
+
if (inputType === "operator") {
|
3884
|
+
const lastChar = event.target.value.slice(-1);
|
3885
|
+
if (/\w/.test(lastChar)) {
|
3886
|
+
const operator = event.target.value.slice(0, -1);
|
3887
|
+
if (!/\w/.test(operator)) {
|
3888
|
+
const optionIndex = options.findIndex((option) => option.value === operator);
|
3889
|
+
if (optionIndex >= 0) {
|
3890
|
+
model._updateFilter(filterToUse, inputType, options[optionIndex]);
|
3891
|
+
setInputValue(lastChar);
|
3892
|
+
}
|
3893
|
+
reactDom.flushSync(() => {
|
3894
|
+
setInputType("value");
|
3895
|
+
});
|
3896
|
+
(_b = refs.domReference.current) == null ? void 0 : _b.focus();
|
3897
|
+
return;
|
3898
|
+
}
|
3899
|
+
}
|
3900
|
+
}
|
3901
|
+
const value = event.target.value;
|
3902
|
+
setInputValue(value);
|
3903
|
+
setActiveIndex(0);
|
3904
|
+
}
|
3905
|
+
const items = options.filter(
|
3906
|
+
(item) => {
|
3907
|
+
var _a2, _b;
|
3908
|
+
return (_b = (_a2 = item.label) != null ? _a2 : item.value) == null ? void 0 : _b.toLocaleLowerCase().startsWith(inputValue.toLowerCase());
|
3909
|
+
}
|
3910
|
+
);
|
3911
|
+
const flushInputType = React.useCallback((inputType2) => {
|
3912
|
+
reactDom.flushSync(() => {
|
3913
|
+
setInputType(inputType2);
|
3914
|
+
});
|
3915
|
+
}, []);
|
3916
|
+
React.useEffect(() => {
|
3917
|
+
if (wip && !_wip) {
|
3918
|
+
model._addWip();
|
3919
|
+
}
|
3920
|
+
}, [_wip]);
|
3921
|
+
React.useEffect(() => {
|
3922
|
+
if (!wip && refs.domReference.current) {
|
3923
|
+
setInputType("value");
|
3924
|
+
setInputValue("");
|
3925
|
+
refs.domReference.current.focus();
|
3926
|
+
}
|
3927
|
+
}, []);
|
3928
|
+
const handleFetchOptions = React.useCallback(async () => {
|
3929
|
+
let options2 = [];
|
3930
|
+
if (inputType === "key") {
|
3931
|
+
options2 = await model._getKeys(null);
|
3932
|
+
} else if (inputType === "operator") {
|
3933
|
+
options2 = model._getOperators();
|
3934
|
+
} else if (inputType === "value") {
|
3935
|
+
options2 = await model._getValuesFor(filterToUse);
|
3936
|
+
}
|
3937
|
+
setOptions(options2);
|
3938
|
+
}, [filterToUse, inputType, model]);
|
3939
|
+
const handleBackspaceInput = React.useCallback(
|
3940
|
+
(event) => {
|
3941
|
+
if (event.key === "Backspace" && !inputValue && inputType === "key") {
|
3942
|
+
model._removeLastFilter();
|
3943
|
+
setOpen(false);
|
3944
|
+
}
|
3945
|
+
},
|
3946
|
+
[inputValue, inputType]
|
3947
|
+
);
|
3948
|
+
const handleTabInput = React.useCallback((event) => {
|
3949
|
+
if (event.key === "Tab" && !event.shiftKey) {
|
3950
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3951
|
+
handleResetWip();
|
3952
|
+
}
|
3953
|
+
}, []);
|
3954
|
+
const handleShiftTabInput = React.useCallback((event) => {
|
3955
|
+
if (event.key === "Tab" && event.shiftKey) {
|
3956
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3957
|
+
handleResetWip();
|
3958
|
+
}
|
3959
|
+
}, []);
|
3960
|
+
const handleEnterInput = React.useCallback(
|
3961
|
+
(event) => {
|
3962
|
+
var _a2;
|
3963
|
+
if (event.key === "Enter" && activeIndex != null && items[activeIndex]) {
|
3964
|
+
model._updateFilter(filterToUse, inputType, items[activeIndex]);
|
3965
|
+
setInputValue("");
|
3966
|
+
if (inputType === "key") {
|
3967
|
+
flushInputType("operator");
|
3968
|
+
} else if (inputType === "operator") {
|
3969
|
+
flushInputType("value");
|
3970
|
+
} else if (inputType === "value") {
|
3971
|
+
flushInputType("key");
|
3972
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
3973
|
+
}
|
3974
|
+
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
3975
|
+
}
|
3976
|
+
},
|
3977
|
+
[activeIndex, filterToUse, inputType, items, model]
|
3978
|
+
);
|
3979
|
+
React.useEffect(() => {
|
3980
|
+
if (open) {
|
3981
|
+
handleFetchOptions();
|
3982
|
+
}
|
3983
|
+
}, [open, inputType]);
|
3984
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
3985
|
+
className: styles.comboboxWrapper
|
3986
|
+
}, filterToUse ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
3987
|
+
className: styles.pillWrapper
|
3988
|
+
}, (filterToUse == null ? void 0 : filterToUse.key) ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
3989
|
+
className: css.cx(styles.basePill, styles.keyPill)
|
3990
|
+
}, filterToUse.key) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && inputType !== "operator" ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
3991
|
+
className: css.cx(styles.basePill, operatorIdentifier),
|
3992
|
+
role: "button",
|
3993
|
+
"aria-label": "Edit filter operator",
|
3994
|
+
tabIndex: 0,
|
3995
|
+
onClick: (event) => {
|
3996
|
+
var _a2;
|
3997
|
+
event.stopPropagation();
|
3998
|
+
flushInputType("operator");
|
3999
|
+
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
4000
|
+
},
|
4001
|
+
onKeyDown: (event) => {
|
4002
|
+
var _a2;
|
4003
|
+
handleShiftTabInput(event);
|
4004
|
+
if (event.key === "Enter") {
|
4005
|
+
flushInputType("operator");
|
4006
|
+
(_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
|
4007
|
+
}
|
4008
|
+
}
|
4009
|
+
}, filterToUse.operator) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && (filterToUse == null ? void 0 : filterToUse.value) && !["operator", "value"].includes(inputType) ? /* @__PURE__ */ React__default["default"].createElement("div", {
|
4010
|
+
className: css.cx(styles.basePill, styles.valuePill)
|
4011
|
+
}, filterToUse.value) : null) : null, /* @__PURE__ */ React__default["default"].createElement("input", __spreadProps$n(__spreadValues$z({}, getReferenceProps({
|
4012
|
+
ref: refs.setReference,
|
4013
|
+
onChange,
|
4014
|
+
value: inputValue,
|
4015
|
+
placeholder: !wip ? inputType === "operator" ? `${filterToUse[inputType]} ${filterToUse.value || ""}` : filterToUse[inputType] : "Filter by label values",
|
4016
|
+
"aria-autocomplete": "list",
|
4017
|
+
onKeyDown(event) {
|
4018
|
+
if (inputType === "operator") {
|
4019
|
+
handleShiftTabInput(event);
|
4020
|
+
}
|
4021
|
+
handleBackspaceInput(event);
|
4022
|
+
handleTabInput(event);
|
4023
|
+
handleEnterInput(event);
|
4024
|
+
}
|
4025
|
+
})), {
|
4026
|
+
className: styles.inputStyle,
|
4027
|
+
onClick: (event) => {
|
4028
|
+
event.stopPropagation();
|
4029
|
+
setOpen(true);
|
4030
|
+
},
|
4031
|
+
onFocus: () => {
|
4032
|
+
setActiveIndex(0);
|
4033
|
+
setOpen(true);
|
4034
|
+
}
|
4035
|
+
})), /* @__PURE__ */ React__default["default"].createElement(react.FloatingPortal, null, open && /* @__PURE__ */ React__default["default"].createElement(react.FloatingFocusManager, {
|
4036
|
+
context,
|
4037
|
+
initialFocus: -1,
|
4038
|
+
visuallyHiddenDismiss: true
|
4039
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$n(__spreadValues$z({}, getFloatingProps({
|
4040
|
+
ref: refs.setFloating,
|
4041
|
+
style: __spreadProps$n(__spreadValues$z({}, floatingStyles), {
|
4042
|
+
overflowY: "auto"
|
4043
|
+
})
|
4044
|
+
})), {
|
4045
|
+
className: styles.dropdownWrapper
|
4046
|
+
}), items.map((item, index) => {
|
4047
|
+
var _a2;
|
4048
|
+
return /* @__PURE__ */ React__default["default"].createElement(Item, __spreadProps$n(__spreadValues$z({}, getItemProps({
|
4049
|
+
key: item.value,
|
4050
|
+
ref(node) {
|
4051
|
+
listRef.current[index] = node;
|
4052
|
+
},
|
4053
|
+
onClick() {
|
4054
|
+
var _a3;
|
4055
|
+
model._updateFilter(filterToUse, inputType, item);
|
4056
|
+
setInputValue("");
|
4057
|
+
if (inputType === "key") {
|
4058
|
+
flushInputType("operator");
|
4059
|
+
} else if (inputType === "operator") {
|
4060
|
+
flushInputType("value");
|
4061
|
+
} else if (inputType === "value") {
|
4062
|
+
flushInputType("key");
|
4063
|
+
handleChangeViewMode == null ? void 0 : handleChangeViewMode();
|
4064
|
+
}
|
4065
|
+
(_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
|
4066
|
+
}
|
4067
|
+
})), {
|
4068
|
+
active: activeIndex === index
|
4069
|
+
}), (_a2 = item.label) != null ? _a2 : item.value);
|
4070
|
+
})))));
|
4071
|
+
});
|
4072
|
+
const getStyles2 = (theme) => ({
|
4073
|
+
comboboxWrapper: css.css({
|
4074
|
+
display: "flex",
|
4075
|
+
flexWrap: "nowrap"
|
4076
|
+
}),
|
4077
|
+
pillWrapper: css.css({
|
4078
|
+
display: "flex",
|
4079
|
+
alignItems: "center",
|
4080
|
+
whiteSpace: "nowrap"
|
4081
|
+
}),
|
4082
|
+
basePill: css.css(__spreadProps$n(__spreadValues$z({
|
4083
|
+
display: "flex",
|
4084
|
+
alignItems: "center",
|
4085
|
+
background: theme.colors.action.disabledBackground,
|
4086
|
+
border: `1px solid ${theme.colors.border.weak}`,
|
4087
|
+
padding: theme.spacing(0.125, 1, 0.125, 1),
|
4088
|
+
color: theme.colors.text.primary,
|
4089
|
+
overflow: "hidden",
|
4090
|
+
whiteSpace: "nowrap",
|
4091
|
+
minHeight: "22px"
|
4092
|
+
}, theme.typography.bodySmall), {
|
4093
|
+
cursor: "pointer"
|
4094
|
+
})),
|
4095
|
+
keyPill: css.css({
|
4096
|
+
fontWeight: theme.typography.fontWeightBold,
|
4097
|
+
cursor: "default"
|
4098
|
+
}),
|
4099
|
+
valuePill: css.css({
|
4100
|
+
background: theme.colors.action.selected
|
4101
|
+
}),
|
4102
|
+
dropdownWrapper: css.css({
|
4103
|
+
backgroundColor: theme.colors.background.primary,
|
4104
|
+
color: theme.colors.text.primary,
|
4105
|
+
boxShadow: theme.shadows.z2
|
4106
|
+
}),
|
4107
|
+
inputStyle: css.css({
|
4108
|
+
paddingBlock: 0,
|
4109
|
+
"&:focus": {
|
4110
|
+
outline: "none"
|
4111
|
+
}
|
4112
|
+
})
|
4113
|
+
});
|
4114
|
+
function AdHocFilterEditSwitch({ filter, model }) {
|
4115
|
+
const styles = ui.useStyles2(getStyles3);
|
4116
|
+
const [viewMode, setViewMode] = React.useState(true);
|
4117
|
+
const pillWrapperRef = React.useRef(null);
|
4118
|
+
const handleChangeViewMode = React.useCallback((event) => {
|
4119
|
+
var _a;
|
4120
|
+
event == null ? void 0 : event.stopPropagation();
|
4121
|
+
let viewMode2 = false;
|
4122
|
+
reactDom.flushSync(() => {
|
4123
|
+
setViewMode((mode) => {
|
4124
|
+
viewMode2 = mode;
|
4125
|
+
return !mode;
|
4126
|
+
});
|
4127
|
+
});
|
4128
|
+
if (!viewMode2) {
|
4129
|
+
(_a = pillWrapperRef.current) == null ? void 0 : _a.focus();
|
4130
|
+
}
|
4131
|
+
}, []);
|
4132
|
+
if (viewMode) {
|
4133
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
4134
|
+
className: styles.combinedFilterPill,
|
4135
|
+
onClick: handleChangeViewMode,
|
4136
|
+
onKeyDown: (e) => {
|
4137
|
+
if (e.key === "Enter") {
|
4138
|
+
handleChangeViewMode();
|
4139
|
+
}
|
4140
|
+
},
|
4141
|
+
role: "button",
|
4142
|
+
"aria-label": "Edit filter",
|
4143
|
+
tabIndex: 0,
|
4144
|
+
ref: pillWrapperRef
|
4145
|
+
}, /* @__PURE__ */ React__default["default"].createElement("span", null, filter.key, " ", filter.operator, " ", filter.value), /* @__PURE__ */ React__default["default"].createElement(ui.IconButton, {
|
4146
|
+
onClick: (e) => {
|
4147
|
+
e.stopPropagation();
|
4148
|
+
model._removeFilter(filter);
|
4149
|
+
},
|
4150
|
+
onKeyDownCapture: (e) => {
|
4151
|
+
if (e.key === "Enter") {
|
4152
|
+
e.preventDefault();
|
4153
|
+
e.stopPropagation();
|
4154
|
+
model._removeFilter(filter);
|
4155
|
+
}
|
4156
|
+
},
|
4157
|
+
name: "times",
|
4158
|
+
size: "md",
|
4159
|
+
className: styles.removeButton,
|
4160
|
+
tooltip: "Remove filter"
|
4161
|
+
}));
|
4162
|
+
}
|
4163
|
+
return /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
|
4164
|
+
filter,
|
4165
|
+
model,
|
4166
|
+
handleChangeViewMode
|
4167
|
+
});
|
4168
|
+
}
|
4169
|
+
const getStyles3 = (theme) => ({
|
4170
|
+
wrapper: css.css({
|
4171
|
+
display: "flex",
|
4172
|
+
flexWrap: "wrap",
|
4173
|
+
alignItems: "center",
|
4174
|
+
columnGap: theme.spacing(1),
|
4175
|
+
rowGap: theme.spacing(1),
|
4176
|
+
minHeight: theme.spacing(4),
|
4177
|
+
backgroundColor: theme.components.input.background,
|
4178
|
+
border: `1px solid ${theme.colors.border.strong}`,
|
4179
|
+
borderRadius: theme.shape.radius.default,
|
4180
|
+
paddingInline: theme.spacing(1),
|
4181
|
+
"&:focus-within": {
|
4182
|
+
outline: "2px dotted transparent",
|
4183
|
+
outlineOffset: "2px",
|
4184
|
+
boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
|
4185
|
+
transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
|
4186
|
+
transitionDuration: "0.2s",
|
4187
|
+
transitionProperty: "outline, outline-offset, box-shadow"
|
4188
|
+
}
|
4189
|
+
}),
|
4190
|
+
combinedFilterPill: css.css(__spreadProps$n(__spreadValues$z({
|
4191
|
+
display: "flex",
|
4192
|
+
alignItems: "center",
|
4193
|
+
background: theme.colors.action.selected,
|
4194
|
+
borderRadius: theme.shape.radius.default,
|
4195
|
+
border: `1px solid ${theme.colors.border.weak}`,
|
4196
|
+
padding: theme.spacing(0.125, 0, 0.125, 1),
|
4197
|
+
color: theme.colors.text.primary,
|
4198
|
+
overflow: "hidden",
|
4199
|
+
whiteSpace: "nowrap",
|
4200
|
+
minHeight: "22px"
|
4201
|
+
}, theme.typography.bodySmall), {
|
4202
|
+
fontWeight: theme.typography.fontWeightBold,
|
4203
|
+
cursor: "pointer",
|
4204
|
+
"&:hover": {
|
4205
|
+
background: theme.colors.emphasize(theme.colors.background.secondary)
|
4206
|
+
}
|
4207
|
+
})),
|
4208
|
+
removeButton: css.css({
|
4209
|
+
marginInline: theme.spacing(0.5),
|
4210
|
+
cursor: "pointer",
|
4211
|
+
"&:hover": {
|
4212
|
+
color: theme.colors.text.primary
|
4213
|
+
}
|
4214
|
+
})
|
4215
|
+
});
|
4216
|
+
|
3755
4217
|
var __defProp$y = Object.defineProperty;
|
3756
4218
|
var __defProps$m = Object.defineProperties;
|
3757
4219
|
var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
|
@@ -3837,6 +4299,12 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
3837
4299
|
}
|
3838
4300
|
this.setState({ filters: this.state.filters.filter((f) => f !== filter) });
|
3839
4301
|
}
|
4302
|
+
_removeLastFilter() {
|
4303
|
+
const filterToRemove = this.state.filters.at(-1);
|
4304
|
+
if (filterToRemove) {
|
4305
|
+
this._removeFilter(filterToRemove);
|
4306
|
+
}
|
4307
|
+
}
|
3840
4308
|
async _getKeys(currentKey) {
|
3841
4309
|
var _a, _b, _c;
|
3842
4310
|
const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, currentKey));
|
@@ -3853,7 +4321,11 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
3853
4321
|
const otherFilters = this.state.filters.filter((f) => f.key !== currentKey).concat((_c = this.state.baseFilters) != null ? _c : []);
|
3854
4322
|
const timeRange = sceneGraph.getTimeRange(this).state.value;
|
3855
4323
|
const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : void 0;
|
3856
|
-
const response = await ds.getTagKeys(__spreadValues$y({
|
4324
|
+
const response = await ds.getTagKeys(__spreadValues$y({
|
4325
|
+
filters: otherFilters,
|
4326
|
+
queries,
|
4327
|
+
timeRange
|
4328
|
+
}, getEnrichedFiltersRequest(this)));
|
3857
4329
|
if (responseHasError(response)) {
|
3858
4330
|
this.setState({ error: response.error.message });
|
3859
4331
|
}
|
@@ -3914,6 +4386,28 @@ function renderExpression(builder, filters) {
|
|
3914
4386
|
function AdHocFiltersVariableRenderer({ model }) {
|
3915
4387
|
const { filters, readOnly, addFilterButtonText } = model.useState();
|
3916
4388
|
const styles = ui.useStyles2(getStyles$8);
|
4389
|
+
const focusOnInputRef = React.useRef();
|
4390
|
+
if (model.state.layout === "combobox") {
|
4391
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
4392
|
+
className: styles.comboboxWrapper,
|
4393
|
+
onClick: () => {
|
4394
|
+
var _a;
|
4395
|
+
(_a = focusOnInputRef.current) == null ? void 0 : _a.call(focusOnInputRef);
|
4396
|
+
}
|
4397
|
+
}, /* @__PURE__ */ React__default["default"].createElement(ui.Icon, {
|
4398
|
+
name: "filter",
|
4399
|
+
className: styles.filterIcon,
|
4400
|
+
size: "lg"
|
4401
|
+
}), filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(AdHocFilterEditSwitch, {
|
4402
|
+
key: index,
|
4403
|
+
filter,
|
4404
|
+
model
|
4405
|
+
})), /* @__PURE__ */ React__default["default"].createElement(AdHocCombobox, {
|
4406
|
+
model,
|
4407
|
+
wip: true,
|
4408
|
+
ref: focusOnInputRef
|
4409
|
+
}));
|
4410
|
+
}
|
3917
4411
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
3918
4412
|
className: styles.wrapper
|
3919
4413
|
}, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
|
@@ -3935,9 +4429,31 @@ const getStyles$8 = (theme) => ({
|
|
3935
4429
|
columnGap: theme.spacing(2),
|
3936
4430
|
rowGap: theme.spacing(1)
|
3937
4431
|
}),
|
4432
|
+
comboboxWrapper: css.css({
|
4433
|
+
display: "flex",
|
4434
|
+
flexWrap: "wrap",
|
4435
|
+
alignItems: "center",
|
4436
|
+
columnGap: theme.spacing(1),
|
4437
|
+
rowGap: theme.spacing(0.5),
|
4438
|
+
minHeight: theme.spacing(4),
|
4439
|
+
backgroundColor: theme.components.input.background,
|
4440
|
+
border: `1px solid ${theme.colors.border.strong}`,
|
4441
|
+
borderRadius: theme.shape.radius.default,
|
4442
|
+
paddingInline: theme.spacing(1),
|
4443
|
+
paddingBlock: theme.spacing(0.5),
|
4444
|
+
flexGrow: 1,
|
4445
|
+
"&:focus-within": {
|
4446
|
+
outline: "2px dotted transparent",
|
4447
|
+
outlineOffset: "2px",
|
4448
|
+
boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
|
4449
|
+
transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
|
4450
|
+
transitionDuration: "0.2s",
|
4451
|
+
transitionProperty: "outline, outline-offset, box-shadow"
|
4452
|
+
}
|
4453
|
+
}),
|
3938
4454
|
filterIcon: css.css({
|
3939
4455
|
color: theme.colors.text.secondary,
|
3940
|
-
|
4456
|
+
alignSelf: "center"
|
3941
4457
|
})
|
3942
4458
|
});
|
3943
4459
|
function toSelectableValue(input) {
|