This commit is contained in:
2019-05-01 19:41:10 +00:00
parent 3ebf647d53
commit 1c4f9ffee6
2 changed files with 60 additions and 147 deletions

View File

@@ -41,10 +41,10 @@ All platforms and browsers
- DONE Make about contextual and insert a menu item to view log - DONE Make about contextual and insert a menu item to view log
- DONE WIRE up save menu item and add code to disable save on broken rules (and make red, disabled etc) - DONE WIRE up save menu item and add code to disable save on broken rules (and make red, disabled etc)
- DONE Move wire up event code from app.vue to gzmenu and call it from app.vue - DONE Move wire up event code from app.vue to gzmenu and call it from app.vue
### UPDATE VUETIFY, SB 0.5.0, not 0.4.6
### - RIGHTS in form state so can easily enable / disable etc ### - RIGHTS in form state so can easily enable / disable etc
- INFO - SERVER will return on request of an object one of these: - DONE INFO - SERVER will return on request of an object one of these:
- DONE Not authenticated at all 401 - DONE Not authenticated at all 401
- DONE Redirect to login - DONE Redirect to login
- DONE Not authorized for this object 403 (could be due to not own or whatever, we don't care, server handles that shit, client just knows not to show it) - DONE Not authorized for this object 403 (could be due to not own or whatever, we don't care, server handles that shit, client just knows not to show it)
@@ -74,7 +74,7 @@ All platforms and browsers
- Wire up delete menu item - Wire up delete menu item
- api code is stubbed out for delete, need to write that as well - api code is stubbed out for delete, need to write that as well
- DONE TODO navigating through menu doesn't "back" properly when clicking back on browser controls - DONE TODO navigating through menu doesn't "back" properly when clicking back on browser controls
= TODO: widget form now not localized title at menu top - DONE widget form now not localized title at menu top
- Widget list, refresh page causes items per page to reset back to 5 from custom setting, it should cache that shit at least for a session anyway - Widget list, refresh page causes items per page to reset back to 5 from custom setting, it should cache that shit at least for a session anyway

View File

@@ -168,9 +168,11 @@
</template> </template>
<script> <script>
/* eslint-disable */ /* xeslint-disable */
//import ayatype from "../api/ayatype";
/////////////////////////////
//
//
function clickHandler(menuItem) { function clickHandler(menuItem) {
if (!menuItem) { if (!menuItem) {
return; return;
@@ -193,35 +195,53 @@ function clickHandler(menuItem) {
} }
} }
export default { //////////////////////
//https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards //
// /*eslint-disable-next-line*/ //
// beforeRouteEnter(to, from, next) { function generateMenu(vm, readOnly) {
// //check rights here!!! var menuOptions = {
// /*eslint-disable-next-line*/ isMain: false,
// var v = { t: to, f: from, n: next }; icon: "fa-splotch",
title: vm.$gzlocale.get("Widget"),
helpUrl: "intro/#searching",
menuItems: []
};
// // called before the route that renders this component is confirmed. //eslint-disable-next-line
// // does NOT have access to `this` component instance, console.log(readOnly);
// // because it has not been created yet when this guard is called!
// }, if (readOnly != true) {
// /*eslint-disable-next-line*/ menuOptions.menuItems = [
// beforeRouteUpdate(to, from, next) { {
// // called when the route that renders this component has changed, title: vm.$gzlocale.get("Save"),
// // but this component is reused in the new route. icon: "save",
// // For example, for a route with dynamic params `/foo/:id`, when we surface: true,
// // navigate between `/foo/1` and `/foo/2`, the same `Foo` component instance key: "inventory-widget-edit:save",
// // will be reused, and this hook will be called when that happens. vm: vm
// // has access to `this` component instance. },
// }, {
// /*eslint-disable-next-line*/ title: vm.$gzlocale.get("Delete"),
// beforeRouteLeave(to, from, next) { icon: "trash-alt",
// // called when the route that renders this component is about to surface: true,
// // be navigated away from. key: "inventory-widget-edit:delete",
// // has access to `this` component instance. vm: vm
// }, },
{ divider: true, inset: false },
{
title: vm.$gzlocale.get("Duplicate"),
icon: "clone",
key: "inventory-widget-edit:duplicate",
vm: vm
}
];
}
//eslint-disable-next-line
console.log(menuOptions);
vm.$gzevent.$emit("menu-change", menuOptions);
}
export default {
beforeCreate() { beforeCreate() {
console.log("BEFORE CREATE CALLED");
//Cache all required lt keys //Cache all required lt keys
var ltKeysRequired = [ var ltKeysRequired = [
"Widget", "Widget",
@@ -251,42 +271,11 @@ export default {
"WidgetCustom16" "WidgetCustom16"
]; ];
var vm = this; var vm = this;
//console.log("B4CREATE FETCHING KEYS NOW");
this.$gzlocale this.$gzlocale
.fetch(ltKeysRequired) .fetch(ltKeysRequired)
//.then(() => console.log("KEYS FETCHED")) // .then(function() {
.then(function() { // generateMenu(vm, );
vm.$gzevent.$emit("menu-change", { // })
isMain: false,
icon: "fa-splotch",
title: vm.$gzlocale.get("Widget"),
helpUrl: "intro/#searching",
menuItems: [
{
title: vm.$gzlocale.get("Save"),
icon: "save",
surface: true,
key: "inventory-widget-edit:save",
vm: vm
},
{
title: vm.$gzlocale.get("Delete"),
icon: "trash-alt",
surface: true,
key: "inventory-widget-edit:delete",
vm: vm
},
{ divider: true, inset: false },
{
title: vm.$gzlocale.get("Duplicate"),
icon: "clone",
key: "inventory-widget-edit:duplicate",
vm: vm
}
]
});
})
.then(() => (vm.formState.ready = true)) .then(() => (vm.formState.ready = true))
.catch(err => { .catch(err => {
vm.formState.ready = true; vm.formState.ready = true;
@@ -294,38 +283,6 @@ export default {
}); });
}, },
created() { created() {
//console.log("CREATED CALLED");
// this.$gzevent.$emit("menu-change", {
// isMain: false,
// icon: "fa-splotch",
// title: this.$gzlocale.get("Widget"),
// helpUrl: "intro/#searching",
// menuItems: [
// {
// title: this.$gzlocale.get("Save"),
// icon: "save",
// surface: true,
// key: "inventory-widget-edit:save",
// vm: this
// },
// {
// title: this.$gzlocale.get("Delete"),
// icon: "trash-alt",
// surface: true,
// key: "inventory-widget-edit:delete",
// vm: this
// },
// { divider: true, inset: false },
// {
// title: this.$gzlocale.get("Duplicate"),
// icon: "clone",
// key: "inventory-widget-edit:duplicate",
// vm: this
// }
// ]
// });
this.$gzevent.$on("menu-click", clickHandler); this.$gzevent.$on("menu-click", clickHandler);
this.getDataFromApi(); this.getDataFromApi();
}, },
@@ -356,7 +313,8 @@ export default {
if (this.formState.loading) { if (this.formState.loading) {
return; return;
} }
var canSave = val.dirty && val.valid;
var canSave = val.dirty && val.valid && !val.readOnly;
if (canSave) { if (canSave) {
this.$gzevent.$emit("menu-enable-item", "inventory-widget-edit:save"); this.$gzevent.$emit("menu-enable-item", "inventory-widget-edit:save");
} else { } else {
@@ -401,6 +359,9 @@ export default {
loading: false, loading: false,
readOnly: res.readOnly ? true : false readOnly: res.readOnly ? true : false
}); });
//modify the menu as necessary
generateMenu(vm, res.readOnly);
} }
}) })
.catch(function handleGetDataFromAPIError(error) { .catch(function handleGetDataFromAPIError(error) {
@@ -487,51 +448,3 @@ export default {
</script> </script>
<style></style> <style></style>
/*
Sample widget record api v8
{
"data": {
"id": 100,
"concurrencyToken": 2675248,
"ownerId": 1,
"name": "Fantastic Wooden Chips 122",
"serial": 100,
"dollarAmount": 584.83,
"active": true,
"roles": 8212,
"startDate": "2019-02-12T10:12:39.594206",
"endDate": "2019-02-12T13:40:59.986405",
"notes": "Eum optio incidunt blanditiis laboriosam. Sed ipsam occaecati minus corrupti repudiandae delectus. Culpa nostrum est ullam assumenda animi ut. Velit sunt ex ipsum. Temporibus cum quaerat at omnis at quas. Commodi dolor molestiae beatae.",
"count": 0,
"customFields": null,
"tags": [
"brown",
"red"
]
}
}
IN JS FORMAT
{
data: {
id: 100,
concurrencyToken: 2675248,
ownerId: 1,
name: 'Fantastic Wooden Chips 122',
serial: 100,
dollarAmount: 584.83,
active: true,
roles: 8212,
startDate: '2019-02-12T10:12:39.594206',
endDate: '2019-02-12T13:40:59.986405',
notes: 'Eum optio incidunt blanditiis laboriosam. Sed ipsam occaecati minus corrupti repudiandae delectus. Culpa nostrum est ullam assumenda animi ut. Velit sunt ex ipsum. Temporibus cum quaerat at omnis at quas. Commodi dolor molestiae beatae.',
count: 0,
customFields: null,
tags: [
'brown',
'red'
]
}
}
*/