@grafana/scenes 4.27.0--canary.766.9367073867.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 (39) 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 +4 -5
  23. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  24. package/dist/esm/variables/components/VariableValueSelect.js +15 -7
  25. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  26. package/dist/esm/variables/components/getOptionSearcher.js +1 -7
  27. package/dist/esm/variables/components/getOptionSearcher.js.map +1 -1
  28. package/dist/esm/variables/groupby/GroupByVariable.js +2 -2
  29. package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
  30. package/dist/esm/variables/interpolation/sceneInterpolator.js +3 -3
  31. package/dist/esm/variables/interpolation/sceneInterpolator.js.map +1 -1
  32. package/dist/esm/variables/utils.js.map +1 -1
  33. package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
  34. package/dist/index.d.ts +256 -146
  35. package/dist/index.js +1131 -910
  36. package/dist/index.js.map +1 -1
  37. package/package.json +4 -7
  38. package/dist/esm/querying/timeShiftQueryResponseOperator.js +0 -60
  39. 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,7 +2765,7 @@ class CustomAllValue {
2945
2765
  }
2946
2766
  }
2947
2767
 
2948
- function getOptionSearcher(options, includeAll, value, text) {
2768
+ function getOptionSearcher(options, includeAll) {
2949
2769
  const ufuzzy = new uFuzzy__default["default"]();
2950
2770
  let allOptions = options;
2951
2771
  const haystack = [];
@@ -2953,12 +2773,6 @@ function getOptionSearcher(options, includeAll, value, text) {
2953
2773
  if (includeAll) {
2954
2774
  allOptions = [{ value: ALL_VARIABLE_VALUE, label: ALL_VARIABLE_TEXT }, ...allOptions];
2955
2775
  }
2956
- if (!Array.isArray(value)) {
2957
- const current = options.find((x) => x.value === value);
2958
- if (!current) {
2959
- allOptions = [{ value, label: String(text) }, ...allOptions];
2960
- }
2961
- }
2962
2776
  return (search) => {
2963
2777
  if (search === "") {
2964
2778
  if (allOptions.length > limit) {
@@ -2990,45 +2804,52 @@ function getOptionSearcher(options, includeAll, value, text) {
2990
2804
  };
2991
2805
  }
2992
2806
 
2993
- var __defProp$z = Object.defineProperty;
2994
- var __defProps$n = Object.defineProperties;
2995
- var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
2996
- var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
2997
- var __hasOwnProp$z = Object.prototype.hasOwnProperty;
2998
- var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
2999
- var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3000
- 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) => {
3001
2815
  for (var prop in b || (b = {}))
3002
- if (__hasOwnProp$z.call(b, prop))
3003
- __defNormalProp$z(a, prop, b[prop]);
3004
- if (__getOwnPropSymbols$z)
3005
- for (var prop of __getOwnPropSymbols$z(b)) {
3006
- if (__propIsEnum$z.call(b, prop))
3007
- __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]);
3008
2822
  }
3009
2823
  return a;
3010
2824
  };
3011
- var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
2825
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
3012
2826
  var __objRest$3 = (source, exclude) => {
3013
2827
  var target = {};
3014
2828
  for (var prop in source)
3015
- if (__hasOwnProp$z.call(source, prop) && exclude.indexOf(prop) < 0)
2829
+ if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
3016
2830
  target[prop] = source[prop];
3017
- if (source != null && __getOwnPropSymbols$z)
3018
- for (var prop of __getOwnPropSymbols$z(source)) {
3019
- 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))
3020
2834
  target[prop] = source[prop];
3021
2835
  }
3022
2836
  return target;
3023
2837
  };
3024
- 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
+ }
3025
2845
  function VariableValueSelect({ model }) {
3026
2846
  const { value, text, key, options, includeAll } = model.useState();
3027
2847
  const [inputValue, setInputValue] = React.useState("");
3028
2848
  const [hasCustomValue, setHasCustomValue] = React.useState(false);
2849
+ const selectValue = toSelectableValue$1(value, String(text));
3029
2850
  const optionSearcher = React.useMemo(
3030
- () => getOptionSearcher(options, includeAll, value, text),
3031
- [options, includeAll, value, text]
2851
+ () => getOptionSearcher(options, includeAll),
2852
+ [options, includeAll]
3032
2853
  );
3033
2854
  const onInputChange = (value2, { action }) => {
3034
2855
  if (action === "input-change") {
@@ -3051,13 +2872,14 @@ function VariableValueSelect({ model }) {
3051
2872
  };
3052
2873
  return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
3053
2874
  id: key,
2875
+ isValidNewOption: (inputValue2) => inputValue2.trim().length > 0,
3054
2876
  placeholder: "Select value",
3055
2877
  width: "auto",
3056
- value,
2878
+ value: selectValue,
3057
2879
  inputValue,
3058
2880
  allowCustomValue: true,
3059
2881
  virtualized: true,
3060
- filterOption: filterNoOp$1,
2882
+ filterOption: filterNoOp$2,
3061
2883
  tabSelectsValue: false,
3062
2884
  onInputChange,
3063
2885
  onOpenMenu,
@@ -3073,13 +2895,13 @@ function VariableValueSelect({ model }) {
3073
2895
  });
3074
2896
  }
3075
2897
  function VariableValueSelectMulti({ model }) {
3076
- const { value, text, options, key, maxVisibleValues, noValueOnClear, includeAll } = model.useState();
2898
+ const { value, options, key, maxVisibleValues, noValueOnClear, includeAll } = model.useState();
3077
2899
  const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
3078
2900
  const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
3079
2901
  const [inputValue, setInputValue] = React.useState("");
3080
2902
  const optionSearcher = React.useMemo(
3081
- () => getOptionSearcher(options, includeAll, value, text),
3082
- [options, includeAll, value, text]
2903
+ () => getOptionSearcher(options, includeAll),
2904
+ [options, includeAll]
3083
2905
  );
3084
2906
  React.useEffect(() => {
3085
2907
  setUncommittedValue(arrayValue);
@@ -3120,7 +2942,7 @@ function VariableValueSelectMulti({ model }) {
3120
2942
  onBlur: () => {
3121
2943
  model.changeValueTo(uncommittedValue);
3122
2944
  },
3123
- filterOption: filterNoOp$1,
2945
+ filterOption: filterNoOp$2,
3124
2946
  "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${uncommittedValue}`),
3125
2947
  onChange: (newValue, action) => {
3126
2948
  if (action.action === "clear" && noValueOnClear) {
@@ -3143,7 +2965,7 @@ const OptionWithCheckbox = ({
3143
2965
  const theme = ui.useTheme2();
3144
2966
  const selectStyles = ui.getSelectStyles(theme);
3145
2967
  const optionStyles = ui.useStyles2(getOptionStyles);
3146
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$n(__spreadValues$z({
2968
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
3147
2969
  ref: innerRef,
3148
2970
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
3149
2971
  }, rest), {
@@ -3237,28 +3059,28 @@ function fromUrlValues(urlValues) {
3237
3059
  );
3238
3060
  }
3239
3061
 
3240
- var __defProp$y = Object.defineProperty;
3241
- var __defProps$m = Object.defineProperties;
3242
- var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
3243
- var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
3244
- var __hasOwnProp$y = Object.prototype.hasOwnProperty;
3245
- var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
3246
- var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3247
- 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) => {
3248
3070
  for (var prop in b || (b = {}))
3249
- if (__hasOwnProp$y.call(b, prop))
3250
- __defNormalProp$y(a, prop, b[prop]);
3251
- if (__getOwnPropSymbols$y)
3252
- for (var prop of __getOwnPropSymbols$y(b)) {
3253
- if (__propIsEnum$y.call(b, prop))
3254
- __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]);
3255
3077
  }
3256
3078
  return a;
3257
3079
  };
3258
- var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
3080
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
3259
3081
  class GroupByVariable extends MultiValueVariable {
3260
3082
  constructor(initialState) {
3261
- super(__spreadProps$m(__spreadValues$y({
3083
+ super(__spreadProps$n(__spreadValues$z({
3262
3084
  isMulti: true,
3263
3085
  name: "",
3264
3086
  value: [],
@@ -3376,8 +3198,8 @@ function GroupByVariableRenderer({ model }) {
3376
3198
  const [inputValue, setInputValue] = React.useState("");
3377
3199
  const [uncommittedValue, setUncommittedValue] = React.useState(values);
3378
3200
  const optionSearcher = React.useMemo(
3379
- () => getOptionSearcher(options, includeAll, value, text),
3380
- [options, includeAll, value, text]
3201
+ () => getOptionSearcher(options, includeAll),
3202
+ [options, includeAll]
3381
3203
  );
3382
3204
  React.useEffect(() => {
3383
3205
  setUncommittedValue(values);
@@ -3409,7 +3231,7 @@ function GroupByVariableRenderer({ model }) {
3409
3231
  tabSelectsValue: false,
3410
3232
  virtualized: true,
3411
3233
  options: filteredOptions,
3412
- filterOption: filterNoOp,
3234
+ filterOption: filterNoOp$1,
3413
3235
  closeMenuOnSelect: false,
3414
3236
  isOpen: isOptionsOpen,
3415
3237
  isClearable: true,
@@ -3440,7 +3262,7 @@ function GroupByVariableRenderer({ model }) {
3440
3262
  }
3441
3263
  });
3442
3264
  }
3443
- const filterNoOp = () => true;
3265
+ const filterNoOp$1 = () => true;
3444
3266
 
3445
3267
  function LoadingIndicator(props) {
3446
3268
  return /* @__PURE__ */ React__default["default"].createElement(ui.Tooltip, {
@@ -3457,7 +3279,7 @@ function LoadingIndicator(props) {
3457
3279
  }
3458
3280
 
3459
3281
  function ControlsLabel(props) {
3460
- const styles = ui.useStyles2(getStyles$8);
3282
+ const styles = ui.useStyles2(getStyles$9);
3461
3283
  const theme = ui.useTheme2();
3462
3284
  const isVertical = props.layout === "vertical";
3463
3285
  const loadingIndicator = Boolean(props.isLoading) ? /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -3520,7 +3342,7 @@ function ControlsLabel(props) {
3520
3342
  }
3521
3343
  return labelElement;
3522
3344
  }
3523
- const getStyles$8 = (theme) => ({
3345
+ const getStyles$9 = (theme) => ({
3524
3346
  horizontalLabel: css.css({
3525
3347
  background: theme.isDark ? theme.colors.background.primary : theme.colors.background.secondary,
3526
3348
  display: `flex`,
@@ -3568,9 +3390,10 @@ function keyLabelToOption(key, label) {
3568
3390
  label: label || key
3569
3391
  } : null;
3570
3392
  }
3393
+ const filterNoOp = () => true;
3571
3394
  function AdHocFilterRenderer({ filter, model }) {
3572
3395
  var _a, _b;
3573
- const styles = ui.useStyles2(getStyles$7);
3396
+ const styles = ui.useStyles2(getStyles$8);
3574
3397
  const [keys, setKeys] = React.useState([]);
3575
3398
  const [values, setValues] = React.useState([]);
3576
3399
  const [isKeysLoading, setIsKeysLoading] = React.useState(false);
@@ -3582,11 +3405,8 @@ function AdHocFilterRenderer({ filter, model }) {
3582
3405
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3583
3406
  const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
3584
3407
  const optionSearcher = React.useMemo(
3585
- () => {
3586
- var _a2, _b2;
3587
- return getOptionSearcher(values.map(selectableValueToVariableValueOption), void 0, (_a2 = valueValue == null ? void 0 : valueValue.value) != null ? _a2 : "", (_b2 = valueValue == null ? void 0 : valueValue.label) != null ? _b2 : "");
3588
- },
3589
- [values, valueValue == null ? void 0 : valueValue.value, valueValue == null ? void 0 : valueValue.label]
3408
+ () => getOptionSearcher(values.map(selectableValueToVariableValueOption), void 0),
3409
+ [values]
3590
3410
  );
3591
3411
  const onValueInputChange = (value, { action }) => {
3592
3412
  if (action === "input-change") {
@@ -3605,6 +3425,7 @@ function AdHocFilterRenderer({ filter, model }) {
3605
3425
  className: css.cx(styles.value, isKeysOpen ? styles.widthWhenOpen : void 0),
3606
3426
  width: "auto",
3607
3427
  value: valueValue,
3428
+ filterOption: filterNoOp,
3608
3429
  placeholder: "Select value",
3609
3430
  options: filteredValueOptions,
3610
3431
  inputValue: valueInputValue,
@@ -3704,7 +3525,7 @@ function AdHocFilterRenderer({ filter, model }) {
3704
3525
  onClick: () => model._removeFilter(filter)
3705
3526
  }));
3706
3527
  }
3707
- const getStyles$7 = (theme) => ({
3528
+ const getStyles$8 = (theme) => ({
3708
3529
  field: css.css({
3709
3530
  marginBottom: 0
3710
3531
  }),
@@ -3842,29 +3663,29 @@ function isFilter(filter) {
3842
3663
  return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
3843
3664
  }
3844
3665
 
3845
- var __defProp$x = Object.defineProperty;
3846
- var __defProps$l = Object.defineProperties;
3847
- var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
3848
- var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
3849
- var __hasOwnProp$x = Object.prototype.hasOwnProperty;
3850
- var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
3851
- var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3852
- 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) => {
3853
3674
  for (var prop in b || (b = {}))
3854
- if (__hasOwnProp$x.call(b, prop))
3855
- __defNormalProp$x(a, prop, b[prop]);
3856
- if (__getOwnPropSymbols$x)
3857
- for (var prop of __getOwnPropSymbols$x(b)) {
3858
- if (__propIsEnum$x.call(b, prop))
3859
- __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]);
3860
3681
  }
3861
3682
  return a;
3862
3683
  };
3863
- var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
3684
+ var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
3864
3685
  class AdHocFiltersVariable extends SceneObjectBase {
3865
3686
  constructor(state) {
3866
3687
  var _a, _b;
3867
- super(__spreadValues$x({
3688
+ super(__spreadValues$y({
3868
3689
  type: "adhoc",
3869
3690
  name: (_a = state.name) != null ? _a : "Filters",
3870
3691
  filters: [],
@@ -3901,15 +3722,15 @@ class AdHocFiltersVariable extends SceneObjectBase {
3901
3722
  const propLabelKey = `${prop}Label`;
3902
3723
  if (filter === _wip) {
3903
3724
  if (prop === "value") {
3904
- 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 });
3905
3726
  } else {
3906
- 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 }) });
3907
3728
  }
3908
3729
  return;
3909
3730
  }
3910
3731
  const updatedFilters = this.state.filters.map((f) => {
3911
3732
  if (f === filter) {
3912
- const updatedFilter = __spreadProps$l(__spreadValues$x({}, f), { [prop]: value, [propLabelKey]: label });
3733
+ const updatedFilter = __spreadProps$m(__spreadValues$y({}, f), { [prop]: value, [propLabelKey]: label });
3913
3734
  if (prop === "key" && filter[prop] !== value) {
3914
3735
  updatedFilter.value = "";
3915
3736
  updatedFilter.valueLabel = "";
@@ -3990,7 +3811,7 @@ function renderExpression(builder, filters) {
3990
3811
  }
3991
3812
  function AdHocFiltersVariableRenderer({ model }) {
3992
3813
  const { filters, readOnly, addFilterButtonText } = model.useState();
3993
- const styles = ui.useStyles2(getStyles$6);
3814
+ const styles = ui.useStyles2(getStyles$7);
3994
3815
  return /* @__PURE__ */ React__default["default"].createElement("div", {
3995
3816
  className: styles.wrapper
3996
3817
  }, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
@@ -4004,7 +3825,7 @@ function AdHocFiltersVariableRenderer({ model }) {
4004
3825
  addFilterButtonText
4005
3826
  }));
4006
3827
  }
4007
- const getStyles$6 = (theme) => ({
3828
+ const getStyles$7 = (theme) => ({
4008
3829
  wrapper: css.css({
4009
3830
  display: "flex",
4010
3831
  flexWrap: "wrap",
@@ -4088,25 +3909,25 @@ function areDifferentLayers(a, b) {
4088
3909
  return false;
4089
3910
  }
4090
3911
 
4091
- var __defProp$w = Object.defineProperty;
4092
- var __defProps$k = Object.defineProperties;
4093
- var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
4094
- var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
4095
- var __hasOwnProp$w = Object.prototype.hasOwnProperty;
4096
- var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
4097
- var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4098
- 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) => {
4099
3920
  for (var prop in b || (b = {}))
4100
- if (__hasOwnProp$w.call(b, prop))
4101
- __defNormalProp$w(a, prop, b[prop]);
4102
- if (__getOwnPropSymbols$w)
4103
- for (var prop of __getOwnPropSymbols$w(b)) {
4104
- if (__propIsEnum$w.call(b, prop))
4105
- __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]);
4106
3927
  }
4107
3928
  return a;
4108
3929
  };
4109
- var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
3930
+ var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
4110
3931
  let counter$1 = 100;
4111
3932
  function getNextRequestId$1() {
4112
3933
  return "SQR" + counter$1++;
@@ -4123,70 +3944,6 @@ class SceneQueryRunner extends SceneObjectBase {
4123
3944
  onVariableUpdateCompleted: this.onVariableUpdatesCompleted.bind(this),
4124
3945
  onAnyVariableChanged: this.onAnyVariableChanged.bind(this)
4125
3946
  });
4126
- this.prepareRequests = (timeRange, ds) => {
4127
- const comparer = this.getTimeCompare();
4128
- const { minInterval, queries } = this.state;
4129
- let secondaryRequest;
4130
- let request = __spreadValues$w({
4131
- app: "scenes",
4132
- requestId: getNextRequestId$1(),
4133
- timezone: timeRange.getTimeZone(),
4134
- panelId: 1,
4135
- range: timeRange.state.value,
4136
- interval: "1s",
4137
- intervalMs: 1e3,
4138
- targets: lodash.cloneDeep(queries),
4139
- maxDataPoints: this.getMaxDataPoints(),
4140
- scopedVars: this._scopedVars,
4141
- startTime: Date.now(),
4142
- liveStreaming: this.state.liveStreaming,
4143
- rangeRaw: {
4144
- from: timeRange.state.from,
4145
- to: timeRange.state.to
4146
- },
4147
- cacheTimeout: this.state.cacheTimeout,
4148
- queryCachingTTL: this.state.queryCachingTTL
4149
- }, getEnrichedDataRequest(this));
4150
- if (this._adhocFiltersVar) {
4151
- request.filters = this._adhocFiltersVar.state.filters.filter(isFilterComplete);
4152
- }
4153
- if (this._groupByVar) {
4154
- request.groupByKeys = this._groupByVar.state.value;
4155
- }
4156
- request.targets = request.targets.map((query) => {
4157
- var _a;
4158
- if (!query.datasource || query.datasource.uid !== ds.uid && !((_a = ds.meta) == null ? void 0 : _a.mixed) && runtime.isExpressionReference && !runtime.isExpressionReference(query.datasource)) {
4159
- query.datasource = ds.getRef();
4160
- }
4161
- return query;
4162
- });
4163
- const lowerIntervalLimit = minInterval ? minInterval : ds.interval;
4164
- const norm = data.rangeUtil.calculateInterval(timeRange.state.value, request.maxDataPoints, lowerIntervalLimit);
4165
- request.scopedVars = Object.assign({}, request.scopedVars, {
4166
- __interval: { text: norm.interval, value: norm.interval },
4167
- __interval_ms: { text: norm.intervalMs.toString(), value: norm.intervalMs }
4168
- });
4169
- request.interval = norm.interval;
4170
- request.intervalMs = norm.intervalMs;
4171
- const primaryTimeRange = timeRange.state.value;
4172
- if (comparer) {
4173
- const secondaryTimeRange = comparer.getCompareTimeRange(primaryTimeRange);
4174
- if (secondaryTimeRange) {
4175
- const secondaryTargets = request.targets.filter((query) => query.timeRangeCompare !== false);
4176
- if (secondaryTargets.length) {
4177
- secondaryRequest = __spreadProps$k(__spreadValues$w({}, request), {
4178
- targets: secondaryTargets,
4179
- range: secondaryTimeRange,
4180
- requestId: getNextRequestId$1()
4181
- });
4182
- }
4183
- request = __spreadProps$k(__spreadValues$w({}, request), {
4184
- range: primaryTimeRange
4185
- });
4186
- }
4187
- }
4188
- return [request, secondaryRequest];
4189
- };
4190
3947
  this.onDataReceived = (data$1) => {
4191
3948
  const preProcessedData = data.preProcessPanelData(data$1, this.state.data);
4192
3949
  this._resultAnnotations = data$1.annotations;
@@ -4205,11 +3962,11 @@ class SceneQueryRunner extends SceneObjectBase {
4205
3962
  }
4206
3963
  _onActivate() {
4207
3964
  const timeRange = sceneGraph.getTimeRange(this);
4208
- const comparer = this.getTimeCompare();
4209
- if (comparer) {
3965
+ const providers = this.getClosestExtraQueryProviders();
3966
+ for (const provider of providers) {
4210
3967
  this._subs.add(
4211
- comparer.subscribeToState((n, p) => {
4212
- if (n.compareWith !== p.compareWith) {
3968
+ provider.subscribeToState((n, p) => {
3969
+ if (provider.shouldRerun(p, n)) {
4213
3970
  this.runQueries();
4214
3971
  }
4215
3972
  })
@@ -4268,9 +4025,9 @@ class SceneQueryRunner extends SceneObjectBase {
4268
4025
  return;
4269
4026
  }
4270
4027
  this._layerAnnotations = annotations;
4271
- 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 });
4272
4029
  this.setState({
4273
- data: __spreadProps$k(__spreadValues$w({}, baseStateUpdate), {
4030
+ data: __spreadProps$l(__spreadValues$x({}, baseStateUpdate), {
4274
4031
  annotations: [...(_d = this._resultAnnotations) != null ? _d : [], ...annotations],
4275
4032
  alertState: alertState != null ? alertState : (_e = this.state.data) == null ? void 0 : _e.alertState
4276
4033
  })
@@ -4389,7 +4146,7 @@ class SceneQueryRunner extends SceneObjectBase {
4389
4146
  this._dataLayersSub = void 0;
4390
4147
  }
4391
4148
  this.setState({
4392
- 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 })
4393
4150
  });
4394
4151
  }
4395
4152
  async runWithTimeRange(timeRange) {
@@ -4403,6 +4160,7 @@ class SceneQueryRunner extends SceneObjectBase {
4403
4160
  (_a = this._querySub) == null ? void 0 : _a.unsubscribe();
4404
4161
  if (this._variableDependency.hasDependencyInLoadingState()) {
4405
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 }) });
4406
4164
  return;
4407
4165
  }
4408
4166
  const { queries } = this.state;
@@ -4415,16 +4173,18 @@ class SceneQueryRunner extends SceneObjectBase {
4415
4173
  const ds = await getDataSource(datasource, this._scopedVars);
4416
4174
  this.findAndSubscribeToAdHocFilters(datasource == null ? void 0 : datasource.uid);
4417
4175
  const runRequest = runtime.getRunRequest();
4418
- const [request, secondaryRequest] = this.prepareRequests(timeRange, ds);
4176
+ const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds);
4419
4177
  writeSceneLog("SceneQueryRunner", "Starting runRequest", this.state.key);
4420
- let stream = runRequest(ds, request);
4421
- if (secondaryRequest) {
4422
- 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);
4423
4183
  }
4424
4184
  stream = stream.pipe(
4425
4185
  registerQueryWithController({
4426
4186
  type: "data",
4427
- request,
4187
+ request: primary,
4428
4188
  origin: this,
4429
4189
  cancel: () => this.cancelQuery()
4430
4190
  })
@@ -4432,7 +4192,7 @@ class SceneQueryRunner extends SceneObjectBase {
4432
4192
  this._querySub = stream.subscribe(this.onDataReceived);
4433
4193
  } catch (err) {
4434
4194
  console.error("PanelQueryRunner Error", err);
4435
- 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), {
4436
4196
  state: schema.LoadingState.Error,
4437
4197
  errors: [runtime.toDataQueryError(err)]
4438
4198
  }));
@@ -4442,16 +4202,73 @@ class SceneQueryRunner extends SceneObjectBase {
4442
4202
  var _a;
4443
4203
  const clone = super.clone(withState);
4444
4204
  if (this._resultAnnotations) {
4445
- clone["_resultAnnotations"] = this._resultAnnotations.map((frame) => __spreadValues$w({}, frame));
4205
+ clone["_resultAnnotations"] = this._resultAnnotations.map((frame) => __spreadValues$x({}, frame));
4446
4206
  }
4447
4207
  if (this._layerAnnotations) {
4448
- clone["_layerAnnotations"] = this._layerAnnotations.map((frame) => __spreadValues$w({}, frame));
4208
+ clone["_layerAnnotations"] = this._layerAnnotations.map((frame) => __spreadValues$x({}, frame));
4449
4209
  }
4450
4210
  clone["_variableValueRecorder"] = this._variableValueRecorder.cloneAndRecordCurrentValuesForSceneObject(this);
4451
4211
  clone["_containerWidth"] = this._containerWidth;
4452
4212
  clone["_results"].next({ origin: this, data: (_a = this.state.data) != null ? _a : emptyPanelData });
4453
4213
  return clone;
4454
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
+ }
4455
4272
  _combineDataLayers(data) {
4456
4273
  if (this._layerAnnotations && this._layerAnnotations.length > 0) {
4457
4274
  data.annotations = (data.annotations || []).concat(this._layerAnnotations);
@@ -4466,22 +4283,23 @@ class SceneQueryRunner extends SceneObjectBase {
4466
4283
  this.setState({ data: emptyPanelData });
4467
4284
  }
4468
4285
  }
4469
- getTimeCompare() {
4286
+ getClosestExtraQueryProviders() {
4287
+ const found = /* @__PURE__ */ new Map();
4470
4288
  if (!this.parent) {
4471
- return null;
4289
+ return [];
4472
4290
  }
4473
- return getClosest(this.parent, (s) => {
4474
- let found = null;
4475
- if (s instanceof SceneTimeRangeCompare) {
4476
- return s;
4291
+ getClosest(this.parent, (s) => {
4292
+ if (isExtraQueryProvider(s) && !found.has(s.constructor)) {
4293
+ found.set(s.constructor, s);
4477
4294
  }
4478
4295
  s.forEachChild((child) => {
4479
- if (child instanceof SceneTimeRangeCompare) {
4480
- found = child;
4296
+ if (isExtraQueryProvider(child) && !found.has(child.constructor)) {
4297
+ found.set(child.constructor, child);
4481
4298
  }
4482
4299
  });
4483
- return found;
4300
+ return null;
4484
4301
  });
4302
+ return Array.from(found.values());
4485
4303
  }
4486
4304
  findAndSubscribeToAdHocFilters(uid) {
4487
4305
  const filtersVar = findActiveAdHocFilterVariableByUid(uid);
@@ -4680,28 +4498,28 @@ class ActWhenVariableChanged extends SceneObjectBase {
4680
4498
  }
4681
4499
  }
4682
4500
 
4683
- var __defProp$v = Object.defineProperty;
4684
- var __defProps$j = Object.defineProperties;
4685
- var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
4686
- var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
4687
- var __hasOwnProp$v = Object.prototype.hasOwnProperty;
4688
- var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
4689
- var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4690
- 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) => {
4691
4509
  for (var prop in b || (b = {}))
4692
- if (__hasOwnProp$v.call(b, prop))
4693
- __defNormalProp$v(a, prop, b[prop]);
4694
- if (__getOwnPropSymbols$v)
4695
- for (var prop of __getOwnPropSymbols$v(b)) {
4696
- if (__propIsEnum$v.call(b, prop))
4697
- __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]);
4698
4516
  }
4699
4517
  return a;
4700
4518
  };
4701
- var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
4519
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
4702
4520
  class CursorSync extends SceneObjectBase {
4703
4521
  constructor(state) {
4704
- super(__spreadProps$j(__spreadValues$v({}, state), {
4522
+ super(__spreadProps$k(__spreadValues$w({}, state), {
4705
4523
  sync: state.sync || schema.DashboardCursorSync.Off
4706
4524
  }));
4707
4525
  this.getEventsBus = (panel) => {
@@ -4965,25 +4783,25 @@ const getAlertStateStyles = (theme) => {
4965
4783
  };
4966
4784
  };
4967
4785
 
4968
- var __defProp$u = Object.defineProperty;
4969
- var __defProps$i = Object.defineProperties;
4970
- var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
4971
- var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
4972
- var __hasOwnProp$u = Object.prototype.hasOwnProperty;
4973
- var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
4974
- var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4975
- 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) => {
4976
4794
  for (var prop in b || (b = {}))
4977
- if (__hasOwnProp$u.call(b, prop))
4978
- __defNormalProp$u(a, prop, b[prop]);
4979
- if (__getOwnPropSymbols$u)
4980
- for (var prop of __getOwnPropSymbols$u(b)) {
4981
- if (__propIsEnum$u.call(b, prop))
4982
- __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]);
4983
4801
  }
4984
4802
  return a;
4985
4803
  };
4986
- var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
4804
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
4987
4805
  const displayOverrideRef = "hideSeriesFrom";
4988
4806
  const isHideSeriesOverride = data.isSystemOverrideWithRef(displayOverrideRef);
4989
4807
  function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
@@ -4993,13 +4811,13 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
4993
4811
  if (currentIndex < 0) {
4994
4812
  if (mode === ui.SeriesVisibilityChangeMode.ToggleSelection) {
4995
4813
  const override3 = createOverride$1([displayName, ...getNamesOfHiddenFields(overrides, data)]);
4996
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4814
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
4997
4815
  overrides: [...fieldConfig.overrides, override3]
4998
4816
  });
4999
4817
  }
5000
4818
  const displayNames = getDisplayNames(data, displayName);
5001
4819
  const override2 = createOverride$1(displayNames);
5002
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4820
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5003
4821
  overrides: [...fieldConfig.overrides, override2]
5004
4822
  });
5005
4823
  }
@@ -5012,22 +4830,22 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
5012
4830
  existing = existing.filter((el) => nameOfHiddenFields.indexOf(el) < 0);
5013
4831
  }
5014
4832
  if (existing[0] === displayName && existing.length === 1) {
5015
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4833
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5016
4834
  overrides: overridesCopy
5017
4835
  });
5018
4836
  }
5019
4837
  const override2 = createOverride$1([displayName, ...nameOfHiddenFields]);
5020
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4838
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5021
4839
  overrides: [...overridesCopy, override2]
5022
4840
  });
5023
4841
  }
5024
4842
  const override = createExtendedOverride(current, displayName);
5025
4843
  if (allFieldsAreExcluded(override, data)) {
5026
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4844
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5027
4845
  overrides: overridesCopy
5028
4846
  });
5029
4847
  }
5030
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4848
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5031
4849
  overrides: [...overridesCopy, override]
5032
4850
  });
5033
4851
  }
@@ -5052,7 +4870,7 @@ function createOverride$1(names, mode = data.ByNamesMatcherMode.exclude, propert
5052
4870
  }
5053
4871
  },
5054
4872
  properties: [
5055
- __spreadProps$i(__spreadValues$u({}, property), {
4873
+ __spreadProps$j(__spreadValues$v({}, property), {
5056
4874
  value: {
5057
4875
  viz: true,
5058
4876
  legend: false,
@@ -5124,32 +4942,32 @@ const getNamesOfHiddenFields = (overrides, data$1) => {
5124
4942
  return names;
5125
4943
  };
5126
4944
 
5127
- var __defProp$t = Object.defineProperty;
5128
- var __defProps$h = Object.defineProperties;
5129
- var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
5130
- var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
5131
- var __hasOwnProp$t = Object.prototype.hasOwnProperty;
5132
- var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
5133
- var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5134
- 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) => {
5135
4953
  for (var prop in b || (b = {}))
5136
- if (__hasOwnProp$t.call(b, prop))
5137
- __defNormalProp$t(a, prop, b[prop]);
5138
- if (__getOwnPropSymbols$t)
5139
- for (var prop of __getOwnPropSymbols$t(b)) {
5140
- if (__propIsEnum$t.call(b, prop))
5141
- __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]);
5142
4960
  }
5143
4961
  return a;
5144
4962
  };
5145
- var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
4963
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
5146
4964
  const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
5147
4965
  const { overrides } = fieldConfig;
5148
4966
  const currentIndex = fieldConfig.overrides.findIndex((override) => {
5149
4967
  return override.matcher.id === data.FieldMatcherID.byName && override.matcher.options === label;
5150
4968
  });
5151
4969
  if (currentIndex < 0) {
5152
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4970
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5153
4971
  overrides: [...fieldConfig.overrides, createOverride(label, color)]
5154
4972
  });
5155
4973
  }
@@ -5157,19 +4975,19 @@ const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
5157
4975
  const existing = overridesCopy[currentIndex];
5158
4976
  const propertyIndex = existing.properties.findIndex((p) => p.id === "color");
5159
4977
  if (propertyIndex < 0) {
5160
- overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$t({}, existing), {
4978
+ overridesCopy[currentIndex] = __spreadProps$i(__spreadValues$u({}, existing), {
5161
4979
  properties: [...existing.properties, createProperty(color)]
5162
4980
  });
5163
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4981
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5164
4982
  overrides: overridesCopy
5165
4983
  });
5166
4984
  }
5167
4985
  const propertiesCopy = Array.from(existing.properties);
5168
4986
  propertiesCopy[propertyIndex] = createProperty(color);
5169
- overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$t({}, existing), {
4987
+ overridesCopy[currentIndex] = __spreadProps$i(__spreadValues$u({}, existing), {
5170
4988
  properties: propertiesCopy
5171
4989
  });
5172
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4990
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5173
4991
  overrides: overridesCopy
5174
4992
  });
5175
4993
  };
@@ -5192,29 +5010,29 @@ const createProperty = (color) => {
5192
5010
  };
5193
5011
  };
5194
5012
 
5195
- var __defProp$s = Object.defineProperty;
5196
- var __defProps$g = Object.defineProperties;
5197
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
5198
- var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
5199
- var __hasOwnProp$s = Object.prototype.hasOwnProperty;
5200
- var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
5201
- var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5202
- 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) => {
5203
5021
  for (var prop in b || (b = {}))
5204
- if (__hasOwnProp$s.call(b, prop))
5205
- __defNormalProp$s(a, prop, b[prop]);
5206
- if (__getOwnPropSymbols$s)
5207
- for (var prop of __getOwnPropSymbols$s(b)) {
5208
- if (__propIsEnum$s.call(b, prop))
5209
- __defNormalProp$s(a, prop, b[prop]);
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]);
5210
5028
  }
5211
5029
  return a;
5212
5030
  };
5213
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
5031
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
5214
5032
  class VizPanel extends SceneObjectBase {
5215
5033
  constructor(state) {
5216
5034
  var _a;
5217
- super(__spreadValues$s({
5035
+ super(__spreadValues$t({
5218
5036
  options: {},
5219
5037
  fieldConfig: { defaults: {}, overrides: [] },
5220
5038
  title: "Title",
@@ -5327,7 +5145,7 @@ class VizPanel extends SceneObjectBase {
5327
5145
  };
5328
5146
  this._onInstanceStateChange = (state) => {
5329
5147
  if (this._panelContext) {
5330
- this._panelContext = __spreadProps$g(__spreadValues$s({}, this._panelContext), {
5148
+ this._panelContext = __spreadProps$h(__spreadValues$t({}, this._panelContext), {
5331
5149
  instanceState: state
5332
5150
  });
5333
5151
  }
@@ -5351,8 +5169,8 @@ class VizPanel extends SceneObjectBase {
5351
5169
  sortBy = sortKey;
5352
5170
  }
5353
5171
  this.onOptionsChange(
5354
- __spreadProps$g(__spreadValues$s({}, this.state.options), {
5355
- 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 })
5356
5174
  }),
5357
5175
  true
5358
5176
  );
@@ -5436,6 +5254,9 @@ class VizPanel extends SceneObjectBase {
5436
5254
  (_a = this._panelContext) != null ? _a : this._panelContext = this.buildPanelContext();
5437
5255
  return this._panelContext;
5438
5256
  }
5257
+ clearFieldConfigCache() {
5258
+ this._dataWithFieldConfig = void 0;
5259
+ }
5439
5260
  applyFieldConfig(rawData) {
5440
5261
  var _a, _b, _c, _d;
5441
5262
  const plugin = this._plugin;
@@ -5459,7 +5280,7 @@ class VizPanel extends SceneObjectBase {
5459
5280
  if (!data.compareArrayValues(newFrames, prevFrames, data.compareDataFrameStructures)) {
5460
5281
  this._structureRev++;
5461
5282
  }
5462
- this._dataWithFieldConfig = __spreadProps$g(__spreadValues$s({}, rawData), {
5283
+ this._dataWithFieldConfig = __spreadProps$h(__spreadValues$t({}, rawData), {
5463
5284
  structureRev: this._structureRev,
5464
5285
  series: newFrames
5465
5286
  });
@@ -5602,25 +5423,25 @@ function getMessageFromError(err) {
5602
5423
  return JSON.stringify(err);
5603
5424
  }
5604
5425
 
5605
- var __defProp$r = Object.defineProperty;
5606
- var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
5607
- var __hasOwnProp$r = Object.prototype.hasOwnProperty;
5608
- var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
5609
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5610
- 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) => {
5611
5432
  for (var prop in b || (b = {}))
5612
- if (__hasOwnProp$r.call(b, prop))
5613
- __defNormalProp$r(a, prop, b[prop]);
5614
- if (__getOwnPropSymbols$r)
5615
- for (var prop of __getOwnPropSymbols$r(b)) {
5616
- if (__propIsEnum$r.call(b, prop))
5617
- __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]);
5618
5439
  }
5619
5440
  return a;
5620
5441
  };
5621
5442
  class SceneDataLayerBase extends SceneObjectBase {
5622
5443
  constructor(initialState, variableDependencyStatePaths = []) {
5623
- super(__spreadValues$r({
5444
+ super(__spreadValues$s({
5624
5445
  isEnabled: true
5625
5446
  }, initialState));
5626
5447
  this._results = new rxjs.ReplaySubject(1);
@@ -5742,33 +5563,33 @@ function DataLayerControlSwitch({ layer }) {
5742
5563
  }
5743
5564
  const containerStyle$1 = css.css({ display: "flex" });
5744
5565
 
5745
- var __defProp$q = Object.defineProperty;
5746
- var __defProps$f = Object.defineProperties;
5747
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
5748
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
5749
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
5750
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
5751
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5752
- 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) => {
5753
5574
  for (var prop in b || (b = {}))
5754
- if (__hasOwnProp$q.call(b, prop))
5755
- __defNormalProp$q(a, prop, b[prop]);
5756
- if (__getOwnPropSymbols$q)
5757
- for (var prop of __getOwnPropSymbols$q(b)) {
5758
- if (__propIsEnum$q.call(b, prop))
5759
- __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]);
5760
5581
  }
5761
5582
  return a;
5762
5583
  };
5763
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
5584
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
5764
5585
  var __objRest$2 = (source, exclude) => {
5765
5586
  var target = {};
5766
5587
  for (var prop in source)
5767
- if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
5588
+ if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
5768
5589
  target[prop] = source[prop];
5769
- if (source != null && __getOwnPropSymbols$q)
5770
- for (var prop of __getOwnPropSymbols$q(source)) {
5771
- 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))
5772
5593
  target[prop] = source[prop];
5773
5594
  }
5774
5595
  return target;
@@ -5777,7 +5598,7 @@ const standardAnnotationSupport = {
5777
5598
  prepareAnnotation: (json) => {
5778
5599
  if (lodash.isString(json == null ? void 0 : json.query)) {
5779
5600
  const _a = json, { query } = _a, rest = __objRest$2(_a, ["query"]);
5780
- return __spreadProps$f(__spreadValues$q({}, rest), {
5601
+ return __spreadProps$g(__spreadValues$r({}, rest), {
5781
5602
  target: {
5782
5603
  refId: "annotation_query",
5783
5604
  query
@@ -5945,25 +5766,25 @@ function shouldUseLegacyRunner(datasource) {
5945
5766
  return !datasource.annotations || legacyRunner.includes(type);
5946
5767
  }
5947
5768
 
5948
- var __defProp$p = Object.defineProperty;
5949
- var __defProps$e = Object.defineProperties;
5950
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
5951
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
5952
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
5953
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
5954
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5955
- 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) => {
5956
5777
  for (var prop in b || (b = {}))
5957
- if (__hasOwnProp$p.call(b, prop))
5958
- __defNormalProp$p(a, prop, b[prop]);
5959
- if (__getOwnPropSymbols$p)
5960
- for (var prop of __getOwnPropSymbols$p(b)) {
5961
- if (__propIsEnum$p.call(b, prop))
5962
- __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]);
5963
5784
  }
5964
5785
  return a;
5965
5786
  };
5966
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
5787
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
5967
5788
  let counter = 100;
5968
5789
  function getNextRequestId() {
5969
5790
  return "AQ" + counter++;
@@ -5986,8 +5807,8 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
5986
5807
  }))
5987
5808
  );
5988
5809
  }
5989
- const processor = __spreadValues$p(__spreadValues$p({}, standardAnnotationSupport), datasource.annotations);
5990
- 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);
5991
5812
  const annotation = processor.prepareAnnotation(annotationWithDefaults);
5992
5813
  if (!annotation) {
5993
5814
  return rxjs.of({
@@ -6010,7 +5831,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6010
5831
  __annotation: { text: annotation.name, value: annotation },
6011
5832
  __sceneObject: { text: "__sceneObject", value: layer }
6012
5833
  };
6013
- const queryRequest = __spreadValues$p(__spreadProps$e(__spreadValues$p({
5834
+ const queryRequest = __spreadValues$q(__spreadProps$f(__spreadValues$q({
6014
5835
  startTime: Date.now(),
6015
5836
  requestId: getNextRequestId(),
6016
5837
  range: timeRange.state.value,
@@ -6020,7 +5841,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6020
5841
  app: data.CoreApp.Dashboard,
6021
5842
  timezone: timeRange.getTimeZone(),
6022
5843
  targets: [
6023
- __spreadProps$e(__spreadValues$p({}, processedQuery), {
5844
+ __spreadProps$f(__spreadValues$q({}, processedQuery), {
6024
5845
  refId: "Anno"
6025
5846
  })
6026
5847
  ]
@@ -6038,7 +5859,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6038
5859
  data$1.forEach((frame) => {
6039
5860
  var _a2;
6040
5861
  if (!((_a2 = frame.meta) == null ? void 0 : _a2.dataTopic)) {
6041
- 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 });
6042
5863
  }
6043
5864
  });
6044
5865
  return processor.processEvents(annotation, data$1).pipe(
@@ -6053,19 +5874,19 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6053
5874
  );
6054
5875
  }
6055
5876
 
6056
- var __defProp$o = Object.defineProperty;
6057
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
6058
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
6059
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
6060
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6061
- 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) => {
6062
5883
  for (var prop in b || (b = {}))
6063
- if (__hasOwnProp$o.call(b, prop))
6064
- __defNormalProp$o(a, prop, b[prop]);
6065
- if (__getOwnPropSymbols$o)
6066
- for (var prop of __getOwnPropSymbols$o(b)) {
6067
- if (__propIsEnum$o.call(b, prop))
6068
- __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]);
6069
5890
  }
6070
5891
  return a;
6071
5892
  };
@@ -6076,7 +5897,7 @@ function postProcessQueryResult(annotation, results) {
6076
5897
  }
6077
5898
  const processed = results.map((item) => {
6078
5899
  var _a;
6079
- const processedItem = __spreadValues$o({}, item);
5900
+ const processedItem = __spreadValues$p({}, item);
6080
5901
  processedItem.source = annotation;
6081
5902
  processedItem.color = runtime.config.theme2.visualization.getColorByName(annotation.iconColor);
6082
5903
  processedItem.type = annotation.name;
@@ -6125,29 +5946,29 @@ function isPanelAlert(event) {
6125
5946
  return event.eventType === "panel-alert";
6126
5947
  }
6127
5948
 
6128
- var __defProp$n = Object.defineProperty;
6129
- var __defProps$d = Object.defineProperties;
6130
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
6131
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
6132
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
6133
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
6134
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6135
- 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) => {
6136
5957
  for (var prop in b || (b = {}))
6137
- if (__hasOwnProp$n.call(b, prop))
6138
- __defNormalProp$n(a, prop, b[prop]);
6139
- if (__getOwnPropSymbols$n)
6140
- for (var prop of __getOwnPropSymbols$n(b)) {
6141
- if (__propIsEnum$n.call(b, prop))
6142
- __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]);
6143
5964
  }
6144
5965
  return a;
6145
5966
  };
6146
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
5967
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
6147
5968
  class AnnotationsDataLayer extends SceneDataLayerBase {
6148
5969
  constructor(initialState) {
6149
5970
  super(
6150
- __spreadValues$n({
5971
+ __spreadValues$o({
6151
5972
  isEnabled: true
6152
5973
  }, initialState),
6153
5974
  ["query"]
@@ -6195,7 +6016,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
6195
6016
  this.publishResults(stateUpdate);
6196
6017
  });
6197
6018
  } catch (e) {
6198
- this.publishResults(__spreadProps$d(__spreadValues$n({}, emptyPanelData), {
6019
+ this.publishResults(__spreadProps$e(__spreadValues$o({}, emptyPanelData), {
6199
6020
  state: schema.LoadingState.Error,
6200
6021
  errors: [
6201
6022
  {
@@ -6212,9 +6033,9 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
6212
6033
  processEvents(query, events) {
6213
6034
  let processedEvents = postProcessQueryResult(query, events.events || []);
6214
6035
  processedEvents = dedupAnnotations(processedEvents);
6215
- const stateUpdate = __spreadProps$d(__spreadValues$n({}, emptyPanelData), { state: events.state });
6036
+ const stateUpdate = __spreadProps$e(__spreadValues$o({}, emptyPanelData), { state: events.state });
6216
6037
  const df = data.arrayToDataFrame(processedEvents);
6217
- df.meta = __spreadProps$d(__spreadValues$n({}, df.meta), {
6038
+ df.meta = __spreadProps$e(__spreadValues$o({}, df.meta), {
6218
6039
  dataTopic: data.DataTopic.Annotations
6219
6040
  });
6220
6041
  stateUpdate.series = [df];
@@ -6267,28 +6088,28 @@ class SceneTimeRangeTransformerBase extends SceneObjectBase {
6267
6088
  }
6268
6089
  }
6269
6090
 
6270
- var __defProp$m = Object.defineProperty;
6271
- var __defProps$c = Object.defineProperties;
6272
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
6273
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
6274
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
6275
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
6276
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6277
- 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) => {
6278
6099
  for (var prop in b || (b = {}))
6279
- if (__hasOwnProp$m.call(b, prop))
6280
- __defNormalProp$m(a, prop, b[prop]);
6281
- if (__getOwnPropSymbols$m)
6282
- for (var prop of __getOwnPropSymbols$m(b)) {
6283
- if (__propIsEnum$m.call(b, prop))
6284
- __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]);
6285
6106
  }
6286
6107
  return a;
6287
6108
  };
6288
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
6109
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
6289
6110
  class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6290
6111
  constructor(state) {
6291
- super(__spreadProps$c(__spreadValues$m({}, state), {
6112
+ super(__spreadProps$d(__spreadValues$n({}, state), {
6292
6113
  timeZone: state.timeZone,
6293
6114
  from: "now-6h",
6294
6115
  to: "now",
@@ -6296,7 +6117,7 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6296
6117
  }));
6297
6118
  }
6298
6119
  ancestorTimeRangeChanged(timeRange) {
6299
- this.setState(__spreadProps$c(__spreadValues$m({}, timeRange), {
6120
+ this.setState(__spreadProps$d(__spreadValues$n({}, timeRange), {
6300
6121
  timeZone: this.state.timeZone,
6301
6122
  value: evaluateTimeRange(
6302
6123
  timeRange.from,
@@ -6324,25 +6145,25 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6324
6145
  }
6325
6146
  }
6326
6147
 
6327
- var __defProp$l = Object.defineProperty;
6328
- var __defProps$b = Object.defineProperties;
6329
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
6330
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
6331
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
6332
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
6333
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6334
- 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) => {
6335
6156
  for (var prop in b || (b = {}))
6336
- if (__hasOwnProp$l.call(b, prop))
6337
- __defNormalProp$l(a, prop, b[prop]);
6338
- if (__getOwnPropSymbols$l)
6339
- for (var prop of __getOwnPropSymbols$l(b)) {
6340
- if (__propIsEnum$l.call(b, prop))
6341
- __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]);
6342
6163
  }
6343
6164
  return a;
6344
6165
  };
6345
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
6166
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
6346
6167
  class SceneDataLayerSetBase extends SceneObjectBase {
6347
6168
  constructor() {
6348
6169
  super(...arguments);
@@ -6366,7 +6187,7 @@ class SceneDataLayerSetBase extends SceneObjectBase {
6366
6187
  series = series.concat(result.data.series);
6367
6188
  }
6368
6189
  }
6369
- const combinedData = __spreadProps$b(__spreadValues$l({}, emptyPanelData), { series });
6190
+ const combinedData = __spreadProps$c(__spreadValues$m({}, emptyPanelData), { series });
6370
6191
  this._results.next({ origin: this, data: combinedData });
6371
6192
  this.setStateHelper({ data: combinedData });
6372
6193
  }
@@ -6415,25 +6236,25 @@ SceneDataLayerSet.Component = ({ model }) => {
6415
6236
  })));
6416
6237
  };
6417
6238
 
6418
- var __defProp$k = Object.defineProperty;
6419
- var __defProps$a = Object.defineProperties;
6420
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
6421
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
6422
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
6423
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
6424
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6425
- 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) => {
6426
6247
  for (var prop in b || (b = {}))
6427
- if (__hasOwnProp$k.call(b, prop))
6428
- __defNormalProp$k(a, prop, b[prop]);
6429
- if (__getOwnPropSymbols$k)
6430
- for (var prop of __getOwnPropSymbols$k(b)) {
6431
- if (__propIsEnum$k.call(b, prop))
6432
- __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]);
6433
6254
  }
6434
6255
  return a;
6435
6256
  };
6436
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
6257
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
6437
6258
  class SceneDataTransformer extends SceneObjectBase {
6438
6259
  constructor(state) {
6439
6260
  super(state);
@@ -6510,7 +6331,7 @@ class SceneDataTransformer extends SceneObjectBase {
6510
6331
  const { series, annotations } = this._prevDataFromSource;
6511
6332
  if (data.series === series && data.annotations === annotations) {
6512
6333
  if (this.state.data && data.state !== this.state.data.state) {
6513
- 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 }) });
6514
6335
  }
6515
6336
  return true;
6516
6337
  }
@@ -6558,7 +6379,7 @@ class SceneDataTransformer extends SceneObjectBase {
6558
6379
  rxjs.map((values) => {
6559
6380
  const transformedSeries = values[0];
6560
6381
  const transformedAnnotations = values[1];
6561
- return __spreadProps$a(__spreadValues$k({}, data$1), {
6382
+ return __spreadProps$b(__spreadValues$l({}, data$1), {
6562
6383
  series: transformedSeries,
6563
6384
  annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
6564
6385
  });
@@ -6569,7 +6390,7 @@ class SceneDataTransformer extends SceneObjectBase {
6569
6390
  const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
6570
6391
  const transformationError = runtime.toDataQueryError(err);
6571
6392
  transformationError.message = `Error transforming data: ${transformationError.message}`;
6572
- const result = __spreadProps$a(__spreadValues$k({}, data$1), {
6393
+ const result = __spreadProps$b(__spreadValues$l({}, data$1), {
6573
6394
  state: data.LoadingState.Error,
6574
6395
  errors: [...sourceErr, transformationError]
6575
6396
  });
@@ -6902,28 +6723,28 @@ class SceneVariableSetVariableDependencyHandler {
6902
6723
  }
6903
6724
  }
6904
6725
 
6905
- var __defProp$j = Object.defineProperty;
6906
- var __defProps$9 = Object.defineProperties;
6907
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
6908
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
6909
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
6910
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
6911
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6912
- var __spreadValues$j = (a, b) => {
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) => {
6913
6734
  for (var prop in b || (b = {}))
6914
- if (__hasOwnProp$j.call(b, prop))
6915
- __defNormalProp$j(a, prop, b[prop]);
6916
- if (__getOwnPropSymbols$j)
6917
- for (var prop of __getOwnPropSymbols$j(b)) {
6918
- if (__propIsEnum$j.call(b, prop))
6919
- __defNormalProp$j(a, prop, b[prop]);
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]);
6920
6741
  }
6921
6742
  return a;
6922
6743
  };
6923
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
6744
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
6924
6745
  class ConstantVariable extends SceneObjectBase {
6925
6746
  constructor(initialState) {
6926
- super(__spreadProps$9(__spreadValues$j({
6747
+ super(__spreadProps$a(__spreadValues$k({
6927
6748
  type: "constant",
6928
6749
  value: "",
6929
6750
  name: ""
@@ -6936,25 +6757,25 @@ class ConstantVariable extends SceneObjectBase {
6936
6757
  }
6937
6758
  }
6938
6759
 
6939
- var __defProp$i = Object.defineProperty;
6940
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6941
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6942
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6943
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6944
- 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) => {
6945
6766
  for (var prop in b || (b = {}))
6946
- if (__hasOwnProp$i.call(b, prop))
6947
- __defNormalProp$i(a, prop, b[prop]);
6948
- if (__getOwnPropSymbols$i)
6949
- for (var prop of __getOwnPropSymbols$i(b)) {
6950
- if (__propIsEnum$i.call(b, prop))
6951
- __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]);
6952
6773
  }
6953
6774
  return a;
6954
6775
  };
6955
6776
  class CustomVariable extends MultiValueVariable {
6956
6777
  constructor(initialState) {
6957
- super(__spreadValues$i({
6778
+ super(__spreadValues$j({
6958
6779
  type: "custom",
6959
6780
  query: "",
6960
6781
  value: "",
@@ -6988,25 +6809,25 @@ CustomVariable.Component = ({ model }) => {
6988
6809
  return renderSelectForVariable(model);
6989
6810
  };
6990
6811
 
6991
- var __defProp$h = Object.defineProperty;
6992
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
6993
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
6994
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
6995
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6996
- 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) => {
6997
6818
  for (var prop in b || (b = {}))
6998
- if (__hasOwnProp$h.call(b, prop))
6999
- __defNormalProp$h(a, prop, b[prop]);
7000
- if (__getOwnPropSymbols$h)
7001
- for (var prop of __getOwnPropSymbols$h(b)) {
7002
- if (__propIsEnum$h.call(b, prop))
7003
- __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]);
7004
6825
  }
7005
6826
  return a;
7006
6827
  };
7007
6828
  class DataSourceVariable extends MultiValueVariable {
7008
6829
  constructor(initialState) {
7009
- super(__spreadValues$h({
6830
+ super(__spreadValues$i({
7010
6831
  type: "datasource",
7011
6832
  value: "",
7012
6833
  text: "",
@@ -7090,25 +6911,25 @@ const hasCustomVariableSupport = (datasource) => {
7090
6911
  return "query" in variableSupport && "editor" in variableSupport && Boolean(variableSupport.query) && Boolean(variableSupport.editor);
7091
6912
  };
7092
6913
 
7093
- var __defProp$g = Object.defineProperty;
7094
- var __defProps$8 = Object.defineProperties;
7095
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
7096
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
7097
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
7098
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
7099
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7100
- 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) => {
7101
6922
  for (var prop in b || (b = {}))
7102
- if (__hasOwnProp$g.call(b, prop))
7103
- __defNormalProp$g(a, prop, b[prop]);
7104
- if (__getOwnPropSymbols$g)
7105
- for (var prop of __getOwnPropSymbols$g(b)) {
7106
- if (__propIsEnum$g.call(b, prop))
7107
- __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]);
7108
6929
  }
7109
6930
  return a;
7110
6931
  };
7111
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
6932
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
7112
6933
  class StandardQueryRunner {
7113
6934
  constructor(datasource, _runRequest = runtime.getRunRequest()) {
7114
6935
  this.datasource = datasource;
@@ -7145,7 +6966,7 @@ class LegacyQueryRunner {
7145
6966
  return getEmptyMetricFindValueObservable();
7146
6967
  }
7147
6968
  return rxjs.from(
7148
- this.datasource.metricFindQuery(variable.state.query, __spreadProps$8(__spreadValues$g({}, request), {
6969
+ this.datasource.metricFindQuery(variable.state.query, __spreadProps$9(__spreadValues$h({}, request), {
7149
6970
  variable: {
7150
6971
  name: variable.state.name,
7151
6972
  type: variable.state.type
@@ -7207,7 +7028,7 @@ function ensureVariableQueryModelIsADataQuery(variable) {
7207
7028
  return { query, refId: `variable-${variable.state.name}` };
7208
7029
  }
7209
7030
  if (query.refId == null) {
7210
- return __spreadProps$8(__spreadValues$g({}, query), { refId: `variable-${variable.state.name}` });
7031
+ return __spreadProps$9(__spreadValues$h({}, query), { refId: `variable-${variable.state.name}` });
7211
7032
  }
7212
7033
  return variable.state.query;
7213
7034
  }
@@ -7422,25 +7243,25 @@ function areMetricFindValues(data$1) {
7422
7243
  return false;
7423
7244
  }
7424
7245
 
7425
- var __defProp$f = Object.defineProperty;
7426
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
7427
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
7428
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
7429
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7430
- 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) => {
7431
7252
  for (var prop in b || (b = {}))
7432
- if (__hasOwnProp$f.call(b, prop))
7433
- __defNormalProp$f(a, prop, b[prop]);
7434
- if (__getOwnPropSymbols$f)
7435
- for (var prop of __getOwnPropSymbols$f(b)) {
7436
- if (__propIsEnum$f.call(b, prop))
7437
- __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]);
7438
7259
  }
7439
7260
  return a;
7440
7261
  };
7441
7262
  class QueryVariable extends MultiValueVariable {
7442
7263
  constructor(initialState) {
7443
- super(__spreadValues$f({
7264
+ super(__spreadValues$g({
7444
7265
  type: "query",
7445
7266
  name: "",
7446
7267
  value: "",
@@ -7593,25 +7414,25 @@ function queryMetricTree(query) {
7593
7414
  return queryTree(children, query.split("."), 0);
7594
7415
  }
7595
7416
 
7596
- var __defProp$e = Object.defineProperty;
7597
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
7598
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
7599
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
7600
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7601
- 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) => {
7602
7423
  for (var prop in b || (b = {}))
7603
- if (__hasOwnProp$e.call(b, prop))
7604
- __defNormalProp$e(a, prop, b[prop]);
7605
- if (__getOwnPropSymbols$e)
7606
- for (var prop of __getOwnPropSymbols$e(b)) {
7607
- if (__propIsEnum$e.call(b, prop))
7608
- __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]);
7609
7430
  }
7610
7431
  return a;
7611
7432
  };
7612
7433
  class TestVariable extends MultiValueVariable {
7613
7434
  constructor(initialState, isLazy = false) {
7614
- super(__spreadValues$e({
7435
+ super(__spreadValues$f({
7615
7436
  type: "custom",
7616
7437
  name: "Test",
7617
7438
  value: "Value",
@@ -7720,25 +7541,25 @@ function VariableValueInput({ model }) {
7720
7541
  });
7721
7542
  }
7722
7543
 
7723
- var __defProp$d = Object.defineProperty;
7724
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7725
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7726
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7727
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7728
- 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) => {
7729
7550
  for (var prop in b || (b = {}))
7730
- if (__hasOwnProp$d.call(b, prop))
7731
- __defNormalProp$d(a, prop, b[prop]);
7732
- if (__getOwnPropSymbols$d)
7733
- for (var prop of __getOwnPropSymbols$d(b)) {
7734
- if (__propIsEnum$d.call(b, prop))
7735
- __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]);
7736
7557
  }
7737
7558
  return a;
7738
7559
  };
7739
7560
  class TextBoxVariable extends SceneObjectBase {
7740
7561
  constructor(initialState) {
7741
- super(__spreadValues$d({
7562
+ super(__spreadValues$e({
7742
7563
  type: "textbox",
7743
7564
  value: "",
7744
7565
  name: ""
@@ -7775,28 +7596,28 @@ TextBoxVariable.Component = ({ model }) => {
7775
7596
  });
7776
7597
  };
7777
7598
 
7778
- var __defProp$c = Object.defineProperty;
7779
- var __defProps$7 = Object.defineProperties;
7780
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
7781
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7782
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7783
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7784
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7785
- 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) => {
7786
7607
  for (var prop in b || (b = {}))
7787
- if (__hasOwnProp$c.call(b, prop))
7788
- __defNormalProp$c(a, prop, b[prop]);
7789
- if (__getOwnPropSymbols$c)
7790
- for (var prop of __getOwnPropSymbols$c(b)) {
7791
- if (__propIsEnum$c.call(b, prop))
7792
- __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]);
7793
7614
  }
7794
7615
  return a;
7795
7616
  };
7796
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
7617
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
7797
7618
  class LocalValueVariable extends SceneObjectBase {
7798
7619
  constructor(initialState) {
7799
- super(__spreadProps$7(__spreadValues$c({
7620
+ super(__spreadProps$8(__spreadValues$d({
7800
7621
  type: "system",
7801
7622
  value: "",
7802
7623
  text: "",
@@ -7828,25 +7649,25 @@ class LocalValueVariable extends SceneObjectBase {
7828
7649
  }
7829
7650
  }
7830
7651
 
7831
- var __defProp$b = Object.defineProperty;
7832
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7833
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7834
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7835
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7836
- 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) => {
7837
7658
  for (var prop in b || (b = {}))
7838
- if (__hasOwnProp$b.call(b, prop))
7839
- __defNormalProp$b(a, prop, b[prop]);
7840
- if (__getOwnPropSymbols$b)
7841
- for (var prop of __getOwnPropSymbols$b(b)) {
7842
- if (__propIsEnum$b.call(b, prop))
7843
- __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]);
7844
7665
  }
7845
7666
  return a;
7846
7667
  };
7847
7668
  class IntervalVariable extends SceneObjectBase {
7848
7669
  constructor(initialState) {
7849
- super(__spreadValues$b({
7670
+ super(__spreadValues$c({
7850
7671
  type: "interval",
7851
7672
  value: "",
7852
7673
  intervals: ["1m", "10m", "30m", "1h", "6h", "12h", "1d", "7d", "14d", "30d"],
@@ -8054,7 +7875,7 @@ class EmbeddedScene extends SceneObjectBase {
8054
7875
  EmbeddedScene.Component = EmbeddedSceneRenderer;
8055
7876
  function EmbeddedSceneRenderer({ model }) {
8056
7877
  const { body, controls } = model.useState();
8057
- const styles = ui.useStyles2(getStyles$5);
7878
+ const styles = ui.useStyles2(getStyles$6);
8058
7879
  return /* @__PURE__ */ React__default["default"].createElement("div", {
8059
7880
  className: styles.container
8060
7881
  }, controls && /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -8068,7 +7889,7 @@ function EmbeddedSceneRenderer({ model }) {
8068
7889
  model: body
8069
7890
  })));
8070
7891
  }
8071
- const getStyles$5 = (theme) => {
7892
+ const getStyles$6 = (theme) => {
8072
7893
  return {
8073
7894
  container: css.css({
8074
7895
  flexGrow: 1,
@@ -8171,30 +7992,30 @@ function isSceneGridLayout(child) {
8171
7992
  return child instanceof SceneGridLayout;
8172
7993
  }
8173
7994
 
8174
- var __defProp$a = Object.defineProperty;
8175
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8176
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8177
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8178
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8179
- 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) => {
8180
8001
  for (var prop in b || (b = {}))
8181
- if (__hasOwnProp$a.call(b, prop))
8182
- __defNormalProp$a(a, prop, b[prop]);
8183
- if (__getOwnPropSymbols$a)
8184
- for (var prop of __getOwnPropSymbols$a(b)) {
8185
- if (__propIsEnum$a.call(b, prop))
8186
- __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]);
8187
8008
  }
8188
8009
  return a;
8189
8010
  };
8190
8011
  var __objRest$1 = (source, exclude) => {
8191
8012
  var target = {};
8192
8013
  for (var prop in source)
8193
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
8014
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
8194
8015
  target[prop] = source[prop];
8195
- if (source != null && __getOwnPropSymbols$a)
8196
- for (var prop of __getOwnPropSymbols$a(source)) {
8197
- 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))
8198
8019
  target[prop] = source[prop];
8199
8020
  }
8200
8021
  return target;
@@ -8234,7 +8055,7 @@ const LazyLoader = React__default["default"].forwardRef(
8234
8055
  }
8235
8056
  };
8236
8057
  });
8237
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$a({
8058
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$b({
8238
8059
  id,
8239
8060
  ref: innerRef
8240
8061
  }, rest), loaded && (typeof children === "function" ? children({ isInView }) : children));
@@ -8252,33 +8073,33 @@ LazyLoader.observer = new IntersectionObserver(
8252
8073
  { rootMargin: "100px" }
8253
8074
  );
8254
8075
 
8255
- var __defProp$9 = Object.defineProperty;
8256
- var __defProps$6 = Object.defineProperties;
8257
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
8258
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8259
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8260
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8261
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8262
- 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) => {
8263
8084
  for (var prop in b || (b = {}))
8264
- if (__hasOwnProp$9.call(b, prop))
8265
- __defNormalProp$9(a, prop, b[prop]);
8266
- if (__getOwnPropSymbols$9)
8267
- for (var prop of __getOwnPropSymbols$9(b)) {
8268
- if (__propIsEnum$9.call(b, prop))
8269
- __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]);
8270
8091
  }
8271
8092
  return a;
8272
8093
  };
8273
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
8094
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
8274
8095
  var __objRest = (source, exclude) => {
8275
8096
  var target = {};
8276
8097
  for (var prop in source)
8277
- if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8098
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
8278
8099
  target[prop] = source[prop];
8279
- if (source != null && __getOwnPropSymbols$9)
8280
- for (var prop of __getOwnPropSymbols$9(source)) {
8281
- 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))
8282
8103
  target[prop] = source[prop];
8283
8104
  }
8284
8105
  return target;
@@ -8337,7 +8158,7 @@ const GridItemWrapper = React__default["default"].forwardRef((props, ref) => {
8337
8158
  key: sceneChild.state.key
8338
8159
  });
8339
8160
  if (isLazy) {
8340
- 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), {
8341
8162
  key: sceneChild.state.key,
8342
8163
  "data-griditem-key": sceneChild.state.key,
8343
8164
  className: css.cx(className, props.className),
@@ -8345,7 +8166,7 @@ const GridItemWrapper = React__default["default"].forwardRef((props, ref) => {
8345
8166
  ref
8346
8167
  }), innerContent, children);
8347
8168
  }
8348
- 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), {
8349
8170
  ref,
8350
8171
  key: sceneChild.state.key,
8351
8172
  "data-griditem-key": sceneChild.state.key,
@@ -8375,7 +8196,7 @@ function updateAnimationClass(ref, isDraggable, retry) {
8375
8196
  const ResizeHandle = React__default["default"].forwardRef((_a, ref) => {
8376
8197
  var _b = _a, divProps = __objRest(_b, ["handleAxis"]);
8377
8198
  const customCssClass = ui.useStyles2(getResizeHandleStyles);
8378
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$6(__spreadValues$9({
8199
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$7(__spreadValues$a({
8379
8200
  ref
8380
8201
  }, divProps), {
8381
8202
  className: `${customCssClass} scene-resize-handle`
@@ -8415,60 +8236,60 @@ function getResizeHandleStyles(theme) {
8415
8236
  });
8416
8237
  }
8417
8238
 
8418
- var __defProp$8 = Object.defineProperty;
8419
- var __defProps$5 = Object.defineProperties;
8420
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
8421
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8422
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8423
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8424
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8425
- 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) => {
8426
8247
  for (var prop in b || (b = {}))
8427
- if (__hasOwnProp$8.call(b, prop))
8428
- __defNormalProp$8(a, prop, b[prop]);
8429
- if (__getOwnPropSymbols$8)
8430
- for (var prop of __getOwnPropSymbols$8(b)) {
8431
- if (__propIsEnum$8.call(b, prop))
8432
- __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]);
8433
8254
  }
8434
8255
  return a;
8435
8256
  };
8436
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8257
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
8437
8258
  function fitPanelsInHeight(cells, height) {
8438
8259
  const visibleHeight = height - GRID_CELL_VMARGIN * 4;
8439
8260
  const currentGridHeight = Math.max(...cells.map((cell) => cell.h + cell.y));
8440
8261
  const visibleGridHeight = Math.floor(visibleHeight / (GRID_CELL_HEIGHT + GRID_CELL_VMARGIN));
8441
8262
  const scaleFactor = currentGridHeight / visibleGridHeight;
8442
8263
  return cells.map((cell) => {
8443
- return __spreadProps$5(__spreadValues$8({}, cell), {
8264
+ return __spreadProps$6(__spreadValues$9({}, cell), {
8444
8265
  y: Math.round(cell.y / scaleFactor) || 0,
8445
8266
  h: Math.round(cell.h / scaleFactor) || 1
8446
8267
  });
8447
8268
  });
8448
8269
  }
8449
8270
 
8450
- var __defProp$7 = Object.defineProperty;
8451
- var __defProps$4 = Object.defineProperties;
8452
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8453
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8454
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8455
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8456
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8457
- 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) => {
8458
8279
  for (var prop in b || (b = {}))
8459
- if (__hasOwnProp$7.call(b, prop))
8460
- __defNormalProp$7(a, prop, b[prop]);
8461
- if (__getOwnPropSymbols$7)
8462
- for (var prop of __getOwnPropSymbols$7(b)) {
8463
- if (__propIsEnum$7.call(b, prop))
8464
- __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]);
8465
8286
  }
8466
8287
  return a;
8467
8288
  };
8468
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8289
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8469
8290
  const _SceneGridLayout = class extends SceneObjectBase {
8470
8291
  constructor(state) {
8471
- super(__spreadProps$4(__spreadValues$7({}, state), {
8292
+ super(__spreadProps$5(__spreadValues$8({}, state), {
8472
8293
  children: sortChildrenByPosition(state.children)
8473
8294
  }));
8474
8295
  this._skipOnLayoutChange = false;
@@ -8492,7 +8313,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8492
8313
  height: item.h
8493
8314
  };
8494
8315
  if (!isItemSizeEqual(child.state, nextSize)) {
8495
- child.setState(__spreadValues$7({}, nextSize));
8316
+ child.setState(__spreadValues$8({}, nextSize));
8496
8317
  }
8497
8318
  }
8498
8319
  this.setState({ children: sortChildrenByPosition(this.state.children) });
@@ -8566,7 +8387,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8566
8387
  const yDiff = firstPanelYPos - (rowY + 1);
8567
8388
  let yMax = rowY;
8568
8389
  for (const panel of rowChildren) {
8569
- const newSize = __spreadValues$7({}, panel.state);
8390
+ const newSize = __spreadValues$8({}, panel.state);
8570
8391
  newSize.y = (_b = newSize.y) != null ? _b : rowY;
8571
8392
  newSize.y -= yDiff;
8572
8393
  if (newSize.y !== panel.state.y) {
@@ -8693,7 +8514,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8693
8514
  }
8694
8515
  if (width < 768) {
8695
8516
  this._skipOnLayoutChange = true;
8696
- return cells.map((cell) => __spreadProps$4(__spreadValues$7({}, cell), { w: 24 }));
8517
+ return cells.map((cell) => __spreadProps$5(__spreadValues$8({}, cell), { w: 24 }));
8697
8518
  }
8698
8519
  this._skipOnLayoutChange = false;
8699
8520
  return cells;
@@ -8718,28 +8539,28 @@ function sortGridLayout(layout) {
8718
8539
  return [...layout].sort((a, b) => a.y - b.y || a.x - b.x);
8719
8540
  }
8720
8541
 
8721
- var __defProp$6 = Object.defineProperty;
8722
- var __defProps$3 = Object.defineProperties;
8723
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8724
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8725
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8726
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8727
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8728
- 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) => {
8729
8550
  for (var prop in b || (b = {}))
8730
- if (__hasOwnProp$6.call(b, prop))
8731
- __defNormalProp$6(a, prop, b[prop]);
8732
- if (__getOwnPropSymbols$6)
8733
- for (var prop of __getOwnPropSymbols$6(b)) {
8734
- if (__propIsEnum$6.call(b, prop))
8735
- __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]);
8736
8557
  }
8737
8558
  return a;
8738
8559
  };
8739
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
8560
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8740
8561
  class SceneGridRow extends SceneObjectBase {
8741
8562
  constructor(state) {
8742
- super(__spreadProps$3(__spreadValues$6({
8563
+ super(__spreadProps$4(__spreadValues$7({
8743
8564
  children: state.children || [],
8744
8565
  isCollapsible: state.isCollapsible || true,
8745
8566
  title: state.title || ""
@@ -8904,7 +8725,7 @@ NestedScene.Component = NestedSceneRenderer;
8904
8725
  function NestedSceneRenderer({ model }) {
8905
8726
  const { title, isCollapsed, canCollapse, canRemove, body, controls } = model.useState();
8906
8727
  const gridRow = ui.useStyles2(getSceneGridRowStyles);
8907
- const styles = ui.useStyles2(getStyles$4);
8728
+ const styles = ui.useStyles2(getStyles$5);
8908
8729
  const toolbarControls = (controls != null ? controls : []).map((action) => /* @__PURE__ */ React__default["default"].createElement(action.Component, {
8909
8730
  key: action.state.key,
8910
8731
  model: action
@@ -8939,7 +8760,7 @@ function NestedSceneRenderer({ model }) {
8939
8760
  model: body
8940
8761
  }));
8941
8762
  }
8942
- const getStyles$4 = (theme) => ({
8763
+ const getStyles$5 = (theme) => ({
8943
8764
  wrapper: css.css({
8944
8765
  display: "flex",
8945
8766
  flexDirection: "column",
@@ -9106,30 +8927,30 @@ function getShiftedTimeRange(dir, timeRange, upperLimit) {
9106
8927
  };
9107
8928
  }
9108
8929
 
9109
- var __defProp$5 = Object.defineProperty;
9110
- var __defProps$2 = Object.defineProperties;
9111
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9112
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9113
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9114
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9115
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9116
- 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) => {
9117
8938
  for (var prop in b || (b = {}))
9118
- if (__hasOwnProp$5.call(b, prop))
9119
- __defNormalProp$5(a, prop, b[prop]);
9120
- if (__getOwnPropSymbols$5)
9121
- for (var prop of __getOwnPropSymbols$5(b)) {
9122
- if (__propIsEnum$5.call(b, prop))
9123
- __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]);
9124
8945
  }
9125
8946
  return a;
9126
8947
  };
9127
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8948
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
9128
8949
  const DEFAULT_INTERVALS = ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"];
9129
8950
  class SceneRefreshPicker extends SceneObjectBase {
9130
8951
  constructor(state) {
9131
8952
  var _a, _b, _c;
9132
- super(__spreadProps$2(__spreadValues$5({
8953
+ super(__spreadProps$3(__spreadValues$6({
9133
8954
  refresh: ""
9134
8955
  }, state), {
9135
8956
  autoValue: void 0,
@@ -9210,55 +9031,283 @@ class SceneRefreshPicker extends SceneObjectBase {
9210
9031
  }
9211
9032
  getUrlState() {
9212
9033
  return {
9213
- 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
9214
9210
  };
9215
9211
  }
9216
9212
  updateFromUrl(values) {
9217
- const refresh = values.refresh;
9218
- if (refresh && typeof refresh === "string") {
9219
- this.setState({
9220
- refresh
9221
- });
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
+ }
9222
9228
  }
9223
9229
  }
9224
9230
  }
9225
- SceneRefreshPicker.Component = SceneRefreshPickerRenderer;
9226
- 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 }) {
9227
9260
  var _a;
9228
- const { refresh, intervals, autoEnabled, autoValue, isOnCanvas, primary, withText } = model.useState();
9229
- const isRunning = useQueryControllerState(model);
9230
- let text = refresh === ((_a = ui.RefreshPicker.autoOption) == null ? void 0 : _a.value) ? autoValue : withText ? "Refresh" : void 0;
9231
- let tooltip;
9232
- let width;
9233
- if (isRunning) {
9234
- tooltip = "Cancel all queries";
9235
- if (withText) {
9236
- 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);
9237
9273
  }
9238
- }
9239
- if (withText) {
9240
- width = "96px";
9241
- }
9242
- return /* @__PURE__ */ React__default["default"].createElement(ui.RefreshPicker, {
9243
- showAutoInterval: autoEnabled,
9244
- value: refresh,
9245
- intervals,
9246
- tooltip,
9247
- width,
9248
- text,
9249
- onRefresh: model.onRefresh,
9250
- primary,
9251
- onIntervalChanged: model.onIntervalChanged,
9252
- isLoading: isRunning,
9253
- isOnCanvas: isOnCanvas != null ? isOnCanvas : true
9254
- });
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));
9255
9300
  }
9256
- function useQueryControllerState(model) {
9257
- const queryController = sceneGraph.getQueryController(model);
9258
- if (!queryController) {
9259
- return false;
9260
- }
9261
- 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
+ };
9262
9311
  }
9263
9312
 
9264
9313
  class SceneByFrameRepeater extends SceneObjectBase {
@@ -11125,6 +11174,174 @@ const PanelBuilders = {
11125
11174
  }
11126
11175
  };
11127
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
+
11128
11345
  const sceneUtils = {
11129
11346
  getUrlWithAppState,
11130
11347
  registerRuntimePanelPlugin,
@@ -11149,6 +11366,7 @@ exports.ConstantVariable = ConstantVariable;
11149
11366
  exports.CustomVariable = CustomVariable;
11150
11367
  exports.DataSourceVariable = DataSourceVariable;
11151
11368
  exports.EmbeddedScene = EmbeddedScene;
11369
+ exports.FieldConfigBuilder = FieldConfigBuilder;
11152
11370
  exports.FieldConfigBuilders = FieldConfigBuilders;
11153
11371
  exports.FieldConfigOverridesBuilder = FieldConfigOverridesBuilder;
11154
11372
  exports.GroupByVariable = GroupByVariable;
@@ -11203,7 +11421,10 @@ exports.UrlSyncManager = UrlSyncManager;
11203
11421
  exports.UserActionEvent = UserActionEvent;
11204
11422
  exports.VariableDependencyConfig = VariableDependencyConfig;
11205
11423
  exports.VariableValueControl = VariableValueControl;
11424
+ exports.VariableValueSelectWrapper = VariableValueSelectWrapper;
11206
11425
  exports.VariableValueSelectors = VariableValueSelectors;
11426
+ exports.VizConfigBuilder = VizConfigBuilder;
11427
+ exports.VizConfigBuilders = VizConfigBuilders;
11207
11428
  exports.VizPanel = VizPanel;
11208
11429
  exports.VizPanelBuilder = VizPanelBuilder;
11209
11430
  exports.VizPanelMenu = VizPanelMenu;