[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

Frescha frescha at unitedseed.de
Tue Feb 28 22:12:32 UTC 2012


The following commit has been merged in the debian/master branch:
commit ede6e445e0be141379cecb3cdf77b21511c221e5
Author: Frescha <frescha at unitedseed.de>
Date:   Sun Jan 8 15:09:17 2012 +0100

    enh: eltdetail mockup

diff --git a/shinken/modules/webui_broker/helper.py b/shinken/modules/webui_broker/helper.py
index 461234d..7773a91 100644
--- a/shinken/modules/webui_broker/helper.py
+++ b/shinken/modules/webui_broker/helper.py
@@ -358,7 +358,7 @@ class Helper(object):
 
             # If we are the root, we already got this
             if level != 0:
-                s += """<a id="togglelink-%s" href="javascript:toggleBusinessElt('%s')"><img id="business-parents-img-%s" src="/static/images/%s" alt=""> </a> \n""" % (name, name, name, img)
+                s += """<a id="togglelink-%s" href="javascript:toggleBusinessElt('%s')"><img id="business-parents-img-%s" src="/static/images/%s" alt="toggle"> </a> \n""" % (name, name, name, img)
                 
             s += """<ul id="business-parents-%s" style="display: %s; ">""" % (name, display)
         
@@ -370,6 +370,47 @@ class Helper(object):
         safe_print("Returing s:", s)
         return s
 
+    # Mockup helper
+    # User: Frescha
+    # Date: 08.01.2012
+    
+    def print_business_tree(self, tree, level=0):
+        safe_print("Should print tree", tree)
+        node = tree['node']
+        name = node.get_full_name()
+        fathers = tree['fathers']
+        s = ''
+        # Do not print the node if it's the root one, we already know its state!
+        if level != 0:
+            s += "%s is %s since %s\n" % (self.get_link(node), node.state, self.print_duration(node.last_state_change, just_duration=True))
+
+        # If we got no parents, no need to print the expand icon
+        if len(fathers) > 0:
+            # We look if the below tree is goodor not
+            tree_is_good = (node.state_id == 0)
+            
+            # If the tree is good, we will use an expand image
+            # and hide the tree
+            if tree_is_good:
+                display = 'none'
+                img = 'expand.png'
+            else: # we will already show the tree, and use a reduce image
+                display = 'block'
+                img = 'reduce.png'
+
+            # If we are the root, we already got this
+            if level != 0:
+                s += """<a id="togglelink-%s" href="javascript:toggleBusinessElt('%s')"><img id="business-parents-img-%s" src="/static/images/%s" alt="toggle"> </a> \n""" % (name, name, name, img)
+                
+            s += """<ul id="business-parents-%s" class="treeview" style="display: %s; ">""" % (name, display)
+        
+            for n in fathers:
+                sub_node = n['node']
+                sub_s = self.print_business_rules(n, level=level+1)
+                s += '<li class="%s">%s</li>' % (self.get_small_icon_state(sub_node), sub_s)
+            s += "</ul>"
+        safe_print("Returing s:", s)
+        return s    
 
     # Get the small state for host/service icons
     # and satellites ones
diff --git a/shinken/webui/htdocs/css/layout.css b/shinken/webui/htdocs/css/layout.css
index 9c4a8b2..be89c03 100644
--- a/shinken/webui/htdocs/css/layout.css
+++ b/shinken/webui/htdocs/css/layout.css
@@ -264,6 +264,10 @@ td.actions a {
 	float:right;
 }
 
+.link {
+	border-bottom: 1px dotted #787878;
+}
+
 .no_border {
     border-top: 0px;
     border-left: 0px;
diff --git a/shinken/webui/htdocs/css/navigation.css b/shinken/webui/htdocs/css/navigation.css
index fd6625e..353837e 100644
--- a/shinken/webui/htdocs/css/navigation.css
+++ b/shinken/webui/htdocs/css/navigation.css
@@ -363,4 +363,39 @@
 	border:1px solid #aaaaaa;
 	padding:4px 6px 4px 6px;
 	margin:0px 0px 4px 0px;
+}
+
+/* ----------------------------------------------------------------
+ *  Tree menu
+ * ----------------------------------------------------------------*/
+.treeview {
+	margin-top: 15px;
+	color: #787878;
+}
+
+.treeview ul{ /*CSS for Simple Tree Menu*/
+	margin: 0;
+	padding: 0;
+}
+
+.treeview li{ /*Style for LI elements in general (excludes an LI that contains sub lists)*/
+	background: white url(list.gif) no-repeat left center;
+	list-style-type: none;
+	padding-left: 22px;
+	margin-bottom: 3px;
+}
+
+.treeview li.submenu{ /* Style for LI that contains sub lists (other ULs). */
+	background: white url(closed.gif) no-repeat left 1px;
+	cursor: hand !important;
+	cursor: pointer !important;
+}
+
+
+.treeview li.submenu ul{ /*Style for ULs that are children of LIs (submenu) */
+	display: none; /*Hide them by default. Don't delete. */
+}
+
+.treeview .submenu ul li{ /*Style for LIs of ULs that are children of LIs (submenu) */
+	cursor: default;
 }
\ No newline at end of file
diff --git a/shinken/webui/htdocs/css/text.css b/shinken/webui/htdocs/css/text.css
index 2e67d45..57da47c 100644
--- a/shinken/webui/htdocs/css/text.css
+++ b/shinken/webui/htdocs/css/text.css
@@ -14,7 +14,7 @@ body
 }
 
 a {
-    color : black;
+    color : #787878;
     text-decoration: none;
 }
 
diff --git a/shinken/webui/htdocs/js/UvumiDropdown.js b/shinken/webui/htdocs/js/UvumiDropdown.js
deleted file mode 100644
index ddb4498..0000000
--- a/shinken/webui/htdocs/js/UvumiDropdown.js
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
-UvumiTools Dropdown Menu v1.1.2 http://uvumi.com/tools/dropdown.html
-
-Copyright (c) 2009 Uvumi LLC
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var UvumiDropdown = new Class({
-	Implements:Options,
-	
-	options:{
-		clickToOpen:false,	//if set to true,  must click to open submenues
-		openDelay:150,	//if hover mode, duration the mouse must stay on target before submenu is opened. if exits before delay expires, timer is cleared 
-		closeDelay:500,	//delay before the submenu close when mouse exits. If mouse enter the submenu again before timer expires, it's cleared
-		duration:250,	//duration in millisecond of opening/closing effect
-		link:'cancel',
-		transition:Fx.Transitions.linear,	//effect's transitions. See http://docs.mootools.net/Fx/Fx.Transitions for more details
-		mode:'horizontal' //if set to horizontal, the top level menu will be displayed horizontally. If set to vertical, it will be displayed vertically. If it does not match any of those two words, 'horizontal' will be used.
-	},
-
-	initialize: function(menu,options){
-		this.menu = menu;
-		this.setOptions(options);
-		if(this.options.mode != 'horizontal' && this.options.mode != 'vertical'){
-			this.options.mode = 'horizontal';
-		}
-		//some versions of Safari and Chrome run domready before DOM is actually ready, causing wrong positioning. If you still have some display issues in those browser try to increase the delay value a bit. I tried to keep it as low as possible, but sometimes it can take a bit longer than expected
-		if(Browser.Engine.webkit){
-			window.addEvent('domready',this.domReady.delay(200,this));
-		}else{
-			window.addEvent('domready',this.domReady.bind(this));
-		}
-	},
-	
-	domReady:function(){
-		this.menu = $(this.menu);
-		if(!$defined(this.menu)){
-			return false;
-		}
-		//if passed element is not a UL, tries to find one in the children elements
-		if(this.menu.get('tag')!='ul'){
-			this.menu = this.menu.getElement('ul');
-			if(!$defined(this.menu)){
-				return false;
-			}
-		}
-		//handles pages written form right to left.
-		if(this.menu.getStyle('direction') == 'rtl' || $(document.body).getStyle('direction') == 'rtl'){
-			this.rtl = true;
-			if(Browser.Engine.trident && $(document.body).getStyle('direction') == 'rtl'){
-				this.menu.getParent().setStyle('direction','ltr');
-				this.menu.setStyle('direction','rtl');
-			}
-		}
-		//start setup
-		this.menu.setStyles({
-			visibility:'hidden',
-			display:'block',
-			overflow:'hidden',
-			height:0,
-			marginLeft:(Browser.Engine.trident?1:-1)
-		});
-		//we call the createSubmenu function on the main UL, which is a recursive function
-		this.createSubmenu(this.menu);
-		//the LIs must be floated to be displayed horisotally
-		if(this.options.mode=='horizontal'){
-			this.menu.getChildren('li').setStyles({
-				'float':(this.rtl?'right':'left'),
-				display:'block',
-				top:0
-			});
-		
-			//We create an extar LI which role will be to clear the floats of the others
-			var clear = new Element('li',{
-				html:" ",
-				styles:{
-					clear:(this.rtl?'right':'left'),
-					display:(Browser.Engine.trident?'inline':'block'), //took me forever to find that fix
-					position:'relative',
-					top:0,
-					height:0,
-					width:0,
-					fontSize:0,
-					lineHeight:0,
-					margin:0,
-					padding:0
-				}
-			}).inject(this.menu);
-		}else{
-			this.menu.getChildren('li').setStyles({
-				display:'block',
-				top:0
-			});
-		}
-		this.menu.setStyles({
-			height:'40px',
-			overflow:'visible',
-			visibility:'visible'
-		});
-		//hack for IE, again
-		this.menu.getElements('a').setStyle('display',(Browser.Engine.trident?'inline-block':'block'));
-	},
-	
-	createSubmenu:function(ul){
-		//we collect all the LI of the ul
-		var LIs = ul.getChildren('li');
-		var offset = 0;
-		//loop through the LIs
-		LIs.each(function(li){
-			li.setStyles({				
-				position:'relative',
-				display:'block',
-				top:-offset,
-				zIndex:1
-			});
-			offset += li.getSize().y;
-			var innerUl = li.getFirst('ul');
-			//if the current LI contains a UL
-			if($defined(innerUl)){
-				ul.getElements('ul').setStyle('display','none');
-				//if the current UL is the main one, that means we are still in the top row, and the submenu must drop down
-				if(ul == this.menu && this.options.mode == 'horizontal'){
-					li.addClass('submenu-down');
-					var x = 0;
-					var y = li.getSize().y;
-					this.options.link='cancel';
-					li.store('animation',new Fx.Elements($$(innerUl,innerUl.getChildren('li')).setStyle('opacity',0),this.options));
-				//if the current UL is not the main one, the sub menu must pop from the side
-				}else{
-					li.addClass('submenu-left');
-					var x = li.getSize().x-(this.rtl&&!Browser.Engine.trident?2:1)*li.getStyle('border-left-width').toInt();
-					var y = -li.getStyle('border-bottom-width').toInt();
-					this.options.link='chain';
-					li.store('animation',new Fx.Elements($$(innerUl,innerUl.getChildren('li')).setStyle('opacity',0),this.options));
-					offset=li.getSize().y+li.getPosition(this.menu).y;
-				}
-				innerUl.setStyles({
-					position:'absolute',
-					top:y+10,
-					opacity:0
-				});
-				ul.getElements('ul').setStyle('display','block');
-				if(this.rtl){
-					innerUl.setStyles({
-						right:x,
-						marginRight:-x
-					});
-				}else{
-					innerUl.setStyles({
-						left:x,
-						marginLeft:-x
-					});
-				}
-				//we call the createsubmenu function again, on the new UL
-				this.createSubmenu(innerUl);
-				//apply events to make the submenu appears when hovering the LI
-				if(this.options.clickToOpen){
-					li.addEvent('mouseenter',function(){
-							$clear(li.retrieve('closeDelay'));
-						}.bind(this)
-					);
-					li.getFirst('a').addEvent('click',function(e){
-						e.stop();
-						$clear(li.retrieve('closeDelay'));
-						this.showChildList(li);
-					}.bind(this));
-				}else{
-					li.addEvent('mouseenter',function(){
-						$clear(li.retrieve('closeDelay'));
-						li.store('openDelay',this.showChildList.delay(this.options.openDelay,this,li));
-					}.bind(this));
-				}
-				li.addEvent('mouseleave', function(){
-					$clear(li.retrieve('openDelay'));
-					li.store('closeDelay',this.hideChildList.delay(this.options.closeDelay,this,li));
-				}.bind(this));
-			}
-		},this);
-	},
-	
-	//display submenu
-	showChildList:function(li){
-		var ul = li.getFirst('ul');
-		var LIs =  $$(ul.getChildren('li'));
-		var animation = li.retrieve('animation');
-		//if the parent menu is not the main menu, the submenu must pop from the side
-		if(li.getParent('ul')!=this.menu || this.options.mode == 'vertical'){
-			animation.cancel();
-			var anim ={
-				0:{
-					opacity:1
-				},
-				1:{
-					opacity:1
-				}
-			};
-			if(this.rtl){
-				anim[0]['marginRight'] = 0;
-			}else{
-				anim[0]['marginLeft'] = 0;
-			}
-			animation.start(anim);
-			var animobject={};
-		//if the parent menu us the main menu, the submenu must drop down
-		}else{
-			var animobject = {0:{opacity:1}};
-		}
-		LIs.each(function(innerli,i){
-			animobject[i+1]={
-				top: 0,
-				opacity:1
-			};
-		});
-		li.setStyle('z-index',99);
-		animation.start(animobject);
-	},
-	
-	//hide the menu
-	hideChildList:function(li){
-		var animation = li.retrieve('animation');
-		var ul = li.getFirst('ul');
-		var LIs =  $$(ul.getChildren('li'));
-		var offset = 0;
-		var animobject={};
-		LIs.each(function(innerli,i){
-			animobject[i+1]={
-				top:-offset,
-				opacity:0
-			};
-			offset += innerli.getSize().y;
-		});
-		li.setStyle('z-index',1);
-		//if the parent menu is not the main menu, the submenu must fold up, and go to the left
-		if(li.getParent('ul')!=this.menu || this.options.mode == 'vertical'){
-			animobject[1]=null;
-			animation.cancel();
-			animation.start(animobject);
-			var anim = {
-				0:{
-					opacity:0
-				},
-				1:{
-					opacity:0
-				}
-			};
-			
-			if(this.rtl){
-				anim[0]['marginRight'] = -ul.getSize().x;
-			}else{
-				anim[0]['marginLeft'] = -ul.getSize().x;
-			}
-			animation.start(anim);
-		//if the parent menu is the main menu, the submenu must just fold up
-		}else{
-			animobject[0]={opacity:0};
-			animation.start(animobject);
-		}
-	}
-});
\ No newline at end of file
diff --git a/shinken/webui/plugins/eltdetail/views/eltdetail2.tpl b/shinken/webui/plugins/eltdetail/views/eltdetail2.tpl
index 4659ce7..da708a0 100644
--- a/shinken/webui/plugins/eltdetail/views/eltdetail2.tpl
+++ b/shinken/webui/plugins/eltdetail/views/eltdetail2.tpl
@@ -88,7 +88,7 @@ Invalid element name
 		    %# End of the host only case, so now service
 		    %else:
 			 	<dt>Host:</dt>
-		         <dd><a href="/host/{{elt.host.host_name}}">{{elt.host.host_name}}</a></dd>
+		         <dd><a href="/host/{{elt.host.host_name}}" class="link">{{elt.host.host_name}}</a></dd>
 		         <dt>Members of:</dt>
 		         %if len(elt.servicegroups) > 0:
 		         <dd> {{','.join([sg.get_name() for sg in elt.servicegroups])}}</dd>
@@ -326,8 +326,8 @@ Invalid element name
 						    <div class="content">
 						    	%#    Now print the dependencies if we got somes
 								%if len(elt.parent_dependencies) > 0:
-									<a id="togglelink-{{elt.get_dbg_name()}}" href="javascript:toggleBusinessElt('{{elt.get_dbg_name()}}')"> {{!helper.get_button('Show dependency tree', img='/static/images/expand.png')}}</a>
-							      		{{!helper.print_business_rules(datamgr.get_business_parents(elt))}}
+									<!--<a id="togglelink-{{elt.get_dbg_name()}}" href="javascript:toggleBusinessElt('{{elt.get_dbg_name()}}')"> {{!helper.get_button('Show dependency tree', img='/static/images/expand.png')}}</a>-->
+							      		{{!helper.print_business_tree(datamgr.get_business_parents(elt))}}
 								%end
 						    </div>
 						    <div class="content">

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list