vigiboard / vigiboard / controllers / plugins / status.py @ 0f0e32ed
History | View | Annotate | Download (2.38 KB)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
# vim:set expandtab tabstop=4 shiftwidth=4:
|
3 |
################################################################################
|
4 |
#
|
5 |
# Copyright (C) 2007-2011 CS-SI
|
6 |
#
|
7 |
# This program is free software; you can redistribute it and/or modify
|
8 |
# it under the terms of the GNU General Public License version 2 as
|
9 |
# published by the Free Software Foundation.
|
10 |
#
|
11 |
# This program is distributed in the hope that it will be useful,
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
# GNU General Public License for more details.
|
15 |
#
|
16 |
# You should have received a copy of the GNU General Public License
|
17 |
# along with this program; if not, write to the Free Software
|
18 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
19 |
################################################################################
|
20 |
|
21 |
"""
|
22 |
Un plugin pour VigiBoard qui ajoute 3 colonnes au tableau des événements :
|
23 |
- la première colonne contient l'état d'acquittement de l'événement.
|
24 |
- la seconde colonne contient un lien permettant d'éditer certaines
|
25 |
propriétés associées à l'événement corrélé.
|
26 |
- la dernière colonne permet de (dé)sélectionner l'événement pour
|
27 |
effectuer un traitement par lot.
|
28 |
"""
|
29 |
import tw.forms as twf |
30 |
from pylons.i18n import lazy_ugettext as l_ |
31 |
|
32 |
from vigilo.models.tables import CorrEvent |
33 |
from vigilo.models.functions import sql_escape_like |
34 |
from vigiboard.controllers.plugins import VigiboardRequestPlugin |
35 |
|
36 |
class PluginStatus(VigiboardRequestPlugin): |
37 |
"""
|
38 |
Ajoute des colonnes permettant de voir le statut d'acquittement
|
39 |
d'un événement corrélé et de modifier certaines de ses propriétés.
|
40 |
"""
|
41 |
|
42 |
def get_generated_columns_count(self): |
43 |
"""
|
44 |
Renvoie le nombre de colonnes que ce plugin ajoute.
|
45 |
Ce plugin en ajoute 4, au lieu de 1 comme la plupart des plugins.
|
46 |
"""
|
47 |
return 4 |
48 |
|
49 |
def get_search_fields(self): |
50 |
return [
|
51 |
twf.TextField( |
52 |
'trouble_ticket',
|
53 |
label_text=l_('Trouble Ticket'),
|
54 |
validator=twf.validators.String(if_missing=None),
|
55 |
) |
56 |
] |
57 |
|
58 |
def handle_search_fields(self, query, search, subqueries): |
59 |
if search.get('trouble_ticket'): |
60 |
tt = sql_escape_like(search['trouble_ticket'])
|
61 |
query.add_filter(CorrEvent.trouble_ticket.ilike(tt)) |