mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
fix delete VM modal not dismiss
This commit is contained in:
parent
e150c7f550
commit
9eec2ed557
@ -26,6 +26,14 @@ export default {
|
|||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
close: {
|
||||||
|
type: Function,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
doneLocation: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -84,13 +92,11 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
resourceNames,
|
resourceNames,
|
||||||
remove() {
|
remove() {
|
||||||
const parentComponent = this.$parent.$parent.$parent;
|
|
||||||
|
|
||||||
let goTo;
|
let goTo;
|
||||||
|
|
||||||
if (parentComponent.doneLocation) {
|
if (this.doneLocation) {
|
||||||
// doneLocation will recompute to undefined when delete request completes
|
// doneLocation will recompute to undefined when delete request completes
|
||||||
goTo = { ...parentComponent.doneLocation };
|
goTo = { ...this.doneLocation };
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(this.value.map((resource) => {
|
Promise.all(this.value.map((resource) => {
|
||||||
@ -118,13 +124,13 @@ export default {
|
|||||||
const parsed = Parse(resource.links.self);
|
const parsed = Parse(resource.links.self);
|
||||||
|
|
||||||
resource.remove({ url: `${ parsed.pathname }?${ removedDisks }propagationPolicy=Foreground` });
|
resource.remove({ url: `${ parsed.pathname }?${ removedDisks }propagationPolicy=Foreground` });
|
||||||
})).then((results) => {
|
})).then((_results) => {
|
||||||
if ( goTo && !isEmpty(goTo) ) {
|
if ( goTo && !isEmpty(goTo) ) {
|
||||||
parentComponent.currentRouter.push(goTo);
|
this.value?.[0]?.currentRouter().push(goTo)
|
||||||
}
|
}
|
||||||
parentComponent.close();
|
this.close();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
parentComponent.error = err;
|
this.$emit('errors', err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user