From d7f1fd4fe31a57764b28721f4a92175724b17547 Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Thu, 16 Apr 2020 18:16:37 -0400 Subject: [PATCH] Switching to use Vuex, need to use mutations to set. --- scripts/system/inventory/src/App.vue | 464 +++--------------- .../inventory/src/components/HelloWorld.vue | 151 ------ .../inventory/src/components/ItemIterator.vue | 40 +- .../inventory/src/components/NotUsing.vue | 262 ++++++++++ scripts/system/inventory/src/plugins/store.js | 63 +++ 5 files changed, 414 insertions(+), 566 deletions(-) delete mode 100644 scripts/system/inventory/src/components/HelloWorld.vue create mode 100644 scripts/system/inventory/src/components/NotUsing.vue diff --git a/scripts/system/inventory/src/App.vue b/scripts/system/inventory/src/App.vue index dee109f9e0..de25eac74f 100644 --- a/scripts/system/inventory/src/App.vue +++ b/scripts/system/inventory/src/App.vue @@ -53,7 +53,7 @@ tick-size="3" > - + mdi-plus @@ -75,275 +75,12 @@ - - @@ -358,7 +95,7 @@ No @@ -368,7 +105,7 @@ Yes @@ -379,7 +116,7 @@ @@ -394,7 +131,7 @@ No @@ -404,7 +141,7 @@ Yes @@ -415,7 +152,7 @@ @@ -423,14 +160,14 @@ @@ -449,7 +186,7 @@ item-text="name" item-value="uuid" class="my-2" - v-model="editDialog.data.folder" + v-model="$store.state.editDialog.data.folder" label="Folder" outlined > @@ -457,7 +194,7 @@ @@ -467,7 +204,7 @@ Cancel @@ -477,8 +214,8 @@ Done @@ -491,7 +228,7 @@ @@ -499,14 +236,14 @@ @@ -516,7 +253,7 @@ Cancel @@ -526,8 +263,8 @@ Done @@ -540,7 +277,7 @@ @@ -552,14 +289,14 @@ @@ -569,7 +306,7 @@ Cancel @@ -579,8 +316,8 @@ Create @@ -592,7 +329,7 @@ @@ -601,7 +338,7 @@ @@ -612,7 +349,7 @@ @@ -624,7 +361,7 @@ @@ -648,7 +385,7 @@ Cancel @@ -658,8 +395,8 @@ Add @@ -671,7 +408,7 @@ @@ -679,12 +416,12 @@ Receiving Item - {{receiveDialog.data.user}} is sending you an item. + {{$store.state.receiveDialog.data.user}} is sending you an item. @@ -692,7 +429,7 @@ class="px-2" label="Type" :rules="[v => !!v || 'Type is required.']" - v-model="receiveDialog.data.type" + v-model="$store.state.receiveDialog.data.type" required > @@ -700,7 +437,7 @@ class="px-2" label="Name" :rules="[v => !!v || 'Name is required.']" - v-model="receiveDialog.data.name" + v-model="$store.state.receiveDialog.data.name" required > @@ -711,7 +448,7 @@ @@ -731,7 +468,7 @@ Reject @@ -741,8 +478,8 @@ Accept @@ -754,7 +491,7 @@ @@ -767,13 +504,13 @@ @@ -808,7 +545,7 @@ Cancel @@ -818,8 +555,8 @@ Send @@ -1014,69 +751,6 @@ export default { "uuid": "542543sg45s4gg54353", }, ], - removeDialog: { - show: false, - uuid: null, - }, - removeFolderDialog: { - show: false, - uuid: null, - }, - createFolderDialog: { - show: false, - valid: false, - data: { - "name": null, - }, - }, - addDialog: { - show: false, - valid: false, - data: { - "name": null, - "folder": null, - "url": null, - }, - }, - editDialog: { - show: false, - valid: false, - uuid: null, // - data: { - "type": null, - "name": null, - "url": null, - "folder": null, - }, - }, - editFolderDialog: { - show: false, - valid: false, - uuid: null, // - data: { - "name": null, - }, - }, - receiveDialog: { - show: false, - valid: false, - data: { - "user": null, - "name": null, - "folder": null, - "type": null, - "url": null, - }, - }, - shareDialog: { - show: false, - valid: false, - data: { - "uuid": null, // UUID of the item you want to share. THIS IS THE KEY. - "url": null, // The item you want to share. - "recipient": null, - } - }, folderList: [], nearbyUsers: [ { @@ -1238,9 +912,9 @@ export default { this.pushToItems(itemType, name, folder, url, null); - this.addDialog.data.name = null; - this.addDialog.data.folder = null; - this.addDialog.data.url = null; + this.$store.state.addDialog.data.name = null; + this.$store.state.addDialog.data.folder = null; + this.$store.state.addDialog.data.url = null; }, detectFileType: function(url) { // Attempt the pure regex route... @@ -1300,15 +974,15 @@ export default { }, receivingItem: function(data) { - if (this.receiveDialog.show != true) { // Do not accept offers if the user is already receiving an offer. - this.receiveDialog.data.user = data.data.user; - this.receiveDialog.data.type = data.data.type; - this.receiveDialog.data.name = data.data.name; - this.receiveDialog.data.url = data.data.url; + if (this.$store.state.receiveDialog.show != true) { // Do not accept offers if the user is already receiving an offer. + this.$store.state.receiveDialog.data.user = data.data.user; + this.$store.state.receiveDialog.data.type = data.data.type; + this.$store.state.receiveDialog.data.name = data.data.name; + this.$store.state.receiveDialog.data.url = data.data.url; this.getFolderList("add"); - this.receiveDialog.show = true; + this.$store.state.receiveDialog.show = true; } }, shareItem: function(uuid) { @@ -1320,16 +994,16 @@ export default { this.sendAppMessage("share-item", { "type": typeToShare, "name": nameToShare, - "url": this.shareDialog.data.url, - "recipient": this.shareDialog.data.recipient, + "url": this.$store.state.shareDialog.data.url, + "recipient": this.$store.state.shareDialog.data.recipient, }); }, acceptItem: function() { this.pushToItems( - this.checkItemType(this.receiveDialog.data.type), - this.receiveDialog.data.name, - this.receiveDialog.data.folder, - this.receiveDialog.data.url, + this.checkItemType(this.$store.state.receiveDialog.data.type), + this.$store.state.receiveDialog.data.name, + this.$store.state.receiveDialog.data.folder, + this.$store.state.receiveDialog.data.url, null ); }, diff --git a/scripts/system/inventory/src/components/HelloWorld.vue b/scripts/system/inventory/src/components/HelloWorld.vue deleted file mode 100644 index 099f437727..0000000000 --- a/scripts/system/inventory/src/components/HelloWorld.vue +++ /dev/null @@ -1,151 +0,0 @@ - - - diff --git a/scripts/system/inventory/src/components/ItemIterator.vue b/scripts/system/inventory/src/components/ItemIterator.vue index 4608f08825..005305ae01 100644 --- a/scripts/system/inventory/src/components/ItemIterator.vue +++ b/scripts/system/inventory/src/components/ItemIterator.vue @@ -76,12 +76,12 @@ @@ -91,7 +91,7 @@ Share @@ -99,7 +99,7 @@ Remove @@ -133,15 +133,15 @@
mdi-pencil mdi-minus @@ -219,12 +219,12 @@ @@ -235,7 +235,7 @@ Share @@ -244,7 +244,7 @@ Remove diff --git a/scripts/system/inventory/src/components/NotUsing.vue b/scripts/system/inventory/src/components/NotUsing.vue new file mode 100644 index 0000000000..4d3ff5f2eb --- /dev/null +++ b/scripts/system/inventory/src/components/NotUsing.vue @@ -0,0 +1,262 @@ + \ No newline at end of file diff --git a/scripts/system/inventory/src/plugins/store.js b/scripts/system/inventory/src/plugins/store.js index a87d752588..51b5f079a6 100644 --- a/scripts/system/inventory/src/plugins/store.js +++ b/scripts/system/inventory/src/plugins/store.js @@ -60,6 +60,69 @@ export const store = new Vuex.Store({ "JSON", "UNKNOWN", ], + removeDialog: { + show: false, + uuid: null, + }, + removeFolderDialog: { + show: false, + uuid: null, + }, + createFolderDialog: { + show: false, + valid: false, + data: { + "name": null, + }, + }, + addDialog: { + show: false, + valid: false, + data: { + "name": null, + "folder": null, + "url": null, + }, + }, + editDialog: { + show: false, + valid: false, + uuid: null, // + data: { + "type": null, + "name": null, + "url": null, + "folder": null, + }, + }, + editFolderDialog: { + show: false, + valid: false, + uuid: null, // + data: { + "name": null, + }, + }, + receiveDialog: { + show: false, + valid: false, + data: { + "user": null, + "name": null, + "folder": null, + "type": null, + "url": null, + }, + }, + shareDialog: { + show: false, + valid: false, + data: { + "uuid": null, // UUID of the item you want to share. THIS IS THE KEY. + "url": null, // The item you want to share. + "recipient": null, + } + }, }, mutations: { mutate(state, payload) {