feat: add confirmation modal for vm soft reboot and restart (#327)

* feat: add confirmation for vm softreboot and restart

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

* refactor: update wordings

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

* feat: handle bulk action

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

---------

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
Yiya Chen 2025-06-06 12:27:15 +08:00 committed by GitHub
parent 29b1ab2fb9
commit feddcd247a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 13 deletions

View File

@ -49,9 +49,13 @@ dialog:
} }
protip: "Tip: Hold the {alternateLabel} key while clicking action to bypass this confirmation" protip: "Tip: Hold the {alternateLabel} key while clicking action to bypass this confirmation"
stop: stop:
message: "Are you sure you want to continue stop the {type} {names}?" message: "Are you sure you want to 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 pause the {type} {names}?"
restart:
message: "Are you sure you want to restart the {type} {names}?"
softreboot:
message: "Are you sure you want to soft reboot the {type} {names}?"
promptRemove: promptRemove:
title: "Delete {type}" title: "Delete {type}"
warningMessage: "Deleting the selected {type} permanently removes all resources on {thisOrThese} {type}. This action is irreversible. Do you want to continue?" warningMessage: "Deleting the selected {type} permanently removes all resources on {thisOrThese} {type}. This action is irreversible. Do you want to continue?"
@ -66,7 +70,6 @@ harvester:
tip: 'Upload an icon to replace the Harvester favicon in the browser tab. Max file size is 20KB' tip: 'Upload an icon to replace the Harvester favicon in the browser tab. Max file size is 20KB'
productLabel: 'Harvester' productLabel: 'Harvester'
modal: modal:
backup: backup:
success: 'Backup { backUpName } has been initiated.' success: 'Backup { backUpName } has been initiated.'
addBackup: Add Backup addBackup: Add Backup

View File

@ -135,7 +135,8 @@ export default class VirtVm extends HarvesterResource {
enabled: !!this.actions?.restart, enabled: !!this.actions?.restart,
icon: 'icon icon-refresh', icon: 'icon icon-refresh',
label: this.t('harvester.action.restart'), label: this.t('harvester.action.restart'),
bulkable: true bulkable: true,
bulkAction: 'restartVM'
}, },
{ {
action: 'softrebootVM', action: 'softrebootVM',
@ -312,12 +313,22 @@ export default class VirtVm extends HarvesterResource {
this.metadata.annotations[HCI_ANNOTATIONS.VOLUME_CLAIM_TEMPLATE] = JSON.stringify(deleteDataSource); this.metadata.annotations[HCI_ANNOTATIONS.VOLUME_CLAIM_TEMPLATE] = JSON.stringify(deleteDataSource);
} }
restartVM() { restartVM(resources = this) {
this.doActionGrowl('restart', {}); this.$dispatch('promptModal', {
resources,
action: 'restart',
warningMessageKey: 'dialog.confirmExecution.restart.message',
component: 'ConfirmExecutionDialog'
});
} }
softrebootVM() { softrebootVM(resources = this) {
this.doActionGrowl('softreboot', {}); this.$dispatch('promptModal', {
resources,
action: 'softreboot',
warningMessageKey: 'dialog.confirmExecution.softreboot.message',
component: 'ConfirmExecutionDialog'
});
} }
openLogs() { openLogs() {