Skip to content

Commit

Permalink
Add cancelAction in VM create page
Browse files Browse the repository at this point in the history
  • Loading branch information
a110605 committed Sep 10, 2024
1 parent 1aaeaef commit e9613b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions pkg/harvester/edit/kubevirt.io.virtualmachine/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ export default {
},
methods: {
cancelAction() {
const { fromPage = HCI.VM } = this.$route?.query; // default back to VM list page
const cancelOverride = {
name: this.doneRoute,
params: { resource: fromPage }
};
this.$router.replace(cancelOverride);
},
saveVM(buttonCb) {
clear(this.errors);
Expand Down Expand Up @@ -434,12 +443,14 @@ export default {
id="vm"
:done-route="doneRoute"
:resource="value"
:cancelEvent="true"
:mode="mode"
:can-yaml="isSingle ? true : false"
:errors="errors"
:generate-yaml="generateYaml"
:apply-hooks="applyHooks"
@finish="saveVM"
@cancel="cancelAction"
>
<RadioGroup
v-if="isCreate"
Expand Down
4 changes: 2 additions & 2 deletions pkg/harvester/models/harvesterhci.io.virtualmachineimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class HciVmImage extends HarvesterResource {
{
action: 'createFromImage',
enabled: canCreateVM,
icon: 'icon icon-fw icon-spinner',
icon: 'icon icon-circle-plus',
label: this.t('harvester.action.createVM'),
disabled: !this.isReady,
},
Expand All @@ -75,7 +75,7 @@ export default class HciVmImage extends HarvesterResource {
router.push({
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
params: { resource: HCI.VM },
query: { image: this.id }
query: { image: this.id, fromPage: HCI.IMAGE }
});
}

Expand Down

0 comments on commit e9613b4

Please sign in to comment.