Revision e181e86c
Améliorations pour pylint/epydoc.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@3060 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/controllers/plugins/__init__.py | ||
---|---|---|
31 | 31 |
|
32 | 32 |
Cette méthode DEVRAIT être surchargée dans les classes dérivées. |
33 | 33 |
|
34 |
@param idcorrevent: Identifiant du L{CorrEvent} à interroger.
|
|
34 |
@param idcorrevent: Identifiant du C{CorrEvent} à interroger.
|
|
35 | 35 |
@type idcorrevent: C{int} |
36 | 36 |
@return: Dictionnaire contenant la ou les valeur(s) correspondantes. |
37 | 37 |
@rtype: C{dict} |
vigiboard/controllers/plugins/status.py | ||
---|---|---|
2 | 2 |
# vim:set expandtab tabstop=4 shiftwidth=4: |
3 | 3 |
""" |
4 | 4 |
Un plugin pour VigiBoard qui ajoute 3 colonnes au tableau des événements : |
5 |
- la première colonne contient l'état d'acquittement de l'événement. |
|
6 |
- la seconde colonne contient un lien permettant d'éditer certaines |
|
7 |
propriétés associées à l'événement corrélé. |
|
8 |
- la dernière colonne permet de (dé)sélectionner l'événement pour |
|
9 |
effectuer un traitement par lot. |
|
5 |
- la première colonne contient l'état d'acquittement de l'événement.
|
|
6 |
- la seconde colonne contient un lien permettant d'éditer certaines
|
|
7 |
propriétés associées à l'événement corrélé.
|
|
8 |
- la dernière colonne permet de (dé)sélectionner l'événement pour
|
|
9 |
effectuer un traitement par lot.
|
|
10 | 10 |
""" |
11 | 11 |
from vigiboard.controllers.plugins import VigiboardRequestPlugin |
12 | 12 |
|
vigiboard/controllers/plugins/test.py | ||
---|---|---|
14 | 14 |
"Hello world" pour chaque événement du tableau. |
15 | 15 |
""" |
16 | 16 |
|
17 |
def get_value(self, *args, **kwargs): |
|
17 |
def get_value(self, idcorrevent, *args, **kwargs):
|
|
18 | 18 |
""" |
19 | 19 |
Cette méthode est appelée depuis le template associé à ce plugin, |
20 | 20 |
mais également lorsque l'on demande la valeur du plugin grâce à la |
21 | 21 |
méthode get_plugin_value du L{RootController} de VigiBoard. |
22 | 22 |
|
23 |
@param idcorrevent: Identifiant du L{CorrEvent} à interroger.
|
|
23 |
@param idcorrevent: Identifiant du C{CorrEvent} à interroger.
|
|
24 | 24 |
@type idcorrevent: C{int} |
25 | 25 |
@return: Dictionnaire contenant un texte statique. |
26 | 26 |
@rtype: C{dict} |
vigiboard/controllers/root.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
# vim:set expandtab tabstop=4 shiftwidth=4: |
3 |
"""Vigiboard Controller"""
|
|
3 |
"""VigiBoard Controller"""
|
|
4 | 4 |
|
5 | 5 |
from datetime import datetime |
6 | 6 |
from time import mktime |
... | ... | |
67 | 67 |
return dict(kwargs) |
68 | 68 |
|
69 | 69 |
class DefaultSchema(schema.Schema): |
70 |
"""Schéma de validation de la méthode default.""" |
|
70 | 71 |
page = validators.Int(min=1, if_missing=1, if_invalid=1) |
71 | 72 |
supitemgroup = validators.String(if_missing=None) |
72 | 73 |
host = validators.String(if_missing=None) |
... | ... | |
98 | 99 |
@param trouble_ticket: Idem que host mais sur les tickets attribués |
99 | 100 |
|
100 | 101 |
Cette méthode permet de satisfaire les exigences suivantes : |
101 |
- VIGILO_EXIG_VIGILO_BAC_0040, |
|
102 |
- VIGILO_EXIG_VIGILO_BAC_0070, |
|
103 |
- VIGILO_EXIG_VIGILO_BAC_0100, |
|
102 |
- VIGILO_EXIG_VIGILO_BAC_0040,
|
|
103 |
- VIGILO_EXIG_VIGILO_BAC_0070,
|
|
104 |
- VIGILO_EXIG_VIGILO_BAC_0100,
|
|
104 | 105 |
""" |
105 | 106 |
user = get_current_user() |
106 | 107 |
aggregates = VigiboardRequest(user) |
... | ... | |
224 | 225 |
|
225 | 226 |
|
226 | 227 |
class MaskedEventsSchema(schema.Schema): |
228 |
"""Schéma de validation de la méthode masked_events.""" |
|
227 | 229 |
idcorrevent = validators.Int(not_empty=True) |
228 | 230 |
page = validators.Int(min=1, if_missing=1, if_invalid=1) |
229 | 231 |
|
... | ... | |
234 | 236 |
@require(access_restriction) |
235 | 237 |
def masked_events(self, idcorrevent, page): |
236 | 238 |
""" |
237 |
Affichage de la liste des événements bruts masqués dans un
|
|
238 |
événement corrélé (agrégés).
|
|
239 |
Affichage de la liste des événements bruts masqués d'un événement
|
|
240 |
corrélé (événements agrégés dans l'événement corrélé).
|
|
239 | 241 |
|
240 |
@param idevent: identifiant de l'événement souhaité |
|
242 |
@param idcorrevent: identifiant de l'événement corrélé souhaité. |
|
243 |
@type idcorrevent: C{int} |
|
241 | 244 |
""" |
242 | 245 |
user = get_current_user() |
243 | 246 |
|
... | ... | |
330 | 333 |
|
331 | 334 |
|
332 | 335 |
class EventSchema(schema.Schema): |
336 |
"""Schéma de validation de la méthode event.""" |
|
333 | 337 |
idevent = validators.Int(not_empty=True) |
334 | 338 |
page = validators.Int(min=1, if_missing=1, if_invalid=1) |
335 | 339 |
|
... | ... | |
345 | 349 |
|
346 | 350 |
@param idevent: identifiant de l'événement brut souhaité. |
347 | 351 |
@type idevent: C{int} |
352 |
@param page: numéro de la page à afficher. |
|
353 |
@type page: C{int} |
|
348 | 354 |
|
349 |
Cette méthode permet de satisfaire |
|
350 |
l'exigence VIGILO_EXIG_VIGILO_BAC_0080.
|
|
355 |
Cette méthode permet de satisfaire l'exigence
|
|
356 |
VIGILO_EXIG_VIGILO_BAC_0080. |
|
351 | 357 |
""" |
352 |
if not page: |
|
353 |
page = 1 |
|
354 |
|
|
355 | 358 |
user = get_current_user() |
356 | 359 |
events = VigiboardRequest(user, False) |
357 | 360 |
events.add_table( |
... | ... | |
418 | 421 |
|
419 | 422 |
|
420 | 423 |
class ItemSchema(schema.Schema): |
424 |
"""Schéma de validation de la méthode item.""" |
|
421 | 425 |
page = validators.Int(min=1, if_missing=1, if_invalid=1) |
422 | 426 |
host = validators.String(not_empty=True) |
423 | 427 |
service = validators.String(if_missing=None) |
... | ... | |
433 | 437 |
jamais ouverts sur l'hôte / service demandé. |
434 | 438 |
Pour accéder à cette page, l'utilisateur doit être authentifié. |
435 | 439 |
|
440 |
@param page: Numéro de la page à afficher. |
|
436 | 441 |
@param host: Nom de l'hôte souhaité. |
437 | 442 |
@param service: Nom du service souhaité |
438 | 443 |
|
439 |
Cette méthode permet de satisfaire |
|
440 |
l'exigence VIGILO_EXIG_VIGILO_BAC_0080.
|
|
444 |
Cette méthode permet de satisfaire l'exigence
|
|
445 |
VIGILO_EXIG_VIGILO_BAC_0080. |
|
441 | 446 |
""" |
442 | 447 |
idsupitem = SupItem.get_supitem(host, service) |
443 | 448 |
|
... | ... | |
500 | 505 |
|
501 | 506 |
|
502 | 507 |
class UpdateSchema(schema.Schema): |
508 |
"""Schéma de validation de la méthode update.""" |
|
503 | 509 |
id = validators.Regex(r'^[0-9]+(,[0-9]+)*,?$') |
504 | 510 |
last_modification = validators.Number(not_empty=True) |
505 | 511 |
trouble_ticket = validators.String(if_missing='') |
... | ... | |
530 | 536 |
@param ack: Nouvel état d'acquittement des événements sélectionnés. |
531 | 537 |
|
532 | 538 |
Cette méthode permet de satisfaire les exigences suivantes : |
533 |
- VIGILO_EXIG_VIGILO_BAC_0020, |
|
534 |
- VIGILO_EXIG_VIGILO_BAC_0060, |
|
535 |
- VIGILO_EXIG_VIGILO_BAC_0110. |
|
539 |
- VIGILO_EXIG_VIGILO_BAC_0020,
|
|
540 |
- VIGILO_EXIG_VIGILO_BAC_0060,
|
|
541 |
- VIGILO_EXIG_VIGILO_BAC_0110.
|
|
536 | 542 |
""" |
537 | 543 |
|
538 | 544 |
# On vérifie que des identifiants ont bien été transmis via |
... | ... | |
637 | 643 |
|
638 | 644 |
|
639 | 645 |
class GetPluginValueSchema(schema.Schema): |
646 |
"""Schéma de validation de la méthode get_plugin_value.""" |
|
640 | 647 |
idcorrevent = validators.Int(not_empty=True) |
641 | 648 |
plugin_name = validators.OneOf( |
642 | 649 |
[unicode(i[0]) for i in config.get('vigiboard_plugins', [])], |
vigiboard/controllers/vigiboardrequest.py | ||
---|---|---|
5 | 5 |
from time import mktime |
6 | 6 |
from logging import getLogger |
7 | 7 |
|
8 |
from tg import config, tmpl_context, request |
|
8 |
from tg import config, tmpl_context, request, url
|
|
9 | 9 |
from tg.i18n import get_lang |
10 | 10 |
from pylons.i18n import ugettext as _ |
11 | 11 |
from paste.deploy.converters import asbool |
... | ... | |
18 | 18 |
from vigilo.models.tables import Event, CorrEvent, EventHistory, \ |
19 | 19 |
Host, LowLevelService, StateName |
20 | 20 |
from vigilo.models.tables.secondary_tables import SUPITEM_GROUP_TABLE |
21 |
from vigiboard.widgets.edit_event import create_edit_event_form
|
|
22 |
from vigiboard.widgets.search_form import create_search_form
|
|
21 |
from vigiboard.widgets.edit_event import EditEventForm
|
|
22 |
from vigiboard.widgets.search_form import SearchForm
|
|
23 | 23 |
from vigiboard.controllers.plugins import VigiboardRequestPlugin |
24 | 24 |
|
25 | 25 |
LOGGER = getLogger(__name__) |
... | ... | |
422 | 422 |
# TRANSLATORS: Format de date et heure compatible Python/JavaScript. |
423 | 423 |
tmpl_context.calendar_date_format = _('%Y-%m-%d %I:%M:%S %p') |
424 | 424 |
|
425 |
tmpl_context.edit_event_form = create_edit_event_form |
|
426 |
tmpl_context.search_form = create_search_form |
|
425 |
tmpl_context.edit_event_form = EditEventForm("edit_event_form", |
|
426 |
submit_text=l_('Apply'), action=url('/update')) |
|
427 |
tmpl_context.search_form = SearchForm("search_form", |
|
428 |
submit_text=l_('Search'), action=url('/')) |
|
427 | 429 |
|
Also available in: Unified diff