Skip to contentSkip to conversation

conga/luci cluster/form-macros cluster/resourc ...

Cluster-devel [email protected] 1 participant 1 message Sep 13, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-13 17:50:22

Modified files:
luci/cluster : form-macros resource-form-macros
resource_form_handlers.js
luci/homebase : homebase_common.js luci_homebase.css luci/site/luci/Extensions: cluster_adapters.py

Log message:
service stuff..

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.63&r2=1.64

luci/cluster/form-macros +17 -12
@@ -1097,6 +1097,10 @@
 		global sinfo python: here.getServiceInfo(sstat, modelb,request);
 		global running sinfo/running | nothing;" />
 
+	<tal:block tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>'" />
+		var uuid_list = <tal:block tal:replace="sinfo/uuid_list" />;
+	<tal:block tal:replace="structure string: </script>" />
+
 	<table class="cluster service" width="100%">
 		<tr class="cluster service info_top">
 			<td class="cluster service service_name">
@@ -1144,25 +1148,26 @@
 
 	<div id="resskel" class="invisible">
 		<tal:block metal:use-macro="here/resource-form-macros/macros/resource-swap-form" />
-		<div name="expander" class="invisible">
+		<p class="invisible expander">
 			<img class="service_tree" name="arrow_down" alt="[-]"
 				src="/luci/cluster/arrow_down.png"
 				onClick="collapse_div(this)">
-			<span class="service_tree">Hide Children</span>
-		</div>
+			<span class="service_tree expander">Hide Children</span>
+		</p>
 	</div>
 
 	<h2>Service Composition</h2>
 
-	<div id="service_comp_list">
-	<div tal:repeat="res sinfo/resource_list"
-		tal:attributes="class python: 'service_comp rc_indent' + str(res['indent_ctr'])">
+	<div class="service_comp_list" tal:attributes="id sinfo/root_uuid">
 
+	<div tal:repeat="res sinfo/resource_list"
+		tal:attributes="
+			class python: 'service_comp rc_indent' + str(res['indent_ctr']);
+			id python: res['uuid']">
 
 		<tal:block
 			tal:condition="python: res['max_depth'] > 0"
-			tal:replace="structure python: '<div>'" />
-
+			tal:replace="structure python: '<div class=nothing>'" />
 
 		<tal:block tal:define="
 			global type res/type;
@@ -1200,14 +1205,14 @@
 			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 		</span>
 
-		<div name="expander"
+		<p
 			tal:attributes="
-				class python: res['max_depth'] == 0 and 'invisible' or ('rc_indent' + str(res['indent_ctr'] - 1))">
+				class python: (res['max_depth'] == 0 and 'invisible' or ('rc_indent' + str(res['indent_ctr'] - 1))) + ' expander'">
 			<img class="service_tree" name="arrow_down" alt="[-]"
 				src="/luci/cluster/arrow_down.png"
 				onClick="collapse_div(this)">
-			<span class="service_tree">Hide Children</span>
-		</div>
+			<span class="service_tree expander">Hide Children</span>
+		</p>
 
 		<tal:block
 			tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
luci/cluster/resource-form-macros +109 -61

370 lines not on this page · raw message

luci/cluster/resource_form_handlers.js +42 -27

103 lines not on this page · raw message

luci/homebase/homebase_common.js +20 -19
@@ -2,21 +2,26 @@
 	if (!image)
 		return (-1);
 
-	var span = image.parentNode.getElementsByTagName('span');
-	if (span && span.length > 0)
-		span = span[0];
-	else
-		span = null;
-
-	var div = null;
-	divc = image.parentNode.parentNode.parentNode.getElementsByTagName('div');
-	for (var i = 0 ; i < divc.length ; i++) {
-		if (divc[i].className.match(/service_comp/)) {
-			div = divc[i];
+	var span = null;
+	var pdiv = image.parentNode;
+	var spanc = pdiv.getElementsByTagName('span');
+	if (!spanc)
+		return (-1);
+	for (var i = 0 ; i < spanc.length ; i++) {
+		if (spanc[i].className.match(/expander/)) {
+			span = spanc[i];
 			break;
 		}
 	}
+	if (!span)
+		return (-1);
 
+	var div = image.parentNode.parentNode.nextSibling;
+	while (div) {
+		if (div.tagName && div.tagName.match(/^DIV$/i) && div.className.match(/expander/))
+			break;
+		div = div.nextSibling;
+	}
 	if (!div)
 		return (-1);
 
@@ -24,18 +29,14 @@
 		image.src = 'arrow_right.png';
 		image.name = 'arrow_right';
 		image.alt = '[-]';
-		if (span)
-			span.innerHTML = 'Show Children';
-		div.style.visibility = 'hidden';
-		div.style.display = 'none';
+		span.innerHTML = 'Show Children';
+		div.className = 'invisible expander service_comp';
 	} else {
 		image.src = 'arrow_down.png';
 		image.name = 'arrow_down';
 		image.alt = '[+]';
-		if (span)
-			span.innerHTML = 'Hide Children';
-		div.style.visibility = 'inherit';
-		div.style.display = 'block';
+		span.innerHTML = 'Hide Children';
+		div.className = 'expander service_comp';
 	}
 }
 
luci/homebase/luci_homebase.css +3 -2
@@ -146,7 +146,7 @@
 	margin-bottom: .25em;
 }
 
-div.hbSubmit {
+div.hbSubmit,p.hbSubmit {
 	margin-top: .5em;
 	margin-bottom: .5em;
 	margin-right: .5em;
@@ -381,10 +381,11 @@
 	margin-bottom: .25em ! important;
 }
 
-#service_comp_list {
+div.service_comp_list {
 	background: #dee7ec;
 	max-width: 700px;
 	padding: 1em;
+	margin-top: 0;
 }
 
 div.reschoose {
luci/site/luci/Extensions/cluster_adapters.py +15 -11
@@ -6,6 +6,7 @@
 from ricci_communicator import *
 import time
 import Products.ManagedSystem
+from Products.Archetypes.utils import make_uuid
 from Ip import Ip
 from Clusterfs import Clusterfs
 from Fs import Fs
@@ -919,15 +920,15 @@
   #set up struct for service config page
   baseurl = req['URL']
   cluname = req['clustername']
-  map = {}
+  hmap = {}
   servicename = req['servicename']
   for item in status:
     if item['type'] == "service":
       if item['name'] == servicename:
-        map['name'] = servicename
+        hmap['name'] = servicename
         starturls = list()
         if item['running'] == "true":
-          map['running'] = "true"
+          hmap['running'] = "true"
           #In this case, determine where it can run...
           innermap = {}
           nodename = item['nodename']
@@ -956,7 +957,7 @@
             starturl['url'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + servicename + "&pagetype=" + SERVICE_START + "&nodename=" + node.getName()
             starturls.append(starturl)
           innermap['links'] = starturls
-        map['innermap'] = innermap
+        hmap['innermap'] = innermap
 
   #Now build hashes for resources under service.
   #first get service by name from model
@@ -965,15 +966,16 @@
   if svc != None:
     indent_ctr = 0
     children = svc.getChildren()
-    
+    root_uuid = make_uuid('resource') 
     for child in children:
-      recurse_resources(child, resource_list, indent_ctr)
+      recurse_resources(root_uuid, child, resource_list, indent_ctr)
       
-  map['resource_list'] = resource_list 
-
-  return map
+  hmap['resource_list'] = resource_list
+  hmap['root_uuid'] = root_uuid
+  hmap['uuid_list'] = map(lambda x: make_uuid('resource'), range(30))
+  return hmap
 
-def recurse_resources(child, resource_list, indent_ctr, parent=None):
+def recurse_resources(parent_uuid, child, resource_list, indent_ctr, parent=None):
   #First, add the incoming child as a resource
   #Next, check for children of it
   #Call yourself on every children
@@ -992,6 +994,8 @@
     
   #Note: Final version needs all resource attrs
   rc_map['attrs'] = child.getAttributes()
+  rc_map['uuid'] = make_uuid('resource')
+  rc_map['parent_uuid'] = parent_uuid
 
   new_indent_ctr = indent_ctr + 1
 
@@ -999,7 +1003,7 @@
   kids = child.getChildren()
   child_depth = 0
   for kid in kids:
-    child_depth = recurse_resources(kid, resource_list, new_indent_ctr, child)
+    child_depth = recurse_resources(rc_map['uuid'], kid, resource_list, new_indent_ctr, child)
 
   rc_map['max_depth'] = child_depth
   return child_depth + 1