mirror of https://github.com/rancher/dashboard.git
add asyncButton to promptRemove
This commit is contained in:
parent
30865b1a41
commit
4af85594b2
|
|
@ -6,9 +6,12 @@ import Card from '@/components/Card';
|
||||||
import { alternateLabel } from '@/utils/platform';
|
import { alternateLabel } from '@/utils/platform';
|
||||||
import LinkDetail from '@/components/formatter/LinkDetail';
|
import LinkDetail from '@/components/formatter/LinkDetail';
|
||||||
import { uniq } from '@/utils/array';
|
import { uniq } from '@/utils/array';
|
||||||
|
import AsyncButton from '@/components/AsyncButton';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Card, LinkDetail },
|
components: {
|
||||||
|
Card, LinkDetail, AsyncButton
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
confirmName: '', error: '', warning: '', preventDelete: false
|
confirmName: '', error: '', warning: '', preventDelete: false
|
||||||
|
|
@ -151,7 +154,7 @@ export default {
|
||||||
this.$store.commit('action-menu/togglePromptRemove');
|
this.$store.commit('action-menu/togglePromptRemove');
|
||||||
},
|
},
|
||||||
|
|
||||||
remove() {
|
remove(btnCB) {
|
||||||
if (this.needsConfirm && this.confirmName !== this.names[0]) {
|
if (this.needsConfirm && this.confirmName !== this.names[0]) {
|
||||||
this.error = 'Resource names do not match';
|
this.error = 'Resource names do not match';
|
||||||
// if doneLocation is defined, redirect after deleting
|
// if doneLocation is defined, redirect after deleting
|
||||||
|
|
@ -166,14 +169,14 @@ export default {
|
||||||
const serialRemove = this.toRemove.some(resource => resource.removeSerially);
|
const serialRemove = this.toRemove.some(resource => resource.removeSerially);
|
||||||
|
|
||||||
if (serialRemove) {
|
if (serialRemove) {
|
||||||
this.serialRemove(goTo);
|
this.serialRemove(goTo, btnCB);
|
||||||
} else {
|
} else {
|
||||||
this.parallelRemove(goTo);
|
this.parallelRemove(goTo, btnCB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async serialRemove(goTo) {
|
async serialRemove(goTo, btnCB) {
|
||||||
try {
|
try {
|
||||||
const spoofedTypes = this.getSpoofedTypes(this.toRemove);
|
const spoofedTypes = this.getSpoofedTypes(this.toRemove);
|
||||||
|
|
||||||
|
|
@ -186,14 +189,15 @@ export default {
|
||||||
if ( goTo && !isEmpty(goTo) ) {
|
if ( goTo && !isEmpty(goTo) ) {
|
||||||
this.currentRouter.push(goTo);
|
this.currentRouter.push(goTo);
|
||||||
}
|
}
|
||||||
|
btnCB(true);
|
||||||
this.close();
|
this.close();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.error = err;
|
this.error = err;
|
||||||
|
btnCB(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async parallelRemove(goTo) {
|
async parallelRemove(goTo, btnCB) {
|
||||||
try {
|
try {
|
||||||
const spoofedTypes = this.getSpoofedTypes(this.toRemove);
|
const spoofedTypes = this.getSpoofedTypes(this.toRemove);
|
||||||
|
|
||||||
|
|
@ -203,10 +207,11 @@ export default {
|
||||||
if ( goTo && !isEmpty(goTo) ) {
|
if ( goTo && !isEmpty(goTo) ) {
|
||||||
this.currentRouter.push(goTo);
|
this.currentRouter.push(goTo);
|
||||||
}
|
}
|
||||||
|
btnCB(true);
|
||||||
this.close();
|
this.close();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.error = err;
|
this.error = err;
|
||||||
|
btnCB(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -263,9 +268,7 @@ export default {
|
||||||
<button class="btn role-secondary" @click="close">
|
<button class="btn role-secondary" @click="close">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button class="btn bg-error ml-10" :disabled="preventDelete" @click="remove">
|
<AsyncButton mode="delete" class="btn bg-error ml-10" :disabled="preventDelete" @click="remove" />
|
||||||
Delete
|
|
||||||
</button>
|
|
||||||
</template>
|
</template>
|
||||||
</Card>
|
</Card>
|
||||||
</modal>
|
</modal>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue