@perses-dev/dashboards 0.52.0-beta.0 → 0.52.0-beta.2
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 → src/components}/Panel/Panel.js +83 -0
- package/dist/cjs/{components → src/components}/Panel/PanelActions.js +12 -6
- package/dist/cjs/{components → src/components}/Panel/PanelHeader.js +6 -3
- package/dist/cjs/{components → src/components}/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -1
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +2 -1
- package/dist/components/Panel/PanelActions.d.ts.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/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/src/components/AddGroupButton/AddGroupButton.js.map +1 -0
- package/dist/{components/QuerySummaryTable → src/components/AddGroupButton}/index.js.map +1 -1
- package/dist/src/components/AddPanelButton/AddPanelButton.js.map +1 -0
- package/dist/src/components/AddPanelButton/index.js.map +1 -0
- package/dist/src/components/Dashboard/Dashboard.js.map +1 -0
- package/dist/src/components/Dashboard/index.js.map +1 -0
- package/dist/src/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -0
- package/dist/src/components/DashboardStickyToolbar/index.js.map +1 -0
- package/dist/src/components/DashboardToolbar/DashboardToolbar.js.map +1 -0
- package/dist/src/components/DashboardToolbar/index.js.map +1 -0
- package/dist/src/components/Datasources/DatasourceEditor.js.map +1 -0
- package/dist/src/components/Datasources/EditDatasourcesButton.js.map +1 -0
- package/dist/{components/AddPanelButton → src/components/Datasources}/index.js.map +1 -1
- package/dist/src/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -0
- package/dist/{components/SaveDashboardButton → src/components/DeletePanelDialog}/index.js.map +1 -1
- package/dist/src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- package/dist/src/components/DeletePanelGroupDialog/index.js.map +1 -0
- package/dist/src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -0
- package/dist/src/components/DiscardChangesConfirmationDialog/index.js.map +1 -0
- package/dist/src/components/DownloadButton/DownloadButton.js.map +1 -0
- package/dist/src/components/DownloadButton/index.js.map +1 -0
- package/dist/src/components/DownloadButton/serializeDashboard.js.map +1 -0
- package/dist/src/components/EditButton/EditButton.js.map +1 -0
- package/dist/{context/VariableProvider → src/components/EditButton}/index.js.map +1 -1
- package/dist/src/components/EditJsonButton/EditJsonButton.js.map +1 -0
- package/dist/src/components/EditJsonButton/index.js.map +1 -0
- package/dist/src/components/EditJsonDialog/EditJsonDialog.js.map +1 -0
- package/dist/{components/DeletePanelDialog → src/components/EditJsonDialog}/index.js.map +1 -1
- package/dist/src/components/EmptyDashboard/EmptyDashboard.js.map +1 -0
- package/dist/src/components/EmptyDashboard/index.js.map +1 -0
- package/dist/src/components/GridLayout/GridContainer.js.map +1 -0
- package/dist/src/components/GridLayout/GridItemContent.js.map +1 -0
- package/dist/src/components/GridLayout/GridLayout.js.map +1 -0
- package/dist/src/components/GridLayout/GridTitle.js.map +1 -0
- package/dist/src/components/GridLayout/index.js.map +1 -0
- package/dist/src/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/{components → src/components}/Panel/Panel.js +85 -2
- package/dist/src/components/Panel/Panel.js.map +1 -0
- package/dist/{components → src/components}/Panel/PanelActions.js +12 -6
- package/dist/src/components/Panel/PanelActions.js.map +1 -0
- package/dist/src/components/Panel/PanelContent.js.map +1 -0
- package/dist/{components → src/components}/Panel/PanelHeader.js +6 -3
- package/dist/src/components/Panel/PanelHeader.js.map +1 -0
- package/dist/src/components/Panel/PanelLinks.js.map +1 -0
- package/dist/src/components/Panel/PanelPluginLoader.js.map +1 -0
- package/dist/{views/ViewDashboard → src/components/Panel}/index.js.map +1 -1
- package/dist/src/components/PanelDrawer/PanelDrawer.js.map +1 -0
- package/dist/src/components/PanelDrawer/PanelEditorForm.js.map +1 -0
- package/dist/src/components/PanelDrawer/PanelPreview.js.map +1 -0
- package/dist/{components/AddGroupButton → src/components/PanelDrawer}/index.js.map +1 -1
- package/dist/src/components/PanelDrawer/usePanelEditor.js.map +1 -0
- package/dist/src/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -0
- package/dist/src/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -0
- package/dist/src/components/PanelGroupDialog/index.js.map +1 -0
- package/dist/src/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -0
- package/dist/src/components/QuerySummaryTable/index.js.map +1 -0
- package/dist/{components → src/components}/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -1
- package/dist/src/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -0
- package/dist/{components/DiscardChangesConfirmationDialog → src/components/SaveChangesConfirmationDialog}/index.js.map +1 -1
- package/dist/src/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -0
- package/dist/src/components/SaveDashboardButton/index.js.map +1 -0
- package/dist/src/components/Variables/BuiltinVariableAccordions.js.map +1 -0
- package/dist/src/components/Variables/EditVariablesButton.js.map +1 -0
- package/dist/src/components/Variables/Variable.js.map +1 -0
- package/dist/src/components/Variables/VariableEditor.js.map +1 -0
- package/dist/src/components/Variables/VariableList.js.map +1 -0
- package/dist/src/components/Variables/index.js.map +1 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/{components/Datasources/index.js.map → src/constants/grid-layout-config.js.map} +1 -1
- package/dist/src/constants/index.js.map +1 -0
- package/dist/src/constants/styles.js.map +1 -0
- package/dist/src/constants/user-interface-text.js.map +1 -0
- package/dist/src/context/DashboardProvider/DashboardProvider.js.map +1 -0
- package/dist/src/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
- package/dist/src/context/DashboardProvider/common.js.map +1 -0
- package/dist/src/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
- package/dist/src/context/DashboardProvider/delete-panel-group-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/delete-panel-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/duplicate-panel-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/index.js.map +1 -0
- package/dist/src/context/DashboardProvider/panel-editor-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/panel-group-editor-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/panel-group-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/panel-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -0
- package/dist/src/context/DashboardProvider/view-panel-slice.js.map +1 -0
- package/dist/src/context/DatasourceStoreProvider.js.map +1 -0
- package/dist/src/context/VariableProvider/VariableProvider.js.map +1 -0
- package/dist/src/context/VariableProvider/hydrationUtils.js.map +1 -0
- package/dist/{components/DashboardToolbar → src/context/VariableProvider}/index.js.map +1 -1
- package/dist/src/context/VariableProvider/query-params.js.map +1 -0
- package/dist/src/context/VariableProvider/utils.js.map +1 -0
- package/dist/src/context/index.js.map +1 -0
- package/dist/src/context/useDashboard.js.map +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/test/dashboard-provider.js.map +1 -0
- package/dist/src/test/datasource-provider.js.map +1 -0
- package/dist/src/test/index.js.map +1 -0
- package/dist/src/test/plugin-registry.js.map +1 -0
- package/dist/src/test/render.js.map +1 -0
- package/dist/src/test/setup-tests.js.map +1 -0
- package/dist/src/test/testDashboard.js.map +1 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/panelUtils.js.map +1 -0
- package/dist/src/views/ViewDashboard/DashboardApp.js.map +1 -0
- package/dist/src/views/ViewDashboard/ViewDashboard.js.map +1 -0
- package/dist/{components/PanelDrawer → src/views/ViewDashboard}/index.js.map +1 -1
- package/dist/src/views/index.js.map +1 -0
- package/package.json +5 -5
- package/dist/components/AddGroupButton/AddGroupButton.js.map +0 -1
- package/dist/components/AddPanelButton/AddPanelButton.js.map +0 -1
- package/dist/components/Dashboard/Dashboard.js.map +0 -1
- package/dist/components/Dashboard/index.js.map +0 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +0 -1
- package/dist/components/DashboardStickyToolbar/index.js.map +0 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +0 -1
- package/dist/components/Datasources/DatasourceEditor.js.map +0 -1
- package/dist/components/Datasources/EditDatasourcesButton.js.map +0 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +0 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +0 -1
- package/dist/components/DeletePanelGroupDialog/index.js.map +0 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +0 -1
- package/dist/components/DownloadButton/DownloadButton.js.map +0 -1
- package/dist/components/DownloadButton/index.js.map +0 -1
- package/dist/components/DownloadButton/serializeDashboard.js.map +0 -1
- package/dist/components/EditButton/EditButton.js.map +0 -1
- package/dist/components/EditButton/index.js.map +0 -1
- package/dist/components/EditJsonButton/EditJsonButton.js.map +0 -1
- package/dist/components/EditJsonButton/index.js.map +0 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +0 -1
- package/dist/components/EditJsonDialog/index.js.map +0 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +0 -1
- package/dist/components/EmptyDashboard/index.js.map +0 -1
- package/dist/components/GridLayout/GridContainer.js.map +0 -1
- package/dist/components/GridLayout/GridItemContent.js.map +0 -1
- package/dist/components/GridLayout/GridLayout.js.map +0 -1
- package/dist/components/GridLayout/GridTitle.js.map +0 -1
- package/dist/components/GridLayout/index.js.map +0 -1
- package/dist/components/Panel/HeaderIconButton.js.map +0 -1
- package/dist/components/Panel/Panel.js.map +0 -1
- package/dist/components/Panel/PanelActions.js.map +0 -1
- package/dist/components/Panel/PanelContent.js.map +0 -1
- package/dist/components/Panel/PanelHeader.js.map +0 -1
- package/dist/components/Panel/PanelLinks.js.map +0 -1
- package/dist/components/Panel/PanelPluginLoader.js.map +0 -1
- package/dist/components/Panel/index.js.map +0 -1
- package/dist/components/PanelDrawer/PanelDrawer.js.map +0 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +0 -1
- package/dist/components/PanelDrawer/PanelPreview.js.map +0 -1
- package/dist/components/PanelDrawer/usePanelEditor.js.map +0 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +0 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +0 -1
- package/dist/components/PanelGroupDialog/index.js.map +0 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +0 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +0 -1
- package/dist/components/SaveChangesConfirmationDialog/index.js.map +0 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +0 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +0 -1
- package/dist/components/Variables/EditVariablesButton.js.map +0 -1
- package/dist/components/Variables/Variable.js.map +0 -1
- package/dist/components/Variables/VariableEditor.js.map +0 -1
- package/dist/components/Variables/VariableList.js.map +0 -1
- package/dist/components/Variables/index.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/constants/grid-layout-config.js.map +0 -1
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/styles.js.map +0 -1
- package/dist/constants/user-interface-text.js.map +0 -1
- package/dist/context/DashboardProvider/DashboardProvider.js.map +0 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +0 -1
- package/dist/context/DashboardProvider/common.js.map +0 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +0 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +0 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +0 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +0 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +0 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +0 -1
- package/dist/context/DashboardProvider/index.js.map +0 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +0 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +0 -1
- package/dist/context/DashboardProvider/panel-group-slice.js.map +0 -1
- package/dist/context/DashboardProvider/panel-slice.js.map +0 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +0 -1
- package/dist/context/DashboardProvider/view-panel-slice.js.map +0 -1
- package/dist/context/DatasourceStoreProvider.js.map +0 -1
- package/dist/context/VariableProvider/VariableProvider.js.map +0 -1
- package/dist/context/VariableProvider/hydrationUtils.js.map +0 -1
- package/dist/context/VariableProvider/query-params.js.map +0 -1
- package/dist/context/VariableProvider/utils.js.map +0 -1
- package/dist/context/index.js.map +0 -1
- package/dist/context/useDashboard.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/test/dashboard-provider.js.map +0 -1
- package/dist/test/datasource-provider.js.map +0 -1
- package/dist/test/index.js.map +0 -1
- package/dist/test/plugin-registry.js.map +0 -1
- package/dist/test/render.js.map +0 -1
- package/dist/test/setup-tests.js.map +0 -1
- package/dist/test/testDashboard.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/panelUtils.js.map +0 -1
- package/dist/views/ViewDashboard/DashboardApp.js.map +0 -1
- package/dist/views/ViewDashboard/ViewDashboard.js.map +0 -1
- package/dist/views/index.js.map +0 -1
- /package/dist/cjs/{components → src/components}/AddGroupButton/AddGroupButton.js +0 -0
- /package/dist/cjs/{components → src/components}/AddGroupButton/index.js +0 -0
- /package/dist/cjs/{components → src/components}/AddPanelButton/AddPanelButton.js +0 -0
- /package/dist/cjs/{components → src/components}/AddPanelButton/index.js +0 -0
- /package/dist/cjs/{components → src/components}/Dashboard/Dashboard.js +0 -0
- /package/dist/cjs/{components → src/components}/Dashboard/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -0
- /package/dist/cjs/{components → src/components}/DashboardStickyToolbar/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DashboardToolbar/DashboardToolbar.js +0 -0
- /package/dist/cjs/{components → src/components}/DashboardToolbar/index.js +0 -0
- /package/dist/cjs/{components → src/components}/Datasources/DatasourceEditor.js +0 -0
- /package/dist/cjs/{components → src/components}/Datasources/EditDatasourcesButton.js +0 -0
- /package/dist/cjs/{components → src/components}/Datasources/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DeletePanelDialog/DeletePanelDialog.js +0 -0
- /package/dist/cjs/{components → src/components}/DeletePanelDialog/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DeletePanelGroupDialog/DeletePanelGroupDialog.js +0 -0
- /package/dist/cjs/{components → src/components}/DeletePanelGroupDialog/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +0 -0
- /package/dist/cjs/{components → src/components}/DiscardChangesConfirmationDialog/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DownloadButton/DownloadButton.js +0 -0
- /package/dist/cjs/{components → src/components}/DownloadButton/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DownloadButton/serializeDashboard.js +0 -0
- /package/dist/cjs/{components → src/components}/EditButton/EditButton.js +0 -0
- /package/dist/cjs/{components → src/components}/EditButton/index.js +0 -0
- /package/dist/cjs/{components → src/components}/EditJsonButton/EditJsonButton.js +0 -0
- /package/dist/cjs/{components → src/components}/EditJsonButton/index.js +0 -0
- /package/dist/cjs/{components → src/components}/EditJsonDialog/EditJsonDialog.js +0 -0
- /package/dist/cjs/{components → src/components}/EditJsonDialog/index.js +0 -0
- /package/dist/cjs/{components → src/components}/EmptyDashboard/EmptyDashboard.js +0 -0
- /package/dist/cjs/{components → src/components}/EmptyDashboard/index.js +0 -0
- /package/dist/cjs/{components → src/components}/GridLayout/GridContainer.js +0 -0
- /package/dist/cjs/{components → src/components}/GridLayout/GridItemContent.js +0 -0
- /package/dist/cjs/{components → src/components}/GridLayout/GridLayout.js +0 -0
- /package/dist/cjs/{components → src/components}/GridLayout/GridTitle.js +0 -0
- /package/dist/cjs/{components → src/components}/GridLayout/index.js +0 -0
- /package/dist/cjs/{components → src/components}/Panel/HeaderIconButton.js +0 -0
- /package/dist/cjs/{components → src/components}/Panel/PanelContent.js +0 -0
- /package/dist/cjs/{components → src/components}/Panel/PanelLinks.js +0 -0
- /package/dist/cjs/{components → src/components}/Panel/PanelPluginLoader.js +0 -0
- /package/dist/cjs/{components → src/components}/Panel/index.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelDrawer/PanelDrawer.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelDrawer/PanelEditorForm.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelDrawer/PanelPreview.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelDrawer/index.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelDrawer/usePanelEditor.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelGroupDialog/PanelGroupDialog.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelGroupDialog/PanelGroupEditorForm.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelGroupDialog/index.js +0 -0
- /package/dist/cjs/{components → src/components}/QuerySummaryTable/QuerySummaryTable.js +0 -0
- /package/dist/cjs/{components → src/components}/QuerySummaryTable/index.js +0 -0
- /package/dist/cjs/{components → src/components}/SaveChangesConfirmationDialog/index.js +0 -0
- /package/dist/cjs/{components → src/components}/SaveDashboardButton/SaveDashboardButton.js +0 -0
- /package/dist/cjs/{components → src/components}/SaveDashboardButton/index.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/BuiltinVariableAccordions.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/EditVariablesButton.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/Variable.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/VariableEditor.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/VariableList.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/index.js +0 -0
- /package/dist/cjs/{components → src/components}/index.js +0 -0
- /package/dist/cjs/{constants → src/constants}/grid-layout-config.js +0 -0
- /package/dist/cjs/{constants → src/constants}/index.js +0 -0
- /package/dist/cjs/{constants → src/constants}/styles.js +0 -0
- /package/dist/cjs/{constants → src/constants}/user-interface-text.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/DashboardProvider.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/DashboardProviderWithQueryParams.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/common.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/dashboard-provider-api.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/delete-panel-group-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/delete-panel-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/discard-changes-dialog-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/duplicate-panel-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/edit-json-dialog-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/index.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/panel-editor-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/panel-group-editor-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/panel-group-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/panel-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/save-changes-dialog-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DashboardProvider/view-panel-slice.js +0 -0
- /package/dist/cjs/{context → src/context}/DatasourceStoreProvider.js +0 -0
- /package/dist/cjs/{context → src/context}/VariableProvider/VariableProvider.js +0 -0
- /package/dist/cjs/{context → src/context}/VariableProvider/hydrationUtils.js +0 -0
- /package/dist/cjs/{context → src/context}/VariableProvider/index.js +0 -0
- /package/dist/cjs/{context → src/context}/VariableProvider/query-params.js +0 -0
- /package/dist/cjs/{context → src/context}/VariableProvider/utils.js +0 -0
- /package/dist/cjs/{context → src/context}/index.js +0 -0
- /package/dist/cjs/{context → src/context}/useDashboard.js +0 -0
- /package/dist/cjs/{index.js → src/index.js} +0 -0
- /package/dist/cjs/{test → src/test}/dashboard-provider.js +0 -0
- /package/dist/cjs/{test → src/test}/datasource-provider.js +0 -0
- /package/dist/cjs/{test → src/test}/index.js +0 -0
- /package/dist/cjs/{test → src/test}/plugin-registry.js +0 -0
- /package/dist/cjs/{test → src/test}/render.js +0 -0
- /package/dist/cjs/{test → src/test}/setup-tests.js +0 -0
- /package/dist/cjs/{test → src/test}/testDashboard.js +0 -0
- /package/dist/cjs/{utils → src/utils}/index.js +0 -0
- /package/dist/cjs/{utils → src/utils}/panelUtils.js +0 -0
- /package/dist/cjs/{views → src/views}/ViewDashboard/DashboardApp.js +0 -0
- /package/dist/cjs/{views → src/views}/ViewDashboard/ViewDashboard.js +0 -0
- /package/dist/cjs/{views → src/views}/ViewDashboard/index.js +0 -0
- /package/dist/cjs/{views → src/views}/index.js +0 -0
- /package/dist/{components → src/components}/AddGroupButton/AddGroupButton.js +0 -0
- /package/dist/{components → src/components}/AddGroupButton/index.js +0 -0
- /package/dist/{components → src/components}/AddPanelButton/AddPanelButton.js +0 -0
- /package/dist/{components → src/components}/AddPanelButton/index.js +0 -0
- /package/dist/{components → src/components}/Dashboard/Dashboard.js +0 -0
- /package/dist/{components → src/components}/Dashboard/index.js +0 -0
- /package/dist/{components → src/components}/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -0
- /package/dist/{components → src/components}/DashboardStickyToolbar/index.js +0 -0
- /package/dist/{components → src/components}/DashboardToolbar/DashboardToolbar.js +0 -0
- /package/dist/{components → src/components}/DashboardToolbar/index.js +0 -0
- /package/dist/{components → src/components}/Datasources/DatasourceEditor.js +0 -0
- /package/dist/{components → src/components}/Datasources/EditDatasourcesButton.js +0 -0
- /package/dist/{components → src/components}/Datasources/index.js +0 -0
- /package/dist/{components → src/components}/DeletePanelDialog/DeletePanelDialog.js +0 -0
- /package/dist/{components → src/components}/DeletePanelDialog/index.js +0 -0
- /package/dist/{components → src/components}/DeletePanelGroupDialog/DeletePanelGroupDialog.js +0 -0
- /package/dist/{components → src/components}/DeletePanelGroupDialog/index.js +0 -0
- /package/dist/{components → src/components}/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +0 -0
- /package/dist/{components → src/components}/DiscardChangesConfirmationDialog/index.js +0 -0
- /package/dist/{components → src/components}/DownloadButton/DownloadButton.js +0 -0
- /package/dist/{components → src/components}/DownloadButton/index.js +0 -0
- /package/dist/{components → src/components}/DownloadButton/serializeDashboard.js +0 -0
- /package/dist/{components → src/components}/EditButton/EditButton.js +0 -0
- /package/dist/{components → src/components}/EditButton/index.js +0 -0
- /package/dist/{components → src/components}/EditJsonButton/EditJsonButton.js +0 -0
- /package/dist/{components → src/components}/EditJsonButton/index.js +0 -0
- /package/dist/{components → src/components}/EditJsonDialog/EditJsonDialog.js +0 -0
- /package/dist/{components → src/components}/EditJsonDialog/index.js +0 -0
- /package/dist/{components → src/components}/EmptyDashboard/EmptyDashboard.js +0 -0
- /package/dist/{components → src/components}/EmptyDashboard/index.js +0 -0
- /package/dist/{components → src/components}/GridLayout/GridContainer.js +0 -0
- /package/dist/{components → src/components}/GridLayout/GridItemContent.js +0 -0
- /package/dist/{components → src/components}/GridLayout/GridLayout.js +0 -0
- /package/dist/{components → src/components}/GridLayout/GridTitle.js +0 -0
- /package/dist/{components → src/components}/GridLayout/index.js +0 -0
- /package/dist/{components → src/components}/Panel/HeaderIconButton.js +0 -0
- /package/dist/{components → src/components}/Panel/PanelContent.js +0 -0
- /package/dist/{components → src/components}/Panel/PanelLinks.js +0 -0
- /package/dist/{components → src/components}/Panel/PanelPluginLoader.js +0 -0
- /package/dist/{components → src/components}/Panel/index.js +0 -0
- /package/dist/{components → src/components}/PanelDrawer/PanelDrawer.js +0 -0
- /package/dist/{components → src/components}/PanelDrawer/PanelEditorForm.js +0 -0
- /package/dist/{components → src/components}/PanelDrawer/PanelPreview.js +0 -0
- /package/dist/{components → src/components}/PanelDrawer/index.js +0 -0
- /package/dist/{components → src/components}/PanelDrawer/usePanelEditor.js +0 -0
- /package/dist/{components → src/components}/PanelGroupDialog/PanelGroupDialog.js +0 -0
- /package/dist/{components → src/components}/PanelGroupDialog/PanelGroupEditorForm.js +0 -0
- /package/dist/{components → src/components}/PanelGroupDialog/index.js +0 -0
- /package/dist/{components → src/components}/QuerySummaryTable/QuerySummaryTable.js +0 -0
- /package/dist/{components → src/components}/QuerySummaryTable/index.js +0 -0
- /package/dist/{components → src/components}/SaveChangesConfirmationDialog/index.js +0 -0
- /package/dist/{components → src/components}/SaveDashboardButton/SaveDashboardButton.js +0 -0
- /package/dist/{components → src/components}/SaveDashboardButton/index.js +0 -0
- /package/dist/{components → src/components}/Variables/BuiltinVariableAccordions.js +0 -0
- /package/dist/{components → src/components}/Variables/EditVariablesButton.js +0 -0
- /package/dist/{components → src/components}/Variables/Variable.js +0 -0
- /package/dist/{components → src/components}/Variables/VariableEditor.js +0 -0
- /package/dist/{components → src/components}/Variables/VariableList.js +0 -0
- /package/dist/{components → src/components}/Variables/index.js +0 -0
- /package/dist/{components → src/components}/index.js +0 -0
- /package/dist/{constants → src/constants}/grid-layout-config.js +0 -0
- /package/dist/{constants → src/constants}/index.js +0 -0
- /package/dist/{constants → src/constants}/styles.js +0 -0
- /package/dist/{constants → src/constants}/user-interface-text.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/DashboardProvider.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/DashboardProviderWithQueryParams.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/common.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/dashboard-provider-api.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/delete-panel-group-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/delete-panel-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/discard-changes-dialog-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/duplicate-panel-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/edit-json-dialog-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/index.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/panel-editor-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/panel-group-editor-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/panel-group-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/panel-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/save-changes-dialog-slice.js +0 -0
- /package/dist/{context → src/context}/DashboardProvider/view-panel-slice.js +0 -0
- /package/dist/{context → src/context}/DatasourceStoreProvider.js +0 -0
- /package/dist/{context → src/context}/VariableProvider/VariableProvider.js +0 -0
- /package/dist/{context → src/context}/VariableProvider/hydrationUtils.js +0 -0
- /package/dist/{context → src/context}/VariableProvider/index.js +0 -0
- /package/dist/{context → src/context}/VariableProvider/query-params.js +0 -0
- /package/dist/{context → src/context}/VariableProvider/utils.js +0 -0
- /package/dist/{context → src/context}/index.js +0 -0
- /package/dist/{context → src/context}/useDashboard.js +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{test → src/test}/dashboard-provider.js +0 -0
- /package/dist/{test → src/test}/datasource-provider.js +0 -0
- /package/dist/{test → src/test}/index.js +0 -0
- /package/dist/{test → src/test}/plugin-registry.js +0 -0
- /package/dist/{test → src/test}/render.js +0 -0
- /package/dist/{test → src/test}/setup-tests.js +0 -0
- /package/dist/{test → src/test}/testDashboard.js +0 -0
- /package/dist/{utils → src/utils}/index.js +0 -0
- /package/dist/{utils → src/utils}/panelUtils.js +0 -0
- /package/dist/{views → src/views}/ViewDashboard/DashboardApp.js +0 -0
- /package/dist/{views → src/views}/ViewDashboard/ViewDashboard.js +0 -0
- /package/dist/{views → src/views}/ViewDashboard/index.js +0 -0
- /package/dist/{views → src/views}/index.js +0 -0
|
@@ -54,6 +54,88 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
54
54
|
]);
|
|
55
55
|
const chartsTheme = (0, _components.useChartsTheme)();
|
|
56
56
|
const { queryResults } = (0, _pluginsystem.useDataQueriesContext)();
|
|
57
|
+
const { getPlugin } = (0, _pluginsystem.usePluginRegistry)();
|
|
58
|
+
const panelPropsForActions = (0, _react.useMemo)(()=>{
|
|
59
|
+
return {
|
|
60
|
+
spec: definition.spec.plugin.spec,
|
|
61
|
+
queryResults: queryResults.map((query)=>({
|
|
62
|
+
definition: query.definition,
|
|
63
|
+
data: query.data
|
|
64
|
+
})),
|
|
65
|
+
contentDimensions,
|
|
66
|
+
definition
|
|
67
|
+
};
|
|
68
|
+
}, [
|
|
69
|
+
definition,
|
|
70
|
+
contentDimensions,
|
|
71
|
+
queryResults
|
|
72
|
+
]);
|
|
73
|
+
// Load plugin actions from the plugin
|
|
74
|
+
const [pluginActions, setPluginActions] = (0, _react.useState)([]);
|
|
75
|
+
(0, _react.useEffect)(()=>{
|
|
76
|
+
let cancelled = false;
|
|
77
|
+
const loadPluginActions = async ()=>{
|
|
78
|
+
const panelPluginKind = definition.spec.plugin.kind;
|
|
79
|
+
const panelProps = panelPropsForActions;
|
|
80
|
+
if (!panelPluginKind || !panelProps) {
|
|
81
|
+
if (!cancelled) {
|
|
82
|
+
setPluginActions([]);
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
// Add defensive check for getPlugin availability
|
|
88
|
+
if (!getPlugin || typeof getPlugin !== 'function') {
|
|
89
|
+
if (!cancelled) {
|
|
90
|
+
setPluginActions([]);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const plugin = await getPlugin('Panel', panelPluginKind);
|
|
95
|
+
if (cancelled) return;
|
|
96
|
+
// More defensive checking for plugin and actions
|
|
97
|
+
if (!plugin || typeof plugin !== 'object' || !plugin.actions || !Array.isArray(plugin.actions) || plugin.actions.length === 0) {
|
|
98
|
+
if (!cancelled) {
|
|
99
|
+
setPluginActions([]);
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
// Render plugin actions in header location
|
|
104
|
+
const headerActions = plugin.actions.filter((action)=>!action.location || action.location === 'header').map((action, index)=>{
|
|
105
|
+
const ActionComponent = action.component;
|
|
106
|
+
try {
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(ActionComponent, {
|
|
109
|
+
...panelProps
|
|
110
|
+
}, `plugin-action-${index}`);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.warn(`Failed to render plugin action ${index}:`, error);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}).filter((item)=>Boolean(item));
|
|
116
|
+
if (!cancelled) {
|
|
117
|
+
setPluginActions(headerActions);
|
|
118
|
+
}
|
|
119
|
+
} catch (error) {
|
|
120
|
+
if (!cancelled) {
|
|
121
|
+
console.warn('Failed to load plugin actions:', error);
|
|
122
|
+
setPluginActions([]);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
// Use setTimeout to defer the async operation to the next tick
|
|
127
|
+
const timeoutId = setTimeout(()=>{
|
|
128
|
+
loadPluginActions();
|
|
129
|
+
}, 0);
|
|
130
|
+
return ()=>{
|
|
131
|
+
cancelled = true;
|
|
132
|
+
clearTimeout(timeoutId);
|
|
133
|
+
};
|
|
134
|
+
}, [
|
|
135
|
+
definition.spec.plugin.kind,
|
|
136
|
+
panelPropsForActions,
|
|
137
|
+
getPlugin
|
|
138
|
+
]);
|
|
57
139
|
const handleMouseEnter = (e)=>{
|
|
58
140
|
onMouseEnter?.(e);
|
|
59
141
|
};
|
|
@@ -91,6 +173,7 @@ const Panel = /*#__PURE__*/ (0, _react.memo)(function Panel(props) {
|
|
|
91
173
|
readHandlers: readHandlers,
|
|
92
174
|
editHandlers: editHandlers,
|
|
93
175
|
links: definition.spec.links,
|
|
176
|
+
pluginActions: pluginActions,
|
|
94
177
|
sx: {
|
|
95
178
|
paddingX: `${chartsTheme.container.padding.default}px`
|
|
96
179
|
}
|
|
@@ -47,7 +47,7 @@ const ConditionalBox = (0, _material.styled)(_material.Box)({
|
|
|
47
47
|
flexGrow: 1,
|
|
48
48
|
justifyContent: 'flex-end'
|
|
49
49
|
});
|
|
50
|
-
const PanelActions = ({ editHandlers, readHandlers, extra, title, description, descriptionTooltipId, links, queryResults })=>{
|
|
50
|
+
const PanelActions = ({ editHandlers, readHandlers, extra, title, description, descriptionTooltipId, links, queryResults, pluginActions = [] })=>{
|
|
51
51
|
const descriptionAction = (0, _react.useMemo)(()=>{
|
|
52
52
|
if (description && description.trim().length > 0) {
|
|
53
53
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
@@ -82,8 +82,6 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
82
82
|
const isFetching = queryResults.some((q)=>q.isFetching);
|
|
83
83
|
const queryErrors = queryResults.filter((q)=>q.error);
|
|
84
84
|
if (isFetching && hasData) {
|
|
85
|
-
// If the panel has no data, the panel content will show the loading overlay.
|
|
86
|
-
// Therefore, show the circular loading indicator only in case the panel doesn't display the loading overlay already.
|
|
87
85
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {
|
|
88
86
|
"aria-label": "loading",
|
|
89
87
|
size: "1.125rem"
|
|
@@ -239,6 +237,7 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
239
237
|
" ",
|
|
240
238
|
readActions,
|
|
241
239
|
" ",
|
|
240
|
+
pluginActions,
|
|
242
241
|
editActions
|
|
243
242
|
]
|
|
244
243
|
}),
|
|
@@ -269,9 +268,13 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
269
268
|
extraActions,
|
|
270
269
|
" ",
|
|
271
270
|
readActions,
|
|
272
|
-
/*#__PURE__*/ (0, _jsxruntime.
|
|
271
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(OverflowMenu, {
|
|
273
272
|
title: title,
|
|
274
|
-
children:
|
|
273
|
+
children: [
|
|
274
|
+
editActions,
|
|
275
|
+
" ",
|
|
276
|
+
pluginActions
|
|
277
|
+
]
|
|
275
278
|
}),
|
|
276
279
|
moveAction
|
|
277
280
|
]
|
|
@@ -304,7 +307,10 @@ const PanelActions = ({ editHandlers, readHandlers, extra, title, description, d
|
|
|
304
307
|
readActions,
|
|
305
308
|
" ",
|
|
306
309
|
editActions,
|
|
307
|
-
|
|
310
|
+
pluginActions.length <= 1 ? pluginActions : /*#__PURE__*/ (0, _jsxruntime.jsx)(OverflowMenu, {
|
|
311
|
+
title: title,
|
|
312
|
+
children: pluginActions
|
|
313
|
+
}),
|
|
308
314
|
moveAction
|
|
309
315
|
]
|
|
310
316
|
})
|
|
@@ -26,7 +26,7 @@ const _components = require("@perses-dev/components");
|
|
|
26
26
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
27
27
|
const _constants = require("../../constants");
|
|
28
28
|
const _PanelActions = require("./PanelActions");
|
|
29
|
-
function PanelHeader({ id, title: rawTitle, description: rawDescription, links, queryResults, readHandlers, editHandlers, sx, extra, ...rest }) {
|
|
29
|
+
function PanelHeader({ id, title: rawTitle, description: rawDescription, links, queryResults, readHandlers, editHandlers, sx, extra, pluginActions, ...rest }) {
|
|
30
30
|
const titleElementId = `${id}-title`;
|
|
31
31
|
const descriptionTooltipId = `${id}-description`;
|
|
32
32
|
const title = (0, _pluginsystem.useReplaceVariablesInString)(rawTitle);
|
|
@@ -39,6 +39,8 @@ function PanelHeader({ id, title: rawTitle, description: rawDescription, links,
|
|
|
39
39
|
disableTypography: true,
|
|
40
40
|
title: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
41
41
|
direction: "row",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
height: "var(--panel-header-height, 30px)",
|
|
42
44
|
children: [
|
|
43
45
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
44
46
|
id: titleElementId,
|
|
@@ -59,10 +61,11 @@ function PanelHeader({ id, title: rawTitle, description: rawDescription, links,
|
|
|
59
61
|
description: description,
|
|
60
62
|
descriptionTooltipId: descriptionTooltipId,
|
|
61
63
|
links: links,
|
|
62
|
-
queryResults: queryResults,
|
|
63
64
|
readHandlers: readHandlers,
|
|
64
65
|
editHandlers: editHandlers,
|
|
65
|
-
extra: extra
|
|
66
|
+
extra: extra,
|
|
67
|
+
queryResults: queryResults,
|
|
68
|
+
pluginActions: pluginActions
|
|
66
69
|
})
|
|
67
70
|
]
|
|
68
71
|
}),
|
|
@@ -27,6 +27,7 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
27
27
|
const _core = require("@perses-dev/core");
|
|
28
28
|
const _components = require("@perses-dev/components");
|
|
29
29
|
const _context = require("../../context");
|
|
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?';
|
|
30
31
|
const SaveChangesConfirmationDialog = ()=>{
|
|
31
32
|
const { saveChangesConfirmationDialog: dialog } = (0, _context.useSaveChangesConfirmationDialog)();
|
|
32
33
|
const isSavedDurationModified = dialog?.isSavedDurationModified ?? true;
|
|
@@ -52,7 +53,7 @@ const SaveChangesConfirmationDialog = ()=>{
|
|
|
52
53
|
children: [
|
|
53
54
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
54
55
|
marginBottom: 2,
|
|
55
|
-
children: dialog.description ||
|
|
56
|
+
children: dialog.description || SAVE_DEFAULTS_DIALOG_TEXT
|
|
56
57
|
}),
|
|
57
58
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.FormGroup, {
|
|
58
59
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/Panel.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAqB,SAAS,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/Panel.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAqB,SAAS,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAsC,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,SAAS,CAAC;IACtD,UAAU,EAAE,eAAe,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,SAAS,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,kDAkMhB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { QueryData } from '@perses-dev/plugin-system';
|
|
3
3
|
import { Link } from '@perses-dev/core';
|
|
4
4
|
export interface PanelActionsProps {
|
|
@@ -17,6 +17,7 @@ export interface PanelActionsProps {
|
|
|
17
17
|
onViewPanelClick: () => void;
|
|
18
18
|
};
|
|
19
19
|
queryResults: QueryData[];
|
|
20
|
+
pluginActions?: ReactNode[];
|
|
20
21
|
}
|
|
21
22
|
export declare const PanelActions: React.FC<PanelActionsProps>;
|
|
22
23
|
//# sourceMappingURL=PanelActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelActions.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelActions.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PanelActions.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelActions.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAqC,SAAS,EAAqB,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAUtD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAWxC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE;QACb,gBAAgB,EAAE,MAAM,IAAI,CAAC;QAC7B,qBAAqB,EAAE,MAAM,IAAI,CAAC;QAClC,kBAAkB,EAAE,MAAM,IAAI,CAAC;KAChC,CAAC;IACF,YAAY,CAAC,EAAE;QACb,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,MAAM,IAAI,CAAC;KAC9B,CAAC;IACF,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;CAC7B;AASD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA4MpD,CAAC"}
|
|
@@ -13,7 +13,8 @@ export interface PanelHeaderProps extends Omit<CardHeaderProps, OmittedProps> {
|
|
|
13
13
|
queryResults: QueryData[];
|
|
14
14
|
readHandlers?: PanelActionsProps['readHandlers'];
|
|
15
15
|
editHandlers?: PanelActionsProps['editHandlers'];
|
|
16
|
+
pluginActions?: ReactNode[];
|
|
16
17
|
}
|
|
17
|
-
export declare function PanelHeader({ id, title: rawTitle, description: rawDescription, links, queryResults, readHandlers, editHandlers, sx, extra, ...rest }: PanelHeaderProps): ReactElement;
|
|
18
|
+
export declare function PanelHeader({ id, title: rawTitle, description: rawDescription, links, queryResults, readHandlers, editHandlers, sx, extra, pluginActions, ...rest }: PanelHeaderProps): ReactElement;
|
|
18
19
|
export {};
|
|
19
20
|
//# sourceMappingURL=PanelHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelHeader.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAc,eAAe,EAAqB,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,SAAS,EAA+B,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,KAAK,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAE1E,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelHeader.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAc,eAAe,EAAqB,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,SAAS,EAA+B,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,KAAK,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAE1E,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;CAC7B;AAED,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,cAAc,EAC3B,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,EAAE,EACF,KAAK,EACL,aAAa,EACb,GAAG,IAAI,EACR,EAAE,gBAAgB,GAAG,YAAY,CA2DjC"}
|
package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveChangesConfirmationDialog.d.ts","sourceRoot":"","sources":["../../../src/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SaveChangesConfirmationDialog.d.ts","sourceRoot":"","sources":["../../../src/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAU/C,eAAO,MAAM,6BAA6B,QAAO,YAqEhD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/AddGroupButton/AddGroupButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport AddGroupIcon from 'mdi-material-ui/PlusBoxOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport const AddGroupButton = (): ReactElement => {\n const { openAddPanelGroup } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addGroup}>\n <Button\n startIcon={<AddGroupIcon />}\n onClick={openAddPanelGroup}\n aria-label={TOOLTIP_TEXT.addGroup}\n sx={editButtonStyle}\n >\n Panel Group\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddGroupIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddGroupButton","openAddPanelGroup","description","addGroup","startIcon","onClick","aria-label","sx"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,kBAAkB,iCAAiC;AAC1D,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAEpD,OAAO,MAAMC,iBAAiB;IAC5B,MAAM,EAAEC,iBAAiB,EAAE,GAAGF;IAE9B,qBACE,KAACH;QAAYM,aAAaL,aAAaM,QAAQ;kBAC7C,cAAA,KAACT;YACCU,yBAAW,KAACT;YACZU,SAASJ;YACTK,cAAYT,aAAaM,QAAQ;YACjCI,IAAIT;sBACL;;;AAKP,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/AddGroupButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AddGroupButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/AddPanelButton/AddPanelButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button, ButtonProps } from '@mui/material';\nimport AddPanelIcon from 'mdi-material-ui/ChartBoxPlusOutline';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboardActions } from '../../context';\n\nexport interface AddPanelButtonProps extends Pick<ButtonProps, 'fullWidth'> {\n /**\n * The variant to use to display the button.\n */\n variant?: 'text' | 'outlined';\n\n /**\n * The color to use to display the button.\n */\n color?: 'primary' | 'secondary';\n\n /**\n * The label used inside the button.\n */\n label?: string;\n}\n\nexport const AddPanelButton = ({\n variant = 'text',\n color = 'primary',\n label = 'Panel',\n fullWidth,\n}: AddPanelButtonProps): ReactElement => {\n const { openAddPanel } = useDashboardActions();\n\n return (\n <InfoTooltip description={TOOLTIP_TEXT.addPanel}>\n <Button\n startIcon={<AddPanelIcon />}\n onClick={openAddPanel}\n aria-label={TOOLTIP_TEXT.addPanel}\n variant={variant}\n color={color}\n fullWidth={fullWidth}\n sx={editButtonStyle}\n >\n {label}\n </Button>\n </InfoTooltip>\n );\n};\n"],"names":["Button","AddPanelIcon","InfoTooltip","TOOLTIP_TEXT","editButtonStyle","useDashboardActions","AddPanelButton","variant","color","label","fullWidth","openAddPanel","description","addPanel","startIcon","onClick","aria-label","sx"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqB,gBAAgB;AACpD,OAAOC,kBAAkB,sCAAsC;AAC/D,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,mBAAmB,QAAQ,gBAAgB;AAmBpD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,UAAU,MAAM,EAChBC,QAAQ,SAAS,EACjBC,QAAQ,OAAO,EACfC,SAAS,EACW;IACpB,MAAM,EAAEC,YAAY,EAAE,GAAGN;IAEzB,qBACE,KAACH;QAAYU,aAAaT,aAAaU,QAAQ;kBAC7C,cAAA,KAACb;YACCc,yBAAW,KAACb;YACZc,SAASJ;YACTK,cAAYb,aAAaU,QAAQ;YACjCN,SAASA;YACTC,OAAOA;YACPE,WAAWA;YACXO,IAAIb;sBAEHK;;;AAIT,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/AddPanelButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AddPanelButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Dashboard/Dashboard.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { ReactElement, useRef } from 'react';\nimport { usePanelGroupIds } from '../../context';\nimport { GridLayout } from '../GridLayout';\nimport { EmptyDashboard, EmptyDashboardProps } from '../EmptyDashboard';\nimport { PanelOptions } from '../Panel';\nexport type DashboardProps = BoxProps & {\n /**\n * Props for `EmptyDashboard` component that will be rendered when the dashboard\n * is empty (i.e. has no panel groups). If not specified, the defaults will\n * be used.\n */\n emptyDashboardProps?: EmptyDashboardProps;\n panelOptions?: PanelOptions;\n};\nconst HEADER_HEIGHT = 165; // Approximate height of the header in dashboard view (including the navbar and variables toolbar)\n\n/**\n * Renders a Dashboard for the provided Dashboard spec.\n */\nexport function Dashboard({ emptyDashboardProps, panelOptions, ...boxProps }: DashboardProps): ReactElement {\n const panelGroupIds = usePanelGroupIds();\n const boxRef = useRef<HTMLDivElement>(null);\n const isEmpty = !panelGroupIds.length;\n const dashboardTopPosition = boxRef.current?.getBoundingClientRect().top ?? HEADER_HEIGHT;\n const panelFullHeight = window.innerHeight - dashboardTopPosition - window.scrollY;\n\n return (\n <Box {...boxProps} sx={{ height: '100%' }} ref={boxRef}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n {isEmpty && (\n <Box sx={{ height: '100%', display: 'flex', alignItems: 'center' }}>\n <EmptyDashboard {...emptyDashboardProps} />\n </Box>\n )}\n {!isEmpty &&\n panelGroupIds.map((panelGroupId) => (\n <GridLayout\n key={panelGroupId}\n panelGroupId={panelGroupId}\n panelOptions={panelOptions}\n panelFullHeight={panelFullHeight}\n />\n ))}\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","ErrorBoundary","ErrorAlert","useRef","usePanelGroupIds","GridLayout","EmptyDashboard","HEADER_HEIGHT","Dashboard","emptyDashboardProps","panelOptions","boxProps","panelGroupIds","boxRef","isEmpty","length","dashboardTopPosition","current","getBoundingClientRect","top","panelFullHeight","window","innerHeight","scrollY","sx","height","ref","FallbackComponent","display","alignItems","map","panelGroupId"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAkB,gBAAgB;AAC9C,SAASC,aAAa,EAAEC,UAAU,QAAQ,yBAAyB;AACnE,SAAuBC,MAAM,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,cAAc,QAA6B,oBAAoB;AAWxE,MAAMC,gBAAgB,KAAK,kGAAkG;AAE7H;;CAEC,GACD,OAAO,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,YAAY,EAAE,GAAGC,UAA0B;IAC1F,MAAMC,gBAAgBR;IACtB,MAAMS,SAASV,OAAuB;IACtC,MAAMW,UAAU,CAACF,cAAcG,MAAM;IACrC,MAAMC,uBAAuBH,OAAOI,OAAO,EAAEC,wBAAwBC,OAAOZ;IAC5E,MAAMa,kBAAkBC,OAAOC,WAAW,GAAGN,uBAAuBK,OAAOE,OAAO;IAElF,qBACE,KAACvB;QAAK,GAAGW,QAAQ;QAAEa,IAAI;YAAEC,QAAQ;QAAO;QAAGC,KAAKb;kBAC9C,cAAA,MAACZ;YAAc0B,mBAAmBzB;;gBAC/BY,yBACC,KAACd;oBAAIwB,IAAI;wBAAEC,QAAQ;wBAAQG,SAAS;wBAAQC,YAAY;oBAAS;8BAC/D,cAAA,KAACvB;wBAAgB,GAAGG,mBAAmB;;;gBAG1C,CAACK,WACAF,cAAckB,GAAG,CAAC,CAACC,6BACjB,KAAC1B;wBAEC0B,cAAcA;wBACdrB,cAAcA;wBACdU,iBAAiBA;uBAHZW;;;;AASnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Dashboard/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './Dashboard';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DashboardStickyToolbar/DashboardStickyToolbar.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState } from 'react';\nimport {\n AppBar,\n Box,\n IconButton,\n Stack,\n SxProps,\n Theme,\n useMediaQuery,\n useScrollTrigger,\n useTheme,\n} from '@mui/material';\nimport PinOutline from 'mdi-material-ui/PinOutline';\nimport PinOffOutline from 'mdi-material-ui/PinOffOutline';\nimport { TimeRangeControls } from '@perses-dev/plugin-system';\nimport { VariableList } from '../Variables';\n\ninterface DashboardStickyToolbarProps {\n initialVariableIsSticky?: boolean;\n sx?: SxProps<Theme>;\n}\n\nexport function DashboardStickyToolbar(props: DashboardStickyToolbarProps): ReactElement {\n const [isPin, setIsPin] = useState(props.initialVariableIsSticky);\n\n const scrollTrigger = useScrollTrigger({ disableHysteresis: true });\n const isSticky = scrollTrigger && props.initialVariableIsSticky && isPin;\n\n const isBiggerThanMd = useMediaQuery(useTheme().breakpoints.up('md'));\n\n return (\n // marginBottom={-1} counteracts the marginBottom={1} on every variable input.\n // The margin on the inputs is for spacing between inputs, but is not meant to add space to bottom of the container.\n <Box marginBottom={-1} data-testid=\"variable-list\">\n <AppBar\n color=\"inherit\"\n position={isSticky ? 'fixed' : 'static'}\n elevation={isSticky ? 4 : 0}\n sx={{ backgroundColor: 'inherit', ...props.sx }}\n >\n <Box\n display=\"flex\"\n justifyContent=\"space-between\"\n sx={{\n flexDirection: isBiggerThanMd ? 'row' : 'column',\n }}\n >\n <Box\n display=\"flex\"\n flexWrap={!isSticky && isBiggerThanMd ? 'wrap' : 'nowrap'}\n maxWidth={isSticky || !isBiggerThanMd ? '100vw' : '100%'}\n maxHeight=\"150px\" // Limit the vertical space used to ~3 rows of variables\n pt={1}\n pl={isSticky ? 1 : 0}\n mt={isSticky && isBiggerThanMd ? 0.5 : 0}\n ml={isSticky && isBiggerThanMd ? 0.5 : 0}\n sx={{\n overflowX: !isSticky && isBiggerThanMd ? 'hidden' : 'auto',\n // Firefox:\n scrollbarWidth: 'thin',\n // Safari and Chrome:\n '&::-webkit-scrollbar': {\n height: '8px',\n backgroundColor: (theme) => theme.palette.grey['300'],\n },\n '&::-webkit-scrollbar-thumb': {\n background: (theme) => theme.palette.grey['600'],\n },\n }}\n gap={1}\n >\n <VariableList />\n {props.initialVariableIsSticky && (\n <IconButton style={{ width: 'fit-content', height: 'fit-content' }} onClick={() => setIsPin(!isPin)}>\n {isPin ? <PinOutline /> : <PinOffOutline />}\n </IconButton>\n )}\n </Box>\n {isSticky && (\n <Stack\n m={isBiggerThanMd ? 1.5 : 1}\n mt={isBiggerThanMd ? 1.5 : 0}\n ml={isBiggerThanMd ? 1.5 : 'auto'}\n direction=\"row\"\n justifyContent=\"end\"\n >\n <TimeRangeControls />\n </Stack>\n )}\n </Box>\n </AppBar>\n </Box>\n );\n}\n"],"names":["useState","AppBar","Box","IconButton","Stack","useMediaQuery","useScrollTrigger","useTheme","PinOutline","PinOffOutline","TimeRangeControls","VariableList","DashboardStickyToolbar","props","isPin","setIsPin","initialVariableIsSticky","scrollTrigger","disableHysteresis","isSticky","isBiggerThanMd","breakpoints","up","marginBottom","data-testid","color","position","elevation","sx","backgroundColor","display","justifyContent","flexDirection","flexWrap","maxWidth","maxHeight","pt","pl","mt","ml","overflowX","scrollbarWidth","height","theme","palette","grey","background","gap","style","width","onClick","m","direction"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SACEC,MAAM,EACNC,GAAG,EACHC,UAAU,EACVC,KAAK,EAGLC,aAAa,EACbC,gBAAgB,EAChBC,QAAQ,QACH,gBAAgB;AACvB,OAAOC,gBAAgB,6BAA6B;AACpD,OAAOC,mBAAmB,gCAAgC;AAC1D,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,YAAY,QAAQ,eAAe;AAO5C,OAAO,SAASC,uBAAuBC,KAAkC;IACvE,MAAM,CAACC,OAAOC,SAAS,GAAGf,SAASa,MAAMG,uBAAuB;IAEhE,MAAMC,gBAAgBX,iBAAiB;QAAEY,mBAAmB;IAAK;IACjE,MAAMC,WAAWF,iBAAiBJ,MAAMG,uBAAuB,IAAIF;IAEnE,MAAMM,iBAAiBf,cAAcE,WAAWc,WAAW,CAACC,EAAE,CAAC;IAE/D,OACE,8EAA8E;IAC9E,oHAAoH;kBACpH,KAACpB;QAAIqB,cAAc,CAAC;QAAGC,eAAY;kBACjC,cAAA,KAACvB;YACCwB,OAAM;YACNC,UAAUP,WAAW,UAAU;YAC/BQ,WAAWR,WAAW,IAAI;YAC1BS,IAAI;gBAAEC,iBAAiB;gBAAW,GAAGhB,MAAMe,EAAE;YAAC;sBAE9C,cAAA,MAAC1B;gBACC4B,SAAQ;gBACRC,gBAAe;gBACfH,IAAI;oBACFI,eAAeZ,iBAAiB,QAAQ;gBAC1C;;kCAEA,MAAClB;wBACC4B,SAAQ;wBACRG,UAAU,CAACd,YAAYC,iBAAiB,SAAS;wBACjDc,UAAUf,YAAY,CAACC,iBAAiB,UAAU;wBAClDe,WAAU,QAAQ,wDAAwD;;wBAC1EC,IAAI;wBACJC,IAAIlB,WAAW,IAAI;wBACnBmB,IAAInB,YAAYC,iBAAiB,MAAM;wBACvCmB,IAAIpB,YAAYC,iBAAiB,MAAM;wBACvCQ,IAAI;4BACFY,WAAW,CAACrB,YAAYC,iBAAiB,WAAW;4BACpD,WAAW;4BACXqB,gBAAgB;4BAChB,qBAAqB;4BACrB,wBAAwB;gCACtBC,QAAQ;gCACRb,iBAAiB,CAACc,QAAUA,MAAMC,OAAO,CAACC,IAAI,CAAC,MAAM;4BACvD;4BACA,8BAA8B;gCAC5BC,YAAY,CAACH,QAAUA,MAAMC,OAAO,CAACC,IAAI,CAAC,MAAM;4BAClD;wBACF;wBACAE,KAAK;;0CAEL,KAACpC;4BACAE,MAAMG,uBAAuB,kBAC5B,KAACb;gCAAW6C,OAAO;oCAAEC,OAAO;oCAAeP,QAAQ;gCAAc;gCAAGQ,SAAS,IAAMnC,SAAS,CAACD;0CAC1FA,sBAAQ,KAACN,gCAAgB,KAACC;;;;oBAIhCU,0BACC,KAACf;wBACC+C,GAAG/B,iBAAiB,MAAM;wBAC1BkB,IAAIlB,iBAAiB,MAAM;wBAC3BmB,IAAInB,iBAAiB,MAAM;wBAC3BgC,WAAU;wBACVrB,gBAAe;kCAEf,cAAA,KAACrB;;;;;;AAOf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DashboardStickyToolbar/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DashboardStickyToolbar';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,2BAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DashboardToolbar/DashboardToolbar.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Typography, Stack, Button, Box, useTheme, useMediaQuery, Alert } from '@mui/material';\nimport { ErrorBoundary, ErrorAlert } from '@perses-dev/components';\nimport { TimeRangeControls } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\nimport { OnSaveDashboard, useEditMode } from '../../context';\nimport { AddPanelButton } from '../AddPanelButton';\nimport { AddGroupButton } from '../AddGroupButton';\nimport { DownloadButton } from '../DownloadButton';\nimport { EditVariablesButton } from '../Variables';\nimport { EditDatasourcesButton } from '../Datasources';\nimport { EditButton } from '../EditButton';\nimport { EditJsonButton } from '../EditJsonButton';\nimport { SaveDashboardButton } from '../SaveDashboardButton';\nimport { DashboardStickyToolbar } from '../DashboardStickyToolbar';\n\nexport interface DashboardToolbarProps {\n dashboardName: string;\n dashboardTitleComponent?: JSX.Element;\n initialVariableIsSticky?: boolean;\n isReadonly: boolean;\n isVariableEnabled: boolean;\n isDatasourceEnabled: boolean;\n onEditButtonClick: () => void;\n onCancelButtonClick: () => void;\n onSave?: OnSaveDashboard;\n}\n\nexport const DashboardToolbar = (props: DashboardToolbarProps): ReactElement => {\n const {\n dashboardName,\n dashboardTitleComponent,\n initialVariableIsSticky,\n isReadonly,\n isVariableEnabled,\n isDatasourceEnabled,\n onEditButtonClick,\n onCancelButtonClick,\n onSave,\n } = props;\n\n const { isEditMode } = useEditMode();\n\n const isBiggerThanSm = useMediaQuery(useTheme().breakpoints.up('sm'));\n const isBiggerThanMd = useMediaQuery(useTheme().breakpoints.up('md'));\n\n const dashboardTitle = dashboardTitleComponent ? (\n dashboardTitleComponent\n ) : (\n <Typography variant=\"h2\">{dashboardName}</Typography>\n );\n\n const testId = 'dashboard-toolbar';\n\n return (\n <>\n <Stack data-testid={testId}>\n <Box\n px={2}\n py={1.5}\n display=\"flex\"\n sx={{ backgroundColor: (theme) => theme.palette.primary.main + (isEditMode ? '30' : '0') }}\n >\n {dashboardTitle}\n {isEditMode ? (\n <Stack direction=\"row\" gap={1} ml=\"auto\">\n {isReadonly && (\n <Alert severity=\"warning\" sx={{ backgroundColor: 'transparent', padding: 0 }}>\n Dashboard managed via code only. Download JSON and commit changes to save.\n </Alert>\n )}\n <Stack direction=\"row\" spacing={0.5} ml={1} whiteSpace=\"nowrap\">\n {isVariableEnabled && <EditVariablesButton />}\n {isDatasourceEnabled && <EditDatasourcesButton />}\n <AddPanelButton />\n <AddGroupButton />\n </Stack>\n <SaveDashboardButton onSave={onSave} isDisabled={isReadonly} />\n <Button variant=\"outlined\" onClick={onCancelButtonClick}>\n Cancel\n </Button>\n </Stack>\n ) : (\n <>\n {isBiggerThanSm && (\n <Stack direction=\"row\" gap={1} ml=\"auto\">\n <EditButton onClick={onEditButtonClick} />\n </Stack>\n )}\n </>\n )}\n </Box>\n <Box\n sx={{\n display: 'flex',\n width: '100%',\n alignItems: 'start',\n padding: (theme) => theme.spacing(1, 2, 0, 2),\n flexDirection: isBiggerThanMd ? 'row' : 'column',\n flexWrap: 'nowrap',\n gap: 1,\n }}\n >\n <Box width=\"100%\">\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardStickyToolbar\n initialVariableIsSticky={initialVariableIsSticky}\n sx={{\n backgroundColor: ({ palette }) => palette.background.default,\n }}\n />\n </ErrorBoundary>\n </Box>\n <Stack direction=\"row\" ml=\"auto\" flexWrap=\"wrap\" justifyContent=\"end\">\n <Stack direction=\"row\" spacing={1} mt={1} ml={1}>\n <TimeRangeControls />\n <DownloadButton />\n <EditJsonButton isReadonly={!isEditMode} />\n </Stack>\n </Stack>\n </Box>\n </Stack>\n </>\n );\n};\n"],"names":["Typography","Stack","Button","Box","useTheme","useMediaQuery","Alert","ErrorBoundary","ErrorAlert","TimeRangeControls","useEditMode","AddPanelButton","AddGroupButton","DownloadButton","EditVariablesButton","EditDatasourcesButton","EditButton","EditJsonButton","SaveDashboardButton","DashboardStickyToolbar","DashboardToolbar","props","dashboardName","dashboardTitleComponent","initialVariableIsSticky","isReadonly","isVariableEnabled","isDatasourceEnabled","onEditButtonClick","onCancelButtonClick","onSave","isEditMode","isBiggerThanSm","breakpoints","up","isBiggerThanMd","dashboardTitle","variant","testId","data-testid","px","py","display","sx","backgroundColor","theme","palette","primary","main","direction","gap","ml","severity","padding","spacing","whiteSpace","isDisabled","onClick","width","alignItems","flexDirection","flexWrap","FallbackComponent","background","default","justifyContent","mt"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DashboardToolbar/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DashboardToolbar';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Datasources/DatasourceEditor.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n Box,\n Button,\n IconButton,\n Stack,\n Table,\n TableBody,\n TableCell,\n TableContainer,\n TableHead,\n TableRow,\n Typography,\n} from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport PencilIcon from 'mdi-material-ui/Pencil';\nimport TrashIcon from 'mdi-material-ui/TrashCan';\nimport { Action, DatasourceDefinition, DatasourceSpec } from '@perses-dev/core';\nimport { DatasourceEditorForm, ValidationProvider } from '@perses-dev/plugin-system';\nimport { ReactElement, useState } from 'react';\nimport { useImmer } from 'use-immer';\nimport { useDiscardChangesConfirmationDialog } from '../../context';\n\nexport function DatasourceEditor(props: {\n datasources: Record<string, DatasourceSpec>;\n onChange: (datasources: Record<string, DatasourceSpec>) => void;\n onCancel: () => void;\n}): ReactElement {\n const [datasources, setDatasources] = useImmer(props.datasources);\n const [datasourceFormAction, setDatasourceFormAction] = useState<Action>('update');\n const [datasourceEdit, setDatasourceEdit] = useState<DatasourceDefinition | null>(null);\n const defaultSpec: DatasourceSpec = {\n default: false,\n plugin: {\n // TODO: find a way to avoid assuming that the PrometheusDatasource plugin is installed\n kind: 'PrometheusDatasource',\n spec: {},\n },\n };\n\n const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } =\n useDiscardChangesConfirmationDialog();\n\n const handleCancel = (): void => {\n if (JSON.stringify(props.datasources) !== JSON.stringify(datasources)) {\n openDiscardChangesConfirmationDialog({\n onDiscardChanges: () => {\n closeDiscardChangesConfirmationDialog();\n props.onCancel();\n },\n onCancel: () => {\n closeDiscardChangesConfirmationDialog();\n },\n description:\n 'You have unapplied changes. Are you sure you want to discard these changes? Changes cannot be recovered.',\n });\n } else {\n props.onCancel();\n }\n };\n\n const removeDatasource = (name: string): void => {\n setDatasources((draft) => {\n delete draft[name];\n });\n };\n\n const addDatasource = (): void => {\n setDatasourceFormAction('create');\n setDatasourceEdit({\n name: 'NewDatasource',\n spec: defaultSpec,\n });\n };\n\n const editDatasource = (name: string): void => {\n setDatasourceFormAction('update');\n setDatasourceEdit({\n name: name,\n spec: datasources[name] ?? defaultSpec,\n });\n };\n\n return (\n <>\n {datasourceEdit ? (\n <ValidationProvider>\n <DatasourceEditorForm\n initialDatasourceDefinition={datasourceEdit}\n action={datasourceFormAction}\n isDraft={true}\n onActionChange={setDatasourceFormAction}\n onSave={(def: DatasourceDefinition) => {\n setDatasources((draft) => {\n delete draft[datasourceEdit.name]; // to tackle the case where datasource name has been changed\n draft[def.name] = def.spec;\n setDatasourceEdit(null);\n });\n }}\n onClose={() => {\n setDatasourceEdit(null);\n }}\n />\n </ValidationProvider>\n ) : (\n <>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">Edit Dashboard Datasources</Typography>\n <Stack direction=\"row\" spacing={1} marginLeft=\"auto\">\n <Button\n disabled={props.datasources === datasources}\n variant=\"contained\"\n onClick={() => {\n props.onChange(datasources);\n }}\n >\n Apply\n </Button>\n <Button color=\"secondary\" variant=\"outlined\" onClick={handleCancel}>\n Cancel\n </Button>\n </Stack>\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Stack spacing={2}>\n <Stack spacing={2}>\n <TableContainer>\n <Table sx={{ minWidth: 650 }} aria-label=\"table of datasources\">\n <TableHead>\n <TableRow>\n <TableCell>Name</TableCell>\n <TableCell>Type</TableCell>\n <TableCell>Description</TableCell>\n <TableCell align=\"right\">Actions</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {Object.entries(datasources).map(([name, spec]) => {\n return (\n <TableRow key={name}>\n <TableCell component=\"th\" scope=\"row\" sx={{ fontWeight: 'bold' }}>\n {name}\n </TableCell>\n <TableCell>{spec.plugin.kind}</TableCell>\n <TableCell>{spec.display?.description ?? ''}</TableCell>\n <TableCell align=\"right\" sx={{ whiteSpace: 'nowrap' }}>\n <IconButton onClick={() => editDatasource(name)}>\n <PencilIcon />\n </IconButton>\n <IconButton onClick={() => removeDatasource(name)}>\n <TrashIcon />\n </IconButton>\n </TableCell>\n </TableRow>\n );\n })}\n </TableBody>\n </Table>\n </TableContainer>\n <Box display=\"flex\">\n <Button\n variant=\"contained\"\n startIcon={<AddIcon />}\n sx={{ marginLeft: 'auto' }}\n onClick={addDatasource}\n >\n Add Datasource\n </Button>\n </Box>\n </Stack>\n </Stack>\n </Box>\n </>\n )}\n </>\n );\n}\n"],"names":["Box","Button","IconButton","Stack","Table","TableBody","TableCell","TableContainer","TableHead","TableRow","Typography","AddIcon","PencilIcon","TrashIcon","DatasourceEditorForm","ValidationProvider","useState","useImmer","useDiscardChangesConfirmationDialog","DatasourceEditor","props","datasources","setDatasources","datasourceFormAction","setDatasourceFormAction","datasourceEdit","setDatasourceEdit","defaultSpec","default","plugin","kind","spec","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","handleCancel","JSON","stringify","onDiscardChanges","onCancel","description","removeDatasource","name","draft","addDatasource","editDatasource","initialDatasourceDefinition","action","isDraft","onActionChange","onSave","def","onClose","sx","display","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","direction","marginLeft","disabled","onClick","onChange","color","overflowY","minWidth","aria-label","align","Object","entries","map","component","scope","fontWeight","whiteSpace","startIcon"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Datasources/EditDatasourcesButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState } from 'react';\nimport { Button } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport { Drawer, InfoTooltip } from '@perses-dev/components';\nimport { DashboardResource, DatasourceSpec, EphemeralDashboardResource } from '@perses-dev/core';\nimport { useDatasourceStore } from '@perses-dev/plugin-system';\nimport { TOOLTIP_TEXT, editButtonStyle } from '../../constants';\nimport { useDashboard } from '../../context';\nimport { DatasourceEditor } from './DatasourceEditor';\n\nexport function EditDatasourcesButton(): ReactElement {\n const [isDatasourceEditorOpen, setIsDatasourceEditorOpen] = useState(false);\n const { getLocalDatasources, setLocalDatasources, getSavedDatasources, setSavedDatasources } = useDatasourceStore();\n const localDatasources: Record<string, DatasourceSpec> = getLocalDatasources();\n const savedDatasources: Record<string, DatasourceSpec> = getSavedDatasources();\n const { dashboard, setDashboard } = useDashboard();\n\n const openDatasourceEditor = (): void => {\n setIsDatasourceEditorOpen(true);\n };\n\n const closeDatasourceEditor = (): void => {\n setIsDatasourceEditorOpen(false);\n };\n\n const handleChangeDatasources = (datasources: Record<string, DatasourceSpec>): void => {\n // Calculates the new list of datasources that are allowed to be used.\n const newSavedDatasources: Record<string, DatasourceSpec> = Object.keys(datasources)\n .filter((key) => {\n // Datasources are allowed to be used if a) they are direct, or b) they are proxied, and their\n // proxy is the same as what we have saved.\n const isDirect = 'directUrl' in (datasources[key]?.plugin?.spec ?? {});\n const isSavedProxy =\n !isDirect &&\n !('directUrl' in (savedDatasources[key]?.plugin?.spec ?? {})) &&\n datasources[key]?.plugin?.spec?.proxy === savedDatasources[key]?.plugin?.spec?.proxy;\n\n return isDirect || isSavedProxy;\n })\n .reduce(\n (obj, key) => {\n obj[key] = datasources[key] as DatasourceSpec;\n\n return obj;\n },\n {} as Record<string, DatasourceSpec>\n );\n\n setDashboard(\n dashboard.kind === 'Dashboard'\n ? ({\n ...dashboard,\n spec: {\n ...dashboard.spec,\n datasources: datasources,\n },\n } as DashboardResource)\n : ({\n ...dashboard,\n spec: {\n ...dashboard.spec,\n datasources: datasources,\n },\n } as EphemeralDashboardResource)\n );\n setSavedDatasources(newSavedDatasources);\n setLocalDatasources(datasources);\n setIsDatasourceEditorOpen(false);\n };\n\n return (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.editDatasources}>\n <Button\n startIcon={<PencilIcon />}\n onClick={openDatasourceEditor}\n aria-label={TOOLTIP_TEXT.editDatasources}\n variant=\"text\"\n color=\"primary\"\n sx={editButtonStyle}\n >\n Datasources\n </Button>\n </InfoTooltip>\n <Drawer\n isOpen={isDatasourceEditorOpen}\n onClose={closeDatasourceEditor}\n PaperProps={{ sx: { width: '50%' } }}\n data-testid=\"datasource-editor\"\n >\n <DatasourceEditor\n datasources={localDatasources}\n onCancel={closeDatasourceEditor}\n onChange={handleChangeDatasources}\n />\n </Drawer>\n </>\n );\n}\n"],"names":["useState","Button","PencilIcon","Drawer","InfoTooltip","useDatasourceStore","TOOLTIP_TEXT","editButtonStyle","useDashboard","DatasourceEditor","EditDatasourcesButton","isDatasourceEditorOpen","setIsDatasourceEditorOpen","getLocalDatasources","setLocalDatasources","getSavedDatasources","setSavedDatasources","localDatasources","savedDatasources","dashboard","setDashboard","openDatasourceEditor","closeDatasourceEditor","handleChangeDatasources","datasources","newSavedDatasources","Object","keys","filter","key","isDirect","plugin","spec","isSavedProxy","proxy","reduce","obj","kind","description","editDatasources","startIcon","onClick","aria-label","variant","color","sx","isOpen","onClose","PaperProps","width","data-testid","onCancel","onChange"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SAASC,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,gBAAgB,gCAAgC;AACvD,SAASC,MAAM,EAAEC,WAAW,QAAQ,yBAAyB;AAE7D,SAASC,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,YAAY,EAAEC,eAAe,QAAQ,kBAAkB;AAChE,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,qBAAqB;AAEtD,OAAO,SAASC;IACd,MAAM,CAACC,wBAAwBC,0BAA0B,GAAGZ,SAAS;IACrE,MAAM,EAAEa,mBAAmB,EAAEC,mBAAmB,EAAEC,mBAAmB,EAAEC,mBAAmB,EAAE,GAAGX;IAC/F,MAAMY,mBAAmDJ;IACzD,MAAMK,mBAAmDH;IACzD,MAAM,EAAEI,SAAS,EAAEC,YAAY,EAAE,GAAGZ;IAEpC,MAAMa,uBAAuB;QAC3BT,0BAA0B;IAC5B;IAEA,MAAMU,wBAAwB;QAC5BV,0BAA0B;IAC5B;IAEA,MAAMW,0BAA0B,CAACC;QAC/B,sEAAsE;QACtE,MAAMC,sBAAsDC,OAAOC,IAAI,CAACH,aACrEI,MAAM,CAAC,CAACC;YACP,8FAA8F;YAC9F,2CAA2C;YAC3C,MAAMC,WAAW,eAAgBN,CAAAA,WAAW,CAACK,IAAI,EAAEE,QAAQC,QAAQ,CAAC,CAAA;YACpE,MAAMC,eACJ,CAACH,YACD,CAAE,CAAA,eAAgBZ,CAAAA,gBAAgB,CAACW,IAAI,EAAEE,QAAQC,QAAQ,CAAC,CAAA,CAAC,KAC3DR,WAAW,CAACK,IAAI,EAAEE,QAAQC,MAAME,UAAUhB,gBAAgB,CAACW,IAAI,EAAEE,QAAQC,MAAME;YAEjF,OAAOJ,YAAYG;QACrB,GACCE,MAAM,CACL,CAACC,KAAKP;YACJO,GAAG,CAACP,IAAI,GAAGL,WAAW,CAACK,IAAI;YAE3B,OAAOO;QACT,GACA,CAAC;QAGLhB,aACED,UAAUkB,IAAI,KAAK,cACd;YACC,GAAGlB,SAAS;YACZa,MAAM;gBACJ,GAAGb,UAAUa,IAAI;gBACjBR,aAAaA;YACf;QACF,IACC;YACC,GAAGL,SAAS;YACZa,MAAM;gBACJ,GAAGb,UAAUa,IAAI;gBACjBR,aAAaA;YACf;QACF;QAENR,oBAAoBS;QACpBX,oBAAoBU;QACpBZ,0BAA0B;IAC5B;IAEA,qBACE;;0BACE,KAACR;gBAAYkC,aAAahC,aAAaiC,eAAe;0BACpD,cAAA,KAACtC;oBACCuC,yBAAW,KAACtC;oBACZuC,SAASpB;oBACTqB,cAAYpC,aAAaiC,eAAe;oBACxCI,SAAQ;oBACRC,OAAM;oBACNC,IAAItC;8BACL;;;0BAIH,KAACJ;gBACC2C,QAAQnC;gBACRoC,SAASzB;gBACT0B,YAAY;oBAAEH,IAAI;wBAAEI,OAAO;oBAAM;gBAAE;gBACnCC,eAAY;0BAEZ,cAAA,KAACzC;oBACCe,aAAaP;oBACbkC,UAAU7B;oBACV8B,UAAU7B;;;;;AAKpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Datasources/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditDatasourcesButton';\nexport * from './DatasourceEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAA0B;AACxC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DeletePanelDialog/DeletePanelDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FormEvent, ReactElement } from 'react';\nimport { Dialog } from '@perses-dev/components';\nimport { useDeletePanelDialog, DeletePanelDialogState, useViewPanel } from '../../context';\n\nexport const DeletePanelDialog = (): ReactElement => {\n const { deletePanelDialog, closeDeletePanelDialog } = useDeletePanelDialog();\n\n return (\n <Dialog open={deletePanelDialog !== undefined}>\n <Dialog.Header onClose={() => closeDeletePanelDialog()}>Delete Panel</Dialog.Header>\n {deletePanelDialog && <DeletePanelForm deletePanelDialog={deletePanelDialog} />}\n </Dialog>\n );\n};\n\ninterface DeletePanelFormProps {\n deletePanelDialog: DeletePanelDialogState;\n}\n\nconst DeletePanelForm = ({ deletePanelDialog }: DeletePanelFormProps): ReactElement => {\n const { deletePanel, closeDeletePanelDialog } = useDeletePanelDialog();\n const { setViewPanel } = useViewPanel();\n\n const handleDelete = (e: FormEvent): void => {\n e.preventDefault();\n const { panelGroupItemId } = deletePanelDialog;\n deletePanel(panelGroupItemId);\n closeDeletePanelDialog();\n setViewPanel(undefined);\n };\n\n return (\n <form onSubmit={handleDelete}>\n <Dialog.Content>\n Are you sure you want to delete {deletePanelDialog.panelName} from {deletePanelDialog.panelGroupName}? This\n action cannot be undone.\n </Dialog.Content>\n <Dialog.Actions>\n <Dialog.PrimaryButton>Delete</Dialog.PrimaryButton>\n <Dialog.SecondaryButton onClick={() => closeDeletePanelDialog()}>Cancel</Dialog.SecondaryButton>\n </Dialog.Actions>\n </form>\n );\n};\n"],"names":["Dialog","useDeletePanelDialog","useViewPanel","DeletePanelDialog","deletePanelDialog","closeDeletePanelDialog","open","undefined","Header","onClose","DeletePanelForm","deletePanel","setViewPanel","handleDelete","e","preventDefault","panelGroupItemId","form","onSubmit","Content","panelName","panelGroupName","Actions","PrimaryButton","SecondaryButton","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAASC,oBAAoB,EAA0BC,YAAY,QAAQ,gBAAgB;AAE3F,OAAO,MAAMC,oBAAoB;IAC/B,MAAM,EAAEC,iBAAiB,EAAEC,sBAAsB,EAAE,GAAGJ;IAEtD,qBACE,MAACD;QAAOM,MAAMF,sBAAsBG;;0BAClC,KAACP,OAAOQ,MAAM;gBAACC,SAAS,IAAMJ;0BAA0B;;YACvDD,mCAAqB,KAACM;gBAAgBN,mBAAmBA;;;;AAGhE,EAAE;AAMF,MAAMM,kBAAkB,CAAC,EAAEN,iBAAiB,EAAwB;IAClE,MAAM,EAAEO,WAAW,EAAEN,sBAAsB,EAAE,GAAGJ;IAChD,MAAM,EAAEW,YAAY,EAAE,GAAGV;IAEzB,MAAMW,eAAe,CAACC;QACpBA,EAAEC,cAAc;QAChB,MAAM,EAAEC,gBAAgB,EAAE,GAAGZ;QAC7BO,YAAYK;QACZX;QACAO,aAAaL;IACf;IAEA,qBACE,MAACU;QAAKC,UAAUL;;0BACd,MAACb,OAAOmB,OAAO;;oBAAC;oBACmBf,kBAAkBgB,SAAS;oBAAC;oBAAOhB,kBAAkBiB,cAAc;oBAAC;;;0BAGvG,MAACrB,OAAOsB,OAAO;;kCACb,KAACtB,OAAOuB,aAAa;kCAAC;;kCACtB,KAACvB,OAAOwB,eAAe;wBAACC,SAAS,IAAMpB;kCAA0B;;;;;;AAIzE"}
|
package/dist/{components/SaveDashboardButton → src/components/DeletePanelDialog}/index.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DeletePanelDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DeletePanelDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FormEvent, ReactElement } from 'react';\nimport { IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { useDeletePanelGroupDialog, useViewPanel } from '../../context';\n\nexport const DeletePanelGroupDialog = (): ReactElement => {\n const { deletePanelGroupDialog, closeDeletePanelGroupDialog, deletePanelGroup } = useDeletePanelGroupDialog();\n const { setViewPanel } = useViewPanel();\n const panelGroupId = deletePanelGroupDialog?.panelGroupId;\n\n const handleDelete = (e: FormEvent): void => {\n e.preventDefault();\n if (panelGroupId === undefined) {\n throw new Error('group index is undefined');\n }\n deletePanelGroup(panelGroupId);\n closeDeletePanelGroupDialog();\n setViewPanel(undefined);\n };\n\n return (\n <Dialog open={deletePanelGroupDialog !== undefined}>\n <DialogTitle>Delete Panel Group</DialogTitle>\n <IconButton\n aria-label=\"Close\"\n onClick={() => closeDeletePanelGroupDialog()}\n sx={(theme) => ({\n position: 'absolute',\n top: theme.spacing(0.5),\n right: theme.spacing(0.5),\n })}\n >\n <CloseIcon />\n </IconButton>\n <form onSubmit={handleDelete}>\n <DialogContent dividers sx={{ width: '500px' }}>\n Are you sure you want to delete {deletePanelGroupDialog?.panelGroupName ?? 'panel group'}? This will delete\n all the panels within the group.\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" type=\"submit\">\n Delete\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={() => closeDeletePanelGroupDialog()}>\n Cancel\n </Button>\n </DialogActions>\n </form>\n </Dialog>\n );\n};\n"],"names":["IconButton","Dialog","DialogTitle","DialogContent","DialogActions","Button","CloseIcon","useDeletePanelGroupDialog","useViewPanel","DeletePanelGroupDialog","deletePanelGroupDialog","closeDeletePanelGroupDialog","deletePanelGroup","setViewPanel","panelGroupId","handleDelete","e","preventDefault","undefined","Error","open","aria-label","onClick","sx","theme","position","top","spacing","right","form","onSubmit","dividers","width","panelGroupName","variant","type","color"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,UAAU,EAAEC,MAAM,EAAEC,WAAW,EAAEC,aAAa,EAAEC,aAAa,EAAEC,MAAM,QAAQ,gBAAgB;AACtG,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,yBAAyB,EAAEC,YAAY,QAAQ,gBAAgB;AAExE,OAAO,MAAMC,yBAAyB;IACpC,MAAM,EAAEC,sBAAsB,EAAEC,2BAA2B,EAAEC,gBAAgB,EAAE,GAAGL;IAClF,MAAM,EAAEM,YAAY,EAAE,GAAGL;IACzB,MAAMM,eAAeJ,wBAAwBI;IAE7C,MAAMC,eAAe,CAACC;QACpBA,EAAEC,cAAc;QAChB,IAAIH,iBAAiBI,WAAW;YAC9B,MAAM,IAAIC,MAAM;QAClB;QACAP,iBAAiBE;QACjBH;QACAE,aAAaK;IACf;IAEA,qBACE,MAACjB;QAAOmB,MAAMV,2BAA2BQ;;0BACvC,KAAChB;0BAAY;;0BACb,KAACF;gBACCqB,cAAW;gBACXC,SAAS,IAAMX;gBACfY,IAAI,CAACC,QAAW,CAAA;wBACdC,UAAU;wBACVC,KAAKF,MAAMG,OAAO,CAAC;wBACnBC,OAAOJ,MAAMG,OAAO,CAAC;oBACvB,CAAA;0BAEA,cAAA,KAACrB;;0BAEH,MAACuB;gBAAKC,UAAUf;;kCACd,MAACZ;wBAAc4B,QAAQ;wBAACR,IAAI;4BAAES,OAAO;wBAAQ;;4BAAG;4BACbtB,wBAAwBuB,kBAAkB;4BAAc;;;kCAG3F,MAAC7B;;0CACC,KAACC;gCAAO6B,SAAQ;gCAAYC,MAAK;0CAAS;;0CAG1C,KAAC9B;gCAAO6B,SAAQ;gCAAWE,OAAM;gCAAYd,SAAS,IAAMX;0CAA+B;;;;;;;;AAOrG,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DeletePanelGroupDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DeletePanelGroupDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,2BAA2B"}
|
package/dist/src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DiscardChangesConfirmationDialog } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { useDiscardChangesConfirmationDialog } from '../../context';\n\nexport const DashboardDiscardChangesConfirmationDialog = (): ReactElement | null => {\n const { discardChangesConfirmationDialog: dialog } = useDiscardChangesConfirmationDialog();\n if (dialog === undefined) {\n return null;\n }\n return (\n <DiscardChangesConfirmationDialog\n description={\n dialog.description ||\n 'You have unsaved changes in this dashboard. Are you sure you want to discard these changes? Changes cannot be recovered.'\n }\n isOpen={true}\n onCancel={dialog.onCancel}\n onDiscardChanges={dialog.onDiscardChanges}\n />\n );\n};\n"],"names":["DiscardChangesConfirmationDialog","useDiscardChangesConfirmationDialog","DashboardDiscardChangesConfirmationDialog","discardChangesConfirmationDialog","dialog","undefined","description","isOpen","onCancel","onDiscardChanges"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,gCAAgC,QAAQ,yBAAyB;AAE1E,SAASC,mCAAmC,QAAQ,gBAAgB;AAEpE,OAAO,MAAMC,4CAA4C;IACvD,MAAM,EAAEC,kCAAkCC,MAAM,EAAE,GAAGH;IACrD,IAAIG,WAAWC,WAAW;QACxB,OAAO;IACT;IACA,qBACE,KAACL;QACCM,aACEF,OAAOE,WAAW,IAClB;QAEFC,QAAQ;QACRC,UAAUJ,OAAOI,QAAQ;QACzBC,kBAAkBL,OAAOK,gBAAgB;;AAG/C,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DiscardChangesConfirmationDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DiscardChangesConfirmationDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qCAAqC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DownloadButton/DownloadButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ClickAwayListener, Menu, MenuItem, MenuList } from '@mui/material';\nimport { ToolbarIconButton } from '@perses-dev/components';\nimport DownloadIcon from 'mdi-material-ui/DownloadOutline';\nimport React, { ReactElement, useRef } from 'react';\nimport { useDashboard } from '../../context';\nimport { serializeDashboard } from './serializeDashboard';\n\n// Button that enables downloading the dashboard as a JSON file\nexport function DownloadButton(): ReactElement {\n const { dashboard } = useDashboard();\n const hiddenLinkRef = useRef<HTMLAnchorElement>(null);\n const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);\n const open = Boolean(anchorEl);\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n const handleItemClick = (format: 'json' | 'yaml', shape?: 'cr') => (): void => {\n setAnchorEl(null);\n\n const { contentType, content } = serializeDashboard(dashboard, format, shape);\n\n if (!hiddenLinkRef || !hiddenLinkRef.current) return;\n // Create blob URL\n const hiddenLinkUrl = URL.createObjectURL(new Blob([content], { type: contentType }));\n // Simulate click\n hiddenLinkRef.current.download = `${dashboard.metadata.name}${shape === 'cr' ? '-cr' : ''}.${format}`;\n hiddenLinkRef.current.href = hiddenLinkUrl;\n hiddenLinkRef.current.click();\n // Remove blob URL (for memory management)\n URL.revokeObjectURL(hiddenLinkUrl);\n };\n\n return (\n <>\n <ToolbarIconButton\n id=\"download-dashboard-button\"\n aria-controls={open ? 'basic-menu' : undefined}\n aria-haspopup=\"true\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleClick}\n >\n <DownloadIcon />\n </ToolbarIconButton>\n\n <Menu\n id=\"download-dashboard-formats\"\n anchorEl={anchorEl}\n open={open}\n hideBackdrop={true}\n onClose={() => setAnchorEl(null)}\n MenuListProps={{\n 'aria-labelledby': 'download-dashboard-button',\n }}\n >\n <div>\n <ClickAwayListener onClickAway={() => setAnchorEl(null)}>\n <MenuList>\n <MenuItem onClick={handleItemClick('json')}>JSON</MenuItem>\n <MenuItem onClick={handleItemClick('yaml')}>YAML</MenuItem>\n <MenuItem onClick={handleItemClick('yaml', 'cr')}>YAML (CR)</MenuItem>\n </MenuList>\n </ClickAwayListener>\n </div>\n </Menu>\n\n {/* Hidden link to download the dashboard as a JSON or YAML file */}\n {/* eslint-disable jsx-a11y/anchor-has-content */}\n {/* eslint-disable jsx-a11y/anchor-is-valid */}\n <a ref={hiddenLinkRef} style={{ display: 'none' }} />\n </>\n );\n}\n"],"names":["ClickAwayListener","Menu","MenuItem","MenuList","ToolbarIconButton","DownloadIcon","React","useRef","useDashboard","serializeDashboard","DownloadButton","dashboard","hiddenLinkRef","anchorEl","setAnchorEl","useState","open","Boolean","handleClick","event","currentTarget","handleItemClick","format","shape","contentType","content","current","hiddenLinkUrl","URL","createObjectURL","Blob","type","download","metadata","name","href","click","revokeObjectURL","id","aria-controls","undefined","aria-haspopup","aria-expanded","onClick","hideBackdrop","onClose","MenuListProps","div","onClickAway","a","ref","style","display"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,iBAAiB,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,gBAAgB;AAC5E,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,OAAOC,kBAAkB,kCAAkC;AAC3D,OAAOC,SAAuBC,MAAM,QAAQ,QAAQ;AACpD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,+DAA+D;AAC/D,OAAO,SAASC;IACd,MAAM,EAAEC,SAAS,EAAE,GAAGH;IACtB,MAAMI,gBAAgBL,OAA0B;IAChD,MAAM,CAACM,UAAUC,YAAY,GAAGR,MAAMS,QAAQ,CAAqB;IACnE,MAAMC,OAAOC,QAAQJ;IACrB,MAAMK,cAAc,CAACC;QACnBL,YAAYK,MAAMC,aAAa;IACjC;IACA,MAAMC,kBAAkB,CAACC,QAAyBC,QAAiB;YACjET,YAAY;YAEZ,MAAM,EAAEU,WAAW,EAAEC,OAAO,EAAE,GAAGhB,mBAAmBE,WAAWW,QAAQC;YAEvE,IAAI,CAACX,iBAAiB,CAACA,cAAcc,OAAO,EAAE;YAC9C,kBAAkB;YAClB,MAAMC,gBAAgBC,IAAIC,eAAe,CAAC,IAAIC,KAAK;gBAACL;aAAQ,EAAE;gBAAEM,MAAMP;YAAY;YAClF,iBAAiB;YACjBZ,cAAcc,OAAO,CAACM,QAAQ,GAAG,GAAGrB,UAAUsB,QAAQ,CAACC,IAAI,GAAGX,UAAU,OAAO,QAAQ,GAAG,CAAC,EAAED,QAAQ;YACrGV,cAAcc,OAAO,CAACS,IAAI,GAAGR;YAC7Bf,cAAcc,OAAO,CAACU,KAAK;YAC3B,0CAA0C;YAC1CR,IAAIS,eAAe,CAACV;QACtB;IAEA,qBACE;;0BACE,KAACvB;gBACCkC,IAAG;gBACHC,iBAAevB,OAAO,eAAewB;gBACrCC,iBAAc;gBACdC,iBAAe1B,OAAO,SAASwB;gBAC/BG,SAASzB;0BAET,cAAA,KAACb;;0BAGH,KAACJ;gBACCqC,IAAG;gBACHzB,UAAUA;gBACVG,MAAMA;gBACN4B,cAAc;gBACdC,SAAS,IAAM/B,YAAY;gBAC3BgC,eAAe;oBACb,mBAAmB;gBACrB;0BAEA,cAAA,KAACC;8BACC,cAAA,KAAC/C;wBAAkBgD,aAAa,IAAMlC,YAAY;kCAChD,cAAA,MAACX;;8CACC,KAACD;oCAASyC,SAAStB,gBAAgB;8CAAS;;8CAC5C,KAACnB;oCAASyC,SAAStB,gBAAgB;8CAAS;;8CAC5C,KAACnB;oCAASyC,SAAStB,gBAAgB,QAAQ;8CAAO;;;;;;;0BAS1D,KAAC4B;gBAAEC,KAAKtC;gBAAeuC,OAAO;oBAAEC,SAAS;gBAAO;;;;AAGtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DownloadButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DownloadButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/DownloadButton/serializeDashboard.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DashboardResource, EphemeralDashboardResource } from '@perses-dev/core';\nimport { stringify } from 'yaml';\n\ntype SerializedDashboard = {\n contentType: string;\n content: string;\n};\n\nfunction serializeYaml(dashboard: DashboardResource | EphemeralDashboardResource, shape?: 'cr'): SerializedDashboard {\n let content: string;\n\n if (shape === 'cr') {\n const name = dashboard.metadata.name.toLowerCase().replace(/[^a-z0-9-]/g, '-');\n content = stringify(\n {\n apiVersion: 'perses.dev/v1alpha1',\n kind: 'PersesDashboard',\n metadata: {\n labels: {\n 'app.kubernetes.io/name': 'perses-dashboard',\n 'app.kubernetes.io/instance': name,\n 'app.kubernetes.io/part-of': 'perses-operator',\n },\n name,\n namespace: dashboard.metadata.project,\n },\n spec: dashboard.spec,\n },\n { schema: 'yaml-1.1' }\n );\n } else {\n content = stringify(dashboard, { schema: 'yaml-1.1' });\n }\n\n return { contentType: 'application/yaml', content };\n}\n\nexport function serializeDashboard(\n dashboard: DashboardResource | EphemeralDashboardResource,\n format: 'json' | 'yaml',\n shape?: 'cr'\n): SerializedDashboard {\n switch (format) {\n case 'json':\n return { contentType: 'application/json', content: JSON.stringify(dashboard, null, 2) };\n case 'yaml':\n return serializeYaml(dashboard, shape);\n }\n}\n"],"names":["stringify","serializeYaml","dashboard","shape","content","name","metadata","toLowerCase","replace","apiVersion","kind","labels","namespace","project","spec","schema","contentType","serializeDashboard","format","JSON"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,SAAS,QAAQ,OAAO;AAOjC,SAASC,cAAcC,SAAyD,EAAEC,KAAY;IAC5F,IAAIC;IAEJ,IAAID,UAAU,MAAM;QAClB,MAAME,OAAOH,UAAUI,QAAQ,CAACD,IAAI,CAACE,WAAW,GAAGC,OAAO,CAAC,eAAe;QAC1EJ,UAAUJ,UACR;YACES,YAAY;YACZC,MAAM;YACNJ,UAAU;gBACRK,QAAQ;oBACN,0BAA0B;oBAC1B,8BAA8BN;oBAC9B,6BAA6B;gBAC/B;gBACAA;gBACAO,WAAWV,UAAUI,QAAQ,CAACO,OAAO;YACvC;YACAC,MAAMZ,UAAUY,IAAI;QACtB,GACA;YAAEC,QAAQ;QAAW;IAEzB,OAAO;QACLX,UAAUJ,UAAUE,WAAW;YAAEa,QAAQ;QAAW;IACtD;IAEA,OAAO;QAAEC,aAAa;QAAoBZ;IAAQ;AACpD;AAEA,OAAO,SAASa,mBACdf,SAAyD,EACzDgB,MAAuB,EACvBf,KAAY;IAEZ,OAAQe;QACN,KAAK;YACH,OAAO;gBAAEF,aAAa;gBAAoBZ,SAASe,KAAKnB,SAAS,CAACE,WAAW,MAAM;YAAG;QACxF,KAAK;YACH,OAAOD,cAAcC,WAAWC;IACpC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditButton/EditButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport { ReactElement } from 'react';\n\nexport interface EditButtonProps {\n /**\n * The label used inside the button.\n */\n label?: string;\n\n /**\n * Handler that puts the dashboard into editing mode.\n */\n onClick: () => void;\n}\n\nexport const EditButton = ({ label = 'Edit', onClick }: EditButtonProps): ReactElement => {\n return (\n <Button\n onClick={onClick}\n startIcon={<PencilIcon />}\n variant=\"outlined\"\n color=\"secondary\"\n sx={{ whiteSpace: 'nowrap', minWidth: 'auto' }}\n >\n {label}\n </Button>\n );\n};\n"],"names":["Button","PencilIcon","EditButton","label","onClick","startIcon","variant","color","sx","whiteSpace","minWidth"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,gBAAgB,gCAAgC;AAevD,OAAO,MAAMC,aAAa,CAAC,EAAEC,QAAQ,MAAM,EAAEC,OAAO,EAAmB;IACrE,qBACE,KAACJ;QACCI,SAASA;QACTC,yBAAW,KAACJ;QACZK,SAAQ;QACRC,OAAM;QACNC,IAAI;YAAEC,YAAY;YAAUC,UAAU;QAAO;kBAE5CP;;AAGP,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditJsonButton/EditJsonButton.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport CodeIcon from 'mdi-material-ui/CodeBraces';\nimport { InfoTooltip, ToolbarIconButton } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { TOOLTIP_TEXT } from '../../constants';\nimport { useEditJsonDialog } from '../../context';\n\nexport interface EditJsonButtonProps {\n isReadonly: boolean;\n}\n\nexport const EditJsonButton = (props: EditJsonButtonProps): ReactElement => {\n const { isReadonly } = props;\n const { openEditJsonDialog } = useEditJsonDialog();\n\n const info = isReadonly ? TOOLTIP_TEXT.viewJson : TOOLTIP_TEXT.editJson;\n\n return (\n <InfoTooltip description={info}>\n <ToolbarIconButton aria-label={info} variant=\"outlined\" onClick={() => openEditJsonDialog()}>\n <CodeIcon />\n </ToolbarIconButton>\n </InfoTooltip>\n );\n};\n"],"names":["CodeIcon","InfoTooltip","ToolbarIconButton","TOOLTIP_TEXT","useEditJsonDialog","EditJsonButton","props","isReadonly","openEditJsonDialog","info","viewJson","editJson","description","aria-label","variant","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,cAAc,6BAA6B;AAClD,SAASC,WAAW,EAAEC,iBAAiB,QAAQ,yBAAyB;AAExE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,iBAAiB,QAAQ,gBAAgB;AAMlD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,UAAU,EAAE,GAAGD;IACvB,MAAM,EAAEE,kBAAkB,EAAE,GAAGJ;IAE/B,MAAMK,OAAOF,aAAaJ,aAAaO,QAAQ,GAAGP,aAAaQ,QAAQ;IAEvE,qBACE,KAACV;QAAYW,aAAaH;kBACxB,cAAA,KAACP;YAAkBW,cAAYJ;YAAMK,SAAQ;YAAWC,SAAS,IAAMP;sBACrE,cAAA,KAACR;;;AAIT,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditJsonButton/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditJsonButton';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditJsonDialog/EditJsonDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FormEvent, ReactElement, useState } from 'react';\nimport { Alert, FormControl } from '@mui/material';\nimport { Dialog, JSONEditor } from '@perses-dev/components';\nimport { useDatasourceStore, useTimeRange } from '@perses-dev/plugin-system';\nimport { useEditJsonDialog, useDashboard } from '../../context';\n\nexport interface EditJsonDialogProps {\n isReadonly: boolean;\n disableMetadataEdition?: boolean;\n}\n\nexport const EditJsonDialog = (props: EditJsonDialogProps): ReactElement => {\n const { isReadonly, disableMetadataEdition } = props;\n const { editJsonDialog, closeEditJsonDialog } = useEditJsonDialog();\n\n return (\n <Dialog open={!!editJsonDialog?.isOpen} scroll=\"paper\" fullWidth maxWidth=\"lg\">\n <Dialog.Header onClose={() => closeEditJsonDialog()}>{!isReadonly && 'Edit '} Dashboard JSON</Dialog.Header>\n {editJsonDialog?.isOpen && (\n <EditJsonDialogForm isReadonly={isReadonly} disableMetadataEdition={disableMetadataEdition} />\n )}\n </Dialog>\n );\n};\n\nconst EditJsonDialogForm = (props: EditJsonDialogProps): ReactElement => {\n const { isReadonly, disableMetadataEdition } = props;\n const { closeEditJsonDialog } = useEditJsonDialog();\n const { setTimeRange, setRefreshInterval } = useTimeRange();\n const { dashboard, setDashboard } = useDashboard();\n const { setLocalDatasources } = useDatasourceStore();\n const [draftDashboard, setDraftDashboard] = useState(dashboard);\n\n const handleApply = (e: FormEvent): void => {\n e.preventDefault();\n setDashboard(draftDashboard);\n setTimeRange({ pastDuration: draftDashboard.spec.duration });\n setRefreshInterval(draftDashboard.spec.refreshInterval ?? '0s');\n setLocalDatasources(draftDashboard.spec.datasources ?? {});\n closeEditJsonDialog();\n };\n\n const completeDraftDashboard = (dashboard: string | undefined): void => {\n try {\n const json = JSON.parse(dashboard ?? '{}');\n setDraftDashboard(json);\n } catch (_) {\n // do nothing\n }\n };\n\n return (\n <Dialog.Form onSubmit={handleApply}>\n <Dialog.Content sx={{ width: '100%' }}>\n {disableMetadataEdition && !isReadonly && (\n <Alert sx={{ marginBottom: (theme) => theme.spacing(1) }} severity=\"warning\">\n Metadata cannot be modified or saved.\n </Alert>\n )}\n {draftDashboard.kind === 'EphemeralDashboard' && (\n <Alert sx={{ marginBottom: 1 }} severity=\"warning\">\n Time-to-live cannot be modified or saved from here. Go to the project view to modify it.\n </Alert>\n )}\n <FormControl fullWidth>\n <JSONEditor\n minHeight=\"300px\"\n maxHeight=\"70vh\"\n value={draftDashboard}\n onChange={(value: string) => completeDraftDashboard(value)}\n readOnly={isReadonly}\n />\n </FormControl>\n </Dialog.Content>\n {!isReadonly && (\n <Dialog.Actions>\n <Dialog.PrimaryButton onClick={handleApply}>Apply</Dialog.PrimaryButton>\n </Dialog.Actions>\n )}\n </Dialog.Form>\n );\n};\n"],"names":["useState","Alert","FormControl","Dialog","JSONEditor","useDatasourceStore","useTimeRange","useEditJsonDialog","useDashboard","EditJsonDialog","props","isReadonly","disableMetadataEdition","editJsonDialog","closeEditJsonDialog","open","isOpen","scroll","fullWidth","maxWidth","Header","onClose","EditJsonDialogForm","setTimeRange","setRefreshInterval","dashboard","setDashboard","setLocalDatasources","draftDashboard","setDraftDashboard","handleApply","e","preventDefault","pastDuration","spec","duration","refreshInterval","datasources","completeDraftDashboard","json","JSON","parse","_","Form","onSubmit","Content","sx","width","marginBottom","theme","spacing","severity","kind","minHeight","maxHeight","value","onChange","readOnly","Actions","PrimaryButton","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAkCA,QAAQ,QAAQ,QAAQ;AAC1D,SAASC,KAAK,EAAEC,WAAW,QAAQ,gBAAgB;AACnD,SAASC,MAAM,EAAEC,UAAU,QAAQ,yBAAyB;AAC5D,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,4BAA4B;AAC7E,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,gBAAgB;AAOhE,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,UAAU,EAAEC,sBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEG,cAAc,EAAEC,mBAAmB,EAAE,GAAGP;IAEhD,qBACE,MAACJ;QAAOY,MAAM,CAAC,CAACF,gBAAgBG;QAAQC,QAAO;QAAQC,SAAS;QAACC,UAAS;;0BACxE,MAAChB,OAAOiB,MAAM;gBAACC,SAAS,IAAMP;;oBAAwB,CAACH,cAAc;oBAAQ;;;YAC5EE,gBAAgBG,wBACf,KAACM;gBAAmBX,YAAYA;gBAAYC,wBAAwBA;;;;AAI5E,EAAE;AAEF,MAAMU,qBAAqB,CAACZ;IAC1B,MAAM,EAAEC,UAAU,EAAEC,sBAAsB,EAAE,GAAGF;IAC/C,MAAM,EAAEI,mBAAmB,EAAE,GAAGP;IAChC,MAAM,EAAEgB,YAAY,EAAEC,kBAAkB,EAAE,GAAGlB;IAC7C,MAAM,EAAEmB,SAAS,EAAEC,YAAY,EAAE,GAAGlB;IACpC,MAAM,EAAEmB,mBAAmB,EAAE,GAAGtB;IAChC,MAAM,CAACuB,gBAAgBC,kBAAkB,GAAG7B,SAASyB;IAErD,MAAMK,cAAc,CAACC;QACnBA,EAAEC,cAAc;QAChBN,aAAaE;QACbL,aAAa;YAAEU,cAAcL,eAAeM,IAAI,CAACC,QAAQ;QAAC;QAC1DX,mBAAmBI,eAAeM,IAAI,CAACE,eAAe,IAAI;QAC1DT,oBAAoBC,eAAeM,IAAI,CAACG,WAAW,IAAI,CAAC;QACxDvB;IACF;IAEA,MAAMwB,yBAAyB,CAACb;QAC9B,IAAI;YACF,MAAMc,OAAOC,KAAKC,KAAK,CAAChB,aAAa;YACrCI,kBAAkBU;QACpB,EAAE,OAAOG,GAAG;QACV,aAAa;QACf;IACF;IAEA,qBACE,MAACvC,OAAOwC,IAAI;QAACC,UAAUd;;0BACrB,MAAC3B,OAAO0C,OAAO;gBAACC,IAAI;oBAAEC,OAAO;gBAAO;;oBACjCnC,0BAA0B,CAACD,4BAC1B,KAACV;wBAAM6C,IAAI;4BAAEE,cAAc,CAACC,QAAUA,MAAMC,OAAO,CAAC;wBAAG;wBAAGC,UAAS;kCAAU;;oBAI9EvB,eAAewB,IAAI,KAAK,sCACvB,KAACnD;wBAAM6C,IAAI;4BAAEE,cAAc;wBAAE;wBAAGG,UAAS;kCAAU;;kCAIrD,KAACjD;wBAAYgB,SAAS;kCACpB,cAAA,KAACd;4BACCiD,WAAU;4BACVC,WAAU;4BACVC,OAAO3B;4BACP4B,UAAU,CAACD,QAAkBjB,uBAAuBiB;4BACpDE,UAAU9C;;;;;YAIf,CAACA,4BACA,KAACR,OAAOuD,OAAO;0BACb,cAAA,KAACvD,OAAOwD,aAAa;oBAACC,SAAS9B;8BAAa;;;;;AAKtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditJsonDialog/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './EditJsonDialog';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
|