Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / widgets / edit_event.py @ 011743be

History | View | Annotate | Download (2.16 KB)

1
# -*- coding: utf-8 -*-
2
# vim:set expandtab tabstop=4 shiftwidth=4:
3
# Copyright (C) 2007-2020 CS GROUP - France
4
# License: GNU GPL v2 <http://www.gnu.org/licenses/gpl-2.0.html>
5

    
6
"""Le formulaire d'édition d'un événement."""
7

    
8
from tg.i18n import lazy_ugettext as l_
9
from tw.api import WidgetsList
10
from tw.forms import TableForm, SingleSelectField, TextField, \
11
                        HiddenField, Label
12

    
13
__all__ = (
14
    'edit_event_status_options',
15
    'EditEventForm',
16
)
17

    
18
edit_event_status_options = [
19
    ['NoChange', l_('No change')],
20
    ['None', l_('Change to None')],
21
    ['Acknowledged', l_('Change to Acknowledged')],
22
    ['AAClosed', l_('Change to Closed')],
23
    ['Forced', l_('Force to Closed')],
24
]
25

    
26
# Énumère les valeurs possibles pour le champ "type_action"
27
# dans la base de données et les marque comme nécessitant une traduction.
28
valid_action_types = {
29
    u'Ticket change': l_('Ticket change'),
30
    u'Forced change state': l_('Forced change state'),
31
    u'Acknowledgement change state': l_('Acknowledgement change state'),
32
    u'Ticket change notification': l_('Ticket change notification'),
33
    u'New occurrence': l_('New occurrence'),
34
    u'Nagios update state': l_('Nagios update state'),
35
}
36

    
37
# Gère le cas où un événement est clos de force.
38
l_('Forced')
39

    
40

    
41
class EditEventForm(TableForm):
42
    """
43
    Formulaire d'édition d'événement
44

45
    Affiche une zone de texte pour le Trouble Ticket et une
46
    liste déroulante pour le nouveau status
47

48
    Ce widget permet de répondre aux exigences suivantes :
49
        - VIGILO_EXIG_VIGILO_BAC_0060
50
        - VIGILO_EXIG_VIGILO_BAC_0110
51
    """
52

    
53
    class fields(WidgetsList):
54
        """
55
        Champs du formulaire d'édition des événements.
56
        """
57
        id = HiddenField('id')
58
        trouble_ticket = TextField(label_text=l_('Trouble Ticket'),
59
                                   maxlength=250)
60
        warning = Label(suppress_label=True, text=l_('Warning: changing '
61
                        'the ticket will affect all selected events.'))
62
        ack = SingleSelectField(label_text=l_('Acknowledgement Status'),
63
                                options=edit_event_status_options)
64
        last_modification = HiddenField()