Skip to content

Commit 470e959

Browse files
authored
Change disk-only VM snapshot removal message (#11182)
* fix message * check for hypervisor * fix function being executed once
1 parent 4359198 commit 470e959

4 files changed

Lines changed: 17 additions & 8 deletions

File tree

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,6 +3037,7 @@
30373037
"message.action.unmanage.volume": "Please confirm that you want to unmanage the Volume.",
30383038
"message.action.unmanage.volumes": "Please confirm that you want to unmanage the Volumes.",
30393039
"message.action.vmsnapshot.delete": "Please confirm that you want to delete this Instance Snapshot. <br>Please notice that the Instance will be paused before the Snapshot deletion, and resumed after deletion, if it runs on KVM.",
3040+
"message.action.vmsnapshot.disk-only.delete": "Please confirm that you want to delete this Instance Snapshot.",
30403041
"message.activate.project": "Are you sure you want to activate this project?",
30413042
"message.add.custom.action.parameters": "Parameters to be made available while running the custom action.",
30423043
"message.add.egress.rule.failed": "Adding new egress rule failed.",

ui/public/locales/pt_BR.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,8 @@
19141914
"message.action.unmanage.instance": "Por favor, confirme que voc\u00ea deseja parar de gerenciar a inst\u00e2ncia.",
19151915
"message.action.unmanage.instances": "Por favor, confirme que voc\u00ea deseja parar de gerenciar as inst\u00e2ncias.",
19161916
"message.action.unmanage.virtualmachine": "Por favor, confirme que voc\u00ea deseja parar de gerenciar a VM.",
1917-
"message.action.vmsnapshot.delete": "Por favor, confirme que voc\u00ea deseja excluir esta snapshot de VM.",
1917+
"message.action.vmsnapshot.delete": "Por favor, confirme que voc\u00ea deseja excluir esta snapshot de VM. <br>Saiba que caso a instância execute em um hypervisor KVM, ela será pausada antes da deleç\u00e3o, e continuada após a deleç\u00e3o.",
1918+
"message.action.vmsnapshot.disk-only.delete": "Por favor, confirme que voc\u00ea deseja excluir esta snapshot de VM.",
19181919
"message.activate.project": "Voc\u00ea tem certeza que deseja ativar este projeto?",
19191920
"message.add.egress.rule.failed": "Falha ao adicionar uma nova regra de sa\u00edda",
19201921
"message.add.egress.rule.processing": "Adicionando uma nova regra de sa\u00edda...",

ui/src/config/section/compute.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,12 @@ export default {
533533
api: 'deleteVMSnapshot',
534534
icon: 'delete-outlined',
535535
label: 'label.action.vmsnapshot.delete',
536-
message: 'message.action.vmsnapshot.delete',
536+
message: (record) => {
537+
if (record.hypervisor !== 'KVM' || record.type === 'Disk') {
538+
return 'message.action.vmsnapshot.disk-only.delete'
539+
}
540+
return 'message.action.vmsnapshot.delete'
541+
},
537542
dataView: true,
538543
show: (record) => { return ['Ready', 'Expunging', 'Error'].includes(record.state) },
539544
args: ['vmsnapshotid'],

ui/src/views/AutogenView.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
:spinning="actionLoading"
217217
v-ctrl-enter="handleSubmit"
218218
>
219-
<span v-if="currentAction.message">
219+
<span v-if="currentAction.messageString">
220220
<div v-if="selectedRowKeys.length > 0">
221221
<a-alert
222222
v-if="['delete-outlined', 'DeleteOutlined', 'poweroff-outlined', 'PoweroffOutlined'].includes(currentAction.icon)"
@@ -228,7 +228,7 @@
228228
style="padding-left: 5px"
229229
v-html="`<b>${selectedRowKeys.length} ` + $t('label.items.selected') + `. </b>`"
230230
/>
231-
<span v-html="currentAction.message" />
231+
<span v-html="currentAction.messageString" />
232232
</template>
233233
</a-alert>
234234
<a-alert
@@ -240,14 +240,14 @@
240240
v-if="selectedRowKeys.length > 0"
241241
v-html="`<b>${selectedRowKeys.length} ` + $t('label.items.selected') + `. </b>`"
242242
/>
243-
<span v-html="currentAction.message" />
243+
<span v-html="currentAction.messageString" />
244244
</template>
245245
</a-alert>
246246
</div>
247247
<div v-else>
248248
<a-alert type="warning">
249249
<template #message>
250-
<span v-html="currentAction.message" />
250+
<span v-html="currentAction.messageString" />
251251
</template>
252252
</a-alert>
253253
</div>
@@ -1369,9 +1369,11 @@ export default {
13691369
this.currentAction.paramFilters = []
13701370
if ('message' in action) {
13711371
if (typeof action.message === 'function') {
1372-
action.message = action.message(action.resource)
1372+
action.messageString = action.message(action.resource)
1373+
} else {
1374+
action.messageString = action.message
13731375
}
1374-
action.message = Array.isArray(action.message) ? this.$t(...action.message) : this.$t(action.message)
1376+
action.messageString = Array.isArray(action.messageString) ? this.$t(...action.messageString) : this.$t(action.messageString)
13751377
}
13761378
this.getArgs(action, isGroupAction, paramFields)
13771379
this.getFilters(action, isGroupAction, paramFields)

0 commit comments

Comments
 (0)