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

View File

@@ -8,11 +8,16 @@
<template v-if="showLicenseUi() == 'revoked'"> <template v-if="showLicenseUi() == 'revoked'">
Revoked license ui</template Revoked license ui</template
> >
<template v-if="showLicenseUi() == 'need'"> <template
v-if="
showLicenseUi() == 'needcantrial' ||
showLicenseUi() == 'neednotrial'
"
>
<v-col cols="12"> <v-col cols="12">
<h3 class="mb-6 ml-1">{{ $ay.t("NoLicenseTitle") }}</h3> <h3 class="mb-6 ml-1">{{ $ay.t("NoLicenseTitle") }}</h3>
<v-expansion-panels focusable> <v-expansion-panels focusable>
<v-expansion-panel> <v-expansion-panel v-if="showLicenseUi() == 'needcantrial'">
<v-expansion-panel-header>{{ <v-expansion-panel-header>{{
$ay.t("StartEvaluation") $ay.t("StartEvaluation")
}}</v-expansion-panel-header> }}</v-expansion-panel-header>
@@ -71,8 +76,9 @@
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col cols="12"> <v-col cols="12">
{{ sendRequestDisabled() }} <v-btn
<v-btn :disabled="sendRequestDisabled()" :disabled="sendRequestDisabled()"
@click="sendRequest()"
>$ay.t('SendRequest')</v-btn >$ay.t('SendRequest')</v-btn
> >
</v-col> </v-col>
@@ -159,9 +165,9 @@ export default {
}, },
licenseState: 0, licenseState: 0,
request: { request: {
Email: null, Email: "cardjohn@ayanova.com",
Company: null, Company: "Super TestCo",
Contact: null Contact: "Test Testerson"
}, },
obj: {}, obj: {},
formState: { formState: {
@@ -215,9 +221,14 @@ export default {
} }
*/ */
let licenseState = window.$gz.store.state.globalSettings.licenseStatus; let licenseState = window.$gz.store.state.globalSettings.licenseStatus;
//LICENSE STATUS: NONE, EXPIREDTRIAL, EXPIREDPURCHASE //LICENSE STATUS: NONE, EXPIREDTRIAL
if (licenseState == 0 || licenseState == 2 || licenseState == 4) { if (licenseState == 0 || licenseState == 2) {
return "need"; return "needcantrial";
}
//LICENSE STATUS: EXPIREDPURCHASE
if (licenseState == 4) {
return "neednotrial";
} }
//LICENSE STATE: REVOKED //LICENSE STATE: REVOKED
if (licenseState == 5) { if (licenseState == 5) {
@@ -240,6 +251,32 @@ export default {
"requestemail" "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() { translation() {
return window.$gz.translation; return window.$gz.translation;
}, },
@@ -463,7 +500,8 @@ function fetchTranslatedText(vm) {
"LicenseContactName", "LicenseContactName",
"LicenseEmail", "LicenseEmail",
"RequestEvaluationLicense", "RequestEvaluationLicense",
"LicenseEmailVerficationHint" "LicenseEmailVerficationHint",
"AdminEraseDatabaseWarning" //preexisting
]); ]);
} }