This commit is contained in:
2020-04-08 18:19:06 +00:00
parent 1a07f89b7b
commit 7d02547e4a
2 changed files with 54 additions and 21 deletions

View File

@@ -53,7 +53,7 @@ CURRENT TODOs
todo: search - center the whole thing, looks silly to the left when everything else is centered todo: search - center the whole thing, looks silly to the left when everything else is centered
todo: session cache search results and scroll position if possible to support "back and forthing" todo: session cache search results and scroll position if possible to support "back and forthing"
todo: search what order should the results be retruned in, right now is by id but looks weird in list
todo: SEARCH UI todo: SEARCH UI
- case insensitive by default unless server overriden like picklist - case insensitive by default unless server overriden like picklist
- all searches without wildcards or quotes are "contains" searches by default and multiple phrases space delimited are accomodated - all searches without wildcards or quotes are "contains" searches by default and multiple phrases space delimited are accomodated

View File

@@ -35,34 +35,63 @@
</v-btn> </v-btn>
</v-col> </v-col>
<v-col cols="12" > <v-col cols="12">
<p v-if="!results.length">{{ $ay.t("NoResults") }}</p> <p v-if="!results.length">{{ $ay.t("NoResults") }}</p>
<v-card v-if="results.length" max-width="900"> <v-card v-if="results.length" max-width="900">
<v-list> <v-list>
<v-subheader v-if="maxResultsReturned"> <v-subheader v-if="maxResultsReturned">
<span>({{ $ay.t("TooManyResults") }})</span> <span>({{ $ay.t("TooManyResults") }})</span>
</v-subheader> </v-subheader>
<template v-for="(item, i) in results"> <template v-for="(item, i) in results">
<v-list-item :key="i"> <v-subheader :key="i" v-if="item.subheader"
<v-list-item-avatar> ><v-icon x-large>{{ item.icon }}</v-icon
<v-icon>{{ item.icon }}</v-icon> >{{ item.subheader }}</v-subheader
</v-list-item-avatar> >
<template>
<v-list-item link :key="i">
<!-- <v-list-item-avatar>
<v-list-item-content> </v-list-item-avatar> -->
<v-btn text @click="openItem">
<v-list-item-content>
<v-list-item-title <v-list-item-title
@click="openItem"
v-text="item.name" v-text="item.name"
></v-list-item-title> ></v-list-item-title>
</v-btn> </v-list-item-content>
</v-list-item-content>
<v-list-item-action> <v-list-item-action>
<v-btn icon @click="getExcerpt"> <v-btn icon @click="getExcerpt">
<v-icon>fa-info-circle</v-icon> <v-icon color="grey lighten-1" large
</v-btn> >fa-info-circle</v-icon
</v-list-item-action> >
</v-list-item> </v-btn>
</v-list-item-action>
</v-list-item>
</template>
<!-- <template v-else> v-if="$vuetify.breakpoint.smAndUp"
<v-list-item link :key="i">
<v-list-item-avatar>
<v-icon>{{ item.icon }}</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title
@click="openItem"
v-text="item.name"
></v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click="getExcerpt">
<v-icon color="grey lighten-1" large
>fa-info-circle</v-icon
>
</v-btn>
</v-list-item-action>
</v-list-item>
</template> -->
</template> </template>
</v-list> </v-list>
</v-card> </v-card>
@@ -197,12 +226,16 @@ export default {
//vm.results = res.data.searchResults; //vm.results = res.data.searchResults;
let newResults = []; let newResults = [];
let lastType = -1;
for (let i = 0; i < res.data.searchResults.length; i++) { for (let i = 0; i < res.data.searchResults.length; i++) {
let item = res.data.searchResults[i]; let item = res.data.searchResults[i];
let icon = window.$gz.util.iconForCoreType(item.type); if (item.type != lastType) {
if (icon) { //change of type, set subheader props
item["icon"] = icon; item["subheader"] = item.type;
item["icon"] = window.$gz.util.iconForCoreType(item.type);
lastType = item.type;
} }
newResults.push(item); newResults.push(item);
} }
vm.results = newResults; vm.results = newResults;