HUGE REFACTOR / CLEANUP
if there is a issue it's probably something in here that was changed
This commit is contained in:
@@ -102,24 +102,16 @@
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Xeslint-disable */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const FORM_KEY = "ay-evaluate";
|
||||
export default {
|
||||
async created() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
try {
|
||||
await initForm(vm);
|
||||
|
||||
vm.obj.timeZoneOffset =
|
||||
Math.floor(new Date().getTimezoneOffset() / 60) * -1;
|
||||
//get rights to generate sample data and erase db I guess
|
||||
vm.rights = window.$gz.role.getRights(window.$gz.type.TrialSeeder);
|
||||
//set form readonly if it's so
|
||||
vm.formState.readOnly = !vm.rights.change;
|
||||
generateMenu(vm);
|
||||
vm.formState.ready = true;
|
||||
@@ -130,7 +122,6 @@ export default {
|
||||
window.$gz.errorHandler.handleFormError(err, vm);
|
||||
}
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||
},
|
||||
@@ -160,7 +151,6 @@ export default {
|
||||
rights: window.$gz.role.fullRightsObject()
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
form() {
|
||||
return window.$gz.form;
|
||||
@@ -180,7 +170,7 @@ export default {
|
||||
return window.$gz.menu.contactSupportUrl();
|
||||
},
|
||||
async generate() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
|
||||
if (vm.formState.readOnly) {
|
||||
window.$gz.eventBus.$emit(
|
||||
@@ -197,7 +187,6 @@ export default {
|
||||
if (dialogResult == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
dialogResult = await window.$gz.dialog.confirmGeneric(
|
||||
"AdminEraseDatabaseLastWarning",
|
||||
"error"
|
||||
@@ -205,41 +194,22 @@ export default {
|
||||
if (dialogResult == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
//call seed route
|
||||
let jobId = await window.$gz.api.upsert(
|
||||
`trial/seed/${vm.obj.seedLevel}/${vm.obj.timeZoneOffset}`
|
||||
);
|
||||
if (jobId.error) {
|
||||
//throw new Error(jobId.error);
|
||||
throw new Error(window.$gz.errorHandler.errorToString(jobId, vm));
|
||||
}
|
||||
jobId = jobId.jobId; //it's in a sub key
|
||||
//indicate loading by setting on button
|
||||
jobId = jobId.jobId;
|
||||
vm.seedingJobActive = true;
|
||||
|
||||
/* /// <summary>
|
||||
/// Job status for opsjobs
|
||||
/// </summary>
|
||||
public enum JobStatus : int
|
||||
{
|
||||
Absent=0,
|
||||
Sleeping = 1,
|
||||
Running = 2,
|
||||
Completed = 3,
|
||||
Failed = 4
|
||||
} */
|
||||
let jobStatus = 1;
|
||||
//get status
|
||||
|
||||
while (vm.seedingJobActive == true) {
|
||||
await window.$gz.util.sleepAsync(2000);
|
||||
//check if done
|
||||
jobStatus = await window.$gz.api.get(
|
||||
`job-operations/status/${jobId}`
|
||||
);
|
||||
if (jobStatus.error) {
|
||||
//throw new Error(jobStatus.error);
|
||||
throw new Error(
|
||||
window.$gz.errorHandler.errorToString(jobStatus, vm)
|
||||
);
|
||||
@@ -252,8 +222,6 @@ export default {
|
||||
vm.seedingJobActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Here if it's completed successfully
|
||||
window.$gz.eventBus.$emit("notify-success", vm.$ay.t("JobCompleted"));
|
||||
vm.$router.push("/login");
|
||||
} catch (error) {
|
||||
@@ -272,7 +240,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) {
|
||||
default:
|
||||
@@ -288,7 +256,7 @@ function clickHandler(menuItem) {
|
||||
//
|
||||
//
|
||||
function generateMenu(vm) {
|
||||
let menuOptions = {
|
||||
const menuOptions = {
|
||||
isMain: true,
|
||||
icon: "$ayiRocket",
|
||||
title: "Evaluate",
|
||||
|
||||
Reference in New Issue
Block a user