Add live colors to corpu sstatus

This commit is contained in:
Stephan Porada 2019-11-05 15:22:25 +01:00
parent f2024be050
commit d04f90dee8
3 changed files with 22 additions and 4 deletions

View File

@ -79,3 +79,8 @@ class CorpusList extends List {
);
}
}
CorpusList.STATUS_COLORS = {"unprepared": "grey",
"preparable": "orange",
"preparing": "yellow",
"prepared": "green",
"default": "red"};

View File

@ -113,7 +113,11 @@ JobList.SERVICE_COLORS = {"nlp": "blue",
JobList.SERVICE_ICONS = {"nlp": "format_textdirection_l_to_r",
"ocr": "find_in_page",
"default": "help"};
JobList.STATUS_COLORS = {"pending": "amber",
"running": "indigo",
"complete": "teal",
JobList.STATUS_COLORS = {"submitted": "blue",
"preparing": "light-blue",
"pending": "orange",
"running": "amber",
"complete": "green",
"stopping": "orange",
"removing": "deep-orange",
"default": "red"};

View File

@ -1,10 +1,19 @@
{% extends "limited_width.html.j2" %}
{% block page_content %}
<script>
setStatus(status) {
var statusElement;
statusElement = document.getElementById("status");
statusElement.classList.remove(...Object.values(CorpusList.STATUS_COLORS));
statusElement.classList.add(CorpusList.STATUS_COLORS[status] || CorpusList.STATUS_COLORS['default']);
statusElement.innerText = status;
}
</script>
<div class="col s12 m4">
<h3 id="title">{{ corpus.title }}</h3>
<p id="description">{{ corpus.description }}</p>
<a class="waves-effect waves-light btn">{{ corpus.status }}</a>
<a class="waves-effect waves-light btn" id="status">{{ corpus.status }}</a>
</div>
<div class="col s12 m8">