Skip to contentSkip to conversation

conga/luci/cluster form-macros resource-form-m ...

Cluster-devel [email protected] 1 participant 1 message Sep 22, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-22 18:21:59

Modified files:
luci/cluster : form-macros resource-form-macros
resource_form_handlers.js

Log message:
- resources support
- improved user interaction in places
- better error handling in places

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.60&r2=1.61
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.8&r2=1.9

luci/cluster/form-macros +88 -20
@@ -31,7 +31,7 @@
 		tal:define="ragent python: here.getRicciAgent(clu);
 			global stat python: here.getClusterStatus(ragent);
 			global cstatus python: here.getClustersInfo(stat,request);
-			global cluster_status python: 'cluster ' + (cstatus['running'] == 'true' and 'running' or 'stopped');"
+			global cluster_status python: 'cluster ' + (('running' in cstatus and cstatus['running'] == 'true') and 'running' or 'stopped');"
  	/>
 
 	<table class="cluster" width="100%">
@@ -39,16 +39,16 @@
 		<td class="cluster cluster_name">
 			<strong class="cluster cluster_name">Cluster Name</strong>:
 			<a href=""
-				tal:attributes="href cstatus/clucfg;
+				tal:attributes="href cstatus/clucfg | nothing;
 								class python: 'cluster ' + cluster_status;"
-				tal:content="cstatus/clusteralias" />
+				tal:content="cstatus/clusteralias | string: [unknown]" />
 		</td>
 
 		<td class="cluster cluster_action">
 			<form method="post" onSubmit="return dropdown(this.gourl)">
 				<select name="gourl" id="cluster_action" class="cluster">
-					<option tal:condition="python: cstatus['running'] != 'true'" value="" class="cluster running">Start this cluster</option>
-					<option tal:condition="python: cstatus['running'] == 'true'" value="" class="cluster stopped">Stop this cluster</option>
+					<option tal:condition="python: 'running' in cstatus and cstatus['running'] != 'true'" value="" class="cluster running">Start this cluster</option>
+					<option tal:condition="python: 'running' in cstatus and cstatus['running'] == 'true'" value="" class="cluster stopped">Stop this cluster</option>
 					<option value="" class="cluster">Restart this cluster</option>
 				</select>
 				<input class="cluster" type="submit" value="Go" />
@@ -58,7 +58,9 @@
 
 	<tr class="cluster info_middle">
 		<td colspan="2" class="cluster cluster_quorum">
-			<ul class="cluster_quorum">
+			<ul class="cluster_quorum"
+				tal:condition="exists: cstatus/status">
+
 				<li><strong class="cluster">Status</strong>: <span tal:replace="cstatus/status"/></li>
 				<li><strong class="cluster">Total Cluster Votes</strong>: <span tal:replace="cstatus/votes"/></li>
 				<li><strong class="cluster">Minimum Required Quorum</strong>: <span tal:replace="cstatus/minquorum"/></li>
@@ -67,7 +69,9 @@
 	</tr>
 
 	<tr class="cluster info_bottom">
-		<td class="cluster cluster_nodes">
+		<td class="cluster cluster_nodes"
+			tal:condition="exists: cstatus/currentnodes">
+
 			<strong class="cluster">Nodes</strong>
 			<ul class="cluster">
 			<tal:block tal:repeat="nd cstatus/currentnodes">
@@ -86,11 +90,13 @@
 		<td class="cluster service cluster_services">
 			<strong class="cluster service">Services</strong>
 			<ul class="cluster service">
-			<tal:block tal:condition="python: len(cstatus['currentservices']) < 1">
+			<tal:block tal:condition="python: not 'currentservices' in cstatus or len(cstatus['currentservices']) < 1">
 				<li>No Services Defined</li>
 			</tal:block>
 
-			<tal:block tal:repeat="svc cstatus/currentservices">
+			<tal:block
+				tal:condition="exists: cstatus/currentservices"
+				tal:repeat="svc cstatus/currentservices">
 				<tal:block
 					tal:define="global svcclass python: svc['srunning'] == 'true' and 'running' or 'stopped'" />
 
@@ -161,28 +167,40 @@
 			<tbody class="systemsTable">
 				<tr class="systemsTable">
 					<td class="systemsTable">
-						<input class="hbInputSys" type="text" id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
+						<input class="hbInputSys" type="text"
+							id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
 					</td>
 					<td class="systemsTable">
-						<input type="password" id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd" class="hbInputPass" onChange="pwd0Change(adminform);" />
+						<input type="password"
+							id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd"
+							class="hbInputPass" autocomplete="off"
+							onChange="pwd0Change(adminform);" />
 					</td>
 				</tr>
 
 				<tr class="systemsTable">
 					<td class="systemsTable">
-						<input class="hbInputSys" type="text" id="__SYSTEM1:Addr" name="__SYSTEM1:Addr" />
+						<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);" />
+						<input type="password"
+							id="__SYSTEM1:Passwd" name="__SYSTEM1:Passwd"
+							class="hbInputPass" autocomplete="off"
+							onChange="pwd0Change(adminform);" />
 					</td>
 				</tr>
 
 				<tr class="systemsTable">
 					<td class="systemsTable">
-						<input class="hbInputSys" type="text" id="__SYSTEM2:Addr" name="__SYSTEM2:Addr" />
+						<input class="hbInputSys" type="text"
+							id="__SYSTEM2:Addr" name="__SYSTEM2:Addr" />
 					</td>
 					<td class="systemsTable">
-						<input type="password" id="__SYSTEM2:Passwd" name="__SYSTEM2:Passwd" class="hbInputPass" onChange="pwd0Change(adminform);" />
+						<input type="password"
+							id="__SYSTEM2:Passwd" name="__SYSTEM2:Passwd"
+							class="hbInputPass" autocomplete="off"
+							onChange="pwd0Change(adminform);" />
 					</td>
 				</tr>
 			</tbody>
@@ -975,10 +993,14 @@
 			<tbody class="systemsTable">
 				<tr class="systemsTable">
 					<td class="systemsTable">
-						<input class="hbInputSys" type="text" id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
+						<input class="hbInputSys" type="text"
+							id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
 					</td>
 					<td class="systemsTable">
-						<input type="password" id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd" class="hbInputPass" onChange="pwd0Change(adminform);" />
+						<input type="password"
+							id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd"
+							class="hbInputPass" autocomplete="off"
+							onChange="pwd0Change(adminform);" />
 					</td>
 				</tr>
 			</tbody>
@@ -1093,12 +1115,16 @@
 	</script>
 	<tal:block tal:define="
 		global ricci_agent python: here.getRicciAgentForCluster(request);
+		global global_resources python: here.getResourcesInfo(modelb, request);
 		global sstat python: here.getClusterStatus(ricci_agent);
 		global sinfo python: here.getServiceInfo(sstat, modelb,request);
 		global running sinfo/running | nothing;" />
 
 	<tal:block tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>'" />
 		var uuid_list = <tal:block tal:replace="sinfo/uuid_list" />;
+		var global_resources = <tal:block tal:replace="python: map(lambda x: str(x['name']), global_resources) or 'null'" />;
+		var active_resources = <tal:block tal:replace="python: map(lambda x: str(x['name']), sinfo['resource_list']) or 'null'" />;
+		var resource_names = <tal:block tal:replace="python: (map(lambda x: str(x['name']), global_resources) + map(lambda x: str(x['name']), sinfo['resource_list'])) or 'null'" />;
 	<tal:block tal:replace="structure string: </script>" />
 
 	<table class="cluster service" width="100%">
@@ -1147,7 +1173,7 @@
 	<br/>
 
 	<div id="resskel" class="invisible">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/resource-swap-form" />
+		<tal:block metal:use-macro="here/resource-form-macros/macros/service-compose-macro" /> 
 	</div>
 
 	<h2 onclick="forms_to_xml()">Service Composition</h2>
@@ -1160,12 +1186,12 @@
 			id python: res['uuid']">
 
 		<tal:block
-			tal:condition="python: res['max_depth'] > 0"
+			tal:condition="python: 'max_depth' in res and res['max_depth'] > 0"
 			tal:replace="structure python: '<div class=nothing>'" />
 
 		<tal:block tal:define="
 			global type res/type;
-			global ref res/ref_object | nothing" />
+			global resourceIsRef res/ref_object | nothing" />
 
 		<span tal:omit-tag="" tal:condition="python: type == 'IP Address: '">
 			<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
@@ -1200,12 +1226,54 @@
 		</span>
 
 		<tal:block
+			tal:condition="python: 'indent_ctr' in res and 'max_depth' in res"
 			tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
 	</div>
 	</div>
 	<form name="master">
 		<input type="hidden" name="form_xml" />
 	</form>
+
+	<div class="invisible" id="global_resources_block">
+		<tal:block tal:repeat="gr global_resources">
+			<tal:block tal:define="
+				global res gr;
+				global type res/type;
+				global resourceIsRef python: True" />
+
+		<span tal:omit-tag="" tal:condition="python: type == 'IP Address: '">
+			<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'fs'">
+			<tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" />
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
+			<tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
+			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
+			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
+			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'smb'">
+			<tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'Script: '">
+			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+		</span>
+		</tal:block>
+	</div>
 </div>
 
 <div metal:define-macro="service-form">
luci/cluster/resource-form-macros +168 -65

572 lines not on this page · raw message

luci/cluster/resource_form_handlers.js +57 -22

101 lines not on this page · raw message