@grafana/scenes 6.40.0--canary.1277.18545717336.0 → 6.40.0--canary.1278.18558414211.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
@@ -3902,23 +3902,29 @@ class GroupByVariable extends MultiValueVariable {
3902
3902
  });
3903
3903
  return applicableValues;
3904
3904
  }
3905
- async _verifyApplicability() {
3905
+ async getGroupByApplicabilityForQueries(value, queries) {
3906
3906
  const ds = await getDataSource(this.state.datasource, {
3907
3907
  __sceneObject: wrapInSafeSerializableSceneObject(this)
3908
3908
  });
3909
3909
  if (!ds.getDrilldownsApplicability) {
3910
3910
  return;
3911
3911
  }
3912
- const queries = getQueriesForVariables(this);
3913
3912
  const timeRange = sceneGraph.getTimeRange(this).state.value;
3914
- const value = this.state.value;
3915
- const response = await ds.getDrilldownsApplicability({
3913
+ return await ds.getDrilldownsApplicability({
3916
3914
  groupByKeys: Array.isArray(value) ? value.map((v) => String(v)) : value ? [String(value)] : [],
3917
3915
  queries,
3918
3916
  timeRange,
3919
3917
  scopes: sceneGraph.getScopes(this),
3920
3918
  ...getEnrichedFiltersRequest(this)
3921
3919
  });
3920
+ }
3921
+ async _verifyApplicability() {
3922
+ const queries = getQueriesForVariables(this);
3923
+ const value = this.state.value;
3924
+ const response = await this.getGroupByApplicabilityForQueries(value, queries);
3925
+ if (!response) {
3926
+ return;
3927
+ }
3922
3928
  if (!lodash.isEqual(response, this.state.keysApplicability)) {
3923
3929
  this.setState({ keysApplicability: response != null ? response : void 0 });
3924
3930
  this.publishEvent(new SceneVariableValueChangedEvent(this), true);
@@ -6562,25 +6568,28 @@ class AdHocFiltersVariable extends SceneObjectBase {
6562
6568
  });
6563
6569
  }
6564
6570
  }
6565
- async _verifyApplicability() {
6566
- var _a, _b, _c;
6567
- const filters = [...this.state.filters, ...(_a = this.state.originFilters) != null ? _a : []];
6571
+ async getFiltersApplicabilityForQueries(filters, queries) {
6568
6572
  const ds = await this._dataSourceSrv.get(this.state.datasource, this._scopedVars);
6569
6573
  if (!ds || !ds.getDrilldownsApplicability) {
6570
6574
  return;
6571
6575
  }
6572
- if (!filters) {
6573
- return;
6574
- }
6575
6576
  const timeRange = sceneGraph.getTimeRange(this).state.value;
6576
- const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : void 0;
6577
- const response = await ds.getDrilldownsApplicability({
6577
+ return await ds.getDrilldownsApplicability({
6578
6578
  filters,
6579
6579
  queries,
6580
6580
  timeRange,
6581
6581
  scopes: sceneGraph.getScopes(this),
6582
6582
  ...getEnrichedFiltersRequest(this)
6583
6583
  });
6584
+ }
6585
+ async _verifyApplicability() {
6586
+ var _a, _b, _c;
6587
+ const filters = [...this.state.filters, ...(_a = this.state.originFilters) != null ? _a : []];
6588
+ const queries = this.state.useQueriesAsFilterForOptions ? getQueriesForVariables(this) : void 0;
6589
+ const response = await this.getFiltersApplicabilityForQueries(filters, queries != null ? queries : []);
6590
+ if (!response) {
6591
+ return;
6592
+ }
6584
6593
  const responseMap = /* @__PURE__ */ new Map();
6585
6594
  response.forEach((filter) => {
6586
6595
  responseMap.set(`${filter.key}${filter.origin ? `-${filter.origin}` : ""}`, filter);
@@ -8827,6 +8836,7 @@ function VizPanelRenderer({ model }) {
8827
8836
  hoverHeaderOffset,
8828
8837
  menu,
8829
8838
  headerActions,
8839
+ subHeaderContent,
8830
8840
  titleItems,
8831
8841
  seriesLimit,
8832
8842
  seriesLimitShowAll,
@@ -8874,6 +8884,20 @@ function VizPanelRenderer({ model }) {
8874
8884
  if (dataObject && dataObject.setContainerWidth) {
8875
8885
  dataObject.setContainerWidth(Math.round(width));
8876
8886
  }
8887
+ let subHeaderElement = [];
8888
+ if (subHeaderContent) {
8889
+ if (Array.isArray(subHeaderContent)) {
8890
+ subHeaderElement = subHeaderElement.concat(
8891
+ subHeaderContent.map((subHeaderItem) => {
8892
+ return /* @__PURE__ */ React__default.default.createElement(subHeaderItem.Component, { model: subHeaderItem, key: `${subHeaderItem.state.key}` });
8893
+ })
8894
+ );
8895
+ } else if (isSceneObject(subHeaderContent)) {
8896
+ subHeaderElement.push(/* @__PURE__ */ React__default.default.createElement(subHeaderContent.Component, { model: subHeaderContent }));
8897
+ } else {
8898
+ subHeaderElement.push(subHeaderContent);
8899
+ }
8900
+ }
8877
8901
  let titleItemsElement = [];
8878
8902
  if (titleItems) {
8879
8903
  if (Array.isArray(titleItems)) {
@@ -8947,8 +8971,7 @@ function VizPanelRenderer({ model }) {
8947
8971
  const isReadyToRender = dataObject.isDataReadyToDisplay ? dataObject.isDataReadyToDisplay() : true;
8948
8972
  const context = model.getPanelContext();
8949
8973
  const panelId = model.getLegacyPanelId();
8950
- return /* @__PURE__ */ React__default.default.createElement("div", { className: relativeWrapper }, /* @__PURE__ */ React__default.default.createElement("div", { ref, className: absoluteWrapper, "data-viz-panel-key": model.state.key }, width > 0 && height > 0 && // @ts-expect-error showMenuAlways remove when updating to @grafana/ui@12 fixed in https://github.com/grafana/grafana/pull/103553
8951
- /* @__PURE__ */ React__default.default.createElement(
8974
+ return /* @__PURE__ */ React__default.default.createElement("div", { className: relativeWrapper }, /* @__PURE__ */ React__default.default.createElement("div", { ref, className: absoluteWrapper, "data-viz-panel-key": model.state.key }, width > 0 && height > 0 && /* @__PURE__ */ React__default.default.createElement(
8952
8975
  ui.PanelChrome,
8953
8976
  {
8954
8977
  title: titleInterpolated,
@@ -8970,6 +8993,7 @@ function VizPanelRenderer({ model }) {
8970
8993
  onFocus: setPanelAttention,
8971
8994
  onMouseEnter: setPanelAttention,
8972
8995
  onMouseMove: debouncedMouseMove,
8996
+ subHeaderContent: subHeaderElement.length ? subHeaderElement : void 0,
8973
8997
  onDragStart: (e) => {
8974
8998
  var _a2;
8975
8999
  (_a2 = dragHooks.onDragStart) == null ? void 0 : _a2.call(dragHooks, e, model);
@@ -13146,15 +13170,9 @@ const DEFAULT_COMPARE_OPTIONS = [
13146
13170
  { label: "Month before", value: "1M" }
13147
13171
  ];
13148
13172
  class SceneTimeRangeCompare extends SceneObjectBase {
13149
- constructor(state = {}) {
13150
- super({
13151
- key: state.key || "compareWith",
13152
- compareOptions: DEFAULT_COMPARE_OPTIONS,
13153
- ...state
13154
- });
13155
- this._urlSync = new SceneObjectUrlSyncConfig(this, {
13156
- keys: () => [this.state.key || "compareWith"]
13157
- });
13173
+ constructor(state) {
13174
+ super({ compareOptions: DEFAULT_COMPARE_OPTIONS, ...state });
13175
+ this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["compareWith"] });
13158
13176
  this._onActivate = () => {
13159
13177
  const sceneTimeRange = sceneGraph.getTimeRange(this);
13160
13178
  this.setState({ compareOptions: this.getCompareOptions(sceneTimeRange.state.value) });
@@ -13241,22 +13259,25 @@ class SceneTimeRangeCompare extends SceneObjectBase {
13241
13259
  return void 0;
13242
13260
  }
13243
13261
  getUrlState() {
13244
- const key = this.state.key || "compareWith";
13245
- return { [key]: this.state.compareWith };
13262
+ return {
13263
+ compareWith: this.state.compareWith
13264
+ };
13246
13265
  }
13247
13266
  updateFromUrl(values) {
13248
- const key = this.state.key || "compareWith";
13249
- if (values[key] === PREVIOUS_PERIOD_VALUE) {
13250
- this.setState({ compareWith: PREVIOUS_PERIOD_VALUE });
13267
+ if (!values.compareWith) {
13251
13268
  return;
13252
13269
  }
13253
- const compareWith = parseUrlParam(values[key]);
13270
+ const compareWith = parseUrlParam(values.compareWith);
13254
13271
  if (compareWith) {
13255
13272
  const compareOptions = this.getCompareOptions(sceneGraph.getTimeRange(this).state.value);
13256
13273
  if (compareOptions.find(({ value }) => value === compareWith)) {
13257
- this.setState({ compareWith });
13274
+ this.setState({
13275
+ compareWith
13276
+ });
13258
13277
  } else {
13259
- this.setState({ compareWith: PREVIOUS_PERIOD_VALUE });
13278
+ this.setState({
13279
+ compareWith: "__previousPeriod"
13280
+ });
13260
13281
  }
13261
13282
  }
13262
13283
  }
@@ -15533,6 +15554,7 @@ exports.dataLayers = index;
15533
15554
  exports.escapeUrlPipeDelimiters = escapeUrlPipeDelimiters;
15534
15555
  exports.formatRegistry = formatRegistry;
15535
15556
  exports.getExploreURL = getExploreURL;
15557
+ exports.getNonApplicablePillStyles = getNonApplicablePillStyles;
15536
15558
  exports.isCustomVariableValue = isCustomVariableValue;
15537
15559
  exports.isDataLayer = isDataLayer;
15538
15560
  exports.isDataRequestEnricher = isDataRequestEnricher;