mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 02:57:00 +02:00
Begin fixing functionality for deep iteration.
This commit is contained in:
parent
c9961226b6
commit
14823d84d6
3 changed files with 93 additions and 58 deletions
|
@ -139,7 +139,7 @@
|
||||||
<v-btn
|
<v-btn
|
||||||
color="blue"
|
color="blue"
|
||||||
class="px-3"
|
class="px-3"
|
||||||
@click="removeFolderDialog.show = false"
|
@click="removeFolderDialogStore.show = false"
|
||||||
>
|
>
|
||||||
No
|
No
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
<v-btn
|
<v-btn
|
||||||
color="red"
|
color="red"
|
||||||
class="px-3"
|
class="px-3"
|
||||||
@click="removeFolderDialog.show = false; removeFolder($store.state.removeFolderDialog.uuid);"
|
@click="removeFolderDialogStore.show = false; removeFolder($store.state.removeFolderDialog.uuid);"
|
||||||
>
|
>
|
||||||
Yes
|
Yes
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
@ -553,7 +553,7 @@
|
||||||
<v-btn
|
<v-btn
|
||||||
color="red"
|
color="red"
|
||||||
class="px-3"
|
class="px-3"
|
||||||
@click="shareDialogStore.shareDialog.show = false"
|
@click="shareDialogStore.show = false"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
@ -564,7 +564,7 @@
|
||||||
color="blue"
|
color="blue"
|
||||||
class="px-3"
|
class="px-3"
|
||||||
:disabled="!$store.state.shareDialog.valid"
|
:disabled="!$store.state.shareDialog.valid"
|
||||||
@click="shareDialogStore.shareDialog.show = false; shareItem($store.state.shareDialog.data.uuid);"
|
@click="shareDialogStore.show = false; shareItem($store.state.shareDialog.data.uuid);"
|
||||||
>
|
>
|
||||||
Send
|
Send
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
@ -760,6 +760,7 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
folderList: [],
|
folderList: [],
|
||||||
|
recursiveFolderHoldingList: [],
|
||||||
nearbyUsers: [
|
nearbyUsers: [
|
||||||
{
|
{
|
||||||
name: "Who",
|
name: "Who",
|
||||||
|
@ -1080,25 +1081,6 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sortFolder: function(uuid) {
|
|
||||||
for (var i = 0; i < this.items.length; i++) {
|
|
||||||
if (this.items[i].uuid == uuid) {
|
|
||||||
this.items[i].items.sort(function(a, b) {
|
|
||||||
var nameA = a.name.toUpperCase(); // ignore upper and lowercase
|
|
||||||
var nameB = b.name.toUpperCase(); // ignore upper and lowercase
|
|
||||||
if (nameA < nameB) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (nameA > nameB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// names must be equal
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getFolderList: function(request) {
|
getFolderList: function(request) {
|
||||||
if (request == "edit") {
|
if (request == "edit") {
|
||||||
this.folderList = [
|
this.folderList = [
|
||||||
|
@ -1119,16 +1101,11 @@ export default {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < this.items.length; i++) {
|
var generateList = this.recursiveFolderPopulate();
|
||||||
if (Object.prototype.hasOwnProperty.call(this.items[i], "hasChildren")) {
|
|
||||||
if (this.items[i].hasChildren === true) {
|
if (generateList) {
|
||||||
this.folderList.push({
|
this.folderList.push(generateList);
|
||||||
"name": this.items[i].name,
|
|
||||||
"uuid": this.items[i].uuid,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
moveItemToFolder: function(uuid, folderUUID) {
|
moveItemToFolder: function(uuid, folderUUID) {
|
||||||
|
@ -1179,32 +1156,67 @@ export default {
|
||||||
uuid
|
uuid
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
searchForItem: function(uuid) {
|
sortFolder: function(uuid) {
|
||||||
var itemToReturn = {
|
|
||||||
"returnedItem": null,
|
|
||||||
"iteration": null,
|
|
||||||
"parentArray": null,
|
|
||||||
"itemUUID": uuid,
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < this.items.length; i++) {
|
for (var i = 0; i < this.items.length; i++) {
|
||||||
if (this.items[i].uuid == uuid) {
|
if (this.items[i].uuid == uuid) {
|
||||||
itemToReturn.returnedItem = this.items[i];
|
this.items[i].items.sort(function(a, b) {
|
||||||
itemToReturn.iteration = i;
|
var nameA = a.name.toUpperCase(); // ignore upper and lowercase
|
||||||
itemToReturn.parentArray = this.items;
|
var nameB = b.name.toUpperCase(); // ignore upper and lowercase
|
||||||
return itemToReturn;
|
if (nameA < nameB) {
|
||||||
} else if (Object.prototype.hasOwnProperty.call(this.items[i], "items")) {
|
return -1;
|
||||||
for (var di = 0; di < this.items[i].items.length; di++) { // DI means deep iteration
|
|
||||||
if (this.items[i].items[di].uuid == uuid) {
|
|
||||||
itemToReturn.returnedItem = this.items[i].items[di];
|
|
||||||
itemToReturn.iteration = di;
|
|
||||||
itemToReturn.parentArray = this.items[i].items;
|
|
||||||
return itemToReturn;
|
|
||||||
}
|
}
|
||||||
}
|
if (nameA > nameB) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// names must be equal
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchForItem: function(uuid) {
|
||||||
|
var foundItem = this.recursiveSingularSearch(uuid, this.items);
|
||||||
|
|
||||||
|
if (foundItem) {
|
||||||
|
return {
|
||||||
|
"returnedItem": foundItem.returnedItem,
|
||||||
|
"iteration": foundItem.iteration,
|
||||||
|
"parentArray": foundItem.parentArray,
|
||||||
|
"itemUUID": uuid,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
recursiveSingularSearch: function(uuid, indexToSearch) {
|
||||||
|
for (var i = 0; i < indexToSearch.length; i++) {
|
||||||
|
if (indexToSearch[i].uuid == uuid) {
|
||||||
|
var foundItem = {
|
||||||
|
"returnedItem": indexToSearch[i],
|
||||||
|
"iteration": i,
|
||||||
|
"parentArray": indexToSearch,
|
||||||
|
}
|
||||||
|
return foundItem;
|
||||||
|
} else if (Object.prototype.hasOwnProperty.call(indexToSearch[i], "items") && indexToSearch[i].length > 0) {
|
||||||
|
this.recursiveSingularSearch(uuid, indexToSearch[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
recursiveFolderPopulate: function(indexToSearch, firstIteration) {
|
||||||
|
for (var i = 0; i < indexToSearch.length; i++) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(this.items[i], "hasChildren")) {
|
||||||
|
this.recursiveFolderHoldingList.push({
|
||||||
|
"name": indexToSearch[i].name,
|
||||||
|
"uuid": indexToSearch[i].uuid,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.recursiveFolderPopulate(indexToSearch[i], false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstIteration === true) {
|
||||||
|
return this.recursiveFolderHoldingList;
|
||||||
|
}
|
||||||
|
},
|
||||||
sendInventory: function() {
|
sendInventory: function() {
|
||||||
this.sendAppMessage("web-to-script-inventory", this.items );
|
this.sendAppMessage("web-to-script-inventory", this.items );
|
||||||
},
|
},
|
||||||
|
@ -1268,10 +1280,11 @@ export default {
|
||||||
property: 'editDialog',
|
property: 'editDialog',
|
||||||
with: value
|
with: value
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getFolderList('edit');
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
editDialogShow: function() {
|
||||||
|
return this.$store.state.editDialog.show;
|
||||||
|
},
|
||||||
editFolderDialogStore: {
|
editFolderDialogStore: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.editFolderDialog;
|
return this.$store.state.editFolderDialog;
|
||||||
|
@ -1339,7 +1352,10 @@ export default {
|
||||||
with: value
|
with: value
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
triggerSortFolder: function () {
|
||||||
|
return this.$store.state.triggerSortFolder;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// Whenever the item list changes, this will notice and then send it to the script to be saved.
|
// Whenever the item list changes, this will notice and then send it to the script to be saved.
|
||||||
|
@ -1359,6 +1375,18 @@ export default {
|
||||||
this.sendSettings();
|
this.sendSettings();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
editDialogShow: {
|
||||||
|
handler: function(newVal) {
|
||||||
|
if (newVal === true) {
|
||||||
|
this.getFolderList('edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
triggerSortFolder: {
|
||||||
|
handler: function(newVal) {
|
||||||
|
this.sortFolder(newVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@
|
||||||
<v-icon>mdi-minus</v-icon>
|
<v-icon>mdi-minus</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn medium tile color="blue" class="mx-1 folder-button"
|
<v-btn medium tile color="blue" class="mx-1 folder-button"
|
||||||
@click="sortFolder(item.uuid);"
|
@click="triggerSortFolder(item.uuid);"
|
||||||
>
|
>
|
||||||
<v-icon>mdi-ab-testing</v-icon>
|
<v-icon>mdi-ab-testing</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
@ -312,7 +312,13 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnedItemIconColor;
|
return returnedItemIconColor;
|
||||||
}
|
},
|
||||||
|
triggerSortFolder: function(uuid) {
|
||||||
|
this.$store.commit('mutate', {
|
||||||
|
property: 'triggerSortFolder',
|
||||||
|
with: uuid
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
|
@ -123,6 +123,7 @@ export const store = new Vuex.Store({
|
||||||
"recipient": null,
|
"recipient": null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
triggerSortFolder: null,
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
mutate (state, payload) {
|
mutate (state, payload) {
|
||||||
|
|
Loading…
Reference in a new issue