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-btn>
</v-col> </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"> <v-col cols="12">
<p v-if="!items.length">{{ $ay.t("NoResults") }}</p> <p v-if="!items.length">{{ $ay.t("NoResults") }}</p>
<v-card v-if="items.length" max-width="900"> <v-card v-if="items.length" max-width="900">
@@ -61,8 +43,9 @@
<span>({{ $ay.t("TooManyResults") }})</span> <span>({{ $ay.t("TooManyResults") }})</span>
</v-subheader> </v-subheader>
<template v-for="(item,ind) in items"> <template v-for="item in items">
<v-subheader :key="ind" v-if="item.subheader" <!-- 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 ><v-icon large class="mr-2">{{ item.icon }}</v-icon
><span class="title">{{ ><span class="title">{{
item.subheader item.subheader
@@ -87,7 +70,6 @@
</v-btn> </v-btn>
</v-list-item-action> </v-list-item-action>
</v-list-item> </v-list-item>
<!-- {{ item }} -->
</template> </template>
</v-list> </v-list>
</v-card> </v-card>
@@ -96,7 +78,6 @@
</v-form> </v-form>
</v-col> </v-col>
</v-row> </v-row>
{{ items }}
</v-container> </v-container>
</template> </template>
@@ -164,26 +145,7 @@ export default {
}, },
searchPhrase: null, searchPhrase: null,
searchObjectType: 0, searchObjectType: 0,
results: [], items: [],
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 }
],
maxResultsReturned: false, maxResultsReturned: false,
formState: { formState: {
ready: false, ready: false,
@@ -200,28 +162,12 @@ export default {
}, },
methods: { 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) { openItem(item) {
console.log("open item", item); console.log("open item", item);
}, },
getExcerpt(item) { getExcerpt(item) {
item.info = "***NEW INFO HERE****"; item.info = "***NEW INFO HERE****";
this.$forceUpdate();
// let v = this.results[i]; // let v = this.results[i];
// console.log("getExcerpt results before:", this.results[i].info); // console.log("getExcerpt results before:", this.results[i].info);
// v.info = "NEW INFO HERE"; // v.info = "NEW INFO HERE";
@@ -245,7 +191,7 @@ export default {
} }
* *
*/ */
console.log("Searching...");
window.$gz.api window.$gz.api
.upsert(API_BASE_URL, { .upsert(API_BASE_URL, {
phrase: vm.searchPhrase, phrase: vm.searchPhrase,
@@ -259,12 +205,10 @@ export default {
vm.formState.serverError = res.error; vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm); window.$gz.form.setErrorBoxErrors(vm);
} else { } else {
console.log("Results returned, processing...");
vm.maxResultsReturned = vm.maxResultsReturned =
res.data.searchResults.length == MAX_RESULTS; res.data.searchResults.length == MAX_RESULTS;
//vm.results = res.data.searchResults; // vm.items = [];
vm.items = [];
let newResults = []; let newResults = [];
let nDex = 0; let nDex = 0;
let lastType = -1; let lastType = -1;
@@ -277,12 +221,11 @@ export default {
item.type item.type
]); ]);
//this is breaking shit if (tsub != null) {
// if (tsub != null) { item.subheader = tsub.name;
// item.subheader = tsub.name; } else {
// } else { item.subheader = "TYPE " + item.type;
// item.subheader = "TYPE " + item.type; }
// }
item.icon = window.$gz.util.iconForCoreType(item.type); item.icon = window.$gz.util.iconForCoreType(item.type);
lastType = item.type; lastType = item.type;
@@ -292,7 +235,7 @@ export default {
newResults.push(item); newResults.push(item);
} }
console.log("Pusshing newResults into items now...");
vm.items = newResults; vm.items = newResults;
//Update the form status //Update the form status