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

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



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2007-01-05 23:26:11

Modified files:
	luci/cluster   : fence_device.js form-macros 

Log message:
	per-node fencing updates (related to bz212021)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.140&r2=1.141

--- conga/luci/cluster/fence_device.js	2006/12/01 14:56:53	1.2
+++ conga/luci/cluster/fence_device.js	2007/01/05 23:26:11	1.3
@@ -1,3 +1,14 @@
+function del_fence_instance(fi_div_id) {
+	delete_element_id(fi_div_id);
+}
+
+function del_fence(fence_id) {
+	delete_element_id(fence_id);
+}
+
+function add_fence_instance(fi_cont_id) {
+}
+
 function swap_fence_div(container_id, element_id) {
 	var container_element = document.getElementById(container_id);
 	if (!container_element) {
@@ -25,14 +36,12 @@
 
 	var fence_id = fence_opt.value;
 	var child_element = document.getElementById(fence_id);
-	if (container_element.firstChild)
-		container_element.removeChild(container_element.firstChild);
-
 	if (!child_element)
 		return (-1);
+	if (container_element.firstChild)
+		container_element.removeChild(container_element.firstChild);
 
 	var target = child_element.cloneNode(1);
-	target.id = null;
 
 	var fence_type = fence_id;
 	if (fence_opt.className.match(/shared_fencedev/)) {
@@ -46,10 +55,40 @@
 		}	
 	}
 
+	var target_form = document.createElement('form');
+	target_form.name = container_element.id;
+	target_form.appendChild(target);
+	container_element.appendChild(target_form);
+
 	var fi_form = document.getElementById(fence_type + '_instance');
-	if (fi_form)
-		target.appendChild(fi_form.cloneNode(1));
-	container_element.appendChild(target);
+	if (fi_form) {
+		var idiv = document.createElement('div');
+		idiv.id = container_id + '_instances';
+		idiv.name = idiv.id;
+
+		var cloned_iform = fi_form.cloneNode(1);
+		cloned_iform.id = container_id + '_0';
+		cloned_iform.name = cloned_iform.id;
+		cloned_iform.className = '';
+
+		var form_elem = document.createElement('form');
+		form_elem.name = cloned_iform.id;
+		form_elem.appendChild(cloned_iform);
+
+		idiv.appendChild(form_elem);
+		container_element.appendChild(idiv);
+	}
+
+	var remove_div = document.createElement('div');
+	remove_div.className = 'hbSubmit';
+	var remove_button = document.createElement('input');
+	remove_button.setAttribute('type', 'button');
+	remove_button.setAttribute('value', 'Remove this fence device');
+	remove_button.setAttribute('onclick', "del_fence('" + container_element.id + "');");
+	var remove_form = document.createElement('form');
+	remove_form.appendChild(remove_button);
+	remove_div.appendChild(remove_form);
+	container_element.appendChild(remove_div);
 }
 
 var num_fences_level = Array(0, 0)
@@ -67,7 +106,7 @@
 	var div_elem = document.createElement('div');
 	if (!div_elem)
 		return (-1);
-	var level_num_fences = num_fences_level[fence_level];
+	var level_num_fences = num_fences_level[fence_level - 1];
 
 	div_elem.id = 'fence' + fence_level + '_' + level_num_fences;
 	chooser_elem = chooser_elem.cloneNode(1);
@@ -91,5 +130,45 @@
 
 	div_elem.appendChild(chooser_elem);
 	container.appendChild(div_elem);
-	num_fences_level[fence_level]++;
+	num_fences_level[fence_level - 1]++;
+}
+
+function validate_fence(master_form, container_id) {
+	var errors = new Array();
+	var div_elem = document.getElementById(container_id);
+	if (!div_elem)
+		return (-1);
+	var form_xml = '';
+
+	var form = div_elem.getElementsByTagName('form');
+	for (var i = 0 ; i < form.length ; i++) {
+		var input_elem = form[i].getElementsByTagName('input');
+		var temp = '';
+		for (var j = 0 ; j < input_elem.length ; j++) {
+			var res_type = input_elem[j].type;
+			if (res_type == 'hidden' || res_type == 'text' ||
+				res_type == 'password')
+			{
+				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
+			} else if (res_type == 'checkbox' || res_type == 'radio') {
+				if (input_elem[j].checked)
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" checked="checked"';
+				if (res_type == 'radio')
+					temp += ' value="' + input_elem[j].value + '"';
+				temp += ' />';
+			}
+		}
+		var select_elem = form[i].getElementsByTagName('select');
+		for (var j = 0 ; j < select_elem.length ; j++) {
+			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
+		}
+
+		form_xml += '<form id="' + form[i].getAttribute('name') + '">' + temp + '</form>';
+	}
+
+	master_form.fence_xml.value = '<formlist>' + form_xml + '</formlist>';
+
+	if (confirm('Submit: ' + master_form.fence_xml.value))
+		return;
+		//form.submit();
 }
--- conga/luci/cluster/form-macros	2007/01/04 00:19:48	1.140
+++ conga/luci/cluster/form-macros	2007/01/05 23:26:11	1.141
@@ -1166,6 +1166,7 @@
 </div>
 
 <div metal:define-macro="shared-fence-option-list">
+	<option>Select a shared fence device</option>
 	<option name="fence_apc" value="fence_apc">APC Power Switch</option>
 	<option name="fence_wti" value="fence_wti">WTI Power Switch</option>
 	<option name="fence_brocade" value="fence_brocade">Brocade Fabric Switch</option>
@@ -1182,6 +1183,7 @@
 </div>
 
 <div metal:define-macro="fence-option-list">
+	<option>Select a fence device</option>
 	<option name="fence_apc" value="fence_apc">APC Power Switch</option>
 	<option name="fence_wti" value="fence_wti">WTI Power Switch</option>
 	<option name="fence_brocade" value="fence_brocade">Brocade Fabric Switch</option>
@@ -1249,15 +1251,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-apc" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1316,15 +1309,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-mcdata" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1374,15 +1358,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-wti" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1587,15 +1562,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-brocade" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1649,15 +1615,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-sanbox2" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1707,15 +1664,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-brocade" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1756,15 +1704,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-gnbd" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1814,15 +1753,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-egenera" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1879,6 +1809,7 @@
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
+		<input type="hidden" name="sharable" value="1" />
 		<input type="hidden" name="fence_type" value="fence_bladecenter" />
 	</div>
 </div>
@@ -1930,15 +1861,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-bullpap" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -2012,15 +1934,6 @@
 			</tr>
 		</table>	
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-xvm" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -2236,10 +2149,25 @@
 						tal:attributes="value cur_instance/switch | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2260,10 +2188,25 @@
 						tal:attributes="value cur_instance/pserver | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2277,10 +2220,25 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2294,10 +2252,25 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2311,10 +2284,25 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2328,10 +2316,25 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2345,10 +2348,25 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2362,10 +2380,25 @@
 						tal:attributes="value cur_instance/ipaddress | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2379,10 +2412,25 @@
 						tal:attributes="value cur_instance/ipaddress | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2396,10 +2444,25 @@
 						tal:attributes="value cur_instance/domain | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2413,10 +2476,25 @@
 						tal:attributes="value cur_instance/domain | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2445,8 +2523,70 @@
 		metal:use-macro="here/form-macros/macros/fence-instance-form-bladecenter" />
 </div>
 
+<div metal:define-macro="fencedev-instance-cond-ladder"
+	tal:condition="exists: cur_fence_type">
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_apc'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-apc" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_mcdata'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-mcdata" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_wti'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-wti" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_brocade'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-brocade" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_sanbox2'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-sanbox2" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_vixel'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-vixel" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_gnbd'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-gnbd" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_egenera'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-egenera" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_bullpap'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-bullpap" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_xvm'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-xvm" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_bladecenter'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-bladecenter" />
+	</tal:block>
+</div>
+
 <div metal:define-macro="node-form">
 	<script type="text/javascript"
+		src="/luci/homebase/homebase_common.js">
+	</script>
+	<script type="text/javascript"
 		src="/luci/cluster/fence_device.js">
 	</script>
 	<script type="text/javascript">
@@ -2647,13 +2787,6 @@
 	</div>
 
 	<table id="fence_devices" class="cluster node fence">
-		<tfoot class="fence">
-			<tr class="cluster node fence"><td class="cluster node fence">
-				<input type="button" value="Update fence properties"
-					onClick="validate_fence_properties('fence_devices')" />
-			</td></tr>
-		</tfoot>
-
 		<tbody class="fence">
 		<tr class="cluster node info_top fence">
 			<td class="cluster node fence">
@@ -2661,6 +2794,7 @@
 					<strong class="cluster node">Main Fencing Method</strong>
 				</span>
 			</td>
+
 			<td class="cluster node fence_backup">
 				<span class="fence">
 					<strong class="cluster node">Backup Fencing Method</strong>
@@ -2671,29 +2805,71 @@
 		<tr class="cluster node info_top fence">
 			<td class="cluster node fence_main fence">
 				<div class="fence_container">
+
 				<div id="fence_list_level1" tal:define="global cur_fence_num python: 0">
 					<tal:block tal:condition="exists: fenceinfo/level1">
-						<tal:block tal:repeat="cur_fencedev fenceinfo/level1">
+
+						<div tal:repeat="cur_fencedev fenceinfo/level1"
+							 tal:attributes="id python: 'fence1_' + str(cur_fence_num)">
+
 							<tal:block tal:define="
-								cur_fence_instances cur_fencedev/instance_list | nothing;
+								cur_fence_dev_id python: 'fence1_' + str(cur_fence_num);
 								cur_fence_type cur_fencedev/agent | nothing;
-								cur_fence_level python: 1;">
-								<div tal:attributes="id python: 'fence1_' + str(cur_fence_num)">
-									<tal:block
-										metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+								cur_fence_level python: 1">
+
+								<form tal:attributes="name cur_fence_dev_id | string:[unknown]">
+									<tal:block metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+								</form>
+
+								<tal:block
+									tal:define="global cur_instance_num python:0" />
+
+								<div tal:attributes="id python: cur_fence_dev_id + '_instances'">
+									<tal:block tal:condition="exists: cur_fencedev/instance_list">
+										<tal:block tal:repeat="cur_instance cur_fencedev/instance_list">
+											<tal:block
+												tal:define="global cur_fence_instance_id python: cur_fence_dev_id + '_' + str(cur_instance_num)" />
+
+											<div tal:attributes="
+												name cur_fence_instance_id | nothing;
+												id cur_fence_instance_id | nothing">
+
+												<form
+													tal:attributes="name cur_fence_instance_id | nothing">
+													<tal:block metal:use-macro="here/form-macros/macros/fencedev-instance-cond-ladder" />
+												</form>
+												<tal:block
+													tal:define="global cur_instance_num  python:cur_instance_num + 1" />
+											</div>
+										</tal:block>
+									</tal:block>
+								</div>
+								<div class="hbSubmit">
+									<input type="button" name="remove_fence"
+										value="Remove this fence device" />
 								</div>
+
+								<tal:block tal:define="global cur_fence_num python: cur_fence_num + 1" />
 							</tal:block>
-							<tal:block tal:define="global cur_fence_num python: cur_fence_num + 1" />
-						</tal:block>
+						</div>
 					</tal:block>
+
 					<tal:block
 						tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>num_fences_level[0] = ' + str(cur_fence_num) + ';</script>'" />
 				</div>
 
 				<div class="fence_control">
 					<input type="button" value="Add a fence to this level"
-						onclick="add_node_fence_device(1);" />
+						onclick="add_node_fence_device(1)" />
 				</div>
+				<div class="hbSubmit">
+					<form name="fence1_master">
+						<input type="hidden" name="fence_level" value="1" />
+						<input type="hidden" name="fence_xml" value="" />
+						<input type="button"
+							value="Update fence properties"
+							onclick="validate_fence(this.form, 'fence_list_level1')" />
+					</form>
 				</div>
 			</td>
 
@@ -2725,6 +2901,7 @@
 		</tbody>
 	</table>
 	</tal:block>
+
 	<tal:block tal:condition="python: 'ricci_error' in nodeinfo">
 		<hr/>
 		<strong class="errmsgs">
@@ -3707,19 +3884,24 @@
 		<tr class="cluster node info_top fence">
 			<td class="cluster node fence_main fence">
 				<form name="main_fence_form">
-				<select name="select_div"
-					onChange="swap_fence_div('fence_container',
-								this.options[this.selectedIndex].value)">
-					<tal:block metal:use-macro="here/form-macros/macros/shared-fence-option-list" />
-				</select>
+					<select name="select_div"
+						onChange="swap_fence_div('fence_container',
+									this.options[this.selectedIndex].value)">
+						<tal:block metal:use-macro="here/form-macros/macros/shared-fence-option-list" />
+					</select>
+				</form>
+
+				<form name="fencedevaddform" action="" method="post">
+					<div id="fence_container">
+					</div>
+					<div class="hbSubmit">
+						<input type="submit"
+							value="Add this shared fence device" />
+						<input type="hidden" name="pagetype"
+							value="51" id="pagetype" />
+						<input type="hidden" name="clustername" id="pagetype"
+							tal:attributes="value request/clustername" />
 				</form>
-        <form name="fencedevaddform" action="" method="post">
-				<div id="fence_container">
-				</div>
-			  <input type="submit" value="Add this shared fence device"/>
-        <input type="hidden" name="pagetype" value="51" id="pagetype" />
-        <input type="hidden" name="clustername" value="" id="pagetype" tal:attributes="value request/clustername"/>
-        </form>
 			</td>
 		</tr>
 		</tbody>
@@ -3740,7 +3922,7 @@
 
 	<tal:block tal:define="fencedevs python: here.getFenceInfo(modelb, None)">
 
-	<tal:block tal:condition="fencedevs/fencedevs">
+	<tal:block tal:condition="exists: fencedevs/fencedevs">
 		<table class="systemsTable">
 	        <thead class="systemsTable">
 				<tr class="systemsTable">
@@ -3843,34 +4025,47 @@
 <div metal:define-macro="fencedev-form">
 	<h2>Fence Device Form</h2>
 
-	<div class="cluster fencedev">
+	<div class="cluster fencedev fence">
 		<tal:block tal:define="
 			global cur_fencename request/fencename | nothing;
 			global cur_cluster request/clustername | nothing;
-			global cur_fence_type python: 'fence_apc'"/>
+			global cur_fence_type nothing" />
 
-		<span tal:condition="cur_fencename">
-			<span tal:define="
+		<tal:block tal:condition="cur_fencename">
+			<tal:block tal:define="
 					global cur_fencedev python:here.getFence(modelb,request);
-					global cur_fence_type cur_fencedev/agent" />
-		</span>
+					global cur_fence_type cur_fencedev/agent | nothing" />
+		</tal:block>
 
-  <form name="fencedeveditform" action="" method="post">	
-		<tal:block
-			metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
-    <input type="submit" value="Update this fence device"/>
-    <input type="hidden" name="pagetype" value="54" id="pagetype" />
-    <input type="hidden" name="clustername" value="" id="pagetype" tal:attributes="value request/clustername"/>
-    <input type="hidden" name="orig_name" value="" id="orig_name" tal:attributes="value request/fencename"/>
-  <input type="hidden" name="fencename" value="" id="fencename" tal:attributes="value request/fencename"/>
-  </form>
-  <form name="fencedevdeleteform" action="" method="post">
-  <input type="submit" value="Delete this fence device"/>
-  <input type="hidden" name="pagetype" value="57" id="pagetype"/>
-  <input type="hidden" name="clustername" value="" id="pagetype" tal:attributes="value request/clustername"/>
-  <input type="hidden" name="fencename" value="" id="fencename" tal:attributes="value request/fencename"/>
-    <input type="hidden" name="orig_name" value="" id="orig_name" tal:attributes="value request/fencename"/>
-  </form>
+		<form name="fencedeveditform" action="" method="post">	
+			<tal:block
+				metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+
+			<input type="hidden" name="pagetype" value="54" />
+			<input type="hidden" name="clustername"
+				tal:attributes="value request/clustername" />
+			<input type="hidden" name="orig_name"
+				tal:attributes="value request/fencename"/>
+  			<input type="hidden" name="fencename"
+				tal:attributes="value request/fencename" />
+
+			<div class="hbSubmit">
+				<input type="submit" value="Update this fence device" />
+			</div>
+		</form>
+
+		<form name="fencedevdeleteform" action="" method="post">
+			<input type="hidden" name="pagetype" value="57" />
+			<input type="hidden" name="clustername"
+				tal:attributes="value request/clustername" />
+			<input type="hidden" name="fencename"
+				tal:attributes="value request/fencename" />
+			<input type="hidden" name="orig_name"
+				tal:attributes="value request/fencename" />
+			<div class="hbSubmit">
+				<input type="submit" value="Delete this fence device" />
+			</div>
+		</form>
 	</div>
 </div>
 


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