From 4e80d65152d3c45ff8f9bfa214fe05ffc6224ecb Mon Sep 17 00:00:00 2001 From: Francesco Torchia Date: Mon, 29 Jan 2024 16:33:12 +0100 Subject: [PATCH] Clean-up code Signed-off-by: Francesco Torchia --- .../VirtualMachineBootOrder/index.vue | 41 ++++++++----------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineBootOrder/index.vue b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineBootOrder/index.vue index 60b98e70d34..5c654e867a2 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; @@ -126,32 +133,23 @@ export default { 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,7 +158,7 @@ export default { this.update(); }, - swapToOrderedAll() { + swapToUnorderedAll() { this.unordered.push(...this.ordered); this.ordered = []; this.bootOrders = []; @@ -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; @@ -289,19 +284,19 @@ export default {
- - - -