@grafana/scenes 5.36.3 → 5.36.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- 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 +6 -1
- package/dist/esm/components/SceneRefreshPicker.js.map +1 -1
- package/dist/esm/components/VizPanel/VizPanel.js +8 -1
- 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/registerQueryWithController.js +18 -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/components/VariableValueSelect.js +5 -0
- package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
- package/dist/esm/variables/variants/MultiValueVariable.js +2 -2
- 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 +45 -33
- package/dist/index.js +467 -212
- 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$R = Object.defineProperty;
|
|
45
|
+
var __getOwnPropSymbols$R = Object.getOwnPropertySymbols;
|
|
46
|
+
var __hasOwnProp$R = Object.prototype.hasOwnProperty;
|
|
47
|
+
var __propIsEnum$R = Object.prototype.propertyIsEnumerable;
|
|
48
|
+
var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
49
|
+
var __spreadValues$R = (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$R.call(b, prop))
|
|
52
|
+
__defNormalProp$R(a, prop, b[prop]);
|
|
53
|
+
if (__getOwnPropSymbols$R)
|
|
54
|
+
for (var prop of __getOwnPropSymbols$R(b)) {
|
|
55
|
+
if (__propIsEnum$R.call(b, prop))
|
|
56
|
+
__defNormalProp$R(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$R({}, 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$Q = Object.defineProperty;
|
|
80
|
+
var __defProps$y = Object.defineProperties;
|
|
81
|
+
var __getOwnPropDescs$y = Object.getOwnPropertyDescriptors;
|
|
82
|
+
var __getOwnPropSymbols$Q = Object.getOwnPropertySymbols;
|
|
83
|
+
var __hasOwnProp$Q = Object.prototype.hasOwnProperty;
|
|
84
|
+
var __propIsEnum$Q = Object.prototype.propertyIsEnumerable;
|
|
85
|
+
var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
86
|
+
var __spreadValues$Q = (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$Q.call(b, prop))
|
|
89
|
+
__defNormalProp$Q(a, prop, b[prop]);
|
|
90
|
+
if (__getOwnPropSymbols$Q)
|
|
91
|
+
for (var prop of __getOwnPropSymbols$Q(b)) {
|
|
92
|
+
if (__propIsEnum$Q.call(b, prop))
|
|
93
|
+
__defNormalProp$Q(a, prop, b[prop]);
|
|
94
94
|
}
|
|
95
95
|
return a;
|
|
96
96
|
};
|
|
97
|
-
var __spreadProps$
|
|
97
|
+
var __spreadProps$y = (a, b) => __defProps$y(a, __getOwnPropDescs$y(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$y(__spreadValues$Q({}, 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$P = Object.defineProperty;
|
|
132
|
+
var __defProps$x = Object.defineProperties;
|
|
133
|
+
var __getOwnPropDescs$x = Object.getOwnPropertyDescriptors;
|
|
134
|
+
var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
|
|
135
|
+
var __hasOwnProp$P = Object.prototype.hasOwnProperty;
|
|
136
|
+
var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
|
|
137
|
+
var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
138
|
+
var __spreadValues$P = (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$P.call(b, prop))
|
|
141
|
+
__defNormalProp$P(a, prop, b[prop]);
|
|
142
|
+
if (__getOwnPropSymbols$P)
|
|
143
|
+
for (var prop of __getOwnPropSymbols$P(b)) {
|
|
144
|
+
if (__propIsEnum$P.call(b, prop))
|
|
145
|
+
__defNormalProp$P(a, prop, b[prop]);
|
|
146
146
|
}
|
|
147
147
|
return a;
|
|
148
148
|
};
|
|
149
|
-
var __spreadProps$
|
|
149
|
+
var __spreadProps$x = (a, b) => __defProps$x(a, __getOwnPropDescs$x(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$P.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$P)
|
|
156
|
+
for (var prop of __getOwnPropSymbols$P(source)) {
|
|
157
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$P.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 && !model.renderBeforeActivation) {
|
|
173
173
|
return null;
|
|
174
174
|
}
|
|
175
|
-
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$
|
|
175
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$x(__spreadValues$P({}, 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$O = Object.defineProperty;
|
|
222
|
+
var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
|
|
223
|
+
var __hasOwnProp$O = Object.prototype.hasOwnProperty;
|
|
224
|
+
var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
|
|
225
|
+
var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
226
|
+
var __spreadValues$O = (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$O.call(b, prop))
|
|
229
|
+
__defNormalProp$O(a, prop, b[prop]);
|
|
230
|
+
if (__getOwnPropSymbols$O)
|
|
231
|
+
for (var prop of __getOwnPropSymbols$O(b)) {
|
|
232
|
+
if (__propIsEnum$O.call(b, prop))
|
|
233
|
+
__defNormalProp$O(a, prop, b[prop]);
|
|
234
234
|
}
|
|
235
235
|
return a;
|
|
236
236
|
};
|
|
@@ -297,7 +297,7 @@ class SceneObjectBase {
|
|
|
297
297
|
}
|
|
298
298
|
setState(update) {
|
|
299
299
|
const prevState = this._state;
|
|
300
|
-
const newState = __spreadValues$
|
|
300
|
+
const newState = __spreadValues$O(__spreadValues$O({}, this._state), update);
|
|
301
301
|
this._state = Object.freeze(newState);
|
|
302
302
|
this._setParent(update);
|
|
303
303
|
this._handleActivationOfChangedStateProps(prevState, newState);
|
|
@@ -493,19 +493,19 @@ function forEachChild(state, callback) {
|
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
-
var __defProp$
|
|
497
|
-
var __getOwnPropSymbols$
|
|
498
|
-
var __hasOwnProp$
|
|
499
|
-
var __propIsEnum$
|
|
500
|
-
var __defNormalProp$
|
|
501
|
-
var __spreadValues$
|
|
496
|
+
var __defProp$N = Object.defineProperty;
|
|
497
|
+
var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
|
|
498
|
+
var __hasOwnProp$N = Object.prototype.hasOwnProperty;
|
|
499
|
+
var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
|
|
500
|
+
var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
501
|
+
var __spreadValues$N = (a, b) => {
|
|
502
502
|
for (var prop in b || (b = {}))
|
|
503
|
-
if (__hasOwnProp$
|
|
504
|
-
__defNormalProp$
|
|
505
|
-
if (__getOwnPropSymbols$
|
|
506
|
-
for (var prop of __getOwnPropSymbols$
|
|
507
|
-
if (__propIsEnum$
|
|
508
|
-
__defNormalProp$
|
|
503
|
+
if (__hasOwnProp$N.call(b, prop))
|
|
504
|
+
__defNormalProp$N(a, prop, b[prop]);
|
|
505
|
+
if (__getOwnPropSymbols$N)
|
|
506
|
+
for (var prop of __getOwnPropSymbols$N(b)) {
|
|
507
|
+
if (__propIsEnum$N.call(b, prop))
|
|
508
|
+
__defNormalProp$N(a, prop, b[prop]);
|
|
509
509
|
}
|
|
510
510
|
return a;
|
|
511
511
|
};
|
|
@@ -514,7 +514,7 @@ function cloneSceneObject(sceneObject, withState) {
|
|
|
514
514
|
return new sceneObject.constructor(clonedState);
|
|
515
515
|
}
|
|
516
516
|
function cloneSceneObjectState(sceneState, withState) {
|
|
517
|
-
const clonedState = __spreadValues$
|
|
517
|
+
const clonedState = __spreadValues$N({}, sceneState);
|
|
518
518
|
Object.assign(clonedState, withState);
|
|
519
519
|
for (const key in clonedState) {
|
|
520
520
|
if (withState && withState[key] !== void 0) {
|
|
@@ -615,6 +615,305 @@ function lookupVariable(name, sceneObject) {
|
|
|
615
615
|
return null;
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
+
function writeSceneLog(logger, message, ...rest) {
|
|
619
|
+
let loggingEnabled = false;
|
|
620
|
+
if (typeof window !== "undefined") {
|
|
621
|
+
loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
|
|
622
|
+
}
|
|
623
|
+
if (loggingEnabled) {
|
|
624
|
+
console.log(`${logger}: `, message, ...rest);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
var __accessCheck$3 = (obj, member, msg) => {
|
|
629
|
+
if (!member.has(obj))
|
|
630
|
+
throw TypeError("Cannot " + msg);
|
|
631
|
+
};
|
|
632
|
+
var __privateGet$3 = (obj, member, getter) => {
|
|
633
|
+
__accessCheck$3(obj, member, "read from private field");
|
|
634
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
635
|
+
};
|
|
636
|
+
var __privateAdd$3 = (obj, member, value) => {
|
|
637
|
+
if (member.has(obj))
|
|
638
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
639
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
640
|
+
};
|
|
641
|
+
var __privateSet$3 = (obj, member, value, setter) => {
|
|
642
|
+
__accessCheck$3(obj, member, "write to private field");
|
|
643
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
644
|
+
return value;
|
|
645
|
+
};
|
|
646
|
+
var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
|
|
647
|
+
const POST_STORM_WINDOW = 2e3;
|
|
648
|
+
const SPAN_THRESHOLD = 30;
|
|
649
|
+
class SceneRenderProfiler {
|
|
650
|
+
constructor(queryController) {
|
|
651
|
+
this.queryController = queryController;
|
|
652
|
+
__privateAdd$3(this, _profileInProgress, null);
|
|
653
|
+
__privateAdd$3(this, _profileStartTs, null);
|
|
654
|
+
__privateAdd$3(this, _trailAnimationFrameId, null);
|
|
655
|
+
__privateAdd$3(this, _recordedTrailingSpans, []);
|
|
656
|
+
this.lastFrameTime = 0;
|
|
657
|
+
this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
|
|
658
|
+
const currentFrameTime = performance.now();
|
|
659
|
+
const frameLength = currentFrameTime - lastFrameTime;
|
|
660
|
+
__privateGet$3(this, _recordedTrailingSpans).push(frameLength);
|
|
661
|
+
if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
|
|
662
|
+
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
|
663
|
+
() => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
|
|
664
|
+
));
|
|
665
|
+
} else {
|
|
666
|
+
const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
|
|
667
|
+
const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
|
|
668
|
+
writeSceneLog(
|
|
669
|
+
this.constructor.name,
|
|
670
|
+
"Profile tail recorded, slow frames duration:",
|
|
671
|
+
slowFramesTime,
|
|
672
|
+
slowFrames,
|
|
673
|
+
__privateGet$3(this, _profileInProgress)
|
|
674
|
+
);
|
|
675
|
+
__privateSet$3(this, _recordedTrailingSpans, []);
|
|
676
|
+
const profileDuration = measurementStartTs - profileStartTs;
|
|
677
|
+
writeSceneLog(
|
|
678
|
+
this.constructor.name,
|
|
679
|
+
"Stoped recording, total measured time (network included):",
|
|
680
|
+
profileDuration + slowFramesTime
|
|
681
|
+
);
|
|
682
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
|
683
|
+
const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
|
|
684
|
+
performance.measure("DashboardInteraction", {
|
|
685
|
+
start: profileStartTs,
|
|
686
|
+
end: profileEndTs
|
|
687
|
+
});
|
|
688
|
+
const networkDuration = captureNetwork(profileStartTs, profileEndTs);
|
|
689
|
+
if (this.queryController.state.onProfileComplete) {
|
|
690
|
+
this.queryController.state.onProfileComplete({
|
|
691
|
+
origin: __privateGet$3(this, _profileInProgress).origin,
|
|
692
|
+
crumbs: __privateGet$3(this, _profileInProgress).crumbs,
|
|
693
|
+
duration: profileDuration + slowFramesTime,
|
|
694
|
+
networkDuration,
|
|
695
|
+
jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
|
|
696
|
+
usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
|
|
697
|
+
totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
if (window.__runs) {
|
|
701
|
+
window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
|
|
702
|
+
`;
|
|
703
|
+
} else {
|
|
704
|
+
window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
|
|
705
|
+
`;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
startProfile(name) {
|
|
711
|
+
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
|
712
|
+
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
|
713
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
|
714
|
+
writeSceneLog(this.constructor.name, "New profile: Stopped recording frames");
|
|
715
|
+
}
|
|
716
|
+
__privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
|
|
717
|
+
__privateSet$3(this, _profileStartTs, performance.now());
|
|
718
|
+
writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
|
|
719
|
+
}
|
|
720
|
+
recordProfileTail(measurementStartTime, profileStartTs) {
|
|
721
|
+
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
|
722
|
+
() => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
|
|
723
|
+
));
|
|
724
|
+
}
|
|
725
|
+
tryCompletingProfile() {
|
|
726
|
+
writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
|
|
727
|
+
if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
|
|
728
|
+
writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
|
|
729
|
+
this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
isTailRecording() {
|
|
733
|
+
return Boolean(__privateGet$3(this, _trailAnimationFrameId));
|
|
734
|
+
}
|
|
735
|
+
cancelTailRecording() {
|
|
736
|
+
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
|
737
|
+
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
|
738
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
|
739
|
+
writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
addCrumb(crumb) {
|
|
743
|
+
if (__privateGet$3(this, _profileInProgress)) {
|
|
744
|
+
__privateGet$3(this, _profileInProgress).crumbs.push(crumb);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
_profileInProgress = new WeakMap();
|
|
749
|
+
_profileStartTs = new WeakMap();
|
|
750
|
+
_trailAnimationFrameId = new WeakMap();
|
|
751
|
+
_recordedTrailingSpans = new WeakMap();
|
|
752
|
+
function processRecordedSpans(spans) {
|
|
753
|
+
for (let i = spans.length - 1; i >= 0; i--) {
|
|
754
|
+
if (spans[i] > SPAN_THRESHOLD) {
|
|
755
|
+
return spans.slice(0, i + 1);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return [spans[0]];
|
|
759
|
+
}
|
|
760
|
+
function captureNetwork(startTs, endTs) {
|
|
761
|
+
const entries = performance.getEntriesByType("resource");
|
|
762
|
+
performance.clearResourceTimings();
|
|
763
|
+
const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
|
|
764
|
+
for (const entry of networkEntries) {
|
|
765
|
+
performance.measure("Network entry " + entry.name, {
|
|
766
|
+
start: entry.startTime,
|
|
767
|
+
end: entry.responseEnd
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
return calculateNetworkTime(networkEntries);
|
|
771
|
+
}
|
|
772
|
+
function calculateNetworkTime(requests) {
|
|
773
|
+
if (requests.length === 0) {
|
|
774
|
+
return 0;
|
|
775
|
+
}
|
|
776
|
+
requests.sort((a, b) => a.startTime - b.startTime);
|
|
777
|
+
let totalNetworkTime = 0;
|
|
778
|
+
let currentStart = requests[0].startTime;
|
|
779
|
+
let currentEnd = requests[0].responseEnd;
|
|
780
|
+
for (let i = 1; i < requests.length; i++) {
|
|
781
|
+
if (requests[i].startTime <= currentEnd) {
|
|
782
|
+
currentEnd = Math.max(currentEnd, requests[i].responseEnd);
|
|
783
|
+
} else {
|
|
784
|
+
totalNetworkTime += currentEnd - currentStart;
|
|
785
|
+
currentStart = requests[i].startTime;
|
|
786
|
+
currentEnd = requests[i].responseEnd;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
totalNetworkTime += currentEnd - currentStart;
|
|
790
|
+
return totalNetworkTime;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
var __defProp$M = Object.defineProperty;
|
|
794
|
+
var __defProps$w = Object.defineProperties;
|
|
795
|
+
var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
|
|
796
|
+
var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
|
|
797
|
+
var __hasOwnProp$M = Object.prototype.hasOwnProperty;
|
|
798
|
+
var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
|
|
799
|
+
var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
800
|
+
var __spreadValues$M = (a, b) => {
|
|
801
|
+
for (var prop in b || (b = {}))
|
|
802
|
+
if (__hasOwnProp$M.call(b, prop))
|
|
803
|
+
__defNormalProp$M(a, prop, b[prop]);
|
|
804
|
+
if (__getOwnPropSymbols$M)
|
|
805
|
+
for (var prop of __getOwnPropSymbols$M(b)) {
|
|
806
|
+
if (__propIsEnum$M.call(b, prop))
|
|
807
|
+
__defNormalProp$M(a, prop, b[prop]);
|
|
808
|
+
}
|
|
809
|
+
return a;
|
|
810
|
+
};
|
|
811
|
+
var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
|
|
812
|
+
var __accessCheck$2 = (obj, member, msg) => {
|
|
813
|
+
if (!member.has(obj))
|
|
814
|
+
throw TypeError("Cannot " + msg);
|
|
815
|
+
};
|
|
816
|
+
var __privateGet$2 = (obj, member, getter) => {
|
|
817
|
+
__accessCheck$2(obj, member, "read from private field");
|
|
818
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
819
|
+
};
|
|
820
|
+
var __privateAdd$2 = (obj, member, value) => {
|
|
821
|
+
if (member.has(obj))
|
|
822
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
823
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
824
|
+
};
|
|
825
|
+
var __privateSet$2 = (obj, member, value, setter) => {
|
|
826
|
+
__accessCheck$2(obj, member, "write to private field");
|
|
827
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
828
|
+
return value;
|
|
829
|
+
};
|
|
830
|
+
var _running, _tryCompleteProfileFrameId;
|
|
831
|
+
function isQueryController(s) {
|
|
832
|
+
return "isQueryController" in s;
|
|
833
|
+
}
|
|
834
|
+
class SceneQueryController extends SceneObjectBase {
|
|
835
|
+
constructor(state = {}) {
|
|
836
|
+
super(__spreadProps$w(__spreadValues$M({}, state), { isRunning: false }));
|
|
837
|
+
this.isQueryController = true;
|
|
838
|
+
this.profiler = new SceneRenderProfiler(this);
|
|
839
|
+
__privateAdd$2(this, _running, /* @__PURE__ */ new Set());
|
|
840
|
+
__privateAdd$2(this, _tryCompleteProfileFrameId, null);
|
|
841
|
+
this.runningQueriesCount = () => {
|
|
842
|
+
return __privateGet$2(this, _running).size;
|
|
843
|
+
};
|
|
844
|
+
this.addActivationHandler(() => {
|
|
845
|
+
return () => __privateGet$2(this, _running).clear();
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
startProfile(source) {
|
|
849
|
+
if (!this.state.enableProfiling) {
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
this.profiler.startProfile(source.constructor.name);
|
|
853
|
+
}
|
|
854
|
+
queryStarted(entry) {
|
|
855
|
+
__privateGet$2(this, _running).add(entry);
|
|
856
|
+
this.changeRunningQueryCount(1, entry);
|
|
857
|
+
if (!this.state.isRunning) {
|
|
858
|
+
this.setState({ isRunning: true });
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
queryCompleted(entry) {
|
|
862
|
+
if (!__privateGet$2(this, _running).has(entry)) {
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
__privateGet$2(this, _running).delete(entry);
|
|
866
|
+
this.changeRunningQueryCount(-1);
|
|
867
|
+
if (__privateGet$2(this, _running).size === 0) {
|
|
868
|
+
this.setState({ isRunning: false });
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
changeRunningQueryCount(dir, entry) {
|
|
872
|
+
var _a;
|
|
873
|
+
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
|
874
|
+
if (dir === 1 && this.state.enableProfiling) {
|
|
875
|
+
if (entry) {
|
|
876
|
+
this.profiler.addCrumb(`${entry.origin.constructor.name}/${entry.type}`);
|
|
877
|
+
}
|
|
878
|
+
if (this.profiler.isTailRecording()) {
|
|
879
|
+
writeSceneLog(this.constructor.name, "New query started, cancelling tail recording");
|
|
880
|
+
this.profiler.cancelTailRecording();
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
if (this.state.enableProfiling) {
|
|
884
|
+
if (__privateGet$2(this, _tryCompleteProfileFrameId)) {
|
|
885
|
+
cancelAnimationFrame(__privateGet$2(this, _tryCompleteProfileFrameId));
|
|
886
|
+
}
|
|
887
|
+
__privateSet$2(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
|
|
888
|
+
this.profiler.tryCompletingProfile();
|
|
889
|
+
}));
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
cancelAll() {
|
|
893
|
+
var _a;
|
|
894
|
+
for (const entry of __privateGet$2(this, _running).values()) {
|
|
895
|
+
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
_running = new WeakMap();
|
|
900
|
+
_tryCompleteProfileFrameId = new WeakMap();
|
|
901
|
+
|
|
902
|
+
function getQueryController(sceneObject) {
|
|
903
|
+
let parent = sceneObject;
|
|
904
|
+
while (parent) {
|
|
905
|
+
if (parent.state.$behaviors) {
|
|
906
|
+
for (const behavior of parent.state.$behaviors) {
|
|
907
|
+
if (isQueryController(behavior)) {
|
|
908
|
+
return behavior;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
parent = parent.parent;
|
|
913
|
+
}
|
|
914
|
+
return void 0;
|
|
915
|
+
}
|
|
916
|
+
|
|
618
917
|
var __defProp$L = Object.defineProperty;
|
|
619
918
|
var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
|
|
620
919
|
var __hasOwnProp$L = Object.prototype.hasOwnProperty;
|
|
@@ -821,6 +1120,8 @@ class SceneTimeRange extends SceneObjectBase {
|
|
|
821
1120
|
this.state.weekStart
|
|
822
1121
|
);
|
|
823
1122
|
if (update.from !== this.state.from || update.to !== this.state.to) {
|
|
1123
|
+
const queryController = getQueryController(this);
|
|
1124
|
+
queryController == null ? void 0 : queryController.startProfile(this);
|
|
824
1125
|
this._urlSync.performBrowserHistoryAction(() => {
|
|
825
1126
|
this.setState(update);
|
|
826
1127
|
});
|
|
@@ -1624,12 +1925,12 @@ class MultiValueVariable extends SceneObjectBase {
|
|
|
1624
1925
|
setStateHelper(state) {
|
|
1625
1926
|
setBaseClassState(this, state);
|
|
1626
1927
|
}
|
|
1627
|
-
getOptionsForSelect() {
|
|
1928
|
+
getOptionsForSelect(includeCurrentValue = true) {
|
|
1628
1929
|
let options = this.state.options;
|
|
1629
1930
|
if (this.state.includeAll) {
|
|
1630
1931
|
options = [{ value: ALL_VARIABLE_VALUE, label: ALL_VARIABLE_TEXT }, ...options];
|
|
1631
1932
|
}
|
|
1632
|
-
if (!Array.isArray(this.state.value)) {
|
|
1933
|
+
if (includeCurrentValue && !Array.isArray(this.state.value)) {
|
|
1633
1934
|
const current = options.find((x) => x.value === this.state.value);
|
|
1634
1935
|
if (!current) {
|
|
1635
1936
|
options = [{ value: this.state.value, label: String(this.state.text) }, ...options];
|
|
@@ -2156,70 +2457,55 @@ function isDataLayer(obj) {
|
|
|
2156
2457
|
return "isDataLayer" in obj;
|
|
2157
2458
|
}
|
|
2158
2459
|
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
__accessCheck$2(obj, member, "read from private field");
|
|
2165
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
2166
|
-
};
|
|
2167
|
-
var __privateAdd$2 = (obj, member, value) => {
|
|
2168
|
-
if (member.has(obj))
|
|
2169
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
2170
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
2171
|
-
};
|
|
2172
|
-
var _running;
|
|
2173
|
-
function isQueryController(s) {
|
|
2174
|
-
return "isQueryController" in s;
|
|
2175
|
-
}
|
|
2176
|
-
class SceneQueryController extends SceneObjectBase {
|
|
2177
|
-
constructor() {
|
|
2178
|
-
super({ isRunning: false });
|
|
2179
|
-
this.isQueryController = true;
|
|
2180
|
-
__privateAdd$2(this, _running, /* @__PURE__ */ new Set());
|
|
2181
|
-
this.addActivationHandler(() => {
|
|
2182
|
-
return () => __privateGet$2(this, _running).clear();
|
|
2183
|
-
});
|
|
2184
|
-
}
|
|
2185
|
-
queryStarted(entry) {
|
|
2186
|
-
__privateGet$2(this, _running).add(entry);
|
|
2187
|
-
this.changeRunningQueryCount(1);
|
|
2188
|
-
if (!this.state.isRunning) {
|
|
2189
|
-
this.setState({ isRunning: true });
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
queryCompleted(entry) {
|
|
2193
|
-
if (!__privateGet$2(this, _running).has(entry)) {
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
2196
|
-
__privateGet$2(this, _running).delete(entry);
|
|
2197
|
-
this.changeRunningQueryCount(-1);
|
|
2198
|
-
if (__privateGet$2(this, _running).size === 0) {
|
|
2199
|
-
this.setState({ isRunning: false });
|
|
2200
|
-
}
|
|
2201
|
-
}
|
|
2202
|
-
changeRunningQueryCount(dir) {
|
|
2203
|
-
var _a;
|
|
2204
|
-
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
|
2205
|
-
}
|
|
2206
|
-
cancelAll() {
|
|
2207
|
-
var _a;
|
|
2208
|
-
for (const entry of __privateGet$2(this, _running).values()) {
|
|
2209
|
-
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
|
2460
|
+
function registerQueryWithController(entry) {
|
|
2461
|
+
return (queryStream) => {
|
|
2462
|
+
const queryControler = sceneGraph.getQueryController(entry.origin);
|
|
2463
|
+
if (!queryControler) {
|
|
2464
|
+
return queryStream;
|
|
2210
2465
|
}
|
|
2211
|
-
|
|
2466
|
+
return new rxjs.Observable((observer) => {
|
|
2467
|
+
if (!entry.cancel) {
|
|
2468
|
+
entry.cancel = () => observer.complete();
|
|
2469
|
+
}
|
|
2470
|
+
queryControler.queryStarted(entry);
|
|
2471
|
+
let markedAsCompleted = false;
|
|
2472
|
+
const sub = queryStream.subscribe({
|
|
2473
|
+
next: (v) => {
|
|
2474
|
+
if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
|
|
2475
|
+
markedAsCompleted = true;
|
|
2476
|
+
queryControler.queryCompleted(entry);
|
|
2477
|
+
}
|
|
2478
|
+
observer.next(v);
|
|
2479
|
+
},
|
|
2480
|
+
error: (e) => observer.error(e),
|
|
2481
|
+
complete: () => {
|
|
2482
|
+
observer.complete();
|
|
2483
|
+
}
|
|
2484
|
+
});
|
|
2485
|
+
return () => {
|
|
2486
|
+
sub.unsubscribe();
|
|
2487
|
+
if (!markedAsCompleted) {
|
|
2488
|
+
queryControler.queryCompleted(entry);
|
|
2489
|
+
}
|
|
2490
|
+
};
|
|
2491
|
+
});
|
|
2492
|
+
};
|
|
2212
2493
|
}
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2494
|
+
function wrapPromiseInStateObservable(promise) {
|
|
2495
|
+
return new rxjs.Observable((observer) => {
|
|
2496
|
+
observer.next({ state: schema.LoadingState.Loading });
|
|
2497
|
+
const promiseObservable = rxjs.from(promise);
|
|
2498
|
+
promiseObservable.pipe(
|
|
2499
|
+
rxjs.map(() => ({ state: schema.LoadingState.Done })),
|
|
2500
|
+
rxjs.catchError(() => {
|
|
2501
|
+
observer.next({ state: schema.LoadingState.Error });
|
|
2502
|
+
return [];
|
|
2503
|
+
})
|
|
2504
|
+
).subscribe({
|
|
2505
|
+
next: (result) => observer.next(result),
|
|
2506
|
+
complete: () => observer.complete()
|
|
2507
|
+
});
|
|
2508
|
+
});
|
|
2223
2509
|
}
|
|
2224
2510
|
|
|
2225
2511
|
async function getDataSource(datasource, scopedVars) {
|
|
@@ -2232,7 +2518,21 @@ async function getDataSource(datasource, scopedVars) {
|
|
|
2232
2518
|
if (datasource && datasource.query) {
|
|
2233
2519
|
return datasource;
|
|
2234
2520
|
}
|
|
2235
|
-
|
|
2521
|
+
const dsPromise = runtime.getDataSourceSrv().get(datasource, scopedVars);
|
|
2522
|
+
if (scopedVars.__sceneObject && scopedVars.__sceneObject.value.valueOf()) {
|
|
2523
|
+
const queryControler = sceneGraph.getQueryController(scopedVars.__sceneObject.value.valueOf());
|
|
2524
|
+
if (queryControler && queryControler.state.enableProfiling) {
|
|
2525
|
+
wrapPromiseInStateObservable(dsPromise).pipe(
|
|
2526
|
+
registerQueryWithController({
|
|
2527
|
+
type: "plugin",
|
|
2528
|
+
origin: scopedVars.__sceneObject.value.valueOf()
|
|
2529
|
+
})
|
|
2530
|
+
).subscribe(() => {
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
const result = await dsPromise;
|
|
2535
|
+
return result;
|
|
2236
2536
|
}
|
|
2237
2537
|
|
|
2238
2538
|
class VariableValueRecorder {
|
|
@@ -2481,41 +2781,6 @@ function findActiveAdHocFilterVariableByUid(dsUid) {
|
|
|
2481
2781
|
return void 0;
|
|
2482
2782
|
}
|
|
2483
2783
|
|
|
2484
|
-
function registerQueryWithController(entry) {
|
|
2485
|
-
return (queryStream) => {
|
|
2486
|
-
const queryControler = sceneGraph.getQueryController(entry.origin);
|
|
2487
|
-
if (!queryControler) {
|
|
2488
|
-
return queryStream;
|
|
2489
|
-
}
|
|
2490
|
-
return new rxjs.Observable((observer) => {
|
|
2491
|
-
if (!entry.cancel) {
|
|
2492
|
-
entry.cancel = () => observer.complete();
|
|
2493
|
-
}
|
|
2494
|
-
queryControler.queryStarted(entry);
|
|
2495
|
-
let markedAsCompleted = false;
|
|
2496
|
-
const sub = queryStream.subscribe({
|
|
2497
|
-
next: (v) => {
|
|
2498
|
-
if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
|
|
2499
|
-
markedAsCompleted = true;
|
|
2500
|
-
queryControler.queryCompleted(entry);
|
|
2501
|
-
}
|
|
2502
|
-
observer.next(v);
|
|
2503
|
-
},
|
|
2504
|
-
error: (e) => observer.error(e),
|
|
2505
|
-
complete: () => {
|
|
2506
|
-
observer.complete();
|
|
2507
|
-
}
|
|
2508
|
-
});
|
|
2509
|
-
return () => {
|
|
2510
|
-
sub.unsubscribe();
|
|
2511
|
-
if (!markedAsCompleted) {
|
|
2512
|
-
queryControler.queryCompleted(entry);
|
|
2513
|
-
}
|
|
2514
|
-
};
|
|
2515
|
-
});
|
|
2516
|
-
};
|
|
2517
|
-
}
|
|
2518
|
-
|
|
2519
2784
|
const allActiveGroupByVariables = /* @__PURE__ */ new Set();
|
|
2520
2785
|
function findActiveGroupByVariablesByUid(dsUid) {
|
|
2521
2786
|
var _a;
|
|
@@ -2590,6 +2855,7 @@ function VariableValueSelect({ model }) {
|
|
|
2590
2855
|
const [inputValue, setInputValue] = React.useState("");
|
|
2591
2856
|
const [hasCustomValue, setHasCustomValue] = React.useState(false);
|
|
2592
2857
|
const selectValue = toSelectableValue$2(value, String(text));
|
|
2858
|
+
const queryController = sceneGraph.getQueryController(model);
|
|
2593
2859
|
const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
|
|
2594
2860
|
const onInputChange = (value2, { action }) => {
|
|
2595
2861
|
if (action === "input-change") {
|
|
@@ -2629,6 +2895,7 @@ function VariableValueSelect({ model }) {
|
|
|
2629
2895
|
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
|
|
2630
2896
|
onChange: (newValue) => {
|
|
2631
2897
|
model.changeValueTo(newValue.value, newValue.label);
|
|
2898
|
+
queryController == null ? void 0 : queryController.startProfile(model);
|
|
2632
2899
|
if (hasCustomValue !== newValue.__isNew__) {
|
|
2633
2900
|
setHasCustomValue(newValue.__isNew__);
|
|
2634
2901
|
}
|
|
@@ -2649,6 +2916,7 @@ function VariableValueSelectMulti({ model }) {
|
|
|
2649
2916
|
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
|
2650
2917
|
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
|
2651
2918
|
const [inputValue, setInputValue] = React.useState("");
|
|
2919
|
+
const queryController = sceneGraph.getQueryController(model);
|
|
2652
2920
|
const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
|
|
2653
2921
|
React.useEffect(() => {
|
|
2654
2922
|
setUncommittedValue(arrayValue);
|
|
@@ -2694,6 +2962,7 @@ function VariableValueSelectMulti({ model }) {
|
|
|
2694
2962
|
onInputChange,
|
|
2695
2963
|
onBlur: () => {
|
|
2696
2964
|
model.changeValueTo(uncommittedValue);
|
|
2965
|
+
queryController == null ? void 0 : queryController.startProfile(model);
|
|
2697
2966
|
},
|
|
2698
2967
|
filterOption: filterNoOp$2,
|
|
2699
2968
|
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
|
|
@@ -6748,30 +7017,6 @@ function findDescendents(scene, descendentType) {
|
|
|
6748
7017
|
const targetScenes = findAllObjects(scene, isDescendentType);
|
|
6749
7018
|
return targetScenes.filter(isDescendentType);
|
|
6750
7019
|
}
|
|
6751
|
-
function getQueryController(sceneObject) {
|
|
6752
|
-
let parent = sceneObject;
|
|
6753
|
-
while (parent) {
|
|
6754
|
-
if (parent.state.$behaviors) {
|
|
6755
|
-
for (const behavior of parent.state.$behaviors) {
|
|
6756
|
-
if (isQueryController(behavior)) {
|
|
6757
|
-
return behavior;
|
|
6758
|
-
}
|
|
6759
|
-
}
|
|
6760
|
-
}
|
|
6761
|
-
parent = parent.parent;
|
|
6762
|
-
}
|
|
6763
|
-
return void 0;
|
|
6764
|
-
}
|
|
6765
|
-
function getUrlSyncManager(sceneObject) {
|
|
6766
|
-
let parent = sceneObject;
|
|
6767
|
-
while (parent) {
|
|
6768
|
-
if ("urlSyncManager" in parent.state) {
|
|
6769
|
-
return parent.state.urlSyncManager;
|
|
6770
|
-
}
|
|
6771
|
-
parent = parent.parent;
|
|
6772
|
-
}
|
|
6773
|
-
return void 0;
|
|
6774
|
-
}
|
|
6775
7020
|
|
|
6776
7021
|
const sceneGraph = {
|
|
6777
7022
|
getVariables,
|
|
@@ -6787,9 +7032,8 @@ const sceneGraph = {
|
|
|
6787
7032
|
findObject,
|
|
6788
7033
|
findAllObjects,
|
|
6789
7034
|
getAncestor,
|
|
6790
|
-
findDescendents,
|
|
6791
7035
|
getQueryController,
|
|
6792
|
-
|
|
7036
|
+
findDescendents
|
|
6793
7037
|
};
|
|
6794
7038
|
|
|
6795
7039
|
class UniqueUrlKeyMapper {
|
|
@@ -7759,7 +8003,13 @@ class VizPanel extends SceneObjectBase {
|
|
|
7759
8003
|
} else {
|
|
7760
8004
|
const { importPanelPlugin } = runtime.getPluginImportUtils();
|
|
7761
8005
|
try {
|
|
7762
|
-
const
|
|
8006
|
+
const panelPromise = importPanelPlugin(pluginId);
|
|
8007
|
+
const queryControler = sceneGraph.getQueryController(this);
|
|
8008
|
+
if (queryControler && queryControler.state.enableProfiling) {
|
|
8009
|
+
wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: "plugin", origin: this })).subscribe(() => {
|
|
8010
|
+
});
|
|
8011
|
+
}
|
|
8012
|
+
const result = await panelPromise;
|
|
7763
8013
|
this._pluginLoaded(result, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);
|
|
7764
8014
|
} catch (err) {
|
|
7765
8015
|
this._pluginLoaded(getPanelPluginNotFound(pluginId));
|
|
@@ -11348,6 +11598,7 @@ class SceneRefreshPicker extends SceneObjectBase {
|
|
|
11348
11598
|
this._autoRefreshBlocked = false;
|
|
11349
11599
|
this.onRefresh = () => {
|
|
11350
11600
|
const queryController = sceneGraph.getQueryController(this);
|
|
11601
|
+
queryController == null ? void 0 : queryController.startProfile(this);
|
|
11351
11602
|
if (queryController == null ? void 0 : queryController.state.isRunning) {
|
|
11352
11603
|
queryController.cancelAll();
|
|
11353
11604
|
return;
|
|
@@ -11403,6 +11654,8 @@ class SceneRefreshPicker extends SceneObjectBase {
|
|
|
11403
11654
|
}
|
|
11404
11655
|
this._intervalTimer = setInterval(() => {
|
|
11405
11656
|
if (this.isTabVisible()) {
|
|
11657
|
+
const queryController = sceneGraph.getQueryController(this);
|
|
11658
|
+
queryController == null ? void 0 : queryController.startProfile(this);
|
|
11406
11659
|
timeRange.onRefresh();
|
|
11407
11660
|
} else {
|
|
11408
11661
|
this._autoRefreshBlocked = true;
|
|
@@ -11476,7 +11729,9 @@ function SceneRefreshPickerRenderer({ model }) {
|
|
|
11476
11729
|
tooltip,
|
|
11477
11730
|
width,
|
|
11478
11731
|
text,
|
|
11479
|
-
onRefresh:
|
|
11732
|
+
onRefresh: () => {
|
|
11733
|
+
model.onRefresh();
|
|
11734
|
+
},
|
|
11480
11735
|
primary,
|
|
11481
11736
|
onIntervalChanged: model.onIntervalChanged,
|
|
11482
11737
|
isLoading: isRunning,
|