Added color in web-index reprenting modules states.

pull/71/head
Mokaddem 2016-08-24 18:00:05 +02:00
parent 3313064e51
commit 611454ba82
2 changed files with 23 additions and 3 deletions

View File

@ -81,8 +81,22 @@ def event_stream():
def get_queues(r): def get_queues(r):
# We may want to put the llen in a pipeline to do only one query. # We may want to put the llen in a pipeline to do only one query.
return [(queue, int(card)) for queue, card in data = [(queue, int(card)) for queue, card in r.hgetall("queues").iteritems()]
r.hgetall("queues").iteritems()] newData = []
for queue, card in data:
key = "MODULE_" + queue
value = r.get(key)
if value is not None:
timestamp, path = value.split(", ")
if timestamp is not None:
startTime_readable = datetime.datetime.fromtimestamp(int(timestamp))
processed_time_readable = str((datetime.datetime.now() - startTime_readable)).split('.')[0]
seconds = int((datetime.datetime.now() - startTime_readable).total_seconds())
newData.append( (queue, card, seconds) )
else:
newData.append( (queue, cards, 0) )
return newData
def list_len(s): def list_len(s):

View File

@ -221,11 +221,17 @@ function create_queue_table() {
for(i = 0; i < (glob_tabvar.row1).length;i++){ for(i = 0; i < (glob_tabvar.row1).length;i++){
var tr = document.createElement('TR') var tr = document.createElement('TR')
for(j = 0; j < (glob_tabvar.row1[i]).length; j++){ for(j = 0; j < 2; j++){
var td = document.createElement('TD') var td = document.createElement('TD')
td.appendChild(document.createTextNode(glob_tabvar.row1[i][j])); td.appendChild(document.createTextNode(glob_tabvar.row1[i][j]));
tr.appendChild(td) tr.appendChild(td)
} }
if (parseInt(glob_tabvar.row1[i][2]) > 60*1 && parseInt(glob_tabvar.row1[i][1]) > 2)
tr.className += " danger";
else if (parseInt(glob_tabvar.row1[i][2]) > 60*1)
tr.className += " warning";
else
tr.className += " success";
tableBody.appendChild(tr); tableBody.appendChild(tr);
} }
Tablediv.appendChild(table); Tablediv.appendChild(table);