This commit is contained in:
@@ -36,9 +36,13 @@
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-card max-width="900px">
|
||||
<p v-if="!results.length">No results</p>
|
||||
<v-card v-if="results.length" max-width="900px">
|
||||
<v-list>
|
||||
<v-subheader>Results</v-subheader>
|
||||
<v-subheader v-if="maxResultsReturned">
|
||||
<span>({{ $ay.t("TooManyResults") }})</span>
|
||||
</v-subheader>
|
||||
_.groupBy(collection, [iteratee=_.identity])
|
||||
<v-list-item-group v-model="item" color="primary">
|
||||
<v-list-item v-for="(item, i) in results" :key="i">
|
||||
<v-list-item-icon>
|
||||
@@ -53,10 +57,6 @@
|
||||
</v-list-item-group>
|
||||
</v-list>
|
||||
</v-card>
|
||||
|
||||
totalresults:{{ totalResults }}
|
||||
|
||||
<div>results:{{ results }}</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
@@ -98,6 +98,7 @@
|
||||
const FORM_KEY = "home-search";
|
||||
const API_BASE_URL = "Search/";
|
||||
const FORM_CUSTOM_TEMPLATE_KEY = "home-search";
|
||||
const MAX_RESULTS = 200;
|
||||
|
||||
export default {
|
||||
created() {
|
||||
@@ -129,7 +130,7 @@ export default {
|
||||
searchPhrase: null,
|
||||
searchObjectType: 0,
|
||||
results: [],
|
||||
totalResults: null,
|
||||
maxResultsReturned: false,
|
||||
formState: {
|
||||
ready: false,
|
||||
dirty: false,
|
||||
@@ -167,7 +168,7 @@ export default {
|
||||
phrase: vm.searchPhrase,
|
||||
nameOnly: false,
|
||||
typeOnly: !!vm.searchObjectType ? vm.searchObjectType : 0,
|
||||
maxResults: 200
|
||||
maxResults: MAX_RESULTS
|
||||
})
|
||||
|
||||
.then(res => {
|
||||
@@ -176,7 +177,9 @@ export default {
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
vm.results = res.data.searchResults;
|
||||
vm.totalResults = res.data.totalResultsFound;
|
||||
vm.maxResultsReturned =
|
||||
res.data.searchResults.length == MAX_RESULTS;
|
||||
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
@@ -260,7 +263,8 @@ function initForm(vm) {
|
||||
function fetchTranslatedText(vm) {
|
||||
return window.$gz.translation.fetch([
|
||||
//todo: needs all object types
|
||||
"Object"
|
||||
"Object",
|
||||
"TooManyResults"
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user