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

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



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2006-08-16 19:08:36

Modified files:
	luci/cluster   : form-macros 
	luci/homebase  : homebase_common.js 

Log message:
	more cluster properties config form bits, and cleanups for homebase

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.2&r2=1.3

--- conga/luci/cluster/form-macros	2006/08/15 22:27:05	1.44
+++ conga/luci/cluster/form-macros	2006/08/16 19:08:35	1.45
@@ -398,6 +398,27 @@
 	</div>
 
 	<div id="configTabContent" tal:condition="python: configTabNum == 3">
+		<script type="text/javascript">
+			var prev_mcast_str = '';
+
+			function disable_mcast(addrId) {
+				addrObj = document.getElementById(addrId);
+				if (!addrObj || addrObj.disabled)
+					return;
+				addrObj.disabled = true;
+				prev_mcast_str = addrObj.value;
+				addrObj.value = '';
+			}
+
+			function enable_mcast(addrId) {
+				addrObj = document.getElementById(addrId);
+				if (!addrObj || !addrObj.disabled)
+					return;
+				addrObj.disabled = false;
+				addrObj.value = prev_mcast_str;
+			}
+		</script>
+
 		<form name="multicast" action="" method="get" tal:attributes="action clusterinfo/multicast_url">
 		<table id="systemsTable" class="systemsTable" border="0" cellspacing="0">
 			<thead class="systemsTable"> 
@@ -412,7 +433,7 @@
 				<tr class="systemsTable">
 					<td class="systemsTable">
 						<input type="radio" name="mcast" value="False"
-							onchecked="javascript:document.getElementById('mcast_address').disabled=true;"
+							onClick="disable_mcast('mcast_address');"
 							tal:attributes="checked python:clusterinfo['is_mcast'] != 'True'"
 						/>
 						Let cluster choose the multicast address
@@ -422,7 +443,7 @@
 				<tr class="systemsTable">
 					<td class="systemsTable">
 						<input type="radio" name="mcast" value="True"
-							onchecked="javascript:document.getElementById('mcast_address').disabled=false;"
+							onClick="enable_mcast('mcast_address');"
 							tal:attributes="checked python:clusterinfo['is_mcast'] == 'True'"
 						
 						/>
@@ -435,7 +456,7 @@
 						<input type="text" name="mcast_address" id="mcast_address"
 							tal:attributes="
 								disabled python: clusterinfo['is_mcast'] != 'True' and '1' or '0';
-								value clusterinfo/mcast_addr"
+								value python: clusterinfo['is_mcast'] == 'True' and clusterinfo['mcast_addr'] or '';"
 						/>
 					</td>
 				</tr>
@@ -454,6 +475,120 @@
 
 	<div id="configTabContent" tal:condition="python: configTabNum == 4">
 		<form name="quorum_partition" action="" method="get" tal:attributes="action clusterinfo/quorumd_url">
+		<script type="text/javascript">
+			oldInput = null;
+
+			function addHeuristic(parent_name) {
+				parent = document.getElementById(parent_name);
+				if (!parent)
+					return;
+				hnum = document.getElementById('num_heuristics');
+				if (!hnum)
+					return;
+
+				var cur_hnum = Number(hnum.value) + 1;
+				if (cur_hnum >= 10) {
+					alert('There is a maximum of 10 heuristics.');
+					return;
+				}
+				hstr = 'heuristic' + cur_hnum + ':';
+
+				name_td = document.createElement('td');
+				name_td.className = 'systemsTable';
+				name_input = document.createElement('input');
+				name_input.className = 'qdname qdisk';
+				name_input.setAttribute('name', hstr + 'hname'); 
+				name_input.setAttribute('id', hstr + 'hname'); 
+				name_input.setAttribute('type', 'text');
+				name_td.appendChild(name_input);
+
+				path_td = document.createElement('td');
+				path_td.className = 'systemsTable';
+				path_input = document.createElement('input');
+				path_input.className = 'qdpath qdisk';
+				path_input.setAttribute('name', hstr + 'hprog'); 
+				path_input.setAttribute('id', hstr + 'hprog'); 
+				path_input.setAttribute('type', 'text');
+				path_td.appendChild(path_input);
+
+				interval_td = document.createElement('td');
+				interval_td.className = 'systemsTable';
+				interval_input = document.createElement('input');
+				interval_input.className = 'qdint qdisk';
+				interval_input.setAttribute('name', hstr + 'hinterval'); 
+				interval_input.setAttribute('id', hstr + 'hinterval'); 
+				interval_input.setAttribute('type', 'text');
+				interval_td.appendChild(interval_input);
+
+				score_td = document.createElement('td');
+				score_td.className = 'systemsTable';
+				score_input = document.createElement('input');
+				score_input.className = 'qdscore qdisk';
+				score_input.setAttribute('name', hstr + 'hscore'); 
+				score_input.setAttribute('id', hstr + 'hscore'); 
+				score_input.setAttribute('type', 'input');
+				score_td.appendChild(score_input); 
+
+				tr = document.createElement('tr');
+				tr.className = 'systemsTable';
+				tr.appendChild(name_td);
+				tr.appendChild(path_td);
+				tr.appendChild(interval_td);
+				tr.appendChild(score_td);
+				parent.appendChild(tr);
+				hnum.value++;
+			}
+
+			function disableChildrenInput(parent_name) {
+				parent = document.getElementById(parent_name);
+				if (!parent)
+					return;
+
+				inputElem = parent.getElementsByTagName('input');
+				if (!inputElem || inputElem.length < 1) {
+					oldInput = null;
+					return;
+				}
+				if (inputElem[0].disabled)
+					return;
+				oldInput = new Array(inputElem.length);
+				for (var i = 0 ; i < inputElem.length ; i++) {
+					e = inputElem[i];
+
+					e.disabled = true;
+					if (e.type == 'button')
+						continue;
+					oldInput[e.name] = e.value;
+					e.value = '';
+				}
+			}
+
+			function enableChildrenInput(parent_name) {
+				parent = document.getElementById(parent_name);
+				if (!parent)
+					return;
+
+				inputElem = parent.getElementsByTagName('input');
+				if (!inputElem || inputElem.length < 1) {
+					return;
+				}
+
+				if (!inputElem[0].disabled)
+					return;
+
+				for (var i = 0 ; i < inputElem.length ; i++) {
+					e = inputElem[i];
+					e.disabled = false;
+					if (e.type == 'button')
+						continue;
+					if (oldInput && oldInput[e.name])
+						e.value = oldInput[e.name];
+					else
+						e.value = '';
+				}
+				oldInput = null;
+			}
+		</script>
 		<div class="configTabContent">
 		<table id="systemsTable" class="systemsTable" border="0" cellspacing="0">
 			<thead class="systemsTable"> 
@@ -465,13 +600,17 @@
 			</thead>
 
 			<tbody class="systemsTable">
-				<tr class="systemsTable"><td class="systemsTable">
-					<input type="radio" name="quorumd" value="False" checked="" tal:attributes="checked python:clusterinfo['is_quorumd'] != 'True'"/>
+				<tr class="systemsTable" id="st_row"><td class="systemsTable" id="st_col">
+					<input type="radio" name="quorumd" value="False"
+						onClick="disableChildrenInput('quorumdisk');"
+						tal:attributes="checked python:clusterinfo['is_quorumd'] != 'True'"/>
 					Do not use a Quorum Partition
 				</td></tr>
 
 				<tr class="systemsTable"><td class="systemsTable">
-					<input type="radio" name="quorumd" value="True"/>
+					<input type="radio" name="quorumd" value="True"
+						onClick="enableChildrenInput('quorumdisk');"
+						tal:attributes="checked python:clusterinfo['is_quorumd'] == 'True'"/>
 						Use a Quorum Partition
 				</td></tr>
 			</tbody>
@@ -558,7 +697,7 @@
 				</tr>
 			</thead>
 
-			<tbody class="systemsTable"
+			<tbody class="systemsTable" id='heuristicList'
 				tal:define="global heuristics clusterinfo/hlist">
 
 				<tal:block tal:condition="python: not len(heuristics)">
@@ -619,7 +758,7 @@
 			</tbody>
 			<tfoot>
 				<tr class="systemsTable"><td class="systemsTable">
-					<input class="addrow" type="button" value="Add another heuristic">
+					<input class="addrow" type="button" value="Add another heuristic" onClick="addHeuristic('heuristicList');">
 				</td></tr>
 			</tfoot>
 		</table>
@@ -630,6 +769,9 @@
 		<div class="hbSubmit spacing configTabContent">
 			<input class="hbSubmit" type="submit" value="Apply">
 		</div>
+			<script tal:condition="python:clusterinfo['is_quorumd'] != 'True'">
+				disableChildrenInput('quorumdisk');
+			</script>
 		</form>
 	</div>
 </div>
--- conga/luci/homebase/homebase_common.js	2006/07/18 19:25:20	1.2
+++ conga/luci/homebase/homebase_common.js	2006/08/16 19:08:36	1.3
@@ -114,14 +114,14 @@
 	var num_systems = form.numStorage.value;
 
 	var newsys = document.createElement('input');
-	newsys.setAttribute('style', 'padding:.20em !important;width:200px;');
+	newsys.className = 'hbInputSys';
 	newsys.setAttribute('name', '__SYSTEM' + num_systems + ':Addr');
 	newsys.setAttribute('id', '__SYSTEM' + num_systems + ':Addr');
 	newsys.setAttribute('type', 'text');
 	newsys.setAttribute('value', '');
 
 	var newsysp = document.createElement('input');
-	newsysp.setAttribute('style', 'padding:.20em !important;width:160px;');
+	newsysp.className = 'hbInputPass';
 	newsysp.setAttribute('name', '__SYSTEM' + num_systems + ':Passwd');
 	newsysp.setAttribute('id', '__SYSTEM' + num_systems + ':Passwd');
 	newsysp.setAttribute('type', 'password');
@@ -134,10 +134,11 @@
 	}
 
 	var newrow = document.createElement('tr');
+	newrow.className = 'systemsTable';
 	var hcol = document.createElement('td')
-	hcol.setAttribute('style', 'margin: 0em;padding: 0em 1em .33em 0em;background: #dee7ec;padding-left: .5em;text-align: left;');
+	hcol.className = 'systemsTable';
 	var pcol = document.createElement('td')
-	pcol.setAttribute('style', 'margin: 0em;padding: 0em 1em .33em 0em;background: #dee7ec;padding-left: .5em;text-align: left;');
+	pcol.className = 'systemsTable';
 
 	hcol.appendChild(newsys)
 	pcol.appendChild(newsysp)


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