This commit is contained in:
2020-06-12 18:53:48 +00:00
parent c81b55c000
commit e6f3d324e2
2 changed files with 66 additions and 15 deletions

View File

@@ -57,7 +57,11 @@ function handleError(action, error, route, reject) {
window.$gz.translation.get("ErrorUserNotAuthorized")
);
router.push(window.$gz.store.state.homePage);
return reject("[ErrorUserNotAuthorized]");
if (reject) {
return reject("[ErrorUserNotAuthorized]");
} else {
throw "[ErrorUserNotAuthorized]";
}
}
//Handle 401 not authenticated
@@ -72,7 +76,11 @@ function handleError(action, error, route, reject) {
);
auth.logout();
router.push("/login");
return reject("[ErrorUserNotAuthenticated]");
if (reject) {
return reject("[ErrorUserNotAuthenticated]");
} else {
throw "[ErrorUserNotAuthenticated]";
}
}
//is it a network error?
@@ -96,7 +104,12 @@ function handleError(action, error, route, reject) {
window.$gz.eventBus.$emit("notify-error", msg);
//note: using translation key in square brackets
return reject(msg);
if (reject) {
return reject(msg);
} else {
throw msg;
}
//throw "Error: unable to contact server";
}
}
@@ -460,7 +473,7 @@ export default {
r = await that.extractBodyEx(r);
return r;
} catch (error) {
handleError("UPSERT", error, route, reject);
handleError("UPSERT", error, route);
}
},
upsert(route, data) {

View File

@@ -8,11 +8,16 @@
<template v-if="showLicenseUi() == 'revoked'">
Revoked license ui</template
>
<template v-if="showLicenseUi() == 'need'">
<template
v-if="
showLicenseUi() == 'needcantrial' ||
showLicenseUi() == 'neednotrial'
"
>
<v-col cols="12">
<h3 class="mb-6 ml-1">{{ $ay.t("NoLicenseTitle") }}</h3>
<v-expansion-panels focusable>
<v-expansion-panel>
<v-expansion-panel v-if="showLicenseUi() == 'needcantrial'">
<v-expansion-panel-header>{{
$ay.t("StartEvaluation")
}}</v-expansion-panel-header>
@@ -71,8 +76,9 @@
></v-text-field>
</v-col>
<v-col cols="12">
{{ sendRequestDisabled() }}
<v-btn :disabled="sendRequestDisabled()"
<v-btn
:disabled="sendRequestDisabled()"
@click="sendRequest()"
>$ay.t('SendRequest')</v-btn
>
</v-col>
@@ -159,9 +165,9 @@ export default {
},
licenseState: 0,
request: {
Email: null,
Company: null,
Contact: null
Email: "cardjohn@ayanova.com",
Company: "Super TestCo",
Contact: "Test Testerson"
},
obj: {},
formState: {
@@ -215,9 +221,14 @@ export default {
}
*/
let licenseState = window.$gz.store.state.globalSettings.licenseStatus;
//LICENSE STATUS: NONE, EXPIREDTRIAL, EXPIREDPURCHASE
if (licenseState == 0 || licenseState == 2 || licenseState == 4) {
return "need";
//LICENSE STATUS: NONE, EXPIREDTRIAL
if (licenseState == 0 || licenseState == 2) {
return "needcantrial";
}
//LICENSE STATUS: EXPIREDPURCHASE
if (licenseState == 4) {
return "neednotrial";
}
//LICENSE STATE: REVOKED
if (licenseState == 5) {
@@ -240,6 +251,32 @@ export default {
"requestemail"
]);
},
async sendRequest() {
let vm = this;
try {
//Only no key or expired trial are here, not expired purchase
//so safe to erase
let dialogResult = await window.$gz.dialog.confirmGeneric(
"AdminEraseDatabaseWarning"
);
if (dialogResult == false) {
return;
}
//call erase
let r = await window.$gz.api.upsertEx(
"license/permanently-erase-all-data",
"I understand"
);
//send request
r = await window.$gz.api.upsertEx("license/trialRequest", vm.request);
console.log(r);
//then another message box saying watch your email to verify
} catch (error) {
window.$gz.errorHandler.handleFormError(error, vm);
}
},
translation() {
return window.$gz.translation;
},
@@ -463,7 +500,8 @@ function fetchTranslatedText(vm) {
"LicenseContactName",
"LicenseEmail",
"RequestEvaluationLicense",
"LicenseEmailVerficationHint"
"LicenseEmailVerficationHint",
"AdminEraseDatabaseWarning" //preexisting
]);
}