mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
RestoreDashboards: Make confirmation text consistent (#92388)
* refactor: change wording * refactor: change API * refactor: clean up
This commit is contained in:
parent
f1ba609b34
commit
1f35bc8346
@ -370,7 +370,7 @@ func (hs *HTTPServer) SoftDeleteDashboard(c *contextmodel.ReqContext) response.R
|
||||
|
||||
return response.JSON(http.StatusOK, util.DynMap{
|
||||
"title": dash.Title,
|
||||
"message": fmt.Sprintf("Dashboard %s moved to trash", dash.Title),
|
||||
"message": fmt.Sprintf("Dashboard %s moved to Recently deleted", dash.Title),
|
||||
"uid": dash.UID,
|
||||
})
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ import { locationService, config, reportInteraction } from '@grafana/runtime';
|
||||
import { Modal, ConfirmModal, Button, Text, Space, TextLink } from '@grafana/ui';
|
||||
import { DashboardModel } from 'app/features/dashboard/state';
|
||||
import { cleanUpDashboardAndVariables } from 'app/features/dashboard/state/actions';
|
||||
import { deleteDashboard } from 'app/features/manage-dashboards/state/actions';
|
||||
|
||||
import { Trans, t } from '../../../../core/internationalization';
|
||||
import { useDeleteItemsMutation } from '../../../browse-dashboards/api/browseDashboardsAPI';
|
||||
|
||||
type DeleteDashboardModalProps = {
|
||||
hideModal(): void;
|
||||
@ -25,6 +25,7 @@ type Props = DeleteDashboardModalProps & ConnectedProps<typeof connector>;
|
||||
|
||||
const DeleteDashboardModalUnconnected = ({ hideModal, cleanUpDashboardAndVariables, dashboard }: Props) => {
|
||||
const isProvisioned = dashboard.meta.provisioned;
|
||||
const [deleteItems] = useDeleteItemsMutation();
|
||||
|
||||
const [, onConfirm] = useAsyncFn(async () => {
|
||||
reportInteraction('grafana_manage_dashboards_delete_clicked', {
|
||||
@ -34,7 +35,14 @@ const DeleteDashboardModalUnconnected = ({ hideModal, cleanUpDashboardAndVariabl
|
||||
source: 'dashboard_settings',
|
||||
restore_enabled: config.featureToggles.dashboardRestoreUI,
|
||||
});
|
||||
await deleteDashboard(dashboard.uid, true);
|
||||
await deleteItems({
|
||||
selectedItems: {
|
||||
dashboard: {
|
||||
[dashboard.uid]: true,
|
||||
},
|
||||
folder: {},
|
||||
},
|
||||
});
|
||||
cleanUpDashboardAndVariables();
|
||||
hideModal();
|
||||
locationService.replace('/');
|
||||
|
Loading…
Reference in New Issue
Block a user