vigiboard / vigiboard / controllers / vigiboard_plugin / shn.py @ 19e88cb8
History | View | Annotate | Download (1 KB)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
# vim:set expandtab tabstop=4 shiftwidth=4:
|
3 |
|
4 |
from vigiboard.controllers.vigiboard_plugin import \ |
5 |
VigiboardRequestPlugin
|
6 |
from vigicore.model import ServiceHautNiveau, Events |
7 |
from sqlalchemy import sql, asc |
8 |
from pylons.i18n import ugettext as _ |
9 |
|
10 |
class PluginSHN (VigiboardRequestPlugin): |
11 |
|
12 |
"""
|
13 |
Plugin permettant de rajouter le nombre de SHNs impactés à
|
14 |
l'affichage
|
15 |
"""
|
16 |
|
17 |
def __init__(self): |
18 |
super(PluginSHN,self).__init__( |
19 |
table = [ServiceHautNiveau.servicename_dep, |
20 |
sql.func.count(Events.idevent)], |
21 |
outerjoin = [(ServiceHautNiveau, |
22 |
ServiceHautNiveau.servicename_dep == Events.servicename)], |
23 |
groupby = [(Events),(ServiceHautNiveau.servicename_dep)], |
24 |
name = _(u'SHNs impacté'),
|
25 |
style = {'style':'text-align:center'} |
26 |
) |
27 |
|
28 |
def show(self, req): |
29 |
"""Fonction d'affichage"""
|
30 |
if req[1] : |
31 |
return req[2] |
32 |
else :
|
33 |
return None |