This commit is contained in:
@@ -5,7 +5,8 @@ PRIORITY - ALWAYS Lowest level stuff first, i.e. TODO at server, api route chang
|
||||
WIFI change 5g channel to 52,56,60 and 2g channel to 8
|
||||
recheck before doing as it seems to vary, maybe someone else's is auto switching
|
||||
|
||||
|
||||
todo: trial mode login form shouldn't be offered unless there are sample users
|
||||
todo: auto generate sample trial data small on new db created?
|
||||
|
||||
todo: Evaluate UI
|
||||
Goes to root level Evaluation page on login
|
||||
|
||||
@@ -365,6 +365,14 @@ export default {
|
||||
//
|
||||
isImageAttachment: function(fileName, mimeType) {
|
||||
return this.iconForFile(fileName, mimeType) == "fa-file-image";
|
||||
},
|
||||
///////////////////////////////////////////////
|
||||
// Sleep async
|
||||
//
|
||||
sleepAsync: function(milliseconds) {
|
||||
console.log("sleep async");
|
||||
// eslint-disable-next-line
|
||||
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
|
||||
<v-col cols="12">
|
||||
<v-btn
|
||||
:loading="seedingJobActive"
|
||||
:disabled="formState.readOnly"
|
||||
@click="generate()"
|
||||
class="my-8 mr-4"
|
||||
@@ -102,6 +103,7 @@ export default {
|
||||
selectLists: {
|
||||
seedLevels: []
|
||||
},
|
||||
seedingJobActive: false,
|
||||
obj: {
|
||||
seedLevel: "small",
|
||||
timeZoneOffset: 0
|
||||
@@ -149,7 +151,7 @@ export default {
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
}
|
||||
if (res.data != false) {
|
||||
if (res.data != true) {
|
||||
let dialogResult = await window.$gz.dialog.confirmGeneric(
|
||||
"AdminEraseDatabaseWarning",
|
||||
"warning"
|
||||
@@ -172,12 +174,56 @@ export default {
|
||||
);
|
||||
}
|
||||
|
||||
//notice about what's going to happen
|
||||
//maybe some kind of ui to determine if a job is running or not?
|
||||
//a job monitoring ui dialog or something would be ideal
|
||||
|
||||
//call seed route
|
||||
await window.$gz.api.upsertEx(
|
||||
let jobId = await window.$gz.api.upsertEx(
|
||||
`trial/seed/${vm.obj.seedLevel}/${vm.obj.timeZoneOffset}`
|
||||
);
|
||||
//ideally some kind of job checking ui showing feedback would be nice
|
||||
|
||||
//indicate loading by setting on button
|
||||
|
||||
vm.seedingJobActive = true;
|
||||
|
||||
console.log("Jobid is", jobId);
|
||||
/* /// <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) {
|
||||
console.log(
|
||||
"top of while loop about to sleep 5 seconds seeding job active=",
|
||||
vm.seedingJobActive
|
||||
);
|
||||
|
||||
await window.$gz.util.sleepAsync(5000);
|
||||
console.log("back from sleep checking job");
|
||||
//check if done
|
||||
jobStatus = await window.$gz.api.get(
|
||||
`job-operations/status/${jobId}`
|
||||
);
|
||||
console.log(`Job status is ${jobStatus}`);
|
||||
if (jobStatus == 4 || jobStatus == 0) {
|
||||
throw "Seeding job failed";
|
||||
}
|
||||
if (jobStatus == 3) {
|
||||
vm.seedingJobActive = false;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
vm.seedingJobActive = false;
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user