Skip to content

Commit 4004779

Browse files
author
Guillaume Subiron
committed
Cleanup eltview margins, tags and order of sections (#693)
1 parent 90e0f20 commit 4004779

File tree

3 files changed

+144
-153
lines changed

3 files changed

+144
-153
lines changed

module/htdocs/css/shinken-layout.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ body {
4040
padding-bottom: 70px;
4141
}
4242

43-
.page-header {
44-
margin-top:15px;
45-
}
46-
4743
.page-header .fas {
4844
margin-right: 10px;
4945
}

module/plugins/eltdetail/views/_eltdetail_information.tpl

Lines changed: 143 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
<div class="panel panel-default" style="border-top:none; border-radius:0;">
55
<div class="panel-body">
66

7-
<div class="row">
7+
<div class="col-lg-6">
8+
89
<div class="status-lead" style="margin-left: 10px; margin-top: 20px;">
910
<div style="display: table-cell; vertical-align: middle; ">
1011
{{!helper.get_fa_icon_state(elt, use_title=False)}}
@@ -34,10 +35,7 @@
3435
<samp>{{! elt.output}}</samp>
3536
</div>
3637
</div>
37-
</div>
3838

39-
<div class="row">
40-
<div class="col-lg-6">
4139
<h4 class="page-header"><i class="fas fa-bolt"></i> Last check</h4>
4240
<table class="table table-condensed table-nowrap">
4341
<colgroup>
@@ -227,147 +225,42 @@
227225
%some_doc = elt.notes or elt.notes_url or elt.action_url or elt.customs and ('_IMPACT' in elt.customs or '_DETAILLEDESC' in elt.customs or '_FIXACTIONS' in elt.customs)
228226

229227
%if some_doc:
230-
<h4 class="page-header"><i class="fas fa-question-circle"></i> Documentation</h4>
231-
%if elt.notes or elt.notes_url:
232-
%if elt.notes:
233-
<p>{{! elt.notes}}</p>
234-
%end
235-
236-
%if elt.notes_url:
237-
<ul class="list-inline">
238-
%for note in helper.get_element_notes_url(elt, icon="external-link-square", css='class="btn btn-info btn-xs"'):
239-
<li>{{! note}}</li>
240-
%end
241-
</ul>
242-
%end
243-
%end
244-
245-
%if elt.action_url:
246-
<ul class="list-inline">
247-
%for action in helper.get_element_actions_url(elt, title="", icon="cogs", css='class="btn btn-warning btn-xs"'):
248-
<li>{{! action}}</li>
249-
%end
250-
</ul>
251-
%end
252-
253-
%if elt.customs and ('_IMPACT' in elt.customs or '_DETAILLEDESC' in elt.customs or '_FIXACTIONS' in elt.customs):
254-
<dl class="dl-horizontal">
255-
%if '_DETAILLEDESC' in elt.customs:
256-
<dt style="width: 100px;">Description </dt><dd style="margin-left: 120px;"> {{ elt.customs['_DETAILLEDESC'] }}</dd>
257-
%end
258-
%if '_IMPACT' in elt.customs:
259-
<dt style="width: 100px;">Impact </dt><dd style="margin-left: 120px;"> {{ elt.customs['_IMPACT'] }}</dd>
260-
%end
261-
%if '_FIXACTIONS' in elt.customs:
262-
<dt style="width: 100px;">How to fix </dt><dd style="margin-left: 120px;"> {{ elt.customs['_FIXACTIONS'] }}</dd>
263-
%end
264-
</dl>
265-
%end
266-
%end
228+
<h4 class="page-header"><i class="fas fa-question-circle"></i> Documentation</h4>
229+
%if elt.notes or elt.notes_url:
230+
%if elt.notes:
231+
<p>{{! elt.notes}}</p>
232+
%end
267233

268-
%tags = elt.get_service_tags() if elt_type=='service' else elt.get_host_tags()
269-
%if tags:
270-
%tag='stag' if elt_type=='service' else 'htag'
271-
<h4 class="page-header"><i class="fas fa-tag"></i> Tags</h4>
272-
<div class="btn-group">
273-
%for t in sorted(tags):
274-
<a href="/all?search={{tag}}:{{t}}">
275-
%if app.tag_as_image:
276-
<img src="/tag/{{t.lower()}}" alt="{{t.lower()}}" =title="Tag: {{t.lower()}}" style="height: 24px"></img>
277-
%else:
278-
<button class="btn btn-default btn-xs bg-lightgrey"><i class="fas fa-tag"></i> {{t.lower()}}</button>
234+
%if elt.notes_url:
235+
<ul class="list-inline">
236+
%for note in helper.get_element_notes_url(elt, icon="external-link-square", css='class="btn btn-info btn-xs"'):
237+
<li>{{! note}}</li>
238+
%end
239+
</ul>
279240
%end
280-
</a>
281241
%end
282-
</div>
283-
%end
284-
285-
%if elt.event_handler:
286-
<h4 class="page-header">Event handler</h4>
287-
<table class="table table-condensed">
288-
<colgroup>
289-
<col style="width: 40%" />
290-
<col style="width: 60%" />
291-
</colgroup>
292-
<tbody class="small">
293-
%enabled = app.datamgr.get_configuration_parameter('enable_flap_detection')
294-
<tr>
295-
<td><strong>Event handler enabled:</strong></td>
296-
<td>
297-
<input type="checkbox" class="js-toggle-parameter"
298-
{{'checked' if elt.event_handler_enabled else ''}}
299-
title="{{'Disable event handler' if elt.event_handler_enabled else 'Enable event handler'}}"
300-
{{'disabled' if not (enabled and app.can_action()) else ''}}
301-
data-action="toggle_event_handlers"
302-
data-element="{{helper.get_uri_name(elt)}}">
303-
%if not enabled:
304-
<em>&nbsp;Globally disabled by configuration</em>
305-
%end
306-
</td>
307-
</tr>
308-
<tr>
309-
<td><strong>Event handler:</strong></td>
310-
<td>
311-
<a href="/commands#{{elt.event_handler.get_name()}}">{{ elt.event_handler.get_name() }}</a>
312-
</td>
313-
</tr>
314-
</tbody>
315-
</table>
316-
%end
317242

318-
<h4 class="page-header"><i class="fas fa-arrows-alt-v"></i> Flapping detection</h4>
319-
<table class="table table-condensed">
320-
<colgroup>
321-
<col style="width: 40%" />
322-
<col style="width: 60%" />
323-
</colgroup>
324-
<tbody class="small">
325-
%enabled = app.datamgr.get_configuration_parameter('enable_flap_detection')
326-
<tr>
327-
<td><strong>Flapping detection:</strong></td>
328-
<td>
329-
<input type="checkbox" class="js-toggle-parameter"
330-
{{'checked' if elt.flap_detection_enabled else ''}}
331-
title="{{'Disable flapping detection' if elt.flap_detection_enabled else 'Enable flapping detection'}}"
332-
{{'disabled' if not (enabled and app.can_action()) else ''}}
333-
data-action="toggle_flap_detection"
334-
data-element="{{helper.get_uri_name(elt)}}">
335-
%if not enabled:
336-
<em>&nbsp;Globally disabled by configuration</em>
337-
%end
338-
</td>
339-
</tr>
340-
%if elt.flap_detection_enabled:
341-
<tr>
342-
<td><strong>Options:</strong></td>
343-
<td>{{', '.join(elt.flap_detection_options)}}</td>
344-
</tr>
345-
<tr>
346-
<td><strong>Low threshold:</strong></td>
347-
<td>{{elt.low_flap_threshold}}</td>
348-
</tr>
349-
<tr>
350-
<td><strong>High threshold:</strong></td>
351-
<td>{{elt.high_flap_threshold}}</td>
352-
</tr>
243+
%if elt.action_url:
244+
<ul class="list-inline">
245+
%for action in helper.get_element_actions_url(elt, title="", icon="cogs", css='class="btn btn-warning btn-xs"'):
246+
<li>{{! action}}</li>
353247
%end
354-
</tbody>
355-
</table>
248+
</ul>
249+
%end
356250

357-
%if elt.stalking_options and elt.stalking_options[0]:
358-
<h4 class="page-header"><i class="fas fa-cogs"></i> Stalking options</h4>
359-
<table class="table table-condensed">
360-
<colgroup>
361-
<col style="width: 40%" />
362-
<col style="width: 60%" />
363-
</colgroup>
364-
<tbody class="small">
365-
<tr>
366-
<td><strong>Options:</strong></td>
367-
<td>{{', '.join(elt.stalking_options)}}</td>
368-
</tr>
369-
</tbody>
370-
</table>
251+
%if elt.customs and ('_IMPACT' in elt.customs or '_DETAILLEDESC' in elt.customs or '_FIXACTIONS' in elt.customs):
252+
<dl class="dl-horizontal">
253+
%if '_DETAILLEDESC' in elt.customs:
254+
<dt style="width: 100px;">Description </dt><dd style="margin-left: 120px;"> {{ elt.customs['_DETAILLEDESC'] }}</dd>
255+
%end
256+
%if '_IMPACT' in elt.customs:
257+
<dt style="width: 100px;">Impact </dt><dd style="margin-left: 120px;"> {{ elt.customs['_IMPACT'] }}</dd>
258+
%end
259+
%if '_FIXACTIONS' in elt.customs:
260+
<dt style="width: 100px;">How to fix </dt><dd style="margin-left: 120px;"> {{ elt.customs['_FIXACTIONS'] }}</dd>
261+
%end
262+
</dl>
263+
%end
371264
%end
372265

373266
<h4 class="page-header"><i class="fas fa-paper-plane"></i> Notifications</h4>
@@ -471,21 +364,123 @@
471364
</tbody>
472365
</table>
473366

474-
%if getattr(elt, 'hostgroups', None):
475-
<h4 class="page-header"><i class="fas fa-sitemap"></i> Member of:</h4>
476-
<ul class="list-inline">
477-
%for hg in elt.hostgroups:
478-
<li class="list-inline-item">
479-
<a href="/hosts-group/{{hg.get_name()}}" class="link">{{hg.alias}} ({{hg.get_name()}})</a>
480-
{{", " if hg != elt.hostgroups[-1] else ""}}
481-
</li>
367+
%if elt.event_handler:
368+
<h4 class="page-header">Event handler</h4>
369+
<table class="table table-condensed">
370+
<colgroup>
371+
<col style="width: 40%" />
372+
<col style="width: 60%" />
373+
</colgroup>
374+
<tbody class="small">
375+
%enabled = app.datamgr.get_configuration_parameter('enable_flap_detection')
376+
<tr>
377+
<td><strong>Event handler enabled:</strong></td>
378+
<td>
379+
<input type="checkbox" class="js-toggle-parameter"
380+
{{'checked' if elt.event_handler_enabled else ''}}
381+
title="{{'Disable event handler' if elt.event_handler_enabled else 'Enable event handler'}}"
382+
{{'disabled' if not (enabled and app.can_action()) else ''}}
383+
data-action="toggle_event_handlers"
384+
data-element="{{helper.get_uri_name(elt)}}">
385+
%if not enabled:
386+
<em>&nbsp;Globally disabled by configuration</em>
387+
%end
388+
</td>
389+
</tr>
390+
<tr>
391+
<td><strong>Event handler:</strong></td>
392+
<td>
393+
<a href="/commands#{{elt.event_handler.get_name()}}">{{ elt.event_handler.get_name() }}</a>
394+
</td>
395+
</tr>
396+
</tbody>
397+
</table>
398+
%end
399+
400+
<h4 class="page-header"><i class="fas fa-arrows-alt-v"></i> Flapping detection</h4>
401+
<table class="table table-condensed">
402+
<colgroup>
403+
<col style="width: 40%" />
404+
<col style="width: 60%" />
405+
</colgroup>
406+
<tbody class="small">
407+
%enabled = app.datamgr.get_configuration_parameter('enable_flap_detection')
408+
<tr>
409+
<td><strong>Flapping detection:</strong></td>
410+
<td>
411+
<input type="checkbox" class="js-toggle-parameter"
412+
{{'checked' if elt.flap_detection_enabled else ''}}
413+
title="{{'Disable flapping detection' if elt.flap_detection_enabled else 'Enable flapping detection'}}"
414+
{{'disabled' if not (enabled and app.can_action()) else ''}}
415+
data-action="toggle_flap_detection"
416+
data-element="{{helper.get_uri_name(elt)}}">
417+
%if not enabled:
418+
<em>&nbsp;Globally disabled by configuration</em>
419+
%end
420+
</td>
421+
</tr>
422+
%if elt.flap_detection_enabled:
423+
<tr>
424+
<td><strong>Options:</strong></td>
425+
<td>{{', '.join(elt.flap_detection_options)}}</td>
426+
</tr>
427+
<tr>
428+
<td><strong>Low threshold:</strong></td>
429+
<td>{{elt.low_flap_threshold}}</td>
430+
</tr>
431+
<tr>
432+
<td><strong>High threshold:</strong></td>
433+
<td>{{elt.high_flap_threshold}}</td>
434+
</tr>
435+
%end
436+
</tbody>
437+
</table>
438+
439+
%if elt.stalking_options and elt.stalking_options[0]:
440+
<h4 class="page-header"><i class="fas fa-cogs"></i> Stalking options</h4>
441+
<table class="table table-condensed">
442+
<colgroup>
443+
<col style="width: 40%" />
444+
<col style="width: 60%" />
445+
</colgroup>
446+
<tbody class="small">
447+
<tr>
448+
<td><strong>Options:</strong></td>
449+
<td>{{', '.join(elt.stalking_options)}}</td>
450+
</tr>
451+
</tbody>
452+
</table>
453+
%end
454+
%tags = elt.get_service_tags() if elt_type=='service' else elt.get_host_tags()
455+
%if tags:
456+
%tag='stag' if elt_type=='service' else 'htag'
457+
<h4 class="page-header"><i class="fas fa-tag"></i> Tags</h4>
458+
<ul class="list-inline" style="line-height: 2;">
459+
%for t in sorted(tags):
460+
<li class="list-inline-item">
461+
%if app.tag_as_image:
462+
<a href="/all?search={{tag}}:{{t}}"><img src="/tag/{{t.lower()}}" alt="{{t.lower()}}" title="Tag: {{t.lower()}}" style="height: 24px"></img></a>
463+
%else:
464+
<a href="/all?search={{tag}}:{{t}}" class="btn btn-xs btn-default">{{t.lower()}}</a>
482465
%end
466+
</li>
467+
%end
468+
</ul>
469+
%end
470+
471+
%if getattr(elt, 'hostgroups', None):
472+
<h4 class="page-header"><i class="fas fa-sitemap"></i> Hostgroups</h4>
473+
<ul class="list-inline" style="line-height: 2;">
474+
%for hg in elt.hostgroups:
475+
<li class="list-inline-item">
476+
<a href="/hosts-group/{{hg.get_name()}}" class="btn btn-xs btn-default">{{hg.get_name()}}{{" (%s)" % hg.alias if hg.alias != hg.get_name() else ""}}</a>
477+
</li>
478+
%end
483479
</ul>
484480

485481
%end
486482

487483
</div>
488-
</div>
489484
</div>
490485
</div>
491486
</div>

module/views/layout.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
%if navi:
114114
%include("pagination_element", navi=navi, page=page, elts_per_page=elts_per_page, display_steps_form=True, div_class="pull-right hidden-xs", drop="dropdown")
115115
%end
116-
<h3 class="page-header hidden-xs">
116+
<h3 class="page-header hidden-xs" style="margin-top: 10px;">
117117
<ol class="breadcrumb hidden-xs">
118118
%if not breadcrumb:
119119
<li class="active">{{title or 'No title'}}</li>

0 commit comments

Comments
 (0)