@grafana/scenes 4.26.1--canary.770.9385565703.0 → 4.26.1--canary.771.9386870862.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -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
  }
@@ -2955,7 +2959,6 @@ const OptionWithCheckbox = ({
2955
2959
  isSelected,
2956
2960
  renderOptionLabel
2957
2961
  }) => {
2958
- var _b;
2959
2962
  const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
2960
2963
  const theme = ui.useTheme2();
2961
2964
  const selectStyles = ui.getSelectStyles(theme);
@@ -2964,17 +2967,17 @@ const OptionWithCheckbox = ({
2964
2967
  ref: innerRef,
2965
2968
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
2966
2969
  }, rest), {
2967
- "data-testid": e2eSelectors.selectors.components.Select.option,
2970
+ "aria-label": "Select option",
2971
+ "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(
2972
+ data.label || String(data.value)
2973
+ ),
2968
2974
  title: data.title
2969
2975
  }), /* @__PURE__ */ React__default["default"].createElement("div", {
2970
2976
  className: optionStyles.checkbox
2971
2977
  }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
2972
2978
  value: isSelected
2973
2979
  })), /* @__PURE__ */ React__default["default"].createElement("div", {
2974
- className: selectStyles.optionBody,
2975
- "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(
2976
- (_b = data.label) != null ? _b : String(data.value)
2977
- )
2980
+ className: selectStyles.optionBody
2978
2981
  }, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
2979
2982
  };
2980
2983
  OptionWithCheckbox.displayName = "SelectMenuOptions";
@@ -5213,6 +5216,9 @@ class VizPanel extends SceneObjectBase {
5213
5216
  (_a = this._panelContext) != null ? _a : this._panelContext = this.buildPanelContext();
5214
5217
  return this._panelContext;
5215
5218
  }
5219
+ clearFieldConfigCache() {
5220
+ this._dataWithFieldConfig = void 0;
5221
+ }
5216
5222
  applyFieldConfig(rawData) {
5217
5223
  var _a, _b, _c, _d;
5218
5224
  const plugin = this._plugin;
@@ -11130,6 +11136,174 @@ const PanelBuilders = {
11130
11136
  }
11131
11137
  };
11132
11138
 
11139
+ class VizConfigBuilder {
11140
+ constructor(pluginId, pluginVersion, defaultOptions, defaultFieldConfig) {
11141
+ this._pluginId = pluginId;
11142
+ this._pluginVersion = pluginVersion;
11143
+ this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);
11144
+ this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);
11145
+ }
11146
+ setColor(color) {
11147
+ this._fieldConfigBuilder.setColor(color);
11148
+ return this;
11149
+ }
11150
+ setDecimals(decimals) {
11151
+ this._fieldConfigBuilder.setDecimals(decimals);
11152
+ return this;
11153
+ }
11154
+ setDisplayName(displayName) {
11155
+ this._fieldConfigBuilder.setDisplayName(displayName);
11156
+ return this;
11157
+ }
11158
+ setFilterable(filterable) {
11159
+ this._fieldConfigBuilder.setFilterable(filterable);
11160
+ return this;
11161
+ }
11162
+ setLinks(links) {
11163
+ this._fieldConfigBuilder.setLinks(links);
11164
+ return this;
11165
+ }
11166
+ setMappings(mappings) {
11167
+ this._fieldConfigBuilder.setMappings(mappings);
11168
+ return this;
11169
+ }
11170
+ setMax(max) {
11171
+ this._fieldConfigBuilder.setMax(max);
11172
+ return this;
11173
+ }
11174
+ setMin(min) {
11175
+ this._fieldConfigBuilder.setMin(min);
11176
+ return this;
11177
+ }
11178
+ setNoValue(noValue) {
11179
+ this._fieldConfigBuilder.setNoValue(noValue);
11180
+ return this;
11181
+ }
11182
+ setThresholds(thresholds) {
11183
+ this._fieldConfigBuilder.setThresholds(thresholds);
11184
+ return this;
11185
+ }
11186
+ setUnit(unit) {
11187
+ this._fieldConfigBuilder.setUnit(unit);
11188
+ return this;
11189
+ }
11190
+ setCustomFieldConfig(id, value) {
11191
+ this._fieldConfigBuilder.setCustomFieldConfig(id, value);
11192
+ return this;
11193
+ }
11194
+ setOverrides(builder) {
11195
+ this._fieldConfigBuilder.setOverrides(builder);
11196
+ return this;
11197
+ }
11198
+ setOption(id, value) {
11199
+ this._panelOptionsBuilder.setOption(id, value);
11200
+ return this;
11201
+ }
11202
+ build() {
11203
+ return {
11204
+ pluginId: this._pluginId,
11205
+ pluginVersion: this._pluginVersion,
11206
+ options: this._panelOptionsBuilder.build(),
11207
+ fieldConfig: this._fieldConfigBuilder.build()
11208
+ };
11209
+ }
11210
+ }
11211
+
11212
+ const VizConfigBuilders = {
11213
+ barchart() {
11214
+ return new VizConfigBuilder(
11215
+ "barchart",
11216
+ "10.0.0",
11217
+ () => BarChartPanelCfg_types_gen.defaultOptions,
11218
+ () => BarChartPanelCfg_types_gen.defaultFieldConfig
11219
+ );
11220
+ },
11221
+ bargauge() {
11222
+ return new VizConfigBuilder("bargauge", "10.0.0", () => BarGaugePanelCfg_types_gen.defaultOptions);
11223
+ },
11224
+ datagrid() {
11225
+ return new VizConfigBuilder("datagrid", "10.0.0", () => DatagridPanelCfg_types_gen.defaultOptions);
11226
+ },
11227
+ flamegraph() {
11228
+ return new VizConfigBuilder("flamegraph", "10.0.0");
11229
+ },
11230
+ gauge() {
11231
+ return new VizConfigBuilder("gauge", "10.0.0", () => GaugePanelCfg_types_gen.defaultOptions);
11232
+ },
11233
+ geomap() {
11234
+ return new VizConfigBuilder("geomap", "10.0.0", () => GeomapPanelCfg_types_gen.defaultOptions);
11235
+ },
11236
+ heatmap() {
11237
+ return new VizConfigBuilder("heatmap", "10.0.0", () => HeatmapPanelCfg_types_gen.defaultOptions);
11238
+ },
11239
+ histogram() {
11240
+ return new VizConfigBuilder(
11241
+ "histogram",
11242
+ "10.0.0",
11243
+ () => HistogramPanelCfg_types_gen.defaultOptions,
11244
+ () => HistogramPanelCfg_types_gen.defaultFieldConfig
11245
+ );
11246
+ },
11247
+ logs() {
11248
+ return new VizConfigBuilder("logs", "10.0.0");
11249
+ },
11250
+ news() {
11251
+ return new VizConfigBuilder("news", "10.0.0", () => NewsPanelCfg_types_gen.defaultOptions);
11252
+ },
11253
+ nodegraph() {
11254
+ return new VizConfigBuilder("nodeGraph", "10.0.0");
11255
+ },
11256
+ piechart() {
11257
+ return new VizConfigBuilder(
11258
+ "piechart",
11259
+ "10.0.0",
11260
+ () => PieChartPanelCfg_types_gen.defaultOptions
11261
+ );
11262
+ },
11263
+ stat() {
11264
+ return new VizConfigBuilder("stat", "10.0.0", () => StatPanelCfg_types_gen.defaultOptions);
11265
+ },
11266
+ statetimeline() {
11267
+ return new VizConfigBuilder(
11268
+ "state-timeline",
11269
+ "10.0.0",
11270
+ () => StateTimelinePanelCfg_types_gen.defaultOptions,
11271
+ () => StateTimelinePanelCfg_types_gen.defaultFieldConfig
11272
+ );
11273
+ },
11274
+ statushistory() {
11275
+ return new VizConfigBuilder(
11276
+ "status-history",
11277
+ "10.0.0",
11278
+ () => StatusHistoryPanelCfg_types_gen.defaultOptions,
11279
+ () => StatusHistoryPanelCfg_types_gen.defaultFieldConfig
11280
+ );
11281
+ },
11282
+ table() {
11283
+ return new VizConfigBuilder("table", "10.0.0", () => TablePanelCfg_types_gen.defaultOptions);
11284
+ },
11285
+ text() {
11286
+ return new VizConfigBuilder("text", "10.0.0", () => TextPanelCfg_types_gen.defaultOptions);
11287
+ },
11288
+ timeseries() {
11289
+ return new VizConfigBuilder("timeseries", "10.0.0");
11290
+ },
11291
+ trend() {
11292
+ return new VizConfigBuilder("trend", "10.0.0");
11293
+ },
11294
+ traces() {
11295
+ return new VizConfigBuilder("traces", "10.0.0");
11296
+ },
11297
+ xychart() {
11298
+ return new VizConfigBuilder(
11299
+ "xychart",
11300
+ "10.0.0",
11301
+ () => XYChartPanelCfg_types_gen.defaultOptions,
11302
+ () => XYChartPanelCfg_types_gen.defaultFieldConfig
11303
+ );
11304
+ }
11305
+ };
11306
+
11133
11307
  const sceneUtils = {
11134
11308
  getUrlWithAppState,
11135
11309
  registerRuntimePanelPlugin,
@@ -11154,6 +11328,7 @@ exports.ConstantVariable = ConstantVariable;
11154
11328
  exports.CustomVariable = CustomVariable;
11155
11329
  exports.DataSourceVariable = DataSourceVariable;
11156
11330
  exports.EmbeddedScene = EmbeddedScene;
11331
+ exports.FieldConfigBuilder = FieldConfigBuilder;
11157
11332
  exports.FieldConfigBuilders = FieldConfigBuilders;
11158
11333
  exports.FieldConfigOverridesBuilder = FieldConfigOverridesBuilder;
11159
11334
  exports.GroupByVariable = GroupByVariable;
@@ -11208,7 +11383,10 @@ exports.UrlSyncManager = UrlSyncManager;
11208
11383
  exports.UserActionEvent = UserActionEvent;
11209
11384
  exports.VariableDependencyConfig = VariableDependencyConfig;
11210
11385
  exports.VariableValueControl = VariableValueControl;
11386
+ exports.VariableValueSelectWrapper = VariableValueSelectWrapper;
11211
11387
  exports.VariableValueSelectors = VariableValueSelectors;
11388
+ exports.VizConfigBuilder = VizConfigBuilder;
11389
+ exports.VizConfigBuilders = VizConfigBuilders;
11212
11390
  exports.VizPanel = VizPanel;
11213
11391
  exports.VizPanelBuilder = VizPanelBuilder;
11214
11392
  exports.VizPanelMenu = VizPanelMenu;