@perses-dev/dashboards 0.52.0-beta.2 → 0.52.0-beta.3
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/components/AddGroupButton/AddGroupButton.js.map +1 -0
- package/dist/{src/components/PanelDrawer → components/AddGroupButton}/index.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -0
- package/dist/{src/components/Datasources → components/AddPanelButton}/index.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -0
- package/dist/components/Dashboard/index.js.map +1 -0
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -0
- package/dist/components/DashboardStickyToolbar/index.js.map +1 -0
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -0
- package/dist/{src/context/VariableProvider → components/DashboardToolbar}/index.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -0
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -0
- package/dist/{src/constants/grid-layout-config.js.map → components/Datasources/index.js.map} +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -0
- package/dist/{src/components/EditJsonDialog → components/DeletePanelDialog}/index.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -0
- package/dist/components/DeletePanelGroupDialog/index.js.map +1 -0
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -0
- package/dist/{src/components/SaveChangesConfirmationDialog → components/DiscardChangesConfirmationDialog}/index.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -0
- package/dist/components/DownloadButton/index.js.map +1 -0
- package/dist/components/DownloadButton/serializeDashboard.js.map +1 -0
- package/dist/components/EditButton/EditButton.js.map +1 -0
- package/dist/components/EditButton/index.js.map +1 -0
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -0
- package/dist/components/EditJsonButton/index.js.map +1 -0
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -0
- package/dist/components/EditJsonDialog/index.js.map +1 -0
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -0
- package/dist/components/EmptyDashboard/index.js.map +1 -0
- package/dist/components/GridLayout/GridContainer.js.map +1 -0
- package/dist/components/GridLayout/GridItemContent.js.map +1 -0
- package/dist/components/GridLayout/GridLayout.js.map +1 -0
- package/dist/components/GridLayout/GridTitle.js.map +1 -0
- package/dist/components/GridLayout/index.js.map +1 -0
- package/dist/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/components/Panel/Panel.js.map +1 -0
- package/dist/components/Panel/PanelActions.js.map +1 -0
- package/dist/components/Panel/PanelContent.js.map +1 -0
- package/dist/components/Panel/PanelHeader.js.map +1 -0
- package/dist/components/Panel/PanelLinks.js.map +1 -0
- package/dist/components/Panel/PanelPluginLoader.js.map +1 -0
- package/dist/components/Panel/index.js.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -0
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -0
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -0
- package/dist/{src/views/ViewDashboard → components/PanelDrawer}/index.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -0
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -0
- package/dist/components/PanelGroupDialog/index.js.map +1 -0
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -0
- package/dist/{src/components/AddGroupButton → components/QuerySummaryTable}/index.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -0
- package/dist/components/SaveChangesConfirmationDialog/index.js.map +1 -0
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -0
- package/dist/{src/components/DeletePanelDialog → components/SaveDashboardButton}/index.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -0
- package/dist/components/Variables/EditVariablesButton.js.map +1 -0
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableEditor.js.map +1 -0
- package/dist/components/Variables/VariableList.js.map +1 -0
- package/dist/components/Variables/index.js.map +1 -0
- package/dist/components/index.js.map +1 -0
- package/dist/constants/grid-layout-config.js.map +1 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/styles.js.map +1 -0
- package/dist/constants/user-interface-text.js.map +1 -0
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
- package/dist/context/DashboardProvider/common.js.map +1 -0
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -0
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -0
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -0
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -0
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -0
- package/dist/context/DashboardProvider/index.js.map +1 -0
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -0
- package/dist/context/DashboardProvider/panel-slice.js.map +1 -0
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -0
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.js.map +1 -0
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
- package/dist/{src/components/EditButton → context/VariableProvider}/index.js.map +1 -1
- package/dist/context/VariableProvider/query-params.js.map +1 -0
- package/dist/context/VariableProvider/utils.js.map +1 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/useDashboard.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/test/dashboard-provider.js.map +1 -0
- package/dist/test/datasource-provider.js.map +1 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/plugin-registry.js.map +1 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/test/testDashboard.js.map +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/panelUtils.js.map +1 -0
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -0
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -0
- package/dist/{src/components/Panel → views/ViewDashboard}/index.js.map +1 -1
- package/dist/views/index.js.map +1 -0
- package/package.json +7 -7
- package/dist/src/components/AddGroupButton/AddGroupButton.js.map +0 -1
- package/dist/src/components/AddPanelButton/AddPanelButton.js.map +0 -1
- package/dist/src/components/AddPanelButton/index.js.map +0 -1
- package/dist/src/components/Dashboard/Dashboard.js.map +0 -1
- package/dist/src/components/Dashboard/index.js.map +0 -1
- package/dist/src/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +0 -1
- package/dist/src/components/DashboardStickyToolbar/index.js.map +0 -1
- package/dist/src/components/DashboardToolbar/DashboardToolbar.js.map +0 -1
- package/dist/src/components/DashboardToolbar/index.js.map +0 -1
- package/dist/src/components/Datasources/DatasourceEditor.js.map +0 -1
- package/dist/src/components/Datasources/EditDatasourcesButton.js.map +0 -1
- package/dist/src/components/DeletePanelDialog/DeletePanelDialog.js.map +0 -1
- package/dist/src/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +0 -1
- package/dist/src/components/DeletePanelGroupDialog/index.js.map +0 -1
- package/dist/src/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +0 -1
- package/dist/src/components/DiscardChangesConfirmationDialog/index.js.map +0 -1
- package/dist/src/components/DownloadButton/DownloadButton.js.map +0 -1
- package/dist/src/components/DownloadButton/index.js.map +0 -1
- package/dist/src/components/DownloadButton/serializeDashboard.js.map +0 -1
- package/dist/src/components/EditButton/EditButton.js.map +0 -1
- package/dist/src/components/EditJsonButton/EditJsonButton.js.map +0 -1
- package/dist/src/components/EditJsonButton/index.js.map +0 -1
- package/dist/src/components/EditJsonDialog/EditJsonDialog.js.map +0 -1
- package/dist/src/components/EmptyDashboard/EmptyDashboard.js.map +0 -1
- package/dist/src/components/EmptyDashboard/index.js.map +0 -1
- package/dist/src/components/GridLayout/GridContainer.js.map +0 -1
- package/dist/src/components/GridLayout/GridItemContent.js.map +0 -1
- package/dist/src/components/GridLayout/GridLayout.js.map +0 -1
- package/dist/src/components/GridLayout/GridTitle.js.map +0 -1
- package/dist/src/components/GridLayout/index.js.map +0 -1
- package/dist/src/components/Panel/HeaderIconButton.js.map +0 -1
- package/dist/src/components/Panel/Panel.js.map +0 -1
- package/dist/src/components/Panel/PanelActions.js.map +0 -1
- package/dist/src/components/Panel/PanelContent.js.map +0 -1
- package/dist/src/components/Panel/PanelHeader.js.map +0 -1
- package/dist/src/components/Panel/PanelLinks.js.map +0 -1
- package/dist/src/components/Panel/PanelPluginLoader.js.map +0 -1
- package/dist/src/components/PanelDrawer/PanelDrawer.js.map +0 -1
- package/dist/src/components/PanelDrawer/PanelEditorForm.js.map +0 -1
- package/dist/src/components/PanelDrawer/PanelPreview.js.map +0 -1
- package/dist/src/components/PanelDrawer/usePanelEditor.js.map +0 -1
- package/dist/src/components/PanelGroupDialog/PanelGroupDialog.js.map +0 -1
- package/dist/src/components/PanelGroupDialog/PanelGroupEditorForm.js.map +0 -1
- package/dist/src/components/PanelGroupDialog/index.js.map +0 -1
- package/dist/src/components/QuerySummaryTable/QuerySummaryTable.js.map +0 -1
- package/dist/src/components/QuerySummaryTable/index.js.map +0 -1
- package/dist/src/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +0 -1
- package/dist/src/components/SaveDashboardButton/SaveDashboardButton.js.map +0 -1
- package/dist/src/components/SaveDashboardButton/index.js.map +0 -1
- package/dist/src/components/Variables/BuiltinVariableAccordions.js.map +0 -1
- package/dist/src/components/Variables/EditVariablesButton.js.map +0 -1
- package/dist/src/components/Variables/Variable.js.map +0 -1
- package/dist/src/components/Variables/VariableEditor.js.map +0 -1
- package/dist/src/components/Variables/VariableList.js.map +0 -1
- package/dist/src/components/Variables/index.js.map +0 -1
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/constants/index.js.map +0 -1
- package/dist/src/constants/styles.js.map +0 -1
- package/dist/src/constants/user-interface-text.js.map +0 -1
- package/dist/src/context/DashboardProvider/DashboardProvider.js.map +0 -1
- package/dist/src/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +0 -1
- package/dist/src/context/DashboardProvider/common.js.map +0 -1
- package/dist/src/context/DashboardProvider/dashboard-provider-api.js.map +0 -1
- package/dist/src/context/DashboardProvider/delete-panel-group-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/delete-panel-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/discard-changes-dialog-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/duplicate-panel-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/edit-json-dialog-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/index.js.map +0 -1
- package/dist/src/context/DashboardProvider/panel-editor-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/panel-group-editor-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/panel-group-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/panel-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/save-changes-dialog-slice.js.map +0 -1
- package/dist/src/context/DashboardProvider/view-panel-slice.js.map +0 -1
- package/dist/src/context/DatasourceStoreProvider.js.map +0 -1
- package/dist/src/context/VariableProvider/VariableProvider.js.map +0 -1
- package/dist/src/context/VariableProvider/hydrationUtils.js.map +0 -1
- package/dist/src/context/VariableProvider/query-params.js.map +0 -1
- package/dist/src/context/VariableProvider/utils.js.map +0 -1
- package/dist/src/context/index.js.map +0 -1
- package/dist/src/context/useDashboard.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/test/dashboard-provider.js.map +0 -1
- package/dist/src/test/datasource-provider.js.map +0 -1
- package/dist/src/test/index.js.map +0 -1
- package/dist/src/test/plugin-registry.js.map +0 -1
- package/dist/src/test/render.js.map +0 -1
- package/dist/src/test/setup-tests.js.map +0 -1
- package/dist/src/test/testDashboard.js.map +0 -1
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/panelUtils.js.map +0 -1
- package/dist/src/views/ViewDashboard/DashboardApp.js.map +0 -1
- package/dist/src/views/ViewDashboard/ViewDashboard.js.map +0 -1
- package/dist/src/views/index.js.map +0 -1
- /package/dist/cjs/{src/components → components}/AddGroupButton/AddGroupButton.js +0 -0
- /package/dist/cjs/{src/components → components}/AddGroupButton/index.js +0 -0
- /package/dist/cjs/{src/components → components}/AddPanelButton/AddPanelButton.js +0 -0
- /package/dist/cjs/{src/components → components}/AddPanelButton/index.js +0 -0
- /package/dist/cjs/{src/components → components}/Dashboard/Dashboard.js +0 -0
- /package/dist/cjs/{src/components → components}/Dashboard/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -0
- /package/dist/cjs/{src/components → components}/DashboardStickyToolbar/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DashboardToolbar/DashboardToolbar.js +0 -0
- /package/dist/cjs/{src/components → components}/DashboardToolbar/index.js +0 -0
- /package/dist/cjs/{src/components → components}/Datasources/DatasourceEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/Datasources/EditDatasourcesButton.js +0 -0
- /package/dist/cjs/{src/components → components}/Datasources/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DeletePanelDialog/DeletePanelDialog.js +0 -0
- /package/dist/cjs/{src/components → components}/DeletePanelDialog/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DeletePanelGroupDialog/DeletePanelGroupDialog.js +0 -0
- /package/dist/cjs/{src/components → components}/DeletePanelGroupDialog/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +0 -0
- /package/dist/cjs/{src/components → components}/DiscardChangesConfirmationDialog/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DownloadButton/DownloadButton.js +0 -0
- /package/dist/cjs/{src/components → components}/DownloadButton/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DownloadButton/serializeDashboard.js +0 -0
- /package/dist/cjs/{src/components → components}/EditButton/EditButton.js +0 -0
- /package/dist/cjs/{src/components → components}/EditButton/index.js +0 -0
- /package/dist/cjs/{src/components → components}/EditJsonButton/EditJsonButton.js +0 -0
- /package/dist/cjs/{src/components → components}/EditJsonButton/index.js +0 -0
- /package/dist/cjs/{src/components → components}/EditJsonDialog/EditJsonDialog.js +0 -0
- /package/dist/cjs/{src/components → components}/EditJsonDialog/index.js +0 -0
- /package/dist/cjs/{src/components → components}/EmptyDashboard/EmptyDashboard.js +0 -0
- /package/dist/cjs/{src/components → components}/EmptyDashboard/index.js +0 -0
- /package/dist/cjs/{src/components → components}/GridLayout/GridContainer.js +0 -0
- /package/dist/cjs/{src/components → components}/GridLayout/GridItemContent.js +0 -0
- /package/dist/cjs/{src/components → components}/GridLayout/GridLayout.js +0 -0
- /package/dist/cjs/{src/components → components}/GridLayout/GridTitle.js +0 -0
- /package/dist/cjs/{src/components → components}/GridLayout/index.js +0 -0
- /package/dist/cjs/{src/components → components}/Panel/HeaderIconButton.js +0 -0
- /package/dist/cjs/{src/components → components}/Panel/Panel.js +0 -0
- /package/dist/cjs/{src/components → components}/Panel/PanelActions.js +0 -0
- /package/dist/cjs/{src/components → components}/Panel/PanelContent.js +0 -0
- /package/dist/cjs/{src/components → components}/Panel/PanelHeader.js +0 -0
- /package/dist/cjs/{src/components → components}/Panel/PanelLinks.js +0 -0
- /package/dist/cjs/{src/components → components}/Panel/PanelPluginLoader.js +0 -0
- /package/dist/cjs/{src/components → components}/Panel/index.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelDrawer/PanelDrawer.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelDrawer/PanelEditorForm.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelDrawer/PanelPreview.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelDrawer/index.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelDrawer/usePanelEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelGroupDialog/PanelGroupDialog.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelGroupDialog/PanelGroupEditorForm.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelGroupDialog/index.js +0 -0
- /package/dist/cjs/{src/components → components}/QuerySummaryTable/QuerySummaryTable.js +0 -0
- /package/dist/cjs/{src/components → components}/QuerySummaryTable/index.js +0 -0
- /package/dist/cjs/{src/components → components}/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +0 -0
- /package/dist/cjs/{src/components → components}/SaveChangesConfirmationDialog/index.js +0 -0
- /package/dist/cjs/{src/components → components}/SaveDashboardButton/SaveDashboardButton.js +0 -0
- /package/dist/cjs/{src/components → components}/SaveDashboardButton/index.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/BuiltinVariableAccordions.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/EditVariablesButton.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/Variable.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/VariableEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/VariableList.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/index.js +0 -0
- /package/dist/cjs/{src/components → components}/index.js +0 -0
- /package/dist/cjs/{src/constants → constants}/grid-layout-config.js +0 -0
- /package/dist/cjs/{src/constants → constants}/index.js +0 -0
- /package/dist/cjs/{src/constants → constants}/styles.js +0 -0
- /package/dist/cjs/{src/constants → constants}/user-interface-text.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/DashboardProvider.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/DashboardProviderWithQueryParams.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/common.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/dashboard-provider-api.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/delete-panel-group-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/delete-panel-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/discard-changes-dialog-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/duplicate-panel-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/edit-json-dialog-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/index.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/panel-editor-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/panel-group-editor-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/panel-group-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/panel-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/save-changes-dialog-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DashboardProvider/view-panel-slice.js +0 -0
- /package/dist/cjs/{src/context → context}/DatasourceStoreProvider.js +0 -0
- /package/dist/cjs/{src/context → context}/VariableProvider/VariableProvider.js +0 -0
- /package/dist/cjs/{src/context → context}/VariableProvider/hydrationUtils.js +0 -0
- /package/dist/cjs/{src/context → context}/VariableProvider/index.js +0 -0
- /package/dist/cjs/{src/context → context}/VariableProvider/query-params.js +0 -0
- /package/dist/cjs/{src/context → context}/VariableProvider/utils.js +0 -0
- /package/dist/cjs/{src/context → context}/index.js +0 -0
- /package/dist/cjs/{src/context → context}/useDashboard.js +0 -0
- /package/dist/cjs/{src/index.js → index.js} +0 -0
- /package/dist/cjs/{src/test → test}/dashboard-provider.js +0 -0
- /package/dist/cjs/{src/test → test}/datasource-provider.js +0 -0
- /package/dist/cjs/{src/test → test}/index.js +0 -0
- /package/dist/cjs/{src/test → test}/plugin-registry.js +0 -0
- /package/dist/cjs/{src/test → test}/render.js +0 -0
- /package/dist/cjs/{src/test → test}/setup-tests.js +0 -0
- /package/dist/cjs/{src/test → test}/testDashboard.js +0 -0
- /package/dist/cjs/{src/utils → utils}/index.js +0 -0
- /package/dist/cjs/{src/utils → utils}/panelUtils.js +0 -0
- /package/dist/cjs/{src/views → views}/ViewDashboard/DashboardApp.js +0 -0
- /package/dist/cjs/{src/views → views}/ViewDashboard/ViewDashboard.js +0 -0
- /package/dist/cjs/{src/views → views}/ViewDashboard/index.js +0 -0
- /package/dist/cjs/{src/views → views}/index.js +0 -0
- /package/dist/{src/components → components}/AddGroupButton/AddGroupButton.js +0 -0
- /package/dist/{src/components → components}/AddGroupButton/index.js +0 -0
- /package/dist/{src/components → components}/AddPanelButton/AddPanelButton.js +0 -0
- /package/dist/{src/components → components}/AddPanelButton/index.js +0 -0
- /package/dist/{src/components → components}/Dashboard/Dashboard.js +0 -0
- /package/dist/{src/components → components}/Dashboard/index.js +0 -0
- /package/dist/{src/components → components}/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -0
- /package/dist/{src/components → components}/DashboardStickyToolbar/index.js +0 -0
- /package/dist/{src/components → components}/DashboardToolbar/DashboardToolbar.js +0 -0
- /package/dist/{src/components → components}/DashboardToolbar/index.js +0 -0
- /package/dist/{src/components → components}/Datasources/DatasourceEditor.js +0 -0
- /package/dist/{src/components → components}/Datasources/EditDatasourcesButton.js +0 -0
- /package/dist/{src/components → components}/Datasources/index.js +0 -0
- /package/dist/{src/components → components}/DeletePanelDialog/DeletePanelDialog.js +0 -0
- /package/dist/{src/components → components}/DeletePanelDialog/index.js +0 -0
- /package/dist/{src/components → components}/DeletePanelGroupDialog/DeletePanelGroupDialog.js +0 -0
- /package/dist/{src/components → components}/DeletePanelGroupDialog/index.js +0 -0
- /package/dist/{src/components → components}/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +0 -0
- /package/dist/{src/components → components}/DiscardChangesConfirmationDialog/index.js +0 -0
- /package/dist/{src/components → components}/DownloadButton/DownloadButton.js +0 -0
- /package/dist/{src/components → components}/DownloadButton/index.js +0 -0
- /package/dist/{src/components → components}/DownloadButton/serializeDashboard.js +0 -0
- /package/dist/{src/components → components}/EditButton/EditButton.js +0 -0
- /package/dist/{src/components → components}/EditButton/index.js +0 -0
- /package/dist/{src/components → components}/EditJsonButton/EditJsonButton.js +0 -0
- /package/dist/{src/components → components}/EditJsonButton/index.js +0 -0
- /package/dist/{src/components → components}/EditJsonDialog/EditJsonDialog.js +0 -0
- /package/dist/{src/components → components}/EditJsonDialog/index.js +0 -0
- /package/dist/{src/components → components}/EmptyDashboard/EmptyDashboard.js +0 -0
- /package/dist/{src/components → components}/EmptyDashboard/index.js +0 -0
- /package/dist/{src/components → components}/GridLayout/GridContainer.js +0 -0
- /package/dist/{src/components → components}/GridLayout/GridItemContent.js +0 -0
- /package/dist/{src/components → components}/GridLayout/GridLayout.js +0 -0
- /package/dist/{src/components → components}/GridLayout/GridTitle.js +0 -0
- /package/dist/{src/components → components}/GridLayout/index.js +0 -0
- /package/dist/{src/components → components}/Panel/HeaderIconButton.js +0 -0
- /package/dist/{src/components → components}/Panel/Panel.js +0 -0
- /package/dist/{src/components → components}/Panel/PanelActions.js +0 -0
- /package/dist/{src/components → components}/Panel/PanelContent.js +0 -0
- /package/dist/{src/components → components}/Panel/PanelHeader.js +0 -0
- /package/dist/{src/components → components}/Panel/PanelLinks.js +0 -0
- /package/dist/{src/components → components}/Panel/PanelPluginLoader.js +0 -0
- /package/dist/{src/components → components}/Panel/index.js +0 -0
- /package/dist/{src/components → components}/PanelDrawer/PanelDrawer.js +0 -0
- /package/dist/{src/components → components}/PanelDrawer/PanelEditorForm.js +0 -0
- /package/dist/{src/components → components}/PanelDrawer/PanelPreview.js +0 -0
- /package/dist/{src/components → components}/PanelDrawer/index.js +0 -0
- /package/dist/{src/components → components}/PanelDrawer/usePanelEditor.js +0 -0
- /package/dist/{src/components → components}/PanelGroupDialog/PanelGroupDialog.js +0 -0
- /package/dist/{src/components → components}/PanelGroupDialog/PanelGroupEditorForm.js +0 -0
- /package/dist/{src/components → components}/PanelGroupDialog/index.js +0 -0
- /package/dist/{src/components → components}/QuerySummaryTable/QuerySummaryTable.js +0 -0
- /package/dist/{src/components → components}/QuerySummaryTable/index.js +0 -0
- /package/dist/{src/components → components}/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +0 -0
- /package/dist/{src/components → components}/SaveChangesConfirmationDialog/index.js +0 -0
- /package/dist/{src/components → components}/SaveDashboardButton/SaveDashboardButton.js +0 -0
- /package/dist/{src/components → components}/SaveDashboardButton/index.js +0 -0
- /package/dist/{src/components → components}/Variables/BuiltinVariableAccordions.js +0 -0
- /package/dist/{src/components → components}/Variables/EditVariablesButton.js +0 -0
- /package/dist/{src/components → components}/Variables/Variable.js +0 -0
- /package/dist/{src/components → components}/Variables/VariableEditor.js +0 -0
- /package/dist/{src/components → components}/Variables/VariableList.js +0 -0
- /package/dist/{src/components → components}/Variables/index.js +0 -0
- /package/dist/{src/components → components}/index.js +0 -0
- /package/dist/{src/constants → constants}/grid-layout-config.js +0 -0
- /package/dist/{src/constants → constants}/index.js +0 -0
- /package/dist/{src/constants → constants}/styles.js +0 -0
- /package/dist/{src/constants → constants}/user-interface-text.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/DashboardProvider.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/DashboardProviderWithQueryParams.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/common.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/dashboard-provider-api.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/delete-panel-group-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/delete-panel-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/discard-changes-dialog-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/duplicate-panel-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/edit-json-dialog-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/index.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/panel-editor-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/panel-group-editor-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/panel-group-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/panel-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/save-changes-dialog-slice.js +0 -0
- /package/dist/{src/context → context}/DashboardProvider/view-panel-slice.js +0 -0
- /package/dist/{src/context → context}/DatasourceStoreProvider.js +0 -0
- /package/dist/{src/context → context}/VariableProvider/VariableProvider.js +0 -0
- /package/dist/{src/context → context}/VariableProvider/hydrationUtils.js +0 -0
- /package/dist/{src/context → context}/VariableProvider/index.js +0 -0
- /package/dist/{src/context → context}/VariableProvider/query-params.js +0 -0
- /package/dist/{src/context → context}/VariableProvider/utils.js +0 -0
- /package/dist/{src/context → context}/index.js +0 -0
- /package/dist/{src/context → context}/useDashboard.js +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/test → test}/dashboard-provider.js +0 -0
- /package/dist/{src/test → test}/datasource-provider.js +0 -0
- /package/dist/{src/test → test}/index.js +0 -0
- /package/dist/{src/test → test}/plugin-registry.js +0 -0
- /package/dist/{src/test → test}/render.js +0 -0
- /package/dist/{src/test → test}/setup-tests.js +0 -0
- /package/dist/{src/test → test}/testDashboard.js +0 -0
- /package/dist/{src/utils → utils}/index.js +0 -0
- /package/dist/{src/utils → utils}/panelUtils.js +0 -0
- /package/dist/{src/views → views}/ViewDashboard/DashboardApp.js +0 -0
- /package/dist/{src/views → views}/ViewDashboard/ViewDashboard.js +0 -0
- /package/dist/{src/views → views}/ViewDashboard/index.js +0 -0
- /package/dist/{src/views → views}/index.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/VariableProvider/hydrationUtils.ts"],"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 { DEFAULT_ALL_VALUE, VariableValue, VariableDefinition } from '@perses-dev/core';\nimport { VariableStoreStateMap, VariableState } from '@perses-dev/plugin-system';\nimport { ExternalVariableDefinition } from '@perses-dev/dashboards';\n\n// TODO: move to VariableProvider/utils.ts\nfunction hydrateVariableState(variable: VariableDefinition, initialValue?: VariableValue): VariableState {\n const varState: VariableState = {\n value: null,\n loading: false,\n overriding: false,\n overridden: false,\n };\n switch (variable.kind) {\n case 'TextVariable':\n varState.value = initialValue ?? variable.spec.value;\n break;\n case 'ListVariable':\n varState.options = [];\n varState.value = initialValue ?? variable.spec.defaultValue ?? null;\n // TODO: smarter fallbacks for defaultValue when allowAllValue is true\n if (varState.options.length > 0 && !varState.value) {\n const firstOptionValue = varState.options[0]?.value ?? null;\n if (firstOptionValue !== null) {\n varState.value = variable.spec.allowMultiple ? [firstOptionValue] : firstOptionValue;\n }\n }\n\n // \"all\" variable handling assumes the value is not in an array. This is\n // handled properly during internal variable interactions, but it is possible\n // to end up in a buggy state if the variables are initialized with an \"all\"\n // value inside an array. When hydrating variables, normalize this to minimize\n // bugs.\n if (Array.isArray(varState.value) && varState.value.length === 1 && varState.value[0] === DEFAULT_ALL_VALUE) {\n varState.value = DEFAULT_ALL_VALUE;\n }\n\n break;\n default:\n break;\n }\n return varState;\n}\n\n/**\n * Build the local variable states according to the given definitions\n * @param localDefinitions local variable definitions. Dynamic part.\n * @param externalDefinitions external variables definitions. Static part.\n * @param initialValues values coming from query parameters\n */\nexport function hydrateVariableDefinitionStates(\n localDefinitions: VariableDefinition[],\n initialValues: Record<string, VariableValue>,\n externalDefinitions: ExternalVariableDefinition[] = []\n): VariableStoreStateMap {\n const state: VariableStoreStateMap = new VariableStoreStateMap();\n\n // Collect the names used by local definitions\n let overridingNames: Record<string, boolean> = {};\n localDefinitions.forEach(\n (v) => {\n overridingNames[v.spec.name] = true;\n },\n {} as Record<string, boolean>\n );\n\n // Then populate the external variables state,\n // taking care of well flagging each name as used, so the overridden state can be filled accordingly.\n const overriddenNames: Record<string, boolean> = {};\n externalDefinitions.forEach(\n (externalDef) => {\n const source = externalDef.source;\n externalDef.definitions.forEach((v) => {\n const name = v.spec.name;\n const param = initialValues[name];\n const initialValue = param ? param : null;\n state.set(\n { source, name },\n {\n ...hydrateVariableState(v, initialValue),\n overridden: !!overridingNames[name],\n }\n );\n\n overridingNames[name] = true;\n overriddenNames[v.spec.name] = true;\n });\n },\n {} as Record<string, boolean>\n );\n\n // Then populate the local variables state,\n // taking care the overriding state is filled according to the names used in external variables.\n localDefinitions.forEach((v) => {\n const name = v.spec.name;\n const param = initialValues[name];\n const initialValue = param ? param : null;\n state.set(\n { name },\n {\n ...hydrateVariableState(v, initialValue),\n overriding: !!overriddenNames[name],\n }\n );\n });\n\n overridingNames = {};\n externalDefinitions\n .slice()\n .reverse()\n .forEach((externalDef) => {\n const source = externalDef.source;\n externalDef.definitions.forEach((v) => {\n const name = v.spec.name;\n const value = state.get({ source, name });\n if (value) {\n value.overriding = !!overridingNames[name];\n }\n overridingNames[name] = true;\n });\n });\n return state;\n}\n"],"names":["DEFAULT_ALL_VALUE","VariableStoreStateMap","hydrateVariableState","variable","initialValue","varState","value","loading","overriding","overridden","kind","spec","options","defaultValue","length","firstOptionValue","allowMultiple","Array","isArray","hydrateVariableDefinitionStates","localDefinitions","initialValues","externalDefinitions","state","overridingNames","forEach","v","name","overriddenNames","externalDef","source","definitions","param","set","slice","reverse","get"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AACl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MrB,QAAQiB,MAAMa,GAAG,CAAC;gBAAEN;gBAAQH;YAAK;YACvC,IAAIrB,OAAO;gBACTA,MAAME,UAAU,GAAG,CAAC,CAACgB,eAAe,CAACG,KAAK;YAC5C;YACAH,eAAe,CAACG,KAAK,GAAG;QAC1B;IACF;IACF,OAAOJ;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/VariableProvider/query-params.ts"],"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 { VariableValue, VariableDefinition } from '@perses-dev/core';\nimport { QueryParamConfig, useQueryParams } from 'use-query-params';\n\nconst variableQueryParameterPrefix = 'var-';\n\nexport function getURLQueryParamName(name: string): string {\n return `${variableQueryParameterPrefix}${name}`;\n}\n\nexport function encodeVariableValue(value: VariableValue): string | null {\n if (Array.isArray(value)) {\n return value.join(',');\n }\n return value;\n}\n\nexport function decodeVariableValue(value: string): VariableValue {\n if (!value) {\n return null;\n }\n const values = value.split(',');\n if (values.length === 1) {\n return values[0] as string;\n }\n return values;\n}\n\nconst VariableValueParam: QueryParamConfig<VariableValue> = {\n encode: encodeVariableValue,\n decode: (v) => {\n if (typeof v === 'string') {\n return decodeVariableValue(v);\n }\n return '';\n },\n};\n\nexport function useVariableQueryParams(defs: VariableDefinition[]): ReturnType<typeof useQueryParams> {\n const config: Record<string, typeof VariableValueParam> = {};\n defs.forEach((def) => {\n const name = getURLQueryParamName(def.spec.name);\n config[name] = VariableValueParam;\n });\n return useQueryParams(config, { updateType: 'replaceIn' });\n}\n\nexport function getInitalValuesFromQueryParameters(\n queryParamValues: Record<string, VariableValue>\n): Record<string, VariableValue> {\n const values: Record<string, VariableValue> = {};\n Object.keys(queryParamValues).forEach((key) => {\n const value = queryParamValues[key];\n if (!value) {\n return;\n }\n const name = key.replace(variableQueryParameterPrefix, '');\n values[name] = value;\n });\n return values;\n}\n"],"names":["useQueryParams","variableQueryParameterPrefix","getURLQueryParamName","name","encodeVariableValue","value","Array","isArray","join","decodeVariableValue","values","split","length","VariableValueParam","encode","decode","v","useVariableQueryParams","defs","config","forEach","def","spec","updateType","getInitalValuesFromQueryParameters","queryParamValues","Object","keys","key","replace"],"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,SAA2BA,cAAc,QAAQ,mBAAmB;AAEpE,MAAMC,+BAA+B;AAErC,OAAO,SAASC,qBAAqBC,IAAY;IAC/C,OAAO,GAAGF,+BAA+BE,MAAM;AACjD;AAEA,OAAO,SAASC,oBAAoBC,KAAoB;IACtD,IAAIC,MAAMC,OAAO,CAACF,QAAQ;QACxB,OAAOA,MAAMG,IAAI,CAAC;IACpB;IACA,OAAOH;AACT;AAEA,OAAO,SAASI,oBAAoBJ,KAAa;IAC/C,IAAI,CAACA,OAAO;QACV,OAAO;IACT;IACA,MAAMK,SAASL,MAAMM,KAAK,CAAC;IAC3B,IAAID,OAAOE,MAAM,KAAK,GAAG;QACvB,OAAOF,MAAM,CAAC,EAAE;IAClB;IACA,OAAOA;AACT;AAEA,MAAMG,qBAAsD;IAC1DC,QAAQV;IACRW,QAAQ,CAACC;QACP,IAAI,OAAOA,MAAM,UAAU;YACzB,OAAOP,oBAAoBO;QAC7B;QACA,OAAO;IACT;AACF;AAEA,OAAO,SAASC,uBAAuBC,IAA0B;IAC/D,MAAMC,SAAoD,CAAC;IAC3DD,KAAKE,OAAO,CAAC,CAACC;QACZ,MAAMlB,OAAOD,qBAAqBmB,IAAIC,IAAI,CAACnB,IAAI;QAC/CgB,MAAM,CAAChB,KAAK,GAAGU;IACjB;IACA,OAAOb,eAAemB,QAAQ;QAAEI,YAAY;IAAY;AAC1D;AAEA,OAAO,SAASC,mCACdC,gBAA+C;IAE/C,MAAMf,SAAwC,CAAC;IAC/CgB,OAAOC,IAAI,CAACF,kBAAkBL,OAAO,CAAC,CAACQ;QACrC,MAAMvB,QAAQoB,gBAAgB,CAACG,IAAI;QACnC,IAAI,CAACvB,OAAO;YACV;QACF;QACA,MAAMF,OAAOyB,IAAIC,OAAO,CAAC5B,8BAA8B;QACvDS,MAAM,CAACP,KAAK,GAAGE;IACjB;IACA,OAAOK;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/context/VariableProvider/utils.ts"],"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 { VariableDefinition } from '@perses-dev/core';\nimport { VariableStoreStateMap } from '@perses-dev/plugin-system';\nimport { ExternalVariableDefinition } from '@perses-dev/dashboards';\n\n/*\n * Check whether saved variable definitions are out of date with current default list values in Zustand store\n */\nexport function checkSavedDefaultVariableStatus(\n definitions: VariableDefinition[],\n varState: VariableStoreStateMap\n): {\n modifiedVariableNames: string[];\n isSavedVariableModified: boolean;\n} {\n let isSavedVariableModified = false;\n const modifiedVariableNames: string[] = [];\n for (const savedVariable of definitions) {\n const name = savedVariable.spec.name;\n if (savedVariable.kind === 'ListVariable') {\n const currentVariable = varState.get({ name });\n if (currentVariable?.value !== null && currentVariable?.value !== savedVariable.spec.defaultValue) {\n modifiedVariableNames.push(name);\n isSavedVariableModified = true;\n }\n } else if (savedVariable.kind === 'TextVariable') {\n const currentVariable = varState.get({ name });\n const currentVariableValue = typeof currentVariable?.value === 'string' ? currentVariable.value : '';\n if (savedVariable.spec.value !== currentVariableValue) {\n modifiedVariableNames.push(name);\n isSavedVariableModified = true;\n }\n }\n }\n return { isSavedVariableModified, modifiedVariableNames };\n}\n\n/**\n * Merge the different kind of variable definition into a list without any duplicates (same name).\n * Respects the order of priority explained in {@link forEachVariableDefinition}\n * @param locals\n * @param externals\n */\nexport function mergeVariableDefinitions(\n locals: VariableDefinition[],\n externals: ExternalVariableDefinition[]\n): VariableDefinition[] {\n const pushed: Record<string, boolean> = {};\n const result: VariableDefinition[] = [];\n\n // Append the value only if it's not already appended\n forEachVariableDefinition(locals, externals, (value: VariableDefinition, name: string) => {\n if (!pushed[name]) {\n result.push(value);\n pushed[name] = true;\n }\n });\n return result;\n}\n\n/**\n * Find a definition by its name.\n * Respects the order of priority explained in {@link forEachVariableDefinition}\n * @param name\n * @param localDefinitions\n * @param externalDefinitions\n */\nexport function findVariableDefinitionByName(\n name: string,\n localDefinitions: VariableDefinition[],\n externalDefinitions: ExternalVariableDefinition[]\n): VariableDefinition | undefined {\n return mergeVariableDefinitions(localDefinitions, externalDefinitions).find((d) => d.spec.name === name);\n}\n\n/**\n * Loop on local and external variable definitions, respecting the order of priority:\n * - local var defs override external var defs of same name\n * - each external var defs override the external var defs coming after.\n * @param locals\n * @param externals\n * @param callbackFn\n */\nexport function forEachVariableDefinition(\n locals: VariableDefinition[],\n externals: ExternalVariableDefinition[],\n callbackFn: (varDef: VariableDefinition, name: string, source?: string) => void\n): void {\n locals.forEach((v) => callbackFn(v, v.spec.name));\n externals.forEach((ext) => ext.definitions.forEach((v) => callbackFn(v, v.spec.name, ext.source)));\n}\n"],"names":["checkSavedDefaultVariableStatus","definitions","varState","isSavedVariableModified","modifiedVariableNames","savedVariable","name","spec","kind","currentVariable","get","value","defaultValue","push","currentVariableValue","mergeVariableDefinitions","locals","externals","pushed","result","forEachVariableDefinition","findVariableDefinitionByName","localDefinitions","externalDefinitions","find","d","callbackFn","forEach","v","ext","source"],"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;AAMjC;;CAEC,GACD,OAAO,SAASA,gCACdC,WAAiC,EACjCC,QAA+B;IAK/B,IAAIC,0BAA0B;IAC9B,MAAMC,wBAAkC,EAAE;IAC1C,KAAK,MAAMC,iBAAiBJ,YAAa;QACvC,MAAMK,OAAOD,cAAcE,IAAI,CAACD,IAAI;QACpC,IAAID,cAAcG,IAAI,KAAK,gBAAgB;YACzC,MAAMC,kBAAkBP,SAASQ,GAAG,CAAC;gBAAEJ;YAAK;YAC5C,IAAIG,iBAAiBE,UAAU,QAAQF,iBAAiBE,UAAUN,cAAcE,IAAI,CAACK,YAAY,EAAE;gBACjGR,sBAAsBS,IAAI,CAACP;gBAC3BH,0BAA0B;YAC5B;QACF,OAAO,IAAIE,cAAcG,IAAI,KAAK,gBAAgB;YAChD,MAAMC,kBAAkBP,SAASQ,GAAG,CAAC;gBAAEJ;YAAK;YAC5C,MAAMQ,uBAAuB,OAAOL,iBAAiBE,UAAU,WAAWF,gBAAgBE,KAAK,GAAG;YAClG,IAAIN,cAAcE,IAAI,CAACI,KAAK,KAAKG,sBAAsB;gBACrDV,sBAAsBS,IAAI,CAACP;gBAC3BH,0BAA0B;YAC5B;QACF;IACF;IACA,OAAO;QAAEA;QAAyBC;IAAsB;AAC1D;AAEA;;;;;CAKC,GACD,OAAO,SAASW,yBACdC,MAA4B,EAC5BC,SAAuC;IAEvC,MAAMC,SAAkC,CAAC;IACzC,MAAMC,SAA+B,EAAE;IAEvC,qDAAqD;IACrDC,0BAA0BJ,QAAQC,WAAW,CAACN,OAA2BL;QACvE,IAAI,CAACY,MAAM,CAACZ,KAAK,EAAE;YACjBa,OAAON,IAAI,CAACF;YACZO,MAAM,CAACZ,KAAK,GAAG;QACjB;IACF;IACA,OAAOa;AACT;AAEA;;;;;;CAMC,GACD,OAAO,SAASE,6BACdf,IAAY,EACZgB,gBAAsC,EACtCC,mBAAiD;IAEjD,OAAOR,yBAAyBO,kBAAkBC,qBAAqBC,IAAI,CAAC,CAACC,IAAMA,EAAElB,IAAI,CAACD,IAAI,KAAKA;AACrG;AAEA;;;;;;;CAOC,GACD,OAAO,SAASc,0BACdJ,MAA4B,EAC5BC,SAAuC,EACvCS,UAA+E;IAE/EV,OAAOW,OAAO,CAAC,CAACC,IAAMF,WAAWE,GAAGA,EAAErB,IAAI,CAACD,IAAI;IAC/CW,UAAUU,OAAO,CAAC,CAACE,MAAQA,IAAI5B,WAAW,CAAC0B,OAAO,CAAC,CAACC,IAAMF,WAAWE,GAAGA,EAAErB,IAAI,CAACD,IAAI,EAAEuB,IAAIC,MAAM;AACjG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/index.ts"],"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\nexport * from './DashboardProvider';\nexport * from './DatasourceStoreProvider';\nexport * from './VariableProvider';\nexport * from './useDashboard';\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;AACpC,cAAc,4BAA4B;AAC1C,cAAc,qBAAqB;AACnC,cAAc,iBAAiB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/context/useDashboard.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 {\n createPanelRef,\n DashboardResource,\n EphemeralDashboardResource,\n GridDefinition,\n PanelGroupId,\n} from '@perses-dev/core';\nimport { PanelGroupDefinition, useDashboardStore } from './DashboardProvider';\nimport { useVariableDefinitionActions, useVariableDefinitions } from './VariableProvider';\n\nexport function useDashboard(): {\n dashboard: DashboardResource | EphemeralDashboardResource;\n setDashboard: (dashboardResource: DashboardResource | EphemeralDashboardResource) => void;\n} {\n const {\n panels,\n panelGroups,\n panelGroupOrder,\n setDashboard: setDashboardResource,\n kind,\n metadata,\n display,\n duration,\n refreshInterval,\n datasources,\n ttl,\n } = useDashboardStore(\n ({\n panels,\n panelGroups,\n panelGroupOrder,\n setDashboard,\n kind,\n metadata,\n display,\n duration,\n refreshInterval,\n datasources,\n ttl,\n }) => ({\n panels,\n panelGroups,\n panelGroupOrder,\n setDashboard,\n kind,\n metadata,\n display,\n duration,\n refreshInterval,\n datasources,\n ttl,\n })\n );\n const { setVariableDefinitions } = useVariableDefinitionActions();\n const variables = useVariableDefinitions();\n const layouts = convertPanelGroupsToLayouts(panelGroups, panelGroupOrder);\n\n const dashboard =\n kind === 'Dashboard'\n ? ({\n kind,\n metadata,\n spec: {\n display,\n panels,\n layouts,\n variables,\n duration,\n refreshInterval,\n datasources,\n },\n } as DashboardResource)\n : ({\n kind,\n metadata,\n spec: {\n display,\n panels,\n layouts,\n variables,\n duration,\n refreshInterval,\n datasources,\n ttl,\n },\n } as EphemeralDashboardResource);\n\n const setDashboard = (dashboardResource: DashboardResource | EphemeralDashboardResource): void => {\n setVariableDefinitions(dashboardResource.spec.variables);\n setDashboardResource(dashboardResource);\n };\n\n return {\n dashboard,\n setDashboard,\n };\n}\n\nfunction convertPanelGroupsToLayouts(\n panelGroups: Record<number, PanelGroupDefinition>,\n panelGroupOrder: PanelGroupId[]\n): GridDefinition[] {\n const layouts: GridDefinition[] = [];\n panelGroupOrder.map((groupOrderId) => {\n const group = panelGroups[groupOrderId];\n if (group === undefined) {\n throw new Error('panel group not found');\n }\n const { title, isCollapsed, itemLayouts, itemPanelKeys } = group;\n let display = undefined;\n if (title) {\n display = {\n title,\n collapse: {\n open: !isCollapsed,\n },\n };\n }\n const layout: GridDefinition = {\n kind: 'Grid',\n spec: {\n display,\n items: itemLayouts.map((layout) => {\n const panelKey = itemPanelKeys[layout.i];\n if (panelKey === undefined) {\n throw new Error(`Missing panel key of layout ${layout.i}`);\n }\n return {\n x: layout.x,\n y: layout.y,\n width: layout.w,\n height: layout.h,\n content: createPanelRef(panelKey),\n };\n }),\n },\n };\n layouts.push(layout);\n });\n\n return layouts;\n}\n"],"names":["createPanelRef","useDashboardStore","useVariableDefinitionActions","useVariableDefinitions","useDashboard","panels","panelGroups","panelGroupOrder","setDashboard","setDashboardResource","kind","metadata","display","duration","refreshInterval","datasources","ttl","setVariableDefinitions","variables","layouts","convertPanelGroupsToLayouts","dashboard","spec","dashboardResource","map","groupOrderId","group","undefined","Error","title","isCollapsed","itemLayouts","itemPanelKeys","collapse","open","layout","items","panelKey","i","x","y","width","w","height","h","content","push"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CA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UAAUC,WAAW;YACvB,MAAM,IAAIC,MAAM;QAClB;QACA,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,WAAW,EAAEC,aAAa,EAAE,GAAGN;QAC3D,IAAId,UAAUe;QACd,IAAIE,OAAO;YACTjB,UAAU;gBACRiB;gBACAI,UAAU;oBACRC,MAAM,CAACJ;gBACT;YACF;QACF;QACA,MAAMK,SAAyB;YAC7BzB,MAAM;YACNY,MAAM;gBACJV;gBACAwB,OAAOL,YAAYP,GAAG,CAAC,CAACW;oBACtB,MAAME,WAAWL,aAAa,CAACG,OAAOG,CAAC,CAAC;oBACxC,IAAID,aAAaV,WAAW;wBAC1B,MAAM,IAAIC,MAAM,CAAC,4BAA4B,EAAEO,OAAOG,CAAC,EAAE;oBAC3D;oBACA,OAAO;wBACLC,GAAGJ,OAAOI,CAAC;wBACXC,GAAGL,OAAOK,CAAC;wBACXC,OAAON,OAAOO,CAAC;wBACfC,QAAQR,OAAOS,CAAC;wBAChBC,SAAS7C,eAAeqC;oBAC1B;gBACF;YACF;QACF;QACAlB,QAAQ2B,IAAI,CAACX;IACf;IAEA,OAAOhB;AACT"}
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/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 './components';\nexport * from './context';\nexport * from './views';\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;AAC7B,cAAc,YAAY;AAC1B,cAAc,UAAU"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/dashboard-provider.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 { DashboardResource } from '@perses-dev/core';\nimport { useContext } from 'react';\nimport { StoreApi } from 'zustand';\nimport { DashboardContext, DashboardStoreState } from '../context';\nimport testDashboard from './testDashboard';\n\n/**\n * Helper to get a test dashboard resource.\n */\nexport function getTestDashboard(): DashboardResource {\n // TODO: Should we be cloning this to create a new object each time?\n return testDashboard;\n}\n\n/**\n * Test helper to create a \"spy\" component that will capture the DashboardProvider's store, allowing you to inspect\n * its state in tests. Be sure to render the DashboardProviderSpy component that's returned in the component test\n * underneath the DashboardProvider.\n */\nexport function createDashboardProviderSpy(): {\n DashboardProviderSpy: () => null;\n store: { value?: StoreApi<DashboardStoreState> };\n} {\n const store: { value?: StoreApi<DashboardStoreState> } = {};\n\n // Spy component just captures the store value so it can be inspected in tests\n function DashboardProviderSpy(): null {\n const ctx = useContext(DashboardContext);\n store.value = ctx;\n return null;\n }\n\n return {\n DashboardProviderSpy,\n store,\n };\n}\n"],"names":["useContext","DashboardContext","testDashboard","getTestDashboard","createDashboardProviderSpy","store","DashboardProviderSpy","ctx","value"],"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,QAAQ,QAAQ;AAEnC,SAASC,gBAAgB,QAA6B,aAAa;AACnE,OAAOC,mBAAmB,kBAAkB;AAE5C;;CAEC,GACD,OAAO,SAASC;IACd,oEAAoE;IACpE,OAAOD;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASE;IAId,MAAMC,QAAmD,CAAC;IAE1D,8EAA8E;IAC9E,SAASC;QACP,MAAMC,MAAMP,WAAWC;QACvBI,MAAMG,KAAK,GAAGD;QACd,OAAO;IACT;IAEA,OAAO;QACLD;QACAD;IACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/datasource-provider.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 { GlobalDatasourceResource } from '@perses-dev/core';\nimport { DatasourceStoreProviderProps } from '../context';\nimport { getTestDashboard } from './dashboard-provider';\n\nexport const prometheusDemoUrl = 'https://prometheus.demo.prometheus.io';\nexport const prometheusDemo: GlobalDatasourceResource = {\n kind: 'GlobalDatasource',\n metadata: {\n name: 'PrometheusDemo',\n createdAt: '0001-01-01T00:00:00Z',\n updatedAt: '0001-01-01T00:00:00Z',\n version: 0,\n },\n spec: {\n default: true,\n plugin: {\n kind: 'PrometheusDatasource',\n spec: { directUrl: prometheusDemoUrl },\n },\n },\n} as const;\n\n// This default currently defines the bare minimum to get a story working in\n// the `Dashboard` storybook with the Prometheus demo api. We'll likely want\n// to expand it to do more in the future.\nexport const defaultDatasourceProps: Pick<DatasourceStoreProviderProps, 'datasourceApi' | 'dashboardResource'> = {\n dashboardResource: getTestDashboard(),\n datasourceApi: {\n buildProxyUrl: () => '',\n getDatasource: () => {\n return Promise.resolve(undefined);\n },\n getGlobalDatasource: (selector) => {\n if (selector.kind === 'PrometheusDatasource') {\n return Promise.resolve(prometheusDemo);\n }\n\n return Promise.resolve(undefined);\n },\n listDatasources: () => {\n return Promise.resolve([]);\n },\n listGlobalDatasources: () => {\n return Promise.resolve([]);\n },\n },\n};\n"],"names":["getTestDashboard","prometheusDemoUrl","prometheusDemo","kind","metadata","name","createdAt","updatedAt","version","spec","default","plugin","directUrl","defaultDatasourceProps","dashboardResource","datasourceApi","buildProxyUrl","getDatasource","Promise","resolve","undefined","getGlobalDatasource","selector","listDatasources","listGlobalDatasources"],"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;AAIjC,SAASA,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,MAAMC,oBAAoB,wCAAwC;AACzE,OAAO,MAAMC,iBAA2C;IACtDC,MAAM;IACNC,UAAU;QACRC,MAAM;QACNC,WAAW;QACXC,WAAW;QACXC,SAAS;IACX;IACAC,MAAM;QACJC,SAAS;QACTC,QAAQ;YACNR,MAAM;YACNM,MAAM;gBAAEG,WAAWX;YAAkB;QACvC;IACF;AACF,EAAW;AAEX,4EAA4E;AAC5E,4EAA4E;AAC5E,yCAAyC;AACzC,OAAO,MAAMY,yBAAoG;IAC/GC,mBAAmBd;IACnBe,eAAe;QACbC,eAAe,IAAM;QACrBC,eAAe;YACb,OAAOC,QAAQC,OAAO,CAACC;QACzB;QACAC,qBAAqB,CAACC;YACpB,IAAIA,SAASnB,IAAI,KAAK,wBAAwB;gBAC5C,OAAOe,QAAQC,OAAO,CAACjB;YACzB;YAEA,OAAOgB,QAAQC,OAAO,CAACC;QACzB;QACAG,iBAAiB;YACf,OAAOL,QAAQC,OAAO,CAAC,EAAE;QAC3B;QACAK,uBAAuB;YACrB,OAAON,QAAQC,OAAO,CAAC,EAAE;QAC3B;IACF;AACF,EAAE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/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-provider';\nexport * from './datasource-provider';\nexport * from './plugin-registry';\nexport * from './render';\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,uBAAuB;AACrC,cAAc,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,cAAc,WAAW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/plugin-registry.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 { UnknownSpec } from '@perses-dev/core';\nimport { PanelPlugin, MockPlugin } from '@perses-dev/plugin-system';\nimport { ReactElement } from 'react';\n\nconst FakeTimeSeriesChartOptionEditor = (): ReactElement => {\n return <div>TimeSeriesChart options</div>;\n};\n\nconst FakeTimeSeriesPlugin: PanelPlugin<UnknownSpec> = {\n PanelComponent: () => {\n return <div>TimeSeriesChart panel</div>;\n },\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: FakeTimeSeriesChartOptionEditor,\n },\n ],\n createInitialOptions: () => ({}),\n supportedQueryTypes: ['TimeSeriesQuery'],\n};\n\nconst MOCK_TIME_SERIES_PANEL: MockPlugin = {\n kind: 'Panel',\n spec: { name: 'TimeSeriesChart' },\n plugin: FakeTimeSeriesPlugin,\n};\n\n// Array of default mock plugins added to the PluginRegistry during test renders\nexport const MOCK_PLUGINS: MockPlugin[] = [MOCK_TIME_SERIES_PANEL];\n"],"names":["FakeTimeSeriesChartOptionEditor","div","FakeTimeSeriesPlugin","PanelComponent","panelOptionsEditorComponents","label","content","createInitialOptions","supportedQueryTypes","MOCK_TIME_SERIES_PANEL","kind","spec","name","plugin","MOCK_PLUGINS"],"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;;AAMjC,MAAMA,kCAAkC;IACtC,qBAAO,KAACC;kBAAI;;AACd;AAEA,MAAMC,uBAAiD;IACrDC,gBAAgB;QACd,qBAAO,KAACF;sBAAI;;IACd;IACAG,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAASN;QACX;KACD;IACDO,sBAAsB,IAAO,CAAA,CAAC,CAAA;IAC9BC,qBAAqB;QAAC;KAAkB;AAC1C;AAEA,MAAMC,yBAAqC;IACzCC,MAAM;IACNC,MAAM;QAAEC,MAAM;IAAkB;IAChCC,QAAQX;AACV;AAEA,gFAAgF;AAChF,OAAO,MAAMY,eAA6B;IAACL;CAAuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/render.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 { ChartsProvider, SnackbarProvider, testChartsTheme } from '@perses-dev/components';\nimport { mockPluginRegistry, PluginRegistry } from '@perses-dev/plugin-system';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { createMemoryHistory, MemoryHistory } from 'history';\nimport { ReactElement, useLayoutEffect, useState } from 'react';\nimport { Router } from 'react-router-dom';\nimport { QueryParamProvider } from 'use-query-params';\nimport { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6';\nimport { DatasourceStoreProvider } from '../context';\nimport { defaultDatasourceProps } from '../test';\nimport { MOCK_PLUGINS } from './plugin-registry';\n\ninterface CustomRouterProps {\n history: MemoryHistory;\n children: React.ReactNode;\n}\n\n/*\n * Workaround for React router upgrade type errors.\n * More details: https://stackoverflow.com/a/69948457/17575201\n */\nconst CustomRouter: React.FC<CustomRouterProps> = ({ history, children }) => {\n const [state, setState] = useState({\n action: history.action,\n location: history.location,\n });\n\n useLayoutEffect(() => history.listen(setState), [history]);\n\n return (\n <Router location={state.location} navigationType={state.action} navigator={history}>\n {children}\n </Router>\n );\n};\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(\n ui: React.ReactElement,\n options?: Omit<RenderOptions, 'queries'>,\n history?: MemoryHistory\n): RenderResult {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } } });\n\n const customHistory = history ?? createMemoryHistory();\n\n const mockRegistry = mockPluginRegistry(...MOCK_PLUGINS);\n\n const BaseRender = (): ReactElement => (\n <CustomRouter history={customHistory}>\n <QueryClientProvider client={queryClient}>\n <QueryParamProvider adapter={ReactRouter6Adapter}>\n <SnackbarProvider anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}>\n <ChartsProvider chartsTheme={testChartsTheme}>\n <PluginRegistry\n pluginLoader={mockRegistry.pluginLoader}\n defaultPluginKinds={mockRegistry.defaultPluginKinds}\n >\n <DatasourceStoreProvider {...defaultDatasourceProps}>{ui}</DatasourceStoreProvider>\n </PluginRegistry>\n </ChartsProvider>\n </SnackbarProvider>\n </QueryParamProvider>\n </QueryClientProvider>\n </CustomRouter>\n );\n\n return render(<BaseRender />, options);\n}\n"],"names":["ChartsProvider","SnackbarProvider","testChartsTheme","mockPluginRegistry","PluginRegistry","QueryClient","QueryClientProvider","render","createMemoryHistory","useLayoutEffect","useState","Router","QueryParamProvider","ReactRouter6Adapter","DatasourceStoreProvider","defaultDatasourceProps","MOCK_PLUGINS","CustomRouter","history","children","state","setState","action","location","listen","navigationType","navigator","renderWithContext","ui","options","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","customHistory","mockRegistry","BaseRender","client","adapter","anchorOrigin","vertical","horizontal","chartsTheme","pluginLoader","defaultPluginKinds"],"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,cAAc,EAAEC,gBAAgB,EAAEC,eAAe,QAAQ,yBAAyB;AAC3F,SAASC,kBAAkB,EAAEC,cA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,cAAA,KAAC1C;4BAAe2C,aAAazC;sCAC3B,cAAA,KAACE;gCACCwC,cAAcR,aAAaQ,YAAY;gCACvCC,oBAAoBT,aAAaS,kBAAkB;0CAEnD,cAAA,KAAC/B;oCAAyB,GAAGC,sBAAsB;8CAAGa;;;;;;;;IASpE,OAAOrB,qBAAO,KAAC8B,iBAAeR;AAChC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/setup-tests.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 { defaultFallbackInView } from 'react-intersection-observer';\n\n// Add testing library assertions\nimport '@testing-library/jest-dom/extend-expect';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n\n// Tell react-intersection-observer that everything should be considered in-view for tests (see package documentation\n// for other options)\ndefaultFallbackInView(true);\n"],"names":["defaultFallbackInView","jest","mock"],"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,qBAAqB,QAAQ,8BAA8B;AAEpE,iCAAiC;AACjC,OAAO,0CAA0C;AAEjD,iFAAiF;AACjFC,KAAKC,IAAI,CAAC;AAEV,qHAAqH;AACrH,qBAAqB;AACrBF,sBAAsB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/test/testDashboard.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 } from '@perses-dev/core';\n\nconst testDashboard: DashboardResource = {\n kind: 'Dashboard',\n metadata: {\n name: 'Node Stats',\n project: 'perses',\n createdAt: '2021-11-09',\n updatedAt: '2021-11-09',\n version: 0,\n },\n spec: {\n duration: '30m',\n refreshInterval: '0s',\n variables: [\n {\n kind: 'TextVariable',\n spec: {\n name: 'job',\n value: 'node',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'instance',\n value: 'demo.do.prometheus.io:9100',\n },\n },\n {\n kind: 'TextVariable',\n spec: {\n name: 'interval',\n value: '1m',\n },\n },\n ],\n panels: {\n cpu: {\n kind: 'Panel',\n spec: {\n display: { name: 'CPU' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: '%' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'avg without (cpu)(rate(node_cpu_seconds_total{job=\"node\",instance=\"$instance\",mode!=\"idle\"}[$interval]))',\n },\n },\n },\n },\n ],\n },\n },\n memory: {\n kind: 'Panel',\n spec: {\n display: { name: 'Memory' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'bytes' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'node_memory_MemTotal_bytes{job=\"node\",instance=\"$instance\"} - node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"} - node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Buffers_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_Cached_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query: 'node_memory_MemFree_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n },\n },\n // This panel is referenced in more than one layout below\n diskIO: {\n kind: 'Panel',\n spec: {\n display: { name: 'Disk I/O Utilization' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'percent' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n 'rate(node_disk_io_time_seconds_total{job=\"node\",instance=\"$instance\",device!~\"^(md\\\\\\\\d+$|dm-)\"}[$interval])',\n },\n },\n },\n },\n ],\n },\n },\n filesystemFullness: {\n kind: 'Panel',\n spec: {\n display: { name: 'Filesystem Fullness' },\n plugin: {\n kind: 'TimeSeriesChart',\n spec: {\n format: { unit: 'percent' },\n },\n },\n queries: [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: 'PrometheusTimeSeriesQuery',\n spec: {\n query:\n '1 - node_filesystem_free_bytes{job=\"node\",instance=\"$instance\",fstype!=\"rootfs\",mountpoint!~\"/(run|var).*\",mountpoint!=\"\"} / node_filesystem_size_bytes{job=\"node\",instance=\"$instance\"}',\n },\n },\n },\n },\n ],\n },\n },\n },\n layouts: [\n // Regular Title, no collapse enabled\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'CPU Stats',\n collapse: {\n open: true,\n },\n },\n items: [\n // First Row\n {\n x: 0,\n y: 0,\n width: 12,\n height: 4,\n content: { $ref: '#/spec/panels/cpu' },\n },\n {\n x: 0,\n y: 5,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n ],\n },\n },\n // No title,\n {\n kind: 'Grid',\n spec: {\n items: [\n {\n x: 0,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/diskIO' },\n },\n {\n x: 8,\n y: 0,\n width: 8,\n height: 3,\n content: { $ref: '#/spec/panels/memory' },\n },\n ],\n },\n },\n // Collapsed\n {\n kind: 'Grid',\n spec: {\n display: {\n title: 'Disk Stats',\n collapse: {\n open: false,\n },\n },\n items: [\n {\n x: 18,\n y: 0,\n width: 6,\n height: 2,\n content: { $ref: '#/spec/panels/filesystemFullness' },\n },\n ],\n },\n },\n ],\n },\n};\n\nexport default testDashboard;\n"],"names":["testDashboard","kind","metadata","name","project","createdAt","updatedAt","version","spec","duration","refreshInterval","variables","value","panels","cpu","display","plugin","format","unit","queries","query","memory","diskIO","filesystemFullness","layouts","title","collapse","open","items","x","y","width","height","content","$ref"],"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;AAIjC,MAAMA,gBAAmC;IACvCC,MAAM;IACNC,UAAU;QACRC,MAAM;QACNC,SAAS;QACTC,WAAW;QACXC,WAAW;QACXC,SAAS;IACX;IACAC,MAAM;QACJC,UAAU;QACVC,iBAAiB;QACjBC,WAAW;YACT;gBACEV,MAAM;gBACNO,MAAM;oBACJL,MAAM;oBACNS,OAAO;gBACT;YACF;YACA;gBACEX,MAAM;gBACNO,MAAM;oBACJL,MAAM;oB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BACRC,MAAM;wBACR;oBACF;oBACAC,OAAO;wBACL;4BACEC,GAAG;4BACHC,GAAG;4BACHC,OAAO;4BACPC,QAAQ;4BACRC,SAAS;gCAAEC,MAAM;4BAAmC;wBACtD;qBACD;gBACH;YACF;SACD;IACH;AACF;AAEA,eAAelC,cAAc"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/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 './panelUtils';\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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/panelUtils.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 { PanelDefinition } from '@perses-dev/core';\nimport { PanelGroupDefinition, PanelGroupItemLayout } from '../context';\nimport { GRID_LAYOUT_SMALL_BREAKPOINT, GRID_LAYOUT_COLS } from '../constants';\n\n// Given a PanelGroup, will find the Y coordinate for adding a new row to the grid, taking into account the items present\nexport function getYForNewRow(group: PanelGroupDefinition): number {\n let newRowY = 0;\n for (const layout of group.itemLayouts) {\n const itemMaxY = layout.y + layout.h;\n if (itemMaxY > newRowY) {\n newRowY = itemMaxY;\n }\n }\n return newRowY;\n}\n\ntype PanelGroupItemBounds = {\n /**\n * Left horizontal position.\n */\n x1: number;\n /**\n * Right horizontal position.\n */\n x2: number;\n /**\n * Top vertical position.\n */\n y1: number;\n /**\n * Bottom vertical position\n */\n y2: number;\n};\n\nfunction getPanelBounds({ x, y, w, h }: PanelGroupItemLayout): PanelGroupItemBounds {\n return {\n x1: x,\n x2: x + w,\n y1: y,\n y2: y + h,\n };\n}\n\nexport type UnpositionedPanelGroupItemLayout = Omit<PanelGroupItemLayout, 'x' | 'y'>;\n\n/**\n * Inserts a new panel into the layout with placement determined by a specified\n * reference panel. The new panel is placed:\n * - To the right of the reference panel if there is space available without\n * moving other panels.\n * - Otherwise, directly below the reference panel. If other panels are below\n * this location, they will also shift downward because the grid uses\n * vertical-based compacting.\n *\n * @param newLayout - Layout for new panel to insert into the grid.\n * @param referenceLayout - Layout for reference panel used to determine the\n * placement of the new panel.\n * @param itemLayouts - Full grid layout.\n * @returns - Item layouts modified to insert the new panel.\n */\nexport function insertPanelInLayout(\n newLayout: UnpositionedPanelGroupItemLayout,\n referenceLayout: PanelGroupItemLayout,\n itemLayouts: PanelGroupItemLayout[]\n): PanelGroupItemLayout[] {\n const MAX_LAYOUT_WIDTH = GRID_LAYOUT_COLS[GRID_LAYOUT_SMALL_BREAKPOINT];\n\n const referenceBounds = getPanelBounds(referenceLayout);\n\n // Organize layouts based on vertical relation to the item being inserted\n // after.\n const aboveInsertRow: PanelGroupItemLayout[] = [];\n const insertRow: PanelGroupItemLayout[] = [];\n const belowInsertRow: PanelGroupItemLayout[] = [];\n itemLayouts.forEach((itemLayout) => {\n const itemBounds = getPanelBounds(itemLayout);\n\n if (itemBounds.y2 <= referenceBounds.y1) {\n aboveInsertRow.push(itemLayout);\n } else if (itemBounds.y1 >= referenceBounds.y2) {\n belowInsertRow.push(itemLayout);\n } else {\n insertRow.push(itemLayout);\n }\n });\n\n // Cannot safely assume that the order of item layouts array is strictly\n // left to right. Sorting the row by horizontal position to more easily find\n // gaps.\n insertRow.sort((a, b) => a.x - b.x);\n const insertAfterIndex = insertRow.findIndex((item) => item.i === referenceLayout.i);\n\n if (insertAfterIndex === insertRow.length - 1) {\n // Insert to the right when space is available and the reference is the last\n // item in the row.\n if (referenceBounds.x2 + newLayout.w <= MAX_LAYOUT_WIDTH) {\n return [\n ...aboveInsertRow,\n ...insertRow,\n {\n ...newLayout,\n x: referenceBounds.x2,\n y: referenceBounds.y1,\n },\n ...belowInsertRow,\n ];\n }\n } else if (insertAfterIndex >= 0) {\n const nextItem = insertRow[insertAfterIndex + 1];\n\n if (nextItem && getPanelBounds(nextItem).x1 - referenceBounds.x2 >= newLayout.w) {\n // Insert to the right when space is available between the reference and\n // the next item in the row.\n insertRow.splice(insertAfterIndex + 1, 0, {\n ...newLayout,\n x: referenceBounds.x2,\n y: referenceBounds.y1,\n });\n\n return [...aboveInsertRow, ...insertRow, ...belowInsertRow];\n }\n }\n\n // Insert the new item below the original and shift the items below the\n // row where the reference is located.\n return [\n ...aboveInsertRow,\n ...insertRow,\n { x: referenceBounds.x1, y: referenceBounds.y2, ...newLayout },\n ...belowInsertRow.map((itemLayout) => {\n // Note: the grid will not necessarily display all of these items shifted\n // all the way down because of vertical compacting, but shifing their\n // y position ensures the new item gets vertical precedence over items\n // below it in that compacting.\n return { ...itemLayout, y: itemLayout.y + newLayout.h };\n }),\n ];\n}\n\n/**\n * Get a valid panel key, where a valid key:\n * - does not include invalid characters\n * - is unique\n */\nexport function getValidPanelKey(panelKey: string, panels: Record<string, PanelDefinition>): string {\n const uniquePanelKeys = getUniquePanelKeys(panels);\n let normalizedPanelKey = getPanelKeyParts(removeWhiteSpaces(panelKey)).name;\n\n const matchingKey = uniquePanelKeys[normalizedPanelKey];\n if (typeof matchingKey === 'number') {\n normalizedPanelKey += `-${matchingKey + 1}`;\n }\n return normalizedPanelKey;\n}\n\ntype PanelKeyParts = {\n name: string;\n number?: number;\n};\n\nconst removeWhiteSpaces = (str: string): string => {\n return str.replace(/\\s+/g, '');\n};\n\n/**\n * Breaks the specified panel key into the name and the optional `-number` used\n * for deduping panels with the same name.\n */\nfunction getPanelKeyParts(panelKey: string): PanelKeyParts {\n const parts = panelKey.match(/(.+)-([0-9]+)/);\n if (parts && parts[1] && parts[2]) {\n return {\n name: parts[1],\n number: parseInt(parts[2], 10),\n };\n }\n\n return {\n name: panelKey,\n };\n}\n\n// Find all the unique panel keys and the largest number used for each.\n// ex: cpu, cpu-1, cpu-2 count as the same panel key since these panels have the same name\nfunction getUniquePanelKeys(panels: Record<string, PanelDefinition>): Record<string, number> {\n const uniquePanelKeys: Record<string, number> = {};\n Object.keys(panels).forEach((panelKey) => {\n const { name, number } = getPanelKeyParts(panelKey);\n if (uniquePanelKeys[name] === undefined) {\n uniquePanelKeys[name] = 0;\n }\n const currentValue = uniquePanelKeys[name];\n if (typeof currentValue === 'number' && number) {\n // Check for the maximum value because we cannot rely on a sequential\n // set of numbers when panels are modified.\n uniquePanelKeys[name] = Math.max(currentValue, number);\n }\n });\n return uniquePanelKeys;\n}\n"],"names":["GRID_LAYOUT_SMALL_BREAKPOINT","GRID_LAYOUT_COLS","getYForNewRow","group","newRowY","layout","itemLayouts","itemMaxY","y","h","getPanelBounds","x","w","x1","x2","y1","y2","insertPanelInLayout","newLayout","referenceLayout","MAX_LAYOUT_WIDTH","referenceBounds","aboveInsertRow","insertRow","belowInsertRow","forEach","itemLayout","itemBounds","push","sort","a","b","insertAfterIndex","findIndex","item","i","length","nextItem","splice","map","getValidPanelKey","panelKey","panels","uniquePanelKeys","getUniquePanelKeys","normalizedPanelKey","getPanelKeyParts","removeWhiteSpaces","name","matchingKey","str","replace","parts","match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/DashboardApp.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 { Box } from '@mui/material';\nimport { ChartsProvider, ErrorAlert, ErrorBoundary, useChartsTheme } from '@perses-dev/components';\nimport { DashboardResource, EphemeralDashboardResource } from '@perses-dev/core';\nimport { useDatasourceStore } from '@perses-dev/plugin-system';\nimport {\n PanelDrawer,\n Dashboard,\n PanelGroupDialog,\n DeletePanelGroupDialog,\n DashboardDiscardChangesConfirmationDialog,\n DashboardToolbar,\n DeletePanelDialog,\n EmptyDashboardProps,\n EditJsonDialog,\n SaveChangesConfirmationDialog,\n} from '../../components';\nimport { OnSaveDashboard, useDashboard, useDiscardChangesConfirmationDialog, useEditMode } from '../../context';\n\nexport interface DashboardAppProps {\n emptyDashboardProps?: Partial<EmptyDashboardProps>;\n dashboardResource: DashboardResource | EphemeralDashboardResource;\n dashboardTitleComponent?: JSX.Element;\n onSave?: OnSaveDashboard;\n onDiscard?: (entity: DashboardResource) => void;\n initialVariableIsSticky?: boolean;\n isReadonly: boolean;\n isVariableEnabled: boolean;\n isDatasourceEnabled: boolean;\n isCreating?: boolean;\n}\n\nexport const DashboardApp = (props: DashboardAppProps): ReactElement => {\n const {\n dashboardResource,\n dashboardTitleComponent,\n emptyDashboardProps,\n onSave,\n onDiscard,\n initialVariableIsSticky,\n isReadonly,\n isVariableEnabled,\n isDatasourceEnabled,\n isCreating,\n } = props;\n\n const chartsTheme = useChartsTheme();\n\n const { isEditMode, setEditMode } = useEditMode();\n const { dashboard, setDashboard } = useDashboard();\n const [originalDashboard, setOriginalDashboard] = useState<\n DashboardResource | EphemeralDashboardResource | undefined\n >(undefined);\n const { setSavedDatasources } = useDatasourceStore();\n\n const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } =\n useDiscardChangesConfirmationDialog();\n\n const handleDiscardChanges = (): void => {\n // Reset to the original spec and exit edit mode\n if (originalDashboard) {\n setDashboard(originalDashboard);\n }\n setEditMode(false);\n closeDiscardChangesConfirmationDialog();\n if (onDiscard) {\n onDiscard(dashboard as unknown as DashboardResource);\n }\n };\n\n const onEditButtonClick = (): void => {\n setEditMode(true);\n setOriginalDashboard(dashboard);\n setSavedDatasources(dashboard.spec.datasources ?? {});\n };\n\n const onCancelButtonClick = (): void => {\n // check if dashboard has been modified\n if (JSON.stringify(dashboard) === JSON.stringify(originalDashboard)) {\n setEditMode(false);\n } else {\n openDiscardChangesConfirmationDialog({\n onDiscardChanges: () => {\n handleDiscardChanges();\n },\n onCancel: () => {\n closeDiscardChangesConfirmationDialog();\n },\n });\n }\n };\n\n return (\n <Box\n sx={{\n flexGrow: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <DashboardToolbar\n dashboardName={dashboardResource.metadata.name}\n dashboardTitleComponent={dashboardTitleComponent}\n initialVariableIsSticky={initialVariableIsSticky}\n onSave={onSave}\n isReadonly={isReadonly}\n isVariableEnabled={isVariableEnabled}\n isDatasourceEnabled={isDatasourceEnabled}\n onEditButtonClick={onEditButtonClick}\n onCancelButtonClick={onCancelButtonClick}\n />\n <Box sx={{ paddingTop: 2, paddingX: 2, height: '100%' }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Dashboard\n emptyDashboardProps={{\n onEditButtonClick,\n ...emptyDashboardProps,\n }}\n />\n </ErrorBoundary>\n <ChartsProvider chartsTheme={chartsTheme} enablePinning={false} enableSyncGrouping={false}>\n <PanelDrawer />\n </ChartsProvider>\n <PanelGroupDialog />\n <DeletePanelGroupDialog />\n <DeletePanelDialog />\n <DashboardDiscardChangesConfirmationDialog />\n <EditJsonDialog isReadonly={!isEditMode} disableMetadataEdition={!isCreating} />\n <SaveChangesConfirmationDialog />\n </Box>\n </Box>\n );\n};\n"],"names":["useState","Box","ChartsProvider","ErrorAlert","ErrorBoundary","useChartsTheme","useDatasourceStore","PanelDrawer","Dashboard","PanelGroupDialog","DeletePanelGroupDialog","DashboardDiscardChangesConfirmationDialog","DashboardToolbar","DeletePanelDialog","EditJsonDialog","SaveChangesConfirmationDialog","useDashboard","useDiscardChangesConfirmationDialog","useEditMode","DashboardApp","props","dashboardResource","dashboardTitleComponent","emptyDashboardProps","onSave","onDiscard","initialVariableIsSticky","isReadonly","isVariableEnabled","isDatasourceEnabled","isCreating","chartsTheme","isEditMode","setEditMode","dashboard","setDashboard","originalDashboard","setOriginalDashboard","undefined","setSavedDatasources","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","handleDiscardChanges","onEditButtonClick","spec","datasources","onCancelButtonClick","JSON","stringify","onDiscardChanges","onCancel","sx","flexGrow","overflowX","overflowY","display","flexDirection","dashboardName","metadata","name","paddingTop","paddingX","height","FallbackComponent","enablePinning","enableSyncGrouping","disableMetadataEdition"],"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,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,EAAEC,UAAU,EAAEC,aAAa,EAAEC,cAAc,QAAQ,yBAAyB;AAEnG,SAASC,kBAAkB,QAAQ,4BAA4B;AAC/D,SACEC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,sBAAsB,EACtBC,yCAAyC,EACzCC,gBAAgB,EAChBC,iBAAiB,EAEjBC,cAAc,E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BACzBI,yBAAyBA;gBACzBF,QAAQA;gBACRG,YAAYA;gBACZC,mBAAmBA;gBACnBC,qBAAqBA;gBACrBc,mBAAmBA;gBACnBG,qBAAqBA;;0BAEvB,MAAC7C;gBAAIkD,IAAI;oBAAES,YAAY;oBAAGC,UAAU;oBAAGC,QAAQ;gBAAO;;kCACpD,KAAC1D;wBAAc2D,mBAAmB5D;kCAChC,cAAA,KAACK;4BACCe,qBAAqB;gCACnBoB;gCACA,GAAGpB,mBAAmB;4BACxB;;;kCAGJ,KAACrB;wBAAe6B,aAAaA;wBAAaiC,eAAe;wBAAOC,oBAAoB;kCAClF,cAAA,KAAC1D;;kCAEH,KAACE;kCACD,KAACC;kCACD,KAACG;kCACD,KAACF;kCACD,KAACG;wBAAea,YAAY,CAACK;wBAAYkC,wBAAwB,CAACpC;;kCAClE,KAACf;;;;;AAIT,EAAE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/views/ViewDashboard/ViewDashboard.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 { Box, BoxProps } from '@mui/material';\nimport { BuiltinVariableDefinition, DEFAULT_DASHBOARD_DURATION, DEFAULT_REFRESH_INTERVAL } from '@perses-dev/core';\nimport { ErrorBoundary, ErrorAlert, combineSx } from '@perses-dev/components';\nimport {\n TimeRangeProviderWithQueryParams,\n useInitialRefreshInterval,\n useInitialTimeRange,\n usePluginBuiltinVariableDefinitions,\n} from '@perses-dev/plugin-system';\nimport { ReactElement, useMemo } from 'react';\nimport {\n DatasourceStoreProviderProps,\n DatasourceStoreProvider,\n VariableProviderProps,\n VariableProviderWithQueryParams,\n} from '../../context';\nimport { DashboardProviderWithQueryParams } from '../../context/DashboardProvider/DashboardProviderWithQueryParams';\nimport { DashboardApp, DashboardAppProps } from './DashboardApp';\n\nexport interface ViewDashboardProps extends Omit<BoxProps, 'children'>, DashboardAppProps {\n datasourceApi: DatasourceStoreProviderProps['datasourceApi'];\n externalVariableDefinitions?: VariableProviderProps['externalVariableDefinitions'];\n isEditing?: boolean;\n isCreating?: boolean;\n}\n\n/**\n * The View for displaying a Dashboard, along with the UI for selecting variable values.\n */\nexport function ViewDashboard(props: ViewDashboardProps): ReactElement {\n const {\n dashboardResource,\n datasourceApi,\n externalVariableDefinitions,\n dashboardTitleComponent,\n emptyDashboardProps,\n onSave,\n onDiscard,\n initialVariableIsSticky,\n isReadonly,\n isVariableEnabled,\n isDatasourceEnabled,\n isEditing,\n isCreating,\n sx,\n ...others\n } = props;\n const { spec } = dashboardResource;\n const dashboardDuration = spec.duration ?? DEFAULT_DASHBOARD_DURATION;\n const dashboardRefreshInterval = spec.refreshInterval ?? DEFAULT_REFRESH_INTERVAL;\n const initialTimeRange = useInitialTimeRange(dashboardDuration);\n const initialRefreshInterval = useInitialRefreshInterval(dashboardRefreshInterval);\n const { data } = usePluginBuiltinVariableDefinitions();\n\n const builtinVariables = useMemo(() => {\n const result = [\n {\n kind: 'BuiltinVariable',\n spec: {\n name: '__dashboard',\n value: () => dashboardResource.metadata.name,\n source: 'Dashboard',\n display: {\n name: '__dashboard',\n description: 'The name of the current dashboard',\n hidden: true,\n },\n },\n } as BuiltinVariableDefinition,\n {\n kind: 'BuiltinVariable',\n spec: {\n name: '__project',\n value: () => dashboardResource.metadata.project,\n source: 'Dashboard',\n display: {\n name: '__project',\n description: 'The name of the current dashboard project',\n hidden: true,\n },\n },\n } as BuiltinVariableDefinition,\n ];\n if (data) {\n data.forEach((def: BuiltinVariableDefinition) => result.push(def));\n }\n return result;\n }, [dashboardResource.metadata.name, dashboardResource.metadata.project, data]);\n\n return (\n <DatasourceStoreProvider dashboardResource={dashboardResource} datasourceApi={datasourceApi}>\n <DashboardProviderWithQueryParams\n initialState={{\n dashboardResource,\n isEditMode: !!isEditing,\n }}\n >\n <TimeRangeProviderWithQueryParams\n initialTimeRange={initialTimeRange}\n initialRefreshInterval={initialRefreshInterval}\n >\n <VariableProviderWithQueryParams\n initialVariableDefinitions={spec.variables}\n externalVariableDefinitions={externalVariableDefinitions}\n builtinVariableDefinitions={builtinVariables}\n >\n <Box\n sx={combineSx(\n {\n display: 'flex',\n width: '100%',\n height: '100%',\n position: 'relative',\n overflow: 'hidden',\n },\n sx\n )}\n {...others}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <DashboardApp\n dashboardResource={dashboardResource}\n dashboardTitleComponent={dashboardTitleComponent}\n emptyDashboardProps={emptyDashboardProps}\n onSave={onSave}\n onDiscard={onDiscard}\n initialVariableIsSticky={initialVariableIsSticky}\n isReadonly={isReadonly}\n isVariableEnabled={isVariableEnabled}\n isDatasourceEnabled={isDatasourceEnabled}\n isCreating={isCreating}\n />\n </ErrorBoundary>\n </Box>\n </VariableProviderWithQueryParams>\n </TimeRangeProviderWithQueryParams>\n </DashboardProviderWithQueryParams>\n </DatasourceStoreProvider>\n );\n}\n"],"names":["Box","DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL","ErrorBoundary","ErrorAlert","combineSx","TimeRangeProviderWithQueryParams","useInitialRefreshInterval","useInitialTimeRange","usePluginBuiltinVariableDefinitions","useMemo","DatasourceStoreProvider","VariableProviderWithQueryParams","DashboardProviderWithQueryParams","DashboardApp","ViewDashboard","props","dashboardResource","datasourceApi","externalVariableDefinitions","dashboardTitleComponent","emptyDashboardProps","onSave","onDiscard","initialVariableIsSticky","isReadonly","isVariableEnabled","isDatasourceEnabled","isEditing","isCreating","sx","others","spec","dashboardDuration","duration","dashboardRefreshInterval","refreshInterval","initialTimeRange","initialRefreshInterval","data","builtinVariables","result","kind","name","value","metadata","source","display","description","hidden","project","forEach","def","push","initialState","isEditMode","initialVariableDefinitions","variables","builtinVariableDefinitions","width","height","position","overflow","FallbackComponent"],"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,SAAoCC,0BAA0B,EAAEC,wBAAwB,QAAQ,mBAAmB;AACnH,SAASC,aAAa,EAAEC,UAAU,EAAEC,SAAS,QAAQ,yBAAyB;AAC9E,SACEC,gCAAgC,EAChCC,yBAAyB,EACzBC,mBAAmB,EACnBC,mCAAmC,QAC9B,4BAA4B;AACnC,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SAEEC,uBAAuB,EAEvBC,+BAA+B,QAC1B,gBAAgB;AACvB,SAASC,gCAAgC,QAAQ,mEAAmE;AACpH,SAASC,YAAY,QAA2B,iBAAiB;AASjE;;CAEC,GACD,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,EACJC,iBAAiB,EACjBC,aAAa,EACbC,2BAA2B,EAC3BC,uBAAuB,EACvBC,mBAAmB,EACnBC,MAAM,EACNC,SAAS,EACTC,uBAAuB,EACvBC,UAAU,EACVC,iBAAiB,EACjBC,mBAAmB,EACnBC,SAAS,EACTC,UAAU,EACVC,EAAE,EACF,GAAGC,QACJ,GAAGf;IACJ,MAAM,EAAEgB,IAAI,EAAE,GAAGf;IACjB,MAAMgB,oBAAoBD,KAAKE,QAAQ,IAAIjC;IAC3C,MAAMkC,2BAA2BH,KAAKI,eAAe,IAAIlC;IACzD,MAAMmC,mBAAmB7B,oBAAoByB;IAC7C,MAAMK,yBAAyB/B,0BAA0B4B;IACzD,MAAM,EAAEI,IAAI,EAAE,GAAG9B;IAEjB,MAAM+B,mBAAmB9B,QAAQ;QAC/B,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CACrBE,YAAYA;;;;;;;;AAS9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/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 './ViewDashboard';\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,kBAAkB"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/cjs/{src/components → components}/DashboardStickyToolbar/DashboardStickyToolbar.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/cjs/{src/components → components}/DeletePanelGroupDialog/DeletePanelGroupDialog.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/cjs/{src/context → context}/DashboardProvider/DashboardProviderWithQueryParams.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{src/components → components}/DashboardStickyToolbar/DashboardStickyToolbar.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|