HUGE REFACTOR / CLEANUP

if there is a issue it's probably something in here that was changed
This commit is contained in:
2021-09-28 20:19:44 +00:00
parent 51eddfede9
commit d0afdd9855
238 changed files with 3127 additions and 8614 deletions

View File

@@ -96,7 +96,6 @@
$ay.t("CheckForLicense")
}}</v-btn>
</v-col>
<!-- </div> -->
</template>
<template
v-if="
@@ -221,17 +220,11 @@
</v-row>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
const FORM_KEY = "adm-license";
const API_BASE_URL = null;
const FORM_CUSTOM_TEMPLATE_KEY = null;
export default {
async created() {
let vm = this;
const vm = this;
try {
await initForm(vm);
vm.rights = window.$gz.role.getRights(window.$gz.type.License);
@@ -275,17 +268,13 @@ export default {
rights: window.$gz.role.getRights(window.$gz.type.License)
};
},
//WATCHERS
watch: {
formState: {
handler: function(val) {
//,oldval is available here too if necessary
if (this.formState.loading) {
return;
}
//enable / disable save button
let canSave = val.dirty && val.valid && !val.readOnly;
const canSave = val.dirty && val.valid && !val.readOnly;
if (canSave) {
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
} else {
@@ -358,7 +347,7 @@ export default {
]);
},
async sendEvaluationRequest() {
let vm = this;
const vm = this;
try {
if (this.dbIsEmpty != true) {
//Need to erase database
@@ -384,17 +373,14 @@ export default {
"license/permanently-erase-all-data",
"I understand"
);
//send request
r = await window.$gz.api.upsert("license/trialRequest", vm.request);
if (r.error) {
//throw new Error(r);
throw new Error(window.$gz.errorHandler.errorToString(r, vm));
}
//a string is returned and will start with E1 if it's an error
if (r.startsWith("E1")) {
throw new Error(window.$gz.errorHandler.errorToString(r, vm));
//throw new Error(r);
}
if (r == "ok") {
@@ -410,13 +396,12 @@ export default {
}
},
async fetchKey() {
let vm = this;
const vm = this;
try {
//check if we're still on the same "page" or the server has a different license
//It might have been just installed by the server on it's own so check if we are not working with the most current license
let currentServerLicenseInfo = await window.$gz.api.get("license");
if (currentServerLicenseInfo.error) {
//throw new Error(currentServerLicenseInfo.error);
throw new Error(
window.$gz.errorHandler.errorToString(currentServerLicenseInfo, vm)
);
@@ -433,22 +418,18 @@ export default {
vm.$router.push("/login");
return;
}
//call fetch key on server
let r = await window.$gz.api.upsert("license");
//r should just be a string response unless there is an error in which case it's an object
if (r.error) {
// throw new Error(r);
throw new Error(window.$gz.errorHandler.errorToString(r, vm));
}
if (r.startsWith("E1")) {
//throw new Error(r);
throw new Error(window.$gz.errorHandler.errorToString(r, vm));
}
//If here, there is no technical error
//key might not exist or be not found but no error so r contains the deets
if (r == "ok") {
//all ok, new key installed time to logout and back in
await window.$gz.dialog.displayLTModalNotificationMessage(
@@ -466,7 +447,7 @@ export default {
}
},
async erase() {
let vm = this;
const vm = this;
try {
if (this.dbIsEmpty != true) {
@@ -520,7 +501,7 @@ function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const m = window.$gz.menu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "fetch":
@@ -548,7 +529,7 @@ function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: true,
icon: "$ayiTicket",
title: "HelpLicense",
@@ -594,14 +575,12 @@ function generateMenu(vm) {
async function initForm(vm) {
await fetchTranslatedText(vm);
let res = await window.$gz.api.get("license");
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);
}
vm.currentLicenseInfo = res.data.license;
res = await window.$gz.api.get("license/database-empty");
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
return Promise.reject(res);
}