This commit is contained in:
2019-04-30 23:26:39 +00:00
parent aba5dc721c
commit 9a51e8c4e8
4 changed files with 34 additions and 17 deletions

View File

@@ -41,12 +41,13 @@ 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: - 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
- 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)
- Object...BUT with READONLY flag of some kind present (in outer wrapper??), so client knows to show read only and not allow editing - Object...BUT with READONLY flag of some kind present (in outer wrapper??), so client knows to show read only and not allow editing
- And client doesn't need to work out self owned etc - And client doesn't need to work out self owned etc
- DONE Object without readonly flag present so fully editable!!! WOOT! - DONE Object without readonly flag present so fully editable!!! WOOT!
@@ -57,13 +58,9 @@ All platforms and browsers
- WidgetList should check if Own record possible and check the list object for owner ID (maybe all lists will need to provide owner ID's?) - WidgetList should check if Own record possible and check the list object for owner ID (maybe all lists will need to provide owner ID's?)
- Delete should be checked - Delete should be checked
- CHANGE should be checked - CHANGE should be checked
- If no rights then should redirect back to HOME, NOT LOGIN!!! - DONE If no rights then should redirect back to HOME, NOT LOGIN!!!
- user with no rights = SubContractorLimited - DONE user with no rights = SubContractorLimited
- If user attempts to load widget form but has no rights to widget server returns the NO rights code but that is triggering back to login - TODO LIST OBJECT RESEARCH / DECISION
- Should it do this? Normally would not be an issue because it wouldn't open that form unless they saved or manually typed a link to it
- Technically it's incorrect, they don't have to login, they just can't get that record
- Have a look at why it's redirecting and decide if this is worth a change
- LIST OBJECT RESEARCH / DECISION
- TODO: ?? DECISION server widget lists and other lists - TODO: ?? DECISION server widget lists and other lists
- Either the list should show items with alternate icons to EDIT if they are read only or... - Either the list should show items with alternate icons to EDIT if they are read only or...
- Use a generic OPEN icon and link instead and user doesn't see status until they open it. - Use a generic OPEN icon and link instead and user doesn't see status until they open it.

View File

@@ -1,2 +1,5 @@
VUE COMMAND LINE INTERFACE VUE COMMAND LINE INTERFACE
run vue cli from anywhere run vue cli from anywhere
VUE GUI INTERFACE
run vue ui from project folder (or maybe anywhere not sure)

View File

@@ -497,6 +497,10 @@ export default {
if (newState.loading != undefined) { if (newState.loading != undefined) {
newState.vm.formState.loading = newState.loading; newState.vm.formState.loading = newState.loading;
} }
if (newState.readOnly != undefined) {
newState.vm.formState.readOnly = newState.readOnly;
}
}); });
} }
}; };

View File

@@ -18,6 +18,7 @@
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field <v-text-field
v-model="obj.name" v-model="obj.name"
:readonly="this.formState.readOnly"
clearable clearable
@click:clear="onChange('name')" @click:clear="onChange('name')"
:counter="255" :counter="255"
@@ -31,6 +32,7 @@
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field <v-text-field
v-model="obj.serial" v-model="obj.serial"
:readonly="this.formState.readOnly"
clearable clearable
@click:clear="onChange('serial')" @click:clear="onChange('serial')"
:counter="10" :counter="10"
@@ -44,6 +46,7 @@
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field <v-text-field
v-model="obj.count" v-model="obj.count"
:readonly="this.formState.readOnly"
clearable clearable
@click:clear="onChange('count')" @click:clear="onChange('count')"
:counter="10" :counter="10"
@@ -60,6 +63,7 @@
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field <v-text-field
v-model="obj.dollarAmount" v-model="obj.dollarAmount"
:readonly="this.formState.readOnly"
:prefix="this.$gzlocale.formats.currencySymbol" :prefix="this.$gzlocale.formats.currencySymbol"
:label="this.$gzlocale.get('WidgetDollarAmount')" :label="this.$gzlocale.get('WidgetDollarAmount')"
ref="dollarAmount" ref="dollarAmount"
@@ -75,6 +79,7 @@
<gz-date-time-picker <gz-date-time-picker
:label="this.$gzlocale.get('WidgetStartDate')" :label="this.$gzlocale.get('WidgetStartDate')"
v-model="obj.startDate" v-model="obj.startDate"
:readonly="this.formState.readOnly"
ref="startDate" ref="startDate"
:error-messages="this.$gzform.serverErrors(this,'startDate')" :error-messages="this.$gzform.serverErrors(this,'startDate')"
@change="onChange('startDate')" @change="onChange('startDate')"
@@ -82,11 +87,12 @@
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<gz-date-time-picker <gz-date-time-picker
:label="this.$gzlocale.get('WidgetEndDate')" :label="this.$gzlocale.get('WidgetEndDate')"
:rules="[this.$gzform.datePrecedence(this,'startDate','endDate')]" :rules="[this.$gzform.datePrecedence(this,'startDate','endDate')]"
:error-messages="this.$gzform.serverErrors(this,'endDate')" :error-messages="this.$gzform.serverErrors(this,'endDate')"
v-model="obj.endDate" v-model="obj.endDate"
:readonly="this.formState.readOnly"
ref="endDate" ref="endDate"
@change="onChange('endDate')" @change="onChange('endDate')"
></gz-date-time-picker> ></gz-date-time-picker>
@@ -94,6 +100,7 @@
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<v-checkbox <v-checkbox
v-model="obj.active" v-model="obj.active"
:readonly="this.formState.readOnly"
:label="this.$gzlocale.get('Active')" :label="this.$gzlocale.get('Active')"
ref="active" ref="active"
:error-messages="this.$gzform.serverErrors(this,'active')" :error-messages="this.$gzform.serverErrors(this,'active')"
@@ -104,6 +111,7 @@
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field <v-text-field
v-model="obj.roles" v-model="obj.roles"
:readonly="this.formState.readOnly"
:label="this.$gzlocale.get('WidgetRoles')" :label="this.$gzlocale.get('WidgetRoles')"
ref="roles" ref="roles"
:rules="[this.$gzform.integerValid(this,'roles'),this.$gzform.required(this,'roles')]" :rules="[this.$gzform.integerValid(this,'roles'),this.$gzform.required(this,'roles')]"
@@ -318,7 +326,7 @@ export default {
}, },
methods: { methods: {
onChange(ref) { onChange(ref) {
if (!this.formState.loading) { if (!this.formState.loading && !this.formState.readOnly) {
this.$gzform.onChange(this, ref); this.$gzform.onChange(this, ref);
} }
}, },
@@ -340,7 +348,8 @@ export default {
vm: vm, vm: vm,
dirty: false, dirty: false,
valid: true, valid: true,
loading: false loading: false,
readOnly: res.readOnly ? true : false
}); });
} }
}) })
@@ -370,18 +379,22 @@ export default {
vm.formState.serverError = res.error; vm.formState.serverError = res.error;
vm.$gzform.setErrorBoxErrors(vm); vm.$gzform.setErrorBoxErrors(vm);
} else { } else {
vm.$gzform.setFormState({
vm: vm,
dirty: false
});
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put //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.id) { if (res.id) {
//Handle "post" of new record //Handle "post" of new record
vm.obj = res.data; vm.obj = res.data;
vm.$gzform.setFormState({
vm: vm,
dirty: false,
readOnly: res.readOnly ? true : false
});
} else { } else {
//Handle "put" of an existing record //Handle "put" of an existing record
vm.obj.concurrencyToken = res.data.concurrencyToken; vm.obj.concurrencyToken = res.data.concurrencyToken;
vm.$gzform.setFormState({
vm: vm,
dirty: false
});
} }
} }
}) })