@grafana/scenes 4.26.1--canary.770.9383024969.0 → 4.26.1--canary.734.9384160424.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/dist/esm/components/VizPanel/VizPanel.js +3 -0
- package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
- package/dist/esm/core/PanelBuilders/VizConfigBuilder.js +78 -0
- package/dist/esm/core/PanelBuilders/VizConfigBuilder.js.map +1 -0
- package/dist/esm/core/PanelBuilders/VizConfigBuilders.js +114 -0
- package/dist/esm/core/PanelBuilders/VizConfigBuilders.js.map +1 -0
- package/dist/esm/core/types.js.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
- package/dist/esm/services/UrlSyncManager.js +5 -3
- package/dist/esm/services/UrlSyncManager.js.map +1 -1
- package/dist/esm/utils/writeSceneLog.js +5 -1
- package/dist/esm/utils/writeSceneLog.js.map +1 -1
- package/dist/esm/variables/components/VariableValueSelect.js +5 -6
- package/dist/esm/variables/components/VariableValueSelect.js.map +1 -1
- package/dist/esm/variables/utils.js.map +1 -1
- package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -1
- package/dist/index.d.ts +244 -143
- package/dist/index.js +190 -10
- package/dist/index.js.map +1 -1
- package/package.json +5 -8
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
|
-
|
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
|
-
"
|
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;
|
@@ -7716,6 +7722,7 @@ class UrlSyncManager {
|
|
7716
7722
|
this._locationSub = null;
|
7717
7723
|
this._ignoreNextLocationUpdate = false;
|
7718
7724
|
this._onLocationUpdate = (location) => {
|
7725
|
+
this._urlParams = new URLSearchParams(location.search);
|
7719
7726
|
if (this._ignoreNextLocationUpdate) {
|
7720
7727
|
this._ignoreNextLocationUpdate = false;
|
7721
7728
|
return;
|
@@ -7723,9 +7730,8 @@ class UrlSyncManager {
|
|
7723
7730
|
if (this._lastPath !== location.pathname) {
|
7724
7731
|
return;
|
7725
7732
|
}
|
7726
|
-
const urlParams = new URLSearchParams(location.search);
|
7727
7733
|
this._urlKeyMapper.rebuildIndex(this._sceneRoot);
|
7728
|
-
syncStateFromUrl(this._sceneRoot,
|
7734
|
+
syncStateFromUrl(this._sceneRoot, this._urlParams, this._urlKeyMapper);
|
7729
7735
|
this._lastPath = location.pathname;
|
7730
7736
|
};
|
7731
7737
|
this._onStateChanged = ({ payload }) => {
|
@@ -7758,8 +7764,10 @@ class UrlSyncManager {
|
|
7758
7764
|
writeSceneLog("UrlSyncManager", "Unregister previous scene state subscription", this._sceneRoot.state.key);
|
7759
7765
|
this._stateSub.unsubscribe();
|
7760
7766
|
}
|
7767
|
+
const location = runtime.locationService.getLocation();
|
7761
7768
|
this._sceneRoot = root;
|
7762
|
-
this._lastPath =
|
7769
|
+
this._lastPath = location.pathname;
|
7770
|
+
this._urlParams = new URLSearchParams(location.search);
|
7763
7771
|
this._stateSub = root.subscribeToEvent(SceneObjectStateChangedEvent, this._onStateChanged);
|
7764
7772
|
this.syncFrom(this._sceneRoot);
|
7765
7773
|
}
|
@@ -11130,6 +11138,174 @@ const PanelBuilders = {
|
|
11130
11138
|
}
|
11131
11139
|
};
|
11132
11140
|
|
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
|
+
|
11133
11309
|
const sceneUtils = {
|
11134
11310
|
getUrlWithAppState,
|
11135
11311
|
registerRuntimePanelPlugin,
|
@@ -11154,6 +11330,7 @@ exports.ConstantVariable = ConstantVariable;
|
|
11154
11330
|
exports.CustomVariable = CustomVariable;
|
11155
11331
|
exports.DataSourceVariable = DataSourceVariable;
|
11156
11332
|
exports.EmbeddedScene = EmbeddedScene;
|
11333
|
+
exports.FieldConfigBuilder = FieldConfigBuilder;
|
11157
11334
|
exports.FieldConfigBuilders = FieldConfigBuilders;
|
11158
11335
|
exports.FieldConfigOverridesBuilder = FieldConfigOverridesBuilder;
|
11159
11336
|
exports.GroupByVariable = GroupByVariable;
|
@@ -11208,7 +11385,10 @@ exports.UrlSyncManager = UrlSyncManager;
|
|
11208
11385
|
exports.UserActionEvent = UserActionEvent;
|
11209
11386
|
exports.VariableDependencyConfig = VariableDependencyConfig;
|
11210
11387
|
exports.VariableValueControl = VariableValueControl;
|
11388
|
+
exports.VariableValueSelectWrapper = VariableValueSelectWrapper;
|
11211
11389
|
exports.VariableValueSelectors = VariableValueSelectors;
|
11390
|
+
exports.VizConfigBuilder = VizConfigBuilder;
|
11391
|
+
exports.VizConfigBuilders = VizConfigBuilders;
|
11212
11392
|
exports.VizPanel = VizPanel;
|
11213
11393
|
exports.VizPanelBuilder = VizPanelBuilder;
|
11214
11394
|
exports.VizPanelMenu = VizPanelMenu;
|