@perses-dev/dashboards 0.0.0-snapshot-scatter-chart-embed-8efdfab → 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/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/cjs/components/AddPanelButton/AddPanelButton.js +2 -2
- package/dist/cjs/components/Dashboard/Dashboard.js +9 -2
- package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +4 -4
- package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +6 -6
- package/dist/cjs/components/Datasources/DatasourceEditor.js +19 -20
- package/dist/cjs/components/Datasources/EditDatasourcesButton.js +11 -8
- package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
- package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -5
- package/dist/cjs/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/cjs/components/DownloadButton/DownloadButton.js +3 -4
- package/dist/cjs/components/EditButton/EditButton.js +1 -1
- package/dist/cjs/components/EditJsonButton/EditJsonButton.js +3 -4
- package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +21 -17
- package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +5 -5
- package/dist/cjs/components/GridLayout/GridContainer.js +16 -11
- package/dist/cjs/components/GridLayout/GridItemContent.js +24 -10
- package/dist/cjs/components/GridLayout/GridLayout.js +63 -14
- package/dist/cjs/components/GridLayout/GridTitle.js +8 -9
- package/dist/cjs/{validation/panel.js → components/Panel/HeaderIconButton.js} +8 -10
- package/dist/cjs/components/Panel/Panel.js +15 -11
- package/dist/cjs/components/Panel/PanelActions.js +216 -0
- package/dist/cjs/components/Panel/PanelContent.js +6 -6
- 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 -62
- package/dist/cjs/components/PanelDrawer/PanelPreview.js +9 -6
- package/dist/cjs/components/PanelDrawer/usePanelEditor.js +9 -6
- package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
- package/dist/cjs/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +5 -7
- package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +7 -9
- package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +8 -8
- package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +8 -14
- package/dist/cjs/components/Variables/EditVariablesButton.js +5 -5
- package/dist/cjs/components/Variables/{TemplateVariable.js → Variable.js} +48 -56
- package/dist/cjs/components/Variables/VariableEditor.js +39 -46
- package/dist/cjs/components/Variables/VariableList.js +23 -22
- package/dist/cjs/components/Variables/index.js +2 -2
- package/dist/cjs/components/index.js +0 -2
- package/dist/cjs/constants/styles.js +17 -9
- package/dist/cjs/constants/user-interface-text.js +6 -5
- package/dist/cjs/context/DashboardProvider/DashboardProvider.js +24 -17
- package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +36 -0
- package/dist/cjs/context/DashboardProvider/common.js +5 -5
- package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +51 -43
- package/dist/cjs/context/DashboardProvider/delete-panel-group-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +4 -5
- package/dist/cjs/context/DashboardProvider/duplicate-panel-slice.js +1 -1
- package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +11 -16
- package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
- package/dist/cjs/context/DashboardProvider/panel-group-slice.js +13 -8
- package/dist/cjs/context/DashboardProvider/view-panel-slice.js +79 -0
- package/dist/cjs/context/DatasourceStoreProvider.js +32 -31
- package/dist/cjs/context/{TemplateVariableProvider/TemplateVariableProvider.js → VariableProvider/VariableProvider.js} +128 -131
- 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 +8 -8
- package/dist/cjs/context/{TemplateVariableProvider → VariableProvider}/utils.js +6 -6
- package/dist/cjs/context/index.js +2 -2
- package/dist/cjs/context/useDashboard.js +24 -9
- 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/dashboard-provider.js +3 -3
- package/dist/cjs/test/datasource-provider.js +4 -4
- package/dist/cjs/test/plugin-registry.js +4 -2
- package/dist/cjs/test/render.js +14 -12
- package/dist/cjs/utils/index.js +0 -1
- package/dist/cjs/utils/panelUtils.js +5 -5
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +8 -8
- package/dist/cjs/views/ViewDashboard/ViewDashboard.js +10 -11
- package/dist/components/AddGroupButton/AddGroupButton.d.ts +2 -2
- package/dist/components/AddGroupButton/AddGroupButton.d.ts.map +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js +1 -1
- package/dist/components/AddGroupButton/AddGroupButton.js.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.d.ts +2 -2
- package/dist/components/AddPanelButton/AddPanelButton.d.ts.map +1 -1
- package/dist/components/AddPanelButton/AddPanelButton.js +2 -2
- package/dist/components/AddPanelButton/AddPanelButton.js.map +1 -1
- package/dist/components/Dashboard/Dashboard.d.ts +3 -3
- package/dist/components/Dashboard/Dashboard.d.ts.map +1 -1
- package/dist/components/Dashboard/Dashboard.js +9 -2
- package/dist/components/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +2 -2
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
- package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +4 -4
- 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 +5 -5
- package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.d.ts +2 -2
- package/dist/components/Datasources/DatasourceEditor.d.ts.map +1 -1
- package/dist/components/Datasources/DatasourceEditor.js +20 -21
- package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.d.ts +2 -2
- package/dist/components/Datasources/EditDatasourcesButton.d.ts.map +1 -1
- package/dist/components/Datasources/EditDatasourcesButton.js +11 -8
- package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts +2 -2
- package/dist/components/DeletePanelDialog/DeletePanelDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js +4 -4
- package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts +2 -2
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -5
- package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +2 -2
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.d.ts +2 -2
- package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.js +3 -4
- package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
- package/dist/components/EditButton/EditButton.d.ts +2 -2
- package/dist/components/EditButton/EditButton.d.ts.map +1 -1
- package/dist/components/EditButton/EditButton.js +1 -1
- package/dist/components/EditButton/EditButton.js.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.d.ts +2 -2
- package/dist/components/EditJsonButton/EditJsonButton.d.ts.map +1 -1
- package/dist/components/EditJsonButton/EditJsonButton.js +3 -4
- package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts +2 -2
- package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
- package/dist/components/EditJsonDialog/EditJsonDialog.js +21 -17
- 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 +5 -5
- 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 +16 -11
- package/dist/components/GridLayout/GridContainer.js.map +1 -1
- package/dist/components/GridLayout/GridItemContent.d.ts +2 -2
- package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
- package/dist/components/GridLayout/GridItemContent.js +25 -11
- package/dist/components/GridLayout/GridItemContent.js.map +1 -1
- package/dist/components/GridLayout/GridLayout.d.ts +4 -3
- package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
- package/dist/components/GridLayout/GridLayout.js +65 -16
- package/dist/components/GridLayout/GridLayout.js.map +1 -1
- package/dist/components/GridLayout/GridTitle.d.ts +3 -3
- package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
- package/dist/components/GridLayout/GridTitle.js +8 -9
- 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/components/{TimeRangeControls/index.js → Panel/HeaderIconButton.js} +7 -3
- package/dist/components/Panel/HeaderIconButton.js.map +1 -0
- package/dist/components/Panel/Panel.d.ts +13 -7
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/Panel/Panel.js +16 -12
- 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 -2
- package/dist/components/Panel/PanelContent.d.ts.map +1 -1
- package/dist/components/Panel/PanelContent.js +6 -6
- package/dist/components/Panel/PanelContent.js.map +1 -1
- package/dist/components/Panel/PanelHeader.d.ts +9 -9
- 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 -2
- 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 -4
- package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelEditorForm.js +70 -65
- package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.d.ts +3 -3
- package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
- package/dist/components/PanelDrawer/PanelPreview.js +9 -6
- 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 -2
- 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 -2
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.d.ts.map +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js +1 -1
- package/dist/components/PanelGroupDialog/PanelGroupEditorForm.js.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts +2 -2
- package/dist/components/QuerySummaryTable/QuerySummaryTable.d.ts.map +1 -1
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js +5 -7
- package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +2 -2
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +8 -10
- package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +2 -2
- package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -1
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js +9 -9
- package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts +3 -3
- package/dist/components/Variables/BuiltinVariableAccordions.d.ts.map +1 -1
- package/dist/components/Variables/BuiltinVariableAccordions.js +8 -14
- package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
- package/dist/components/Variables/EditVariablesButton.d.ts +2 -2
- package/dist/components/Variables/EditVariablesButton.d.ts.map +1 -1
- package/dist/components/Variables/EditVariablesButton.js +6 -6
- package/dist/components/Variables/EditVariablesButton.js.map +1 -1
- package/dist/components/Variables/{TemplateVariable.d.ts → Variable.d.ts} +6 -6
- package/dist/components/Variables/Variable.d.ts.map +1 -0
- package/dist/components/Variables/{TemplateVariable.js → Variable.js} +49 -57
- package/dist/components/Variables/Variable.js.map +1 -0
- package/dist/components/Variables/VariableEditor.d.ts +3 -3
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +40 -47
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/VariableList.d.ts +4 -4
- 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/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -2
- package/dist/components/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 -2
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +3 -2
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.d.ts +11 -6
- package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
- package/dist/context/DashboardProvider/DashboardProvider.js +22 -15
- 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 +3 -3
- 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 +26 -19
- 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 +1 -1
- package/dist/context/DashboardProvider/delete-panel-group-slice.js.map +1 -1
- package/dist/context/DashboardProvider/delete-panel-slice.js +4 -5
- 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 +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 +8 -13
- 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 +3 -3
- package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
- package/dist/context/DashboardProvider/panel-group-slice.js +8 -4
- 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 +10 -10
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +32 -31
- 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} +117 -116
- 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 +3 -3
- package/dist/context/useDashboard.d.ts.map +1 -1
- package/dist/context/useDashboard.js +24 -9
- 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 +10 -8
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/panelUtils.d.ts +1 -1
- package/dist/utils/panelUtils.d.ts.map +1 -1
- package/dist/utils/panelUtils.js +2 -2
- package/dist/utils/panelUtils.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.d.ts +4 -4
- package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +8 -8
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.d.ts +4 -4
- package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
- package/dist/views/ViewDashboard/ViewDashboard.js +11 -12
- package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
- package/package.json +9 -9
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -210
- package/dist/cjs/components/TimeRangeControls/index.js +0 -30
- package/dist/cjs/components/ToolbarIconButton/ToolbarIconButton.js +0 -40
- package/dist/cjs/components/ToolbarIconButton/index.js +0 -30
- package/dist/cjs/context/TemplateVariableProvider/index.js +0 -30
- package/dist/cjs/utils/time.js +0 -29
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +0 -14
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +0 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +0 -186
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +0 -1
- package/dist/components/TimeRangeControls/index.d.ts +0 -2
- package/dist/components/TimeRangeControls/index.d.ts.map +0 -1
- package/dist/components/TimeRangeControls/index.js.map +0 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts +0 -6
- package/dist/components/ToolbarIconButton/ToolbarIconButton.d.ts.map +0 -1
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js +0 -32
- package/dist/components/ToolbarIconButton/ToolbarIconButton.js.map +0 -1
- package/dist/components/ToolbarIconButton/index.d.ts +0 -2
- package/dist/components/ToolbarIconButton/index.d.ts.map +0 -1
- package/dist/components/ToolbarIconButton/index.js +0 -15
- package/dist/components/ToolbarIconButton/index.js.map +0 -1
- 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 +0 -15
- 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/utils/time.d.ts +0 -5
- package/dist/utils/time.d.ts.map +0 -1
- package/dist/utils/time.js +0 -23
- package/dist/utils/time.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
|
@@ -22,9 +22,10 @@ Object.defineProperty(exports, "usePanelEditor", {
|
|
|
22
22
|
});
|
|
23
23
|
const _react = require("react");
|
|
24
24
|
const usePanelEditor = (panelDefinition)=>{
|
|
25
|
-
const { display
|
|
25
|
+
const { display, plugin: pluginDefinition, queries: initialQueries, links: initialLinks } = panelDefinition.spec;
|
|
26
26
|
const [name, setName] = (0, _react.useState)(display.name);
|
|
27
27
|
const [description, setDescription] = (0, _react.useState)(display.description);
|
|
28
|
+
const [links, setLinks] = (0, _react.useState)(initialLinks);
|
|
28
29
|
const [plugin, setPlugin] = (0, _react.useState)(pluginDefinition);
|
|
29
30
|
// need to keep track of prevQueries if switching from a panel with no queries (ex: markdown) to one with queries
|
|
30
31
|
const [prevQueries, setPrevQueries] = (0, _react.useState)(initialQueries);
|
|
@@ -47,14 +48,16 @@ const usePanelEditor = (panelDefinition)=>{
|
|
|
47
48
|
]);
|
|
48
49
|
// reset panel definition
|
|
49
50
|
const setPanelDefinition = (0, _react.useCallback)((panelDefinition)=>{
|
|
50
|
-
const { display
|
|
51
|
+
const { display, plugin, queries, links } = panelDefinition.spec;
|
|
51
52
|
setName(display.name);
|
|
52
53
|
setDescription(display.description);
|
|
54
|
+
setLinks(links);
|
|
53
55
|
setPlugin(plugin);
|
|
54
56
|
setQueries(queries);
|
|
55
57
|
}, [
|
|
56
58
|
setName,
|
|
57
59
|
setDescription,
|
|
60
|
+
setLinks,
|
|
58
61
|
setPlugin,
|
|
59
62
|
setQueries
|
|
60
63
|
]);
|
|
@@ -67,23 +70,23 @@ const usePanelEditor = (panelDefinition)=>{
|
|
|
67
70
|
description
|
|
68
71
|
},
|
|
69
72
|
plugin,
|
|
70
|
-
queries: currentQueries
|
|
73
|
+
queries: currentQueries,
|
|
74
|
+
links
|
|
71
75
|
}
|
|
72
76
|
},
|
|
73
77
|
setName,
|
|
74
78
|
setDescription,
|
|
79
|
+
setLinks,
|
|
75
80
|
setQueries,
|
|
76
81
|
setPlugin,
|
|
77
82
|
setPanelDefinition
|
|
78
83
|
}), [
|
|
79
84
|
name,
|
|
80
85
|
description,
|
|
86
|
+
links,
|
|
81
87
|
plugin,
|
|
82
88
|
currentQueries,
|
|
83
|
-
setName,
|
|
84
|
-
setDescription,
|
|
85
89
|
setQueries,
|
|
86
|
-
setPlugin,
|
|
87
90
|
setPanelDefinition
|
|
88
91
|
]);
|
|
89
92
|
};
|
|
@@ -38,7 +38,7 @@ function PanelGroupDialog() {
|
|
|
38
38
|
const handleClose = ()=>setIsClosing(true);
|
|
39
39
|
// Don't call close on the store until the Dialog has completely transitioned out
|
|
40
40
|
const handleExited = ()=>{
|
|
41
|
-
panelGroupEditor
|
|
41
|
+
panelGroupEditor?.close();
|
|
42
42
|
setIsClosing(false);
|
|
43
43
|
};
|
|
44
44
|
// Dialog is open if we have a model and we're not transitioning out
|
|
@@ -32,7 +32,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
32
32
|
const _react = require("react");
|
|
33
33
|
const _material = require("@mui/material");
|
|
34
34
|
function PanelGroupEditorForm(props) {
|
|
35
|
-
const { initialValues
|
|
35
|
+
const { initialValues, onSubmit } = props;
|
|
36
36
|
const [title, setTitle] = (0, _react.useState)(initialValues.title);
|
|
37
37
|
const [isCollapsed, setIsCollapsed] = (0, _react.useState)(initialValues.isCollapsed);
|
|
38
38
|
const handleCollapsedChange = (e)=>{
|
|
@@ -26,15 +26,15 @@ const _reactquery = require("@tanstack/react-query");
|
|
|
26
26
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
27
27
|
const TABLE_MAX_WIDTH = 1000;
|
|
28
28
|
function QuerySummaryTable(props) {
|
|
29
|
-
const { showTotalQueries =true
|
|
29
|
+
const { showTotalQueries = true } = props;
|
|
30
30
|
const datasourceClient = (0, _pluginsystem.useDatasourceClient)({
|
|
31
31
|
kind: 'PrometheusDatasource'
|
|
32
32
|
});
|
|
33
|
-
const { absoluteTimeRange
|
|
33
|
+
const { absoluteTimeRange } = (0, _pluginsystem.useTimeRange)();
|
|
34
34
|
// for displaying a summary of recent query results
|
|
35
35
|
const queryClient = (0, _reactquery.useQueryClient)();
|
|
36
36
|
const queries = queryClient.getQueryCache().findAll();
|
|
37
|
-
const activeQueries = queries.filter((query)=>query.state.status === '
|
|
37
|
+
const activeQueries = queries.filter((query)=>query.state.status === 'pending');
|
|
38
38
|
const completedQueries = queries.filter((query)=>query.state.status === 'success');
|
|
39
39
|
const querySummary = (0, _pluginsystem.useActiveTimeSeriesQueries)();
|
|
40
40
|
if (datasourceClient.isLoading === true) {
|
|
@@ -42,12 +42,10 @@ function QuerySummaryTable(props) {
|
|
|
42
42
|
}
|
|
43
43
|
const warnings = [];
|
|
44
44
|
querySummary.forEach((query)=>{
|
|
45
|
-
var _queryData_metadata;
|
|
46
45
|
const queryData = query.state.data;
|
|
47
|
-
if (queryData &&
|
|
48
|
-
var _queryData_metadata_notices_;
|
|
46
|
+
if (queryData && queryData.metadata?.notices) {
|
|
49
47
|
const queryKey = query.queryKey;
|
|
50
|
-
const warningMessage =
|
|
48
|
+
const warningMessage = queryData.metadata.notices[0]?.message;
|
|
51
49
|
if (warningMessage) {
|
|
52
50
|
warnings.push({
|
|
53
51
|
query: String(queryKey[0].spec.plugin.spec.query),
|
|
@@ -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
|
|
@@ -28,17 +28,15 @@ const _core = require("@perses-dev/core");
|
|
|
28
28
|
const _components = require("@perses-dev/components");
|
|
29
29
|
const _context = require("../../context");
|
|
30
30
|
const SaveChangesConfirmationDialog = ()=>{
|
|
31
|
-
const { saveChangesConfirmationDialog: dialog
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
var _dialog_isSavedVariableModified;
|
|
35
|
-
const isSavedVariableModified = (_dialog_isSavedVariableModified = dialog === null || dialog === void 0 ? void 0 : dialog.isSavedVariableModified) !== null && _dialog_isSavedVariableModified !== void 0 ? _dialog_isSavedVariableModified : true;
|
|
31
|
+
const { saveChangesConfirmationDialog: dialog } = (0, _context.useSaveChangesConfirmationDialog)();
|
|
32
|
+
const isSavedDurationModified = dialog?.isSavedDurationModified ?? true;
|
|
33
|
+
const isSavedVariableModified = dialog?.isSavedVariableModified ?? true;
|
|
36
34
|
const [saveDefaultTimeRange, setSaveDefaultTimeRange] = (0, _react.useState)(isSavedDurationModified);
|
|
37
35
|
const [saveDefaultVariables, setSaveDefaultVariables] = (0, _react.useState)(isSavedVariableModified);
|
|
38
|
-
const { getSavedVariablesStatus
|
|
39
|
-
const { modifiedVariableNames
|
|
36
|
+
const { getSavedVariablesStatus } = (0, _context.useVariableDefinitionActions)();
|
|
37
|
+
const { modifiedVariableNames } = getSavedVariablesStatus();
|
|
40
38
|
const isOpen = dialog !== undefined;
|
|
41
|
-
const { timeRange
|
|
39
|
+
const { timeRange } = (0, _pluginsystem.useTimeRange)();
|
|
42
40
|
const currentTimeRangeText = (0, _core.isRelativeTimeRange)(timeRange) ? `(Last ${timeRange.pastDuration})` : '(Absolute time ranges can not be saved)';
|
|
43
41
|
const saveTimeRangeText = `Save current time range as new default ${currentTimeRangeText}`;
|
|
44
42
|
const saveVariablesText = `Save current variable values as new default (${modifiedVariableNames.length > 0 ? modifiedVariableNames.join(', ') : 'No modified variables'})`;
|
|
@@ -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
|
|
@@ -26,14 +26,14 @@ const _material = require("@mui/material");
|
|
|
26
26
|
const _core = require("@perses-dev/core");
|
|
27
27
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
28
28
|
const _context = require("../../context");
|
|
29
|
-
const SaveDashboardButton = ({ onSave
|
|
29
|
+
const SaveDashboardButton = ({ onSave, isDisabled, variant = 'contained' })=>{
|
|
30
30
|
const [isSavingDashboard, setSavingDashboard] = (0, _react.useState)(false);
|
|
31
|
-
const { dashboard
|
|
32
|
-
const { getSavedVariablesStatus
|
|
33
|
-
const { isSavedVariableModified
|
|
34
|
-
const { timeRange
|
|
35
|
-
const { setEditMode
|
|
36
|
-
const { openSaveChangesConfirmationDialog
|
|
31
|
+
const { dashboard, setDashboard } = (0, _context.useDashboard)();
|
|
32
|
+
const { getSavedVariablesStatus, setVariableDefaultValues } = (0, _context.useVariableDefinitionActions)();
|
|
33
|
+
const { isSavedVariableModified } = getSavedVariablesStatus();
|
|
34
|
+
const { timeRange } = (0, _pluginsystem.useTimeRange)();
|
|
35
|
+
const { setEditMode } = (0, _context.useEditMode)();
|
|
36
|
+
const { openSaveChangesConfirmationDialog, closeSaveChangesConfirmationDialog } = (0, _context.useSaveChangesConfirmationDialog)();
|
|
37
37
|
const onSaveButtonClick = ()=>{
|
|
38
38
|
const isSavedDurationModified = (0, _core.isRelativeTimeRange)(timeRange) && dashboard.spec.duration !== timeRange.pastDuration;
|
|
39
39
|
// Save dashboard
|
|
@@ -30,7 +30,7 @@ function _interop_require_default(obj) {
|
|
|
30
30
|
default: obj
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function BuiltinVariableAccordions({ builtinVariableDefinitions
|
|
33
|
+
function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
34
34
|
const builtinVariablesBySource = (0, _react.useMemo)(()=>{
|
|
35
35
|
const result = {};
|
|
36
36
|
for (const definition of builtinVariableDefinitions){
|
|
@@ -58,10 +58,8 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
58
58
|
}, [
|
|
59
59
|
builtinVariablesBySource
|
|
60
60
|
]);
|
|
61
|
-
var _builtinVariablesBySource_source, _v_spec_display_description;
|
|
62
61
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
|
63
|
-
children: sources.map((source)
|
|
64
|
-
/*#__PURE__*/ return (0, _jsxruntime.jsxs)(_material.Accordion, {
|
|
62
|
+
children: sources.map((source)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Accordion, {
|
|
65
63
|
sx: (theme)=>({
|
|
66
64
|
'.MuiAccordionSummary-root': {
|
|
67
65
|
backgroundColor: theme.palette.background.lighter
|
|
@@ -78,12 +76,12 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
78
76
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
79
77
|
variant: "h2",
|
|
80
78
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
81
|
-
title: `${source}
|
|
79
|
+
title: `${source} Built-in Variables`,
|
|
82
80
|
description: "Variables computed during dashboard rendering.",
|
|
83
81
|
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
|
|
84
82
|
children: [
|
|
85
83
|
source,
|
|
86
|
-
"
|
|
84
|
+
" Built-in Variables"
|
|
87
85
|
]
|
|
88
86
|
})
|
|
89
87
|
})
|
|
@@ -110,9 +108,7 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
110
108
|
})
|
|
111
109
|
}),
|
|
112
110
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
|
|
113
|
-
children: (
|
|
114
|
-
var _v_spec_display;
|
|
115
|
-
/*#__PURE__*/ return (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
111
|
+
children: (builtinVariablesBySource[source] ?? []).map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
|
|
116
112
|
children: [
|
|
117
113
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
|
|
118
114
|
component: "th",
|
|
@@ -123,18 +119,16 @@ function BuiltinVariableAccordions({ builtinVariableDefinitions }) {
|
|
|
123
119
|
children: v.spec.name
|
|
124
120
|
}),
|
|
125
121
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
|
|
126
|
-
children:
|
|
122
|
+
children: v.spec.display?.description ?? ''
|
|
127
123
|
})
|
|
128
124
|
]
|
|
129
|
-
}, source + '-' + v.spec.name)
|
|
130
|
-
})
|
|
125
|
+
}, source + '-' + v.spec.name))
|
|
131
126
|
})
|
|
132
127
|
]
|
|
133
128
|
})
|
|
134
129
|
})
|
|
135
130
|
})
|
|
136
131
|
]
|
|
137
|
-
}, source)
|
|
138
|
-
})
|
|
132
|
+
}, source))
|
|
139
133
|
});
|
|
140
134
|
}
|
|
@@ -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
|
|
@@ -34,12 +34,12 @@ function _interop_require_default(obj) {
|
|
|
34
34
|
default: obj
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function EditVariablesButton({ variant ='text'
|
|
37
|
+
function EditVariablesButton({ variant = 'text', label = 'Variables', color = 'primary', fullWidth }) {
|
|
38
38
|
const [isVariableEditorOpen, setIsVariableEditorOpen] = (0, _react.useState)(false);
|
|
39
|
-
const variableDefinitions = (0, _context.
|
|
40
|
-
const externalVariableDefinitions = (0, _context.
|
|
39
|
+
const variableDefinitions = (0, _context.useVariableDefinitions)();
|
|
40
|
+
const externalVariableDefinitions = (0, _context.useExternalVariableDefinitions)();
|
|
41
41
|
const builtinVariableDefinitions = (0, _pluginsystem.useBuiltinVariableDefinitions)();
|
|
42
|
-
const { setVariableDefinitions
|
|
42
|
+
const { setVariableDefinitions } = (0, _context.useVariableDefinitionActions)();
|
|
43
43
|
const openVariableEditor = ()=>{
|
|
44
44
|
setIsVariableEditorOpen(true);
|
|
45
45
|
};
|
|
@@ -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,14 +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)(()=>variablesOptionsQuery.isFetching
|
|
77
|
-
variablesOptionsQuery
|
|
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, [
|
|
76
|
+
variablesOptionsQuery.isFetching
|
|
78
77
|
]);
|
|
79
|
-
const options = variablesOptionsQuery.data
|
|
80
|
-
|
|
78
|
+
const options = (0, _react.useMemo)(()=>variablesOptionsQuery.data ?? [], [
|
|
79
|
+
variablesOptionsQuery.data
|
|
80
|
+
]);
|
|
81
|
+
let value = state?.value;
|
|
81
82
|
// Make sure value is an array if allowMultiple is true
|
|
82
83
|
if (allowMultiple && !Array.isArray(value)) {
|
|
83
84
|
value = typeof value === 'string' ? [
|
|
@@ -138,8 +139,7 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
138
139
|
allowMultiple
|
|
139
140
|
]);
|
|
140
141
|
value = (0, _react.useMemo)(()=>{
|
|
141
|
-
|
|
142
|
-
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;
|
|
143
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.
|
|
144
144
|
if (firstOptionValue) {
|
|
145
145
|
if (!valueIsInOptions || !value || value.length === 0) {
|
|
@@ -161,13 +161,12 @@ function useListVariableState(spec, state, variablesOptionsQuery) {
|
|
|
161
161
|
// an array, hence this conditional
|
|
162
162
|
if (Array.isArray(value)) {
|
|
163
163
|
return viewOptions.filter((o)=>{
|
|
164
|
-
return value
|
|
164
|
+
return value?.includes(o.value);
|
|
165
165
|
});
|
|
166
166
|
} else {
|
|
167
|
-
|
|
168
|
-
return (_viewOptions_find = viewOptions.find((o)=>{
|
|
167
|
+
return viewOptions.find((o)=>{
|
|
169
168
|
return value === o.value;
|
|
170
|
-
})
|
|
169
|
+
}) ?? {
|
|
171
170
|
value: '',
|
|
172
171
|
label: ''
|
|
173
172
|
};
|
|
@@ -194,28 +193,25 @@ const StyledPopper = (props)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Poppe
|
|
|
194
193
|
const LETTER_HSIZE = 8; // approximation
|
|
195
194
|
const ARROW_OFFSET = 40; // right offset for list variables (= take into account the dropdown toggle size)
|
|
196
195
|
const getWidthPx = (inputValue, kind)=>{
|
|
197
|
-
const width = (inputValue.length + 1) * LETTER_HSIZE + (kind
|
|
198
|
-
if (width < _constants.
|
|
199
|
-
return _constants.
|
|
200
|
-
} else if (width > _constants.
|
|
201
|
-
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;
|
|
202
201
|
} else {
|
|
203
202
|
return width;
|
|
204
203
|
}
|
|
205
204
|
};
|
|
206
|
-
function ListVariable({ name
|
|
207
|
-
|
|
208
|
-
const ctx = (0, _context.useTemplateVariable)(name, source);
|
|
205
|
+
function ListVariable({ name, source }) {
|
|
206
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
209
207
|
const definition = ctx.definition;
|
|
210
208
|
const variablesOptionsQuery = (0, _pluginsystem.useListVariablePluginValues)(definition);
|
|
211
|
-
const { setVariableValue
|
|
212
|
-
const { selectedOptions
|
|
213
|
-
const [
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
const allowMultiple = (definition === null || definition === void 0 ? void 0 : definition.spec.allowMultiple) === true;
|
|
218
|
-
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;
|
|
219
215
|
// Update value when changed
|
|
220
216
|
(0, _react.useEffect)(()=>{
|
|
221
217
|
if (value) {
|
|
@@ -257,7 +253,9 @@ function ListVariable({ name , source }) {
|
|
|
257
253
|
limitTags: 3,
|
|
258
254
|
size: "small",
|
|
259
255
|
disableClearable: true,
|
|
260
|
-
|
|
256
|
+
slots: {
|
|
257
|
+
popper: StyledPopper
|
|
258
|
+
},
|
|
261
259
|
renderInput: (params)=>{
|
|
262
260
|
return allowMultiple ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
263
261
|
...params,
|
|
@@ -274,9 +272,8 @@ function ListVariable({ name , source }) {
|
|
|
274
272
|
'& .MuiInputBase-root': {
|
|
275
273
|
minHeight: '38px'
|
|
276
274
|
},
|
|
277
|
-
'& .
|
|
278
|
-
|
|
279
|
-
paddingLeft: '5px'
|
|
275
|
+
'& .MuiAutocomplete-tag': {
|
|
276
|
+
margin: '1px 2px'
|
|
280
277
|
}
|
|
281
278
|
},
|
|
282
279
|
value: selectedOptions,
|
|
@@ -287,9 +284,7 @@ function ListVariable({ name , source }) {
|
|
|
287
284
|
setVariableValue(name, variableOptionToVariableValue(value), source);
|
|
288
285
|
}
|
|
289
286
|
},
|
|
290
|
-
inputValue: inputValue,
|
|
291
287
|
onInputChange: (_, newInputValue)=>{
|
|
292
|
-
setInputValue(newInputValue);
|
|
293
288
|
if (!allowMultiple) {
|
|
294
289
|
setInputWidth(getWidthPx(newInputValue, 'list'));
|
|
295
290
|
}
|
|
@@ -300,35 +295,32 @@ function ListVariable({ name , source }) {
|
|
|
300
295
|
]
|
|
301
296
|
});
|
|
302
297
|
}
|
|
303
|
-
function TextVariable({ name
|
|
304
|
-
|
|
305
|
-
const ctx = (0, _context.useTemplateVariable)(name, source);
|
|
298
|
+
function TextVariable({ name, source }) {
|
|
299
|
+
const ctx = (0, _context.useVariableDefinitionAndState)(name, source);
|
|
306
300
|
const state = ctx.state;
|
|
307
301
|
const definition = ctx.definition;
|
|
308
|
-
|
|
309
|
-
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 ?? '');
|
|
310
303
|
const [inputWidth, setInputWidth] = (0, _react.useState)(getWidthPx(tempValue, 'text'));
|
|
311
|
-
const { setVariableValue
|
|
304
|
+
const { setVariableValue } = (0, _context.useVariableDefinitionActions)();
|
|
312
305
|
(0, _react.useEffect)(()=>{
|
|
313
|
-
|
|
314
|
-
setTempValue((_state_value = state === null || state === void 0 ? void 0 : state.value) !== null && _state_value !== void 0 ? _state_value : '');
|
|
306
|
+
setTempValue(state?.value ?? '');
|
|
315
307
|
}, [
|
|
316
|
-
state
|
|
308
|
+
state?.value
|
|
317
309
|
]);
|
|
318
|
-
var _definition_spec_display_name, _definition_spec_constant;
|
|
319
310
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
320
311
|
title: tempValue,
|
|
321
312
|
value: tempValue,
|
|
322
|
-
//onChange={(e) => setTempValue(e.target.value)}
|
|
323
313
|
onChange: (e)=>{
|
|
324
314
|
setTempValue(e.target.value);
|
|
325
315
|
setInputWidth(getWidthPx(e.target.value, 'text'));
|
|
326
316
|
},
|
|
327
317
|
onBlur: ()=>setVariableValue(name, tempValue, source),
|
|
328
318
|
placeholder: name,
|
|
329
|
-
label:
|
|
330
|
-
|
|
331
|
-
|
|
319
|
+
label: definition?.spec.display?.name ?? name,
|
|
320
|
+
slotProps: {
|
|
321
|
+
input: {
|
|
322
|
+
readOnly: definition?.spec.constant ?? false
|
|
323
|
+
}
|
|
332
324
|
},
|
|
333
325
|
sx: {
|
|
334
326
|
width: `${inputWidth}px`,
|