From f5f49ec3ae14e1a1d12668dce3f1c1559722fffd Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Thu, 16 Apr 2020 23:05:33 -0400 Subject: [PATCH] Now properly using mutations. --- scripts/system/inventory/src/App.vue | 185 +++++++++++++----- .../inventory/src/components/ItemIterator.vue | 147 ++++++++++++-- 2 files changed, 263 insertions(+), 69 deletions(-) diff --git a/scripts/system/inventory/src/App.vue b/scripts/system/inventory/src/App.vue index de25eac74f..c8af9f29b7 100644 --- a/scripts/system/inventory/src/App.vue +++ b/scripts/system/inventory/src/App.vue @@ -53,14 +53,14 @@ tick-size="3" > - + mdi-plus Add Item - + mdi-folder-plus @@ -80,7 +80,7 @@ @@ -95,7 +95,7 @@ No @@ -105,7 +105,7 @@ Yes @@ -116,7 +116,7 @@ @@ -131,7 +131,7 @@ No @@ -141,7 +141,7 @@ Yes @@ -152,7 +152,7 @@ @@ -160,14 +160,14 @@ @@ -186,7 +186,7 @@ item-text="name" item-value="uuid" class="my-2" - v-model="$store.state.editDialog.data.folder" + v-model="editDialogStore.data.folder" label="Folder" outlined > @@ -194,7 +194,7 @@ @@ -204,7 +204,7 @@ Cancel @@ -215,7 +215,7 @@ color="blue" class="px-3" :disabled="!$store.state.editDialog.valid" - @click="$store.state.editDialog.show = false; editItem($store.state.editDialog.uuid);" + @click="editDialogStore.show = false; editItem($store.state.editDialog.uuid);" > Done @@ -228,7 +228,7 @@ @@ -236,14 +236,14 @@ @@ -253,7 +253,7 @@ Cancel @@ -264,7 +264,7 @@ color="blue" class="px-3" :disabled="!$store.state.editFolderDialog.valid" - @click="$store.state.editFolderDialog.show = false; editFolder($store.state.editFolderDialog.uuid);" + @click="editFolderDialogStore.show = false; editFolder($store.state.editFolderDialog.uuid);" > Done @@ -277,7 +277,7 @@ @@ -289,14 +289,14 @@ @@ -306,7 +306,7 @@ Cancel @@ -317,7 +317,7 @@ color="blue" class="px-3" :disabled="!$store.state.createFolderDialog.valid" - @click="$store.state.createFolderDialog.show = false; createFolder($store.state.createFolderDialog.data.name)" + @click="createFolderDialogStore.show = false; createFolder($store.state.createFolderDialog.data.name)" > Create @@ -329,7 +329,7 @@ @@ -338,7 +338,7 @@ @@ -349,7 +349,7 @@ @@ -361,7 +361,7 @@ @@ -385,7 +385,7 @@ Cancel @@ -396,7 +396,7 @@ color="blue" class="px-3" :disabled="!$store.state.addDialog.valid" - @click="$store.state.addDialog.show = false; addItem($store.state.addDialog.data.name, $store.state.addDialog.data.folder, $store.state.addDialog.data.url)" + @click="addDialogStore.show = false; addItem($store.state.addDialog.data.name, $store.state.addDialog.data.folder, $store.state.addDialog.data.url)" > Add @@ -408,7 +408,7 @@ @@ -421,7 +421,7 @@ @@ -429,7 +429,7 @@ class="px-2" label="Type" :rules="[v => !!v || 'Type is required.']" - v-model="$store.state.receiveDialog.data.type" + v-model="receiveDialogStore.data.type" required > @@ -437,7 +437,7 @@ class="px-2" label="Name" :rules="[v => !!v || 'Name is required.']" - v-model="$store.state.receiveDialog.data.name" + v-model="receiveDialogStore.data.name" required > @@ -448,7 +448,7 @@ @@ -468,7 +468,7 @@ Reject @@ -479,7 +479,7 @@ color="blue" class="px-3" :disabled="!$store.state.receiveDialog.valid" - @click="$store.state.receiveDialog.show = false; acceptItem();" + @click="receiveDialogStore.show = false; acceptItem();" > Accept @@ -491,7 +491,7 @@ @@ -504,13 +504,13 @@ @@ -545,7 +545,7 @@ Cancel @@ -556,7 +556,7 @@ color="blue" class="px-3" :disabled="!$store.state.shareDialog.valid" - @click="$store.state.shareDialog.show = false; shareItem($store.state.shareDialog.data.uuid);" + @click="shareDialogStore.shareDialog.show = false; shareItem($store.state.shareDialog.data.uuid);" > Send @@ -1234,7 +1234,94 @@ export default { }, }, computed: { - + addDialogStore: { + get() { + return this.$store.state.addDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'addDialog', + with: value + }); + }, + }, + editDialogStore: { + get() { + return this.$store.state.editDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'editDialog', + with: value + }); + }, + }, + editFolderDialogStore: { + get() { + return this.$store.state.editFolderDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'editFolderDialog', + with: value + }); + }, + }, + createFolderDialogStore: { + get() { + return this.$store.state.createFolderDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'createFolderDialog', + with: value + }); + }, + }, + receiveDialogStore: { + get() { + return this.$store.state.receiveDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'receiveDialog', + with: value + }); + }, + }, + shareDialogStore: { + get() { + return this.$store.state.shareDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'shareDialog', + with: value + }); + }, + }, + removeFolderDialogStore: { + get() { + return this.$store.state.removeFolderDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'removeFolderDialog', + with: value + }); + }, + }, + removeDialogStore: { + get() { + return this.$store.state.removeDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'removeDialog', + with: value + }); + }, + } }, watch: { // Whenever the item list changes, this will notice and then send it to the script to be saved. diff --git a/scripts/system/inventory/src/components/ItemIterator.vue b/scripts/system/inventory/src/components/ItemIterator.vue index 005305ae01..267d1cae55 100644 --- a/scripts/system/inventory/src/components/ItemIterator.vue +++ b/scripts/system/inventory/src/components/ItemIterator.vue @@ -76,12 +76,12 @@ @@ -91,7 +91,12 @@ Share @@ -99,7 +104,10 @@ Remove @@ -133,15 +141,18 @@
mdi-pencil mdi-minus @@ -219,12 +230,12 @@ @@ -235,7 +246,12 @@ Share @@ -244,7 +260,10 @@ Remove @@ -291,6 +310,94 @@ export default { }, settingsChanged() { return this.$store.state.settings; + }, + addDialogStore: { + get() { + return this.$store.state.addDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'addDialog', + with: value + }); + }, + }, + editDialogStore: { + get() { + return this.$store.state.editDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'editDialog', + with: value + }); + }, + }, + editFolderDialogStore: { + get() { + return this.$store.state.editFolderDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'editFolderDialog', + with: value + }); + }, + }, + createFolderDialogStore: { + get() { + return this.$store.state.createFolderDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'createFolderDialog', + with: value + }); + }, + }, + receiveDialogStore: { + get() { + return this.$store.state.receiveDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'receiveDialog', + with: value + }); + }, + }, + shareDialogStore: { + get() { + return this.$store.state.shareDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'shareDialog', + with: value + }); + }, + }, + removeFolderDialogStore: { + get() { + return this.$store.state.removeFolderDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'removeFolderDialog', + with: value + }); + }, + }, + removeDialogStore: { + get() { + return this.$store.state.removeDialog; + }, + set(value) { + this.$store.commit('mutate', { + property: 'removeDialog', + with: value + }); + }, } }, watch: {