Commit c65bd62d authored by Romain Loth's avatar Romain Loth

[FIX] project view: minor adjustments to real time progressbar

parent 30b3c871
...@@ -383,8 +383,8 @@ QUERY_SIZE_N_MAX = 1000 ...@@ -383,8 +383,8 @@ QUERY_SIZE_N_MAX = 1000
QUERY_SIZE_N_DEFAULT = 1000 QUERY_SIZE_N_DEFAULT = 1000
# Refresh corpora workflow status for project view's progressbar # Refresh corpora workflow status for project view's progressbar
PROJECT_VIEW_REFRESH_INTERVAL = 3000 # in ms PROJECT_VIEW_REFRESH_INTERVAL = 3000 # 1st refresh in ms (then increasing arithmetically)
PROJECT_VIEW_MAX_REFRESH_ATTEMPTS = 5 # how many times before we give up PROJECT_VIEW_MAX_REFRESH_ATTEMPTS = 10 # how many times before we give up
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Graph <=> nodes API parameters # Graph <=> nodes API parameters
......
...@@ -101,15 +101,14 @@ ...@@ -101,15 +101,14 @@
<div class="col-md-3 content" id="corpus_{{corpus.id}}_tools"> <div class="col-md-3 content" id="corpus_{{corpus.id}}_tools">
{% for state in corpus.hyperdata.statuses %} {% for state in corpus.hyperdata.statuses %}
{% ifequal state.action "Workflow" %} {% ifequal state.action "Workflow" %}
{% if state.complete %} <a class="{% if not state.complete %}hidden{% endif %}"
href="/projects/{{project.id}}/corpora/{{corpus.id}}" title="View the corpus">
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}" title="View the corpus">
<button type="button" class="btn btn-default" aria-label="Left Align"> <button type="button" class="btn btn-default" aria-label="Left Align">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
</button> </button>
</a> </a>
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom" data-trigger="focus" <button type="button" class="btn btn-default {% if not state.complete %}hidden{% endif %}" data-container="body" data-toggle="popover" data-placement="bottom" data-trigger="focus"
data-content=" data-content="
<ul> <ul>
<li <li
...@@ -121,7 +120,6 @@ ...@@ -121,7 +120,6 @@
<span class="glyphicon glyphicon-repeat" aria-hidden="true" <span class="glyphicon glyphicon-repeat" aria-hidden="true"
title='Recalculate ngram scores and similarities'></span> title='Recalculate ngram scores and similarities'></span>
</button> </button>
{% endif %}
<!-- TODO: delete non seulement si state.complete mais aussi si state.error --> <!-- TODO: delete non seulement si state.complete mais aussi si state.error -->
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom" <button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
...@@ -845,15 +843,25 @@ ...@@ -845,15 +843,25 @@
// 0 is status of whole WORKFLOW // 0 is status of whole WORKFLOW
var statusW = statuses[0] var statusW = statuses[0]
if (statusW.complete) { if (statusW.complete) {
// show checkbox
$('#corpus_'+crid+'_status').html( $('#corpus_'+crid+'_status').html(
'<span id="corpus_'+crid+'_status_ok" ' '<span id="corpus_'+crid+'_status_ok" '
+ ' class="glyphicon glyphicon-ok"></span>' + ' class="glyphicon glyphicon-ok"></span>'
) )
// show all tools
var cTools = document.getElementById('corpus_'+crid+'_tools').children
for (var i in cTools) {
var elt = cTools[i]
if (elt.classList) {
elt.classList.remove("hidden")
}
}
} }
// workflow incomplete: we check each action in [1,4] // workflow incomplete: we check each action in [1,4]
else { else {
var subStatuses = statuses.slice(1,5) var subStatuses = statuses.slice(1,5)
console.warn(subStatuses) // console.warn(subStatuses)
for (var j in subStatuses) { for (var j in subStatuses) {
// stepName parmi 'Docs','Ngrams','Index','Lists' // stepName parmi 'Docs','Ngrams','Index','Lists'
var stepOk = subStatuses[j]['complete'] var stepOk = subStatuses[j]['complete']
...@@ -881,15 +889,16 @@ ...@@ -881,15 +889,16 @@
// normal cases: update progressbar ------------ // normal cases: update progressbar ------------
else { else {
progressbar = document.getElementById(pgbarId) var progressbar = document.getElementById(pgbarId)
if (progressbar) { if (progressbar) {
// console.log('updating '+pgbarId) console.log('updating '+pgbarId, "stepOk:", stepOk)
// A: done // A: done
if (stepOk || stepOk == "true") { if (stepOk || stepOk == "true") {
// make progressbar segment green // make progressbar segment green
if (progressbar.class && progressbar.class.match('active')) { if (progressbar.className
&& progressbar.className.match('active')) {
progressbar.classList.remove("active") progressbar.classList.remove("active")
progressbar.classList.add("progress-bar-success") progressbar.classList.add("progress-bar-success")
} }
...@@ -903,14 +912,13 @@ ...@@ -903,14 +912,13 @@
} }
// C: new action => new bar segment // C: new action => new bar segment
else { else {
// console.log('creating '+pgbarId) console.log('creating '+pgbarId)
barSegmentHtml = '<div class="progress-bar progress-bar-striped' barSegmentHtml = '<div class="progress-bar progress-bar-striped'
barSegmentHtml += (stepOk ? ' progress-bar-success' : ' active') + '"' barSegmentHtml += (stepOk ? ' progress-bar-success' : ' active') + '"'
barSegmentHtml += 'role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100"' barSegmentHtml += 'role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100"'
barSegmentHtml += 'id="corpus_'+crid+'_status_'+stepName+'" style="width: 20%">' barSegmentHtml += 'id="corpus_'+crid+'_status_'+stepName+'" style="width: 20%">'
barSegmentHtml += '<span>'+stepName barSegmentHtml += '<span>'+stepName
barSegmentHtml += (stepOk ? 'Processing' : '')
barSegmentHtml += '</span></div>' barSegmentHtml += '</span></div>'
$('#corpus_'+crid+'_status > .progress') $('#corpus_'+crid+'_status > .progress')
...@@ -1002,7 +1010,7 @@ ...@@ -1002,7 +1010,7 @@
} }
} }
else { else {
console.warn("OK, all corpora ingestion complete") console.info("OK, all corpora ingestion complete")
nChecks = 0 nChecks = 0
return true return true
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment