Skip to contentSkip to conversation

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

Cluster-devel [email protected] 1 participant 1 message Feb 8, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-02-08 03:42:58

Modified files:
luci/cluster : form-macros validate_fdom.js
luci/site/luci/Extensions: cluster_adapters.py

Log message:
Support editing fdoms

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.181&r2=1.182
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fdom.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.233&r2=1.234

luci/cluster/form-macros +10 -6
@@ -4353,14 +4353,14 @@
 				<td>
 					<input type="checkbox" name="prioritized" id="prioritized"
 						onchange="fdom_set_prioritized(this.form, this.checked)"
-						tal:attributes="checked fdom/prioritied | nothing" />
+						tal:attributes="checked python: (fdom and 'prioritized' in fdom and fdom['prioritized'] == '1') and 'checked' or ''" />
 				</td>
 			</tr>
 			<tr class="systemsTable">
 				<td>Restrict failover to this domain's members</td>
 				<td>
 					<input type="checkbox" name="restricted"
-						tal:attributes="checked fdom/restricted | nothing" />
+						tal:attributes="checked python: (fdom and 'restricted' in fdom and fdom['restricted'] == '1') and 'checked' or ''" />
 				</td>
 			</tr>
 			<tr class="systemsTable">
@@ -4393,15 +4393,17 @@
 					<td class="systemsTable" width="10%">
 						<input type="checkbox"
 							onchange="fdom_set_member(this.form, this.name, this.checked)"
-							tal:attributes="name n" />
+							tal:attributes="
+								checked python: ('members' in fdom and n in fdom['members']) and 'checked' or '';
+								name n" />
 					</td>
 					<td class="systemsTable" width="75%">
 						<input type="text" class="fdom_priority"
 							tal:attributes="
 								id n;
 								name python: '__PRIORITY__' + n;
-								value from/members/n/priority | string:1;
-								disabled not:fdom/prioritied | nothing" />
+								value python: ('members' in fdom and n in fdom['members'] and 'priority' in fdom['members'][n]) and fdom['members'][n]['priority'] or '1';
+								disabled python: (not fdom or not 'prioritized' in fdom or fdom['prioritized'] != '1' or not 'members' in fdom or not n in fdom['members']) and 'disabled' or ''" />
 					</td>
 				</tr>
 			</tal:block>
@@ -4424,11 +4426,13 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? failover domains ??? Configure a failover domain');
 	</script>
-	<h2>Failover Domain Configuration Form</h2>
 </div>
 
 <div metal:define-macro="fdom-form">
 	<h2>Failover Domain Form</h2>
+	<tal:block tal:define="fdom python:here.getFdomInfo(modelb, request)">
+		<tal:block metal:use-macro="here/form-macros/macros/fdom-macro" />
+	</tal:block>
 </div>
 
 <div metal:define-macro="fdomprocess-form">
luci/cluster/validate_fdom.js +5 -1
@@ -31,6 +31,10 @@
 	if (error_dialog(errors))
 		return (-1);
 
-	if (confirm('Add this failover domain?'))
+	var confirm_msg = 'Add this failover domain?';
+	if (form.oldname)
+		confirm_msg = 'Update this failover domain?';
+
+	if (confirm(confirm_msg))
 		form.submit();
 }
luci/site/luci/Extensions/cluster_adapters.py +56 -9

125 lines not on this page · raw message