@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
|
@@ -16,19 +16,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "GridItemContent", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return GridItemContent;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _reactintersectionobserver = require("react-intersection-observer");
|
|
26
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
23
27
|
const _context = require("../../context");
|
|
24
28
|
const _utils = require("../../utils");
|
|
25
|
-
const
|
|
29
|
+
const _Panel = require("../Panel/Panel");
|
|
26
30
|
function GridItemContent(props) {
|
|
27
31
|
const { panelGroupItemId , width } = props;
|
|
28
32
|
const panelDefinition = (0, _context.usePanel)(panelGroupItemId);
|
|
29
|
-
const { spec: { queries }
|
|
33
|
+
const { spec: { queries } } = panelDefinition;
|
|
30
34
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
31
35
|
const { openEditPanel , openDeletePanelDialog , duplicatePanel } = (0, _context.usePanelActions)(panelGroupItemId);
|
|
36
|
+
const { ref , inView } = (0, _reactintersectionobserver.useInView)({
|
|
37
|
+
threshold: 0.2,
|
|
38
|
+
initialInView: false,
|
|
39
|
+
triggerOnce: true
|
|
40
|
+
});
|
|
32
41
|
// Provide actions to the panel when in edit mode
|
|
33
42
|
let editHandlers = undefined;
|
|
34
43
|
if (isEditMode) {
|
|
@@ -47,14 +56,26 @@ function GridItemContent(props) {
|
|
|
47
56
|
spec: query.spec.plugin.spec
|
|
48
57
|
};
|
|
49
58
|
});
|
|
50
|
-
return /*#__PURE__*/ (0,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
60
|
+
ref: ref,
|
|
61
|
+
sx: {
|
|
62
|
+
width: '100%',
|
|
63
|
+
height: '100%'
|
|
54
64
|
},
|
|
55
|
-
children: /*#__PURE__*/ (0,
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DataQueriesProvider, {
|
|
66
|
+
definitions: definitions,
|
|
67
|
+
options: {
|
|
68
|
+
suggestedStepMs
|
|
69
|
+
},
|
|
70
|
+
queryOptions: {
|
|
71
|
+
enabled: inView
|
|
72
|
+
},
|
|
73
|
+
children: inView && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Panel.Panel, {
|
|
74
|
+
definition: panelDefinition,
|
|
75
|
+
editHandlers: editHandlers,
|
|
76
|
+
panelOptions: props.panelOptions,
|
|
77
|
+
panelGroupItemId: panelGroupItemId
|
|
78
|
+
})
|
|
58
79
|
})
|
|
59
80
|
});
|
|
60
81
|
}
|
|
@@ -16,27 +16,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "GridLayout", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return GridLayout;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _react = require("react");
|
|
23
|
-
const
|
|
25
|
+
const _reactgridlayout = require("react-grid-layout");
|
|
24
26
|
const _material = require("@mui/material");
|
|
25
27
|
const _components = require("@perses-dev/components");
|
|
26
28
|
const _context = require("../../context");
|
|
27
29
|
const _constants = require("../../constants");
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
30
|
+
const _GridTitle = require("./GridTitle");
|
|
31
|
+
const _GridItemContent = require("./GridItemContent");
|
|
32
|
+
const _GridContainer = require("./GridContainer");
|
|
31
33
|
const DEFAULT_MARGIN = 10;
|
|
32
|
-
const ResponsiveGridLayout = (0,
|
|
34
|
+
const ResponsiveGridLayout = (0, _reactgridlayout.WidthProvider)(_reactgridlayout.Responsive);
|
|
33
35
|
function GridLayout(props) {
|
|
34
36
|
const { panelGroupId /*...others */ } = props;
|
|
35
37
|
const theme = (0, _material.useTheme)();
|
|
36
38
|
const groupDefinition = (0, _context.usePanelGroup)(panelGroupId);
|
|
37
39
|
const { updatePanelGroupLayouts } = (0, _context.usePanelGroupActions)(panelGroupId);
|
|
38
|
-
var
|
|
39
|
-
const [isOpen, setIsOpen] = (0, _react.useState)((
|
|
40
|
+
var _ref;
|
|
41
|
+
const [isOpen, setIsOpen] = (0, _react.useState)((_ref = !groupDefinition.isCollapsed) !== null && _ref !== void 0 ? _ref : true);
|
|
40
42
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
41
43
|
const [gridColWidth, setGridColWidth] = (0, _react.useState)(0);
|
|
42
44
|
const handleLayoutChange = (currentLayout, allLayouts)=>{
|
|
@@ -59,9 +61,9 @@ function GridLayout(props) {
|
|
|
59
61
|
// exclude margin and padding from total width
|
|
60
62
|
setGridColWidth((containerWidth - marginWidth - containerPaddingWidth) / cols);
|
|
61
63
|
};
|
|
62
|
-
return /*#__PURE__*/ (0,
|
|
64
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_GridContainer.GridContainer, {
|
|
63
65
|
children: [
|
|
64
|
-
groupDefinition.title !== undefined && /*#__PURE__*/ (0,
|
|
66
|
+
groupDefinition.title !== undefined && /*#__PURE__*/ (0, _jsxruntime.jsx)(_GridTitle.GridTitle, {
|
|
65
67
|
panelGroupId: panelGroupId,
|
|
66
68
|
title: groupDefinition.title,
|
|
67
69
|
collapse: groupDefinition.isCollapsed === undefined ? undefined : {
|
|
@@ -69,12 +71,12 @@ function GridLayout(props) {
|
|
|
69
71
|
onToggleOpen: ()=>setIsOpen((current)=>!current)
|
|
70
72
|
}
|
|
71
73
|
}),
|
|
72
|
-
/*#__PURE__*/ (0,
|
|
74
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Collapse, {
|
|
73
75
|
in: isOpen,
|
|
74
76
|
unmountOnExit: true,
|
|
75
77
|
appear: false,
|
|
76
78
|
"data-testid": "panel-group-content",
|
|
77
|
-
children: /*#__PURE__*/ (0,
|
|
79
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(ResponsiveGridLayout, {
|
|
78
80
|
className: "layout",
|
|
79
81
|
breakpoints: {
|
|
80
82
|
sm: theme.breakpoints.values.sm,
|
|
@@ -101,10 +103,11 @@ function GridLayout(props) {
|
|
|
101
103
|
},
|
|
102
104
|
onLayoutChange: handleLayoutChange,
|
|
103
105
|
onWidthChange: handleWidthChange,
|
|
104
|
-
children: groupDefinition.itemLayouts.map(({ i , w })=>/*#__PURE__*/ (0,
|
|
105
|
-
children: /*#__PURE__*/ (0,
|
|
106
|
+
children: groupDefinition.itemLayouts.map(({ i , w })=>/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
107
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
106
108
|
FallbackComponent: _components.ErrorAlert,
|
|
107
|
-
children: /*#__PURE__*/ (0,
|
|
109
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_GridItemContent.GridItemContent, {
|
|
110
|
+
panelOptions: props.panelOptions,
|
|
108
111
|
panelGroupItemId: {
|
|
109
112
|
panelGroupId,
|
|
110
113
|
panelGroupItemLayoutId: i
|
|
@@ -16,37 +16,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "GridTitle", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return GridTitle;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
25
|
+
const _ChevronDown = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronDown"));
|
|
26
|
+
const _ChevronRight = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronRight"));
|
|
27
|
+
const _ChartBoxPlusOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChartBoxPlusOutline"));
|
|
28
|
+
const _PencilOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/PencilOutline"));
|
|
29
|
+
const _ArrowUp = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ArrowUp"));
|
|
30
|
+
const _ArrowDown = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ArrowDown"));
|
|
31
|
+
const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
|
|
30
32
|
const _components = require("@perses-dev/components");
|
|
31
|
-
const
|
|
33
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
32
34
|
const _constants = require("../../constants");
|
|
33
35
|
const _context = require("../../context");
|
|
34
|
-
function
|
|
36
|
+
function _interop_require_default(obj) {
|
|
35
37
|
return obj && obj.__esModule ? obj : {
|
|
36
38
|
default: obj
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
function GridTitle(props) {
|
|
40
42
|
const { panelGroupId , title: rawTitle , collapse } = props;
|
|
41
|
-
const title = (0,
|
|
43
|
+
const title = (0, _pluginsystem.useReplaceVariablesInString)(rawTitle);
|
|
42
44
|
const { openAddPanel , openEditPanelGroup , moveUp , moveDown } = (0, _context.usePanelGroupActions)(panelGroupId);
|
|
43
45
|
const { openDeletePanelGroupDialog } = (0, _context.useDeletePanelGroupDialog)();
|
|
44
46
|
const { isEditMode } = (0, _context.useEditMode)();
|
|
45
|
-
const text = /*#__PURE__*/ (0,
|
|
47
|
+
const text = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
46
48
|
variant: "h2",
|
|
47
49
|
children: title
|
|
48
50
|
});
|
|
49
|
-
return /*#__PURE__*/ (0,
|
|
51
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
50
52
|
onClick: collapse === null || collapse === void 0 ? void 0 : collapse.onToggleOpen,
|
|
51
53
|
sx: {
|
|
52
54
|
display: 'flex',
|
|
@@ -57,59 +59,59 @@ function GridTitle(props) {
|
|
|
57
59
|
backgroundColor: ({ palette })=>palette.background.paper
|
|
58
60
|
},
|
|
59
61
|
"data-testid": "panel-group-header",
|
|
60
|
-
children: collapse ? /*#__PURE__*/ (0,
|
|
62
|
+
children: collapse ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
61
63
|
children: [
|
|
62
|
-
/*#__PURE__*/ (0,
|
|
64
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
63
65
|
sx: {
|
|
64
66
|
marginRight: 1
|
|
65
67
|
},
|
|
66
68
|
"aria-label": `${collapse.isOpen ? 'collapse' : 'expand'} group ${title}`,
|
|
67
|
-
children: collapse.isOpen ? /*#__PURE__*/ (0,
|
|
69
|
+
children: collapse.isOpen ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronDown.default, {}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronRight.default, {})
|
|
68
70
|
}),
|
|
69
71
|
text,
|
|
70
|
-
isEditMode && /*#__PURE__*/ (0,
|
|
72
|
+
isEditMode && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
71
73
|
direction: "row",
|
|
72
74
|
marginLeft: "auto",
|
|
73
75
|
children: [
|
|
74
|
-
/*#__PURE__*/ (0,
|
|
76
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
75
77
|
description: _constants.TOOLTIP_TEXT.addPanelToGroup,
|
|
76
|
-
children: /*#__PURE__*/ (0,
|
|
78
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
77
79
|
"aria-label": _constants.ARIA_LABEL_TEXT.addPanelToGroup(title),
|
|
78
80
|
onClick: (e)=>{
|
|
79
81
|
// Don't trigger expand/collapse
|
|
80
82
|
e.stopPropagation();
|
|
81
83
|
openAddPanel();
|
|
82
84
|
},
|
|
83
|
-
children: /*#__PURE__*/ (0,
|
|
85
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChartBoxPlusOutline.default, {})
|
|
84
86
|
})
|
|
85
87
|
}),
|
|
86
|
-
/*#__PURE__*/ (0,
|
|
88
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
87
89
|
description: _constants.TOOLTIP_TEXT.editGroup,
|
|
88
|
-
children: /*#__PURE__*/ (0,
|
|
90
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
89
91
|
"aria-label": _constants.ARIA_LABEL_TEXT.editGroup(title),
|
|
90
92
|
onClick: (e)=>{
|
|
91
93
|
// Don't trigger expand/collapse
|
|
92
94
|
e.stopPropagation();
|
|
93
95
|
openEditPanelGroup();
|
|
94
96
|
},
|
|
95
|
-
children: /*#__PURE__*/ (0,
|
|
97
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PencilOutline.default, {})
|
|
96
98
|
})
|
|
97
99
|
}),
|
|
98
|
-
/*#__PURE__*/ (0,
|
|
100
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
99
101
|
description: _constants.TOOLTIP_TEXT.deleteGroup,
|
|
100
|
-
children: /*#__PURE__*/ (0,
|
|
102
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
101
103
|
"aria-label": _constants.ARIA_LABEL_TEXT.deleteGroup(title),
|
|
102
104
|
onClick: (e)=>{
|
|
103
105
|
// Don't trigger expand/collapse
|
|
104
106
|
e.stopPropagation();
|
|
105
107
|
openDeletePanelGroupDialog(panelGroupId);
|
|
106
108
|
},
|
|
107
|
-
children: /*#__PURE__*/ (0,
|
|
109
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {})
|
|
108
110
|
})
|
|
109
111
|
}),
|
|
110
|
-
/*#__PURE__*/ (0,
|
|
112
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
111
113
|
description: _constants.TOOLTIP_TEXT.moveGroupDown,
|
|
112
|
-
children: /*#__PURE__*/ (0,
|
|
114
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
113
115
|
"aria-label": _constants.ARIA_LABEL_TEXT.moveGroupDown(title),
|
|
114
116
|
disabled: moveDown === undefined,
|
|
115
117
|
onClick: (e)=>{
|
|
@@ -117,12 +119,12 @@ function GridTitle(props) {
|
|
|
117
119
|
e.stopPropagation();
|
|
118
120
|
moveDown && moveDown();
|
|
119
121
|
},
|
|
120
|
-
children: /*#__PURE__*/ (0,
|
|
122
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ArrowDown.default, {})
|
|
121
123
|
})
|
|
122
124
|
}),
|
|
123
|
-
/*#__PURE__*/ (0,
|
|
125
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
124
126
|
description: _constants.TOOLTIP_TEXT.moveGroupUp,
|
|
125
|
-
children: /*#__PURE__*/ (0,
|
|
127
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
126
128
|
"aria-label": _constants.ARIA_LABEL_TEXT.moveGroupUp(title),
|
|
127
129
|
disabled: moveUp === undefined,
|
|
128
130
|
onClick: (e)=>{
|
|
@@ -130,7 +132,7 @@ function GridTitle(props) {
|
|
|
130
132
|
e.stopPropagation();
|
|
131
133
|
moveUp && moveUp();
|
|
132
134
|
},
|
|
133
|
-
children: /*#__PURE__*/ (0,
|
|
135
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ArrowUp.default, {})
|
|
134
136
|
})
|
|
135
137
|
})
|
|
136
138
|
]
|
|
@@ -14,18 +14,20 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function
|
|
17
|
+
_export_star(require("./GridContainer"), exports);
|
|
18
|
+
_export_star(require("./GridItemContent"), exports);
|
|
19
|
+
_export_star(require("./GridLayout"), exports);
|
|
20
|
+
_export_star(require("./GridTitle"), exports);
|
|
21
|
+
function _export_star(from, to) {
|
|
22
22
|
Object.keys(from).forEach(function(k) {
|
|
23
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
24
|
+
Object.defineProperty(to, k, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function() {
|
|
27
|
+
return from[k];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
29
31
|
});
|
|
30
32
|
return from;
|
|
31
33
|
}
|
|
@@ -16,28 +16,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "Panel", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return Panel;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _react = require("react");
|
|
23
|
-
const
|
|
24
|
-
const _reactIntersectionObserver = require("react-intersection-observer");
|
|
25
|
+
const _useresizeobserver = /*#__PURE__*/ _interop_require_default(require("use-resize-observer"));
|
|
25
26
|
const _components = require("@perses-dev/components");
|
|
26
27
|
const _material = require("@mui/material");
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
function
|
|
28
|
+
const _PanelHeader = require("./PanelHeader");
|
|
29
|
+
const _PanelContent = require("./PanelContent");
|
|
30
|
+
function _interop_require_default(obj) {
|
|
30
31
|
return obj && obj.__esModule ? obj : {
|
|
31
32
|
default: obj
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
35
|
-
|
|
36
|
+
var _panelOptions_extra;
|
|
37
|
+
const { definition , editHandlers , onMouseEnter , onMouseLeave , sx , panelOptions , panelGroupItemId , ...others } = props;
|
|
36
38
|
// Make sure we have an ID we can use for aria attributes
|
|
37
39
|
const generatedPanelId = (0, _components.useId)('Panel');
|
|
38
40
|
const headerId = `${generatedPanelId}-header`;
|
|
39
41
|
const [contentElement, setContentElement] = (0, _react.useState)(null);
|
|
40
|
-
const { width , height } = (0,
|
|
42
|
+
const { width , height } = (0, _useresizeobserver.default)({
|
|
41
43
|
ref: contentElement
|
|
42
44
|
});
|
|
43
45
|
const contentDimensions = (0, _react.useMemo)(()=>{
|
|
@@ -50,11 +52,6 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
50
52
|
width,
|
|
51
53
|
height
|
|
52
54
|
]);
|
|
53
|
-
const { ref , inView } = (0, _reactIntersectionObserver.useInView)({
|
|
54
|
-
threshold: 0.3,
|
|
55
|
-
initialInView: false,
|
|
56
|
-
triggerOnce: true
|
|
57
|
-
});
|
|
58
55
|
const chartsTheme = (0, _components.useChartsTheme)();
|
|
59
56
|
const handleMouseEnter = (e)=>{
|
|
60
57
|
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(e);
|
|
@@ -62,8 +59,7 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
62
59
|
const handleMouseLeave = (e)=>{
|
|
63
60
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e);
|
|
64
61
|
};
|
|
65
|
-
return /*#__PURE__*/ (0,
|
|
66
|
-
ref: ref,
|
|
62
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Card, {
|
|
67
63
|
component: "section",
|
|
68
64
|
sx: (0, _components.combineSx)({
|
|
69
65
|
width: '100%',
|
|
@@ -79,7 +75,11 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
79
75
|
"data-testid": "panel",
|
|
80
76
|
...others,
|
|
81
77
|
children: [
|
|
82
|
-
/*#__PURE__*/ (0,
|
|
78
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelHeader.PanelHeader, {
|
|
79
|
+
extra: panelOptions === null || panelOptions === void 0 ? void 0 : (_panelOptions_extra = panelOptions.extra) === null || _panelOptions_extra === void 0 ? void 0 : _panelOptions_extra.call(panelOptions, {
|
|
80
|
+
panelDefinition: definition,
|
|
81
|
+
panelGroupItemId
|
|
82
|
+
}),
|
|
83
83
|
id: headerId,
|
|
84
84
|
title: definition.spec.display.name,
|
|
85
85
|
description: definition.spec.display.description,
|
|
@@ -88,7 +88,7 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
88
88
|
paddingX: `${chartsTheme.container.padding.default}px`
|
|
89
89
|
}
|
|
90
90
|
}),
|
|
91
|
-
/*#__PURE__*/ (0,
|
|
91
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CardContent, {
|
|
92
92
|
component: "figure",
|
|
93
93
|
sx: {
|
|
94
94
|
position: 'relative',
|
|
@@ -102,12 +102,12 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
ref: setContentElement,
|
|
105
|
-
children: /*#__PURE__*/ (0,
|
|
105
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
106
106
|
FallbackComponent: _components.ErrorAlert,
|
|
107
107
|
resetKeys: [
|
|
108
|
-
definition.spec
|
|
108
|
+
definition.spec
|
|
109
109
|
],
|
|
110
|
-
children:
|
|
110
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelContent.PanelContent, {
|
|
111
111
|
panelPluginKind: definition.spec.plugin.kind,
|
|
112
112
|
spec: definition.spec.plugin.spec,
|
|
113
113
|
contentDimensions: contentDimensions
|
|
@@ -16,19 +16,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PanelContent", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PanelContent;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
23
25
|
const _material = require("@mui/material");
|
|
24
26
|
function PanelContent(props) {
|
|
25
27
|
const { panelPluginKind , contentDimensions , ...others } = props;
|
|
26
|
-
const { data: plugin , isLoading } = (0,
|
|
28
|
+
const { data: plugin , isLoading } = (0, _pluginsystem.usePlugin)('Panel', panelPluginKind, {
|
|
27
29
|
useErrorBoundary: true
|
|
28
30
|
});
|
|
29
31
|
const PanelComponent = plugin === null || plugin === void 0 ? void 0 : plugin.PanelComponent;
|
|
30
32
|
if (isLoading) {
|
|
31
|
-
return /*#__PURE__*/ (0,
|
|
33
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Skeleton, {
|
|
32
34
|
variant: "rectangular",
|
|
33
35
|
width: contentDimensions === null || contentDimensions === void 0 ? void 0 : contentDimensions.width,
|
|
34
36
|
height: contentDimensions === null || contentDimensions === void 0 ? void 0 : contentDimensions.height,
|
|
@@ -38,7 +40,7 @@ function PanelContent(props) {
|
|
|
38
40
|
if (PanelComponent === undefined) {
|
|
39
41
|
throw new Error(`Missing PanelComponent from panel plugin for kind '${panelPluginKind}'`);
|
|
40
42
|
}
|
|
41
|
-
return /*#__PURE__*/ (0,
|
|
43
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(PanelComponent, {
|
|
42
44
|
...others,
|
|
43
45
|
contentDimensions: contentDimensions
|
|
44
46
|
});
|
|
@@ -16,51 +16,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PanelHeader", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PanelHeader;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _components = require("@perses-dev/components");
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
26
|
+
const _InformationOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/InformationOutline"));
|
|
27
|
+
const _PencilOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/PencilOutline"));
|
|
28
|
+
const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
|
|
29
|
+
const _DragVertical = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DragVertical"));
|
|
30
|
+
const _ContentCopy = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ContentCopy"));
|
|
31
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
30
32
|
const _constants = require("../../constants");
|
|
31
|
-
function
|
|
33
|
+
function _interop_require_default(obj) {
|
|
32
34
|
return obj && obj.__esModule ? obj : {
|
|
33
35
|
default: obj
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
|
-
function PanelHeader({ id , title: rawTitle , description: rawDescription , editHandlers , sx , ...rest }) {
|
|
38
|
+
function PanelHeader({ id , title: rawTitle , description: rawDescription , editHandlers , sx , extra , ...rest }) {
|
|
37
39
|
const titleElementId = `${id}-title`;
|
|
38
40
|
const descriptionTooltipId = `${id}-description`;
|
|
39
|
-
const title = (0,
|
|
40
|
-
const description = (0,
|
|
41
|
+
const title = (0, _pluginsystem.useReplaceVariablesInString)(rawTitle);
|
|
42
|
+
const description = (0, _pluginsystem.useReplaceVariablesInString)(rawDescription);
|
|
41
43
|
let actions = undefined;
|
|
42
44
|
if (editHandlers !== undefined) {
|
|
43
45
|
// If there are edit handlers, always just show the edit buttons
|
|
44
|
-
actions = /*#__PURE__*/ (0,
|
|
46
|
+
actions = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
45
47
|
children: [
|
|
46
|
-
/*#__PURE__*/ (0,
|
|
48
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
47
49
|
description: _constants.TOOLTIP_TEXT.editPanel,
|
|
48
|
-
children: /*#__PURE__*/ (0,
|
|
50
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(HeaderIconButton, {
|
|
49
51
|
"aria-label": _constants.ARIA_LABEL_TEXT.editPanel(title),
|
|
50
52
|
size: "small",
|
|
51
53
|
onClick: editHandlers.onEditPanelClick,
|
|
52
|
-
children: /*#__PURE__*/ (0,
|
|
54
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PencilOutline.default, {
|
|
53
55
|
fontSize: "inherit"
|
|
54
56
|
})
|
|
55
57
|
})
|
|
56
58
|
}),
|
|
57
|
-
/*#__PURE__*/ (0,
|
|
59
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
58
60
|
description: _constants.TOOLTIP_TEXT.duplicatePanel,
|
|
59
|
-
children: /*#__PURE__*/ (0,
|
|
61
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(HeaderIconButton, {
|
|
60
62
|
"aria-label": _constants.ARIA_LABEL_TEXT.duplicatePanel(title),
|
|
61
63
|
size: "small",
|
|
62
64
|
onClick: editHandlers.onDuplicatePanelClick,
|
|
63
|
-
children: /*#__PURE__*/ (0,
|
|
65
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ContentCopy.default, {
|
|
64
66
|
fontSize: "inherit",
|
|
65
67
|
sx: {
|
|
66
68
|
// Shrink this icon a little bit to look more consistent
|
|
@@ -70,23 +72,23 @@ function PanelHeader({ id , title: rawTitle , description: rawDescription , edit
|
|
|
70
72
|
})
|
|
71
73
|
})
|
|
72
74
|
}),
|
|
73
|
-
/*#__PURE__*/ (0,
|
|
75
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
74
76
|
description: _constants.TOOLTIP_TEXT.deletePanel,
|
|
75
|
-
children: /*#__PURE__*/ (0,
|
|
77
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(HeaderIconButton, {
|
|
76
78
|
"aria-label": _constants.ARIA_LABEL_TEXT.deletePanel(title),
|
|
77
79
|
size: "small",
|
|
78
80
|
onClick: editHandlers.onDeletePanelClick,
|
|
79
|
-
children: /*#__PURE__*/ (0,
|
|
81
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {
|
|
80
82
|
fontSize: "inherit"
|
|
81
83
|
})
|
|
82
84
|
})
|
|
83
85
|
}),
|
|
84
|
-
/*#__PURE__*/ (0,
|
|
86
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
85
87
|
description: _constants.TOOLTIP_TEXT.movePanel,
|
|
86
|
-
children: /*#__PURE__*/ (0,
|
|
88
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(HeaderIconButton, {
|
|
87
89
|
"aria-label": _constants.ARIA_LABEL_TEXT.movePanel(title),
|
|
88
90
|
size: "small",
|
|
89
|
-
children: /*#__PURE__*/ (0,
|
|
91
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DragVertical.default, {
|
|
90
92
|
className: "drag-handle",
|
|
91
93
|
sx: {
|
|
92
94
|
cursor: 'grab'
|
|
@@ -98,16 +100,16 @@ function PanelHeader({ id , title: rawTitle , description: rawDescription , edit
|
|
|
98
100
|
]
|
|
99
101
|
});
|
|
100
102
|
}
|
|
101
|
-
return /*#__PURE__*/ (0,
|
|
103
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CardHeader, {
|
|
102
104
|
id: id,
|
|
103
105
|
component: "header",
|
|
104
106
|
"aria-labelledby": titleElementId,
|
|
105
107
|
"aria-describedby": descriptionTooltipId,
|
|
106
108
|
disableTypography: true,
|
|
107
|
-
title: /*#__PURE__*/ (0,
|
|
109
|
+
title: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
108
110
|
direction: "row",
|
|
109
111
|
children: [
|
|
110
|
-
/*#__PURE__*/ (0,
|
|
112
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
111
113
|
id: titleElementId,
|
|
112
114
|
variant: "subtitle1",
|
|
113
115
|
sx: {
|
|
@@ -121,14 +123,14 @@ function PanelHeader({ id , title: rawTitle , description: rawDescription , edit
|
|
|
121
123
|
},
|
|
122
124
|
children: title
|
|
123
125
|
}),
|
|
124
|
-
description !== undefined && description.trim().length > 0 && /*#__PURE__*/ (0,
|
|
126
|
+
description !== undefined && description.trim().length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
125
127
|
id: descriptionTooltipId,
|
|
126
128
|
description: description,
|
|
127
129
|
enterDelay: 100,
|
|
128
|
-
children: /*#__PURE__*/ (0,
|
|
130
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(HeaderIconButton, {
|
|
129
131
|
"aria-label": "panel description",
|
|
130
132
|
size: "small",
|
|
131
|
-
children: /*#__PURE__*/ (0,
|
|
133
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_InformationOutline.default, {
|
|
132
134
|
"aria-describedby": "info-tooltip",
|
|
133
135
|
"aria-hidden": false,
|
|
134
136
|
fontSize: "inherit",
|
|
@@ -140,11 +142,15 @@ function PanelHeader({ id , title: rawTitle , description: rawDescription , edit
|
|
|
140
142
|
})
|
|
141
143
|
]
|
|
142
144
|
}),
|
|
143
|
-
action: /*#__PURE__*/ (0,
|
|
145
|
+
action: /*#__PURE__*/ (0, _jsxruntime.jsxs)(HeaderActionWrapper, {
|
|
144
146
|
direction: "row",
|
|
145
147
|
spacing: 0.25,
|
|
146
148
|
alignItems: "center",
|
|
147
|
-
children:
|
|
149
|
+
children: [
|
|
150
|
+
editHandlers === undefined && extra,
|
|
151
|
+
" ",
|
|
152
|
+
actions
|
|
153
|
+
]
|
|
148
154
|
}),
|
|
149
155
|
sx: (0, _components.combineSx)((theme)=>({
|
|
150
156
|
padding: theme.spacing(1),
|