This commit is contained in:
@@ -42,17 +42,14 @@ CURRENT ROADMAP
|
||||
CURRENT TODOs
|
||||
=-=-=-=-=-=-=
|
||||
|
||||
TODO: PLAY WITH QUERIES, if search for pizza in name bombed at server
|
||||
- SERVER: when the query bombs with exception it should output the query text to the log and console (DEV MODE)
|
||||
- do same thing not in dev mode but in higher level of logging? though more ideal if it returns to client so I can see it remotely
|
||||
- Maybe still a good idea to return generated query in case of fail for diagnosis
|
||||
TODO: ListView editor hasn't had SAVE code written yet
|
||||
|
||||
TODO: DataTable need a no results display to make it clear it hasn't just bombed or something on no results
|
||||
|
||||
TODO: CACHE dataListAvailable Fields at least on one temporary cache for most current
|
||||
- This is because the listview editor needs it and if a user is flipping back and forth between
|
||||
the datatable and the filter getting it just right they will be triggering a fetch over and over
|
||||
|
||||
TODO: In DELETE USER server code must delete listviews as well that are not public for that user
|
||||
|
||||
|
||||
UNSAVED STATUS IN EDITOR
|
||||
|
||||
@@ -482,7 +482,13 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
obj: { editView: [], name: "", public: true },
|
||||
obj: {
|
||||
editView: [],
|
||||
name: "",
|
||||
public: true,
|
||||
concurrencyToken: 0,
|
||||
userId: 0
|
||||
},
|
||||
listViewId: undefined,
|
||||
dataListKey: undefined,
|
||||
formKey: undefined,
|
||||
@@ -702,78 +708,69 @@ export default {
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
// var vm = this;
|
||||
// var url = API_BASE_URL + this.formCustomTemplateKey;
|
||||
// //clear any errors vm might be around from previous submit
|
||||
// window.$gz.form.deleteAllErrorBoxErrors(this);
|
||||
// //Create template data object here....
|
||||
// //Note that server expects to see a string array of json template, not actual json
|
||||
// var newObj = {
|
||||
// formKey: this.formCustomTemplateKey,
|
||||
// concurrencyToken: this.concurrencyToken,
|
||||
// template: "[]"
|
||||
// };
|
||||
// //temporary array to hold template for later stringification
|
||||
// var temp = [];
|
||||
// //Rules:
|
||||
// for (var i = 0; i < this.obj.length; i++) {
|
||||
// var fldItem = this.obj[i];
|
||||
// if (fldItem.custom == false) {
|
||||
// //Process regular stock field
|
||||
// //If it's *not* set to stockRequired (i.e. built in field with biz rules that can't be hidden or changed)
|
||||
// // and it's also set to hidden or required then it's template-worthy
|
||||
// if (
|
||||
// !fldItem.stockRequired &&
|
||||
// (fldItem.visible == false || fldItem.required == true)
|
||||
// ) {
|
||||
// temp.push({
|
||||
// fld: fldItem.key,
|
||||
// required: fldItem.required,
|
||||
// hide: !fldItem.visible
|
||||
// });
|
||||
// }
|
||||
// } else {
|
||||
// //Process custom field
|
||||
// //If it's not visible then don't add it at all
|
||||
// if (fldItem.visible == true) {
|
||||
// temp.push({
|
||||
// fld: fldItem.key,
|
||||
// required: fldItem.required,
|
||||
// type: fldItem.type
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //now set the template as a json string
|
||||
// newObj.template = JSON.stringify(temp);
|
||||
// window.$gz.api
|
||||
// .upsert(url, newObj)
|
||||
// .then(res => {
|
||||
// vm.formState.loading = false;
|
||||
// if (res.error != undefined) {
|
||||
// vm.formState.serverError = res.error;
|
||||
// window.$gz.form.setErrorBoxErrors(vm);
|
||||
// } else {
|
||||
// //Handle "put" of an existing record (UPDATE) (there is no POST of a new record for this particular object)
|
||||
// //Set store values for template and token
|
||||
// window.$gz.formCustomTemplate.set(
|
||||
// vm.formCustomTemplateKey,
|
||||
// res.data.concurrencyToken,
|
||||
// newObj.template
|
||||
// );
|
||||
// //set our local concurrency token value
|
||||
// vm.concurrencyToken = res.data.concurrencyToken;
|
||||
// //form is now clean
|
||||
// window.$gz.form.setFormState({
|
||||
// vm: vm,
|
||||
// dirty: false
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
// .catch(function handleSubmitError(error) {
|
||||
// vm.formState.loading = false;
|
||||
// window.$gz.errorHandler.handleFormError(error, vm);
|
||||
// });
|
||||
if (this.canSave) {
|
||||
this.formState.loading = true;
|
||||
var vm = this;
|
||||
var url = API_BASE_URL + this.$route.params.id;
|
||||
/*
|
||||
{
|
||||
"id": 0,
|
||||
"concurrencyToken": 0,
|
||||
"userId": 0,
|
||||
"name": "string",
|
||||
"public": true,
|
||||
"listKey": "string",
|
||||
"listView": "string"
|
||||
}
|
||||
|
||||
//Put in unsaved listview
|
||||
//debugger;
|
||||
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||
formSettings.saved.dataTable.unsavedListView = JSON.stringify(
|
||||
generateListViewFromEdited(vm)
|
||||
);
|
||||
formSettings.saved.dataTable.listViewId = -1;
|
||||
window.$gz.form.setFormSettings(vm.formKey, formSettings);
|
||||
*/
|
||||
//clear any errors vm might be around from previous submit
|
||||
window.$gz.form.deleteAllErrorBoxErrors(this);
|
||||
window.$gz.api
|
||||
.upsert(url, this.obj)
|
||||
.then(res => {
|
||||
vm.formState.loading = false;
|
||||
if (res.error != undefined) {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
|
||||
if (res.data.id) {
|
||||
//Handle "post" of new record (CREATE)
|
||||
vm.obj = res.data;
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
readOnly: res.readOnly ? true : false
|
||||
});
|
||||
|
||||
//change url to new record but don't actually navigate, replace current url with same url but with the actual id at the end instead of zero:
|
||||
vm.$router.replace(
|
||||
vm.$route.fullPath.slice(0, -1) + res.data.id
|
||||
);
|
||||
} else {
|
||||
//Handle "put" of an existing record (UPDATE)
|
||||
vm.obj.concurrencyToken = res.data.concurrencyToken;
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(function handleSubmitError(error) {
|
||||
vm.formState.loading = false;
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1156,6 +1153,8 @@ function setEffectiveListView(vm) {
|
||||
vm.effectiveListView = JSON.parse(res.data.listView);
|
||||
vm.obj.public = res.data.public;
|
||||
vm.obj.name = res.data.name;
|
||||
vm.obj.concurrencyToken = res.data.concurrencyToken;
|
||||
vm.obj.userId = res.data.userId;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user