@grafana/scenes 5.23.0 → 5.23.1--canary.858.11699916776.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -6
- package/dist/esm/behaviors/SceneQueryController.js +60 -5
- package/dist/esm/behaviors/SceneQueryController.js.map +1 -1
- package/dist/esm/behaviors/SceneRenderProfiler.js +169 -0
- package/dist/esm/behaviors/SceneRenderProfiler.js.map +1 -0
- package/dist/esm/components/SceneRefreshPicker.js +4 -1
- package/dist/esm/components/SceneRefreshPicker.js.map +1 -1
- package/dist/esm/components/VizPanel/VizPanel.js +9 -6
- package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
- package/dist/esm/core/SceneTimeRange.js +3 -0
- package/dist/esm/core/SceneTimeRange.js.map +1 -1
- package/dist/esm/core/sceneGraph/getQueryController.js +19 -0
- package/dist/esm/core/sceneGraph/getQueryController.js.map +1 -0
- package/dist/esm/core/sceneGraph/index.js +3 -3
- package/dist/esm/core/sceneGraph/index.js.map +1 -1
- package/dist/esm/core/sceneGraph/sceneGraph.js +1 -26
- package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/querying/SceneQueryRunner.js +1 -3
- package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
- package/dist/esm/querying/registerQueryWithController.js +19 -2
- package/dist/esm/querying/registerQueryWithController.js.map +1 -1
- package/dist/esm/utils/getDataSource.js +17 -1
- package/dist/esm/utils/getDataSource.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +12 -8
- package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js +1 -4
- package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js.map +1 -1
- package/dist/esm/variables/components/VariableValueSelect.js +5 -0
- package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
- package/dist/esm/variables/utils.js.map +1 -1
- package/dist/esm/variables/variants/MultiValueVariable.js.map +1 -1
- package/dist/esm/variables/variants/TestVariable.js.map +1 -1
- package/dist/index.d.ts +44 -32
- package/dist/index.js +479 -230
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -41,19 +41,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
41
41
|
var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
|
42
42
|
var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
|
43
43
|
|
44
|
-
var __defProp$
|
45
|
-
var __getOwnPropSymbols$
|
46
|
-
var __hasOwnProp$
|
47
|
-
var __propIsEnum$
|
48
|
-
var __defNormalProp$
|
49
|
-
var __spreadValues$
|
44
|
+
var __defProp$P = Object.defineProperty;
|
45
|
+
var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
|
46
|
+
var __hasOwnProp$P = Object.prototype.hasOwnProperty;
|
47
|
+
var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
|
48
|
+
var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
49
|
+
var __spreadValues$P = (a, b) => {
|
50
50
|
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$
|
51
|
+
if (__hasOwnProp$P.call(b, prop))
|
52
|
+
__defNormalProp$P(a, prop, b[prop]);
|
53
|
+
if (__getOwnPropSymbols$P)
|
54
|
+
for (var prop of __getOwnPropSymbols$P(b)) {
|
55
|
+
if (__propIsEnum$P.call(b, prop))
|
56
|
+
__defNormalProp$P(a, prop, b[prop]);
|
57
57
|
}
|
58
58
|
return a;
|
59
59
|
};
|
@@ -62,7 +62,7 @@ function useAppQueryParams() {
|
|
62
62
|
return runtime.locationSearchToObject(location.search || "");
|
63
63
|
}
|
64
64
|
function getUrlWithAppState(path, searchObject, preserveParams) {
|
65
|
-
const paramsCopy = __spreadValues$
|
65
|
+
const paramsCopy = __spreadValues$P({}, searchObject);
|
66
66
|
if (preserveParams) {
|
67
67
|
for (const key of Object.keys(paramsCopy)) {
|
68
68
|
if (!preserveParams.includes(key)) {
|
@@ -76,31 +76,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
|
|
76
76
|
return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
|
77
77
|
}
|
78
78
|
|
79
|
-
var __defProp$
|
80
|
-
var __defProps$
|
81
|
-
var __getOwnPropDescs$
|
82
|
-
var __getOwnPropSymbols$
|
83
|
-
var __hasOwnProp$
|
84
|
-
var __propIsEnum$
|
85
|
-
var __defNormalProp$
|
86
|
-
var __spreadValues$
|
79
|
+
var __defProp$O = Object.defineProperty;
|
80
|
+
var __defProps$w = Object.defineProperties;
|
81
|
+
var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
|
82
|
+
var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
|
83
|
+
var __hasOwnProp$O = Object.prototype.hasOwnProperty;
|
84
|
+
var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
|
85
|
+
var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
86
|
+
var __spreadValues$O = (a, b) => {
|
87
87
|
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$
|
88
|
+
if (__hasOwnProp$O.call(b, prop))
|
89
|
+
__defNormalProp$O(a, prop, b[prop]);
|
90
|
+
if (__getOwnPropSymbols$O)
|
91
|
+
for (var prop of __getOwnPropSymbols$O(b)) {
|
92
|
+
if (__propIsEnum$O.call(b, prop))
|
93
|
+
__defNormalProp$O(a, prop, b[prop]);
|
94
94
|
}
|
95
95
|
return a;
|
96
96
|
};
|
97
|
-
var __spreadProps$
|
97
|
+
var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
|
98
98
|
const runtimePanelPlugins = /* @__PURE__ */ new Map();
|
99
99
|
function registerRuntimePanelPlugin({ pluginId, plugin }) {
|
100
100
|
if (runtimePanelPlugins.has(pluginId)) {
|
101
101
|
throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
|
102
102
|
}
|
103
|
-
plugin.meta = __spreadProps$
|
103
|
+
plugin.meta = __spreadProps$w(__spreadValues$O({}, plugin.meta), {
|
104
104
|
id: pluginId,
|
105
105
|
name: pluginId,
|
106
106
|
module: "runtime plugin",
|
@@ -128,33 +128,33 @@ function loadPanelPluginSync(pluginId) {
|
|
128
128
|
return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
|
129
129
|
}
|
130
130
|
|
131
|
-
var __defProp$
|
132
|
-
var __defProps$
|
133
|
-
var __getOwnPropDescs$
|
134
|
-
var __getOwnPropSymbols$
|
135
|
-
var __hasOwnProp$
|
136
|
-
var __propIsEnum$
|
137
|
-
var __defNormalProp$
|
138
|
-
var __spreadValues$
|
131
|
+
var __defProp$N = Object.defineProperty;
|
132
|
+
var __defProps$v = Object.defineProperties;
|
133
|
+
var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
|
134
|
+
var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
|
135
|
+
var __hasOwnProp$N = Object.prototype.hasOwnProperty;
|
136
|
+
var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
|
137
|
+
var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
138
|
+
var __spreadValues$N = (a, b) => {
|
139
139
|
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$
|
140
|
+
if (__hasOwnProp$N.call(b, prop))
|
141
|
+
__defNormalProp$N(a, prop, b[prop]);
|
142
|
+
if (__getOwnPropSymbols$N)
|
143
|
+
for (var prop of __getOwnPropSymbols$N(b)) {
|
144
|
+
if (__propIsEnum$N.call(b, prop))
|
145
|
+
__defNormalProp$N(a, prop, b[prop]);
|
146
146
|
}
|
147
147
|
return a;
|
148
148
|
};
|
149
|
-
var __spreadProps$
|
149
|
+
var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
|
150
150
|
var __objRest$5 = (source, exclude) => {
|
151
151
|
var target = {};
|
152
152
|
for (var prop in source)
|
153
|
-
if (__hasOwnProp$
|
153
|
+
if (__hasOwnProp$N.call(source, prop) && exclude.indexOf(prop) < 0)
|
154
154
|
target[prop] = source[prop];
|
155
|
-
if (source != null && __getOwnPropSymbols$
|
156
|
-
for (var prop of __getOwnPropSymbols$
|
157
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
155
|
+
if (source != null && __getOwnPropSymbols$N)
|
156
|
+
for (var prop of __getOwnPropSymbols$N(source)) {
|
157
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$N.call(source, prop))
|
158
158
|
target[prop] = source[prop];
|
159
159
|
}
|
160
160
|
return target;
|
@@ -172,7 +172,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
|
|
172
172
|
if (!model.isActive) {
|
173
173
|
return null;
|
174
174
|
}
|
175
|
-
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$
|
175
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$v(__spreadValues$N({}, otherProps), {
|
176
176
|
model
|
177
177
|
}));
|
178
178
|
}
|
@@ -188,49 +188,49 @@ class UserActionEvent extends data.BusEventWithPayload {
|
|
188
188
|
}
|
189
189
|
UserActionEvent.type = "scene-object-user-action";
|
190
190
|
|
191
|
-
var __accessCheck$
|
191
|
+
var __accessCheck$4 = (obj, member, msg) => {
|
192
192
|
if (!member.has(obj))
|
193
193
|
throw TypeError("Cannot " + msg);
|
194
194
|
};
|
195
|
-
var __privateGet$
|
196
|
-
__accessCheck$
|
195
|
+
var __privateGet$4 = (obj, member, getter) => {
|
196
|
+
__accessCheck$4(obj, member, "read from private field");
|
197
197
|
return getter ? getter.call(obj) : member.get(obj);
|
198
198
|
};
|
199
|
-
var __privateAdd$
|
199
|
+
var __privateAdd$4 = (obj, member, value) => {
|
200
200
|
if (member.has(obj))
|
201
201
|
throw TypeError("Cannot add the same private member more than once");
|
202
202
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
203
203
|
};
|
204
|
-
var __privateSet$
|
205
|
-
__accessCheck$
|
204
|
+
var __privateSet$4 = (obj, member, value, setter) => {
|
205
|
+
__accessCheck$4(obj, member, "write to private field");
|
206
206
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
207
207
|
return value;
|
208
208
|
};
|
209
209
|
var _ref;
|
210
210
|
class SceneObjectRef {
|
211
211
|
constructor(ref) {
|
212
|
-
__privateAdd$
|
213
|
-
__privateSet$
|
212
|
+
__privateAdd$4(this, _ref, void 0);
|
213
|
+
__privateSet$4(this, _ref, ref);
|
214
214
|
}
|
215
215
|
resolve() {
|
216
|
-
return __privateGet$
|
216
|
+
return __privateGet$4(this, _ref);
|
217
217
|
}
|
218
218
|
}
|
219
219
|
_ref = new WeakMap();
|
220
220
|
|
221
|
-
var __defProp$
|
222
|
-
var __getOwnPropSymbols$
|
223
|
-
var __hasOwnProp$
|
224
|
-
var __propIsEnum$
|
225
|
-
var __defNormalProp$
|
226
|
-
var __spreadValues$
|
221
|
+
var __defProp$M = Object.defineProperty;
|
222
|
+
var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
|
223
|
+
var __hasOwnProp$M = Object.prototype.hasOwnProperty;
|
224
|
+
var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
|
225
|
+
var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
226
|
+
var __spreadValues$M = (a, b) => {
|
227
227
|
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$
|
228
|
+
if (__hasOwnProp$M.call(b, prop))
|
229
|
+
__defNormalProp$M(a, prop, b[prop]);
|
230
|
+
if (__getOwnPropSymbols$M)
|
231
|
+
for (var prop of __getOwnPropSymbols$M(b)) {
|
232
|
+
if (__propIsEnum$M.call(b, prop))
|
233
|
+
__defNormalProp$M(a, prop, b[prop]);
|
234
234
|
}
|
235
235
|
return a;
|
236
236
|
};
|
@@ -293,7 +293,7 @@ class SceneObjectBase {
|
|
293
293
|
}
|
294
294
|
setState(update) {
|
295
295
|
const prevState = this._state;
|
296
|
-
const newState = __spreadValues$
|
296
|
+
const newState = __spreadValues$M(__spreadValues$M({}, this._state), update);
|
297
297
|
this._state = Object.freeze(newState);
|
298
298
|
this._setParent(update);
|
299
299
|
this._handleActivationOfChangedStateProps(prevState, newState);
|
@@ -489,19 +489,19 @@ function forEachChild(state, callback) {
|
|
489
489
|
}
|
490
490
|
}
|
491
491
|
|
492
|
-
var __defProp$
|
493
|
-
var __getOwnPropSymbols$
|
494
|
-
var __hasOwnProp$
|
495
|
-
var __propIsEnum$
|
496
|
-
var __defNormalProp$
|
497
|
-
var __spreadValues$
|
492
|
+
var __defProp$L = Object.defineProperty;
|
493
|
+
var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
|
494
|
+
var __hasOwnProp$L = Object.prototype.hasOwnProperty;
|
495
|
+
var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
|
496
|
+
var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
497
|
+
var __spreadValues$L = (a, b) => {
|
498
498
|
for (var prop in b || (b = {}))
|
499
|
-
if (__hasOwnProp$
|
500
|
-
__defNormalProp$
|
501
|
-
if (__getOwnPropSymbols$
|
502
|
-
for (var prop of __getOwnPropSymbols$
|
503
|
-
if (__propIsEnum$
|
504
|
-
__defNormalProp$
|
499
|
+
if (__hasOwnProp$L.call(b, prop))
|
500
|
+
__defNormalProp$L(a, prop, b[prop]);
|
501
|
+
if (__getOwnPropSymbols$L)
|
502
|
+
for (var prop of __getOwnPropSymbols$L(b)) {
|
503
|
+
if (__propIsEnum$L.call(b, prop))
|
504
|
+
__defNormalProp$L(a, prop, b[prop]);
|
505
505
|
}
|
506
506
|
return a;
|
507
507
|
};
|
@@ -510,7 +510,7 @@ function cloneSceneObject(sceneObject, withState) {
|
|
510
510
|
return new sceneObject.constructor(clonedState);
|
511
511
|
}
|
512
512
|
function cloneSceneObjectState(sceneState, withState) {
|
513
|
-
const clonedState = __spreadValues$
|
513
|
+
const clonedState = __spreadValues$L({}, sceneState);
|
514
514
|
Object.assign(clonedState, withState);
|
515
515
|
for (const key in clonedState) {
|
516
516
|
if (withState && withState[key] !== void 0) {
|
@@ -611,6 +611,305 @@ function lookupVariable(name, sceneObject) {
|
|
611
611
|
return null;
|
612
612
|
}
|
613
613
|
|
614
|
+
function writeSceneLog(logger, message, ...rest) {
|
615
|
+
let loggingEnabled = false;
|
616
|
+
if (typeof window !== "undefined") {
|
617
|
+
loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
|
618
|
+
}
|
619
|
+
if (loggingEnabled) {
|
620
|
+
console.log(`${logger}: `, message, ...rest);
|
621
|
+
}
|
622
|
+
}
|
623
|
+
|
624
|
+
var __accessCheck$3 = (obj, member, msg) => {
|
625
|
+
if (!member.has(obj))
|
626
|
+
throw TypeError("Cannot " + msg);
|
627
|
+
};
|
628
|
+
var __privateGet$3 = (obj, member, getter) => {
|
629
|
+
__accessCheck$3(obj, member, "read from private field");
|
630
|
+
return getter ? getter.call(obj) : member.get(obj);
|
631
|
+
};
|
632
|
+
var __privateAdd$3 = (obj, member, value) => {
|
633
|
+
if (member.has(obj))
|
634
|
+
throw TypeError("Cannot add the same private member more than once");
|
635
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
636
|
+
};
|
637
|
+
var __privateSet$3 = (obj, member, value, setter) => {
|
638
|
+
__accessCheck$3(obj, member, "write to private field");
|
639
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
640
|
+
return value;
|
641
|
+
};
|
642
|
+
var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
|
643
|
+
const POST_STORM_WINDOW = 2e3;
|
644
|
+
const SPAN_THRESHOLD = 30;
|
645
|
+
class SceneRenderProfiler {
|
646
|
+
constructor(queryController) {
|
647
|
+
this.queryController = queryController;
|
648
|
+
__privateAdd$3(this, _profileInProgress, null);
|
649
|
+
__privateAdd$3(this, _profileStartTs, null);
|
650
|
+
__privateAdd$3(this, _trailAnimationFrameId, null);
|
651
|
+
__privateAdd$3(this, _recordedTrailingSpans, []);
|
652
|
+
this.lastFrameTime = 0;
|
653
|
+
this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
|
654
|
+
const currentFrameTime = performance.now();
|
655
|
+
const frameLength = currentFrameTime - lastFrameTime;
|
656
|
+
__privateGet$3(this, _recordedTrailingSpans).push(frameLength);
|
657
|
+
if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
|
658
|
+
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
659
|
+
() => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
|
660
|
+
));
|
661
|
+
} else {
|
662
|
+
const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
|
663
|
+
const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
|
664
|
+
writeSceneLog(
|
665
|
+
this.constructor.name,
|
666
|
+
"Profile tail recorded, slow frames duration:",
|
667
|
+
slowFramesTime,
|
668
|
+
slowFrames,
|
669
|
+
__privateGet$3(this, _profileInProgress)
|
670
|
+
);
|
671
|
+
__privateSet$3(this, _recordedTrailingSpans, []);
|
672
|
+
const profileDuration = measurementStartTs - profileStartTs;
|
673
|
+
writeSceneLog(
|
674
|
+
this.constructor.name,
|
675
|
+
"Stoped recording, total measured time (network included):",
|
676
|
+
profileDuration + slowFramesTime
|
677
|
+
);
|
678
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
679
|
+
const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
|
680
|
+
performance.measure("DashboardInteraction", {
|
681
|
+
start: profileStartTs,
|
682
|
+
end: profileEndTs
|
683
|
+
});
|
684
|
+
const networkDuration = captureNetwork(profileStartTs, profileEndTs);
|
685
|
+
if (this.queryController.state.onProfileComplete) {
|
686
|
+
this.queryController.state.onProfileComplete({
|
687
|
+
origin: __privateGet$3(this, _profileInProgress).origin,
|
688
|
+
crumbs: __privateGet$3(this, _profileInProgress).crumbs,
|
689
|
+
duration: profileDuration + slowFramesTime,
|
690
|
+
networkDuration,
|
691
|
+
jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
|
692
|
+
usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
|
693
|
+
totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
|
694
|
+
});
|
695
|
+
}
|
696
|
+
if (window.__runs) {
|
697
|
+
window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
|
698
|
+
`;
|
699
|
+
} else {
|
700
|
+
window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
|
701
|
+
`;
|
702
|
+
}
|
703
|
+
}
|
704
|
+
};
|
705
|
+
}
|
706
|
+
startProfile(name) {
|
707
|
+
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
708
|
+
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
709
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
710
|
+
writeSceneLog(this.constructor.name, "New profile: Stopped recording frames");
|
711
|
+
}
|
712
|
+
__privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
|
713
|
+
__privateSet$3(this, _profileStartTs, performance.now());
|
714
|
+
writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
|
715
|
+
}
|
716
|
+
recordProfileTail(measurementStartTime, profileStartTs) {
|
717
|
+
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
718
|
+
() => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
|
719
|
+
));
|
720
|
+
}
|
721
|
+
tryCompletingProfile() {
|
722
|
+
writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
|
723
|
+
if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
|
724
|
+
writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
|
725
|
+
this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
|
726
|
+
}
|
727
|
+
}
|
728
|
+
isTailRecording() {
|
729
|
+
return Boolean(__privateGet$3(this, _trailAnimationFrameId));
|
730
|
+
}
|
731
|
+
cancelTailRecording() {
|
732
|
+
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
733
|
+
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
734
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
735
|
+
writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
|
736
|
+
}
|
737
|
+
}
|
738
|
+
addCrumb(crumb) {
|
739
|
+
if (__privateGet$3(this, _profileInProgress)) {
|
740
|
+
__privateGet$3(this, _profileInProgress).crumbs.push(crumb);
|
741
|
+
}
|
742
|
+
}
|
743
|
+
}
|
744
|
+
_profileInProgress = new WeakMap();
|
745
|
+
_profileStartTs = new WeakMap();
|
746
|
+
_trailAnimationFrameId = new WeakMap();
|
747
|
+
_recordedTrailingSpans = new WeakMap();
|
748
|
+
function processRecordedSpans(spans) {
|
749
|
+
for (let i = spans.length - 1; i >= 0; i--) {
|
750
|
+
if (spans[i] > SPAN_THRESHOLD) {
|
751
|
+
return spans.slice(0, i + 1);
|
752
|
+
}
|
753
|
+
}
|
754
|
+
return [spans[0]];
|
755
|
+
}
|
756
|
+
function captureNetwork(startTs, endTs) {
|
757
|
+
const entries = performance.getEntriesByType("resource");
|
758
|
+
performance.clearResourceTimings();
|
759
|
+
const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
|
760
|
+
for (const entry of networkEntries) {
|
761
|
+
performance.measure("Network entry " + entry.name, {
|
762
|
+
start: entry.startTime,
|
763
|
+
end: entry.responseEnd
|
764
|
+
});
|
765
|
+
}
|
766
|
+
return calculateNetworkTime(networkEntries);
|
767
|
+
}
|
768
|
+
function calculateNetworkTime(requests) {
|
769
|
+
if (requests.length === 0) {
|
770
|
+
return 0;
|
771
|
+
}
|
772
|
+
requests.sort((a, b) => a.startTime - b.startTime);
|
773
|
+
let totalNetworkTime = 0;
|
774
|
+
let currentStart = requests[0].startTime;
|
775
|
+
let currentEnd = requests[0].responseEnd;
|
776
|
+
for (let i = 1; i < requests.length; i++) {
|
777
|
+
if (requests[i].startTime <= currentEnd) {
|
778
|
+
currentEnd = Math.max(currentEnd, requests[i].responseEnd);
|
779
|
+
} else {
|
780
|
+
totalNetworkTime += currentEnd - currentStart;
|
781
|
+
currentStart = requests[i].startTime;
|
782
|
+
currentEnd = requests[i].responseEnd;
|
783
|
+
}
|
784
|
+
}
|
785
|
+
totalNetworkTime += currentEnd - currentStart;
|
786
|
+
return totalNetworkTime;
|
787
|
+
}
|
788
|
+
|
789
|
+
var __defProp$K = Object.defineProperty;
|
790
|
+
var __defProps$u = Object.defineProperties;
|
791
|
+
var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
|
792
|
+
var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
|
793
|
+
var __hasOwnProp$K = Object.prototype.hasOwnProperty;
|
794
|
+
var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
|
795
|
+
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
796
|
+
var __spreadValues$K = (a, b) => {
|
797
|
+
for (var prop in b || (b = {}))
|
798
|
+
if (__hasOwnProp$K.call(b, prop))
|
799
|
+
__defNormalProp$K(a, prop, b[prop]);
|
800
|
+
if (__getOwnPropSymbols$K)
|
801
|
+
for (var prop of __getOwnPropSymbols$K(b)) {
|
802
|
+
if (__propIsEnum$K.call(b, prop))
|
803
|
+
__defNormalProp$K(a, prop, b[prop]);
|
804
|
+
}
|
805
|
+
return a;
|
806
|
+
};
|
807
|
+
var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(b));
|
808
|
+
var __accessCheck$2 = (obj, member, msg) => {
|
809
|
+
if (!member.has(obj))
|
810
|
+
throw TypeError("Cannot " + msg);
|
811
|
+
};
|
812
|
+
var __privateGet$2 = (obj, member, getter) => {
|
813
|
+
__accessCheck$2(obj, member, "read from private field");
|
814
|
+
return getter ? getter.call(obj) : member.get(obj);
|
815
|
+
};
|
816
|
+
var __privateAdd$2 = (obj, member, value) => {
|
817
|
+
if (member.has(obj))
|
818
|
+
throw TypeError("Cannot add the same private member more than once");
|
819
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
820
|
+
};
|
821
|
+
var __privateSet$2 = (obj, member, value, setter) => {
|
822
|
+
__accessCheck$2(obj, member, "write to private field");
|
823
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
824
|
+
return value;
|
825
|
+
};
|
826
|
+
var _running, _tryCompleteProfileFrameId;
|
827
|
+
function isQueryController(s) {
|
828
|
+
return "isQueryController" in s;
|
829
|
+
}
|
830
|
+
class SceneQueryController extends SceneObjectBase {
|
831
|
+
constructor(state = {}) {
|
832
|
+
super(__spreadProps$u(__spreadValues$K({}, state), { isRunning: false }));
|
833
|
+
this.isQueryController = true;
|
834
|
+
this.profiler = new SceneRenderProfiler(this);
|
835
|
+
__privateAdd$2(this, _running, /* @__PURE__ */ new Set());
|
836
|
+
__privateAdd$2(this, _tryCompleteProfileFrameId, null);
|
837
|
+
this.runningQueriesCount = () => {
|
838
|
+
return __privateGet$2(this, _running).size;
|
839
|
+
};
|
840
|
+
this.addActivationHandler(() => {
|
841
|
+
return () => __privateGet$2(this, _running).clear();
|
842
|
+
});
|
843
|
+
}
|
844
|
+
startProfile(source) {
|
845
|
+
if (!this.state.enableProfiling) {
|
846
|
+
return;
|
847
|
+
}
|
848
|
+
this.profiler.startProfile(source.constructor.name);
|
849
|
+
}
|
850
|
+
queryStarted(entry) {
|
851
|
+
__privateGet$2(this, _running).add(entry);
|
852
|
+
this.changeRunningQueryCount(1, entry);
|
853
|
+
if (!this.state.isRunning) {
|
854
|
+
this.setState({ isRunning: true });
|
855
|
+
}
|
856
|
+
}
|
857
|
+
queryCompleted(entry) {
|
858
|
+
if (!__privateGet$2(this, _running).has(entry)) {
|
859
|
+
return;
|
860
|
+
}
|
861
|
+
__privateGet$2(this, _running).delete(entry);
|
862
|
+
this.changeRunningQueryCount(-1);
|
863
|
+
if (__privateGet$2(this, _running).size === 0) {
|
864
|
+
this.setState({ isRunning: false });
|
865
|
+
}
|
866
|
+
}
|
867
|
+
changeRunningQueryCount(dir, entry) {
|
868
|
+
var _a;
|
869
|
+
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
870
|
+
if (dir === 1 && this.state.enableProfiling) {
|
871
|
+
if (entry) {
|
872
|
+
this.profiler.addCrumb(`${entry.origin.constructor.name}/${entry.type}`);
|
873
|
+
}
|
874
|
+
if (this.profiler.isTailRecording()) {
|
875
|
+
writeSceneLog(this.constructor.name, "New query started, cancelling tail recording");
|
876
|
+
this.profiler.cancelTailRecording();
|
877
|
+
}
|
878
|
+
}
|
879
|
+
if (this.state.enableProfiling) {
|
880
|
+
if (__privateGet$2(this, _tryCompleteProfileFrameId)) {
|
881
|
+
cancelAnimationFrame(__privateGet$2(this, _tryCompleteProfileFrameId));
|
882
|
+
}
|
883
|
+
__privateSet$2(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
|
884
|
+
this.profiler.tryCompletingProfile();
|
885
|
+
}));
|
886
|
+
}
|
887
|
+
}
|
888
|
+
cancelAll() {
|
889
|
+
var _a;
|
890
|
+
for (const entry of __privateGet$2(this, _running).values()) {
|
891
|
+
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
892
|
+
}
|
893
|
+
}
|
894
|
+
}
|
895
|
+
_running = new WeakMap();
|
896
|
+
_tryCompleteProfileFrameId = new WeakMap();
|
897
|
+
|
898
|
+
function getQueryController(sceneObject) {
|
899
|
+
let parent = sceneObject;
|
900
|
+
while (parent) {
|
901
|
+
if (parent.state.$behaviors) {
|
902
|
+
for (const behavior of parent.state.$behaviors) {
|
903
|
+
if (isQueryController(behavior)) {
|
904
|
+
return behavior;
|
905
|
+
}
|
906
|
+
}
|
907
|
+
}
|
908
|
+
parent = parent.parent;
|
909
|
+
}
|
910
|
+
return void 0;
|
911
|
+
}
|
912
|
+
|
614
913
|
var __defProp$J = Object.defineProperty;
|
615
914
|
var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
|
616
915
|
var __hasOwnProp$J = Object.prototype.hasOwnProperty;
|
@@ -787,6 +1086,8 @@ class SceneTimeRange extends SceneObjectBase {
|
|
787
1086
|
this.state.UNSAFE_nowDelay
|
788
1087
|
);
|
789
1088
|
if (update.from !== this.state.from || update.to !== this.state.to) {
|
1089
|
+
const queryController = getQueryController(this);
|
1090
|
+
queryController == null ? void 0 : queryController.startProfile(this);
|
790
1091
|
this._urlSync.performBrowserHistoryAction(() => {
|
791
1092
|
this.setState(update);
|
792
1093
|
});
|
@@ -2131,70 +2432,56 @@ function isDataLayer(obj) {
|
|
2131
2432
|
return "isDataLayer" in obj;
|
2132
2433
|
}
|
2133
2434
|
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
__accessCheck$2(obj, member, "read from private field");
|
2140
|
-
return getter ? getter.call(obj) : member.get(obj);
|
2141
|
-
};
|
2142
|
-
var __privateAdd$2 = (obj, member, value) => {
|
2143
|
-
if (member.has(obj))
|
2144
|
-
throw TypeError("Cannot add the same private member more than once");
|
2145
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2146
|
-
};
|
2147
|
-
var _running;
|
2148
|
-
function isQueryController(s) {
|
2149
|
-
return "isQueryController" in s;
|
2150
|
-
}
|
2151
|
-
class SceneQueryController extends SceneObjectBase {
|
2152
|
-
constructor() {
|
2153
|
-
super({ isRunning: false });
|
2154
|
-
this.isQueryController = true;
|
2155
|
-
__privateAdd$2(this, _running, /* @__PURE__ */ new Set());
|
2156
|
-
this.addActivationHandler(() => {
|
2157
|
-
return () => __privateGet$2(this, _running).clear();
|
2158
|
-
});
|
2159
|
-
}
|
2160
|
-
queryStarted(entry) {
|
2161
|
-
__privateGet$2(this, _running).add(entry);
|
2162
|
-
this.changeRunningQueryCount(1);
|
2163
|
-
if (!this.state.isRunning) {
|
2164
|
-
this.setState({ isRunning: true });
|
2165
|
-
}
|
2166
|
-
}
|
2167
|
-
queryCompleted(entry) {
|
2168
|
-
if (!__privateGet$2(this, _running).has(entry)) {
|
2169
|
-
return;
|
2170
|
-
}
|
2171
|
-
__privateGet$2(this, _running).delete(entry);
|
2172
|
-
this.changeRunningQueryCount(-1);
|
2173
|
-
if (__privateGet$2(this, _running).size === 0) {
|
2174
|
-
this.setState({ isRunning: false });
|
2175
|
-
}
|
2176
|
-
}
|
2177
|
-
changeRunningQueryCount(dir) {
|
2178
|
-
var _a;
|
2179
|
-
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
2180
|
-
}
|
2181
|
-
cancelAll() {
|
2182
|
-
var _a;
|
2183
|
-
for (const entry of __privateGet$2(this, _running).values()) {
|
2184
|
-
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
2435
|
+
function registerQueryWithController(entry) {
|
2436
|
+
return (queryStream) => {
|
2437
|
+
const queryControler = sceneGraph.getQueryController(entry.origin);
|
2438
|
+
if (!queryControler) {
|
2439
|
+
return queryStream;
|
2185
2440
|
}
|
2186
|
-
|
2441
|
+
return new rxjs.Observable((observer) => {
|
2442
|
+
if (!entry.cancel) {
|
2443
|
+
entry.cancel = () => observer.complete();
|
2444
|
+
}
|
2445
|
+
queryControler.queryStarted(entry);
|
2446
|
+
let markedAsCompleted = false;
|
2447
|
+
const sub = queryStream.subscribe({
|
2448
|
+
next: (v) => {
|
2449
|
+
if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
|
2450
|
+
markedAsCompleted = true;
|
2451
|
+
queryControler.queryCompleted(entry);
|
2452
|
+
}
|
2453
|
+
observer.next(v);
|
2454
|
+
},
|
2455
|
+
error: (e) => observer.error(e),
|
2456
|
+
complete: () => {
|
2457
|
+
observer.complete();
|
2458
|
+
}
|
2459
|
+
});
|
2460
|
+
return () => {
|
2461
|
+
sub.unsubscribe();
|
2462
|
+
if (!markedAsCompleted) {
|
2463
|
+
queryControler.queryCompleted(entry);
|
2464
|
+
}
|
2465
|
+
};
|
2466
|
+
});
|
2467
|
+
};
|
2187
2468
|
}
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
|
2193
|
-
|
2194
|
-
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2469
|
+
function wrapPromiseInStateObservable(promise) {
|
2470
|
+
console.log("wrapPromiseInStateObservable", promise);
|
2471
|
+
return new rxjs.Observable((observer) => {
|
2472
|
+
observer.next({ state: schema.LoadingState.Loading });
|
2473
|
+
const promiseObservable = rxjs.from(promise);
|
2474
|
+
promiseObservable.pipe(
|
2475
|
+
rxjs.map(() => ({ state: schema.LoadingState.Done })),
|
2476
|
+
rxjs.catchError(() => {
|
2477
|
+
observer.next({ state: schema.LoadingState.Error });
|
2478
|
+
return [];
|
2479
|
+
})
|
2480
|
+
).subscribe({
|
2481
|
+
next: (result) => observer.next(result),
|
2482
|
+
complete: () => observer.complete()
|
2483
|
+
});
|
2484
|
+
});
|
2198
2485
|
}
|
2199
2486
|
|
2200
2487
|
async function getDataSource(datasource, scopedVars) {
|
@@ -2207,7 +2494,21 @@ async function getDataSource(datasource, scopedVars) {
|
|
2207
2494
|
if (datasource && datasource.query) {
|
2208
2495
|
return datasource;
|
2209
2496
|
}
|
2210
|
-
|
2497
|
+
const dsPromise = runtime.getDataSourceSrv().get(datasource, scopedVars);
|
2498
|
+
if (scopedVars.__sceneObject && scopedVars.__sceneObject.value.valueOf()) {
|
2499
|
+
const queryControler = sceneGraph.getQueryController(scopedVars.__sceneObject.value.valueOf());
|
2500
|
+
if (queryControler && queryControler.state.enableProfiling) {
|
2501
|
+
wrapPromiseInStateObservable(dsPromise).pipe(
|
2502
|
+
registerQueryWithController({
|
2503
|
+
type: "plugin",
|
2504
|
+
origin: scopedVars.__sceneObject.value.valueOf()
|
2505
|
+
})
|
2506
|
+
).subscribe(() => {
|
2507
|
+
});
|
2508
|
+
}
|
2509
|
+
}
|
2510
|
+
const result = await dsPromise;
|
2511
|
+
return result;
|
2211
2512
|
}
|
2212
2513
|
|
2213
2514
|
class VariableValueRecorder {
|
@@ -2455,41 +2756,6 @@ function findActiveAdHocFilterVariableByUid(dsUid) {
|
|
2455
2756
|
return void 0;
|
2456
2757
|
}
|
2457
2758
|
|
2458
|
-
function registerQueryWithController(entry) {
|
2459
|
-
return (queryStream) => {
|
2460
|
-
const queryControler = sceneGraph.getQueryController(entry.origin);
|
2461
|
-
if (!queryControler) {
|
2462
|
-
return queryStream;
|
2463
|
-
}
|
2464
|
-
return new rxjs.Observable((observer) => {
|
2465
|
-
if (!entry.cancel) {
|
2466
|
-
entry.cancel = () => observer.complete();
|
2467
|
-
}
|
2468
|
-
queryControler.queryStarted(entry);
|
2469
|
-
let markedAsCompleted = false;
|
2470
|
-
const sub = queryStream.subscribe({
|
2471
|
-
next: (v) => {
|
2472
|
-
if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
|
2473
|
-
markedAsCompleted = true;
|
2474
|
-
queryControler.queryCompleted(entry);
|
2475
|
-
}
|
2476
|
-
observer.next(v);
|
2477
|
-
},
|
2478
|
-
error: (e) => observer.error(e),
|
2479
|
-
complete: () => {
|
2480
|
-
observer.complete();
|
2481
|
-
}
|
2482
|
-
});
|
2483
|
-
return () => {
|
2484
|
-
sub.unsubscribe();
|
2485
|
-
if (!markedAsCompleted) {
|
2486
|
-
queryControler.queryCompleted(entry);
|
2487
|
-
}
|
2488
|
-
};
|
2489
|
-
});
|
2490
|
-
};
|
2491
|
-
}
|
2492
|
-
|
2493
2759
|
const allActiveGroupByVariables = /* @__PURE__ */ new Set();
|
2494
2760
|
function findActiveGroupByVariablesByUid(dsUid) {
|
2495
2761
|
var _a;
|
@@ -2598,6 +2864,7 @@ function VariableValueSelect({ model }) {
|
|
2598
2864
|
const [inputValue, setInputValue] = React.useState("");
|
2599
2865
|
const [hasCustomValue, setHasCustomValue] = React.useState(false);
|
2600
2866
|
const selectValue = toSelectableValue$2(value, String(text));
|
2867
|
+
const queryController = sceneGraph.getQueryController(model);
|
2601
2868
|
const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
|
2602
2869
|
const onInputChange = (value2, { action }) => {
|
2603
2870
|
if (action === "input-change") {
|
@@ -2637,6 +2904,7 @@ function VariableValueSelect({ model }) {
|
|
2637
2904
|
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
|
2638
2905
|
onChange: (newValue) => {
|
2639
2906
|
model.changeValueTo(newValue.value, newValue.label);
|
2907
|
+
queryController == null ? void 0 : queryController.startProfile(model);
|
2640
2908
|
if (hasCustomValue !== newValue.__isNew__) {
|
2641
2909
|
setHasCustomValue(newValue.__isNew__);
|
2642
2910
|
}
|
@@ -2648,6 +2916,7 @@ function VariableValueSelectMulti({ model }) {
|
|
2648
2916
|
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
2649
2917
|
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
2650
2918
|
const [inputValue, setInputValue] = React.useState("");
|
2919
|
+
const queryController = sceneGraph.getQueryController(model);
|
2651
2920
|
const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
|
2652
2921
|
React.useEffect(() => {
|
2653
2922
|
setUncommittedValue(arrayValue);
|
@@ -2693,6 +2962,7 @@ function VariableValueSelectMulti({ model }) {
|
|
2693
2962
|
onInputChange,
|
2694
2963
|
onBlur: () => {
|
2695
2964
|
model.changeValueTo(uncommittedValue);
|
2965
|
+
queryController == null ? void 0 : queryController.startProfile(model);
|
2696
2966
|
},
|
2697
2967
|
filterOption: filterNoOp$2,
|
2698
2968
|
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
|
@@ -3305,10 +3575,12 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
3305
3575
|
const [isOperatorOpen, setIsOperatorOpen] = React.useState(false);
|
3306
3576
|
const [valueInputValue, setValueInputValue] = React.useState("");
|
3307
3577
|
const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
|
3308
|
-
const [uncommittedValue, setUncommittedValue] = React.useState(
|
3309
|
-
|
3310
|
-
|
3311
|
-
|
3578
|
+
const [uncommittedValue, setUncommittedValue] = React.useState(
|
3579
|
+
filter.values ? filter.values.map((value, index) => {
|
3580
|
+
var _a2;
|
3581
|
+
return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
|
3582
|
+
}) : []
|
3583
|
+
);
|
3312
3584
|
const isMultiValue = isMultiValueOperator(filter.operator);
|
3313
3585
|
const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
|
3314
3586
|
const valueValue = keyLabelToOption(filter.value, (_a = filter.valueLabels) == null ? void 0 : _a[0]);
|
@@ -3331,10 +3603,12 @@ function AdHocFilterRenderer({ filter, model }) {
|
|
3331
3603
|
setUncommittedValue([]);
|
3332
3604
|
} else if (!isMultiValueOperator(existingOperator) && isMultiValueOperator(newOperator) && filter.value) {
|
3333
3605
|
update.values = [filter.value];
|
3334
|
-
setUncommittedValue([
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3606
|
+
setUncommittedValue([
|
3607
|
+
{
|
3608
|
+
value: filter.value,
|
3609
|
+
label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
|
3610
|
+
}
|
3611
|
+
]);
|
3338
3612
|
}
|
3339
3613
|
model._updateFilter(filter, update);
|
3340
3614
|
};
|
@@ -3613,10 +3887,7 @@ function deserializeUrlToFilters(value) {
|
|
3613
3887
|
}
|
3614
3888
|
function toArray(filter) {
|
3615
3889
|
var _a;
|
3616
|
-
const result = [
|
3617
|
-
toUrlCommaDelimitedString(filter.key, filter.keyLabel),
|
3618
|
-
filter.operator
|
3619
|
-
];
|
3890
|
+
const result = [toUrlCommaDelimitedString(filter.key, filter.keyLabel), filter.operator];
|
3620
3891
|
if (isMultiValueOperator(filter.operator)) {
|
3621
3892
|
filter.values.forEach((value, index) => {
|
3622
3893
|
var _a2;
|
@@ -5223,9 +5494,7 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
5223
5494
|
})
|
5224
5495
|
);
|
5225
5496
|
}
|
5226
|
-
this.subscribeToTimeRangeChanges(
|
5227
|
-
timeRange
|
5228
|
-
);
|
5497
|
+
this.subscribeToTimeRangeChanges(timeRange);
|
5229
5498
|
if (this.shouldRunQueriesOnActivate()) {
|
5230
5499
|
this.runQueries();
|
5231
5500
|
}
|
@@ -6477,30 +6746,6 @@ function findDescendents(scene, descendentType) {
|
|
6477
6746
|
const targetScenes = findAllObjects(scene, isDescendentType);
|
6478
6747
|
return targetScenes.filter(isDescendentType);
|
6479
6748
|
}
|
6480
|
-
function getQueryController(sceneObject) {
|
6481
|
-
let parent = sceneObject;
|
6482
|
-
while (parent) {
|
6483
|
-
if (parent.state.$behaviors) {
|
6484
|
-
for (const behavior of parent.state.$behaviors) {
|
6485
|
-
if (isQueryController(behavior)) {
|
6486
|
-
return behavior;
|
6487
|
-
}
|
6488
|
-
}
|
6489
|
-
}
|
6490
|
-
parent = parent.parent;
|
6491
|
-
}
|
6492
|
-
return void 0;
|
6493
|
-
}
|
6494
|
-
function getUrlSyncManager(sceneObject) {
|
6495
|
-
let parent = sceneObject;
|
6496
|
-
while (parent) {
|
6497
|
-
if ("urlSyncManager" in parent.state) {
|
6498
|
-
return parent.state.urlSyncManager;
|
6499
|
-
}
|
6500
|
-
parent = parent.parent;
|
6501
|
-
}
|
6502
|
-
return void 0;
|
6503
|
-
}
|
6504
6749
|
|
6505
6750
|
const sceneGraph = {
|
6506
6751
|
getVariables,
|
@@ -6516,9 +6761,8 @@ const sceneGraph = {
|
|
6516
6761
|
findObject,
|
6517
6762
|
findAllObjects,
|
6518
6763
|
getAncestor,
|
6519
|
-
findDescendents,
|
6520
6764
|
getQueryController,
|
6521
|
-
|
6765
|
+
findDescendents
|
6522
6766
|
};
|
6523
6767
|
|
6524
6768
|
class UniqueUrlKeyMapper {
|
@@ -7390,7 +7634,13 @@ class VizPanel extends SceneObjectBase {
|
|
7390
7634
|
} else {
|
7391
7635
|
const { importPanelPlugin } = runtime.getPluginImportUtils();
|
7392
7636
|
try {
|
7393
|
-
const
|
7637
|
+
const panelPromise = importPanelPlugin(pluginId);
|
7638
|
+
const queryControler = sceneGraph.getQueryController(this);
|
7639
|
+
if (queryControler && queryControler.state.enableProfiling) {
|
7640
|
+
wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: "plugin", origin: this })).subscribe(() => {
|
7641
|
+
});
|
7642
|
+
}
|
7643
|
+
const result = await panelPromise;
|
7394
7644
|
this._pluginLoaded(result, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);
|
7395
7645
|
} catch (err) {
|
7396
7646
|
this._pluginLoaded(getPanelPluginNotFound(pluginId));
|
@@ -7459,11 +7709,7 @@ class VizPanel extends SceneObjectBase {
|
|
7459
7709
|
}
|
7460
7710
|
async changePluginType(pluginId, newOptions, newFieldConfig) {
|
7461
7711
|
var _a, _b;
|
7462
|
-
const {
|
7463
|
-
options: prevOptions,
|
7464
|
-
fieldConfig: prevFieldConfig,
|
7465
|
-
pluginId: prevPluginId
|
7466
|
-
} = this.state;
|
7712
|
+
const { options: prevOptions, fieldConfig: prevFieldConfig, pluginId: prevPluginId } = this.state;
|
7467
7713
|
this._dataWithFieldConfig = void 0;
|
7468
7714
|
const isAfterPluginChange = this.state.pluginId !== pluginId;
|
7469
7715
|
await this._loadPlugin(pluginId, newOptions != null ? newOptions : {}, newFieldConfig, isAfterPluginChange);
|
@@ -10937,6 +11183,7 @@ class SceneRefreshPicker extends SceneObjectBase {
|
|
10937
11183
|
this._autoRefreshBlocked = false;
|
10938
11184
|
this.onRefresh = () => {
|
10939
11185
|
const queryController = sceneGraph.getQueryController(this);
|
11186
|
+
queryController == null ? void 0 : queryController.startProfile(this);
|
10940
11187
|
if (queryController == null ? void 0 : queryController.state.isRunning) {
|
10941
11188
|
queryController.cancelAll();
|
10942
11189
|
return;
|
@@ -11065,7 +11312,9 @@ function SceneRefreshPickerRenderer({ model }) {
|
|
11065
11312
|
tooltip,
|
11066
11313
|
width,
|
11067
11314
|
text,
|
11068
|
-
onRefresh:
|
11315
|
+
onRefresh: () => {
|
11316
|
+
model.onRefresh();
|
11317
|
+
},
|
11069
11318
|
primary,
|
11070
11319
|
onIntervalChanged: model.onIntervalChanged,
|
11071
11320
|
isLoading: isRunning,
|