This commit is contained in:
@@ -147,6 +147,20 @@ export default {
|
||||
}
|
||||
|
||||
return ret;
|
||||
}, ///////////////////////////////
|
||||
// ICON FOR CORE OBJECT TYPES
|
||||
//(used for search results)
|
||||
//
|
||||
//CoreBizObject add here
|
||||
iconForCoreType: function(aytype) {
|
||||
switch (aytype) {
|
||||
case window.$gz.type.User:
|
||||
return "fa-user";
|
||||
case window.$gz.type.Widget:
|
||||
return "fa-vial";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//new functions above here
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
:label="$ay.t('Search')"
|
||||
ref="searchPhrase"
|
||||
@change="getDataFromApi()"
|
||||
hint="text, *xt, *ex*, te*"
|
||||
hint="text, *xt, te*"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
@@ -42,12 +42,10 @@
|
||||
<v-subheader v-if="maxResultsReturned">
|
||||
<span>({{ $ay.t("TooManyResults") }})</span>
|
||||
</v-subheader>
|
||||
_.groupBy(collection, [iteratee=_.identity])
|
||||
maybe add an icon property in code but only for each new item in group?
|
||||
<v-list-item-group v-model="item" color="primary">
|
||||
<v-list-item v-for="(item, i) in results" :key="i">
|
||||
<v-list-item-icon>
|
||||
<v-icon>fa-splotch</v-icon>
|
||||
<v-icon>{{ item.icon }}</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title
|
||||
@@ -177,10 +175,22 @@ export default {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
vm.results = res.data.searchResults;
|
||||
vm.maxResultsReturned =
|
||||
res.data.searchResults.length == MAX_RESULTS;
|
||||
|
||||
//vm.results = res.data.searchResults;
|
||||
let newResults = [];
|
||||
|
||||
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;
|
||||
}
|
||||
newResults.push(item);
|
||||
}
|
||||
vm.results = newResults;
|
||||
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
|
||||
Reference in New Issue
Block a user