Revision 6892ebac
Séparation des historiques lors de l'affichage de plusieurs évènements
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@526 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/controllers/vigiboardrequest.py | ||
---|---|---|
309 | 309 |
event, |
310 | 310 |
{'class': class_tr[i%2]}, |
311 | 311 |
{'class' : self.bouton_severity[event.severity] + \ |
312 |
self.class_ack[event.status], |
|
313 |
'style' : 'text-align: center'}, |
|
312 |
self.class_ack[event.status]}, |
|
314 | 313 |
{'class' : self.bouton_severity[event.severity] + \ |
315 | 314 |
self.class_ack[event.status] }, |
316 | 315 |
{'src' : '/images/%s2.png' % \ |
... | ... | |
351 | 350 |
).filter(EventHistory.idevent.in_(self.idevents) |
352 | 351 |
).order_by(desc(EventHistory.timestamp) |
353 | 352 |
).order_by(desc(EventHistory.idhistory)) |
354 |
|
|
353 |
print history |
|
355 | 354 |
if history.count() == 0: |
356 | 355 |
self.hist = [] |
357 | 356 |
return |
358 |
hists = []
|
|
357 |
hists = {}
|
|
359 | 358 |
i = 0 |
360 | 359 |
class_tr = ['odd', 'even'] |
361 | 360 |
hostname = self.events[1][0].hostname |
362 | 361 |
servicename = self.events[1][0].servicename |
363 |
|
|
362 |
hist_tmp = [] |
|
363 |
last_idevent = history[0].idevent |
|
364 | 364 |
for hist in history : |
365 |
|
|
366 |
if last_idevent != hist.idevent: |
|
367 |
hists[last_idevent] = hist_tmp |
|
368 |
last_idevent = hist.idevent |
|
369 |
hist_tmp = [] |
|
365 | 370 |
|
366 | 371 |
# La liste pour l'historique actuel comporte dans l'ordre : |
367 |
# Son identifiant |
|
368 |
# Son nom d'hôte |
|
369 |
# Son nom de service |
|
370 | 372 |
# Le moment où il a été généré |
371 | 373 |
# Qui l'a généré |
372 | 374 |
# Le type d'action qui a été appliqué |
... | ... | |
377 | 379 |
# La classe de la sévérité s'il y a |
378 | 380 |
|
379 | 381 |
if hist.value : |
380 |
hists.append([ |
|
381 |
hist.idhistory, |
|
382 |
hostname, |
|
383 |
servicename, |
|
382 |
hist_tmp.append([ |
|
384 | 383 |
hist.timestamp, |
385 | 384 |
hist.username, |
386 | 385 |
hist.type_action, |
... | ... | |
390 | 389 |
{'class':self.class_severity[min(int(hist.value),7)]} |
391 | 390 |
]) |
392 | 391 |
else: |
393 |
hists.append([ |
|
394 |
hist.idhistory, |
|
395 |
hostname, |
|
396 |
servicename, |
|
392 |
hist_tmp.append([ |
|
397 | 393 |
hist.timestamp, |
398 | 394 |
hist.username, |
399 | 395 |
hist.type_action, |
... | ... | |
404 | 400 |
]) |
405 | 401 |
i = i + 1 |
406 | 402 |
|
403 |
hists[last_idevent] = hist_tmp |
|
407 | 404 |
self.hist = hists |
408 | 405 |
|
409 | 406 |
def generate_tmpl_context(self): |
Also available in: Unified diff