refactor: the promptRemove.confirmRelatedResource message needs to be refactored (#293)

* feat: change dialog wordings

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>

* refactor: update protip wording

Co-authored-by: Jillian Maroket <67180770+jillian-maroket@users.noreply.github.com>
Signed-off-by: Yiya Chen <yiya.chen@suse.com>

---------

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
Signed-off-by: Yiya Chen <yiya.chen@suse.com>
Co-authored-by: Jillian Maroket <67180770+jillian-maroket@users.noreply.github.com>
This commit is contained in:
Yiya Chen 2025-05-14 15:27:06 +08:00 committed by GitHub
parent 63c4810b99
commit 258476876a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 11 deletions

View File

@ -42,8 +42,25 @@ export default {
computed: { computed: {
...mapState('action-menu', ['modalData']), ...mapState('action-menu', ['modalData']),
warningMessageKey() { title() {
return this.modalData.warningMessageKey; return this.modalData.title || 'dialog.promptRemove.title';
},
formattedType() {
return this.type.toLowerCase();
},
warningMessage() {
if (this.modalData.warningMessage) return this.t(this.modalData.warningMessage);
const isPlural = this.type.endsWith('s');
const thisOrThese = isPlural ? 'these' : 'this';
const defaultMessage = this.t('dialog.promptRemove.warningMessage', {
type: this.formattedType,
thisOrThese,
});
return defaultMessage;
}, },
names() { names() {
@ -101,7 +118,7 @@ export default {
}, },
protip() { protip() {
return this.t('promptRemove.protip', { alternateLabel }); return this.t('dialog.promptRemove.protip', { alternateLabel });
}, },
}, },
@ -137,19 +154,22 @@ export default {
> >
<template #title> <template #title>
<h4 class="text-default-text"> <h4 class="text-default-text">
{{ t('promptRemove.title') }} {{ t(title, { type }, true) }}
</h4> </h4>
</template> </template>
<template #body> <template #body>
<div class="pl-10 pr-10"> <div class="pl-10 pr-10">
<span <span
v-clean-html="t(warningMessageKey, { type, names: resourceNames }, true)" v-clean-html="warningMessage"
></span> ></span>
<div class="mt-10 mb-10"> <div class="mt-10 mb-10">
<span <span
v-clean-html="t('promptRemove.confirmName', { nameToMatch: escapeHtml(nameToMatch) }, true)" v-clean-html="t('dialog.promptRemove.confirmName', {
type: formattedType,
nameToMatch: escapeHtml(nameToMatch)
}, true)"
></span> ></span>
</div> </div>
<div class="mb-10"> <div class="mb-10">

View File

@ -52,6 +52,11 @@ dialog:
message: "Are you sure you want to continue stop the {type} {names}?" message: "Are you sure you want to continue stop the {type} {names}?"
pause: pause:
message: "Are you sure you want to continue pause the {type} {names}?" message: "Are you sure you want to continue pause the {type} {names}?"
promptRemove:
title: "Delete {type}"
warningMessage: "Deleting the selected {type} permanently removes all resources on {thisOrThese} {type}. This action is irreversible. Do you want to continue?"
confirmName: "Type <b>{nameToMatch}</b> to delete the {type}:"
protip: "Tip: Hold the {alternateLabel} key while clicking Delete to bypass the confirmation step."
harvester: harvester:
branding: branding:
@ -782,7 +787,7 @@ harvester:
instanceLabels: instanceLabels:
banner: These labels are automatically synchronized to the virtual machine instance. banner: These labels are automatically synchronized to the virtual machine instance.
labels: labels:
banner: These key values are added as labels to the virtual machine. banner: These key values are added as labels to the virtual machine.
volume: volume:
label: Volumes label: Volumes

View File

@ -67,8 +67,7 @@ export default class HciNamespace extends namespace {
promptRemove(resources = this) { promptRemove(resources = this) {
this.$dispatch('promptModal', { this.$dispatch('promptModal', {
resources, resources,
warningMessageKey: 'promptRemove.confirmRelatedResource', component: 'ConfirmRelatedToRemoveDialog'
component: 'ConfirmRelatedToRemoveDialog'
}); });
} }

View File

@ -115,8 +115,7 @@ export default class HciNode extends HarvesterResource {
promptRemove(resources = this) { promptRemove(resources = this) {
this.$dispatch('promptModal', { this.$dispatch('promptModal', {
resources, resources,
warningMessageKey: 'promptRemove.confirmRelatedResource', component: 'ConfirmRelatedToRemoveDialog'
component: 'ConfirmRelatedToRemoveDialog'
}); });
} }