Skip to content

Commit

Permalink
Clean-up code
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
  • Loading branch information
torchiaf committed Jan 29, 2024
1 parent d4bf7b4 commit 4e80d65
Showing 1 changed file with 18 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]);
Expand All @@ -160,7 +158,7 @@ export default {
this.update();
},
swapToOrderedAll() {
swapToUnorderedAll() {
this.unordered.push(...this.ordered);
this.ordered = [];
this.bootOrders = [];
Expand All @@ -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;
Expand Down Expand Up @@ -289,19 +284,19 @@ export default {

<div v-if="!isView" class="swap-buttons actions ml-15">
<div class="buttons-container">
<button :disabled="unordered.length === 0" class="btn btn-sm role-primary ml-5" @click.prevent="swapToUnorderedAll">
<button :disabled="unordered.length === 0" class="btn btn-sm role-primary ml-5" @click.prevent="swapToOrderedAll">
<i class="icon icon-lg icon-chevron-beginning"></i>
</button>

<button :disabled="unordered.length === 0" class="btn btn-sm role-primary mt-5 ml-5" @click.prevent="swapToUnordered">
<button :disabled="unordered.length === 0" class="btn btn-sm role-primary mt-5 ml-5" @click.prevent="swapToOrdered">
<i class="icon icon-lg icon-chevron-up"></i>
</button>

<button :disabled="ordered.length === 0" class="btn btn-sm role-primary mt-20 ml-5" @click.prevent="swapToOrdered">
<button :disabled="ordered.length === 0" class="btn btn-sm role-primary mt-20 ml-5" @click.prevent="swapToUnordered">
<i class="icon icon-lg icon-chevron-down"></i>
</button>

<button :disabled="ordered.length === 0" class="btn btn-sm role-primary mt-5 ml-5" @click.prevent="swapToOrderedAll">
<button :disabled="ordered.length === 0" class="btn btn-sm role-primary mt-5 ml-5" @click.prevent="swapToUnorderedAll">
<i class="icon icon-lg icon-chevron-end"></i>
</button>
</div>
Expand Down

0 comments on commit 4e80d65

Please sign in to comment.