@grafana/scenes 6.0.0--canary.979.12373078054.0 → 6.0.0--canary.979.12745482012.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +109 -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 +10 -2
- package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
- package/dist/esm/core/SceneTimeRange.js +15 -29
- package/dist/esm/core/SceneTimeRange.js.map +1 -1
- package/dist/esm/core/SceneTimeZoneOverride.js +9 -6
- package/dist/esm/core/SceneTimeZoneOverride.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 +5 -5
- package/dist/esm/querying/SceneQueryRunner.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/evaluateTimeRange.js +12 -2
- package/dist/esm/utils/evaluateTimeRange.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/AdHocFiltersCombobox/AdHocFiltersCombobox.js +2 -2
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/utils.js +9 -2
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/utils.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +16 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js.map +1 -1
- package/dist/esm/variables/adhoc/patchGetAdhocFilters.js +2 -1
- package/dist/esm/variables/adhoc/patchGetAdhocFilters.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/groupby/GroupByVariable.js +6 -4
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/esm/variables/groupby/findActiveGroupByVariablesByUid.js +3 -1
- package/dist/esm/variables/groupby/findActiveGroupByVariablesByUid.js.map +1 -1
- package/dist/esm/variables/utils.js +5 -2
- package/dist/esm/variables/utils.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/esm/variables/variants/query/createQueryVariableRunner.js +27 -1
- package/dist/esm/variables/variants/query/createQueryVariableRunner.js.map +1 -1
- package/dist/esm/variables/variants/query/guards.js +7 -1
- package/dist/esm/variables/variants/query/guards.js.map +1 -1
- package/dist/esm/variables/variants/query/utils.js +17 -22
- package/dist/esm/variables/variants/query/utils.js.map +1 -1
- package/dist/index.d.ts +55 -33
- package/dist/index.js +593 -287
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
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)) {
|
@@ -92,31 +92,31 @@ function useSceneRouteMatch(path) {
|
|
92
92
|
return match;
|
93
93
|
}
|
94
94
|
|
95
|
-
var __defProp$
|
96
|
-
var __defProps$
|
97
|
-
var __getOwnPropDescs$
|
98
|
-
var __getOwnPropSymbols$
|
99
|
-
var __hasOwnProp$
|
100
|
-
var __propIsEnum$
|
101
|
-
var __defNormalProp$
|
102
|
-
var __spreadValues$
|
95
|
+
var __defProp$Q = Object.defineProperty;
|
96
|
+
var __defProps$y = Object.defineProperties;
|
97
|
+
var __getOwnPropDescs$y = Object.getOwnPropertyDescriptors;
|
98
|
+
var __getOwnPropSymbols$Q = Object.getOwnPropertySymbols;
|
99
|
+
var __hasOwnProp$Q = Object.prototype.hasOwnProperty;
|
100
|
+
var __propIsEnum$Q = Object.prototype.propertyIsEnumerable;
|
101
|
+
var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
102
|
+
var __spreadValues$Q = (a, b) => {
|
103
103
|
for (var prop in b || (b = {}))
|
104
|
-
if (__hasOwnProp$
|
105
|
-
__defNormalProp$
|
106
|
-
if (__getOwnPropSymbols$
|
107
|
-
for (var prop of __getOwnPropSymbols$
|
108
|
-
if (__propIsEnum$
|
109
|
-
__defNormalProp$
|
104
|
+
if (__hasOwnProp$Q.call(b, prop))
|
105
|
+
__defNormalProp$Q(a, prop, b[prop]);
|
106
|
+
if (__getOwnPropSymbols$Q)
|
107
|
+
for (var prop of __getOwnPropSymbols$Q(b)) {
|
108
|
+
if (__propIsEnum$Q.call(b, prop))
|
109
|
+
__defNormalProp$Q(a, prop, b[prop]);
|
110
110
|
}
|
111
111
|
return a;
|
112
112
|
};
|
113
|
-
var __spreadProps$
|
113
|
+
var __spreadProps$y = (a, b) => __defProps$y(a, __getOwnPropDescs$y(b));
|
114
114
|
const runtimePanelPlugins = /* @__PURE__ */ new Map();
|
115
115
|
function registerRuntimePanelPlugin({ pluginId, plugin }) {
|
116
116
|
if (runtimePanelPlugins.has(pluginId)) {
|
117
117
|
throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
|
118
118
|
}
|
119
|
-
plugin.meta = __spreadProps$
|
119
|
+
plugin.meta = __spreadProps$y(__spreadValues$Q({}, plugin.meta), {
|
120
120
|
id: pluginId,
|
121
121
|
name: pluginId,
|
122
122
|
module: "runtime plugin",
|
@@ -144,33 +144,33 @@ function loadPanelPluginSync(pluginId) {
|
|
144
144
|
return (_a = getPanelPluginFromCache(pluginId)) != null ? _a : runtimePanelPlugins.get(pluginId);
|
145
145
|
}
|
146
146
|
|
147
|
-
var __defProp$
|
148
|
-
var __defProps$
|
149
|
-
var __getOwnPropDescs$
|
150
|
-
var __getOwnPropSymbols$
|
151
|
-
var __hasOwnProp$
|
152
|
-
var __propIsEnum$
|
153
|
-
var __defNormalProp$
|
154
|
-
var __spreadValues$
|
147
|
+
var __defProp$P = Object.defineProperty;
|
148
|
+
var __defProps$x = Object.defineProperties;
|
149
|
+
var __getOwnPropDescs$x = Object.getOwnPropertyDescriptors;
|
150
|
+
var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
|
151
|
+
var __hasOwnProp$P = Object.prototype.hasOwnProperty;
|
152
|
+
var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
|
153
|
+
var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
154
|
+
var __spreadValues$P = (a, b) => {
|
155
155
|
for (var prop in b || (b = {}))
|
156
|
-
if (__hasOwnProp$
|
157
|
-
__defNormalProp$
|
158
|
-
if (__getOwnPropSymbols$
|
159
|
-
for (var prop of __getOwnPropSymbols$
|
160
|
-
if (__propIsEnum$
|
161
|
-
__defNormalProp$
|
156
|
+
if (__hasOwnProp$P.call(b, prop))
|
157
|
+
__defNormalProp$P(a, prop, b[prop]);
|
158
|
+
if (__getOwnPropSymbols$P)
|
159
|
+
for (var prop of __getOwnPropSymbols$P(b)) {
|
160
|
+
if (__propIsEnum$P.call(b, prop))
|
161
|
+
__defNormalProp$P(a, prop, b[prop]);
|
162
162
|
}
|
163
163
|
return a;
|
164
164
|
};
|
165
|
-
var __spreadProps$
|
165
|
+
var __spreadProps$x = (a, b) => __defProps$x(a, __getOwnPropDescs$x(b));
|
166
166
|
var __objRest$5 = (source, exclude) => {
|
167
167
|
var target = {};
|
168
168
|
for (var prop in source)
|
169
|
-
if (__hasOwnProp$
|
169
|
+
if (__hasOwnProp$P.call(source, prop) && exclude.indexOf(prop) < 0)
|
170
170
|
target[prop] = source[prop];
|
171
|
-
if (source != null && __getOwnPropSymbols$
|
172
|
-
for (var prop of __getOwnPropSymbols$
|
173
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
171
|
+
if (source != null && __getOwnPropSymbols$P)
|
172
|
+
for (var prop of __getOwnPropSymbols$P(source)) {
|
173
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$P.call(source, prop))
|
174
174
|
target[prop] = source[prop];
|
175
175
|
}
|
176
176
|
return target;
|
@@ -188,7 +188,7 @@ function SceneComponentWrapperWithoutMemo(_a) {
|
|
188
188
|
if (!model.isActive && !model.renderBeforeActivation) {
|
189
189
|
return null;
|
190
190
|
}
|
191
|
-
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$
|
191
|
+
return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$x(__spreadValues$P({}, otherProps), {
|
192
192
|
model
|
193
193
|
}));
|
194
194
|
}
|
@@ -204,49 +204,49 @@ class UserActionEvent extends data.BusEventWithPayload {
|
|
204
204
|
}
|
205
205
|
UserActionEvent.type = "scene-object-user-action";
|
206
206
|
|
207
|
-
var __accessCheck$
|
207
|
+
var __accessCheck$4 = (obj, member, msg) => {
|
208
208
|
if (!member.has(obj))
|
209
209
|
throw TypeError("Cannot " + msg);
|
210
210
|
};
|
211
|
-
var __privateGet$
|
212
|
-
__accessCheck$
|
211
|
+
var __privateGet$4 = (obj, member, getter) => {
|
212
|
+
__accessCheck$4(obj, member, "read from private field");
|
213
213
|
return getter ? getter.call(obj) : member.get(obj);
|
214
214
|
};
|
215
|
-
var __privateAdd$
|
215
|
+
var __privateAdd$4 = (obj, member, value) => {
|
216
216
|
if (member.has(obj))
|
217
217
|
throw TypeError("Cannot add the same private member more than once");
|
218
218
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
219
219
|
};
|
220
|
-
var __privateSet$
|
221
|
-
__accessCheck$
|
220
|
+
var __privateSet$4 = (obj, member, value, setter) => {
|
221
|
+
__accessCheck$4(obj, member, "write to private field");
|
222
222
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
223
223
|
return value;
|
224
224
|
};
|
225
225
|
var _ref;
|
226
226
|
class SceneObjectRef {
|
227
227
|
constructor(ref) {
|
228
|
-
__privateAdd$
|
229
|
-
__privateSet$
|
228
|
+
__privateAdd$4(this, _ref, void 0);
|
229
|
+
__privateSet$4(this, _ref, ref);
|
230
230
|
}
|
231
231
|
resolve() {
|
232
|
-
return __privateGet$
|
232
|
+
return __privateGet$4(this, _ref);
|
233
233
|
}
|
234
234
|
}
|
235
235
|
_ref = new WeakMap();
|
236
236
|
|
237
|
-
var __defProp$
|
238
|
-
var __getOwnPropSymbols$
|
239
|
-
var __hasOwnProp$
|
240
|
-
var __propIsEnum$
|
241
|
-
var __defNormalProp$
|
242
|
-
var __spreadValues$
|
237
|
+
var __defProp$O = Object.defineProperty;
|
238
|
+
var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
|
239
|
+
var __hasOwnProp$O = Object.prototype.hasOwnProperty;
|
240
|
+
var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
|
241
|
+
var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
242
|
+
var __spreadValues$O = (a, b) => {
|
243
243
|
for (var prop in b || (b = {}))
|
244
|
-
if (__hasOwnProp$
|
245
|
-
__defNormalProp$
|
246
|
-
if (__getOwnPropSymbols$
|
247
|
-
for (var prop of __getOwnPropSymbols$
|
248
|
-
if (__propIsEnum$
|
249
|
-
__defNormalProp$
|
244
|
+
if (__hasOwnProp$O.call(b, prop))
|
245
|
+
__defNormalProp$O(a, prop, b[prop]);
|
246
|
+
if (__getOwnPropSymbols$O)
|
247
|
+
for (var prop of __getOwnPropSymbols$O(b)) {
|
248
|
+
if (__propIsEnum$O.call(b, prop))
|
249
|
+
__defNormalProp$O(a, prop, b[prop]);
|
250
250
|
}
|
251
251
|
return a;
|
252
252
|
};
|
@@ -313,7 +313,7 @@ class SceneObjectBase {
|
|
313
313
|
}
|
314
314
|
setState(update) {
|
315
315
|
const prevState = this._state;
|
316
|
-
const newState = __spreadValues$
|
316
|
+
const newState = __spreadValues$O(__spreadValues$O({}, this._state), update);
|
317
317
|
this._state = Object.freeze(newState);
|
318
318
|
this._setParent(update);
|
319
319
|
this._handleActivationOfChangedStateProps(prevState, newState);
|
@@ -509,19 +509,19 @@ function forEachChild(state, callback) {
|
|
509
509
|
}
|
510
510
|
}
|
511
511
|
|
512
|
-
var __defProp$
|
513
|
-
var __getOwnPropSymbols$
|
514
|
-
var __hasOwnProp$
|
515
|
-
var __propIsEnum$
|
516
|
-
var __defNormalProp$
|
517
|
-
var __spreadValues$
|
512
|
+
var __defProp$N = Object.defineProperty;
|
513
|
+
var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
|
514
|
+
var __hasOwnProp$N = Object.prototype.hasOwnProperty;
|
515
|
+
var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
|
516
|
+
var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
517
|
+
var __spreadValues$N = (a, b) => {
|
518
518
|
for (var prop in b || (b = {}))
|
519
|
-
if (__hasOwnProp$
|
520
|
-
__defNormalProp$
|
521
|
-
if (__getOwnPropSymbols$
|
522
|
-
for (var prop of __getOwnPropSymbols$
|
523
|
-
if (__propIsEnum$
|
524
|
-
__defNormalProp$
|
519
|
+
if (__hasOwnProp$N.call(b, prop))
|
520
|
+
__defNormalProp$N(a, prop, b[prop]);
|
521
|
+
if (__getOwnPropSymbols$N)
|
522
|
+
for (var prop of __getOwnPropSymbols$N(b)) {
|
523
|
+
if (__propIsEnum$N.call(b, prop))
|
524
|
+
__defNormalProp$N(a, prop, b[prop]);
|
525
525
|
}
|
526
526
|
return a;
|
527
527
|
};
|
@@ -530,7 +530,7 @@ function cloneSceneObject(sceneObject, withState) {
|
|
530
530
|
return new sceneObject.constructor(clonedState);
|
531
531
|
}
|
532
532
|
function cloneSceneObjectState(sceneState, withState) {
|
533
|
-
const clonedState = __spreadValues$
|
533
|
+
const clonedState = __spreadValues$N({}, sceneState);
|
534
534
|
Object.assign(clonedState, withState);
|
535
535
|
for (const key in clonedState) {
|
536
536
|
if (withState && withState[key] !== void 0) {
|
@@ -631,6 +631,305 @@ function lookupVariable(name, sceneObject) {
|
|
631
631
|
return null;
|
632
632
|
}
|
633
633
|
|
634
|
+
function writeSceneLog(logger, message, ...rest) {
|
635
|
+
let loggingEnabled = false;
|
636
|
+
if (typeof window !== "undefined") {
|
637
|
+
loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
|
638
|
+
}
|
639
|
+
if (loggingEnabled) {
|
640
|
+
console.log(`${logger}: `, message, ...rest);
|
641
|
+
}
|
642
|
+
}
|
643
|
+
|
644
|
+
var __accessCheck$3 = (obj, member, msg) => {
|
645
|
+
if (!member.has(obj))
|
646
|
+
throw TypeError("Cannot " + msg);
|
647
|
+
};
|
648
|
+
var __privateGet$3 = (obj, member, getter) => {
|
649
|
+
__accessCheck$3(obj, member, "read from private field");
|
650
|
+
return getter ? getter.call(obj) : member.get(obj);
|
651
|
+
};
|
652
|
+
var __privateAdd$3 = (obj, member, value) => {
|
653
|
+
if (member.has(obj))
|
654
|
+
throw TypeError("Cannot add the same private member more than once");
|
655
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
656
|
+
};
|
657
|
+
var __privateSet$3 = (obj, member, value, setter) => {
|
658
|
+
__accessCheck$3(obj, member, "write to private field");
|
659
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
660
|
+
return value;
|
661
|
+
};
|
662
|
+
var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
|
663
|
+
const POST_STORM_WINDOW = 2e3;
|
664
|
+
const SPAN_THRESHOLD = 30;
|
665
|
+
class SceneRenderProfiler {
|
666
|
+
constructor(queryController) {
|
667
|
+
this.queryController = queryController;
|
668
|
+
__privateAdd$3(this, _profileInProgress, null);
|
669
|
+
__privateAdd$3(this, _profileStartTs, null);
|
670
|
+
__privateAdd$3(this, _trailAnimationFrameId, null);
|
671
|
+
__privateAdd$3(this, _recordedTrailingSpans, []);
|
672
|
+
this.lastFrameTime = 0;
|
673
|
+
this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
|
674
|
+
const currentFrameTime = performance.now();
|
675
|
+
const frameLength = currentFrameTime - lastFrameTime;
|
676
|
+
__privateGet$3(this, _recordedTrailingSpans).push(frameLength);
|
677
|
+
if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
|
678
|
+
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
679
|
+
() => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
|
680
|
+
));
|
681
|
+
} else {
|
682
|
+
const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
|
683
|
+
const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
|
684
|
+
writeSceneLog(
|
685
|
+
this.constructor.name,
|
686
|
+
"Profile tail recorded, slow frames duration:",
|
687
|
+
slowFramesTime,
|
688
|
+
slowFrames,
|
689
|
+
__privateGet$3(this, _profileInProgress)
|
690
|
+
);
|
691
|
+
__privateSet$3(this, _recordedTrailingSpans, []);
|
692
|
+
const profileDuration = measurementStartTs - profileStartTs;
|
693
|
+
writeSceneLog(
|
694
|
+
this.constructor.name,
|
695
|
+
"Stoped recording, total measured time (network included):",
|
696
|
+
profileDuration + slowFramesTime
|
697
|
+
);
|
698
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
699
|
+
const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
|
700
|
+
performance.measure("DashboardInteraction", {
|
701
|
+
start: profileStartTs,
|
702
|
+
end: profileEndTs
|
703
|
+
});
|
704
|
+
const networkDuration = captureNetwork(profileStartTs, profileEndTs);
|
705
|
+
if (this.queryController.state.onProfileComplete) {
|
706
|
+
this.queryController.state.onProfileComplete({
|
707
|
+
origin: __privateGet$3(this, _profileInProgress).origin,
|
708
|
+
crumbs: __privateGet$3(this, _profileInProgress).crumbs,
|
709
|
+
duration: profileDuration + slowFramesTime,
|
710
|
+
networkDuration,
|
711
|
+
jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
|
712
|
+
usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
|
713
|
+
totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
|
714
|
+
});
|
715
|
+
}
|
716
|
+
if (window.__runs) {
|
717
|
+
window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
|
718
|
+
`;
|
719
|
+
} else {
|
720
|
+
window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
|
721
|
+
`;
|
722
|
+
}
|
723
|
+
}
|
724
|
+
};
|
725
|
+
}
|
726
|
+
startProfile(name) {
|
727
|
+
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
728
|
+
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
729
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
730
|
+
writeSceneLog(this.constructor.name, "New profile: Stopped recording frames");
|
731
|
+
}
|
732
|
+
__privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
|
733
|
+
__privateSet$3(this, _profileStartTs, performance.now());
|
734
|
+
writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
|
735
|
+
}
|
736
|
+
recordProfileTail(measurementStartTime, profileStartTs) {
|
737
|
+
__privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
|
738
|
+
() => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
|
739
|
+
));
|
740
|
+
}
|
741
|
+
tryCompletingProfile() {
|
742
|
+
writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
|
743
|
+
if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
|
744
|
+
writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
|
745
|
+
this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
|
746
|
+
}
|
747
|
+
}
|
748
|
+
isTailRecording() {
|
749
|
+
return Boolean(__privateGet$3(this, _trailAnimationFrameId));
|
750
|
+
}
|
751
|
+
cancelTailRecording() {
|
752
|
+
if (__privateGet$3(this, _trailAnimationFrameId)) {
|
753
|
+
cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
|
754
|
+
__privateSet$3(this, _trailAnimationFrameId, null);
|
755
|
+
writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
|
756
|
+
}
|
757
|
+
}
|
758
|
+
addCrumb(crumb) {
|
759
|
+
if (__privateGet$3(this, _profileInProgress)) {
|
760
|
+
__privateGet$3(this, _profileInProgress).crumbs.push(crumb);
|
761
|
+
}
|
762
|
+
}
|
763
|
+
}
|
764
|
+
_profileInProgress = new WeakMap();
|
765
|
+
_profileStartTs = new WeakMap();
|
766
|
+
_trailAnimationFrameId = new WeakMap();
|
767
|
+
_recordedTrailingSpans = new WeakMap();
|
768
|
+
function processRecordedSpans(spans) {
|
769
|
+
for (let i = spans.length - 1; i >= 0; i--) {
|
770
|
+
if (spans[i] > SPAN_THRESHOLD) {
|
771
|
+
return spans.slice(0, i + 1);
|
772
|
+
}
|
773
|
+
}
|
774
|
+
return [spans[0]];
|
775
|
+
}
|
776
|
+
function captureNetwork(startTs, endTs) {
|
777
|
+
const entries = performance.getEntriesByType("resource");
|
778
|
+
performance.clearResourceTimings();
|
779
|
+
const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
|
780
|
+
for (const entry of networkEntries) {
|
781
|
+
performance.measure("Network entry " + entry.name, {
|
782
|
+
start: entry.startTime,
|
783
|
+
end: entry.responseEnd
|
784
|
+
});
|
785
|
+
}
|
786
|
+
return calculateNetworkTime(networkEntries);
|
787
|
+
}
|
788
|
+
function calculateNetworkTime(requests) {
|
789
|
+
if (requests.length === 0) {
|
790
|
+
return 0;
|
791
|
+
}
|
792
|
+
requests.sort((a, b) => a.startTime - b.startTime);
|
793
|
+
let totalNetworkTime = 0;
|
794
|
+
let currentStart = requests[0].startTime;
|
795
|
+
let currentEnd = requests[0].responseEnd;
|
796
|
+
for (let i = 1; i < requests.length; i++) {
|
797
|
+
if (requests[i].startTime <= currentEnd) {
|
798
|
+
currentEnd = Math.max(currentEnd, requests[i].responseEnd);
|
799
|
+
} else {
|
800
|
+
totalNetworkTime += currentEnd - currentStart;
|
801
|
+
currentStart = requests[i].startTime;
|
802
|
+
currentEnd = requests[i].responseEnd;
|
803
|
+
}
|
804
|
+
}
|
805
|
+
totalNetworkTime += currentEnd - currentStart;
|
806
|
+
return totalNetworkTime;
|
807
|
+
}
|
808
|
+
|
809
|
+
var __defProp$M = Object.defineProperty;
|
810
|
+
var __defProps$w = Object.defineProperties;
|
811
|
+
var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
|
812
|
+
var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
|
813
|
+
var __hasOwnProp$M = Object.prototype.hasOwnProperty;
|
814
|
+
var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
|
815
|
+
var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
816
|
+
var __spreadValues$M = (a, b) => {
|
817
|
+
for (var prop in b || (b = {}))
|
818
|
+
if (__hasOwnProp$M.call(b, prop))
|
819
|
+
__defNormalProp$M(a, prop, b[prop]);
|
820
|
+
if (__getOwnPropSymbols$M)
|
821
|
+
for (var prop of __getOwnPropSymbols$M(b)) {
|
822
|
+
if (__propIsEnum$M.call(b, prop))
|
823
|
+
__defNormalProp$M(a, prop, b[prop]);
|
824
|
+
}
|
825
|
+
return a;
|
826
|
+
};
|
827
|
+
var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
|
828
|
+
var __accessCheck$2 = (obj, member, msg) => {
|
829
|
+
if (!member.has(obj))
|
830
|
+
throw TypeError("Cannot " + msg);
|
831
|
+
};
|
832
|
+
var __privateGet$2 = (obj, member, getter) => {
|
833
|
+
__accessCheck$2(obj, member, "read from private field");
|
834
|
+
return getter ? getter.call(obj) : member.get(obj);
|
835
|
+
};
|
836
|
+
var __privateAdd$2 = (obj, member, value) => {
|
837
|
+
if (member.has(obj))
|
838
|
+
throw TypeError("Cannot add the same private member more than once");
|
839
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
840
|
+
};
|
841
|
+
var __privateSet$2 = (obj, member, value, setter) => {
|
842
|
+
__accessCheck$2(obj, member, "write to private field");
|
843
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
844
|
+
return value;
|
845
|
+
};
|
846
|
+
var _running, _tryCompleteProfileFrameId;
|
847
|
+
function isQueryController(s) {
|
848
|
+
return "isQueryController" in s;
|
849
|
+
}
|
850
|
+
class SceneQueryController extends SceneObjectBase {
|
851
|
+
constructor(state = {}) {
|
852
|
+
super(__spreadProps$w(__spreadValues$M({}, state), { isRunning: false }));
|
853
|
+
this.isQueryController = true;
|
854
|
+
this.profiler = new SceneRenderProfiler(this);
|
855
|
+
__privateAdd$2(this, _running, /* @__PURE__ */ new Set());
|
856
|
+
__privateAdd$2(this, _tryCompleteProfileFrameId, null);
|
857
|
+
this.runningQueriesCount = () => {
|
858
|
+
return __privateGet$2(this, _running).size;
|
859
|
+
};
|
860
|
+
this.addActivationHandler(() => {
|
861
|
+
return () => __privateGet$2(this, _running).clear();
|
862
|
+
});
|
863
|
+
}
|
864
|
+
startProfile(source) {
|
865
|
+
if (!this.state.enableProfiling) {
|
866
|
+
return;
|
867
|
+
}
|
868
|
+
this.profiler.startProfile(source.constructor.name);
|
869
|
+
}
|
870
|
+
queryStarted(entry) {
|
871
|
+
__privateGet$2(this, _running).add(entry);
|
872
|
+
this.changeRunningQueryCount(1, entry);
|
873
|
+
if (!this.state.isRunning) {
|
874
|
+
this.setState({ isRunning: true });
|
875
|
+
}
|
876
|
+
}
|
877
|
+
queryCompleted(entry) {
|
878
|
+
if (!__privateGet$2(this, _running).has(entry)) {
|
879
|
+
return;
|
880
|
+
}
|
881
|
+
__privateGet$2(this, _running).delete(entry);
|
882
|
+
this.changeRunningQueryCount(-1);
|
883
|
+
if (__privateGet$2(this, _running).size === 0) {
|
884
|
+
this.setState({ isRunning: false });
|
885
|
+
}
|
886
|
+
}
|
887
|
+
changeRunningQueryCount(dir, entry) {
|
888
|
+
var _a;
|
889
|
+
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
890
|
+
if (dir === 1 && this.state.enableProfiling) {
|
891
|
+
if (entry) {
|
892
|
+
this.profiler.addCrumb(`${entry.origin.constructor.name}/${entry.type}`);
|
893
|
+
}
|
894
|
+
if (this.profiler.isTailRecording()) {
|
895
|
+
writeSceneLog(this.constructor.name, "New query started, cancelling tail recording");
|
896
|
+
this.profiler.cancelTailRecording();
|
897
|
+
}
|
898
|
+
}
|
899
|
+
if (this.state.enableProfiling) {
|
900
|
+
if (__privateGet$2(this, _tryCompleteProfileFrameId)) {
|
901
|
+
cancelAnimationFrame(__privateGet$2(this, _tryCompleteProfileFrameId));
|
902
|
+
}
|
903
|
+
__privateSet$2(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
|
904
|
+
this.profiler.tryCompletingProfile();
|
905
|
+
}));
|
906
|
+
}
|
907
|
+
}
|
908
|
+
cancelAll() {
|
909
|
+
var _a;
|
910
|
+
for (const entry of __privateGet$2(this, _running).values()) {
|
911
|
+
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
912
|
+
}
|
913
|
+
}
|
914
|
+
}
|
915
|
+
_running = new WeakMap();
|
916
|
+
_tryCompleteProfileFrameId = new WeakMap();
|
917
|
+
|
918
|
+
function getQueryController(sceneObject) {
|
919
|
+
let parent = sceneObject;
|
920
|
+
while (parent) {
|
921
|
+
if (parent.state.$behaviors) {
|
922
|
+
for (const behavior of parent.state.$behaviors) {
|
923
|
+
if (isQueryController(behavior)) {
|
924
|
+
return behavior;
|
925
|
+
}
|
926
|
+
}
|
927
|
+
}
|
928
|
+
parent = parent.parent;
|
929
|
+
}
|
930
|
+
return void 0;
|
931
|
+
}
|
932
|
+
|
634
933
|
var __defProp$L = Object.defineProperty;
|
635
934
|
var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
|
636
935
|
var __hasOwnProp$L = Object.prototype.hasOwnProperty;
|
@@ -732,9 +1031,12 @@ function parseUrlParam(value) {
|
|
732
1031
|
return null;
|
733
1032
|
}
|
734
1033
|
|
735
|
-
function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay) {
|
1034
|
+
function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay, weekStart) {
|
736
1035
|
const hasDelay = delay && to === "now";
|
737
1036
|
const now = Date.now();
|
1037
|
+
if (weekStart) {
|
1038
|
+
setWeekStartIfDifferent(weekStart);
|
1039
|
+
}
|
738
1040
|
const parseOrToDateTime = (val, options) => {
|
739
1041
|
if (data.dateMath.toDateTime) {
|
740
1042
|
return data.dateMath.toDateTime(val, options);
|
@@ -761,6 +1063,13 @@ function evaluateTimeRange(from, to, timeZone, fiscalYearStartMonth, delay) {
|
|
761
1063
|
}
|
762
1064
|
};
|
763
1065
|
}
|
1066
|
+
let prevWeekStart;
|
1067
|
+
function setWeekStartIfDifferent(weekStart) {
|
1068
|
+
if (weekStart !== prevWeekStart) {
|
1069
|
+
prevWeekStart = weekStart;
|
1070
|
+
data.setWeekStart(weekStart);
|
1071
|
+
}
|
1072
|
+
}
|
764
1073
|
|
765
1074
|
function isValid$1(value, roundUp, timeZone) {
|
766
1075
|
if (data.isDateTime(value)) {
|
@@ -800,7 +1109,8 @@ class SceneTimeRange extends SceneObjectBase {
|
|
800
1109
|
to,
|
801
1110
|
timeZone || data.getTimeZone(),
|
802
1111
|
state.fiscalYearStartMonth,
|
803
|
-
state.UNSAFE_nowDelay
|
1112
|
+
state.UNSAFE_nowDelay,
|
1113
|
+
state.weekStart
|
804
1114
|
);
|
805
1115
|
const refreshOnActivate = (_a = state.refreshOnActivate) != null ? _a : { percent: 10 };
|
806
1116
|
super(__spreadValues$K({ from, to, timeZone, value, refreshOnActivate }, state));
|
@@ -822,9 +1132,12 @@ class SceneTimeRange extends SceneObjectBase {
|
|
822
1132
|
update.to,
|
823
1133
|
this.getTimeZone(),
|
824
1134
|
this.state.fiscalYearStartMonth,
|
825
|
-
this.state.UNSAFE_nowDelay
|
1135
|
+
this.state.UNSAFE_nowDelay,
|
1136
|
+
this.state.weekStart
|
826
1137
|
);
|
827
1138
|
if (update.from !== this.state.from || update.to !== this.state.to) {
|
1139
|
+
const queryController = getQueryController(this);
|
1140
|
+
queryController == null ? void 0 : queryController.startProfile(this);
|
828
1141
|
this._urlSync.performBrowserHistoryAction(() => {
|
829
1142
|
this.setState(update);
|
830
1143
|
});
|
@@ -836,15 +1149,7 @@ class SceneTimeRange extends SceneObjectBase {
|
|
836
1149
|
});
|
837
1150
|
};
|
838
1151
|
this.onRefresh = () => {
|
839
|
-
this.
|
840
|
-
value: evaluateTimeRange(
|
841
|
-
this.state.from,
|
842
|
-
this.state.to,
|
843
|
-
this.getTimeZone(),
|
844
|
-
this.state.fiscalYearStartMonth,
|
845
|
-
this.state.UNSAFE_nowDelay
|
846
|
-
)
|
847
|
-
});
|
1152
|
+
this.refreshRange(0);
|
848
1153
|
this.publishEvent(new runtime.RefreshEvent(), true);
|
849
1154
|
};
|
850
1155
|
this.addActivationHandler(this._onActivate.bind(this));
|
@@ -856,23 +1161,12 @@ class SceneTimeRange extends SceneObjectBase {
|
|
856
1161
|
this._subs.add(
|
857
1162
|
timeZoneSource.subscribeToState((n, p) => {
|
858
1163
|
if (n.timeZone !== void 0 && n.timeZone !== p.timeZone) {
|
859
|
-
this.
|
860
|
-
value: evaluateTimeRange(
|
861
|
-
this.state.from,
|
862
|
-
this.state.to,
|
863
|
-
timeZoneSource.getTimeZone(),
|
864
|
-
this.state.fiscalYearStartMonth,
|
865
|
-
this.state.UNSAFE_nowDelay
|
866
|
-
)
|
867
|
-
});
|
1164
|
+
this.refreshRange(0);
|
868
1165
|
}
|
869
1166
|
})
|
870
1167
|
);
|
871
1168
|
}
|
872
1169
|
}
|
873
|
-
if (this.state.weekStart) {
|
874
|
-
data.setWeekStart(this.state.weekStart);
|
875
|
-
}
|
876
1170
|
if (data.rangeUtil.isRelativeTimeRange(this.state.value.raw)) {
|
877
1171
|
this.refreshIfStale();
|
878
1172
|
}
|
@@ -917,13 +1211,12 @@ class SceneTimeRange extends SceneObjectBase {
|
|
917
1211
|
this.state.to,
|
918
1212
|
(_a = this.state.timeZone) != null ? _a : data.getTimeZone(),
|
919
1213
|
this.state.fiscalYearStartMonth,
|
920
|
-
this.state.UNSAFE_nowDelay
|
1214
|
+
this.state.UNSAFE_nowDelay,
|
1215
|
+
this.state.weekStart
|
921
1216
|
);
|
922
1217
|
const diff = value.to.diff(this.state.value.to, "milliseconds");
|
923
1218
|
if (diff >= refreshAfterMs) {
|
924
|
-
this.setState({
|
925
|
-
value
|
926
|
-
});
|
1219
|
+
this.setState({ value });
|
927
1220
|
}
|
928
1221
|
}
|
929
1222
|
calculatePercentOfInterval(percent) {
|
@@ -982,7 +1275,8 @@ class SceneTimeRange extends SceneObjectBase {
|
|
982
1275
|
(_b = update.to) != null ? _b : this.state.to,
|
983
1276
|
(_c = update.timeZone) != null ? _c : this.getTimeZone(),
|
984
1277
|
this.state.fiscalYearStartMonth,
|
985
|
-
this.state.UNSAFE_nowDelay
|
1278
|
+
this.state.UNSAFE_nowDelay,
|
1279
|
+
this.state.weekStart
|
986
1280
|
);
|
987
1281
|
return this.setState(update);
|
988
1282
|
}
|
@@ -1647,12 +1941,12 @@ class MultiValueVariable extends SceneObjectBase {
|
|
1647
1941
|
setStateHelper(state) {
|
1648
1942
|
setBaseClassState(this, state);
|
1649
1943
|
}
|
1650
|
-
getOptionsForSelect() {
|
1944
|
+
getOptionsForSelect(includeCurrentValue = true) {
|
1651
1945
|
let options = this.state.options;
|
1652
1946
|
if (this.state.includeAll) {
|
1653
1947
|
options = [{ value: ALL_VARIABLE_VALUE, label: ALL_VARIABLE_TEXT }, ...options];
|
1654
1948
|
}
|
1655
|
-
if (!Array.isArray(this.state.value)) {
|
1949
|
+
if (includeCurrentValue && !Array.isArray(this.state.value)) {
|
1656
1950
|
const current = options.find((x) => x.value === this.state.value);
|
1657
1951
|
if (!current) {
|
1658
1952
|
options = [{ value: this.state.value, label: String(this.state.text) }, ...options];
|
@@ -2179,70 +2473,55 @@ function isDataLayer(obj) {
|
|
2179
2473
|
return "isDataLayer" in obj;
|
2180
2474
|
}
|
2181
2475
|
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
__accessCheck$2(obj, member, "read from private field");
|
2188
|
-
return getter ? getter.call(obj) : member.get(obj);
|
2189
|
-
};
|
2190
|
-
var __privateAdd$2 = (obj, member, value) => {
|
2191
|
-
if (member.has(obj))
|
2192
|
-
throw TypeError("Cannot add the same private member more than once");
|
2193
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2194
|
-
};
|
2195
|
-
var _running;
|
2196
|
-
function isQueryController(s) {
|
2197
|
-
return "isQueryController" in s;
|
2198
|
-
}
|
2199
|
-
class SceneQueryController extends SceneObjectBase {
|
2200
|
-
constructor() {
|
2201
|
-
super({ isRunning: false });
|
2202
|
-
this.isQueryController = true;
|
2203
|
-
__privateAdd$2(this, _running, /* @__PURE__ */ new Set());
|
2204
|
-
this.addActivationHandler(() => {
|
2205
|
-
return () => __privateGet$2(this, _running).clear();
|
2206
|
-
});
|
2207
|
-
}
|
2208
|
-
queryStarted(entry) {
|
2209
|
-
__privateGet$2(this, _running).add(entry);
|
2210
|
-
this.changeRunningQueryCount(1);
|
2211
|
-
if (!this.state.isRunning) {
|
2212
|
-
this.setState({ isRunning: true });
|
2213
|
-
}
|
2214
|
-
}
|
2215
|
-
queryCompleted(entry) {
|
2216
|
-
if (!__privateGet$2(this, _running).has(entry)) {
|
2217
|
-
return;
|
2218
|
-
}
|
2219
|
-
__privateGet$2(this, _running).delete(entry);
|
2220
|
-
this.changeRunningQueryCount(-1);
|
2221
|
-
if (__privateGet$2(this, _running).size === 0) {
|
2222
|
-
this.setState({ isRunning: false });
|
2223
|
-
}
|
2224
|
-
}
|
2225
|
-
changeRunningQueryCount(dir) {
|
2226
|
-
var _a;
|
2227
|
-
window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
|
2228
|
-
}
|
2229
|
-
cancelAll() {
|
2230
|
-
var _a;
|
2231
|
-
for (const entry of __privateGet$2(this, _running).values()) {
|
2232
|
-
(_a = entry.cancel) == null ? void 0 : _a.call(entry);
|
2476
|
+
function registerQueryWithController(entry) {
|
2477
|
+
return (queryStream) => {
|
2478
|
+
const queryControler = sceneGraph.getQueryController(entry.origin);
|
2479
|
+
if (!queryControler) {
|
2480
|
+
return queryStream;
|
2233
2481
|
}
|
2234
|
-
|
2482
|
+
return new rxjs.Observable((observer) => {
|
2483
|
+
if (!entry.cancel) {
|
2484
|
+
entry.cancel = () => observer.complete();
|
2485
|
+
}
|
2486
|
+
queryControler.queryStarted(entry);
|
2487
|
+
let markedAsCompleted = false;
|
2488
|
+
const sub = queryStream.subscribe({
|
2489
|
+
next: (v) => {
|
2490
|
+
if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
|
2491
|
+
markedAsCompleted = true;
|
2492
|
+
queryControler.queryCompleted(entry);
|
2493
|
+
}
|
2494
|
+
observer.next(v);
|
2495
|
+
},
|
2496
|
+
error: (e) => observer.error(e),
|
2497
|
+
complete: () => {
|
2498
|
+
observer.complete();
|
2499
|
+
}
|
2500
|
+
});
|
2501
|
+
return () => {
|
2502
|
+
sub.unsubscribe();
|
2503
|
+
if (!markedAsCompleted) {
|
2504
|
+
queryControler.queryCompleted(entry);
|
2505
|
+
}
|
2506
|
+
};
|
2507
|
+
});
|
2508
|
+
};
|
2235
2509
|
}
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2510
|
+
function wrapPromiseInStateObservable(promise) {
|
2511
|
+
return new rxjs.Observable((observer) => {
|
2512
|
+
observer.next({ state: schema.LoadingState.Loading });
|
2513
|
+
const promiseObservable = rxjs.from(promise);
|
2514
|
+
promiseObservable.pipe(
|
2515
|
+
rxjs.map(() => ({ state: schema.LoadingState.Done })),
|
2516
|
+
rxjs.catchError(() => {
|
2517
|
+
observer.next({ state: schema.LoadingState.Error });
|
2518
|
+
return [];
|
2519
|
+
})
|
2520
|
+
).subscribe({
|
2521
|
+
next: (result) => observer.next(result),
|
2522
|
+
complete: () => observer.complete()
|
2523
|
+
});
|
2524
|
+
});
|
2246
2525
|
}
|
2247
2526
|
|
2248
2527
|
async function getDataSource(datasource, scopedVars) {
|
@@ -2255,7 +2534,21 @@ async function getDataSource(datasource, scopedVars) {
|
|
2255
2534
|
if (datasource && datasource.query) {
|
2256
2535
|
return datasource;
|
2257
2536
|
}
|
2258
|
-
|
2537
|
+
const dsPromise = runtime.getDataSourceSrv().get(datasource, scopedVars);
|
2538
|
+
if (scopedVars.__sceneObject && scopedVars.__sceneObject.value.valueOf()) {
|
2539
|
+
const queryControler = sceneGraph.getQueryController(scopedVars.__sceneObject.value.valueOf());
|
2540
|
+
if (queryControler && queryControler.state.enableProfiling) {
|
2541
|
+
wrapPromiseInStateObservable(dsPromise).pipe(
|
2542
|
+
registerQueryWithController({
|
2543
|
+
type: "plugin",
|
2544
|
+
origin: scopedVars.__sceneObject.value.valueOf()
|
2545
|
+
})
|
2546
|
+
).subscribe(() => {
|
2547
|
+
});
|
2548
|
+
}
|
2549
|
+
}
|
2550
|
+
const result = await dsPromise;
|
2551
|
+
return result;
|
2259
2552
|
}
|
2260
2553
|
|
2261
2554
|
class VariableValueRecorder {
|
@@ -2497,53 +2790,18 @@ function patchGetAdhocFilters(filterVar) {
|
|
2497
2790
|
function findActiveAdHocFilterVariableByUid(dsUid) {
|
2498
2791
|
var _a;
|
2499
2792
|
for (const filter of allActiveFilterSets.values()) {
|
2500
|
-
if (((_a = filter.state.datasource) == null ? void 0 : _a.uid) === dsUid) {
|
2793
|
+
if (interpolate(filter, (_a = filter.state.datasource) == null ? void 0 : _a.uid) === dsUid) {
|
2501
2794
|
return filter;
|
2502
2795
|
}
|
2503
2796
|
}
|
2504
2797
|
return void 0;
|
2505
2798
|
}
|
2506
2799
|
|
2507
|
-
function registerQueryWithController(entry) {
|
2508
|
-
return (queryStream) => {
|
2509
|
-
const queryControler = sceneGraph.getQueryController(entry.origin);
|
2510
|
-
if (!queryControler) {
|
2511
|
-
return queryStream;
|
2512
|
-
}
|
2513
|
-
return new rxjs.Observable((observer) => {
|
2514
|
-
if (!entry.cancel) {
|
2515
|
-
entry.cancel = () => observer.complete();
|
2516
|
-
}
|
2517
|
-
queryControler.queryStarted(entry);
|
2518
|
-
let markedAsCompleted = false;
|
2519
|
-
const sub = queryStream.subscribe({
|
2520
|
-
next: (v) => {
|
2521
|
-
if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
|
2522
|
-
markedAsCompleted = true;
|
2523
|
-
queryControler.queryCompleted(entry);
|
2524
|
-
}
|
2525
|
-
observer.next(v);
|
2526
|
-
},
|
2527
|
-
error: (e) => observer.error(e),
|
2528
|
-
complete: () => {
|
2529
|
-
observer.complete();
|
2530
|
-
}
|
2531
|
-
});
|
2532
|
-
return () => {
|
2533
|
-
sub.unsubscribe();
|
2534
|
-
if (!markedAsCompleted) {
|
2535
|
-
queryControler.queryCompleted(entry);
|
2536
|
-
}
|
2537
|
-
};
|
2538
|
-
});
|
2539
|
-
};
|
2540
|
-
}
|
2541
|
-
|
2542
2800
|
const allActiveGroupByVariables = /* @__PURE__ */ new Set();
|
2543
2801
|
function findActiveGroupByVariablesByUid(dsUid) {
|
2544
2802
|
var _a;
|
2545
2803
|
for (const groupByVariable of allActiveGroupByVariables.values()) {
|
2546
|
-
if (((_a = groupByVariable.state.datasource) == null ? void 0 : _a.uid) === dsUid) {
|
2804
|
+
if (interpolate(groupByVariable, (_a = groupByVariable.state.datasource) == null ? void 0 : _a.uid) === dsUid) {
|
2547
2805
|
return groupByVariable;
|
2548
2806
|
}
|
2549
2807
|
}
|
@@ -2613,6 +2871,7 @@ function VariableValueSelect({ model }) {
|
|
2613
2871
|
const [inputValue, setInputValue] = React.useState("");
|
2614
2872
|
const [hasCustomValue, setHasCustomValue] = React.useState(false);
|
2615
2873
|
const selectValue = toSelectableValue$2(value, String(text));
|
2874
|
+
const queryController = sceneGraph.getQueryController(model);
|
2616
2875
|
const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
|
2617
2876
|
const onInputChange = (value2, { action }) => {
|
2618
2877
|
if (action === "input-change") {
|
@@ -2652,6 +2911,7 @@ function VariableValueSelect({ model }) {
|
|
2652
2911
|
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
|
2653
2912
|
onChange: (newValue) => {
|
2654
2913
|
model.changeValueTo(newValue.value, newValue.label);
|
2914
|
+
queryController == null ? void 0 : queryController.startProfile(model);
|
2655
2915
|
if (hasCustomValue !== newValue.__isNew__) {
|
2656
2916
|
setHasCustomValue(newValue.__isNew__);
|
2657
2917
|
}
|
@@ -2672,6 +2932,7 @@ function VariableValueSelectMulti({ model }) {
|
|
2672
2932
|
const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
|
2673
2933
|
const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
|
2674
2934
|
const [inputValue, setInputValue] = React.useState("");
|
2935
|
+
const queryController = sceneGraph.getQueryController(model);
|
2675
2936
|
const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
|
2676
2937
|
React.useEffect(() => {
|
2677
2938
|
setUncommittedValue(arrayValue);
|
@@ -2717,6 +2978,7 @@ function VariableValueSelectMulti({ model }) {
|
|
2717
2978
|
onInputChange,
|
2718
2979
|
onBlur: () => {
|
2719
2980
|
model.changeValueTo(uncommittedValue);
|
2981
|
+
queryController == null ? void 0 : queryController.startProfile(model);
|
2720
2982
|
},
|
2721
2983
|
filterOption: filterNoOp$2,
|
2722
2984
|
"data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
|
@@ -2978,10 +3240,12 @@ class GroupByVariable extends MultiValueVariable {
|
|
2978
3240
|
}
|
2979
3241
|
return keys;
|
2980
3242
|
};
|
2981
|
-
this.
|
2982
|
-
|
2983
|
-
|
2984
|
-
|
3243
|
+
if (this.state.applyMode === "auto") {
|
3244
|
+
this.addActivationHandler(() => {
|
3245
|
+
allActiveGroupByVariables.add(this);
|
3246
|
+
return () => allActiveGroupByVariables.delete(this);
|
3247
|
+
});
|
3248
|
+
}
|
2985
3249
|
}
|
2986
3250
|
validateAndUpdate() {
|
2987
3251
|
return this.getValueOptions({}).pipe(
|
@@ -3643,7 +3907,7 @@ class AdHocFiltersVariableUrlSyncHandler {
|
|
3643
3907
|
if (filters.length === 0) {
|
3644
3908
|
return { [this.getKey()]: [""] };
|
3645
3909
|
}
|
3646
|
-
const value = filters.filter(isFilterComplete).map((filter) => toArray(filter).map(escapeUrlPipeDelimiters).join("|"));
|
3910
|
+
const value = filters.filter(isFilterComplete).filter((filter) => !filter.hidden).map((filter) => toArray(filter).map(escapeUrlPipeDelimiters).join("|"));
|
3647
3911
|
return { [this.getKey()]: value };
|
3648
3912
|
}
|
3649
3913
|
updateFromUrl(values) {
|
@@ -3846,13 +4110,20 @@ const VIRTUAL_LIST_OVERSCAN = 5;
|
|
3846
4110
|
const VIRTUAL_LIST_ITEM_HEIGHT = 38;
|
3847
4111
|
const VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION = 60;
|
3848
4112
|
const ERROR_STATE_DROPDOWN_WIDTH = 366;
|
3849
|
-
|
4113
|
+
const REGEXP_NON_ASCII = /[^ -~]/m;
|
4114
|
+
function searchOptions(options) {
|
3850
4115
|
const haystack = options.map((o) => {
|
3851
4116
|
var _a;
|
3852
4117
|
return (_a = o.label) != null ? _a : o.value;
|
3853
4118
|
});
|
3854
4119
|
const fuzzySearch = getFuzzySearcher(haystack);
|
3855
4120
|
return (search, filterInputType) => {
|
4121
|
+
if (REGEXP_NON_ASCII.test(search)) {
|
4122
|
+
return options.filter((o) => {
|
4123
|
+
var _a, _b;
|
4124
|
+
return ((_a = o.label) == null ? void 0 : _a.includes(search)) || ((_b = o.value) == null ? void 0 : _b.includes(search)) || false;
|
4125
|
+
});
|
4126
|
+
}
|
3856
4127
|
if (filterInputType === "operator" && search !== "") {
|
3857
4128
|
search = `"${search}"`;
|
3858
4129
|
}
|
@@ -4192,7 +4463,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
|
|
4192
4463
|
const listRef = React.useRef([]);
|
4193
4464
|
const disabledIndicesRef = React.useRef([]);
|
4194
4465
|
const filterInputTypeRef = React.useRef(!isAlwaysWip ? "value" : "key");
|
4195
|
-
const optionsSearcher = React.useMemo(() =>
|
4466
|
+
const optionsSearcher = React.useMemo(() => searchOptions(options), [options]);
|
4196
4467
|
const isLastFilter = React.useMemo(() => {
|
4197
4468
|
if (isAlwaysWip) {
|
4198
4469
|
return false;
|
@@ -5089,6 +5360,21 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
5089
5360
|
this.publishEvent(new SceneVariableValueChangedEvent(this), true);
|
5090
5361
|
}
|
5091
5362
|
}
|
5363
|
+
updateFilters(filters, options) {
|
5364
|
+
let filterExpressionChanged = false;
|
5365
|
+
let filterExpression = void 0;
|
5366
|
+
if (filters && filters !== this.state.filters) {
|
5367
|
+
filterExpression = renderExpression(this.state.expressionBuilder, filters);
|
5368
|
+
filterExpressionChanged = filterExpression !== this.state.filterExpression;
|
5369
|
+
}
|
5370
|
+
super.setState({
|
5371
|
+
filters,
|
5372
|
+
filterExpression
|
5373
|
+
});
|
5374
|
+
if (filterExpressionChanged && (options == null ? void 0 : options.skipPublish) !== true || (options == null ? void 0 : options.forcePublish)) {
|
5375
|
+
this.publishEvent(new SceneVariableValueChangedEvent(this), true);
|
5376
|
+
}
|
5377
|
+
}
|
5092
5378
|
getValue() {
|
5093
5379
|
return this.state.filterExpression;
|
5094
5380
|
}
|
@@ -5234,7 +5520,7 @@ function AdHocFiltersVariableRenderer({ model }) {
|
|
5234
5520
|
}
|
5235
5521
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
5236
5522
|
className: styles.wrapper
|
5237
|
-
}, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
|
5523
|
+
}, filters.filter((filter) => !filter.hidden).map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
|
5238
5524
|
key: index
|
5239
5525
|
}, /* @__PURE__ */ React__default["default"].createElement(AdHocFilterRenderer, {
|
5240
5526
|
filter,
|
@@ -5349,7 +5635,7 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
5349
5635
|
this._results = new rxjs.ReplaySubject(1);
|
5350
5636
|
this._scopedVars = { __sceneObject: wrapInSafeSerializableSceneObject(this) };
|
5351
5637
|
this._variableDependency = new VariableDependencyConfig(this, {
|
5352
|
-
statePaths: ["queries", "datasource"],
|
5638
|
+
statePaths: ["queries", "datasource", "minInterval"],
|
5353
5639
|
onVariableUpdateCompleted: this.onVariableUpdatesCompleted.bind(this),
|
5354
5640
|
onAnyVariableChanged: this.onAnyVariableChanged.bind(this)
|
5355
5641
|
});
|
@@ -5586,7 +5872,7 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
5586
5872
|
try {
|
5587
5873
|
const datasource = (_c = this.state.datasource) != null ? _c : findFirstDatasource(queries);
|
5588
5874
|
const ds = await getDataSource(datasource, this._scopedVars);
|
5589
|
-
this.findAndSubscribeToAdHocFilters(
|
5875
|
+
this.findAndSubscribeToAdHocFilters(ds.uid);
|
5590
5876
|
const runRequest = runtime.getRunRequest();
|
5591
5877
|
const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds);
|
5592
5878
|
writeSceneLog("SceneQueryRunner", "Starting runRequest", this.state.key);
|
@@ -5715,13 +6001,13 @@ class SceneQueryRunner extends SceneObjectBase {
|
|
5715
6001
|
});
|
5716
6002
|
return Array.from(found.values());
|
5717
6003
|
}
|
5718
|
-
findAndSubscribeToAdHocFilters(
|
5719
|
-
const filtersVar = findActiveAdHocFilterVariableByUid(
|
6004
|
+
findAndSubscribeToAdHocFilters(interpolatedUid) {
|
6005
|
+
const filtersVar = findActiveAdHocFilterVariableByUid(interpolatedUid);
|
5720
6006
|
if (this._adhocFiltersVar !== filtersVar) {
|
5721
6007
|
this._adhocFiltersVar = filtersVar;
|
5722
6008
|
this._updateExplicitVariableDependencies();
|
5723
6009
|
}
|
5724
|
-
const groupByVar = findActiveGroupByVariablesByUid(
|
6010
|
+
const groupByVar = findActiveGroupByVariablesByUid(interpolatedUid);
|
5725
6011
|
if (this._groupByVar !== groupByVar) {
|
5726
6012
|
this._groupByVar = groupByVar;
|
5727
6013
|
this._updateExplicitVariableDependencies();
|
@@ -5815,13 +6101,16 @@ function escapeLokiRegexp(value) {
|
|
5815
6101
|
return value.replace(RE2_METACHARACTERS, "\\$&");
|
5816
6102
|
}
|
5817
6103
|
function getQueriesForVariables(sourceObject) {
|
6104
|
+
var _a;
|
5818
6105
|
const runners = sceneGraph.findAllObjects(
|
5819
6106
|
sourceObject.getRoot(),
|
5820
6107
|
(o) => o instanceof SceneQueryRunner
|
5821
6108
|
);
|
6109
|
+
const interpolatedDsUuid = sceneGraph.interpolate(sourceObject, (_a = sourceObject.state.datasource) == null ? void 0 : _a.uid);
|
5822
6110
|
const applicableRunners = filterOutInactiveRunnerDuplicates(runners).filter((r) => {
|
5823
|
-
var
|
5824
|
-
|
6111
|
+
var _a2;
|
6112
|
+
const interpolatedQueryDsUuid = sceneGraph.interpolate(sourceObject, (_a2 = r.state.datasource) == null ? void 0 : _a2.uid);
|
6113
|
+
return interpolatedQueryDsUuid === interpolatedDsUuid;
|
5825
6114
|
});
|
5826
6115
|
if (applicableRunners.length === 0) {
|
5827
6116
|
return [];
|
@@ -6121,6 +6410,12 @@ const hasCustomVariableSupport = (datasource) => {
|
|
6121
6410
|
const variableSupport = datasource.variables;
|
6122
6411
|
return "query" in variableSupport && "editor" in variableSupport && Boolean(variableSupport.query) && Boolean(variableSupport.editor);
|
6123
6412
|
};
|
6413
|
+
const hasDataSourceVariableSupport = (datasource) => {
|
6414
|
+
if (!datasource.variables) {
|
6415
|
+
return false;
|
6416
|
+
}
|
6417
|
+
return datasource.variables.getType() === data.VariableSupportType.Datasource;
|
6418
|
+
};
|
6124
6419
|
|
6125
6420
|
var __defProp$w = Object.defineProperty;
|
6126
6421
|
var __defProps$k = Object.defineProperties;
|
@@ -6216,6 +6511,29 @@ class CustomQueryRunner {
|
|
6216
6511
|
return this._runRequest(this.datasource, request, this.datasource.variables.query.bind(this.datasource.variables));
|
6217
6512
|
}
|
6218
6513
|
}
|
6514
|
+
const variableDummyRefId = "variable-query";
|
6515
|
+
class DatasourceQueryRunner {
|
6516
|
+
constructor(datasource, _runRequest = runtime.getRunRequest()) {
|
6517
|
+
this.datasource = datasource;
|
6518
|
+
this._runRequest = _runRequest;
|
6519
|
+
}
|
6520
|
+
getTarget(variable) {
|
6521
|
+
var _a;
|
6522
|
+
if (hasDataSourceVariableSupport(this.datasource)) {
|
6523
|
+
if (typeof variable.state.query === "string") {
|
6524
|
+
return variable.state.query;
|
6525
|
+
}
|
6526
|
+
return __spreadProps$k(__spreadValues$w({}, variable.state.query), { refId: (_a = variable.state.query.refId) != null ? _a : variableDummyRefId });
|
6527
|
+
}
|
6528
|
+
throw new Error("Couldn't create a target with supplied arguments.");
|
6529
|
+
}
|
6530
|
+
runRequest(_, request) {
|
6531
|
+
if (!hasDataSourceVariableSupport(this.datasource)) {
|
6532
|
+
return getEmptyMetricFindValueObservable();
|
6533
|
+
}
|
6534
|
+
return this._runRequest(this.datasource, request, this.datasource.query);
|
6535
|
+
}
|
6536
|
+
}
|
6219
6537
|
function getEmptyMetricFindValueObservable() {
|
6220
6538
|
return rxjs.of({ state: data.LoadingState.Done, series: [], timeRange: data.getDefaultTimeRange() });
|
6221
6539
|
}
|
@@ -6229,6 +6547,9 @@ function createQueryVariableRunnerFactory(datasource) {
|
|
6229
6547
|
if (hasCustomVariableSupport(datasource)) {
|
6230
6548
|
return new CustomQueryRunner(datasource);
|
6231
6549
|
}
|
6550
|
+
if (hasDataSourceVariableSupport(datasource)) {
|
6551
|
+
return new DatasourceQueryRunner(datasource);
|
6552
|
+
}
|
6232
6553
|
throw new Error(`Couldn't create a query runner for datasource ${datasource.type}`);
|
6233
6554
|
}
|
6234
6555
|
let createQueryVariableRunner = createQueryVariableRunnerFactory;
|
@@ -6305,28 +6626,6 @@ const sortVariableValues = (options, sortOrder) => {
|
|
6305
6626
|
if (sortOrder === data.VariableSort.disabled) {
|
6306
6627
|
return options;
|
6307
6628
|
}
|
6308
|
-
const sortByNumeric = (opt) => {
|
6309
|
-
if (!opt.text) {
|
6310
|
-
return -1;
|
6311
|
-
}
|
6312
|
-
const matches = opt.text.match(/.*?(\d+).*/);
|
6313
|
-
if (!matches || matches.length < 2) {
|
6314
|
-
return -1;
|
6315
|
-
} else {
|
6316
|
-
return parseInt(matches[1], 10);
|
6317
|
-
}
|
6318
|
-
};
|
6319
|
-
const sortByNaturalSort = (options2) => {
|
6320
|
-
return options2.sort((a, b) => {
|
6321
|
-
if (!a.text) {
|
6322
|
-
return -1;
|
6323
|
-
}
|
6324
|
-
if (!b.text) {
|
6325
|
-
return 1;
|
6326
|
-
}
|
6327
|
-
return a.text.localeCompare(b.text, void 0, { numeric: true });
|
6328
|
-
});
|
6329
|
-
};
|
6330
6629
|
switch (sortOrder) {
|
6331
6630
|
case data.VariableSort.alphabeticalAsc:
|
6332
6631
|
options = lodash.sortBy(options, "label");
|
@@ -6362,6 +6661,23 @@ const sortVariableValues = (options, sortOrder) => {
|
|
6362
6661
|
}
|
6363
6662
|
return options;
|
6364
6663
|
};
|
6664
|
+
function sortByNumeric(opt) {
|
6665
|
+
if (!opt.label) {
|
6666
|
+
return -1;
|
6667
|
+
}
|
6668
|
+
const matches = opt.label.match(/.*?(\d+).*/);
|
6669
|
+
if (!matches || matches.length < 2) {
|
6670
|
+
return -1;
|
6671
|
+
} else {
|
6672
|
+
return parseInt(matches[1], 10);
|
6673
|
+
}
|
6674
|
+
}
|
6675
|
+
const collator = new Intl.Collator(void 0, { sensitivity: "accent", numeric: true });
|
6676
|
+
function sortByNaturalSort(options) {
|
6677
|
+
return options.slice().sort((a, b) => {
|
6678
|
+
return collator.compare(a.label, b.label);
|
6679
|
+
});
|
6680
|
+
}
|
6365
6681
|
|
6366
6682
|
function toMetricFindValues() {
|
6367
6683
|
return (source) => source.pipe(
|
@@ -6717,30 +7033,6 @@ function findDescendents(scene, descendentType) {
|
|
6717
7033
|
const targetScenes = findAllObjects(scene, isDescendentType);
|
6718
7034
|
return targetScenes.filter(isDescendentType);
|
6719
7035
|
}
|
6720
|
-
function getQueryController(sceneObject) {
|
6721
|
-
let parent = sceneObject;
|
6722
|
-
while (parent) {
|
6723
|
-
if (parent.state.$behaviors) {
|
6724
|
-
for (const behavior of parent.state.$behaviors) {
|
6725
|
-
if (isQueryController(behavior)) {
|
6726
|
-
return behavior;
|
6727
|
-
}
|
6728
|
-
}
|
6729
|
-
}
|
6730
|
-
parent = parent.parent;
|
6731
|
-
}
|
6732
|
-
return void 0;
|
6733
|
-
}
|
6734
|
-
function getUrlSyncManager(sceneObject) {
|
6735
|
-
let parent = sceneObject;
|
6736
|
-
while (parent) {
|
6737
|
-
if ("urlSyncManager" in parent.state) {
|
6738
|
-
return parent.state.urlSyncManager;
|
6739
|
-
}
|
6740
|
-
parent = parent.parent;
|
6741
|
-
}
|
6742
|
-
return void 0;
|
6743
|
-
}
|
6744
7036
|
|
6745
7037
|
const sceneGraph = {
|
6746
7038
|
getVariables,
|
@@ -6756,9 +7048,8 @@ const sceneGraph = {
|
|
6756
7048
|
findObject,
|
6757
7049
|
findAllObjects,
|
6758
7050
|
getAncestor,
|
6759
|
-
findDescendents,
|
6760
7051
|
getQueryController,
|
6761
|
-
|
7052
|
+
findDescendents
|
6762
7053
|
};
|
6763
7054
|
|
6764
7055
|
class UniqueUrlKeyMapper {
|
@@ -7580,7 +7871,8 @@ class VizPanel extends SceneObjectBase {
|
|
7580
7871
|
sceneTimeRange.state.to,
|
7581
7872
|
sceneTimeRange.getTimeZone(),
|
7582
7873
|
sceneTimeRange.state.fiscalYearStartMonth,
|
7583
|
-
sceneTimeRange.state.UNSAFE_nowDelay
|
7874
|
+
sceneTimeRange.state.UNSAFE_nowDelay,
|
7875
|
+
sceneTimeRange.state.weekStart
|
7584
7876
|
);
|
7585
7877
|
}
|
7586
7878
|
const plugin = this.getPlugin();
|
@@ -7727,7 +8019,13 @@ class VizPanel extends SceneObjectBase {
|
|
7727
8019
|
} else {
|
7728
8020
|
const { importPanelPlugin } = runtime.getPluginImportUtils();
|
7729
8021
|
try {
|
7730
|
-
const
|
8022
|
+
const panelPromise = importPanelPlugin(pluginId);
|
8023
|
+
const queryControler = sceneGraph.getQueryController(this);
|
8024
|
+
if (queryControler && queryControler.state.enableProfiling) {
|
8025
|
+
wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: "plugin", origin: this })).subscribe(() => {
|
8026
|
+
});
|
8027
|
+
}
|
8028
|
+
const result = await panelPromise;
|
7731
8029
|
this._pluginLoaded(result, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);
|
7732
8030
|
} catch (err) {
|
7733
8031
|
this._pluginLoaded(getPanelPluginNotFound(pluginId));
|
@@ -8691,7 +8989,8 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
|
|
8691
8989
|
timeRange.to,
|
8692
8990
|
this.state.timeZone,
|
8693
8991
|
timeRange.fiscalYearStartMonth,
|
8694
|
-
timeRange.UNSAFE_nowDelay
|
8992
|
+
timeRange.UNSAFE_nowDelay,
|
8993
|
+
timeRange.weekStart
|
8695
8994
|
)
|
8696
8995
|
}));
|
8697
8996
|
}
|
@@ -8699,14 +8998,16 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
|
|
8699
8998
|
return this.state.timeZone;
|
8700
8999
|
}
|
8701
9000
|
onTimeZoneChange(timeZone) {
|
9001
|
+
const parentTimeRange = this.getAncestorTimeRange();
|
8702
9002
|
this.setState({
|
8703
9003
|
timeZone,
|
8704
9004
|
value: evaluateTimeRange(
|
8705
|
-
|
8706
|
-
|
8707
|
-
|
8708
|
-
|
8709
|
-
|
9005
|
+
parentTimeRange.state.from,
|
9006
|
+
parentTimeRange.state.to,
|
9007
|
+
timeZone,
|
9008
|
+
parentTimeRange.state.fiscalYearStartMonth,
|
9009
|
+
parentTimeRange.state.UNSAFE_nowDelay,
|
9010
|
+
parentTimeRange.state.weekStart
|
8710
9011
|
)
|
8711
9012
|
});
|
8712
9013
|
}
|
@@ -11313,6 +11614,7 @@ class SceneRefreshPicker extends SceneObjectBase {
|
|
11313
11614
|
this._autoRefreshBlocked = false;
|
11314
11615
|
this.onRefresh = () => {
|
11315
11616
|
const queryController = sceneGraph.getQueryController(this);
|
11617
|
+
queryController == null ? void 0 : queryController.startProfile(this);
|
11316
11618
|
if (queryController == null ? void 0 : queryController.state.isRunning) {
|
11317
11619
|
queryController.cancelAll();
|
11318
11620
|
return;
|
@@ -11368,6 +11670,8 @@ class SceneRefreshPicker extends SceneObjectBase {
|
|
11368
11670
|
}
|
11369
11671
|
this._intervalTimer = setInterval(() => {
|
11370
11672
|
if (this.isTabVisible()) {
|
11673
|
+
const queryController = sceneGraph.getQueryController(this);
|
11674
|
+
queryController == null ? void 0 : queryController.startProfile(this);
|
11371
11675
|
timeRange.onRefresh();
|
11372
11676
|
} else {
|
11373
11677
|
this._autoRefreshBlocked = true;
|
@@ -11441,7 +11745,9 @@ function SceneRefreshPickerRenderer({ model }) {
|
|
11441
11745
|
tooltip,
|
11442
11746
|
width,
|
11443
11747
|
text,
|
11444
|
-
onRefresh:
|
11748
|
+
onRefresh: () => {
|
11749
|
+
model.onRefresh();
|
11750
|
+
},
|
11445
11751
|
primary,
|
11446
11752
|
onIntervalChanged: model.onIntervalChanged,
|
11447
11753
|
isLoading: isRunning,
|