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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +41 -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 +84 -88
  17. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  18. package/dist/esm/querying/extraQueryProcessingOperator.js +46 -0
  19. package/dist/esm/querying/extraQueryProcessingOperator.js.map +1 -0
  20. package/dist/esm/utils/writeSceneLog.js +5 -1
  21. package/dist/esm/utils/writeSceneLog.js.map +1 -1
  22. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js +3 -37
  23. package/dist/esm/variables/adhoc/AdHocFilterRenderer.js.map +1 -1
  24. package/dist/esm/variables/components/VariableValueSelect.js +11 -11
  25. package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
  26. package/dist/esm/variables/components/getOptionSearcher.js +8 -1
  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 +1128 -935
  36. package/dist/index.js.map +1 -1
  37. package/package.json +5 -8
  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,13 +2765,20 @@ class CustomAllValue {
2945
2765
  }
2946
2766
  }
2947
2767
 
2948
- function getOptionSearcher(options, includeAll, limit = 1e4) {
2768
+ function getOptionSearcher(options, includeAll, value, text) {
2949
2769
  const ufuzzy = new uFuzzy__default["default"]();
2950
2770
  let allOptions = options;
2951
2771
  const haystack = [];
2772
+ const limit = 1e4;
2952
2773
  if (includeAll) {
2953
2774
  allOptions = [{ value: ALL_VARIABLE_VALUE, label: ALL_VARIABLE_TEXT }, ...allOptions];
2954
2775
  }
2776
+ if (!Array.isArray(value)) {
2777
+ const current = options.find((x) => x.value === value);
2778
+ if (!current) {
2779
+ allOptions = [{ value, label: String(text) }, ...allOptions];
2780
+ }
2781
+ }
2955
2782
  return (search) => {
2956
2783
  if (search === "") {
2957
2784
  if (allOptions.length > limit) {
@@ -2983,33 +2810,33 @@ function getOptionSearcher(options, includeAll, limit = 1e4) {
2983
2810
  };
2984
2811
  }
2985
2812
 
2986
- var __defProp$z = Object.defineProperty;
2987
- var __defProps$n = Object.defineProperties;
2988
- var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
2989
- var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
2990
- var __hasOwnProp$z = Object.prototype.hasOwnProperty;
2991
- var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
2992
- var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2993
- var __spreadValues$z = (a, b) => {
2813
+ var __defProp$A = Object.defineProperty;
2814
+ var __defProps$o = Object.defineProperties;
2815
+ var __getOwnPropDescs$o = Object.getOwnPropertyDescriptors;
2816
+ var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
2817
+ var __hasOwnProp$A = Object.prototype.hasOwnProperty;
2818
+ var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
2819
+ var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2820
+ var __spreadValues$A = (a, b) => {
2994
2821
  for (var prop in b || (b = {}))
2995
- if (__hasOwnProp$z.call(b, prop))
2996
- __defNormalProp$z(a, prop, b[prop]);
2997
- if (__getOwnPropSymbols$z)
2998
- for (var prop of __getOwnPropSymbols$z(b)) {
2999
- if (__propIsEnum$z.call(b, prop))
3000
- __defNormalProp$z(a, prop, b[prop]);
2822
+ if (__hasOwnProp$A.call(b, prop))
2823
+ __defNormalProp$A(a, prop, b[prop]);
2824
+ if (__getOwnPropSymbols$A)
2825
+ for (var prop of __getOwnPropSymbols$A(b)) {
2826
+ if (__propIsEnum$A.call(b, prop))
2827
+ __defNormalProp$A(a, prop, b[prop]);
3001
2828
  }
3002
2829
  return a;
3003
2830
  };
3004
- var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
2831
+ var __spreadProps$o = (a, b) => __defProps$o(a, __getOwnPropDescs$o(b));
3005
2832
  var __objRest$3 = (source, exclude) => {
3006
2833
  var target = {};
3007
2834
  for (var prop in source)
3008
- if (__hasOwnProp$z.call(source, prop) && exclude.indexOf(prop) < 0)
2835
+ if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
3009
2836
  target[prop] = source[prop];
3010
- if (source != null && __getOwnPropSymbols$z)
3011
- for (var prop of __getOwnPropSymbols$z(source)) {
3012
- if (exclude.indexOf(prop) < 0 && __propIsEnum$z.call(source, prop))
2837
+ if (source != null && __getOwnPropSymbols$A)
2838
+ for (var prop of __getOwnPropSymbols$A(source)) {
2839
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
3013
2840
  target[prop] = source[prop];
3014
2841
  }
3015
2842
  return target;
@@ -3020,8 +2847,8 @@ function VariableValueSelect({ model }) {
3020
2847
  const [inputValue, setInputValue] = React.useState("");
3021
2848
  const [hasCustomValue, setHasCustomValue] = React.useState(false);
3022
2849
  const optionSearcher = React.useMemo(
3023
- () => getOptionSearcher(options, includeAll),
3024
- [options, includeAll]
2850
+ () => getOptionSearcher(options, includeAll, value, text),
2851
+ [options, includeAll, value, text]
3025
2852
  );
3026
2853
  const onInputChange = (value2, { action }) => {
3027
2854
  if (action === "input-change") {
@@ -3044,7 +2871,6 @@ function VariableValueSelect({ model }) {
3044
2871
  };
3045
2872
  return /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
3046
2873
  id: key,
3047
- isValidNewOption: (inputValue2) => inputValue2.trim().length > 0,
3048
2874
  placeholder: "Select value",
3049
2875
  width: "auto",
3050
2876
  value,
@@ -3067,13 +2893,13 @@ function VariableValueSelect({ model }) {
3067
2893
  });
3068
2894
  }
3069
2895
  function VariableValueSelectMulti({ model }) {
3070
- const { value, options, key, maxVisibleValues, noValueOnClear, includeAll } = model.useState();
2896
+ const { value, text, options, key, maxVisibleValues, noValueOnClear, includeAll } = model.useState();
3071
2897
  const arrayValue = React.useMemo(() => lodash.isArray(value) ? value : [value], [value]);
3072
2898
  const [uncommittedValue, setUncommittedValue] = React.useState(arrayValue);
3073
2899
  const [inputValue, setInputValue] = React.useState("");
3074
2900
  const optionSearcher = React.useMemo(
3075
- () => getOptionSearcher(options, includeAll),
3076
- [options, includeAll]
2901
+ () => getOptionSearcher(options, includeAll, value, text),
2902
+ [options, includeAll, value, text]
3077
2903
  );
3078
2904
  React.useEffect(() => {
3079
2905
  setUncommittedValue(arrayValue);
@@ -3133,25 +2959,26 @@ const OptionWithCheckbox = ({
3133
2959
  isSelected,
3134
2960
  renderOptionLabel
3135
2961
  }) => {
2962
+ var _b;
3136
2963
  const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
3137
2964
  const theme = ui.useTheme2();
3138
2965
  const selectStyles = ui.getSelectStyles(theme);
3139
2966
  const optionStyles = ui.useStyles2(getOptionStyles);
3140
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$n(__spreadValues$z({
2967
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$o(__spreadValues$A({
3141
2968
  ref: innerRef,
3142
2969
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
3143
2970
  }, rest), {
3144
- "aria-label": "Select option",
3145
- "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(
3146
- data.label || String(data.value)
3147
- ),
2971
+ "data-testid": e2eSelectors.selectors.components.Select.option,
3148
2972
  title: data.title
3149
2973
  }), /* @__PURE__ */ React__default["default"].createElement("div", {
3150
2974
  className: optionStyles.checkbox
3151
2975
  }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
3152
2976
  value: isSelected
3153
2977
  })), /* @__PURE__ */ React__default["default"].createElement("div", {
3154
- className: selectStyles.optionBody
2978
+ className: selectStyles.optionBody,
2979
+ "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(
2980
+ (_b = data.label) != null ? _b : String(data.value)
2981
+ )
3155
2982
  }, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
3156
2983
  };
3157
2984
  OptionWithCheckbox.displayName = "SelectMenuOptions";
@@ -3231,28 +3058,28 @@ function fromUrlValues(urlValues) {
3231
3058
  );
3232
3059
  }
3233
3060
 
3234
- var __defProp$y = Object.defineProperty;
3235
- var __defProps$m = Object.defineProperties;
3236
- var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
3237
- var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
3238
- var __hasOwnProp$y = Object.prototype.hasOwnProperty;
3239
- var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
3240
- var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3241
- var __spreadValues$y = (a, b) => {
3061
+ var __defProp$z = Object.defineProperty;
3062
+ var __defProps$n = Object.defineProperties;
3063
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
3064
+ var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
3065
+ var __hasOwnProp$z = Object.prototype.hasOwnProperty;
3066
+ var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
3067
+ var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3068
+ var __spreadValues$z = (a, b) => {
3242
3069
  for (var prop in b || (b = {}))
3243
- if (__hasOwnProp$y.call(b, prop))
3244
- __defNormalProp$y(a, prop, b[prop]);
3245
- if (__getOwnPropSymbols$y)
3246
- for (var prop of __getOwnPropSymbols$y(b)) {
3247
- if (__propIsEnum$y.call(b, prop))
3248
- __defNormalProp$y(a, prop, b[prop]);
3070
+ if (__hasOwnProp$z.call(b, prop))
3071
+ __defNormalProp$z(a, prop, b[prop]);
3072
+ if (__getOwnPropSymbols$z)
3073
+ for (var prop of __getOwnPropSymbols$z(b)) {
3074
+ if (__propIsEnum$z.call(b, prop))
3075
+ __defNormalProp$z(a, prop, b[prop]);
3249
3076
  }
3250
3077
  return a;
3251
3078
  };
3252
- var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
3079
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
3253
3080
  class GroupByVariable extends MultiValueVariable {
3254
3081
  constructor(initialState) {
3255
- super(__spreadProps$m(__spreadValues$y({
3082
+ super(__spreadProps$n(__spreadValues$z({
3256
3083
  isMulti: true,
3257
3084
  name: "",
3258
3085
  value: [],
@@ -3370,8 +3197,8 @@ function GroupByVariableRenderer({ model }) {
3370
3197
  const [inputValue, setInputValue] = React.useState("");
3371
3198
  const [uncommittedValue, setUncommittedValue] = React.useState(values);
3372
3199
  const optionSearcher = React.useMemo(
3373
- () => getOptionSearcher(options, includeAll),
3374
- [options, includeAll]
3200
+ () => getOptionSearcher(options, includeAll, value, text),
3201
+ [options, includeAll, value, text]
3375
3202
  );
3376
3203
  React.useEffect(() => {
3377
3204
  setUncommittedValue(values);
@@ -3451,7 +3278,7 @@ function LoadingIndicator(props) {
3451
3278
  }
3452
3279
 
3453
3280
  function ControlsLabel(props) {
3454
- const styles = ui.useStyles2(getStyles$8);
3281
+ const styles = ui.useStyles2(getStyles$9);
3455
3282
  const theme = ui.useTheme2();
3456
3283
  const isVertical = props.layout === "vertical";
3457
3284
  const loadingIndicator = Boolean(props.isLoading) ? /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -3514,7 +3341,7 @@ function ControlsLabel(props) {
3514
3341
  }
3515
3342
  return labelElement;
3516
3343
  }
3517
- const getStyles$8 = (theme) => ({
3344
+ const getStyles$9 = (theme) => ({
3518
3345
  horizontalLabel: css.css({
3519
3346
  background: theme.isDark ? theme.colors.background.primary : theme.colors.background.secondary,
3520
3347
  display: `flex`,
@@ -3549,13 +3376,6 @@ const getStyles$8 = (theme) => ({
3549
3376
  })
3550
3377
  });
3551
3378
 
3552
- function selectableValueToVariableValueOption(value) {
3553
- var _a;
3554
- return {
3555
- label: (_a = value.label) != null ? _a : String(value.value),
3556
- value: value.value
3557
- };
3558
- }
3559
3379
  function keyLabelToOption(key, label) {
3560
3380
  return key !== "" ? {
3561
3381
  value: key,
@@ -3564,30 +3384,16 @@ function keyLabelToOption(key, label) {
3564
3384
  }
3565
3385
  function AdHocFilterRenderer({ filter, model }) {
3566
3386
  var _a, _b;
3567
- const styles = ui.useStyles2(getStyles$7);
3387
+ const styles = ui.useStyles2(getStyles$8);
3568
3388
  const [keys, setKeys] = React.useState([]);
3569
3389
  const [values, setValues] = React.useState([]);
3570
3390
  const [isKeysLoading, setIsKeysLoading] = React.useState(false);
3571
3391
  const [isValuesLoading, setIsValuesLoading] = React.useState(false);
3572
3392
  const [isKeysOpen, setIsKeysOpen] = React.useState(false);
3573
3393
  const [isValuesOpen, setIsValuesOpen] = React.useState(false);
3574
- const [valueInputValue, setValueInputValue] = React.useState("");
3575
- const [valueHasCustomValue, setValueHasCustomValue] = React.useState(false);
3576
3394
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
3577
3395
  const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
3578
- const optionSearcher = React.useMemo(
3579
- () => getOptionSearcher(values.map(selectableValueToVariableValueOption), void 0, 1e3),
3580
- [values]
3581
- );
3582
- const onValueInputChange = (value, { action }) => {
3583
- if (action === "input-change") {
3584
- setValueInputValue(value);
3585
- }
3586
- return value;
3587
- };
3588
- const filteredValueOptions = optionSearcher(valueInputValue);
3589
3396
  const valueSelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
3590
- virtualized: true,
3591
3397
  allowCustomValue: true,
3592
3398
  isValidNewOption: (inputValue) => inputValue.trim().length > 0,
3593
3399
  allowCreateWhileLoading: true,
@@ -3597,33 +3403,21 @@ function AdHocFilterRenderer({ filter, model }) {
3597
3403
  width: "auto",
3598
3404
  value: valueValue,
3599
3405
  placeholder: "Select value",
3600
- options: filteredValueOptions,
3601
- inputValue: valueInputValue,
3602
- onInputChange: onValueInputChange,
3603
- onChange: (v) => {
3604
- model._updateFilter(filter, "value", v);
3605
- if (valueHasCustomValue !== v.__isNew__) {
3606
- setValueHasCustomValue(v.__isNew__);
3607
- }
3608
- },
3406
+ options: values,
3407
+ onChange: (v) => model._updateFilter(filter, "value", v),
3609
3408
  isOpen: isValuesOpen && !isValuesLoading,
3610
3409
  isLoading: isValuesLoading,
3611
3410
  autoFocus: filter.key !== "" && filter.value === "",
3612
3411
  openMenuOnFocus: true,
3613
3412
  onOpenMenu: async () => {
3614
- var _a2;
3615
3413
  setIsValuesLoading(true);
3616
3414
  setIsValuesOpen(true);
3617
3415
  const values2 = await model._getValuesFor(filter);
3618
3416
  setIsValuesLoading(false);
3619
3417
  setValues(values2);
3620
- if (valueHasCustomValue) {
3621
- setValueInputValue((_a2 = valueValue == null ? void 0 : valueValue.label) != null ? _a2 : "");
3622
- }
3623
3418
  },
3624
3419
  onCloseMenu: () => {
3625
3420
  setIsValuesOpen(false);
3626
- setValueInputValue("");
3627
3421
  }
3628
3422
  });
3629
3423
  const keySelect = /* @__PURE__ */ React__default["default"].createElement(ui.Select, {
@@ -3695,7 +3489,7 @@ function AdHocFilterRenderer({ filter, model }) {
3695
3489
  onClick: () => model._removeFilter(filter)
3696
3490
  }));
3697
3491
  }
3698
- const getStyles$7 = (theme) => ({
3492
+ const getStyles$8 = (theme) => ({
3699
3493
  field: css.css({
3700
3494
  marginBottom: 0
3701
3495
  }),
@@ -3833,29 +3627,29 @@ function isFilter(filter) {
3833
3627
  return filter !== null && typeof filter.key === "string" && typeof filter.value === "string";
3834
3628
  }
3835
3629
 
3836
- var __defProp$x = Object.defineProperty;
3837
- var __defProps$l = Object.defineProperties;
3838
- var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
3839
- var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
3840
- var __hasOwnProp$x = Object.prototype.hasOwnProperty;
3841
- var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
3842
- var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3843
- var __spreadValues$x = (a, b) => {
3630
+ var __defProp$y = Object.defineProperty;
3631
+ var __defProps$m = Object.defineProperties;
3632
+ var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
3633
+ var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
3634
+ var __hasOwnProp$y = Object.prototype.hasOwnProperty;
3635
+ var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
3636
+ var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3637
+ var __spreadValues$y = (a, b) => {
3844
3638
  for (var prop in b || (b = {}))
3845
- if (__hasOwnProp$x.call(b, prop))
3846
- __defNormalProp$x(a, prop, b[prop]);
3847
- if (__getOwnPropSymbols$x)
3848
- for (var prop of __getOwnPropSymbols$x(b)) {
3849
- if (__propIsEnum$x.call(b, prop))
3850
- __defNormalProp$x(a, prop, b[prop]);
3639
+ if (__hasOwnProp$y.call(b, prop))
3640
+ __defNormalProp$y(a, prop, b[prop]);
3641
+ if (__getOwnPropSymbols$y)
3642
+ for (var prop of __getOwnPropSymbols$y(b)) {
3643
+ if (__propIsEnum$y.call(b, prop))
3644
+ __defNormalProp$y(a, prop, b[prop]);
3851
3645
  }
3852
3646
  return a;
3853
3647
  };
3854
- var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
3648
+ var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
3855
3649
  class AdHocFiltersVariable extends SceneObjectBase {
3856
3650
  constructor(state) {
3857
3651
  var _a, _b;
3858
- super(__spreadValues$x({
3652
+ super(__spreadValues$y({
3859
3653
  type: "adhoc",
3860
3654
  name: (_a = state.name) != null ? _a : "Filters",
3861
3655
  filters: [],
@@ -3892,15 +3686,15 @@ class AdHocFiltersVariable extends SceneObjectBase {
3892
3686
  const propLabelKey = `${prop}Label`;
3893
3687
  if (filter === _wip) {
3894
3688
  if (prop === "value") {
3895
- this.setState({ filters: [...filters, __spreadProps$l(__spreadValues$x({}, _wip), { [prop]: value, [propLabelKey]: label })], _wip: void 0 });
3689
+ this.setState({ filters: [...filters, __spreadProps$m(__spreadValues$y({}, _wip), { [prop]: value, [propLabelKey]: label })], _wip: void 0 });
3896
3690
  } else {
3897
- this.setState({ _wip: __spreadProps$l(__spreadValues$x({}, filter), { [prop]: value, [propLabelKey]: label }) });
3691
+ this.setState({ _wip: __spreadProps$m(__spreadValues$y({}, filter), { [prop]: value, [propLabelKey]: label }) });
3898
3692
  }
3899
3693
  return;
3900
3694
  }
3901
3695
  const updatedFilters = this.state.filters.map((f) => {
3902
3696
  if (f === filter) {
3903
- const updatedFilter = __spreadProps$l(__spreadValues$x({}, f), { [prop]: value, [propLabelKey]: label });
3697
+ const updatedFilter = __spreadProps$m(__spreadValues$y({}, f), { [prop]: value, [propLabelKey]: label });
3904
3698
  if (prop === "key" && filter[prop] !== value) {
3905
3699
  updatedFilter.value = "";
3906
3700
  updatedFilter.valueLabel = "";
@@ -3981,7 +3775,7 @@ function renderExpression(builder, filters) {
3981
3775
  }
3982
3776
  function AdHocFiltersVariableRenderer({ model }) {
3983
3777
  const { filters, readOnly, addFilterButtonText } = model.useState();
3984
- const styles = ui.useStyles2(getStyles$6);
3778
+ const styles = ui.useStyles2(getStyles$7);
3985
3779
  return /* @__PURE__ */ React__default["default"].createElement("div", {
3986
3780
  className: styles.wrapper
3987
3781
  }, filters.map((filter, index) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, {
@@ -3995,7 +3789,7 @@ function AdHocFiltersVariableRenderer({ model }) {
3995
3789
  addFilterButtonText
3996
3790
  }));
3997
3791
  }
3998
- const getStyles$6 = (theme) => ({
3792
+ const getStyles$7 = (theme) => ({
3999
3793
  wrapper: css.css({
4000
3794
  display: "flex",
4001
3795
  flexWrap: "wrap",
@@ -4079,25 +3873,25 @@ function areDifferentLayers(a, b) {
4079
3873
  return false;
4080
3874
  }
4081
3875
 
4082
- var __defProp$w = Object.defineProperty;
4083
- var __defProps$k = Object.defineProperties;
4084
- var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
4085
- var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
4086
- var __hasOwnProp$w = Object.prototype.hasOwnProperty;
4087
- var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
4088
- var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4089
- var __spreadValues$w = (a, b) => {
3876
+ var __defProp$x = Object.defineProperty;
3877
+ var __defProps$l = Object.defineProperties;
3878
+ var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
3879
+ var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
3880
+ var __hasOwnProp$x = Object.prototype.hasOwnProperty;
3881
+ var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
3882
+ var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3883
+ var __spreadValues$x = (a, b) => {
4090
3884
  for (var prop in b || (b = {}))
4091
- if (__hasOwnProp$w.call(b, prop))
4092
- __defNormalProp$w(a, prop, b[prop]);
4093
- if (__getOwnPropSymbols$w)
4094
- for (var prop of __getOwnPropSymbols$w(b)) {
4095
- if (__propIsEnum$w.call(b, prop))
4096
- __defNormalProp$w(a, prop, b[prop]);
3885
+ if (__hasOwnProp$x.call(b, prop))
3886
+ __defNormalProp$x(a, prop, b[prop]);
3887
+ if (__getOwnPropSymbols$x)
3888
+ for (var prop of __getOwnPropSymbols$x(b)) {
3889
+ if (__propIsEnum$x.call(b, prop))
3890
+ __defNormalProp$x(a, prop, b[prop]);
4097
3891
  }
4098
3892
  return a;
4099
3893
  };
4100
- var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
3894
+ var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
4101
3895
  let counter$1 = 100;
4102
3896
  function getNextRequestId$1() {
4103
3897
  return "SQR" + counter$1++;
@@ -4114,70 +3908,6 @@ class SceneQueryRunner extends SceneObjectBase {
4114
3908
  onVariableUpdateCompleted: this.onVariableUpdatesCompleted.bind(this),
4115
3909
  onAnyVariableChanged: this.onAnyVariableChanged.bind(this)
4116
3910
  });
4117
- this.prepareRequests = (timeRange, ds) => {
4118
- const comparer = this.getTimeCompare();
4119
- const { minInterval, queries } = this.state;
4120
- let secondaryRequest;
4121
- let request = __spreadValues$w({
4122
- app: "scenes",
4123
- requestId: getNextRequestId$1(),
4124
- timezone: timeRange.getTimeZone(),
4125
- panelId: 1,
4126
- range: timeRange.state.value,
4127
- interval: "1s",
4128
- intervalMs: 1e3,
4129
- targets: lodash.cloneDeep(queries),
4130
- maxDataPoints: this.getMaxDataPoints(),
4131
- scopedVars: this._scopedVars,
4132
- startTime: Date.now(),
4133
- liveStreaming: this.state.liveStreaming,
4134
- rangeRaw: {
4135
- from: timeRange.state.from,
4136
- to: timeRange.state.to
4137
- },
4138
- cacheTimeout: this.state.cacheTimeout,
4139
- queryCachingTTL: this.state.queryCachingTTL
4140
- }, getEnrichedDataRequest(this));
4141
- if (this._adhocFiltersVar) {
4142
- request.filters = this._adhocFiltersVar.state.filters.filter(isFilterComplete);
4143
- }
4144
- if (this._groupByVar) {
4145
- request.groupByKeys = this._groupByVar.state.value;
4146
- }
4147
- request.targets = request.targets.map((query) => {
4148
- var _a;
4149
- if (!query.datasource || query.datasource.uid !== ds.uid && !((_a = ds.meta) == null ? void 0 : _a.mixed) && runtime.isExpressionReference && !runtime.isExpressionReference(query.datasource)) {
4150
- query.datasource = ds.getRef();
4151
- }
4152
- return query;
4153
- });
4154
- const lowerIntervalLimit = minInterval ? minInterval : ds.interval;
4155
- const norm = data.rangeUtil.calculateInterval(timeRange.state.value, request.maxDataPoints, lowerIntervalLimit);
4156
- request.scopedVars = Object.assign({}, request.scopedVars, {
4157
- __interval: { text: norm.interval, value: norm.interval },
4158
- __interval_ms: { text: norm.intervalMs.toString(), value: norm.intervalMs }
4159
- });
4160
- request.interval = norm.interval;
4161
- request.intervalMs = norm.intervalMs;
4162
- const primaryTimeRange = timeRange.state.value;
4163
- if (comparer) {
4164
- const secondaryTimeRange = comparer.getCompareTimeRange(primaryTimeRange);
4165
- if (secondaryTimeRange) {
4166
- const secondaryTargets = request.targets.filter((query) => query.timeRangeCompare !== false);
4167
- if (secondaryTargets.length) {
4168
- secondaryRequest = __spreadProps$k(__spreadValues$w({}, request), {
4169
- targets: secondaryTargets,
4170
- range: secondaryTimeRange,
4171
- requestId: getNextRequestId$1()
4172
- });
4173
- }
4174
- request = __spreadProps$k(__spreadValues$w({}, request), {
4175
- range: primaryTimeRange
4176
- });
4177
- }
4178
- }
4179
- return [request, secondaryRequest];
4180
- };
4181
3911
  this.onDataReceived = (data$1) => {
4182
3912
  const preProcessedData = data.preProcessPanelData(data$1, this.state.data);
4183
3913
  this._resultAnnotations = data$1.annotations;
@@ -4196,11 +3926,11 @@ class SceneQueryRunner extends SceneObjectBase {
4196
3926
  }
4197
3927
  _onActivate() {
4198
3928
  const timeRange = sceneGraph.getTimeRange(this);
4199
- const comparer = this.getTimeCompare();
4200
- if (comparer) {
3929
+ const providers = this.getClosestExtraQueryProviders();
3930
+ for (const provider of providers) {
4201
3931
  this._subs.add(
4202
- comparer.subscribeToState((n, p) => {
4203
- if (n.compareWith !== p.compareWith) {
3932
+ provider.subscribeToState((n, p) => {
3933
+ if (provider.shouldRerun(p, n)) {
4204
3934
  this.runQueries();
4205
3935
  }
4206
3936
  })
@@ -4259,9 +3989,9 @@ class SceneQueryRunner extends SceneObjectBase {
4259
3989
  return;
4260
3990
  }
4261
3991
  this._layerAnnotations = annotations;
4262
- const baseStateUpdate = this.state.data ? this.state.data : __spreadProps$k(__spreadValues$w({}, emptyPanelData), { timeRange: timeRange.state.value });
3992
+ const baseStateUpdate = this.state.data ? this.state.data : __spreadProps$l(__spreadValues$x({}, emptyPanelData), { timeRange: timeRange.state.value });
4263
3993
  this.setState({
4264
- data: __spreadProps$k(__spreadValues$w({}, baseStateUpdate), {
3994
+ data: __spreadProps$l(__spreadValues$x({}, baseStateUpdate), {
4265
3995
  annotations: [...(_d = this._resultAnnotations) != null ? _d : [], ...annotations],
4266
3996
  alertState: alertState != null ? alertState : (_e = this.state.data) == null ? void 0 : _e.alertState
4267
3997
  })
@@ -4380,7 +4110,7 @@ class SceneQueryRunner extends SceneObjectBase {
4380
4110
  this._dataLayersSub = void 0;
4381
4111
  }
4382
4112
  this.setState({
4383
- data: __spreadProps$k(__spreadValues$w({}, this.state.data), { state: schema.LoadingState.Done })
4113
+ data: __spreadProps$l(__spreadValues$x({}, this.state.data), { state: schema.LoadingState.Done })
4384
4114
  });
4385
4115
  }
4386
4116
  async runWithTimeRange(timeRange) {
@@ -4394,6 +4124,7 @@ class SceneQueryRunner extends SceneObjectBase {
4394
4124
  (_a = this._querySub) == null ? void 0 : _a.unsubscribe();
4395
4125
  if (this._variableDependency.hasDependencyInLoadingState()) {
4396
4126
  writeSceneLog("SceneQueryRunner", "Variable dependency is in loading state, skipping query execution");
4127
+ this.setState({ data: __spreadProps$l(__spreadValues$x({}, this.state.data), { state: schema.LoadingState.Loading }) });
4397
4128
  return;
4398
4129
  }
4399
4130
  const { queries } = this.state;
@@ -4406,16 +4137,18 @@ class SceneQueryRunner extends SceneObjectBase {
4406
4137
  const ds = await getDataSource(datasource, this._scopedVars);
4407
4138
  this.findAndSubscribeToAdHocFilters(datasource == null ? void 0 : datasource.uid);
4408
4139
  const runRequest = runtime.getRunRequest();
4409
- const [request, secondaryRequest] = this.prepareRequests(timeRange, ds);
4140
+ const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds);
4410
4141
  writeSceneLog("SceneQueryRunner", "Starting runRequest", this.state.key);
4411
- let stream = runRequest(ds, request);
4412
- if (secondaryRequest) {
4413
- stream = rxjs.forkJoin([stream, runRequest(ds, secondaryRequest)]).pipe(timeShiftQueryResponseOperator);
4142
+ let stream = runRequest(ds, primary);
4143
+ if (secondaries.length > 0) {
4144
+ const secondaryStreams = secondaries.map((r) => runRequest(ds, r));
4145
+ const op = extraQueryProcessingOperator(processors);
4146
+ stream = rxjs.forkJoin([stream, ...secondaryStreams]).pipe(op);
4414
4147
  }
4415
4148
  stream = stream.pipe(
4416
4149
  registerQueryWithController({
4417
4150
  type: "data",
4418
- request,
4151
+ request: primary,
4419
4152
  origin: this,
4420
4153
  cancel: () => this.cancelQuery()
4421
4154
  })
@@ -4423,7 +4156,7 @@ class SceneQueryRunner extends SceneObjectBase {
4423
4156
  this._querySub = stream.subscribe(this.onDataReceived);
4424
4157
  } catch (err) {
4425
4158
  console.error("PanelQueryRunner Error", err);
4426
- this.onDataReceived(__spreadProps$k(__spreadValues$w(__spreadValues$w({}, emptyPanelData), this.state.data), {
4159
+ this.onDataReceived(__spreadProps$l(__spreadValues$x(__spreadValues$x({}, emptyPanelData), this.state.data), {
4427
4160
  state: schema.LoadingState.Error,
4428
4161
  errors: [runtime.toDataQueryError(err)]
4429
4162
  }));
@@ -4433,16 +4166,72 @@ class SceneQueryRunner extends SceneObjectBase {
4433
4166
  var _a;
4434
4167
  const clone = super.clone(withState);
4435
4168
  if (this._resultAnnotations) {
4436
- clone["_resultAnnotations"] = this._resultAnnotations.map((frame) => __spreadValues$w({}, frame));
4169
+ clone["_resultAnnotations"] = this._resultAnnotations.map((frame) => __spreadValues$x({}, frame));
4437
4170
  }
4438
4171
  if (this._layerAnnotations) {
4439
- clone["_layerAnnotations"] = this._layerAnnotations.map((frame) => __spreadValues$w({}, frame));
4172
+ clone["_layerAnnotations"] = this._layerAnnotations.map((frame) => __spreadValues$x({}, frame));
4440
4173
  }
4441
4174
  clone["_variableValueRecorder"] = this._variableValueRecorder.cloneAndRecordCurrentValuesForSceneObject(this);
4442
4175
  clone["_containerWidth"] = this._containerWidth;
4443
4176
  clone["_results"].next({ origin: this, data: (_a = this.state.data) != null ? _a : emptyPanelData });
4444
4177
  return clone;
4445
4178
  }
4179
+ prepareRequests(timeRange, ds) {
4180
+ var _a;
4181
+ const { minInterval, queries } = this.state;
4182
+ let request = __spreadValues$x({
4183
+ app: "scenes",
4184
+ requestId: getNextRequestId$1(),
4185
+ timezone: timeRange.getTimeZone(),
4186
+ range: timeRange.state.value,
4187
+ interval: "1s",
4188
+ intervalMs: 1e3,
4189
+ targets: lodash.cloneDeep(queries),
4190
+ maxDataPoints: this.getMaxDataPoints(),
4191
+ scopedVars: this._scopedVars,
4192
+ startTime: Date.now(),
4193
+ liveStreaming: this.state.liveStreaming,
4194
+ rangeRaw: {
4195
+ from: timeRange.state.from,
4196
+ to: timeRange.state.to
4197
+ },
4198
+ cacheTimeout: this.state.cacheTimeout,
4199
+ queryCachingTTL: this.state.queryCachingTTL
4200
+ }, getEnrichedDataRequest(this));
4201
+ if (this._adhocFiltersVar) {
4202
+ request.filters = this._adhocFiltersVar.state.filters.filter(isFilterComplete);
4203
+ }
4204
+ if (this._groupByVar) {
4205
+ request.groupByKeys = this._groupByVar.state.value;
4206
+ }
4207
+ request.targets = request.targets.map((query) => {
4208
+ var _a2;
4209
+ if (!query.datasource || query.datasource.uid !== ds.uid && !((_a2 = ds.meta) == null ? void 0 : _a2.mixed) && runtime.isExpressionReference && !runtime.isExpressionReference(query.datasource)) {
4210
+ query.datasource = ds.getRef();
4211
+ }
4212
+ return query;
4213
+ });
4214
+ const lowerIntervalLimit = minInterval ? minInterval : ds.interval;
4215
+ const norm = data.rangeUtil.calculateInterval(timeRange.state.value, request.maxDataPoints, lowerIntervalLimit);
4216
+ request.scopedVars = Object.assign({}, request.scopedVars, {
4217
+ __interval: { text: norm.interval, value: norm.interval },
4218
+ __interval_ms: { text: norm.intervalMs.toString(), value: norm.intervalMs }
4219
+ });
4220
+ request.interval = norm.interval;
4221
+ request.intervalMs = norm.intervalMs;
4222
+ const primaryTimeRange = timeRange.state.value;
4223
+ let secondaryRequests = [];
4224
+ let secondaryProcessors = /* @__PURE__ */ new Map();
4225
+ for (const provider of (_a = this.getClosestExtraQueryProviders()) != null ? _a : []) {
4226
+ for (const { req, processor } of provider.getExtraQueries(request)) {
4227
+ const requestId = getNextRequestId$1();
4228
+ secondaryRequests.push(__spreadProps$l(__spreadValues$x({}, req), { requestId }));
4229
+ secondaryProcessors.set(requestId, processor != null ? processor : passthroughProcessor);
4230
+ }
4231
+ }
4232
+ request.range = primaryTimeRange;
4233
+ return { primary: request, secondaries: secondaryRequests, processors: secondaryProcessors };
4234
+ }
4446
4235
  _combineDataLayers(data) {
4447
4236
  if (this._layerAnnotations && this._layerAnnotations.length > 0) {
4448
4237
  data.annotations = (data.annotations || []).concat(this._layerAnnotations);
@@ -4457,22 +4246,23 @@ class SceneQueryRunner extends SceneObjectBase {
4457
4246
  this.setState({ data: emptyPanelData });
4458
4247
  }
4459
4248
  }
4460
- getTimeCompare() {
4249
+ getClosestExtraQueryProviders() {
4250
+ const found = /* @__PURE__ */ new Map();
4461
4251
  if (!this.parent) {
4462
- return null;
4252
+ return [];
4463
4253
  }
4464
- return getClosest(this.parent, (s) => {
4465
- let found = null;
4466
- if (s instanceof SceneTimeRangeCompare) {
4467
- return s;
4254
+ getClosest(this.parent, (s) => {
4255
+ if (isExtraQueryProvider(s) && !found.has(s.constructor)) {
4256
+ found.set(s.constructor, s);
4468
4257
  }
4469
4258
  s.forEachChild((child) => {
4470
- if (child instanceof SceneTimeRangeCompare) {
4471
- found = child;
4259
+ if (isExtraQueryProvider(child) && !found.has(child.constructor)) {
4260
+ found.set(child.constructor, child);
4472
4261
  }
4473
4262
  });
4474
- return found;
4263
+ return null;
4475
4264
  });
4265
+ return Array.from(found.values());
4476
4266
  }
4477
4267
  findAndSubscribeToAdHocFilters(uid) {
4478
4268
  const filtersVar = findActiveAdHocFilterVariableByUid(uid);
@@ -4671,28 +4461,28 @@ class ActWhenVariableChanged extends SceneObjectBase {
4671
4461
  }
4672
4462
  }
4673
4463
 
4674
- var __defProp$v = Object.defineProperty;
4675
- var __defProps$j = Object.defineProperties;
4676
- var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
4677
- var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
4678
- var __hasOwnProp$v = Object.prototype.hasOwnProperty;
4679
- var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
4680
- var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4681
- var __spreadValues$v = (a, b) => {
4464
+ var __defProp$w = Object.defineProperty;
4465
+ var __defProps$k = Object.defineProperties;
4466
+ var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
4467
+ var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
4468
+ var __hasOwnProp$w = Object.prototype.hasOwnProperty;
4469
+ var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
4470
+ var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4471
+ var __spreadValues$w = (a, b) => {
4682
4472
  for (var prop in b || (b = {}))
4683
- if (__hasOwnProp$v.call(b, prop))
4684
- __defNormalProp$v(a, prop, b[prop]);
4685
- if (__getOwnPropSymbols$v)
4686
- for (var prop of __getOwnPropSymbols$v(b)) {
4687
- if (__propIsEnum$v.call(b, prop))
4688
- __defNormalProp$v(a, prop, b[prop]);
4473
+ if (__hasOwnProp$w.call(b, prop))
4474
+ __defNormalProp$w(a, prop, b[prop]);
4475
+ if (__getOwnPropSymbols$w)
4476
+ for (var prop of __getOwnPropSymbols$w(b)) {
4477
+ if (__propIsEnum$w.call(b, prop))
4478
+ __defNormalProp$w(a, prop, b[prop]);
4689
4479
  }
4690
4480
  return a;
4691
4481
  };
4692
- var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
4482
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
4693
4483
  class CursorSync extends SceneObjectBase {
4694
4484
  constructor(state) {
4695
- super(__spreadProps$j(__spreadValues$v({}, state), {
4485
+ super(__spreadProps$k(__spreadValues$w({}, state), {
4696
4486
  sync: state.sync || schema.DashboardCursorSync.Off
4697
4487
  }));
4698
4488
  this.getEventsBus = (panel) => {
@@ -4956,25 +4746,25 @@ const getAlertStateStyles = (theme) => {
4956
4746
  };
4957
4747
  };
4958
4748
 
4959
- var __defProp$u = Object.defineProperty;
4960
- var __defProps$i = Object.defineProperties;
4961
- var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
4962
- var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
4963
- var __hasOwnProp$u = Object.prototype.hasOwnProperty;
4964
- var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
4965
- var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4966
- var __spreadValues$u = (a, b) => {
4749
+ var __defProp$v = Object.defineProperty;
4750
+ var __defProps$j = Object.defineProperties;
4751
+ var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
4752
+ var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
4753
+ var __hasOwnProp$v = Object.prototype.hasOwnProperty;
4754
+ var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
4755
+ var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4756
+ var __spreadValues$v = (a, b) => {
4967
4757
  for (var prop in b || (b = {}))
4968
- if (__hasOwnProp$u.call(b, prop))
4969
- __defNormalProp$u(a, prop, b[prop]);
4970
- if (__getOwnPropSymbols$u)
4971
- for (var prop of __getOwnPropSymbols$u(b)) {
4972
- if (__propIsEnum$u.call(b, prop))
4973
- __defNormalProp$u(a, prop, b[prop]);
4758
+ if (__hasOwnProp$v.call(b, prop))
4759
+ __defNormalProp$v(a, prop, b[prop]);
4760
+ if (__getOwnPropSymbols$v)
4761
+ for (var prop of __getOwnPropSymbols$v(b)) {
4762
+ if (__propIsEnum$v.call(b, prop))
4763
+ __defNormalProp$v(a, prop, b[prop]);
4974
4764
  }
4975
4765
  return a;
4976
4766
  };
4977
- var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
4767
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
4978
4768
  const displayOverrideRef = "hideSeriesFrom";
4979
4769
  const isHideSeriesOverride = data.isSystemOverrideWithRef(displayOverrideRef);
4980
4770
  function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
@@ -4984,13 +4774,13 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
4984
4774
  if (currentIndex < 0) {
4985
4775
  if (mode === ui.SeriesVisibilityChangeMode.ToggleSelection) {
4986
4776
  const override3 = createOverride$1([displayName, ...getNamesOfHiddenFields(overrides, data)]);
4987
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4777
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
4988
4778
  overrides: [...fieldConfig.overrides, override3]
4989
4779
  });
4990
4780
  }
4991
4781
  const displayNames = getDisplayNames(data, displayName);
4992
4782
  const override2 = createOverride$1(displayNames);
4993
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4783
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
4994
4784
  overrides: [...fieldConfig.overrides, override2]
4995
4785
  });
4996
4786
  }
@@ -5003,22 +4793,22 @@ function seriesVisibilityConfigFactory(label, mode, fieldConfig, data) {
5003
4793
  existing = existing.filter((el) => nameOfHiddenFields.indexOf(el) < 0);
5004
4794
  }
5005
4795
  if (existing[0] === displayName && existing.length === 1) {
5006
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4796
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5007
4797
  overrides: overridesCopy
5008
4798
  });
5009
4799
  }
5010
4800
  const override2 = createOverride$1([displayName, ...nameOfHiddenFields]);
5011
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4801
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5012
4802
  overrides: [...overridesCopy, override2]
5013
4803
  });
5014
4804
  }
5015
4805
  const override = createExtendedOverride(current, displayName);
5016
4806
  if (allFieldsAreExcluded(override, data)) {
5017
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4807
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5018
4808
  overrides: overridesCopy
5019
4809
  });
5020
4810
  }
5021
- return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
4811
+ return __spreadProps$j(__spreadValues$v({}, fieldConfig), {
5022
4812
  overrides: [...overridesCopy, override]
5023
4813
  });
5024
4814
  }
@@ -5043,7 +4833,7 @@ function createOverride$1(names, mode = data.ByNamesMatcherMode.exclude, propert
5043
4833
  }
5044
4834
  },
5045
4835
  properties: [
5046
- __spreadProps$i(__spreadValues$u({}, property), {
4836
+ __spreadProps$j(__spreadValues$v({}, property), {
5047
4837
  value: {
5048
4838
  viz: true,
5049
4839
  legend: false,
@@ -5115,32 +4905,32 @@ const getNamesOfHiddenFields = (overrides, data$1) => {
5115
4905
  return names;
5116
4906
  };
5117
4907
 
5118
- var __defProp$t = Object.defineProperty;
5119
- var __defProps$h = Object.defineProperties;
5120
- var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
5121
- var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
5122
- var __hasOwnProp$t = Object.prototype.hasOwnProperty;
5123
- var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
5124
- var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5125
- var __spreadValues$t = (a, b) => {
4908
+ var __defProp$u = Object.defineProperty;
4909
+ var __defProps$i = Object.defineProperties;
4910
+ var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
4911
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
4912
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
4913
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
4914
+ var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4915
+ var __spreadValues$u = (a, b) => {
5126
4916
  for (var prop in b || (b = {}))
5127
- if (__hasOwnProp$t.call(b, prop))
5128
- __defNormalProp$t(a, prop, b[prop]);
5129
- if (__getOwnPropSymbols$t)
5130
- for (var prop of __getOwnPropSymbols$t(b)) {
5131
- if (__propIsEnum$t.call(b, prop))
5132
- __defNormalProp$t(a, prop, b[prop]);
4917
+ if (__hasOwnProp$u.call(b, prop))
4918
+ __defNormalProp$u(a, prop, b[prop]);
4919
+ if (__getOwnPropSymbols$u)
4920
+ for (var prop of __getOwnPropSymbols$u(b)) {
4921
+ if (__propIsEnum$u.call(b, prop))
4922
+ __defNormalProp$u(a, prop, b[prop]);
5133
4923
  }
5134
4924
  return a;
5135
4925
  };
5136
- var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
4926
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
5137
4927
  const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
5138
4928
  const { overrides } = fieldConfig;
5139
4929
  const currentIndex = fieldConfig.overrides.findIndex((override) => {
5140
4930
  return override.matcher.id === data.FieldMatcherID.byName && override.matcher.options === label;
5141
4931
  });
5142
4932
  if (currentIndex < 0) {
5143
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4933
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5144
4934
  overrides: [...fieldConfig.overrides, createOverride(label, color)]
5145
4935
  });
5146
4936
  }
@@ -5148,19 +4938,19 @@ const changeSeriesColorConfigFactory = (label, color, fieldConfig) => {
5148
4938
  const existing = overridesCopy[currentIndex];
5149
4939
  const propertyIndex = existing.properties.findIndex((p) => p.id === "color");
5150
4940
  if (propertyIndex < 0) {
5151
- overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$t({}, existing), {
4941
+ overridesCopy[currentIndex] = __spreadProps$i(__spreadValues$u({}, existing), {
5152
4942
  properties: [...existing.properties, createProperty(color)]
5153
4943
  });
5154
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4944
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5155
4945
  overrides: overridesCopy
5156
4946
  });
5157
4947
  }
5158
4948
  const propertiesCopy = Array.from(existing.properties);
5159
4949
  propertiesCopy[propertyIndex] = createProperty(color);
5160
- overridesCopy[currentIndex] = __spreadProps$h(__spreadValues$t({}, existing), {
4950
+ overridesCopy[currentIndex] = __spreadProps$i(__spreadValues$u({}, existing), {
5161
4951
  properties: propertiesCopy
5162
4952
  });
5163
- return __spreadProps$h(__spreadValues$t({}, fieldConfig), {
4953
+ return __spreadProps$i(__spreadValues$u({}, fieldConfig), {
5164
4954
  overrides: overridesCopy
5165
4955
  });
5166
4956
  };
@@ -5183,29 +4973,29 @@ const createProperty = (color) => {
5183
4973
  };
5184
4974
  };
5185
4975
 
5186
- var __defProp$s = Object.defineProperty;
5187
- var __defProps$g = Object.defineProperties;
5188
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
5189
- var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
5190
- var __hasOwnProp$s = Object.prototype.hasOwnProperty;
5191
- var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
5192
- var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5193
- var __spreadValues$s = (a, b) => {
4976
+ var __defProp$t = Object.defineProperty;
4977
+ var __defProps$h = Object.defineProperties;
4978
+ var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
4979
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
4980
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
4981
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
4982
+ var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4983
+ var __spreadValues$t = (a, b) => {
5194
4984
  for (var prop in b || (b = {}))
5195
- if (__hasOwnProp$s.call(b, prop))
5196
- __defNormalProp$s(a, prop, b[prop]);
5197
- if (__getOwnPropSymbols$s)
5198
- for (var prop of __getOwnPropSymbols$s(b)) {
5199
- if (__propIsEnum$s.call(b, prop))
5200
- __defNormalProp$s(a, prop, b[prop]);
4985
+ if (__hasOwnProp$t.call(b, prop))
4986
+ __defNormalProp$t(a, prop, b[prop]);
4987
+ if (__getOwnPropSymbols$t)
4988
+ for (var prop of __getOwnPropSymbols$t(b)) {
4989
+ if (__propIsEnum$t.call(b, prop))
4990
+ __defNormalProp$t(a, prop, b[prop]);
5201
4991
  }
5202
4992
  return a;
5203
4993
  };
5204
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
4994
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
5205
4995
  class VizPanel extends SceneObjectBase {
5206
4996
  constructor(state) {
5207
4997
  var _a;
5208
- super(__spreadValues$s({
4998
+ super(__spreadValues$t({
5209
4999
  options: {},
5210
5000
  fieldConfig: { defaults: {}, overrides: [] },
5211
5001
  title: "Title",
@@ -5318,7 +5108,7 @@ class VizPanel extends SceneObjectBase {
5318
5108
  };
5319
5109
  this._onInstanceStateChange = (state) => {
5320
5110
  if (this._panelContext) {
5321
- this._panelContext = __spreadProps$g(__spreadValues$s({}, this._panelContext), {
5111
+ this._panelContext = __spreadProps$h(__spreadValues$t({}, this._panelContext), {
5322
5112
  instanceState: state
5323
5113
  });
5324
5114
  }
@@ -5342,8 +5132,8 @@ class VizPanel extends SceneObjectBase {
5342
5132
  sortBy = sortKey;
5343
5133
  }
5344
5134
  this.onOptionsChange(
5345
- __spreadProps$g(__spreadValues$s({}, this.state.options), {
5346
- legend: __spreadProps$g(__spreadValues$s({}, legendOptions), { sortBy, sortDesc })
5135
+ __spreadProps$h(__spreadValues$t({}, this.state.options), {
5136
+ legend: __spreadProps$h(__spreadValues$t({}, legendOptions), { sortBy, sortDesc })
5347
5137
  }),
5348
5138
  true
5349
5139
  );
@@ -5427,6 +5217,9 @@ class VizPanel extends SceneObjectBase {
5427
5217
  (_a = this._panelContext) != null ? _a : this._panelContext = this.buildPanelContext();
5428
5218
  return this._panelContext;
5429
5219
  }
5220
+ clearFieldConfigCache() {
5221
+ this._dataWithFieldConfig = void 0;
5222
+ }
5430
5223
  applyFieldConfig(rawData) {
5431
5224
  var _a, _b, _c, _d;
5432
5225
  const plugin = this._plugin;
@@ -5450,7 +5243,7 @@ class VizPanel extends SceneObjectBase {
5450
5243
  if (!data.compareArrayValues(newFrames, prevFrames, data.compareDataFrameStructures)) {
5451
5244
  this._structureRev++;
5452
5245
  }
5453
- this._dataWithFieldConfig = __spreadProps$g(__spreadValues$s({}, rawData), {
5246
+ this._dataWithFieldConfig = __spreadProps$h(__spreadValues$t({}, rawData), {
5454
5247
  structureRev: this._structureRev,
5455
5248
  series: newFrames
5456
5249
  });
@@ -5593,25 +5386,25 @@ function getMessageFromError(err) {
5593
5386
  return JSON.stringify(err);
5594
5387
  }
5595
5388
 
5596
- var __defProp$r = Object.defineProperty;
5597
- var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
5598
- var __hasOwnProp$r = Object.prototype.hasOwnProperty;
5599
- var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
5600
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5601
- var __spreadValues$r = (a, b) => {
5389
+ var __defProp$s = Object.defineProperty;
5390
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
5391
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
5392
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
5393
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5394
+ var __spreadValues$s = (a, b) => {
5602
5395
  for (var prop in b || (b = {}))
5603
- if (__hasOwnProp$r.call(b, prop))
5604
- __defNormalProp$r(a, prop, b[prop]);
5605
- if (__getOwnPropSymbols$r)
5606
- for (var prop of __getOwnPropSymbols$r(b)) {
5607
- if (__propIsEnum$r.call(b, prop))
5608
- __defNormalProp$r(a, prop, b[prop]);
5396
+ if (__hasOwnProp$s.call(b, prop))
5397
+ __defNormalProp$s(a, prop, b[prop]);
5398
+ if (__getOwnPropSymbols$s)
5399
+ for (var prop of __getOwnPropSymbols$s(b)) {
5400
+ if (__propIsEnum$s.call(b, prop))
5401
+ __defNormalProp$s(a, prop, b[prop]);
5609
5402
  }
5610
5403
  return a;
5611
5404
  };
5612
5405
  class SceneDataLayerBase extends SceneObjectBase {
5613
5406
  constructor(initialState, variableDependencyStatePaths = []) {
5614
- super(__spreadValues$r({
5407
+ super(__spreadValues$s({
5615
5408
  isEnabled: true
5616
5409
  }, initialState));
5617
5410
  this._results = new rxjs.ReplaySubject(1);
@@ -5733,33 +5526,33 @@ function DataLayerControlSwitch({ layer }) {
5733
5526
  }
5734
5527
  const containerStyle$1 = css.css({ display: "flex" });
5735
5528
 
5736
- var __defProp$q = Object.defineProperty;
5737
- var __defProps$f = Object.defineProperties;
5738
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
5739
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
5740
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
5741
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
5742
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5743
- var __spreadValues$q = (a, b) => {
5529
+ var __defProp$r = Object.defineProperty;
5530
+ var __defProps$g = Object.defineProperties;
5531
+ var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
5532
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
5533
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
5534
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
5535
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5536
+ var __spreadValues$r = (a, b) => {
5744
5537
  for (var prop in b || (b = {}))
5745
- if (__hasOwnProp$q.call(b, prop))
5746
- __defNormalProp$q(a, prop, b[prop]);
5747
- if (__getOwnPropSymbols$q)
5748
- for (var prop of __getOwnPropSymbols$q(b)) {
5749
- if (__propIsEnum$q.call(b, prop))
5750
- __defNormalProp$q(a, prop, b[prop]);
5538
+ if (__hasOwnProp$r.call(b, prop))
5539
+ __defNormalProp$r(a, prop, b[prop]);
5540
+ if (__getOwnPropSymbols$r)
5541
+ for (var prop of __getOwnPropSymbols$r(b)) {
5542
+ if (__propIsEnum$r.call(b, prop))
5543
+ __defNormalProp$r(a, prop, b[prop]);
5751
5544
  }
5752
5545
  return a;
5753
5546
  };
5754
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
5547
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
5755
5548
  var __objRest$2 = (source, exclude) => {
5756
5549
  var target = {};
5757
5550
  for (var prop in source)
5758
- if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
5551
+ if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
5759
5552
  target[prop] = source[prop];
5760
- if (source != null && __getOwnPropSymbols$q)
5761
- for (var prop of __getOwnPropSymbols$q(source)) {
5762
- if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
5553
+ if (source != null && __getOwnPropSymbols$r)
5554
+ for (var prop of __getOwnPropSymbols$r(source)) {
5555
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
5763
5556
  target[prop] = source[prop];
5764
5557
  }
5765
5558
  return target;
@@ -5768,7 +5561,7 @@ const standardAnnotationSupport = {
5768
5561
  prepareAnnotation: (json) => {
5769
5562
  if (lodash.isString(json == null ? void 0 : json.query)) {
5770
5563
  const _a = json, { query } = _a, rest = __objRest$2(_a, ["query"]);
5771
- return __spreadProps$f(__spreadValues$q({}, rest), {
5564
+ return __spreadProps$g(__spreadValues$r({}, rest), {
5772
5565
  target: {
5773
5566
  refId: "annotation_query",
5774
5567
  query
@@ -5936,25 +5729,25 @@ function shouldUseLegacyRunner(datasource) {
5936
5729
  return !datasource.annotations || legacyRunner.includes(type);
5937
5730
  }
5938
5731
 
5939
- var __defProp$p = Object.defineProperty;
5940
- var __defProps$e = Object.defineProperties;
5941
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
5942
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
5943
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
5944
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
5945
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5946
- var __spreadValues$p = (a, b) => {
5732
+ var __defProp$q = Object.defineProperty;
5733
+ var __defProps$f = Object.defineProperties;
5734
+ var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
5735
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
5736
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
5737
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
5738
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5739
+ var __spreadValues$q = (a, b) => {
5947
5740
  for (var prop in b || (b = {}))
5948
- if (__hasOwnProp$p.call(b, prop))
5949
- __defNormalProp$p(a, prop, b[prop]);
5950
- if (__getOwnPropSymbols$p)
5951
- for (var prop of __getOwnPropSymbols$p(b)) {
5952
- if (__propIsEnum$p.call(b, prop))
5953
- __defNormalProp$p(a, prop, b[prop]);
5741
+ if (__hasOwnProp$q.call(b, prop))
5742
+ __defNormalProp$q(a, prop, b[prop]);
5743
+ if (__getOwnPropSymbols$q)
5744
+ for (var prop of __getOwnPropSymbols$q(b)) {
5745
+ if (__propIsEnum$q.call(b, prop))
5746
+ __defNormalProp$q(a, prop, b[prop]);
5954
5747
  }
5955
5748
  return a;
5956
5749
  };
5957
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
5750
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
5958
5751
  let counter = 100;
5959
5752
  function getNextRequestId() {
5960
5753
  return "AQ" + counter++;
@@ -5977,8 +5770,8 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
5977
5770
  }))
5978
5771
  );
5979
5772
  }
5980
- const processor = __spreadValues$p(__spreadValues$p({}, standardAnnotationSupport), datasource.annotations);
5981
- const annotationWithDefaults = __spreadValues$p(__spreadValues$p({}, (_a = processor.getDefaultQuery) == null ? void 0 : _a.call(processor)), query);
5773
+ const processor = __spreadValues$q(__spreadValues$q({}, standardAnnotationSupport), datasource.annotations);
5774
+ const annotationWithDefaults = __spreadValues$q(__spreadValues$q({}, (_a = processor.getDefaultQuery) == null ? void 0 : _a.call(processor)), query);
5982
5775
  const annotation = processor.prepareAnnotation(annotationWithDefaults);
5983
5776
  if (!annotation) {
5984
5777
  return rxjs.of({
@@ -6001,7 +5794,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6001
5794
  __annotation: { text: annotation.name, value: annotation },
6002
5795
  __sceneObject: { text: "__sceneObject", value: layer }
6003
5796
  };
6004
- const queryRequest = __spreadValues$p(__spreadProps$e(__spreadValues$p({
5797
+ const queryRequest = __spreadValues$q(__spreadProps$f(__spreadValues$q({
6005
5798
  startTime: Date.now(),
6006
5799
  requestId: getNextRequestId(),
6007
5800
  range: timeRange.state.value,
@@ -6011,7 +5804,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6011
5804
  app: data.CoreApp.Dashboard,
6012
5805
  timezone: timeRange.getTimeZone(),
6013
5806
  targets: [
6014
- __spreadProps$e(__spreadValues$p({}, processedQuery), {
5807
+ __spreadProps$f(__spreadValues$q({}, processedQuery), {
6015
5808
  refId: "Anno"
6016
5809
  })
6017
5810
  ]
@@ -6029,7 +5822,7 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6029
5822
  data$1.forEach((frame) => {
6030
5823
  var _a2;
6031
5824
  if (!((_a2 = frame.meta) == null ? void 0 : _a2.dataTopic)) {
6032
- frame.meta = __spreadProps$e(__spreadValues$p({}, frame.meta || {}), { dataTopic: data.DataTopic.Annotations });
5825
+ frame.meta = __spreadProps$f(__spreadValues$q({}, frame.meta || {}), { dataTopic: data.DataTopic.Annotations });
6033
5826
  }
6034
5827
  });
6035
5828
  return processor.processEvents(annotation, data$1).pipe(
@@ -6044,19 +5837,19 @@ function executeAnnotationQuery(datasource, timeRange, query, layer) {
6044
5837
  );
6045
5838
  }
6046
5839
 
6047
- var __defProp$o = Object.defineProperty;
6048
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
6049
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
6050
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
6051
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6052
- var __spreadValues$o = (a, b) => {
5840
+ var __defProp$p = Object.defineProperty;
5841
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
5842
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
5843
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
5844
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5845
+ var __spreadValues$p = (a, b) => {
6053
5846
  for (var prop in b || (b = {}))
6054
- if (__hasOwnProp$o.call(b, prop))
6055
- __defNormalProp$o(a, prop, b[prop]);
6056
- if (__getOwnPropSymbols$o)
6057
- for (var prop of __getOwnPropSymbols$o(b)) {
6058
- if (__propIsEnum$o.call(b, prop))
6059
- __defNormalProp$o(a, prop, b[prop]);
5847
+ if (__hasOwnProp$p.call(b, prop))
5848
+ __defNormalProp$p(a, prop, b[prop]);
5849
+ if (__getOwnPropSymbols$p)
5850
+ for (var prop of __getOwnPropSymbols$p(b)) {
5851
+ if (__propIsEnum$p.call(b, prop))
5852
+ __defNormalProp$p(a, prop, b[prop]);
6060
5853
  }
6061
5854
  return a;
6062
5855
  };
@@ -6067,7 +5860,7 @@ function postProcessQueryResult(annotation, results) {
6067
5860
  }
6068
5861
  const processed = results.map((item) => {
6069
5862
  var _a;
6070
- const processedItem = __spreadValues$o({}, item);
5863
+ const processedItem = __spreadValues$p({}, item);
6071
5864
  processedItem.source = annotation;
6072
5865
  processedItem.color = runtime.config.theme2.visualization.getColorByName(annotation.iconColor);
6073
5866
  processedItem.type = annotation.name;
@@ -6116,29 +5909,29 @@ function isPanelAlert(event) {
6116
5909
  return event.eventType === "panel-alert";
6117
5910
  }
6118
5911
 
6119
- var __defProp$n = Object.defineProperty;
6120
- var __defProps$d = Object.defineProperties;
6121
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
6122
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
6123
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
6124
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
6125
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6126
- var __spreadValues$n = (a, b) => {
5912
+ var __defProp$o = Object.defineProperty;
5913
+ var __defProps$e = Object.defineProperties;
5914
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
5915
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
5916
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
5917
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
5918
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5919
+ var __spreadValues$o = (a, b) => {
6127
5920
  for (var prop in b || (b = {}))
6128
- if (__hasOwnProp$n.call(b, prop))
6129
- __defNormalProp$n(a, prop, b[prop]);
6130
- if (__getOwnPropSymbols$n)
6131
- for (var prop of __getOwnPropSymbols$n(b)) {
6132
- if (__propIsEnum$n.call(b, prop))
6133
- __defNormalProp$n(a, prop, b[prop]);
5921
+ if (__hasOwnProp$o.call(b, prop))
5922
+ __defNormalProp$o(a, prop, b[prop]);
5923
+ if (__getOwnPropSymbols$o)
5924
+ for (var prop of __getOwnPropSymbols$o(b)) {
5925
+ if (__propIsEnum$o.call(b, prop))
5926
+ __defNormalProp$o(a, prop, b[prop]);
6134
5927
  }
6135
5928
  return a;
6136
5929
  };
6137
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
5930
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
6138
5931
  class AnnotationsDataLayer extends SceneDataLayerBase {
6139
5932
  constructor(initialState) {
6140
5933
  super(
6141
- __spreadValues$n({
5934
+ __spreadValues$o({
6142
5935
  isEnabled: true
6143
5936
  }, initialState),
6144
5937
  ["query"]
@@ -6186,7 +5979,7 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
6186
5979
  this.publishResults(stateUpdate);
6187
5980
  });
6188
5981
  } catch (e) {
6189
- this.publishResults(__spreadProps$d(__spreadValues$n({}, emptyPanelData), {
5982
+ this.publishResults(__spreadProps$e(__spreadValues$o({}, emptyPanelData), {
6190
5983
  state: schema.LoadingState.Error,
6191
5984
  errors: [
6192
5985
  {
@@ -6203,9 +5996,9 @@ class AnnotationsDataLayer extends SceneDataLayerBase {
6203
5996
  processEvents(query, events) {
6204
5997
  let processedEvents = postProcessQueryResult(query, events.events || []);
6205
5998
  processedEvents = dedupAnnotations(processedEvents);
6206
- const stateUpdate = __spreadProps$d(__spreadValues$n({}, emptyPanelData), { state: events.state });
5999
+ const stateUpdate = __spreadProps$e(__spreadValues$o({}, emptyPanelData), { state: events.state });
6207
6000
  const df = data.arrayToDataFrame(processedEvents);
6208
- df.meta = __spreadProps$d(__spreadValues$n({}, df.meta), {
6001
+ df.meta = __spreadProps$e(__spreadValues$o({}, df.meta), {
6209
6002
  dataTopic: data.DataTopic.Annotations
6210
6003
  });
6211
6004
  stateUpdate.series = [df];
@@ -6258,28 +6051,28 @@ class SceneTimeRangeTransformerBase extends SceneObjectBase {
6258
6051
  }
6259
6052
  }
6260
6053
 
6261
- var __defProp$m = Object.defineProperty;
6262
- var __defProps$c = Object.defineProperties;
6263
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
6264
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
6265
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
6266
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
6267
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6268
- var __spreadValues$m = (a, b) => {
6054
+ var __defProp$n = Object.defineProperty;
6055
+ var __defProps$d = Object.defineProperties;
6056
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
6057
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
6058
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
6059
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
6060
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6061
+ var __spreadValues$n = (a, b) => {
6269
6062
  for (var prop in b || (b = {}))
6270
- if (__hasOwnProp$m.call(b, prop))
6271
- __defNormalProp$m(a, prop, b[prop]);
6272
- if (__getOwnPropSymbols$m)
6273
- for (var prop of __getOwnPropSymbols$m(b)) {
6274
- if (__propIsEnum$m.call(b, prop))
6275
- __defNormalProp$m(a, prop, b[prop]);
6063
+ if (__hasOwnProp$n.call(b, prop))
6064
+ __defNormalProp$n(a, prop, b[prop]);
6065
+ if (__getOwnPropSymbols$n)
6066
+ for (var prop of __getOwnPropSymbols$n(b)) {
6067
+ if (__propIsEnum$n.call(b, prop))
6068
+ __defNormalProp$n(a, prop, b[prop]);
6276
6069
  }
6277
6070
  return a;
6278
6071
  };
6279
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
6072
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
6280
6073
  class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6281
6074
  constructor(state) {
6282
- super(__spreadProps$c(__spreadValues$m({}, state), {
6075
+ super(__spreadProps$d(__spreadValues$n({}, state), {
6283
6076
  timeZone: state.timeZone,
6284
6077
  from: "now-6h",
6285
6078
  to: "now",
@@ -6287,7 +6080,7 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6287
6080
  }));
6288
6081
  }
6289
6082
  ancestorTimeRangeChanged(timeRange) {
6290
- this.setState(__spreadProps$c(__spreadValues$m({}, timeRange), {
6083
+ this.setState(__spreadProps$d(__spreadValues$n({}, timeRange), {
6291
6084
  timeZone: this.state.timeZone,
6292
6085
  value: evaluateTimeRange(
6293
6086
  timeRange.from,
@@ -6315,25 +6108,25 @@ class SceneTimeZoneOverride extends SceneTimeRangeTransformerBase {
6315
6108
  }
6316
6109
  }
6317
6110
 
6318
- var __defProp$l = Object.defineProperty;
6319
- var __defProps$b = Object.defineProperties;
6320
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
6321
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
6322
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
6323
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
6324
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6325
- var __spreadValues$l = (a, b) => {
6111
+ var __defProp$m = Object.defineProperty;
6112
+ var __defProps$c = Object.defineProperties;
6113
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
6114
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
6115
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
6116
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
6117
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6118
+ var __spreadValues$m = (a, b) => {
6326
6119
  for (var prop in b || (b = {}))
6327
- if (__hasOwnProp$l.call(b, prop))
6328
- __defNormalProp$l(a, prop, b[prop]);
6329
- if (__getOwnPropSymbols$l)
6330
- for (var prop of __getOwnPropSymbols$l(b)) {
6331
- if (__propIsEnum$l.call(b, prop))
6332
- __defNormalProp$l(a, prop, b[prop]);
6120
+ if (__hasOwnProp$m.call(b, prop))
6121
+ __defNormalProp$m(a, prop, b[prop]);
6122
+ if (__getOwnPropSymbols$m)
6123
+ for (var prop of __getOwnPropSymbols$m(b)) {
6124
+ if (__propIsEnum$m.call(b, prop))
6125
+ __defNormalProp$m(a, prop, b[prop]);
6333
6126
  }
6334
6127
  return a;
6335
6128
  };
6336
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
6129
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
6337
6130
  class SceneDataLayerSetBase extends SceneObjectBase {
6338
6131
  constructor() {
6339
6132
  super(...arguments);
@@ -6357,7 +6150,7 @@ class SceneDataLayerSetBase extends SceneObjectBase {
6357
6150
  series = series.concat(result.data.series);
6358
6151
  }
6359
6152
  }
6360
- const combinedData = __spreadProps$b(__spreadValues$l({}, emptyPanelData), { series });
6153
+ const combinedData = __spreadProps$c(__spreadValues$m({}, emptyPanelData), { series });
6361
6154
  this._results.next({ origin: this, data: combinedData });
6362
6155
  this.setStateHelper({ data: combinedData });
6363
6156
  }
@@ -6406,25 +6199,25 @@ SceneDataLayerSet.Component = ({ model }) => {
6406
6199
  })));
6407
6200
  };
6408
6201
 
6409
- var __defProp$k = Object.defineProperty;
6410
- var __defProps$a = Object.defineProperties;
6411
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
6412
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
6413
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
6414
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
6415
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6416
- var __spreadValues$k = (a, b) => {
6202
+ var __defProp$l = Object.defineProperty;
6203
+ var __defProps$b = Object.defineProperties;
6204
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
6205
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
6206
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
6207
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
6208
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6209
+ var __spreadValues$l = (a, b) => {
6417
6210
  for (var prop in b || (b = {}))
6418
- if (__hasOwnProp$k.call(b, prop))
6419
- __defNormalProp$k(a, prop, b[prop]);
6420
- if (__getOwnPropSymbols$k)
6421
- for (var prop of __getOwnPropSymbols$k(b)) {
6422
- if (__propIsEnum$k.call(b, prop))
6423
- __defNormalProp$k(a, prop, b[prop]);
6211
+ if (__hasOwnProp$l.call(b, prop))
6212
+ __defNormalProp$l(a, prop, b[prop]);
6213
+ if (__getOwnPropSymbols$l)
6214
+ for (var prop of __getOwnPropSymbols$l(b)) {
6215
+ if (__propIsEnum$l.call(b, prop))
6216
+ __defNormalProp$l(a, prop, b[prop]);
6424
6217
  }
6425
6218
  return a;
6426
6219
  };
6427
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
6220
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
6428
6221
  class SceneDataTransformer extends SceneObjectBase {
6429
6222
  constructor(state) {
6430
6223
  super(state);
@@ -6501,7 +6294,7 @@ class SceneDataTransformer extends SceneObjectBase {
6501
6294
  const { series, annotations } = this._prevDataFromSource;
6502
6295
  if (data.series === series && data.annotations === annotations) {
6503
6296
  if (this.state.data && data.state !== this.state.data.state) {
6504
- this.setState({ data: __spreadProps$a(__spreadValues$k({}, this.state.data), { state: data.state }) });
6297
+ this.setState({ data: __spreadProps$b(__spreadValues$l({}, this.state.data), { state: data.state }) });
6505
6298
  }
6506
6299
  return true;
6507
6300
  }
@@ -6549,7 +6342,7 @@ class SceneDataTransformer extends SceneObjectBase {
6549
6342
  rxjs.map((values) => {
6550
6343
  const transformedSeries = values[0];
6551
6344
  const transformedAnnotations = values[1];
6552
- return __spreadProps$a(__spreadValues$k({}, data$1), {
6345
+ return __spreadProps$b(__spreadValues$l({}, data$1), {
6553
6346
  series: transformedSeries,
6554
6347
  annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
6555
6348
  });
@@ -6560,7 +6353,7 @@ class SceneDataTransformer extends SceneObjectBase {
6560
6353
  const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
6561
6354
  const transformationError = runtime.toDataQueryError(err);
6562
6355
  transformationError.message = `Error transforming data: ${transformationError.message}`;
6563
- const result = __spreadProps$a(__spreadValues$k({}, data$1), {
6356
+ const result = __spreadProps$b(__spreadValues$l({}, data$1), {
6564
6357
  state: data.LoadingState.Error,
6565
6358
  errors: [...sourceErr, transformationError]
6566
6359
  });
@@ -6893,28 +6686,28 @@ class SceneVariableSetVariableDependencyHandler {
6893
6686
  }
6894
6687
  }
6895
6688
 
6896
- var __defProp$j = Object.defineProperty;
6897
- var __defProps$9 = Object.defineProperties;
6898
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
6899
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
6900
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
6901
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
6902
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6903
- var __spreadValues$j = (a, b) => {
6904
- for (var prop in b || (b = {}))
6905
- if (__hasOwnProp$j.call(b, prop))
6906
- __defNormalProp$j(a, prop, b[prop]);
6907
- if (__getOwnPropSymbols$j)
6908
- for (var prop of __getOwnPropSymbols$j(b)) {
6909
- if (__propIsEnum$j.call(b, prop))
6910
- __defNormalProp$j(a, prop, b[prop]);
6689
+ var __defProp$k = Object.defineProperty;
6690
+ var __defProps$a = Object.defineProperties;
6691
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
6692
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
6693
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
6694
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
6695
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6696
+ var __spreadValues$k = (a, b) => {
6697
+ for (var prop in b || (b = {}))
6698
+ if (__hasOwnProp$k.call(b, prop))
6699
+ __defNormalProp$k(a, prop, b[prop]);
6700
+ if (__getOwnPropSymbols$k)
6701
+ for (var prop of __getOwnPropSymbols$k(b)) {
6702
+ if (__propIsEnum$k.call(b, prop))
6703
+ __defNormalProp$k(a, prop, b[prop]);
6911
6704
  }
6912
6705
  return a;
6913
6706
  };
6914
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
6707
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
6915
6708
  class ConstantVariable extends SceneObjectBase {
6916
6709
  constructor(initialState) {
6917
- super(__spreadProps$9(__spreadValues$j({
6710
+ super(__spreadProps$a(__spreadValues$k({
6918
6711
  type: "constant",
6919
6712
  value: "",
6920
6713
  name: ""
@@ -6927,25 +6720,25 @@ class ConstantVariable extends SceneObjectBase {
6927
6720
  }
6928
6721
  }
6929
6722
 
6930
- var __defProp$i = Object.defineProperty;
6931
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6932
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6933
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6934
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6935
- var __spreadValues$i = (a, b) => {
6723
+ var __defProp$j = Object.defineProperty;
6724
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
6725
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
6726
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
6727
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6728
+ var __spreadValues$j = (a, b) => {
6936
6729
  for (var prop in b || (b = {}))
6937
- if (__hasOwnProp$i.call(b, prop))
6938
- __defNormalProp$i(a, prop, b[prop]);
6939
- if (__getOwnPropSymbols$i)
6940
- for (var prop of __getOwnPropSymbols$i(b)) {
6941
- if (__propIsEnum$i.call(b, prop))
6942
- __defNormalProp$i(a, prop, b[prop]);
6730
+ if (__hasOwnProp$j.call(b, prop))
6731
+ __defNormalProp$j(a, prop, b[prop]);
6732
+ if (__getOwnPropSymbols$j)
6733
+ for (var prop of __getOwnPropSymbols$j(b)) {
6734
+ if (__propIsEnum$j.call(b, prop))
6735
+ __defNormalProp$j(a, prop, b[prop]);
6943
6736
  }
6944
6737
  return a;
6945
6738
  };
6946
6739
  class CustomVariable extends MultiValueVariable {
6947
6740
  constructor(initialState) {
6948
- super(__spreadValues$i({
6741
+ super(__spreadValues$j({
6949
6742
  type: "custom",
6950
6743
  query: "",
6951
6744
  value: "",
@@ -6979,25 +6772,25 @@ CustomVariable.Component = ({ model }) => {
6979
6772
  return renderSelectForVariable(model);
6980
6773
  };
6981
6774
 
6982
- var __defProp$h = Object.defineProperty;
6983
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
6984
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
6985
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
6986
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6987
- var __spreadValues$h = (a, b) => {
6775
+ var __defProp$i = Object.defineProperty;
6776
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6777
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6778
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6779
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6780
+ var __spreadValues$i = (a, b) => {
6988
6781
  for (var prop in b || (b = {}))
6989
- if (__hasOwnProp$h.call(b, prop))
6990
- __defNormalProp$h(a, prop, b[prop]);
6991
- if (__getOwnPropSymbols$h)
6992
- for (var prop of __getOwnPropSymbols$h(b)) {
6993
- if (__propIsEnum$h.call(b, prop))
6994
- __defNormalProp$h(a, prop, b[prop]);
6782
+ if (__hasOwnProp$i.call(b, prop))
6783
+ __defNormalProp$i(a, prop, b[prop]);
6784
+ if (__getOwnPropSymbols$i)
6785
+ for (var prop of __getOwnPropSymbols$i(b)) {
6786
+ if (__propIsEnum$i.call(b, prop))
6787
+ __defNormalProp$i(a, prop, b[prop]);
6995
6788
  }
6996
6789
  return a;
6997
6790
  };
6998
6791
  class DataSourceVariable extends MultiValueVariable {
6999
6792
  constructor(initialState) {
7000
- super(__spreadValues$h({
6793
+ super(__spreadValues$i({
7001
6794
  type: "datasource",
7002
6795
  value: "",
7003
6796
  text: "",
@@ -7081,25 +6874,25 @@ const hasCustomVariableSupport = (datasource) => {
7081
6874
  return "query" in variableSupport && "editor" in variableSupport && Boolean(variableSupport.query) && Boolean(variableSupport.editor);
7082
6875
  };
7083
6876
 
7084
- var __defProp$g = Object.defineProperty;
7085
- var __defProps$8 = Object.defineProperties;
7086
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
7087
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
7088
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
7089
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
7090
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7091
- var __spreadValues$g = (a, b) => {
6877
+ var __defProp$h = Object.defineProperty;
6878
+ var __defProps$9 = Object.defineProperties;
6879
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
6880
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
6881
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
6882
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
6883
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6884
+ var __spreadValues$h = (a, b) => {
7092
6885
  for (var prop in b || (b = {}))
7093
- if (__hasOwnProp$g.call(b, prop))
7094
- __defNormalProp$g(a, prop, b[prop]);
7095
- if (__getOwnPropSymbols$g)
7096
- for (var prop of __getOwnPropSymbols$g(b)) {
7097
- if (__propIsEnum$g.call(b, prop))
7098
- __defNormalProp$g(a, prop, b[prop]);
6886
+ if (__hasOwnProp$h.call(b, prop))
6887
+ __defNormalProp$h(a, prop, b[prop]);
6888
+ if (__getOwnPropSymbols$h)
6889
+ for (var prop of __getOwnPropSymbols$h(b)) {
6890
+ if (__propIsEnum$h.call(b, prop))
6891
+ __defNormalProp$h(a, prop, b[prop]);
7099
6892
  }
7100
6893
  return a;
7101
6894
  };
7102
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
6895
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
7103
6896
  class StandardQueryRunner {
7104
6897
  constructor(datasource, _runRequest = runtime.getRunRequest()) {
7105
6898
  this.datasource = datasource;
@@ -7136,7 +6929,7 @@ class LegacyQueryRunner {
7136
6929
  return getEmptyMetricFindValueObservable();
7137
6930
  }
7138
6931
  return rxjs.from(
7139
- this.datasource.metricFindQuery(variable.state.query, __spreadProps$8(__spreadValues$g({}, request), {
6932
+ this.datasource.metricFindQuery(variable.state.query, __spreadProps$9(__spreadValues$h({}, request), {
7140
6933
  variable: {
7141
6934
  name: variable.state.name,
7142
6935
  type: variable.state.type
@@ -7198,7 +6991,7 @@ function ensureVariableQueryModelIsADataQuery(variable) {
7198
6991
  return { query, refId: `variable-${variable.state.name}` };
7199
6992
  }
7200
6993
  if (query.refId == null) {
7201
- return __spreadProps$8(__spreadValues$g({}, query), { refId: `variable-${variable.state.name}` });
6994
+ return __spreadProps$9(__spreadValues$h({}, query), { refId: `variable-${variable.state.name}` });
7202
6995
  }
7203
6996
  return variable.state.query;
7204
6997
  }
@@ -7413,25 +7206,25 @@ function areMetricFindValues(data$1) {
7413
7206
  return false;
7414
7207
  }
7415
7208
 
7416
- var __defProp$f = Object.defineProperty;
7417
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
7418
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
7419
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
7420
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7421
- var __spreadValues$f = (a, b) => {
7209
+ var __defProp$g = Object.defineProperty;
7210
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
7211
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
7212
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
7213
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7214
+ var __spreadValues$g = (a, b) => {
7422
7215
  for (var prop in b || (b = {}))
7423
- if (__hasOwnProp$f.call(b, prop))
7424
- __defNormalProp$f(a, prop, b[prop]);
7425
- if (__getOwnPropSymbols$f)
7426
- for (var prop of __getOwnPropSymbols$f(b)) {
7427
- if (__propIsEnum$f.call(b, prop))
7428
- __defNormalProp$f(a, prop, b[prop]);
7216
+ if (__hasOwnProp$g.call(b, prop))
7217
+ __defNormalProp$g(a, prop, b[prop]);
7218
+ if (__getOwnPropSymbols$g)
7219
+ for (var prop of __getOwnPropSymbols$g(b)) {
7220
+ if (__propIsEnum$g.call(b, prop))
7221
+ __defNormalProp$g(a, prop, b[prop]);
7429
7222
  }
7430
7223
  return a;
7431
7224
  };
7432
7225
  class QueryVariable extends MultiValueVariable {
7433
7226
  constructor(initialState) {
7434
- super(__spreadValues$f({
7227
+ super(__spreadValues$g({
7435
7228
  type: "query",
7436
7229
  name: "",
7437
7230
  value: "",
@@ -7584,25 +7377,25 @@ function queryMetricTree(query) {
7584
7377
  return queryTree(children, query.split("."), 0);
7585
7378
  }
7586
7379
 
7587
- var __defProp$e = Object.defineProperty;
7588
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
7589
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
7590
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
7591
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7592
- var __spreadValues$e = (a, b) => {
7380
+ var __defProp$f = Object.defineProperty;
7381
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
7382
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
7383
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
7384
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7385
+ var __spreadValues$f = (a, b) => {
7593
7386
  for (var prop in b || (b = {}))
7594
- if (__hasOwnProp$e.call(b, prop))
7595
- __defNormalProp$e(a, prop, b[prop]);
7596
- if (__getOwnPropSymbols$e)
7597
- for (var prop of __getOwnPropSymbols$e(b)) {
7598
- if (__propIsEnum$e.call(b, prop))
7599
- __defNormalProp$e(a, prop, b[prop]);
7387
+ if (__hasOwnProp$f.call(b, prop))
7388
+ __defNormalProp$f(a, prop, b[prop]);
7389
+ if (__getOwnPropSymbols$f)
7390
+ for (var prop of __getOwnPropSymbols$f(b)) {
7391
+ if (__propIsEnum$f.call(b, prop))
7392
+ __defNormalProp$f(a, prop, b[prop]);
7600
7393
  }
7601
7394
  return a;
7602
7395
  };
7603
7396
  class TestVariable extends MultiValueVariable {
7604
7397
  constructor(initialState, isLazy = false) {
7605
- super(__spreadValues$e({
7398
+ super(__spreadValues$f({
7606
7399
  type: "custom",
7607
7400
  name: "Test",
7608
7401
  value: "Value",
@@ -7711,25 +7504,25 @@ function VariableValueInput({ model }) {
7711
7504
  });
7712
7505
  }
7713
7506
 
7714
- var __defProp$d = Object.defineProperty;
7715
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7716
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7717
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7718
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7719
- var __spreadValues$d = (a, b) => {
7507
+ var __defProp$e = Object.defineProperty;
7508
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
7509
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
7510
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
7511
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7512
+ var __spreadValues$e = (a, b) => {
7720
7513
  for (var prop in b || (b = {}))
7721
- if (__hasOwnProp$d.call(b, prop))
7722
- __defNormalProp$d(a, prop, b[prop]);
7723
- if (__getOwnPropSymbols$d)
7724
- for (var prop of __getOwnPropSymbols$d(b)) {
7725
- if (__propIsEnum$d.call(b, prop))
7726
- __defNormalProp$d(a, prop, b[prop]);
7514
+ if (__hasOwnProp$e.call(b, prop))
7515
+ __defNormalProp$e(a, prop, b[prop]);
7516
+ if (__getOwnPropSymbols$e)
7517
+ for (var prop of __getOwnPropSymbols$e(b)) {
7518
+ if (__propIsEnum$e.call(b, prop))
7519
+ __defNormalProp$e(a, prop, b[prop]);
7727
7520
  }
7728
7521
  return a;
7729
7522
  };
7730
7523
  class TextBoxVariable extends SceneObjectBase {
7731
7524
  constructor(initialState) {
7732
- super(__spreadValues$d({
7525
+ super(__spreadValues$e({
7733
7526
  type: "textbox",
7734
7527
  value: "",
7735
7528
  name: ""
@@ -7766,28 +7559,28 @@ TextBoxVariable.Component = ({ model }) => {
7766
7559
  });
7767
7560
  };
7768
7561
 
7769
- var __defProp$c = Object.defineProperty;
7770
- var __defProps$7 = Object.defineProperties;
7771
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
7772
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7773
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7774
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7775
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7776
- var __spreadValues$c = (a, b) => {
7562
+ var __defProp$d = Object.defineProperty;
7563
+ var __defProps$8 = Object.defineProperties;
7564
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
7565
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7566
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7567
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7568
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7569
+ var __spreadValues$d = (a, b) => {
7777
7570
  for (var prop in b || (b = {}))
7778
- if (__hasOwnProp$c.call(b, prop))
7779
- __defNormalProp$c(a, prop, b[prop]);
7780
- if (__getOwnPropSymbols$c)
7781
- for (var prop of __getOwnPropSymbols$c(b)) {
7782
- if (__propIsEnum$c.call(b, prop))
7783
- __defNormalProp$c(a, prop, b[prop]);
7571
+ if (__hasOwnProp$d.call(b, prop))
7572
+ __defNormalProp$d(a, prop, b[prop]);
7573
+ if (__getOwnPropSymbols$d)
7574
+ for (var prop of __getOwnPropSymbols$d(b)) {
7575
+ if (__propIsEnum$d.call(b, prop))
7576
+ __defNormalProp$d(a, prop, b[prop]);
7784
7577
  }
7785
7578
  return a;
7786
7579
  };
7787
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
7580
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
7788
7581
  class LocalValueVariable extends SceneObjectBase {
7789
7582
  constructor(initialState) {
7790
- super(__spreadProps$7(__spreadValues$c({
7583
+ super(__spreadProps$8(__spreadValues$d({
7791
7584
  type: "system",
7792
7585
  value: "",
7793
7586
  text: "",
@@ -7819,25 +7612,25 @@ class LocalValueVariable extends SceneObjectBase {
7819
7612
  }
7820
7613
  }
7821
7614
 
7822
- var __defProp$b = Object.defineProperty;
7823
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7824
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7825
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7826
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7827
- var __spreadValues$b = (a, b) => {
7615
+ var __defProp$c = Object.defineProperty;
7616
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
7617
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
7618
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
7619
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7620
+ var __spreadValues$c = (a, b) => {
7828
7621
  for (var prop in b || (b = {}))
7829
- if (__hasOwnProp$b.call(b, prop))
7830
- __defNormalProp$b(a, prop, b[prop]);
7831
- if (__getOwnPropSymbols$b)
7832
- for (var prop of __getOwnPropSymbols$b(b)) {
7833
- if (__propIsEnum$b.call(b, prop))
7834
- __defNormalProp$b(a, prop, b[prop]);
7622
+ if (__hasOwnProp$c.call(b, prop))
7623
+ __defNormalProp$c(a, prop, b[prop]);
7624
+ if (__getOwnPropSymbols$c)
7625
+ for (var prop of __getOwnPropSymbols$c(b)) {
7626
+ if (__propIsEnum$c.call(b, prop))
7627
+ __defNormalProp$c(a, prop, b[prop]);
7835
7628
  }
7836
7629
  return a;
7837
7630
  };
7838
7631
  class IntervalVariable extends SceneObjectBase {
7839
7632
  constructor(initialState) {
7840
- super(__spreadValues$b({
7633
+ super(__spreadValues$c({
7841
7634
  type: "interval",
7842
7635
  value: "",
7843
7636
  intervals: ["1m", "10m", "30m", "1h", "6h", "12h", "1d", "7d", "14d", "30d"],
@@ -8045,7 +7838,7 @@ class EmbeddedScene extends SceneObjectBase {
8045
7838
  EmbeddedScene.Component = EmbeddedSceneRenderer;
8046
7839
  function EmbeddedSceneRenderer({ model }) {
8047
7840
  const { body, controls } = model.useState();
8048
- const styles = ui.useStyles2(getStyles$5);
7841
+ const styles = ui.useStyles2(getStyles$6);
8049
7842
  return /* @__PURE__ */ React__default["default"].createElement("div", {
8050
7843
  className: styles.container
8051
7844
  }, controls && /* @__PURE__ */ React__default["default"].createElement("div", {
@@ -8059,7 +7852,7 @@ function EmbeddedSceneRenderer({ model }) {
8059
7852
  model: body
8060
7853
  })));
8061
7854
  }
8062
- const getStyles$5 = (theme) => {
7855
+ const getStyles$6 = (theme) => {
8063
7856
  return {
8064
7857
  container: css.css({
8065
7858
  flexGrow: 1,
@@ -8162,30 +7955,30 @@ function isSceneGridLayout(child) {
8162
7955
  return child instanceof SceneGridLayout;
8163
7956
  }
8164
7957
 
8165
- var __defProp$a = Object.defineProperty;
8166
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8167
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8168
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8169
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8170
- var __spreadValues$a = (a, b) => {
7958
+ var __defProp$b = Object.defineProperty;
7959
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
7960
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
7961
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
7962
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7963
+ var __spreadValues$b = (a, b) => {
8171
7964
  for (var prop in b || (b = {}))
8172
- if (__hasOwnProp$a.call(b, prop))
8173
- __defNormalProp$a(a, prop, b[prop]);
8174
- if (__getOwnPropSymbols$a)
8175
- for (var prop of __getOwnPropSymbols$a(b)) {
8176
- if (__propIsEnum$a.call(b, prop))
8177
- __defNormalProp$a(a, prop, b[prop]);
7965
+ if (__hasOwnProp$b.call(b, prop))
7966
+ __defNormalProp$b(a, prop, b[prop]);
7967
+ if (__getOwnPropSymbols$b)
7968
+ for (var prop of __getOwnPropSymbols$b(b)) {
7969
+ if (__propIsEnum$b.call(b, prop))
7970
+ __defNormalProp$b(a, prop, b[prop]);
8178
7971
  }
8179
7972
  return a;
8180
7973
  };
8181
7974
  var __objRest$1 = (source, exclude) => {
8182
7975
  var target = {};
8183
7976
  for (var prop in source)
8184
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
7977
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
8185
7978
  target[prop] = source[prop];
8186
- if (source != null && __getOwnPropSymbols$a)
8187
- for (var prop of __getOwnPropSymbols$a(source)) {
8188
- if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
7979
+ if (source != null && __getOwnPropSymbols$b)
7980
+ for (var prop of __getOwnPropSymbols$b(source)) {
7981
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
8189
7982
  target[prop] = source[prop];
8190
7983
  }
8191
7984
  return target;
@@ -8225,7 +8018,7 @@ const LazyLoader = React__default["default"].forwardRef(
8225
8018
  }
8226
8019
  };
8227
8020
  });
8228
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$a({
8021
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadValues$b({
8229
8022
  id,
8230
8023
  ref: innerRef
8231
8024
  }, rest), loaded && (typeof children === "function" ? children({ isInView }) : children));
@@ -8243,33 +8036,33 @@ LazyLoader.observer = new IntersectionObserver(
8243
8036
  { rootMargin: "100px" }
8244
8037
  );
8245
8038
 
8246
- var __defProp$9 = Object.defineProperty;
8247
- var __defProps$6 = Object.defineProperties;
8248
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
8249
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8250
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8251
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8252
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8253
- var __spreadValues$9 = (a, b) => {
8039
+ var __defProp$a = Object.defineProperty;
8040
+ var __defProps$7 = Object.defineProperties;
8041
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
8042
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
8043
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
8044
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
8045
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8046
+ var __spreadValues$a = (a, b) => {
8254
8047
  for (var prop in b || (b = {}))
8255
- if (__hasOwnProp$9.call(b, prop))
8256
- __defNormalProp$9(a, prop, b[prop]);
8257
- if (__getOwnPropSymbols$9)
8258
- for (var prop of __getOwnPropSymbols$9(b)) {
8259
- if (__propIsEnum$9.call(b, prop))
8260
- __defNormalProp$9(a, prop, b[prop]);
8048
+ if (__hasOwnProp$a.call(b, prop))
8049
+ __defNormalProp$a(a, prop, b[prop]);
8050
+ if (__getOwnPropSymbols$a)
8051
+ for (var prop of __getOwnPropSymbols$a(b)) {
8052
+ if (__propIsEnum$a.call(b, prop))
8053
+ __defNormalProp$a(a, prop, b[prop]);
8261
8054
  }
8262
8055
  return a;
8263
8056
  };
8264
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
8057
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
8265
8058
  var __objRest = (source, exclude) => {
8266
8059
  var target = {};
8267
8060
  for (var prop in source)
8268
- if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
8061
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
8269
8062
  target[prop] = source[prop];
8270
- if (source != null && __getOwnPropSymbols$9)
8271
- for (var prop of __getOwnPropSymbols$9(source)) {
8272
- if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
8063
+ if (source != null && __getOwnPropSymbols$a)
8064
+ for (var prop of __getOwnPropSymbols$a(source)) {
8065
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
8273
8066
  target[prop] = source[prop];
8274
8067
  }
8275
8068
  return target;
@@ -8328,7 +8121,7 @@ const GridItemWrapper = React__default["default"].forwardRef((props, ref) => {
8328
8121
  key: sceneChild.state.key
8329
8122
  });
8330
8123
  if (isLazy) {
8331
- return /* @__PURE__ */ React__default["default"].createElement(LazyLoader, __spreadProps$6(__spreadValues$9({}, divProps), {
8124
+ return /* @__PURE__ */ React__default["default"].createElement(LazyLoader, __spreadProps$7(__spreadValues$a({}, divProps), {
8332
8125
  key: sceneChild.state.key,
8333
8126
  "data-griditem-key": sceneChild.state.key,
8334
8127
  className: css.cx(className, props.className),
@@ -8336,7 +8129,7 @@ const GridItemWrapper = React__default["default"].forwardRef((props, ref) => {
8336
8129
  ref
8337
8130
  }), innerContent, children);
8338
8131
  }
8339
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$6(__spreadValues$9({}, divProps), {
8132
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$7(__spreadValues$a({}, divProps), {
8340
8133
  ref,
8341
8134
  key: sceneChild.state.key,
8342
8135
  "data-griditem-key": sceneChild.state.key,
@@ -8366,7 +8159,7 @@ function updateAnimationClass(ref, isDraggable, retry) {
8366
8159
  const ResizeHandle = React__default["default"].forwardRef((_a, ref) => {
8367
8160
  var _b = _a, divProps = __objRest(_b, ["handleAxis"]);
8368
8161
  const customCssClass = ui.useStyles2(getResizeHandleStyles);
8369
- return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$6(__spreadValues$9({
8162
+ return /* @__PURE__ */ React__default["default"].createElement("div", __spreadProps$7(__spreadValues$a({
8370
8163
  ref
8371
8164
  }, divProps), {
8372
8165
  className: `${customCssClass} scene-resize-handle`
@@ -8406,60 +8199,60 @@ function getResizeHandleStyles(theme) {
8406
8199
  });
8407
8200
  }
8408
8201
 
8409
- var __defProp$8 = Object.defineProperty;
8410
- var __defProps$5 = Object.defineProperties;
8411
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
8412
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8413
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8414
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8415
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8416
- var __spreadValues$8 = (a, b) => {
8202
+ var __defProp$9 = Object.defineProperty;
8203
+ var __defProps$6 = Object.defineProperties;
8204
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
8205
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
8206
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
8207
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
8208
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8209
+ var __spreadValues$9 = (a, b) => {
8417
8210
  for (var prop in b || (b = {}))
8418
- if (__hasOwnProp$8.call(b, prop))
8419
- __defNormalProp$8(a, prop, b[prop]);
8420
- if (__getOwnPropSymbols$8)
8421
- for (var prop of __getOwnPropSymbols$8(b)) {
8422
- if (__propIsEnum$8.call(b, prop))
8423
- __defNormalProp$8(a, prop, b[prop]);
8211
+ if (__hasOwnProp$9.call(b, prop))
8212
+ __defNormalProp$9(a, prop, b[prop]);
8213
+ if (__getOwnPropSymbols$9)
8214
+ for (var prop of __getOwnPropSymbols$9(b)) {
8215
+ if (__propIsEnum$9.call(b, prop))
8216
+ __defNormalProp$9(a, prop, b[prop]);
8424
8217
  }
8425
8218
  return a;
8426
8219
  };
8427
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8220
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
8428
8221
  function fitPanelsInHeight(cells, height) {
8429
8222
  const visibleHeight = height - GRID_CELL_VMARGIN * 4;
8430
8223
  const currentGridHeight = Math.max(...cells.map((cell) => cell.h + cell.y));
8431
8224
  const visibleGridHeight = Math.floor(visibleHeight / (GRID_CELL_HEIGHT + GRID_CELL_VMARGIN));
8432
8225
  const scaleFactor = currentGridHeight / visibleGridHeight;
8433
8226
  return cells.map((cell) => {
8434
- return __spreadProps$5(__spreadValues$8({}, cell), {
8227
+ return __spreadProps$6(__spreadValues$9({}, cell), {
8435
8228
  y: Math.round(cell.y / scaleFactor) || 0,
8436
8229
  h: Math.round(cell.h / scaleFactor) || 1
8437
8230
  });
8438
8231
  });
8439
8232
  }
8440
8233
 
8441
- var __defProp$7 = Object.defineProperty;
8442
- var __defProps$4 = Object.defineProperties;
8443
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8444
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8445
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8446
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8447
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8448
- var __spreadValues$7 = (a, b) => {
8234
+ var __defProp$8 = Object.defineProperty;
8235
+ var __defProps$5 = Object.defineProperties;
8236
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
8237
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
8238
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
8239
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
8240
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8241
+ var __spreadValues$8 = (a, b) => {
8449
8242
  for (var prop in b || (b = {}))
8450
- if (__hasOwnProp$7.call(b, prop))
8451
- __defNormalProp$7(a, prop, b[prop]);
8452
- if (__getOwnPropSymbols$7)
8453
- for (var prop of __getOwnPropSymbols$7(b)) {
8454
- if (__propIsEnum$7.call(b, prop))
8455
- __defNormalProp$7(a, prop, b[prop]);
8243
+ if (__hasOwnProp$8.call(b, prop))
8244
+ __defNormalProp$8(a, prop, b[prop]);
8245
+ if (__getOwnPropSymbols$8)
8246
+ for (var prop of __getOwnPropSymbols$8(b)) {
8247
+ if (__propIsEnum$8.call(b, prop))
8248
+ __defNormalProp$8(a, prop, b[prop]);
8456
8249
  }
8457
8250
  return a;
8458
8251
  };
8459
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8252
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
8460
8253
  const _SceneGridLayout = class extends SceneObjectBase {
8461
8254
  constructor(state) {
8462
- super(__spreadProps$4(__spreadValues$7({}, state), {
8255
+ super(__spreadProps$5(__spreadValues$8({}, state), {
8463
8256
  children: sortChildrenByPosition(state.children)
8464
8257
  }));
8465
8258
  this._skipOnLayoutChange = false;
@@ -8483,7 +8276,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8483
8276
  height: item.h
8484
8277
  };
8485
8278
  if (!isItemSizeEqual(child.state, nextSize)) {
8486
- child.setState(__spreadValues$7({}, nextSize));
8279
+ child.setState(__spreadValues$8({}, nextSize));
8487
8280
  }
8488
8281
  }
8489
8282
  this.setState({ children: sortChildrenByPosition(this.state.children) });
@@ -8557,7 +8350,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8557
8350
  const yDiff = firstPanelYPos - (rowY + 1);
8558
8351
  let yMax = rowY;
8559
8352
  for (const panel of rowChildren) {
8560
- const newSize = __spreadValues$7({}, panel.state);
8353
+ const newSize = __spreadValues$8({}, panel.state);
8561
8354
  newSize.y = (_b = newSize.y) != null ? _b : rowY;
8562
8355
  newSize.y -= yDiff;
8563
8356
  if (newSize.y !== panel.state.y) {
@@ -8684,7 +8477,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
8684
8477
  }
8685
8478
  if (width < 768) {
8686
8479
  this._skipOnLayoutChange = true;
8687
- return cells.map((cell) => __spreadProps$4(__spreadValues$7({}, cell), { w: 24 }));
8480
+ return cells.map((cell) => __spreadProps$5(__spreadValues$8({}, cell), { w: 24 }));
8688
8481
  }
8689
8482
  this._skipOnLayoutChange = false;
8690
8483
  return cells;
@@ -8709,28 +8502,28 @@ function sortGridLayout(layout) {
8709
8502
  return [...layout].sort((a, b) => a.y - b.y || a.x - b.x);
8710
8503
  }
8711
8504
 
8712
- var __defProp$6 = Object.defineProperty;
8713
- var __defProps$3 = Object.defineProperties;
8714
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8715
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8716
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8717
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8718
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8719
- var __spreadValues$6 = (a, b) => {
8505
+ var __defProp$7 = Object.defineProperty;
8506
+ var __defProps$4 = Object.defineProperties;
8507
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
8508
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
8509
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
8510
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
8511
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8512
+ var __spreadValues$7 = (a, b) => {
8720
8513
  for (var prop in b || (b = {}))
8721
- if (__hasOwnProp$6.call(b, prop))
8722
- __defNormalProp$6(a, prop, b[prop]);
8723
- if (__getOwnPropSymbols$6)
8724
- for (var prop of __getOwnPropSymbols$6(b)) {
8725
- if (__propIsEnum$6.call(b, prop))
8726
- __defNormalProp$6(a, prop, b[prop]);
8514
+ if (__hasOwnProp$7.call(b, prop))
8515
+ __defNormalProp$7(a, prop, b[prop]);
8516
+ if (__getOwnPropSymbols$7)
8517
+ for (var prop of __getOwnPropSymbols$7(b)) {
8518
+ if (__propIsEnum$7.call(b, prop))
8519
+ __defNormalProp$7(a, prop, b[prop]);
8727
8520
  }
8728
8521
  return a;
8729
8522
  };
8730
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
8523
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
8731
8524
  class SceneGridRow extends SceneObjectBase {
8732
8525
  constructor(state) {
8733
- super(__spreadProps$3(__spreadValues$6({
8526
+ super(__spreadProps$4(__spreadValues$7({
8734
8527
  children: state.children || [],
8735
8528
  isCollapsible: state.isCollapsible || true,
8736
8529
  title: state.title || ""
@@ -8895,7 +8688,7 @@ NestedScene.Component = NestedSceneRenderer;
8895
8688
  function NestedSceneRenderer({ model }) {
8896
8689
  const { title, isCollapsed, canCollapse, canRemove, body, controls } = model.useState();
8897
8690
  const gridRow = ui.useStyles2(getSceneGridRowStyles);
8898
- const styles = ui.useStyles2(getStyles$4);
8691
+ const styles = ui.useStyles2(getStyles$5);
8899
8692
  const toolbarControls = (controls != null ? controls : []).map((action) => /* @__PURE__ */ React__default["default"].createElement(action.Component, {
8900
8693
  key: action.state.key,
8901
8694
  model: action
@@ -8930,7 +8723,7 @@ function NestedSceneRenderer({ model }) {
8930
8723
  model: body
8931
8724
  }));
8932
8725
  }
8933
- const getStyles$4 = (theme) => ({
8726
+ const getStyles$5 = (theme) => ({
8934
8727
  wrapper: css.css({
8935
8728
  display: "flex",
8936
8729
  flexDirection: "column",
@@ -9097,30 +8890,30 @@ function getShiftedTimeRange(dir, timeRange, upperLimit) {
9097
8890
  };
9098
8891
  }
9099
8892
 
9100
- var __defProp$5 = Object.defineProperty;
9101
- var __defProps$2 = Object.defineProperties;
9102
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9103
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9104
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9105
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9106
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9107
- var __spreadValues$5 = (a, b) => {
8893
+ var __defProp$6 = Object.defineProperty;
8894
+ var __defProps$3 = Object.defineProperties;
8895
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
8896
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
8897
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
8898
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
8899
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8900
+ var __spreadValues$6 = (a, b) => {
9108
8901
  for (var prop in b || (b = {}))
9109
- if (__hasOwnProp$5.call(b, prop))
9110
- __defNormalProp$5(a, prop, b[prop]);
9111
- if (__getOwnPropSymbols$5)
9112
- for (var prop of __getOwnPropSymbols$5(b)) {
9113
- if (__propIsEnum$5.call(b, prop))
9114
- __defNormalProp$5(a, prop, b[prop]);
8902
+ if (__hasOwnProp$6.call(b, prop))
8903
+ __defNormalProp$6(a, prop, b[prop]);
8904
+ if (__getOwnPropSymbols$6)
8905
+ for (var prop of __getOwnPropSymbols$6(b)) {
8906
+ if (__propIsEnum$6.call(b, prop))
8907
+ __defNormalProp$6(a, prop, b[prop]);
9115
8908
  }
9116
8909
  return a;
9117
8910
  };
9118
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
8911
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
9119
8912
  const DEFAULT_INTERVALS = ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"];
9120
8913
  class SceneRefreshPicker extends SceneObjectBase {
9121
8914
  constructor(state) {
9122
8915
  var _a, _b, _c;
9123
- super(__spreadProps$2(__spreadValues$5({
8916
+ super(__spreadProps$3(__spreadValues$6({
9124
8917
  refresh: ""
9125
8918
  }, state), {
9126
8919
  autoValue: void 0,
@@ -9201,55 +8994,283 @@ class SceneRefreshPicker extends SceneObjectBase {
9201
8994
  }
9202
8995
  getUrlState() {
9203
8996
  return {
9204
- refresh: this.state.refresh
8997
+ refresh: this.state.refresh
8998
+ };
8999
+ }
9000
+ updateFromUrl(values) {
9001
+ const refresh = values.refresh;
9002
+ if (refresh && typeof refresh === "string") {
9003
+ this.setState({
9004
+ refresh
9005
+ });
9006
+ }
9007
+ }
9008
+ }
9009
+ SceneRefreshPicker.Component = SceneRefreshPickerRenderer;
9010
+ function SceneRefreshPickerRenderer({ model }) {
9011
+ var _a;
9012
+ const { refresh, intervals, autoEnabled, autoValue, isOnCanvas, primary, withText } = model.useState();
9013
+ const isRunning = useQueryControllerState(model);
9014
+ let text = refresh === ((_a = ui.RefreshPicker.autoOption) == null ? void 0 : _a.value) ? autoValue : withText ? "Refresh" : void 0;
9015
+ let tooltip;
9016
+ let width;
9017
+ if (isRunning) {
9018
+ tooltip = "Cancel all queries";
9019
+ if (withText) {
9020
+ text = "Cancel";
9021
+ }
9022
+ }
9023
+ if (withText) {
9024
+ width = "96px";
9025
+ }
9026
+ return /* @__PURE__ */ React__default["default"].createElement(ui.RefreshPicker, {
9027
+ showAutoInterval: autoEnabled,
9028
+ value: refresh,
9029
+ intervals,
9030
+ tooltip,
9031
+ width,
9032
+ text,
9033
+ onRefresh: model.onRefresh,
9034
+ primary,
9035
+ onIntervalChanged: model.onIntervalChanged,
9036
+ isLoading: isRunning,
9037
+ isOnCanvas: isOnCanvas != null ? isOnCanvas : true
9038
+ });
9039
+ }
9040
+ function useQueryControllerState(model) {
9041
+ const queryController = sceneGraph.getQueryController(model);
9042
+ if (!queryController) {
9043
+ return false;
9044
+ }
9045
+ return queryController.useState().isRunning;
9046
+ }
9047
+
9048
+ const getCompareSeriesRefId = (refId) => `${refId}-compare`;
9049
+
9050
+ var __defProp$5 = Object.defineProperty;
9051
+ var __defProps$2 = Object.defineProperties;
9052
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
9053
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
9054
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
9055
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
9056
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9057
+ var __spreadValues$5 = (a, b) => {
9058
+ for (var prop in b || (b = {}))
9059
+ if (__hasOwnProp$5.call(b, prop))
9060
+ __defNormalProp$5(a, prop, b[prop]);
9061
+ if (__getOwnPropSymbols$5)
9062
+ for (var prop of __getOwnPropSymbols$5(b)) {
9063
+ if (__propIsEnum$5.call(b, prop))
9064
+ __defNormalProp$5(a, prop, b[prop]);
9065
+ }
9066
+ return a;
9067
+ };
9068
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
9069
+ const PREVIOUS_PERIOD_VALUE = "__previousPeriod";
9070
+ const NO_PERIOD_VALUE = "__noPeriod";
9071
+ const PREVIOUS_PERIOD_COMPARE_OPTION = {
9072
+ label: "Previous period",
9073
+ value: PREVIOUS_PERIOD_VALUE
9074
+ };
9075
+ const NO_COMPARE_OPTION = {
9076
+ label: "No comparison",
9077
+ value: NO_PERIOD_VALUE
9078
+ };
9079
+ const DEFAULT_COMPARE_OPTIONS = [
9080
+ { label: "Day before", value: "24h" },
9081
+ { label: "Week before", value: "1w" },
9082
+ { label: "Month before", value: "1M" }
9083
+ ];
9084
+ class SceneTimeRangeCompare extends SceneObjectBase {
9085
+ constructor(state) {
9086
+ super(__spreadValues$5({ compareOptions: DEFAULT_COMPARE_OPTIONS }, state));
9087
+ this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["compareWith"] });
9088
+ this._onActivate = () => {
9089
+ const sceneTimeRange = sceneGraph.getTimeRange(this);
9090
+ this.setState({ compareOptions: this.getCompareOptions(sceneTimeRange.state.value) });
9091
+ this._subs.add(
9092
+ sceneTimeRange.subscribeToState((timeRange) => {
9093
+ const compareOptions = this.getCompareOptions(timeRange.value);
9094
+ const stateUpdate = { compareOptions };
9095
+ if (Boolean(this.state.compareWith) && !compareOptions.find(({ value }) => value === this.state.compareWith)) {
9096
+ stateUpdate.compareWith = PREVIOUS_PERIOD_VALUE;
9097
+ }
9098
+ this.setState(stateUpdate);
9099
+ })
9100
+ );
9101
+ };
9102
+ this.getCompareOptions = (timeRange) => {
9103
+ const diffDays = Math.ceil(timeRange.to.diff(timeRange.from));
9104
+ const matchIndex = DEFAULT_COMPARE_OPTIONS.findIndex(({ value }) => {
9105
+ const intervalInMs = data.rangeUtil.intervalToMs(value);
9106
+ return intervalInMs >= diffDays;
9107
+ });
9108
+ return [
9109
+ NO_COMPARE_OPTION,
9110
+ PREVIOUS_PERIOD_COMPARE_OPTION,
9111
+ ...DEFAULT_COMPARE_OPTIONS.slice(matchIndex).map(({ label, value }) => ({ label, value }))
9112
+ ];
9113
+ };
9114
+ this.onCompareWithChanged = (compareWith) => {
9115
+ if (compareWith === NO_PERIOD_VALUE) {
9116
+ this.onClearCompare();
9117
+ } else {
9118
+ this.setState({ compareWith });
9119
+ }
9120
+ };
9121
+ this.onClearCompare = () => {
9122
+ this.setState({ compareWith: void 0 });
9123
+ };
9124
+ this.addActivationHandler(this._onActivate);
9125
+ }
9126
+ getExtraQueries(request) {
9127
+ const extraQueries = [];
9128
+ const compareRange = this.getCompareTimeRange(request.range);
9129
+ if (!compareRange) {
9130
+ return extraQueries;
9131
+ }
9132
+ const targets = request.targets.filter((query) => query.timeRangeCompare !== false);
9133
+ if (targets.length) {
9134
+ extraQueries.push({
9135
+ req: __spreadProps$2(__spreadValues$5({}, request), {
9136
+ targets,
9137
+ range: compareRange
9138
+ }),
9139
+ processor: timeShiftAlignmentProcessor
9140
+ });
9141
+ }
9142
+ return extraQueries;
9143
+ }
9144
+ shouldRerun(prev, next) {
9145
+ return prev.compareWith !== next.compareWith;
9146
+ }
9147
+ getCompareTimeRange(timeRange) {
9148
+ let compareFrom;
9149
+ let compareTo;
9150
+ if (this.state.compareWith) {
9151
+ if (this.state.compareWith === PREVIOUS_PERIOD_VALUE) {
9152
+ const diffMs = timeRange.to.diff(timeRange.from);
9153
+ compareFrom = data.dateTime(timeRange.from).subtract(diffMs);
9154
+ compareTo = data.dateTime(timeRange.to).subtract(diffMs);
9155
+ } else {
9156
+ compareFrom = data.dateTime(timeRange.from).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
9157
+ compareTo = data.dateTime(timeRange.to).subtract(data.rangeUtil.intervalToMs(this.state.compareWith));
9158
+ }
9159
+ return {
9160
+ from: compareFrom,
9161
+ to: compareTo,
9162
+ raw: {
9163
+ from: compareFrom,
9164
+ to: compareTo
9165
+ }
9166
+ };
9167
+ }
9168
+ return void 0;
9169
+ }
9170
+ getUrlState() {
9171
+ return {
9172
+ compareWith: this.state.compareWith
9205
9173
  };
9206
9174
  }
9207
9175
  updateFromUrl(values) {
9208
- const refresh = values.refresh;
9209
- if (refresh && typeof refresh === "string") {
9210
- this.setState({
9211
- refresh
9212
- });
9176
+ if (!values.compareWith) {
9177
+ return;
9178
+ }
9179
+ const compareWith = parseUrlParam(values.compareWith);
9180
+ if (compareWith) {
9181
+ const compareOptions = this.getCompareOptions(sceneGraph.getTimeRange(this).state.value);
9182
+ if (compareOptions.find(({ value }) => value === compareWith)) {
9183
+ this.setState({
9184
+ compareWith
9185
+ });
9186
+ } else {
9187
+ this.setState({
9188
+ compareWith: "__previousPeriod"
9189
+ });
9190
+ }
9213
9191
  }
9214
9192
  }
9215
9193
  }
9216
- SceneRefreshPicker.Component = SceneRefreshPickerRenderer;
9217
- function SceneRefreshPickerRenderer({ model }) {
9194
+ SceneTimeRangeCompare.Component = SceneTimeRangeCompareRenderer;
9195
+ const timeShiftAlignmentProcessor = (primary, secondary) => {
9196
+ const diff = secondary.timeRange.from.diff(primary.timeRange.from);
9197
+ secondary.series.forEach((series) => {
9198
+ series.refId = getCompareSeriesRefId(series.refId || "");
9199
+ series.meta = __spreadProps$2(__spreadValues$5({}, series.meta), {
9200
+ timeCompare: {
9201
+ diffMs: diff,
9202
+ isTimeShiftQuery: true
9203
+ }
9204
+ });
9205
+ series.fields.forEach((field) => {
9206
+ if (field.type === data.FieldType.time) {
9207
+ field.values = field.values.map((v) => {
9208
+ return diff < 0 ? v - diff : v + diff;
9209
+ });
9210
+ }
9211
+ field.config = __spreadProps$2(__spreadValues$5({}, field.config), {
9212
+ color: {
9213
+ mode: "fixed",
9214
+ fixedColor: runtime.config.theme.palette.gray60
9215
+ }
9216
+ });
9217
+ return field;
9218
+ });
9219
+ });
9220
+ return rxjs.of(secondary);
9221
+ };
9222
+ function SceneTimeRangeCompareRenderer({ model }) {
9218
9223
  var _a;
9219
- const { refresh, intervals, autoEnabled, autoValue, isOnCanvas, primary, withText } = model.useState();
9220
- const isRunning = useQueryControllerState(model);
9221
- let text = refresh === ((_a = ui.RefreshPicker.autoOption) == null ? void 0 : _a.value) ? autoValue : withText ? "Refresh" : void 0;
9222
- let tooltip;
9223
- let width;
9224
- if (isRunning) {
9225
- tooltip = "Cancel all queries";
9226
- if (withText) {
9227
- text = "Cancel";
9224
+ const styles = ui.useStyles2(getStyles$4);
9225
+ const { compareWith, compareOptions } = model.useState();
9226
+ const [previousCompare, setPreviousCompare] = React__default["default"].useState(compareWith);
9227
+ const previousValue = (_a = compareOptions.find(({ value: value2 }) => value2 === previousCompare)) != null ? _a : PREVIOUS_PERIOD_COMPARE_OPTION;
9228
+ const value = compareOptions.find(({ value: value2 }) => value2 === compareWith);
9229
+ const enabled = Boolean(value);
9230
+ const onClick = () => {
9231
+ if (enabled) {
9232
+ setPreviousCompare(compareWith);
9233
+ model.onClearCompare();
9234
+ } else if (!enabled) {
9235
+ model.onCompareWithChanged(previousValue.value);
9228
9236
  }
9229
- }
9230
- if (withText) {
9231
- width = "96px";
9232
- }
9233
- return /* @__PURE__ */ React__default["default"].createElement(ui.RefreshPicker, {
9234
- showAutoInterval: autoEnabled,
9235
- value: refresh,
9236
- intervals,
9237
- tooltip,
9238
- width,
9239
- text,
9240
- onRefresh: model.onRefresh,
9241
- primary,
9242
- onIntervalChanged: model.onIntervalChanged,
9243
- isLoading: isRunning,
9244
- isOnCanvas: isOnCanvas != null ? isOnCanvas : true
9245
- });
9237
+ };
9238
+ return /* @__PURE__ */ React__default["default"].createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
9239
+ variant: "canvas",
9240
+ tooltip: "Enable time frame comparison",
9241
+ onClick: (e) => {
9242
+ e.stopPropagation();
9243
+ e.preventDefault();
9244
+ onClick();
9245
+ }
9246
+ }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
9247
+ label: " ",
9248
+ value: enabled,
9249
+ onClick
9250
+ }), "Comparison"), enabled ? /* @__PURE__ */ React__default["default"].createElement(ui.ButtonSelect, {
9251
+ variant: "canvas",
9252
+ value,
9253
+ options: compareOptions,
9254
+ onChange: (v) => {
9255
+ model.onCompareWithChanged(v.value);
9256
+ }
9257
+ }) : /* @__PURE__ */ React__default["default"].createElement(ui.ToolbarButton, {
9258
+ className: styles.previewButton,
9259
+ disabled: true,
9260
+ variant: "canvas",
9261
+ isOpen: false
9262
+ }, previousValue.label));
9246
9263
  }
9247
- function useQueryControllerState(model) {
9248
- const queryController = sceneGraph.getQueryController(model);
9249
- if (!queryController) {
9250
- return false;
9251
- }
9252
- return queryController.useState().isRunning;
9264
+ function getStyles$4(theme) {
9265
+ return {
9266
+ previewButton: css.css({
9267
+ "&:disabled": {
9268
+ border: `1px solid ${theme.colors.secondary.border}`,
9269
+ color: theme.colors.text.disabled,
9270
+ opacity: 1
9271
+ }
9272
+ })
9273
+ };
9253
9274
  }
9254
9275
 
9255
9276
  class SceneByFrameRepeater extends SceneObjectBase {
@@ -11116,6 +11137,174 @@ const PanelBuilders = {
11116
11137
  }
11117
11138
  };
11118
11139
 
11140
+ class VizConfigBuilder {
11141
+ constructor(pluginId, pluginVersion, defaultOptions, defaultFieldConfig) {
11142
+ this._pluginId = pluginId;
11143
+ this._pluginVersion = pluginVersion;
11144
+ this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);
11145
+ this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);
11146
+ }
11147
+ setColor(color) {
11148
+ this._fieldConfigBuilder.setColor(color);
11149
+ return this;
11150
+ }
11151
+ setDecimals(decimals) {
11152
+ this._fieldConfigBuilder.setDecimals(decimals);
11153
+ return this;
11154
+ }
11155
+ setDisplayName(displayName) {
11156
+ this._fieldConfigBuilder.setDisplayName(displayName);
11157
+ return this;
11158
+ }
11159
+ setFilterable(filterable) {
11160
+ this._fieldConfigBuilder.setFilterable(filterable);
11161
+ return this;
11162
+ }
11163
+ setLinks(links) {
11164
+ this._fieldConfigBuilder.setLinks(links);
11165
+ return this;
11166
+ }
11167
+ setMappings(mappings) {
11168
+ this._fieldConfigBuilder.setMappings(mappings);
11169
+ return this;
11170
+ }
11171
+ setMax(max) {
11172
+ this._fieldConfigBuilder.setMax(max);
11173
+ return this;
11174
+ }
11175
+ setMin(min) {
11176
+ this._fieldConfigBuilder.setMin(min);
11177
+ return this;
11178
+ }
11179
+ setNoValue(noValue) {
11180
+ this._fieldConfigBuilder.setNoValue(noValue);
11181
+ return this;
11182
+ }
11183
+ setThresholds(thresholds) {
11184
+ this._fieldConfigBuilder.setThresholds(thresholds);
11185
+ return this;
11186
+ }
11187
+ setUnit(unit) {
11188
+ this._fieldConfigBuilder.setUnit(unit);
11189
+ return this;
11190
+ }
11191
+ setCustomFieldConfig(id, value) {
11192
+ this._fieldConfigBuilder.setCustomFieldConfig(id, value);
11193
+ return this;
11194
+ }
11195
+ setOverrides(builder) {
11196
+ this._fieldConfigBuilder.setOverrides(builder);
11197
+ return this;
11198
+ }
11199
+ setOption(id, value) {
11200
+ this._panelOptionsBuilder.setOption(id, value);
11201
+ return this;
11202
+ }
11203
+ build() {
11204
+ return {
11205
+ pluginId: this._pluginId,
11206
+ pluginVersion: this._pluginVersion,
11207
+ options: this._panelOptionsBuilder.build(),
11208
+ fieldConfig: this._fieldConfigBuilder.build()
11209
+ };
11210
+ }
11211
+ }
11212
+
11213
+ const VizConfigBuilders = {
11214
+ barchart() {
11215
+ return new VizConfigBuilder(
11216
+ "barchart",
11217
+ "10.0.0",
11218
+ () => BarChartPanelCfg_types_gen.defaultOptions,
11219
+ () => BarChartPanelCfg_types_gen.defaultFieldConfig
11220
+ );
11221
+ },
11222
+ bargauge() {
11223
+ return new VizConfigBuilder("bargauge", "10.0.0", () => BarGaugePanelCfg_types_gen.defaultOptions);
11224
+ },
11225
+ datagrid() {
11226
+ return new VizConfigBuilder("datagrid", "10.0.0", () => DatagridPanelCfg_types_gen.defaultOptions);
11227
+ },
11228
+ flamegraph() {
11229
+ return new VizConfigBuilder("flamegraph", "10.0.0");
11230
+ },
11231
+ gauge() {
11232
+ return new VizConfigBuilder("gauge", "10.0.0", () => GaugePanelCfg_types_gen.defaultOptions);
11233
+ },
11234
+ geomap() {
11235
+ return new VizConfigBuilder("geomap", "10.0.0", () => GeomapPanelCfg_types_gen.defaultOptions);
11236
+ },
11237
+ heatmap() {
11238
+ return new VizConfigBuilder("heatmap", "10.0.0", () => HeatmapPanelCfg_types_gen.defaultOptions);
11239
+ },
11240
+ histogram() {
11241
+ return new VizConfigBuilder(
11242
+ "histogram",
11243
+ "10.0.0",
11244
+ () => HistogramPanelCfg_types_gen.defaultOptions,
11245
+ () => HistogramPanelCfg_types_gen.defaultFieldConfig
11246
+ );
11247
+ },
11248
+ logs() {
11249
+ return new VizConfigBuilder("logs", "10.0.0");
11250
+ },
11251
+ news() {
11252
+ return new VizConfigBuilder("news", "10.0.0", () => NewsPanelCfg_types_gen.defaultOptions);
11253
+ },
11254
+ nodegraph() {
11255
+ return new VizConfigBuilder("nodeGraph", "10.0.0");
11256
+ },
11257
+ piechart() {
11258
+ return new VizConfigBuilder(
11259
+ "piechart",
11260
+ "10.0.0",
11261
+ () => PieChartPanelCfg_types_gen.defaultOptions
11262
+ );
11263
+ },
11264
+ stat() {
11265
+ return new VizConfigBuilder("stat", "10.0.0", () => StatPanelCfg_types_gen.defaultOptions);
11266
+ },
11267
+ statetimeline() {
11268
+ return new VizConfigBuilder(
11269
+ "state-timeline",
11270
+ "10.0.0",
11271
+ () => StateTimelinePanelCfg_types_gen.defaultOptions,
11272
+ () => StateTimelinePanelCfg_types_gen.defaultFieldConfig
11273
+ );
11274
+ },
11275
+ statushistory() {
11276
+ return new VizConfigBuilder(
11277
+ "status-history",
11278
+ "10.0.0",
11279
+ () => StatusHistoryPanelCfg_types_gen.defaultOptions,
11280
+ () => StatusHistoryPanelCfg_types_gen.defaultFieldConfig
11281
+ );
11282
+ },
11283
+ table() {
11284
+ return new VizConfigBuilder("table", "10.0.0", () => TablePanelCfg_types_gen.defaultOptions);
11285
+ },
11286
+ text() {
11287
+ return new VizConfigBuilder("text", "10.0.0", () => TextPanelCfg_types_gen.defaultOptions);
11288
+ },
11289
+ timeseries() {
11290
+ return new VizConfigBuilder("timeseries", "10.0.0");
11291
+ },
11292
+ trend() {
11293
+ return new VizConfigBuilder("trend", "10.0.0");
11294
+ },
11295
+ traces() {
11296
+ return new VizConfigBuilder("traces", "10.0.0");
11297
+ },
11298
+ xychart() {
11299
+ return new VizConfigBuilder(
11300
+ "xychart",
11301
+ "10.0.0",
11302
+ () => XYChartPanelCfg_types_gen.defaultOptions,
11303
+ () => XYChartPanelCfg_types_gen.defaultFieldConfig
11304
+ );
11305
+ }
11306
+ };
11307
+
11119
11308
  const sceneUtils = {
11120
11309
  getUrlWithAppState,
11121
11310
  registerRuntimePanelPlugin,
@@ -11140,6 +11329,7 @@ exports.ConstantVariable = ConstantVariable;
11140
11329
  exports.CustomVariable = CustomVariable;
11141
11330
  exports.DataSourceVariable = DataSourceVariable;
11142
11331
  exports.EmbeddedScene = EmbeddedScene;
11332
+ exports.FieldConfigBuilder = FieldConfigBuilder;
11143
11333
  exports.FieldConfigBuilders = FieldConfigBuilders;
11144
11334
  exports.FieldConfigOverridesBuilder = FieldConfigOverridesBuilder;
11145
11335
  exports.GroupByVariable = GroupByVariable;
@@ -11194,7 +11384,10 @@ exports.UrlSyncManager = UrlSyncManager;
11194
11384
  exports.UserActionEvent = UserActionEvent;
11195
11385
  exports.VariableDependencyConfig = VariableDependencyConfig;
11196
11386
  exports.VariableValueControl = VariableValueControl;
11387
+ exports.VariableValueSelectWrapper = VariableValueSelectWrapper;
11197
11388
  exports.VariableValueSelectors = VariableValueSelectors;
11389
+ exports.VizConfigBuilder = VizConfigBuilder;
11390
+ exports.VizConfigBuilders = VizConfigBuilders;
11198
11391
  exports.VizPanel = VizPanel;
11199
11392
  exports.VizPanelBuilder = VizPanelBuilder;
11200
11393
  exports.VizPanelMenu = VizPanelMenu;