From ea3416af4c7b7d146ec13f6f5b95f95f1a4e8527 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Mon, 11 Jan 2021 15:43:15 +0100
Subject: [PATCH] Add build and analyze button
---
.../js/nopaque/displays/CorpusDisplay.js | 21 ++++++++++++-------
web/app/templates/corpora/corpus.html.j2 | 4 ++--
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/web/app/static/js/nopaque/displays/CorpusDisplay.js b/web/app/static/js/nopaque/displays/CorpusDisplay.js
index fb98e2bc..2050ed49 100644
--- a/web/app/static/js/nopaque/displays/CorpusDisplay.js
+++ b/web/app/static/js/nopaque/displays/CorpusDisplay.js
@@ -47,17 +47,24 @@ class CorpusDisplay extends RessourceDisplay {
}
setStatus(status) {
- for (let element of this.displayElement.querySelectorAll('.corpus-status')) {this.setElement(element, status);}
- for (let element of this.displayElement.querySelectorAll('.status')) {element.dataset.status = status;}
- for (let element of this.displayElement.querySelectorAll('.status-spinner')) {
- if (['complete', 'failed', 'unprepared'].includes(status)) {
- element.classList.add('hide');
+ for (let element of this.displayElement.querySelectorAll('.analyse-corpus-trigger')) {
+ if (['analysing', 'prepared', 'start analysis'].includes(status)) {
+ element.classList.remove('disabled');
} else {
- element.classList.remove('hide');
+ element.classList.add('disabled');
}
}
for (let element of this.displayElement.querySelectorAll('.build-corpus-trigger')) {
- if (['complete', 'failed'].includes(status)) {
+ if (status === 'unprepared') {
+ element.classList.remove('disabled');
+ } else {
+ element.classList.add('disabled');
+ }
+ }
+ for (let element of this.displayElement.querySelectorAll('.corpus-status')) {this.setElement(element, status);}
+ for (let element of this.displayElement.querySelectorAll('.status')) {element.dataset.status = status;}
+ for (let element of this.displayElement.querySelectorAll('.status-spinner')) {
+ if (['submitted', 'queued', 'running', 'canceling', 'start analysis', 'stop analysis'].includes(status)) {
element.classList.remove('hide');
} else {
element.classList.add('hide');
diff --git a/web/app/templates/corpora/corpus.html.j2 b/web/app/templates/corpora/corpus.html.j2
index c6695603..7c1d5730 100644
--- a/web/app/templates/corpora/corpus.html.j2
+++ b/web/app/templates/corpora/corpus.html.j2
@@ -70,8 +70,8 @@