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

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -2071,11 +2071,7 @@ async function getDataSource(datasource, scopedVars) {
2071
2071
  }
2072
2072
 
2073
2073
  function writeSceneLog(logger, message, ...rest) {
2074
- let loggingEnabled = false;
2075
- if (typeof window !== "undefined") {
2076
- loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
2077
- }
2078
- if (loggingEnabled) {
2074
+ if (window.grafanaSceneLogging) {
2079
2075
  console.log(`${logger}: `, message, ...rest);
2080
2076
  }
2081
2077
  }
@@ -2959,6 +2955,7 @@ const OptionWithCheckbox = ({
2959
2955
  isSelected,
2960
2956
  renderOptionLabel
2961
2957
  }) => {
2958
+ var _b;
2962
2959
  const _a = innerProps, rest = __objRest$3(_a, ["onMouseMove", "onMouseOver"]);
2963
2960
  const theme = ui.useTheme2();
2964
2961
  const selectStyles = ui.getSelectStyles(theme);
@@ -2967,17 +2964,17 @@ const OptionWithCheckbox = ({
2967
2964
  ref: innerRef,
2968
2965
  className: css.cx(selectStyles.option, isFocused && selectStyles.optionFocused)
2969
2966
  }, rest), {
2970
- "aria-label": "Select option",
2971
- "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(
2972
- data.label || String(data.value)
2973
- ),
2967
+ "data-testid": e2eSelectors.selectors.components.Select.option,
2974
2968
  title: data.title
2975
2969
  }), /* @__PURE__ */ React__default["default"].createElement("div", {
2976
2970
  className: optionStyles.checkbox
2977
2971
  }, /* @__PURE__ */ React__default["default"].createElement(ui.Checkbox, {
2978
2972
  value: isSelected
2979
2973
  })), /* @__PURE__ */ React__default["default"].createElement("div", {
2980
- className: selectStyles.optionBody
2974
+ className: selectStyles.optionBody,
2975
+ "data-testid": e2eSelectors.selectors.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(
2976
+ (_b = data.label) != null ? _b : String(data.value)
2977
+ )
2981
2978
  }, /* @__PURE__ */ React__default["default"].createElement("span", null, children)));
2982
2979
  };
2983
2980
  OptionWithCheckbox.displayName = "SelectMenuOptions";
@@ -5216,9 +5213,6 @@ class VizPanel extends SceneObjectBase {
5216
5213
  (_a = this._panelContext) != null ? _a : this._panelContext = this.buildPanelContext();
5217
5214
  return this._panelContext;
5218
5215
  }
5219
- clearFieldConfigCache() {
5220
- this._dataWithFieldConfig = void 0;
5221
- }
5222
5216
  applyFieldConfig(rawData) {
5223
5217
  var _a, _b, _c, _d;
5224
5218
  const plugin = this._plugin;
@@ -7722,7 +7716,6 @@ class UrlSyncManager {
7722
7716
  this._locationSub = null;
7723
7717
  this._ignoreNextLocationUpdate = false;
7724
7718
  this._onLocationUpdate = (location) => {
7725
- this._urlParams = new URLSearchParams(location.search);
7726
7719
  if (this._ignoreNextLocationUpdate) {
7727
7720
  this._ignoreNextLocationUpdate = false;
7728
7721
  return;
@@ -7730,8 +7723,9 @@ class UrlSyncManager {
7730
7723
  if (this._lastPath !== location.pathname) {
7731
7724
  return;
7732
7725
  }
7726
+ const urlParams = new URLSearchParams(location.search);
7733
7727
  this._urlKeyMapper.rebuildIndex(this._sceneRoot);
7734
- syncStateFromUrl(this._sceneRoot, this._urlParams, this._urlKeyMapper);
7728
+ syncStateFromUrl(this._sceneRoot, urlParams, this._urlKeyMapper);
7735
7729
  this._lastPath = location.pathname;
7736
7730
  };
7737
7731
  this._onStateChanged = ({ payload }) => {
@@ -7764,10 +7758,8 @@ class UrlSyncManager {
7764
7758
  writeSceneLog("UrlSyncManager", "Unregister previous scene state subscription", this._sceneRoot.state.key);
7765
7759
  this._stateSub.unsubscribe();
7766
7760
  }
7767
- const location = runtime.locationService.getLocation();
7768
7761
  this._sceneRoot = root;
7769
- this._lastPath = location.pathname;
7770
- this._urlParams = new URLSearchParams(location.search);
7762
+ this._lastPath = runtime.locationService.getLocation().pathname;
7771
7763
  this._stateSub = root.subscribeToEvent(SceneObjectStateChangedEvent, this._onStateChanged);
7772
7764
  this.syncFrom(this._sceneRoot);
7773
7765
  }
@@ -11138,174 +11130,6 @@ const PanelBuilders = {
11138
11130
  }
11139
11131
  };
11140
11132
 
11141
- class VizConfigBuilder {
11142
- constructor(pluginId, pluginVersion, defaultOptions, defaultFieldConfig) {
11143
- this._pluginId = pluginId;
11144
- this._pluginVersion = pluginVersion;
11145
- this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);
11146
- this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);
11147
- }
11148
- setColor(color) {
11149
- this._fieldConfigBuilder.setColor(color);
11150
- return this;
11151
- }
11152
- setDecimals(decimals) {
11153
- this._fieldConfigBuilder.setDecimals(decimals);
11154
- return this;
11155
- }
11156
- setDisplayName(displayName) {
11157
- this._fieldConfigBuilder.setDisplayName(displayName);
11158
- return this;
11159
- }
11160
- setFilterable(filterable) {
11161
- this._fieldConfigBuilder.setFilterable(filterable);
11162
- return this;
11163
- }
11164
- setLinks(links) {
11165
- this._fieldConfigBuilder.setLinks(links);
11166
- return this;
11167
- }
11168
- setMappings(mappings) {
11169
- this._fieldConfigBuilder.setMappings(mappings);
11170
- return this;
11171
- }
11172
- setMax(max) {
11173
- this._fieldConfigBuilder.setMax(max);
11174
- return this;
11175
- }
11176
- setMin(min) {
11177
- this._fieldConfigBuilder.setMin(min);
11178
- return this;
11179
- }
11180
- setNoValue(noValue) {
11181
- this._fieldConfigBuilder.setNoValue(noValue);
11182
- return this;
11183
- }
11184
- setThresholds(thresholds) {
11185
- this._fieldConfigBuilder.setThresholds(thresholds);
11186
- return this;
11187
- }
11188
- setUnit(unit) {
11189
- this._fieldConfigBuilder.setUnit(unit);
11190
- return this;
11191
- }
11192
- setCustomFieldConfig(id, value) {
11193
- this._fieldConfigBuilder.setCustomFieldConfig(id, value);
11194
- return this;
11195
- }
11196
- setOverrides(builder) {
11197
- this._fieldConfigBuilder.setOverrides(builder);
11198
- return this;
11199
- }
11200
- setOption(id, value) {
11201
- this._panelOptionsBuilder.setOption(id, value);
11202
- return this;
11203
- }
11204
- build() {
11205
- return {
11206
- pluginId: this._pluginId,
11207
- pluginVersion: this._pluginVersion,
11208
- options: this._panelOptionsBuilder.build(),
11209
- fieldConfig: this._fieldConfigBuilder.build()
11210
- };
11211
- }
11212
- }
11213
-
11214
- const VizConfigBuilders = {
11215
- barchart() {
11216
- return new VizConfigBuilder(
11217
- "barchart",
11218
- "10.0.0",
11219
- () => BarChartPanelCfg_types_gen.defaultOptions,
11220
- () => BarChartPanelCfg_types_gen.defaultFieldConfig
11221
- );
11222
- },
11223
- bargauge() {
11224
- return new VizConfigBuilder("bargauge", "10.0.0", () => BarGaugePanelCfg_types_gen.defaultOptions);
11225
- },
11226
- datagrid() {
11227
- return new VizConfigBuilder("datagrid", "10.0.0", () => DatagridPanelCfg_types_gen.defaultOptions);
11228
- },
11229
- flamegraph() {
11230
- return new VizConfigBuilder("flamegraph", "10.0.0");
11231
- },
11232
- gauge() {
11233
- return new VizConfigBuilder("gauge", "10.0.0", () => GaugePanelCfg_types_gen.defaultOptions);
11234
- },
11235
- geomap() {
11236
- return new VizConfigBuilder("geomap", "10.0.0", () => GeomapPanelCfg_types_gen.defaultOptions);
11237
- },
11238
- heatmap() {
11239
- return new VizConfigBuilder("heatmap", "10.0.0", () => HeatmapPanelCfg_types_gen.defaultOptions);
11240
- },
11241
- histogram() {
11242
- return new VizConfigBuilder(
11243
- "histogram",
11244
- "10.0.0",
11245
- () => HistogramPanelCfg_types_gen.defaultOptions,
11246
- () => HistogramPanelCfg_types_gen.defaultFieldConfig
11247
- );
11248
- },
11249
- logs() {
11250
- return new VizConfigBuilder("logs", "10.0.0");
11251
- },
11252
- news() {
11253
- return new VizConfigBuilder("news", "10.0.0", () => NewsPanelCfg_types_gen.defaultOptions);
11254
- },
11255
- nodegraph() {
11256
- return new VizConfigBuilder("nodeGraph", "10.0.0");
11257
- },
11258
- piechart() {
11259
- return new VizConfigBuilder(
11260
- "piechart",
11261
- "10.0.0",
11262
- () => PieChartPanelCfg_types_gen.defaultOptions
11263
- );
11264
- },
11265
- stat() {
11266
- return new VizConfigBuilder("stat", "10.0.0", () => StatPanelCfg_types_gen.defaultOptions);
11267
- },
11268
- statetimeline() {
11269
- return new VizConfigBuilder(
11270
- "state-timeline",
11271
- "10.0.0",
11272
- () => StateTimelinePanelCfg_types_gen.defaultOptions,
11273
- () => StateTimelinePanelCfg_types_gen.defaultFieldConfig
11274
- );
11275
- },
11276
- statushistory() {
11277
- return new VizConfigBuilder(
11278
- "status-history",
11279
- "10.0.0",
11280
- () => StatusHistoryPanelCfg_types_gen.defaultOptions,
11281
- () => StatusHistoryPanelCfg_types_gen.defaultFieldConfig
11282
- );
11283
- },
11284
- table() {
11285
- return new VizConfigBuilder("table", "10.0.0", () => TablePanelCfg_types_gen.defaultOptions);
11286
- },
11287
- text() {
11288
- return new VizConfigBuilder("text", "10.0.0", () => TextPanelCfg_types_gen.defaultOptions);
11289
- },
11290
- timeseries() {
11291
- return new VizConfigBuilder("timeseries", "10.0.0");
11292
- },
11293
- trend() {
11294
- return new VizConfigBuilder("trend", "10.0.0");
11295
- },
11296
- traces() {
11297
- return new VizConfigBuilder("traces", "10.0.0");
11298
- },
11299
- xychart() {
11300
- return new VizConfigBuilder(
11301
- "xychart",
11302
- "10.0.0",
11303
- () => XYChartPanelCfg_types_gen.defaultOptions,
11304
- () => XYChartPanelCfg_types_gen.defaultFieldConfig
11305
- );
11306
- }
11307
- };
11308
-
11309
11133
  const sceneUtils = {
11310
11134
  getUrlWithAppState,
11311
11135
  registerRuntimePanelPlugin,
@@ -11330,7 +11154,6 @@ exports.ConstantVariable = ConstantVariable;
11330
11154
  exports.CustomVariable = CustomVariable;
11331
11155
  exports.DataSourceVariable = DataSourceVariable;
11332
11156
  exports.EmbeddedScene = EmbeddedScene;
11333
- exports.FieldConfigBuilder = FieldConfigBuilder;
11334
11157
  exports.FieldConfigBuilders = FieldConfigBuilders;
11335
11158
  exports.FieldConfigOverridesBuilder = FieldConfigOverridesBuilder;
11336
11159
  exports.GroupByVariable = GroupByVariable;
@@ -11385,10 +11208,7 @@ exports.UrlSyncManager = UrlSyncManager;
11385
11208
  exports.UserActionEvent = UserActionEvent;
11386
11209
  exports.VariableDependencyConfig = VariableDependencyConfig;
11387
11210
  exports.VariableValueControl = VariableValueControl;
11388
- exports.VariableValueSelectWrapper = VariableValueSelectWrapper;
11389
11211
  exports.VariableValueSelectors = VariableValueSelectors;
11390
- exports.VizConfigBuilder = VizConfigBuilder;
11391
- exports.VizConfigBuilders = VizConfigBuilders;
11392
11212
  exports.VizPanel = VizPanel;
11393
11213
  exports.VizPanelBuilder = VizPanelBuilder;
11394
11214
  exports.VizPanelMenu = VizPanelMenu;