@grafana/scenes 5.25.0 → 5.25.1--canary.858.11930656504.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/CHANGELOG.md +6 -6
  2. package/dist/esm/behaviors/SceneQueryController.js +60 -5
  3. package/dist/esm/behaviors/SceneQueryController.js.map +1 -1
  4. package/dist/esm/behaviors/SceneRenderProfiler.js +169 -0
  5. package/dist/esm/behaviors/SceneRenderProfiler.js.map +1 -0
  6. package/dist/esm/components/SceneRefreshPicker.js +6 -1
  7. package/dist/esm/components/SceneRefreshPicker.js.map +1 -1
  8. package/dist/esm/components/VizPanel/VizPanel.js +9 -6
  9. package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
  10. package/dist/esm/components/layout/grid/SceneGridRow.js +2 -1
  11. package/dist/esm/components/layout/grid/SceneGridRow.js.map +1 -1
  12. package/dist/esm/core/SceneTimeRange.js +3 -0
  13. package/dist/esm/core/SceneTimeRange.js.map +1 -1
  14. package/dist/esm/core/sceneGraph/getQueryController.js +19 -0
  15. package/dist/esm/core/sceneGraph/getQueryController.js.map +1 -0
  16. package/dist/esm/core/sceneGraph/index.js +3 -3
  17. package/dist/esm/core/sceneGraph/index.js.map +1 -1
  18. package/dist/esm/core/sceneGraph/sceneGraph.js +1 -26
  19. package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/querying/SceneQueryRunner.js +1 -3
  22. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  23. package/dist/esm/querying/registerQueryWithController.js +18 -2
  24. package/dist/esm/querying/registerQueryWithController.js.map +1 -1
  25. package/dist/esm/utils/getDataSource.js +17 -1
  26. package/dist/esm/utils/getDataSource.js.map +1 -1
  27. package/dist/esm/variables/VariableDependencyConfig.js +29 -0
  28. package/dist/esm/variables/VariableDependencyConfig.js.map +1 -1
  29. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +12 -8
  30. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  31. package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js +1 -4
  32. package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js.map +1 -1
  33. package/dist/esm/variables/components/VariableValueSelect.js +5 -0
  34. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  35. package/dist/esm/variables/sets/SceneVariableSet.js.map +1 -1
  36. package/dist/esm/variables/utils.js.map +1 -1
  37. package/dist/esm/variables/variants/TestVariable.js.map +1 -1
  38. package/dist/index.d.ts +49 -32
  39. package/dist/index.js +788 -509
  40. package/dist/index.js.map +1 -1
  41. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -41,19 +41,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var uFuzzy__default = /*#__PURE__*/_interopDefaultLegacy(uFuzzy);
42
42
  var ReactGridLayout__default = /*#__PURE__*/_interopDefaultLegacy(ReactGridLayout);
43
43
 
44
- var __defProp$P = Object.defineProperty;
45
- var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
46
- var __hasOwnProp$P = Object.prototype.hasOwnProperty;
47
- var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
48
- var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
- var __spreadValues$P = (a, b) => {
44
+ var __defProp$Q = Object.defineProperty;
45
+ var __getOwnPropSymbols$Q = Object.getOwnPropertySymbols;
46
+ var __hasOwnProp$Q = Object.prototype.hasOwnProperty;
47
+ var __propIsEnum$Q = Object.prototype.propertyIsEnumerable;
48
+ var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
+ var __spreadValues$Q = (a, b) => {
50
50
  for (var prop in b || (b = {}))
51
- if (__hasOwnProp$P.call(b, prop))
52
- __defNormalProp$P(a, prop, b[prop]);
53
- if (__getOwnPropSymbols$P)
54
- for (var prop of __getOwnPropSymbols$P(b)) {
55
- if (__propIsEnum$P.call(b, prop))
56
- __defNormalProp$P(a, prop, b[prop]);
51
+ if (__hasOwnProp$Q.call(b, prop))
52
+ __defNormalProp$Q(a, prop, b[prop]);
53
+ if (__getOwnPropSymbols$Q)
54
+ for (var prop of __getOwnPropSymbols$Q(b)) {
55
+ if (__propIsEnum$Q.call(b, prop))
56
+ __defNormalProp$Q(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$P({}, searchObject);
65
+ const paramsCopy = __spreadValues$Q({}, searchObject);
66
66
  if (preserveParams) {
67
67
  for (const key of Object.keys(paramsCopy)) {
68
68
  if (!preserveParams.includes(key)) {
@@ -76,31 +76,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
76
76
  return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
77
77
  }
78
78
 
79
- var __defProp$O = Object.defineProperty;
80
- var __defProps$w = Object.defineProperties;
81
- var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
82
- var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
83
- var __hasOwnProp$O = Object.prototype.hasOwnProperty;
84
- var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
85
- var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
86
- var __spreadValues$O = (a, b) => {
79
+ var __defProp$P = Object.defineProperty;
80
+ var __defProps$x = Object.defineProperties;
81
+ var __getOwnPropDescs$x = Object.getOwnPropertyDescriptors;
82
+ var __getOwnPropSymbols$P = Object.getOwnPropertySymbols;
83
+ var __hasOwnProp$P = Object.prototype.hasOwnProperty;
84
+ var __propIsEnum$P = Object.prototype.propertyIsEnumerable;
85
+ var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
86
+ var __spreadValues$P = (a, b) => {
87
87
  for (var prop in b || (b = {}))
88
- if (__hasOwnProp$O.call(b, prop))
89
- __defNormalProp$O(a, prop, b[prop]);
90
- if (__getOwnPropSymbols$O)
91
- for (var prop of __getOwnPropSymbols$O(b)) {
92
- if (__propIsEnum$O.call(b, prop))
93
- __defNormalProp$O(a, prop, b[prop]);
88
+ if (__hasOwnProp$P.call(b, prop))
89
+ __defNormalProp$P(a, prop, b[prop]);
90
+ if (__getOwnPropSymbols$P)
91
+ for (var prop of __getOwnPropSymbols$P(b)) {
92
+ if (__propIsEnum$P.call(b, prop))
93
+ __defNormalProp$P(a, prop, b[prop]);
94
94
  }
95
95
  return a;
96
96
  };
97
- var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
97
+ var __spreadProps$x = (a, b) => __defProps$x(a, __getOwnPropDescs$x(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$w(__spreadValues$O({}, plugin.meta), {
103
+ plugin.meta = __spreadProps$x(__spreadValues$P({}, 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$N = Object.defineProperty;
132
- var __defProps$v = Object.defineProperties;
133
- var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
134
- var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
135
- var __hasOwnProp$N = Object.prototype.hasOwnProperty;
136
- var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
137
- var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138
- var __spreadValues$N = (a, b) => {
131
+ var __defProp$O = Object.defineProperty;
132
+ var __defProps$w = Object.defineProperties;
133
+ var __getOwnPropDescs$w = Object.getOwnPropertyDescriptors;
134
+ var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
135
+ var __hasOwnProp$O = Object.prototype.hasOwnProperty;
136
+ var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
137
+ var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138
+ var __spreadValues$O = (a, b) => {
139
139
  for (var prop in b || (b = {}))
140
- if (__hasOwnProp$N.call(b, prop))
141
- __defNormalProp$N(a, prop, b[prop]);
142
- if (__getOwnPropSymbols$N)
143
- for (var prop of __getOwnPropSymbols$N(b)) {
144
- if (__propIsEnum$N.call(b, prop))
145
- __defNormalProp$N(a, prop, b[prop]);
140
+ if (__hasOwnProp$O.call(b, prop))
141
+ __defNormalProp$O(a, prop, b[prop]);
142
+ if (__getOwnPropSymbols$O)
143
+ for (var prop of __getOwnPropSymbols$O(b)) {
144
+ if (__propIsEnum$O.call(b, prop))
145
+ __defNormalProp$O(a, prop, b[prop]);
146
146
  }
147
147
  return a;
148
148
  };
149
- var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
149
+ var __spreadProps$w = (a, b) => __defProps$w(a, __getOwnPropDescs$w(b));
150
150
  var __objRest$5 = (source, exclude) => {
151
151
  var target = {};
152
152
  for (var prop in source)
153
- if (__hasOwnProp$N.call(source, prop) && exclude.indexOf(prop) < 0)
153
+ if (__hasOwnProp$O.call(source, prop) && exclude.indexOf(prop) < 0)
154
154
  target[prop] = source[prop];
155
- if (source != null && __getOwnPropSymbols$N)
156
- for (var prop of __getOwnPropSymbols$N(source)) {
157
- if (exclude.indexOf(prop) < 0 && __propIsEnum$N.call(source, prop))
155
+ if (source != null && __getOwnPropSymbols$O)
156
+ for (var prop of __getOwnPropSymbols$O(source)) {
157
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$O.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$v(__spreadValues$N({}, otherProps), {
175
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$w(__spreadValues$O({}, 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$3 = (obj, member, msg) => {
191
+ var __accessCheck$4 = (obj, member, msg) => {
192
192
  if (!member.has(obj))
193
193
  throw TypeError("Cannot " + msg);
194
194
  };
195
- var __privateGet$3 = (obj, member, getter) => {
196
- __accessCheck$3(obj, member, "read from private field");
195
+ var __privateGet$4 = (obj, member, getter) => {
196
+ __accessCheck$4(obj, member, "read from private field");
197
197
  return getter ? getter.call(obj) : member.get(obj);
198
198
  };
199
- var __privateAdd$3 = (obj, member, value) => {
199
+ var __privateAdd$4 = (obj, member, value) => {
200
200
  if (member.has(obj))
201
201
  throw TypeError("Cannot add the same private member more than once");
202
202
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
203
203
  };
204
- var __privateSet$2 = (obj, member, value, setter) => {
205
- __accessCheck$3(obj, member, "write to private field");
204
+ var __privateSet$4 = (obj, member, value, setter) => {
205
+ __accessCheck$4(obj, member, "write to private field");
206
206
  setter ? setter.call(obj, value) : member.set(obj, value);
207
207
  return value;
208
208
  };
209
209
  var _ref;
210
210
  class SceneObjectRef {
211
211
  constructor(ref) {
212
- __privateAdd$3(this, _ref, void 0);
213
- __privateSet$2(this, _ref, ref);
212
+ __privateAdd$4(this, _ref, void 0);
213
+ __privateSet$4(this, _ref, ref);
214
214
  }
215
215
  resolve() {
216
- return __privateGet$3(this, _ref);
216
+ return __privateGet$4(this, _ref);
217
217
  }
218
218
  }
219
219
  _ref = new WeakMap();
220
220
 
221
- var __defProp$M = Object.defineProperty;
222
- var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
223
- var __hasOwnProp$M = Object.prototype.hasOwnProperty;
224
- var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
225
- var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
226
- var __spreadValues$M = (a, b) => {
221
+ var __defProp$N = Object.defineProperty;
222
+ var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
223
+ var __hasOwnProp$N = Object.prototype.hasOwnProperty;
224
+ var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
225
+ var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
226
+ var __spreadValues$N = (a, b) => {
227
227
  for (var prop in b || (b = {}))
228
- if (__hasOwnProp$M.call(b, prop))
229
- __defNormalProp$M(a, prop, b[prop]);
230
- if (__getOwnPropSymbols$M)
231
- for (var prop of __getOwnPropSymbols$M(b)) {
232
- if (__propIsEnum$M.call(b, prop))
233
- __defNormalProp$M(a, prop, b[prop]);
228
+ if (__hasOwnProp$N.call(b, prop))
229
+ __defNormalProp$N(a, prop, b[prop]);
230
+ if (__getOwnPropSymbols$N)
231
+ for (var prop of __getOwnPropSymbols$N(b)) {
232
+ if (__propIsEnum$N.call(b, prop))
233
+ __defNormalProp$N(a, prop, b[prop]);
234
234
  }
235
235
  return a;
236
236
  };
@@ -293,7 +293,7 @@ class SceneObjectBase {
293
293
  }
294
294
  setState(update) {
295
295
  const prevState = this._state;
296
- const newState = __spreadValues$M(__spreadValues$M({}, this._state), update);
296
+ const newState = __spreadValues$N(__spreadValues$N({}, this._state), update);
297
297
  this._state = Object.freeze(newState);
298
298
  this._setParent(update);
299
299
  this._handleActivationOfChangedStateProps(prevState, newState);
@@ -489,19 +489,19 @@ function forEachChild(state, callback) {
489
489
  }
490
490
  }
491
491
 
492
- var __defProp$L = Object.defineProperty;
493
- var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
494
- var __hasOwnProp$L = Object.prototype.hasOwnProperty;
495
- var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
496
- var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
497
- var __spreadValues$L = (a, b) => {
492
+ var __defProp$M = Object.defineProperty;
493
+ var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
494
+ var __hasOwnProp$M = Object.prototype.hasOwnProperty;
495
+ var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
496
+ var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
497
+ var __spreadValues$M = (a, b) => {
498
498
  for (var prop in b || (b = {}))
499
- if (__hasOwnProp$L.call(b, prop))
500
- __defNormalProp$L(a, prop, b[prop]);
501
- if (__getOwnPropSymbols$L)
502
- for (var prop of __getOwnPropSymbols$L(b)) {
503
- if (__propIsEnum$L.call(b, prop))
504
- __defNormalProp$L(a, prop, b[prop]);
499
+ if (__hasOwnProp$M.call(b, prop))
500
+ __defNormalProp$M(a, prop, b[prop]);
501
+ if (__getOwnPropSymbols$M)
502
+ for (var prop of __getOwnPropSymbols$M(b)) {
503
+ if (__propIsEnum$M.call(b, prop))
504
+ __defNormalProp$M(a, prop, b[prop]);
505
505
  }
506
506
  return a;
507
507
  };
@@ -510,7 +510,7 @@ function cloneSceneObject(sceneObject, withState) {
510
510
  return new sceneObject.constructor(clonedState);
511
511
  }
512
512
  function cloneSceneObjectState(sceneState, withState) {
513
- const clonedState = __spreadValues$L({}, sceneState);
513
+ const clonedState = __spreadValues$M({}, sceneState);
514
514
  Object.assign(clonedState, withState);
515
515
  for (const key in clonedState) {
516
516
  if (withState && withState[key] !== void 0) {
@@ -611,6 +611,305 @@ function lookupVariable(name, sceneObject) {
611
611
  return null;
612
612
  }
613
613
 
614
+ function writeSceneLog(logger, message, ...rest) {
615
+ let loggingEnabled = false;
616
+ if (typeof window !== "undefined") {
617
+ loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
618
+ }
619
+ if (loggingEnabled) {
620
+ console.log(`${logger}: `, message, ...rest);
621
+ }
622
+ }
623
+
624
+ var __accessCheck$3 = (obj, member, msg) => {
625
+ if (!member.has(obj))
626
+ throw TypeError("Cannot " + msg);
627
+ };
628
+ var __privateGet$3 = (obj, member, getter) => {
629
+ __accessCheck$3(obj, member, "read from private field");
630
+ return getter ? getter.call(obj) : member.get(obj);
631
+ };
632
+ var __privateAdd$3 = (obj, member, value) => {
633
+ if (member.has(obj))
634
+ throw TypeError("Cannot add the same private member more than once");
635
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
636
+ };
637
+ var __privateSet$3 = (obj, member, value, setter) => {
638
+ __accessCheck$3(obj, member, "write to private field");
639
+ setter ? setter.call(obj, value) : member.set(obj, value);
640
+ return value;
641
+ };
642
+ var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
643
+ const POST_STORM_WINDOW = 2e3;
644
+ const SPAN_THRESHOLD = 30;
645
+ class SceneRenderProfiler {
646
+ constructor(queryController) {
647
+ this.queryController = queryController;
648
+ __privateAdd$3(this, _profileInProgress, null);
649
+ __privateAdd$3(this, _profileStartTs, null);
650
+ __privateAdd$3(this, _trailAnimationFrameId, null);
651
+ __privateAdd$3(this, _recordedTrailingSpans, []);
652
+ this.lastFrameTime = 0;
653
+ this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
654
+ const currentFrameTime = performance.now();
655
+ const frameLength = currentFrameTime - lastFrameTime;
656
+ __privateGet$3(this, _recordedTrailingSpans).push(frameLength);
657
+ if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
658
+ __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
659
+ () => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
660
+ ));
661
+ } else {
662
+ const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
663
+ const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
664
+ writeSceneLog(
665
+ this.constructor.name,
666
+ "Profile tail recorded, slow frames duration:",
667
+ slowFramesTime,
668
+ slowFrames,
669
+ __privateGet$3(this, _profileInProgress)
670
+ );
671
+ __privateSet$3(this, _recordedTrailingSpans, []);
672
+ const profileDuration = measurementStartTs - profileStartTs;
673
+ writeSceneLog(
674
+ this.constructor.name,
675
+ "Stoped recording, total measured time (network included):",
676
+ profileDuration + slowFramesTime
677
+ );
678
+ __privateSet$3(this, _trailAnimationFrameId, null);
679
+ const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
680
+ performance.measure("DashboardInteraction", {
681
+ start: profileStartTs,
682
+ end: profileEndTs
683
+ });
684
+ const networkDuration = captureNetwork(profileStartTs, profileEndTs);
685
+ if (this.queryController.state.onProfileComplete) {
686
+ this.queryController.state.onProfileComplete({
687
+ origin: __privateGet$3(this, _profileInProgress).origin,
688
+ crumbs: __privateGet$3(this, _profileInProgress).crumbs,
689
+ duration: profileDuration + slowFramesTime,
690
+ networkDuration,
691
+ jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
692
+ usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
693
+ totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
694
+ });
695
+ }
696
+ if (window.__runs) {
697
+ window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
698
+ `;
699
+ } else {
700
+ window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
701
+ `;
702
+ }
703
+ }
704
+ };
705
+ }
706
+ startProfile(name) {
707
+ if (__privateGet$3(this, _trailAnimationFrameId)) {
708
+ cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
709
+ __privateSet$3(this, _trailAnimationFrameId, null);
710
+ writeSceneLog(this.constructor.name, "New profile: Stopped recording frames");
711
+ }
712
+ __privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
713
+ __privateSet$3(this, _profileStartTs, performance.now());
714
+ writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
715
+ }
716
+ recordProfileTail(measurementStartTime, profileStartTs) {
717
+ __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
718
+ () => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
719
+ ));
720
+ }
721
+ tryCompletingProfile() {
722
+ writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
723
+ if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
724
+ writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
725
+ this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
726
+ }
727
+ }
728
+ isTailRecording() {
729
+ return Boolean(__privateGet$3(this, _trailAnimationFrameId));
730
+ }
731
+ cancelTailRecording() {
732
+ if (__privateGet$3(this, _trailAnimationFrameId)) {
733
+ cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
734
+ __privateSet$3(this, _trailAnimationFrameId, null);
735
+ writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
736
+ }
737
+ }
738
+ addCrumb(crumb) {
739
+ if (__privateGet$3(this, _profileInProgress)) {
740
+ __privateGet$3(this, _profileInProgress).crumbs.push(crumb);
741
+ }
742
+ }
743
+ }
744
+ _profileInProgress = new WeakMap();
745
+ _profileStartTs = new WeakMap();
746
+ _trailAnimationFrameId = new WeakMap();
747
+ _recordedTrailingSpans = new WeakMap();
748
+ function processRecordedSpans(spans) {
749
+ for (let i = spans.length - 1; i >= 0; i--) {
750
+ if (spans[i] > SPAN_THRESHOLD) {
751
+ return spans.slice(0, i + 1);
752
+ }
753
+ }
754
+ return [spans[0]];
755
+ }
756
+ function captureNetwork(startTs, endTs) {
757
+ const entries = performance.getEntriesByType("resource");
758
+ performance.clearResourceTimings();
759
+ const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
760
+ for (const entry of networkEntries) {
761
+ performance.measure("Network entry " + entry.name, {
762
+ start: entry.startTime,
763
+ end: entry.responseEnd
764
+ });
765
+ }
766
+ return calculateNetworkTime(networkEntries);
767
+ }
768
+ function calculateNetworkTime(requests) {
769
+ if (requests.length === 0) {
770
+ return 0;
771
+ }
772
+ requests.sort((a, b) => a.startTime - b.startTime);
773
+ let totalNetworkTime = 0;
774
+ let currentStart = requests[0].startTime;
775
+ let currentEnd = requests[0].responseEnd;
776
+ for (let i = 1; i < requests.length; i++) {
777
+ if (requests[i].startTime <= currentEnd) {
778
+ currentEnd = Math.max(currentEnd, requests[i].responseEnd);
779
+ } else {
780
+ totalNetworkTime += currentEnd - currentStart;
781
+ currentStart = requests[i].startTime;
782
+ currentEnd = requests[i].responseEnd;
783
+ }
784
+ }
785
+ totalNetworkTime += currentEnd - currentStart;
786
+ return totalNetworkTime;
787
+ }
788
+
789
+ var __defProp$L = Object.defineProperty;
790
+ var __defProps$v = Object.defineProperties;
791
+ var __getOwnPropDescs$v = Object.getOwnPropertyDescriptors;
792
+ var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
793
+ var __hasOwnProp$L = Object.prototype.hasOwnProperty;
794
+ var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
795
+ var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
796
+ var __spreadValues$L = (a, b) => {
797
+ for (var prop in b || (b = {}))
798
+ if (__hasOwnProp$L.call(b, prop))
799
+ __defNormalProp$L(a, prop, b[prop]);
800
+ if (__getOwnPropSymbols$L)
801
+ for (var prop of __getOwnPropSymbols$L(b)) {
802
+ if (__propIsEnum$L.call(b, prop))
803
+ __defNormalProp$L(a, prop, b[prop]);
804
+ }
805
+ return a;
806
+ };
807
+ var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
808
+ var __accessCheck$2 = (obj, member, msg) => {
809
+ if (!member.has(obj))
810
+ throw TypeError("Cannot " + msg);
811
+ };
812
+ var __privateGet$2 = (obj, member, getter) => {
813
+ __accessCheck$2(obj, member, "read from private field");
814
+ return getter ? getter.call(obj) : member.get(obj);
815
+ };
816
+ var __privateAdd$2 = (obj, member, value) => {
817
+ if (member.has(obj))
818
+ throw TypeError("Cannot add the same private member more than once");
819
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
820
+ };
821
+ var __privateSet$2 = (obj, member, value, setter) => {
822
+ __accessCheck$2(obj, member, "write to private field");
823
+ setter ? setter.call(obj, value) : member.set(obj, value);
824
+ return value;
825
+ };
826
+ var _running, _tryCompleteProfileFrameId;
827
+ function isQueryController(s) {
828
+ return "isQueryController" in s;
829
+ }
830
+ class SceneQueryController extends SceneObjectBase {
831
+ constructor(state = {}) {
832
+ super(__spreadProps$v(__spreadValues$L({}, state), { isRunning: false }));
833
+ this.isQueryController = true;
834
+ this.profiler = new SceneRenderProfiler(this);
835
+ __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
836
+ __privateAdd$2(this, _tryCompleteProfileFrameId, null);
837
+ this.runningQueriesCount = () => {
838
+ return __privateGet$2(this, _running).size;
839
+ };
840
+ this.addActivationHandler(() => {
841
+ return () => __privateGet$2(this, _running).clear();
842
+ });
843
+ }
844
+ startProfile(source) {
845
+ if (!this.state.enableProfiling) {
846
+ return;
847
+ }
848
+ this.profiler.startProfile(source.constructor.name);
849
+ }
850
+ queryStarted(entry) {
851
+ __privateGet$2(this, _running).add(entry);
852
+ this.changeRunningQueryCount(1, entry);
853
+ if (!this.state.isRunning) {
854
+ this.setState({ isRunning: true });
855
+ }
856
+ }
857
+ queryCompleted(entry) {
858
+ if (!__privateGet$2(this, _running).has(entry)) {
859
+ return;
860
+ }
861
+ __privateGet$2(this, _running).delete(entry);
862
+ this.changeRunningQueryCount(-1);
863
+ if (__privateGet$2(this, _running).size === 0) {
864
+ this.setState({ isRunning: false });
865
+ }
866
+ }
867
+ changeRunningQueryCount(dir, entry) {
868
+ var _a;
869
+ window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
870
+ if (dir === 1 && this.state.enableProfiling) {
871
+ if (entry) {
872
+ this.profiler.addCrumb(`${entry.origin.constructor.name}/${entry.type}`);
873
+ }
874
+ if (this.profiler.isTailRecording()) {
875
+ writeSceneLog(this.constructor.name, "New query started, cancelling tail recording");
876
+ this.profiler.cancelTailRecording();
877
+ }
878
+ }
879
+ if (this.state.enableProfiling) {
880
+ if (__privateGet$2(this, _tryCompleteProfileFrameId)) {
881
+ cancelAnimationFrame(__privateGet$2(this, _tryCompleteProfileFrameId));
882
+ }
883
+ __privateSet$2(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
884
+ this.profiler.tryCompletingProfile();
885
+ }));
886
+ }
887
+ }
888
+ cancelAll() {
889
+ var _a;
890
+ for (const entry of __privateGet$2(this, _running).values()) {
891
+ (_a = entry.cancel) == null ? void 0 : _a.call(entry);
892
+ }
893
+ }
894
+ }
895
+ _running = new WeakMap();
896
+ _tryCompleteProfileFrameId = new WeakMap();
897
+
898
+ function getQueryController(sceneObject) {
899
+ let parent = sceneObject;
900
+ while (parent) {
901
+ if (parent.state.$behaviors) {
902
+ for (const behavior of parent.state.$behaviors) {
903
+ if (isQueryController(behavior)) {
904
+ return behavior;
905
+ }
906
+ }
907
+ }
908
+ parent = parent.parent;
909
+ }
910
+ return void 0;
911
+ }
912
+
614
913
  var __defProp$K = Object.defineProperty;
615
914
  var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
616
915
  var __hasOwnProp$K = Object.prototype.hasOwnProperty;
@@ -787,6 +1086,8 @@ class SceneTimeRange extends SceneObjectBase {
787
1086
  this.state.UNSAFE_nowDelay
788
1087
  );
789
1088
  if (update.from !== this.state.from || update.to !== this.state.to) {
1089
+ const queryController = getQueryController(this);
1090
+ queryController == null ? void 0 : queryController.startProfile(this);
790
1091
  this._urlSync.performBrowserHistoryAction(() => {
791
1092
  this.setState(update);
792
1093
  });
@@ -2133,70 +2434,55 @@ function isDataLayer(obj) {
2133
2434
  return "isDataLayer" in obj;
2134
2435
  }
2135
2436
 
2136
- var __accessCheck$2 = (obj, member, msg) => {
2137
- if (!member.has(obj))
2138
- throw TypeError("Cannot " + msg);
2139
- };
2140
- var __privateGet$2 = (obj, member, getter) => {
2141
- __accessCheck$2(obj, member, "read from private field");
2142
- return getter ? getter.call(obj) : member.get(obj);
2143
- };
2144
- var __privateAdd$2 = (obj, member, value) => {
2145
- if (member.has(obj))
2146
- throw TypeError("Cannot add the same private member more than once");
2147
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2148
- };
2149
- var _running;
2150
- function isQueryController(s) {
2151
- return "isQueryController" in s;
2152
- }
2153
- class SceneQueryController extends SceneObjectBase {
2154
- constructor() {
2155
- super({ isRunning: false });
2156
- this.isQueryController = true;
2157
- __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
2158
- this.addActivationHandler(() => {
2159
- return () => __privateGet$2(this, _running).clear();
2160
- });
2161
- }
2162
- queryStarted(entry) {
2163
- __privateGet$2(this, _running).add(entry);
2164
- this.changeRunningQueryCount(1);
2165
- if (!this.state.isRunning) {
2166
- this.setState({ isRunning: true });
2167
- }
2168
- }
2169
- queryCompleted(entry) {
2170
- if (!__privateGet$2(this, _running).has(entry)) {
2171
- return;
2172
- }
2173
- __privateGet$2(this, _running).delete(entry);
2174
- this.changeRunningQueryCount(-1);
2175
- if (__privateGet$2(this, _running).size === 0) {
2176
- this.setState({ isRunning: false });
2177
- }
2178
- }
2179
- changeRunningQueryCount(dir) {
2180
- var _a;
2181
- window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
2182
- }
2183
- cancelAll() {
2184
- var _a;
2185
- for (const entry of __privateGet$2(this, _running).values()) {
2186
- (_a = entry.cancel) == null ? void 0 : _a.call(entry);
2437
+ function registerQueryWithController(entry) {
2438
+ return (queryStream) => {
2439
+ const queryControler = sceneGraph.getQueryController(entry.origin);
2440
+ if (!queryControler) {
2441
+ return queryStream;
2187
2442
  }
2188
- }
2443
+ return new rxjs.Observable((observer) => {
2444
+ if (!entry.cancel) {
2445
+ entry.cancel = () => observer.complete();
2446
+ }
2447
+ queryControler.queryStarted(entry);
2448
+ let markedAsCompleted = false;
2449
+ const sub = queryStream.subscribe({
2450
+ next: (v) => {
2451
+ if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
2452
+ markedAsCompleted = true;
2453
+ queryControler.queryCompleted(entry);
2454
+ }
2455
+ observer.next(v);
2456
+ },
2457
+ error: (e) => observer.error(e),
2458
+ complete: () => {
2459
+ observer.complete();
2460
+ }
2461
+ });
2462
+ return () => {
2463
+ sub.unsubscribe();
2464
+ if (!markedAsCompleted) {
2465
+ queryControler.queryCompleted(entry);
2466
+ }
2467
+ };
2468
+ });
2469
+ };
2189
2470
  }
2190
- _running = new WeakMap();
2191
-
2192
- function writeSceneLog(logger, message, ...rest) {
2193
- let loggingEnabled = false;
2194
- if (typeof window !== "undefined") {
2195
- loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
2196
- }
2197
- if (loggingEnabled) {
2198
- console.log(`${logger}: `, message, ...rest);
2199
- }
2471
+ function wrapPromiseInStateObservable(promise) {
2472
+ return new rxjs.Observable((observer) => {
2473
+ observer.next({ state: schema.LoadingState.Loading });
2474
+ const promiseObservable = rxjs.from(promise);
2475
+ promiseObservable.pipe(
2476
+ rxjs.map(() => ({ state: schema.LoadingState.Done })),
2477
+ rxjs.catchError(() => {
2478
+ observer.next({ state: schema.LoadingState.Error });
2479
+ return [];
2480
+ })
2481
+ ).subscribe({
2482
+ next: (result) => observer.next(result),
2483
+ complete: () => observer.complete()
2484
+ });
2485
+ });
2200
2486
  }
2201
2487
 
2202
2488
  async function getDataSource(datasource, scopedVars) {
@@ -2209,7 +2495,21 @@ async function getDataSource(datasource, scopedVars) {
2209
2495
  if (datasource && datasource.query) {
2210
2496
  return datasource;
2211
2497
  }
2212
- return await runtime.getDataSourceSrv().get(datasource, scopedVars);
2498
+ const dsPromise = runtime.getDataSourceSrv().get(datasource, scopedVars);
2499
+ if (scopedVars.__sceneObject && scopedVars.__sceneObject.value.valueOf()) {
2500
+ const queryControler = sceneGraph.getQueryController(scopedVars.__sceneObject.value.valueOf());
2501
+ if (queryControler && queryControler.state.enableProfiling) {
2502
+ wrapPromiseInStateObservable(dsPromise).pipe(
2503
+ registerQueryWithController({
2504
+ type: "plugin",
2505
+ origin: scopedVars.__sceneObject.value.valueOf()
2506
+ })
2507
+ ).subscribe(() => {
2508
+ });
2509
+ }
2510
+ }
2511
+ const result = await dsPromise;
2512
+ return result;
2213
2513
  }
2214
2514
 
2215
2515
  class VariableValueRecorder {
@@ -2457,41 +2757,6 @@ function findActiveAdHocFilterVariableByUid(dsUid) {
2457
2757
  return void 0;
2458
2758
  }
2459
2759
 
2460
- function registerQueryWithController(entry) {
2461
- return (queryStream) => {
2462
- const queryControler = sceneGraph.getQueryController(entry.origin);
2463
- if (!queryControler) {
2464
- return queryStream;
2465
- }
2466
- return new rxjs.Observable((observer) => {
2467
- if (!entry.cancel) {
2468
- entry.cancel = () => observer.complete();
2469
- }
2470
- queryControler.queryStarted(entry);
2471
- let markedAsCompleted = false;
2472
- const sub = queryStream.subscribe({
2473
- next: (v) => {
2474
- if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
2475
- markedAsCompleted = true;
2476
- queryControler.queryCompleted(entry);
2477
- }
2478
- observer.next(v);
2479
- },
2480
- error: (e) => observer.error(e),
2481
- complete: () => {
2482
- observer.complete();
2483
- }
2484
- });
2485
- return () => {
2486
- sub.unsubscribe();
2487
- if (!markedAsCompleted) {
2488
- queryControler.queryCompleted(entry);
2489
- }
2490
- };
2491
- });
2492
- };
2493
- }
2494
-
2495
2760
  const allActiveGroupByVariables = /* @__PURE__ */ new Set();
2496
2761
  function findActiveGroupByVariablesByUid(dsUid) {
2497
2762
  var _a;
@@ -2600,6 +2865,7 @@ function VariableValueSelect({ model }) {
2600
2865
  const [inputValue, setInputValue] = React.useState("");
2601
2866
  const [hasCustomValue, setHasCustomValue] = React.useState(false);
2602
2867
  const selectValue = toSelectableValue$2(value, String(text));
2868
+ const queryController = sceneGraph.getQueryController(model);
2603
2869
  const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
2604
2870
  const onInputChange = (value2, { action }) => {
2605
2871
  if (action === "input-change") {
@@ -2639,6 +2905,7 @@ function VariableValueSelect({ model }) {
2639
2905
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
2640
2906
  onChange: (newValue) => {
2641
2907
  model.changeValueTo(newValue.value, newValue.label);
2908
+ queryController == null ? void 0 : queryController.startProfile(model);
2642
2909
  if (hasCustomValue !== newValue.__isNew__) {
2643
2910
  setHasCustomValue(newValue.__isNew__);
2644
2911
  }
@@ -2650,6 +2917,7 @@ function VariableValueSelectMulti({ model }) {
2650
2917
  const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
2651
2918
  const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
2652
2919
  const [inputValue, setInputValue] = React.useState("");
2920
+ const queryController = sceneGraph.getQueryController(model);
2653
2921
  const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
2654
2922
  React.useEffect(() => {
2655
2923
  setUncommittedValue(arrayValue);
@@ -2695,6 +2963,7 @@ function VariableValueSelectMulti({ model }) {
2695
2963
  onInputChange,
2696
2964
  onBlur: () => {
2697
2965
  model.changeValueTo(uncommittedValue);
2966
+ queryController == null ? void 0 : queryController.startProfile(model);
2698
2967
  },
2699
2968
  filterOption: filterNoOp$2,
2700
2969
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
@@ -3308,10 +3577,12 @@ function AdHocFilterRenderer({ filter, model }) {
3308
3577
  const [isOperatorOpen, setIsOperatorOpen] = React.useState(false);
3309
3578
  const [valueInputValue, setValueInputValue] = React.useState("");
3310
3579
  const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
3311
- const [uncommittedValue, setUncommittedValue] = React.useState(filter.values ? filter.values.map((value, index) => {
3312
- var _a2;
3313
- return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
3314
- }) : []);
3580
+ const [uncommittedValue, setUncommittedValue] = React.useState(
3581
+ filter.values ? filter.values.map((value, index) => {
3582
+ var _a2;
3583
+ return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
3584
+ }) : []
3585
+ );
3315
3586
  const isMultiValue = isMultiValueOperator(filter.operator);
3316
3587
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3317
3588
  const valueValue = keyLabelToOption(filter.value, (_a = filter.valueLabels) == null ? void 0 : _a[0]);
@@ -3334,10 +3605,12 @@ function AdHocFilterRenderer({ filter, model }) {
3334
3605
  setUncommittedValue([]);
3335
3606
  } else if (!isMultiValueOperator(existingOperator) && isMultiValueOperator(newOperator) && filter.value) {
3336
3607
  update.values = [filter.value];
3337
- setUncommittedValue([{
3338
- value: filter.value,
3339
- label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
3340
- }]);
3608
+ setUncommittedValue([
3609
+ {
3610
+ value: filter.value,
3611
+ label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
3612
+ }
3613
+ ]);
3341
3614
  }
3342
3615
  model._updateFilter(filter, update);
3343
3616
  };
@@ -3616,10 +3889,7 @@ function deserializeUrlToFilters(value) {
3616
3889
  }
3617
3890
  function toArray(filter) {
3618
3891
  var _a;
3619
- const result = [
3620
- toUrlCommaDelimitedString(filter.key, filter.keyLabel),
3621
- filter.operator
3622
- ];
3892
+ const result = [toUrlCommaDelimitedString(filter.key, filter.keyLabel), filter.operator];
3623
3893
  if (isMultiValueOperator(filter.operator)) {
3624
3894
  filter.values.forEach((value, index) => {
3625
3895
  var _a2;
@@ -5346,9 +5616,7 @@ class SceneQueryRunner extends SceneObjectBase {
5346
5616
  })
5347
5617
  );
5348
5618
  }
5349
- this.subscribeToTimeRangeChanges(
5350
- timeRange
5351
- );
5619
+ this.subscribeToTimeRangeChanges(timeRange);
5352
5620
  if (this.shouldRunQueriesOnActivate()) {
5353
5621
  this.runQueries();
5354
5622
  }
@@ -5868,6 +6136,40 @@ function handleOptionGroups(values) {
5868
6136
  return result;
5869
6137
  }
5870
6138
 
6139
+ var __defProp$w = Object.defineProperty;
6140
+ var __defProps$k = Object.defineProperties;
6141
+ var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
6142
+ var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
6143
+ var __hasOwnProp$w = Object.prototype.hasOwnProperty;
6144
+ var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
6145
+ var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6146
+ var __spreadValues$w = (a, b) => {
6147
+ for (var prop in b || (b = {}))
6148
+ if (__hasOwnProp$w.call(b, prop))
6149
+ __defNormalProp$w(a, prop, b[prop]);
6150
+ if (__getOwnPropSymbols$w)
6151
+ for (var prop of __getOwnPropSymbols$w(b)) {
6152
+ if (__propIsEnum$w.call(b, prop))
6153
+ __defNormalProp$w(a, prop, b[prop]);
6154
+ }
6155
+ return a;
6156
+ };
6157
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
6158
+ class ConstantVariable extends SceneObjectBase {
6159
+ constructor(initialState) {
6160
+ super(__spreadProps$k(__spreadValues$w({
6161
+ type: "constant",
6162
+ value: "",
6163
+ name: ""
6164
+ }, initialState), {
6165
+ skipUrlSync: true
6166
+ }));
6167
+ }
6168
+ getValue() {
6169
+ return this.state.value;
6170
+ }
6171
+ }
6172
+
5871
6173
  class VariableDependencyConfig {
5872
6174
  constructor(_sceneObject, _options) {
5873
6175
  this._sceneObject = _sceneObject;
@@ -5876,6 +6178,9 @@ class VariableDependencyConfig {
5876
6178
  this._isWaitingForVariables = false;
5877
6179
  this.scanCount = 0;
5878
6180
  this._statePaths = _options.statePaths;
6181
+ if (this._options.handleTimeMacros) {
6182
+ this.handleTimeMacros();
6183
+ }
5879
6184
  }
5880
6185
  hasDependencyOn(name) {
5881
6186
  return this.getNames().has(name);
@@ -5979,6 +6284,31 @@ class VariableDependencyConfig {
5979
6284
  this._dependencies.add(variableName);
5980
6285
  }
5981
6286
  }
6287
+ handleTimeMacros() {
6288
+ this._sceneObject.addActivationHandler(() => {
6289
+ const timeRange = sceneGraph.getTimeRange(this._sceneObject);
6290
+ const sub = timeRange.subscribeToState((newState, oldState) => {
6291
+ const deps = this.getNames();
6292
+ const hasFromDep = deps.has("__from");
6293
+ const hasToDep = deps.has("__to");
6294
+ const hasTimeZone = deps.has("__timezone");
6295
+ if (newState.value !== oldState.value) {
6296
+ if (hasFromDep) {
6297
+ const variable = new ConstantVariable({ name: "__from", value: newState.from });
6298
+ this.variableUpdateCompleted(variable, true);
6299
+ } else if (hasToDep) {
6300
+ const variable = new ConstantVariable({ name: "__to", value: newState.to });
6301
+ this.variableUpdateCompleted(variable, true);
6302
+ }
6303
+ }
6304
+ if (newState.timeZone !== oldState.timeZone && hasTimeZone) {
6305
+ const variable = new ConstantVariable({ name: "__timezone", value: newState.timeZone });
6306
+ this.variableUpdateCompleted(variable, true);
6307
+ }
6308
+ });
6309
+ return () => sub.unsubscribe();
6310
+ });
6311
+ }
5982
6312
  }
5983
6313
 
5984
6314
  const hasLegacyVariableSupport = (datasource) => {
@@ -6005,25 +6335,25 @@ const hasCustomVariableSupport = (datasource) => {
6005
6335
  return "query" in variableSupport && "editor" in variableSupport && Boolean(variableSupport.query) && Boolean(variableSupport.editor);
6006
6336
  };
6007
6337
 
6008
- var __defProp$w = Object.defineProperty;
6009
- var __defProps$k = Object.defineProperties;
6010
- var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
6011
- var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
6012
- var __hasOwnProp$w = Object.prototype.hasOwnProperty;
6013
- var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
6014
- var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6015
- var __spreadValues$w = (a, b) => {
6338
+ var __defProp$v = Object.defineProperty;
6339
+ var __defProps$j = Object.defineProperties;
6340
+ var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
6341
+ var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
6342
+ var __hasOwnProp$v = Object.prototype.hasOwnProperty;
6343
+ var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
6344
+ var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6345
+ var __spreadValues$v = (a, b) => {
6016
6346
  for (var prop in b || (b = {}))
6017
- if (__hasOwnProp$w.call(b, prop))
6018
- __defNormalProp$w(a, prop, b[prop]);
6019
- if (__getOwnPropSymbols$w)
6020
- for (var prop of __getOwnPropSymbols$w(b)) {
6021
- if (__propIsEnum$w.call(b, prop))
6022
- __defNormalProp$w(a, prop, b[prop]);
6347
+ if (__hasOwnProp$v.call(b, prop))
6348
+ __defNormalProp$v(a, prop, b[prop]);
6349
+ if (__getOwnPropSymbols$v)
6350
+ for (var prop of __getOwnPropSymbols$v(b)) {
6351
+ if (__propIsEnum$v.call(b, prop))
6352
+ __defNormalProp$v(a, prop, b[prop]);
6023
6353
  }
6024
6354
  return a;
6025
6355
  };
6026
- var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
6356
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
6027
6357
  class StandardQueryRunner {
6028
6358
  constructor(datasource, _runRequest = runtime.getRunRequest()) {
6029
6359
  this.datasource = datasource;
@@ -6060,7 +6390,7 @@ class LegacyQueryRunner {
6060
6390
  return getEmptyMetricFindValueObservable();
6061
6391
  }
6062
6392
  return rxjs.from(
6063
- this.datasource.metricFindQuery(variable.state.query, __spreadProps$k(__spreadValues$w({}, request), {
6393
+ this.datasource.metricFindQuery(variable.state.query, __spreadProps$j(__spreadValues$v({}, request), {
6064
6394
  variable: {
6065
6395
  name: variable.state.name,
6066
6396
  type: variable.state.type
@@ -6122,7 +6452,7 @@ function ensureVariableQueryModelIsADataQuery(variable) {
6122
6452
  return { query, refId: `variable-${variable.state.name}` };
6123
6453
  }
6124
6454
  if (query.refId == null) {
6125
- return __spreadProps$k(__spreadValues$w({}, query), { refId: `variable-${variable.state.name}` });
6455
+ return __spreadProps$j(__spreadValues$v({}, query), { refId: `variable-${variable.state.name}` });
6126
6456
  }
6127
6457
  return variable.state.query;
6128
6458
  }
@@ -6337,25 +6667,25 @@ function areMetricFindValues(data$1) {
6337
6667
  return false;
6338
6668
  }
6339
6669
 
6340
- var __defProp$v = Object.defineProperty;
6341
- var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
6342
- var __hasOwnProp$v = Object.prototype.hasOwnProperty;
6343
- var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
6344
- var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6345
- var __spreadValues$v = (a, b) => {
6670
+ var __defProp$u = Object.defineProperty;
6671
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
6672
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
6673
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
6674
+ var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6675
+ var __spreadValues$u = (a, b) => {
6346
6676
  for (var prop in b || (b = {}))
6347
- if (__hasOwnProp$v.call(b, prop))
6348
- __defNormalProp$v(a, prop, b[prop]);
6349
- if (__getOwnPropSymbols$v)
6350
- for (var prop of __getOwnPropSymbols$v(b)) {
6351
- if (__propIsEnum$v.call(b, prop))
6352
- __defNormalProp$v(a, prop, b[prop]);
6677
+ if (__hasOwnProp$u.call(b, prop))
6678
+ __defNormalProp$u(a, prop, b[prop]);
6679
+ if (__getOwnPropSymbols$u)
6680
+ for (var prop of __getOwnPropSymbols$u(b)) {
6681
+ if (__propIsEnum$u.call(b, prop))
6682
+ __defNormalProp$u(a, prop, b[prop]);
6353
6683
  }
6354
6684
  return a;
6355
6685
  };
6356
6686
  class QueryVariable extends MultiValueVariable {
6357
6687
  constructor(initialState) {
6358
- super(__spreadValues$v({
6688
+ super(__spreadValues$u({
6359
6689
  type: "query",
6360
6690
  name: "",
6361
6691
  value: "",
@@ -6600,30 +6930,6 @@ function findDescendents(scene, descendentType) {
6600
6930
  const targetScenes = findAllObjects(scene, isDescendentType);
6601
6931
  return targetScenes.filter(isDescendentType);
6602
6932
  }
6603
- function getQueryController(sceneObject) {
6604
- let parent = sceneObject;
6605
- while (parent) {
6606
- if (parent.state.$behaviors) {
6607
- for (const behavior of parent.state.$behaviors) {
6608
- if (isQueryController(behavior)) {
6609
- return behavior;
6610
- }
6611
- }
6612
- }
6613
- parent = parent.parent;
6614
- }
6615
- return void 0;
6616
- }
6617
- function getUrlSyncManager(sceneObject) {
6618
- let parent = sceneObject;
6619
- while (parent) {
6620
- if ("urlSyncManager" in parent.state) {
6621
- return parent.state.urlSyncManager;
6622
- }
6623
- parent = parent.parent;
6624
- }
6625
- return void 0;
6626
- }
6627
6933
 
6628
6934
  const sceneGraph = {
6629
6935
  getVariables,
@@ -6639,9 +6945,8 @@ const sceneGraph = {
6639
6945
  findObject,
6640
6946
  findAllObjects,
6641
6947
  getAncestor,
6642
- findDescendents,
6643
6948
  getQueryController,
6644
- getUrlSyncManager
6949
+ findDescendents
6645
6950
  };
6646
6951
 
6647
6952
  class UniqueUrlKeyMapper {
@@ -6802,28 +7107,28 @@ class ActWhenVariableChanged extends SceneObjectBase {
6802
7107
  }
6803
7108
  }
6804
7109
 
6805
- var __defProp$u = Object.defineProperty;
6806
- var __defProps$j = Object.defineProperties;
6807
- var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
6808
- var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
6809
- var __hasOwnProp$u = Object.prototype.hasOwnProperty;
6810
- var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
6811
- var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6812
- var __spreadValues$u = (a, b) => {
7110
+ var __defProp$t = Object.defineProperty;
7111
+ var __defProps$i = Object.defineProperties;
7112
+ var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
7113
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
7114
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
7115
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
7116
+ var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7117
+ var __spreadValues$t = (a, b) => {
6813
7118
  for (var prop in b || (b = {}))
6814
- if (__hasOwnProp$u.call(b, prop))
6815
- __defNormalProp$u(a, prop, b[prop]);
6816
- if (__getOwnPropSymbols$u)
6817
- for (var prop of __getOwnPropSymbols$u(b)) {
6818
- if (__propIsEnum$u.call(b, prop))
6819
- __defNormalProp$u(a, prop, b[prop]);
7119
+ if (__hasOwnProp$t.call(b, prop))
7120
+ __defNormalProp$t(a, prop, b[prop]);
7121
+ if (__getOwnPropSymbols$t)
7122
+ for (var prop of __getOwnPropSymbols$t(b)) {
7123
+ if (__propIsEnum$t.call(b, prop))
7124
+ __defNormalProp$t(a, prop, b[prop]);
6820
7125
  }
6821
7126
  return a;
6822
7127
  };
6823
- var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
7128
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
6824
7129
  class CursorSync extends SceneObjectBase {
6825
7130
  constructor(state) {
6826
- super(__spreadProps$j(__spreadValues$u({}, state), {
7131
+ super(__spreadProps$i(__spreadValues$t({}, state), {
6827
7132
  sync: state.sync || schema.DashboardCursorSync.Off
6828
7133
  }));
6829
7134
  this.getEventsBus = (panel) => {
@@ -7091,25 +7396,25 @@ const getAlertStateStyles = (theme) => {
7091
7396
  };
7092
7397
  };
7093
7398
 
7094
- var __defProp$t = Object.defineProperty;
7095
- var __defProps$i = Object.defineProperties;
7096
- var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
7097
- var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
7098
- var __hasOwnProp$t = Object.prototype.hasOwnProperty;
7099
- var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
7100
- var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7101
- var __spreadValues$t = (a, b) => {
7399
+ var __defProp$s = Object.defineProperty;
7400
+ var __defProps$h = Object.defineProperties;
7401
+ var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
7402
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
7403
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
7404
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
7405
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7406
+ var __spreadValues$s = (a, b) => {
7102
7407
  for (var prop in b || (b = {}))
7103
- if (__hasOwnProp$t.call(b, prop))
7104
- __defNormalProp$t(a, prop, b[prop]);
7105
- if (__getOwnPropSymbols$t)
7106
- for (var prop of __getOwnPropSymbols$t(b)) {
7107
- if (__propIsEnum$t.call(b, prop))
7108
- __defNormalProp$t(a, prop, b[prop]);
7408
+ if (__hasOwnProp$s.call(b, prop))
7409
+ __defNormalProp$s(a, prop, b[prop]);
7410
+ if (__getOwnPropSymbols$s)
7411
+ for (var prop of __getOwnPropSymbols$s(b)) {
7412
+ if (__propIsEnum$s.call(b, prop))
7413
+ __defNormalProp$s(a, prop, b[prop]);
7109
7414
  }
7110
7415
  return a;
7111
7416
  };
7112
- var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
7417
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
7113
7418
  const displayOverrideRef = "hideSeriesFrom";
7114
7419
  const isHideSeriesOverride = data.isSystemOverrideWithRef(displayOverrideRef);
7115
7420
  function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
@@ -7119,13 +7424,13 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
7119
7424
  if (currentIndex < 0) {
7120
7425
  if (mode === ui.SeriesVisibilityChangeMode.ToggleSelection) {
7121
7426
  const override3 = createOverride$1([displayName, ...getNamesOfHiddenFields(overrides, data)]);
7122
- return __spreadProps$i(__spreadValues$t({}, fieldConfig), {
7427
+ return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7123
7428
  overrides: [...fieldConfig.overrides, override3]
7124
7429
  });
7125
7430
  }
7126
7431
  const displayNames = getDisplayNames(data, displayName);
7127
7432
  const override2 = createOverride$1(displayNames);
7128
- return __spreadProps$i(__spreadValues$t({}, fieldConfig), {
7433
+ return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7129
7434
  overrides: [...fieldConfig.overrides, override2]
7130
7435
  });
7131
7436
  }
@@ -7138,22 +7443,22 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
7138
7443
  existing = existing.filter((el) => nameOfHiddenFields.indexOf(el) < 0);
7139
7444
  }
7140
7445
  if (existing[0] === displayName && existing.length === 1) {
7141
- return __spreadProps$i(__spreadValues$t({}, fieldConfig), {
7446
+ return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7142
7447
  overrides: overridesCopy
7143
7448
  });
7144
7449
  }
7145
7450
  const override2 = createOverride$1([displayName, ...nameOfHiddenFields]);
7146
- return __spreadProps$i(__spreadValues$t({}, fieldConfig), {
7451
+ return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7147
7452
  overrides: [...overridesCopy, override2]
7148
7453
  });
7149
7454
  }
7150
7455
  const override = createExtendedOverride(current, displayName);
7151
7456
  if (allFieldsAreExcluded(override, data)) {
7152
- return __spreadProps$i(__spreadValues$t({}, fieldConfig), {
7457
+ return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7153
7458
  overrides: overridesCopy
7154
7459
  });
7155
7460
  }
7156
- return __spreadProps$i(__spreadValues$t({}, fieldConfig), {
7461
+ return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7157
7462
  overrides: [...overridesCopy, override]
7158
7463
  });
7159
7464
  }
@@ -7178,7 +7483,7 @@ function createOverride$1(names, mode = data.ByNamesMatcherMode.exclude, propert
7178
7483
  }
7179
7484
  },
7180
7485
  properties: [
7181
- __spreadProps$i(__spreadValues$t({}, property), {
7486
+ __spreadProps$h(__spreadValues$s({}, property), {
7182
7487
  value: {
7183
7488
  viz: true,
7184
7489
  legend: false,
@@ -7250,32 +7555,32 @@ const getNamesOfHiddenFields = (overrides, data$1) => {
7250
7555
  return names;
7251
7556
  };
7252
7557
 
7253
- var __defProp$s = Object.defineProperty;
7254
- var __defProps$h = Object.defineProperties;
7255
- var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
7256
- var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
7257
- var __hasOwnProp$s = Object.prototype.hasOwnProperty;
7258
- var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
7259
- var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7260
- var __spreadValues$s = (a, b) => {
7558
+ var __defProp$r = Object.defineProperty;
7559
+ var __defProps$g = Object.defineProperties;
7560
+ var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
7561
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
7562
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
7563
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
7564
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7565
+ var __spreadValues$r = (a, b) => {
7261
7566
  for (var prop in b || (b = {}))
7262
- if (__hasOwnProp$s.call(b, prop))
7263
- __defNormalProp$s(a, prop, b[prop]);
7264
- if (__getOwnPropSymbols$s)
7265
- for (var prop of __getOwnPropSymbols$s(b)) {
7266
- if (__propIsEnum$s.call(b, prop))
7267
- __defNormalProp$s(a, prop, b[prop]);
7567
+ if (__hasOwnProp$r.call(b, prop))
7568
+ __defNormalProp$r(a, prop, b[prop]);
7569
+ if (__getOwnPropSymbols$r)
7570
+ for (var prop of __getOwnPropSymbols$r(b)) {
7571
+ if (__propIsEnum$r.call(b, prop))
7572
+ __defNormalProp$r(a, prop, b[prop]);
7268
7573
  }
7269
7574
  return a;
7270
7575
  };
7271
- var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
7576
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
7272
7577
  const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
7273
7578
  const { overrides } = fieldConfig;
7274
7579
  const currentIndex = fieldConfig.overrides.findIndex((override) => {
7275
7580
  return override.matcher.id === data.FieldMatcherID.byName && override.matcher.options === label;
7276
7581
  });
7277
7582
  if (currentIndex < 0) {
7278
- return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7583
+ return __spreadProps$g(__spreadValues$r({}, fieldConfig), {
7279
7584
  overrides: [...fieldConfig.overrides, createOverride(label, color)]
7280
7585
  });
7281
7586
  }
@@ -7283,19 +7588,19 @@ const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
7283
7588
  const existing = overridesCopy[currentIndex];
7284
7589
  const propertyIndex = existing.properties.findIndex((p) => p.id === "color");
7285
7590
  if (propertyIndex < 0) {
7286
- overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$s({}, existing), {
7591
+ overridesCopy[currentIndex] = __spreadProps$g(__spreadValues$r({}, existing), {
7287
7592
  properties: [...existing.properties, createProperty(color)]
7288
7593
  });
7289
- return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7594
+ return __spreadProps$g(__spreadValues$r({}, fieldConfig), {
7290
7595
  overrides: overridesCopy
7291
7596
  });
7292
7597
  }
7293
7598
  const propertiesCopy = Array.from(existing.properties);
7294
7599
  propertiesCopy[propertyIndex] = createProperty(color);
7295
- overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$s({}, existing), {
7600
+ overridesCopy[currentIndex] = __spreadProps$g(__spreadValues$r({}, existing), {
7296
7601
  properties: propertiesCopy
7297
7602
  });
7298
- return __spreadProps$h(__spreadValues$s({}, fieldConfig), {
7603
+ return __spreadProps$g(__spreadValues$r({}, fieldConfig), {
7299
7604
  overrides: overridesCopy
7300
7605
  });
7301
7606
  };
@@ -7318,29 +7623,29 @@ const createProperty = (color) => {
7318
7623
  };
7319
7624
  };
7320
7625
 
7321
- var __defProp$r = Object.defineProperty;
7322
- var __defProps$g = Object.defineProperties;
7323
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
7324
- var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
7325
- var __hasOwnProp$r = Object.prototype.hasOwnProperty;
7326
- var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
7327
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7328
- var __spreadValues$r = (a, b) => {
7626
+ var __defProp$q = Object.defineProperty;
7627
+ var __defProps$f = Object.defineProperties;
7628
+ var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
7629
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
7630
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
7631
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
7632
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7633
+ var __spreadValues$q = (a, b) => {
7329
7634
  for (var prop in b || (b = {}))
7330
- if (__hasOwnProp$r.call(b, prop))
7331
- __defNormalProp$r(a, prop, b[prop]);
7332
- if (__getOwnPropSymbols$r)
7333
- for (var prop of __getOwnPropSymbols$r(b)) {
7334
- if (__propIsEnum$r.call(b, prop))
7335
- __defNormalProp$r(a, prop, b[prop]);
7635
+ if (__hasOwnProp$q.call(b, prop))
7636
+ __defNormalProp$q(a, prop, b[prop]);
7637
+ if (__getOwnPropSymbols$q)
7638
+ for (var prop of __getOwnPropSymbols$q(b)) {
7639
+ if (__propIsEnum$q.call(b, prop))
7640
+ __defNormalProp$q(a, prop, b[prop]);
7336
7641
  }
7337
7642
  return a;
7338
7643
  };
7339
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
7644
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
7340
7645
  class VizPanel extends SceneObjectBase {
7341
7646
  constructor(state) {
7342
7647
  var _a;
7343
- super(__spreadValues$r({
7648
+ super(__spreadValues$q({
7344
7649
  options: {},
7345
7650
  fieldConfig: { defaults: {}, overrides: [] },
7346
7651
  title: "Title",
@@ -7460,7 +7765,7 @@ class VizPanel extends SceneObjectBase {
7460
7765
  };
7461
7766
  this._onInstanceStateChange = (state) => {
7462
7767
  if (this._panelContext) {
7463
- this._panelContext = __spreadProps$g(__spreadValues$r({}, this._panelContext), {
7768
+ this._panelContext = __spreadProps$f(__spreadValues$q({}, this._panelContext), {
7464
7769
  instanceState: state
7465
7770
  });
7466
7771
  }
@@ -7484,8 +7789,8 @@ class VizPanel extends SceneObjectBase {
7484
7789
  sortBy = sortKey;
7485
7790
  }
7486
7791
  this.onOptionsChange(
7487
- __spreadProps$g(__spreadValues$r({}, this.state.options), {
7488
- legend: __spreadProps$g(__spreadValues$r({}, legendOptions), { sortBy, sortDesc })
7792
+ __spreadProps$f(__spreadValues$q({}, this.state.options), {
7793
+ legend: __spreadProps$f(__spreadValues$q({}, legendOptions), { sortBy, sortDesc })
7489
7794
  }),
7490
7795
  true
7491
7796
  );
@@ -7513,7 +7818,13 @@ class VizPanel extends SceneObjectBase {
7513
7818
  } else {
7514
7819
  const { importPanelPlugin } = runtime.getPluginImportUtils();
7515
7820
  try {
7516
- const result = await importPanelPlugin(pluginId);
7821
+ const panelPromise = importPanelPlugin(pluginId);
7822
+ const queryControler = sceneGraph.getQueryController(this);
7823
+ if (queryControler && queryControler.state.enableProfiling) {
7824
+ wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: "plugin", origin: this })).subscribe(() => {
7825
+ });
7826
+ }
7827
+ const result = await panelPromise;
7517
7828
  this._pluginLoaded(result, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);
7518
7829
  } catch (err) {
7519
7830
  this._pluginLoaded(getPanelPluginNotFound(pluginId));
@@ -7582,11 +7893,7 @@ class VizPanel extends SceneObjectBase {
7582
7893
  }
7583
7894
  async changePluginType(pluginId, newOptions, newFieldConfig) {
7584
7895
  var _a, _b;
7585
- const {
7586
- options: prevOptions,
7587
- fieldConfig: prevFieldConfig,
7588
- pluginId: prevPluginId
7589
- } = this.state;
7896
+ const { options: prevOptions, fieldConfig: prevFieldConfig, pluginId: prevPluginId } = this.state;
7590
7897
  this._dataWithFieldConfig = void 0;
7591
7898
  const isAfterPluginChange = this.state.pluginId !== pluginId;
7592
7899
  await this._loadPlugin(pluginId, newOptions != null ? newOptions : {}, newFieldConfig, isAfterPluginChange);
@@ -7628,7 +7935,7 @@ class VizPanel extends SceneObjectBase {
7628
7935
  if (!data.compareArrayValues(newFrames, prevFrames, data.compareDataFrameStructures)) {
7629
7936
  this._structureRev++;
7630
7937
  }
7631
- this._dataWithFieldConfig = __spreadProps$g(__spreadValues$r({}, rawData), {
7938
+ this._dataWithFieldConfig = __spreadProps$f(__spreadValues$q({}, rawData), {
7632
7939
  structureRev: this._structureRev,
7633
7940
  series: newFrames
7634
7941
  });
@@ -7771,25 +8078,25 @@ function getMessageFromError(err) {
7771
8078
  return JSON.stringify(err);
7772
8079
  }
7773
8080
 
7774
- var __defProp$q = Object.defineProperty;
7775
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
7776
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
7777
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
7778
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7779
- var __spreadValues$q = (a, b) => {
8081
+ var __defProp$p = Object.defineProperty;
8082
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
8083
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
8084
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
8085
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8086
+ var __spreadValues$p = (a, b) => {
7780
8087
  for (var prop in b || (b = {}))
7781
- if (__hasOwnProp$q.call(b, prop))
7782
- __defNormalProp$q(a, prop, b[prop]);
7783
- if (__getOwnPropSymbols$q)
7784
- for (var prop of __getOwnPropSymbols$q(b)) {
7785
- if (__propIsEnum$q.call(b, prop))
7786
- __defNormalProp$q(a, prop, b[prop]);
8088
+ if (__hasOwnProp$p.call(b, prop))
8089
+ __defNormalProp$p(a, prop, b[prop]);
8090
+ if (__getOwnPropSymbols$p)
8091
+ for (var prop of __getOwnPropSymbols$p(b)) {
8092
+ if (__propIsEnum$p.call(b, prop))
8093
+ __defNormalProp$p(a, prop, b[prop]);
7787
8094
  }
7788
8095
  return a;
7789
8096
  };
7790
8097
  class SceneDataLayerBase extends SceneObjectBase {
7791
8098
  constructor(initialState, variableDependencyStatePaths = []) {
7792
- super(__spreadValues$q({
8099
+ super(__spreadValues$p({
7793
8100
  isEnabled: true
7794
8101
  }, initialState));
7795
8102
  this._results = new rxjs.ReplaySubject(1);
@@ -7914,33 +8221,33 @@ function DataLayerControlSwitch({ layer }) {
7914
8221
  }
7915
8222
  const containerStyle$1 = css.css({ display: "flex" });
7916
8223
 
7917
- var __defProp$p = Object.defineProperty;
7918
- var __defProps$f = Object.defineProperties;
7919
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
7920
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
7921
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
7922
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
7923
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7924
- var __spreadValues$p = (a, b) => {
8224
+ var __defProp$o = Object.defineProperty;
8225
+ var __defProps$e = Object.defineProperties;
8226
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
8227
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
8228
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
8229
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
8230
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8231
+ var __spreadValues$o = (a, b) => {
7925
8232
  for (var prop in b || (b = {}))
7926
- if (__hasOwnProp$p.call(b, prop))
7927
- __defNormalProp$p(a, prop, b[prop]);
7928
- if (__getOwnPropSymbols$p)
7929
- for (var prop of __getOwnPropSymbols$p(b)) {
7930
- if (__propIsEnum$p.call(b, prop))
7931
- __defNormalProp$p(a, prop, b[prop]);
8233
+ if (__hasOwnProp$o.call(b, prop))
8234
+ __defNormalProp$o(a, prop, b[prop]);
8235
+ if (__getOwnPropSymbols$o)
8236
+ for (var prop of __getOwnPropSymbols$o(b)) {
8237
+ if (__propIsEnum$o.call(b, prop))
8238
+ __defNormalProp$o(a, prop, b[prop]);
7932
8239
  }
7933
8240
  return a;
7934
8241
  };
7935
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
8242
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
7936
8243
  var __objRest$2 = (source, exclude) => {
7937
8244
  var target = {};
7938
8245
  for (var prop in source)
7939
- if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
8246
+ if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
7940
8247
  target[prop] = source[prop];
7941
- if (source != null && __getOwnPropSymbols$p)
7942
- for (var prop of __getOwnPropSymbols$p(source)) {
7943
- if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
8248
+ if (source != null && __getOwnPropSymbols$o)
8249
+ for (var prop of __getOwnPropSymbols$o(source)) {
8250
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
7944
8251
  target[prop] = source[prop];
7945
8252
  }
7946
8253
  return target;
@@ -7949,7 +8256,7 @@ const standardAnnotationSupport = {
7949
8256
  prepareAnnotation: (json) => {
7950
8257
  if (lodash.isString(json == null ? void 0 : json.query)) {
7951
8258
  const _a = json, { query } = _a, rest = __objRest$2(_a, ["query"]);
7952
- return __spreadProps$f(__spreadValues$p({}, rest), {
8259
+ return __spreadProps$e(__spreadValues$o({}, rest), {
7953
8260
  target: {
7954
8261
  refId: "annotation_query",
7955
8262
  query
@@ -8117,25 +8424,25 @@ function shouldUseLegacyRunner(datasource) {
8117
8424
  return !datasource.annotations || legacyRunner.includes(type);
8118
8425
  }
8119
8426
 
8120
- var __defProp$o = Object.defineProperty;
8121
- var __defProps$e = Object.defineProperties;
8122
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
8123
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
8124
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
8125
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
8126
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8127
- var __spreadValues$o = (a, b) => {
8427
+ var __defProp$n = Object.defineProperty;
8428
+ var __defProps$d = Object.defineProperties;
8429
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
8430
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
8431
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
8432
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
8433
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8434
+ var __spreadValues$n = (a, b) => {
8128
8435
  for (var prop in b || (b = {}))
8129
- if (__hasOwnProp$o.call(b, prop))
8130
- __defNormalProp$o(a, prop, b[prop]);
8131
- if (__getOwnPropSymbols$o)
8132
- for (var prop of __getOwnPropSymbols$o(b)) {
8133
- if (__propIsEnum$o.call(b, prop))
8134
- __defNormalProp$o(a, prop, b[prop]);
8436
+ if (__hasOwnProp$n.call(b, prop))
8437
+ __defNormalProp$n(a, prop, b[prop]);
8438
+ if (__getOwnPropSymbols$n)
8439
+ for (var prop of __getOwnPropSymbols$n(b)) {
8440
+ if (__propIsEnum$n.call(b, prop))
8441
+ __defNormalProp$n(a, prop, b[prop]);
8135
8442
  }
8136
8443
  return a;
8137
8444
  };
8138
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
8445
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
8139
8446
  let counter = 100;
8140
8447
  function getNextRequestId() {
8141
8448
  return "AQ" + counter++;
@@ -8160,8 +8467,8 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
8160
8467
  }))
8161
8468
  );
8162
8469
  }
8163
- const processor = __spreadValues$o(__spreadValues$o({}, standardAnnotationSupport), datasource.annotations);
8164
- const annotationWithDefaults = __spreadValues$o(__spreadValues$o({}, (_a = processor.getDefaultQuery) == null ? void 0 : _a.call(processor)), query);
8470
+ const processor = __spreadValues$n(__spreadValues$n({}, standardAnnotationSupport), datasource.annotations);
8471
+ const annotationWithDefaults = __spreadValues$n(__spreadValues$n({}, (_a = processor.getDefaultQuery) == null ? void 0 : _a.call(processor)), query);
8165
8472
  const annotation = processor.prepareAnnotation(annotationWithDefaults);
8166
8473
  if (!annotation) {
8167
8474
  return rxjs.of({
@@ -8184,7 +8491,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
8184
8491
  __annotation: { text: annotation.name, value: annotation },
8185
8492
  __sceneObject: wrapInSafeSerializableSceneObject(layer)
8186
8493
  };
8187
- const queryRequest = __spreadValues$o(__spreadProps$e(__spreadValues$o({
8494
+ const queryRequest = __spreadValues$n(__spreadProps$d(__spreadValues$n({
8188
8495
  startTime: Date.now(),
8189
8496
  requestId: getNextRequestId(),
8190
8497
  range: timeRange.state.value,
@@ -8194,7 +8501,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
8194
8501
  app: data.CoreApp.Dashboard,
8195
8502
  timezone: timeRange.getTimeZone(),
8196
8503
  targets: [
8197
- __spreadProps$e(__spreadValues$o({}, processedQuery), {
8504
+ __spreadProps$d(__spreadValues$n({}, processedQuery), {
8198
8505
  refId: "Anno"
8199
8506
  })
8200
8507
  ]
@@ -8212,7 +8519,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
8212
8519
  data$1.forEach((frame) => {
8213
8520
  var _a2;
8214
8521
  if (!((_a2 = frame.meta) == null ? void 0 : _a2.dataTopic)) {
8215
- frame.meta = __spreadProps$e(__spreadValues$o({}, frame.meta || {}), { dataTopic: data.DataTopic.Annotations });
8522
+ frame.meta = __spreadProps$d(__spreadValues$n({}, frame.meta || {}), { dataTopic: data.DataTopic.Annotations });
8216
8523
  }
8217
8524
  });
8218
8525
  return processor.processEvents(annotation, data$1).pipe(
@@ -8227,19 +8534,19 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
8227
8534
  );
8228
8535
  }
8229
8536
 
8230
- var __defProp$n = Object.defineProperty;
8231
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
8232
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
8233
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
8234
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8235
- var __spreadValues$n = (a, b) => {
8537
+ var __defProp$m = Object.defineProperty;
8538
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
8539
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
8540
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
8541
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8542
+ var __spreadValues$m = (a, b) => {
8236
8543
  for (var prop in b || (b = {}))
8237
- if (__hasOwnProp$n.call(b, prop))
8238
- __defNormalProp$n(a, prop, b[prop]);
8239
- if (__getOwnPropSymbols$n)
8240
- for (var prop of __getOwnPropSymbols$n(b)) {
8241
- if (__propIsEnum$n.call(b, prop))
8242
- __defNormalProp$n(a, prop, b[prop]);
8544
+ if (__hasOwnProp$m.call(b, prop))
8545
+ __defNormalProp$m(a, prop, b[prop]);
8546
+ if (__getOwnPropSymbols$m)
8547
+ for (var prop of __getOwnPropSymbols$m(b)) {
8548
+ if (__propIsEnum$m.call(b, prop))
8549
+ __defNormalProp$m(a, prop, b[prop]);
8243
8550
  }
8244
8551
  return a;
8245
8552
  };
@@ -8250,7 +8557,7 @@ function postProcessQueryResult(annotation, results) {
8250
8557
  }
8251
8558
  const processed = results.map((item) => {
8252
8559
  var _a;
8253
- const processedItem = __spreadValues$n({}, item);
8560
+ const processedItem = __spreadValues$m({}, item);
8254
8561
  processedItem.source = annotation;
8255
8562
  processedItem.color = runtime.config.theme2.visualization.getColorByName(annotation.iconColor);
8256
8563
  processedItem.type = annotation.name;
@@ -8299,29 +8606,29 @@ function isPanelAlert(event) {
8299
8606
  return event.eventType === "panel-alert";
8300
8607
  }
8301
8608
 
8302
- var __defProp$m = Object.defineProperty;
8303
- var __defProps$d = Object.defineProperties;
8304
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
8305
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
8306
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
8307
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
8308
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8309
- var __spreadValues$m = (a, b) => {
8609
+ var __defProp$l = Object.defineProperty;
8610
+ var __defProps$c = Object.defineProperties;
8611
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
8612
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
8613
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
8614
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
8615
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8616
+ var __spreadValues$l = (a, b) => {
8310
8617
  for (var prop in b || (b = {}))
8311
- if (__hasOwnProp$m.call(b, prop))
8312
- __defNormalProp$m(a, prop, b[prop]);
8313
- if (__getOwnPropSymbols$m)
8314
- for (var prop of __getOwnPropSymbols$m(b)) {
8315
- if (__propIsEnum$m.call(b, prop))
8316
- __defNormalProp$m(a, prop, b[prop]);
8618
+ if (__hasOwnProp$l.call(b, prop))
8619
+ __defNormalProp$l(a, prop, b[prop]);
8620
+ if (__getOwnPropSymbols$l)
8621
+ for (var prop of __getOwnPropSymbols$l(b)) {
8622
+ if (__propIsEnum$l.call(b, prop))
8623
+ __defNormalProp$l(a, prop, b[prop]);
8317
8624
  }
8318
8625
  return a;
8319
8626
  };
8320
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
8627
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
8321
8628
  class AnnotationsDataLayer extends SceneDataLayerBase {
8322
8629
  constructor(initialState) {
8323
8630
  super(
8324
- __spreadValues$m({
8631
+ __spreadValues$l({
8325
8632
  isEnabled: true
8326
8633
  }, initialState),
8327
8634
  ["query"]
@@ -8373,7 +8680,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
8373
8680
  this.publishResults(stateUpdate);
8374
8681
  });
8375
8682
  } catch (e) {
8376
- this.publishResults(__spreadProps$d(__spreadValues$m({}, emptyPanelData), {
8683
+ this.publishResults(__spreadProps$c(__spreadValues$l({}, emptyPanelData), {
8377
8684
  state: schema.LoadingState.Error,
8378
8685
  errors: [
8379
8686
  {
@@ -8390,9 +8697,9 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
8390
8697
  processEvents(query, events) {
8391
8698
  let processedEvents = postProcessQueryResult(query, events.events || []);
8392
8699
  processedEvents = dedupAnnotations(processedEvents);
8393
- const stateUpdate = __spreadProps$d(__spreadValues$m({}, emptyPanelData), { state: events.state });
8700
+ const stateUpdate = __spreadProps$c(__spreadValues$l({}, emptyPanelData), { state: events.state });
8394
8701
  const df = data.arrayToDataFrame(processedEvents);
8395
- df.meta = __spreadProps$d(__spreadValues$m({}, df.meta), {
8702
+ df.meta = __spreadProps$c(__spreadValues$l({}, df.meta), {
8396
8703
  dataTopic: data.DataTopic.Annotations
8397
8704
  });
8398
8705
  stateUpdate.series = [df];
@@ -8445,28 +8752,28 @@ class SceneTimeRangeTransformerBase extends SceneObjectBase {
8445
8752
  }
8446
8753
  }
8447
8754
 
8448
- var __defProp$l = Object.defineProperty;
8449
- var __defProps$c = Object.defineProperties;
8450
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
8451
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
8452
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
8453
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
8454
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8455
- var __spreadValues$l = (a, b) => {
8755
+ var __defProp$k = Object.defineProperty;
8756
+ var __defProps$b = Object.defineProperties;
8757
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
8758
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
8759
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
8760
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
8761
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8762
+ var __spreadValues$k = (a, b) => {
8456
8763
  for (var prop in b || (b = {}))
8457
- if (__hasOwnProp$l.call(b, prop))
8458
- __defNormalProp$l(a, prop, b[prop]);
8459
- if (__getOwnPropSymbols$l)
8460
- for (var prop of __getOwnPropSymbols$l(b)) {
8461
- if (__propIsEnum$l.call(b, prop))
8462
- __defNormalProp$l(a, prop, b[prop]);
8764
+ if (__hasOwnProp$k.call(b, prop))
8765
+ __defNormalProp$k(a, prop, b[prop]);
8766
+ if (__getOwnPropSymbols$k)
8767
+ for (var prop of __getOwnPropSymbols$k(b)) {
8768
+ if (__propIsEnum$k.call(b, prop))
8769
+ __defNormalProp$k(a, prop, b[prop]);
8463
8770
  }
8464
8771
  return a;
8465
8772
  };
8466
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
8773
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
8467
8774
  class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
8468
8775
  constructor(state) {
8469
- super(__spreadProps$c(__spreadValues$l({}, state), {
8776
+ super(__spreadProps$b(__spreadValues$k({}, state), {
8470
8777
  timeZone: state.timeZone,
8471
8778
  from: "now-6h",
8472
8779
  to: "now",
@@ -8474,7 +8781,7 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
8474
8781
  }));
8475
8782
  }
8476
8783
  ancestorTimeRangeChanged(timeRange) {
8477
- this.setState(__spreadProps$c(__spreadValues$l({}, timeRange), {
8784
+ this.setState(__spreadProps$b(__spreadValues$k({}, timeRange), {
8478
8785
  timeZone: this.state.timeZone,
8479
8786
  value: evaluateTimeRange(
8480
8787
  timeRange.from,
@@ -8535,25 +8842,25 @@ class DataProviderProxy extends SceneObjectBase {
8535
8842
  }
8536
8843
  }
8537
8844
 
8538
- var __defProp$k = Object.defineProperty;
8539
- var __defProps$b = Object.defineProperties;
8540
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
8541
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
8542
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
8543
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
8544
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8545
- var __spreadValues$k = (a, b) => {
8845
+ var __defProp$j = Object.defineProperty;
8846
+ var __defProps$a = Object.defineProperties;
8847
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
8848
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
8849
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
8850
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
8851
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8852
+ var __spreadValues$j = (a, b) => {
8546
8853
  for (var prop in b || (b = {}))
8547
- if (__hasOwnProp$k.call(b, prop))
8548
- __defNormalProp$k(a, prop, b[prop]);
8549
- if (__getOwnPropSymbols$k)
8550
- for (var prop of __getOwnPropSymbols$k(b)) {
8551
- if (__propIsEnum$k.call(b, prop))
8552
- __defNormalProp$k(a, prop, b[prop]);
8854
+ if (__hasOwnProp$j.call(b, prop))
8855
+ __defNormalProp$j(a, prop, b[prop]);
8856
+ if (__getOwnPropSymbols$j)
8857
+ for (var prop of __getOwnPropSymbols$j(b)) {
8858
+ if (__propIsEnum$j.call(b, prop))
8859
+ __defNormalProp$j(a, prop, b[prop]);
8553
8860
  }
8554
8861
  return a;
8555
8862
  };
8556
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
8863
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
8557
8864
  class SceneDataLayerSetBase extends SceneObjectBase {
8558
8865
  constructor() {
8559
8866
  super(...arguments);
@@ -8577,7 +8884,7 @@ class SceneDataLayerSetBase extends SceneObjectBase {
8577
8884
  series = series.concat(result.data.series);
8578
8885
  }
8579
8886
  }
8580
- const combinedData = __spreadProps$b(__spreadValues$k({}, emptyPanelData), { series });
8887
+ const combinedData = __spreadProps$a(__spreadValues$j({}, emptyPanelData), { series });
8581
8888
  this._results.next({ origin: this, data: combinedData });
8582
8889
  this.setStateHelper({ data: combinedData });
8583
8890
  }
@@ -8626,25 +8933,25 @@ SceneDataLayerSet.Component = ({ model }) => {
8626
8933
  })));
8627
8934
  };
8628
8935
 
8629
- var __defProp$j = Object.defineProperty;
8630
- var __defProps$a = Object.defineProperties;
8631
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
8632
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
8633
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
8634
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
8635
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8636
- var __spreadValues$j = (a, b) => {
8936
+ var __defProp$i = Object.defineProperty;
8937
+ var __defProps$9 = Object.defineProperties;
8938
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
8939
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
8940
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
8941
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
8942
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8943
+ var __spreadValues$i = (a, b) => {
8637
8944
  for (var prop in b || (b = {}))
8638
- if (__hasOwnProp$j.call(b, prop))
8639
- __defNormalProp$j(a, prop, b[prop]);
8640
- if (__getOwnPropSymbols$j)
8641
- for (var prop of __getOwnPropSymbols$j(b)) {
8642
- if (__propIsEnum$j.call(b, prop))
8643
- __defNormalProp$j(a, prop, b[prop]);
8945
+ if (__hasOwnProp$i.call(b, prop))
8946
+ __defNormalProp$i(a, prop, b[prop]);
8947
+ if (__getOwnPropSymbols$i)
8948
+ for (var prop of __getOwnPropSymbols$i(b)) {
8949
+ if (__propIsEnum$i.call(b, prop))
8950
+ __defNormalProp$i(a, prop, b[prop]);
8644
8951
  }
8645
8952
  return a;
8646
8953
  };
8647
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
8954
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
8648
8955
  class SceneDataTransformer extends SceneObjectBase {
8649
8956
  constructor(state) {
8650
8957
  super(state);
@@ -8721,7 +9028,7 @@ class SceneDataTransformer extends SceneObjectBase {
8721
9028
  const { series, annotations } = this._prevDataFromSource;
8722
9029
  if (data.series === series && data.annotations === annotations) {
8723
9030
  if (this.state.data && data.state !== this.state.data.state) {
8724
- this.setState({ data: __spreadProps$a(__spreadValues$j({}, this.state.data), { state: data.state }) });
9031
+ this.setState({ data: __spreadProps$9(__spreadValues$i({}, this.state.data), { state: data.state }) });
8725
9032
  }
8726
9033
  return true;
8727
9034
  }
@@ -8769,7 +9076,7 @@ class SceneDataTransformer extends SceneObjectBase {
8769
9076
  rxjs.map((values) => {
8770
9077
  const transformedSeries = values[0];
8771
9078
  const transformedAnnotations = values[1];
8772
- return __spreadProps$a(__spreadValues$j({}, data$1), {
9079
+ return __spreadProps$9(__spreadValues$i({}, data$1), {
8773
9080
  series: transformedSeries,
8774
9081
  annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
8775
9082
  });
@@ -8780,7 +9087,7 @@ class SceneDataTransformer extends SceneObjectBase {
8780
9087
  const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
8781
9088
  const transformationError = runtime.toDataQueryError(err);
8782
9089
  transformationError.message = `Error transforming data: ${transformationError.message}`;
8783
- const result = __spreadProps$a(__spreadValues$j({}, data$1), {
9090
+ const result = __spreadProps$9(__spreadValues$i({}, data$1), {
8784
9091
  state: data.LoadingState.Error,
8785
9092
  errors: [...sourceErr, transformationError]
8786
9093
  });
@@ -9117,40 +9424,6 @@ class SceneVariableSetVariableDependencyHandler {
9117
9424
  }
9118
9425
  }
9119
9426
 
9120
- var __defProp$i = Object.defineProperty;
9121
- var __defProps$9 = Object.defineProperties;
9122
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
9123
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
9124
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
9125
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
9126
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9127
- var __spreadValues$i = (a, b) => {
9128
- for (var prop in b || (b = {}))
9129
- if (__hasOwnProp$i.call(b, prop))
9130
- __defNormalProp$i(a, prop, b[prop]);
9131
- if (__getOwnPropSymbols$i)
9132
- for (var prop of __getOwnPropSymbols$i(b)) {
9133
- if (__propIsEnum$i.call(b, prop))
9134
- __defNormalProp$i(a, prop, b[prop]);
9135
- }
9136
- return a;
9137
- };
9138
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
9139
- class ConstantVariable extends SceneObjectBase {
9140
- constructor(initialState) {
9141
- super(__spreadProps$9(__spreadValues$i({
9142
- type: "constant",
9143
- value: "",
9144
- name: ""
9145
- }, initialState), {
9146
- skipUrlSync: true
9147
- }));
9148
- }
9149
- getValue() {
9150
- return this.state.value;
9151
- }
9152
- }
9153
-
9154
9427
  var __defProp$h = Object.defineProperty;
9155
9428
  var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
9156
9429
  var __hasOwnProp$h = Object.prototype.hasOwnProperty;
@@ -10682,7 +10955,8 @@ class SceneGridRow extends SceneObjectBase {
10682
10955
  width: GRID_COLUMN_COUNT
10683
10956
  }));
10684
10957
  this._variableDependency = new VariableDependencyConfig(this, {
10685
- statePaths: ["title"]
10958
+ statePaths: ["title"],
10959
+ handleTimeMacros: true
10686
10960
  });
10687
10961
  this.onCollapseToggle = () => {
10688
10962
  if (!this.state.isCollapsible) {
@@ -11136,6 +11410,7 @@ class SceneRefreshPicker extends SceneObjectBase {
11136
11410
  this._autoRefreshBlocked = false;
11137
11411
  this.onRefresh = () => {
11138
11412
  const queryController = sceneGraph.getQueryController(this);
11413
+ queryController == null ? void 0 : queryController.startProfile(this);
11139
11414
  if (queryController == null ? void 0 : queryController.state.isRunning) {
11140
11415
  queryController.cancelAll();
11141
11416
  return;
@@ -11191,6 +11466,8 @@ class SceneRefreshPicker extends SceneObjectBase {
11191
11466
  }
11192
11467
  this._intervalTimer = setInterval(() => {
11193
11468
  if (this.isTabVisible()) {
11469
+ const queryController = sceneGraph.getQueryController(this);
11470
+ queryController == null ? void 0 : queryController.startProfile(this);
11194
11471
  timeRange.onRefresh();
11195
11472
  } else {
11196
11473
  this._autoRefreshBlocked = true;
@@ -11264,7 +11541,9 @@ function SceneRefreshPickerRenderer({ model }) {
11264
11541
  tooltip,
11265
11542
  width,
11266
11543
  text,
11267
- onRefresh: model.onRefresh,
11544
+ onRefresh: () => {
11545
+ model.onRefresh();
11546
+ },
11268
11547
  primary,
11269
11548
  onIntervalChanged: model.onIntervalChanged,
11270
11549
  isLoading: isRunning,