Commit bebd5ec9 authored by janis.streib's avatar janis.streib 🦉
Browse files

FIX: made transaction list order change mutations

parent b0429f83
Pipeline #111465 passed with stages
in 8 minutes and 34 seconds
......@@ -3,3 +3,4 @@ indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
ij_coffeescript_space_before_function_left_parenth = true
......@@ -20,7 +20,7 @@
class="font-italic text-center mt-3">
Keine Aktionen geplant
</div>
<Draggable v-else v-model="$store.state.ta_list" @start="drag=true" @end="drag=false" handle=".handle">
<Draggable v-else @change="drag_change" :list="$store.state.ta_list" @start="drag=true" @end="drag=false" handle=".handle">
<b-card v-for="(element, index) in $store.state.ta_list" :key="element.id"
:border-variant="function2variant(element.object_function)" class="mb-3 shadow" no-body>
<div class="element-number handle"
......@@ -30,10 +30,10 @@
<div class="move-icons">
<font-awesome-icon class="move-icon"
:icon="['fas','caret-up']"
@click="$store.state.ta_list.move(index, index - 1)"/>
@click="move(index, index - 1)"/>
<font-awesome-icon class="move-icon"
:icon="['fas','caret-down']"
@click="$store.state.ta_list.move(index, index + 1)"/>
@click="move(index, index + 1)"/>
</div>
</div>
<b-card-body class="element-content">
......@@ -174,7 +174,10 @@ export default {
}
},
move (from, to) {
this.$store.state.ta_list.move(from, to)
this.$store.commit('moveTaElements', { from: from, to: to })
},
drag_change (val) {
this.move(val.moved.oldIndex, val.moved.newIndex)
},
async executeTa () {
await this.$store.dispatch('executeTransaction')
......
......@@ -94,6 +94,9 @@ const store = new Vuex.Store({
state.undone = []
window.localStorage.setItem('undone', JSON.stringify(state.undone))
},
moveTaElements (state, payload) {
state.ta_list.move(payload.from, payload.to)
},
login (state, payload) {
const user = payload.user
const token = payload.token
......@@ -240,13 +243,13 @@ const store = new Vuex.Store({
sharedMutations(
{
predicate:
['pushUndoRedoUndone', 'popUndoRedoUndone', 'clearUndoRedoUndone', 'setUndoRedoNewMutation', 'clearUndoRedoDone', 'popUndoRedoDone', 'emptyState', 'login', 'logout', 'addTransactionElement', 'removeTransactionElement', 'emptyTransactionList', 'removeTransactionResult', 'setTransactionBusy']
['pushUndoRedoUndone', 'popUndoRedoUndone', 'clearUndoRedoUndone', 'setUndoRedoNewMutation', 'clearUndoRedoDone', 'popUndoRedoDone', 'emptyState', 'login', 'logout', 'addTransactionElement', 'removeTransactionElement', 'emptyTransactionList', 'removeTransactionResult', 'setTransactionBusy', 'moveTaElements']
}
)
]
})
// Undo-Redo-watched mutations
const watchedMutations = ['addTransactionElement', 'removeTransactionElement', 'emptyTransactionList']
const watchedMutations = ['addTransactionElement', 'removeTransactionElement', 'emptyTransactionList', 'moveTaElements']
Vue.config.errorHandler = function (err, vm, info) {
// handle error
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment