@grafana/scenes 5.7.5--canary.858.10369282107.0 → 5.7.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/esm/behaviors/SceneQueryController.js +5 -55
- package/dist/esm/behaviors/SceneQueryController.js.map +1 -1
- package/dist/esm/components/SceneRefreshPicker.js +7 -4
- package/dist/esm/components/SceneRefreshPicker.js.map +1 -1
- package/dist/esm/core/SceneTimeRange.js +0 -3
- package/dist/esm/core/SceneTimeRange.js.map +1 -1
- package/dist/esm/core/sceneGraph/index.js +1 -2
- package/dist/esm/core/sceneGraph/index.js.map +1 -1
- package/dist/esm/core/sceneGraph/sceneGraph.js +16 -1
- package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/querying/registerQueryWithController.js.map +1 -1
- package/dist/esm/variables/components/VariableValueSelect.js +0 -5
- package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
- package/dist/esm/variables/variants/MultiValueVariable.js +5 -0
- 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 +25 -38
- package/dist/index.js +176 -390
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/esm/behaviors/SceneRenderProfiler.js +0 -171
- package/dist/esm/behaviors/SceneRenderProfiler.js.map +0 -1
- package/dist/esm/core/sceneGraph/getQueryController.js +0 -19
- package/dist/esm/core/sceneGraph/getQueryController.js.map +0 -1
package/dist/index.js
CHANGED
@@ -41,19 +41,19 @@ var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
|
|
41
41
|
var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
|
42
42
|
var AutoSizer__default = /*#__PURE__*/_interopDefaultLegacy(AutoSizer);
|
43
43
|
|
44
|
-
var __defProp$
|
45
|
-
var __getOwnPropSymbols$
|
46
|
-
var __hasOwnProp$
|
47
|
-
var __propIsEnum$
|
48
|
-
var __defNormalProp$
|
49
|
-
var __spreadValues$
|
44
|
+
var __defProp$K = Object.defineProperty;
|
45
|
+
var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
|
46
|
+
var __hasOwnProp$K = Object.prototype.hasOwnProperty;
|
47
|
+
var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
|
48
|
+
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
49
|
+
var __spreadValues$K = (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$K.call(b, prop))
|
52
|
+
__defNormalProp$K(a, prop, b[prop]);
|
53
|
+
if (__getOwnPropSymbols$K)
|
54
|
+
for (var prop of __getOwnPropSymbols$K(b)) {
|
55
|
+
if (__propIsEnum$K.call(b, prop))
|
56
|
+
__defNormalProp$K(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, preserveParams) {
|
65
|
-
const paramsCopy = __spreadValues$
|
65
|
+
const paramsCopy = __spreadValues$K({}, runtime.locationService.getSearchObject());
|
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$J = Object.defineProperty;
|
80
|
+
var __defProps$t = Object.defineProperties;
|
81
|
+
var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
|
82
|
+
var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
|
83
|
+
var __hasOwnProp$J = Object.prototype.hasOwnProperty;
|
84
|
+
var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
|
85
|
+
var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
86
|
+
var __spreadValues$J = (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$J.call(b, prop))
|
89
|
+
__defNormalProp$J(a, prop, b[prop]);
|
90
|
+
if (__getOwnPropSymbols$J)
|
91
|
+
for (var prop of __getOwnPropSymbols$J(b)) {
|
92
|
+
if (__propIsEnum$J.call(b, prop))
|
93
|
+
__defNormalProp$J(a, prop, b[prop]);
|
94
94
|
}
|
95
95
|
return a;
|
96
96
|
};
|
97
|
-
var __spreadProps$
|
97
|
+
var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(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$t(__spreadValues$J({}, 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$I = Object.defineProperty;
|
132
|
+
var __defProps$s = Object.defineProperties;
|
133
|
+
var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
|
134
|
+
var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
|
135
|
+
var __hasOwnProp$I = Object.prototype.hasOwnProperty;
|
136
|
+
var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
|
137
|
+
var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
138
|
+
var __spreadValues$I = (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$I.call(b, prop))
|
141
|
+
__defNormalProp$I(a, prop, b[prop]);
|
142
|
+
if (__getOwnPropSymbols$I)
|
143
|
+
for (var prop of __getOwnPropSymbols$I(b)) {
|
144
|
+
if (__propIsEnum$I.call(b, prop))
|
145
|
+
__defNormalProp$I(a, prop, b[prop]);
|
146
146
|
}
|
147
147
|
return a;
|
148
148
|
};
|
149
|
-
var __spreadProps$
|
149
|
+
var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
|
150
150
|
var __objRest$4 = (source, exclude) => {
|
151
151
|
var target = {};
|
152
152
|
for (var prop in source)
|
153
|
-
if (__hasOwnProp$
|
153
|
+
if (__hasOwnProp$I.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$I)
|
156
|
+
for (var prop of __getOwnPropSymbols$I(source)) {
|
157
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$I.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$s(__spreadValues$I({}, 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$3 = (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$3 = (obj, member, getter) => {
|
196
|
+
__accessCheck$3(obj, member, "read from private field");
|
197
197
|
return getter ? getter.call(obj) : member.get(obj);
|
198
198
|
};
|
199
|
-
var __privateAdd$
|
199
|
+
var __privateAdd$3 = (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$2 = (obj, member, value, setter) => {
|
205
|
+
__accessCheck$3(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$3(this, _ref, void 0);
|
213
|
+
__privateSet$2(this, _ref, ref);
|
214
214
|
}
|
215
215
|
resolve() {
|
216
|
-
return __privateGet$
|
216
|
+
return __privateGet$3(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$H = Object.defineProperty;
|
222
|
+
var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
|
223
|
+
var __hasOwnProp$H = Object.prototype.hasOwnProperty;
|
224
|
+
var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
|
225
|
+
var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
226
|
+
var __spreadValues$H = (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$H.call(b, prop))
|
229
|
+
__defNormalProp$H(a, prop, b[prop]);
|
230
|
+
if (__getOwnPropSymbols$H)
|
231
|
+
for (var prop of __getOwnPropSymbols$H(b)) {
|
232
|
+
if (__propIsEnum$H.call(b, prop))
|
233
|
+
__defNormalProp$H(a, prop, b[prop]);
|
234
234
|
}
|
235
235
|
return a;
|
236
236
|
};
|
@@ -290,7 +290,7 @@ class SceneObjectBase {
|
|
290
290
|
}
|
291
291
|
setState(update) {
|
292
292
|
const prevState = this._state;
|
293
|
-
const newState = __spreadValues$
|
293
|
+
const newState = __spreadValues$H(__spreadValues$H({}, this._state), update);
|
294
294
|
this._state = Object.freeze(newState);
|
295
295
|
this._setParent(update);
|
296
296
|
this._handleActivationOfChangedStateProps(prevState, newState);
|
@@ -486,19 +486,19 @@ function forEachChild(state, callback) {
|
|
486
486
|
}
|
487
487
|
}
|
488
488
|
|
489
|
-
var __defProp$
|
490
|
-
var __getOwnPropSymbols$
|
491
|
-
var __hasOwnProp$
|
492
|
-
var __propIsEnum$
|
493
|
-
var __defNormalProp$
|
494
|
-
var __spreadValues$
|
489
|
+
var __defProp$G = Object.defineProperty;
|
490
|
+
var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
|
491
|
+
var __hasOwnProp$G = Object.prototype.hasOwnProperty;
|
492
|
+
var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
|
493
|
+
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
494
|
+
var __spreadValues$G = (a, b) => {
|
495
495
|
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$
|
496
|
+
if (__hasOwnProp$G.call(b, prop))
|
497
|
+
__defNormalProp$G(a, prop, b[prop]);
|
498
|
+
if (__getOwnPropSymbols$G)
|
499
|
+
for (var prop of __getOwnPropSymbols$G(b)) {
|
500
|
+
if (__propIsEnum$G.call(b, prop))
|
501
|
+
__defNormalProp$G(a, prop, b[prop]);
|
502
502
|
}
|
503
503
|
return a;
|
504
504
|
};
|
@@ -507,7 +507,7 @@ function cloneSceneObject(sceneObject, withState) {
|
|
507
507
|
return new sceneObject.constructor(clonedState);
|
508
508
|
}
|
509
509
|
function cloneSceneObjectState(sceneState, withState) {
|
510
|
-
const clonedState = __spreadValues$
|
510
|
+
const clonedState = __spreadValues$G({}, sceneState);
|
511
511
|
for (const key in clonedState) {
|
512
512
|
const propValue = clonedState[key];
|
513
513
|
if (propValue instanceof SceneObjectBase) {
|
@@ -604,302 +604,6 @@ function lookupVariable(name, sceneObject) {
|
|
604
604
|
return null;
|
605
605
|
}
|
606
606
|
|
607
|
-
function writeSceneLog(logger, message, ...rest) {
|
608
|
-
let loggingEnabled = false;
|
609
|
-
if (typeof window !== "undefined") {
|
610
|
-
loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
|
611
|
-
}
|
612
|
-
if (loggingEnabled) {
|
613
|
-
console.log(`${logger}: `, message, ...rest);
|
614
|
-
}
|
615
|
-
}
|
616
|
-
|
617
|
-
var __accessCheck$3 = (obj, member, msg) => {
|
618
|
-
if (!member.has(obj))
|
619
|
-
throw TypeError("Cannot " + msg);
|
620
|
-
};
|
621
|
-
var __privateGet$3 = (obj, member, getter) => {
|
622
|
-
__accessCheck$3(obj, member, "read from private field");
|
623
|
-
return getter ? getter.call(obj) : member.get(obj);
|
624
|
-
};
|
625
|
-
var __privateAdd$3 = (obj, member, value) => {
|
626
|
-
if (member.has(obj))
|
627
|
-
throw TypeError("Cannot add the same private member more than once");
|
628
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
629
|
-
};
|
630
|
-
var __privateSet$3 = (obj, member, value, setter) => {
|
631
|
-
__accessCheck$3(obj, member, "write to private field");
|
632
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
633
|
-
return value;
|
634
|
-
};
|
635
|
-
var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
|
636
|
-
const POST_STORM_WINDOW = 2e3;
|
637
|
-
const SPAN_THRESHOLD = 30;
|
638
|
-
class SceneRenderProfiler {
|
639
|
-
constructor(queryController) {
|
640
|
-
this.queryController = queryController;
|
641
|
-
__privateAdd$3(this, _profileInProgress, null);
|
642
|
-
__privateAdd$3(this, _profileStartTs, null);
|
643
|
-
__privateAdd$3(this, _trailAnimationFrameId, null);
|
644
|
-
__privateAdd$3(this, _recordedTrailingSpans, []);
|
645
|
-
this.lastFrameTime = 0;
|
646
|
-
this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
|
647
|
-
const currentFrameTime = performance.now();
|
648
|
-
const frameLength = currentFrameTime - lastFrameTime;
|
649
|
-
__privateGet$3(this, _recordedTrailingSpans).push(frameLength);
|
650
|
-
if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
|
651
|
-
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
652
|
-
() => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
|
653
|
-
));
|
654
|
-
} else {
|
655
|
-
const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
|
656
|
-
const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
|
657
|
-
writeSceneLog(
|
658
|
-
this.constructor.name,
|
659
|
-
"Profile tail recorded, slow frames duration:",
|
660
|
-
slowFramesTime,
|
661
|
-
slowFrames,
|
662
|
-
__privateGet$3(this, _profileInProgress)
|
663
|
-
);
|
664
|
-
__privateSet$3(this, _recordedTrailingSpans, []);
|
665
|
-
const n = performance.now();
|
666
|
-
const profileDuration = measurementStartTs - profileStartTs;
|
667
|
-
writeSceneLog(
|
668
|
-
this.constructor.name,
|
669
|
-
"Stoped recording, total measured time (network included):",
|
670
|
-
profileDuration + slowFramesTime
|
671
|
-
);
|
672
|
-
__privateSet$3(this, _trailAnimationFrameId, null);
|
673
|
-
performance.measure("DashboardInteraction tail", {
|
674
|
-
start: measurementStartTs,
|
675
|
-
end: measurementStartTs + n
|
676
|
-
});
|
677
|
-
const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
|
678
|
-
performance.measure("DashboardInteraction", {
|
679
|
-
start: profileStartTs,
|
680
|
-
end: profileEndTs
|
681
|
-
});
|
682
|
-
const networkDuration = captureNetwork(profileStartTs, profileEndTs);
|
683
|
-
if (this.queryController.state.onProfileComplete) {
|
684
|
-
this.queryController.state.onProfileComplete({
|
685
|
-
origin: __privateGet$3(this, _profileInProgress).origin,
|
686
|
-
crumbs: __privateGet$3(this, _profileInProgress).crumbs,
|
687
|
-
duration: profileDuration + slowFramesTime,
|
688
|
-
networkDuration
|
689
|
-
});
|
690
|
-
}
|
691
|
-
if (window.__runs) {
|
692
|
-
window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
|
693
|
-
`;
|
694
|
-
} else {
|
695
|
-
window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
|
696
|
-
`;
|
697
|
-
}
|
698
|
-
}
|
699
|
-
};
|
700
|
-
}
|
701
|
-
startProfile(name) {
|
702
|
-
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
703
|
-
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
704
|
-
__privateSet$3(this, _trailAnimationFrameId, null);
|
705
|
-
writeSceneLog(this.constructor.name, "New profile: Stopped recording frames");
|
706
|
-
}
|
707
|
-
__privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
|
708
|
-
__privateSet$3(this, _profileStartTs, performance.now());
|
709
|
-
writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
|
710
|
-
}
|
711
|
-
recordProfileTail(measurementStartTime, profileStartTs) {
|
712
|
-
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
713
|
-
() => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
|
714
|
-
));
|
715
|
-
}
|
716
|
-
tryCompletingProfile() {
|
717
|
-
writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
|
718
|
-
if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
|
719
|
-
writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
|
720
|
-
this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
|
721
|
-
}
|
722
|
-
}
|
723
|
-
isTailRecording() {
|
724
|
-
return Boolean(__privateGet$3(this, _trailAnimationFrameId));
|
725
|
-
}
|
726
|
-
cancelTailRecording() {
|
727
|
-
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
728
|
-
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
729
|
-
__privateSet$3(this, _trailAnimationFrameId, null);
|
730
|
-
writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
|
731
|
-
}
|
732
|
-
}
|
733
|
-
addCrumb(crumb) {
|
734
|
-
if (__privateGet$3(this, _profileInProgress)) {
|
735
|
-
__privateGet$3(this, _profileInProgress).crumbs.push(crumb);
|
736
|
-
}
|
737
|
-
}
|
738
|
-
}
|
739
|
-
_profileInProgress = new WeakMap();
|
740
|
-
_profileStartTs = new WeakMap();
|
741
|
-
_trailAnimationFrameId = new WeakMap();
|
742
|
-
_recordedTrailingSpans = new WeakMap();
|
743
|
-
function processRecordedSpans(spans) {
|
744
|
-
for (let i = spans.length - 1; i >= 0; i--) {
|
745
|
-
if (spans[i] > SPAN_THRESHOLD) {
|
746
|
-
return spans.slice(0, i + 1);
|
747
|
-
}
|
748
|
-
}
|
749
|
-
return [spans[0]];
|
750
|
-
}
|
751
|
-
function captureNetwork(startTs, endTs) {
|
752
|
-
const entries = performance.getEntriesByType("resource");
|
753
|
-
performance.clearResourceTimings();
|
754
|
-
const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
|
755
|
-
for (const entry of networkEntries) {
|
756
|
-
performance.measure("Network entry " + entry.name, {
|
757
|
-
start: entry.startTime,
|
758
|
-
end: entry.responseEnd
|
759
|
-
});
|
760
|
-
}
|
761
|
-
return calculateNetworkTime(networkEntries);
|
762
|
-
}
|
763
|
-
function calculateNetworkTime(requests) {
|
764
|
-
if (requests.length === 0) {
|
765
|
-
return 0;
|
766
|
-
}
|
767
|
-
requests.sort((a, b) => a.startTime - b.startTime);
|
768
|
-
let totalNetworkTime = 0;
|
769
|
-
let currentStart = requests[0].startTime;
|
770
|
-
let currentEnd = requests[0].responseEnd;
|
771
|
-
for (let i = 1; i < requests.length; i++) {
|
772
|
-
if (requests[i].startTime <= currentEnd) {
|
773
|
-
currentEnd = Math.max(currentEnd, requests[i].responseEnd);
|
774
|
-
} else {
|
775
|
-
totalNetworkTime += currentEnd - currentStart;
|
776
|
-
currentStart = requests[i].startTime;
|
777
|
-
currentEnd = requests[i].responseEnd;
|
778
|
-
}
|
779
|
-
}
|
780
|
-
totalNetworkTime += currentEnd - currentStart;
|
781
|
-
return totalNetworkTime;
|
782
|
-
}
|
783
|
-
|
784
|
-
var __defProp$G = Object.defineProperty;
|
785
|
-
var __defProps$s = Object.defineProperties;
|
786
|
-
var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
|
787
|
-
var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
|
788
|
-
var __hasOwnProp$G = Object.prototype.hasOwnProperty;
|
789
|
-
var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
|
790
|
-
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
791
|
-
var __spreadValues$G = (a, b) => {
|
792
|
-
for (var prop in b || (b = {}))
|
793
|
-
if (__hasOwnProp$G.call(b, prop))
|
794
|
-
__defNormalProp$G(a, prop, b[prop]);
|
795
|
-
if (__getOwnPropSymbols$G)
|
796
|
-
for (var prop of __getOwnPropSymbols$G(b)) {
|
797
|
-
if (__propIsEnum$G.call(b, prop))
|
798
|
-
__defNormalProp$G(a, prop, b[prop]);
|
799
|
-
}
|
800
|
-
return a;
|
801
|
-
};
|
802
|
-
var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
|
803
|
-
var __accessCheck$2 = (obj, member, msg) => {
|
804
|
-
if (!member.has(obj))
|
805
|
-
throw TypeError("Cannot " + msg);
|
806
|
-
};
|
807
|
-
var __privateGet$2 = (obj, member, getter) => {
|
808
|
-
__accessCheck$2(obj, member, "read from private field");
|
809
|
-
return getter ? getter.call(obj) : member.get(obj);
|
810
|
-
};
|
811
|
-
var __privateAdd$2 = (obj, member, value) => {
|
812
|
-
if (member.has(obj))
|
813
|
-
throw TypeError("Cannot add the same private member more than once");
|
814
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
815
|
-
};
|
816
|
-
var __privateSet$2 = (obj, member, value, setter) => {
|
817
|
-
__accessCheck$2(obj, member, "write to private field");
|
818
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
819
|
-
return value;
|
820
|
-
};
|
821
|
-
var _running, _tryCompleteProfileFrameId;
|
822
|
-
function isQueryController(s) {
|
823
|
-
return "isQueryController" in s;
|
824
|
-
}
|
825
|
-
class SceneQueryController extends SceneObjectBase {
|
826
|
-
constructor(state = {}) {
|
827
|
-
super(__spreadProps$s(__spreadValues$G({}, state), { isRunning: false }));
|
828
|
-
this.isQueryController = true;
|
829
|
-
this.profiler = new SceneRenderProfiler(this);
|
830
|
-
__privateAdd$2(this, _running, /* @__PURE__ */ new Set());
|
831
|
-
__privateAdd$2(this, _tryCompleteProfileFrameId, null);
|
832
|
-
this.runningQueriesCount = () => {
|
833
|
-
return __privateGet$2(this, _running).size;
|
834
|
-
};
|
835
|
-
this.addActivationHandler(() => {
|
836
|
-
return () => __privateGet$2(this, _running).clear();
|
837
|
-
});
|
838
|
-
}
|
839
|
-
startProfile(source) {
|
840
|
-
this.profiler.startProfile(source.constructor.name);
|
841
|
-
}
|
842
|
-
queryStarted(entry) {
|
843
|
-
__privateGet$2(this, _running).add(entry);
|
844
|
-
this.changeRunningQueryCount(1, entry);
|
845
|
-
if (!this.state.isRunning) {
|
846
|
-
this.setState({ isRunning: true });
|
847
|
-
}
|
848
|
-
}
|
849
|
-
queryCompleted(entry) {
|
850
|
-
if (!__privateGet$2(this, _running).has(entry)) {
|
851
|
-
return;
|
852
|
-
}
|
853
|
-
__privateGet$2(this, _running).delete(entry);
|
854
|
-
this.changeRunningQueryCount(-1);
|
855
|
-
if (__privateGet$2(this, _running).size === 0) {
|
856
|
-
this.setState({ isRunning: false });
|
857
|
-
}
|
858
|
-
}
|
859
|
-
changeRunningQueryCount(dir, entry) {
|
860
|
-
var _a;
|
861
|
-
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
862
|
-
if (dir === 1) {
|
863
|
-
if (entry) {
|
864
|
-
this.profiler.addCrumb(entry.origin.constructor.name);
|
865
|
-
}
|
866
|
-
if (this.profiler.isTailRecording()) {
|
867
|
-
writeSceneLog(this.constructor.name, "New query started, cancelling tail recording");
|
868
|
-
this.profiler.cancelTailRecording();
|
869
|
-
}
|
870
|
-
}
|
871
|
-
if (__privateGet$2(this, _tryCompleteProfileFrameId)) {
|
872
|
-
cancelAnimationFrame(__privateGet$2(this, _tryCompleteProfileFrameId));
|
873
|
-
}
|
874
|
-
__privateSet$2(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
|
875
|
-
this.profiler.tryCompletingProfile();
|
876
|
-
}));
|
877
|
-
}
|
878
|
-
cancelAll() {
|
879
|
-
var _a;
|
880
|
-
for (const entry of __privateGet$2(this, _running).values()) {
|
881
|
-
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
882
|
-
}
|
883
|
-
}
|
884
|
-
}
|
885
|
-
_running = new WeakMap();
|
886
|
-
_tryCompleteProfileFrameId = new WeakMap();
|
887
|
-
|
888
|
-
function getQueryController(sceneObject) {
|
889
|
-
let parent = sceneObject;
|
890
|
-
while (parent) {
|
891
|
-
if (parent.state.$behaviors) {
|
892
|
-
for (const behavior of parent.state.$behaviors) {
|
893
|
-
if (isQueryController(behavior)) {
|
894
|
-
return behavior;
|
895
|
-
}
|
896
|
-
}
|
897
|
-
}
|
898
|
-
parent = parent.parent;
|
899
|
-
}
|
900
|
-
return void 0;
|
901
|
-
}
|
902
|
-
|
903
607
|
var __defProp$F = Object.defineProperty;
|
904
608
|
var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
|
905
609
|
var __hasOwnProp$F = Object.prototype.hasOwnProperty;
|
@@ -1056,8 +760,6 @@ class SceneTimeRange extends SceneObjectBase {
|
|
1056
760
|
this.state.UNSAFE_nowDelay
|
1057
761
|
);
|
1058
762
|
if (update.from !== this.state.from || update.to !== this.state.to) {
|
1059
|
-
const queryController = getQueryController(this);
|
1060
|
-
queryController == null ? void 0 : queryController.startProfile(this);
|
1061
763
|
this.setState(update);
|
1062
764
|
}
|
1063
765
|
};
|
@@ -2080,6 +1782,72 @@ function isDataLayer(obj) {
|
|
2080
1782
|
return "isDataLayer" in obj;
|
2081
1783
|
}
|
2082
1784
|
|
1785
|
+
var __accessCheck$2 = (obj, member, msg) => {
|
1786
|
+
if (!member.has(obj))
|
1787
|
+
throw TypeError("Cannot " + msg);
|
1788
|
+
};
|
1789
|
+
var __privateGet$2 = (obj, member, getter) => {
|
1790
|
+
__accessCheck$2(obj, member, "read from private field");
|
1791
|
+
return getter ? getter.call(obj) : member.get(obj);
|
1792
|
+
};
|
1793
|
+
var __privateAdd$2 = (obj, member, value) => {
|
1794
|
+
if (member.has(obj))
|
1795
|
+
throw TypeError("Cannot add the same private member more than once");
|
1796
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
1797
|
+
};
|
1798
|
+
var _running;
|
1799
|
+
function isQueryController(s) {
|
1800
|
+
return "isQueryController" in s;
|
1801
|
+
}
|
1802
|
+
class SceneQueryController extends SceneObjectBase {
|
1803
|
+
constructor() {
|
1804
|
+
super({ isRunning: false });
|
1805
|
+
this.isQueryController = true;
|
1806
|
+
__privateAdd$2(this, _running, /* @__PURE__ */ new Set());
|
1807
|
+
this.addActivationHandler(() => {
|
1808
|
+
return () => __privateGet$2(this, _running).clear();
|
1809
|
+
});
|
1810
|
+
}
|
1811
|
+
queryStarted(entry) {
|
1812
|
+
__privateGet$2(this, _running).add(entry);
|
1813
|
+
this.changeRunningQueryCount(1);
|
1814
|
+
if (!this.state.isRunning) {
|
1815
|
+
this.setState({ isRunning: true });
|
1816
|
+
}
|
1817
|
+
}
|
1818
|
+
queryCompleted(entry) {
|
1819
|
+
if (!__privateGet$2(this, _running).has(entry)) {
|
1820
|
+
return;
|
1821
|
+
}
|
1822
|
+
__privateGet$2(this, _running).delete(entry);
|
1823
|
+
this.changeRunningQueryCount(-1);
|
1824
|
+
if (__privateGet$2(this, _running).size === 0) {
|
1825
|
+
this.setState({ isRunning: false });
|
1826
|
+
}
|
1827
|
+
}
|
1828
|
+
changeRunningQueryCount(dir) {
|
1829
|
+
var _a;
|
1830
|
+
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
1831
|
+
}
|
1832
|
+
cancelAll() {
|
1833
|
+
var _a;
|
1834
|
+
for (const entry of __privateGet$2(this, _running).values()) {
|
1835
|
+
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
1836
|
+
}
|
1837
|
+
}
|
1838
|
+
}
|
1839
|
+
_running = new WeakMap();
|
1840
|
+
|
1841
|
+
function writeSceneLog(logger, message, ...rest) {
|
1842
|
+
let loggingEnabled = false;
|
1843
|
+
if (typeof window !== "undefined") {
|
1844
|
+
loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
|
1845
|
+
}
|
1846
|
+
if (loggingEnabled) {
|
1847
|
+
console.log(`${logger}: `, message, ...rest);
|
1848
|
+
}
|
1849
|
+
}
|
1850
|
+
|
2083
1851
|
async function getDataSource(datasource, scopedVars) {
|
2084
1852
|
if (datasource == null ? void 0 : datasource.uid) {
|
2085
1853
|
const runtimeDataSource = runtimeDataSources.get(datasource.uid);
|
@@ -2581,6 +2349,11 @@ class MultiValueVariable extends SceneObjectBase {
|
|
2581
2349
|
}
|
2582
2350
|
return options;
|
2583
2351
|
}
|
2352
|
+
refreshOptions() {
|
2353
|
+
this.getValueOptions({}).subscribe((options) => {
|
2354
|
+
this.updateValueGivenNewOptions(options);
|
2355
|
+
});
|
2356
|
+
}
|
2584
2357
|
}
|
2585
2358
|
function findOptionMatchingCurrent(currentValue, currentText, options) {
|
2586
2359
|
let textMatch;
|
@@ -2747,7 +2520,6 @@ function VariableValueSelect({ model }) {
|
|
2747
2520
|
const [inputValue, setInputValue] = React.useState("");
|
2748
2521
|
const [hasCustomValue, setHasCustomValue] = React.useState(false);
|
2749
2522
|
const selectValue = toSelectableValue$2(value, String(text));
|
2750
|
-
const queryController = sceneGraph.getQueryController(model);
|
2751
2523
|
const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
|
2752
2524
|
const onInputChange = (value2, { action }) => {
|
2753
2525
|
if (action === "input-change") {
|
@@ -2787,7 +2559,6 @@ function VariableValueSelect({ model }) {
|
|
2787
2559
|
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
|
2788
2560
|
onChange: (newValue) => {
|
2789
2561
|
model.changeValueTo(newValue.value, newValue.label);
|
2790
|
-
queryController == null ? void 0 : queryController.startProfile(model);
|
2791
2562
|
if (hasCustomValue !== newValue.__isNew__) {
|
2792
2563
|
setHasCustomValue(newValue.__isNew__);
|
2793
2564
|
}
|
@@ -2799,7 +2570,6 @@ function VariableValueSelectMulti({ model }) {
|
|
2799
2570
|
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
2800
2571
|
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
2801
2572
|
const [inputValue, setInputValue] = React.useState("");
|
2802
|
-
const queryController = sceneGraph.getQueryController(model);
|
2803
2573
|
const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
|
2804
2574
|
React.useEffect(() => {
|
2805
2575
|
setUncommittedValue(arrayValue);
|
@@ -2840,7 +2610,6 @@ function VariableValueSelectMulti({ model }) {
|
|
2840
2610
|
onInputChange,
|
2841
2611
|
onBlur: () => {
|
2842
2612
|
model.changeValueTo(uncommittedValue);
|
2843
|
-
queryController == null ? void 0 : queryController.startProfile(model);
|
2844
2613
|
},
|
2845
2614
|
filterOption: filterNoOp$2,
|
2846
2615
|
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
|
@@ -5215,6 +4984,20 @@ function getAncestor(sceneObject, ancestorType) {
|
|
5215
4984
|
}
|
5216
4985
|
return parent;
|
5217
4986
|
}
|
4987
|
+
function getQueryController(sceneObject) {
|
4988
|
+
let parent = sceneObject;
|
4989
|
+
while (parent) {
|
4990
|
+
if (parent.state.$behaviors) {
|
4991
|
+
for (const behavior of parent.state.$behaviors) {
|
4992
|
+
if (isQueryController(behavior)) {
|
4993
|
+
return behavior;
|
4994
|
+
}
|
4995
|
+
}
|
4996
|
+
}
|
4997
|
+
parent = parent.parent;
|
4998
|
+
}
|
4999
|
+
return void 0;
|
5000
|
+
}
|
5218
5001
|
|
5219
5002
|
const sceneGraph = {
|
5220
5003
|
getVariables,
|
@@ -9499,7 +9282,6 @@ class SceneRefreshPicker extends SceneObjectBase {
|
|
9499
9282
|
this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["refresh"] });
|
9500
9283
|
this.onRefresh = () => {
|
9501
9284
|
const queryController = sceneGraph.getQueryController(this);
|
9502
|
-
queryController == null ? void 0 : queryController.startProfile(this);
|
9503
9285
|
if (queryController == null ? void 0 : queryController.state.isRunning) {
|
9504
9286
|
queryController.cancelAll();
|
9505
9287
|
return;
|
@@ -9590,6 +9372,12 @@ function SceneRefreshPickerRenderer({ model }) {
|
|
9590
9372
|
let text = refresh === ((_a = ui.RefreshPicker.autoOption) == null ? void 0 : _a.value) ? autoValue : withText ? "Refresh" : void 0;
|
9591
9373
|
let tooltip;
|
9592
9374
|
let width;
|
9375
|
+
if (isRunning) {
|
9376
|
+
tooltip = "Cancel all queries";
|
9377
|
+
if (withText) {
|
9378
|
+
text = "Cancel";
|
9379
|
+
}
|
9380
|
+
}
|
9593
9381
|
if (withText) {
|
9594
9382
|
width = "96px";
|
9595
9383
|
}
|
@@ -9600,9 +9388,7 @@ function SceneRefreshPickerRenderer({ model }) {
|
|
9600
9388
|
tooltip,
|
9601
9389
|
width,
|
9602
9390
|
text,
|
9603
|
-
onRefresh:
|
9604
|
-
model.onRefresh();
|
9605
|
-
},
|
9391
|
+
onRefresh: model.onRefresh,
|
9606
9392
|
primary,
|
9607
9393
|
onIntervalChanged: model.onIntervalChanged,
|
9608
9394
|
isLoading: isRunning,
|