[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2006-09-23 04:04:08

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

Log message:
	more cleanups, add the service add form to the service add page.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.17&r2=1.18

--- conga/luci/cluster/form-macros	2006/09/22 21:59:03	1.65
+++ conga/luci/cluster/form-macros	2006/09/23 04:04:08	1.66
@@ -165,7 +165,7 @@
 
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add Another Row" onClick="addSystem(adminform);" />
+						<input type="button" value="Add Another Row" onClick="addSystem(adminform);" />
 					</div>
 				</td></tr>
 			</tfoot>
@@ -238,7 +238,7 @@
 				</td></tr>
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add Another Row" onClick="addSystem(adminform);" />
+						<input type="button" value="Add Another Row" onClick="addSystem(adminform);" />
 					</div>
 				</td></tr>
 			</tfoot>
@@ -281,7 +281,7 @@
 		</tal:block>
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -670,7 +670,7 @@
 
 		<div class="spacing configTabContent"></div>
 		<div class="hbSubmit spacing configTabContent">
-			<input class="hbSubmit" type="button" value="Apply"
+			<input type="button" value="Apply"
 				onClick="validate_form(this.form);"
 			>
 		</div>
@@ -769,7 +769,7 @@
 		<tfoot class="systemsTable">
 			<tr class="systemsTable"><td class="systemsTable" colspan="3">
 				<div class="systemsTableEnd">
-					<input class="hbSubmit" type="button" value="Update node daemon properties" />
+					<input type="button" value="Update node daemon properties" />
 				</div>
 			</td></tr>
 		</tfoot>
@@ -991,7 +991,7 @@
 
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add Another Row" onClick="addSystem(adminform);" />
+						<input type="button" value="Add Another Row" onClick="addSystem(adminform);" />
 					</div>
 				</td></tr>
 			</tfoot>
@@ -1013,7 +1013,7 @@
 		</table>
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -1090,7 +1090,54 @@
 </div>
 
 <div metal:define-macro="serviceadd-form">
-	<h2>Service Add Form</h2>
+	<tal:block metal:use-macro="here/form-macros/macros/service-config-head-macro" />
+
+	<h2>Add a Service</h2>
+
+	<div id="resskel" class="invisible">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/service-compose-macro" /> 
+	</div>
+
+	<div class="service_comp_list">
+		<form name="service_name_form">
+			<table class="systemsTable">
+				<tr class="systemsTable">
+					<td class="systemsTable">
+						<strong class="reshdr">Service name</strong>
+					</td>
+					<td class="systemsTable">
+						<input type="text" length="20" name="service_name" value="" />
+					</td>
+				</tr>
+			</table>
+		</form>
+	</div>
+	<div class="service_comp_list" tal:attributes="id sinfo/root_uuid">
+	</div>
+
+	<div class="service_comp_list">
+		<form name="master">
+		<input type="button" value="Add a resource to this service"
+			onclick="add_child_resource(this.form);" />
+		<input type="button" value="Submit"
+			onClick="forms_to_xml()" />
+		<input type="hidden" name="uuid" value="toplevel" />
+		<input type="hidden" name="parent_uuid" value="_toplevel" />
+		<input type="hidden" name="tree_level" value="-1" />
+		<input type="hidden" name="form_xml" />
+		</form>
+	</div>
+
+	<div class="invisible" id="global_resources_block">
+		<tal:block tal:repeat="gr global_resources">
+			<tal:block tal:define="
+				global res gr;
+				global type res/type;
+				global resourceIsRef python: True" />
+
+			<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
+		</tal:block>
+	</div>
 </div>
 
 <div metal:define-macro="servicestart">
@@ -1112,7 +1159,34 @@
 	<!-- <span metal:use-macro="here/form-macros/macros/serviceconfig-form"/> -->
 </div>
 
-<div metal:define-macro="serviceconfig-form">
+<div metal:define-macro="serviceconfig-type-macro" tal:omit-tag="">
+	<span tal:omit-tag="" tal:condition="python: type == 'IP Address: '">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'fs'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'smb'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'Script: '">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+	</span>
+</div>
+
+<div metal:define-macro="service-config-head-macro" tal:omit-tag="">
 	<script type="text/javascript"
 		src="/luci/homebase/homebase_common.js">
 	</script>
@@ -1132,7 +1206,10 @@
 		var active_resources = <tal:block tal:replace="python: map(lambda x: str(x['name']), sinfo['resource_list']) or 'null'" />;
 		var resource_names = <tal:block tal:replace="python: (map(lambda x: str(x['name']), global_resources) + map(lambda x: str(x['name']), sinfo['resource_list'])) or 'null'" />;
 	<tal:block tal:replace="structure string: </script>" />
+</div>
 
+<div metal:define-macro="serviceconfig-form">
+	<tal:block metal:use-macro="here/form-macros/macros/service-config-head-macro" />
 	<table class="cluster service" width="100%">
 		<tr class="cluster service info_top">
 			<td class="cluster service service_name">
@@ -1178,14 +1255,13 @@
 	</table>
 	<br/>
 
+	<h2>Service Composition</h2>
+
 	<div id="resskel" class="invisible">
 		<tal:block metal:use-macro="here/resource-form-macros/macros/service-compose-macro" /> 
 	</div>
 
-	<h2>Service Composition</h2>
-
 	<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']);
@@ -1199,48 +1275,24 @@
 			global type res/type;
 			global resourceIsRef res/ref_object | nothing" />
 
-		<span tal:omit-tag="" tal:condition="python: type == 'IP Address: '">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'fs'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'smb'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'Script: '">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-		</span>
+		<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 
 		<tal:block
 			tal:condition="python: 'indent_ctr' in res and 'max_depth' in res"
 			tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
+		</div>
 	</div>
-	<form name="master">
-		<input type="button" class="hbSubmit"
-			value="Save changes"
+	<div class="service_comp_list">
+		<form name="master">
+		<input type="button" value="Add a resource to this service"
+			onclick="add_child_resource(this.form);" />
+		<input type="button" value="Save changes"
 			onClick="forms_to_xml()" />
+		<input type="hidden" name="uuid" value="toplevel" />
+		<input type="hidden" name="parent_uuid" value="_toplevel" />
+		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="form_xml" />
-	</form>
+		</form>
 	</div>
 
 	<div class="invisible" id="global_resources_block">
@@ -1250,37 +1302,7 @@
 				global type res/type;
 				global resourceIsRef python: True" />
 
-		<span tal:omit-tag="" tal:condition="python: type == 'IP Address: '">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'fs'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'smb'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'Script: '">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-		</span>
+			<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 		</tal:block>
 	</div>
 </div>
--- conga/luci/cluster/resource-form-macros	2006/09/22 21:59:03	1.15
+++ conga/luci/cluster/resource-form-macros	2006/09/23 04:04:08	1.16
@@ -6,15 +6,15 @@
 
 <div metal:define-macro="res_form_footer" tal:omit-tag="">
 	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
+		<input type="button"
 			onClick="validate_form(this.form);"
 			value="Submit"
 			tal:condition="not: sinfo" />
 
 		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
+			<input type="button" value="Add a child"
 				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
+			<input type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
 	</p>
--- conga/luci/cluster/resource_form_handlers.js	2006/09/22 21:59:03	1.11
+++ conga/luci/cluster/resource_form_handlers.js	2006/09/23 04:04:08	1.12
@@ -271,16 +271,15 @@
 
 function add_child_resource(form) {
 	if (!form || !form.tree_level || !form.parent_uuid || !form.uuid ||
-		!is_valid_int(form.tree_level.value, 0, null))
+		!is_valid_int(form.tree_level.value, -1, null))
 	{
 		return (-1);
 	}
 
 	var ilevel = Number(form.tree_level.value) + 1;
 	var sdiv = document.getElementById('resskel');
-	if (!sdiv) {
+	if (!sdiv)
 		return (-1);
-	}
 
 	var pdiv = document.getElementById(form.uuid.value);
 	if (!pdiv) {
--- conga/luci/homebase/form-macros	2006/09/22 18:22:39	1.36
+++ conga/luci/homebase/form-macros	2006/09/23 04:04:08	1.37
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.36 2006/09/22 18:22:39 rmccabe Exp $
+	$Id: form-macros,v 1.37 2006/09/23 04:04:08 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -72,7 +72,7 @@
 			tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
 
 		<div class="hbSubmit" tal:condition="python:userList" id="hbSubmit">
-			<input class="hbSubmit" name="Submit" type="button" value="Delete This User" onClick="validateForm(document.adminform);" />
+			<input name="Submit" type="button" value="Delete This User" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 
@@ -138,7 +138,7 @@
 			tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input class="hbSubmit" name="Submit" type="button" value="Submit" onClick="validateForm(document.adminform);" />
+			<input name="Submit" type="button" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -245,7 +245,7 @@
 			tal:attributes="value python: num_clusters + 1" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Update Permissions" value="Update Permissions" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Update Permissions" value="Update Permissions" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 
@@ -351,7 +351,7 @@
 			tal:attributes="value python: num_clusters + 1" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Remove Selected Systems" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Remove Selected Systems" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 
@@ -413,7 +413,7 @@
 
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add another entry" onClick="addSystem(adminform);" />
+						<input type="button" value="Add another entry" onClick="addSystem(adminform);" />
 					</div>
 				</td></tr>
 			</tfoot>
@@ -435,7 +435,7 @@
 		</table>
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -540,7 +540,7 @@
 			tal:attributes="value python: sysNum" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Add This Cluster" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Add This Cluster" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -609,7 +609,7 @@
 		<input type="hidden" name="numStorage" value="1" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
--- conga/luci/homebase/luci_homebase.css	2006/09/13 17:50:22	1.22
+++ conga/luci/homebase/luci_homebase.css	2006/09/23 04:04:08	1.23
@@ -1,5 +1,11 @@
 input[type=text], input[type=password] {
 	padding: .2em ! important;
+	font-family: "Bitstream Vera Sans Mono", "DejaVu Sans Mono", monospace;
+	font-size: 11px;
+}
+
+input[type=button] {
+	font-size: 11px;
 }
 
 input[type=checkbox], input[type=radio] {
@@ -19,7 +25,6 @@
 
 input.qdisk {
 	padding: .2em;
-	font-size: 10px;
 }
 
 input.qdname {
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/09/22 18:24:45	1.66
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/09/23 04:04:08	1.67
@@ -843,9 +843,9 @@
       rb = ricci_bridge(node[1].getId())
       if rb.getRicciResponse() == True:
         return node[1].getId()
-    return None
+    return ""
   else:
-    return None
+    return ""
   
 
 def getClusterStatus(self, ricci_name):
@@ -921,7 +921,17 @@
   baseurl = req['URL']
   cluname = req['clustername']
   hmap = {}
-  servicename = req['servicename']
+  root_uuid = 'toplevel'
+
+  hmap['root_uuid'] = root_uuid
+  hmap['uuid_list'] = map(lambda x: make_uuid('resource'), xrange(30))
+
+  try:
+      servicename = req['servicename']
+  except KeyError, e:
+      hmap['resource_list'] = {}
+      return hmap
+
   for item in status:
     if item['type'] == "service":
       if item['name'] == servicename:
@@ -966,13 +976,10 @@
   if svc != None:
     indent_ctr = 0
     children = svc.getChildren()
-    root_uuid = 'toplevel';
     for child in children:
       recurse_resources(root_uuid, child, resource_list, indent_ctr)
       
   hmap['resource_list'] = resource_list
-  hmap['root_uuid'] = root_uuid
-  hmap['uuid_list'] = map(lambda x: make_uuid('resource'), xrange(30))
   return hmap
 
 def recurse_resources(parent_uuid, child, resource_list, indent_ctr, parent=None):
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2006/08/14 16:01:59	1.17
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2006/09/23 04:04:08	1.18
@@ -127,9 +127,12 @@
     if hello != None:
         pass
         #print hello.toxml()
-    self.__sendall(CLUSTER_STR, ss)
-    
-    
+    try:
+        self.__sendall(CLUSTER_STR, ss)
+    except sslerror, e:
+        sock.close()
+        return ''
+
     # receive response
     doc = self.__receive(ss)
     if doc == None:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]