Skip to content

feat(site): show entity name in DeleteDialog #9347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(site): show entity name in DeleteDialog
  • Loading branch information
ammario committed Aug 25, 2023
commit 6f32bdf403e9d37fa7fe3d33ff415baf5079d3a5
2 changes: 1 addition & 1 deletion site/src/components/Dialogs/DeleteDialog/DeleteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const DeleteDialog: FC<PropsWithChildren<DeleteDialogProps>> = ({
<Maybe condition={info !== undefined}>
<p className={styles.warning}>{info}</p>
</Maybe>
<p>{t("deleteDialog.confirm", { entity })}</p>
<p>{t("deleteDialog.confirm", { entity, name })}</p>

<form
onSubmit={(e) => {
Expand Down
2 changes: 1 addition & 1 deletion site/src/i18n/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"deleteDialog": {
"title": "Delete {{entity}}",
"intro": "Deleting this {{entity}} is irreversible!",
"confirm": "Are you sure you want to proceed? Type the name of this {{entity}} below to confirm.",
"confirm": "Are you sure you want to proceed? Type {{name}} below to confirm.",
"confirmLabel": "Name of {{entity}} to delete",
"incorrectName": "Incorrect {{entity}} name."
},
Expand Down
6 changes: 5 additions & 1 deletion site/src/pages/UsersPage/UsersPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ const deleteUser = async (setupActionSpies: () => void) => {
// Check if the confirm message is displayed
const confirmDialog = await screen.findByRole("dialog")
expect(confirmDialog).toHaveTextContent(
t("deleteDialog.confirm", { ns: "common", entity: "user" }).toString(),
t("deleteDialog.confirm", {
ns: "common",
entity: "user",
name: MockUser2.username,
}).toString(),
)

// Confirm with text input
Expand Down