@perses-dev/dashboards 0.43.0 → 0.44.0-rc0
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/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/cjs/components/AddPanelButton/AddPanelButton.js +2 -2
- package/dist/cjs/components/Dashboard/Dashboard.js +1 -1
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +3 -3
- package/dist/cjs/components/Datasources/DatasourceEditor.js +1 -1
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +3 -3
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +1 -1
- package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/cjs/components/DownloadButton/DownloadButton.js +2 -2
- package/dist/cjs/components/EditButton/EditButton.js +1 -1
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +2 -2
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +7 -7
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +3 -3
- package/dist/cjs/components/GridLayout/GridContainer.js +1 -1
- package/dist/cjs/components/GridLayout/GridItemContent.js +5 -5
- package/dist/cjs/components/GridLayout/GridLayout.js +4 -4
- package/dist/cjs/components/GridLayout/GridTitle.js +5 -5
- package/dist/cjs/components/Panel/Panel.js +3 -2
- package/dist/cjs/components/Panel/PanelContent.js +4 -3
- package/dist/cjs/components/Panel/PanelHeader.js +2 -2
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +18 -15
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +2 -2
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +2 -2
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +7 -7
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +6 -6
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +7 -6
- package/dist/cjs/components/Variables/EditVariablesButton.js +2 -2
- package/dist/cjs/components/Variables/TemplateVariable.js +20 -11
- package/dist/cjs/components/Variables/VariableEditor.js +13 -14
- package/dist/cjs/components/Variables/VariableList.js +1 -1
- package/dist/cjs/constants/styles.js +4 -4
- package/dist/cjs/constants/user-interface-text.js +3 -3
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +10 -10
- package/dist/cjs/context/DashboardProvider/common.js +3 -3
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +40 -40
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +3 -3
- package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +4 -6
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +6 -6
- package/dist/cjs/context/DatasourceStoreProvider.js +8 -8
- package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +81 -77
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +7 -7
- package/dist/cjs/context/TemplateVariableProvider/utils.js +3 -3
- package/dist/cjs/context/useDashboard.js +3 -3
- package/dist/cjs/test/dashboard-provider.js +3 -3
- package/dist/cjs/test/datasource-provider.js +4 -4
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/utils/panelUtils.js +5 -5
- package/dist/cjs/utils/time.js +1 -1
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +5 -5
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +1 -2
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +1 -2
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js +2 -2
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +2 -3
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +1 -2
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -1
- 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.d.ts +1 -2
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +1 -1
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts +1 -2
- package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +3 -3
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +1 -2
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +1 -2
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +1 -2
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +1 -2
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +2 -2
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +1 -2
- package/dist/components/EditButton/EditButton.d.ts.map +1 -1
- package/dist/components/EditButton/EditButton.js +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts +1 -2
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js +2 -2
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +1 -2
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +7 -7
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +3 -3
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
- package/dist/components/GridLayout/GridContainer.js +1 -1
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +1 -2
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +5 -5
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +1 -2
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +4 -4
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +1 -2
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +5 -5
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts +2 -2
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +3 -2
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +3 -3
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +4 -3
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +2 -2
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +2 -2
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +18 -15
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -2
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js +2 -2
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +1 -2
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +1 -2
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +1 -2
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +2 -2
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +1 -2
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +1 -2
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +7 -7
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +1 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +3 -3
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +2 -2
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -3
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +7 -6
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +1 -2
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +2 -2
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/TemplateVariable.d.ts +2 -3
- package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
- package/dist/components/Variables/TemplateVariable.js +20 -11
- package/dist/components/Variables/TemplateVariable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +2 -3
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +13 -14
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +2 -3
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +1 -1
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +7 -7
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +2 -2
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +15 -15
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +3 -3
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +4 -6
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -2
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +2 -2
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +3 -3
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +8 -8
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +6 -6
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +70 -66
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
- package/dist/context/TemplateVariableProvider/utils.js.map +1 -1
- package/dist/context/useDashboard.js +3 -3
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
- package/dist/stories/decorators/WithTemplateVariables.js.map +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/utils/panelUtils.d.ts +1 -1
- package/dist/utils/panelUtils.d.ts.map +1 -1
- package/dist/utils/panelUtils.js +2 -2
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/utils/time.js +1 -1
- package/dist/utils/time.js.map +1 -1
- package/dist/validation/panel.d.ts +1 -1
- package/dist/validation/panel.d.ts.map +1 -1
- package/dist/validation/panel.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +5 -5
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +1 -2
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +3 -3
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +6 -6
|
@@ -30,7 +30,7 @@ function _interop_require_default(obj) {
|
|
|
30
30
|
default: obj
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function BuiltinVariableAccordions({ builtinVariableDefinitions
|
|
33
|
+
function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
34
34
|
const builtinVariablesBySource = (0, _react.useMemo)(()=>{
|
|
35
35
|
const result = {};
|
|
36
36
|
for (const definition of builtinVariableDefinitions){
|
|
@@ -58,10 +58,10 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
58
58
|
}, [
|
|
59
59
|
builtinVariablesBySource
|
|
60
60
|
]);
|
|
61
|
-
var _builtinVariablesBySource_source, _v_spec_display_description;
|
|
62
61
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
63
|
-
children: sources.map((source)
|
|
64
|
-
|
|
62
|
+
children: sources.map((source)=>/*#__PURE__*/ {
|
|
63
|
+
var _builtinVariablesBySource_source;
|
|
64
|
+
return (0, _jsxruntime.jsxs)(_material.Accordion, {
|
|
65
65
|
sx: (theme)=>({
|
|
66
66
|
'.MuiAccordionSummary-root': {
|
|
67
67
|
backgroundColor: theme.palette.background.lighter
|
|
@@ -110,9 +110,10 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
110
110
|
})
|
|
111
111
|
}),
|
|
112
112
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
113
|
-
children: ((_builtinVariablesBySource_source = builtinVariablesBySource[source]) !== null && _builtinVariablesBySource_source !== void 0 ? _builtinVariablesBySource_source : []).map((v)
|
|
113
|
+
children: ((_builtinVariablesBySource_source = builtinVariablesBySource[source]) !== null && _builtinVariablesBySource_source !== void 0 ? _builtinVariablesBySource_source : []).map((v)=>/*#__PURE__*/ {
|
|
114
114
|
var _v_spec_display;
|
|
115
|
-
|
|
115
|
+
var _v_spec_display_description;
|
|
116
|
+
return (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
116
117
|
children: [
|
|
117
118
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
|
|
118
119
|
component: "th",
|
|
@@ -34,12 +34,12 @@ function _interop_require_default(obj) {
|
|
|
34
34
|
default: obj
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function EditVariablesButton({ variant ='text'
|
|
37
|
+
function EditVariablesButton({ variant = 'text', label = 'Variables', color = 'primary', fullWidth }) {
|
|
38
38
|
const [isVariableEditorOpen, setIsVariableEditorOpen] = (0, _react.useState)(false);
|
|
39
39
|
const variableDefinitions = (0, _context.useTemplateVariableDefinitions)();
|
|
40
40
|
const externalVariableDefinitions = (0, _context.useTemplateExternalVariableDefinitions)();
|
|
41
41
|
const builtinVariableDefinitions = (0, _pluginsystem.useBuiltinVariableDefinitions)();
|
|
42
|
-
const { setVariableDefinitions
|
|
42
|
+
const { setVariableDefinitions } = (0, _context.useTemplateVariableActions)();
|
|
43
43
|
const openVariableEditor = ()=>{
|
|
44
44
|
setIsVariableEditorOpen(true);
|
|
45
45
|
};
|
|
@@ -46,7 +46,7 @@ function variableOptionToVariableValue(options) {
|
|
|
46
46
|
}
|
|
47
47
|
return options.value;
|
|
48
48
|
}
|
|
49
|
-
function TemplateVariable({ name
|
|
49
|
+
function TemplateVariable({ name, source }) {
|
|
50
50
|
var _ctx_definition;
|
|
51
51
|
const ctx = (0, _context.useTemplateVariable)(name, source);
|
|
52
52
|
const kind = (_ctx_definition = ctx.definition) === null || _ctx_definition === void 0 ? void 0 : _ctx_definition.kind;
|
|
@@ -73,10 +73,18 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
73
73
|
const allowMultiple = (spec === null || spec === void 0 ? void 0 : spec.allowMultiple) === true;
|
|
74
74
|
const allowAllValue = (spec === null || spec === void 0 ? void 0 : spec.allowAllValue) === true;
|
|
75
75
|
const sort = spec === null || spec === void 0 ? void 0 : spec.sort;
|
|
76
|
-
const loading = (0, _react.useMemo)(()=>
|
|
77
|
-
|
|
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
|
+
}, [
|
|
80
|
+
variablesOptionsQuery.isFetching
|
|
81
|
+
]);
|
|
82
|
+
const options = (0, _react.useMemo)(()=>{
|
|
83
|
+
var _variablesOptionsQuery_data;
|
|
84
|
+
return (_variablesOptionsQuery_data = variablesOptionsQuery.data) !== null && _variablesOptionsQuery_data !== void 0 ? _variablesOptionsQuery_data : [];
|
|
85
|
+
}, [
|
|
86
|
+
variablesOptionsQuery.data
|
|
78
87
|
]);
|
|
79
|
-
const options = variablesOptionsQuery.data;
|
|
80
88
|
let value = state === null || state === void 0 ? void 0 : state.value;
|
|
81
89
|
// Make sure value is an array if allowMultiple is true
|
|
82
90
|
if (allowMultiple && !Array.isArray(value)) {
|
|
@@ -185,6 +193,7 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
185
193
|
};
|
|
186
194
|
}
|
|
187
195
|
const StyledPopper = (props)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Popper, {
|
|
196
|
+
placeholder: undefined,
|
|
188
197
|
...props,
|
|
189
198
|
sx: {
|
|
190
199
|
minWidth: 'fit-content'
|
|
@@ -203,17 +212,17 @@ const getWidthPx = (inputValue, kind)=>{
|
|
|
203
212
|
return width;
|
|
204
213
|
}
|
|
205
214
|
};
|
|
206
|
-
function ListVariable({ name
|
|
215
|
+
function ListVariable({ name, source }) {
|
|
207
216
|
var _definition_spec_display;
|
|
208
217
|
const ctx = (0, _context.useTemplateVariable)(name, source);
|
|
209
218
|
const definition = ctx.definition;
|
|
210
219
|
const variablesOptionsQuery = (0, _pluginsystem.useListVariablePluginValues)(definition);
|
|
211
|
-
const { setVariableValue
|
|
212
|
-
const { selectedOptions
|
|
220
|
+
const { setVariableValue, setVariableLoading, setVariableOptions } = (0, _context.useTemplateVariableActions)();
|
|
221
|
+
const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(definition === null || definition === void 0 ? void 0 : definition.spec, ctx.state, variablesOptionsQuery);
|
|
213
222
|
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
214
223
|
const [inputWidth, setInputWidth] = (0, _react.useState)(_constants.MIN_TEMPLATE_VARIABLE_WIDTH);
|
|
215
224
|
var _definition_spec_display_name;
|
|
216
|
-
const title = (_definition_spec_display_name =
|
|
225
|
+
const title = (_definition_spec_display_name = definition === null || definition === void 0 ? void 0 : (_definition_spec_display = definition.spec.display) === null || _definition_spec_display === void 0 ? void 0 : _definition_spec_display.name) !== null && _definition_spec_display_name !== void 0 ? _definition_spec_display_name : name;
|
|
217
226
|
const allowMultiple = (definition === null || definition === void 0 ? void 0 : definition.spec.allowMultiple) === true;
|
|
218
227
|
const allowAllValue = (definition === null || definition === void 0 ? void 0 : definition.spec.allowAllValue) === true;
|
|
219
228
|
// Update value when changed
|
|
@@ -300,7 +309,7 @@ function ListVariable({ name , source }) {
|
|
|
300
309
|
]
|
|
301
310
|
});
|
|
302
311
|
}
|
|
303
|
-
function TextVariable({ name
|
|
312
|
+
function TextVariable({ name, source }) {
|
|
304
313
|
var _definition_spec_display;
|
|
305
314
|
const ctx = (0, _context.useTemplateVariable)(name, source);
|
|
306
315
|
const state = ctx.state;
|
|
@@ -308,7 +317,7 @@ function TextVariable({ name , source }) {
|
|
|
308
317
|
var _state_value;
|
|
309
318
|
const [tempValue, setTempValue] = (0, _react.useState)((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
310
319
|
const [inputWidth, setInputWidth] = (0, _react.useState)(getWidthPx(tempValue, 'text'));
|
|
311
|
-
const { setVariableValue
|
|
320
|
+
const { setVariableValue } = (0, _context.useTemplateVariableActions)();
|
|
312
321
|
(0, _react.useEffect)(()=>{
|
|
313
322
|
var _state_value;
|
|
314
323
|
setTempValue((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
@@ -326,7 +335,7 @@ function TextVariable({ name , source }) {
|
|
|
326
335
|
},
|
|
327
336
|
onBlur: ()=>setVariableValue(name, tempValue, source),
|
|
328
337
|
placeholder: name,
|
|
329
|
-
label: (_definition_spec_display_name =
|
|
338
|
+
label: (_definition_spec_display_name = definition === null || definition === void 0 ? void 0 : (_definition_spec_display = definition.spec.display) === null || _definition_spec_display === void 0 ? void 0 : _definition_spec_display.name) !== null && _definition_spec_display_name !== void 0 ? _definition_spec_display_name : name,
|
|
330
339
|
InputProps: {
|
|
331
340
|
readOnly: (_definition_spec_constant = definition === null || definition === void 0 ? void 0 : definition.spec.constant) !== null && _definition_spec_constant !== void 0 ? _definition_spec_constant : false
|
|
332
341
|
},
|
|
@@ -84,7 +84,7 @@ function VariableEditor(props) {
|
|
|
84
84
|
variableDefinitions
|
|
85
85
|
]);
|
|
86
86
|
const currentEditingVariableDefinition = typeof variableEditIdx === 'number' && variableDefinitions[variableEditIdx];
|
|
87
|
-
const { openDiscardChangesConfirmationDialog
|
|
87
|
+
const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } = (0, _context.useDiscardChangesConfirmationDialog)();
|
|
88
88
|
const handleCancel = ()=>{
|
|
89
89
|
if (JSON.stringify(props.variableDefinitions) !== JSON.stringify(variableDefinitions)) {
|
|
90
90
|
openDiscardChangesConfirmationDialog({
|
|
@@ -164,7 +164,6 @@ function VariableEditor(props) {
|
|
|
164
164
|
draft.push(v);
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
|
-
var _getVariableLabelByKind, _v_spec_display_description, _getVariableLabelByKind1, _v_spec_display_description1;
|
|
168
167
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
169
168
|
children: [
|
|
170
169
|
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.VariableEditorForm, {
|
|
@@ -266,9 +265,10 @@ function VariableEditor(props) {
|
|
|
266
265
|
})
|
|
267
266
|
}),
|
|
268
267
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
269
|
-
children: variableDefinitions.map((v, idx)
|
|
268
|
+
children: variableDefinitions.map((v, idx)=>/*#__PURE__*/ {
|
|
270
269
|
var _v_spec_display, _v_spec_display1;
|
|
271
|
-
|
|
270
|
+
var _getVariableLabelByKind, _v_spec_display_description;
|
|
271
|
+
return (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
272
272
|
children: [
|
|
273
273
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
274
274
|
component: "th",
|
|
@@ -346,8 +346,7 @@ function VariableEditor(props) {
|
|
|
346
346
|
})
|
|
347
347
|
]
|
|
348
348
|
}),
|
|
349
|
-
externalVariableDefinitions && !externalVariableDefinitions.every((v)=>v.definitions.length === 0) && externalVariableDefinitions.map((extVar)=>{
|
|
350
|
-
return extVar.definitions.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Accordion, {
|
|
349
|
+
externalVariableDefinitions && !externalVariableDefinitions.every((v)=>v.definitions.length === 0) && externalVariableDefinitions.map((extVar, key)=>extVar.definitions.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Accordion, {
|
|
351
350
|
sx: (theme)=>({
|
|
352
351
|
'.MuiAccordionSummary-root': {
|
|
353
352
|
backgroundColor: theme.palette.background.lighter
|
|
@@ -428,9 +427,10 @@ function VariableEditor(props) {
|
|
|
428
427
|
})
|
|
429
428
|
}),
|
|
430
429
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
431
|
-
children: extVar.definitions.map((v)
|
|
430
|
+
children: extVar.definitions.map((v)=>/*#__PURE__*/ {
|
|
432
431
|
var _v_spec_display, _v_spec_display1;
|
|
433
|
-
|
|
432
|
+
var _getVariableLabelByKind, _v_spec_display_description;
|
|
433
|
+
return (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
434
434
|
children: [
|
|
435
435
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
436
436
|
component: "th",
|
|
@@ -455,10 +455,10 @@ function VariableEditor(props) {
|
|
|
455
455
|
})
|
|
456
456
|
}),
|
|
457
457
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
458
|
-
children: (
|
|
458
|
+
children: (_getVariableLabelByKind = getVariableLabelByKind(v.kind)) !== null && _getVariableLabelByKind !== void 0 ? _getVariableLabelByKind : v.kind
|
|
459
459
|
}),
|
|
460
460
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
461
|
-
children: (
|
|
461
|
+
children: (_v_spec_display_description = (_v_spec_display1 = v.spec.display) === null || _v_spec_display1 === void 0 ? void 0 : _v_spec_display1.description) !== null && _v_spec_display_description !== void 0 ? _v_spec_display_description : ''
|
|
462
462
|
}),
|
|
463
463
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(TableCell, {
|
|
464
464
|
align: "right",
|
|
@@ -500,8 +500,7 @@ function VariableEditor(props) {
|
|
|
500
500
|
})
|
|
501
501
|
})
|
|
502
502
|
]
|
|
503
|
-
})
|
|
504
|
-
}),
|
|
503
|
+
}, key)),
|
|
505
504
|
builtinVariableDefinitions && /*#__PURE__*/ (0, _jsxruntime.jsx)(_BuiltinVariableAccordions.BuiltinVariableAccordions, {
|
|
506
505
|
builtinVariableDefinitions: builtinVariableDefinitions
|
|
507
506
|
})
|
|
@@ -513,11 +512,11 @@ function VariableEditor(props) {
|
|
|
513
512
|
]
|
|
514
513
|
});
|
|
515
514
|
}
|
|
516
|
-
const TableCell = (0, _material.styled)(_material.TableCell)(({ theme
|
|
515
|
+
const TableCell = (0, _material.styled)(_material.TableCell)(({ theme })=>({
|
|
517
516
|
borderBottom: `solid 1px ${theme.palette.divider}`
|
|
518
517
|
}));
|
|
519
518
|
function VariableName(props) {
|
|
520
|
-
const { name
|
|
519
|
+
const { name, state } = props;
|
|
521
520
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
522
521
|
children: [
|
|
523
522
|
!(state === null || state === void 0 ? void 0 : state.overridden) && `${name} `,
|
|
@@ -49,7 +49,7 @@ function TemplateVariableList() {
|
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function TemplateVariableListItem({ spec
|
|
52
|
+
function TemplateVariableListItem({ spec, source }) {
|
|
53
53
|
var _ctx_state, _spec_display;
|
|
54
54
|
const ctx = (0, _context.useTemplateVariable)(spec.name, source);
|
|
55
55
|
var _ref, _ref1;
|
|
@@ -21,14 +21,14 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
MAX_TEMPLATE_VARIABLE_WIDTH: function() {
|
|
25
|
+
return MAX_TEMPLATE_VARIABLE_WIDTH;
|
|
26
26
|
},
|
|
27
27
|
MIN_TEMPLATE_VARIABLE_WIDTH: function() {
|
|
28
28
|
return MIN_TEMPLATE_VARIABLE_WIDTH;
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
30
|
+
editButtonStyle: function() {
|
|
31
|
+
return editButtonStyle;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const editButtonStyle = {
|
|
@@ -21,11 +21,11 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
TOOLTIP_TEXT: function() {
|
|
25
|
-
return TOOLTIP_TEXT;
|
|
26
|
-
},
|
|
27
24
|
ARIA_LABEL_TEXT: function() {
|
|
28
25
|
return ARIA_LABEL_TEXT;
|
|
26
|
+
},
|
|
27
|
+
TOOLTIP_TEXT: function() {
|
|
28
|
+
return TOOLTIP_TEXT;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const TOOLTIP_TEXT = {
|
|
@@ -24,11 +24,11 @@ _export(exports, {
|
|
|
24
24
|
DashboardContext: function() {
|
|
25
25
|
return DashboardContext;
|
|
26
26
|
},
|
|
27
|
-
useDashboardStore: function() {
|
|
28
|
-
return useDashboardStore;
|
|
29
|
-
},
|
|
30
27
|
DashboardProvider: function() {
|
|
31
28
|
return DashboardProvider;
|
|
29
|
+
},
|
|
30
|
+
useDashboardStore: function() {
|
|
31
|
+
return useDashboardStore;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
const _jsxruntime = require("react/jsx-runtime");
|
|
@@ -63,10 +63,10 @@ function DashboardProvider(props) {
|
|
|
63
63
|
props
|
|
64
64
|
]);
|
|
65
65
|
// load plugin to retrieve initial spec if default panel kind is defined
|
|
66
|
-
const { defaultPluginKinds
|
|
66
|
+
const { defaultPluginKinds } = (0, _pluginsystem.usePluginRegistry)();
|
|
67
67
|
var _defaultPluginKinds_Panel;
|
|
68
68
|
const defaultPanelKind = (_defaultPluginKinds_Panel = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds['Panel']) !== null && _defaultPluginKinds_Panel !== void 0 ? _defaultPluginKinds_Panel : '';
|
|
69
|
-
const { data: plugin
|
|
69
|
+
const { data: plugin } = (0, _pluginsystem.usePlugin)('Panel', defaultPanelKind);
|
|
70
70
|
const [store] = (0, _react.useState)(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders
|
|
71
71
|
(0, _react.useEffect)(()=>{
|
|
72
72
|
if (plugin === undefined) return;
|
|
@@ -88,9 +88,9 @@ function DashboardProvider(props) {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
function initStore(props) {
|
|
91
|
-
const { initialState: { dashboardResource
|
|
92
|
-
const { spec: { display
|
|
93
|
-
let { spec: { layouts
|
|
91
|
+
const { initialState: { dashboardResource, isEditMode } } = props;
|
|
92
|
+
const { spec: { display, duration, refreshInterval = _core.DEFAULT_REFRESH_INTERVAL, datasources }, metadata } = dashboardResource;
|
|
93
|
+
let { spec: { layouts, panels } } = dashboardResource;
|
|
94
94
|
// Set fallbacks in case the frontend is used with a non-Perses backend
|
|
95
95
|
layouts = layouts !== null && layouts !== void 0 ? layouts : [];
|
|
96
96
|
panels = panels !== null && panels !== void 0 ? panels : {};
|
|
@@ -116,12 +116,12 @@ function initStore(props) {
|
|
|
116
116
|
setEditMode: (isEditMode)=>set({
|
|
117
117
|
isEditMode
|
|
118
118
|
}),
|
|
119
|
-
setDashboard: ({ metadata
|
|
119
|
+
setDashboard: ({ metadata, spec: { display, panels = {}, layouts = [], duration, refreshInterval, datasources = {} } })=>{
|
|
120
120
|
set((state)=>{
|
|
121
121
|
state.metadata = metadata;
|
|
122
122
|
state.display = display;
|
|
123
123
|
state.panels = panels;
|
|
124
|
-
const { panelGroups
|
|
124
|
+
const { panelGroups, panelGroupOrder } = (0, _panelgroupslice.convertLayoutsToPanelGroups)(layouts);
|
|
125
125
|
state.panelGroups = panelGroups;
|
|
126
126
|
state.panelGroupOrder = panelGroupOrder;
|
|
127
127
|
state.duration = duration;
|
|
@@ -21,11 +21,11 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
generateId: function() {
|
|
25
|
-
return generateId;
|
|
26
|
-
},
|
|
27
24
|
createPanelDefinition: function() {
|
|
28
25
|
return createPanelDefinition;
|
|
26
|
+
},
|
|
27
|
+
generateId: function() {
|
|
28
|
+
return generateId;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
function generateId() {
|
|
@@ -21,29 +21,29 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
useEditMode: function() {
|
|
25
|
-
return useEditMode;
|
|
26
|
-
},
|
|
27
24
|
useDashboardActions: function() {
|
|
28
25
|
return useDashboardActions;
|
|
29
26
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
27
|
+
useDashboardDuration: function() {
|
|
28
|
+
return useDashboardDuration;
|
|
32
29
|
},
|
|
33
|
-
|
|
34
|
-
return
|
|
30
|
+
useDeletePanelDialog: function() {
|
|
31
|
+
return useDeletePanelDialog;
|
|
35
32
|
},
|
|
36
|
-
|
|
37
|
-
return
|
|
33
|
+
useDeletePanelGroupDialog: function() {
|
|
34
|
+
return useDeletePanelGroupDialog;
|
|
38
35
|
},
|
|
39
|
-
|
|
40
|
-
return
|
|
36
|
+
useDiscardChangesConfirmationDialog: function() {
|
|
37
|
+
return useDiscardChangesConfirmationDialog;
|
|
41
38
|
},
|
|
42
|
-
|
|
43
|
-
return
|
|
39
|
+
useEditJsonDialog: function() {
|
|
40
|
+
return useEditJsonDialog;
|
|
44
41
|
},
|
|
45
|
-
|
|
46
|
-
return
|
|
42
|
+
useEditMode: function() {
|
|
43
|
+
return useEditMode;
|
|
44
|
+
},
|
|
45
|
+
useListPanelGroups: function() {
|
|
46
|
+
return useListPanelGroups;
|
|
47
47
|
},
|
|
48
48
|
usePanel: function() {
|
|
49
49
|
return usePanel;
|
|
@@ -54,38 +54,38 @@ _export(exports, {
|
|
|
54
54
|
usePanelEditor: function() {
|
|
55
55
|
return usePanelEditor;
|
|
56
56
|
},
|
|
57
|
-
|
|
58
|
-
return
|
|
57
|
+
usePanelGroup: function() {
|
|
58
|
+
return usePanelGroup;
|
|
59
59
|
},
|
|
60
|
-
|
|
61
|
-
return
|
|
60
|
+
usePanelGroupActions: function() {
|
|
61
|
+
return usePanelGroupActions;
|
|
62
62
|
},
|
|
63
|
-
|
|
64
|
-
return
|
|
63
|
+
usePanelGroupEditor: function() {
|
|
64
|
+
return usePanelGroupEditor;
|
|
65
65
|
},
|
|
66
|
-
|
|
67
|
-
return
|
|
66
|
+
usePanelGroupIds: function() {
|
|
67
|
+
return usePanelGroupIds;
|
|
68
68
|
},
|
|
69
|
-
|
|
70
|
-
return
|
|
69
|
+
useSaveChangesConfirmationDialog: function() {
|
|
70
|
+
return useSaveChangesConfirmationDialog;
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
const _react = require("react");
|
|
74
74
|
const _DashboardProvider = require("./DashboardProvider");
|
|
75
|
-
const selectEditMode = ({ isEditMode
|
|
75
|
+
const selectEditMode = ({ isEditMode, setEditMode })=>({
|
|
76
76
|
isEditMode,
|
|
77
77
|
setEditMode
|
|
78
78
|
});
|
|
79
79
|
function useEditMode() {
|
|
80
80
|
return (0, _DashboardProvider.useDashboardStore)(selectEditMode);
|
|
81
81
|
}
|
|
82
|
-
const selectDashboardActions = ({ setDashboard
|
|
82
|
+
const selectDashboardActions = ({ setDashboard, openAddPanelGroup, openAddPanel })=>({
|
|
83
83
|
setDashboard,
|
|
84
84
|
openAddPanelGroup,
|
|
85
85
|
openAddPanel
|
|
86
86
|
});
|
|
87
87
|
function useDashboardActions() {
|
|
88
|
-
const { setDashboard
|
|
88
|
+
const { setDashboard, openAddPanelGroup, openAddPanel } = (0, _DashboardProvider.useDashboardStore)(selectDashboardActions);
|
|
89
89
|
return {
|
|
90
90
|
setDashboard,
|
|
91
91
|
openAddPanelGroup: ()=>openAddPanelGroup(),
|
|
@@ -122,15 +122,15 @@ function usePanelGroup(panelGroupId) {
|
|
|
122
122
|
}
|
|
123
123
|
return panelGroup;
|
|
124
124
|
}
|
|
125
|
-
const selectPanelGroupActions = ({ openEditPanelGroup
|
|
125
|
+
const selectPanelGroupActions = ({ openEditPanelGroup, deletePanelGroup, openAddPanel, updatePanelGroupLayouts })=>({
|
|
126
126
|
openEditPanelGroup,
|
|
127
127
|
deletePanelGroup,
|
|
128
128
|
openAddPanel,
|
|
129
129
|
updatePanelGroupLayouts
|
|
130
130
|
});
|
|
131
131
|
function usePanelGroupActions(panelGroupId) {
|
|
132
|
-
const { moveUp
|
|
133
|
-
const { openEditPanelGroup
|
|
132
|
+
const { moveUp, moveDown } = useMovePanelGroup(panelGroupId);
|
|
133
|
+
const { openEditPanelGroup, deletePanelGroup, openAddPanel, updatePanelGroupLayouts } = (0, _DashboardProvider.useDashboardStore)(selectPanelGroupActions);
|
|
134
134
|
return {
|
|
135
135
|
openEditPanelGroup: ()=>openEditPanelGroup(panelGroupId),
|
|
136
136
|
deletePanelGroup: ()=>deletePanelGroup(panelGroupId),
|
|
@@ -165,14 +165,14 @@ const selectPanelGroupEditor = (state)=>state.panelGroupEditor;
|
|
|
165
165
|
function usePanelGroupEditor() {
|
|
166
166
|
return (0, _DashboardProvider.useDashboardStore)(selectPanelGroupEditor);
|
|
167
167
|
}
|
|
168
|
-
const selectDeletePanelGroupDialog = ({ deletePanelGroupDialog
|
|
168
|
+
const selectDeletePanelGroupDialog = ({ deletePanelGroupDialog, openDeletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup })=>({
|
|
169
169
|
deletePanelGroupDialog,
|
|
170
170
|
openDeletePanelGroupDialog,
|
|
171
171
|
closeDeletePanelGroupDialog,
|
|
172
172
|
deletePanelGroup
|
|
173
173
|
});
|
|
174
174
|
function useDeletePanelGroupDialog() {
|
|
175
|
-
const { deletePanelGroupDialog
|
|
175
|
+
const { deletePanelGroupDialog, openDeletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } = (0, _DashboardProvider.useDashboardStore)(selectDeletePanelGroupDialog);
|
|
176
176
|
return {
|
|
177
177
|
deletePanelGroupDialog,
|
|
178
178
|
deletePanelGroup,
|
|
@@ -181,7 +181,7 @@ function useDeletePanelGroupDialog() {
|
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
function usePanel(panelGroupItemId) {
|
|
184
|
-
const { panelGroupId
|
|
184
|
+
const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
185
185
|
const panel = (0, _DashboardProvider.useDashboardStore)((0, _react.useCallback)((store)=>{
|
|
186
186
|
var _store_panelGroups_panelGroupId;
|
|
187
187
|
const panelKey = (_store_panelGroups_panelGroupId = store.panelGroups[panelGroupId]) === null || _store_panelGroups_panelGroupId === void 0 ? void 0 : _store_panelGroups_panelGroupId.itemPanelKeys[panelGroupLayoutId];
|
|
@@ -196,13 +196,13 @@ function usePanel(panelGroupItemId) {
|
|
|
196
196
|
}
|
|
197
197
|
return panel;
|
|
198
198
|
}
|
|
199
|
-
const selectPanelActions = ({ openEditPanel
|
|
199
|
+
const selectPanelActions = ({ openEditPanel, openDeletePanelDialog, duplicatePanel })=>({
|
|
200
200
|
openEditPanel,
|
|
201
201
|
openDeletePanelDialog,
|
|
202
202
|
duplicatePanel
|
|
203
203
|
});
|
|
204
204
|
function usePanelActions(panelGroupItemId) {
|
|
205
|
-
const { openEditPanel
|
|
205
|
+
const { openEditPanel, openDeletePanelDialog, duplicatePanel } = (0, _DashboardProvider.useDashboardStore)(selectPanelActions);
|
|
206
206
|
return {
|
|
207
207
|
openEditPanel: ()=>openEditPanel(panelGroupItemId),
|
|
208
208
|
openDeletePanelDialog: ()=>openDeletePanelDialog(panelGroupItemId),
|
|
@@ -213,7 +213,7 @@ const selectPanelEditor = (state)=>state.panelEditor;
|
|
|
213
213
|
function usePanelEditor() {
|
|
214
214
|
return (0, _DashboardProvider.useDashboardStore)(selectPanelEditor);
|
|
215
215
|
}
|
|
216
|
-
const selectDeletePanelDialog = ({ deletePanelDialog
|
|
216
|
+
const selectDeletePanelDialog = ({ deletePanelDialog, deletePanel, closeDeletePanelDialog })=>({
|
|
217
217
|
deletePanelDialog,
|
|
218
218
|
deletePanel,
|
|
219
219
|
closeDeletePanelDialog
|
|
@@ -226,7 +226,7 @@ const selectDashboardDuration = (state)=>state.duration;
|
|
|
226
226
|
function useDashboardDuration() {
|
|
227
227
|
return (0, _DashboardProvider.useDashboardStore)(selectDashboardDuration);
|
|
228
228
|
}
|
|
229
|
-
const selectSaveChangesConfirmationDialog = ({ saveChangesConfirmationDialog
|
|
229
|
+
const selectSaveChangesConfirmationDialog = ({ saveChangesConfirmationDialog, openSaveChangesConfirmationDialog, closeSaveChangesConfirmationDialog })=>({
|
|
230
230
|
saveChangesConfirmationDialog,
|
|
231
231
|
openSaveChangesConfirmationDialog,
|
|
232
232
|
closeSaveChangesConfirmationDialog
|
|
@@ -234,7 +234,7 @@ const selectSaveChangesConfirmationDialog = ({ saveChangesConfirmationDialog , o
|
|
|
234
234
|
function useSaveChangesConfirmationDialog() {
|
|
235
235
|
return (0, _DashboardProvider.useDashboardStore)(selectSaveChangesConfirmationDialog);
|
|
236
236
|
}
|
|
237
|
-
const selectDiscardChangesConfirmationDialog = ({ discardChangesConfirmationDialog
|
|
237
|
+
const selectDiscardChangesConfirmationDialog = ({ discardChangesConfirmationDialog, openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog })=>({
|
|
238
238
|
discardChangesConfirmationDialog,
|
|
239
239
|
openDiscardChangesConfirmationDialog,
|
|
240
240
|
closeDiscardChangesConfirmationDialog
|
|
@@ -242,7 +242,7 @@ const selectDiscardChangesConfirmationDialog = ({ discardChangesConfirmationDial
|
|
|
242
242
|
function useDiscardChangesConfirmationDialog() {
|
|
243
243
|
return (0, _DashboardProvider.useDashboardStore)(selectDiscardChangesConfirmationDialog);
|
|
244
244
|
}
|
|
245
|
-
const selectEditJsonDialog = ({ editJsonDialog
|
|
245
|
+
const selectEditJsonDialog = ({ editJsonDialog, openEditJsonDialog, closeEditJsonDialog })=>({
|
|
246
246
|
editJsonDialog,
|
|
247
247
|
openEditJsonDialog,
|
|
248
248
|
closeEditJsonDialog
|
|
@@ -22,7 +22,7 @@ Object.defineProperty(exports, "createDeletePanelGroupSlice", {
|
|
|
22
22
|
});
|
|
23
23
|
const createDeletePanelGroupSlice = (set, get)=>({
|
|
24
24
|
deletePanelGroup (panelGroupId) {
|
|
25
|
-
const { panelGroups
|
|
25
|
+
const { panelGroups, panelGroupOrder } = get();
|
|
26
26
|
const group = panelGroups[panelGroupId];
|
|
27
27
|
const idIndex = panelGroupOrder.findIndex((id)=>id === panelGroupId);
|
|
28
28
|
if (group === undefined || idIndex === -1) {
|
|
@@ -25,7 +25,7 @@ function createDeletePanelSlice() {
|
|
|
25
25
|
return (set, get)=>({
|
|
26
26
|
deletePanel (panelGroupItemId) {
|
|
27
27
|
set((draft)=>{
|
|
28
|
-
const { panelGroupId
|
|
28
|
+
const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
29
29
|
const existingGroup = draft.panelGroups[panelGroupId];
|
|
30
30
|
if (existingGroup === undefined) {
|
|
31
31
|
throw new Error(`Missing panel group ${panelGroupId}`);
|
|
@@ -45,8 +45,8 @@ function createDeletePanelSlice() {
|
|
|
45
45
|
});
|
|
46
46
|
},
|
|
47
47
|
openDeletePanelDialog (panelGroupItemId) {
|
|
48
|
-
const { panelGroupId
|
|
49
|
-
const { panels
|
|
48
|
+
const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
49
|
+
const { panels, panelGroups } = get();
|
|
50
50
|
const panelGroup = panelGroups[panelGroupId];
|
|
51
51
|
if (panelGroup === undefined) {
|
|
52
52
|
throw new Error(`Panel group not found ${panelGroupId}`);
|
|
@@ -28,7 +28,7 @@ function createDuplicatePanelSlice() {
|
|
|
28
28
|
set((state)=>{
|
|
29
29
|
const panels = state.panels;
|
|
30
30
|
// Figure out the panel key at that location
|
|
31
|
-
const { panelGroupId
|
|
31
|
+
const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
32
32
|
const group = state.panelGroups[panelGroupId];
|
|
33
33
|
if (group === undefined) {
|
|
34
34
|
throw new Error(`Missing panel group ${panelGroupId}`);
|
|
@@ -25,14 +25,13 @@ const _common = require("./common");
|
|
|
25
25
|
const _panelgroupslice = require("./panel-group-slice");
|
|
26
26
|
function createPanelEditorSlice() {
|
|
27
27
|
// Return the state creator function for Zustand that uses the panels provided as intitial state
|
|
28
|
-
return (set, get)=>{
|
|
29
|
-
return {
|
|
28
|
+
return (set, get)=>({
|
|
30
29
|
panelEditor: undefined,
|
|
31
30
|
openEditPanel (panelGroupItemId) {
|
|
32
31
|
var _panelGroups_panelGroupId;
|
|
33
|
-
const { panels
|
|
32
|
+
const { panels, panelGroups } = get();
|
|
34
33
|
// Figure out the panel key at that location
|
|
35
|
-
const { panelGroupId
|
|
34
|
+
const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
36
35
|
const panelKey = (_panelGroups_panelGroupId = panelGroups[panelGroupId]) === null || _panelGroups_panelGroupId === void 0 ? void 0 : _panelGroups_panelGroupId.itemPanelKeys[panelGroupLayoutId];
|
|
37
36
|
if (panelKey === undefined) {
|
|
38
37
|
throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);
|
|
@@ -149,6 +148,5 @@ function createPanelEditorSlice() {
|
|
|
149
148
|
state.panelEditor = editorState;
|
|
150
149
|
});
|
|
151
150
|
}
|
|
152
|
-
};
|
|
153
|
-
};
|
|
151
|
+
});
|
|
154
152
|
}
|