[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Naparuba
naparuba at gmail.com
Tue Feb 28 22:16:19 UTC 2012
The following commit has been merged in the debian/master branch:
commit 5ee0fe22413c413a0802d9edbc4d67f7170dc4c3
Author: Naparuba <naparuba at gmail.com>
Date: Thu Jan 26 14:40:05 2012 +0100
Add: webui/mobile add sorting on impacts page, and data in problems one.
diff --git a/shinken/misc/sorter.py b/shinken/misc/sorter.py
index 81718d6..f9638fe 100644
--- a/shinken/misc/sorter.py
+++ b/shinken/misc/sorter.py
@@ -51,3 +51,33 @@ def hst_srv_sort(s1, s2):
# Ok, so by name...
return s1.get_full_name() > s2.get_full_name()
+
+
+# Sort hosts and services by impact, states and co
+def worse_first(s1, s2):
+ # Ok, we compute a importance value so
+ # For host, the order is UP, UNREACH, DOWN
+ # For service : OK, UNKNOWN, WARNING, CRIT
+ # And DOWN is before CRITICAL (potential more impact)
+ tab = {'host' : { 0 : 0, 1: 4, 2 : 1},
+ 'service' : {0 : 0, 1 : 2, 2 : 3, 3 : 1}
+ }
+ state1 = tab[s1.__class__.my_type].get(s1.state_id ,0)
+ state2 = tab[s2.__class__.my_type].get(s2.state_id ,0)
+
+ # ok, here, same business_impact
+ # Compare warn and crit state
+ if state1 > state2:
+ return -1
+ if state2 > state1:
+ return 1
+
+ # Same? ok by business impact
+ if s1.business_impact > s2.business_impact:
+ return -1
+ if s2.business_impact > s1.business_impact:
+ return 1
+
+ # Ok, so by name...
+ return s1.get_full_name() > s2.get_full_name()
+
diff --git a/shinken/modules/livestatus_broker/mapping.py b/shinken/modules/livestatus_broker/mapping.py
index 4456eb8..b5b365b 100644
--- a/shinken/modules/livestatus_broker/mapping.py
+++ b/shinken/modules/livestatus_broker/mapping.py
@@ -4619,7 +4619,7 @@ def catchall_factory(name, req):
return method
-print "FINISHING THE ATTRIBUTE MAPPING>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+#print "FINISHING THE ATTRIBUTE MAPPING>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
for objtype in ['Host', 'Service', 'Contact', 'Command', 'Timeperiod', 'Downtime', 'Comment', 'Hostgroup', 'Servicegroup', 'Contactgroup', 'SchedulerLink', 'PollerLink', 'ReactionnerLink', 'BrokerLink', 'Problem', 'Logline', 'Config']:
cls = [t[1] for t in table_class_map.values() if t[0] == objtype][0]
setattr(cls, 'livestatus_attributes', [])
@@ -4720,7 +4720,7 @@ for objtype in ['Host', 'Service', 'Contact', 'Command', 'Timeperiod', 'Downtime
for attribute in sorted([x for x in livestatus_attribute_map[objtype]]):
cls.lsm_columns.append(attribute)
-print "FINISHED THE ATTRIBUTE MAPPING<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
+#print "FINISHED THE ATTRIBUTE MAPPING<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
diff --git a/shinken/objects/schedulingitem.py b/shinken/objects/schedulingitem.py
index 3c0dcaf..82e2a37 100644
--- a/shinken/objects/schedulingitem.py
+++ b/shinken/objects/schedulingitem.py
@@ -1279,7 +1279,7 @@ class SchedulingItem(Item):
rule = ''
if len(elts) >= 2:
rule = '!'.join(elts[1:])
- print "Got rules", rule
+
fact = DependencyNodeFactory()
node = fact.eval_cor_patern(rule, hosts, services)
#print "got node", node
diff --git a/shinken/webui/plugins/impacts/impacts.py b/shinken/webui/plugins/impacts/impacts.py
index c0d439e..5371e8d 100644
--- a/shinken/webui/plugins/impacts/impacts.py
+++ b/shinken/webui/plugins/impacts/impacts.py
@@ -63,7 +63,7 @@ def show_impacts():
imp_id = 0
for imp in all_imp_impacts:
- safe_print("FIND A BAD SERVICE IN IMPACTS", imp.get_dbg_name())
+# safe_print("FIND A BAD SERVICE IN IMPACTS", imp.get_dbg_name())
imp_id += 1
impacts[imp_id] = imp
diff --git a/shinken/webui/plugins/mobile/htdocs/css/main.css b/shinken/webui/plugins/mobile/htdocs/css/main.css
index c0bdba1..8befc01 100644
--- a/shinken/webui/plugins/mobile/htdocs/css/main.css
+++ b/shinken/webui/plugins/mobile/htdocs/css/main.css
@@ -1,3 +1,12 @@
#all{
position : absolute;
+}
+
+
+#main_container {
+ background: white;
+ /*min-height: 700px;*/
+ margin-left: 0;
+ margin-right: 0;
+ width: 100%;
}
\ No newline at end of file
diff --git a/shinken/webui/plugins/flow/htdocs/js/init.js b/shinken/webui/plugins/mobile/htdocs/js/mobile_problems.js
similarity index 77%
copy from shinken/webui/plugins/flow/htdocs/js/init.js
copy to shinken/webui/plugins/mobile/htdocs/js/mobile_problems.js
index 852c8c0..ec997ad 100644
--- a/shinken/webui/plugins/flow/htdocs/js/init.js
+++ b/shinken/webui/plugins/mobile/htdocs/js/mobile_problems.js
@@ -22,12 +22,18 @@
*/
-/* We will initialize the WALL panel with our data*/
window.addEvent('domready', function(){
-
- /*options = {'autoslide' : true};
- snowstack_init(images, options);*/
- zflow(images, "#tray");
+ // First we make opacity low for distant
+ var details = $$('.detail');
+ details.each(function(el){
+ new Fx.Slide(el).hide();
+ });
});
+
+
+/* And if the user lick on the good image, we untoggle them. */
+function show_detail(name){
+ var myFx = new Fx.Slide(name).toggle();
+}
diff --git a/shinken/webui/plugins/mobile/mobile.py b/shinken/webui/plugins/mobile/mobile.py
index 91533bf..1878946 100644
--- a/shinken/webui/plugins/mobile/mobile.py
+++ b/shinken/webui/plugins/mobile/mobile.py
@@ -23,6 +23,7 @@
from shinken.webui.bottle import redirect
+from shinken.misc.sorter import worse_first
### Will be populated by the UI with it's own value
app = None
@@ -55,6 +56,8 @@ def impacts():
all_imp_impacts = app.datamgr.get_important_elements()
+ all_imp_impacts.sort(worse_first)
+
return {'app' : app, 'user' : user, 'impacts' : all_imp_impacts}
diff --git a/shinken/webui/plugins/mobile/views/mobile_impacts.tpl b/shinken/webui/plugins/mobile/views/mobile_impacts.tpl
index dcb6aa5..704a8da 100644
--- a/shinken/webui/plugins/mobile/views/mobile_impacts.tpl
+++ b/shinken/webui/plugins/mobile/views/mobile_impacts.tpl
@@ -2,7 +2,7 @@
%helper = app.helper
%datamgr = app.datamgr
-%rebase layout globals(), title="Tactical view", js=['mobile/js/mobile_main.js', 'mobile/js/mobile_impacts.js'], css=['mobile/css/main.css', 'mobile/css/impacts.css']
+%rebase layout_mobile globals(), title="Tactical view", js=['mobile/js/mobile_main.js', 'mobile/js/mobile_impacts.js'], css=['mobile/css/main.css', 'mobile/css/impacts.css']
<div id="all">
<div> <h1> Shinken business apps</h1> </div>
diff --git a/shinken/webui/plugins/mobile/views/mobile_main.tpl b/shinken/webui/plugins/mobile/views/mobile_main.tpl
index be53f9b..531b799 100644
--- a/shinken/webui/plugins/mobile/views/mobile_main.tpl
+++ b/shinken/webui/plugins/mobile/views/mobile_main.tpl
@@ -1,5 +1,5 @@
-%rebase layout globals(), title="Tactical view", js=['mobile/js/mobile_main.js'], css=['mobile/css/main.css']
+%rebase layout_mobile globals(), title="Tactical view", js=['mobile/js/mobile_main.js'], css=['mobile/css/main.css']
<div id="all">
<div> <h1> Shinken </h1> </div>
diff --git a/shinken/webui/plugins/mobile/views/mobile_problems.tpl b/shinken/webui/plugins/mobile/views/mobile_problems.tpl
index 08c7583..4484835 100644
--- a/shinken/webui/plugins/mobile/views/mobile_problems.tpl
+++ b/shinken/webui/plugins/mobile/views/mobile_problems.tpl
@@ -2,9 +2,9 @@
%helper = app.helper
%datamgr = app.datamgr
-%rebase layout globals(), title="IT problems", js=['mobile/js/mobile_main.js'], css=['mobile/css/main.css', 'mobile/css/problems.css']
+%rebase layout_mobile globals(), title="IT problems", js=['mobile/js/mobile_main.js', 'mobile/js/mobile_problems.js'], css=['mobile/css/main.css', 'mobile/css/problems.css']
-<div id="all">
+<div>
<h2>IT Problems</h2>
@@ -18,11 +18,25 @@
<img src="/static/images/star.png">
%end
-<img style="width : 20px; height:20px" src="{{helper.get_icon_state(pb)}}" />{{pb.state}}: {{pb.get_full_name()}}</h2>
+ <img style="width : 20px; height:20px" src="{{helper.get_icon_state(pb)}}" />
+ {{pb.state}}: {{pb.get_full_name()}}
+ <a href="#" onclick="show_detail('{{pb.get_full_name()}}')"><img style="width : 20px; height:20px" src="/static/images/expand.png" /></a>
+ </h2>
-
+ <div class='detail' id="{{pb.get_full_name()}}">
+ <p>Output :
+ %if app.allow_html_output:
+ {{!helper.strip_html_output(pb.output)}}
+ %else:
+ {{pb.output}}
+ %end
+ </p>
+
+ <p>Since : {{helper.print_duration(pb.last_state_change, just_duration=True, x_elts=2)}}</p>
+ <p>Last check : {{helper.print_duration(pb.last_chk, just_duration=True, x_elts=2)}} ago</p>
+ <p>Next check : in {{helper.print_duration(pb.next_chk, just_duration=True, x_elts=2)}}</p>
%if len([imp for imp in pb.impacts if imp.business_impact > 2]) > 0:
- <p>Important impacts</p>
+ <h4>Important impacts</h4>
<div class="impacts">
%for imp in [imp for imp in pb.impacts if imp.business_impact > 2]:
<div class="impact">
@@ -33,6 +47,7 @@
%end
</div>
%end
+ </div>
</div>
diff --git a/shinken/webui/views/layout.tpl b/shinken/webui/views/layout_mobile.tpl
similarity index 98%
copy from shinken/webui/views/layout.tpl
copy to shinken/webui/views/layout_mobile.tpl
index 9c85c86..5e0c108 100644
--- a/shinken/webui/views/layout.tpl
+++ b/shinken/webui/views/layout_mobile.tpl
@@ -104,7 +104,7 @@
%include header_element globals()
%end
%if print_menu:
- %include navigation_element globals()
+ %include navigation_element_mobile globals()
%end
<div id="main_container" class="grid_16">
%include
diff --git a/shinken/webui/views/navigation_element.tpl b/shinken/webui/views/navigation_element_mobile.tpl
similarity index 91%
copy from shinken/webui/views/navigation_element.tpl
copy to shinken/webui/views/navigation_element_mobile.tpl
index 40ef3d1..67dea38 100644
--- a/shinken/webui/views/navigation_element.tpl
+++ b/shinken/webui/views/navigation_element_mobile.tpl
@@ -1,7 +1,7 @@
%if not 'app' in locals() : app = None
<div id="navigation">
<ul id="menu" class="grid_12">
- %menu = [ ('/', 'Dashboard'), ('/impacts','Impacts'), ('/problems','IT problems'), ('/all', 'All'), ('/system', 'System') ]
+ %menu = [ ('/', 'Home'), ('/mobile/impacts','Impacts'), ('/mobile/problems','IT problems')]
%for (key, value) in menu:
%# Check for the selected element, if there is one
%if menu_part == key:
@@ -43,4 +43,4 @@
</ul>
-->
</div>
-<div class="clear"></div>
\ No newline at end of file
+<div class="clear"></div>
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list