From 41c80588549bb7765f0df3d3aba523109f39d4fd Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 16 Jun 2020 17:47:50 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 3 +- ayanova/src/api/gzutil.js | 8 +++++ ayanova/src/views/ay-evaluate.vue | 52 +++++++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 08d6529e..a27ec9a6 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -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 diff --git a/ayanova/src/api/gzutil.js b/ayanova/src/api/gzutil.js index b30614ca..0dc0557b 100644 --- a/ayanova/src/api/gzutil.js +++ b/ayanova/src/api/gzutil.js @@ -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)); } /** diff --git a/ayanova/src/views/ay-evaluate.vue b/ayanova/src/views/ay-evaluate.vue index c9f7cfbd..4ab781cc 100644 --- a/ayanova/src/views/ay-evaluate.vue +++ b/ayanova/src/views/ay-evaluate.vue @@ -53,6 +53,7 @@ + /// Job status for opsjobs + /// + 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); } }