This commit is contained in:
2019-05-01 23:28:57 +00:00
parent b87d43b70d
commit 7ad284cf77
8 changed files with 192 additions and 91 deletions

View File

@@ -51,19 +51,16 @@ All platforms and browsers
- DONE Object...BUT with READONLY flag of some kind present (in outer wrapper??), so client knows to show read only and not allow editing
- DONE And client doesn't need to work out self owned etc
- DONE Object without readonly flag present so fully editable!!! WOOT!
- Form (AND THE LIST OBJECT) should check rights and adapt accordingly
- ReadFULL record but no change should show record read only
- To test use accounts: ReadFullRecord = AuthorizationRoles.BizAdminLimited | AuthorizationRoles.InventoryLimited
- WidgetList should check if even possible to read any part of record, if not then no link to edit
- 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
- CHANGE should be checked
- DONE If no rights then should redirect back to HOME, NOT LOGIN!!!
- DONE user with no rights = SubContractorLimited
- TODO LIST OBJECT RESEARCH / DECISION
- 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...
- Use a generic OPEN icon and link instead and user doesn't see status until they open it.
- ReadFULL record but no change should show record read only
- To test use accounts: ReadFullRecord = AuthorizationRoles.BizAdminLimited | AuthorizationRoles.InventoryLimited
- WidgetList should check if even possible to read any part of record, if not then no link to edit
- 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?)
- DONE BIG TODO: it would be far nicer if rights to objects were stored in a single JSON fragment that could be easily copied into javascript and c#
- DONE code automatically builds rights collection from json fragment so can use it between both projects and more easily update it in one central spot
- DONE Get that working then come back to the rest of the rights in client side
@@ -73,6 +70,7 @@ All platforms and browsers
- DONE was not calling promises correctly and not chaining them properly. Fixed
- Wire up delete menu item
- api code is stubbed out for delete, need to write that as well
- Need prompt, are you sure??
- DONE TODO navigating through menu doesn't "back" properly when clicking back on browser controls
- DONE widget form now not localized title at menu top

View File

@@ -3,3 +3,7 @@ run vue cli from anywhere
VUE GUI INTERFACE
run vue ui from project folder (or maybe anywhere not sure)
Dialogs and toasts etc:
https://www.npmjs.com/package/vuetify-dialog
Tested on phone, iPad, MSEDGE worked ok, probably fine, easy to use fuck it throwing it in

View File

@@ -4475,7 +4475,7 @@
},
"camelcase-keys": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
"resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz",
"integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=",
"dev": true,
"requires": {
@@ -7588,14 +7588,14 @@
"dev": true
},
"fsevents": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz",
"integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==",
"version": "1.2.9",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz",
"integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==",
"dev": true,
"optional": true,
"requires": {
"nan": "^2.9.2",
"node-pre-gyp": "^0.10.0"
"nan": "^2.12.1",
"node-pre-gyp": "^0.12.0"
},
"dependencies": {
"abbrev": {
@@ -7616,7 +7616,7 @@
"optional": true
},
"are-we-there-yet": {
"version": "1.1.4",
"version": "1.1.5",
"bundled": true,
"dev": true,
"optional": true,
@@ -7628,21 +7628,19 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"chownr": {
"version": "1.0.1",
"version": "1.1.1",
"bundled": true,
"dev": true,
"optional": true
@@ -7650,20 +7648,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@@ -7672,16 +7667,16 @@
"optional": true
},
"debug": {
"version": "2.6.9",
"version": "4.1.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ms": "2.0.0"
"ms": "^2.1.1"
}
},
"deep-extend": {
"version": "0.5.1",
"version": "0.6.0",
"bundled": true,
"dev": true,
"optional": true
@@ -7730,7 +7725,7 @@
}
},
"glob": {
"version": "7.1.2",
"version": "7.1.3",
"bundled": true,
"dev": true,
"optional": true,
@@ -7750,12 +7745,12 @@
"optional": true
},
"iconv-lite": {
"version": "0.4.21",
"version": "0.4.24",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safer-buffer": "^2.1.0"
"safer-buffer": ">= 2.1.2 < 3"
}
},
"ignore-walk": {
@@ -7780,8 +7775,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@@ -7793,7 +7787,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -7808,7 +7801,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -7819,16 +7811,16 @@
"dev": true
},
"minipass": {
"version": "2.2.4",
"version": "2.3.5",
"bundled": true,
"dev": true,
"requires": {
"safe-buffer": "^5.1.1",
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
}
},
"minizlib": {
"version": "1.1.0",
"version": "1.2.1",
"bundled": true,
"dev": true,
"optional": true,
@@ -7845,35 +7837,35 @@
}
},
"ms": {
"version": "2.0.0",
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
},
"needle": {
"version": "2.2.0",
"version": "2.3.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"debug": "^2.1.2",
"debug": "^4.1.0",
"iconv-lite": "^0.4.4",
"sax": "^1.2.4"
}
},
"node-pre-gyp": {
"version": "0.10.0",
"version": "0.12.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"detect-libc": "^1.0.2",
"mkdirp": "^0.5.1",
"needle": "^2.2.0",
"needle": "^2.2.1",
"nopt": "^4.0.1",
"npm-packlist": "^1.1.6",
"npmlog": "^4.0.2",
"rc": "^1.1.7",
"rc": "^1.2.7",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tar": "^4"
@@ -7890,13 +7882,13 @@
}
},
"npm-bundled": {
"version": "1.0.3",
"version": "1.0.6",
"bundled": true,
"dev": true,
"optional": true
},
"npm-packlist": {
"version": "1.1.10",
"version": "1.4.1",
"bundled": true,
"dev": true,
"optional": true,
@@ -7920,8 +7912,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@@ -7933,7 +7924,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@@ -7973,12 +7963,12 @@
"optional": true
},
"rc": {
"version": "1.2.7",
"version": "1.2.8",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"deep-extend": "^0.5.1",
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
@@ -8008,16 +7998,16 @@
}
},
"rimraf": {
"version": "2.6.2",
"version": "2.6.3",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"glob": "^7.0.5"
"glob": "^7.1.3"
}
},
"safe-buffer": {
"version": "5.1.1",
"version": "5.1.2",
"bundled": true,
"dev": true
},
@@ -8034,7 +8024,7 @@
"optional": true
},
"semver": {
"version": "5.5.0",
"version": "5.7.0",
"bundled": true,
"dev": true,
"optional": true
@@ -8055,7 +8045,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -8086,17 +8075,17 @@
"optional": true
},
"tar": {
"version": "4.4.1",
"version": "4.4.8",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"chownr": "^1.0.1",
"chownr": "^1.1.1",
"fs-minipass": "^1.2.5",
"minipass": "^2.2.4",
"minizlib": "^1.1.0",
"minipass": "^2.3.4",
"minizlib": "^1.1.1",
"mkdirp": "^0.5.0",
"safe-buffer": "^5.1.1",
"safe-buffer": "^5.1.2",
"yallist": "^3.0.2"
}
},
@@ -8107,12 +8096,12 @@
"optional": true
},
"wide-align": {
"version": "1.1.2",
"version": "1.1.3",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"string-width": "^1.0.2"
"string-width": "^1.0.2 || 2"
}
},
"wrappy": {
@@ -8121,7 +8110,7 @@
"dev": true
},
"yallist": {
"version": "3.0.2",
"version": "3.0.3",
"bundled": true,
"dev": true
}
@@ -8175,7 +8164,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
@@ -11651,7 +11640,7 @@
},
"meow": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
"resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz",
"integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=",
"dev": true,
"requires": {
@@ -11669,7 +11658,7 @@
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
}
@@ -11972,9 +11961,9 @@
}
},
"nan": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz",
"integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==",
"version": "2.13.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz",
"integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==",
"dev": true,
"optional": true
},
@@ -12091,7 +12080,7 @@
},
"semver": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
"resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
"integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=",
"dev": true
}
@@ -12214,7 +12203,7 @@
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
@@ -12249,7 +12238,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
@@ -14528,7 +14517,7 @@
},
"os-locale": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"dev": true,
"requires": {
@@ -14537,7 +14526,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
@@ -16682,6 +16671,11 @@
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz",
"integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ=="
},
"vue-asyncable": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/vue-asyncable/-/vue-asyncable-0.2.0.tgz",
"integrity": "sha512-AKuYhnjwMVrOgPct9WYbK4S7aMaHbWbznWY8IrCJsHS0pyEZc7lnpilJLGhH3MmRoQL43M0ofPJyHuxnu30McQ=="
},
"vue-cli-plugin-vuetify": {
"version": "0.4.6",
"resolved": "https://registry.npmjs.org/vue-cli-plugin-vuetify/-/vue-cli-plugin-vuetify-0.4.6.tgz",
@@ -16784,11 +16778,28 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"vuedl": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/vuedl/-/vuedl-0.3.0.tgz",
"integrity": "sha512-y+aYI7cvLfScwGlaGDx1HxCf+Ke8ZEoct98r/jr9ETMSg7dErYrBOxqJjFPWGQmj8rCM58XZ+hs02/3DL0sStw==",
"requires": {
"vue-asyncable": "^0.2.0"
}
},
"vuetify": {
"version": "1.5.14",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-1.5.14.tgz",
"integrity": "sha512-7iM+TfghR/wu/Gl+k37lKr0N8Ddr6SxzqHtoK1dIyHgCH6SJRkpaXPw2MC5/FsAg9aUDJbYNWrzSeu5eHw+Q/w=="
},
"vuetify-dialog": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/vuetify-dialog/-/vuetify-dialog-0.3.4.tgz",
"integrity": "sha512-tvMBTWO9b5hw9PKntQgwUYvfqcnCsX6cHa5VpZ1I0LFpPPB04gd2Oys2hMrueS8rUS++qBP+zdDSamOPU5z40g==",
"requires": {
"vue-asyncable": "^0.2.0",
"vuedl": "^0.3.0"
}
},
"vuex": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.1.0.tgz",

View File

@@ -19,6 +19,7 @@
"vue": "^2.6.10",
"vue-router": "^3.0.6",
"vuetify": "^1.5.14",
"vuetify-dialog": "^0.3.4",
"vuex": "^3.1.0",
"vuex-persistedstate": "^2.5.4"
},

View File

@@ -180,6 +180,14 @@ export default {
headers: this.postAuthorizedHeaders()
};
},
fetchRemoveOptions() {
/* REMOVE WITH AUTH */
return {
method: "delete",
mode: "cors",
headers: this.postAuthorizedHeaders()
};
},
APIUrl(apiPath) {
if ("" == store.state.apiUrl) {
//construct the api url and store it
@@ -292,6 +300,24 @@ export default {
handleError("UPSERT", error, route, reject);
});
});
},
///////////////////////////////////
// DELETE DATA FROM API SERVER
//
remove(route) {
var that = this;
return new Promise(function removeDataFromServer(resolve, reject) {
fetch(that.APIUrl(route), that.fetchRemoveOptions())
.then(that.status)
//.then(that.json)
.then(response => {
resolve(response);
})
.catch(function handleRemoveError(error) {
//fundamental error, can't proceed with this call
handleError("DELETE", error, route, reject);
});
});
}
//new functions above here

View File

@@ -502,5 +502,12 @@ export default {
newState.vm.formState.readOnly = newState.readOnly;
}
});
},
async confirm(vm) {
const res = await vm.$dialog.confirm({
text: "Do you really want to exit?",
title: "Warning"
});
return res;
}
};

View File

@@ -12,6 +12,8 @@ import NProgress from "nprogress";
import "nprogress/nprogress.css";
import dayjs from "dayjs";
import lodash from "./libs/lodash.min.js";
import VuetifyDialog from "vuetify-dialog";
//my libs
import gzeventbus from "./api/eventbus";
import gzmenu from "./api/gzmenu";
@@ -22,7 +24,6 @@ import gzform from "./api/gzform";
import roles from "./api/authorizationroles";
import gztype from "./api/ayatype";
import "@/assets/css/main.css";
import gzdateandtimepicker from "./components/gzdateandtimepicker.vue";
/////////////////////////////////////////////////////////////////
@@ -46,11 +47,6 @@ Object.defineProperty(Vue.prototype, "$gzdevmode", {
value: errorHandler.devMode
});
/////////////////////////////////////////////////////////////////
// FORM VALIDATION
//
//TODO: CODE THIS
/////////////////////////////////////////////////////////////////
// ERROR HANDLING
//
@@ -147,6 +143,11 @@ Vue.filter("boolastext", function vueFilterBoolAsText(value) {
//
Vue.component("gz-date-time-picker", gzdateandtimepicker);
////////////////////////////////////////////////////////
//3rd party ui components
//
Vue.use(VuetifyDialog);
/////////////////////////////////////////////////////////////////
// INSTANTIATE
//

View File

@@ -157,7 +157,7 @@
</template>
<script>
/* xeslint-disable */
/* eslint-disable */
/////////////////////////////
//
@@ -401,16 +401,69 @@ export default {
}
},
remove() {
//check rights
//Prompt:
//do the delete
alert("STUB: DELETE");
this.formState.loading = true;
var url = "Widget/" + this.$route.params.id;
//TODO: check if it's a new record (no ID) or one from server (has id)
var vm = this;
this.$gzform.deleteAllErrorBoxErrors(this);
this.$gzapi
.remove(url)
.then(res => {
if (res.error) {
vm.formState.serverError = res.error;
vm.$gzform.setErrorBoxErrors(vm);
} else {
//success, navigate backwards
vm.$router.go(-1);
}
})
.catch(function handleGetDataFromAPIError(error) {
//Update the form status
vm.$gzform.setFormState({
vm: vm,
loading: false
});
vm.$gzHandleFormError(error, vm);
});
},
duplicate() {
//this.$gzrole.getRights(this, this.$gztype.Widget, this.obj.ownerId);
this.$gzevent.$emit(
"popup-message",
"This is a test popup message\r\nDUPLICATE ALL THE THINGS!"
);
console.log("About to dialog");
this.$dialog.confirm({
text: "Do you really want to exit?",
title: "Warning"
}).then(res => {
console.log("The dialog result is:");
console.log(res);
});
//console.log(this.$gzform.confirm(this));
// this.$dialog.error({
// text: "Cannot delete this item",
// title: "Error"
// });
console.log("Done dialog");
// this.$dialog.notify.info("Test notification", {
// position: "top-right",
// timeout: 5000
// });
// this.$dialog.message.info("Test", {
// position: "top-left"
// });
// this.$gzevent.$emit(
// "popup-message",
// "This is a test popup message\r\nDUPLICATE ALL THE THINGS!"
// );
//only if not dirty
//check rights
//duplicate