Skip to content

Commit

Permalink
Closes shinken-monitoring#677 - render notes and actions in the eleme…
Browse files Browse the repository at this point in the history
…nt view
  • Loading branch information
mohierf committed Jan 3, 2019
1 parent 205edf7 commit 0a614a6
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 23 deletions.
2 changes: 1 addition & 1 deletion module/htdocs/css/shinken-layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ body {
}

.page-header {
margin-top:5px;
margin-top:15px;
}

.breadcrumb {
Expand Down
50 changes: 41 additions & 9 deletions module/plugins/eltdetail/views/_eltdetail_information.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,49 @@
</div>

<div class="col-lg-6">
%if elt.notes_url or elt.action_url or elt.notes:
%if elt.notes or elt.notes_url:
<h4 class="page-header">Notes</h4>
%if elt.notes != '':
<p>{{ elt.notes }}</p>

%if elt.notes:
<ul class="list-group">
%for note in helper.get_element_notes(elt, popover=False, css='class="list-group-item"'):
{{! note}}
%end
<div>
%if elt.notes_url != '':
<a class="btn btn-info" href="{{elt.notes_url}}" target=_blank><i class="fa fa-external-link-square"></i> More notes</a>
%end
%if elt.action_url != '':
<a class="btn btn-warning" href="{{elt.action_url}}" target=_blank title="{{ elt.action_url }}"><i class="fa fa-cogs"></i> Launch custom action</a>
</ul>
%end

%if elt.notes_url:
<ul class="list-inline">
%for note in helper.get_element_notes_url(elt, default_title="More notes", default_icon="external-link-square", popover=True, css='class="btn btn-info"'):
<li>{{! note}}</li>
%end
</ul>
%end
%end

%if elt.action_url:
<h4 class="page-header">Actions</h4>
<ul class="list-inline">
%for action in helper.get_element_actions_url(elt, default_title="Launch custom action", default_icon="cogs", popover=True, css='class="btn btn-warning"'):
<li>{{! action}}</li>
%end
</ul>
%end

%elt_type = elt.__class__.my_type
%tags = elt.get_service_tags() if elt_type=='service' else elt.get_host_tags()
%if tags:
%tag='stag' if elt_type=='service' else 'htag'
<h4 class="page-header">Tags</h4>
<div class="btn-group">
%for t in sorted(tags):
<a href="/all?search={{tag}}:{{t}}">
%if app.tag_as_image:
<img src="/tag/{{t.lower()}}" alt="{{t.lower()}}" =title="Tag: {{t.lower()}}" style="height: 24px"></img>
%else:
<button class="btn btn-default btn-xs bg-{{elt_type}}"><i class="fa fa-tag"></i> {{t.lower()}}</button>
%end
</a>
%end
</div>
%end
Expand Down
2 changes: 1 addition & 1 deletion module/plugins/eltdetail/views/eltdetail.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Invalid element name
%breadcrumb += [[elt.display_name, '/service/'+helper.get_uri_name(elt)]]
%end

%js=['js/jquery.sparkline.min.js', 'js/shinken-charts.js', 'availability/js/justgage.js', 'availability/js/raphael-2.1.4.min.js', 'cv_host/js/flot/jquery.flot.min.js', 'cv_host/js/flot/jquery.flot.tickrotor.js', 'cv_host/js/flot/jquery.flot.resize.min.js', 'cv_host/js/flot/jquery.flot.pie.min.js', 'cv_host/js/flot/jquery.flot.categories.min.js', 'cv_host/js/flot/jquery.flot.time.min.js', 'cv_host/js/flot/jquery.flot.stack.min.js', 'cv_host/js/flot/jquery.flot.valuelabels.js', 'eltdetail/js/custom_views.js', 'eltdetail/js/eltdetail.js', 'logs/js/history.js']
%js=['js/jquery.sparkline.min.js', 'js/shinken-charts.js', 'cv_host/js/flot/jquery.flot.min.js', 'cv_host/js/flot/jquery.flot.tickrotor.js', 'cv_host/js/flot/jquery.flot.resize.min.js', 'cv_host/js/flot/jquery.flot.pie.min.js', 'cv_host/js/flot/jquery.flot.categories.min.js', 'cv_host/js/flot/jquery.flot.time.min.js', 'cv_host/js/flot/jquery.flot.stack.min.js', 'cv_host/js/flot/jquery.flot.valuelabels.js', 'eltdetail/js/custom_views.js', 'eltdetail/js/eltdetail.js', 'logs/js/history.js']
%if app.logs_module.is_available():
%js=js + ['availability/js/justgage.js', 'availability/js/raphael-2.1.4.min.js']
%end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ define host{
contact_groups admins

# GPS
_LOC_LAT 45.054700
_LOC_LNG 5.080856
_LOC_LAT 45.054700
_LOC_LNG 5.080856

tags +fred

notes simple note... only text but <em>may be formated</em>

notes_url http://www.my-KB.fr?host=$HOSTADDRESS$

action_url http://www.my-KB.fr?host=$HOSTNAME$

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ define host{

contact_groups admins

tags +fred

_satellites arbiter-master$(arbiter)$$(arbiter-master)$$(7770)$,\
scheduler-master$(scheduler)$$(scheduler-master)$$(7768)$,\
scheduler-second$(scheduler)$$(scheduler-second)$$(17768)$,\
Expand All @@ -21,6 +19,28 @@ define host{
receiver-master$(receiver)$$(receiver-master)$$(7773)$

# GPS
_LOC_LAT 45.054700
_LOC_LNG 5.080856
_LOC_LAT 45.054700
_LOC_LNG 5.080856

tags +fred

notes simple note... only text but <em>may be formated</em>\
|Title::note with only title...\
|Title,,file::note with a title and an icon...\
|Title,,file::note with a title and an icon and an url...,,http://my-url.fr\
|KB5126,,tag::<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. \
Proin et leo gravida, lobortis nunc nec, imperdiet odio. Vivamus quam velit, scelerisque \
nec egestas et, semper ut massa. Vestibulum id tincidunt lacus. <em>Ut in arcu at ex egestas \
vestibulum eu non sapien</em>. <span style="color:red">Nulla facilisi</span>. \
Aliquam non blandit tellus, non luctus tortor. \
Mauris tortor libero, egestas quis rhoncus in, sollicitudin et tortor.,,http://my-url.fr\

notes_url http://www.my-KB.fr?host=$HOSTADDRESS$|http://www.my-KB.fr?host=$HOSTNAME$

action_url http://www.google.fr|url1::http://www.google.fr|\
My KB,,tag::http://www.my-KB.fr?host=$HOSTNAME$|\
Last URL,,tag::<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. \
Proin et leo gravida, lobortis nunc nec, imperdiet odio. Vivamus quam velit, scelerisque \
nec egestas et, semper ut massa.,,http://www.my-KB.fr?host=$HOSTADDRESS$

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ define host{
contact_groups admins

# GPS
_LOC_LAT 45.054700
_LOC_LNG 5.080856
_LOC_LAT 45.054700
_LOC_LNG 5.080856

tags +fred

notes simple note... only text but <em>may be formated</em>

notes_url http://www.my-KB.fr?host=$HOSTADDRESS$

action_url http://www.my-KB.fr?host=$HOSTNAME$

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ define host{

contact_groups admins

tags +fred

_satellites arbiter-master$(arbiter)$$(arbiter-master)$$(7770)$,\
scheduler-master$(scheduler)$$(scheduler-master)$$(7768)$,\
scheduler-second$(scheduler)$$(scheduler-second)$$(17768)$,\
Expand All @@ -21,6 +19,28 @@ define host{
receiver-master$(receiver)$$(receiver-master)$$(7773)$

# GPS
_LOC_LAT 45.054700
_LOC_LNG 5.080856
_LOC_LAT 45.054700
_LOC_LNG 5.080856

tags +fred

notes simple note... only text but <em>may be formated</em>\
|Title::note with only title...\
|Title,,file::note with a title and an icon...\
|Title,,file::note with a title and an icon and an url...,,http://my-url.fr\
|KB5126,,tag::<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. \
Proin et leo gravida, lobortis nunc nec, imperdiet odio. Vivamus quam velit, scelerisque \
nec egestas et, semper ut massa. Vestibulum id tincidunt lacus. <em>Ut in arcu at ex egestas \
vestibulum eu non sapien</em>. <span style="color:red">Nulla facilisi</span>. \
Aliquam non blandit tellus, non luctus tortor. \
Mauris tortor libero, egestas quis rhoncus in, sollicitudin et tortor.,,http://my-url.fr\

notes_url http://www.my-KB.fr?host=$HOSTADDRESS$|http://www.my-KB.fr?host=$HOSTNAME$

action_url http://www.google.fr|url1::http://www.google.fr|\
My KB,,tag::http://www.my-KB.fr?host=$HOSTNAME$|\
Last URL,,tag::<strong>Lorem ipsum dolor sit amet</strong>, consectetur adipiscing elit. \
Proin et leo gravida, lobortis nunc nec, imperdiet odio. Vivamus quam velit, scelerisque \
nec egestas et, semper ut massa.,,http://www.my-KB.fr?host=$HOSTADDRESS$

}

0 comments on commit 0a614a6

Please sign in to comment.