Skip to contentSkip to conversation

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

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

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-08 22:54:32

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

Log message:
resource and service stuff

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.56&r2=1.57
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.62&r2=1.63

luci/cluster/form-macros +5 -3
@@ -1139,13 +1139,14 @@
 	<br/>
 	<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'])">
 
 
 		<tal:block
 			tal:condition="python: res['max_depth'] > 0"
-			tal:replace="structure string:<div>" />
+			tal:replace="structure python: '<div>'" />
 
 
 		<tal:block tal:define="
@@ -1187,8 +1188,8 @@
 		<div
 			tal:condition="python: res['max_depth'] != 0"
 			tal:attributes="
-				class python: 'service_tree rc_indent' + str(res['indent_ctr'] - 1)">
-			<img class="service_tree" name="arrow_down"
+				class python: 'rc_indent' + str(res['indent_ctr'] - 1)">
+			<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>
@@ -1197,6 +1198,7 @@
 		<tal:block
 			tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
 	</div>
+	</div>
 </div>
 
 <div metal:define-macro="service-form">
luci/cluster/index_html +1 -0
@@ -29,6 +29,7 @@
       </metal:cache>
 
       <metal:headslot define-slot="head_slot" />
+		<tal:block tal:define="global sinfo nothing" />
     <div tal:define="global hascluster request/clustername |nothing; global busywaiting python:None;"/>
     <span tal:condition="not: hascluster">
     <meta googaa="ooo"/>
luci/cluster/resource-form-macros +241 -248

924 lines not on this page · raw message

luci/cluster/resource_form_handlers.js +24 -8
@@ -18,11 +18,14 @@
 
 function validate_ip(form) {
 	var errors = new Array();
-	var ipstr =	form.ip1.value + '.' + form.ip2.value + '.' +
-				form.ip3.value + '.' + form.ip4.value;
 
+	if (!form.ip_address || str_is_blank(form.ip_address.value))
+		errors.push('You did not give an IP address.');
+	return (errors);
+
+	var ipstr =	form.ip_address.value;
 	if (!isValidHost(ipstr))
-		errors.push('\"' + ipstr '\" is an invalid IP address.');
+		errors.push('\"' + ipstr + '\" is an invalid IP address.');
 	return (errors);
 }
 
@@ -71,7 +74,7 @@
 }
 
 function validate_gfs(form) {
-	my errors = new Array();
+	var errors = new Array();
 
 	if (!form.mountpoint || str_is_blank(form.mountpoint.value))
 		errors.push('No file system mount point was given.');
@@ -110,20 +113,33 @@
 form_validators['scr'] = validate_script;
 form_validators['smb'] = validate_samba;
 
-function validate(form) {
+function validate_form(form) {
 	var valfn = form_validators[form.type.value];
 	if (!valfn)
 		return (-1);
 
-	if (error_dialog(valfn(form)))
+	var errors = valfn(form);
+	if (form.type.value != 'ip') {
+		if (!form.resourceName || str_is_blank(form.resourceName.value))
+			errors.push('No resource name was given.')
+	}
+
+	if (error_dialog(errors))
 		return (-1);
 	form.submit();
 }
 
 function delete_resource(form) {
-	return (-1);
+	if (!confirm('Are you sure you want to delete this resource?'))
+		return (-1);
+	form.submit();
 }
 
 function add_child_resource(form) {
-	return (-1);
+	if (!form || !form.tree_level ||
+		!is_valid_int(form.tree_level.value, 0, null))
+	{
+		return (-1);
+	}
+	var level = Number(form.tree_level.value);
 }
luci/homebase/homebase_common.js +12 -3
@@ -8,14 +8,22 @@
 	else
 		span = null;
 
-	div = image.parentNode.parentNode.parentNode.getElementsByTagName('div');
-	if (!div || div.length < 1)
+	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];
+			break;
+		}
+	}
+
+	if (!div)
 		return (-1);
-	div = div[3];
 
 	if (image.name == 'arrow_down') {
 		image.src = 'arrow_right.png';
 		image.name = 'arrow_right';
+		image.alt = '[-]';
 		if (span)
 			span.innerHTML = 'Show Children';
 		div.style.visibility = 'hidden';
@@ -23,6 +31,7 @@
 	} else {
 		image.src = 'arrow_down.png';
 		image.name = 'arrow_down';
+		image.alt = '[+]';
 		if (span)
 			span.innerHTML = 'Hide Children';
 		div.style.visibility = 'inherit';
luci/homebase/luci_homebase.css +32 -25

84 lines not on this page · raw message

luci/site/luci/Extensions/cluster_adapters.py +26 -24

116 lines not on this page · raw message