Add build and analyze button

This commit is contained in:
Patrick Jentsch 2021-01-11 15:43:15 +01:00
parent 84ae5fd22a
commit ea3416af4c
2 changed files with 16 additions and 9 deletions

View File

@ -47,17 +47,24 @@ class CorpusDisplay extends RessourceDisplay {
} }
setStatus(status) { setStatus(status) {
for (let element of this.displayElement.querySelectorAll('.corpus-status')) {this.setElement(element, status);} for (let element of this.displayElement.querySelectorAll('.analyse-corpus-trigger')) {
for (let element of this.displayElement.querySelectorAll('.status')) {element.dataset.status = status;} if (['analysing', 'prepared', 'start analysis'].includes(status)) {
for (let element of this.displayElement.querySelectorAll('.status-spinner')) { element.classList.remove('disabled');
if (['complete', 'failed', 'unprepared'].includes(status)) {
element.classList.add('hide');
} else { } else {
element.classList.remove('hide'); element.classList.add('disabled');
} }
} }
for (let element of this.displayElement.querySelectorAll('.build-corpus-trigger')) { 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'); element.classList.remove('hide');
} else { } else {
element.classList.add('hide'); element.classList.add('hide');

View File

@ -70,8 +70,8 @@
</div> </div>
</div> </div>
<div class="card-action right-align"> <div class="card-action right-align">
<a class="btn disabled hide waves-effect waves-light" href="{{ url_for('corpora.analyse_corpus', corpus_id=corpus.id) }}"><i class="material-icons left">search</i>Analyze</a> <a class="analyse-corpus-trigger btn disabled waves-effect waves-light" href="{{ url_for('corpora.analyse_corpus', corpus_id=corpus.id) }}"><i class="material-icons left">search</i>Analyze</a>
<a class="btn disabled hide waves-effect waves-light" href="{{ url_for('corpora.prepare_corpus', corpus_id=corpus.id) }}"><i class="material-icons left">build</i>Build</a> <a class="btn build-corpus-trigger disabled waves-effect waves-light" href="{{ url_for('corpora.prepare_corpus', corpus_id=corpus.id) }}"><i class="material-icons left">build</i>Build</a>
<a class="btn hide waves-effect waves-light" id="corpus-export"><i class="material-icons left">import_export</i>Export Corpus</a> <a class="btn hide waves-effect waves-light" id="corpus-export"><i class="material-icons left">import_export</i>Export Corpus</a>
<a class="btn modal-trigger red waves-effect waves-light" data-target="delete-corpus-modal"><i class="material-icons left">delete</i>Delete</a> <a class="btn modal-trigger red waves-effect waves-light" data-target="delete-corpus-modal"><i class="material-icons left">delete</i>Delete</a>
</div> </div>