@perses-dev/dashboards 0.53.0 → 0.54.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/DashboardLinks/DashboardLinksEditor.js +366 -0
- package/dist/cjs/components/DashboardLinks/EditDashboardLinksButton.js +81 -0
- package/dist/cjs/components/DashboardLinks/index.js +31 -0
- package/dist/cjs/components/DashboardShortcuts/index.js +23 -0
- package/dist/cjs/components/DashboardShortcuts/useDashboardShortcuts.js +373 -0
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +16 -1
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +1 -7
- package/dist/cjs/components/GridLayout/GridItemContent.js +19 -6
- package/dist/cjs/components/{Panel/PanelLinks.js → LinksDisplay/LinksDisplay.js} +59 -10
- package/dist/cjs/components/LinksDisplay/index.js +30 -0
- package/dist/cjs/components/Panel/PanelActions.js +58 -35
- package/dist/cjs/components/PanelDrawer/PanelQueriesSharedControls.js +16 -1
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +3 -61
- package/dist/cjs/components/Variables/ListVariableListBox.js +6 -6
- package/dist/cjs/components/Variables/Variable.js +3 -3
- package/dist/cjs/components/index.js +2 -0
- package/dist/cjs/constants/user-interface-text.js +1 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +5 -1
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +16 -0
- package/dist/cjs/context/DashboardProvider/index.js +7 -0
- package/dist/cjs/context/DashboardProvider/links-slice.js +32 -0
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +2 -2
- package/dist/cjs/context/DashboardProvider/use-save-dashboard.js +104 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +3 -9
- package/dist/cjs/context/VariableProvider/VariableProvider.js +7 -6
- package/dist/cjs/context/VariableProvider/hydrationUtils.js +3 -3
- package/dist/cjs/context/useDashboard.js +7 -4
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/keyboard-shortcuts/PanelFocusProvider.js +157 -0
- package/dist/cjs/keyboard-shortcuts/default-shortcuts/dashboard.js +75 -0
- package/dist/cjs/keyboard-shortcuts/default-shortcuts/global.js +121 -0
- package/dist/cjs/keyboard-shortcuts/default-shortcuts/index.js +33 -0
- package/dist/cjs/keyboard-shortcuts/default-shortcuts/panel.js +90 -0
- package/dist/cjs/keyboard-shortcuts/default-shortcuts/time-range.js +142 -0
- package/dist/cjs/keyboard-shortcuts/events.js +93 -0
- package/dist/cjs/keyboard-shortcuts/index.js +89 -0
- package/dist/cjs/keyboard-shortcuts/types.js +42 -0
- package/dist/cjs/keyboard-shortcuts/utils.js +76 -0
- package/dist/cjs/model/DashboardResource.js +16 -0
- package/dist/cjs/model/index.js +30 -0
- package/dist/cjs/test/render.js +18 -3
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +17 -2
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +2 -1
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardLinks/DashboardLinksEditor.d.ts +9 -0
- package/dist/components/DashboardLinks/DashboardLinksEditor.d.ts.map +1 -0
- package/dist/components/DashboardLinks/DashboardLinksEditor.js +353 -0
- package/dist/components/DashboardLinks/DashboardLinksEditor.js.map +1 -0
- package/dist/components/DashboardLinks/EditDashboardLinksButton.d.ts +18 -0
- package/dist/components/DashboardLinks/EditDashboardLinksButton.d.ts.map +1 -0
- package/dist/components/DashboardLinks/EditDashboardLinksButton.js +68 -0
- package/dist/components/DashboardLinks/EditDashboardLinksButton.js.map +1 -0
- package/dist/components/DashboardLinks/index.d.ts +3 -0
- package/dist/components/DashboardLinks/index.d.ts.map +1 -0
- package/dist/components/DashboardLinks/index.js +16 -0
- package/dist/components/DashboardLinks/index.js.map +1 -0
- package/dist/components/DashboardShortcuts/index.d.ts +3 -0
- package/dist/components/DashboardShortcuts/index.d.ts.map +1 -0
- package/dist/components/DashboardShortcuts/index.js +15 -0
- package/dist/components/DashboardShortcuts/index.js.map +1 -0
- package/dist/components/DashboardShortcuts/useDashboardShortcuts.d.ts +12 -0
- package/dist/components/DashboardShortcuts/useDashboardShortcuts.d.ts.map +1 -0
- package/dist/components/DashboardShortcuts/useDashboardShortcuts.js +365 -0
- package/dist/components/DashboardShortcuts/useDashboardShortcuts.js.map +1 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +1 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +17 -2
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +1 -7
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DownloadButton/serializeDashboard.d.ts +2 -2
- package/dist/components/DownloadButton/serializeDashboard.d.ts.map +1 -1
- package/dist/components/DownloadButton/serializeDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +21 -8
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +1 -1
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/GridLayout/Row.d.ts +2 -1
- package/dist/components/GridLayout/Row.d.ts.map +1 -1
- package/dist/components/GridLayout/Row.js.map +1 -1
- package/dist/components/LeaveDialog/LeaveDialog.d.ts +3 -3
- package/dist/components/LeaveDialog/LeaveDialog.d.ts.map +1 -1
- package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -1
- package/dist/components/LinksDisplay/LinksDisplay.d.ts +10 -0
- package/dist/components/LinksDisplay/LinksDisplay.d.ts.map +1 -0
- package/dist/components/{Panel/PanelLinks.js → LinksDisplay/LinksDisplay.js} +59 -10
- package/dist/components/LinksDisplay/LinksDisplay.js.map +1 -0
- package/dist/components/LinksDisplay/index.d.ts +2 -0
- package/dist/components/LinksDisplay/index.d.ts.map +1 -0
- package/dist/components/LinksDisplay/index.js +15 -0
- package/dist/components/LinksDisplay/index.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +2 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +1 -1
- package/dist/components/Panel/PanelActions.d.ts.map +1 -1
- package/dist/components/Panel/PanelActions.js +59 -36
- package/dist/components/Panel/PanelActions.js.map +1 -1
- package/dist/components/Panel/PanelContent.d.ts +1 -1
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +1 -1
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/PanelPluginLoader.d.ts +1 -1
- package/dist/components/Panel/PanelPluginLoader.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +2 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/PanelQueriesSharedControls.d.ts +1 -1
- package/dist/components/PanelDrawer/PanelQueriesSharedControls.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelQueriesSharedControls.js +16 -1
- package/dist/components/PanelDrawer/PanelQueriesSharedControls.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.d.ts +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts +1 -1
- package/dist/components/QueryViewerDialog/QueryViewerDialog.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +4 -62
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/ListVariableListBox.js +1 -1
- package/dist/components/Variables/ListVariableListBox.js.map +1 -1
- package/dist/components/Variables/Variable.d.ts +1 -1
- package/dist/components/Variables/Variable.js +1 -1
- package/dist/components/Variables/Variable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +2 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +1 -1
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.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/context/DashboardProvider/DashboardProvider.d.ts +8 -6
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +5 -1
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.d.ts +3 -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.d.ts +15 -2
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +14 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.d.ts +2 -0
- package/dist/context/DashboardProvider/index.d.ts.map +1 -1
- package/dist/context/DashboardProvider/index.js +1 -0
- package/dist/context/DashboardProvider/index.js.map +1 -1
- package/dist/context/DashboardProvider/links-slice.d.ts +19 -0
- package/dist/context/DashboardProvider/links-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/links-slice.js +27 -0
- package/dist/context/DashboardProvider/links-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-slice.d.ts +1 -1
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/use-save-dashboard.d.ts +25 -0
- package/dist/context/DashboardProvider/use-save-dashboard.d.ts.map +1 -0
- package/dist/context/DashboardProvider/use-save-dashboard.js +105 -0
- package/dist/context/DashboardProvider/use-save-dashboard.js.map +1 -0
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +4 -2
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +3 -9
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.d.ts +2 -1
- package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.js +2 -1
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts +2 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -1
- package/dist/context/VariableProvider/hydrationUtils.js +1 -1
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/VariableProvider/query-params.d.ts +1 -1
- package/dist/context/VariableProvider/query-params.js.map +1 -1
- package/dist/context/VariableProvider/utils.d.ts +2 -1
- package/dist/context/VariableProvider/utils.d.ts.map +1 -1
- package/dist/context/VariableProvider/utils.js.map +1 -1
- package/dist/context/useDashboard.d.ts +11 -3
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +6 -3
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/keyboard-shortcuts/PanelFocusProvider.d.ts +12 -0
- package/dist/keyboard-shortcuts/PanelFocusProvider.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/PanelFocusProvider.js +97 -0
- package/dist/keyboard-shortcuts/PanelFocusProvider.js.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/dashboard.d.ts +6 -0
- package/dist/keyboard-shortcuts/default-shortcuts/dashboard.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/dashboard.js +53 -0
- package/dist/keyboard-shortcuts/default-shortcuts/dashboard.js.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/global.d.ts +9 -0
- package/dist/keyboard-shortcuts/default-shortcuts/global.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/global.js +90 -0
- package/dist/keyboard-shortcuts/default-shortcuts/global.js.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/index.d.ts +5 -0
- package/dist/keyboard-shortcuts/default-shortcuts/index.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/index.js +18 -0
- package/dist/keyboard-shortcuts/default-shortcuts/index.js.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/panel.d.ts +7 -0
- package/dist/keyboard-shortcuts/default-shortcuts/panel.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/panel.js +65 -0
- package/dist/keyboard-shortcuts/default-shortcuts/panel.js.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/time-range.d.ts +10 -0
- package/dist/keyboard-shortcuts/default-shortcuts/time-range.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/default-shortcuts/time-range.js +108 -0
- package/dist/keyboard-shortcuts/default-shortcuts/time-range.js.map +1 -0
- package/dist/keyboard-shortcuts/events.d.ts +18 -0
- package/dist/keyboard-shortcuts/events.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/events.js +35 -0
- package/dist/keyboard-shortcuts/events.js.map +1 -0
- package/dist/keyboard-shortcuts/index.d.ts +9 -0
- package/dist/keyboard-shortcuts/index.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/index.js +21 -0
- package/dist/keyboard-shortcuts/index.js.map +1 -0
- package/dist/keyboard-shortcuts/types.d.ts +37 -0
- package/dist/keyboard-shortcuts/types.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/types.js +26 -0
- package/dist/keyboard-shortcuts/types.js.map +1 -0
- package/dist/keyboard-shortcuts/utils.d.ts +12 -0
- package/dist/keyboard-shortcuts/utils.d.ts.map +1 -0
- package/dist/keyboard-shortcuts/utils.js +51 -0
- package/dist/keyboard-shortcuts/utils.js.map +1 -0
- package/dist/model/DashboardResource.d.ts +15 -0
- package/dist/model/DashboardResource.d.ts.map +1 -0
- package/dist/model/DashboardResource.js +18 -0
- package/dist/model/DashboardResource.js.map +1 -0
- package/dist/model/index.d.ts +2 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +15 -0
- package/dist/model/index.js.map +1 -0
- package/dist/test/dashboard-provider.d.ts +1 -1
- package/dist/test/dashboard-provider.d.ts.map +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +18 -3
- package/dist/test/render.js.map +1 -1
- package/dist/test/testDashboard.d.ts +11 -2
- package/dist/test/testDashboard.d.ts.map +1 -1
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +5 -3
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +18 -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 +3 -2
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +6 -4
- package/dist/components/Panel/PanelLinks.d.ts +0 -6
- package/dist/components/Panel/PanelLinks.d.ts.map +0 -1
- package/dist/components/Panel/PanelLinks.js.map +0 -1
|
@@ -37,8 +37,8 @@ const _AlertCircle = /*#__PURE__*/ _interop_require_default(require("mdi-materia
|
|
|
37
37
|
const _InformationOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/InformationOutline"));
|
|
38
38
|
const _LightningBolt = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/LightningBolt"));
|
|
39
39
|
const _constants = require("../../constants");
|
|
40
|
+
const _LinksDisplay = require("../LinksDisplay");
|
|
40
41
|
const _HeaderIconButton = require("./HeaderIconButton");
|
|
41
|
-
const _PanelLinks = require("./PanelLinks");
|
|
42
42
|
function _interop_require_default(obj) {
|
|
43
43
|
return obj && obj.__esModule ? obj : {
|
|
44
44
|
default: obj
|
|
@@ -89,8 +89,9 @@ const PanelActions = ({ editHandlers, readHandlers, viewQueriesHandler, extra, t
|
|
|
89
89
|
descriptionTooltipId,
|
|
90
90
|
description
|
|
91
91
|
]);
|
|
92
|
-
const linksAction = links && links.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
93
|
-
links: links
|
|
92
|
+
const linksAction = links && links.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_LinksDisplay.LinksDisplay, {
|
|
93
|
+
links: links,
|
|
94
|
+
variant: "panel"
|
|
94
95
|
});
|
|
95
96
|
const extraActions = editHandlers === undefined && extra;
|
|
96
97
|
const queryStateIndicator = (0, _react.useMemo)(()=>{
|
|
@@ -230,17 +231,22 @@ const PanelActions = ({ editHandlers, readHandlers, viewQueriesHandler, extra, t
|
|
|
230
231
|
]);
|
|
231
232
|
const moveAction = (0, _react.useMemo)(()=>{
|
|
232
233
|
if (editActions && !readHandlers?.isPanelViewed) {
|
|
233
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
234
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
235
|
+
sx: {
|
|
236
|
+
background: (theme)=>theme.palette.background.default
|
|
237
|
+
},
|
|
238
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
239
|
+
description: _constants.TOOLTIP_TEXT.movePanel,
|
|
240
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_HeaderIconButton.HeaderIconButton, {
|
|
241
|
+
"aria-label": _constants.ARIA_LABEL_TEXT.movePanel(title),
|
|
242
|
+
size: "small",
|
|
243
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DragVertical.default, {
|
|
244
|
+
className: "drag-handle",
|
|
245
|
+
sx: {
|
|
246
|
+
cursor: 'grab'
|
|
247
|
+
},
|
|
248
|
+
fontSize: "inherit"
|
|
249
|
+
})
|
|
244
250
|
})
|
|
245
251
|
})
|
|
246
252
|
});
|
|
@@ -393,22 +399,25 @@ const PanelActions = ({ editHandlers, readHandlers, viewQueriesHandler, extra, t
|
|
|
393
399
|
]
|
|
394
400
|
});
|
|
395
401
|
};
|
|
396
|
-
const OverflowMenu = ({ children, title, icon, direction = 'row' })=>{
|
|
397
|
-
const [
|
|
402
|
+
const OverflowMenu = ({ children, title, icon, direction = 'row', placement = 'bottom', offsetX = -2, offsetY = -25 })=>{
|
|
403
|
+
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
398
404
|
// do not show overflow menu if there is no content (for example, edit actions are hidden)
|
|
399
405
|
const hasContent = /*#__PURE__*/ (0, _react.isValidElement)(children) || Array.isArray(children) && children.some(_react.isValidElement);
|
|
400
406
|
if (!hasContent) {
|
|
401
407
|
return null;
|
|
402
408
|
}
|
|
403
409
|
const handleClick = (event)=>{
|
|
404
|
-
|
|
410
|
+
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
405
411
|
};
|
|
406
412
|
const handleClose = ()=>{
|
|
407
|
-
|
|
413
|
+
setAnchorEl(null);
|
|
408
414
|
};
|
|
409
|
-
const open = Boolean(
|
|
415
|
+
const open = Boolean(anchorEl);
|
|
410
416
|
const id = open ? 'actions-menu' : undefined;
|
|
411
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(
|
|
417
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
418
|
+
sx: {
|
|
419
|
+
background: (theme)=>theme.palette.background.default
|
|
420
|
+
},
|
|
412
421
|
children: [
|
|
413
422
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_HeaderIconButton.HeaderIconButton, {
|
|
414
423
|
className: "show-actions",
|
|
@@ -420,24 +429,38 @@ const OverflowMenu = ({ children, title, icon, direction = 'row' })=>{
|
|
|
420
429
|
fontSize: "inherit"
|
|
421
430
|
})
|
|
422
431
|
}),
|
|
423
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.
|
|
432
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Popper, {
|
|
424
433
|
id: id,
|
|
425
434
|
open: open,
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
435
|
+
anchorEl: anchorEl,
|
|
436
|
+
placement: placement,
|
|
437
|
+
modifiers: [
|
|
438
|
+
{
|
|
439
|
+
name: 'offset',
|
|
440
|
+
options: {
|
|
441
|
+
offset: [
|
|
442
|
+
offsetX,
|
|
443
|
+
offsetY
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
sx: {
|
|
449
|
+
backgroundColor: (theme)=>theme.palette.background.paper,
|
|
450
|
+
borderRadius: 1,
|
|
451
|
+
boxShadow: (theme)=>theme.shadows[4]
|
|
432
452
|
},
|
|
433
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
453
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ClickAwayListener, {
|
|
454
|
+
onClickAway: handleClose,
|
|
455
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
456
|
+
direction: direction,
|
|
457
|
+
alignItems: "center",
|
|
458
|
+
sx: {
|
|
459
|
+
padding: 1
|
|
460
|
+
},
|
|
461
|
+
onClick: handleClose,
|
|
462
|
+
children: children
|
|
463
|
+
})
|
|
441
464
|
})
|
|
442
465
|
})
|
|
443
466
|
]
|
|
@@ -40,6 +40,21 @@ function PanelQueriesSharedControls({ plugin, control, panelDefinition, onQuerie
|
|
|
40
40
|
spec: query.spec.plugin.spec
|
|
41
41
|
};
|
|
42
42
|
}) ?? []);
|
|
43
|
+
const handleOnQueriesChange = (0, _react.useCallback)((queries)=>{
|
|
44
|
+
onQueriesChange(queries);
|
|
45
|
+
// If the number of queries has changed, force preview definition update to remove results of deleted queries.
|
|
46
|
+
if (queries.length !== previewDefinition.length) {
|
|
47
|
+
setPreviewDefinition(queries.map((query)=>{
|
|
48
|
+
return {
|
|
49
|
+
kind: query.spec.plugin.kind,
|
|
50
|
+
spec: query.spec.plugin.spec
|
|
51
|
+
};
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}, [
|
|
55
|
+
onQueriesChange,
|
|
56
|
+
previewDefinition.length
|
|
57
|
+
]);
|
|
43
58
|
const handleRunQuery = (0, _react.useCallback)((index, newDef)=>{
|
|
44
59
|
setPreviewDefinition((prev)=>{
|
|
45
60
|
const newDefinitions = [
|
|
@@ -85,7 +100,7 @@ function PanelQueriesSharedControls({ plugin, control, panelDefinition, onQuerie
|
|
|
85
100
|
control: control,
|
|
86
101
|
panelDefinition: panelDefinition,
|
|
87
102
|
onJSONChange: onJSONChange,
|
|
88
|
-
onQueriesChange:
|
|
103
|
+
onQueriesChange: handleOnQueriesChange,
|
|
89
104
|
onQueryRun: handleRunQuery,
|
|
90
105
|
onPluginSpecChange: onPluginSpecChange
|
|
91
106
|
})
|
|
@@ -24,7 +24,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _react = require("react");
|
|
25
25
|
const _material = require("@mui/material");
|
|
26
26
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
27
|
-
const
|
|
27
|
+
const _spec = require("@perses-dev/spec");
|
|
28
28
|
const _components = require("@perses-dev/components");
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const SAVE_DEFAULTS_DIALOG_TEXT = 'You have made changes to the time range or the variables values. Would you like to save these as defaults?';
|
|
@@ -40,7 +40,7 @@ const SaveChangesConfirmationDialog = ()=>{
|
|
|
40
40
|
const { modifiedVariableNames } = getSavedVariablesStatus();
|
|
41
41
|
const isOpen = dialog !== undefined;
|
|
42
42
|
const { timeRange, refreshInterval } = (0, _pluginsystem.useTimeRange)();
|
|
43
|
-
const currentTimeRangeText = (0,
|
|
43
|
+
const currentTimeRangeText = (0, _spec.isRelativeTimeRange)(timeRange) ? `(Last ${timeRange.pastDuration})` : '(Absolute time ranges can not be saved)';
|
|
44
44
|
const saveTimeRangeMessage = `Save current time range as new default ${currentTimeRangeText}`;
|
|
45
45
|
const saveVariableMessage = `Save current variable values as new default (${modifiedVariableNames.length > 0 ? modifiedVariableNames.join(', ') : 'No modified variables'})`;
|
|
46
46
|
const refreshIntervalDisplay = _pluginsystem.DEFAULT_REFRESH_INTERVAL_OPTIONS.some((i)=>i.display === refreshInterval) ? refreshInterval : _pluginsystem.DEFAULT_REFRESH_INTERVAL_OPTIONS.find((i)=>i.value.pastDuration === refreshInterval)?.display;
|
|
@@ -63,8 +63,8 @@ const SaveChangesConfirmationDialog = ()=>{
|
|
|
63
63
|
children: [
|
|
64
64
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
65
65
|
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
|
|
66
|
-
disabled: !isSavedDurationModified || !(0,
|
|
67
|
-
checked: saveDefaultTimeRange && isSavedDurationModified && (0,
|
|
66
|
+
disabled: !isSavedDurationModified || !(0, _spec.isRelativeTimeRange)(timeRange),
|
|
67
|
+
checked: saveDefaultTimeRange && isSavedDurationModified && (0, _spec.isRelativeTimeRange)(timeRange),
|
|
68
68
|
onChange: (e)=>setSaveDefaultTimeRange(e.target.checked)
|
|
69
69
|
}),
|
|
70
70
|
label: saveTimeRangeMessage
|
|
@@ -21,72 +21,14 @@ Object.defineProperty(exports, "SaveDashboardButton", {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _react = require("react");
|
|
25
24
|
const _material = require("@mui/material");
|
|
26
|
-
const _core = require("@perses-dev/core");
|
|
27
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
28
25
|
const _context = require("../../context");
|
|
29
26
|
const SaveDashboardButton = ({ onSave, isDisabled, variant = 'contained' })=>{
|
|
30
|
-
const
|
|
31
|
-
const { dashboard, setDashboard } = (0, _context.useDashboard)();
|
|
32
|
-
const { getSavedVariablesStatus, setVariableDefaultValues } = (0, _context.useVariableDefinitionActions)();
|
|
33
|
-
const { isSavedVariableModified } = getSavedVariablesStatus();
|
|
34
|
-
const { timeRange, refreshInterval } = (0, _pluginsystem.useTimeRange)();
|
|
35
|
-
const { setEditMode } = (0, _context.useEditMode)();
|
|
36
|
-
const { openSaveChangesConfirmationDialog, closeSaveChangesConfirmationDialog } = (0, _context.useSaveChangesConfirmationDialog)();
|
|
37
|
-
const onSaveButtonClick = ()=>{
|
|
38
|
-
const isSavedDurationModified = (0, _core.isRelativeTimeRange)(timeRange) && dashboard.spec.duration !== timeRange.pastDuration;
|
|
39
|
-
const isSavedRefreshIntervalModified = dashboard.spec.refreshInterval !== refreshInterval;
|
|
40
|
-
// Save dashboard
|
|
41
|
-
// - if active timeRange from plugin-system is relative and different from currently saved
|
|
42
|
-
// - or if the saved variables are different from currently saved
|
|
43
|
-
if (isSavedDurationModified || isSavedVariableModified || isSavedRefreshIntervalModified) {
|
|
44
|
-
openSaveChangesConfirmationDialog({
|
|
45
|
-
onSaveChanges: (saveDefaultTimeRange, saveDefaultRefreshInterval, saveDefaultVariables)=>{
|
|
46
|
-
if ((0, _core.isRelativeTimeRange)(timeRange) && saveDefaultTimeRange) {
|
|
47
|
-
dashboard.spec.duration = timeRange.pastDuration;
|
|
48
|
-
}
|
|
49
|
-
if (saveDefaultVariables) {
|
|
50
|
-
const variables = setVariableDefaultValues();
|
|
51
|
-
dashboard.spec.variables = variables;
|
|
52
|
-
}
|
|
53
|
-
if (saveDefaultRefreshInterval && isSavedRefreshIntervalModified) {
|
|
54
|
-
dashboard.spec.refreshInterval = refreshInterval;
|
|
55
|
-
}
|
|
56
|
-
setDashboard(dashboard);
|
|
57
|
-
saveDashboard();
|
|
58
|
-
},
|
|
59
|
-
onCancel: ()=>{
|
|
60
|
-
closeSaveChangesConfirmationDialog();
|
|
61
|
-
},
|
|
62
|
-
isSavedDurationModified,
|
|
63
|
-
isSavedVariableModified,
|
|
64
|
-
isSavedRefreshIntervalModified
|
|
65
|
-
});
|
|
66
|
-
} else {
|
|
67
|
-
saveDashboard();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const saveDashboard = async ()=>{
|
|
71
|
-
if (onSave) {
|
|
72
|
-
try {
|
|
73
|
-
setSavingDashboard(true);
|
|
74
|
-
await onSave(dashboard);
|
|
75
|
-
closeSaveChangesConfirmationDialog();
|
|
76
|
-
setEditMode(false);
|
|
77
|
-
} catch (error) {
|
|
78
|
-
throw new Error(`An error occurred while saving the dashboard. ${error}`);
|
|
79
|
-
} finally{
|
|
80
|
-
setSavingDashboard(false);
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
setEditMode(false);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
27
|
+
const { saveDashboard, isSaving } = (0, _context.useSaveDashboard)(onSave);
|
|
86
28
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
87
29
|
variant: variant,
|
|
88
|
-
onClick:
|
|
89
|
-
disabled: isDisabled ||
|
|
30
|
+
onClick: saveDashboard,
|
|
31
|
+
disabled: isDisabled || isSaving,
|
|
90
32
|
children: "Save"
|
|
91
33
|
});
|
|
92
34
|
};
|
|
@@ -34,7 +34,7 @@ _export(exports, {
|
|
|
34
34
|
const _jsxruntime = require("react/jsx-runtime");
|
|
35
35
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
36
36
|
const _material = require("@mui/material");
|
|
37
|
-
const
|
|
37
|
+
const _spec = require("@perses-dev/spec");
|
|
38
38
|
function _getRequireWildcardCache(nodeInterop) {
|
|
39
39
|
if (typeof WeakMap !== "function") return null;
|
|
40
40
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -107,13 +107,13 @@ function useListVariableListBoxContext() {
|
|
|
107
107
|
if (isIndeterminate) {
|
|
108
108
|
if (allowAllValue) {
|
|
109
109
|
if (filteredOptions.length === options.length) {
|
|
110
|
-
if (selectedOptions[0]?.value ===
|
|
111
|
-
onChange(options.filter((o)=>o.value !==
|
|
110
|
+
if (selectedOptions[0]?.value === _spec.DEFAULT_ALL_VALUE) {
|
|
111
|
+
onChange(options.filter((o)=>o.value !== _spec.DEFAULT_ALL_VALUE));
|
|
112
112
|
} else {
|
|
113
113
|
onChange([
|
|
114
114
|
{
|
|
115
|
-
label:
|
|
116
|
-
value:
|
|
115
|
+
label: _spec.DEFAULT_ALL_VALUE,
|
|
116
|
+
value: _spec.DEFAULT_ALL_VALUE
|
|
117
117
|
}
|
|
118
118
|
]);
|
|
119
119
|
}
|
|
@@ -123,7 +123,7 @@ function useListVariableListBoxContext() {
|
|
|
123
123
|
} else {
|
|
124
124
|
onChange([
|
|
125
125
|
...selectedOptions,
|
|
126
|
-
...filteredOptions.filter((o)=>o.value !==
|
|
126
|
+
...filteredOptions.filter((o)=>o.value !== _spec.DEFAULT_ALL_VALUE)
|
|
127
127
|
]);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -31,7 +31,7 @@ _export(exports, {
|
|
|
31
31
|
const _jsxruntime = require("react/jsx-runtime");
|
|
32
32
|
const _react = require("react");
|
|
33
33
|
const _material = require("@mui/material");
|
|
34
|
-
const
|
|
34
|
+
const _spec = require("@perses-dev/spec");
|
|
35
35
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
36
36
|
const _context = require("../../context");
|
|
37
37
|
const _constants = require("../../constants");
|
|
@@ -104,7 +104,7 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
104
104
|
if (allowAllValue) {
|
|
105
105
|
computedOptions = [
|
|
106
106
|
{
|
|
107
|
-
value:
|
|
107
|
+
value: _spec.DEFAULT_ALL_VALUE,
|
|
108
108
|
label: 'All'
|
|
109
109
|
},
|
|
110
110
|
...computedOptions
|
|
@@ -292,7 +292,7 @@ function ListVariable({ name, source }) {
|
|
|
292
292
|
value: selectedOptions,
|
|
293
293
|
onChange: (_, value)=>{
|
|
294
294
|
if ((value === null || Array.isArray(value) && value.length === 0) && allowAllValue) {
|
|
295
|
-
setVariableValue(name,
|
|
295
|
+
setVariableValue(name, _spec.DEFAULT_ALL_VALUE, source);
|
|
296
296
|
} else {
|
|
297
297
|
setVariableValue(name, variableOptionToVariableValue(value), source);
|
|
298
298
|
}
|
|
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
_export_star(require("./AddGroupButton"), exports);
|
|
18
18
|
_export_star(require("./AddPanelButton"), exports);
|
|
19
19
|
_export_star(require("./Dashboard"), exports);
|
|
20
|
+
_export_star(require("./DashboardLinks"), exports);
|
|
21
|
+
_export_star(require("./DashboardShortcuts"), exports);
|
|
20
22
|
_export_star(require("./DashboardToolbar"), exports);
|
|
21
23
|
_export_star(require("./DashboardStickyToolbar"), exports);
|
|
22
24
|
_export_star(require("./Datasources"), exports);
|
|
@@ -52,6 +52,7 @@ const _duplicatepanelslice = require("./duplicate-panel-slice");
|
|
|
52
52
|
const _editjsondialogslice = require("./edit-json-dialog-slice");
|
|
53
53
|
const _common = require("./common");
|
|
54
54
|
const _viewpanelslice = require("./view-panel-slice");
|
|
55
|
+
const _linksslice = require("./links-slice");
|
|
55
56
|
const DashboardContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
56
57
|
function useDashboardStore(selector) {
|
|
57
58
|
const store = (0, _react.useContext)(DashboardContext);
|
|
@@ -92,6 +93,7 @@ function DashboardProvider(props) {
|
|
|
92
93
|
function initStore(props) {
|
|
93
94
|
const { initialState: { dashboardResource, isEditMode, viewPanelRef, setViewPanelRef } } = props;
|
|
94
95
|
const { kind, metadata, spec: { display, duration, refreshInterval = _core.DEFAULT_REFRESH_INTERVAL, datasources, layouts = [], panels = {} } } = dashboardResource;
|
|
96
|
+
const links = dashboardResource.spec.links ?? [];
|
|
95
97
|
const ttl = 'ttl' in dashboardResource.spec ? dashboardResource.spec.ttl : undefined;
|
|
96
98
|
const store = (0, _zustand.createStore)()((0, _immer.immer)((0, _middleware.devtools)((...args)=>{
|
|
97
99
|
const [set] = args;
|
|
@@ -104,6 +106,7 @@ function initStore(props) {
|
|
|
104
106
|
...(0, _deletepanelslice.createDeletePanelSlice)()(...args),
|
|
105
107
|
...(0, _duplicatepanelslice.createDuplicatePanelSlice)()(...args),
|
|
106
108
|
...(0, _viewpanelslice.createViewPanelSlice)(viewPanelRef, setViewPanelRef)(...args),
|
|
109
|
+
/* Links */ ...(0, _linksslice.createLinksSlice)(links)(...args),
|
|
107
110
|
/* General */ ...(0, _discardchangesdialogslice.createDiscardChangesDialogSlice)(...args),
|
|
108
111
|
...(0, _editjsondialogslice.createEditJsonDialogSlice)(...args),
|
|
109
112
|
...(0, _savechangesdialogslice.createSaveChangesDialogSlice)(...args),
|
|
@@ -120,7 +123,7 @@ function initStore(props) {
|
|
|
120
123
|
isEditMode
|
|
121
124
|
});
|
|
122
125
|
},
|
|
123
|
-
setDashboard: ({ kind, metadata, spec: { display, panels = {}, layouts = [], duration, refreshInterval, datasources = {} } })=>{
|
|
126
|
+
setDashboard: ({ kind, metadata, spec: { display, panels = {}, layouts = [], duration, refreshInterval, datasources = {}, links = [] } })=>{
|
|
124
127
|
set((state)=>{
|
|
125
128
|
state.kind = kind;
|
|
126
129
|
state.metadata = metadata;
|
|
@@ -132,6 +135,7 @@ function initStore(props) {
|
|
|
132
135
|
state.duration = duration;
|
|
133
136
|
state.refreshInterval = refreshInterval ?? _core.DEFAULT_REFRESH_INTERVAL;
|
|
134
137
|
state.datasources = datasources;
|
|
138
|
+
state.links = links;
|
|
135
139
|
// TODO: add ttl here to e.g allow edition from JSON view, but probably requires quite some refactoring
|
|
136
140
|
});
|
|
137
141
|
}
|
|
@@ -27,6 +27,12 @@ _export(exports, {
|
|
|
27
27
|
get useDashboardDuration () {
|
|
28
28
|
return useDashboardDuration;
|
|
29
29
|
},
|
|
30
|
+
get useDashboardLinks () {
|
|
31
|
+
return useDashboardLinks;
|
|
32
|
+
},
|
|
33
|
+
get useDashboardLinksActions () {
|
|
34
|
+
return useDashboardLinksActions;
|
|
35
|
+
},
|
|
30
36
|
get useDeletePanelDialog () {
|
|
31
37
|
return useDeletePanelDialog;
|
|
32
38
|
},
|
|
@@ -101,6 +107,16 @@ function useDashboardActions() {
|
|
|
101
107
|
openAddPanel: ()=>openAddPanel()
|
|
102
108
|
};
|
|
103
109
|
}
|
|
110
|
+
const selectDashboardLinks = (state)=>state.links;
|
|
111
|
+
function useDashboardLinks() {
|
|
112
|
+
return (0, _DashboardProvider.useDashboardStore)(selectDashboardLinks) ?? [];
|
|
113
|
+
}
|
|
114
|
+
const selectDashboardLinksActions = (state)=>({
|
|
115
|
+
setLinks: state.setLinks
|
|
116
|
+
});
|
|
117
|
+
function useDashboardLinksActions() {
|
|
118
|
+
return (0, _DashboardProvider.useDashboardStore)(selectDashboardLinksActions);
|
|
119
|
+
}
|
|
104
120
|
const selectPanelGroupOrder = (state)=>state.panelGroupOrder;
|
|
105
121
|
function usePanelGroupIds() {
|
|
106
122
|
return (0, _DashboardProvider.useDashboardStore)(selectPanelGroupOrder);
|
|
@@ -14,9 +14,16 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
Object.defineProperty(exports, "useSaveDashboard", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return _usesavedashboard.useSaveDashboard;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
17
23
|
_export_star(require("./common"), exports);
|
|
18
24
|
_export_star(require("./dashboard-provider-api"), exports);
|
|
19
25
|
_export_star(require("./DashboardProvider"), exports);
|
|
26
|
+
const _usesavedashboard = require("./use-save-dashboard");
|
|
20
27
|
function _export_star(from, to) {
|
|
21
28
|
Object.keys(from).forEach(function(k) {
|
|
22
29
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 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, "createLinksSlice", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return createLinksSlice;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function createLinksSlice(initLinks) {
|
|
24
|
+
return (set)=>({
|
|
25
|
+
links: initLinks,
|
|
26
|
+
setLinks: (links)=>{
|
|
27
|
+
set((state)=>{
|
|
28
|
+
state.links = links;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -34,7 +34,7 @@ _export(exports, {
|
|
|
34
34
|
return createPanelGroupSlice;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
const
|
|
37
|
+
const _spec = require("@perses-dev/spec");
|
|
38
38
|
const _common = require("./common");
|
|
39
39
|
function createPanelGroupSlice(layouts) {
|
|
40
40
|
const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);
|
|
@@ -87,7 +87,7 @@ function convertLayoutsToPanelGroups(layouts) {
|
|
|
87
87
|
x: item.x,
|
|
88
88
|
y: item.y
|
|
89
89
|
});
|
|
90
|
-
itemPanelKeys[panelGroupLayoutId] = (0,
|
|
90
|
+
itemPanelKeys[panelGroupLayoutId] = (0, _spec.getPanelKeyFromRef)(item.content);
|
|
91
91
|
}
|
|
92
92
|
// Create the panel group and keep track of the ID order
|
|
93
93
|
const panelGroupId = (0, _common.generateId)();
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Copyright 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, "useSaveDashboard", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return useSaveDashboard;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _react = require("react");
|
|
24
|
+
const _spec = require("@perses-dev/spec");
|
|
25
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
26
|
+
const _VariableProvider = require("../VariableProvider/VariableProvider");
|
|
27
|
+
const _useDashboard = require("../useDashboard");
|
|
28
|
+
const _dashboardproviderapi = require("./dashboard-provider-api");
|
|
29
|
+
function useSaveDashboard(onSave) {
|
|
30
|
+
const [isSaving, setSaving] = (0, _react.useState)(false);
|
|
31
|
+
const { dashboard, setDashboard } = (0, _useDashboard.useDashboard)();
|
|
32
|
+
const { setEditMode } = (0, _dashboardproviderapi.useEditMode)();
|
|
33
|
+
const { timeRange, refreshInterval } = (0, _pluginsystem.useTimeRange)();
|
|
34
|
+
const { getSavedVariablesStatus, setVariableDefaultValues } = (0, _VariableProvider.useVariableDefinitionActions)();
|
|
35
|
+
const { openSaveChangesConfirmationDialog, closeSaveChangesConfirmationDialog } = (0, _dashboardproviderapi.useSaveChangesConfirmationDialog)();
|
|
36
|
+
const performSave = (0, _react.useCallback)(async ()=>{
|
|
37
|
+
if (!onSave) {
|
|
38
|
+
setEditMode(false);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
setSaving(true);
|
|
43
|
+
await onSave(dashboard);
|
|
44
|
+
closeSaveChangesConfirmationDialog();
|
|
45
|
+
setEditMode(false);
|
|
46
|
+
} finally{
|
|
47
|
+
setSaving(false);
|
|
48
|
+
}
|
|
49
|
+
}, [
|
|
50
|
+
closeSaveChangesConfirmationDialog,
|
|
51
|
+
dashboard,
|
|
52
|
+
onSave,
|
|
53
|
+
setEditMode
|
|
54
|
+
]);
|
|
55
|
+
const saveDashboard = (0, _react.useCallback)(()=>{
|
|
56
|
+
if (isSaving) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const { isSavedVariableModified } = getSavedVariablesStatus();
|
|
60
|
+
const isSavedDurationModified = (0, _spec.isRelativeTimeRange)(timeRange) && dashboard.spec.duration !== timeRange.pastDuration;
|
|
61
|
+
const isSavedRefreshIntervalModified = dashboard.spec.refreshInterval !== refreshInterval;
|
|
62
|
+
if (isSavedDurationModified || isSavedVariableModified || isSavedRefreshIntervalModified) {
|
|
63
|
+
openSaveChangesConfirmationDialog({
|
|
64
|
+
onSaveChanges: (saveDefaultTimeRange, saveDefaultRefreshInterval, saveDefaultVariables)=>{
|
|
65
|
+
if ((0, _spec.isRelativeTimeRange)(timeRange) && saveDefaultTimeRange) {
|
|
66
|
+
dashboard.spec.duration = timeRange.pastDuration;
|
|
67
|
+
}
|
|
68
|
+
if (saveDefaultVariables) {
|
|
69
|
+
const variables = setVariableDefaultValues();
|
|
70
|
+
dashboard.spec.variables = variables;
|
|
71
|
+
}
|
|
72
|
+
if (saveDefaultRefreshInterval && isSavedRefreshIntervalModified) {
|
|
73
|
+
dashboard.spec.refreshInterval = refreshInterval;
|
|
74
|
+
}
|
|
75
|
+
setDashboard(dashboard);
|
|
76
|
+
performSave();
|
|
77
|
+
},
|
|
78
|
+
onCancel: ()=>{
|
|
79
|
+
closeSaveChangesConfirmationDialog();
|
|
80
|
+
},
|
|
81
|
+
isSavedDurationModified,
|
|
82
|
+
isSavedVariableModified,
|
|
83
|
+
isSavedRefreshIntervalModified
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
performSave();
|
|
87
|
+
}
|
|
88
|
+
}, [
|
|
89
|
+
isSaving,
|
|
90
|
+
getSavedVariablesStatus,
|
|
91
|
+
timeRange,
|
|
92
|
+
dashboard,
|
|
93
|
+
refreshInterval,
|
|
94
|
+
openSaveChangesConfirmationDialog,
|
|
95
|
+
setVariableDefaultValues,
|
|
96
|
+
setDashboard,
|
|
97
|
+
performSave,
|
|
98
|
+
closeSaveChangesConfirmationDialog
|
|
99
|
+
]);
|
|
100
|
+
return {
|
|
101
|
+
saveDashboard,
|
|
102
|
+
isSaving
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -47,7 +47,7 @@ function DatasourceStoreProvider(props) {
|
|
|
47
47
|
}
|
|
48
48
|
if (project) {
|
|
49
49
|
// Try to find it at the project level as a Datasource resource
|
|
50
|
-
const datasource = await datasourceApi.getDatasource(project, selector);
|
|
50
|
+
const datasource = await datasourceApi.getDatasource(String(project), selector);
|
|
51
51
|
if (datasource !== undefined) {
|
|
52
52
|
return {
|
|
53
53
|
spec: datasource.spec,
|
|
@@ -102,7 +102,7 @@ function DatasourceStoreProvider(props) {
|
|
|
102
102
|
listPluginMetadata([
|
|
103
103
|
'Datasource'
|
|
104
104
|
]),
|
|
105
|
-
project ? datasourceApi.listDatasources(project, datasourcePluginName) : [],
|
|
105
|
+
project ? datasourceApi.listDatasources(String(project), datasourcePluginName) : [],
|
|
106
106
|
datasourceApi.listGlobalDatasources(datasourcePluginName)
|
|
107
107
|
]);
|
|
108
108
|
// Find the metadata for the plugin type they asked for, so we can use it for the name of the default datasource
|
|
@@ -160,13 +160,7 @@ function DatasourceStoreProvider(props) {
|
|
|
160
160
|
]);
|
|
161
161
|
const setLocalDatasources = (0, _react.useCallback)((datasources)=>{
|
|
162
162
|
if (dashboardResource) {
|
|
163
|
-
setDashboardResource(
|
|
164
|
-
...dashboardResource,
|
|
165
|
-
spec: {
|
|
166
|
-
...dashboardResource.spec,
|
|
167
|
-
datasources: datasources
|
|
168
|
-
}
|
|
169
|
-
} : {
|
|
163
|
+
setDashboardResource({
|
|
170
164
|
...dashboardResource,
|
|
171
165
|
spec: {
|
|
172
166
|
...dashboardResource.spec,
|