This commit is contained in:
2020-04-07 19:29:56 +00:00
parent 1f677e6a77
commit e9556b1777

View File

@@ -26,7 +26,9 @@
</v-col> </v-col>
<v-col cols="12"> <v-col cols="12">
results list totalresults:{{ totalResults }}
<div>results:{{ results }}</div>
</v-col> </v-col>
</v-row> </v-row>
</v-form> </v-form>
@@ -96,6 +98,8 @@ export default {
}, },
searchPhrase: null, searchPhrase: null,
searchObjectType: null, searchObjectType: null,
results: [],
totalResults: null,
formState: { formState: {
ready: false, ready: false,
dirty: false, dirty: false,
@@ -114,42 +118,39 @@ export default {
getDataFromApi() { getDataFromApi() {
let vm = this; let vm = this;
vm.formState.loading = true; 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); window.$gz.form.deleteAllErrorBoxErrors(vm);
/**
* {
"phrase": "e*",
"nameOnly": false,
"typeOnly": 0,
"maxResults": 100
}
*
*/
window.$gz.api window.$gz.api
.get(url) .upsert(API_BASE_URL, {
phrase: vm.searchPhrase,
nameOnly: false,
typeOnly: !!vm.searchObjectType ? vm.searchObjectType : 0,
maxResults: 200
})
.then(res => { .then(res => {
if (res.error != undefined) { 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; vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm); window.$gz.form.setErrorBoxErrors(vm);
} else { } else {
vm.obj = res.data; vm.results = res.data.searchResults;
vm.totalResults = res.data.totalResultsFound;
//Update the form status //Update the form status
window.$gz.form.setFormState({ window.$gz.form.setFormState({
vm: vm, vm: vm,
dirty: false,
valid: true, loading: false
loading: false,
readOnly: res.readOnly ? true : false
}); });
//modify the menu as necessary //modify the menu as necessary
generateMenu(vm); //generateMenu(vm);
} }
}) })
.catch(function handleGetDataFromAPIError(error) { .catch(function handleGetDataFromAPIError(error) {
@@ -224,14 +225,8 @@ function initForm(vm) {
// //
function fetchTranslatedText(vm) { function fetchTranslatedText(vm) {
return window.$gz.translation.fetch([ return window.$gz.translation.fetch([
//needs all object types //todo: needs all object types
"CurrencyCode", "Search"
"LanguageCode",
"TimeZone",
"UserEmailAddress",
"Hour12",
"UserColor",
"Translation"
]); ]);
} }
@@ -239,8 +234,7 @@ function fetchTranslatedText(vm) {
// //
// //
function populateSelectionLists(vm) { function populateSelectionLists(vm) {
//http://localhost:7575/api/v8/Translation/List return window.$gz.api.get("EnumList/List/Core").then(res => {
return window.$gz.api.get("Translation/List").then(res => {
if (res.error != undefined) { if (res.error != undefined) {
window.$gz.errorHandler.handleFormError(res.error, vm); window.$gz.errorHandler.handleFormError(res.error, vm);
} else { } else {