[Cluster-devel] conga/luci/homebase form-chooser form-macros h ...

rmccabe at sourceware.org rmccabe at sourceware.org
Tue Jul 18 19:25:21 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-07-18 19:25:20

Modified files:
	luci/homebase  : form-chooser form-macros homebase_common.js 
	                 index_html luci_homebase.css 
	                 validate_cluster_add.js 
Added files:
	luci/homebase  : validate_cluster_add_initial.js 

Log message:
	cluster pull-in frontened

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add_initial.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-chooser.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/index_html.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add.js.diff?cvsroot=cluster&r1=1.2&r2=1.3

/cvs/cluster/conga/luci/homebase/validate_cluster_add_initial.js,v  -->  standard output
revision 1.1
--- conga/luci/homebase/validate_cluster_add_initial.js
+++ -	2006-07-18 19:25:20.786056000 +0000
@@ -0,0 +1,22 @@
+function validateForm(form) {
+	var errors = new Array();
+
+	if (!form)
+		return (-1);
+
+	var added_storage = validate_systems(form, errors);
+
+	if (error_dialog(errors))
+		return (-1);
+
+	if (!added_storage || added_storage.length < 1)
+		errors.push('You have not added any cluster nodes.');
+
+	if (error_dialog(errors))
+		return (-1);
+
+	if (confirm('Retrieve cluster information from ' + added_storage[0] + '?'))
+		form.submit();
+
+	return (0);
+}
--- conga/luci/homebase/form-chooser	2006/06/20 21:21:47	1.8
+++ conga/luci/homebase/form-chooser	2006/07/18 19:25:20	1.9
@@ -5,7 +5,7 @@
 </head>
 
 <tal:comment replace="nothing">
-	$Id: form-chooser,v 1.8 2006/06/20 21:21:47 rmccabe Exp $
+	$Id: form-chooser,v 1.9 2006/07/18 19:25:20 rmccabe Exp $
 </tal:comment>
 
 <body>
@@ -40,6 +40,10 @@
 	<span tal:omit-tag="" tal:condition="python: ptype == '6'">
 		<div metal:use-macro="here/form-macros/macros/cluster-add-form" />
 	</span>
+
+	<span tal:omit-tag="" tal:condition="python: ptype == '7'">
+		<div metal:use-macro="here/form-macros/macros/cluster-add-initial-form" />
+	</span>
 </metal:choose-form>
 
 </body>
--- conga/luci/homebase/form-macros	2006/06/30 23:07:32	1.27
+++ conga/luci/homebase/form-macros	2006/07/18 19:25:20	1.28
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.27 2006/06/30 23:07:32 rmccabe Exp $
+	$Id: form-macros,v 1.28 2006/07/18 19:25:20 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -496,17 +496,17 @@
 	<script type="text/javascript" src="/luci/homebase/validate_cluster_add.js">
 	</script>
 
-	<form name="adminform" action="" method="post">
-		<span tal:omit-tag=""
-			tal:define="global clusters python:here.getClusters()" />
+	<tal:block tal:omit-tag=""
+		tal:define="global sessionObj python:request.SESSION.get('checkRet')" />
 
+	<form name="adminform" action="" method="post">
 		<input name="pagetype" type="hidden"
 			tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
 
-		<input name="numStorage" id="numStorage" type="hidden" value="3" />
 
 		<input name="absoluteURL" type="hidden"
 			tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
+
 		<input name="baseURL" type="hidden"
 			tal:attributes="value python:data['children'][data['curIndex']]['base_url']" />
 
@@ -516,60 +516,144 @@
 			<thead class="systemsTable">
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableTop">
-						<strong>Cluster Name</strong>
-						<input class="hbInputSys" type="text" id="clusterName" name="clusterName" />
+						<strong>Cluster Name:</strong> <span tal:replace="python: sessionObj['requestResults']['clusterName']" />
+						<input type="hidden" type="text" id="clusterName" name="clusterName" tal:attributes="value python: sessionObj['requestResults']['clusterName']" />
 					</div>
 				</td></tr>
 				<tr class="systemsTable">
-					<th class="systemsTable">System Hostname</th>
-					<th class="systemsTable">Password</th>
+					<th class="systemsTable">Node Hostname</th>
+					<th class="systemsTable">Root Password</th>
 				</tr>
 			</thead>
 
 			<tfoot class="systemsTable">
 				<tr class="systemsTable"><td colspan="2" class="systemsTable">
-					<div>
+					<div tal:condition="python: not sessionObj['requestResults']['isComplete']">
 						<input type="checkbox" name="allSameCheckBox" id="allSameCheckBox" onClick="allPasswdsSame(adminform);"/> Check if storage system passwords are identical.
 					</div>
-				</td></tr>
-
-				<tr class="systemsTable"><td class="systemsTable" colspan="2">
-					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add Another Row" onClick="addSystem(adminform);" />
-					</div>
+					<div class="systemsTable" tal:condition="python: sessionObj['requestResults']['isComplete']"> </div>
 				</td></tr>
 			</tfoot>
 
+			<span tal:omit-tag=""
+				tal:define="global sysNum python: 0"
+			/>
+
 			<tbody class="systemsTable">
+			<tal:block tal:repeat="node python: sessionObj['requestResults']['nodeList']">
+			
+				<span tal:omit-tag="" tal-condition="python: 'errors' in node"
+					tal:define="global nodeClassExt python: ' error'" />
+
+				<span tal:omit-tag=""
+					tal-condition="python: not 'errors' in node"
+					tal:define="global nodeClassExt python: ''" />
+
+				<span tal:omit-tag=""
+					tal:define="global nodeAuth python: node['cur_auth']" />	
+
 				<tr class="systemsTable">
 					<td class="systemsTable">
-						<input class="hbInputSys" type="text" id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
+						<input type="text"
+							tal:attributes="
+								id python: '__SYSTEM' + str(sysNum) + ':Addr';
+								name python: '__SYSTEM' + str(sysNum) + ':Addr';
+								value python: node['ricci_host'];
+								class python: 'hbInputSys' + nodeClassExt;
+								disabled python: nodeAuth and 1 or 0"
+						 />
 					</td>
 					<td class="systemsTable">
-						<input type="password" id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd" class="hbInputPass" onChange="pwd0Change(adminform);" />
+						<input onChange="pwd0Change(adminform);"
+							tal:attributes="
+								type python: nodeAuth and 'text' or 'password';
+								value python: nodeAuth and '[authenticated]' or '';
+								class python: 'hbInputPass' + nodeClassExt;
+								id python: '__SYSTEM' + str(sysNum) + ':Passwd';
+								name python: '__SYSTEM' + str(sysNum) + ':Passwd';
+								disabled python: nodeAuth and 1 or 0"
+						/>
 					</td>
 				</tr>
+				<span tal:omit-tag=""
+					tal:define="global sysNum python: sysNum + 1"
+				/>
+			</tal:block>
+			</tbody>
+		</table>
+		
+		<input name="numStorage" id="numStorage" type="hidden"
+			tal:attributes="value python: sysNum" />
+
+		<div class="hbSubmit" id="hbSubmit">
+			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+		</div>
+	</form>
+</div>
+
+
+<tal:comment>
+
+
+!###########################
+# CLUSTER ADD FORM INITIAL #
+############################
+
+
+</tal:comment>
+
+<div metal:define-macro="cluster-add-initial-form">
+	<tal:comment replace="nothing">
+		Things to validate
+			- At least one node name/password are given and are valid
+	</tal:comment>
+
+	<script type="text/javascript" src="/luci/homebase/validate_cluster_add_initial.js">
+	</script>
+
+	<form name="adminform" action="" method="post">
+		<input name="pagetype" type="hidden"
+			tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
+
+		<input name="absoluteURL" type="hidden"
+			tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
+		<input name="baseURL" type="hidden"
+			tal:attributes="value python:data['children'][data['curIndex']]['base_url']" />
+
+		<h2 class="homebase">Manage an Existing Cluster</h2>
+
+		<p class="hbText">Enter one node from the cluster you wish to add to the Luci management interface.</p>
 
+		<table id="systemsTable" class="systemsTable" border="0" cellspacing="0">
+			<thead class="systemsTable">
 				<tr class="systemsTable">
-					<td class="systemsTable">
-						<input class="hbInputSys" type="text" id="__SYSTEM1:Addr" name="__SYSTEM1:Addr" />
-					</td>
-					<td class="systemsTable">
-						<input type="password" id="__SYSTEM1:Passwd" name="__SYSTEM1:Passwd" class="hbInputPass" onChange="pwd0Change(adminform);" />
-					</td>
+					<th class="systemsTable">System Hostname</th>
+					<th class="systemsTable">Password</th>
 				</tr>
+			</thead>
 
+			<tfoot class="systemsTable">
+				<tr class="systemsTable"><td colspan="2" class="systemsTable">
+					<div class="hbcheckdiv">
+						<input type="checkbox" name="allSameCheckBox" id="allSameCheckBox" /> Attempt to authenticate to all cluster nodes using the password provided above.
+					</div>
+				</td></tr>
+			</tfoot>
+
+			<tbody class="systemsTable">
 				<tr class="systemsTable">
 					<td class="systemsTable">
-						<input class="hbInputSys" type="text" id="__SYSTEM2:Addr" name="__SYSTEM2:Addr" />
+						<input class="hbInputSys" type="text" id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
 					</td>
 					<td class="systemsTable">
-						<input type="password" id="__SYSTEM2:Passwd" name="__SYSTEM2:Passwd" class="hbInputPass" onChange="pwd0Change(adminform);" />
+						<input type="password" id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd" class="hbInputPass" />
 					</td>
 				</tr>
 			</tbody>
 		</table>
 
+		<input type="hidden" name="numStorage" value="1" />
+
 		<div class="hbSubmit" id="hbSubmit">
 			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
--- conga/luci/homebase/homebase_common.js	2006/06/30 17:45:59	1.1
+++ conga/luci/homebase/homebase_common.js	2006/07/18 19:25:20	1.2
@@ -85,13 +85,16 @@
 	var num_systems = form.numStorage.value;
 
 	var state = cb.checked;
-	var passwd = document.getElementById('__SYSTEM0:Passwd').value;
+	var passwd = document.getElementById('__SYSTEM0:Passwd');
+	if (!passwd || passwd.type != 'password')
+		return (-1);
+	passwd = passwd.value;
 	if (!passwd || !state)
 		passwd = '';
 
 	for (var i = 1 ; i < num_systems ; i++) {
 		var element = document.getElementById('__SYSTEM' + i + ':Passwd')
-		if (element) {
+		if (element && element.type == 'password') {
 			element.value = passwd;
 			element.disabled = state;
 		}
@@ -161,6 +164,7 @@
 
 		if (!element)
 			continue;
+		element.disabled = false;
 
 		var pwdElem = document.getElementById('__SYSTEM' + i + ':Passwd');
 		if (!element.value) {
--- conga/luci/homebase/index_html	2006/07/05 20:26:00	1.11
+++ conga/luci/homebase/index_html	2006/07/18 19:25:20	1.12
@@ -15,7 +15,7 @@
 					xml:lang language">
 
 <tal:comment replace="nothing">
-	$Id: index_html,v 1.11 2006/07/05 20:26:00 rmccabe Exp $
+	$Id: index_html,v 1.12 2006/07/18 19:25:20 rmccabe Exp $
 </tal:comment>
 
 <head metal:use-macro="here/header/macros/html_header">
@@ -139,8 +139,6 @@
 			tal:define="global ret python: request.SESSION.get('checkRet')"
 		/>
 
-		<span tal:omit-tag="" tal:condition="python:request.SESSION.set('checkRet',{})" />
-
 		<div class="retmsgs" id="retmsgsdiv" tal:condition="python:(ret and 'messages' in ret and len(ret['messages']))">
 			<div class="hbclosebox">
 				<a href="javascript:hide_element('retmsgsdiv');"><img src="x.png"></a>
--- conga/luci/homebase/luci_homebase.css	2006/07/05 20:13:03	1.7
+++ conga/luci/homebase/luci_homebase.css	2006/07/18 19:25:20	1.8
@@ -1,11 +1,11 @@
-/* $Id: luci_homebase.css,v 1.7 2006/07/05 20:13:03 rmccabe Exp $ */
+/* $Id: luci_homebase.css,v 1.8 2006/07/18 19:25:20 rmccabe Exp $ */
 
 *.errmsgs,*.retmsgs {
 	list-style-image: none !important;
 	list-style-type: none !important;
 }
 
-*.errmsgs {
+*.error, *.errmsgs {
 	color: red !important;
 }
 
--- conga/luci/homebase/validate_cluster_add.js	2006/07/05 20:13:03	1.2
+++ conga/luci/homebase/validate_cluster_add.js	2006/07/18 19:25:20	1.3
@@ -4,19 +4,12 @@
 	if (!form)
 		return (-1);
 
-	if (form.clusterList) {
-		i = form.clusterList.selectedIndex;
-		if (i < 0 || !form.clusterList[i])
-			errors.push('You have not selected a valid cluster.');
-		else
-			clusterName = form.clusterList[i].value;
-	} else if (form.clusterName)
-		clusterName = form.clusterName.value;
-
-	if (str_is_blank(clusterName)) {
+	var clusterName = form.clusterName;
+	if (!clusterName || str_is_blank(clusterName.value)) {
 		errors.push('No cluster name was given.');
 	} else {
-		var invalid_chars = str_is_valid(form.clusterName.value, '/[0-9A-Za-z_. -]/g');
+		clusterName = clusterName.value;
+		var invalid_chars = str_is_valid(clusterName, '/[0-9A-Za-z_. -]/g');
 		if (invalid_chars)
 			errors.push('The cluster name you gave contains the following invalid characters: "' + invalid_chars + '".');
 	}
@@ -32,7 +25,7 @@
 	if (error_dialog(errors))
 		return (-1);
 
-	if (confirm("Submit form?"))
+	if (confirm('Add the cluster \"' + clusterName + '\" to the Luci management interface?'))
 		form.submit();
 
 	return (0);




More information about the Cluster-devel mailing list