diff --git a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineBootOrder/index.vue b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineBootOrder/index.vue index 60b98e70d34..0c1c61217b8 100644 --- a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineBootOrder/index.vue +++ b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineBootOrder/index.vue @@ -84,6 +84,13 @@ export default { return bootOrder; }, + addBootOrder() { + this.bootOrders = [ + ...this.bootOrders, + this.getNextBootOrder() + ].sort(); + }, + onMoveOrdered(v) { if (v.from.id === 'ordered' && v.to.id === 'unordered') { this.hideLast = true; @@ -121,37 +128,28 @@ export default { ordered[index1] = ordered[index2]; ordered[index2] = temp; - Vue.set(this, 'ordered', ordered); + this.ordered = ordered; this.update(); }, - swapToUnordered() { - this.bootOrders = [ - ...this.bootOrders, - this.getNextBootOrder() - ].sort(); - + swapToOrdered() { + this.addBootOrder(); this.ordered.push(this.unordered[0]); this.unordered.splice(0, 1); this.update(); }, - swapToUnorderedAll() { - this.unordered.forEach(() => { - this.bootOrders = [ - ...this.bootOrders, - this.getNextBootOrder() - ].sort(); - }); + swapToOrderedAll() { + this.unordered.forEach(this.addBootOrder); this.ordered.push(...this.unordered); this.unordered = []; this.update(); }, - swapToOrdered() { + swapToUnordered() { this.bootOrders.pop(); this.unordered.push(this.ordered[this.ordered.length - 1]); @@ -160,10 +158,11 @@ export default { this.update(); }, - swapToOrderedAll() { + swapToUnorderedAll() { + this.bootOrders = []; + this.unordered.push(...this.ordered); this.ordered = []; - this.bootOrders = []; this.update(); }, @@ -171,9 +170,8 @@ export default { dragEndOrdered(v) { if (v.to.id === 'unordered') { this.bootOrders.pop(); - } else { - this.update(); } + this.hideLast = false; this.showNext = null; this.hideButtons = null; @@ -183,10 +181,7 @@ export default { dragEndUnordered(v) { if (v.to.id === 'ordered') { - this.bootOrders = [ - ...this.bootOrders, - this.getNextBootOrder() - ].sort(); + this.addBootOrder(); } this.hideLast = false; this.showNext = null; @@ -248,17 +243,6 @@ export default { -