@perses-dev/dashboards 0.50.0 → 0.51.0-beta.0
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/Dashboard/Dashboard.js +1 -3
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +3 -3
- package/dist/cjs/components/Datasources/DatasourceEditor.js +2 -5
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +2 -0
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -3
- package/dist/cjs/components/DownloadButton/DownloadButton.js +135 -29
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +5 -7
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/cjs/components/GridLayout/GridItemContent.js +4 -3
- package/dist/cjs/components/GridLayout/GridLayout.js +5 -6
- package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
- package/dist/cjs/components/Panel/HeaderIconButton.js +27 -0
- package/dist/cjs/components/Panel/Panel.js +16 -10
- package/dist/cjs/components/Panel/PanelActions.js +365 -0
- package/dist/cjs/components/Panel/PanelContent.js +59 -13
- package/dist/cjs/components/Panel/PanelHeader.js +14 -141
- package/dist/cjs/components/Panel/PanelLinks.js +5 -6
- package/dist/cjs/components/Panel/PanelPluginLoader.js +56 -0
- package/dist/cjs/components/Panel/index.js +1 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +17 -35
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +4 -5
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -4
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +5 -12
- package/dist/cjs/components/Variables/Variable.js +36 -41
- package/dist/cjs/components/Variables/VariableEditor.js +14 -23
- package/dist/cjs/components/Variables/VariableList.js +4 -6
- package/dist/cjs/constants/styles.js +12 -0
- package/dist/cjs/constants/user-interface-text.js +1 -1
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +5 -6
- package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +1 -1
- package/dist/cjs/context/DashboardProvider/common.js +2 -2
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +13 -3
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +3 -6
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +3 -4
- package/dist/cjs/context/DashboardProvider/view-panel-slice.js +1 -2
- package/dist/cjs/context/DatasourceStoreProvider.js +15 -22
- package/dist/cjs/context/VariableProvider/VariableProvider.js +8 -11
- package/dist/cjs/context/VariableProvider/hydrationUtils.js +3 -6
- package/dist/cjs/context/VariableProvider/utils.js +2 -2
- package/dist/cjs/stories/decorators/WithDashboard.js +1 -1
- package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/cjs/stories/decorators/WithVariables.js +1 -1
- package/dist/cjs/test/plugin-registry.js +8 -3
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +4 -3
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -5
- package/dist/components/Dashboard/Dashboard.js +1 -3
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +3 -3
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +2 -5
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +3 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -4
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +1 -5
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +94 -29
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +5 -7
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +5 -4
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +6 -7
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +3 -3
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
- package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
- package/dist/components/Panel/HeaderIconButton.js +19 -0
- package/dist/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +7 -2
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +22 -11
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +22 -0
- package/dist/components/Panel/PanelActions.d.ts.map +1 -0
- package/dist/components/Panel/PanelActions.js +352 -0
- package/dist/components/Panel/PanelActions.js.map +1 -0
- package/dist/components/Panel/PanelContent.d.ts +5 -4
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +61 -15
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +7 -11
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +18 -140
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/PanelLinks.js +5 -6
- package/dist/components/Panel/PanelLinks.js.map +1 -1
- package/dist/components/Panel/PanelPluginLoader.d.ts +13 -0
- package/dist/components/Panel/PanelPluginLoader.d.ts.map +1 -0
- package/dist/components/Panel/PanelPluginLoader.js +51 -0
- package/dist/components/Panel/PanelPluginLoader.js.map +1 -0
- package/dist/components/Panel/index.d.ts +1 -0
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +1 -0
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +17 -35
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +4 -5
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -4
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +5 -12
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/Variable.d.ts +2 -2
- package/dist/components/Variables/Variable.d.ts.map +1 -1
- package/dist/components/Variables/Variable.js +36 -41
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.js +14 -23
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.js +4 -6
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/constants/styles.d.ts +3 -0
- package/dist/constants/styles.d.ts.map +1 -1
- package/dist/constants/styles.js +3 -0
- package/dist/constants/styles.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +1 -1
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +1 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +5 -6
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -1
- package/dist/context/DashboardProvider/common.js +2 -2
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +11 -2
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +13 -4
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +3 -6
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +3 -4
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.js +1 -2
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +15 -22
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.js +8 -11
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
- package/dist/context/VariableProvider/hydrationUtils.js +3 -6
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/VariableProvider/utils.js +2 -2
- package/dist/context/VariableProvider/utils.js.map +1 -1
- package/dist/stories/decorators/WithDashboard.js +1 -1
- package/dist/stories/decorators/WithDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
- package/dist/stories/decorators/WithVariables.js +1 -1
- package/dist/stories/decorators/WithVariables.js.map +1 -1
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +8 -3
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +9 -7
- package/dist/test/render.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +4 -3
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +5 -5
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +8 -7
|
@@ -87,10 +87,10 @@ function PanelLinks({ links }) {
|
|
|
87
87
|
function LinkButton({ link }) {
|
|
88
88
|
const { url, name, tooltip, targetBlank } = useLink(link);
|
|
89
89
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
90
|
-
description: tooltip
|
|
90
|
+
description: tooltip ?? url,
|
|
91
91
|
enterDelay: 100,
|
|
92
92
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
93
|
-
"aria-label": name
|
|
93
|
+
"aria-label": name ?? url,
|
|
94
94
|
size: "small",
|
|
95
95
|
href: url,
|
|
96
96
|
target: targetBlank ? '_blank' : '_self',
|
|
@@ -110,19 +110,18 @@ function LinkButton({ link }) {
|
|
|
110
110
|
function LinkMenuItem({ link }) {
|
|
111
111
|
const { url, name, tooltip, targetBlank } = useLink(link);
|
|
112
112
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
113
|
-
description: tooltip
|
|
113
|
+
description: tooltip ?? url,
|
|
114
114
|
enterDelay: 100,
|
|
115
115
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
116
116
|
component: _material.Link,
|
|
117
117
|
href: url,
|
|
118
118
|
target: targetBlank ? '_blank' : '_self',
|
|
119
|
-
children: name
|
|
119
|
+
children: name ?? url
|
|
120
120
|
})
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
function useLink(link) {
|
|
124
|
-
|
|
125
|
-
const url = (_useReplaceVariablesInString = (0, _pluginsystem.useReplaceVariablesInString)(link.url)) !== null && _useReplaceVariablesInString !== void 0 ? _useReplaceVariablesInString : link.url;
|
|
124
|
+
const url = (0, _pluginsystem.useReplaceVariablesInString)(link.url) ?? link.url;
|
|
126
125
|
const name = (0, _pluginsystem.useReplaceVariablesInString)(link.name);
|
|
127
126
|
const tooltip = (0, _pluginsystem.useReplaceVariablesInString)(link.tooltip);
|
|
128
127
|
if (link.renderVariables === false) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright 2025 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, "PanelPluginLoader", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return PanelPluginLoader;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
|
+
const _material = require("@mui/material");
|
|
26
|
+
function PanelPluginLoader(props) {
|
|
27
|
+
const { kind, spec, contentDimensions, definition, queryResults } = props;
|
|
28
|
+
const { data: plugin, isLoading: isPanelLoading } = (0, _pluginsystem.usePlugin)('Panel', kind, {
|
|
29
|
+
throwOnError: true
|
|
30
|
+
});
|
|
31
|
+
const PanelComponent = plugin?.PanelComponent;
|
|
32
|
+
const supportedQueryTypes = plugin?.supportedQueryTypes || [];
|
|
33
|
+
// Show fullsize skeleton if the panel plugin is loading.
|
|
34
|
+
if (isPanelLoading) {
|
|
35
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Skeleton, {
|
|
36
|
+
variant: "rectangular",
|
|
37
|
+
width: contentDimensions?.width,
|
|
38
|
+
height: contentDimensions?.height,
|
|
39
|
+
"aria-label": "Loading..."
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (PanelComponent === undefined) {
|
|
43
|
+
throw new Error(`Missing PanelComponent from panel plugin for kind '${kind}'`);
|
|
44
|
+
}
|
|
45
|
+
for (const queryResult of queryResults){
|
|
46
|
+
if (!supportedQueryTypes.includes(queryResult.definition.kind)) {
|
|
47
|
+
throw new Error(`This panel does not support queries of type '${queryResult.definition.kind}'. Supported query types: ${supportedQueryTypes.join(', ')}.`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(PanelComponent, {
|
|
51
|
+
spec: spec,
|
|
52
|
+
contentDimensions: contentDimensions,
|
|
53
|
+
definition: definition,
|
|
54
|
+
queryResults: queryResults
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./Panel"), exports);
|
|
18
|
+
_export_star(require("./PanelPluginLoader"), exports);
|
|
18
19
|
function _export_star(from, to) {
|
|
19
20
|
Object.keys(from).forEach(function(k) {
|
|
20
21
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -44,7 +44,7 @@ const PanelDrawer = ()=>{
|
|
|
44
44
|
};
|
|
45
45
|
// Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state
|
|
46
46
|
const handleExited = ()=>{
|
|
47
|
-
panelEditor
|
|
47
|
+
panelEditor?.close();
|
|
48
48
|
setIsClosing(false);
|
|
49
49
|
};
|
|
50
50
|
// Disables closing on click out. This is a quick-win solution to avoid losing draft changes.
|
|
@@ -58,11 +58,14 @@ const PanelDrawer = ()=>{
|
|
|
58
58
|
onExited: handleExited
|
|
59
59
|
},
|
|
60
60
|
"data-testid": "panel-editor",
|
|
61
|
-
children: panelEditor && /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
children: panelEditor && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
62
|
+
FallbackComponent: _components.ErrorAlert,
|
|
63
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelEditorForm.PanelEditorForm, {
|
|
64
|
+
initialAction: panelEditor.mode,
|
|
65
|
+
initialValues: panelEditor.initialValues,
|
|
66
|
+
onSave: handleSave,
|
|
67
|
+
onClose: handleClose
|
|
68
|
+
})
|
|
66
69
|
})
|
|
67
70
|
});
|
|
68
71
|
};
|
|
@@ -167,23 +167,19 @@ function PanelEditorForm(props) {
|
|
|
167
167
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
168
168
|
control: form.control,
|
|
169
169
|
name: "panelDefinition.spec.display.name",
|
|
170
|
-
render: ({ field, fieldState })
|
|
171
|
-
var _fieldState_error;
|
|
172
|
-
var _field_value;
|
|
173
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
170
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
174
171
|
...field,
|
|
175
172
|
required: true,
|
|
176
173
|
fullWidth: true,
|
|
177
174
|
label: "Name",
|
|
178
175
|
error: !!fieldState.error,
|
|
179
|
-
helperText:
|
|
180
|
-
value:
|
|
176
|
+
helperText: fieldState.error?.message,
|
|
177
|
+
value: field.value ?? '',
|
|
181
178
|
onChange: (event)=>{
|
|
182
179
|
field.onChange(event);
|
|
183
180
|
setName(event.target.value);
|
|
184
181
|
}
|
|
185
|
-
})
|
|
186
|
-
}
|
|
182
|
+
})
|
|
187
183
|
})
|
|
188
184
|
}),
|
|
189
185
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
@@ -192,28 +188,22 @@ function PanelEditorForm(props) {
|
|
|
192
188
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
193
189
|
control: form.control,
|
|
194
190
|
name: "groupId",
|
|
195
|
-
render: ({ field, fieldState })
|
|
196
|
-
var _fieldState_error;
|
|
197
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
191
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
198
192
|
select: true,
|
|
199
193
|
...field,
|
|
200
194
|
required: true,
|
|
201
195
|
fullWidth: true,
|
|
202
196
|
label: "Group",
|
|
203
197
|
error: !!fieldState.error,
|
|
204
|
-
helperText:
|
|
198
|
+
helperText: fieldState.error?.message,
|
|
205
199
|
onChange: (event)=>{
|
|
206
200
|
field.onChange(event);
|
|
207
201
|
},
|
|
208
|
-
children: panelGroups.map((panelGroup, index)
|
|
209
|
-
var _panelGroup_title;
|
|
210
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
202
|
+
children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
211
203
|
value: panelGroup.id,
|
|
212
|
-
children:
|
|
213
|
-
}, panelGroup.id)
|
|
214
|
-
|
|
215
|
-
});
|
|
216
|
-
}
|
|
204
|
+
children: panelGroup.title ?? `Group ${index + 1}`
|
|
205
|
+
}, panelGroup.id))
|
|
206
|
+
})
|
|
217
207
|
})
|
|
218
208
|
}),
|
|
219
209
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
@@ -222,22 +212,18 @@ function PanelEditorForm(props) {
|
|
|
222
212
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
223
213
|
control: form.control,
|
|
224
214
|
name: "panelDefinition.spec.display.description",
|
|
225
|
-
render: ({ field, fieldState })
|
|
226
|
-
var _fieldState_error;
|
|
227
|
-
var _field_value;
|
|
228
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
215
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
229
216
|
...field,
|
|
230
217
|
fullWidth: true,
|
|
231
218
|
label: "Description",
|
|
232
219
|
error: !!fieldState.error,
|
|
233
|
-
helperText:
|
|
234
|
-
value:
|
|
220
|
+
helperText: fieldState.error?.message,
|
|
221
|
+
value: field.value ?? '',
|
|
235
222
|
onChange: (event)=>{
|
|
236
223
|
field.onChange(event);
|
|
237
224
|
setDescription(event.target.value);
|
|
238
225
|
}
|
|
239
|
-
})
|
|
240
|
-
}
|
|
226
|
+
})
|
|
241
227
|
})
|
|
242
228
|
}),
|
|
243
229
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
@@ -246,10 +232,7 @@ function PanelEditorForm(props) {
|
|
|
246
232
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
247
233
|
control: form.control,
|
|
248
234
|
name: "panelDefinition.spec.plugin.kind",
|
|
249
|
-
render: ({ field, fieldState })
|
|
250
|
-
var _pluginEditor_error, _fieldState_error;
|
|
251
|
-
var _pluginEditor_error_message;
|
|
252
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginKindSelect, {
|
|
235
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginKindSelect, {
|
|
253
236
|
...field,
|
|
254
237
|
pluginTypes: [
|
|
255
238
|
'Panel'
|
|
@@ -259,7 +242,7 @@ function PanelEditorForm(props) {
|
|
|
259
242
|
label: "Type",
|
|
260
243
|
disabled: pluginEditor.isLoading,
|
|
261
244
|
error: !!pluginEditor.error || !!fieldState.error,
|
|
262
|
-
helperText:
|
|
245
|
+
helperText: pluginEditor.error?.message ?? fieldState.error?.message,
|
|
263
246
|
value: {
|
|
264
247
|
type: 'Panel',
|
|
265
248
|
kind: field.value
|
|
@@ -268,8 +251,7 @@ function PanelEditorForm(props) {
|
|
|
268
251
|
field.onChange(event.kind);
|
|
269
252
|
pluginEditor.onSelectionChange(event);
|
|
270
253
|
}
|
|
271
|
-
})
|
|
272
|
-
}
|
|
254
|
+
})
|
|
273
255
|
})
|
|
274
256
|
}),
|
|
275
257
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
|
|
@@ -34,15 +34,14 @@ function PanelPreview({ panelDefinition }) {
|
|
|
34
34
|
width = boxRef.current.getBoundingClientRect().width;
|
|
35
35
|
}
|
|
36
36
|
const suggestedStepMs = (0, _pluginsystem.useSuggestedStepMs)(width);
|
|
37
|
-
const { data: plugin,
|
|
38
|
-
if (
|
|
37
|
+
const { data: plugin, isPending } = (0, _pluginsystem.usePlugin)('Panel', panelDefinition.spec.plugin.kind);
|
|
38
|
+
if (isPending) {
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
41
|
if (panelDefinition.spec.plugin.kind === '') {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
const queries = (_panelDefinition_spec_queries = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries !== void 0 ? _panelDefinition_spec_queries : [];
|
|
44
|
+
const queries = panelDefinition.spec.queries ?? [];
|
|
46
45
|
// map TimeSeriesQueryDefinition to Definition<UnknownSpec>
|
|
47
46
|
const definitions = queries.length ? queries.map((query)=>{
|
|
48
47
|
return {
|
|
@@ -57,7 +56,7 @@ function PanelPreview({ panelDefinition }) {
|
|
|
57
56
|
definitions: definitions,
|
|
58
57
|
options: {
|
|
59
58
|
suggestedStepMs,
|
|
60
|
-
...plugin
|
|
59
|
+
...plugin?.queryOptions
|
|
61
60
|
},
|
|
62
61
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Panel.Panel, {
|
|
63
62
|
definition: panelDefinition
|
|
@@ -38,7 +38,7 @@ function PanelGroupDialog() {
|
|
|
38
38
|
const handleClose = ()=>setIsClosing(true);
|
|
39
39
|
// Don't call close on the store until the Dialog has completely transitioned out
|
|
40
40
|
const handleExited = ()=>{
|
|
41
|
-
panelGroupEditor
|
|
41
|
+
panelGroupEditor?.close();
|
|
42
42
|
setIsClosing(false);
|
|
43
43
|
};
|
|
44
44
|
// Dialog is open if we have a model and we're not transitioning out
|
|
@@ -34,7 +34,7 @@ function QuerySummaryTable(props) {
|
|
|
34
34
|
// for displaying a summary of recent query results
|
|
35
35
|
const queryClient = (0, _reactquery.useQueryClient)();
|
|
36
36
|
const queries = queryClient.getQueryCache().findAll();
|
|
37
|
-
const activeQueries = queries.filter((query)=>query.state.status === '
|
|
37
|
+
const activeQueries = queries.filter((query)=>query.state.status === 'pending');
|
|
38
38
|
const completedQueries = queries.filter((query)=>query.state.status === 'success');
|
|
39
39
|
const querySummary = (0, _pluginsystem.useActiveTimeSeriesQueries)();
|
|
40
40
|
if (datasourceClient.isLoading === true) {
|
|
@@ -42,12 +42,10 @@ function QuerySummaryTable(props) {
|
|
|
42
42
|
}
|
|
43
43
|
const warnings = [];
|
|
44
44
|
querySummary.forEach((query)=>{
|
|
45
|
-
var _queryData_metadata;
|
|
46
45
|
const queryData = query.state.data;
|
|
47
|
-
if (queryData &&
|
|
48
|
-
var _queryData_metadata_notices_;
|
|
46
|
+
if (queryData && queryData.metadata?.notices) {
|
|
49
47
|
const queryKey = query.queryKey;
|
|
50
|
-
const warningMessage =
|
|
48
|
+
const warningMessage = queryData.metadata.notices[0]?.message;
|
|
51
49
|
if (warningMessage) {
|
|
52
50
|
warnings.push({
|
|
53
51
|
query: String(queryKey[0].spec.plugin.spec.query),
|
|
@@ -29,10 +29,8 @@ const _components = require("@perses-dev/components");
|
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const SaveChangesConfirmationDialog = ()=>{
|
|
31
31
|
const { saveChangesConfirmationDialog: dialog } = (0, _context.useSaveChangesConfirmationDialog)();
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
var _dialog_isSavedVariableModified;
|
|
35
|
-
const isSavedVariableModified = (_dialog_isSavedVariableModified = dialog === null || dialog === void 0 ? void 0 : dialog.isSavedVariableModified) !== null && _dialog_isSavedVariableModified !== void 0 ? _dialog_isSavedVariableModified : true;
|
|
32
|
+
const isSavedDurationModified = dialog?.isSavedDurationModified ?? true;
|
|
33
|
+
const isSavedVariableModified = dialog?.isSavedVariableModified ?? true;
|
|
36
34
|
const [saveDefaultTimeRange, setSaveDefaultTimeRange] = (0, _react.useState)(isSavedDurationModified);
|
|
37
35
|
const [saveDefaultVariables, setSaveDefaultVariables] = (0, _react.useState)(isSavedVariableModified);
|
|
38
36
|
const { getSavedVariablesStatus } = (0, _context.useVariableDefinitionActions)();
|
|
@@ -59,9 +59,7 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
59
59
|
builtinVariablesBySource
|
|
60
60
|
]);
|
|
61
61
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
62
|
-
children: sources.map((source)
|
|
63
|
-
var _builtinVariablesBySource_source;
|
|
64
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Accordion, {
|
|
62
|
+
children: sources.map((source)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Accordion, {
|
|
65
63
|
sx: (theme)=>({
|
|
66
64
|
'.MuiAccordionSummary-root': {
|
|
67
65
|
backgroundColor: theme.palette.background.lighter
|
|
@@ -110,10 +108,7 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
110
108
|
})
|
|
111
109
|
}),
|
|
112
110
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
113
|
-
children: (
|
|
114
|
-
var _v_spec_display;
|
|
115
|
-
var _v_spec_display_description;
|
|
116
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
111
|
+
children: (builtinVariablesBySource[source] ?? []).map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
117
112
|
children: [
|
|
118
113
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
|
|
119
114
|
component: "th",
|
|
@@ -124,18 +119,16 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
124
119
|
children: v.spec.name
|
|
125
120
|
}),
|
|
126
121
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
|
|
127
|
-
children:
|
|
122
|
+
children: v.spec.display?.description ?? ''
|
|
128
123
|
})
|
|
129
124
|
]
|
|
130
|
-
}, source + '-' + v.spec.name)
|
|
131
|
-
})
|
|
125
|
+
}, source + '-' + v.spec.name))
|
|
132
126
|
})
|
|
133
127
|
]
|
|
134
128
|
})
|
|
135
129
|
})
|
|
136
130
|
})
|
|
137
131
|
]
|
|
138
|
-
}, source)
|
|
139
|
-
})
|
|
132
|
+
}, source))
|
|
140
133
|
});
|
|
141
134
|
}
|
|
@@ -47,9 +47,8 @@ function variableOptionToVariableValue(options) {
|
|
|
47
47
|
return options.value;
|
|
48
48
|
}
|
|
49
49
|
function Variable({ name, source }) {
|
|
50
|
-
var _ctx_definition;
|
|
51
50
|
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
52
|
-
const kind =
|
|
51
|
+
const kind = ctx.definition?.kind;
|
|
53
52
|
switch(kind){
|
|
54
53
|
case 'TextVariable':
|
|
55
54
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(TextVariable, {
|
|
@@ -70,22 +69,16 @@ function Variable({ name, source }) {
|
|
|
70
69
|
});
|
|
71
70
|
}
|
|
72
71
|
function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
73
|
-
const allowMultiple =
|
|
74
|
-
const allowAllValue =
|
|
75
|
-
const sort = spec
|
|
76
|
-
const loading = (0, _react.useMemo)(()=>
|
|
77
|
-
var _variablesOptionsQuery_isFetching;
|
|
78
|
-
return (_variablesOptionsQuery_isFetching = variablesOptionsQuery.isFetching) !== null && _variablesOptionsQuery_isFetching !== void 0 ? _variablesOptionsQuery_isFetching : false;
|
|
79
|
-
}, [
|
|
72
|
+
const allowMultiple = spec?.allowMultiple === true;
|
|
73
|
+
const allowAllValue = spec?.allowAllValue === true;
|
|
74
|
+
const sort = spec?.sort;
|
|
75
|
+
const loading = (0, _react.useMemo)(()=>variablesOptionsQuery.isFetching ?? false, [
|
|
80
76
|
variablesOptionsQuery.isFetching
|
|
81
77
|
]);
|
|
82
|
-
const options = (0, _react.useMemo)(()=>
|
|
83
|
-
var _variablesOptionsQuery_data;
|
|
84
|
-
return (_variablesOptionsQuery_data = variablesOptionsQuery.data) !== null && _variablesOptionsQuery_data !== void 0 ? _variablesOptionsQuery_data : [];
|
|
85
|
-
}, [
|
|
78
|
+
const options = (0, _react.useMemo)(()=>variablesOptionsQuery.data ?? [], [
|
|
86
79
|
variablesOptionsQuery.data
|
|
87
80
|
]);
|
|
88
|
-
let value = state
|
|
81
|
+
let value = state?.value;
|
|
89
82
|
// Make sure value is an array if allowMultiple is true
|
|
90
83
|
if (allowMultiple && !Array.isArray(value)) {
|
|
91
84
|
value = typeof value === 'string' ? [
|
|
@@ -146,8 +139,7 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
146
139
|
allowMultiple
|
|
147
140
|
]);
|
|
148
141
|
value = (0, _react.useMemo)(()=>{
|
|
149
|
-
|
|
150
|
-
const firstOptionValue = viewOptions === null || viewOptions === void 0 ? void 0 : (_viewOptions_ = viewOptions[allowAllValue ? 1 : 0]) === null || _viewOptions_ === void 0 ? void 0 : _viewOptions_.value;
|
|
142
|
+
const firstOptionValue = viewOptions?.[allowAllValue ? 1 : 0]?.value;
|
|
151
143
|
// If there is no value but there are options, or the value is not in options, we set the value to the first option.
|
|
152
144
|
if (firstOptionValue) {
|
|
153
145
|
if (!valueIsInOptions || !value || value.length === 0) {
|
|
@@ -169,13 +161,12 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
169
161
|
// an array, hence this conditional
|
|
170
162
|
if (Array.isArray(value)) {
|
|
171
163
|
return viewOptions.filter((o)=>{
|
|
172
|
-
return value
|
|
164
|
+
return value?.includes(o.value);
|
|
173
165
|
});
|
|
174
166
|
} else {
|
|
175
|
-
|
|
176
|
-
return (_viewOptions_find = viewOptions.find((o)=>{
|
|
167
|
+
return viewOptions.find((o)=>{
|
|
177
168
|
return value === o.value;
|
|
178
|
-
})
|
|
169
|
+
}) ?? {
|
|
179
170
|
value: '',
|
|
180
171
|
label: ''
|
|
181
172
|
};
|
|
@@ -212,18 +203,17 @@ const getWidthPx = (inputValue, kind)=>{
|
|
|
212
203
|
}
|
|
213
204
|
};
|
|
214
205
|
function ListVariable({ name, source }) {
|
|
215
|
-
var _definition_spec_display;
|
|
216
206
|
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
217
207
|
const definition = ctx.definition;
|
|
218
208
|
const variablesOptionsQuery = (0, _pluginsystem.useListVariablePluginValues)(definition);
|
|
219
209
|
const { setVariableValue, setVariableLoading, setVariableOptions } = (0, _context.useVariableDefinitionActions)();
|
|
220
|
-
const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(definition
|
|
221
|
-
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
210
|
+
const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(definition?.spec, ctx.state, variablesOptionsQuery);
|
|
222
211
|
const [inputWidth, setInputWidth] = (0, _react.useState)(_constants.MIN_VARIABLE_WIDTH);
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
const
|
|
212
|
+
// Used for multiple value variables, it will not clear variable input when selecting an option
|
|
213
|
+
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
214
|
+
const title = definition?.spec.display?.name ?? name;
|
|
215
|
+
const allowMultiple = definition?.spec.allowMultiple === true;
|
|
216
|
+
const allowAllValue = definition?.spec.allowAllValue === true;
|
|
227
217
|
// Update value when changed
|
|
228
218
|
(0, _react.useEffect)(()=>{
|
|
229
219
|
if (value) {
|
|
@@ -265,11 +255,14 @@ function ListVariable({ name, source }) {
|
|
|
265
255
|
limitTags: 3,
|
|
266
256
|
size: "small",
|
|
267
257
|
disableClearable: true,
|
|
268
|
-
|
|
258
|
+
slots: {
|
|
259
|
+
popper: StyledPopper
|
|
260
|
+
},
|
|
269
261
|
renderInput: (params)=>{
|
|
270
262
|
return allowMultiple ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
271
263
|
...params,
|
|
272
|
-
label: title
|
|
264
|
+
label: title,
|
|
265
|
+
onChange: (e)=>setInputValue(e.target.value)
|
|
273
266
|
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
274
267
|
...params,
|
|
275
268
|
label: title,
|
|
@@ -294,13 +287,17 @@ function ListVariable({ name, source }) {
|
|
|
294
287
|
setVariableValue(name, variableOptionToVariableValue(value), source);
|
|
295
288
|
}
|
|
296
289
|
},
|
|
297
|
-
inputValue: inputValue,
|
|
290
|
+
inputValue: allowMultiple ? inputValue : undefined,
|
|
298
291
|
onInputChange: (_, newInputValue)=>{
|
|
299
|
-
setInputValue(newInputValue);
|
|
300
292
|
if (!allowMultiple) {
|
|
301
293
|
setInputWidth(getWidthPx(newInputValue, 'list'));
|
|
302
294
|
}
|
|
303
295
|
},
|
|
296
|
+
onBlur: ()=>{
|
|
297
|
+
if (allowMultiple) {
|
|
298
|
+
setInputValue('');
|
|
299
|
+
}
|
|
300
|
+
},
|
|
304
301
|
options: viewOptions
|
|
305
302
|
}),
|
|
306
303
|
loading && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.LinearProgress, {})
|
|
@@ -308,21 +305,17 @@ function ListVariable({ name, source }) {
|
|
|
308
305
|
});
|
|
309
306
|
}
|
|
310
307
|
function TextVariable({ name, source }) {
|
|
311
|
-
var _definition_spec_display;
|
|
312
308
|
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
313
309
|
const state = ctx.state;
|
|
314
310
|
const definition = ctx.definition;
|
|
315
|
-
|
|
316
|
-
const [tempValue, setTempValue] = (0, _react.useState)((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
311
|
+
const [tempValue, setTempValue] = (0, _react.useState)(state?.value ?? '');
|
|
317
312
|
const [inputWidth, setInputWidth] = (0, _react.useState)(getWidthPx(tempValue, 'text'));
|
|
318
313
|
const { setVariableValue } = (0, _context.useVariableDefinitionActions)();
|
|
319
314
|
(0, _react.useEffect)(()=>{
|
|
320
|
-
|
|
321
|
-
setTempValue((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
315
|
+
setTempValue(state?.value ?? '');
|
|
322
316
|
}, [
|
|
323
|
-
state
|
|
317
|
+
state?.value
|
|
324
318
|
]);
|
|
325
|
-
var _definition_spec_display_name, _definition_spec_constant;
|
|
326
319
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
327
320
|
title: tempValue,
|
|
328
321
|
value: tempValue,
|
|
@@ -332,9 +325,11 @@ function TextVariable({ name, source }) {
|
|
|
332
325
|
},
|
|
333
326
|
onBlur: ()=>setVariableValue(name, tempValue, source),
|
|
334
327
|
placeholder: name,
|
|
335
|
-
label:
|
|
336
|
-
|
|
337
|
-
|
|
328
|
+
label: definition?.spec.display?.name ?? name,
|
|
329
|
+
slotProps: {
|
|
330
|
+
input: {
|
|
331
|
+
readOnly: definition?.spec.constant ?? false
|
|
332
|
+
}
|
|
338
333
|
},
|
|
339
334
|
sx: {
|
|
340
335
|
width: `${inputWidth}px`,
|