@grafana/scenes 4.27.0--canary.766.9369774725.0 → 4.27.0--canary.766.9398430196.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +2 -0
  3. package/dist/esm/components/SceneTimeRangeCompare.js +55 -1
  4. package/dist/esm/components/SceneTimeRangeCompare.js.map +1 -1
  5. package/dist/esm/components/VizPanel/VizPanel.js +3 -0
  6. package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
  7. package/dist/esm/core/PanelBuilders/VizConfigBuilder.js +78 -0
  8. package/dist/esm/core/PanelBuilders/VizConfigBuilder.js.map +1 -0
  9. package/dist/esm/core/PanelBuilders/VizConfigBuilders.js +114 -0
  10. package/dist/esm/core/PanelBuilders/VizConfigBuilders.js.map +1 -0
  11. package/dist/esm/core/types.js.map +1 -1
  12. package/dist/esm/index.js +4 -1
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/esm/querying/ExtraQueryProvider.js +6 -0
  15. package/dist/esm/querying/ExtraQueryProvider.js.map +1 -0
  16. package/dist/esm/querying/SceneQueryRunner.js +85 -88
  17. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  18. package/dist/esm/querying/extraQueryProcessingOperator.js +46 -0
  19. package/dist/esm/querying/extraQueryProcessingOperator.js.map +1 -0
  20. package/dist/esm/utils/writeSceneLog.js +5 -1
  21. package/dist/esm/utils/writeSceneLog.js.map +1 -1
  22. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +3 -1
  23. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  24. package/dist/esm/variables/components/VariableValueSelect.js +9 -2
  25. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  26. package/dist/esm/variables/components/getOptionSearcher.js +2 -1
  27. package/dist/esm/variables/components/getOptionSearcher.js.map +1 -1
  28. package/dist/esm/variables/interpolation/sceneInterpolator.js +3 -3
  29. package/dist/esm/variables/interpolation/sceneInterpolator.js.map +1 -1
  30. package/dist/esm/variables/utils.js.map +1 -1
  31. package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
  32. package/dist/index.d.ts +256 -146
  33. package/dist/index.js +1127 -897
  34. package/dist/index.js.map +1 -1
  35. package/package.json +4 -7
  36. package/dist/esm/querying/timeShiftQueryResponseOperator.js +0 -60
  37. package/dist/esm/querying/timeShiftQueryResponseOperator.js.map +0 -1
package/dist/index.js CHANGED
@@ -11,8 +11,8 @@ var uuid = require('uuid');
11
11
  var lodash = require('lodash');
12
12
  var schema = require('@grafana/schema');
13
13
  var ui = require('@grafana/ui');
14
- var css = require('@emotion/css');
15
14
  var e2eSelectors = require('@grafana/e2e-selectors');
15
+ var css = require('@emotion/css');
16
16
  var uFuzzy = require('@leeoniya/ufuzzy');
17
17
  var reactUse = require('react-use');
18
18
  var operators = require('rxjs/operators');
@@ -77,8 +77,8 @@ function renderSceneComponentWithRouteProps(sceneObject, routeProps) {
77
77
  }
78
78
 
79
79
  var __defProp$J = Object.defineProperty;
80
- var __defProps$s = Object.defineProperties;
81
- var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
80
+ var __defProps$t = Object.defineProperties;
81
+ var __getOwnPropDescs$t = Object.getOwnPropertyDescriptors;
82
82
  var __getOwnPropSymbols$J = Object.getOwnPropertySymbols;
83
83
  var __hasOwnProp$J = Object.prototype.hasOwnProperty;
84
84
  var __propIsEnum$J = Object.prototype.propertyIsEnumerable;
@@ -94,13 +94,13 @@ var __spreadValues$J = (a, b) => {
94
94
  }
95
95
  return a;
96
96
  };
97
- var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
97
+ var __spreadProps$t = (a, b) => __defProps$t(a, __getOwnPropDescs$t(b));
98
98
  const runtimePanelPlugins = /* @__PURE__ */ new Map();
99
99
  function registerRuntimePanelPlugin({ pluginId, plugin }) {
100
100
  if (runtimePanelPlugins.has(pluginId)) {
101
101
  throw new Error(`A runtime panel plugin with id ${pluginId} has already been registered`);
102
102
  }
103
- plugin.meta = __spreadProps$s(__spreadValues$J({}, plugin.meta), {
103
+ plugin.meta = __spreadProps$t(__spreadValues$J({}, plugin.meta), {
104
104
  id: pluginId,
105
105
  name: pluginId,
106
106
  module: "runtime plugin",
@@ -129,8 +129,8 @@ function loadPanelPluginSync(pluginId) {
129
129
  }
130
130
 
131
131
  var __defProp$I = Object.defineProperty;
132
- var __defProps$r = Object.defineProperties;
133
- var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
132
+ var __defProps$s = Object.defineProperties;
133
+ var __getOwnPropDescs$s = Object.getOwnPropertyDescriptors;
134
134
  var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
135
135
  var __hasOwnProp$I = Object.prototype.hasOwnProperty;
136
136
  var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
@@ -146,7 +146,7 @@ var __spreadValues$I = (a, b) => {
146
146
  }
147
147
  return a;
148
148
  };
149
- var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
149
+ var __spreadProps$s = (a, b) => __defProps$s(a, __getOwnPropDescs$s(b));
150
150
  var __objRest$4 = (source, exclude) => {
151
151
  var target = {};
152
152
  for (var prop in source)
@@ -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$r(__spreadValues$I({}, otherProps), {
175
+ return /* @__PURE__ */ React__default["default"].createElement(Component, __spreadProps$s(__spreadValues$I({}, otherProps), {
176
176
  model
177
177
  }));
178
178
  }
@@ -1347,7 +1347,7 @@ function sceneInterpolator(sceneObject, target, scopedVars, format, interpolatio
1347
1347
  }
1348
1348
  return match;
1349
1349
  }
1350
- const value = formatValue(variable, variable.getValue(fieldPath), fmt);
1350
+ const value = formatValue(sceneObject, variable, variable.getValue(fieldPath), fmt);
1351
1351
  if (interpolations) {
1352
1352
  interpolations.push({ match, variableName, fieldPath, format: fmt, value, found: value !== match });
1353
1353
  }
@@ -1368,12 +1368,12 @@ function lookupFormatVariable(name, match, scopedVars, sceneObject) {
1368
1368
  }
1369
1369
  return null;
1370
1370
  }
1371
- function formatValue(variable, value, formatNameOrFn) {
1371
+ function formatValue(context, variable, value, formatNameOrFn) {
1372
1372
  if (value === null || value === void 0) {
1373
1373
  return "";
1374
1374
  }
1375
1375
  if (isCustomVariableValue(value)) {
1376
- return value.formatter(formatNameOrFn);
1376
+ return sceneInterpolator(context, value.formatter(formatNameOrFn));
1377
1377
  }
1378
1378
  if (!Array.isArray(value) && typeof value === "object") {
1379
1379
  value = `${value}`;
@@ -1749,8 +1749,8 @@ function collectAllVariables(sceneObject, record = {}) {
1749
1749
  }
1750
1750
 
1751
1751
  var __defProp$D = Object.defineProperty;
1752
- var __defProps$q = Object.defineProperties;
1753
- var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
1752
+ var __defProps$r = Object.defineProperties;
1753
+ var __getOwnPropDescs$r = Object.getOwnPropertyDescriptors;
1754
1754
  var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
1755
1755
  var __hasOwnProp$D = Object.prototype.hasOwnProperty;
1756
1756
  var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
@@ -1766,7 +1766,7 @@ var __spreadValues$D = (a, b) => {
1766
1766
  }
1767
1767
  return a;
1768
1768
  };
1769
- var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
1769
+ var __spreadProps$r = (a, b) => __defProps$r(a, __getOwnPropDescs$r(b));
1770
1770
  function getTemplateProxyForField(field, frame, frames) {
1771
1771
  return new Proxy(
1772
1772
  {},
@@ -1782,7 +1782,7 @@ function getTemplateProxyForField(field, frame, frames) {
1782
1782
  if (!field.labels) {
1783
1783
  return "";
1784
1784
  }
1785
- return __spreadProps$q(__spreadValues$D({}, field.labels), {
1785
+ return __spreadProps$r(__spreadValues$D({}, field.labels), {
1786
1786
  __values: Object.values(field.labels).sort().join(", "),
1787
1787
  toString: () => {
1788
1788
  return data.formatLabels(field.labels, "", true);
@@ -2071,7 +2071,11 @@ async function getDataSource(datasource, scopedVars) {
2071
2071
  }
2072
2072
 
2073
2073
  function writeSceneLog(logger, message, ...rest) {
2074
- if (window.grafanaSceneLogging) {
2074
+ let loggingEnabled = false;
2075
+ if (typeof window !== "undefined") {
2076
+ loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
2077
+ }
2078
+ if (loggingEnabled) {
2075
2079
  console.log(`${logger}: `, message, ...rest);
2076
2080
  }
2077
2081
  }
@@ -2255,7 +2259,13 @@ class VariableValueRecorder {
2255
2259
  }
2256
2260
  }
2257
2261
 
2262
+ function isExtraQueryProvider(obj) {
2263
+ return typeof obj === "object" && "getExtraQueries" in obj;
2264
+ }
2265
+
2258
2266
  var __defProp$C = Object.defineProperty;
2267
+ var __defProps$q = Object.defineProperties;
2268
+ var __getOwnPropDescs$q = Object.getOwnPropertyDescriptors;
2259
2269
  var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
2260
2270
  var __hasOwnProp$C = Object.prototype.hasOwnProperty;
2261
2271
  var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
@@ -2271,166 +2281,29 @@ var __spreadValues$C = (a, b) => {
2271
2281
  }
2272
2282
  return a;
2273
2283
  };
2274
- const PREVIOUS_PERIOD_VALUE = "__previousPeriod";
2275
- const NO_PERIOD_VALUE = "__noPeriod";
2276
- const PREVIOUS_PERIOD_COMPARE_OPTION = {
2277
- label: "Previous period",
2278
- value: PREVIOUS_PERIOD_VALUE
2279
- };
2280
- const NO_COMPARE_OPTION = {
2281
- label: "No comparison",
2282
- value: NO_PERIOD_VALUE
2283
- };
2284
- const DEFAULT_COMPARE_OPTIONS = [
2285
- { label: "Day before", value: "24h" },
2286
- { label: "Week before", value: "1w" },
2287
- { label: "Month before", value: "1M" }
2288
- ];
2289
- class SceneTimeRangeCompare extends SceneObjectBase {
2290
- constructor(state) {
2291
- super(__spreadValues$C({ compareOptions: DEFAULT_COMPARE_OPTIONS }, state));
2292
- this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["compareWith"] });
2293
- this._onActivate = () => {
2294
- const sceneTimeRange = sceneGraph.getTimeRange(this);
2295
- this.setState({ compareOptions: this.getCompareOptions(sceneTimeRange.state.value) });
2296
- this._subs.add(
2297
- sceneTimeRange.subscribeToState((timeRange) => {
2298
- const compareOptions = this.getCompareOptions(timeRange.value);
2299
- const stateUpdate = { compareOptions };
2300
- if (Boolean(this.state.compareWith) && !compareOptions.find(({ value }) => value === this.state.compareWith)) {
2301
- stateUpdate.compareWith = PREVIOUS_PERIOD_VALUE;
2302
- }
2303
- this.setState(stateUpdate);
2304
- })
2305
- );
2306
- };
2307
- this.getCompareOptions = (timeRange) => {
2308
- const diffDays = Math.ceil(timeRange.to.diff(timeRange.from));
2309
- const matchIndex = DEFAULT_COMPARE_OPTIONS.findIndex(({ value }) => {
2310
- const intervalInMs = data.rangeUtil.intervalToMs(value);
2311
- return intervalInMs >= diffDays;
2284
+ var __spreadProps$q = (a, b) => __defProps$q(a, __getOwnPropDescs$q(b));
2285
+ const passthroughProcessor = (_, secondary) => rxjs.of(secondary);
2286
+ const extraQueryProcessingOperator = (processors) => (data) => {
2287
+ return data.pipe(
2288
+ rxjs.mergeMap(([primary, ...secondaries]) => {
2289
+ const processedSecondaries = secondaries.flatMap((s) => {
2290
+ var _a, _b;
2291
+ return (_b = (_a = processors.get(s.request.requestId)) == null ? void 0 : _a(primary, s)) != null ? _b : rxjs.of(s);
2292
+ });
2293
+ return rxjs.forkJoin([rxjs.of(primary), ...processedSecondaries]);
2294
+ }),
2295
+ rxjs.map(([primary, ...processedSecondaries]) => {
2296
+ var _a;
2297
+ return __spreadProps$q(__spreadValues$C({}, primary), {
2298
+ series: [...primary.series, ...processedSecondaries.flatMap((s) => s.series)],
2299
+ annotations: [...(_a = primary.annotations) != null ? _a : [], ...processedSecondaries.flatMap((s) => {
2300
+ var _a2;
2301
+ return (_a2 = s.annotations) != null ? _a2 : [];
2302
+ })]
2312
2303
  });
2313
- return [
2314
- NO_COMPARE_OPTION,
2315
- PREVIOUS_PERIOD_COMPARE_OPTION,
2316
- ...DEFAULT_COMPARE_OPTIONS.slice(matchIndex).map(({ label, value }) => ({ label, value }))
2317
- ];
2318
- };
2319
- this.onCompareWithChanged = (compareWith) => {
2320
- if (compareWith === NO_PERIOD_VALUE) {
2321
- this.onClearCompare();
2322
- } else {
2323
- this.setState({ compareWith });
2324
- }
2325
- };
2326
- this.onClearCompare = () => {
2327
- this.setState({ compareWith: void 0 });
2328
- };
2329
- this.addActivationHandler(this._onActivate);
2330
- }
2331
- getCompareTimeRange(timeRange) {
2332
- let compareFrom;
2333
- let compareTo;
2334
- if (this.state.compareWith) {
2335
- if (this.state.compareWith === PREVIOUS_PERIOD_VALUE) {
2336
- const diffMs = timeRange.to.diff(timeRange.from);
2337
- compareFrom = data.dateTime(timeRange.from).subtract(diffMs);
2338
- compareTo = data.dateTime(timeRange.to).subtract(diffMs);
2339
- } else {
2340
- compareFrom = data.dateTime(timeRange.from).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
2341
- compareTo = data.dateTime(timeRange.to).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
2342
- }
2343
- return {
2344
- from: compareFrom,
2345
- to: compareTo,
2346
- raw: {
2347
- from: compareFrom,
2348
- to: compareTo
2349
- }
2350
- };
2351
- }
2352
- return void 0;
2353
- }
2354
- getUrlState() {
2355
- return {
2356
- compareWith: this.state.compareWith
2357
- };
2358
- }
2359
- updateFromUrl(values) {
2360
- if (!values.compareWith) {
2361
- return;
2362
- }
2363
- const compareWith = parseUrlParam(values.compareWith);
2364
- if (compareWith) {
2365
- const compareOptions = this.getCompareOptions(sceneGraph.getTimeRange(this).state.value);
2366
- if (compareOptions.find(({ value }) => value === compareWith)) {
2367
- this.setState({
2368
- compareWith
2369
- });
2370
- } else {
2371
- this.setState({
2372
- compareWith: "__previousPeriod"
2373
- });
2374
- }
2375
- }
2376
- }
2377
- }
2378
- SceneTimeRangeCompare.Component = SceneTimeRangeCompareRenderer;
2379
- function SceneTimeRangeCompareRenderer({ model }) {
2380
- var _a;
2381
- const styles = ui.useStyles2(getStyles$9);
2382
- const { compareWith, compareOptions } = model.useState();
2383
- const [previousCompare, setPreviousCompare] = React__default["default"].useState(compareWith);
2384
- const previousValue = (_a = compareOptions.find(({ value: value2 }) => value2 === previousCompare)) != null ? _a : PREVIOUS_PERIOD_COMPARE_OPTION;
2385
- const value = compareOptions.find(({ value: value2 }) => value2 === compareWith);
2386
- const enabled = Boolean(value);
2387
- const onClick = () => {
2388
- if (enabled) {
2389
- setPreviousCompare(compareWith);
2390
- model.onClearCompare();
2391
- } else if (!enabled) {
2392
- model.onCompareWithChanged(previousValue.value);
2393
- }
2394
- };
2395
- return /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
2396
- variant: "canvas",
2397
- tooltip: "Enable time frame comparison",
2398
- onClick: (e) => {
2399
- e.stopPropagation();
2400
- e.preventDefault();
2401
- onClick();
2402
- }
2403
- }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
2404
- label: " ",
2405
- value: enabled,
2406
- onClick
2407
- }), "Comparison"), enabled ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonSelect, {
2408
- variant: "canvas",
2409
- value,
2410
- options: compareOptions,
2411
- onChange: (v) => {
2412
- model.onCompareWithChanged(v.value);
2413
- }
2414
- }) : /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
2415
- className: styles.previewButton,
2416
- disabled: true,
2417
- variant: "canvas",
2418
- isOpen: false
2419
- }, previousValue.label));
2420
- }
2421
- function getStyles$9(theme) {
2422
- return {
2423
- previewButton: css.css({
2424
- "&:disabled": {
2425
- border: `1px solid ${theme.colors.secondary.border}`,
2426
- color: theme.colors.text.disabled,
2427
- opacity: 1
2428
- }
2429
2304
  })
2430
- };
2431
- }
2432
-
2433
- const getCompareSeriesRefId = (refId) => `${refId}-compare`;
2305
+ );
2306
+ };
2434
2307
 
2435
2308
  var __defProp$B = Object.defineProperty;
2436
2309
  var __defProps$p = Object.defineProperties;
@@ -2451,59 +2324,6 @@ var __spreadValues$B = (a, b) => {
2451
2324
  return a;
2452
2325
  };
2453
2326
  var __spreadProps$p = (a, b) => __defProps$p(a, __getOwnPropDescs$p(b));
2454
- function timeShiftQueryResponseOperator(data$1) {
2455
- return data$1.pipe(
2456
- rxjs.map(([p, s]) => {
2457
- const diff = s.timeRange.from.diff(p.timeRange.from);
2458
- s.series.forEach((series) => {
2459
- series.refId = getCompareSeriesRefId(series.refId || "");
2460
- series.meta = __spreadProps$p(__spreadValues$B({}, series.meta), {
2461
- timeCompare: {
2462
- diffMs: diff,
2463
- isTimeShiftQuery: true
2464
- }
2465
- });
2466
- series.fields.forEach((field) => {
2467
- if (field.type === data.FieldType.time) {
2468
- field.values = field.values.map((v) => {
2469
- return diff < 0 ? v - diff : v + diff;
2470
- });
2471
- }
2472
- field.config = __spreadProps$p(__spreadValues$B({}, field.config), {
2473
- color: {
2474
- mode: "fixed",
2475
- fixedColor: runtime.config.theme.palette.gray60
2476
- }
2477
- });
2478
- return field;
2479
- });
2480
- });
2481
- return __spreadProps$p(__spreadValues$B({}, p), {
2482
- series: [...p.series, ...s.series]
2483
- });
2484
- })
2485
- );
2486
- }
2487
-
2488
- var __defProp$A = Object.defineProperty;
2489
- var __defProps$o = Object.defineProperties;
2490
- var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2491
- var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2492
- var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2493
- var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2494
- var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2495
- var __spreadValues$A = (a, b) => {
2496
- for (var prop in b || (b = {}))
2497
- if (__hasOwnProp$A.call(b, prop))
2498
- __defNormalProp$A(a, prop, b[prop]);
2499
- if (__getOwnPropSymbols$A)
2500
- for (var prop of __getOwnPropSymbols$A(b)) {
2501
- if (__propIsEnum$A.call(b, prop))
2502
- __defNormalProp$A(a, prop, b[prop]);
2503
- }
2504
- return a;
2505
- };
2506
- var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
2507
2327
  function filterAnnotations(data, filters) {
2508
2328
  var _a;
2509
2329
  if (!Array.isArray(data) || data.length === 0) {
@@ -2554,11 +2374,11 @@ function filterAnnotations(data, filters) {
2554
2374
  continue;
2555
2375
  }
2556
2376
  }
2557
- fields.push(__spreadProps$o(__spreadValues$A({}, field), {
2377
+ fields.push(__spreadProps$p(__spreadValues$B({}, field), {
2558
2378
  values: buffer
2559
2379
  }));
2560
2380
  }
2561
- processed.push(__spreadProps$o(__spreadValues$A({}, frame), {
2381
+ processed.push(__spreadProps$p(__spreadValues$B({}, frame), {
2562
2382
  fields,
2563
2383
  length: frameLength
2564
2384
  }));
@@ -2945,10 +2765,11 @@ class CustomAllValue {
2945
2765
  }
2946
2766
  }
2947
2767
 
2948
- function getOptionSearcher(options, includeAll, limit = 1e4) {
2768
+ function getOptionSearcher(options, includeAll) {
2949
2769
  const ufuzzy = new uFuzzy__default["default"]();
2950
2770
  let allOptions = options;
2951
2771
  const haystack = [];
2772
+ const limit = 1e4;
2952
2773
  if (includeAll) {
2953
2774
  allOptions = [{ value: ALL_VARIABLE_VALUE, label: ALL_VARIABLE_TEXT }, ...allOptions];
2954
2775
  }
@@ -2983,42 +2804,49 @@ function getOptionSearcher(options, includeAll, limit = 1e4) {
2983
2804
  };
2984
2805
  }
2985
2806
 
2986
- var __defProp$z = Object.defineProperty;
2987
- var __defProps$n = Object.defineProperties;
2988
- var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
2989
- var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
2990
- var __hasOwnProp$z = Object.prototype.hasOwnProperty;
2991
- var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
2992
- var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2993
- var __spreadValues$z = (a, b) => {
2807
+ var __defProp$A = Object.defineProperty;
2808
+ var __defProps$o = Object.defineProperties;
2809
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2810
+ var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2811
+ var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2812
+ var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2813
+ var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2814
+ var __spreadValues$A = (a, b) => {
2994
2815
  for (var prop in b || (b = {}))
2995
- if (__hasOwnProp$z.call(b, prop))
2996
- __defNormalProp$z(a, prop, b[prop]);
2997
- if (__getOwnPropSymbols$z)
2998
- for (var prop of __getOwnPropSymbols$z(b)) {
2999
- if (__propIsEnum$z.call(b, prop))
3000
- __defNormalProp$z(a, prop, b[prop]);
2816
+ if (__hasOwnProp$A.call(b, prop))
2817
+ __defNormalProp$A(a, prop, b[prop]);
2818
+ if (__getOwnPropSymbols$A)
2819
+ for (var prop of __getOwnPropSymbols$A(b)) {
2820
+ if (__propIsEnum$A.call(b, prop))
2821
+ __defNormalProp$A(a, prop, b[prop]);
3001
2822
  }
3002
2823
  return a;
3003
2824
  };
3004
- var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
2825
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
3005
2826
  var __objRest$3 = (source, exclude) => {
3006
2827
  var target = {};
3007
2828
  for (var prop in source)
3008
- if (__hasOwnProp$z.call(source, prop) && exclude.indexOf(prop) < 0)
2829
+ if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
3009
2830
  target[prop] = source[prop];
3010
- if (source != null && __getOwnPropSymbols$z)
3011
- for (var prop of __getOwnPropSymbols$z(source)) {
3012
- if (exclude.indexOf(prop) < 0 && __propIsEnum$z.call(source, prop))
2831
+ if (source != null && __getOwnPropSymbols$A)
2832
+ for (var prop of __getOwnPropSymbols$A(source)) {
2833
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
3013
2834
  target[prop] = source[prop];
3014
2835
  }
3015
2836
  return target;
3016
2837
  };
3017
- const filterNoOp$1 = () => true;
2838
+ const filterNoOp$2 = () => true;
2839
+ function toSelectableValue$1(value, label) {
2840
+ return {
2841
+ value,
2842
+ label: label != null ? label : String(value)
2843
+ };
2844
+ }
3018
2845
  function VariableValueSelect({ model }) {
3019
2846
  const { value, text, key, options, includeAll } = model.useState();
3020
2847
  const [inputValue, setInputValue] = React.useState("");
3021
2848
  const [hasCustomValue, setHasCustomValue] = React.useState(false);
2849
+ const selectValue = toSelectableValue$1(value, String(text));
3022
2850
  const optionSearcher = React.useMemo(
3023
2851
  () => getOptionSearcher(options, includeAll),
3024
2852
  [options, includeAll]
@@ -3047,11 +2875,11 @@ function VariableValueSelect({ model }) {
3047
2875
  isValidNewOption: (inputValue2) => inputValue2.trim().length > 0,
3048
2876
  placeholder: "Select value",
3049
2877
  width: "auto",
3050
- value,
2878
+ value: selectValue,
3051
2879
  inputValue,
3052
2880
  allowCustomValue: true,
3053
2881
  virtualized: true,
3054
- filterOption: filterNoOp$1,
2882
+ filterOption: filterNoOp$2,
3055
2883
  tabSelectsValue: false,
3056
2884
  onInputChange,
3057
2885
  onOpenMenu,
@@ -3114,7 +2942,7 @@ function VariableValueSelectMulti({ model }) {
3114
2942
  onBlur: () => {
3115
2943
  model.changeValueTo(uncommittedValue);
3116
2944
  },
3117
- filterOption: filterNoOp$1,
2945
+ filterOption: filterNoOp$2,
3118
2946
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
3119
2947
  onChange: (newValue, action) => {
3120
2948
  if (action.action === "clear" && noValueOnClear) {
@@ -3137,7 +2965,7 @@ const OptionWithCheckbox = ({
3137
2965
  const theme = ui.useTheme2();
3138
2966
  const selectStyles = ui.getSelectStyles(theme);
3139
2967
  const optionStyles = ui.useStyles2(getOptionStyles);
3140
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$n(__spreadValues$z({
2968
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
3141
2969
  ref: innerRef,
3142
2970
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
3143
2971
  }, rest), {
@@ -3231,28 +3059,28 @@ function fromUrlValues(urlValues) {
3231
3059
  );
3232
3060
  }
3233
3061
 
3234
- var __defProp$y = Object.defineProperty;
3235
- var __defProps$m = Object.defineProperties;
3236
- var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
3237
- var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
3238
- var __hasOwnProp$y = Object.prototype.hasOwnProperty;
3239
- var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
3240
- var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3241
- var __spreadValues$y = (a, b) => {
3062
+ var __defProp$z = Object.defineProperty;
3063
+ var __defProps$n = Object.defineProperties;
3064
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
3065
+ var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
3066
+ var __hasOwnProp$z = Object.prototype.hasOwnProperty;
3067
+ var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
3068
+ var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3069
+ var __spreadValues$z = (a, b) => {
3242
3070
  for (var prop in b || (b = {}))
3243
- if (__hasOwnProp$y.call(b, prop))
3244
- __defNormalProp$y(a, prop, b[prop]);
3245
- if (__getOwnPropSymbols$y)
3246
- for (var prop of __getOwnPropSymbols$y(b)) {
3247
- if (__propIsEnum$y.call(b, prop))
3248
- __defNormalProp$y(a, prop, b[prop]);
3071
+ if (__hasOwnProp$z.call(b, prop))
3072
+ __defNormalProp$z(a, prop, b[prop]);
3073
+ if (__getOwnPropSymbols$z)
3074
+ for (var prop of __getOwnPropSymbols$z(b)) {
3075
+ if (__propIsEnum$z.call(b, prop))
3076
+ __defNormalProp$z(a, prop, b[prop]);
3249
3077
  }
3250
3078
  return a;
3251
3079
  };
3252
- var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
3080
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
3253
3081
  class GroupByVariable extends MultiValueVariable {
3254
3082
  constructor(initialState) {
3255
- super(__spreadProps$m(__spreadValues$y({
3083
+ super(__spreadProps$n(__spreadValues$z({
3256
3084
  isMulti: true,
3257
3085
  name: "",
3258
3086
  value: [],
@@ -3403,7 +3231,7 @@ function GroupByVariableRenderer({ model }) {
3403
3231
  tabSelectsValue: false,
3404
3232
  virtualized: true,
3405
3233
  options: filteredOptions,
3406
- filterOption: filterNoOp,
3234
+ filterOption: filterNoOp$1,
3407
3235
  closeMenuOnSelect: false,
3408
3236
  isOpen: isOptionsOpen,
3409
3237
  isClearable: true,
@@ -3434,7 +3262,7 @@ function GroupByVariableRenderer({ model }) {
3434
3262
  }
3435
3263
  });
3436
3264
  }
3437
- const filterNoOp = () => true;
3265
+ const filterNoOp$1 = () => true;
3438
3266
 
3439
3267
  function LoadingIndicator(props) {
3440
3268
  return /* @__PURE__ */ React__default["default"].createElement(ui.Tooltip, {
@@ -3451,7 +3279,7 @@ function LoadingIndicator(props) {
3451
3279
  }
3452
3280
 
3453
3281
  function ControlsLabel(props) {
3454
- const styles = ui.useStyles2(getStyles$8);
3282
+ const styles = ui.useStyles2(getStyles$9);
3455
3283
  const theme = ui.useTheme2();
3456
3284
  const isVertical = props.layout === "vertical";
3457
3285
  const loadingIndicator = Boolean(props.isLoading) ? /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -3514,7 +3342,7 @@ function ControlsLabel(props) {
3514
3342
  }
3515
3343
  return labelElement;
3516
3344
  }
3517
- const getStyles$8 = (theme) => ({
3345
+ const getStyles$9 = (theme) => ({
3518
3346
  horizontalLabel: css.css({
3519
3347
  background: theme.isDark ? theme.colors.background.primary : theme.colors.background.secondary,
3520
3348
  display: `flex`,
@@ -3562,9 +3390,10 @@ function keyLabelToOption(key, label) {
3562
3390
  label: label || key
3563
3391
  } : null;
3564
3392
  }
3393
+ const filterNoOp = () => true;
3565
3394
  function AdHocFilterRenderer({ filter, model }) {
3566
3395
  var _a, _b;
3567
- const styles = ui.useStyles2(getStyles$7);
3396
+ const styles = ui.useStyles2(getStyles$8);
3568
3397
  const [keys, setKeys] = React.useState([]);
3569
3398
  const [values, setValues] = React.useState([]);
3570
3399
  const [isKeysLoading, setIsKeysLoading] = React.useState(false);
@@ -3576,7 +3405,7 @@ function AdHocFilterRenderer({ filter, model }) {
3576
3405
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3577
3406
  const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
3578
3407
  const optionSearcher = React.useMemo(
3579
- () => getOptionSearcher(values.map(selectableValueToVariableValueOption), void 0, 1e3),
3408
+ () => getOptionSearcher(values.map(selectableValueToVariableValueOption), void 0),
3580
3409
  [values]
3581
3410
  );
3582
3411
  const onValueInputChange = (value, { action }) => {
@@ -3596,6 +3425,7 @@ function AdHocFilterRenderer({ filter, model }) {
3596
3425
  className: css.cx(styles.value, isKeysOpen ? styles.widthWhenOpen : void 0),
3597
3426
  width: "auto",
3598
3427
  value: valueValue,
3428
+ filterOption: filterNoOp,
3599
3429
  placeholder: "Select value",
3600
3430
  options: filteredValueOptions,
3601
3431
  inputValue: valueInputValue,
@@ -3695,7 +3525,7 @@ function AdHocFilterRenderer({ filter, model }) {
3695
3525
  onClick: () => model._removeFilter(filter)
3696
3526
  }));
3697
3527
  }
3698
- const getStyles$7 = (theme) => ({
3528
+ const getStyles$8 = (theme) => ({
3699
3529
  field: css.css({
3700
3530
  marginBottom: 0
3701
3531
  }),
@@ -3833,29 +3663,29 @@ function isFilter(filter) {
3833
3663
  return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
3834
3664
  }
3835
3665
 
3836
- var __defProp$x = Object.defineProperty;
3837
- var __defProps$l = Object.defineProperties;
3838
- var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
3839
- var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
3840
- var __hasOwnProp$x = Object.prototype.hasOwnProperty;
3841
- var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
3842
- var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3843
- var __spreadValues$x = (a, b) => {
3666
+ var __defProp$y = Object.defineProperty;
3667
+ var __defProps$m = Object.defineProperties;
3668
+ var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
3669
+ var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
3670
+ var __hasOwnProp$y = Object.prototype.hasOwnProperty;
3671
+ var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
3672
+ var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3673
+ var __spreadValues$y = (a, b) => {
3844
3674
  for (var prop in b || (b = {}))
3845
- if (__hasOwnProp$x.call(b, prop))
3846
- __defNormalProp$x(a, prop, b[prop]);
3847
- if (__getOwnPropSymbols$x)
3848
- for (var prop of __getOwnPropSymbols$x(b)) {
3849
- if (__propIsEnum$x.call(b, prop))
3850
- __defNormalProp$x(a, prop, b[prop]);
3675
+ if (__hasOwnProp$y.call(b, prop))
3676
+ __defNormalProp$y(a, prop, b[prop]);
3677
+ if (__getOwnPropSymbols$y)
3678
+ for (var prop of __getOwnPropSymbols$y(b)) {
3679
+ if (__propIsEnum$y.call(b, prop))
3680
+ __defNormalProp$y(a, prop, b[prop]);
3851
3681
  }
3852
3682
  return a;
3853
3683
  };
3854
- var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
3684
+ var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
3855
3685
  class AdHocFiltersVariable extends SceneObjectBase {
3856
3686
  constructor(state) {
3857
3687
  var _a, _b;
3858
- super(__spreadValues$x({
3688
+ super(__spreadValues$y({
3859
3689
  type: "adhoc",
3860
3690
  name: (_a = state.name) != null ? _a : "Filters",
3861
3691
  filters: [],
@@ -3892,15 +3722,15 @@ class AdHocFiltersVariable extends SceneObjectBase {
3892
3722
  const propLabelKey = `${prop}Label`;
3893
3723
  if (filter === _wip) {
3894
3724
  if (prop === "value") {
3895
- this.setState({ filters: [...filters, __spreadProps$l(__spreadValues$x({}, _wip), { [prop]: value, [propLabelKey]: label })], _wip: void 0 });
3725
+ this.setState({ filters: [...filters, __spreadProps$m(__spreadValues$y({}, _wip), { [prop]: value, [propLabelKey]: label })], _wip: void 0 });
3896
3726
  } else {
3897
- this.setState({ _wip: __spreadProps$l(__spreadValues$x({}, filter), { [prop]: value, [propLabelKey]: label }) });
3727
+ this.setState({ _wip: __spreadProps$m(__spreadValues$y({}, filter), { [prop]: value, [propLabelKey]: label }) });
3898
3728
  }
3899
3729
  return;
3900
3730
  }
3901
3731
  const updatedFilters = this.state.filters.map((f) => {
3902
3732
  if (f === filter) {
3903
- const updatedFilter = __spreadProps$l(__spreadValues$x({}, f), { [prop]: value, [propLabelKey]: label });
3733
+ const updatedFilter = __spreadProps$m(__spreadValues$y({}, f), { [prop]: value, [propLabelKey]: label });
3904
3734
  if (prop === "key" && filter[prop] !== value) {
3905
3735
  updatedFilter.value = "";
3906
3736
  updatedFilter.valueLabel = "";
@@ -3981,7 +3811,7 @@ function renderExpression(builder, filters) {
3981
3811
  }
3982
3812
  function AdHocFiltersVariableRenderer({ model }) {
3983
3813
  const { filters, readOnly, addFilterButtonText } = model.useState();
3984
- const styles = ui.useStyles2(getStyles$6);
3814
+ const styles = ui.useStyles2(getStyles$7);
3985
3815
  return /* @__PURE__ */ React__default["default"].createElement("div", {
3986
3816
  className: styles.wrapper
3987
3817
  }, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
@@ -3995,7 +3825,7 @@ function AdHocFiltersVariableRenderer({ model }) {
3995
3825
  addFilterButtonText
3996
3826
  }));
3997
3827
  }
3998
- const getStyles$6 = (theme) => ({
3828
+ const getStyles$7 = (theme) => ({
3999
3829
  wrapper: css.css({
4000
3830
  display: "flex",
4001
3831
  flexWrap: "wrap",
@@ -4079,25 +3909,25 @@ function areDifferentLayers(a, b) {
4079
3909
  return false;
4080
3910
  }
4081
3911
 
4082
- var __defProp$w = Object.defineProperty;
4083
- var __defProps$k = Object.defineProperties;
4084
- var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
4085
- var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
4086
- var __hasOwnProp$w = Object.prototype.hasOwnProperty;
4087
- var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
4088
- var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4089
- var __spreadValues$w = (a, b) => {
3912
+ var __defProp$x = Object.defineProperty;
3913
+ var __defProps$l = Object.defineProperties;
3914
+ var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
3915
+ var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
3916
+ var __hasOwnProp$x = Object.prototype.hasOwnProperty;
3917
+ var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
3918
+ var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3919
+ var __spreadValues$x = (a, b) => {
4090
3920
  for (var prop in b || (b = {}))
4091
- if (__hasOwnProp$w.call(b, prop))
4092
- __defNormalProp$w(a, prop, b[prop]);
4093
- if (__getOwnPropSymbols$w)
4094
- for (var prop of __getOwnPropSymbols$w(b)) {
4095
- if (__propIsEnum$w.call(b, prop))
4096
- __defNormalProp$w(a, prop, b[prop]);
3921
+ if (__hasOwnProp$x.call(b, prop))
3922
+ __defNormalProp$x(a, prop, b[prop]);
3923
+ if (__getOwnPropSymbols$x)
3924
+ for (var prop of __getOwnPropSymbols$x(b)) {
3925
+ if (__propIsEnum$x.call(b, prop))
3926
+ __defNormalProp$x(a, prop, b[prop]);
4097
3927
  }
4098
3928
  return a;
4099
3929
  };
4100
- var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
3930
+ var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
4101
3931
  let counter$1 = 100;
4102
3932
  function getNextRequestId$1() {
4103
3933
  return "SQR" + counter$1++;
@@ -4114,70 +3944,6 @@ class SceneQueryRunner extends SceneObjectBase {
4114
3944
  onVariableUpdateCompleted: this.onVariableUpdatesCompleted.bind(this),
4115
3945
  onAnyVariableChanged: this.onAnyVariableChanged.bind(this)
4116
3946
  });
4117
- this.prepareRequests = (timeRange, ds) => {
4118
- const comparer = this.getTimeCompare();
4119
- const { minInterval, queries } = this.state;
4120
- let secondaryRequest;
4121
- let request = __spreadValues$w({
4122
- app: "scenes",
4123
- requestId: getNextRequestId$1(),
4124
- timezone: timeRange.getTimeZone(),
4125
- panelId: 1,
4126
- range: timeRange.state.value,
4127
- interval: "1s",
4128
- intervalMs: 1e3,
4129
- targets: lodash.cloneDeep(queries),
4130
- maxDataPoints: this.getMaxDataPoints(),
4131
- scopedVars: this._scopedVars,
4132
- startTime: Date.now(),
4133
- liveStreaming: this.state.liveStreaming,
4134
- rangeRaw: {
4135
- from: timeRange.state.from,
4136
- to: timeRange.state.to
4137
- },
4138
- cacheTimeout: this.state.cacheTimeout,
4139
- queryCachingTTL: this.state.queryCachingTTL
4140
- }, getEnrichedDataRequest(this));
4141
- if (this._adhocFiltersVar) {
4142
- request.filters = this._adhocFiltersVar.state.filters.filter(isFilterComplete);
4143
- }
4144
- if (this._groupByVar) {
4145
- request.groupByKeys = this._groupByVar.state.value;
4146
- }
4147
- request.targets = request.targets.map((query) => {
4148
- var _a;
4149
- if (!query.datasource || query.datasource.uid !== ds.uid && !((_a = ds.meta) == null ? void 0 : _a.mixed) && runtime.isExpressionReference && !runtime.isExpressionReference(query.datasource)) {
4150
- query.datasource = ds.getRef();
4151
- }
4152
- return query;
4153
- });
4154
- const lowerIntervalLimit = minInterval ? minInterval : ds.interval;
4155
- const norm = data.rangeUtil.calculateInterval(timeRange.state.value, request.maxDataPoints, lowerIntervalLimit);
4156
- request.scopedVars = Object.assign({}, request.scopedVars, {
4157
- __interval: { text: norm.interval, value: norm.interval },
4158
- __interval_ms: { text: norm.intervalMs.toString(), value: norm.intervalMs }
4159
- });
4160
- request.interval = norm.interval;
4161
- request.intervalMs = norm.intervalMs;
4162
- const primaryTimeRange = timeRange.state.value;
4163
- if (comparer) {
4164
- const secondaryTimeRange = comparer.getCompareTimeRange(primaryTimeRange);
4165
- if (secondaryTimeRange) {
4166
- const secondaryTargets = request.targets.filter((query) => query.timeRangeCompare !== false);
4167
- if (secondaryTargets.length) {
4168
- secondaryRequest = __spreadProps$k(__spreadValues$w({}, request), {
4169
- targets: secondaryTargets,
4170
- range: secondaryTimeRange,
4171
- requestId: getNextRequestId$1()
4172
- });
4173
- }
4174
- request = __spreadProps$k(__spreadValues$w({}, request), {
4175
- range: primaryTimeRange
4176
- });
4177
- }
4178
- }
4179
- return [request, secondaryRequest];
4180
- };
4181
3947
  this.onDataReceived = (data$1) => {
4182
3948
  const preProcessedData = data.preProcessPanelData(data$1, this.state.data);
4183
3949
  this._resultAnnotations = data$1.annotations;
@@ -4196,11 +3962,11 @@ class SceneQueryRunner extends SceneObjectBase {
4196
3962
  }
4197
3963
  _onActivate() {
4198
3964
  const timeRange = sceneGraph.getTimeRange(this);
4199
- const comparer = this.getTimeCompare();
4200
- if (comparer) {
3965
+ const providers = this.getClosestExtraQueryProviders();
3966
+ for (const provider of providers) {
4201
3967
  this._subs.add(
4202
- comparer.subscribeToState((n, p) => {
4203
- if (n.compareWith !== p.compareWith) {
3968
+ provider.subscribeToState((n, p) => {
3969
+ if (provider.shouldRerun(p, n)) {
4204
3970
  this.runQueries();
4205
3971
  }
4206
3972
  })
@@ -4259,9 +4025,9 @@ class SceneQueryRunner extends SceneObjectBase {
4259
4025
  return;
4260
4026
  }
4261
4027
  this._layerAnnotations = annotations;
4262
- const baseStateUpdate = this.state.data ? this.state.data : __spreadProps$k(__spreadValues$w({}, emptyPanelData), { timeRange: timeRange.state.value });
4028
+ const baseStateUpdate = this.state.data ? this.state.data : __spreadProps$l(__spreadValues$x({}, emptyPanelData), { timeRange: timeRange.state.value });
4263
4029
  this.setState({
4264
- data: __spreadProps$k(__spreadValues$w({}, baseStateUpdate), {
4030
+ data: __spreadProps$l(__spreadValues$x({}, baseStateUpdate), {
4265
4031
  annotations: [...(_d = this._resultAnnotations) != null ? _d : [], ...annotations],
4266
4032
  alertState: alertState != null ? alertState : (_e = this.state.data) == null ? void 0 : _e.alertState
4267
4033
  })
@@ -4380,7 +4146,7 @@ class SceneQueryRunner extends SceneObjectBase {
4380
4146
  this._dataLayersSub = void 0;
4381
4147
  }
4382
4148
  this.setState({
4383
- data: __spreadProps$k(__spreadValues$w({}, this.state.data), { state: schema.LoadingState.Done })
4149
+ data: __spreadProps$l(__spreadValues$x({}, this.state.data), { state: schema.LoadingState.Done })
4384
4150
  });
4385
4151
  }
4386
4152
  async runWithTimeRange(timeRange) {
@@ -4394,6 +4160,7 @@ class SceneQueryRunner extends SceneObjectBase {
4394
4160
  (_a = this._querySub) == null ? void 0 : _a.unsubscribe();
4395
4161
  if (this._variableDependency.hasDependencyInLoadingState()) {
4396
4162
  writeSceneLog("SceneQueryRunner", "Variable dependency is in loading state, skipping query execution");
4163
+ this.setState({ data: __spreadProps$l(__spreadValues$x({}, this.state.data), { state: schema.LoadingState.Loading }) });
4397
4164
  return;
4398
4165
  }
4399
4166
  const { queries } = this.state;
@@ -4406,16 +4173,18 @@ class SceneQueryRunner extends SceneObjectBase {
4406
4173
  const ds = await getDataSource(datasource, this._scopedVars);
4407
4174
  this.findAndSubscribeToAdHocFilters(datasource == null ? void 0 : datasource.uid);
4408
4175
  const runRequest = runtime.getRunRequest();
4409
- const [request, secondaryRequest] = this.prepareRequests(timeRange, ds);
4176
+ const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds);
4410
4177
  writeSceneLog("SceneQueryRunner", "Starting runRequest", this.state.key);
4411
- let stream = runRequest(ds, request);
4412
- if (secondaryRequest) {
4413
- stream = rxjs.forkJoin([stream, runRequest(ds, secondaryRequest)]).pipe(timeShiftQueryResponseOperator);
4178
+ let stream = runRequest(ds, primary);
4179
+ if (secondaries.length > 0) {
4180
+ const secondaryStreams = secondaries.map((r) => runRequest(ds, r));
4181
+ const op = extraQueryProcessingOperator(processors);
4182
+ stream = rxjs.forkJoin([stream, ...secondaryStreams]).pipe(op);
4414
4183
  }
4415
4184
  stream = stream.pipe(
4416
4185
  registerQueryWithController({
4417
4186
  type: "data",
4418
- request,
4187
+ request: primary,
4419
4188
  origin: this,
4420
4189
  cancel: () => this.cancelQuery()
4421
4190
  })
@@ -4423,7 +4192,7 @@ class SceneQueryRunner extends SceneObjectBase {
4423
4192
  this._querySub = stream.subscribe(this.onDataReceived);
4424
4193
  } catch (err) {
4425
4194
  console.error("PanelQueryRunner Error", err);
4426
- this.onDataReceived(__spreadProps$k(__spreadValues$w(__spreadValues$w({}, emptyPanelData), this.state.data), {
4195
+ this.onDataReceived(__spreadProps$l(__spreadValues$x(__spreadValues$x({}, emptyPanelData), this.state.data), {
4427
4196
  state: schema.LoadingState.Error,
4428
4197
  errors: [runtime.toDataQueryError(err)]
4429
4198
  }));
@@ -4433,16 +4202,73 @@ class SceneQueryRunner extends SceneObjectBase {
4433
4202
  var _a;
4434
4203
  const clone = super.clone(withState);
4435
4204
  if (this._resultAnnotations) {
4436
- clone["_resultAnnotations"] = this._resultAnnotations.map((frame) => __spreadValues$w({}, frame));
4205
+ clone["_resultAnnotations"] = this._resultAnnotations.map((frame) => __spreadValues$x({}, frame));
4437
4206
  }
4438
4207
  if (this._layerAnnotations) {
4439
- clone["_layerAnnotations"] = this._layerAnnotations.map((frame) => __spreadValues$w({}, frame));
4208
+ clone["_layerAnnotations"] = this._layerAnnotations.map((frame) => __spreadValues$x({}, frame));
4440
4209
  }
4441
4210
  clone["_variableValueRecorder"] = this._variableValueRecorder.cloneAndRecordCurrentValuesForSceneObject(this);
4442
4211
  clone["_containerWidth"] = this._containerWidth;
4443
4212
  clone["_results"].next({ origin: this, data: (_a = this.state.data) != null ? _a : emptyPanelData });
4444
4213
  return clone;
4445
4214
  }
4215
+ prepareRequests(timeRange, ds) {
4216
+ var _a;
4217
+ const { minInterval, queries } = this.state;
4218
+ let request = __spreadValues$x({
4219
+ app: "scenes",
4220
+ requestId: getNextRequestId$1(),
4221
+ timezone: timeRange.getTimeZone(),
4222
+ panelId: 1,
4223
+ range: timeRange.state.value,
4224
+ interval: "1s",
4225
+ intervalMs: 1e3,
4226
+ targets: lodash.cloneDeep(queries),
4227
+ maxDataPoints: this.getMaxDataPoints(),
4228
+ scopedVars: this._scopedVars,
4229
+ startTime: Date.now(),
4230
+ liveStreaming: this.state.liveStreaming,
4231
+ rangeRaw: {
4232
+ from: timeRange.state.from,
4233
+ to: timeRange.state.to
4234
+ },
4235
+ cacheTimeout: this.state.cacheTimeout,
4236
+ queryCachingTTL: this.state.queryCachingTTL
4237
+ }, getEnrichedDataRequest(this));
4238
+ if (this._adhocFiltersVar) {
4239
+ request.filters = this._adhocFiltersVar.state.filters.filter(isFilterComplete);
4240
+ }
4241
+ if (this._groupByVar) {
4242
+ request.groupByKeys = this._groupByVar.state.value;
4243
+ }
4244
+ request.targets = request.targets.map((query) => {
4245
+ var _a2;
4246
+ if (!query.datasource || query.datasource.uid !== ds.uid && !((_a2 = ds.meta) == null ? void 0 : _a2.mixed) && runtime.isExpressionReference && !runtime.isExpressionReference(query.datasource)) {
4247
+ query.datasource = ds.getRef();
4248
+ }
4249
+ return query;
4250
+ });
4251
+ const lowerIntervalLimit = minInterval ? minInterval : ds.interval;
4252
+ const norm = data.rangeUtil.calculateInterval(timeRange.state.value, request.maxDataPoints, lowerIntervalLimit);
4253
+ request.scopedVars = Object.assign({}, request.scopedVars, {
4254
+ __interval: { text: norm.interval, value: norm.interval },
4255
+ __interval_ms: { text: norm.intervalMs.toString(), value: norm.intervalMs }
4256
+ });
4257
+ request.interval = norm.interval;
4258
+ request.intervalMs = norm.intervalMs;
4259
+ const primaryTimeRange = timeRange.state.value;
4260
+ let secondaryRequests = [];
4261
+ let secondaryProcessors = /* @__PURE__ */ new Map();
4262
+ for (const provider of (_a = this.getClosestExtraQueryProviders()) != null ? _a : []) {
4263
+ for (const { req, processor } of provider.getExtraQueries(request)) {
4264
+ const requestId = getNextRequestId$1();
4265
+ secondaryRequests.push(__spreadProps$l(__spreadValues$x({}, req), { requestId }));
4266
+ secondaryProcessors.set(requestId, processor != null ? processor : passthroughProcessor);
4267
+ }
4268
+ }
4269
+ request.range = primaryTimeRange;
4270
+ return { primary: request, secondaries: secondaryRequests, processors: secondaryProcessors };
4271
+ }
4446
4272
  _combineDataLayers(data) {
4447
4273
  if (this._layerAnnotations && this._layerAnnotations.length > 0) {
4448
4274
  data.annotations = (data.annotations || []).concat(this._layerAnnotations);
@@ -4457,22 +4283,23 @@ class SceneQueryRunner extends SceneObjectBase {
4457
4283
  this.setState({ data: emptyPanelData });
4458
4284
  }
4459
4285
  }
4460
- getTimeCompare() {
4286
+ getClosestExtraQueryProviders() {
4287
+ const found = /* @__PURE__ */ new Map();
4461
4288
  if (!this.parent) {
4462
- return null;
4289
+ return [];
4463
4290
  }
4464
- return getClosest(this.parent, (s) => {
4465
- let found = null;
4466
- if (s instanceof SceneTimeRangeCompare) {
4467
- return s;
4291
+ getClosest(this.parent, (s) => {
4292
+ if (isExtraQueryProvider(s) && !found.has(s.constructor)) {
4293
+ found.set(s.constructor, s);
4468
4294
  }
4469
4295
  s.forEachChild((child) => {
4470
- if (child instanceof SceneTimeRangeCompare) {
4471
- found = child;
4296
+ if (isExtraQueryProvider(child) && !found.has(child.constructor)) {
4297
+ found.set(child.constructor, child);
4472
4298
  }
4473
4299
  });
4474
- return found;
4300
+ return null;
4475
4301
  });
4302
+ return Array.from(found.values());
4476
4303
  }
4477
4304
  findAndSubscribeToAdHocFilters(uid) {
4478
4305
  const filtersVar = findActiveAdHocFilterVariableByUid(uid);
@@ -4671,28 +4498,28 @@ class ActWhenVariableChanged extends SceneObjectBase {
4671
4498
  }
4672
4499
  }
4673
4500
 
4674
- var __defProp$v = Object.defineProperty;
4675
- var __defProps$j = Object.defineProperties;
4676
- var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
4677
- var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
4678
- var __hasOwnProp$v = Object.prototype.hasOwnProperty;
4679
- var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
4680
- var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4681
- var __spreadValues$v = (a, b) => {
4501
+ var __defProp$w = Object.defineProperty;
4502
+ var __defProps$k = Object.defineProperties;
4503
+ var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
4504
+ var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
4505
+ var __hasOwnProp$w = Object.prototype.hasOwnProperty;
4506
+ var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
4507
+ var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4508
+ var __spreadValues$w = (a, b) => {
4682
4509
  for (var prop in b || (b = {}))
4683
- if (__hasOwnProp$v.call(b, prop))
4684
- __defNormalProp$v(a, prop, b[prop]);
4685
- if (__getOwnPropSymbols$v)
4686
- for (var prop of __getOwnPropSymbols$v(b)) {
4687
- if (__propIsEnum$v.call(b, prop))
4688
- __defNormalProp$v(a, prop, b[prop]);
4510
+ if (__hasOwnProp$w.call(b, prop))
4511
+ __defNormalProp$w(a, prop, b[prop]);
4512
+ if (__getOwnPropSymbols$w)
4513
+ for (var prop of __getOwnPropSymbols$w(b)) {
4514
+ if (__propIsEnum$w.call(b, prop))
4515
+ __defNormalProp$w(a, prop, b[prop]);
4689
4516
  }
4690
4517
  return a;
4691
4518
  };
4692
- var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
4519
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
4693
4520
  class CursorSync extends SceneObjectBase {
4694
4521
  constructor(state) {
4695
- super(__spreadProps$j(__spreadValues$v({}, state), {
4522
+ super(__spreadProps$k(__spreadValues$w({}, state), {
4696
4523
  sync: state.sync || schema.DashboardCursorSync.Off
4697
4524
  }));
4698
4525
  this.getEventsBus = (panel) => {
@@ -4956,25 +4783,25 @@ const getAlertStateStyles = (theme) => {
4956
4783
  };
4957
4784
  };
4958
4785
 
4959
- var __defProp$u = Object.defineProperty;
4960
- var __defProps$i = Object.defineProperties;
4961
- var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
4962
- var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
4963
- var __hasOwnProp$u = Object.prototype.hasOwnProperty;
4964
- var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
4965
- var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4966
- var __spreadValues$u = (a, b) => {
4786
+ var __defProp$v = Object.defineProperty;
4787
+ var __defProps$j = Object.defineProperties;
4788
+ var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
4789
+ var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
4790
+ var __hasOwnProp$v = Object.prototype.hasOwnProperty;
4791
+ var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
4792
+ var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4793
+ var __spreadValues$v = (a, b) => {
4967
4794
  for (var prop in b || (b = {}))
4968
- if (__hasOwnProp$u.call(b, prop))
4969
- __defNormalProp$u(a, prop, b[prop]);
4970
- if (__getOwnPropSymbols$u)
4971
- for (var prop of __getOwnPropSymbols$u(b)) {
4972
- if (__propIsEnum$u.call(b, prop))
4973
- __defNormalProp$u(a, prop, b[prop]);
4795
+ if (__hasOwnProp$v.call(b, prop))
4796
+ __defNormalProp$v(a, prop, b[prop]);
4797
+ if (__getOwnPropSymbols$v)
4798
+ for (var prop of __getOwnPropSymbols$v(b)) {
4799
+ if (__propIsEnum$v.call(b, prop))
4800
+ __defNormalProp$v(a, prop, b[prop]);
4974
4801
  }
4975
4802
  return a;
4976
4803
  };
4977
- var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
4804
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
4978
4805
  const displayOverrideRef = "hideSeriesFrom";
4979
4806
  const isHideSeriesOverride = data.isSystemOverrideWithRef(displayOverrideRef);
4980
4807
  function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
@@ -4984,13 +4811,13 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
4984
4811
  if (currentIndex < 0) {
4985
4812
  if (mode === ui.SeriesVisibilityChangeMode.ToggleSelection) {
4986
4813
  const override3 = createOverride$1([displayName, ...getNamesOfHiddenFields(overrides, data)]);
4987
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4814
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
4988
4815
  overrides: [...fieldConfig.overrides, override3]
4989
4816
  });
4990
4817
  }
4991
4818
  const displayNames = getDisplayNames(data, displayName);
4992
4819
  const override2 = createOverride$1(displayNames);
4993
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4820
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
4994
4821
  overrides: [...fieldConfig.overrides, override2]
4995
4822
  });
4996
4823
  }
@@ -5003,22 +4830,22 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
5003
4830
  existing = existing.filter((el) => nameOfHiddenFields.indexOf(el) < 0);
5004
4831
  }
5005
4832
  if (existing[0] === displayName && existing.length === 1) {
5006
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4833
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5007
4834
  overrides: overridesCopy
5008
4835
  });
5009
4836
  }
5010
4837
  const override2 = createOverride$1([displayName, ...nameOfHiddenFields]);
5011
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4838
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5012
4839
  overrides: [...overridesCopy, override2]
5013
4840
  });
5014
4841
  }
5015
4842
  const override = createExtendedOverride(current, displayName);
5016
4843
  if (allFieldsAreExcluded(override, data)) {
5017
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4844
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5018
4845
  overrides: overridesCopy
5019
4846
  });
5020
4847
  }
5021
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4848
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5022
4849
  overrides: [...overridesCopy, override]
5023
4850
  });
5024
4851
  }
@@ -5043,7 +4870,7 @@ function createOverride$1(names, mode = data.ByNamesMatcherMode.exclude, propert
5043
4870
  }
5044
4871
  },
5045
4872
  properties: [
5046
- __spreadProps$i(__spreadValues$u({}, property), {
4873
+ __spreadProps$j(__spreadValues$v({}, property), {
5047
4874
  value: {
5048
4875
  viz: true,
5049
4876
  legend: false,
@@ -5115,32 +4942,32 @@ const getNamesOfHiddenFields = (overrides, data$1) => {
5115
4942
  return names;
5116
4943
  };
5117
4944
 
5118
- var __defProp$t = Object.defineProperty;
5119
- var __defProps$h = Object.defineProperties;
5120
- var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
5121
- var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
5122
- var __hasOwnProp$t = Object.prototype.hasOwnProperty;
5123
- var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
5124
- var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5125
- var __spreadValues$t = (a, b) => {
4945
+ var __defProp$u = Object.defineProperty;
4946
+ var __defProps$i = Object.defineProperties;
4947
+ var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
4948
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
4949
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
4950
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
4951
+ var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4952
+ var __spreadValues$u = (a, b) => {
5126
4953
  for (var prop in b || (b = {}))
5127
- if (__hasOwnProp$t.call(b, prop))
5128
- __defNormalProp$t(a, prop, b[prop]);
5129
- if (__getOwnPropSymbols$t)
5130
- for (var prop of __getOwnPropSymbols$t(b)) {
5131
- if (__propIsEnum$t.call(b, prop))
5132
- __defNormalProp$t(a, prop, b[prop]);
4954
+ if (__hasOwnProp$u.call(b, prop))
4955
+ __defNormalProp$u(a, prop, b[prop]);
4956
+ if (__getOwnPropSymbols$u)
4957
+ for (var prop of __getOwnPropSymbols$u(b)) {
4958
+ if (__propIsEnum$u.call(b, prop))
4959
+ __defNormalProp$u(a, prop, b[prop]);
5133
4960
  }
5134
4961
  return a;
5135
4962
  };
5136
- var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
4963
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
5137
4964
  const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
5138
4965
  const { overrides } = fieldConfig;
5139
4966
  const currentIndex = fieldConfig.overrides.findIndex((override) => {
5140
4967
  return override.matcher.id === data.FieldMatcherID.byName && override.matcher.options === label;
5141
4968
  });
5142
4969
  if (currentIndex < 0) {
5143
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4970
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5144
4971
  overrides: [...fieldConfig.overrides, createOverride(label, color)]
5145
4972
  });
5146
4973
  }
@@ -5148,19 +4975,19 @@ const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
5148
4975
  const existing = overridesCopy[currentIndex];
5149
4976
  const propertyIndex = existing.properties.findIndex((p) => p.id === "color");
5150
4977
  if (propertyIndex < 0) {
5151
- overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$t({}, existing), {
4978
+ overridesCopy[currentIndex] = __spreadProps$i(__spreadValues$u({}, existing), {
5152
4979
  properties: [...existing.properties, createProperty(color)]
5153
4980
  });
5154
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4981
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5155
4982
  overrides: overridesCopy
5156
4983
  });
5157
4984
  }
5158
4985
  const propertiesCopy = Array.from(existing.properties);
5159
4986
  propertiesCopy[propertyIndex] = createProperty(color);
5160
- overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$t({}, existing), {
4987
+ overridesCopy[currentIndex] = __spreadProps$i(__spreadValues$u({}, existing), {
5161
4988
  properties: propertiesCopy
5162
4989
  });
5163
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4990
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5164
4991
  overrides: overridesCopy
5165
4992
  });
5166
4993
  };
@@ -5183,29 +5010,29 @@ const createProperty = (color) => {
5183
5010
  };
5184
5011
  };
5185
5012
 
5186
- var __defProp$s = Object.defineProperty;
5187
- var __defProps$g = Object.defineProperties;
5188
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
5189
- var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
5190
- var __hasOwnProp$s = Object.prototype.hasOwnProperty;
5191
- var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
5192
- var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5193
- var __spreadValues$s = (a, b) => {
5013
+ var __defProp$t = Object.defineProperty;
5014
+ var __defProps$h = Object.defineProperties;
5015
+ var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
5016
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
5017
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
5018
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
5019
+ var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5020
+ var __spreadValues$t = (a, b) => {
5194
5021
  for (var prop in b || (b = {}))
5195
- if (__hasOwnProp$s.call(b, prop))
5196
- __defNormalProp$s(a, prop, b[prop]);
5197
- if (__getOwnPropSymbols$s)
5198
- for (var prop of __getOwnPropSymbols$s(b)) {
5199
- if (__propIsEnum$s.call(b, prop))
5200
- __defNormalProp$s(a, prop, b[prop]);
5201
- }
5202
- return a;
5203
- };
5204
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
5022
+ if (__hasOwnProp$t.call(b, prop))
5023
+ __defNormalProp$t(a, prop, b[prop]);
5024
+ if (__getOwnPropSymbols$t)
5025
+ for (var prop of __getOwnPropSymbols$t(b)) {
5026
+ if (__propIsEnum$t.call(b, prop))
5027
+ __defNormalProp$t(a, prop, b[prop]);
5028
+ }
5029
+ return a;
5030
+ };
5031
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
5205
5032
  class VizPanel extends SceneObjectBase {
5206
5033
  constructor(state) {
5207
5034
  var _a;
5208
- super(__spreadValues$s({
5035
+ super(__spreadValues$t({
5209
5036
  options: {},
5210
5037
  fieldConfig: { defaults: {}, overrides: [] },
5211
5038
  title: "Title",
@@ -5318,7 +5145,7 @@ class VizPanel extends SceneObjectBase {
5318
5145
  };
5319
5146
  this._onInstanceStateChange = (state) => {
5320
5147
  if (this._panelContext) {
5321
- this._panelContext = __spreadProps$g(__spreadValues$s({}, this._panelContext), {
5148
+ this._panelContext = __spreadProps$h(__spreadValues$t({}, this._panelContext), {
5322
5149
  instanceState: state
5323
5150
  });
5324
5151
  }
@@ -5342,8 +5169,8 @@ class VizPanel extends SceneObjectBase {
5342
5169
  sortBy = sortKey;
5343
5170
  }
5344
5171
  this.onOptionsChange(
5345
- __spreadProps$g(__spreadValues$s({}, this.state.options), {
5346
- legend: __spreadProps$g(__spreadValues$s({}, legendOptions), { sortBy, sortDesc })
5172
+ __spreadProps$h(__spreadValues$t({}, this.state.options), {
5173
+ legend: __spreadProps$h(__spreadValues$t({}, legendOptions), { sortBy, sortDesc })
5347
5174
  }),
5348
5175
  true
5349
5176
  );
@@ -5427,6 +5254,9 @@ class VizPanel extends SceneObjectBase {
5427
5254
  (_a = this._panelContext) != null ? _a : this._panelContext = this.buildPanelContext();
5428
5255
  return this._panelContext;
5429
5256
  }
5257
+ clearFieldConfigCache() {
5258
+ this._dataWithFieldConfig = void 0;
5259
+ }
5430
5260
  applyFieldConfig(rawData) {
5431
5261
  var _a, _b, _c, _d;
5432
5262
  const plugin = this._plugin;
@@ -5450,7 +5280,7 @@ class VizPanel extends SceneObjectBase {
5450
5280
  if (!data.compareArrayValues(newFrames, prevFrames, data.compareDataFrameStructures)) {
5451
5281
  this._structureRev++;
5452
5282
  }
5453
- this._dataWithFieldConfig = __spreadProps$g(__spreadValues$s({}, rawData), {
5283
+ this._dataWithFieldConfig = __spreadProps$h(__spreadValues$t({}, rawData), {
5454
5284
  structureRev: this._structureRev,
5455
5285
  series: newFrames
5456
5286
  });
@@ -5593,25 +5423,25 @@ function getMessageFromError(err) {
5593
5423
  return JSON.stringify(err);
5594
5424
  }
5595
5425
 
5596
- var __defProp$r = Object.defineProperty;
5597
- var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
5598
- var __hasOwnProp$r = Object.prototype.hasOwnProperty;
5599
- var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
5600
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5601
- var __spreadValues$r = (a, b) => {
5426
+ var __defProp$s = Object.defineProperty;
5427
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
5428
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
5429
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
5430
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5431
+ var __spreadValues$s = (a, b) => {
5602
5432
  for (var prop in b || (b = {}))
5603
- if (__hasOwnProp$r.call(b, prop))
5604
- __defNormalProp$r(a, prop, b[prop]);
5605
- if (__getOwnPropSymbols$r)
5606
- for (var prop of __getOwnPropSymbols$r(b)) {
5607
- if (__propIsEnum$r.call(b, prop))
5608
- __defNormalProp$r(a, prop, b[prop]);
5433
+ if (__hasOwnProp$s.call(b, prop))
5434
+ __defNormalProp$s(a, prop, b[prop]);
5435
+ if (__getOwnPropSymbols$s)
5436
+ for (var prop of __getOwnPropSymbols$s(b)) {
5437
+ if (__propIsEnum$s.call(b, prop))
5438
+ __defNormalProp$s(a, prop, b[prop]);
5609
5439
  }
5610
5440
  return a;
5611
5441
  };
5612
5442
  class SceneDataLayerBase extends SceneObjectBase {
5613
5443
  constructor(initialState, variableDependencyStatePaths = []) {
5614
- super(__spreadValues$r({
5444
+ super(__spreadValues$s({
5615
5445
  isEnabled: true
5616
5446
  }, initialState));
5617
5447
  this._results = new rxjs.ReplaySubject(1);
@@ -5733,33 +5563,33 @@ function DataLayerControlSwitch({ layer }) {
5733
5563
  }
5734
5564
  const containerStyle$1 = css.css({ display: "flex" });
5735
5565
 
5736
- var __defProp$q = Object.defineProperty;
5737
- var __defProps$f = Object.defineProperties;
5738
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
5739
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
5740
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
5741
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
5742
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5743
- var __spreadValues$q = (a, b) => {
5566
+ var __defProp$r = Object.defineProperty;
5567
+ var __defProps$g = Object.defineProperties;
5568
+ var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
5569
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
5570
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
5571
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
5572
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5573
+ var __spreadValues$r = (a, b) => {
5744
5574
  for (var prop in b || (b = {}))
5745
- if (__hasOwnProp$q.call(b, prop))
5746
- __defNormalProp$q(a, prop, b[prop]);
5747
- if (__getOwnPropSymbols$q)
5748
- for (var prop of __getOwnPropSymbols$q(b)) {
5749
- if (__propIsEnum$q.call(b, prop))
5750
- __defNormalProp$q(a, prop, b[prop]);
5575
+ if (__hasOwnProp$r.call(b, prop))
5576
+ __defNormalProp$r(a, prop, b[prop]);
5577
+ if (__getOwnPropSymbols$r)
5578
+ for (var prop of __getOwnPropSymbols$r(b)) {
5579
+ if (__propIsEnum$r.call(b, prop))
5580
+ __defNormalProp$r(a, prop, b[prop]);
5751
5581
  }
5752
5582
  return a;
5753
5583
  };
5754
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
5584
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
5755
5585
  var __objRest$2 = (source, exclude) => {
5756
5586
  var target = {};
5757
5587
  for (var prop in source)
5758
- if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
5588
+ if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
5759
5589
  target[prop] = source[prop];
5760
- if (source != null && __getOwnPropSymbols$q)
5761
- for (var prop of __getOwnPropSymbols$q(source)) {
5762
- if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
5590
+ if (source != null && __getOwnPropSymbols$r)
5591
+ for (var prop of __getOwnPropSymbols$r(source)) {
5592
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
5763
5593
  target[prop] = source[prop];
5764
5594
  }
5765
5595
  return target;
@@ -5768,7 +5598,7 @@ const standardAnnotationSupport = {
5768
5598
  prepareAnnotation: (json) => {
5769
5599
  if (lodash.isString(json == null ? void 0 : json.query)) {
5770
5600
  const _a = json, { query } = _a, rest = __objRest$2(_a, ["query"]);
5771
- return __spreadProps$f(__spreadValues$q({}, rest), {
5601
+ return __spreadProps$g(__spreadValues$r({}, rest), {
5772
5602
  target: {
5773
5603
  refId: "annotation_query",
5774
5604
  query
@@ -5936,25 +5766,25 @@ function shouldUseLegacyRunner(datasource) {
5936
5766
  return !datasource.annotations || legacyRunner.includes(type);
5937
5767
  }
5938
5768
 
5939
- var __defProp$p = Object.defineProperty;
5940
- var __defProps$e = Object.defineProperties;
5941
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
5942
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
5943
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
5944
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
5945
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5946
- var __spreadValues$p = (a, b) => {
5769
+ var __defProp$q = Object.defineProperty;
5770
+ var __defProps$f = Object.defineProperties;
5771
+ var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
5772
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
5773
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
5774
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
5775
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5776
+ var __spreadValues$q = (a, b) => {
5947
5777
  for (var prop in b || (b = {}))
5948
- if (__hasOwnProp$p.call(b, prop))
5949
- __defNormalProp$p(a, prop, b[prop]);
5950
- if (__getOwnPropSymbols$p)
5951
- for (var prop of __getOwnPropSymbols$p(b)) {
5952
- if (__propIsEnum$p.call(b, prop))
5953
- __defNormalProp$p(a, prop, b[prop]);
5778
+ if (__hasOwnProp$q.call(b, prop))
5779
+ __defNormalProp$q(a, prop, b[prop]);
5780
+ if (__getOwnPropSymbols$q)
5781
+ for (var prop of __getOwnPropSymbols$q(b)) {
5782
+ if (__propIsEnum$q.call(b, prop))
5783
+ __defNormalProp$q(a, prop, b[prop]);
5954
5784
  }
5955
5785
  return a;
5956
5786
  };
5957
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
5787
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
5958
5788
  let counter = 100;
5959
5789
  function getNextRequestId() {
5960
5790
  return "AQ" + counter++;
@@ -5977,8 +5807,8 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
5977
5807
  }))
5978
5808
  );
5979
5809
  }
5980
- const processor = __spreadValues$p(__spreadValues$p({}, standardAnnotationSupport), datasource.annotations);
5981
- const annotationWithDefaults = __spreadValues$p(__spreadValues$p({}, (_a = processor.getDefaultQuery) == null ? void 0 : _a.call(processor)), query);
5810
+ const processor = __spreadValues$q(__spreadValues$q({}, standardAnnotationSupport), datasource.annotations);
5811
+ const annotationWithDefaults = __spreadValues$q(__spreadValues$q({}, (_a = processor.getDefaultQuery) == null ? void 0 : _a.call(processor)), query);
5982
5812
  const annotation = processor.prepareAnnotation(annotationWithDefaults);
5983
5813
  if (!annotation) {
5984
5814
  return rxjs.of({
@@ -6001,7 +5831,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6001
5831
  __annotation: { text: annotation.name, value: annotation },
6002
5832
  __sceneObject: { text: "__sceneObject", value: layer }
6003
5833
  };
6004
- const queryRequest = __spreadValues$p(__spreadProps$e(__spreadValues$p({
5834
+ const queryRequest = __spreadValues$q(__spreadProps$f(__spreadValues$q({
6005
5835
  startTime: Date.now(),
6006
5836
  requestId: getNextRequestId(),
6007
5837
  range: timeRange.state.value,
@@ -6011,7 +5841,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6011
5841
  app: data.CoreApp.Dashboard,
6012
5842
  timezone: timeRange.getTimeZone(),
6013
5843
  targets: [
6014
- __spreadProps$e(__spreadValues$p({}, processedQuery), {
5844
+ __spreadProps$f(__spreadValues$q({}, processedQuery), {
6015
5845
  refId: "Anno"
6016
5846
  })
6017
5847
  ]
@@ -6029,7 +5859,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6029
5859
  data$1.forEach((frame) => {
6030
5860
  var _a2;
6031
5861
  if (!((_a2 = frame.meta) == null ? void 0 : _a2.dataTopic)) {
6032
- frame.meta = __spreadProps$e(__spreadValues$p({}, frame.meta || {}), { dataTopic: data.DataTopic.Annotations });
5862
+ frame.meta = __spreadProps$f(__spreadValues$q({}, frame.meta || {}), { dataTopic: data.DataTopic.Annotations });
6033
5863
  }
6034
5864
  });
6035
5865
  return processor.processEvents(annotation, data$1).pipe(
@@ -6044,19 +5874,19 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6044
5874
  );
6045
5875
  }
6046
5876
 
6047
- var __defProp$o = Object.defineProperty;
6048
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
6049
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
6050
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
6051
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6052
- var __spreadValues$o = (a, b) => {
5877
+ var __defProp$p = Object.defineProperty;
5878
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
5879
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
5880
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
5881
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5882
+ var __spreadValues$p = (a, b) => {
6053
5883
  for (var prop in b || (b = {}))
6054
- if (__hasOwnProp$o.call(b, prop))
6055
- __defNormalProp$o(a, prop, b[prop]);
6056
- if (__getOwnPropSymbols$o)
6057
- for (var prop of __getOwnPropSymbols$o(b)) {
6058
- if (__propIsEnum$o.call(b, prop))
6059
- __defNormalProp$o(a, prop, b[prop]);
5884
+ if (__hasOwnProp$p.call(b, prop))
5885
+ __defNormalProp$p(a, prop, b[prop]);
5886
+ if (__getOwnPropSymbols$p)
5887
+ for (var prop of __getOwnPropSymbols$p(b)) {
5888
+ if (__propIsEnum$p.call(b, prop))
5889
+ __defNormalProp$p(a, prop, b[prop]);
6060
5890
  }
6061
5891
  return a;
6062
5892
  };
@@ -6067,7 +5897,7 @@ function postProcessQueryResult(annotation, results) {
6067
5897
  }
6068
5898
  const processed = results.map((item) => {
6069
5899
  var _a;
6070
- const processedItem = __spreadValues$o({}, item);
5900
+ const processedItem = __spreadValues$p({}, item);
6071
5901
  processedItem.source = annotation;
6072
5902
  processedItem.color = runtime.config.theme2.visualization.getColorByName(annotation.iconColor);
6073
5903
  processedItem.type = annotation.name;
@@ -6116,29 +5946,29 @@ function isPanelAlert(event) {
6116
5946
  return event.eventType === "panel-alert";
6117
5947
  }
6118
5948
 
6119
- var __defProp$n = Object.defineProperty;
6120
- var __defProps$d = Object.defineProperties;
6121
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
6122
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
6123
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
6124
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
6125
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6126
- var __spreadValues$n = (a, b) => {
5949
+ var __defProp$o = Object.defineProperty;
5950
+ var __defProps$e = Object.defineProperties;
5951
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
5952
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
5953
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
5954
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
5955
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5956
+ var __spreadValues$o = (a, b) => {
6127
5957
  for (var prop in b || (b = {}))
6128
- if (__hasOwnProp$n.call(b, prop))
6129
- __defNormalProp$n(a, prop, b[prop]);
6130
- if (__getOwnPropSymbols$n)
6131
- for (var prop of __getOwnPropSymbols$n(b)) {
6132
- if (__propIsEnum$n.call(b, prop))
6133
- __defNormalProp$n(a, prop, b[prop]);
5958
+ if (__hasOwnProp$o.call(b, prop))
5959
+ __defNormalProp$o(a, prop, b[prop]);
5960
+ if (__getOwnPropSymbols$o)
5961
+ for (var prop of __getOwnPropSymbols$o(b)) {
5962
+ if (__propIsEnum$o.call(b, prop))
5963
+ __defNormalProp$o(a, prop, b[prop]);
6134
5964
  }
6135
5965
  return a;
6136
5966
  };
6137
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
5967
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
6138
5968
  class AnnotationsDataLayer extends SceneDataLayerBase {
6139
5969
  constructor(initialState) {
6140
5970
  super(
6141
- __spreadValues$n({
5971
+ __spreadValues$o({
6142
5972
  isEnabled: true
6143
5973
  }, initialState),
6144
5974
  ["query"]
@@ -6186,7 +6016,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
6186
6016
  this.publishResults(stateUpdate);
6187
6017
  });
6188
6018
  } catch (e) {
6189
- this.publishResults(__spreadProps$d(__spreadValues$n({}, emptyPanelData), {
6019
+ this.publishResults(__spreadProps$e(__spreadValues$o({}, emptyPanelData), {
6190
6020
  state: schema.LoadingState.Error,
6191
6021
  errors: [
6192
6022
  {
@@ -6203,9 +6033,9 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
6203
6033
  processEvents(query, events) {
6204
6034
  let processedEvents = postProcessQueryResult(query, events.events || []);
6205
6035
  processedEvents = dedupAnnotations(processedEvents);
6206
- const stateUpdate = __spreadProps$d(__spreadValues$n({}, emptyPanelData), { state: events.state });
6036
+ const stateUpdate = __spreadProps$e(__spreadValues$o({}, emptyPanelData), { state: events.state });
6207
6037
  const df = data.arrayToDataFrame(processedEvents);
6208
- df.meta = __spreadProps$d(__spreadValues$n({}, df.meta), {
6038
+ df.meta = __spreadProps$e(__spreadValues$o({}, df.meta), {
6209
6039
  dataTopic: data.DataTopic.Annotations
6210
6040
  });
6211
6041
  stateUpdate.series = [df];
@@ -6258,28 +6088,28 @@ class SceneTimeRangeTransformerBase extends SceneObjectBase {
6258
6088
  }
6259
6089
  }
6260
6090
 
6261
- var __defProp$m = Object.defineProperty;
6262
- var __defProps$c = Object.defineProperties;
6263
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
6264
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
6265
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
6266
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
6267
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6268
- var __spreadValues$m = (a, b) => {
6091
+ var __defProp$n = Object.defineProperty;
6092
+ var __defProps$d = Object.defineProperties;
6093
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
6094
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
6095
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
6096
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
6097
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6098
+ var __spreadValues$n = (a, b) => {
6269
6099
  for (var prop in b || (b = {}))
6270
- if (__hasOwnProp$m.call(b, prop))
6271
- __defNormalProp$m(a, prop, b[prop]);
6272
- if (__getOwnPropSymbols$m)
6273
- for (var prop of __getOwnPropSymbols$m(b)) {
6274
- if (__propIsEnum$m.call(b, prop))
6275
- __defNormalProp$m(a, prop, b[prop]);
6100
+ if (__hasOwnProp$n.call(b, prop))
6101
+ __defNormalProp$n(a, prop, b[prop]);
6102
+ if (__getOwnPropSymbols$n)
6103
+ for (var prop of __getOwnPropSymbols$n(b)) {
6104
+ if (__propIsEnum$n.call(b, prop))
6105
+ __defNormalProp$n(a, prop, b[prop]);
6276
6106
  }
6277
6107
  return a;
6278
6108
  };
6279
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
6109
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
6280
6110
  class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6281
6111
  constructor(state) {
6282
- super(__spreadProps$c(__spreadValues$m({}, state), {
6112
+ super(__spreadProps$d(__spreadValues$n({}, state), {
6283
6113
  timeZone: state.timeZone,
6284
6114
  from: "now-6h",
6285
6115
  to: "now",
@@ -6287,7 +6117,7 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6287
6117
  }));
6288
6118
  }
6289
6119
  ancestorTimeRangeChanged(timeRange) {
6290
- this.setState(__spreadProps$c(__spreadValues$m({}, timeRange), {
6120
+ this.setState(__spreadProps$d(__spreadValues$n({}, timeRange), {
6291
6121
  timeZone: this.state.timeZone,
6292
6122
  value: evaluateTimeRange(
6293
6123
  timeRange.from,
@@ -6315,25 +6145,25 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6315
6145
  }
6316
6146
  }
6317
6147
 
6318
- var __defProp$l = Object.defineProperty;
6319
- var __defProps$b = Object.defineProperties;
6320
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
6321
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
6322
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
6323
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
6324
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6325
- var __spreadValues$l = (a, b) => {
6148
+ var __defProp$m = Object.defineProperty;
6149
+ var __defProps$c = Object.defineProperties;
6150
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
6151
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
6152
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
6153
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
6154
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6155
+ var __spreadValues$m = (a, b) => {
6326
6156
  for (var prop in b || (b = {}))
6327
- if (__hasOwnProp$l.call(b, prop))
6328
- __defNormalProp$l(a, prop, b[prop]);
6329
- if (__getOwnPropSymbols$l)
6330
- for (var prop of __getOwnPropSymbols$l(b)) {
6331
- if (__propIsEnum$l.call(b, prop))
6332
- __defNormalProp$l(a, prop, b[prop]);
6157
+ if (__hasOwnProp$m.call(b, prop))
6158
+ __defNormalProp$m(a, prop, b[prop]);
6159
+ if (__getOwnPropSymbols$m)
6160
+ for (var prop of __getOwnPropSymbols$m(b)) {
6161
+ if (__propIsEnum$m.call(b, prop))
6162
+ __defNormalProp$m(a, prop, b[prop]);
6333
6163
  }
6334
6164
  return a;
6335
6165
  };
6336
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
6166
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
6337
6167
  class SceneDataLayerSetBase extends SceneObjectBase {
6338
6168
  constructor() {
6339
6169
  super(...arguments);
@@ -6357,7 +6187,7 @@ class SceneDataLayerSetBase extends SceneObjectBase {
6357
6187
  series = series.concat(result.data.series);
6358
6188
  }
6359
6189
  }
6360
- const combinedData = __spreadProps$b(__spreadValues$l({}, emptyPanelData), { series });
6190
+ const combinedData = __spreadProps$c(__spreadValues$m({}, emptyPanelData), { series });
6361
6191
  this._results.next({ origin: this, data: combinedData });
6362
6192
  this.setStateHelper({ data: combinedData });
6363
6193
  }
@@ -6406,25 +6236,25 @@ SceneDataLayerSet.Component = ({ model }) => {
6406
6236
  })));
6407
6237
  };
6408
6238
 
6409
- var __defProp$k = Object.defineProperty;
6410
- var __defProps$a = Object.defineProperties;
6411
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
6412
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
6413
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
6414
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
6415
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6416
- var __spreadValues$k = (a, b) => {
6239
+ var __defProp$l = Object.defineProperty;
6240
+ var __defProps$b = Object.defineProperties;
6241
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
6242
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
6243
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
6244
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
6245
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6246
+ var __spreadValues$l = (a, b) => {
6417
6247
  for (var prop in b || (b = {}))
6418
- if (__hasOwnProp$k.call(b, prop))
6419
- __defNormalProp$k(a, prop, b[prop]);
6420
- if (__getOwnPropSymbols$k)
6421
- for (var prop of __getOwnPropSymbols$k(b)) {
6422
- if (__propIsEnum$k.call(b, prop))
6423
- __defNormalProp$k(a, prop, b[prop]);
6248
+ if (__hasOwnProp$l.call(b, prop))
6249
+ __defNormalProp$l(a, prop, b[prop]);
6250
+ if (__getOwnPropSymbols$l)
6251
+ for (var prop of __getOwnPropSymbols$l(b)) {
6252
+ if (__propIsEnum$l.call(b, prop))
6253
+ __defNormalProp$l(a, prop, b[prop]);
6424
6254
  }
6425
6255
  return a;
6426
6256
  };
6427
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
6257
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
6428
6258
  class SceneDataTransformer extends SceneObjectBase {
6429
6259
  constructor(state) {
6430
6260
  super(state);
@@ -6501,7 +6331,7 @@ class SceneDataTransformer extends SceneObjectBase {
6501
6331
  const { series, annotations } = this._prevDataFromSource;
6502
6332
  if (data.series === series && data.annotations === annotations) {
6503
6333
  if (this.state.data && data.state !== this.state.data.state) {
6504
- this.setState({ data: __spreadProps$a(__spreadValues$k({}, this.state.data), { state: data.state }) });
6334
+ this.setState({ data: __spreadProps$b(__spreadValues$l({}, this.state.data), { state: data.state }) });
6505
6335
  }
6506
6336
  return true;
6507
6337
  }
@@ -6549,7 +6379,7 @@ class SceneDataTransformer extends SceneObjectBase {
6549
6379
  rxjs.map((values) => {
6550
6380
  const transformedSeries = values[0];
6551
6381
  const transformedAnnotations = values[1];
6552
- return __spreadProps$a(__spreadValues$k({}, data$1), {
6382
+ return __spreadProps$b(__spreadValues$l({}, data$1), {
6553
6383
  series: transformedSeries,
6554
6384
  annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
6555
6385
  });
@@ -6560,7 +6390,7 @@ class SceneDataTransformer extends SceneObjectBase {
6560
6390
  const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
6561
6391
  const transformationError = runtime.toDataQueryError(err);
6562
6392
  transformationError.message = `Error transforming data: ${transformationError.message}`;
6563
- const result = __spreadProps$a(__spreadValues$k({}, data$1), {
6393
+ const result = __spreadProps$b(__spreadValues$l({}, data$1), {
6564
6394
  state: data.LoadingState.Error,
6565
6395
  errors: [...sourceErr, transformationError]
6566
6396
  });
@@ -6893,28 +6723,28 @@ class SceneVariableSetVariableDependencyHandler {
6893
6723
  }
6894
6724
  }
6895
6725
 
6896
- var __defProp$j = Object.defineProperty;
6897
- var __defProps$9 = Object.defineProperties;
6898
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
6899
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
6900
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
6901
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
6902
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6903
- var __spreadValues$j = (a, b) => {
6904
- for (var prop in b || (b = {}))
6905
- if (__hasOwnProp$j.call(b, prop))
6906
- __defNormalProp$j(a, prop, b[prop]);
6907
- if (__getOwnPropSymbols$j)
6908
- for (var prop of __getOwnPropSymbols$j(b)) {
6909
- if (__propIsEnum$j.call(b, prop))
6910
- __defNormalProp$j(a, prop, b[prop]);
6726
+ var __defProp$k = Object.defineProperty;
6727
+ var __defProps$a = Object.defineProperties;
6728
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
6729
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
6730
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
6731
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
6732
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6733
+ var __spreadValues$k = (a, b) => {
6734
+ for (var prop in b || (b = {}))
6735
+ if (__hasOwnProp$k.call(b, prop))
6736
+ __defNormalProp$k(a, prop, b[prop]);
6737
+ if (__getOwnPropSymbols$k)
6738
+ for (var prop of __getOwnPropSymbols$k(b)) {
6739
+ if (__propIsEnum$k.call(b, prop))
6740
+ __defNormalProp$k(a, prop, b[prop]);
6911
6741
  }
6912
6742
  return a;
6913
6743
  };
6914
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
6744
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
6915
6745
  class ConstantVariable extends SceneObjectBase {
6916
6746
  constructor(initialState) {
6917
- super(__spreadProps$9(__spreadValues$j({
6747
+ super(__spreadProps$a(__spreadValues$k({
6918
6748
  type: "constant",
6919
6749
  value: "",
6920
6750
  name: ""
@@ -6927,25 +6757,25 @@ class ConstantVariable extends SceneObjectBase {
6927
6757
  }
6928
6758
  }
6929
6759
 
6930
- var __defProp$i = Object.defineProperty;
6931
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6932
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6933
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6934
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6935
- var __spreadValues$i = (a, b) => {
6760
+ var __defProp$j = Object.defineProperty;
6761
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
6762
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
6763
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
6764
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6765
+ var __spreadValues$j = (a, b) => {
6936
6766
  for (var prop in b || (b = {}))
6937
- if (__hasOwnProp$i.call(b, prop))
6938
- __defNormalProp$i(a, prop, b[prop]);
6939
- if (__getOwnPropSymbols$i)
6940
- for (var prop of __getOwnPropSymbols$i(b)) {
6941
- if (__propIsEnum$i.call(b, prop))
6942
- __defNormalProp$i(a, prop, b[prop]);
6767
+ if (__hasOwnProp$j.call(b, prop))
6768
+ __defNormalProp$j(a, prop, b[prop]);
6769
+ if (__getOwnPropSymbols$j)
6770
+ for (var prop of __getOwnPropSymbols$j(b)) {
6771
+ if (__propIsEnum$j.call(b, prop))
6772
+ __defNormalProp$j(a, prop, b[prop]);
6943
6773
  }
6944
6774
  return a;
6945
6775
  };
6946
6776
  class CustomVariable extends MultiValueVariable {
6947
6777
  constructor(initialState) {
6948
- super(__spreadValues$i({
6778
+ super(__spreadValues$j({
6949
6779
  type: "custom",
6950
6780
  query: "",
6951
6781
  value: "",
@@ -6979,25 +6809,25 @@ CustomVariable.Component = ({ model }) => {
6979
6809
  return renderSelectForVariable(model);
6980
6810
  };
6981
6811
 
6982
- var __defProp$h = Object.defineProperty;
6983
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
6984
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
6985
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
6986
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6987
- var __spreadValues$h = (a, b) => {
6812
+ var __defProp$i = Object.defineProperty;
6813
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6814
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6815
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6816
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6817
+ var __spreadValues$i = (a, b) => {
6988
6818
  for (var prop in b || (b = {}))
6989
- if (__hasOwnProp$h.call(b, prop))
6990
- __defNormalProp$h(a, prop, b[prop]);
6991
- if (__getOwnPropSymbols$h)
6992
- for (var prop of __getOwnPropSymbols$h(b)) {
6993
- if (__propIsEnum$h.call(b, prop))
6994
- __defNormalProp$h(a, prop, b[prop]);
6819
+ if (__hasOwnProp$i.call(b, prop))
6820
+ __defNormalProp$i(a, prop, b[prop]);
6821
+ if (__getOwnPropSymbols$i)
6822
+ for (var prop of __getOwnPropSymbols$i(b)) {
6823
+ if (__propIsEnum$i.call(b, prop))
6824
+ __defNormalProp$i(a, prop, b[prop]);
6995
6825
  }
6996
6826
  return a;
6997
6827
  };
6998
6828
  class DataSourceVariable extends MultiValueVariable {
6999
6829
  constructor(initialState) {
7000
- super(__spreadValues$h({
6830
+ super(__spreadValues$i({
7001
6831
  type: "datasource",
7002
6832
  value: "",
7003
6833
  text: "",
@@ -7081,25 +6911,25 @@ const hasCustomVariableSupport = (datasource) => {
7081
6911
  return "query" in variableSupport && "editor" in variableSupport && Boolean(variableSupport.query) && Boolean(variableSupport.editor);
7082
6912
  };
7083
6913
 
7084
- var __defProp$g = Object.defineProperty;
7085
- var __defProps$8 = Object.defineProperties;
7086
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
7087
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
7088
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
7089
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
7090
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7091
- var __spreadValues$g = (a, b) => {
6914
+ var __defProp$h = Object.defineProperty;
6915
+ var __defProps$9 = Object.defineProperties;
6916
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
6917
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
6918
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
6919
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
6920
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6921
+ var __spreadValues$h = (a, b) => {
7092
6922
  for (var prop in b || (b = {}))
7093
- if (__hasOwnProp$g.call(b, prop))
7094
- __defNormalProp$g(a, prop, b[prop]);
7095
- if (__getOwnPropSymbols$g)
7096
- for (var prop of __getOwnPropSymbols$g(b)) {
7097
- if (__propIsEnum$g.call(b, prop))
7098
- __defNormalProp$g(a, prop, b[prop]);
6923
+ if (__hasOwnProp$h.call(b, prop))
6924
+ __defNormalProp$h(a, prop, b[prop]);
6925
+ if (__getOwnPropSymbols$h)
6926
+ for (var prop of __getOwnPropSymbols$h(b)) {
6927
+ if (__propIsEnum$h.call(b, prop))
6928
+ __defNormalProp$h(a, prop, b[prop]);
7099
6929
  }
7100
6930
  return a;
7101
6931
  };
7102
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
6932
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
7103
6933
  class StandardQueryRunner {
7104
6934
  constructor(datasource, _runRequest = runtime.getRunRequest()) {
7105
6935
  this.datasource = datasource;
@@ -7136,7 +6966,7 @@ class LegacyQueryRunner {
7136
6966
  return getEmptyMetricFindValueObservable();
7137
6967
  }
7138
6968
  return rxjs.from(
7139
- this.datasource.metricFindQuery(variable.state.query, __spreadProps$8(__spreadValues$g({}, request), {
6969
+ this.datasource.metricFindQuery(variable.state.query, __spreadProps$9(__spreadValues$h({}, request), {
7140
6970
  variable: {
7141
6971
  name: variable.state.name,
7142
6972
  type: variable.state.type
@@ -7198,7 +7028,7 @@ function ensureVariableQueryModelIsADataQuery(variable) {
7198
7028
  return { query, refId: `variable-${variable.state.name}` };
7199
7029
  }
7200
7030
  if (query.refId == null) {
7201
- return __spreadProps$8(__spreadValues$g({}, query), { refId: `variable-${variable.state.name}` });
7031
+ return __spreadProps$9(__spreadValues$h({}, query), { refId: `variable-${variable.state.name}` });
7202
7032
  }
7203
7033
  return variable.state.query;
7204
7034
  }
@@ -7413,25 +7243,25 @@ function areMetricFindValues(data$1) {
7413
7243
  return false;
7414
7244
  }
7415
7245
 
7416
- var __defProp$f = Object.defineProperty;
7417
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
7418
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
7419
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
7420
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7421
- var __spreadValues$f = (a, b) => {
7246
+ var __defProp$g = Object.defineProperty;
7247
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
7248
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
7249
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
7250
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7251
+ var __spreadValues$g = (a, b) => {
7422
7252
  for (var prop in b || (b = {}))
7423
- if (__hasOwnProp$f.call(b, prop))
7424
- __defNormalProp$f(a, prop, b[prop]);
7425
- if (__getOwnPropSymbols$f)
7426
- for (var prop of __getOwnPropSymbols$f(b)) {
7427
- if (__propIsEnum$f.call(b, prop))
7428
- __defNormalProp$f(a, prop, b[prop]);
7253
+ if (__hasOwnProp$g.call(b, prop))
7254
+ __defNormalProp$g(a, prop, b[prop]);
7255
+ if (__getOwnPropSymbols$g)
7256
+ for (var prop of __getOwnPropSymbols$g(b)) {
7257
+ if (__propIsEnum$g.call(b, prop))
7258
+ __defNormalProp$g(a, prop, b[prop]);
7429
7259
  }
7430
7260
  return a;
7431
7261
  };
7432
7262
  class QueryVariable extends MultiValueVariable {
7433
7263
  constructor(initialState) {
7434
- super(__spreadValues$f({
7264
+ super(__spreadValues$g({
7435
7265
  type: "query",
7436
7266
  name: "",
7437
7267
  value: "",
@@ -7584,25 +7414,25 @@ function queryMetricTree(query) {
7584
7414
  return queryTree(children, query.split("."), 0);
7585
7415
  }
7586
7416
 
7587
- var __defProp$e = Object.defineProperty;
7588
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
7589
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
7590
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
7591
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7592
- var __spreadValues$e = (a, b) => {
7417
+ var __defProp$f = Object.defineProperty;
7418
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
7419
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
7420
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
7421
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7422
+ var __spreadValues$f = (a, b) => {
7593
7423
  for (var prop in b || (b = {}))
7594
- if (__hasOwnProp$e.call(b, prop))
7595
- __defNormalProp$e(a, prop, b[prop]);
7596
- if (__getOwnPropSymbols$e)
7597
- for (var prop of __getOwnPropSymbols$e(b)) {
7598
- if (__propIsEnum$e.call(b, prop))
7599
- __defNormalProp$e(a, prop, b[prop]);
7424
+ if (__hasOwnProp$f.call(b, prop))
7425
+ __defNormalProp$f(a, prop, b[prop]);
7426
+ if (__getOwnPropSymbols$f)
7427
+ for (var prop of __getOwnPropSymbols$f(b)) {
7428
+ if (__propIsEnum$f.call(b, prop))
7429
+ __defNormalProp$f(a, prop, b[prop]);
7600
7430
  }
7601
7431
  return a;
7602
7432
  };
7603
7433
  class TestVariable extends MultiValueVariable {
7604
7434
  constructor(initialState, isLazy = false) {
7605
- super(__spreadValues$e({
7435
+ super(__spreadValues$f({
7606
7436
  type: "custom",
7607
7437
  name: "Test",
7608
7438
  value: "Value",
@@ -7711,25 +7541,25 @@ function VariableValueInput({ model }) {
7711
7541
  });
7712
7542
  }
7713
7543
 
7714
- var __defProp$d = Object.defineProperty;
7715
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7716
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7717
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7718
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7719
- var __spreadValues$d = (a, b) => {
7544
+ var __defProp$e = Object.defineProperty;
7545
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
7546
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
7547
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
7548
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7549
+ var __spreadValues$e = (a, b) => {
7720
7550
  for (var prop in b || (b = {}))
7721
- if (__hasOwnProp$d.call(b, prop))
7722
- __defNormalProp$d(a, prop, b[prop]);
7723
- if (__getOwnPropSymbols$d)
7724
- for (var prop of __getOwnPropSymbols$d(b)) {
7725
- if (__propIsEnum$d.call(b, prop))
7726
- __defNormalProp$d(a, prop, b[prop]);
7551
+ if (__hasOwnProp$e.call(b, prop))
7552
+ __defNormalProp$e(a, prop, b[prop]);
7553
+ if (__getOwnPropSymbols$e)
7554
+ for (var prop of __getOwnPropSymbols$e(b)) {
7555
+ if (__propIsEnum$e.call(b, prop))
7556
+ __defNormalProp$e(a, prop, b[prop]);
7727
7557
  }
7728
7558
  return a;
7729
7559
  };
7730
7560
  class TextBoxVariable extends SceneObjectBase {
7731
7561
  constructor(initialState) {
7732
- super(__spreadValues$d({
7562
+ super(__spreadValues$e({
7733
7563
  type: "textbox",
7734
7564
  value: "",
7735
7565
  name: ""
@@ -7766,28 +7596,28 @@ TextBoxVariable.Component = ({ model }) => {
7766
7596
  });
7767
7597
  };
7768
7598
 
7769
- var __defProp$c = Object.defineProperty;
7770
- var __defProps$7 = Object.defineProperties;
7771
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
7772
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7773
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7774
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7775
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7776
- var __spreadValues$c = (a, b) => {
7599
+ var __defProp$d = Object.defineProperty;
7600
+ var __defProps$8 = Object.defineProperties;
7601
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
7602
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7603
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7604
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7605
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7606
+ var __spreadValues$d = (a, b) => {
7777
7607
  for (var prop in b || (b = {}))
7778
- if (__hasOwnProp$c.call(b, prop))
7779
- __defNormalProp$c(a, prop, b[prop]);
7780
- if (__getOwnPropSymbols$c)
7781
- for (var prop of __getOwnPropSymbols$c(b)) {
7782
- if (__propIsEnum$c.call(b, prop))
7783
- __defNormalProp$c(a, prop, b[prop]);
7608
+ if (__hasOwnProp$d.call(b, prop))
7609
+ __defNormalProp$d(a, prop, b[prop]);
7610
+ if (__getOwnPropSymbols$d)
7611
+ for (var prop of __getOwnPropSymbols$d(b)) {
7612
+ if (__propIsEnum$d.call(b, prop))
7613
+ __defNormalProp$d(a, prop, b[prop]);
7784
7614
  }
7785
7615
  return a;
7786
7616
  };
7787
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
7617
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
7788
7618
  class LocalValueVariable extends SceneObjectBase {
7789
7619
  constructor(initialState) {
7790
- super(__spreadProps$7(__spreadValues$c({
7620
+ super(__spreadProps$8(__spreadValues$d({
7791
7621
  type: "system",
7792
7622
  value: "",
7793
7623
  text: "",
@@ -7819,25 +7649,25 @@ class LocalValueVariable extends SceneObjectBase {
7819
7649
  }
7820
7650
  }
7821
7651
 
7822
- var __defProp$b = Object.defineProperty;
7823
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7824
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7825
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7826
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7827
- var __spreadValues$b = (a, b) => {
7652
+ var __defProp$c = Object.defineProperty;
7653
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7654
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7655
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7656
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7657
+ var __spreadValues$c = (a, b) => {
7828
7658
  for (var prop in b || (b = {}))
7829
- if (__hasOwnProp$b.call(b, prop))
7830
- __defNormalProp$b(a, prop, b[prop]);
7831
- if (__getOwnPropSymbols$b)
7832
- for (var prop of __getOwnPropSymbols$b(b)) {
7833
- if (__propIsEnum$b.call(b, prop))
7834
- __defNormalProp$b(a, prop, b[prop]);
7659
+ if (__hasOwnProp$c.call(b, prop))
7660
+ __defNormalProp$c(a, prop, b[prop]);
7661
+ if (__getOwnPropSymbols$c)
7662
+ for (var prop of __getOwnPropSymbols$c(b)) {
7663
+ if (__propIsEnum$c.call(b, prop))
7664
+ __defNormalProp$c(a, prop, b[prop]);
7835
7665
  }
7836
7666
  return a;
7837
7667
  };
7838
7668
  class IntervalVariable extends SceneObjectBase {
7839
7669
  constructor(initialState) {
7840
- super(__spreadValues$b({
7670
+ super(__spreadValues$c({
7841
7671
  type: "interval",
7842
7672
  value: "",
7843
7673
  intervals: ["1m", "10m", "30m", "1h", "6h", "12h", "1d", "7d", "14d", "30d"],
@@ -8045,7 +7875,7 @@ class EmbeddedScene extends SceneObjectBase {
8045
7875
  EmbeddedScene.Component = EmbeddedSceneRenderer;
8046
7876
  function EmbeddedSceneRenderer({ model }) {
8047
7877
  const { body, controls } = model.useState();
8048
- const styles = ui.useStyles2(getStyles$5);
7878
+ const styles = ui.useStyles2(getStyles$6);
8049
7879
  return /* @__PURE__ */ React__default["default"].createElement("div", {
8050
7880
  className: styles.container
8051
7881
  }, controls && /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -8059,7 +7889,7 @@ function EmbeddedSceneRenderer({ model }) {
8059
7889
  model: body
8060
7890
  })));
8061
7891
  }
8062
- const getStyles$5 = (theme) => {
7892
+ const getStyles$6 = (theme) => {
8063
7893
  return {
8064
7894
  container: css.css({
8065
7895
  flexGrow: 1,
@@ -8162,30 +7992,30 @@ function isSceneGridLayout(child) {
8162
7992
  return child instanceof SceneGridLayout;
8163
7993
  }
8164
7994
 
8165
- var __defProp$a = Object.defineProperty;
8166
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8167
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8168
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8169
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8170
- var __spreadValues$a = (a, b) => {
7995
+ var __defProp$b = Object.defineProperty;
7996
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7997
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7998
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7999
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8000
+ var __spreadValues$b = (a, b) => {
8171
8001
  for (var prop in b || (b = {}))
8172
- if (__hasOwnProp$a.call(b, prop))
8173
- __defNormalProp$a(a, prop, b[prop]);
8174
- if (__getOwnPropSymbols$a)
8175
- for (var prop of __getOwnPropSymbols$a(b)) {
8176
- if (__propIsEnum$a.call(b, prop))
8177
- __defNormalProp$a(a, prop, b[prop]);
8002
+ if (__hasOwnProp$b.call(b, prop))
8003
+ __defNormalProp$b(a, prop, b[prop]);
8004
+ if (__getOwnPropSymbols$b)
8005
+ for (var prop of __getOwnPropSymbols$b(b)) {
8006
+ if (__propIsEnum$b.call(b, prop))
8007
+ __defNormalProp$b(a, prop, b[prop]);
8178
8008
  }
8179
8009
  return a;
8180
8010
  };
8181
8011
  var __objRest$1 = (source, exclude) => {
8182
8012
  var target = {};
8183
8013
  for (var prop in source)
8184
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
8014
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
8185
8015
  target[prop] = source[prop];
8186
- if (source != null && __getOwnPropSymbols$a)
8187
- for (var prop of __getOwnPropSymbols$a(source)) {
8188
- if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
8016
+ if (source != null && __getOwnPropSymbols$b)
8017
+ for (var prop of __getOwnPropSymbols$b(source)) {
8018
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
8189
8019
  target[prop] = source[prop];
8190
8020
  }
8191
8021
  return target;
@@ -8225,7 +8055,7 @@ const LazyLoader = React__default["default"].forwardRef(
8225
8055
  }
8226
8056
  };
8227
8057
  });
8228
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$a({
8058
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$b({
8229
8059
  id,
8230
8060
  ref: innerRef
8231
8061
  }, rest), loaded && (typeof children === "function" ? children({ isInView }) : children));
@@ -8243,33 +8073,33 @@ LazyLoader.observer = new IntersectionObserver(
8243
8073
  { rootMargin: "100px" }
8244
8074
  );
8245
8075
 
8246
- var __defProp$9 = Object.defineProperty;
8247
- var __defProps$6 = Object.defineProperties;
8248
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
8249
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8250
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8251
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8252
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8253
- var __spreadValues$9 = (a, b) => {
8076
+ var __defProp$a = Object.defineProperty;
8077
+ var __defProps$7 = Object.defineProperties;
8078
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
8079
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8080
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8081
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8082
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8083
+ var __spreadValues$a = (a, b) => {
8254
8084
  for (var prop in b || (b = {}))
8255
- if (__hasOwnProp$9.call(b, prop))
8256
- __defNormalProp$9(a, prop, b[prop]);
8257
- if (__getOwnPropSymbols$9)
8258
- for (var prop of __getOwnPropSymbols$9(b)) {
8259
- if (__propIsEnum$9.call(b, prop))
8260
- __defNormalProp$9(a, prop, b[prop]);
8085
+ if (__hasOwnProp$a.call(b, prop))
8086
+ __defNormalProp$a(a, prop, b[prop]);
8087
+ if (__getOwnPropSymbols$a)
8088
+ for (var prop of __getOwnPropSymbols$a(b)) {
8089
+ if (__propIsEnum$a.call(b, prop))
8090
+ __defNormalProp$a(a, prop, b[prop]);
8261
8091
  }
8262
8092
  return a;
8263
8093
  };
8264
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
8094
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
8265
8095
  var __objRest = (source, exclude) => {
8266
8096
  var target = {};
8267
8097
  for (var prop in source)
8268
- if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8098
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
8269
8099
  target[prop] = source[prop];
8270
- if (source != null && __getOwnPropSymbols$9)
8271
- for (var prop of __getOwnPropSymbols$9(source)) {
8272
- if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8100
+ if (source != null && __getOwnPropSymbols$a)
8101
+ for (var prop of __getOwnPropSymbols$a(source)) {
8102
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
8273
8103
  target[prop] = source[prop];
8274
8104
  }
8275
8105
  return target;
@@ -8328,7 +8158,7 @@ const GridItemWrapper = React__default["default"].forwardRef((props, ref) => {
8328
8158
  key: sceneChild.state.key
8329
8159
  });
8330
8160
  if (isLazy) {
8331
- return /* @__PURE__ */ React__default["default"].createElement(LazyLoader, __spreadProps$6(__spreadValues$9({}, divProps), {
8161
+ return /* @__PURE__ */ React__default["default"].createElement(LazyLoader, __spreadProps$7(__spreadValues$a({}, divProps), {
8332
8162
  key: sceneChild.state.key,
8333
8163
  "data-griditem-key": sceneChild.state.key,
8334
8164
  className: css.cx(className, props.className),
@@ -8336,7 +8166,7 @@ const GridItemWrapper = React__default["default"].forwardRef((props, ref) => {
8336
8166
  ref
8337
8167
  }), innerContent, children);
8338
8168
  }
8339
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$6(__spreadValues$9({}, divProps), {
8169
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$7(__spreadValues$a({}, divProps), {
8340
8170
  ref,
8341
8171
  key: sceneChild.state.key,
8342
8172
  "data-griditem-key": sceneChild.state.key,
@@ -8366,7 +8196,7 @@ function updateAnimationClass(ref, isDraggable, retry) {
8366
8196
  const ResizeHandle = React__default["default"].forwardRef((_a, ref) => {
8367
8197
  var _b = _a, divProps = __objRest(_b, ["handleAxis"]);
8368
8198
  const customCssClass = ui.useStyles2(getResizeHandleStyles);
8369
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$6(__spreadValues$9({
8199
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$7(__spreadValues$a({
8370
8200
  ref
8371
8201
  }, divProps), {
8372
8202
  className: `${customCssClass} scene-resize-handle`
@@ -8406,60 +8236,60 @@ function getResizeHandleStyles(theme) {
8406
8236
  });
8407
8237
  }
8408
8238
 
8409
- var __defProp$8 = Object.defineProperty;
8410
- var __defProps$5 = Object.defineProperties;
8411
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
8412
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8413
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8414
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8415
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8416
- var __spreadValues$8 = (a, b) => {
8239
+ var __defProp$9 = Object.defineProperty;
8240
+ var __defProps$6 = Object.defineProperties;
8241
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
8242
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8243
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8244
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8245
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8246
+ var __spreadValues$9 = (a, b) => {
8417
8247
  for (var prop in b || (b = {}))
8418
- if (__hasOwnProp$8.call(b, prop))
8419
- __defNormalProp$8(a, prop, b[prop]);
8420
- if (__getOwnPropSymbols$8)
8421
- for (var prop of __getOwnPropSymbols$8(b)) {
8422
- if (__propIsEnum$8.call(b, prop))
8423
- __defNormalProp$8(a, prop, b[prop]);
8248
+ if (__hasOwnProp$9.call(b, prop))
8249
+ __defNormalProp$9(a, prop, b[prop]);
8250
+ if (__getOwnPropSymbols$9)
8251
+ for (var prop of __getOwnPropSymbols$9(b)) {
8252
+ if (__propIsEnum$9.call(b, prop))
8253
+ __defNormalProp$9(a, prop, b[prop]);
8424
8254
  }
8425
8255
  return a;
8426
8256
  };
8427
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8257
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
8428
8258
  function fitPanelsInHeight(cells, height) {
8429
8259
  const visibleHeight = height - GRID_CELL_VMARGIN * 4;
8430
8260
  const currentGridHeight = Math.max(...cells.map((cell) => cell.h + cell.y));
8431
8261
  const visibleGridHeight = Math.floor(visibleHeight / (GRID_CELL_HEIGHT + GRID_CELL_VMARGIN));
8432
8262
  const scaleFactor = currentGridHeight / visibleGridHeight;
8433
8263
  return cells.map((cell) => {
8434
- return __spreadProps$5(__spreadValues$8({}, cell), {
8264
+ return __spreadProps$6(__spreadValues$9({}, cell), {
8435
8265
  y: Math.round(cell.y / scaleFactor) || 0,
8436
8266
  h: Math.round(cell.h / scaleFactor) || 1
8437
8267
  });
8438
8268
  });
8439
8269
  }
8440
8270
 
8441
- var __defProp$7 = Object.defineProperty;
8442
- var __defProps$4 = Object.defineProperties;
8443
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8444
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8445
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8446
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8447
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8448
- var __spreadValues$7 = (a, b) => {
8271
+ var __defProp$8 = Object.defineProperty;
8272
+ var __defProps$5 = Object.defineProperties;
8273
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
8274
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8275
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8276
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8277
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8278
+ var __spreadValues$8 = (a, b) => {
8449
8279
  for (var prop in b || (b = {}))
8450
- if (__hasOwnProp$7.call(b, prop))
8451
- __defNormalProp$7(a, prop, b[prop]);
8452
- if (__getOwnPropSymbols$7)
8453
- for (var prop of __getOwnPropSymbols$7(b)) {
8454
- if (__propIsEnum$7.call(b, prop))
8455
- __defNormalProp$7(a, prop, b[prop]);
8280
+ if (__hasOwnProp$8.call(b, prop))
8281
+ __defNormalProp$8(a, prop, b[prop]);
8282
+ if (__getOwnPropSymbols$8)
8283
+ for (var prop of __getOwnPropSymbols$8(b)) {
8284
+ if (__propIsEnum$8.call(b, prop))
8285
+ __defNormalProp$8(a, prop, b[prop]);
8456
8286
  }
8457
8287
  return a;
8458
8288
  };
8459
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8289
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8460
8290
  const _SceneGridLayout = class extends SceneObjectBase {
8461
8291
  constructor(state) {
8462
- super(__spreadProps$4(__spreadValues$7({}, state), {
8292
+ super(__spreadProps$5(__spreadValues$8({}, state), {
8463
8293
  children: sortChildrenByPosition(state.children)
8464
8294
  }));
8465
8295
  this._skipOnLayoutChange = false;
@@ -8483,7 +8313,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8483
8313
  height: item.h
8484
8314
  };
8485
8315
  if (!isItemSizeEqual(child.state, nextSize)) {
8486
- child.setState(__spreadValues$7({}, nextSize));
8316
+ child.setState(__spreadValues$8({}, nextSize));
8487
8317
  }
8488
8318
  }
8489
8319
  this.setState({ children: sortChildrenByPosition(this.state.children) });
@@ -8557,7 +8387,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8557
8387
  const yDiff = firstPanelYPos - (rowY + 1);
8558
8388
  let yMax = rowY;
8559
8389
  for (const panel of rowChildren) {
8560
- const newSize = __spreadValues$7({}, panel.state);
8390
+ const newSize = __spreadValues$8({}, panel.state);
8561
8391
  newSize.y = (_b = newSize.y) != null ? _b : rowY;
8562
8392
  newSize.y -= yDiff;
8563
8393
  if (newSize.y !== panel.state.y) {
@@ -8684,7 +8514,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8684
8514
  }
8685
8515
  if (width < 768) {
8686
8516
  this._skipOnLayoutChange = true;
8687
- return cells.map((cell) => __spreadProps$4(__spreadValues$7({}, cell), { w: 24 }));
8517
+ return cells.map((cell) => __spreadProps$5(__spreadValues$8({}, cell), { w: 24 }));
8688
8518
  }
8689
8519
  this._skipOnLayoutChange = false;
8690
8520
  return cells;
@@ -8709,28 +8539,28 @@ function sortGridLayout(layout) {
8709
8539
  return [...layout].sort((a, b) => a.y - b.y || a.x - b.x);
8710
8540
  }
8711
8541
 
8712
- var __defProp$6 = Object.defineProperty;
8713
- var __defProps$3 = Object.defineProperties;
8714
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8715
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8716
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8717
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8718
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8719
- var __spreadValues$6 = (a, b) => {
8542
+ var __defProp$7 = Object.defineProperty;
8543
+ var __defProps$4 = Object.defineProperties;
8544
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8545
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8546
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8547
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8548
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8549
+ var __spreadValues$7 = (a, b) => {
8720
8550
  for (var prop in b || (b = {}))
8721
- if (__hasOwnProp$6.call(b, prop))
8722
- __defNormalProp$6(a, prop, b[prop]);
8723
- if (__getOwnPropSymbols$6)
8724
- for (var prop of __getOwnPropSymbols$6(b)) {
8725
- if (__propIsEnum$6.call(b, prop))
8726
- __defNormalProp$6(a, prop, b[prop]);
8551
+ if (__hasOwnProp$7.call(b, prop))
8552
+ __defNormalProp$7(a, prop, b[prop]);
8553
+ if (__getOwnPropSymbols$7)
8554
+ for (var prop of __getOwnPropSymbols$7(b)) {
8555
+ if (__propIsEnum$7.call(b, prop))
8556
+ __defNormalProp$7(a, prop, b[prop]);
8727
8557
  }
8728
8558
  return a;
8729
8559
  };
8730
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
8560
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8731
8561
  class SceneGridRow extends SceneObjectBase {
8732
8562
  constructor(state) {
8733
- super(__spreadProps$3(__spreadValues$6({
8563
+ super(__spreadProps$4(__spreadValues$7({
8734
8564
  children: state.children || [],
8735
8565
  isCollapsible: state.isCollapsible || true,
8736
8566
  title: state.title || ""
@@ -8895,7 +8725,7 @@ NestedScene.Component = NestedSceneRenderer;
8895
8725
  function NestedSceneRenderer({ model }) {
8896
8726
  const { title, isCollapsed, canCollapse, canRemove, body, controls } = model.useState();
8897
8727
  const gridRow = ui.useStyles2(getSceneGridRowStyles);
8898
- const styles = ui.useStyles2(getStyles$4);
8728
+ const styles = ui.useStyles2(getStyles$5);
8899
8729
  const toolbarControls = (controls != null ? controls : []).map((action) => /* @__PURE__ */ React__default["default"].createElement(action.Component, {
8900
8730
  key: action.state.key,
8901
8731
  model: action
@@ -8930,7 +8760,7 @@ function NestedSceneRenderer({ model }) {
8930
8760
  model: body
8931
8761
  }));
8932
8762
  }
8933
- const getStyles$4 = (theme) => ({
8763
+ const getStyles$5 = (theme) => ({
8934
8764
  wrapper: css.css({
8935
8765
  display: "flex",
8936
8766
  flexDirection: "column",
@@ -9097,30 +8927,30 @@ function getShiftedTimeRange(dir, timeRange, upperLimit) {
9097
8927
  };
9098
8928
  }
9099
8929
 
9100
- var __defProp$5 = Object.defineProperty;
9101
- var __defProps$2 = Object.defineProperties;
9102
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9103
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9104
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9105
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9106
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9107
- var __spreadValues$5 = (a, b) => {
8930
+ var __defProp$6 = Object.defineProperty;
8931
+ var __defProps$3 = Object.defineProperties;
8932
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8933
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8934
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8935
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8936
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8937
+ var __spreadValues$6 = (a, b) => {
9108
8938
  for (var prop in b || (b = {}))
9109
- if (__hasOwnProp$5.call(b, prop))
9110
- __defNormalProp$5(a, prop, b[prop]);
9111
- if (__getOwnPropSymbols$5)
9112
- for (var prop of __getOwnPropSymbols$5(b)) {
9113
- if (__propIsEnum$5.call(b, prop))
9114
- __defNormalProp$5(a, prop, b[prop]);
8939
+ if (__hasOwnProp$6.call(b, prop))
8940
+ __defNormalProp$6(a, prop, b[prop]);
8941
+ if (__getOwnPropSymbols$6)
8942
+ for (var prop of __getOwnPropSymbols$6(b)) {
8943
+ if (__propIsEnum$6.call(b, prop))
8944
+ __defNormalProp$6(a, prop, b[prop]);
9115
8945
  }
9116
8946
  return a;
9117
8947
  };
9118
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8948
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
9119
8949
  const DEFAULT_INTERVALS = ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"];
9120
8950
  class SceneRefreshPicker extends SceneObjectBase {
9121
8951
  constructor(state) {
9122
8952
  var _a, _b, _c;
9123
- super(__spreadProps$2(__spreadValues$5({
8953
+ super(__spreadProps$3(__spreadValues$6({
9124
8954
  refresh: ""
9125
8955
  }, state), {
9126
8956
  autoValue: void 0,
@@ -9201,55 +9031,283 @@ class SceneRefreshPicker extends SceneObjectBase {
9201
9031
  }
9202
9032
  getUrlState() {
9203
9033
  return {
9204
- refresh: this.state.refresh
9034
+ refresh: this.state.refresh
9035
+ };
9036
+ }
9037
+ updateFromUrl(values) {
9038
+ const refresh = values.refresh;
9039
+ if (refresh && typeof refresh === "string") {
9040
+ this.setState({
9041
+ refresh
9042
+ });
9043
+ }
9044
+ }
9045
+ }
9046
+ SceneRefreshPicker.Component = SceneRefreshPickerRenderer;
9047
+ function SceneRefreshPickerRenderer({ model }) {
9048
+ var _a;
9049
+ const { refresh, intervals, autoEnabled, autoValue, isOnCanvas, primary, withText } = model.useState();
9050
+ const isRunning = useQueryControllerState(model);
9051
+ let text = refresh === ((_a = ui.RefreshPicker.autoOption) == null ? void 0 : _a.value) ? autoValue : withText ? "Refresh" : void 0;
9052
+ let tooltip;
9053
+ let width;
9054
+ if (isRunning) {
9055
+ tooltip = "Cancel all queries";
9056
+ if (withText) {
9057
+ text = "Cancel";
9058
+ }
9059
+ }
9060
+ if (withText) {
9061
+ width = "96px";
9062
+ }
9063
+ return /* @__PURE__ */ React__default["default"].createElement(ui.RefreshPicker, {
9064
+ showAutoInterval: autoEnabled,
9065
+ value: refresh,
9066
+ intervals,
9067
+ tooltip,
9068
+ width,
9069
+ text,
9070
+ onRefresh: model.onRefresh,
9071
+ primary,
9072
+ onIntervalChanged: model.onIntervalChanged,
9073
+ isLoading: isRunning,
9074
+ isOnCanvas: isOnCanvas != null ? isOnCanvas : true
9075
+ });
9076
+ }
9077
+ function useQueryControllerState(model) {
9078
+ const queryController = sceneGraph.getQueryController(model);
9079
+ if (!queryController) {
9080
+ return false;
9081
+ }
9082
+ return queryController.useState().isRunning;
9083
+ }
9084
+
9085
+ const getCompareSeriesRefId = (refId) => `${refId}-compare`;
9086
+
9087
+ var __defProp$5 = Object.defineProperty;
9088
+ var __defProps$2 = Object.defineProperties;
9089
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9090
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9091
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9092
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9093
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9094
+ var __spreadValues$5 = (a, b) => {
9095
+ for (var prop in b || (b = {}))
9096
+ if (__hasOwnProp$5.call(b, prop))
9097
+ __defNormalProp$5(a, prop, b[prop]);
9098
+ if (__getOwnPropSymbols$5)
9099
+ for (var prop of __getOwnPropSymbols$5(b)) {
9100
+ if (__propIsEnum$5.call(b, prop))
9101
+ __defNormalProp$5(a, prop, b[prop]);
9102
+ }
9103
+ return a;
9104
+ };
9105
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
9106
+ const PREVIOUS_PERIOD_VALUE = "__previousPeriod";
9107
+ const NO_PERIOD_VALUE = "__noPeriod";
9108
+ const PREVIOUS_PERIOD_COMPARE_OPTION = {
9109
+ label: "Previous period",
9110
+ value: PREVIOUS_PERIOD_VALUE
9111
+ };
9112
+ const NO_COMPARE_OPTION = {
9113
+ label: "No comparison",
9114
+ value: NO_PERIOD_VALUE
9115
+ };
9116
+ const DEFAULT_COMPARE_OPTIONS = [
9117
+ { label: "Day before", value: "24h" },
9118
+ { label: "Week before", value: "1w" },
9119
+ { label: "Month before", value: "1M" }
9120
+ ];
9121
+ class SceneTimeRangeCompare extends SceneObjectBase {
9122
+ constructor(state) {
9123
+ super(__spreadValues$5({ compareOptions: DEFAULT_COMPARE_OPTIONS }, state));
9124
+ this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["compareWith"] });
9125
+ this._onActivate = () => {
9126
+ const sceneTimeRange = sceneGraph.getTimeRange(this);
9127
+ this.setState({ compareOptions: this.getCompareOptions(sceneTimeRange.state.value) });
9128
+ this._subs.add(
9129
+ sceneTimeRange.subscribeToState((timeRange) => {
9130
+ const compareOptions = this.getCompareOptions(timeRange.value);
9131
+ const stateUpdate = { compareOptions };
9132
+ if (Boolean(this.state.compareWith) && !compareOptions.find(({ value }) => value === this.state.compareWith)) {
9133
+ stateUpdate.compareWith = PREVIOUS_PERIOD_VALUE;
9134
+ }
9135
+ this.setState(stateUpdate);
9136
+ })
9137
+ );
9138
+ };
9139
+ this.getCompareOptions = (timeRange) => {
9140
+ const diffDays = Math.ceil(timeRange.to.diff(timeRange.from));
9141
+ const matchIndex = DEFAULT_COMPARE_OPTIONS.findIndex(({ value }) => {
9142
+ const intervalInMs = data.rangeUtil.intervalToMs(value);
9143
+ return intervalInMs >= diffDays;
9144
+ });
9145
+ return [
9146
+ NO_COMPARE_OPTION,
9147
+ PREVIOUS_PERIOD_COMPARE_OPTION,
9148
+ ...DEFAULT_COMPARE_OPTIONS.slice(matchIndex).map(({ label, value }) => ({ label, value }))
9149
+ ];
9150
+ };
9151
+ this.onCompareWithChanged = (compareWith) => {
9152
+ if (compareWith === NO_PERIOD_VALUE) {
9153
+ this.onClearCompare();
9154
+ } else {
9155
+ this.setState({ compareWith });
9156
+ }
9157
+ };
9158
+ this.onClearCompare = () => {
9159
+ this.setState({ compareWith: void 0 });
9160
+ };
9161
+ this.addActivationHandler(this._onActivate);
9162
+ }
9163
+ getExtraQueries(request) {
9164
+ const extraQueries = [];
9165
+ const compareRange = this.getCompareTimeRange(request.range);
9166
+ if (!compareRange) {
9167
+ return extraQueries;
9168
+ }
9169
+ const targets = request.targets.filter((query) => query.timeRangeCompare !== false);
9170
+ if (targets.length) {
9171
+ extraQueries.push({
9172
+ req: __spreadProps$2(__spreadValues$5({}, request), {
9173
+ targets,
9174
+ range: compareRange
9175
+ }),
9176
+ processor: timeShiftAlignmentProcessor
9177
+ });
9178
+ }
9179
+ return extraQueries;
9180
+ }
9181
+ shouldRerun(prev, next) {
9182
+ return prev.compareWith !== next.compareWith;
9183
+ }
9184
+ getCompareTimeRange(timeRange) {
9185
+ let compareFrom;
9186
+ let compareTo;
9187
+ if (this.state.compareWith) {
9188
+ if (this.state.compareWith === PREVIOUS_PERIOD_VALUE) {
9189
+ const diffMs = timeRange.to.diff(timeRange.from);
9190
+ compareFrom = data.dateTime(timeRange.from).subtract(diffMs);
9191
+ compareTo = data.dateTime(timeRange.to).subtract(diffMs);
9192
+ } else {
9193
+ compareFrom = data.dateTime(timeRange.from).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
9194
+ compareTo = data.dateTime(timeRange.to).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
9195
+ }
9196
+ return {
9197
+ from: compareFrom,
9198
+ to: compareTo,
9199
+ raw: {
9200
+ from: compareFrom,
9201
+ to: compareTo
9202
+ }
9203
+ };
9204
+ }
9205
+ return void 0;
9206
+ }
9207
+ getUrlState() {
9208
+ return {
9209
+ compareWith: this.state.compareWith
9205
9210
  };
9206
9211
  }
9207
9212
  updateFromUrl(values) {
9208
- const refresh = values.refresh;
9209
- if (refresh && typeof refresh === "string") {
9210
- this.setState({
9211
- refresh
9212
- });
9213
+ if (!values.compareWith) {
9214
+ return;
9215
+ }
9216
+ const compareWith = parseUrlParam(values.compareWith);
9217
+ if (compareWith) {
9218
+ const compareOptions = this.getCompareOptions(sceneGraph.getTimeRange(this).state.value);
9219
+ if (compareOptions.find(({ value }) => value === compareWith)) {
9220
+ this.setState({
9221
+ compareWith
9222
+ });
9223
+ } else {
9224
+ this.setState({
9225
+ compareWith: "__previousPeriod"
9226
+ });
9227
+ }
9213
9228
  }
9214
9229
  }
9215
9230
  }
9216
- SceneRefreshPicker.Component = SceneRefreshPickerRenderer;
9217
- function SceneRefreshPickerRenderer({ model }) {
9231
+ SceneTimeRangeCompare.Component = SceneTimeRangeCompareRenderer;
9232
+ const timeShiftAlignmentProcessor = (primary, secondary) => {
9233
+ const diff = secondary.timeRange.from.diff(primary.timeRange.from);
9234
+ secondary.series.forEach((series) => {
9235
+ series.refId = getCompareSeriesRefId(series.refId || "");
9236
+ series.meta = __spreadProps$2(__spreadValues$5({}, series.meta), {
9237
+ timeCompare: {
9238
+ diffMs: diff,
9239
+ isTimeShiftQuery: true
9240
+ }
9241
+ });
9242
+ series.fields.forEach((field) => {
9243
+ if (field.type === data.FieldType.time) {
9244
+ field.values = field.values.map((v) => {
9245
+ return diff < 0 ? v - diff : v + diff;
9246
+ });
9247
+ }
9248
+ field.config = __spreadProps$2(__spreadValues$5({}, field.config), {
9249
+ color: {
9250
+ mode: "fixed",
9251
+ fixedColor: runtime.config.theme.palette.gray60
9252
+ }
9253
+ });
9254
+ return field;
9255
+ });
9256
+ });
9257
+ return rxjs.of(secondary);
9258
+ };
9259
+ function SceneTimeRangeCompareRenderer({ model }) {
9218
9260
  var _a;
9219
- const { refresh, intervals, autoEnabled, autoValue, isOnCanvas, primary, withText } = model.useState();
9220
- const isRunning = useQueryControllerState(model);
9221
- let text = refresh === ((_a = ui.RefreshPicker.autoOption) == null ? void 0 : _a.value) ? autoValue : withText ? "Refresh" : void 0;
9222
- let tooltip;
9223
- let width;
9224
- if (isRunning) {
9225
- tooltip = "Cancel all queries";
9226
- if (withText) {
9227
- text = "Cancel";
9261
+ const styles = ui.useStyles2(getStyles$4);
9262
+ const { compareWith, compareOptions } = model.useState();
9263
+ const [previousCompare, setPreviousCompare] = React__default["default"].useState(compareWith);
9264
+ const previousValue = (_a = compareOptions.find(({ value: value2 }) => value2 === previousCompare)) != null ? _a : PREVIOUS_PERIOD_COMPARE_OPTION;
9265
+ const value = compareOptions.find(({ value: value2 }) => value2 === compareWith);
9266
+ const enabled = Boolean(value);
9267
+ const onClick = () => {
9268
+ if (enabled) {
9269
+ setPreviousCompare(compareWith);
9270
+ model.onClearCompare();
9271
+ } else if (!enabled) {
9272
+ model.onCompareWithChanged(previousValue.value);
9228
9273
  }
9229
- }
9230
- if (withText) {
9231
- width = "96px";
9232
- }
9233
- return /* @__PURE__ */ React__default["default"].createElement(ui.RefreshPicker, {
9234
- showAutoInterval: autoEnabled,
9235
- value: refresh,
9236
- intervals,
9237
- tooltip,
9238
- width,
9239
- text,
9240
- onRefresh: model.onRefresh,
9241
- primary,
9242
- onIntervalChanged: model.onIntervalChanged,
9243
- isLoading: isRunning,
9244
- isOnCanvas: isOnCanvas != null ? isOnCanvas : true
9245
- });
9274
+ };
9275
+ return /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
9276
+ variant: "canvas",
9277
+ tooltip: "Enable time frame comparison",
9278
+ onClick: (e) => {
9279
+ e.stopPropagation();
9280
+ e.preventDefault();
9281
+ onClick();
9282
+ }
9283
+ }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
9284
+ label: " ",
9285
+ value: enabled,
9286
+ onClick
9287
+ }), "Comparison"), enabled ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonSelect, {
9288
+ variant: "canvas",
9289
+ value,
9290
+ options: compareOptions,
9291
+ onChange: (v) => {
9292
+ model.onCompareWithChanged(v.value);
9293
+ }
9294
+ }) : /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
9295
+ className: styles.previewButton,
9296
+ disabled: true,
9297
+ variant: "canvas",
9298
+ isOpen: false
9299
+ }, previousValue.label));
9246
9300
  }
9247
- function useQueryControllerState(model) {
9248
- const queryController = sceneGraph.getQueryController(model);
9249
- if (!queryController) {
9250
- return false;
9251
- }
9252
- return queryController.useState().isRunning;
9301
+ function getStyles$4(theme) {
9302
+ return {
9303
+ previewButton: css.css({
9304
+ "&:disabled": {
9305
+ border: `1px solid ${theme.colors.secondary.border}`,
9306
+ color: theme.colors.text.disabled,
9307
+ opacity: 1
9308
+ }
9309
+ })
9310
+ };
9253
9311
  }
9254
9312
 
9255
9313
  class SceneByFrameRepeater extends SceneObjectBase {
@@ -11116,6 +11174,174 @@ const PanelBuilders = {
11116
11174
  }
11117
11175
  };
11118
11176
 
11177
+ class VizConfigBuilder {
11178
+ constructor(pluginId, pluginVersion, defaultOptions, defaultFieldConfig) {
11179
+ this._pluginId = pluginId;
11180
+ this._pluginVersion = pluginVersion;
11181
+ this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);
11182
+ this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);
11183
+ }
11184
+ setColor(color) {
11185
+ this._fieldConfigBuilder.setColor(color);
11186
+ return this;
11187
+ }
11188
+ setDecimals(decimals) {
11189
+ this._fieldConfigBuilder.setDecimals(decimals);
11190
+ return this;
11191
+ }
11192
+ setDisplayName(displayName) {
11193
+ this._fieldConfigBuilder.setDisplayName(displayName);
11194
+ return this;
11195
+ }
11196
+ setFilterable(filterable) {
11197
+ this._fieldConfigBuilder.setFilterable(filterable);
11198
+ return this;
11199
+ }
11200
+ setLinks(links) {
11201
+ this._fieldConfigBuilder.setLinks(links);
11202
+ return this;
11203
+ }
11204
+ setMappings(mappings) {
11205
+ this._fieldConfigBuilder.setMappings(mappings);
11206
+ return this;
11207
+ }
11208
+ setMax(max) {
11209
+ this._fieldConfigBuilder.setMax(max);
11210
+ return this;
11211
+ }
11212
+ setMin(min) {
11213
+ this._fieldConfigBuilder.setMin(min);
11214
+ return this;
11215
+ }
11216
+ setNoValue(noValue) {
11217
+ this._fieldConfigBuilder.setNoValue(noValue);
11218
+ return this;
11219
+ }
11220
+ setThresholds(thresholds) {
11221
+ this._fieldConfigBuilder.setThresholds(thresholds);
11222
+ return this;
11223
+ }
11224
+ setUnit(unit) {
11225
+ this._fieldConfigBuilder.setUnit(unit);
11226
+ return this;
11227
+ }
11228
+ setCustomFieldConfig(id, value) {
11229
+ this._fieldConfigBuilder.setCustomFieldConfig(id, value);
11230
+ return this;
11231
+ }
11232
+ setOverrides(builder) {
11233
+ this._fieldConfigBuilder.setOverrides(builder);
11234
+ return this;
11235
+ }
11236
+ setOption(id, value) {
11237
+ this._panelOptionsBuilder.setOption(id, value);
11238
+ return this;
11239
+ }
11240
+ build() {
11241
+ return {
11242
+ pluginId: this._pluginId,
11243
+ pluginVersion: this._pluginVersion,
11244
+ options: this._panelOptionsBuilder.build(),
11245
+ fieldConfig: this._fieldConfigBuilder.build()
11246
+ };
11247
+ }
11248
+ }
11249
+
11250
+ const VizConfigBuilders = {
11251
+ barchart() {
11252
+ return new VizConfigBuilder(
11253
+ "barchart",
11254
+ "10.0.0",
11255
+ () => BarChartPanelCfg_types_gen.defaultOptions,
11256
+ () => BarChartPanelCfg_types_gen.defaultFieldConfig
11257
+ );
11258
+ },
11259
+ bargauge() {
11260
+ return new VizConfigBuilder("bargauge", "10.0.0", () => BarGaugePanelCfg_types_gen.defaultOptions);
11261
+ },
11262
+ datagrid() {
11263
+ return new VizConfigBuilder("datagrid", "10.0.0", () => DatagridPanelCfg_types_gen.defaultOptions);
11264
+ },
11265
+ flamegraph() {
11266
+ return new VizConfigBuilder("flamegraph", "10.0.0");
11267
+ },
11268
+ gauge() {
11269
+ return new VizConfigBuilder("gauge", "10.0.0", () => GaugePanelCfg_types_gen.defaultOptions);
11270
+ },
11271
+ geomap() {
11272
+ return new VizConfigBuilder("geomap", "10.0.0", () => GeomapPanelCfg_types_gen.defaultOptions);
11273
+ },
11274
+ heatmap() {
11275
+ return new VizConfigBuilder("heatmap", "10.0.0", () => HeatmapPanelCfg_types_gen.defaultOptions);
11276
+ },
11277
+ histogram() {
11278
+ return new VizConfigBuilder(
11279
+ "histogram",
11280
+ "10.0.0",
11281
+ () => HistogramPanelCfg_types_gen.defaultOptions,
11282
+ () => HistogramPanelCfg_types_gen.defaultFieldConfig
11283
+ );
11284
+ },
11285
+ logs() {
11286
+ return new VizConfigBuilder("logs", "10.0.0");
11287
+ },
11288
+ news() {
11289
+ return new VizConfigBuilder("news", "10.0.0", () => NewsPanelCfg_types_gen.defaultOptions);
11290
+ },
11291
+ nodegraph() {
11292
+ return new VizConfigBuilder("nodeGraph", "10.0.0");
11293
+ },
11294
+ piechart() {
11295
+ return new VizConfigBuilder(
11296
+ "piechart",
11297
+ "10.0.0",
11298
+ () => PieChartPanelCfg_types_gen.defaultOptions
11299
+ );
11300
+ },
11301
+ stat() {
11302
+ return new VizConfigBuilder("stat", "10.0.0", () => StatPanelCfg_types_gen.defaultOptions);
11303
+ },
11304
+ statetimeline() {
11305
+ return new VizConfigBuilder(
11306
+ "state-timeline",
11307
+ "10.0.0",
11308
+ () => StateTimelinePanelCfg_types_gen.defaultOptions,
11309
+ () => StateTimelinePanelCfg_types_gen.defaultFieldConfig
11310
+ );
11311
+ },
11312
+ statushistory() {
11313
+ return new VizConfigBuilder(
11314
+ "status-history",
11315
+ "10.0.0",
11316
+ () => StatusHistoryPanelCfg_types_gen.defaultOptions,
11317
+ () => StatusHistoryPanelCfg_types_gen.defaultFieldConfig
11318
+ );
11319
+ },
11320
+ table() {
11321
+ return new VizConfigBuilder("table", "10.0.0", () => TablePanelCfg_types_gen.defaultOptions);
11322
+ },
11323
+ text() {
11324
+ return new VizConfigBuilder("text", "10.0.0", () => TextPanelCfg_types_gen.defaultOptions);
11325
+ },
11326
+ timeseries() {
11327
+ return new VizConfigBuilder("timeseries", "10.0.0");
11328
+ },
11329
+ trend() {
11330
+ return new VizConfigBuilder("trend", "10.0.0");
11331
+ },
11332
+ traces() {
11333
+ return new VizConfigBuilder("traces", "10.0.0");
11334
+ },
11335
+ xychart() {
11336
+ return new VizConfigBuilder(
11337
+ "xychart",
11338
+ "10.0.0",
11339
+ () => XYChartPanelCfg_types_gen.defaultOptions,
11340
+ () => XYChartPanelCfg_types_gen.defaultFieldConfig
11341
+ );
11342
+ }
11343
+ };
11344
+
11119
11345
  const sceneUtils = {
11120
11346
  getUrlWithAppState,
11121
11347
  registerRuntimePanelPlugin,
@@ -11140,6 +11366,7 @@ exports.ConstantVariable = ConstantVariable;
11140
11366
  exports.CustomVariable = CustomVariable;
11141
11367
  exports.DataSourceVariable = DataSourceVariable;
11142
11368
  exports.EmbeddedScene = EmbeddedScene;
11369
+ exports.FieldConfigBuilder = FieldConfigBuilder;
11143
11370
  exports.FieldConfigBuilders = FieldConfigBuilders;
11144
11371
  exports.FieldConfigOverridesBuilder = FieldConfigOverridesBuilder;
11145
11372
  exports.GroupByVariable = GroupByVariable;
@@ -11194,7 +11421,10 @@ exports.UrlSyncManager = UrlSyncManager;
11194
11421
  exports.UserActionEvent = UserActionEvent;
11195
11422
  exports.VariableDependencyConfig = VariableDependencyConfig;
11196
11423
  exports.VariableValueControl = VariableValueControl;
11424
+ exports.VariableValueSelectWrapper = VariableValueSelectWrapper;
11197
11425
  exports.VariableValueSelectors = VariableValueSelectors;
11426
+ exports.VizConfigBuilder = VizConfigBuilder;
11427
+ exports.VizConfigBuilders = VizConfigBuilders;
11198
11428
  exports.VizPanel = VizPanel;
11199
11429
  exports.VizPanelBuilder = VizPanelBuilder;
11200
11430
  exports.VizPanelMenu = VizPanelMenu;