From db7e822dda56d32135eca6d3e3211a50cf93d31a Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Thu, 16 Jun 2022 22:09:39 +0200 Subject: feat: Add one more state Add a new state to the worker so it can better report what is happening. Also added a status report in the index page. --- templates/_footer.tmpl | 14 ++++++++++++++ templates/_head.tmpl | 1 + templates/index.tmpl | 4 ++++ 3 files changed, 19 insertions(+) (limited to 'templates') diff --git a/templates/_footer.tmpl b/templates/_footer.tmpl index 07bc857..97a5bf8 100644 --- a/templates/_footer.tmpl +++ b/templates/_footer.tmpl @@ -8,6 +8,20 @@ window.location.href = '/' }); } + + function getStatus() { + fetch("/jobs/", { method: 'GET'}) + .then((res) => { return objs = res.json(); }) + .then((objs) => { + for (i in objs) { + span = document.getElementById("status_"+objs[i].Id); + span.textContent = objs[i].Status; + } + }); + } + +setInterval(getStatus, 1000); + diff --git a/templates/_head.tmpl b/templates/_head.tmpl index 2bb58c4..b99510f 100644 --- a/templates/_head.tmpl +++ b/templates/_head.tmpl @@ -2,6 +2,7 @@ + diff --git a/templates/index.tmpl b/templates/index.tmpl index 9bb7512..ae7f674 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -8,6 +8,7 @@ Title Link Output + Status @@ -18,6 +19,9 @@ {{ .Title }} {{ .Link }} {{ .OutputFolder }} + + + Edit -- cgit v1.2.3