cleaned back up from testing to figure out issue

This commit is contained in:
2020-04-08 22:00:45 +00:00
parent d8f7aa9c0a
commit 213aae5620

View File

@@ -35,24 +35,6 @@
</v-btn>
</v-col>
<v-col cols="12">
<ul>
<template v-for="item in items">
<li :key="item.index">
{{ item
}}<v-btn icon @click="getExcerpt(item)">
<v-icon color="grey lighten-1" large
>fa-info-circle</v-icon
>
</v-btn>
</li>
</template>
</ul>
<v-btn @click="testBuild()">
TEST BUILD
</v-btn>
</v-col>
<v-col cols="12">
<p v-if="!items.length">{{ $ay.t("NoResults") }}</p>
<v-card v-if="items.length" max-width="900">
@@ -61,8 +43,9 @@
<span>({{ $ay.t("TooManyResults") }})</span>
</v-subheader>
<template v-for="(item,ind) in items">
<v-subheader :key="ind" v-if="item.subheader"
<template v-for="item in items">
<!-- KEY MUST BE UNIQUE INSIDE v-for OR LIST ITEM GOES SNAKEY -->
<v-subheader :key="'s' + item.index" v-if="item.subheader"
><v-icon large class="mr-2">{{ item.icon }}</v-icon
><span class="title">{{
item.subheader
@@ -87,7 +70,6 @@
</v-btn>
</v-list-item-action>
</v-list-item>
<!-- {{ item }} -->
</template>
</v-list>
</v-card>
@@ -96,7 +78,6 @@
</v-form>
</v-col>
</v-row>
{{ items }}
</v-container>
</template>
@@ -164,26 +145,7 @@ export default {
},
searchPhrase: null,
searchObjectType: 0,
results: [],
items: [
{
name: "Awesome Plastic Car 32",
type: 2,
id: 7,
info: null,
index: 1
},
{
name: "Handcrafted Metal Towels 117",
type: 2,
id: 92,
subheader: "Widget",
icon: "fa-vial",
info: null,
index: 2
},
{ name: "Awesome Plastic Car 32", type: 2, id: 7, info: null, index: 3 }
],
items: [],
maxResultsReturned: false,
formState: {
ready: false,
@@ -200,28 +162,12 @@ export default {
},
methods: {
test(item) {
item.name = "NEW NAME";
},
testBuild() {
console.log("TEST BUILD");
for (let i = 4; i < 10; i++) {
console.log("Pushing item ", i);
this.items.push({
name: "Awesome Plastic Car" + i,
type: 2,
id: 7,
info: null,
index: i
});
}
},
openItem(item) {
console.log("open item", item);
},
getExcerpt(item) {
item.info = "***NEW INFO HERE****";
this.$forceUpdate();
// let v = this.results[i];
// console.log("getExcerpt results before:", this.results[i].info);
// v.info = "NEW INFO HERE";
@@ -245,7 +191,7 @@ export default {
}
*
*/
console.log("Searching...");
window.$gz.api
.upsert(API_BASE_URL, {
phrase: vm.searchPhrase,
@@ -259,12 +205,10 @@ export default {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
console.log("Results returned, processing...");
vm.maxResultsReturned =
res.data.searchResults.length == MAX_RESULTS;
//vm.results = res.data.searchResults;
vm.items = [];
// vm.items = [];
let newResults = [];
let nDex = 0;
let lastType = -1;
@@ -277,12 +221,11 @@ export default {
item.type
]);
//this is breaking shit
// if (tsub != null) {
// item.subheader = tsub.name;
// } else {
// item.subheader = "TYPE " + item.type;
// }
if (tsub != null) {
item.subheader = tsub.name;
} else {
item.subheader = "TYPE " + item.type;
}
item.icon = window.$gz.util.iconForCoreType(item.type);
lastType = item.type;
@@ -292,7 +235,7 @@ export default {
newResults.push(item);
}
console.log("Pusshing newResults into items now...");
vm.items = newResults;
//Update the form status