@perses-dev/dashboards 0.38.0 → 0.40.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/AddGroupButton/AddGroupButton.js +9 -7
- package/dist/cjs/components/AddGroupButton/index.js +10 -8
- package/dist/cjs/components/AddPanelButton/AddPanelButton.js +9 -7
- package/dist/cjs/components/AddPanelButton/index.js +10 -8
- package/dist/cjs/components/Dashboard/Dashboard.js +14 -11
- package/dist/cjs/components/Dashboard/index.js +10 -8
- package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +18 -16
- package/dist/cjs/components/DashboardStickyToolbar/index.js +10 -8
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +43 -41
- package/dist/cjs/components/DashboardToolbar/index.js +10 -8
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +12 -10
- package/dist/cjs/components/DeletePanelDialog/index.js +10 -8
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +17 -15
- package/dist/cjs/components/DeletePanelGroupDialog/index.js +10 -8
- package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +5 -3
- package/dist/cjs/components/DiscardChangesConfirmationDialog/index.js +10 -8
- package/dist/cjs/components/DownloadButton/DownloadButton.js +12 -10
- package/dist/cjs/components/DownloadButton/index.js +10 -8
- package/dist/cjs/components/EditButton/EditButton.js +8 -6
- package/dist/cjs/components/EditButton/index.js +10 -8
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +10 -8
- package/dist/cjs/components/EditJsonButton/index.js +10 -8
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +29 -23
- package/dist/cjs/components/EditJsonDialog/index.js +10 -8
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +18 -16
- package/dist/cjs/components/EmptyDashboard/index.js +10 -8
- package/dist/cjs/components/GridLayout/GridContainer.js +5 -3
- package/dist/cjs/components/GridLayout/GridItemContent.js +33 -12
- package/dist/cjs/components/GridLayout/GridLayout.js +19 -16
- package/dist/cjs/components/GridLayout/GridTitle.js +35 -33
- package/dist/cjs/components/GridLayout/index.js +13 -11
- package/dist/cjs/components/Panel/Panel.js +21 -21
- package/dist/cjs/components/Panel/PanelContent.js +8 -6
- package/dist/cjs/components/Panel/PanelHeader.js +39 -33
- package/dist/cjs/components/Panel/index.js +10 -8
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +25 -77
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +269 -141
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +11 -9
- package/dist/cjs/components/PanelDrawer/index.js +10 -8
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +3 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +18 -16
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +15 -11
- package/dist/cjs/components/PanelGroupDialog/index.js +10 -8
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +46 -44
- package/dist/cjs/components/QuerySummaryTable/index.js +10 -8
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +23 -21
- package/dist/cjs/components/SaveChangesConfirmationDialog/index.js +10 -8
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +11 -9
- package/dist/cjs/components/SaveDashboardButton/index.js +10 -8
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +40 -16
- package/dist/cjs/components/TimeRangeControls/index.js +10 -8
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +5 -3
- package/dist/cjs/components/ToolbarIconButton/index.js +10 -8
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +140 -0
- package/dist/cjs/components/Variables/EditVariablesButton.js +18 -11
- package/dist/cjs/components/Variables/TemplateVariable.js +127 -76
- package/dist/cjs/components/Variables/VariableEditor.js +356 -117
- package/dist/cjs/components/Variables/VariableList.js +45 -21
- package/dist/cjs/components/Variables/index.js +14 -11
- package/dist/cjs/components/index.js +31 -29
- package/dist/cjs/constants/grid-layout-config.js +6 -2
- package/dist/cjs/constants/index.js +11 -9
- package/dist/cjs/constants/user-interface-text.js +6 -2
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +40 -34
- package/dist/cjs/context/DashboardProvider/common.js +6 -2
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +70 -38
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +5 -3
- package/dist/cjs/context/DashboardProvider/discard-changes-dialog-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/edit-json-dialog-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/index.js +12 -10
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +13 -11
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +8 -6
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +15 -7
- package/dist/cjs/context/DashboardProvider/panel-slice.js +3 -1
- package/dist/cjs/context/DashboardProvider/save-changes-dialog-slice.js +3 -1
- package/dist/cjs/context/DatasourceStoreProvider.js +114 -45
- package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +189 -51
- package/dist/cjs/context/TemplateVariableProvider/hydrationUtils.js +65 -13
- package/dist/cjs/context/TemplateVariableProvider/index.js +10 -8
- package/dist/cjs/context/TemplateVariableProvider/query-params.js +17 -7
- package/dist/cjs/context/TemplateVariableProvider/utils.js +49 -9
- package/dist/cjs/context/index.js +13 -11
- package/dist/cjs/context/useDashboard.js +8 -6
- package/dist/cjs/index.js +12 -10
- package/dist/cjs/stories/decorators/WithDashboard.js +6 -4
- package/dist/cjs/stories/decorators/WithDatasourceStore.js +6 -4
- package/dist/cjs/stories/decorators/WithTemplateVariables.js +6 -4
- package/dist/cjs/stories/decorators/constants.js +5 -3
- package/dist/cjs/stories/decorators/index.js +13 -11
- package/dist/cjs/test/dashboard-provider.js +8 -4
- package/dist/cjs/test/datasource-provider.js +16 -12
- package/dist/cjs/test/index.js +13 -11
- package/dist/cjs/test/plugin-registry.js +6 -4
- package/dist/cjs/test/render.js +27 -20
- package/dist/cjs/test/setup-tests.js +2 -2
- package/dist/cjs/test/testDashboard.js +13 -11
- package/dist/cjs/utils/index.js +11 -9
- package/dist/cjs/utils/panelUtils.js +9 -3
- package/dist/cjs/utils/time.js +5 -3
- package/dist/cjs/validation/index.js +30 -0
- package/dist/cjs/validation/panel.js +29 -0
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +24 -15
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +64 -19
- package/dist/cjs/views/ViewDashboard/index.js +10 -8
- package/dist/cjs/views/index.js +10 -8
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddGroupButton/index.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/AddPanelButton/index.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +3 -1
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +3 -2
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Dashboard/index.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/index.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/index.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelDialog/index.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +2 -2
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/index.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/index.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/DownloadButton/index.js.map +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditButton/index.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonButton/index.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +4 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +12 -8
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EditJsonDialog/index.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/EmptyDashboard/index.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +2 -0
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +27 -8
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +2 -0
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +3 -2
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/GridLayout/index.js.map +1 -1
- package/dist/components/Panel/Panel.d.ts +20 -0
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +8 -10
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +2 -1
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +7 -3
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +22 -76
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +4 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +223 -138
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +2 -2
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/index.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/PanelGroupDialog/index.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +4 -4
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/QuerySummaryTable/index.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -4
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/index.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +4 -4
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/SaveDashboardButton/index.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +19 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/components/ToolbarIconButton/index.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +8 -0
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -0
- package/dist/components/Variables/BuiltinVariableAccordions.js +127 -0
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -0
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +6 -1
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/TemplateVariable.d.ts +12 -2
- package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
- package/dist/components/Variables/TemplateVariable.js +102 -61
- package/dist/components/Variables/TemplateVariable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts +9 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +326 -97
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +5 -0
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +32 -18
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -0
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +1 -0
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/constants/grid-layout-config.js.map +1 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +5 -5
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +2 -2
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +2 -2
- 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.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.js.map +1 -1
- 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 +7 -7
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +2 -2
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +3 -3
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +14 -10
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +107 -40
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +48 -13
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +165 -41
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts +9 -2
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js +67 -12
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
- package/dist/context/TemplateVariableProvider/index.js.map +1 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +1 -1
- package/dist/context/TemplateVariableProvider/utils.d.ts +27 -2
- package/dist/context/TemplateVariableProvider/utils.d.ts.map +1 -1
- package/dist/context/TemplateVariableProvider/utils.js +48 -6
- package/dist/context/TemplateVariableProvider/utils.js.map +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.js +1 -1
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/index.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/stories/decorators/constants.js +2 -2
- package/dist/stories/decorators/constants.js.map +1 -1
- package/dist/stories/decorators/index.js.map +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/datasource-provider.d.ts.map +1 -1
- package/dist/test/datasource-provider.js +5 -7
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/index.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 +8 -3
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/testDashboard.js +10 -10
- package/dist/test/testDashboard.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/utils/time.js.map +1 -1
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +15 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/panel.d.ts +19 -0
- package/dist/validation/panel.d.ts.map +1 -0
- package/dist/validation/panel.js +21 -0
- package/dist/validation/panel.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts +1 -0
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +11 -4
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +3 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +51 -8
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/dist/views/ViewDashboard/index.js.map +1 -1
- package/dist/views/index.js.map +1 -1
- package/package.json +8 -7
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./Panel"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -16,105 +16,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PanelDrawer", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PanelDrawer;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _react = require("react");
|
|
23
|
-
const _material = require("@mui/material");
|
|
24
25
|
const _components = require("@perses-dev/components");
|
|
25
26
|
const _context = require("../../context");
|
|
26
|
-
const
|
|
27
|
+
const _PanelEditorForm = require("./PanelEditorForm");
|
|
27
28
|
const PanelDrawer = ()=>{
|
|
28
29
|
const panelEditor = (0, _context.usePanelEditor)();
|
|
29
|
-
const { openDiscardChangesConfirmationDialog , closeDiscardChangesConfirmationDialog } = (0, _context.useDiscardChangesConfirmationDialog)();
|
|
30
|
-
const [values, setValues] = (0, _react.useState)(undefined);
|
|
31
30
|
// When the user clicks close, start closing but don't call the store yet to keep values stable during animtation
|
|
32
31
|
const [isClosing, setIsClosing] = (0, _react.useState)(false);
|
|
33
|
-
const handleClose = ()=>{
|
|
34
|
-
const isModified = JSON.stringify(panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.initialValues) !== JSON.stringify(values);
|
|
35
|
-
if (isModified) {
|
|
36
|
-
openDiscardChangesConfirmationDialog({
|
|
37
|
-
onDiscardChanges: ()=>{
|
|
38
|
-
closeDiscardChangesConfirmationDialog();
|
|
39
|
-
setIsClosing(true);
|
|
40
|
-
},
|
|
41
|
-
onCancel: ()=>{
|
|
42
|
-
closeDiscardChangesConfirmationDialog();
|
|
43
|
-
},
|
|
44
|
-
description: 'You have unapplied changes in this panel. Are you sure you want to discard these changes? Changes cannot be recovered.'
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
setIsClosing(true);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
// Don't call closeDrawer on the store until the Drawer has completely transitioned out
|
|
51
|
-
const handleExited = ()=>{
|
|
52
|
-
panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.close();
|
|
53
|
-
setIsClosing(false);
|
|
54
|
-
};
|
|
55
32
|
// Drawer is open if we have a model and we're not transitioning out
|
|
56
33
|
const isOpen = panelEditor !== undefined && isClosing === false;
|
|
57
|
-
|
|
34
|
+
function handleSave(values) {
|
|
58
35
|
// This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy
|
|
59
36
|
if (panelEditor === undefined || values === undefined) {
|
|
60
37
|
throw new Error('Cannot apply changes');
|
|
61
38
|
}
|
|
62
39
|
panelEditor.applyChanges(values);
|
|
63
40
|
setIsClosing(true);
|
|
41
|
+
}
|
|
42
|
+
const handleClose = ()=>{
|
|
43
|
+
setIsClosing(true);
|
|
44
|
+
};
|
|
45
|
+
// Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state
|
|
46
|
+
const handleExited = ()=>{
|
|
47
|
+
panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.close();
|
|
48
|
+
setIsClosing(false);
|
|
64
49
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
// Disables closing on click out. This is a quick-win solution to avoid losing draft changes.
|
|
51
|
+
// -> TODO find a way to enable closing by clicking-out in edit view, with a discard confirmation modal popping up
|
|
52
|
+
const handleClickOut = ()=>{
|
|
53
|
+
/* do nothing */ };
|
|
54
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.Drawer, {
|
|
69
55
|
isOpen: isOpen,
|
|
70
|
-
onClose:
|
|
56
|
+
onClose: handleClickOut,
|
|
71
57
|
SlideProps: {
|
|
72
58
|
onExited: handleExited
|
|
73
59
|
},
|
|
74
60
|
"data-testid": "panel-editor",
|
|
75
|
-
children: panelEditor
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
alignItems: 'center',
|
|
81
|
-
padding: (theme)=>theme.spacing(1, 2),
|
|
82
|
-
borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
|
|
83
|
-
},
|
|
84
|
-
children: [
|
|
85
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
86
|
-
variant: "h2",
|
|
87
|
-
children: [
|
|
88
|
-
panelEditor.mode,
|
|
89
|
-
" Panel"
|
|
90
|
-
]
|
|
91
|
-
}),
|
|
92
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
93
|
-
direction: "row",
|
|
94
|
-
spacing: 1,
|
|
95
|
-
marginLeft: "auto",
|
|
96
|
-
children: [
|
|
97
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
98
|
-
type: "submit",
|
|
99
|
-
variant: "contained",
|
|
100
|
-
onClick: handleSubmit,
|
|
101
|
-
children: panelEditor.mode === 'Add' ? 'Add' : 'Apply'
|
|
102
|
-
}),
|
|
103
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Button, {
|
|
104
|
-
color: "secondary",
|
|
105
|
-
variant: "outlined",
|
|
106
|
-
onClick: handleClose,
|
|
107
|
-
children: "Cancel"
|
|
108
|
-
})
|
|
109
|
-
]
|
|
110
|
-
})
|
|
111
|
-
]
|
|
112
|
-
}),
|
|
113
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelEditorForm.PanelEditorForm, {
|
|
114
|
-
initialValues: panelEditor.initialValues,
|
|
115
|
-
onChange: handleChange
|
|
116
|
-
})
|
|
117
|
-
]
|
|
61
|
+
children: panelEditor && /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelEditorForm.PanelEditorForm, {
|
|
62
|
+
initialAction: panelEditor.mode,
|
|
63
|
+
initialValues: panelEditor.initialValues,
|
|
64
|
+
onSave: handleSave,
|
|
65
|
+
onClose: handleClose
|
|
118
66
|
})
|
|
119
67
|
});
|
|
120
68
|
};
|
|
@@ -21,26 +21,72 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
PanelEditorForm: ()
|
|
25
|
-
|
|
24
|
+
PanelEditorForm: function() {
|
|
25
|
+
return PanelEditorForm;
|
|
26
|
+
},
|
|
27
|
+
panelEditorFormId: function() {
|
|
28
|
+
return panelEditorFormId;
|
|
29
|
+
}
|
|
26
30
|
});
|
|
27
|
-
const
|
|
28
|
-
const _react = require("react");
|
|
31
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
32
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
29
33
|
const _material = require("@mui/material");
|
|
30
34
|
const _components = require("@perses-dev/components");
|
|
31
|
-
const
|
|
35
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
36
|
+
const _reacthookform = require("react-hook-form");
|
|
37
|
+
const _zod = require("@hookform/resolvers/zod");
|
|
32
38
|
const _context = require("../../context");
|
|
33
|
-
const
|
|
39
|
+
const _validation = require("../../validation");
|
|
40
|
+
const _PanelPreview = require("./PanelPreview");
|
|
34
41
|
const _usePanelEditor = require("./usePanelEditor");
|
|
42
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
43
|
+
if (typeof WeakMap !== "function") return null;
|
|
44
|
+
var cacheBabelInterop = new WeakMap();
|
|
45
|
+
var cacheNodeInterop = new WeakMap();
|
|
46
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
47
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
48
|
+
})(nodeInterop);
|
|
49
|
+
}
|
|
50
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
51
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
54
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
55
|
+
return {
|
|
56
|
+
default: obj
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
60
|
+
if (cache && cache.has(obj)) {
|
|
61
|
+
return cache.get(obj);
|
|
62
|
+
}
|
|
63
|
+
var newObj = {};
|
|
64
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
65
|
+
for(var key in obj){
|
|
66
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
67
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
68
|
+
if (desc && (desc.get || desc.set)) {
|
|
69
|
+
Object.defineProperty(newObj, key, desc);
|
|
70
|
+
} else {
|
|
71
|
+
newObj[key] = obj[key];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
newObj.default = obj;
|
|
76
|
+
if (cache) {
|
|
77
|
+
cache.set(obj, newObj);
|
|
78
|
+
}
|
|
79
|
+
return newObj;
|
|
80
|
+
}
|
|
35
81
|
function PanelEditorForm(props) {
|
|
36
|
-
|
|
37
|
-
const { initialValues: { panelDefinition: initialPanelDef , groupId: initialGroupId } , onChange , } = props;
|
|
82
|
+
const { initialValues: { panelDefinition: initialPanelDef , groupId: initialGroupId } , initialAction , onSave , onClose } = props;
|
|
38
83
|
const panelGroups = (0, _context.useListPanelGroups)();
|
|
39
84
|
const [groupId, setGroupId] = (0, _react.useState)(initialGroupId);
|
|
40
85
|
const { panelDefinition , setName , setDescription , setQueries , setPlugin , setPanelDefinition } = (0, _usePanelEditor.usePanelEditor)(initialPanelDef);
|
|
41
86
|
const { plugin } = panelDefinition.spec;
|
|
87
|
+
const [isDiscardDialogOpened, setDiscardDialogOpened] = (0, _react.useState)(false);
|
|
42
88
|
// Use common plugin editor logic even though we've split the inputs up in this form
|
|
43
|
-
const pluginEditor = (0,
|
|
89
|
+
const pluginEditor = (0, _pluginsystem.usePluginEditor)({
|
|
44
90
|
pluginType: 'Panel',
|
|
45
91
|
value: {
|
|
46
92
|
kind: plugin.kind,
|
|
@@ -53,14 +99,42 @@ function PanelEditorForm(props) {
|
|
|
53
99
|
setQueries(undefined, isHidden);
|
|
54
100
|
}
|
|
55
101
|
});
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
102
|
+
const titleAction = (0, _pluginsystem.getTitleAction)(initialAction, true);
|
|
103
|
+
const submitText = (0, _pluginsystem.getSubmitText)(initialAction, true);
|
|
104
|
+
const form = (0, _reacthookform.useForm)({
|
|
105
|
+
resolver: (0, _zod.zodResolver)(_validation.panelEditorValidationSchema),
|
|
106
|
+
mode: 'onBlur',
|
|
107
|
+
defaultValues: {
|
|
108
|
+
name: initialPanelDef.spec.display.name,
|
|
109
|
+
groupId: initialGroupId,
|
|
110
|
+
description: initialPanelDef.spec.display.description,
|
|
111
|
+
type: pluginEditor.pendingKind ? pluginEditor.pendingKind : plugin.kind
|
|
61
112
|
}
|
|
62
|
-
|
|
113
|
+
});
|
|
114
|
+
const processForm = ()=>{
|
|
115
|
+
const values = {
|
|
116
|
+
groupId,
|
|
117
|
+
panelDefinition
|
|
118
|
+
};
|
|
119
|
+
onSave(values);
|
|
63
120
|
};
|
|
121
|
+
// When user click on cancel, several possibilities:
|
|
122
|
+
// - create action: ask for discard approval
|
|
123
|
+
// - update action: ask for discard approval if changed
|
|
124
|
+
// - read action: don´t ask for discard approval
|
|
125
|
+
function handleCancel() {
|
|
126
|
+
if (JSON.stringify({
|
|
127
|
+
groupId: initialGroupId,
|
|
128
|
+
panelDefinition: initialPanelDef
|
|
129
|
+
}) !== JSON.stringify({
|
|
130
|
+
groupId,
|
|
131
|
+
panelDefinition
|
|
132
|
+
})) {
|
|
133
|
+
setDiscardDialogOpened(true);
|
|
134
|
+
} else {
|
|
135
|
+
onClose();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
64
138
|
const handlePanelDefinitionChange = (nextPanelDef)=>{
|
|
65
139
|
const { kind: pluginKind , spec: pluginSpec } = nextPanelDef.spec.plugin;
|
|
66
140
|
// if panel plugin kind and spec are modified, then need to save current spec
|
|
@@ -69,146 +143,200 @@ function PanelEditorForm(props) {
|
|
|
69
143
|
}
|
|
70
144
|
setPanelDefinition(nextPanelDef);
|
|
71
145
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
component: "form",
|
|
87
|
-
id: panelEditorFormId,
|
|
88
|
-
sx: {
|
|
89
|
-
flex: 1,
|
|
90
|
-
overflowY: 'scroll',
|
|
91
|
-
padding: (theme)=>theme.spacing(2)
|
|
92
|
-
},
|
|
93
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
94
|
-
container: true,
|
|
95
|
-
spacing: 2,
|
|
96
|
-
children: [
|
|
97
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
98
|
-
item: true,
|
|
99
|
-
xs: 8,
|
|
100
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
101
|
-
required: true,
|
|
102
|
-
fullWidth: true,
|
|
103
|
-
label: "Name",
|
|
104
|
-
value: (_name = panelDefinition.spec.display.name) !== null && _name !== void 0 ? _name : '',
|
|
105
|
-
variant: "outlined",
|
|
106
|
-
onChange: (e)=>{
|
|
107
|
-
setName(e.target.value);
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
}),
|
|
111
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
112
|
-
item: true,
|
|
113
|
-
xs: 4,
|
|
114
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
115
|
-
fullWidth: true,
|
|
146
|
+
var _panelGroup_title, _pluginEditor_error_message;
|
|
147
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reacthookform.FormProvider, {
|
|
148
|
+
...form,
|
|
149
|
+
children: [
|
|
150
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
151
|
+
sx: {
|
|
152
|
+
display: 'flex',
|
|
153
|
+
alignItems: 'center',
|
|
154
|
+
padding: (theme)=>theme.spacing(1, 2),
|
|
155
|
+
borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
|
|
156
|
+
},
|
|
157
|
+
children: [
|
|
158
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
|
|
159
|
+
variant: "h2",
|
|
116
160
|
children: [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
161
|
+
titleAction,
|
|
162
|
+
" Panel"
|
|
163
|
+
]
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
166
|
+
direction: "row",
|
|
167
|
+
spacing: 1,
|
|
168
|
+
marginLeft: "auto",
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
171
|
+
variant: "contained",
|
|
172
|
+
disabled: !form.formState.isValid,
|
|
173
|
+
onClick: form.handleSubmit(processForm),
|
|
174
|
+
children: submitText
|
|
120
175
|
}),
|
|
121
|
-
/*#__PURE__*/ (0,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
onChange: handleGroupChange,
|
|
127
|
-
children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
128
|
-
value: panelGroup.id,
|
|
129
|
-
children: (_title = panelGroup.title) !== null && _title !== void 0 ? _title : `Group ${index + 1}`
|
|
130
|
-
}, panelGroup.id))
|
|
176
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
177
|
+
color: "secondary",
|
|
178
|
+
variant: "outlined",
|
|
179
|
+
onClick: handleCancel,
|
|
180
|
+
children: "Cancel"
|
|
131
181
|
})
|
|
132
182
|
]
|
|
133
183
|
})
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
})
|
|
147
|
-
}),
|
|
148
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
149
|
-
item: true,
|
|
150
|
-
xs: 4,
|
|
184
|
+
]
|
|
185
|
+
}),
|
|
186
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
187
|
+
id: panelEditorFormId,
|
|
188
|
+
sx: {
|
|
189
|
+
flex: 1,
|
|
190
|
+
overflowY: 'scroll',
|
|
191
|
+
padding: (theme)=>theme.spacing(2)
|
|
192
|
+
},
|
|
193
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
|
|
194
|
+
container: true,
|
|
195
|
+
spacing: 2,
|
|
151
196
|
children: [
|
|
152
|
-
/*#__PURE__*/ (0,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
197
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
198
|
+
item: true,
|
|
199
|
+
xs: 8,
|
|
200
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
201
|
+
name: "name",
|
|
202
|
+
render: ({ field , fieldState })=>{
|
|
203
|
+
var _fieldState_error;
|
|
204
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
205
|
+
...field,
|
|
206
|
+
required: true,
|
|
207
|
+
fullWidth: true,
|
|
208
|
+
label: "Name",
|
|
209
|
+
error: !!fieldState.error,
|
|
210
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
211
|
+
onChange: (event)=>{
|
|
212
|
+
field.onChange(event);
|
|
213
|
+
setName(event.target.value);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
}),
|
|
219
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
220
|
+
item: true,
|
|
221
|
+
xs: 4,
|
|
222
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
223
|
+
name: "groupId",
|
|
224
|
+
render: ({ field , fieldState })=>{
|
|
225
|
+
var _fieldState_error;
|
|
226
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
227
|
+
select: true,
|
|
228
|
+
...field,
|
|
229
|
+
required: true,
|
|
230
|
+
fullWidth: true,
|
|
231
|
+
label: "Group",
|
|
232
|
+
error: !!fieldState.error,
|
|
233
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
234
|
+
onChange: (event)=>{
|
|
235
|
+
field.onChange(event);
|
|
236
|
+
setGroupId(+event.target.value);
|
|
237
|
+
},
|
|
238
|
+
children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
239
|
+
value: panelGroup.id,
|
|
240
|
+
children: (_panelGroup_title = panelGroup.title) !== null && _panelGroup_title !== void 0 ? _panelGroup_title : `Group ${index + 1}`
|
|
241
|
+
}, panelGroup.id))
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
}),
|
|
246
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
247
|
+
item: true,
|
|
248
|
+
xs: 8,
|
|
249
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
250
|
+
name: "description",
|
|
251
|
+
render: ({ field , fieldState })=>{
|
|
252
|
+
var _fieldState_error;
|
|
253
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
254
|
+
...field,
|
|
255
|
+
fullWidth: true,
|
|
256
|
+
label: "Description",
|
|
257
|
+
error: !!fieldState.error,
|
|
258
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
259
|
+
onChange: (event)=>{
|
|
260
|
+
field.onChange(event);
|
|
261
|
+
setDescription(event.target.value);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
}),
|
|
267
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
268
|
+
item: true,
|
|
269
|
+
xs: 4,
|
|
270
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
271
|
+
name: "type",
|
|
272
|
+
render: ({ field , fieldState })=>{
|
|
273
|
+
var _pluginEditor_error, _fieldState_error;
|
|
274
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_pluginsystem.PluginKindSelect, {
|
|
275
|
+
...field,
|
|
276
|
+
pluginType: "Panel",
|
|
277
|
+
required: true,
|
|
278
|
+
fullWidth: true,
|
|
279
|
+
label: "Type",
|
|
280
|
+
disabled: pluginEditor.isLoading,
|
|
281
|
+
error: !!pluginEditor.error || !!fieldState.error,
|
|
282
|
+
helperText: (_pluginEditor_error_message = (_pluginEditor_error = pluginEditor.error) === null || _pluginEditor_error === void 0 ? void 0 : _pluginEditor_error.message) !== null && _pluginEditor_error_message !== void 0 ? _pluginEditor_error_message : (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
283
|
+
onChange: (event)=>{
|
|
284
|
+
field.onChange(event);
|
|
285
|
+
pluginEditor.onKindChange(event);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
}),
|
|
291
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
|
|
292
|
+
item: true,
|
|
293
|
+
xs: 12,
|
|
156
294
|
children: [
|
|
157
|
-
/*#__PURE__*/ (0,
|
|
158
|
-
|
|
159
|
-
|
|
295
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
296
|
+
variant: "h4",
|
|
297
|
+
marginBottom: 1,
|
|
298
|
+
children: "Preview"
|
|
160
299
|
}),
|
|
161
|
-
/*#__PURE__*/ (0,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
value: pluginEditor.pendingKind ? pluginEditor.pendingKind : plugin.kind,
|
|
167
|
-
onChange: pluginEditor.onKindChange
|
|
300
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
301
|
+
FallbackComponent: _components.ErrorAlert,
|
|
302
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelPreview.PanelPreview, {
|
|
303
|
+
panelDefinition: panelDefinition
|
|
304
|
+
})
|
|
168
305
|
})
|
|
169
306
|
]
|
|
170
307
|
}),
|
|
171
|
-
/*#__PURE__*/ (0,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
FallbackComponent: _components.ErrorAlert,
|
|
187
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_panelPreview.PanelPreview, {
|
|
188
|
-
panelDefinition: panelDefinition
|
|
308
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
309
|
+
item: true,
|
|
310
|
+
xs: 12,
|
|
311
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
312
|
+
FallbackComponent: _components.ErrorAlert,
|
|
313
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PanelSpecEditor, {
|
|
314
|
+
panelDefinition: panelDefinition,
|
|
315
|
+
onJSONChange: handlePanelDefinitionChange,
|
|
316
|
+
onQueriesChange: (queries)=>{
|
|
317
|
+
setQueries(queries);
|
|
318
|
+
},
|
|
319
|
+
onPluginSpecChange: (spec)=>{
|
|
320
|
+
pluginEditor.onSpecChange(spec);
|
|
321
|
+
}
|
|
322
|
+
})
|
|
189
323
|
})
|
|
190
324
|
})
|
|
191
325
|
]
|
|
192
|
-
}),
|
|
193
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
194
|
-
item: true,
|
|
195
|
-
xs: 12,
|
|
196
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.ErrorBoundary, {
|
|
197
|
-
FallbackComponent: _components.ErrorAlert,
|
|
198
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PanelSpecEditor, {
|
|
199
|
-
panelDefinition: panelDefinition,
|
|
200
|
-
onJSONChange: handlePanelDefinitionChange,
|
|
201
|
-
onQueriesChange: (queries)=>{
|
|
202
|
-
setQueries(queries);
|
|
203
|
-
},
|
|
204
|
-
onPluginSpecChange: (spec)=>{
|
|
205
|
-
pluginEditor.onSpecChange(spec);
|
|
206
|
-
}
|
|
207
|
-
})
|
|
208
|
-
})
|
|
209
326
|
})
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
327
|
+
}),
|
|
328
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.DiscardChangesConfirmationDialog, {
|
|
329
|
+
description: "You have unapplied changes in this panel. Are you sure you want to discard these changes? Changes cannot be recovered.",
|
|
330
|
+
isOpen: isDiscardDialogOpened,
|
|
331
|
+
onCancel: ()=>{
|
|
332
|
+
setDiscardDialogOpened(false);
|
|
333
|
+
},
|
|
334
|
+
onDiscardChanges: ()=>{
|
|
335
|
+
setDiscardDialogOpened(false);
|
|
336
|
+
onClose();
|
|
337
|
+
}
|
|
338
|
+
})
|
|
339
|
+
]
|
|
340
|
+
});
|
|
213
341
|
}
|
|
214
342
|
const panelEditorFormId = 'panel-editor-form';
|