Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / templates / vigiboard_event_table.html @ 3d0d254c

History | View | Annotate | Download (9.25 KB)

1
<html xmlns:py="http://genshi.edgewall.org/"
2
      xmlns:xi="http://www.w3.org/2001/XInclude"
3
      py:strip="">
4

    
5

    
6
  <xi:include href="vigiboard_history_table.html" />
7

    
8
<py:def function="event_table(events,page,pages,rows_info,edit_event_status_options,history,hist_error,search)">
9
<?python from genshi import HTML ?>
10

    
11
<py:if test="len(events) > 1">
12
<table class="vigitable" summary="Event table">
13
        <thead>
14
                <tr >
15
                        <td style="width:26px;border-right: solid 1px #4682b4">
16
                                <a py:if="page > pages[0]" href="${tg.url('/%d' % (page-1))}"><img src="${tg.url('/images/fleche_up.png')}" alt="Previous" title="Previous page"/></a>
17
                                <img py:if="page == pages[0]" src="${tg.url('/images/fleche_up.png')}" alt="Previous" title="Previous page" />
18
                        </td>
19
                        <!--!
20
                                8 = nombre de champs affichés en permanence.
21
                                events[1][6] contient une liste des en-têtes générés par les plugins.
22
                                La somme est calculée de sorte que le bandeau de changement de pages
23
                                soit aligné sur le reste du tableau (les alertes).
24
                        -->
25
                    <td colspan="${8+len(events[1][6])}" style="color: white;background-color: #4682b4" >${_('Showing rows %(id_first_row)d to %(id_last_row)d of %(total_rows)d') % rows_info} <br />
26
                                Pages <py:for each="p in pages">
27
                                <a py:if="p != page" href="${tg.url('/%d' % p)}" py:content="p" />
28
                                <span py:if="p == page" py:replace="p" />
29
                                </py:for>
30
                        </td>
31
                        <td style="width:26px;border-left: solid 1px #4682b4">
32
                                <a py:if="pages[-1] > page" href="${tg.url('/%d' % (page+1))}"><img src="${tg.url('/images/fleche_down.png')}" alt="Next" title="Next page"/></a>
33
                                <img py:if="page == pages[-1]" src="${tg.url('/images/fleche_down.png')}"  alt="Next" title="Next page" />
34
                        </td>
35
                </tr>
36

    
37
                <tr>
38
                        <py:for each="(pname,pstyle) in events[0]">
39
                        <th style="padding: 5px;" py:attrs="pstyle">${HTML(pname)}</th>
40
                        </py:for>
41
                        <th style="width:26px;padding: 0px;"><a class="Edit_EventsLien" href="javascript:vigiboard_edit_eventdialog('all')"><img src="${tg.url('/images/icon_page_edit.png')}" alt="Edit selected" title="Edit all selected events"/></a></th>
42
                        <th style="padding:0px;"><input title="Select/Unselect all" id="vigiboard_checkall_checkbox" type="checkbox" onclick="vigiboard_checkall()" /></th>
43
                </tr>
44
        </thead>
45
        
46
        <tbody>
47
                <py:for each="(event,class_tr,class_td_severity,class_td_date,img_fleche,img_statu,plugin) in events[1:]">
48
                <tr py:attrs="class_tr">
49
                        <td style="padding: 3px;" py:attrs="class_td_severity">
50
                            <a href="javascript:vigiboard_historydialog('${event.idaggregate}')" class="HistoryLien"><img src="${tg.url(img_fleche['src'])}" style="width:20px" alt="Details" title="Event details" /></a>
51
                    </td>
52
                        <td py:attrs="class_td_date">
53
                            <span style="font-weight: bold;">${event.get_date('timestamp_active')}</span>
54
                            <br />[${event.get_since_date('timestamp_active')}]
55
                         </td>
56
                        <td py:attrs="class_td_date" style="text-align:center">${event.occurrences}</td>
57
                        <td>${event.cause.hostname}</td>
58
                        <td>${event.cause.servicename}</td>
59
                        <td>${event.cause.message}</td>
60
                        <td py:for="plug in plugin" py:attrs="plug[1]">${HTML(plug[0])}</td>
61
                        <td style="text-align: center"><a py:if="event.trouble_ticket is not None" href="${
62
                                        tg.config['vigiboard_links.tt'] % {
63
                                                'idaggregate': event.idaggregate,
64
                                                'host': event.cause.hostname,
65
                                                'service': event.cause.servicename,
66
                                                'tt': event.trouble_ticket }}">[${event.trouble_ticket}]</a></td>
67
                        <td style="text-align: center"><img py:attrs="img_statu" py:if="img_statu != None" alt="Status" title="Event status"/></td>
68
                        <td py:attrs="class_td_date" style="padding: 0px;text-align: center"><a class="Edit_EventsLien" href="javascript:vigiboard_edit_eventdialog('${event.idaggregate}')"><img src="${tg.url('/images/icon_page_edit.png')}" alt="Edit" title="Edit this event"/></a></td>
69
                        <td py:attrs="class_td_date" style="padding:0px;text-align: center"><input type="checkbox" class="Edit_EventsCheckBox" value="${event.idaggregate}"/></td>
70
                </tr>
71

    
72
                    <py:if test="hist_error == True">
73
                        <tr><td colspan="10+len(plugin)">
74
                                ${history_table(history[event.idcause],hist_error)}        
75
                        </td></tr>
76
                    </py:if>
77
                </py:for>
78
        
79
        </tbody>
80

    
81
</table>
82

    
83
${tmpl_context.edit_eventdialog()}
84
${tmpl_context.searchdialog}
85
${tmpl_context.historydialog}
86
<py:for each="fct,tpl in plugin_context">
87
        ${fct()}
88
        <xi:include href="vigiboard_plugin/${tpl}.html" /> 
89
</py:for>
90

    
91
<script type="text/javascript">
92
        function vigiboard_historydialog(idd) {
93
                $.getJSON("${tg.url('/history_dialog')}",{idaggregate:idd},function(json){
94
                        $('#HistoryDialog_initial_state').html(json.initial_state);
95
                        $('#HistoryDialog_current_state').html(json.current_state);
96
                        $('#HistoryDialog_detailed_event').attr('href', '${tg.url('/event/')}' + json.idaggregate);
97
                        $('#HistoryDialog_detailed_host').attr('href', '${tg.url('/host_service/')}' + json.host + "/" + json.service);
98
                        <py:for each="edname, edit in tg.config['vigiboard_links.eventdetails'].iteritems()">
99
                        $('#HistoryDialog_${edname}').attr('href', json.eventdetails['${edname}']);
100
                        </py:for>
101
                        $('#HistoryDialog').dialog('open');
102
                })
103
        }
104
        function vigiboard_edit_eventdialog(idd) {
105
                $('#edit_event_form_comment').attr('value','');
106
                $('#edit_event_form_trouble_ticket').attr('value','');
107
                $('#edit_event_form_tt_create').attr('checked',false);
108
                $('#edit_event_form_status').find('option:first').attr('selected', 'selected').parent('select');;
109
                if ( idd == 'all' ) {
110
                        var a = '';
111
                        $('.Edit_EventsCheckBox').each(function() {
112
                                if ( $(this).attr('checked'))
113
                                        a += $(this).attr('value') + ',';
114
                        });
115
                        idd = a;
116
                }
117
                $('#edit_event_form_id').attr('value',idd);        
118
                $('#Edit_EventsDialog').dialog('open');
119
        }
120
        function vigiboard_searchdialog() {
121
                $('#search_form_host').attr('value','${search['host']}');
122
                $('#search_form_service').attr('value','${search['service']}');
123
                $('#search_form_output').attr('value','${search['output']}');
124
                $('#search_form_trouble_ticket').attr('value', '${search['tt']}');
125
                $('#SearchDialog').dialog('open');        
126
        }
127
        function vigiboard_checkall() {
128
                var val = $('#vigiboard_checkall_checkbox').attr('checked');        
129
                $('input[type=checkbox]').each(function(){$(this).attr('checked',val);});
130
        }
131
        $('.HistoryLien').each(function() {
132
                $(this).click(function(e){
133
                $('#HistoryDialog').dialog('option','position',[e.clientX+10,e.clientY]);
134
                })});
135
        $('.Edit_EventsLien').each(function() {
136
                $(this).click(function(e){
137
                $('#Edit_EventsDialog').dialog('option','position',[e.clientX-400-20,e.clientY]);
138
                })});
139
        $('#SearchLien').click(function(e){
140
                $('#SearchDialog').dialog('option','position','center');
141
        });
142
        
143

    
144
</script>
145

    
146
<div style="display:none" id="HistoryDialog">
147
Initial State: <span id="HistoryDialog_initial_state" /><br />
148
Current State: <span id="HistoryDialog_current_state" /><br />
149
<ul>
150
        <li><a id="HistoryDialog_detailed_event" href="#">Detailed history for this event</a></li>
151
        <li><a id="HistoryDialog_detailed_host" href="#">Detailed history for this host/service</a></li>
152
        <li py:for="edname, edit in tg.config['vigiboard_links.eventdetails'].iteritems()">
153
                <a href="#" id="HistoryDialog_${edname}">${edit[0]}</a>
154
        </li>
155
</ul>
156
</div>
157

    
158
<div  style="display:none" id="Edit_EventsDialog">
159
        ${tmpl_context.edit_event_form()} 
160
</div>
161
<div  style="display:none" id="SearchDialog">
162
        ${tmpl_context.search_form()}
163
</div>
164

    
165
</py:if>
166

    
167
<py:if test="1 >= len(events)">
168
<table class="vigitable">
169

    
170
        <thead>
171
                <tr>
172
                        <td style="width:26px;background-color: rgb(70, 130, 180);">
173
                                <img src="${tg.url('/images/fleche_up.png')}" alt="Previous" title="Previous page"/>
174
                        </td>
175
                        <td colspan="9" style="width:100%;background-color:#4682B4;color:white;text-align:center">Showing rows 0 to 0 of 0<br />
176
                                Page 0
177
                        </td>
178
                        <td style="width:26px">
179
                                <img src="${tg.url('/images/fleche_down.png')}" alt="Next" title="Next page" />
180
                        </td>
181
                </tr>
182

    
183
                <tr style="background-color:#F8F8F8;font-weight: bold">
184
                                <py:for each="(pname,pstyle) in events[0]">
185
                        <td py:attrs="pstyle">${HTML(pname)}</td>
186
                    </py:for>
187
                                    <td style="text-align: center;"><img src="${tg.url('/images/icon_page_edit.png')}" alt="Edit selected" title="Edit all selected events"/></td>
188
                        <td style="text-align: center;"><input id="vigiboard_checkall_checkbox" type="checkbox" /></td>
189
                </tr>
190
        </thead>
191

    
192
        <tbody>
193
<tr><td colspan="9"><br />No event</td></tr>
194
</tbody>
195
</table>
196
${tmpl_context.searchdialog}
197
<div  style="display:none" id="SearchDialog">
198
        ${tmpl_context.search_form()}
199
</div>
200
<script type="text/javascript">
201
function vigiboard_searchdialog() {
202
                $('#search_form_host').attr('value','');
203
                $('#search_form_service').attr('value','');
204
                $('#search_form_output').attr('value','');
205
                $('#search_form_trouble_ticket').attr('value', '');
206
                $('#SearchDialog').dialog('open');      
207
        }
208
$('#SearchLien').click(function(e){
209
                $('#SearchDialog').dialog('option','position','center');
210
        });
211
</script>
212

    
213
</py:if>
214

    
215
</py:def>
216

    
217
</html>