@grafana/scenes 4.24.4--canary.734.9299949379.0 → 4.24.4
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/README.md +0 -2
- package/dist/esm/components/EmbeddedScene.js +1 -2
- package/dist/esm/components/EmbeddedScene.js.map +1 -1
- package/dist/esm/components/VizPanel/VizPanel.js +0 -3
- package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
- package/dist/esm/components/VizPanel/VizPanelRenderer.js +13 -4
- package/dist/esm/components/VizPanel/VizPanelRenderer.js.map +1 -1
- package/dist/esm/core/types.js.map +1 -1
- package/dist/esm/index.js +1 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
- package/dist/esm/services/UrlSyncManager.js +3 -5
- package/dist/esm/services/UrlSyncManager.js.map +1 -1
- package/dist/esm/utils/writeSceneLog.js +1 -5
- package/dist/esm/utils/writeSceneLog.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 +142 -243
- package/dist/index.js +15 -189
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/dist/esm/core/PanelBuilders/VizConfigBuilder.js +0 -78
- package/dist/esm/core/PanelBuilders/VizConfigBuilder.js.map +0 -1
- package/dist/esm/core/PanelBuilders/VizConfigBuilders.js +0 -114
- package/dist/esm/core/PanelBuilders/VizConfigBuilders.js.map +0 -1
package/dist/index.js
CHANGED
@@ -2046,11 +2046,7 @@ async function getDataSource(datasource, scopedVars) {
|
|
2046
2046
|
}
|
2047
2047
|
|
2048
2048
|
function writeSceneLog(logger, message, ...rest) {
|
2049
|
-
|
2050
|
-
if (typeof window !== "undefined") {
|
2051
|
-
loggingEnabled = localStorage.getItem("grafana.debug.scenes") === "true";
|
2052
|
-
}
|
2053
|
-
if (loggingEnabled) {
|
2049
|
+
if (window.grafanaSceneLogging) {
|
2054
2050
|
console.log(`${logger}: `, message, ...rest);
|
2055
2051
|
}
|
2056
2052
|
}
|
@@ -4605,6 +4601,12 @@ function VizPanelRenderer({ model }) {
|
|
4605
4601
|
description
|
4606
4602
|
} = model.useState();
|
4607
4603
|
const [ref, { width, height }] = reactUse.useMeasure();
|
4604
|
+
const appEvents = React.useMemo(() => runtime.getAppEvents(), []);
|
4605
|
+
const setPanelAttention = React.useCallback(
|
4606
|
+
() => appEvents.publish(new data.SetPanelAttentionEvent({ panelId: model.state.key })),
|
4607
|
+
[model.state.key, appEvents]
|
4608
|
+
);
|
4609
|
+
const debouncedMouseMove = React.useMemo(() => lodash.debounce(setPanelAttention, 100), [setPanelAttention]);
|
4608
4610
|
const plugin = model.getPlugin();
|
4609
4611
|
const { dragClass, dragClassCancel } = getDragClasses(model);
|
4610
4612
|
const dataObject = sceneGraph.getData(model);
|
@@ -4718,7 +4720,9 @@ function VizPanelRenderer({ model }) {
|
|
4718
4720
|
dragClassCancel,
|
4719
4721
|
padding: plugin.noPadding ? "none" : "md",
|
4720
4722
|
menu: panelMenu,
|
4721
|
-
onCancelQuery: model.onCancelQuery
|
4723
|
+
onCancelQuery: model.onCancelQuery,
|
4724
|
+
onFocus: setPanelAttention,
|
4725
|
+
onMouseMove: debouncedMouseMove
|
4722
4726
|
}, (innerWidth, innerHeight) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(ui.ErrorBoundaryAlert, {
|
4723
4727
|
dependencies: [plugin, data$1]
|
4724
4728
|
}, /* @__PURE__ */ React__default["default"].createElement(data.PluginContextProvider, {
|
@@ -4741,7 +4745,7 @@ function VizPanelRenderer({ model }) {
|
|
4741
4745
|
onOptionsChange: model.onOptionsChange,
|
4742
4746
|
onFieldConfigChange: model.onFieldConfigChange,
|
4743
4747
|
onChangeTimeRange: model.onTimeRangeChange,
|
4744
|
-
eventBus:
|
4748
|
+
eventBus: appEvents
|
4745
4749
|
}))))))));
|
4746
4750
|
}
|
4747
4751
|
function getDragClasses(panel) {
|
@@ -5268,9 +5272,6 @@ class VizPanel extends SceneObjectBase {
|
|
5268
5272
|
(_a = this._panelContext) != null ? _a : this._panelContext = this.buildPanelContext();
|
5269
5273
|
return this._panelContext;
|
5270
5274
|
}
|
5271
|
-
clearFieldConfigCache() {
|
5272
|
-
this._dataWithFieldConfig = void 0;
|
5273
|
-
}
|
5274
5275
|
applyFieldConfig(rawData) {
|
5275
5276
|
var _a, _b, _c, _d;
|
5276
5277
|
const plugin = this._plugin;
|
@@ -7774,7 +7775,6 @@ class UrlSyncManager {
|
|
7774
7775
|
this._locationSub = null;
|
7775
7776
|
this._ignoreNextLocationUpdate = false;
|
7776
7777
|
this._onLocationUpdate = (location) => {
|
7777
|
-
this._urlParams = new URLSearchParams(location.search);
|
7778
7778
|
if (this._ignoreNextLocationUpdate) {
|
7779
7779
|
this._ignoreNextLocationUpdate = false;
|
7780
7780
|
return;
|
@@ -7782,8 +7782,9 @@ class UrlSyncManager {
|
|
7782
7782
|
if (this._lastPath !== location.pathname) {
|
7783
7783
|
return;
|
7784
7784
|
}
|
7785
|
+
const urlParams = new URLSearchParams(location.search);
|
7785
7786
|
this._urlKeyMapper.rebuildIndex(this._sceneRoot);
|
7786
|
-
syncStateFromUrl(this._sceneRoot,
|
7787
|
+
syncStateFromUrl(this._sceneRoot, urlParams, this._urlKeyMapper);
|
7787
7788
|
this._lastPath = location.pathname;
|
7788
7789
|
};
|
7789
7790
|
this._onStateChanged = ({ payload }) => {
|
@@ -7816,10 +7817,8 @@ class UrlSyncManager {
|
|
7816
7817
|
writeSceneLog("UrlSyncManager", "Unregister previous scene state subscription", this._sceneRoot.state.key);
|
7817
7818
|
this._stateSub.unsubscribe();
|
7818
7819
|
}
|
7819
|
-
const location = runtime.locationService.getLocation();
|
7820
7820
|
this._sceneRoot = root;
|
7821
|
-
this._lastPath =
|
7822
|
-
this._urlParams = new URLSearchParams(location.search);
|
7821
|
+
this._lastPath = runtime.locationService.getLocation().pathname;
|
7823
7822
|
this._stateSub = root.subscribeToEvent(SceneObjectStateChangedEvent, this._onStateChanged);
|
7824
7823
|
this.syncFrom(this._sceneRoot);
|
7825
7824
|
}
|
@@ -7892,7 +7891,7 @@ EmbeddedScene.Component = EmbeddedSceneRenderer;
|
|
7892
7891
|
function EmbeddedSceneRenderer({ model }) {
|
7893
7892
|
const { body, controls } = model.useState();
|
7894
7893
|
const styles = ui.useStyles2(getStyles$5);
|
7895
|
-
|
7894
|
+
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
7896
7895
|
className: styles.container
|
7897
7896
|
}, controls && /* @__PURE__ */ React__default["default"].createElement("div", {
|
7898
7897
|
className: styles.controls
|
@@ -7904,7 +7903,6 @@ function EmbeddedSceneRenderer({ model }) {
|
|
7904
7903
|
}, /* @__PURE__ */ React__default["default"].createElement(body.Component, {
|
7905
7904
|
model: body
|
7906
7905
|
})));
|
7907
|
-
return inner;
|
7908
7906
|
}
|
7909
7907
|
const getStyles$5 = (theme) => {
|
7910
7908
|
return {
|
@@ -10963,174 +10961,6 @@ const PanelBuilders = {
|
|
10963
10961
|
}
|
10964
10962
|
};
|
10965
10963
|
|
10966
|
-
class VizConfigBuilder {
|
10967
|
-
constructor(pluginId, pluginVersion, defaultOptions, defaultFieldConfig) {
|
10968
|
-
this._pluginId = pluginId;
|
10969
|
-
this._pluginVersion = pluginVersion;
|
10970
|
-
this._fieldConfigBuilder = new FieldConfigBuilder(defaultFieldConfig);
|
10971
|
-
this._panelOptionsBuilder = new PanelOptionsBuilder(defaultOptions);
|
10972
|
-
}
|
10973
|
-
setColor(color) {
|
10974
|
-
this._fieldConfigBuilder.setColor(color);
|
10975
|
-
return this;
|
10976
|
-
}
|
10977
|
-
setDecimals(decimals) {
|
10978
|
-
this._fieldConfigBuilder.setDecimals(decimals);
|
10979
|
-
return this;
|
10980
|
-
}
|
10981
|
-
setDisplayName(displayName) {
|
10982
|
-
this._fieldConfigBuilder.setDisplayName(displayName);
|
10983
|
-
return this;
|
10984
|
-
}
|
10985
|
-
setFilterable(filterable) {
|
10986
|
-
this._fieldConfigBuilder.setFilterable(filterable);
|
10987
|
-
return this;
|
10988
|
-
}
|
10989
|
-
setLinks(links) {
|
10990
|
-
this._fieldConfigBuilder.setLinks(links);
|
10991
|
-
return this;
|
10992
|
-
}
|
10993
|
-
setMappings(mappings) {
|
10994
|
-
this._fieldConfigBuilder.setMappings(mappings);
|
10995
|
-
return this;
|
10996
|
-
}
|
10997
|
-
setMax(max) {
|
10998
|
-
this._fieldConfigBuilder.setMax(max);
|
10999
|
-
return this;
|
11000
|
-
}
|
11001
|
-
setMin(min) {
|
11002
|
-
this._fieldConfigBuilder.setMin(min);
|
11003
|
-
return this;
|
11004
|
-
}
|
11005
|
-
setNoValue(noValue) {
|
11006
|
-
this._fieldConfigBuilder.setNoValue(noValue);
|
11007
|
-
return this;
|
11008
|
-
}
|
11009
|
-
setThresholds(thresholds) {
|
11010
|
-
this._fieldConfigBuilder.setThresholds(thresholds);
|
11011
|
-
return this;
|
11012
|
-
}
|
11013
|
-
setUnit(unit) {
|
11014
|
-
this._fieldConfigBuilder.setUnit(unit);
|
11015
|
-
return this;
|
11016
|
-
}
|
11017
|
-
setCustomFieldConfig(id, value) {
|
11018
|
-
this._fieldConfigBuilder.setCustomFieldConfig(id, value);
|
11019
|
-
return this;
|
11020
|
-
}
|
11021
|
-
setOverrides(builder) {
|
11022
|
-
this._fieldConfigBuilder.setOverrides(builder);
|
11023
|
-
return this;
|
11024
|
-
}
|
11025
|
-
setOption(id, value) {
|
11026
|
-
this._panelOptionsBuilder.setOption(id, value);
|
11027
|
-
return this;
|
11028
|
-
}
|
11029
|
-
build() {
|
11030
|
-
return {
|
11031
|
-
pluginId: this._pluginId,
|
11032
|
-
pluginVersion: this._pluginVersion,
|
11033
|
-
options: this._panelOptionsBuilder.build(),
|
11034
|
-
fieldConfig: this._fieldConfigBuilder.build()
|
11035
|
-
};
|
11036
|
-
}
|
11037
|
-
}
|
11038
|
-
|
11039
|
-
const VizConfigBuilders = {
|
11040
|
-
barchart() {
|
11041
|
-
return new VizConfigBuilder(
|
11042
|
-
"barchart",
|
11043
|
-
"10.0.0",
|
11044
|
-
() => BarChartPanelCfg_types_gen.defaultOptions,
|
11045
|
-
() => BarChartPanelCfg_types_gen.defaultFieldConfig
|
11046
|
-
);
|
11047
|
-
},
|
11048
|
-
bargauge() {
|
11049
|
-
return new VizConfigBuilder("bargauge", "10.0.0", () => BarGaugePanelCfg_types_gen.defaultOptions);
|
11050
|
-
},
|
11051
|
-
datagrid() {
|
11052
|
-
return new VizConfigBuilder("datagrid", "10.0.0", () => DatagridPanelCfg_types_gen.defaultOptions);
|
11053
|
-
},
|
11054
|
-
flamegraph() {
|
11055
|
-
return new VizConfigBuilder("flamegraph", "10.0.0");
|
11056
|
-
},
|
11057
|
-
gauge() {
|
11058
|
-
return new VizConfigBuilder("gauge", "10.0.0", () => GaugePanelCfg_types_gen.defaultOptions);
|
11059
|
-
},
|
11060
|
-
geomap() {
|
11061
|
-
return new VizConfigBuilder("geomap", "10.0.0", () => GeomapPanelCfg_types_gen.defaultOptions);
|
11062
|
-
},
|
11063
|
-
heatmap() {
|
11064
|
-
return new VizConfigBuilder("heatmap", "10.0.0", () => HeatmapPanelCfg_types_gen.defaultOptions);
|
11065
|
-
},
|
11066
|
-
histogram() {
|
11067
|
-
return new VizConfigBuilder(
|
11068
|
-
"histogram",
|
11069
|
-
"10.0.0",
|
11070
|
-
() => HistogramPanelCfg_types_gen.defaultOptions,
|
11071
|
-
() => HistogramPanelCfg_types_gen.defaultFieldConfig
|
11072
|
-
);
|
11073
|
-
},
|
11074
|
-
logs() {
|
11075
|
-
return new VizConfigBuilder("logs", "10.0.0");
|
11076
|
-
},
|
11077
|
-
news() {
|
11078
|
-
return new VizConfigBuilder("news", "10.0.0", () => NewsPanelCfg_types_gen.defaultOptions);
|
11079
|
-
},
|
11080
|
-
nodegraph() {
|
11081
|
-
return new VizConfigBuilder("nodeGraph", "10.0.0");
|
11082
|
-
},
|
11083
|
-
piechart() {
|
11084
|
-
return new VizConfigBuilder(
|
11085
|
-
"piechart",
|
11086
|
-
"10.0.0",
|
11087
|
-
() => PieChartPanelCfg_types_gen.defaultOptions
|
11088
|
-
);
|
11089
|
-
},
|
11090
|
-
stat() {
|
11091
|
-
return new VizConfigBuilder("stat", "10.0.0", () => StatPanelCfg_types_gen.defaultOptions);
|
11092
|
-
},
|
11093
|
-
statetimeline() {
|
11094
|
-
return new VizConfigBuilder(
|
11095
|
-
"state-timeline",
|
11096
|
-
"10.0.0",
|
11097
|
-
() => StateTimelinePanelCfg_types_gen.defaultOptions,
|
11098
|
-
() => StateTimelinePanelCfg_types_gen.defaultFieldConfig
|
11099
|
-
);
|
11100
|
-
},
|
11101
|
-
statushistory() {
|
11102
|
-
return new VizConfigBuilder(
|
11103
|
-
"status-history",
|
11104
|
-
"10.0.0",
|
11105
|
-
() => StatusHistoryPanelCfg_types_gen.defaultOptions,
|
11106
|
-
() => StatusHistoryPanelCfg_types_gen.defaultFieldConfig
|
11107
|
-
);
|
11108
|
-
},
|
11109
|
-
table() {
|
11110
|
-
return new VizConfigBuilder("table", "10.0.0", () => TablePanelCfg_types_gen.defaultOptions);
|
11111
|
-
},
|
11112
|
-
text() {
|
11113
|
-
return new VizConfigBuilder("text", "10.0.0", () => TextPanelCfg_types_gen.defaultOptions);
|
11114
|
-
},
|
11115
|
-
timeseries() {
|
11116
|
-
return new VizConfigBuilder("timeseries", "10.0.0");
|
11117
|
-
},
|
11118
|
-
trend() {
|
11119
|
-
return new VizConfigBuilder("trend", "10.0.0");
|
11120
|
-
},
|
11121
|
-
traces() {
|
11122
|
-
return new VizConfigBuilder("traces", "10.0.0");
|
11123
|
-
},
|
11124
|
-
xychart() {
|
11125
|
-
return new VizConfigBuilder(
|
11126
|
-
"xychart",
|
11127
|
-
"10.0.0",
|
11128
|
-
() => XYChartPanelCfg_types_gen.defaultOptions,
|
11129
|
-
() => XYChartPanelCfg_types_gen.defaultFieldConfig
|
11130
|
-
);
|
11131
|
-
}
|
11132
|
-
};
|
11133
|
-
|
11134
10964
|
const sceneUtils = {
|
11135
10965
|
getUrlWithAppState,
|
11136
10966
|
registerRuntimePanelPlugin,
|
@@ -11155,7 +10985,6 @@ exports.ConstantVariable = ConstantVariable;
|
|
11155
10985
|
exports.CustomVariable = CustomVariable;
|
11156
10986
|
exports.DataSourceVariable = DataSourceVariable;
|
11157
10987
|
exports.EmbeddedScene = EmbeddedScene;
|
11158
|
-
exports.FieldConfigBuilder = FieldConfigBuilder;
|
11159
10988
|
exports.FieldConfigBuilders = FieldConfigBuilders;
|
11160
10989
|
exports.FieldConfigOverridesBuilder = FieldConfigOverridesBuilder;
|
11161
10990
|
exports.GroupByVariable = GroupByVariable;
|
@@ -11210,10 +11039,7 @@ exports.UrlSyncManager = UrlSyncManager;
|
|
11210
11039
|
exports.UserActionEvent = UserActionEvent;
|
11211
11040
|
exports.VariableDependencyConfig = VariableDependencyConfig;
|
11212
11041
|
exports.VariableValueControl = VariableValueControl;
|
11213
|
-
exports.VariableValueSelectWrapper = VariableValueSelectWrapper;
|
11214
11042
|
exports.VariableValueSelectors = VariableValueSelectors;
|
11215
|
-
exports.VizConfigBuilder = VizConfigBuilder;
|
11216
|
-
exports.VizConfigBuilders = VizConfigBuilders;
|
11217
11043
|
exports.VizPanel = VizPanel;
|
11218
11044
|
exports.VizPanelBuilder = VizPanelBuilder;
|
11219
11045
|
exports.VizPanelMenu = VizPanelMenu;
|