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

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



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2006-12-01 14:56:54

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

Log message:
	more fence device fixes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.117&r2=1.118
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.29&r2=1.30

--- conga/luci/cluster/fence_device.js	2006/11/29 18:39:50	1.1
+++ conga/luci/cluster/fence_device.js	2006/12/01 14:56:53	1.2
@@ -1,5 +1,5 @@
 function swap_fence_div(container_id, element_id) {
-	var container_element = document.getElementById(container_id)
+	var container_element = document.getElementById(container_id);
 	if (!container_element) {
 		return (-1);
 	}
@@ -17,3 +17,79 @@
 	target.id = null;
 	container_element.appendChild(target);
 }
+
+function swap_node_fence_div(container_id, fence_opt) {
+	var container_element = document.getElementById(container_id);
+	if (!container_element || !fence_opt || !fence_opt.value)
+		return (-1);
+
+	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);
+
+	var target = child_element.cloneNode(1);
+	target.id = null;
+
+	var fence_type = fence_id;
+	if (fence_opt.className.match(/shared_fencedev/)) {
+		var input_tags = target.getElementsByTagName('input');
+		for (var i = 0 ; i < input_tags.length ; i++) {
+			if (input_tags[i].type != 'button') {
+				input_tags[i].disabled = true;
+				if (input_tags[i].name == 'fence_type')
+					fence_type = input_tags[i].value;
+			}
+		}	
+	}
+
+	var fi_form = document.getElementById(fence_type + '_instance');
+	if (fi_form)
+		target.appendChild(fi_form.cloneNode(1));
+	container_element.appendChild(target);
+}
+
+var num_fences_level = Array(0, 0)
+
+function add_node_fence_device(fence_level) {
+	var cont_name = 'fence_list_level' + fence_level;
+	var container = document.getElementById(cont_name);
+	if (!container)
+		return (-1);
+
+	var chooser_elem = document.getElementById('fence_selection_block');
+	if (!chooser_elem)
+		return (-1);
+
+	var div_elem = document.createElement('div');
+	if (!div_elem)
+		return (-1);
+	var level_num_fences = num_fences_level[fence_level];
+
+	div_elem.id = 'fence' + fence_level + '_' + level_num_fences;
+	chooser_elem = chooser_elem.cloneNode(1);
+	chooser_elem.id = null;
+	chooser_elem.className = null;
+
+	var input_elems = chooser_elem.getElementsByTagName('input');
+	if (!input_elems || input_elems.length < 2)
+		return (-1);
+	for (var i = 0 ; i < input_elems.length ; i++) {
+		if (input_elems[i].name == 'fence_level')
+			input_elems[i].value = fence_level;
+		else if (input_elems[i].name == 'fence_num')
+			input_elems[i].value = level_num_fences++;
+	}
+
+	var select_elem = chooser_elem.getElementsByTagName('select');
+	if (!select_elem || select_elem.length != 1)
+		return (-1);
+	select_elem[0].setAttribute('onChange', "swap_node_fence_div('" + div_elem.id + "', this.options[this.selectedIndex])");
+
+	div_elem.appendChild(chooser_elem);
+	container.appendChild(div_elem);
+	num_fences_level[fence_level]++;
+}
--- conga/luci/cluster/form-macros	2006/11/30 22:31:22	1.117
+++ conga/luci/cluster/form-macros	2006/12/01 14:56:53	1.118
@@ -1141,7 +1141,7 @@
 
 	<div id="fence_apc" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>APC Power Switch</td>
 			</tr>
@@ -1183,7 +1183,7 @@
 
 	<div id="fence_mcdata" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>McData SAN Switch</td>
 			</tr>
@@ -1225,7 +1225,7 @@
 
 	<div id="fence_wti" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>WTI Power Switch</td>
 			</tr>
@@ -1260,7 +1260,7 @@
 
 	<div id="fence_ilo" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>HP iLO</td>
 			</tr>
@@ -1302,7 +1302,7 @@
 
 	<div id="fence_drac" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Dell Drac</td>
 			</tr>
@@ -1343,7 +1343,7 @@
 
 	<div id="fence_rsa" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>IBM RSA II</td>
 			</tr>
@@ -1385,7 +1385,7 @@
 
 	<div id="fence_brocade" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Brocade Fabric Switch</td>
 			</tr>
@@ -1427,7 +1427,7 @@
 
 	<div id="fence_sanbox2" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>QLogic SANbox2</td>
 			</tr>
@@ -1466,7 +1466,7 @@
 
 	<div id="fence_vixel" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Vixel SAN Switch</td>
 			</tr>
@@ -1501,7 +1501,7 @@
 
 	<div id="fence_gnbd" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>GNBD</td>
 			</tr>
@@ -1529,7 +1529,7 @@
 
 	<div id="fence_egenera" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Egenera SAN Controller</td>
 			</tr>
@@ -1564,7 +1564,7 @@
 
 	<div id="fence_bladecenter" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>IBM Blade Center</td>
 			</tr>
@@ -1606,7 +1606,7 @@
 
 	<div id="fence_bullpap" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Bull PAP</td>
 			</tr>
@@ -1648,7 +1648,7 @@
 
 	<div id="fence_rps10" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>RPS10 Serial Switch</td>
 			</tr>
@@ -1683,7 +1683,7 @@
 
 	<div id="fence_xvm" class="fencedev">
 	<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Virtual Machine Fencing</td>
 			</tr>
@@ -1703,7 +1703,7 @@
 
 	<div id="fence_scsi" class="fencedev">
 	<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>SCSI Reservation Fencing</td>
 			</tr>
@@ -1723,7 +1723,7 @@
 
 	<div id="fence_ipmilan" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>IPMI Lan</td>
 			</tr>
@@ -1769,7 +1769,7 @@
 
 	<div id="fence_manual" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Manual Fencing</td>
 			</tr>
@@ -1863,7 +1863,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-apc">
-	<div id="fence_apc_instance" class="fencedev">
+	<div id="fence_apc_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1884,7 +1884,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-egenera">
-	<div id="fence_egenera_instance" class="fencedev">
+	<div id="fence_egenera_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>lpan</td>
@@ -1905,7 +1905,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-wti">
-	<div id="fence_wti_instance" class="fencedev">
+	<div id="fence_wti_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1919,7 +1919,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-brocade">
-	<div id="fence_brocade_instance" class="fencedev">
+	<div id="fence_brocade_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1933,7 +1933,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-vixel">
-	<div id="fence_vixel_instance" class="fencedev">
+	<div id="fence_vixel_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1947,7 +1947,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-sanbox2">
-	<div id="fence_sanbox2_instance" class="fencedev">
+	<div id="fence_sanbox2_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1961,7 +1961,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-mcdata">
-	<div id="fence_mcdata_instance" class="fencedev">
+	<div id="fence_mcdata_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1975,7 +1975,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-gndb">
-	<div id="fence_gnbd_instance" class="fencedev">
+	<div id="fence_gnbd_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>IP Address</td>
@@ -1989,7 +1989,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-bladecenter">
-	<div id="fence_bladecenter_instance" class="fencedev">
+	<div id="fence_bladecenter_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Blade</td>
@@ -2003,7 +2003,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-bullpap">
-	<div id="fence_bullpap_instance" class="fencedev">
+	<div id="fence_bullpap_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Domain</td>
@@ -2017,7 +2017,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-xvm">
-	<div id="fence_xvm_instance" class="fencedev">
+	<div id="fence_xvm_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Domain</td>
@@ -2214,79 +2214,91 @@
 
 	<hr/>
 
-	<div id="invisible" class="invisible">
+	<div class="invisible" id="fence_device_list">
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-list" />
 	</div>
 
-	<table id="fence_devices" class="cluster node fencedev">
-		<tfoot class="fencedev">
-		<tr class="cluster node fencedev"><td class="cluster node fencedev">
-			<input type="button" value="Update fence properties"
-				onClick="validate_fence_properties('fence_devices')" />
-		</td></tr>
+	<div class="invisible" id="shared_fence_devices">
+		<tal:block tal:repeat="cur_fencedev fencedevinfo/fencedevs">
+			<tal:block metal:use-macro="here/form-macros/macros/shared-fence-device-list" />
+		</tal:block>
+	</div>
+
+	<div class="invisible" id="fence_instances">
+		<tal:block metal:use-macro="here/form-macros/macros/fence-instance-form-list" />
+	</div>
+
+	<div id="fence_selection_block" class="invisible">
+		<form name="main_fence_form">
+			<select name="select_div">
+				<option value="fence-form-new-device">------ Use an existing Fence Device ------</option>
+				<tal:block tal:repeat="f fencedevinfo/fencedevs">
+					<option class="shared_fencedev"
+						tal:attributes="value f/name"
+						tal:content="python: f['name'] + ' (' + f['pretty_name'] + ')'"
+					/>
+				</tal:block>
+				<option value="fence-form-new-instance">------ Create a new Fence Device ------</option>
+				<tal:block metal:use-macro="here/form-macros/macros/fence-option-list" />
+			</select>
+			<input type="hidden" name="fence_level" value="" />
+			<input type="hidden" name="fence_num" value="" />
+		</form>
+	</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="fencedev">
-		<tr class="cluster node info_top fencedev">
-			<td class="cluster node fencedev">
-				<span class="fencedev">
+
+		<tbody class="fence">
+		<tr class="cluster node info_top fence">
+			<td class="cluster node fence">
+				<span class="fence">
 					<strong class="cluster node">Main Fencing Method</strong>
 				</span>
 			</td>
 			<td class="cluster node fence_backup">
-				<span class="fencedev">
+				<span class="fence">
 					<strong class="cluster node">Backup Fencing Method</strong>
 				</span>
 			</td>
 		</tr>
 
-		<tr class="cluster node info_top fencedev">
-			<td class="cluster node fence_main fencedev">
-				<tal:block tal:repeat="cur_fencedev fencedevinfo/fencedevs">
-					<div class="invisible" id="shared_fence_devices">
-						<tal:block metal:use-macro="here/form-macros/macros/shared-fence-device-list" />
-					</div>
-				</tal:block>
+		<tr class="cluster node info_top fence">
+			<td class="cluster node fence_main fence"><div class="fence_container">
+				<div id="fence_list_level1">
+					<tal:comment tal:replace="nothing">
+						XXX - fill in any existing fence devices for this node
+						and update the counter number for this level
+					</tal:comment>
+				</div>
 
-				<form name="main_fence_form">
-				<select name="select_div"
-					onChange="swap_fence_div('fence_container',
-								this.options[this.selectedIndex].value)">
-					<option value="fence-form-new-device">------ Use an existing Fence Device ------</option>
-					<tal:block tal:repeat="f fencedevinfo/fencedevs">
-						<option class="shared_fencedev"
-							tal:attributes="value f/name"
-							tal:content="python: f['name'] + ' (' + f['pretty_name'] + ')'"
-						/>
-					</tal:block>
-					<option value="fence-form-new-instance">------ Create a new Fence Device ------</option>
-					<tal:block metal:use-macro="here/form-macros/macros/fence-option-list" />
-				</select>
-				</form>
-				<div id="fence_container">
+				<div class="fence_control">
+					<input type="button" value="Add a fence to this level"
+						onclick="add_node_fence_device(1);" />
 				</div>
-			</td>
-			<td class="cluster node fence_main fencedev">
-				<form name="backup_fence_form">
-				<select name="select_div"
-					onChange="swap_fence_div('fence_container_backup',
-						this.options[this.selectedIndex].value)">
-					<option value="fence-form-new-device">------ Use an existing Fence Device ------</option>
-					<option value="fence-form-new-instance">------ Create a new Fence Device ------</option>
-					<tal:block metal:use-macro="here/form-macros/macros/fence-option-list" />
-				</select>
-				</form>
-				<div id="fence_container_backup">
+			</div></td>
+
+			<td class="cluster node fence_main fence"><div class="fence_container">
+				<div id="fence_list_level2">
+					<tal:comment tal:replace="nothing">
+						XXX - fill in any existing fence devices for this node
+						and update the counter number for this level
+					</tal:comment>
 				</div>
-			</td>
+
+				<div class="fence_control">
+					<input type="button" value="Add a fence to this level"
+						onclick="add_node_fence_device(2)" />
+				</div>
+			</div></td>
 		</tr>
 		</tbody>
 	</table>
-	<script type="text/javascript">
-		swap_fence_div('fence_container',
-			document.main_fence_form.select_div.options[document.main_fence_form.select_div.selectedIndex].value);
-		swap_fence_div('fence_container_backup',
-			document.backup_fence_form.select_div.options[document.backup_fence_form.select_div.selectedIndex].value);
-	</script>
 </div>
 
 <div metal:define-macro="nodes-form">
@@ -3051,23 +3063,23 @@
 		<tal:block metal:use-macro="here/form-macros/macros/shared-fence-form-list" />
 	</div>
 
-	<table id="fence_devices" class="cluster node fencedev">
-		<tfoot class="fencedev">
-		<tr class="cluster node fencedev"><td class="cluster node fencedev">
+	<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="Add this shared fence device"
 				onClick="validate_fence_properties('fence_devices')" />
 		</td></tr>
 		</tfoot>
-		<tbody class="fencedev">
-		<tr class="cluster node info_top fencedev">
-			<td class="cluster node fencedev">
-				<span class="fencedev">
+		<tbody class="fence">
+		<tr class="cluster node info_top fence">
+			<td class="cluster node fence">
+				<span class="fence">
 					<strong class="cluster node">Fencing Type</strong>
 				</span>
 			</td>
 		</tr>
-		<tr class="cluster node info_top fencedev">
-			<td class="cluster node fence_main fencedev">
+		<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',
@@ -3208,7 +3220,7 @@
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-manual" />
 	</tal:block>
 
-	<div class="fencedev">
+	<div class="fence_submit">
 		<input class="hbInput" type="button" value="Submit" name="Submit" />
 	</div>
 	</div>
--- conga/luci/homebase/luci_homebase.css	2006/11/03 21:47:27	1.29
+++ conga/luci/homebase/luci_homebase.css	2006/12/01 14:56:54	1.30
@@ -14,27 +14,27 @@
 	background: #dee7ec;
 }
 
-div.fencedev {
+div.fence {
 	max-width: 700px;
 	padding: .5em;
 }
 
-*.fencedev {
+*.fence {
 	background: #dee7ec;
 }
 
-table.fencedev {
+table.fence {
 	padding: .618em;
 	width: 700px;
 }
 
-div.fencedev,
-td.fencedev {
+div.fence,
+td.fence {
 	padding-top: .309em;
 	padding-bottom: .309em;
 }
 
-td.fencedev {
+td.fence {
 	width: 50%;
 }
 
@@ -438,6 +438,21 @@
 	margin-bottom: .25em ! important;
 }
 
+div.fence_add {
+	margin-top: .25em ! important;
+	margin-bottom: .25em ! important;
+}
+
+div.fence_container {
+	border: thin solid #c9c9c9;
+}
+
+div.fence_control {
+	margin-top: 2em;
+	margin-bottom: .75em;
+	margin-left: .33em;
+}
+
 div.service_comp_list {
 	background: #dee7ec;
 	max-width: 700px;


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