This commit is contained in:
@@ -42,17 +42,14 @@ CURRENT ROADMAP
|
|||||||
CURRENT TODOs
|
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: 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
|
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
|
- 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
|
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
|
UNSAVED STATUS IN EDITOR
|
||||||
|
|||||||
@@ -482,7 +482,13 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
obj: { editView: [], name: "", public: true },
|
obj: {
|
||||||
|
editView: [],
|
||||||
|
name: "",
|
||||||
|
public: true,
|
||||||
|
concurrencyToken: 0,
|
||||||
|
userId: 0
|
||||||
|
},
|
||||||
listViewId: undefined,
|
listViewId: undefined,
|
||||||
dataListKey: undefined,
|
dataListKey: undefined,
|
||||||
formKey: undefined,
|
formKey: undefined,
|
||||||
@@ -702,78 +708,69 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
// var vm = this;
|
if (this.canSave) {
|
||||||
// var url = API_BASE_URL + this.formCustomTemplateKey;
|
this.formState.loading = true;
|
||||||
// //clear any errors vm might be around from previous submit
|
var vm = this;
|
||||||
// window.$gz.form.deleteAllErrorBoxErrors(this);
|
var url = API_BASE_URL + this.$route.params.id;
|
||||||
// //Create template data object here....
|
/*
|
||||||
// //Note that server expects to see a string array of json template, not actual json
|
{
|
||||||
// var newObj = {
|
"id": 0,
|
||||||
// formKey: this.formCustomTemplateKey,
|
"concurrencyToken": 0,
|
||||||
// concurrencyToken: this.concurrencyToken,
|
"userId": 0,
|
||||||
// template: "[]"
|
"name": "string",
|
||||||
// };
|
"public": true,
|
||||||
// //temporary array to hold template for later stringification
|
"listKey": "string",
|
||||||
// var temp = [];
|
"listView": "string"
|
||||||
// //Rules:
|
}
|
||||||
// for (var i = 0; i < this.obj.length; i++) {
|
|
||||||
// var fldItem = this.obj[i];
|
//Put in unsaved listview
|
||||||
// if (fldItem.custom == false) {
|
//debugger;
|
||||||
// //Process regular stock field
|
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||||
// //If it's *not* set to stockRequired (i.e. built in field with biz rules that can't be hidden or changed)
|
formSettings.saved.dataTable.unsavedListView = JSON.stringify(
|
||||||
// // and it's also set to hidden or required then it's template-worthy
|
generateListViewFromEdited(vm)
|
||||||
// if (
|
);
|
||||||
// !fldItem.stockRequired &&
|
formSettings.saved.dataTable.listViewId = -1;
|
||||||
// (fldItem.visible == false || fldItem.required == true)
|
window.$gz.form.setFormSettings(vm.formKey, formSettings);
|
||||||
// ) {
|
*/
|
||||||
// temp.push({
|
//clear any errors vm might be around from previous submit
|
||||||
// fld: fldItem.key,
|
window.$gz.form.deleteAllErrorBoxErrors(this);
|
||||||
// required: fldItem.required,
|
window.$gz.api
|
||||||
// hide: !fldItem.visible
|
.upsert(url, this.obj)
|
||||||
// });
|
.then(res => {
|
||||||
// }
|
vm.formState.loading = false;
|
||||||
// } else {
|
if (res.error != undefined) {
|
||||||
// //Process custom field
|
vm.formState.serverError = res.error;
|
||||||
// //If it's not visible then don't add it at all
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
// if (fldItem.visible == true) {
|
} else {
|
||||||
// temp.push({
|
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
|
||||||
// fld: fldItem.key,
|
if (res.data.id) {
|
||||||
// required: fldItem.required,
|
//Handle "post" of new record (CREATE)
|
||||||
// type: fldItem.type
|
vm.obj = res.data;
|
||||||
// });
|
window.$gz.form.setFormState({
|
||||||
// }
|
vm: vm,
|
||||||
// }
|
dirty: false,
|
||||||
// }
|
readOnly: res.readOnly ? true : false
|
||||||
// //now set the template as a json string
|
});
|
||||||
// newObj.template = JSON.stringify(temp);
|
|
||||||
// window.$gz.api
|
//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:
|
||||||
// .upsert(url, newObj)
|
vm.$router.replace(
|
||||||
// .then(res => {
|
vm.$route.fullPath.slice(0, -1) + res.data.id
|
||||||
// vm.formState.loading = false;
|
);
|
||||||
// if (res.error != undefined) {
|
} else {
|
||||||
// vm.formState.serverError = res.error;
|
//Handle "put" of an existing record (UPDATE)
|
||||||
// window.$gz.form.setErrorBoxErrors(vm);
|
vm.obj.concurrencyToken = res.data.concurrencyToken;
|
||||||
// } else {
|
window.$gz.form.setFormState({
|
||||||
// //Handle "put" of an existing record (UPDATE) (there is no POST of a new record for this particular object)
|
vm: vm,
|
||||||
// //Set store values for template and token
|
dirty: false
|
||||||
// window.$gz.formCustomTemplate.set(
|
});
|
||||||
// vm.formCustomTemplateKey,
|
}
|
||||||
// res.data.concurrencyToken,
|
}
|
||||||
// newObj.template
|
})
|
||||||
// );
|
.catch(function handleSubmitError(error) {
|
||||||
// //set our local concurrency token value
|
vm.formState.loading = false;
|
||||||
// vm.concurrencyToken = res.data.concurrencyToken;
|
window.$gz.errorHandler.handleFormError(error, vm);
|
||||||
// //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);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1156,6 +1153,8 @@ function setEffectiveListView(vm) {
|
|||||||
vm.effectiveListView = JSON.parse(res.data.listView);
|
vm.effectiveListView = JSON.parse(res.data.listView);
|
||||||
vm.obj.public = res.data.public;
|
vm.obj.public = res.data.public;
|
||||||
vm.obj.name = res.data.name;
|
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