@perses-dev/plugin-system 0.0.0-snapshot-profile-89b306f → 0.0.0-snapshot-time-zone-selector-946f408
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +2 -2
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +3 -1
- package/dist/cjs/components/Variables/variable-model.js +4 -2
- package/dist/cjs/constants/user-interface-text.js +1 -0
- package/dist/cjs/model/index.js +0 -1
- package/dist/cjs/remote/PluginRuntime.js +6 -6
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +2 -10
- package/dist/cjs/runtime/DataQueriesProvider/model.js +4 -17
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +30 -3
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +5 -1
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +31 -0
- package/dist/cjs/runtime/index.js +0 -1
- package/dist/cjs/runtime/time-series-queries.js +1 -1
- package/dist/cjs/test/mock-data.js +0 -23
- package/dist/cjs/{model/profile-queries.js → test/render-hook.js} +16 -1
- package/dist/cjs/test/render.js +4 -21
- package/dist/cjs/test/utils.js +49 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +2 -2
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +4 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +4 -2
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +1 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +1 -0
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +0 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/plugins.d.ts +0 -2
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/remote/PluginRuntime.js +6 -6
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +2 -10
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +4 -17
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +12 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +28 -4
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +6 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +4 -0
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +29 -1
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +0 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +1 -1
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +2 -2
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/test/mock-data.d.ts +1 -2
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +0 -20
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render-hook.d.ts +8 -0
- package/dist/test/render-hook.d.ts.map +1 -0
- package/dist/test/render-hook.js +26 -0
- package/dist/test/render-hook.js.map +1 -0
- package/dist/test/render.d.ts +1 -5
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +4 -21
- package/dist/test/render.js.map +1 -1
- package/dist/test/utils.d.ts +9 -0
- package/dist/test/utils.d.ts.map +1 -0
- package/dist/test/utils.js +41 -0
- package/dist/test/utils.js.map +1 -0
- package/package.json +5 -5
- package/dist/cjs/runtime/profile-queries.js +0 -65
- package/dist/model/profile-queries.d.ts +0 -19
- package/dist/model/profile-queries.d.ts.map +0 -1
- package/dist/model/profile-queries.js +0 -15
- package/dist/model/profile-queries.js.map +0 -1
- package/dist/runtime/profile-queries.d.ts +0 -10
- package/dist/runtime/profile-queries.d.ts.map +0 -1
- package/dist/runtime/profile-queries.js +0 -52
- package/dist/runtime/profile-queries.js.map +0 -1
|
@@ -43,7 +43,7 @@ function useDefaultQueryDefinition(queryTypes) {
|
|
|
43
43
|
const { defaultPluginKinds } = (0, _runtime.usePluginRegistry)();
|
|
44
44
|
const defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';
|
|
45
45
|
const { data: defaultQueryPlugin } = (0, _runtime.usePlugin)(defaultQueryType, defaultQueryKind, {
|
|
46
|
-
|
|
46
|
+
useErrorBoundary: true,
|
|
47
47
|
enabled: true
|
|
48
48
|
});
|
|
49
49
|
// This default query definition is used if no query is provided initially or when we add a new query
|
|
@@ -29,14 +29,14 @@ const _MultiQueryEditor = require("../MultiQueryEditor");
|
|
|
29
29
|
function PanelSpecEditor(props) {
|
|
30
30
|
const { control, panelDefinition, onJSONChange, onQueriesChange, onPluginSpecChange } = props;
|
|
31
31
|
const { kind } = panelDefinition.spec.plugin;
|
|
32
|
-
const { data: plugin,
|
|
32
|
+
const { data: plugin, isLoading, error } = (0, _runtime.usePlugin)('Panel', kind);
|
|
33
33
|
if (error) {
|
|
34
34
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorAlert, {
|
|
35
35
|
error: error
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
// TODO: Proper loading indicator
|
|
39
|
-
if (
|
|
39
|
+
if (isLoading) {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
42
|
if (plugin === undefined) {
|
|
@@ -84,6 +84,7 @@ const DEFAULT_REFRESH_INTERVAL_OPTIONS = [
|
|
|
84
84
|
const DEFAULT_HEIGHT = '34px';
|
|
85
85
|
function TimeRangeControls({ heightPx, showTimeRangeSelector = true, showRefreshButton = true, showRefreshInterval = true, showCustomTimeRange, showZoomButtons = true, timePresets }) {
|
|
86
86
|
const { timeRange, setTimeRange, refresh, refreshInterval, setRefreshInterval } = (0, _runtime.useTimeRange)();
|
|
87
|
+
const { timeZone } = (0, _runtime.useTimeZone)();
|
|
87
88
|
const showCustomTimeRangeValue = (0, _runtime.useShowCustomTimeRangeSetting)(showCustomTimeRange);
|
|
88
89
|
const showZoomInOutButtons = (0, _runtime.useShowZoomRangeSetting)(showZoomButtons);
|
|
89
90
|
const timePresetsValue = (0, _runtime.useTimeRangeOptionsSetting)(timePresets);
|
|
@@ -172,7 +173,8 @@ function TimeRangeControls({ heightPx, showTimeRangeSelector = true, showRefresh
|
|
|
172
173
|
value: timeRange,
|
|
173
174
|
onChange: setTimeRange,
|
|
174
175
|
height: height,
|
|
175
|
-
showCustomTimeRange: showCustomTimeRangeValue
|
|
176
|
+
showCustomTimeRange: showCustomTimeRangeValue,
|
|
177
|
+
timeZone: timeZone
|
|
176
178
|
}),
|
|
177
179
|
showZoomInOutButtons && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
178
180
|
description: _constants.TOOLTIP_TEXT.zoomOut,
|
|
@@ -73,11 +73,13 @@ function useListVariablePluginValues(definition) {
|
|
|
73
73
|
};
|
|
74
74
|
const spec = definition.spec.plugin.spec;
|
|
75
75
|
const capturingRegexp = definition.spec.capturingRegexp !== undefined ? new RegExp(definition.spec.capturingRegexp, 'g') : undefined;
|
|
76
|
-
let dependsOnVariables;
|
|
76
|
+
let dependsOnVariables = Object.keys(allVariables); // Default to all variables
|
|
77
77
|
if (variablePlugin?.dependsOn) {
|
|
78
78
|
const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);
|
|
79
|
-
dependsOnVariables = dependencies.variables;
|
|
79
|
+
dependsOnVariables = dependencies.variables ? dependencies.variables : dependsOnVariables;
|
|
80
80
|
}
|
|
81
|
+
// Exclude self variable to avoid circular dependency
|
|
82
|
+
dependsOnVariables = dependsOnVariables.filter((v)=>v !== definition.spec.name);
|
|
81
83
|
const variables = (0, _runtime.useAllVariableValues)(dependsOnVariables);
|
|
82
84
|
let waitToLoad = false;
|
|
83
85
|
if (dependsOnVariables) {
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -22,7 +22,6 @@ _export_star(require("./plugin-base"), exports);
|
|
|
22
22
|
_export_star(require("./plugin-loading"), exports);
|
|
23
23
|
_export_star(require("./time-series-queries"), exports);
|
|
24
24
|
_export_star(require("./trace-queries"), exports);
|
|
25
|
-
_export_star(require("./profile-queries"), exports);
|
|
26
25
|
_export_star(require("./variables"), exports);
|
|
27
26
|
function _export_star(from, to) {
|
|
28
27
|
Object.keys(from).forEach(function(k) {
|
|
@@ -112,11 +112,11 @@ const getPluginRuntime = ()=>{
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
'@tanstack/react-query': {
|
|
115
|
-
version: '
|
|
115
|
+
version: '4.39.1',
|
|
116
116
|
lib: ()=>_reactquery,
|
|
117
117
|
shareConfig: {
|
|
118
118
|
singleton: true,
|
|
119
|
-
requiredVersion: '^
|
|
119
|
+
requiredVersion: '^4.39.1'
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
'react-hook-form': {
|
|
@@ -140,7 +140,7 @@ const getPluginRuntime = ()=>{
|
|
|
140
140
|
lib: ()=>require('@perses-dev/components'),
|
|
141
141
|
shareConfig: {
|
|
142
142
|
singleton: true,
|
|
143
|
-
requiredVersion: '^0.51.0-
|
|
143
|
+
requiredVersion: '^0.51.0-rc.0'
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
'@perses-dev/plugin-system': {
|
|
@@ -148,7 +148,7 @@ const getPluginRuntime = ()=>{
|
|
|
148
148
|
lib: ()=>require('@perses-dev/plugin-system'),
|
|
149
149
|
shareConfig: {
|
|
150
150
|
singleton: true,
|
|
151
|
-
requiredVersion: '^0.51.0-
|
|
151
|
+
requiredVersion: '^0.51.0-rc.0'
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
'@perses-dev/explore': {
|
|
@@ -156,7 +156,7 @@ const getPluginRuntime = ()=>{
|
|
|
156
156
|
lib: ()=>require('@perses-dev/explore'),
|
|
157
157
|
shareConfig: {
|
|
158
158
|
singleton: true,
|
|
159
|
-
requiredVersion: '^0.51.0-
|
|
159
|
+
requiredVersion: '^0.51.0-rc.0'
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
'@perses-dev/dashboards': {
|
|
@@ -164,7 +164,7 @@ const getPluginRuntime = ()=>{
|
|
|
164
164
|
lib: ()=>require('@perses-dev/dashboards'),
|
|
165
165
|
shareConfig: {
|
|
166
166
|
singleton: true,
|
|
167
|
-
requiredVersion: '^0.51.0-
|
|
167
|
+
requiredVersion: '^0.51.0-rc.0'
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
170
|
// Below are the shared modules that are used by the plugins, this can be part of the SDK
|
|
@@ -38,7 +38,6 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
38
38
|
const _react = require("react");
|
|
39
39
|
const _timeseriesqueries = require("../time-series-queries");
|
|
40
40
|
const _tracequeries = require("../trace-queries");
|
|
41
|
-
const _profilequeries = require("../profile-queries");
|
|
42
41
|
const _UsageMetricsProvider = require("../UsageMetricsProvider");
|
|
43
42
|
const _model = require("./model");
|
|
44
43
|
const DataQueriesContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
@@ -84,22 +83,17 @@ function DataQueriesProvider(props) {
|
|
|
84
83
|
const timeSeriesResults = (0, _timeseriesqueries.useTimeSeriesQueries)(timeSeriesQueries, options, queryOptions);
|
|
85
84
|
const traceQueries = queryDefinitions.filter((definition)=>definition.kind === 'TraceQuery');
|
|
86
85
|
const traceResults = (0, _tracequeries.useTraceQueries)(traceQueries);
|
|
87
|
-
const profileQueries = queryDefinitions.filter((definition)=>definition.kind === 'ProfileQuery');
|
|
88
|
-
const profileResults = (0, _profilequeries.useProfileQueries)(profileQueries);
|
|
89
86
|
const refetchAll = (0, _react.useCallback)(()=>{
|
|
90
87
|
timeSeriesResults.forEach((result)=>result.refetch());
|
|
91
88
|
traceResults.forEach((result)=>result.refetch());
|
|
92
|
-
profileResults.forEach((result)=>result.refetch());
|
|
93
89
|
}, [
|
|
94
90
|
timeSeriesResults,
|
|
95
|
-
traceResults
|
|
96
|
-
profileResults
|
|
91
|
+
traceResults
|
|
97
92
|
]);
|
|
98
93
|
const ctx = (0, _react.useMemo)(()=>{
|
|
99
94
|
const mergedQueryResults = [
|
|
100
95
|
...(0, _model.transformQueryResults)(timeSeriesResults, timeSeriesQueries),
|
|
101
|
-
...(0, _model.transformQueryResults)(traceResults, traceQueries)
|
|
102
|
-
...(0, _model.transformQueryResults)(profileResults, profileQueries)
|
|
96
|
+
...(0, _model.transformQueryResults)(traceResults, traceQueries)
|
|
103
97
|
];
|
|
104
98
|
if (queryOptions?.enabled) {
|
|
105
99
|
for (const result of mergedQueryResults){
|
|
@@ -124,8 +118,6 @@ function DataQueriesProvider(props) {
|
|
|
124
118
|
timeSeriesResults,
|
|
125
119
|
traceQueries,
|
|
126
120
|
traceResults,
|
|
127
|
-
profileQueries,
|
|
128
|
-
profileResults,
|
|
129
121
|
refetchAll,
|
|
130
122
|
queryOptions?.enabled,
|
|
131
123
|
usageMetrics
|
|
@@ -49,15 +49,11 @@ function useQueryType() {
|
|
|
49
49
|
const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)([
|
|
50
50
|
'TraceQuery'
|
|
51
51
|
]);
|
|
52
|
-
const { data: profileQueryPlugins, isLoading: isProfileQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)([
|
|
53
|
-
'ProfileQuery'
|
|
54
|
-
]);
|
|
55
52
|
// For example, `map: {"TimeSeriesQuery":["PrometheusTimeSeriesQuery"],"TraceQuery":["TempoTraceQuery"]}`
|
|
56
53
|
const queryTypeMap = (0, _react.useMemo)(()=>{
|
|
57
54
|
const map = {
|
|
58
55
|
TimeSeriesQuery: [],
|
|
59
|
-
TraceQuery: []
|
|
60
|
-
ProfileQuery: []
|
|
56
|
+
TraceQuery: []
|
|
61
57
|
};
|
|
62
58
|
if (timeSeriesQueryPlugins) {
|
|
63
59
|
timeSeriesQueryPlugins.forEach((plugin)=>{
|
|
@@ -69,16 +65,10 @@ function useQueryType() {
|
|
|
69
65
|
map[plugin.kind]?.push(plugin.spec.name);
|
|
70
66
|
});
|
|
71
67
|
}
|
|
72
|
-
if (profileQueryPlugins) {
|
|
73
|
-
profileQueryPlugins.forEach((plugin)=>{
|
|
74
|
-
map[plugin.kind]?.push(plugin.spec.name);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
68
|
return map;
|
|
78
69
|
}, [
|
|
79
70
|
timeSeriesQueryPlugins,
|
|
80
|
-
traceQueryPlugins
|
|
81
|
-
profileQueryPlugins
|
|
71
|
+
traceQueryPlugins
|
|
82
72
|
]);
|
|
83
73
|
const getQueryType = (0, _react.useCallback)((pluginKind)=>{
|
|
84
74
|
const isLoading = (pluginKind)=>{
|
|
@@ -87,10 +77,8 @@ function useQueryType() {
|
|
|
87
77
|
return isTimeSeriesQueryLoading;
|
|
88
78
|
case 'TempoTraceQuery':
|
|
89
79
|
return isTraceQueryPluginLoading;
|
|
90
|
-
case 'PyroscopeProfileQuery':
|
|
91
|
-
return isProfileQueryPluginLoading;
|
|
92
80
|
}
|
|
93
|
-
return isTraceQueryPluginLoading || isTimeSeriesQueryLoading
|
|
81
|
+
return isTraceQueryPluginLoading || isTimeSeriesQueryLoading;
|
|
94
82
|
};
|
|
95
83
|
if (isLoading(pluginKind)) {
|
|
96
84
|
return undefined;
|
|
@@ -104,8 +92,7 @@ function useQueryType() {
|
|
|
104
92
|
}, [
|
|
105
93
|
queryTypeMap,
|
|
106
94
|
isTimeSeriesQueryLoading,
|
|
107
|
-
isTraceQueryPluginLoading
|
|
108
|
-
isProfileQueryPluginLoading
|
|
95
|
+
isTraceQueryPluginLoading
|
|
109
96
|
]);
|
|
110
97
|
return getQueryType;
|
|
111
98
|
}
|
|
@@ -35,11 +35,15 @@ _export(exports, {
|
|
|
35
35
|
},
|
|
36
36
|
useTimeRangeContext: function() {
|
|
37
37
|
return useTimeRangeContext;
|
|
38
|
+
},
|
|
39
|
+
useTimeZone: function() {
|
|
40
|
+
return useTimeZone;
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
const _jsxruntime = require("react/jsx-runtime");
|
|
41
44
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
42
45
|
const _core = require("@perses-dev/core");
|
|
46
|
+
const _components = require("@perses-dev/components");
|
|
43
47
|
const _refreshinterval = require("./refresh-interval");
|
|
44
48
|
function _getRequireWildcardCache(nodeInterop) {
|
|
45
49
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -93,15 +97,29 @@ function useTimeRangeContext() {
|
|
|
93
97
|
function useTimeRange() {
|
|
94
98
|
return useTimeRangeContext();
|
|
95
99
|
}
|
|
100
|
+
function useTimeZone() {
|
|
101
|
+
const { timeZone, setTimeZone } = useTimeRangeContext();
|
|
102
|
+
return {
|
|
103
|
+
timeZone,
|
|
104
|
+
setTimeZone,
|
|
105
|
+
formatWithUserTimeZone: (date, formatString)=>{
|
|
106
|
+
return (0, _components.formatWithTimeZone)(date, formatString, timeZone);
|
|
107
|
+
},
|
|
108
|
+
dateFormatOptionsWithUserTimeZone: (dateFormatOptions)=>{
|
|
109
|
+
return (0, _components.dateFormatOptionsWithTimeZone)(dateFormatOptions, timeZone);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
96
113
|
function useSuggestedStepMs(width) {
|
|
97
114
|
const { absoluteTimeRange } = useTimeRange();
|
|
98
115
|
if (width === undefined) return 0;
|
|
99
116
|
return (0, _core.getSuggestedStepMs)(absoluteTimeRange, width);
|
|
100
117
|
}
|
|
101
118
|
function TimeRangeProvider(props) {
|
|
102
|
-
const { timeRange, refreshInterval, children, setTimeRange, setRefreshInterval } = props;
|
|
119
|
+
const { timeRange, refreshInterval, children, setTimeRange, setRefreshInterval, timeZone = _core.DEFAULT_DASHBOARD_TIMEZONE, setTimeZone } = props;
|
|
103
120
|
const [localTimeRange, setLocalTimeRange] = (0, _react.useState)(timeRange);
|
|
104
121
|
const [localRefreshInterval, setLocalRefreshInterval] = (0, _react.useState)(refreshInterval);
|
|
122
|
+
const [localTimeZone, setLocalTimeZone] = (0, _react.useState)(timeZone);
|
|
105
123
|
const [refreshCounter, setRefreshCounter] = (0, _react.useState)(0);
|
|
106
124
|
(0, _react.useEffect)(()=>{
|
|
107
125
|
setLocalTimeRange(timeRange);
|
|
@@ -114,6 +132,11 @@ function TimeRangeProvider(props) {
|
|
|
114
132
|
}, [
|
|
115
133
|
refreshInterval
|
|
116
134
|
]);
|
|
135
|
+
(0, _react.useEffect)(()=>{
|
|
136
|
+
setLocalTimeZone(timeZone);
|
|
137
|
+
}, [
|
|
138
|
+
timeZone
|
|
139
|
+
]);
|
|
117
140
|
const refresh = (0, _react.useCallback)(()=>{
|
|
118
141
|
setRefreshCounter((counter)=>counter + 1);
|
|
119
142
|
}, [
|
|
@@ -135,22 +158,26 @@ function TimeRangeProvider(props) {
|
|
|
135
158
|
const absoluteTimeRange = (0, _core.isRelativeTimeRange)(localTimeRange) ? (0, _core.toAbsoluteTimeRange)(localTimeRange) : localTimeRange;
|
|
136
159
|
return {
|
|
137
160
|
timeRange: localTimeRange,
|
|
161
|
+
timeZone: localTimeZone,
|
|
138
162
|
setTimeRange: setTimeRange ?? setLocalTimeRange,
|
|
139
163
|
absoluteTimeRange,
|
|
140
164
|
refresh,
|
|
141
165
|
refreshKey: `${absoluteTimeRange.start}:${absoluteTimeRange.end}:${localRefreshInterval}:${refreshCounter}`,
|
|
142
166
|
refreshInterval: localRefreshInterval,
|
|
143
167
|
refreshIntervalInMs: refreshIntervalInMs,
|
|
144
|
-
setRefreshInterval: setRefreshInterval ?? setLocalRefreshInterval
|
|
168
|
+
setRefreshInterval: setRefreshInterval ?? setLocalRefreshInterval,
|
|
169
|
+
setTimeZone: setTimeZone ?? setLocalTimeZone
|
|
145
170
|
};
|
|
146
171
|
}, [
|
|
147
172
|
localTimeRange,
|
|
173
|
+
localTimeZone,
|
|
148
174
|
setTimeRange,
|
|
149
175
|
refresh,
|
|
150
176
|
localRefreshInterval,
|
|
151
177
|
refreshCounter,
|
|
152
178
|
refreshIntervalInMs,
|
|
153
|
-
setRefreshInterval
|
|
179
|
+
setRefreshInterval,
|
|
180
|
+
setTimeZone
|
|
154
181
|
]);
|
|
155
182
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(TimeRangeContext.Provider, {
|
|
156
183
|
value: ctx,
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "TimeRangeProviderWithQueryParams", {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _core = require("@perses-dev/core");
|
|
24
25
|
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
25
26
|
const _TimeRangeProvider = require("./TimeRangeProvider");
|
|
26
27
|
const _queryparams = require("./query-params");
|
|
@@ -30,14 +31,17 @@ function _interop_require_default(obj) {
|
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
function TimeRangeProviderWithQueryParams(props) {
|
|
33
|
-
const { initialTimeRange, initialRefreshInterval, children } = props;
|
|
34
|
+
const { initialTimeRange, initialRefreshInterval, children, initialTimeZone = _core.DEFAULT_DASHBOARD_TIMEZONE } = props;
|
|
34
35
|
const { timeRange, setTimeRange } = (0, _queryparams.useTimeRangeParams)(initialTimeRange);
|
|
35
36
|
const { refreshInterval, setRefreshInterval } = (0, _queryparams.useSetRefreshIntervalParams)(initialRefreshInterval);
|
|
37
|
+
const { timeZone, setTimeZone } = (0, _queryparams.useSetTimeZoneParams)(initialTimeZone);
|
|
36
38
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeRangeProvider.TimeRangeProvider, {
|
|
37
39
|
timeRange: timeRange,
|
|
38
40
|
refreshInterval: refreshInterval,
|
|
39
41
|
setTimeRange: setTimeRange,
|
|
40
42
|
setRefreshInterval: setRefreshInterval,
|
|
43
|
+
timeZone: timeZone,
|
|
44
|
+
setTimeZone: setTimeZone,
|
|
41
45
|
children: children
|
|
42
46
|
});
|
|
43
47
|
}
|
|
@@ -45,6 +45,9 @@ _export(exports, {
|
|
|
45
45
|
useSetRefreshIntervalParams: function() {
|
|
46
46
|
return useSetRefreshIntervalParams;
|
|
47
47
|
},
|
|
48
|
+
useSetTimeZoneParams: function() {
|
|
49
|
+
return useSetTimeZoneParams;
|
|
50
|
+
},
|
|
48
51
|
useTimeRangeParams: function() {
|
|
49
52
|
return useTimeRangeParams;
|
|
50
53
|
}
|
|
@@ -221,3 +224,31 @@ function useSetRefreshIntervalParams(initialRefreshInterval) {
|
|
|
221
224
|
setRefreshInterval: setRefreshInterval
|
|
222
225
|
};
|
|
223
226
|
}
|
|
227
|
+
function useSetTimeZoneParams(initialTimeZone) {
|
|
228
|
+
const [query, setQuery] = (0, _usequeryparams.useQueryParams)({
|
|
229
|
+
timeZone: _usequeryparams.StringParam
|
|
230
|
+
}, {
|
|
231
|
+
updateType: 'replaceIn'
|
|
232
|
+
});
|
|
233
|
+
const { timeZone } = query;
|
|
234
|
+
(0, _react.useEffect)(()=>{
|
|
235
|
+
if (!timeZone) {
|
|
236
|
+
setQuery({
|
|
237
|
+
timeZone: initialTimeZone
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}, [
|
|
241
|
+
setQuery,
|
|
242
|
+
timeZone,
|
|
243
|
+
initialTimeZone
|
|
244
|
+
]);
|
|
245
|
+
const setTimeZone = (0, _react.useCallback)((timeZone)=>setQuery({
|
|
246
|
+
timeZone
|
|
247
|
+
}), [
|
|
248
|
+
setQuery
|
|
249
|
+
]);
|
|
250
|
+
return {
|
|
251
|
+
timeZone: timeZone ? timeZone : initialTimeZone,
|
|
252
|
+
setTimeZone: setTimeZone
|
|
253
|
+
};
|
|
254
|
+
}
|
|
@@ -21,7 +21,6 @@ _export_star(require("./variables"), exports);
|
|
|
21
21
|
_export_star(require("./TimeRangeProvider"), exports);
|
|
22
22
|
_export_star(require("./time-series-queries"), exports);
|
|
23
23
|
_export_star(require("./trace-queries"), exports);
|
|
24
|
-
_export_star(require("./profile-queries"), exports);
|
|
25
24
|
_export_star(require("./DataQueriesProvider"), exports);
|
|
26
25
|
_export_star(require("./QueryCountProvider"), exports);
|
|
27
26
|
_export_star(require("./UsageMetricsProvider"), exports);
|
|
@@ -38,11 +38,11 @@ _export(exports, {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const _reactquery = require("@tanstack/react-query");
|
|
41
|
-
const _variables = require("./variables");
|
|
42
41
|
const _TimeRangeProvider = require("./TimeRangeProvider");
|
|
43
42
|
const _datasources = require("./datasources");
|
|
44
43
|
const _pluginregistry = require("./plugin-registry");
|
|
45
44
|
const _utils = require("./utils");
|
|
45
|
+
const _variables = require("./variables");
|
|
46
46
|
const TIME_SERIES_QUERY_KEY = 'TimeSeriesQuery';
|
|
47
47
|
function getQueryOptions({ plugin, definition, context }) {
|
|
48
48
|
const { timeRange, datasourceStore, suggestedStepMs, mode, variableState, refreshKey } = context;
|
|
@@ -21,9 +21,6 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
MOCK_PROFILE_DATA: function() {
|
|
25
|
-
return MOCK_PROFILE_DATA;
|
|
26
|
-
},
|
|
27
24
|
MOCK_TIME_SERIES_DATA: function() {
|
|
28
25
|
return MOCK_TIME_SERIES_DATA;
|
|
29
26
|
},
|
|
@@ -102,23 +99,3 @@ const MOCK_TRACE_DATA = {
|
|
|
102
99
|
executedQueryString: '{ duration > 1000ms }'
|
|
103
100
|
}
|
|
104
101
|
};
|
|
105
|
-
const MOCK_PROFILE_DATA = {
|
|
106
|
-
profile: {
|
|
107
|
-
stackTrace: {
|
|
108
|
-
id: 0,
|
|
109
|
-
name: 'root',
|
|
110
|
-
level: 0,
|
|
111
|
-
start: 1699916103945861,
|
|
112
|
-
end: 1699916105065861,
|
|
113
|
-
total: 1000,
|
|
114
|
-
self: 500,
|
|
115
|
-
children: []
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
metadata: {
|
|
119
|
-
spyName: '',
|
|
120
|
-
sampleRate: 1000000000,
|
|
121
|
-
units: 'samples',
|
|
122
|
-
name: 'cpu'
|
|
123
|
-
}
|
|
124
|
-
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -14,3 +14,18 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
Object.defineProperty(exports, "renderHookWithContext", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return renderHookWithContext;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _react = require("@testing-library/react");
|
|
24
|
+
const _utils = require("./utils");
|
|
25
|
+
function renderHookWithContext(callback, contextOptions, renderHookOptions) {
|
|
26
|
+
const wrapper = (0, _utils.getTestContextWrapper)(contextOptions);
|
|
27
|
+
return (0, _react.renderHook)(callback, {
|
|
28
|
+
wrapper,
|
|
29
|
+
...renderHookOptions
|
|
30
|
+
});
|
|
31
|
+
}
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -22,27 +22,10 @@ Object.defineProperty(exports, "renderWithContext", {
|
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _react = require("@testing-library/react");
|
|
25
|
-
const
|
|
26
|
-
const _PluginRegistry = require("../components/PluginRegistry");
|
|
27
|
-
const _testplugins = require("./test-plugins");
|
|
25
|
+
const _utils = require("./utils");
|
|
28
26
|
function renderWithContext(ui, renderOptions, contextOptions) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
queries: {
|
|
33
|
-
refetchOnWindowFocus: false,
|
|
34
|
-
retry: false
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return (0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
|
|
39
|
-
client: queryClient,
|
|
40
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginRegistry.PluginRegistry, {
|
|
41
|
-
pluginLoader: _testplugins.testPluginLoader,
|
|
42
|
-
defaultPluginKinds: contextOptions?.defaultPluginKinds ?? {
|
|
43
|
-
TimeSeriesQuery: 'PrometheusTimeSeriesQuery'
|
|
44
|
-
},
|
|
45
|
-
children: ui
|
|
46
|
-
})
|
|
27
|
+
const Wrapper = (0, _utils.getTestContextWrapper)(contextOptions);
|
|
28
|
+
return (0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(Wrapper, {
|
|
29
|
+
children: ui
|
|
47
30
|
}), renderOptions);
|
|
48
31
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "getTestContextWrapper", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return getTestContextWrapper;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _reactquery = require("@tanstack/react-query");
|
|
25
|
+
const _components = require("../components");
|
|
26
|
+
const _testplugins = require("./test-plugins");
|
|
27
|
+
function getTestContextWrapper(contextOptions) {
|
|
28
|
+
// Create a new QueryClient for each test to avoid caching issues
|
|
29
|
+
const queryClient = new _reactquery.QueryClient({
|
|
30
|
+
defaultOptions: {
|
|
31
|
+
queries: {
|
|
32
|
+
refetchOnWindowFocus: false,
|
|
33
|
+
retry: false
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return function Wrapper({ children }) {
|
|
38
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
|
|
39
|
+
client: queryClient,
|
|
40
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.PluginRegistry, {
|
|
41
|
+
pluginLoader: _testplugins.testPluginLoader,
|
|
42
|
+
defaultPluginKinds: contextOptions?.defaultPluginKinds ?? {
|
|
43
|
+
TimeSeriesQuery: 'PrometheusTimeSeriesQuery'
|
|
44
|
+
},
|
|
45
|
+
children: children
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -28,7 +28,7 @@ function useDefaultQueryDefinition(queryTypes) {
|
|
|
28
28
|
const { defaultPluginKinds } = usePluginRegistry();
|
|
29
29
|
const defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';
|
|
30
30
|
const { data: defaultQueryPlugin } = usePlugin(defaultQueryType, defaultQueryKind, {
|
|
31
|
-
|
|
31
|
+
useErrorBoundary: true,
|
|
32
32
|
enabled: true
|
|
33
33
|
});
|
|
34
34
|
// This default query definition is used if no query is provided initially or when we add a new query
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState } from 'react';\nimport { produce } from 'immer';\nimport { Button, Stack } from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { QueryDefinition, QueryPluginType } from '@perses-dev/core';\nimport { useListPluginMetadata, usePlugin, usePluginRegistry } from '../../runtime';\nimport { QueryEditorContainer } from './QueryEditorContainer';\n\nexport interface MultiQueryEditorProps {\n queryTypes: QueryPluginType[];\n queries?: QueryDefinition[];\n onChange: (queries: QueryDefinition[]) => void;\n}\n\nfunction useDefaultQueryDefinition(queryTypes: QueryPluginType[]): {\n defaultInitialQueryDefinition: QueryDefinition;\n isLoading: boolean;\n} {\n // Build the default query plugin\n // This will be used only if the queries are empty, to open a starting query\n\n // Firs the default query type\n const defaultQueryType = queryTypes[0]!;\n\n // Then the default plugin kind\n // Use as default the plugin kind explicitly set as default or the first in the list\n const { data: queryPlugins, isLoading } = useListPluginMetadata(queryTypes);\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';\n\n const { data: defaultQueryPlugin } = usePlugin(defaultQueryType, defaultQueryKind, {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState } from 'react';\nimport { produce } from 'immer';\nimport { Button, Stack } from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { QueryDefinition, QueryPluginType } from '@perses-dev/core';\nimport { useListPluginMetadata, usePlugin, usePluginRegistry } from '../../runtime';\nimport { QueryEditorContainer } from './QueryEditorContainer';\n\nexport interface MultiQueryEditorProps {\n queryTypes: QueryPluginType[];\n queries?: QueryDefinition[];\n onChange: (queries: QueryDefinition[]) => void;\n}\n\nfunction useDefaultQueryDefinition(queryTypes: QueryPluginType[]): {\n defaultInitialQueryDefinition: QueryDefinition;\n isLoading: boolean;\n} {\n // Build the default query plugin\n // This will be used only if the queries are empty, to open a starting query\n\n // Firs the default query type\n const defaultQueryType = queryTypes[0]!;\n\n // Then the default plugin kind\n // Use as default the plugin kind explicitly set as default or the first in the list\n const { data: queryPlugins, isLoading } = useListPluginMetadata(queryTypes);\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';\n\n const { data: defaultQueryPlugin } = usePlugin(defaultQueryType, defaultQueryKind, {\n useErrorBoundary: true,\n enabled: true,\n });\n\n // This default query definition is used if no query is provided initially or when we add a new query\n return {\n defaultInitialQueryDefinition: {\n kind: defaultQueryType,\n spec: {\n plugin: { kind: defaultQueryKind, spec: defaultQueryPlugin?.createInitialOptions() || {} },\n },\n },\n isLoading,\n };\n}\n\n/**\n * A component render a list of {@link QueryEditorContainer} for the given query definitions.\n * It allows adding, removing and editing queries.\n * @param queryTypes The list of query types that the underlying editor will propose\n * @param queries The list of query definitions to render\n * @param onChange The callback to call when the queries are modified\n * @constructor\n */\nexport function MultiQueryEditor({ queryTypes, queries = [], onChange }: MultiQueryEditorProps): ReactElement {\n const { defaultInitialQueryDefinition, isLoading } = useDefaultQueryDefinition(queryTypes);\n\n // State for which queries are collapsed\n const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(() => false));\n\n // Query handlers\n const handleQueryChange = (index: number, queryDef: QueryDefinition): void => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft[index] = queryDef;\n } else {\n draft = [queryDef];\n }\n })\n );\n };\n\n const handleQueryAdd = (): void => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft.push(defaultInitialQueryDefinition);\n } else {\n draft = [...queries, defaultInitialQueryDefinition];\n }\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.push(false);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryDelete = (index: number): void => {\n onChange(\n produce(queries, (draft) => {\n draft.splice(index, 1);\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.splice(index, 1);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryCollapseExpand = (index: number): void => {\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed[index] = !queriesCollapsed[index];\n return [...queriesCollapsed];\n });\n };\n\n // show one query input if queries is empty\n const queryDefinitions: QueryDefinition[] = queries.length\n ? queries\n : !isLoading\n ? [defaultInitialQueryDefinition]\n : [];\n\n return (\n <>\n <Stack spacing={1}>\n {queryDefinitions.map((query: QueryDefinition, i: number) => (\n <QueryEditorContainer\n queryTypes={queryTypes}\n key={i}\n index={i}\n query={query}\n isCollapsed={!!queriesCollapsed[i]}\n onChange={handleQueryChange}\n onDelete={queries.length > 1 ? handleQueryDelete : undefined}\n onCollapseExpand={handleQueryCollapseExpand}\n />\n ))}\n </Stack>\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleQueryAdd}>\n Add Query\n </Button>\n </>\n );\n}\n"],"names":["useState","produce","Button","Stack","AddIcon","useListPluginMetadata","usePlugin","usePluginRegistry","QueryEditorContainer","useDefaultQueryDefinition","queryTypes","defaultQueryType","data","queryPlugins","isLoading","defaultPluginKinds","defaultQueryKind","spec","name","defaultQueryPlugin","useErrorBoundary","enabled","defaultInitialQueryDefinition","kind","plugin","createInitialOptions","MultiQueryEditor","queries","onChange","queriesCollapsed","setQueriesCollapsed","map","handleQueryChange","index","queryDef","draft","handleQueryAdd","push","handleQueryDelete","splice","handleQueryCollapseExpand","queryDefinitions","length","spacing","query","i","isCollapsed","onDelete","undefined","onCollapseExpand","variant","startIcon","sx","marginTop","onClick"],"mappings":"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"}
|
|
@@ -19,14 +19,14 @@ import { MultiQueryEditor } from '../MultiQueryEditor';
|
|
|
19
19
|
export function PanelSpecEditor(props) {
|
|
20
20
|
const { control, panelDefinition, onJSONChange, onQueriesChange, onPluginSpecChange } = props;
|
|
21
21
|
const { kind } = panelDefinition.spec.plugin;
|
|
22
|
-
const { data: plugin,
|
|
22
|
+
const { data: plugin, isLoading, error } = usePlugin('Panel', kind);
|
|
23
23
|
if (error) {
|
|
24
24
|
return /*#__PURE__*/ _jsx(ErrorAlert, {
|
|
25
25
|
error: error
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
// TODO: Proper loading indicator
|
|
29
|
-
if (
|
|
29
|
+
if (isLoading) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
if (plugin === undefined) {
|