@grafana/scenes 5.28.1 → 5.29.0--canary.808.12161480494.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -6128,8 +6128,8 @@ function ensureVariableQueryModelIsADataQuery(variable) {
6128
6128
  return variable.state.query;
6129
6129
  }
6130
6130
 
6131
- const metricNamesToVariableValues = (variableRegEx, sort, metricNames) => {
6132
- var _a, _b, _c, _d, _e, _f;
6131
+ function metricNamesToVariableValues(variableRegEx, sort, metricNames) {
6132
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
6133
6133
  let regex;
6134
6134
  let options = [];
6135
6135
  if (variableRegEx) {
@@ -6137,8 +6137,8 @@ const metricNamesToVariableValues = (variableRegEx, sort, metricNames) => {
6137
6137
  }
6138
6138
  for (let i = 0; i < metricNames.length; i++) {
6139
6139
  const item = metricNames[i];
6140
- let text = item.text === void 0 || item.text === null ? item.value : item.text;
6141
- let value = item.value === void 0 || item.value === null ? item.text : item.value;
6140
+ let text = (_b = (_a = item.text) != null ? _a : item.value) != null ? _b : "";
6141
+ let value = (_d = (_c = item.value) != null ? _c : item.text) != null ? _d : "";
6142
6142
  if (lodash.isNumber(value)) {
6143
6143
  value = value.toString();
6144
6144
  }
@@ -6155,8 +6155,8 @@ const metricNamesToVariableValues = (variableRegEx, sort, metricNames) => {
6155
6155
  const firstMatch = matches.find((m) => m.length > 1);
6156
6156
  const manyMatches = matches.length > 1 && firstMatch;
6157
6157
  if (valueGroup || textGroup) {
6158
- value = (_c = (_a = valueGroup == null ? void 0 : valueGroup.groups) == null ? void 0 : _a.value) != null ? _c : (_b = textGroup == null ? void 0 : textGroup.groups) == null ? void 0 : _b.text;
6159
- text = (_f = (_d = textGroup == null ? void 0 : textGroup.groups) == null ? void 0 : _d.text) != null ? _f : (_e = valueGroup == null ? void 0 : valueGroup.groups) == null ? void 0 : _e.value;
6158
+ value = (_g = (_e = valueGroup == null ? void 0 : valueGroup.groups) == null ? void 0 : _e.value) != null ? _g : (_f = textGroup == null ? void 0 : textGroup.groups) == null ? void 0 : _f.text;
6159
+ text = (_j = (_h = textGroup == null ? void 0 : textGroup.groups) == null ? void 0 : _h.text) != null ? _j : (_i = valueGroup == null ? void 0 : valueGroup.groups) == null ? void 0 : _i.value;
6160
6160
  } else if (manyMatches) {
6161
6161
  for (let j = 0; j < matches.length; j++) {
6162
6162
  const match = matches[j];
@@ -6172,7 +6172,7 @@ const metricNamesToVariableValues = (variableRegEx, sort, metricNames) => {
6172
6172
  }
6173
6173
  options = lodash.uniqBy(options, "value");
6174
6174
  return sortVariableValues(options, sort);
6175
- };
6175
+ }
6176
6176
  const getAllMatches = (str, regex) => {
6177
6177
  const results = [];
6178
6178
  let matches = null;
@@ -6291,8 +6291,8 @@ function toMetricFindValues() {
6291
6291
  for (let index = 0; index < frame.length; index++) {
6292
6292
  const expandable = expandableIndex !== -1 ? frame.fields[expandableIndex].values.get(index) : void 0;
6293
6293
  const string = frame.fields[stringIndex].values.get(index);
6294
- const text = textIndex !== -1 ? frame.fields[textIndex].values.get(index) : null;
6295
- const value = valueIndex !== -1 ? frame.fields[valueIndex].values.get(index) : null;
6294
+ const text = textIndex !== -1 ? frame.fields[textIndex].values.get(index) : "";
6295
+ const value = valueIndex !== -1 ? frame.fields[valueIndex].values.get(index) : "";
6296
6296
  if (valueIndex === -1 && textIndex === -1) {
6297
6297
  metrics.push({ text: string, value: string, expandable });
6298
6298
  continue;
@@ -7068,7 +7068,7 @@ function VizPanelRenderer({ model }) {
7068
7068
  ref,
7069
7069
  className: absoluteWrapper,
7070
7070
  "data-viz-panel-key": model.state.key
7071
- }, width > 0 && height > 0 && /* @__PURE__ */ React__default["default"].createElement(ui.PanelChrome, {
7071
+ }, width > 0 && height > 0 && /* @__PURE__ */ React__default["default"].createElement(ui.PanelChrome, __spreadValues$t({
7072
7072
  title: titleInterpolated,
7073
7073
  description: (description == null ? void 0 : description.trim()) ? model.getDescription : void 0,
7074
7074
  loadingState: data$1.state,
@@ -7090,7 +7090,7 @@ function VizPanelRenderer({ model }) {
7090
7090
  onFocus: setPanelAttention,
7091
7091
  onMouseEnter: setPanelAttention,
7092
7092
  onMouseMove: debouncedMouseMove
7093
- }, (innerWidth, innerHeight) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(ui.ErrorBoundaryAlert, {
7093
+ }, model.state.panelChromeProps), (innerWidth, innerHeight) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(ui.ErrorBoundaryAlert, {
7094
7094
  dependencies: [plugin, data$1]
7095
7095
  }, /* @__PURE__ */ React__default["default"].createElement(data.PluginContextProvider, {
7096
7096
  meta: plugin.meta
@@ -13132,6 +13132,10 @@ class VizPanelBuilder {
13132
13132
  this._state.headerActions = headerActions;
13133
13133
  return this;
13134
13134
  }
13135
+ setPanelChromeProps(props) {
13136
+ this._state.panelChromeProps = props;
13137
+ return this;
13138
+ }
13135
13139
  setColor(color) {
13136
13140
  this._fieldConfigBuilder.setColor(color);
13137
13141
  return this;