@perses-dev/dashboards 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-explorer-plugin-c4a7621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Dashboard/Dashboard.js +8 -1
- package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +2 -2
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +1 -1
- package/dist/cjs/components/Datasources/DatasourceEditor.js +18 -18
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +3 -4
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +10 -13
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +2 -2
- package/dist/cjs/components/GridLayout/GridContainer.js +15 -10
- package/dist/cjs/components/GridLayout/GridItemContent.js +19 -4
- package/dist/cjs/components/GridLayout/GridLayout.js +61 -12
- package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
- package/dist/cjs/{validation/panel.js → components/Panel/HeaderIconButton.js} +8 -10
- package/dist/cjs/components/Panel/Panel.js +14 -10
- package/dist/cjs/components/Panel/PanelActions.js +216 -0
- package/dist/cjs/components/Panel/PanelContent.js +4 -4
- package/dist/cjs/components/Panel/PanelHeader.js +36 -103
- package/dist/cjs/components/Panel/PanelLinks.js +136 -0
- package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
- package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +67 -65
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +7 -3
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +9 -6
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +4 -6
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +2 -2
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +7 -14
- package/dist/cjs/components/Variables/EditVariablesButton.js +4 -4
- package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +43 -60
- package/dist/cjs/components/Variables/VariableEditor.js +34 -40
- package/dist/cjs/components/Variables/VariableList.js +23 -22
- package/dist/cjs/components/Variables/index.js +2 -2
- package/dist/cjs/constants/styles.js +15 -7
- package/dist/cjs/constants/user-interface-text.js +3 -0
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +10 -8
- package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +36 -0
- package/dist/cjs/context/DashboardProvider/common.js +2 -2
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +14 -6
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +7 -10
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +8 -3
- package/dist/cjs/context/DashboardProvider/view-panel-slice.js +79 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +18 -23
- package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +62 -69
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +11 -14
- package/dist/cjs/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
- package/dist/cjs/context/index.js +2 -2
- package/dist/cjs/context/useDashboard.js +4 -4
- package/dist/cjs/stories/decorators/WithDashboard.js +1 -1
- package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/cjs/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
- package/dist/cjs/stories/decorators/index.js +2 -2
- package/dist/cjs/test/plugin-registry.js +4 -2
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +3 -3
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +7 -8
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -1
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +2 -1
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +8 -1
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +3 -3
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
- package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js +1 -1
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts +2 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +19 -19
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +2 -5
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +3 -4
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +2 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +2 -1
- package/dist/components/EditButton/EditButton.d.ts.map +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +7 -10
- package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts +3 -3
- package/dist/components/EmptyDashboard/EmptyDashboard.d.ts.map +1 -1
- package/dist/components/EmptyDashboard/EmptyDashboard.js +2 -2
- package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
- package/dist/components/GridLayout/GridContainer.d.ts +5 -3
- package/dist/components/GridLayout/GridContainer.d.ts.map +1 -1
- package/dist/components/GridLayout/GridContainer.js +15 -10
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +2 -1
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +21 -6
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +4 -2
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +63 -14
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +3 -2
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +3 -3
- package/dist/components/GridLayout/GridTitle.js.map +1 -1
- package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
- package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
- package/dist/{context/TemplateVariableProvider/index.js → components/Panel/HeaderIconButton.js} +7 -3
- package/dist/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +11 -5
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +15 -11
- package/dist/components/Panel/Panel.js.map +1 -1
- package/dist/components/Panel/PanelActions.d.ts +16 -0
- package/dist/components/Panel/PanelActions.d.ts.map +1 -0
- package/dist/components/Panel/PanelActions.js +203 -0
- package/dist/components/Panel/PanelActions.js.map +1 -0
- package/dist/components/Panel/PanelContent.d.ts +2 -1
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +4 -4
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +8 -8
- package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
- package/dist/components/Panel/PanelHeader.js +39 -106
- package/dist/components/Panel/PanelHeader.js.map +1 -1
- package/dist/components/Panel/PanelLinks.d.ts +6 -0
- package/dist/components/Panel/PanelLinks.d.ts.map +1 -0
- package/dist/components/Panel/PanelLinks.js +123 -0
- package/dist/components/Panel/PanelLinks.js.map +1 -0
- package/dist/components/PanelDrawer/PanelDrawer.d.ts +2 -1
- package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
- package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +70 -68
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +3 -2
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +8 -4
- package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.d.ts +12 -10
- package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -1
- package/dist/components/PanelDrawer/usePanelEditor.js +9 -6
- package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts +2 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts +2 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +5 -7
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +3 -3
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +2 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +7 -14
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +2 -1
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +5 -5
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +6 -5
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/{TemplateVariable.js → Variable.js} +44 -61
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableEditor.d.ts +3 -2
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +35 -41
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +4 -3
- package/dist/components/Variables/VariableList.d.ts.map +1 -1
- package/dist/components/Variables/VariableList.js +21 -20
- package/dist/components/Variables/VariableList.js.map +1 -1
- package/dist/components/Variables/index.d.ts +1 -1
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +2 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/constants/styles.d.ts +4 -2
- package/dist/constants/styles.d.ts.map +1 -1
- package/dist/constants/styles.js +5 -3
- package/dist/constants/styles.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +3 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +3 -0
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +6 -3
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +11 -9
- package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts +4 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.d.ts.map +1 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +28 -0
- package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -0
- package/dist/context/DashboardProvider/common.d.ts.map +1 -1
- package/dist/context/DashboardProvider/common.js +2 -2
- package/dist/context/DashboardProvider/common.js.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +36 -23
- package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
- package/dist/context/DashboardProvider/dashboard-provider-api.js +13 -6
- package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +1 -2
- package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/discard-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
- package/dist/context/DashboardProvider/edit-json-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/index.d.ts +1 -2
- package/dist/context/DashboardProvider/index.d.ts.map +1 -1
- package/dist/context/DashboardProvider/index.js.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts +2 -9
- package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-editor-slice.js +4 -7
- package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts +2 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.d.ts +2 -2
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +7 -3
- package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -1
- package/dist/context/DashboardProvider/view-panel-slice.d.ts +21 -0
- package/dist/context/DashboardProvider/view-panel-slice.d.ts.map +1 -0
- package/dist/context/DashboardProvider/view-panel-slice.js +73 -0
- package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -0
- package/dist/context/DatasourceStoreProvider.d.ts +7 -7
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +18 -23
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/context/VariableProvider/VariableProvider.d.ts +119 -0
- package/dist/context/VariableProvider/VariableProvider.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +51 -54
- package/dist/context/VariableProvider/VariableProvider.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.d.ts +1 -1
- package/dist/context/VariableProvider/hydrationUtils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/hydrationUtils.js +9 -12
- package/dist/context/VariableProvider/hydrationUtils.js.map +1 -0
- package/dist/context/VariableProvider/index.d.ts +2 -0
- package/dist/context/VariableProvider/index.d.ts.map +1 -0
- package/dist/{validation → context/VariableProvider}/index.js +2 -2
- package/dist/context/VariableProvider/index.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.d.ts +2 -6
- package/dist/context/VariableProvider/query-params.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/query-params.js +1 -1
- package/dist/context/VariableProvider/query-params.js.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.d.ts +1 -1
- package/dist/context/VariableProvider/utils.d.ts.map +1 -0
- package/dist/context/{TemplateVariableProvider → VariableProvider}/utils.js +3 -3
- package/dist/context/VariableProvider/utils.js.map +1 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +4 -4
- package/dist/context/useDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDashboard.js +1 -1
- package/dist/stories/decorators/WithDashboard.js.map +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js +1 -1
- package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
- package/dist/stories/decorators/{WithTemplateVariables.js → WithVariables.js} +9 -9
- package/dist/stories/decorators/WithVariables.js.map +1 -0
- package/dist/stories/decorators/index.js +2 -2
- package/dist/stories/decorators/index.js.map +1 -1
- package/dist/test/dashboard-provider.d.ts +1 -1
- package/dist/test/dashboard-provider.d.ts.map +1 -1
- package/dist/test/dashboard-provider.js.map +1 -1
- package/dist/test/datasource-provider.d.ts +2 -2
- package/dist/test/datasource-provider.d.ts.map +1 -1
- package/dist/test/datasource-provider.js.map +1 -1
- package/dist/test/plugin-registry.d.ts.map +1 -1
- package/dist/test/plugin-registry.js +4 -2
- package/dist/test/plugin-registry.js.map +1 -1
- package/dist/test/render.d.ts +2 -2
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +9 -7
- package/dist/test/render.js.map +1 -1
- package/dist/utils/panelUtils.d.ts.map +1 -1
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -2
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +3 -3
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +4 -3
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +8 -9
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +9 -9
- package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
- package/dist/components/Variables/TemplateVariable.d.ts.map +0 -1
- package/dist/components/Variables/TemplateVariable.js.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +0 -77
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +0 -1
- package/dist/context/TemplateVariableProvider/index.d.ts +0 -2
- package/dist/context/TemplateVariableProvider/index.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/index.js.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/query-params.js.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.d.ts.map +0 -1
- package/dist/context/TemplateVariableProvider/utils.js.map +0 -1
- package/dist/stories/decorators/WithTemplateVariables.js.map +0 -1
- package/dist/validation/index.d.ts +0 -2
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/panel.d.ts +0 -19
- package/dist/validation/panel.d.ts.map +0 -1
- package/dist/validation/panel.js +0 -21
- package/dist/validation/panel.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "DashboardProviderWithQueryParams", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return DashboardProviderWithQueryParams;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _usequeryparams = require("use-query-params");
|
|
25
|
+
const _DashboardProvider = require("./DashboardProvider");
|
|
26
|
+
function DashboardProviderWithQueryParams({ children, initialState }) {
|
|
27
|
+
const [viewPanelRef, setViewPanelRef] = (0, _usequeryparams.useQueryParam)('viewPanelRef', _usequeryparams.StringParam);
|
|
28
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_DashboardProvider.DashboardProvider, {
|
|
29
|
+
initialState: {
|
|
30
|
+
viewPanelRef: viewPanelRef ?? undefined,
|
|
31
|
+
setViewPanelRef: setViewPanelRef,
|
|
32
|
+
...initialState
|
|
33
|
+
},
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -43,8 +43,8 @@ function createPanelDefinition(defaultPanelKind, defaultPanelSpec) {
|
|
|
43
43
|
description: undefined
|
|
44
44
|
},
|
|
45
45
|
plugin: {
|
|
46
|
-
kind: defaultPanelKind
|
|
47
|
-
spec: defaultPanelSpec
|
|
46
|
+
kind: defaultPanelKind ?? '',
|
|
47
|
+
spec: defaultPanelSpec ?? {}
|
|
48
48
|
},
|
|
49
49
|
queries: []
|
|
50
50
|
}
|
|
@@ -68,6 +68,9 @@ _export(exports, {
|
|
|
68
68
|
},
|
|
69
69
|
useSaveChangesConfirmationDialog: function() {
|
|
70
70
|
return useSaveChangesConfirmationDialog;
|
|
71
|
+
},
|
|
72
|
+
useViewPanel: function() {
|
|
73
|
+
return useViewPanel;
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
76
|
const _react = require("react");
|
|
@@ -183,8 +186,7 @@ function useDeletePanelGroupDialog() {
|
|
|
183
186
|
function usePanel(panelGroupItemId) {
|
|
184
187
|
const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
185
188
|
const panel = (0, _DashboardProvider.useDashboardStore)((0, _react.useCallback)((store)=>{
|
|
186
|
-
|
|
187
|
-
const panelKey = (_store_panelGroups_panelGroupId = store.panelGroups[panelGroupId]) === null || _store_panelGroups_panelGroupId === void 0 ? void 0 : _store_panelGroups_panelGroupId.itemPanelKeys[panelGroupLayoutId];
|
|
189
|
+
const panelKey = store.panelGroups[panelGroupId]?.itemPanelKeys[panelGroupLayoutId];
|
|
188
190
|
if (panelKey === undefined) return;
|
|
189
191
|
return store.panels[panelKey];
|
|
190
192
|
}, [
|
|
@@ -196,17 +198,19 @@ function usePanel(panelGroupItemId) {
|
|
|
196
198
|
}
|
|
197
199
|
return panel;
|
|
198
200
|
}
|
|
199
|
-
const selectPanelActions = ({ openEditPanel, openDeletePanelDialog, duplicatePanel })=>({
|
|
201
|
+
const selectPanelActions = ({ openEditPanel, openDeletePanelDialog, duplicatePanel, setViewPanel })=>({
|
|
200
202
|
openEditPanel,
|
|
201
203
|
openDeletePanelDialog,
|
|
202
|
-
duplicatePanel
|
|
204
|
+
duplicatePanel,
|
|
205
|
+
setViewPanel
|
|
203
206
|
});
|
|
204
207
|
function usePanelActions(panelGroupItemId) {
|
|
205
|
-
const { openEditPanel, openDeletePanelDialog, duplicatePanel } = (0, _DashboardProvider.useDashboardStore)(selectPanelActions);
|
|
208
|
+
const { openEditPanel, openDeletePanelDialog, duplicatePanel, setViewPanel } = (0, _DashboardProvider.useDashboardStore)(selectPanelActions);
|
|
206
209
|
return {
|
|
207
210
|
openEditPanel: ()=>openEditPanel(panelGroupItemId),
|
|
208
211
|
openDeletePanelDialog: ()=>openDeletePanelDialog(panelGroupItemId),
|
|
209
|
-
duplicatePanel: ()=>duplicatePanel(panelGroupItemId)
|
|
212
|
+
duplicatePanel: ()=>duplicatePanel(panelGroupItemId),
|
|
213
|
+
viewPanel: (panelGroupItemId)=>setViewPanel(panelGroupItemId)
|
|
210
214
|
};
|
|
211
215
|
}
|
|
212
216
|
const selectPanelEditor = (state)=>state.panelEditor;
|
|
@@ -226,6 +230,10 @@ const selectDashboardDuration = (state)=>state.duration;
|
|
|
226
230
|
function useDashboardDuration() {
|
|
227
231
|
return (0, _DashboardProvider.useDashboardStore)(selectDashboardDuration);
|
|
228
232
|
}
|
|
233
|
+
const selectViewPanel = (state)=>state.getViewPanel();
|
|
234
|
+
function useViewPanel() {
|
|
235
|
+
return (0, _DashboardProvider.useDashboardStore)(selectViewPanel);
|
|
236
|
+
}
|
|
229
237
|
const selectSaveChangesConfirmationDialog = ({ saveChangesConfirmationDialog, openSaveChangesConfirmationDialog, closeSaveChangesConfirmationDialog })=>({
|
|
230
238
|
saveChangesConfirmationDialog,
|
|
231
239
|
openSaveChangesConfirmationDialog,
|
|
@@ -60,11 +60,10 @@ function createDeletePanelSlice() {
|
|
|
60
60
|
throw new Error(`Could not find panel ${panelKey}`);
|
|
61
61
|
}
|
|
62
62
|
set((state)=>{
|
|
63
|
-
var _panelGroup_title;
|
|
64
63
|
state.deletePanelDialog = {
|
|
65
64
|
panelGroupItemId: panelGroupItemId,
|
|
66
65
|
panelName: panel.spec.display.name,
|
|
67
|
-
panelGroupName:
|
|
66
|
+
panelGroupName: panelGroup.title ?? ''
|
|
68
67
|
};
|
|
69
68
|
});
|
|
70
69
|
},
|
|
@@ -20,7 +20,7 @@ Object.defineProperty(exports, "createPanelEditorSlice", {
|
|
|
20
20
|
return createPanelEditorSlice;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
const
|
|
23
|
+
const _utils = require("../../utils");
|
|
24
24
|
const _common = require("./common");
|
|
25
25
|
const _panelgroupslice = require("./panel-group-slice");
|
|
26
26
|
function createPanelEditorSlice() {
|
|
@@ -28,11 +28,10 @@ function createPanelEditorSlice() {
|
|
|
28
28
|
return (set, get)=>({
|
|
29
29
|
panelEditor: undefined,
|
|
30
30
|
openEditPanel (panelGroupItemId) {
|
|
31
|
-
var _panelGroups_panelGroupId;
|
|
32
31
|
const { panels, panelGroups } = get();
|
|
33
32
|
// Figure out the panel key at that location
|
|
34
33
|
const { panelGroupId, panelGroupItemLayoutId: panelGroupLayoutId } = panelGroupItemId;
|
|
35
|
-
const panelKey =
|
|
34
|
+
const panelKey = panelGroups[panelGroupId]?.itemPanelKeys[panelGroupLayoutId];
|
|
36
35
|
if (panelKey === undefined) {
|
|
37
36
|
throw new Error(`Could not find Panel Group item ${panelGroupItemId}`);
|
|
38
37
|
}
|
|
@@ -76,7 +75,7 @@ function createPanelEditorSlice() {
|
|
|
76
75
|
newGroup.itemLayouts.push({
|
|
77
76
|
i: existingLayout.i,
|
|
78
77
|
x: 0,
|
|
79
|
-
y: (0,
|
|
78
|
+
y: (0, _utils.getYForNewRow)(newGroup),
|
|
80
79
|
w: existingLayout.w,
|
|
81
80
|
h: existingLayout.h
|
|
82
81
|
});
|
|
@@ -95,25 +94,23 @@ function createPanelEditorSlice() {
|
|
|
95
94
|
});
|
|
96
95
|
},
|
|
97
96
|
openAddPanel (panelGroupId) {
|
|
98
|
-
var _get_initialValues;
|
|
99
97
|
// If a panel group isn't supplied, add to the first group or create a group if there aren't any
|
|
100
98
|
let newGroup = undefined;
|
|
101
|
-
panelGroupId
|
|
99
|
+
panelGroupId ??= get().panelGroupOrder[0];
|
|
102
100
|
if (panelGroupId === undefined) {
|
|
103
101
|
newGroup = (0, _panelgroupslice.createEmptyPanelGroup)();
|
|
104
102
|
newGroup.title = 'Panel Group';
|
|
105
103
|
panelGroupId = newGroup.id;
|
|
106
104
|
}
|
|
107
|
-
var _get_initialValues_panelDefinition;
|
|
108
105
|
const editorState = {
|
|
109
106
|
mode: 'create',
|
|
110
107
|
initialValues: {
|
|
111
108
|
groupId: panelGroupId,
|
|
112
|
-
panelDefinition:
|
|
109
|
+
panelDefinition: get().initialValues?.panelDefinition ?? (0, _common.createPanelDefinition)()
|
|
113
110
|
},
|
|
114
111
|
applyChanges: (next)=>{
|
|
115
112
|
const name = next.panelDefinition.spec.display.name;
|
|
116
|
-
const panelKey = (0,
|
|
113
|
+
const panelKey = (0, _utils.getValidPanelKey)(name, get().panels);
|
|
117
114
|
set((state)=>{
|
|
118
115
|
// Add a panel
|
|
119
116
|
state.panels[panelKey] = next.panelDefinition;
|
|
@@ -125,7 +122,7 @@ function createPanelEditorSlice() {
|
|
|
125
122
|
const layout = {
|
|
126
123
|
i: (0, _common.generateId)().toString(),
|
|
127
124
|
x: 0,
|
|
128
|
-
y: (0,
|
|
125
|
+
y: (0, _utils.getYForNewRow)(group),
|
|
129
126
|
w: 12,
|
|
130
127
|
h: 6
|
|
131
128
|
};
|
|
@@ -55,12 +55,11 @@ const createPanelGroupEditorSlice = (set, get)=>({
|
|
|
55
55
|
if (existingGroup === undefined) {
|
|
56
56
|
throw new Error(`Panel group with Id ${panelGroupId} does not exist`);
|
|
57
57
|
}
|
|
58
|
-
var _existingGroup_title;
|
|
59
58
|
// Create the editor state
|
|
60
59
|
const editor = {
|
|
61
60
|
mode: 'Edit',
|
|
62
61
|
initialValues: {
|
|
63
|
-
title:
|
|
62
|
+
title: existingGroup.title ?? '',
|
|
64
63
|
isCollapsed: existingGroup.isCollapsed
|
|
65
64
|
},
|
|
66
65
|
applyChanges (next) {
|
|
@@ -32,10 +32,16 @@ _export(exports, {
|
|
|
32
32
|
},
|
|
33
33
|
createPanelGroupSlice: function() {
|
|
34
34
|
return createPanelGroupSlice;
|
|
35
|
+
},
|
|
36
|
+
isPanelGroupItemIdEqual: function() {
|
|
37
|
+
return isPanelGroupItemIdEqual;
|
|
35
38
|
}
|
|
36
39
|
});
|
|
37
40
|
const _core = require("@perses-dev/core");
|
|
38
41
|
const _common = require("./common");
|
|
42
|
+
function isPanelGroupItemIdEqual(a, b) {
|
|
43
|
+
return a?.panelGroupId === b?.panelGroupId && a?.panelGroupItemLayoutId === b?.panelGroupItemLayoutId;
|
|
44
|
+
}
|
|
39
45
|
function createPanelGroupSlice(layouts) {
|
|
40
46
|
const { panelGroups, panelGroupOrder } = convertLayoutsToPanelGroups(layouts);
|
|
41
47
|
// Return the state creator function for Zustand
|
|
@@ -75,7 +81,6 @@ function convertLayoutsToPanelGroups(layouts) {
|
|
|
75
81
|
const panelGroups = {};
|
|
76
82
|
const panelGroupIdOrder = [];
|
|
77
83
|
for (const layout of layouts){
|
|
78
|
-
var _layout_spec_display_collapse, _layout_spec_display, _layout_spec_display1;
|
|
79
84
|
const itemLayouts = [];
|
|
80
85
|
const itemPanelKeys = {};
|
|
81
86
|
// Split layout information from panel keys to make it easier to update just layouts on move/resize of panels
|
|
@@ -94,8 +99,8 @@ function convertLayoutsToPanelGroups(layouts) {
|
|
|
94
99
|
const panelGroupId = (0, _common.generateId)();
|
|
95
100
|
panelGroups[panelGroupId] = {
|
|
96
101
|
id: panelGroupId,
|
|
97
|
-
isCollapsed:
|
|
98
|
-
title:
|
|
102
|
+
isCollapsed: layout.spec.display?.collapse?.open === false,
|
|
103
|
+
title: layout.spec.display?.title,
|
|
99
104
|
itemLayouts,
|
|
100
105
|
itemPanelKeys
|
|
101
106
|
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "createViewPanelSlice", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return createViewPanelSlice;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function createViewPanelSlice(viewPanelRef, setViewPanelRef) {
|
|
24
|
+
return (set, get)=>({
|
|
25
|
+
viewPanel: {
|
|
26
|
+
panelGroupItemId: undefined,
|
|
27
|
+
panelRef: viewPanelRef
|
|
28
|
+
},
|
|
29
|
+
getViewPanel () {
|
|
30
|
+
return getViewPanelGroupId(get().panelGroups, get().viewPanel.panelGroupItemId, get().viewPanel.panelRef);
|
|
31
|
+
},
|
|
32
|
+
setViewPanel (panelGroupItemId) {
|
|
33
|
+
set((state)=>{
|
|
34
|
+
state.viewPanel = {
|
|
35
|
+
panelRef: undefined,
|
|
36
|
+
panelGroupItemId: panelGroupItemId
|
|
37
|
+
};
|
|
38
|
+
const panelRef = findPanelRefOfPanelGroupItemId(get().panelGroups, panelGroupItemId);
|
|
39
|
+
if (setViewPanelRef) {
|
|
40
|
+
setViewPanelRef(panelRef);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function getViewPanelGroupId(panelGroups, panelGroupItemId, panelRef) {
|
|
47
|
+
if (panelGroupItemId) {
|
|
48
|
+
return panelGroupItemId;
|
|
49
|
+
}
|
|
50
|
+
if (panelRef) {
|
|
51
|
+
return findPanelGroupItemIdOfPanelRef(panelGroups, panelRef);
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
// Find the PanelGroupItemId of a Panel from a PanelRef
|
|
56
|
+
function findPanelGroupItemIdOfPanelRef(panelGroups, panelRef) {
|
|
57
|
+
for (const panelGroup of Object.values(panelGroups)){
|
|
58
|
+
const itemPanel = Object.entries(panelGroup.itemPanelKeys ?? []).find(([_, value])=>value === panelRef);
|
|
59
|
+
if (itemPanel) {
|
|
60
|
+
const [key] = itemPanel;
|
|
61
|
+
return {
|
|
62
|
+
panelGroupId: panelGroup.id,
|
|
63
|
+
panelGroupItemLayoutId: key
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
// Find the PanelRef from a PanelGroupItemId
|
|
70
|
+
function findPanelRefOfPanelGroupItemId(panelGroups, panelGroupItemId) {
|
|
71
|
+
if (!panelGroupItemId) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const panelGroup = panelGroups[panelGroupItemId.panelGroupId];
|
|
75
|
+
if (panelGroup) {
|
|
76
|
+
return panelGroup.itemPanelKeys[panelGroupItemId.panelGroupItemLayoutId];
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
@@ -27,9 +27,8 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
27
27
|
function DatasourceStoreProvider(props) {
|
|
28
28
|
const { projectName, datasourceApi, onCreate, children } = props;
|
|
29
29
|
const [dashboardResource, setDashboardResource] = (0, _react.useState)(props.dashboardResource);
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const project = projectName !== null && projectName !== void 0 ? projectName : dashboardResource === null || dashboardResource === void 0 ? void 0 : dashboardResource.metadata.project;
|
|
30
|
+
const [savedDatasources, setSavedDatasources] = (0, _react.useState)(props.savedDatasources ?? {});
|
|
31
|
+
const project = projectName ?? dashboardResource?.metadata.project;
|
|
33
32
|
const { getPlugin, listPluginMetadata } = (0, _pluginsystem.usePluginRegistry)();
|
|
34
33
|
const findDatasource = (0, _core.useEvent)(async (selector)=>{
|
|
35
34
|
// Try to find it in dashboard spec
|
|
@@ -99,24 +98,26 @@ function DatasourceStoreProvider(props) {
|
|
|
99
98
|
getPlugin,
|
|
100
99
|
onCreate
|
|
101
100
|
]);
|
|
102
|
-
const listDatasourceSelectItems = (0, _core.useEvent)(async (
|
|
101
|
+
const listDatasourceSelectItems = (0, _core.useEvent)(async (datasourcePluginName)=>{
|
|
103
102
|
const [pluginMetadata, datasources, globalDatasources] = await Promise.all([
|
|
104
|
-
listPluginMetadata(
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
listPluginMetadata([
|
|
104
|
+
'Datasource'
|
|
105
|
+
]),
|
|
106
|
+
project ? datasourceApi.listDatasources(project, datasourcePluginName) : [],
|
|
107
|
+
datasourceApi.listGlobalDatasources(datasourcePluginName)
|
|
107
108
|
]);
|
|
108
109
|
// Find the metadata for the plugin type they asked for, so we can use it for the name of the default datasource
|
|
109
|
-
const datasourcePluginMetadata = pluginMetadata.find((metadata)=>metadata.
|
|
110
|
+
const datasourcePluginMetadata = pluginMetadata.find((metadata)=>metadata.spec.name === datasourcePluginName);
|
|
110
111
|
if (datasourcePluginMetadata === undefined) {
|
|
111
|
-
throw new Error(`Could not find a Datasource plugin with kind '${
|
|
112
|
+
throw new Error(`Could not find a Datasource plugin with kind '${datasourcePluginName}'`);
|
|
112
113
|
}
|
|
113
114
|
// Get helper for computing results properly
|
|
114
|
-
const { results, addItem } = buildDatasourceSelectItemGroups(datasourcePluginMetadata.display.name);
|
|
115
|
+
const { results, addItem } = buildDatasourceSelectItemGroups(datasourcePluginMetadata.spec.display.name);
|
|
115
116
|
// Start with dashboard datasources with the highest precedence
|
|
116
|
-
if (dashboardResource
|
|
117
|
+
if (dashboardResource?.spec.datasources) {
|
|
117
118
|
for(const selectorName in dashboardResource.spec.datasources){
|
|
118
119
|
const spec = dashboardResource.spec.datasources[selectorName];
|
|
119
|
-
if (spec === undefined || spec.plugin.kind !==
|
|
120
|
+
if (spec === undefined || spec.plugin.kind !== datasourcePluginName) continue;
|
|
120
121
|
const saved = selectorName in savedDatasources;
|
|
121
122
|
addItem({
|
|
122
123
|
spec,
|
|
@@ -149,8 +150,7 @@ function DatasourceStoreProvider(props) {
|
|
|
149
150
|
return results;
|
|
150
151
|
});
|
|
151
152
|
const getLocalDatasources = (0, _react.useCallback)(()=>{
|
|
152
|
-
|
|
153
|
-
return (_dashboardResource_spec_datasources = dashboardResource === null || dashboardResource === void 0 ? void 0 : dashboardResource.spec.datasources) !== null && _dashboardResource_spec_datasources !== void 0 ? _dashboardResource_spec_datasources : {};
|
|
153
|
+
return dashboardResource?.spec.datasources ?? {};
|
|
154
154
|
}, [
|
|
155
155
|
dashboardResource
|
|
156
156
|
]);
|
|
@@ -236,8 +236,7 @@ function findDashboardDatasource(dashboardDatasources, selector) {
|
|
|
236
236
|
const groupIndices = {};
|
|
237
237
|
let currentGroupIndex = 1; // 0 is the default group, always there as it contains at least the first item.
|
|
238
238
|
const addItem = ({ spec, selectorName, selectorGroup: group, editLink, saved })=>{
|
|
239
|
-
|
|
240
|
-
group = group !== null && group !== void 0 ? group : '';
|
|
239
|
+
group = group ?? '';
|
|
241
240
|
// Ensure the default group is always present as soon as an item is added.
|
|
242
241
|
if (isFirst) {
|
|
243
242
|
results.push({
|
|
@@ -245,9 +244,8 @@ function findDashboardDatasource(dashboardDatasources, selector) {
|
|
|
245
244
|
items: []
|
|
246
245
|
});
|
|
247
246
|
}
|
|
248
|
-
var _groupIndices_group;
|
|
249
247
|
// Create the group if necessary
|
|
250
|
-
let selectItemGroup = results[
|
|
248
|
+
let selectItemGroup = results[groupIndices[group] ?? -1];
|
|
251
249
|
if (!selectItemGroup) {
|
|
252
250
|
groupIndices[group] = currentGroupIndex;
|
|
253
251
|
selectItemGroup = {
|
|
@@ -260,9 +258,8 @@ function findDashboardDatasource(dashboardDatasources, selector) {
|
|
|
260
258
|
}
|
|
261
259
|
// Add item to the group
|
|
262
260
|
const isOverridden = usedNames.has(selectorName);
|
|
263
|
-
var _spec_display_name;
|
|
264
261
|
selectItemGroup.items.push({
|
|
265
|
-
name:
|
|
262
|
+
name: spec.display?.name ?? selectorName,
|
|
266
263
|
overridden: isOverridden,
|
|
267
264
|
saved,
|
|
268
265
|
selector: {
|
|
@@ -291,9 +288,7 @@ function findDashboardDatasource(dashboardDatasources, selector) {
|
|
|
291
288
|
// At the end, we make sure the overriding item(s) is well flagged so
|
|
292
289
|
if (isOverridden) {
|
|
293
290
|
for(let i = explicitDefaultAdded ? 1 : 0; i < currentGroupIndex; i++){
|
|
294
|
-
|
|
295
|
-
var _results_i_items;
|
|
296
|
-
((_results_i_items = (_results_i = results[i]) === null || _results_i === void 0 ? void 0 : _results_i.items) !== null && _results_i_items !== void 0 ? _results_i_items : []).filter((item)=>item.selector.name === selectorName).forEach((item)=>{
|
|
291
|
+
(results[i]?.items ?? []).filter((item)=>item.selector.name === selectorName).forEach((item)=>{
|
|
297
292
|
item.overriding = true;
|
|
298
293
|
});
|
|
299
294
|
}
|