@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,8 +21,8 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
Variable: function() {
|
|
25
|
+
return Variable;
|
|
26
26
|
},
|
|
27
27
|
useListVariableState: function() {
|
|
28
28
|
return useListVariableState;
|
|
@@ -46,10 +46,9 @@ function variableOptionToVariableValue(options) {
|
|
|
46
46
|
}
|
|
47
47
|
return options.value;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
const kind = (_ctx_definition = ctx.definition) === null || _ctx_definition === void 0 ? void 0 : _ctx_definition.kind;
|
|
49
|
+
function Variable({ name, source }) {
|
|
50
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
51
|
+
const kind = ctx.definition?.kind;
|
|
53
52
|
switch(kind){
|
|
54
53
|
case 'TextVariable':
|
|
55
54
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(TextVariable, {
|
|
@@ -70,22 +69,16 @@ function TemplateVariable({ name, source }) {
|
|
|
70
69
|
});
|
|
71
70
|
}
|
|
72
71
|
function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
73
|
-
const allowMultiple =
|
|
74
|
-
const allowAllValue =
|
|
75
|
-
const sort = spec
|
|
76
|
-
const loading = (0, _react.useMemo)(()=>
|
|
77
|
-
var _variablesOptionsQuery_isFetching;
|
|
78
|
-
return (_variablesOptionsQuery_isFetching = variablesOptionsQuery.isFetching) !== null && _variablesOptionsQuery_isFetching !== void 0 ? _variablesOptionsQuery_isFetching : false;
|
|
79
|
-
}, [
|
|
72
|
+
const allowMultiple = spec?.allowMultiple === true;
|
|
73
|
+
const allowAllValue = spec?.allowAllValue === true;
|
|
74
|
+
const sort = spec?.sort;
|
|
75
|
+
const loading = (0, _react.useMemo)(()=>variablesOptionsQuery.isFetching ?? false, [
|
|
80
76
|
variablesOptionsQuery.isFetching
|
|
81
77
|
]);
|
|
82
|
-
const options = (0, _react.useMemo)(()=>
|
|
83
|
-
var _variablesOptionsQuery_data;
|
|
84
|
-
return (_variablesOptionsQuery_data = variablesOptionsQuery.data) !== null && _variablesOptionsQuery_data !== void 0 ? _variablesOptionsQuery_data : [];
|
|
85
|
-
}, [
|
|
78
|
+
const options = (0, _react.useMemo)(()=>variablesOptionsQuery.data ?? [], [
|
|
86
79
|
variablesOptionsQuery.data
|
|
87
80
|
]);
|
|
88
|
-
let value = state
|
|
81
|
+
let value = state?.value;
|
|
89
82
|
// Make sure value is an array if allowMultiple is true
|
|
90
83
|
if (allowMultiple && !Array.isArray(value)) {
|
|
91
84
|
value = typeof value === 'string' ? [
|
|
@@ -146,8 +139,7 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
146
139
|
allowMultiple
|
|
147
140
|
]);
|
|
148
141
|
value = (0, _react.useMemo)(()=>{
|
|
149
|
-
|
|
150
|
-
const firstOptionValue = viewOptions === null || viewOptions === void 0 ? void 0 : (_viewOptions_ = viewOptions[allowAllValue ? 1 : 0]) === null || _viewOptions_ === void 0 ? void 0 : _viewOptions_.value;
|
|
142
|
+
const firstOptionValue = viewOptions?.[allowAllValue ? 1 : 0]?.value;
|
|
151
143
|
// If there is no value but there are options, or the value is not in options, we set the value to the first option.
|
|
152
144
|
if (firstOptionValue) {
|
|
153
145
|
if (!valueIsInOptions || !value || value.length === 0) {
|
|
@@ -169,13 +161,12 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
169
161
|
// an array, hence this conditional
|
|
170
162
|
if (Array.isArray(value)) {
|
|
171
163
|
return viewOptions.filter((o)=>{
|
|
172
|
-
return value
|
|
164
|
+
return value?.includes(o.value);
|
|
173
165
|
});
|
|
174
166
|
} else {
|
|
175
|
-
|
|
176
|
-
return (_viewOptions_find = viewOptions.find((o)=>{
|
|
167
|
+
return viewOptions.find((o)=>{
|
|
177
168
|
return value === o.value;
|
|
178
|
-
})
|
|
169
|
+
}) ?? {
|
|
179
170
|
value: '',
|
|
180
171
|
label: ''
|
|
181
172
|
};
|
|
@@ -193,7 +184,6 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
193
184
|
};
|
|
194
185
|
}
|
|
195
186
|
const StyledPopper = (props)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Popper, {
|
|
196
|
-
placeholder: undefined,
|
|
197
187
|
...props,
|
|
198
188
|
sx: {
|
|
199
189
|
minWidth: 'fit-content'
|
|
@@ -203,28 +193,25 @@ const StyledPopper = (props)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Poppe
|
|
|
203
193
|
const LETTER_HSIZE = 8; // approximation
|
|
204
194
|
const ARROW_OFFSET = 40; // right offset for list variables (= take into account the dropdown toggle size)
|
|
205
195
|
const getWidthPx = (inputValue, kind)=>{
|
|
206
|
-
const width = (inputValue.length + 1) * LETTER_HSIZE + (kind
|
|
207
|
-
if (width < _constants.
|
|
208
|
-
return _constants.
|
|
209
|
-
} else if (width > _constants.
|
|
210
|
-
return _constants.
|
|
196
|
+
const width = (inputValue.length + 1) * LETTER_HSIZE + (kind === 'list' ? ARROW_OFFSET : 0);
|
|
197
|
+
if (width < _constants.MIN_VARIABLE_WIDTH) {
|
|
198
|
+
return _constants.MIN_VARIABLE_WIDTH;
|
|
199
|
+
} else if (width > _constants.MAX_VARIABLE_WIDTH) {
|
|
200
|
+
return _constants.MAX_VARIABLE_WIDTH;
|
|
211
201
|
} else {
|
|
212
202
|
return width;
|
|
213
203
|
}
|
|
214
204
|
};
|
|
215
205
|
function ListVariable({ name, source }) {
|
|
216
|
-
|
|
217
|
-
const ctx = (0, _context.useTemplateVariable)(name, source);
|
|
206
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
218
207
|
const definition = ctx.definition;
|
|
219
208
|
const variablesOptionsQuery = (0, _pluginsystem.useListVariablePluginValues)(definition);
|
|
220
|
-
const { setVariableValue, setVariableLoading, setVariableOptions } = (0, _context.
|
|
221
|
-
const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(definition
|
|
222
|
-
const [
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
const allowMultiple = (definition === null || definition === void 0 ? void 0 : definition.spec.allowMultiple) === true;
|
|
227
|
-
const allowAllValue = (definition === null || definition === void 0 ? void 0 : definition.spec.allowAllValue) === true;
|
|
209
|
+
const { setVariableValue, setVariableLoading, setVariableOptions } = (0, _context.useVariableDefinitionActions)();
|
|
210
|
+
const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(definition?.spec, ctx.state, variablesOptionsQuery);
|
|
211
|
+
const [inputWidth, setInputWidth] = (0, _react.useState)(_constants.MIN_VARIABLE_WIDTH);
|
|
212
|
+
const title = definition?.spec.display?.name ?? name;
|
|
213
|
+
const allowMultiple = definition?.spec.allowMultiple === true;
|
|
214
|
+
const allowAllValue = definition?.spec.allowAllValue === true;
|
|
228
215
|
// Update value when changed
|
|
229
216
|
(0, _react.useEffect)(()=>{
|
|
230
217
|
if (value) {
|
|
@@ -266,7 +253,9 @@ function ListVariable({ name, source }) {
|
|
|
266
253
|
limitTags: 3,
|
|
267
254
|
size: "small",
|
|
268
255
|
disableClearable: true,
|
|
269
|
-
|
|
256
|
+
slots: {
|
|
257
|
+
popper: StyledPopper
|
|
258
|
+
},
|
|
270
259
|
renderInput: (params)=>{
|
|
271
260
|
return allowMultiple ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
272
261
|
...params,
|
|
@@ -283,9 +272,8 @@ function ListVariable({ name, source }) {
|
|
|
283
272
|
'& .MuiInputBase-root': {
|
|
284
273
|
minHeight: '38px'
|
|
285
274
|
},
|
|
286
|
-
'& .
|
|
287
|
-
|
|
288
|
-
paddingLeft: '5px'
|
|
275
|
+
'& .MuiAutocomplete-tag': {
|
|
276
|
+
margin: '1px 2px'
|
|
289
277
|
}
|
|
290
278
|
},
|
|
291
279
|
value: selectedOptions,
|
|
@@ -296,9 +284,7 @@ function ListVariable({ name, source }) {
|
|
|
296
284
|
setVariableValue(name, variableOptionToVariableValue(value), source);
|
|
297
285
|
}
|
|
298
286
|
},
|
|
299
|
-
inputValue: inputValue,
|
|
300
287
|
onInputChange: (_, newInputValue)=>{
|
|
301
|
-
setInputValue(newInputValue);
|
|
302
288
|
if (!allowMultiple) {
|
|
303
289
|
setInputWidth(getWidthPx(newInputValue, 'list'));
|
|
304
290
|
}
|
|
@@ -310,34 +296,31 @@ function ListVariable({ name, source }) {
|
|
|
310
296
|
});
|
|
311
297
|
}
|
|
312
298
|
function TextVariable({ name, source }) {
|
|
313
|
-
|
|
314
|
-
const ctx = (0, _context.useTemplateVariable)(name, source);
|
|
299
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
315
300
|
const state = ctx.state;
|
|
316
301
|
const definition = ctx.definition;
|
|
317
|
-
|
|
318
|
-
const [tempValue, setTempValue] = (0, _react.useState)((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
302
|
+
const [tempValue, setTempValue] = (0, _react.useState)(state?.value ?? '');
|
|
319
303
|
const [inputWidth, setInputWidth] = (0, _react.useState)(getWidthPx(tempValue, 'text'));
|
|
320
|
-
const { setVariableValue } = (0, _context.
|
|
304
|
+
const { setVariableValue } = (0, _context.useVariableDefinitionActions)();
|
|
321
305
|
(0, _react.useEffect)(()=>{
|
|
322
|
-
|
|
323
|
-
setTempValue((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
306
|
+
setTempValue(state?.value ?? '');
|
|
324
307
|
}, [
|
|
325
|
-
state
|
|
308
|
+
state?.value
|
|
326
309
|
]);
|
|
327
|
-
var _definition_spec_display_name, _definition_spec_constant;
|
|
328
310
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
329
311
|
title: tempValue,
|
|
330
312
|
value: tempValue,
|
|
331
|
-
//onChange={(e) => setTempValue(e.target.value)}
|
|
332
313
|
onChange: (e)=>{
|
|
333
314
|
setTempValue(e.target.value);
|
|
334
315
|
setInputWidth(getWidthPx(e.target.value, 'text'));
|
|
335
316
|
},
|
|
336
317
|
onBlur: ()=>setVariableValue(name, tempValue, source),
|
|
337
318
|
placeholder: name,
|
|
338
|
-
label:
|
|
339
|
-
|
|
340
|
-
|
|
319
|
+
label: definition?.spec.display?.name ?? name,
|
|
320
|
+
slotProps: {
|
|
321
|
+
input: {
|
|
322
|
+
readOnly: definition?.spec.constant ?? false
|
|
323
|
+
}
|
|
341
324
|
},
|
|
342
325
|
sx: {
|
|
343
326
|
width: `${inputWidth}px`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -43,7 +43,7 @@ const _ChevronUp = /*#__PURE__*/ _interop_require_default(require("mdi-material-
|
|
|
43
43
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
44
44
|
const _components = require("@perses-dev/components");
|
|
45
45
|
const _context = require("../../context");
|
|
46
|
-
const _hydrationUtils = require("../../context/
|
|
46
|
+
const _hydrationUtils = require("../../context/VariableProvider/hydrationUtils");
|
|
47
47
|
const _BuiltinVariableAccordions = require("./BuiltinVariableAccordions");
|
|
48
48
|
function _interop_require_default(obj) {
|
|
49
49
|
return obj && obj.__esModule ? obj : {
|
|
@@ -51,8 +51,7 @@ function _interop_require_default(obj) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
function getVariableLabelByKind(kind) {
|
|
54
|
-
|
|
55
|
-
return (_VARIABLE_TYPES_find = _pluginsystem.VARIABLE_TYPES.find((variableType)=>variableType.kind === kind)) === null || _VARIABLE_TYPES_find === void 0 ? void 0 : _VARIABLE_TYPES_find.label;
|
|
54
|
+
return _pluginsystem.VARIABLE_TYPES.find((variableType)=>variableType.kind === kind)?.label;
|
|
56
55
|
}
|
|
57
56
|
function getValidation(variableDefinitions) {
|
|
58
57
|
const errors = [];
|
|
@@ -77,7 +76,7 @@ function VariableEditor(props) {
|
|
|
77
76
|
]);
|
|
78
77
|
const [variableState] = (0, _react.useMemo)(()=>{
|
|
79
78
|
return [
|
|
80
|
-
(0, _hydrationUtils.
|
|
79
|
+
(0, _hydrationUtils.hydrateVariableDefinitionStates)(variableDefinitions, {}, externalVariableDefinitions)
|
|
81
80
|
];
|
|
82
81
|
}, [
|
|
83
82
|
externalVariableDefinitions,
|
|
@@ -166,22 +165,25 @@ function VariableEditor(props) {
|
|
|
166
165
|
};
|
|
167
166
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
168
167
|
children: [
|
|
169
|
-
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.ValidationProvider, {
|
|
169
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.VariableEditorForm, {
|
|
170
|
+
initialVariableDefinition: currentEditingVariableDefinition,
|
|
171
|
+
action: variableFormAction,
|
|
172
|
+
isDraft: true,
|
|
173
|
+
onActionChange: setVariableFormAction,
|
|
174
|
+
onSave: (definition)=>{
|
|
175
|
+
setVariableDefinitions((draft)=>{
|
|
176
|
+
draft[variableEditIdx] = definition;
|
|
177
|
+
setVariableEditIdx(null);
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
onClose: ()=>{
|
|
181
|
+
if (variableFormAction === 'create') {
|
|
182
|
+
removeVariable(variableEditIdx);
|
|
183
|
+
}
|
|
176
184
|
setVariableEditIdx(null);
|
|
177
|
-
});
|
|
178
|
-
},
|
|
179
|
-
onClose: ()=>{
|
|
180
|
-
if (variableFormAction === 'create') {
|
|
181
|
-
removeVariable(variableEditIdx);
|
|
182
185
|
}
|
|
183
|
-
|
|
184
|
-
}
|
|
186
|
+
})
|
|
185
187
|
}),
|
|
186
188
|
!currentEditingVariableDefinition && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
187
189
|
children: [
|
|
@@ -265,16 +267,13 @@ function VariableEditor(props) {
|
|
|
265
267
|
})
|
|
266
268
|
}),
|
|
267
269
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
268
|
-
children: variableDefinitions.map((v, idx)=>/*#__PURE__*/ {
|
|
269
|
-
var _v_spec_display, _v_spec_display1;
|
|
270
|
-
var _getVariableLabelByKind, _v_spec_display_description;
|
|
271
|
-
return (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
270
|
+
children: variableDefinitions.map((v, idx)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
272
271
|
children: [
|
|
273
272
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
274
273
|
component: "th",
|
|
275
274
|
scope: "row",
|
|
276
275
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
277
|
-
checked:
|
|
276
|
+
checked: v.spec.display?.hidden !== true,
|
|
278
277
|
onChange: (e)=>{
|
|
279
278
|
toggleVariableVisibility(idx, e.target.checked);
|
|
280
279
|
}
|
|
@@ -294,10 +293,10 @@ function VariableEditor(props) {
|
|
|
294
293
|
})
|
|
295
294
|
}),
|
|
296
295
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
297
|
-
children:
|
|
296
|
+
children: getVariableLabelByKind(v.kind) ?? v.kind
|
|
298
297
|
}),
|
|
299
298
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
300
|
-
children:
|
|
299
|
+
children: v.spec.display?.description ?? ''
|
|
301
300
|
}),
|
|
302
301
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(TableCell, {
|
|
303
302
|
align: "right",
|
|
@@ -326,8 +325,7 @@ function VariableEditor(props) {
|
|
|
326
325
|
]
|
|
327
326
|
})
|
|
328
327
|
]
|
|
329
|
-
}, v.spec.name)
|
|
330
|
-
})
|
|
328
|
+
}, v.spec.name))
|
|
331
329
|
})
|
|
332
330
|
]
|
|
333
331
|
})
|
|
@@ -427,16 +425,13 @@ function VariableEditor(props) {
|
|
|
427
425
|
})
|
|
428
426
|
}),
|
|
429
427
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
430
|
-
children: extVar.definitions.map((v)=>/*#__PURE__*/ {
|
|
431
|
-
var _v_spec_display, _v_spec_display1;
|
|
432
|
-
var _getVariableLabelByKind, _v_spec_display_description;
|
|
433
|
-
return (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
428
|
+
children: extVar.definitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
434
429
|
children: [
|
|
435
430
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
436
431
|
component: "th",
|
|
437
432
|
scope: "row",
|
|
438
433
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
439
|
-
checked:
|
|
434
|
+
checked: v.spec.display?.hidden !== true,
|
|
440
435
|
disabled: true
|
|
441
436
|
})
|
|
442
437
|
}),
|
|
@@ -455,10 +450,10 @@ function VariableEditor(props) {
|
|
|
455
450
|
})
|
|
456
451
|
}),
|
|
457
452
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
458
|
-
children:
|
|
453
|
+
children: getVariableLabelByKind(v.kind) ?? v.kind
|
|
459
454
|
}),
|
|
460
455
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(TableCell, {
|
|
461
|
-
children:
|
|
456
|
+
children: v.spec.display?.description ?? ''
|
|
462
457
|
}),
|
|
463
458
|
/*#__PURE__*/ (0, _jsxruntime.jsxs)(TableCell, {
|
|
464
459
|
align: "right",
|
|
@@ -492,8 +487,7 @@ function VariableEditor(props) {
|
|
|
492
487
|
]
|
|
493
488
|
})
|
|
494
489
|
]
|
|
495
|
-
}, v.spec.name)
|
|
496
|
-
})
|
|
490
|
+
}, v.spec.name))
|
|
497
491
|
})
|
|
498
492
|
]
|
|
499
493
|
})
|
|
@@ -519,13 +513,13 @@ function VariableName(props) {
|
|
|
519
513
|
const { name, state } = props;
|
|
520
514
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
521
515
|
children: [
|
|
522
|
-
!
|
|
523
|
-
!
|
|
516
|
+
!state?.overridden && `${name} `,
|
|
517
|
+
!state?.overridden && state?.overriding && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
524
518
|
fontWeight: "normal",
|
|
525
519
|
color: (theme)=>theme.palette.primary.main,
|
|
526
520
|
children: "(overriding)"
|
|
527
521
|
}),
|
|
528
|
-
|
|
522
|
+
state?.overridden && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
529
523
|
children: [
|
|
530
524
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
531
525
|
color: (theme)=>theme.palette.grey[500],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,47 +21,48 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
VariableList: function() {
|
|
25
|
+
return VariableList;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
VariableListItem: function() {
|
|
28
|
+
return VariableListItem;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _jsxruntime = require("react/jsx-runtime");
|
|
32
32
|
const _material = require("@mui/material");
|
|
33
33
|
const _context = require("../../context");
|
|
34
34
|
const _constants = require("../../constants");
|
|
35
|
-
const
|
|
36
|
-
function
|
|
37
|
-
const variableDefinitions = (0, _context.
|
|
38
|
-
const externalVariableDefinitions = (0, _context.
|
|
35
|
+
const _Variable = require("./Variable");
|
|
36
|
+
function VariableList() {
|
|
37
|
+
const variableDefinitions = (0, _context.useVariableDefinitions)();
|
|
38
|
+
const externalVariableDefinitions = (0, _context.useExternalVariableDefinitions)();
|
|
39
39
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
40
40
|
children: [
|
|
41
41
|
externalVariableDefinitions.slice().reverse() // We reverse to have the most prioritized on top
|
|
42
|
-
.map((def)=>def.definitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
42
|
+
.map((def)=>def.definitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(VariableListItem, {
|
|
43
43
|
spec: v.spec,
|
|
44
44
|
source: def.source
|
|
45
45
|
}, v.spec.name + def.source))),
|
|
46
|
-
variableDefinitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
46
|
+
variableDefinitions.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(VariableListItem, {
|
|
47
47
|
spec: v.spec
|
|
48
48
|
}, v.spec.name))
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
function VariableListItem({ spec, source }) {
|
|
53
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(spec.name, source);
|
|
54
|
+
if (ctx.state?.overridden) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
56
57
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
57
|
-
display:
|
|
58
|
-
minWidth: `${_constants.
|
|
59
|
-
maxWidth: `${_constants.
|
|
58
|
+
display: spec.display?.hidden ? 'none' : undefined,
|
|
59
|
+
minWidth: `${_constants.MIN_VARIABLE_WIDTH}px`,
|
|
60
|
+
maxWidth: `${_constants.MAX_VARIABLE_WIDTH}px`,
|
|
60
61
|
flexShrink: 0,
|
|
61
|
-
"data-testid": '
|
|
62
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
62
|
+
"data-testid": 'variable-' + spec.name,
|
|
63
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Variable.Variable, {
|
|
63
64
|
name: spec.name,
|
|
64
65
|
source: source
|
|
65
|
-
}, (
|
|
66
|
-
}, (
|
|
66
|
+
}, (spec.name + source) ?? '')
|
|
67
|
+
}, (spec.name + source) ?? '');
|
|
67
68
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./BuiltinVariableAccordions"), exports);
|
|
18
18
|
_export_star(require("./EditVariablesButton"), exports);
|
|
19
|
-
_export_star(require("./
|
|
19
|
+
_export_star(require("./Variable"), exports);
|
|
20
20
|
_export_star(require("./VariableEditor"), exports);
|
|
21
21
|
_export_star(require("./VariableList"), exports);
|
|
22
22
|
function _export_star(from, to) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,11 +21,17 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
HEADER_ACTIONS_CONTAINER_NAME: function() {
|
|
25
|
+
return HEADER_ACTIONS_CONTAINER_NAME;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
HEADER_ACTIONS_MIN_WIDTH: function() {
|
|
28
|
+
return HEADER_ACTIONS_MIN_WIDTH;
|
|
29
|
+
},
|
|
30
|
+
MAX_VARIABLE_WIDTH: function() {
|
|
31
|
+
return MAX_VARIABLE_WIDTH;
|
|
32
|
+
},
|
|
33
|
+
MIN_VARIABLE_WIDTH: function() {
|
|
34
|
+
return MIN_VARIABLE_WIDTH;
|
|
29
35
|
},
|
|
30
36
|
editButtonStyle: function() {
|
|
31
37
|
return editButtonStyle;
|
|
@@ -38,5 +44,7 @@ const editButtonStyle = {
|
|
|
38
44
|
marginRight: 0.5
|
|
39
45
|
}
|
|
40
46
|
};
|
|
41
|
-
const
|
|
42
|
-
const
|
|
47
|
+
const MIN_VARIABLE_WIDTH = 120;
|
|
48
|
+
const MAX_VARIABLE_WIDTH = 500;
|
|
49
|
+
const HEADER_ACTIONS_MIN_WIDTH = 200;
|
|
50
|
+
const HEADER_ACTIONS_CONTAINER_NAME = 'header-actions-container';
|
|
@@ -44,6 +44,7 @@ const TOOLTIP_TEXT = {
|
|
|
44
44
|
moveGroupDown: 'Move group down',
|
|
45
45
|
moveGroupUp: 'Move group up',
|
|
46
46
|
// Panel buttons
|
|
47
|
+
viewPanel: 'Toggle View Mode',
|
|
47
48
|
editPanel: 'Edit',
|
|
48
49
|
duplicatePanel: 'Duplicate',
|
|
49
50
|
deletePanel: 'Delete',
|
|
@@ -60,8 +61,10 @@ const ARIA_LABEL_TEXT = {
|
|
|
60
61
|
moveGroupDown: (groupName)=>`move group ${groupName} down`,
|
|
61
62
|
moveGroupUp: (groupName)=>`move group ${groupName} up`,
|
|
62
63
|
// Panel buttons
|
|
64
|
+
viewPanel: (panelName)=>`toggle panel ${panelName} view mode`,
|
|
63
65
|
editPanel: (panelName)=>`edit panel ${panelName}`,
|
|
64
66
|
duplicatePanel: (panelName)=>`duplicate panel ${panelName}`,
|
|
65
67
|
deletePanel: (panelName)=>`delete panel ${panelName}`,
|
|
68
|
+
showPanelActions: (panelName)=>`show panel actions for ${panelName} `,
|
|
66
69
|
movePanel: (panelName)=>`move panel ${panelName}`
|
|
67
70
|
};
|
|
@@ -33,6 +33,7 @@ _export(exports, {
|
|
|
33
33
|
});
|
|
34
34
|
const _jsxruntime = require("react/jsx-runtime");
|
|
35
35
|
const _zustand = require("zustand");
|
|
36
|
+
const _traditional = require("zustand/traditional");
|
|
36
37
|
const _middleware = require("zustand/middleware");
|
|
37
38
|
const _immer = require("zustand/middleware/immer");
|
|
38
39
|
const _shallow = require("zustand/shallow");
|
|
@@ -50,13 +51,14 @@ const _savechangesdialogslice = require("./save-changes-dialog-slice");
|
|
|
50
51
|
const _duplicatepanelslice = require("./duplicate-panel-slice");
|
|
51
52
|
const _editjsondialogslice = require("./edit-json-dialog-slice");
|
|
52
53
|
const _common = require("./common");
|
|
54
|
+
const _viewpanelslice = require("./view-panel-slice");
|
|
53
55
|
const DashboardContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
54
56
|
function useDashboardStore(selector) {
|
|
55
57
|
const store = (0, _react.useContext)(DashboardContext);
|
|
56
58
|
if (store === undefined) {
|
|
57
59
|
throw new Error('No DashboardContext found. Did you forget a Provider?');
|
|
58
60
|
}
|
|
59
|
-
return (0,
|
|
61
|
+
return (0, _traditional.useStoreWithEqualityFn)(store, selector, _shallow.shallow);
|
|
60
62
|
}
|
|
61
63
|
function DashboardProvider(props) {
|
|
62
64
|
const createDashboardStore = (0, _react.useCallback)(initStore, [
|
|
@@ -64,13 +66,12 @@ function DashboardProvider(props) {
|
|
|
64
66
|
]);
|
|
65
67
|
// load plugin to retrieve initial spec if default panel kind is defined
|
|
66
68
|
const { defaultPluginKinds } = (0, _pluginsystem.usePluginRegistry)();
|
|
67
|
-
|
|
68
|
-
const defaultPanelKind = (_defaultPluginKinds_Panel = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds['Panel']) !== null && _defaultPluginKinds_Panel !== void 0 ? _defaultPluginKinds_Panel : '';
|
|
69
|
+
const defaultPanelKind = defaultPluginKinds?.['Panel'] ?? '';
|
|
69
70
|
const { data: plugin } = (0, _pluginsystem.usePlugin)('Panel', defaultPanelKind);
|
|
70
71
|
const [store] = (0, _react.useState)(createDashboardStore(props)); // prevent calling createDashboardStore every time it rerenders
|
|
71
72
|
(0, _react.useEffect)(()=>{
|
|
72
73
|
if (plugin === undefined) return;
|
|
73
|
-
const defaultPanelSpec = plugin.createInitialOptions();
|
|
74
|
+
const defaultPanelSpec = plugin.createInitialOptions ? plugin.createInitialOptions() : {};
|
|
74
75
|
// set default panel kind, spec, and queries for add panel editor
|
|
75
76
|
store.setState({
|
|
76
77
|
initialValues: {
|
|
@@ -88,13 +89,13 @@ function DashboardProvider(props) {
|
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
function initStore(props) {
|
|
91
|
-
const { initialState: { dashboardResource, isEditMode } } = props;
|
|
92
|
+
const { initialState: { dashboardResource, isEditMode, viewPanelRef, setViewPanelRef } } = props;
|
|
92
93
|
const { kind, metadata, spec: { display, duration, refreshInterval = _core.DEFAULT_REFRESH_INTERVAL, datasources } } = dashboardResource;
|
|
93
94
|
const ttl = 'ttl' in dashboardResource.spec ? dashboardResource.spec.ttl : undefined;
|
|
94
95
|
let { spec: { layouts, panels } } = dashboardResource;
|
|
95
96
|
// Set fallbacks in case the frontend is used with a non-Perses backend
|
|
96
|
-
layouts = layouts
|
|
97
|
-
panels = panels
|
|
97
|
+
layouts = layouts ?? [];
|
|
98
|
+
panels = panels ?? {};
|
|
98
99
|
const store = (0, _zustand.createStore)()((0, _immer.immer)((0, _middleware.devtools)((...args)=>{
|
|
99
100
|
const [set] = args;
|
|
100
101
|
return {
|
|
@@ -105,6 +106,7 @@ function initStore(props) {
|
|
|
105
106
|
...(0, _paneleditorslice.createPanelEditorSlice)()(...args),
|
|
106
107
|
...(0, _deletepanelslice.createDeletePanelSlice)()(...args),
|
|
107
108
|
...(0, _duplicatepanelslice.createDuplicatePanelSlice)()(...args),
|
|
109
|
+
...(0, _viewpanelslice.createViewPanelSlice)(viewPanelRef, setViewPanelRef)(...args),
|
|
108
110
|
/* General */ ...(0, _discardchangesdialogslice.createDiscardChangesDialogSlice)(...args),
|
|
109
111
|
...(0, _editjsondialogslice.createEditJsonDialogSlice)(...args),
|
|
110
112
|
...(0, _savechangesdialogslice.createSaveChangesDialogSlice)(...args),
|
|
@@ -129,7 +131,7 @@ function initStore(props) {
|
|
|
129
131
|
state.panelGroups = panelGroups;
|
|
130
132
|
state.panelGroupOrder = panelGroupOrder;
|
|
131
133
|
state.duration = duration;
|
|
132
|
-
state.refreshInterval = refreshInterval
|
|
134
|
+
state.refreshInterval = refreshInterval ?? _core.DEFAULT_REFRESH_INTERVAL;
|
|
133
135
|
state.datasources = datasources;
|
|
134
136
|
// TODO: add ttl here to e.g allow edition from JSON view, but probably requires quite some refactoring
|
|
135
137
|
});
|