@grafana/scenes 5.14.8--canary.858.10850008598.0 → 5.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/CHANGELOG.md +23 -6
  2. package/dist/esm/behaviors/SceneQueryController.js +5 -60
  3. package/dist/esm/behaviors/SceneQueryController.js.map +1 -1
  4. package/dist/esm/components/SceneRefreshPicker.js +1 -4
  5. package/dist/esm/components/SceneRefreshPicker.js.map +1 -1
  6. package/dist/esm/components/SceneTimePicker.js +2 -1
  7. package/dist/esm/components/SceneTimePicker.js.map +1 -1
  8. package/dist/esm/components/VizPanel/VizPanel.js +6 -9
  9. package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
  10. package/dist/esm/core/SceneTimeRange.js +2 -13
  11. package/dist/esm/core/SceneTimeRange.js.map +1 -1
  12. package/dist/esm/core/sceneGraph/index.js +3 -3
  13. package/dist/esm/core/sceneGraph/index.js.map +1 -1
  14. package/dist/esm/core/sceneGraph/sceneGraph.js +26 -1
  15. package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
  16. package/dist/esm/index.js +1 -0
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/querying/DataProviderProxy.js +37 -0
  19. package/dist/esm/querying/DataProviderProxy.js.map +1 -0
  20. package/dist/esm/querying/SceneQueryRunner.js +3 -1
  21. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  22. package/dist/esm/querying/registerQueryWithController.js +2 -19
  23. package/dist/esm/querying/registerQueryWithController.js.map +1 -1
  24. package/dist/esm/utils/getDataSource.js +1 -17
  25. package/dist/esm/utils/getDataSource.js.map +1 -1
  26. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +8 -12
  27. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  28. package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js +4 -1
  29. package/dist/esm/variables/adhoc/AdHocFiltersVariableUrlSyncHandler.js.map +1 -1
  30. package/dist/esm/variables/components/VariableValueSelect.js +0 -5
  31. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  32. package/dist/esm/variables/utils.js.map +1 -1
  33. package/dist/esm/variables/variants/MultiValueVariable.js.map +1 -1
  34. package/dist/esm/variables/variants/TestVariable.js.map +1 -1
  35. package/dist/index.d.ts +43 -44
  36. package/dist/index.js +266 -488
  37. package/dist/index.js.map +1 -1
  38. package/package.json +2 -2
  39. package/dist/esm/behaviors/SceneRenderProfiler.js +0 -169
  40. package/dist/esm/behaviors/SceneRenderProfiler.js.map +0 -1
  41. package/dist/esm/core/sceneGraph/getQueryController.js +0 -19
  42. package/dist/esm/core/sceneGraph/getQueryController.js.map +0 -1
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$O = Object.defineProperty;
45
+ var __getOwnPropSymbols$O = Object.getOwnPropertySymbols;
46
+ var __hasOwnProp$O = Object.prototype.hasOwnProperty;
47
+ var __propIsEnum$O = Object.prototype.propertyIsEnumerable;
48
+ var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
49
+ var __spreadValues$O = (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$O.call(b, prop))
52
+ __defNormalProp$O(a, prop, b[prop]);
53
+ if (__getOwnPropSymbols$O)
54
+ for (var prop of __getOwnPropSymbols$O(b)) {
55
+ if (__propIsEnum$O.call(b, prop))
56
+ __defNormalProp$O(a, prop, b[prop]);
57
57
  }
58
58
  return a;
59
59
  };
@@ -62,7 +62,7 @@ function useAppQueryParams() {
62
62
  return runtime.locationSearchToObject(location.search || "");
63
63
  }
64
64
  function getUrlWithAppState(path, preserveParams) {
65
- const paramsCopy = __spreadValues$P({}, runtime.locationService.getSearchObject());
65
+ const paramsCopy = __spreadValues$O({}, runtime.locationService.getSearchObject());
66
66
  if (preserveParams) {
67
67
  for (const key of Object.keys(paramsCopy)) {
68
68
  if (!preserveParams.includes(key)) {
@@ -76,31 +76,31 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
76
76
  return React__default["default"].createElement(sceneObject.Component, { model: sceneObject, routeProps });
77
77
  }
78
78
 
79
- var __defProp$O = Object.defineProperty;
80
- var __defProps$v = Object.defineProperties;
81
- var __getOwnPropDescs$v = 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$N = Object.defineProperty;
80
+ var __defProps$u = Object.defineProperties;
81
+ var __getOwnPropDescs$u = Object.getOwnPropertyDescriptors;
82
+ var __getOwnPropSymbols$N = Object.getOwnPropertySymbols;
83
+ var __hasOwnProp$N = Object.prototype.hasOwnProperty;
84
+ var __propIsEnum$N = Object.prototype.propertyIsEnumerable;
85
+ var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
86
+ var __spreadValues$N = (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$N.call(b, prop))
89
+ __defNormalProp$N(a, prop, b[prop]);
90
+ if (__getOwnPropSymbols$N)
91
+ for (var prop of __getOwnPropSymbols$N(b)) {
92
+ if (__propIsEnum$N.call(b, prop))
93
+ __defNormalProp$N(a, prop, b[prop]);
94
94
  }
95
95
  return a;
96
96
  };
97
- var __spreadProps$v = (a, b) => __defProps$v(a, __getOwnPropDescs$v(b));
97
+ var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(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$v(__spreadValues$O({}, plugin.meta), {
103
+ plugin.meta = __spreadProps$u(__spreadValues$N({}, 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$u = Object.defineProperties;
133
- var __getOwnPropDescs$u = 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$M = Object.defineProperty;
132
+ var __defProps$t = Object.defineProperties;
133
+ var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
134
+ var __getOwnPropSymbols$M = Object.getOwnPropertySymbols;
135
+ var __hasOwnProp$M = Object.prototype.hasOwnProperty;
136
+ var __propIsEnum$M = Object.prototype.propertyIsEnumerable;
137
+ var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138
+ var __spreadValues$M = (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$M.call(b, prop))
141
+ __defNormalProp$M(a, prop, b[prop]);
142
+ if (__getOwnPropSymbols$M)
143
+ for (var prop of __getOwnPropSymbols$M(b)) {
144
+ if (__propIsEnum$M.call(b, prop))
145
+ __defNormalProp$M(a, prop, b[prop]);
146
146
  }
147
147
  return a;
148
148
  };
149
- var __spreadProps$u = (a, b) => __defProps$u(a, __getOwnPropDescs$u(b));
149
+ var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(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$M.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$M)
156
+ for (var prop of __getOwnPropSymbols$M(source)) {
157
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$M.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$u(__spreadValues$N({}, otherProps), {
175
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$t(__spreadValues$M({}, 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$4 = (obj, member, msg) => {
191
+ var __accessCheck$3 = (obj, member, msg) => {
192
192
  if (!member.has(obj))
193
193
  throw TypeError("Cannot " + msg);
194
194
  };
195
- var __privateGet$4 = (obj, member, getter) => {
196
- __accessCheck$4(obj, member, "read from private field");
195
+ var __privateGet$3 = (obj, member, getter) => {
196
+ __accessCheck$3(obj, member, "read from private field");
197
197
  return getter ? getter.call(obj) : member.get(obj);
198
198
  };
199
- var __privateAdd$4 = (obj, member, value) => {
199
+ var __privateAdd$3 = (obj, member, value) => {
200
200
  if (member.has(obj))
201
201
  throw TypeError("Cannot add the same private member more than once");
202
202
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
203
203
  };
204
- var __privateSet$4 = (obj, member, value, setter) => {
205
- __accessCheck$4(obj, member, "write to private field");
204
+ var __privateSet$2 = (obj, member, value, setter) => {
205
+ __accessCheck$3(obj, member, "write to private field");
206
206
  setter ? setter.call(obj, value) : member.set(obj, value);
207
207
  return value;
208
208
  };
209
209
  var _ref;
210
210
  class SceneObjectRef {
211
211
  constructor(ref) {
212
- __privateAdd$4(this, _ref, void 0);
213
- __privateSet$4(this, _ref, ref);
212
+ __privateAdd$3(this, _ref, void 0);
213
+ __privateSet$2(this, _ref, ref);
214
214
  }
215
215
  resolve() {
216
- return __privateGet$4(this, _ref);
216
+ return __privateGet$3(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$L = Object.defineProperty;
222
+ var __getOwnPropSymbols$L = Object.getOwnPropertySymbols;
223
+ var __hasOwnProp$L = Object.prototype.hasOwnProperty;
224
+ var __propIsEnum$L = Object.prototype.propertyIsEnumerable;
225
+ var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
226
+ var __spreadValues$L = (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$L.call(b, prop))
229
+ __defNormalProp$L(a, prop, b[prop]);
230
+ if (__getOwnPropSymbols$L)
231
+ for (var prop of __getOwnPropSymbols$L(b)) {
232
+ if (__propIsEnum$L.call(b, prop))
233
+ __defNormalProp$L(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$L(__spreadValues$L({}, 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$K = Object.defineProperty;
493
+ var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
494
+ var __hasOwnProp$K = Object.prototype.hasOwnProperty;
495
+ var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
496
+ var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
497
+ var __spreadValues$K = (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$K.call(b, prop))
500
+ __defNormalProp$K(a, prop, b[prop]);
501
+ if (__getOwnPropSymbols$K)
502
+ for (var prop of __getOwnPropSymbols$K(b)) {
503
+ if (__propIsEnum$K.call(b, prop))
504
+ __defNormalProp$K(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$K({}, sceneState);
514
514
  for (const key in clonedState) {
515
515
  const propValue = clonedState[key];
516
516
  if (propValue instanceof SceneObjectBase) {
@@ -607,305 +607,6 @@ function lookupVariable(name, sceneObject) {
607
607
  return null;
608
608
  }
609
609
 
610
- function writeSceneLog(logger, message, ...rest) {
611
- let loggingEnabled = false;
612
- if (typeof window !== "undefined") {
613
- loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
614
- }
615
- if (loggingEnabled) {
616
- console.log(`${logger}: `, message, ...rest);
617
- }
618
- }
619
-
620
- var __accessCheck$3 = (obj, member, msg) => {
621
- if (!member.has(obj))
622
- throw TypeError("Cannot " + msg);
623
- };
624
- var __privateGet$3 = (obj, member, getter) => {
625
- __accessCheck$3(obj, member, "read from private field");
626
- return getter ? getter.call(obj) : member.get(obj);
627
- };
628
- var __privateAdd$3 = (obj, member, value) => {
629
- if (member.has(obj))
630
- throw TypeError("Cannot add the same private member more than once");
631
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
632
- };
633
- var __privateSet$3 = (obj, member, value, setter) => {
634
- __accessCheck$3(obj, member, "write to private field");
635
- setter ? setter.call(obj, value) : member.set(obj, value);
636
- return value;
637
- };
638
- var _profileInProgress, _profileStartTs, _trailAnimationFrameId, _recordedTrailingSpans;
639
- const POST_STORM_WINDOW = 2e3;
640
- const SPAN_THRESHOLD = 30;
641
- class SceneRenderProfiler {
642
- constructor(queryController) {
643
- this.queryController = queryController;
644
- __privateAdd$3(this, _profileInProgress, null);
645
- __privateAdd$3(this, _profileStartTs, null);
646
- __privateAdd$3(this, _trailAnimationFrameId, null);
647
- __privateAdd$3(this, _recordedTrailingSpans, []);
648
- this.lastFrameTime = 0;
649
- this.measureTrailingFrames = (measurementStartTs, lastFrameTime, profileStartTs) => {
650
- const currentFrameTime = performance.now();
651
- const frameLength = currentFrameTime - lastFrameTime;
652
- __privateGet$3(this, _recordedTrailingSpans).push(frameLength);
653
- if (currentFrameTime - measurementStartTs < POST_STORM_WINDOW) {
654
- __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
655
- () => this.measureTrailingFrames(measurementStartTs, currentFrameTime, profileStartTs)
656
- ));
657
- } else {
658
- const slowFrames = processRecordedSpans(__privateGet$3(this, _recordedTrailingSpans));
659
- const slowFramesTime = slowFrames.reduce((acc, val) => acc + val, 0);
660
- writeSceneLog(
661
- this.constructor.name,
662
- "Profile tail recorded, slow frames duration:",
663
- slowFramesTime,
664
- slowFrames,
665
- __privateGet$3(this, _profileInProgress)
666
- );
667
- __privateSet$3(this, _recordedTrailingSpans, []);
668
- const profileDuration = measurementStartTs - profileStartTs;
669
- writeSceneLog(
670
- this.constructor.name,
671
- "Stoped recording, total measured time (network included):",
672
- profileDuration + slowFramesTime
673
- );
674
- __privateSet$3(this, _trailAnimationFrameId, null);
675
- const profileEndTs = profileStartTs + profileDuration + slowFramesTime;
676
- performance.measure("DashboardInteraction", {
677
- start: profileStartTs,
678
- end: profileEndTs
679
- });
680
- const networkDuration = captureNetwork(profileStartTs, profileEndTs);
681
- if (this.queryController.state.onProfileComplete) {
682
- this.queryController.state.onProfileComplete({
683
- origin: __privateGet$3(this, _profileInProgress).origin,
684
- crumbs: __privateGet$3(this, _profileInProgress).crumbs,
685
- duration: profileDuration + slowFramesTime,
686
- networkDuration,
687
- jsHeapSizeLimit: performance.memory ? performance.memory.jsHeapSizeLimit : 0,
688
- usedJSHeapSize: performance.memory ? performance.memory.usedJSHeapSize : 0,
689
- totalJSHeapSize: performance.memory ? performance.memory.totalJSHeapSize : 0
690
- });
691
- }
692
- if (window.__runs) {
693
- window.__runs += `${Date.now()}, ${profileDuration + slowFramesTime}
694
- `;
695
- } else {
696
- window.__runs = `${Date.now()}, ${profileDuration + slowFramesTime}
697
- `;
698
- }
699
- }
700
- };
701
- }
702
- startProfile(name) {
703
- if (__privateGet$3(this, _trailAnimationFrameId)) {
704
- cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
705
- __privateSet$3(this, _trailAnimationFrameId, null);
706
- writeSceneLog(this.constructor.name, "New profile: Stopped recording frames");
707
- }
708
- __privateSet$3(this, _profileInProgress, { origin: name, crumbs: [] });
709
- __privateSet$3(this, _profileStartTs, performance.now());
710
- writeSceneLog(this.constructor.name, "Profile started:", __privateGet$3(this, _profileInProgress), __privateGet$3(this, _profileStartTs));
711
- }
712
- recordProfileTail(measurementStartTime, profileStartTs) {
713
- __privateSet$3(this, _trailAnimationFrameId, requestAnimationFrame(
714
- () => this.measureTrailingFrames(measurementStartTime, measurementStartTime, profileStartTs)
715
- ));
716
- }
717
- tryCompletingProfile() {
718
- writeSceneLog(this.constructor.name, "Trying to complete profile", __privateGet$3(this, _profileInProgress));
719
- if (this.queryController.runningQueriesCount() === 0 && __privateGet$3(this, _profileInProgress)) {
720
- writeSceneLog(this.constructor.name, "All queries completed, stopping profile");
721
- this.recordProfileTail(performance.now(), __privateGet$3(this, _profileStartTs));
722
- }
723
- }
724
- isTailRecording() {
725
- return Boolean(__privateGet$3(this, _trailAnimationFrameId));
726
- }
727
- cancelTailRecording() {
728
- if (__privateGet$3(this, _trailAnimationFrameId)) {
729
- cancelAnimationFrame(__privateGet$3(this, _trailAnimationFrameId));
730
- __privateSet$3(this, _trailAnimationFrameId, null);
731
- writeSceneLog(this.constructor.name, "Cancelled recording frames, new profile started");
732
- }
733
- }
734
- addCrumb(crumb) {
735
- if (__privateGet$3(this, _profileInProgress)) {
736
- __privateGet$3(this, _profileInProgress).crumbs.push(crumb);
737
- }
738
- }
739
- }
740
- _profileInProgress = new WeakMap();
741
- _profileStartTs = new WeakMap();
742
- _trailAnimationFrameId = new WeakMap();
743
- _recordedTrailingSpans = new WeakMap();
744
- function processRecordedSpans(spans) {
745
- for (let i = spans.length - 1; i >= 0; i--) {
746
- if (spans[i] > SPAN_THRESHOLD) {
747
- return spans.slice(0, i + 1);
748
- }
749
- }
750
- return [spans[0]];
751
- }
752
- function captureNetwork(startTs, endTs) {
753
- const entries = performance.getEntriesByType("resource");
754
- performance.clearResourceTimings();
755
- const networkEntries = entries.filter((entry) => entry.startTime >= startTs && entry.startTime <= endTs);
756
- for (const entry of networkEntries) {
757
- performance.measure("Network entry " + entry.name, {
758
- start: entry.startTime,
759
- end: entry.responseEnd
760
- });
761
- }
762
- return calculateNetworkTime(networkEntries);
763
- }
764
- function calculateNetworkTime(requests) {
765
- if (requests.length === 0) {
766
- return 0;
767
- }
768
- requests.sort((a, b) => a.startTime - b.startTime);
769
- let totalNetworkTime = 0;
770
- let currentStart = requests[0].startTime;
771
- let currentEnd = requests[0].responseEnd;
772
- for (let i = 1; i < requests.length; i++) {
773
- if (requests[i].startTime <= currentEnd) {
774
- currentEnd = Math.max(currentEnd, requests[i].responseEnd);
775
- } else {
776
- totalNetworkTime += currentEnd - currentStart;
777
- currentStart = requests[i].startTime;
778
- currentEnd = requests[i].responseEnd;
779
- }
780
- }
781
- totalNetworkTime += currentEnd - currentStart;
782
- return totalNetworkTime;
783
- }
784
-
785
- var __defProp$K = Object.defineProperty;
786
- var __defProps$t = Object.defineProperties;
787
- var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
788
- var __getOwnPropSymbols$K = Object.getOwnPropertySymbols;
789
- var __hasOwnProp$K = Object.prototype.hasOwnProperty;
790
- var __propIsEnum$K = Object.prototype.propertyIsEnumerable;
791
- var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
792
- var __spreadValues$K = (a, b) => {
793
- for (var prop in b || (b = {}))
794
- if (__hasOwnProp$K.call(b, prop))
795
- __defNormalProp$K(a, prop, b[prop]);
796
- if (__getOwnPropSymbols$K)
797
- for (var prop of __getOwnPropSymbols$K(b)) {
798
- if (__propIsEnum$K.call(b, prop))
799
- __defNormalProp$K(a, prop, b[prop]);
800
- }
801
- return a;
802
- };
803
- var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
804
- var __accessCheck$2 = (obj, member, msg) => {
805
- if (!member.has(obj))
806
- throw TypeError("Cannot " + msg);
807
- };
808
- var __privateGet$2 = (obj, member, getter) => {
809
- __accessCheck$2(obj, member, "read from private field");
810
- return getter ? getter.call(obj) : member.get(obj);
811
- };
812
- var __privateAdd$2 = (obj, member, value) => {
813
- if (member.has(obj))
814
- throw TypeError("Cannot add the same private member more than once");
815
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
816
- };
817
- var __privateSet$2 = (obj, member, value, setter) => {
818
- __accessCheck$2(obj, member, "write to private field");
819
- setter ? setter.call(obj, value) : member.set(obj, value);
820
- return value;
821
- };
822
- var _running, _tryCompleteProfileFrameId;
823
- function isQueryController(s) {
824
- return "isQueryController" in s;
825
- }
826
- class SceneQueryController extends SceneObjectBase {
827
- constructor(state = {}) {
828
- super(__spreadProps$t(__spreadValues$K({}, state), { isRunning: false }));
829
- this.isQueryController = true;
830
- this.profiler = new SceneRenderProfiler(this);
831
- __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
832
- __privateAdd$2(this, _tryCompleteProfileFrameId, null);
833
- this.runningQueriesCount = () => {
834
- return __privateGet$2(this, _running).size;
835
- };
836
- this.addActivationHandler(() => {
837
- return () => __privateGet$2(this, _running).clear();
838
- });
839
- }
840
- startProfile(source) {
841
- if (!this.state.enableProfiling) {
842
- return;
843
- }
844
- this.profiler.startProfile(source.constructor.name);
845
- }
846
- queryStarted(entry) {
847
- __privateGet$2(this, _running).add(entry);
848
- this.changeRunningQueryCount(1, entry);
849
- if (!this.state.isRunning) {
850
- this.setState({ isRunning: true });
851
- }
852
- }
853
- queryCompleted(entry) {
854
- if (!__privateGet$2(this, _running).has(entry)) {
855
- return;
856
- }
857
- __privateGet$2(this, _running).delete(entry);
858
- this.changeRunningQueryCount(-1);
859
- if (__privateGet$2(this, _running).size === 0) {
860
- this.setState({ isRunning: false });
861
- }
862
- }
863
- changeRunningQueryCount(dir, entry) {
864
- var _a;
865
- window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
866
- if (dir === 1 && this.state.enableProfiling) {
867
- if (entry) {
868
- this.profiler.addCrumb(`${entry.origin.constructor.name}/${entry.type}`);
869
- }
870
- if (this.profiler.isTailRecording()) {
871
- writeSceneLog(this.constructor.name, "New query started, cancelling tail recording");
872
- this.profiler.cancelTailRecording();
873
- }
874
- }
875
- if (this.state.enableProfiling) {
876
- if (__privateGet$2(this, _tryCompleteProfileFrameId)) {
877
- cancelAnimationFrame(__privateGet$2(this, _tryCompleteProfileFrameId));
878
- }
879
- __privateSet$2(this, _tryCompleteProfileFrameId, requestAnimationFrame(() => {
880
- this.profiler.tryCompletingProfile();
881
- }));
882
- }
883
- }
884
- cancelAll() {
885
- var _a;
886
- for (const entry of __privateGet$2(this, _running).values()) {
887
- (_a = entry.cancel) == null ? void 0 : _a.call(entry);
888
- }
889
- }
890
- }
891
- _running = new WeakMap();
892
- _tryCompleteProfileFrameId = new WeakMap();
893
-
894
- function getQueryController(sceneObject) {
895
- let parent = sceneObject;
896
- while (parent) {
897
- if (parent.state.$behaviors) {
898
- for (const behavior of parent.state.$behaviors) {
899
- if (isQueryController(behavior)) {
900
- return behavior;
901
- }
902
- }
903
- }
904
- parent = parent.parent;
905
- }
906
- return void 0;
907
- }
908
-
909
610
  var __defProp$J = Object.defineProperty;
910
611
  var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
911
612
  var __hasOwnProp$J = Object.prototype.hasOwnProperty;
@@ -1071,8 +772,6 @@ class SceneTimeRange extends SceneObjectBase {
1071
772
  this.state.UNSAFE_nowDelay
1072
773
  );
1073
774
  if (update.from !== this.state.from || update.to !== this.state.to) {
1074
- const queryController = getQueryController(this);
1075
- queryController == null ? void 0 : queryController.startProfile(this);
1076
775
  this._urlSync.performBrowserHistoryAction(() => {
1077
776
  this.setState(update);
1078
777
  });
@@ -1118,17 +817,9 @@ class SceneTimeRange extends SceneObjectBase {
1118
817
  );
1119
818
  }
1120
819
  }
1121
- if (this.state.weekStart) {
1122
- data.setWeekStart(this.state.weekStart);
1123
- }
1124
820
  if (data.rangeUtil.isRelativeTimeRange(this.state.value.raw)) {
1125
821
  this.refreshIfStale();
1126
822
  }
1127
- return () => {
1128
- if (this.state.weekStart) {
1129
- data.setWeekStart(runtime.config.bootData.user.weekStart);
1130
- }
1131
- };
1132
823
  }
1133
824
  refreshIfStale() {
1134
825
  var _a, _b, _c, _d;
@@ -2124,56 +1815,70 @@ function isDataLayer(obj) {
2124
1815
  return "isDataLayer" in obj;
2125
1816
  }
2126
1817
 
2127
- function registerQueryWithController(entry) {
2128
- return (queryStream) => {
2129
- const queryControler = sceneGraph.getQueryController(entry.origin);
2130
- if (!queryControler) {
2131
- return queryStream;
2132
- }
2133
- return new rxjs.Observable((observer) => {
2134
- if (!entry.cancel) {
2135
- entry.cancel = () => observer.complete();
2136
- }
2137
- queryControler.queryStarted(entry);
2138
- let markedAsCompleted = false;
2139
- const sub = queryStream.subscribe({
2140
- next: (v) => {
2141
- if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
2142
- markedAsCompleted = true;
2143
- queryControler.queryCompleted(entry);
2144
- }
2145
- observer.next(v);
2146
- },
2147
- error: (e) => observer.error(e),
2148
- complete: () => {
2149
- observer.complete();
2150
- }
2151
- });
2152
- return () => {
2153
- sub.unsubscribe();
2154
- if (!markedAsCompleted) {
2155
- queryControler.queryCompleted(entry);
2156
- }
2157
- };
2158
- });
2159
- };
1818
+ var __accessCheck$2 = (obj, member, msg) => {
1819
+ if (!member.has(obj))
1820
+ throw TypeError("Cannot " + msg);
1821
+ };
1822
+ var __privateGet$2 = (obj, member, getter) => {
1823
+ __accessCheck$2(obj, member, "read from private field");
1824
+ return getter ? getter.call(obj) : member.get(obj);
1825
+ };
1826
+ var __privateAdd$2 = (obj, member, value) => {
1827
+ if (member.has(obj))
1828
+ throw TypeError("Cannot add the same private member more than once");
1829
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1830
+ };
1831
+ var _running;
1832
+ function isQueryController(s) {
1833
+ return "isQueryController" in s;
2160
1834
  }
2161
- function wrapPromiseInStateObservable(promise) {
2162
- console.log("wrapPromiseInStateObservable", promise);
2163
- return new rxjs.Observable((observer) => {
2164
- observer.next({ state: schema.LoadingState.Loading });
2165
- const promiseObservable = rxjs.from(promise);
2166
- promiseObservable.pipe(
2167
- rxjs.map(() => ({ state: schema.LoadingState.Done })),
2168
- rxjs.catchError(() => {
2169
- observer.next({ state: schema.LoadingState.Error });
2170
- return [];
2171
- })
2172
- ).subscribe({
2173
- next: (result) => observer.next(result),
2174
- complete: () => observer.complete()
1835
+ class SceneQueryController extends SceneObjectBase {
1836
+ constructor() {
1837
+ super({ isRunning: false });
1838
+ this.isQueryController = true;
1839
+ __privateAdd$2(this, _running, /* @__PURE__ */ new Set());
1840
+ this.addActivationHandler(() => {
1841
+ return () => __privateGet$2(this, _running).clear();
2175
1842
  });
2176
- });
1843
+ }
1844
+ queryStarted(entry) {
1845
+ __privateGet$2(this, _running).add(entry);
1846
+ this.changeRunningQueryCount(1);
1847
+ if (!this.state.isRunning) {
1848
+ this.setState({ isRunning: true });
1849
+ }
1850
+ }
1851
+ queryCompleted(entry) {
1852
+ if (!__privateGet$2(this, _running).has(entry)) {
1853
+ return;
1854
+ }
1855
+ __privateGet$2(this, _running).delete(entry);
1856
+ this.changeRunningQueryCount(-1);
1857
+ if (__privateGet$2(this, _running).size === 0) {
1858
+ this.setState({ isRunning: false });
1859
+ }
1860
+ }
1861
+ changeRunningQueryCount(dir) {
1862
+ var _a;
1863
+ window.__grafanaRunningQueryCount = ((_a = window.__grafanaRunningQueryCount) != null ? _a : 0) + dir;
1864
+ }
1865
+ cancelAll() {
1866
+ var _a;
1867
+ for (const entry of __privateGet$2(this, _running).values()) {
1868
+ (_a = entry.cancel) == null ? void 0 : _a.call(entry);
1869
+ }
1870
+ }
1871
+ }
1872
+ _running = new WeakMap();
1873
+
1874
+ function writeSceneLog(logger, message, ...rest) {
1875
+ let loggingEnabled = false;
1876
+ if (typeof window !== "undefined") {
1877
+ loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
1878
+ }
1879
+ if (loggingEnabled) {
1880
+ console.log(`${logger}: `, message, ...rest);
1881
+ }
2177
1882
  }
2178
1883
 
2179
1884
  async function getDataSource(datasource, scopedVars) {
@@ -2186,21 +1891,7 @@ async function getDataSource(datasource, scopedVars) {
2186
1891
  if (datasource && datasource.query) {
2187
1892
  return datasource;
2188
1893
  }
2189
- const dsPromise = runtime.getDataSourceSrv().get(datasource, scopedVars);
2190
- if (scopedVars.__sceneObject && scopedVars.__sceneObject.value.valueOf()) {
2191
- const queryControler = sceneGraph.getQueryController(scopedVars.__sceneObject.value.valueOf());
2192
- if (queryControler && queryControler.state.enableProfiling) {
2193
- wrapPromiseInStateObservable(dsPromise).pipe(
2194
- registerQueryWithController({
2195
- type: "plugin",
2196
- origin: scopedVars.__sceneObject.value.valueOf()
2197
- })
2198
- ).subscribe(() => {
2199
- });
2200
- }
2201
- }
2202
- const result = await dsPromise;
2203
- return result;
1894
+ return await runtime.getDataSourceSrv().get(datasource, scopedVars);
2204
1895
  }
2205
1896
 
2206
1897
  class VariableValueRecorder {
@@ -2448,6 +2139,41 @@ function findActiveAdHocFilterVariableByUid(dsUid) {
2448
2139
  return void 0;
2449
2140
  }
2450
2141
 
2142
+ function registerQueryWithController(entry) {
2143
+ return (queryStream) => {
2144
+ const queryControler = sceneGraph.getQueryController(entry.origin);
2145
+ if (!queryControler) {
2146
+ return queryStream;
2147
+ }
2148
+ return new rxjs.Observable((observer) => {
2149
+ if (!entry.cancel) {
2150
+ entry.cancel = () => observer.complete();
2151
+ }
2152
+ queryControler.queryStarted(entry);
2153
+ let markedAsCompleted = false;
2154
+ const sub = queryStream.subscribe({
2155
+ next: (v) => {
2156
+ if (!markedAsCompleted && v.state !== schema.LoadingState.Loading) {
2157
+ markedAsCompleted = true;
2158
+ queryControler.queryCompleted(entry);
2159
+ }
2160
+ observer.next(v);
2161
+ },
2162
+ error: (e) => observer.error(e),
2163
+ complete: () => {
2164
+ observer.complete();
2165
+ }
2166
+ });
2167
+ return () => {
2168
+ sub.unsubscribe();
2169
+ if (!markedAsCompleted) {
2170
+ queryControler.queryCompleted(entry);
2171
+ }
2172
+ };
2173
+ });
2174
+ };
2175
+ }
2176
+
2451
2177
  const allActiveGroupByVariables = /* @__PURE__ */ new Set();
2452
2178
  function findActiveGroupByVariablesByUid(dsUid) {
2453
2179
  var _a;
@@ -2837,7 +2563,6 @@ function VariableValueSelect({ model }) {
2837
2563
  const [inputValue, setInputValue] = React.useState("");
2838
2564
  const [hasCustomValue, setHasCustomValue] = React.useState(false);
2839
2565
  const selectValue = toSelectableValue$2(value, String(text));
2840
- const queryController = sceneGraph.getQueryController(model);
2841
2566
  const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
2842
2567
  const onInputChange = (value2, { action }) => {
2843
2568
  if (action === "input-change") {
@@ -2877,7 +2602,6 @@ function VariableValueSelect({ model }) {
2877
2602
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${value}`),
2878
2603
  onChange: (newValue) => {
2879
2604
  model.changeValueTo(newValue.value, newValue.label);
2880
- queryController == null ? void 0 : queryController.startProfile(model);
2881
2605
  if (hasCustomValue !== newValue.__isNew__) {
2882
2606
  setHasCustomValue(newValue.__isNew__);
2883
2607
  }
@@ -2889,7 +2613,6 @@ function VariableValueSelectMulti({ model }) {
2889
2613
  const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
2890
2614
  const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
2891
2615
  const [inputValue, setInputValue] = React.useState("");
2892
- const queryController = sceneGraph.getQueryController(model);
2893
2616
  const optionSearcher = React.useMemo(() => getOptionSearcher(options, includeAll), [options, includeAll]);
2894
2617
  React.useEffect(() => {
2895
2618
  setUncommittedValue(arrayValue);
@@ -2935,7 +2658,6 @@ function VariableValueSelectMulti({ model }) {
2935
2658
  onInputChange,
2936
2659
  onBlur: () => {
2937
2660
  model.changeValueTo(uncommittedValue);
2938
- queryController == null ? void 0 : queryController.startProfile(model);
2939
2661
  },
2940
2662
  filterOption: filterNoOp$2,
2941
2663
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
@@ -3543,12 +3265,10 @@ function AdHocFilterRenderer({ filter, model }) {
3543
3265
  const [isOperatorOpen, setIsOperatorOpen] = React.useState(false);
3544
3266
  const [valueInputValue, setValueInputValue] = React.useState("");
3545
3267
  const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
3546
- const [uncommittedValue, setUncommittedValue] = React.useState(
3547
- filter.values ? filter.values.map((value, index) => {
3548
- var _a2;
3549
- return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
3550
- }) : []
3551
- );
3268
+ const [uncommittedValue, setUncommittedValue] = React.useState(filter.values ? filter.values.map((value, index) => {
3269
+ var _a2;
3270
+ return keyLabelToOption(value, (_a2 = filter.valueLabels) == null ? void 0 : _a2[index]);
3271
+ }) : []);
3552
3272
  const isMultiValue = isMultiValueOperator(filter.operator);
3553
3273
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3554
3274
  const valueValue = keyLabelToOption(filter.value, (_a = filter.valueLabels) == null ? void 0 : _a[0]);
@@ -3571,12 +3291,10 @@ function AdHocFilterRenderer({ filter, model }) {
3571
3291
  setUncommittedValue([]);
3572
3292
  } else if (!isMultiValueOperator(existingOperator) && isMultiValueOperator(newOperator) && filter.value) {
3573
3293
  update.values = [filter.value];
3574
- setUncommittedValue([
3575
- {
3576
- value: filter.value,
3577
- label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
3578
- }
3579
- ]);
3294
+ setUncommittedValue([{
3295
+ value: filter.value,
3296
+ label: (_b2 = (_a2 = filter.valueLabels) == null ? void 0 : _a2[0]) != null ? _b2 : filter.value
3297
+ }]);
3580
3298
  }
3581
3299
  model._updateFilter(filter, update);
3582
3300
  };
@@ -3855,7 +3573,10 @@ function deserializeUrlToFilters(value) {
3855
3573
  }
3856
3574
  function toArray(filter) {
3857
3575
  var _a;
3858
- const result = [toUrlCommaDelimitedString(filter.key, filter.keyLabel), filter.operator];
3576
+ const result = [
3577
+ toUrlCommaDelimitedString(filter.key, filter.keyLabel),
3578
+ filter.operator
3579
+ ];
3859
3580
  if (isMultiValueOperator(filter.operator)) {
3860
3581
  filter.values.forEach((value, index) => {
3861
3582
  var _a2;
@@ -5334,7 +5055,9 @@ class SceneQueryRunner extends SceneObjectBase {
5334
5055
  })
5335
5056
  );
5336
5057
  }
5337
- this.subscribeToTimeRangeChanges(timeRange);
5058
+ this.subscribeToTimeRangeChanges(
5059
+ timeRange
5060
+ );
5338
5061
  if (this.shouldRunQueriesOnActivate()) {
5339
5062
  this.runQueries();
5340
5063
  }
@@ -6586,6 +6309,30 @@ function findDescendents(scene, descendentType) {
6586
6309
  const targetScenes = findAllObjects(scene, isDescendentType);
6587
6310
  return targetScenes.filter(isDescendentType);
6588
6311
  }
6312
+ function getQueryController(sceneObject) {
6313
+ let parent = sceneObject;
6314
+ while (parent) {
6315
+ if (parent.state.$behaviors) {
6316
+ for (const behavior of parent.state.$behaviors) {
6317
+ if (isQueryController(behavior)) {
6318
+ return behavior;
6319
+ }
6320
+ }
6321
+ }
6322
+ parent = parent.parent;
6323
+ }
6324
+ return void 0;
6325
+ }
6326
+ function getUrlSyncManager(sceneObject) {
6327
+ let parent = sceneObject;
6328
+ while (parent) {
6329
+ if ("urlSyncManager" in parent.state) {
6330
+ return parent.state.urlSyncManager;
6331
+ }
6332
+ parent = parent.parent;
6333
+ }
6334
+ return void 0;
6335
+ }
6589
6336
 
6590
6337
  const sceneGraph = {
6591
6338
  getVariables,
@@ -6601,8 +6348,9 @@ const sceneGraph = {
6601
6348
  findObject,
6602
6349
  findAllObjects,
6603
6350
  getAncestor,
6351
+ findDescendents,
6604
6352
  getQueryController,
6605
- findDescendents
6353
+ getUrlSyncManager
6606
6354
  };
6607
6355
 
6608
6356
  class UniqueUrlKeyMapper {
@@ -7466,13 +7214,7 @@ class VizPanel extends SceneObjectBase {
7466
7214
  } else {
7467
7215
  const { importPanelPlugin } = runtime.getPluginImportUtils();
7468
7216
  try {
7469
- const panelPromise = importPanelPlugin(pluginId);
7470
- const queryControler = sceneGraph.getQueryController(this);
7471
- if (queryControler && queryControler.state.enableProfiling) {
7472
- wrapPromiseInStateObservable(panelPromise).pipe(registerQueryWithController({ type: "plugin", origin: this })).subscribe(() => {
7473
- });
7474
- }
7475
- const result = await panelPromise;
7217
+ const result = await importPanelPlugin(pluginId);
7476
7218
  this._pluginLoaded(result, overwriteOptions, overwriteFieldConfig, isAfterPluginChange);
7477
7219
  } catch (err) {
7478
7220
  this._pluginLoaded(getPanelPluginNotFound(pluginId));
@@ -7541,7 +7283,11 @@ class VizPanel extends SceneObjectBase {
7541
7283
  }
7542
7284
  async changePluginType(pluginId, newOptions, newFieldConfig) {
7543
7285
  var _a, _b;
7544
- const { options: prevOptions, fieldConfig: prevFieldConfig, pluginId: prevPluginId } = this.state;
7286
+ const {
7287
+ options: prevOptions,
7288
+ fieldConfig: prevFieldConfig,
7289
+ pluginId: prevPluginId
7290
+ } = this.state;
7545
7291
  this._dataWithFieldConfig = void 0;
7546
7292
  await this._loadPlugin(pluginId, newOptions != null ? newOptions : {}, newFieldConfig, true);
7547
7293
  const panel = {
@@ -8452,6 +8198,39 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
8452
8198
  }
8453
8199
  }
8454
8200
 
8201
+ class DataProviderProxy extends SceneObjectBase {
8202
+ constructor(state) {
8203
+ super({
8204
+ source: state.source,
8205
+ data: state.source.resolve().state.data
8206
+ });
8207
+ this.addActivationHandler(() => {
8208
+ this._subs.add(
8209
+ this.state.source.resolve().subscribeToState((newState, oldState) => {
8210
+ if (newState.data !== oldState.data) {
8211
+ this.setState({ data: newState.data });
8212
+ }
8213
+ })
8214
+ );
8215
+ });
8216
+ }
8217
+ setContainerWidth(width) {
8218
+ var _a, _b;
8219
+ (_b = (_a = this.state.source.resolve()).setContainerWidth) == null ? void 0 : _b.call(_a, width);
8220
+ }
8221
+ isDataReadyToDisplay() {
8222
+ var _a, _b, _c;
8223
+ return (_c = (_b = (_a = this.state.source.resolve()).isDataReadyToDisplay) == null ? void 0 : _b.call(_a)) != null ? _c : true;
8224
+ }
8225
+ cancelQuery() {
8226
+ var _a, _b;
8227
+ (_b = (_a = this.state.source.resolve()).cancelQuery) == null ? void 0 : _b.call(_a);
8228
+ }
8229
+ getResultsStream() {
8230
+ return this.state.source.resolve().getResultsStream();
8231
+ }
8232
+ }
8233
+
8455
8234
  var __defProp$k = Object.defineProperty;
8456
8235
  var __defProps$b = Object.defineProperties;
8457
8236
  var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
@@ -10841,7 +10620,8 @@ function SceneTimePickerRenderer({ model }) {
10841
10620
  onMoveForward: model.onMoveForward,
10842
10621
  onZoom: model.onZoom,
10843
10622
  onChangeTimeZone: timeRange.onTimeZoneChange,
10844
- onChangeFiscalYearStartMonth: model.onChangeFiscalYearStartMonth
10623
+ onChangeFiscalYearStartMonth: model.onChangeFiscalYearStartMonth,
10624
+ weekStart: timeRangeState.weekStart
10845
10625
  });
10846
10626
  }
10847
10627
  function getZoomedTimeRange(timeRange, factor) {
@@ -10923,7 +10703,6 @@ class SceneRefreshPicker extends SceneObjectBase {
10923
10703
  this._autoRefreshBlocked = false;
10924
10704
  this.onRefresh = () => {
10925
10705
  const queryController = sceneGraph.getQueryController(this);
10926
- queryController == null ? void 0 : queryController.startProfile(this);
10927
10706
  if (queryController == null ? void 0 : queryController.state.isRunning) {
10928
10707
  queryController.cancelAll();
10929
10708
  return;
@@ -11052,9 +10831,7 @@ function SceneRefreshPickerRenderer({ model }) {
11052
10831
  tooltip,
11053
10832
  width,
11054
10833
  text,
11055
- onRefresh: () => {
11056
- model.onRefresh();
11057
- },
10834
+ onRefresh: model.onRefresh,
11058
10835
  primary,
11059
10836
  onIntervalChanged: model.onIntervalChanged,
11060
10837
  isLoading: isRunning,
@@ -13354,6 +13131,7 @@ const sceneUtils = {
13354
13131
  exports.AdHocFiltersVariable = AdHocFiltersVariable;
13355
13132
  exports.ConstantVariable = ConstantVariable;
13356
13133
  exports.CustomVariable = CustomVariable;
13134
+ exports.DataProviderProxy = DataProviderProxy;
13357
13135
  exports.DataSourceVariable = DataSourceVariable;
13358
13136
  exports.EmbeddedScene = EmbeddedScene;
13359
13137
  exports.FieldConfigBuilder = FieldConfigBuilder;