mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:10:25 +02:00
Better search iteration and handling.
This commit is contained in:
parent
c6917cae3b
commit
2ef8586477
1 changed files with 133 additions and 77 deletions
|
@ -53,7 +53,7 @@ getIcon<!--
|
||||||
tick-size="3"
|
tick-size="3"
|
||||||
></v-slider>
|
></v-slider>
|
||||||
|
|
||||||
<v-list-item @click="addDialog.show = true">
|
<v-list-item @click="addDialog.show = true; getFolderList();">
|
||||||
<v-list-item-icon>
|
<v-list-item-icon>
|
||||||
<v-icon>mdi-plus</v-icon>
|
<v-icon>mdi-plus</v-icon>
|
||||||
</v-list-item-icon>
|
</v-list-item-icon>
|
||||||
|
@ -92,7 +92,7 @@ getIcon<!--
|
||||||
>
|
>
|
||||||
<v-list-item
|
<v-list-item
|
||||||
one-line
|
one-line
|
||||||
v-if="!item.folder"
|
v-if="!item.isFolder"
|
||||||
class="mx-auto draggable-card"
|
class="mx-auto draggable-card"
|
||||||
max-width="344"
|
max-width="344"
|
||||||
outlined
|
outlined
|
||||||
|
@ -150,6 +150,7 @@ getIcon<!--
|
||||||
editDialog.data.type = item.type;
|
editDialog.data.type = item.type;
|
||||||
editDialog.data.name = item.name;
|
editDialog.data.name = item.name;
|
||||||
editDialog.data.url = item.url;
|
editDialog.data.url = item.url;
|
||||||
|
getFolderList();
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<v-list-item-title>Edit</v-list-item-title>
|
<v-list-item-title>Edit</v-list-item-title>
|
||||||
|
@ -182,7 +183,7 @@ getIcon<!--
|
||||||
|
|
||||||
<!-- The Folder List Item -->
|
<!-- The Folder List Item -->
|
||||||
<v-list-group
|
<v-list-group
|
||||||
v-if="item.folder"
|
v-if="item.isFolder"
|
||||||
class="top-level-folder"
|
class="top-level-folder"
|
||||||
>
|
>
|
||||||
<!-- prepend-icon="mdi-blur-linear" put this in the list group, no idea how to make it a handle yet though... -->
|
<!-- prepend-icon="mdi-blur-linear" put this in the list group, no idea how to make it a handle yet though... -->
|
||||||
|
@ -289,6 +290,7 @@ getIcon<!--
|
||||||
editDialog.data.type = item.type;
|
editDialog.data.type = item.type;
|
||||||
editDialog.data.name = item.name;
|
editDialog.data.name = item.name;
|
||||||
editDialog.data.url = item.url;
|
editDialog.data.url = item.url;
|
||||||
|
getFolderList();
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<v-list-item-title>Edit</v-list-item-title>
|
<v-list-item-title>Edit</v-list-item-title>
|
||||||
|
@ -415,29 +417,38 @@ getIcon<!--
|
||||||
:lazy-validation="false"
|
:lazy-validation="false"
|
||||||
>
|
>
|
||||||
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
class="px-2"
|
class="px-2"
|
||||||
label="Type"
|
label="Type"
|
||||||
v-model="editDialog.data.type"
|
v-model="editDialog.data.type"
|
||||||
:rules="[v => !!v || 'Type is required.']"
|
:rules="[v => !!v || 'Type is required.']"
|
||||||
required
|
required
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
class="px-2"
|
class="px-2"
|
||||||
label="Name"
|
label="Name"
|
||||||
v-model="editDialog.data.name"
|
v-model="editDialog.data.name"
|
||||||
:rules="[v => !!v || 'Name is required.']"
|
:rules="[v => !!v || 'Name is required.']"
|
||||||
required
|
required
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
|
|
||||||
<v-text-field
|
<v-overflow-btn
|
||||||
class="px-2"
|
class="my-2"
|
||||||
label="URL"
|
:items="folderListNames"
|
||||||
v-model="editDialog.data.url"
|
v-model="editDialog.data.folder"
|
||||||
:rules="[v => !!v || 'URL is required.']"
|
label="Folder"
|
||||||
required
|
editable
|
||||||
></v-text-field>
|
item-value="name"
|
||||||
|
></v-overflow-btn>
|
||||||
|
|
||||||
|
<v-text-field
|
||||||
|
class="px-2"
|
||||||
|
label="URL"
|
||||||
|
v-model="editDialog.data.url"
|
||||||
|
:rules="[v => !!v || 'URL is required.']"
|
||||||
|
required
|
||||||
|
></v-text-field>
|
||||||
|
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
|
|
||||||
|
@ -546,7 +557,7 @@ getIcon<!--
|
||||||
<v-btn
|
<v-btn
|
||||||
color="red"
|
color="red"
|
||||||
class="px-3"
|
class="px-3"
|
||||||
@click="addDialog.show = false"
|
@click="createFolderDialog.show = false"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
@ -574,16 +585,17 @@ getIcon<!--
|
||||||
>
|
>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-title class="headline">Add Item</v-card-title>
|
<v-card-title class="headline">Add Item</v-card-title>
|
||||||
|
|
||||||
<v-card-text>
|
|
||||||
Enter the name of the item.
|
|
||||||
</v-card-text>
|
|
||||||
|
|
||||||
<v-form
|
<v-form
|
||||||
ref="addForm"
|
ref="addForm"
|
||||||
v-model="addDialog.valid"
|
v-model="addDialog.valid"
|
||||||
:lazy-validation="false"
|
:lazy-validation="false"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<v-card-text>
|
||||||
|
Enter the name of the item.
|
||||||
|
</v-card-text>
|
||||||
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
class="px-2"
|
class="px-2"
|
||||||
|
@ -592,6 +604,19 @@ getIcon<!--
|
||||||
:rules="[v => !!v || 'Name is required.']"
|
:rules="[v => !!v || 'Name is required.']"
|
||||||
required
|
required
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
|
|
||||||
|
<v-card-text>
|
||||||
|
Select a folder (optional).
|
||||||
|
</v-card-text>
|
||||||
|
|
||||||
|
<v-overflow-btn
|
||||||
|
class="my-2"
|
||||||
|
:items="folderListNames"
|
||||||
|
v-model="addDialog.data.folder"
|
||||||
|
label="Folder"
|
||||||
|
editable
|
||||||
|
item-value="name"
|
||||||
|
></v-overflow-btn>
|
||||||
|
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
Enter the URL of the item.
|
Enter the URL of the item.
|
||||||
|
@ -837,10 +862,11 @@ export default {
|
||||||
"type": "script",
|
"type": "script",
|
||||||
"name": "VRGrabScale",
|
"name": "VRGrabScale",
|
||||||
"url": "https://gooawefaweawfgle.com/vr.js",
|
"url": "https://gooawefaweawfgle.com/vr.js",
|
||||||
|
"folder": "",
|
||||||
"uuid": "54254354353",
|
"uuid": "54254354353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"folder": true,
|
"isFolder": true,
|
||||||
"name": "Test Folder",
|
"name": "Test Folder",
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
|
@ -862,48 +888,56 @@ export default {
|
||||||
"type": "script",
|
"type": "script",
|
||||||
"name": "VRGrabScale",
|
"name": "VRGrabScale",
|
||||||
"url": "https://googfdafsgaergale.com/vr.js",
|
"url": "https://googfdafsgaergale.com/vr.js",
|
||||||
|
"folder": "",
|
||||||
"uuid": "54hgfhgf254354353",
|
"uuid": "54hgfhgf254354353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "script",
|
"type": "script",
|
||||||
"name": "TEST",
|
"name": "TEST",
|
||||||
"url": "https://gooadfdagle.com/vr.js",
|
"url": "https://gooadfdagle.com/vr.js",
|
||||||
|
"folder": "",
|
||||||
"uuid": "542rfwat4t5fsddf4354353",
|
"uuid": "542rfwat4t5fsddf4354353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "json",
|
"type": "json",
|
||||||
"name": "TESTJSON",
|
"name": "TESTJSON",
|
||||||
"url": "https://gooadfdagle.com/vr.json",
|
"url": "https://gooadfdagle.com/vr.json",
|
||||||
|
"folder": "",
|
||||||
"uuid": "542rfwat4t54354353",
|
"uuid": "542rfwat4t54354353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "script",
|
"type": "script",
|
||||||
"name": "TESTLONGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG",
|
"name": "TESTLONGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG",
|
||||||
"url": "https://googfdaffle.com/vrLONGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG.js",
|
"url": "https://googfdaffle.com/vrLONGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG.js",
|
||||||
|
"folder": "",
|
||||||
"uuid": "5425ggsrg45354353",
|
"uuid": "5425ggsrg45354353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "avatar",
|
"type": "avatar",
|
||||||
"name": "AVI",
|
"name": "AVI",
|
||||||
"url": "https://googlfadfe.com/vr.fst",
|
"url": "https://googlfadfe.com/vr.fst",
|
||||||
|
"folder": "",
|
||||||
"uuid": "542gregg45s3g4354353",
|
"uuid": "542gregg45s3g4354353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "avatar",
|
"type": "avatar",
|
||||||
"name": "AVI",
|
"name": "AVI",
|
||||||
"url": "https://googlefdaf.com/vr.fst",
|
"url": "https://googlefdaf.com/vr.fst",
|
||||||
|
"folder": "",
|
||||||
"uuid": "5420798-087-54354353",
|
"uuid": "5420798-087-54354353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "model",
|
"type": "model",
|
||||||
"name": "3D MODEL",
|
"name": "3D MODEL",
|
||||||
"url": "https://googlee.com/vr.fbx",
|
"url": "https://googlee.com/vr.fbx",
|
||||||
|
"folder": "",
|
||||||
"uuid": "54254354980-7667jt353",
|
"uuid": "54254354980-7667jt353",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "serverless",
|
"type": "serverless",
|
||||||
"name": "SERVERLESS DOMAIN",
|
"name": "SERVERLESS DOMAIN",
|
||||||
"url": "https://googleee.com/vr.fbx",
|
"url": "https://googleee.com/vr.fbx",
|
||||||
|
"folder": "",
|
||||||
"uuid": "542543sg45s4gg54353",
|
"uuid": "542543sg45s4gg54353",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -954,6 +988,7 @@ export default {
|
||||||
valid: false,
|
valid: false,
|
||||||
data: {
|
data: {
|
||||||
"name": null,
|
"name": null,
|
||||||
|
"folder": null,
|
||||||
"url": null,
|
"url": null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -965,6 +1000,7 @@ export default {
|
||||||
"type": null,
|
"type": null,
|
||||||
"name": null,
|
"name": null,
|
||||||
"url": null,
|
"url": null,
|
||||||
|
"folder": null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
editFolderDialog: {
|
editFolderDialog: {
|
||||||
|
@ -994,6 +1030,8 @@ export default {
|
||||||
"recipient": null,
|
"recipient": null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
folderListUUIDs: [],
|
||||||
|
folderListNames: [],
|
||||||
nearbyUsers: [
|
nearbyUsers: [
|
||||||
{
|
{
|
||||||
name: "Who",
|
name: "Who",
|
||||||
|
@ -1043,12 +1081,13 @@ export default {
|
||||||
var uuid = s.join("");
|
var uuid = s.join("");
|
||||||
return uuid;
|
return uuid;
|
||||||
},
|
},
|
||||||
pushToItems: function(type, name, url) {
|
pushToItems: function(type, name, folder, url) {
|
||||||
var itemToPush =
|
var itemToPush =
|
||||||
{
|
{
|
||||||
"type": type,
|
"type": type,
|
||||||
"name": name,
|
"name": name,
|
||||||
"url": url,
|
"url": url,
|
||||||
|
"folder": folder,
|
||||||
"uuid": this.createUUID(),
|
"uuid": this.createUUID(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1057,7 +1096,7 @@ export default {
|
||||||
pushFolderToItems: function(name) {
|
pushFolderToItems: function(name) {
|
||||||
var folderToPush =
|
var folderToPush =
|
||||||
{
|
{
|
||||||
"folder": true,
|
"isFolder": true,
|
||||||
"name": name,
|
"name": name,
|
||||||
"items": [],
|
"items": [],
|
||||||
"uuid": this.createUUID(),
|
"uuid": this.createUUID(),
|
||||||
|
@ -1151,24 +1190,12 @@ export default {
|
||||||
this.pushToItems(itemType, name, url);
|
this.pushToItems(itemType, name, url);
|
||||||
|
|
||||||
this.addDialog.data.name = null;
|
this.addDialog.data.name = null;
|
||||||
|
this.addDialog.data.folder = null;
|
||||||
this.addDialog.data.url = null;
|
this.addDialog.data.url = null;
|
||||||
},
|
},
|
||||||
removeItem: function(uuid) {
|
removeItem: function(uuid) {
|
||||||
for (var i = 0; i < this.items.length; i++) {
|
var findItem = this.searchForItem(uuid);
|
||||||
if (this.items[i].uuid == uuid) {
|
findItem.parentArray.splice(findItem.iteration, 1);
|
||||||
this.items.splice(i, 1);
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else if (Object.prototype.hasOwnProperty.call(this.items[i], "items")) {
|
|
||||||
for (var di = 0; di < this.items[i].items.length; di++) { // DI means deep iteration
|
|
||||||
if (this.items[i].items[di].uuid == uuid) {
|
|
||||||
this.items[i].items.splice(di, 1);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
removeFolder: function(uuid) {
|
removeFolder: function(uuid) {
|
||||||
for (var i = 0; i < this.items.length; i++) {
|
for (var i = 0; i < this.items.length; i++) {
|
||||||
|
@ -1179,26 +1206,11 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
editItem: function(uuid) {
|
editItem: function(uuid) {
|
||||||
for (var i = 0; i < this.items.length; i++) {
|
var findItem = this.searchForItem(uuid);
|
||||||
if (this.items[i].uuid == uuid) {
|
findItem.returnedItem.type = this.checkItemType(this.editDialog.data.type);
|
||||||
this.items[i].type = this.checkItemType(this.editDialog.data.type);
|
findItem.returnedItem.name = this.editDialog.data.name;
|
||||||
this.items[i].name = this.editDialog.data.name;
|
findItem.returnedItem.url = this.editDialog.data.url;
|
||||||
this.items[i].url = this.editDialog.data.url;
|
|
||||||
|
|
||||||
return;
|
|
||||||
} else if (Object.prototype.hasOwnProperty.call(this.items[i], "items")) {
|
|
||||||
for (var di = 0; di < this.items[i].items.length; di++) { // DI means deep iteration
|
|
||||||
if (this.items[i].items[di].uuid == uuid) {
|
|
||||||
this.items[i].items[di].type = this.checkItemType(this.editDialog.data.type);
|
|
||||||
this.items[i].items[di].name = this.editDialog.data.name;
|
|
||||||
this.items[i].items[di].url = this.editDialog.data.url;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
receivingItem: function(data) {
|
receivingItem: function(data) {
|
||||||
if (this.receiveDialog.show != true) { // Do not accept offers if the user is already receiving an offer.
|
if (this.receiveDialog.show != true) { // Do not accept offers if the user is already receiving an offer.
|
||||||
|
@ -1211,16 +1223,10 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
shareItem: function(uuid) {
|
shareItem: function(uuid) {
|
||||||
var typeToShare;
|
var findItem = this.searchForItem(uuid);
|
||||||
var nameToShare;
|
var typeToShare = findItem.returnedItem.type;
|
||||||
|
var nameToShare = findItem.returnedItem.name;
|
||||||
for (var i = 0; i < this.items.length; i++) {
|
|
||||||
if (this.items[i].uuid == uuid) {
|
|
||||||
typeToShare = this.items[i].type;
|
|
||||||
nameToShare = this.items[i].name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// alert("type" + typeToShare + "name" + nameToShare);
|
// alert("type" + typeToShare + "name" + nameToShare);
|
||||||
this.sendAppMessage("share-item", {
|
this.sendAppMessage("share-item", {
|
||||||
|
@ -1243,6 +1249,18 @@ export default {
|
||||||
"url": url
|
"url": url
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onDragStart: function() {
|
||||||
|
console.info("Drag start.");
|
||||||
|
},
|
||||||
|
onDragUpdate: function() {
|
||||||
|
console.info("Drag Update.");
|
||||||
|
},
|
||||||
|
onDragEnd: function() {
|
||||||
|
console.info("Drag End.");
|
||||||
|
},
|
||||||
|
onDragChange: function(ev) {
|
||||||
|
console.info("Drag Update.", ev);
|
||||||
|
},
|
||||||
sortInventory: function(level) {
|
sortInventory: function(level) {
|
||||||
if (level == "top") {
|
if (level == "top") {
|
||||||
this.items.sort(function(a, b) {
|
this.items.sort(function(a, b) {
|
||||||
|
@ -1279,6 +1297,44 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getFolderList: function() {
|
||||||
|
this.folderListNames = ["No Folder"]; // We want to give the option to put it in the root directory.
|
||||||
|
this.folderListUUIDs = ["No Folder"]; // Clear the list before pushing to it.
|
||||||
|
|
||||||
|
for (var i = 0; i < this.items.length; i++) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(this.items[i], "isFolder")) {
|
||||||
|
if (this.items[i].isFolder === true) {
|
||||||
|
this.folderListNames.push(this.items[i].name);
|
||||||
|
this.folderListUUIDs.push(this.items[i].uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
searchForItem: function(uuid) {
|
||||||
|
var itemToReturn = {
|
||||||
|
"returnedItem": null,
|
||||||
|
"iteration": null,
|
||||||
|
"parentArray": null
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < this.items.length; i++) {
|
||||||
|
if (this.items[i].uuid == uuid) {
|
||||||
|
itemToReturn.returnedItem = this.items[i];
|
||||||
|
itemToReturn.iteration = i;
|
||||||
|
itemToReturn.parentArray = this.items;
|
||||||
|
return itemToReturn;
|
||||||
|
} else if (Object.prototype.hasOwnProperty.call(this.items[i], "items")) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
sendInventory: function() {
|
sendInventory: function() {
|
||||||
this.sendAppMessage("web-to-script-inventory", this.items );
|
this.sendAppMessage("web-to-script-inventory", this.items );
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue