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: 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
- 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

View File

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