From e9556b177724d8622590e9e1871bd013ce69392d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 7 Apr 2020 19:29:56 +0000 Subject: [PATCH] --- ayanova/src/views/home-search.vue | 64 ++++++++++++++----------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/ayanova/src/views/home-search.vue b/ayanova/src/views/home-search.vue index dfa0b781..c99f17af 100644 --- a/ayanova/src/views/home-search.vue +++ b/ayanova/src/views/home-search.vue @@ -26,7 +26,9 @@ - results list + totalresults:{{ totalResults }} + +
results:{{ results }}
@@ -96,6 +98,8 @@ export default { }, searchPhrase: null, searchObjectType: null, + results: [], + totalResults: null, formState: { ready: false, dirty: false, @@ -114,42 +118,39 @@ export default { getDataFromApi() { let vm = this; vm.formState.loading = true; - //always fetch on this form for the current logged in user id - let url = API_BASE_URL + vm.$store.state.userId; - window.$gz.form.deleteAllErrorBoxErrors(vm); - + /** + * { + "phrase": "e*", + "nameOnly": false, + "typeOnly": 0, + "maxResults": 100 +} + * + */ window.$gz.api - .get(url) + .upsert(API_BASE_URL, { + phrase: vm.searchPhrase, + nameOnly: false, + typeOnly: !!vm.searchObjectType ? vm.searchObjectType : 0, + maxResults: 200 + }) + .then(res => { if (res.error != undefined) { - //Not found? - if (res.error.code == "2010") { - //notify not found error then navigate backwards - window.$gz.eventBus.$emit( - "notify-error", - vm.$ay.t("ErrorAPI2010") - ); - // navigate backwards - window.$gz._.delay(function() { - vm.$router.go(-1); - }, 2000); - } vm.formState.serverError = res.error; window.$gz.form.setErrorBoxErrors(vm); } else { - vm.obj = res.data; - + vm.results = res.data.searchResults; + vm.totalResults = res.data.totalResultsFound; //Update the form status window.$gz.form.setFormState({ vm: vm, - dirty: false, - valid: true, - loading: false, - readOnly: res.readOnly ? true : false + + loading: false }); //modify the menu as necessary - generateMenu(vm); + //generateMenu(vm); } }) .catch(function handleGetDataFromAPIError(error) { @@ -224,14 +225,8 @@ function initForm(vm) { // function fetchTranslatedText(vm) { return window.$gz.translation.fetch([ - //needs all object types - "CurrencyCode", - "LanguageCode", - "TimeZone", - "UserEmailAddress", - "Hour12", - "UserColor", - "Translation" + //todo: needs all object types + "Search" ]); } @@ -239,8 +234,7 @@ function fetchTranslatedText(vm) { // // function populateSelectionLists(vm) { - //http://localhost:7575/api/v8/Translation/List - return window.$gz.api.get("Translation/List").then(res => { + return window.$gz.api.get("EnumList/List/Core").then(res => { if (res.error != undefined) { window.$gz.errorHandler.handleFormError(res.error, vm); } else {