Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / templates / vigiboard_event_table.html @ be29aa96

History | View | Annotate | Download (9.19 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
        
14
        <thead>
15
                <tr >
16
                        <td style="width:26px;border-right: solid 1px #4682b4">
17
                                <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>
18
                                <img py:if="page == pages[0]" src="${tg.url('/images/fleche_up.png')}" alt="Previous" title="Previous page" />
19
                        </td>
20
                        <!--!
21
                                8 = nombre de champs affichés en permanence.
22
                                events[1][6] contient une liste des en-têtes générés par les plugins.
23
                                La somme est calculée de sorte que le bandeau de changement de pages
24
                                soit aligné sur le reste du tableau (les alertes).
25
                        -->
26
                    <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 />
27
                                Pages <py:for each="p in pages">
28
                                <a py:if="p != page" href="${tg.url('/%d' % p)}" py:content="p" />
29
                                <span py:if="p == page" py:replace="p" />
30
                                </py:for>
31
                        </td>
32
                        <td style="width:26px;border-left: solid 1px #4682b4">
33
                                <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>
34
                                <img py:if="page == pages[-1]" src="${tg.url('/images/fleche_down.png')}"  alt="Next" title="Next page" />
35
                        </td>
36
                </tr>
37

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

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

    
77
</table>
78

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

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

    
140
</script>
141

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

    
154
<div  style="display:none" id="Edit_EventsDialog">
155
        ${tmpl_context.edit_event_form()} 
156
</div>
157
<div  style="display:none" id="SearchDialog">
158
        ${tmpl_context.search_form()}
159
</div>
160

    
161
</py:if>
162

    
163
<py:if test="1 >= len(events)">
164
<table class="vigitable">
165

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

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

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

    
209
</py:if>
210

    
211
</py:def>
212

    
213
</html>