@grafana/scenes 6.25.0 → 6.26.1--canary.1173.15996524097.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.
package/dist/index.js CHANGED
@@ -8378,6 +8378,253 @@ const createProperty = (color) => {
8378
8378
  };
8379
8379
  };
8380
8380
 
8381
+ class SceneDataLayerSetBase extends SceneObjectBase {
8382
+ constructor() {
8383
+ super(...arguments);
8384
+ /** Mark it as a data layer */
8385
+ this.isDataLayer = true;
8386
+ /**
8387
+ * Subject to emit results to.
8388
+ */
8389
+ this._results = new rxjs.ReplaySubject(1);
8390
+ this._dataLayersMerger = new DataLayersMerger();
8391
+ }
8392
+ subscribeToAllLayers(layers) {
8393
+ if (layers.length > 0) {
8394
+ this.querySub = this._dataLayersMerger.getMergedStream(layers).subscribe(this._onLayerUpdateReceived.bind(this));
8395
+ } else {
8396
+ this._results.next({ origin: this, data: emptyPanelData });
8397
+ this.setStateHelper({ data: emptyPanelData });
8398
+ }
8399
+ }
8400
+ _onLayerUpdateReceived(results) {
8401
+ var _a;
8402
+ let series = [];
8403
+ for (const result of results) {
8404
+ if ((_a = result.data) == null ? void 0 : _a.series) {
8405
+ series = series.concat(result.data.series);
8406
+ }
8407
+ }
8408
+ const combinedData = { ...emptyPanelData, series };
8409
+ this._results.next({ origin: this, data: combinedData });
8410
+ this.setStateHelper({ data: combinedData });
8411
+ }
8412
+ getResultsStream() {
8413
+ return this._results;
8414
+ }
8415
+ cancelQuery() {
8416
+ var _a;
8417
+ (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
8418
+ }
8419
+ /**
8420
+ * This helper function is to counter the contravariance of setState
8421
+ */
8422
+ setStateHelper(state) {
8423
+ setBaseClassState(this, state);
8424
+ }
8425
+ }
8426
+ class SceneDataLayerSet extends SceneDataLayerSetBase {
8427
+ constructor(state) {
8428
+ var _a, _b;
8429
+ super({
8430
+ name: (_a = state.name) != null ? _a : "Data layers",
8431
+ layers: (_b = state.layers) != null ? _b : []
8432
+ });
8433
+ this.addActivationHandler(() => this._onActivate());
8434
+ }
8435
+ _onActivate() {
8436
+ this._subs.add(
8437
+ this.subscribeToState((newState, oldState) => {
8438
+ var _a;
8439
+ if (newState.layers !== oldState.layers) {
8440
+ (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
8441
+ this.subscribeToAllLayers(newState.layers);
8442
+ }
8443
+ })
8444
+ );
8445
+ this.subscribeToAllLayers(this.state.layers);
8446
+ return () => {
8447
+ var _a;
8448
+ (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
8449
+ };
8450
+ }
8451
+ }
8452
+ SceneDataLayerSet.Component = ({ model }) => {
8453
+ const { layers } = model.useState();
8454
+ return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, layers.map((layer) => /* @__PURE__ */ React__default.default.createElement(layer.Component, { model: layer, key: layer.state.key })));
8455
+ };
8456
+
8457
+ class SceneDataTransformer extends SceneObjectBase {
8458
+ constructor(state) {
8459
+ super(state);
8460
+ this._results = new rxjs.ReplaySubject(1);
8461
+ /**
8462
+ * Scan transformations for variable usage and re-process transforms when a variable values change
8463
+ */
8464
+ this._variableDependency = new VariableDependencyConfig(
8465
+ this,
8466
+ {
8467
+ statePaths: ["transformations"],
8468
+ onReferencedVariableValueChanged: () => this.reprocessTransformations()
8469
+ }
8470
+ );
8471
+ this.addActivationHandler(() => this.activationHandler());
8472
+ }
8473
+ activationHandler() {
8474
+ const sourceData = this.getSourceData();
8475
+ this._subs.add(sourceData.subscribeToState((state) => this.transform(state.data)));
8476
+ if (sourceData.state.data) {
8477
+ this.transform(sourceData.state.data);
8478
+ }
8479
+ return () => {
8480
+ if (this._transformSub) {
8481
+ this._transformSub.unsubscribe();
8482
+ }
8483
+ };
8484
+ }
8485
+ getSourceData() {
8486
+ if (this.state.$data) {
8487
+ if (this.state.$data instanceof SceneDataLayerSet) {
8488
+ throw new Error("SceneDataLayerSet can not be used as data provider for SceneDataTransformer.");
8489
+ }
8490
+ return this.state.$data;
8491
+ }
8492
+ if (!this.parent || !this.parent.parent) {
8493
+ throw new Error("SceneDataTransformer must either have $data set on it or have a parent.parent with $data");
8494
+ }
8495
+ return sceneGraph.getData(this.parent.parent);
8496
+ }
8497
+ setContainerWidth(width) {
8498
+ if (this.state.$data && this.state.$data.setContainerWidth) {
8499
+ this.state.$data.setContainerWidth(width);
8500
+ }
8501
+ }
8502
+ isDataReadyToDisplay() {
8503
+ const dataObject = this.getSourceData();
8504
+ if (dataObject.isDataReadyToDisplay) {
8505
+ return dataObject.isDataReadyToDisplay();
8506
+ }
8507
+ return true;
8508
+ }
8509
+ reprocessTransformations() {
8510
+ this.transform(this.getSourceData().state.data, true);
8511
+ }
8512
+ cancelQuery() {
8513
+ var _a, _b;
8514
+ (_b = (_a = this.getSourceData()).cancelQuery) == null ? void 0 : _b.call(_a);
8515
+ }
8516
+ getResultsStream() {
8517
+ return this._results;
8518
+ }
8519
+ clone(withState) {
8520
+ const clone = super.clone(withState);
8521
+ if (this._prevDataFromSource) {
8522
+ clone["_prevDataFromSource"] = this._prevDataFromSource;
8523
+ }
8524
+ return clone;
8525
+ }
8526
+ haveAlreadyTransformedData(data) {
8527
+ if (!this._prevDataFromSource) {
8528
+ return false;
8529
+ }
8530
+ if (data === this._prevDataFromSource) {
8531
+ return true;
8532
+ }
8533
+ const { series, annotations } = this._prevDataFromSource;
8534
+ if (data.series === series && data.annotations === annotations) {
8535
+ if (this.state.data && data.state !== this.state.data.state) {
8536
+ this.setState({ data: { ...this.state.data, state: data.state } });
8537
+ }
8538
+ return true;
8539
+ }
8540
+ return false;
8541
+ }
8542
+ transform(data$1, force = false) {
8543
+ var _a;
8544
+ if (this.state.transformations.length === 0 || !data$1) {
8545
+ this._prevDataFromSource = data$1;
8546
+ this.setState({ data: data$1 });
8547
+ if (data$1) {
8548
+ this._results.next({ origin: this, data: data$1 });
8549
+ }
8550
+ return;
8551
+ }
8552
+ if (!force && this.haveAlreadyTransformedData(data$1)) {
8553
+ return;
8554
+ }
8555
+ let interpolatedTransformations = this._interpolateVariablesInTransformationConfigs(data$1);
8556
+ const seriesTransformations = interpolatedTransformations.filter((transformation) => {
8557
+ if ("options" in transformation || "topic" in transformation) {
8558
+ return transformation.topic == null || transformation.topic === data.DataTopic.Series;
8559
+ }
8560
+ return true;
8561
+ }).map((transformation) => "operator" in transformation ? transformation.operator : transformation);
8562
+ const annotationsTransformations = interpolatedTransformations.filter((transformation) => {
8563
+ if ("options" in transformation || "topic" in transformation) {
8564
+ return transformation.topic === data.DataTopic.Annotations;
8565
+ }
8566
+ return false;
8567
+ }).map((transformation) => "operator" in transformation ? transformation.operator : transformation);
8568
+ if (this._transformSub) {
8569
+ this._transformSub.unsubscribe();
8570
+ }
8571
+ const ctx = {
8572
+ interpolate: (value) => {
8573
+ var _a2;
8574
+ return sceneGraph.interpolate(this, value, (_a2 = data$1.request) == null ? void 0 : _a2.scopedVars);
8575
+ }
8576
+ };
8577
+ let streams = [data.transformDataFrame(seriesTransformations, data$1.series, ctx)];
8578
+ if (data$1.annotations && data$1.annotations.length > 0 && annotationsTransformations.length > 0) {
8579
+ streams.push(data.transformDataFrame(annotationsTransformations, (_a = data$1.annotations) != null ? _a : []));
8580
+ }
8581
+ this._transformSub = rxjs.forkJoin(streams).pipe(
8582
+ rxjs.map((values) => {
8583
+ const transformedSeries = values[0];
8584
+ const transformedAnnotations = values[1];
8585
+ return {
8586
+ ...data$1,
8587
+ series: transformedSeries,
8588
+ annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
8589
+ };
8590
+ }),
8591
+ rxjs.catchError((err) => {
8592
+ var _a2;
8593
+ console.error("Error transforming data: ", err);
8594
+ const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
8595
+ const transformationError = runtime.toDataQueryError(err);
8596
+ transformationError.message = `Error transforming data: ${transformationError.message}`;
8597
+ const result = {
8598
+ ...data$1,
8599
+ state: data.LoadingState.Error,
8600
+ // Combine transformation error with upstream errors
8601
+ errors: [...sourceErr, transformationError]
8602
+ };
8603
+ return rxjs.of(result);
8604
+ })
8605
+ ).subscribe((transformedData) => {
8606
+ this.setState({ data: transformedData });
8607
+ this._results.next({ origin: this, data: transformedData });
8608
+ this._prevDataFromSource = data$1;
8609
+ });
8610
+ }
8611
+ _interpolateVariablesInTransformationConfigs(data) {
8612
+ var _a;
8613
+ const transformations = this.state.transformations;
8614
+ if (this._variableDependency.getNames().size === 0) {
8615
+ return transformations;
8616
+ }
8617
+ const onlyObjects = transformations.every((t) => typeof t === "object");
8618
+ if (onlyObjects) {
8619
+ return JSON.parse(sceneGraph.interpolate(this, JSON.stringify(transformations), (_a = data.request) == null ? void 0 : _a.scopedVars));
8620
+ }
8621
+ return transformations.map((t) => {
8622
+ var _a2;
8623
+ return typeof t === "object" ? JSON.parse(sceneGraph.interpolate(this, JSON.stringify(t), (_a2 = data.request) == null ? void 0 : _a2.scopedVars)) : t;
8624
+ });
8625
+ }
8626
+ }
8627
+
8381
8628
  class VizPanel extends SceneObjectBase {
8382
8629
  constructor(state) {
8383
8630
  var _a;
@@ -8616,6 +8863,17 @@ class VizPanel extends SceneObjectBase {
8616
8863
  if (plugin.onPanelMigration && currentVersion !== pluginVersion && !isAfterPluginChange) {
8617
8864
  panel.options = await plugin.onPanelMigration(panel);
8618
8865
  }
8866
+ let $data = this.state.$data;
8867
+ if (panel.transformations && $data) {
8868
+ if ($data instanceof SceneDataTransformer) {
8869
+ $data.setState({ transformations: panel.transformations });
8870
+ } else if ($data instanceof SceneQueryRunner) {
8871
+ $data = new SceneDataTransformer({
8872
+ transformations: panel.transformations,
8873
+ $data
8874
+ });
8875
+ }
8876
+ }
8619
8877
  const withDefaults = data.getPanelOptionsWithDefaults({
8620
8878
  plugin,
8621
8879
  currentOptions: panel.options,
@@ -8624,6 +8882,7 @@ class VizPanel extends SceneObjectBase {
8624
8882
  });
8625
8883
  this._plugin = plugin;
8626
8884
  this.setState({
8885
+ $data,
8627
8886
  options: withDefaults.options,
8628
8887
  fieldConfig: withDefaults.fieldConfig,
8629
8888
  pluginVersion: currentVersion,
@@ -9520,253 +9779,6 @@ class DataProviderProxy extends SceneObjectBase {
9520
9779
  }
9521
9780
  }
9522
9781
 
9523
- class SceneDataLayerSetBase extends SceneObjectBase {
9524
- constructor() {
9525
- super(...arguments);
9526
- /** Mark it as a data layer */
9527
- this.isDataLayer = true;
9528
- /**
9529
- * Subject to emit results to.
9530
- */
9531
- this._results = new rxjs.ReplaySubject(1);
9532
- this._dataLayersMerger = new DataLayersMerger();
9533
- }
9534
- subscribeToAllLayers(layers) {
9535
- if (layers.length > 0) {
9536
- this.querySub = this._dataLayersMerger.getMergedStream(layers).subscribe(this._onLayerUpdateReceived.bind(this));
9537
- } else {
9538
- this._results.next({ origin: this, data: emptyPanelData });
9539
- this.setStateHelper({ data: emptyPanelData });
9540
- }
9541
- }
9542
- _onLayerUpdateReceived(results) {
9543
- var _a;
9544
- let series = [];
9545
- for (const result of results) {
9546
- if ((_a = result.data) == null ? void 0 : _a.series) {
9547
- series = series.concat(result.data.series);
9548
- }
9549
- }
9550
- const combinedData = { ...emptyPanelData, series };
9551
- this._results.next({ origin: this, data: combinedData });
9552
- this.setStateHelper({ data: combinedData });
9553
- }
9554
- getResultsStream() {
9555
- return this._results;
9556
- }
9557
- cancelQuery() {
9558
- var _a;
9559
- (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
9560
- }
9561
- /**
9562
- * This helper function is to counter the contravariance of setState
9563
- */
9564
- setStateHelper(state) {
9565
- setBaseClassState(this, state);
9566
- }
9567
- }
9568
- class SceneDataLayerSet extends SceneDataLayerSetBase {
9569
- constructor(state) {
9570
- var _a, _b;
9571
- super({
9572
- name: (_a = state.name) != null ? _a : "Data layers",
9573
- layers: (_b = state.layers) != null ? _b : []
9574
- });
9575
- this.addActivationHandler(() => this._onActivate());
9576
- }
9577
- _onActivate() {
9578
- this._subs.add(
9579
- this.subscribeToState((newState, oldState) => {
9580
- var _a;
9581
- if (newState.layers !== oldState.layers) {
9582
- (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
9583
- this.subscribeToAllLayers(newState.layers);
9584
- }
9585
- })
9586
- );
9587
- this.subscribeToAllLayers(this.state.layers);
9588
- return () => {
9589
- var _a;
9590
- (_a = this.querySub) == null ? void 0 : _a.unsubscribe();
9591
- };
9592
- }
9593
- }
9594
- SceneDataLayerSet.Component = ({ model }) => {
9595
- const { layers } = model.useState();
9596
- return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, layers.map((layer) => /* @__PURE__ */ React__default.default.createElement(layer.Component, { model: layer, key: layer.state.key })));
9597
- };
9598
-
9599
- class SceneDataTransformer extends SceneObjectBase {
9600
- constructor(state) {
9601
- super(state);
9602
- this._results = new rxjs.ReplaySubject(1);
9603
- /**
9604
- * Scan transformations for variable usage and re-process transforms when a variable values change
9605
- */
9606
- this._variableDependency = new VariableDependencyConfig(
9607
- this,
9608
- {
9609
- statePaths: ["transformations"],
9610
- onReferencedVariableValueChanged: () => this.reprocessTransformations()
9611
- }
9612
- );
9613
- this.addActivationHandler(() => this.activationHandler());
9614
- }
9615
- activationHandler() {
9616
- const sourceData = this.getSourceData();
9617
- this._subs.add(sourceData.subscribeToState((state) => this.transform(state.data)));
9618
- if (sourceData.state.data) {
9619
- this.transform(sourceData.state.data);
9620
- }
9621
- return () => {
9622
- if (this._transformSub) {
9623
- this._transformSub.unsubscribe();
9624
- }
9625
- };
9626
- }
9627
- getSourceData() {
9628
- if (this.state.$data) {
9629
- if (this.state.$data instanceof SceneDataLayerSet) {
9630
- throw new Error("SceneDataLayerSet can not be used as data provider for SceneDataTransformer.");
9631
- }
9632
- return this.state.$data;
9633
- }
9634
- if (!this.parent || !this.parent.parent) {
9635
- throw new Error("SceneDataTransformer must either have $data set on it or have a parent.parent with $data");
9636
- }
9637
- return sceneGraph.getData(this.parent.parent);
9638
- }
9639
- setContainerWidth(width) {
9640
- if (this.state.$data && this.state.$data.setContainerWidth) {
9641
- this.state.$data.setContainerWidth(width);
9642
- }
9643
- }
9644
- isDataReadyToDisplay() {
9645
- const dataObject = this.getSourceData();
9646
- if (dataObject.isDataReadyToDisplay) {
9647
- return dataObject.isDataReadyToDisplay();
9648
- }
9649
- return true;
9650
- }
9651
- reprocessTransformations() {
9652
- this.transform(this.getSourceData().state.data, true);
9653
- }
9654
- cancelQuery() {
9655
- var _a, _b;
9656
- (_b = (_a = this.getSourceData()).cancelQuery) == null ? void 0 : _b.call(_a);
9657
- }
9658
- getResultsStream() {
9659
- return this._results;
9660
- }
9661
- clone(withState) {
9662
- const clone = super.clone(withState);
9663
- if (this._prevDataFromSource) {
9664
- clone["_prevDataFromSource"] = this._prevDataFromSource;
9665
- }
9666
- return clone;
9667
- }
9668
- haveAlreadyTransformedData(data) {
9669
- if (!this._prevDataFromSource) {
9670
- return false;
9671
- }
9672
- if (data === this._prevDataFromSource) {
9673
- return true;
9674
- }
9675
- const { series, annotations } = this._prevDataFromSource;
9676
- if (data.series === series && data.annotations === annotations) {
9677
- if (this.state.data && data.state !== this.state.data.state) {
9678
- this.setState({ data: { ...this.state.data, state: data.state } });
9679
- }
9680
- return true;
9681
- }
9682
- return false;
9683
- }
9684
- transform(data$1, force = false) {
9685
- var _a;
9686
- if (this.state.transformations.length === 0 || !data$1) {
9687
- this._prevDataFromSource = data$1;
9688
- this.setState({ data: data$1 });
9689
- if (data$1) {
9690
- this._results.next({ origin: this, data: data$1 });
9691
- }
9692
- return;
9693
- }
9694
- if (!force && this.haveAlreadyTransformedData(data$1)) {
9695
- return;
9696
- }
9697
- let interpolatedTransformations = this._interpolateVariablesInTransformationConfigs(data$1);
9698
- const seriesTransformations = interpolatedTransformations.filter((transformation) => {
9699
- if ("options" in transformation || "topic" in transformation) {
9700
- return transformation.topic == null || transformation.topic === data.DataTopic.Series;
9701
- }
9702
- return true;
9703
- }).map((transformation) => "operator" in transformation ? transformation.operator : transformation);
9704
- const annotationsTransformations = interpolatedTransformations.filter((transformation) => {
9705
- if ("options" in transformation || "topic" in transformation) {
9706
- return transformation.topic === data.DataTopic.Annotations;
9707
- }
9708
- return false;
9709
- }).map((transformation) => "operator" in transformation ? transformation.operator : transformation);
9710
- if (this._transformSub) {
9711
- this._transformSub.unsubscribe();
9712
- }
9713
- const ctx = {
9714
- interpolate: (value) => {
9715
- var _a2;
9716
- return sceneGraph.interpolate(this, value, (_a2 = data$1.request) == null ? void 0 : _a2.scopedVars);
9717
- }
9718
- };
9719
- let streams = [data.transformDataFrame(seriesTransformations, data$1.series, ctx)];
9720
- if (data$1.annotations && data$1.annotations.length > 0 && annotationsTransformations.length > 0) {
9721
- streams.push(data.transformDataFrame(annotationsTransformations, (_a = data$1.annotations) != null ? _a : []));
9722
- }
9723
- this._transformSub = rxjs.forkJoin(streams).pipe(
9724
- rxjs.map((values) => {
9725
- const transformedSeries = values[0];
9726
- const transformedAnnotations = values[1];
9727
- return {
9728
- ...data$1,
9729
- series: transformedSeries,
9730
- annotations: transformedAnnotations != null ? transformedAnnotations : data$1.annotations
9731
- };
9732
- }),
9733
- rxjs.catchError((err) => {
9734
- var _a2;
9735
- console.error("Error transforming data: ", err);
9736
- const sourceErr = ((_a2 = this.getSourceData().state.data) == null ? void 0 : _a2.errors) || [];
9737
- const transformationError = runtime.toDataQueryError(err);
9738
- transformationError.message = `Error transforming data: ${transformationError.message}`;
9739
- const result = {
9740
- ...data$1,
9741
- state: data.LoadingState.Error,
9742
- // Combine transformation error with upstream errors
9743
- errors: [...sourceErr, transformationError]
9744
- };
9745
- return rxjs.of(result);
9746
- })
9747
- ).subscribe((transformedData) => {
9748
- this.setState({ data: transformedData });
9749
- this._results.next({ origin: this, data: transformedData });
9750
- this._prevDataFromSource = data$1;
9751
- });
9752
- }
9753
- _interpolateVariablesInTransformationConfigs(data) {
9754
- var _a;
9755
- const transformations = this.state.transformations;
9756
- if (this._variableDependency.getNames().size === 0) {
9757
- return transformations;
9758
- }
9759
- const onlyObjects = transformations.every((t) => typeof t === "object");
9760
- if (onlyObjects) {
9761
- return JSON.parse(sceneGraph.interpolate(this, JSON.stringify(transformations), (_a = data.request) == null ? void 0 : _a.scopedVars));
9762
- }
9763
- return transformations.map((t) => {
9764
- var _a2;
9765
- return typeof t === "object" ? JSON.parse(sceneGraph.interpolate(this, JSON.stringify(t), (_a2 = data.request) == null ? void 0 : _a2.scopedVars)) : t;
9766
- });
9767
- }
9768
- }
9769
-
9770
9782
  class VariableValueSelectors extends SceneObjectBase {
9771
9783
  }
9772
9784
  VariableValueSelectors.Component = VariableValueSelectorsRenderer;
@@ -12093,7 +12105,7 @@ const PREVIOUS_PERIOD_COMPARE_OPTION = {
12093
12105
  value: PREVIOUS_PERIOD_VALUE
12094
12106
  };
12095
12107
  const NO_COMPARE_OPTION = {
12096
- label: "No comparison",
12108
+ label: "None",
12097
12109
  value: NO_PERIOD_VALUE
12098
12110
  };
12099
12111
  const DEFAULT_COMPARE_OPTIONS = [
@@ -12248,7 +12260,7 @@ const timeShiftAlignmentProcessor = (primary, secondary) => {
12248
12260
  function SceneTimeRangeCompareRenderer({ model }) {
12249
12261
  var _a;
12250
12262
  const styles = ui.useStyles2(getStyles$4);
12251
- const { compareWith, compareOptions } = model.useState();
12263
+ const { compareWith, compareOptions, hideCheckbox } = model.useState();
12252
12264
  const [previousCompare, setPreviousCompare] = React__default.default.useState(compareWith);
12253
12265
  const previousValue = (_a = compareOptions.find(({ value: value2 }) => value2 === previousCompare)) != null ? _a : PREVIOUS_PERIOD_COMPARE_OPTION;
12254
12266
  const value = compareOptions.find(({ value: value2 }) => value2 === compareWith);
@@ -12261,7 +12273,13 @@ function SceneTimeRangeCompareRenderer({ model }) {
12261
12273
  model.onCompareWithChanged(previousValue.value);
12262
12274
  }
12263
12275
  };
12264
- return /* @__PURE__ */ React__default.default.createElement(ui.ButtonGroup, null, /* @__PURE__ */ React__default.default.createElement(
12276
+ const selectValue = hideCheckbox && !compareWith ? NO_COMPARE_OPTION : value;
12277
+ const showSelect = hideCheckbox || enabled;
12278
+ const displayValue = hideCheckbox && selectValue ? {
12279
+ ...selectValue,
12280
+ label: `Comparison: ${selectValue.label}`
12281
+ } : selectValue;
12282
+ return /* @__PURE__ */ React__default.default.createElement(ui.ButtonGroup, null, !hideCheckbox && /* @__PURE__ */ React__default.default.createElement(
12265
12283
  ui.ToolbarButton,
12266
12284
  {
12267
12285
  variant: "canvas",
@@ -12277,11 +12295,11 @@ function SceneTimeRangeCompareRenderer({ model }) {
12277
12295
  },
12278
12296
  /* @__PURE__ */ React__default.default.createElement(ui.Checkbox, { label: " ", value: enabled, onClick }),
12279
12297
  /* @__PURE__ */ React__default.default.createElement(i18n.Trans, { i18nKey: "grafana-scenes.components.scene-time-range-compare-renderer.button-label" }, "Comparison")
12280
- ), enabled ? /* @__PURE__ */ React__default.default.createElement(
12298
+ ), showSelect ? /* @__PURE__ */ React__default.default.createElement(
12281
12299
  ui.ButtonSelect,
12282
12300
  {
12283
12301
  variant: "canvas",
12284
- value,
12302
+ value: displayValue,
12285
12303
  options: compareOptions,
12286
12304
  onChange: (v) => {
12287
12305
  model.onCompareWithChanged(v.value);