[Cluster-devel] conga/luci/cluster form-macros resource-form-m ...

shuennek at sourceware.org shuennek at sourceware.org
Thu Aug 10 23:06:20 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	shuennek at sourceware.org	2006-08-10 23:06:20

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

Log message:
	

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.2&r2=1.3

--- conga/luci/cluster/form-macros	2006/08/10 15:49:34	1.21
+++ conga/luci/cluster/form-macros	2006/08/10 23:06:20	1.22
@@ -832,25 +832,22 @@
 </div>
 
 <div metal:define-macro="serviceconfig-form">
-	<tal:block tal:define="
-					global ricci_agent python:here.getRicciAgentForCluster(request);
-					global sstat python:here.getClusterStatus(ricci_agent);
-					global sinfo python:here.getServiceInfo(sstat, modelb,request);
-					global running sinfo/running | nothing;" />
-
-	<table width="800px">
-		<tr style="padding:10px;margin:10px;border-width:0px;">
-			<td style="padding:10px;margin:10px;border-width:0px;">
-				<h1 style="border:0px;">Service Name: <span tal:content="sinfo/name"/></h1>
-			</td>
-
-			<td style="margin:10px">
-			<form method="post" onSubmit="return dropdown(this.gourl)">
-				<select name="gourl"
-					tal:define="global innermap sinfo/innermap;
-								starturls innermap/links">
-
-					<tal:block tal:condition="running">
+  <tal:block tal:define="
+    global ricci_agent python:here.getRicciAgentForCluster(request);
+    global sstat python:here.getClusterStatus(ricci_agent);
+    global sinfo python:here.getServiceInfo(sstat, modelb,request);
+    global running sinfo/running | nothing;" />
+  <table width="800px">
+    <tr style="padding:10px;margin:10px;border-width:0px;">
+      <td style="padding:10px;margin:10px;border-width:0px;">
+	<h1 style="border:0px;">Service Name: <span tal:content="sinfo/name"/></h1>
+      </td>
+      <td style="margin:10px">
+	<form method="post" onSubmit="return dropdown(this.gourl)">
+          <select name="gourl"
+		    tal:define="global innermap sinfo/innermap;
+		    starturls innermap/links">
+	  <tal:block tal:condition="running">
 						<option value=""><span tal:replace="innermap/current"/></option>
 						<option value="" tal:attributes="value innermap/restarturl">Restart this service</option>
 						<option value="">----------</option>
@@ -881,22 +878,45 @@
 			<h1 tal:condition="not: running" style="border:0px;">Service Status: <font color="red"><i>Stopped</i></font></h1>
 			<h1 tal:condition="running" style="border:0px;">Service Status: <font color="green"><i>Running</i></font></h1>
 		</td></tr>
-	</table>
+  </table>
   <h2> Service Composition</h2>
-  <span tal:define="global svc_rcs sinfo/resource_list"/>
-  <span tal:repeat="svc_rc svc_rcs">
-   <h4> Name: <span tal:content="svc_rc/resource_name"/></h4>
-   <h4> Type: <span tal:content="svc_rc/type"/></h4>
-   <span tal:define="ref svc_rc/ref_object | nothing">
-     <span tal:condition="ref">
-      <h4>This is a shared resource</h4>
-     </span>
-     <span tal:condition="not: ref">
-      <h4>This is a resource private to this service</h4>
-     </span>
-   </span>
-   <h4>Indent level:  <span tal:content="svc_rc/indent_ctr"/></h4>
-  </span>
+  <ul>
+  <span tal:omit-tag="" tal:define="global svc_rcs sinfo/resource_list"/>
+    <li tal:repeat="res svc_rcs">
+      <ul>
+      <div tal:define="global type res/type;
+		       global ref res/ref_object | nothing"/>
+        <span omit-tag="" tal:condition="ref">
+          <span tal:omit-tag="" tal:define="global shared string:true"/>
+        </span>
+	<strong tal:content="res/indent_str"/>
+        <span tal:omit-tag="" tal:condition="python:type == 'IP Address: '">
+          <li metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
+        </span>
+        <span tal:omit-tag="" tal:condition="python:type == 'fs'">
+          <li metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
+        </span>
+        <span tal:omit-tag="" tal:condition="python:type == 'gfs'">
+          <li metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
+        </span>
+        <span tal:omit-tag="" tal:condition="python:type == 'nfsm'">
+          <li metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
+        </span>
+        <span tal:omit-tag="" tal:condition="python:type == 'nfsx'">
+          <li metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
+        </span>
+        <span tal:omit-tag="" tal:condition="python:type == 'nfsc'">
+          <li metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
+        </span>
+        <span tal:omit-tag="" tal:condition="python:type == 'smb'">
+          <li metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+        </span>
+        <span tal:omit-tag="" tal:condition="python:type == 'Script: '">
+          <li metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+        </span>
+      </ul>
+    </li>
+  </ul>
 </div>
 
 <div metal:define-macro="service-form">
--- conga/luci/cluster/resource-form-macros	2006/08/10 19:46:09	1.3
+++ conga/luci/cluster/resource-form-macros	2006/08/10 23:06:20	1.4
@@ -152,15 +152,16 @@
   </div>
 
   <div id="IP" metal:define-macro="ip_macro">
-    <span tal:condition="python:ptype == '33'">
+    <span tal:condition="python:ptype == '33' or ptype == '24'">
       <span tal:define="
+        global edit python:True;
         global resName res/name;
         global address python:resName.split('.');
         global ip1 python:address[0];
         global ip2 python:address[1];
         global ip3 python:address[2];
         global ip4 python:address[3];
-	global monitor_link res/attrs/monitor_link;
+	global monitor_link res/attrs/monitor_link|nothing;
         global cluname request/clustername;
         tmp_URL context/cluster/index_html/absolute_url;
         global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname+'&edit=1'"/>
@@ -168,20 +169,21 @@
 
     <span tal:condition="python:ptype != '33'">
       <span tal:define="
+            global edit python:False;
 	    global monitor_link string:1;
             global cluname request/clustername;
             tmp_URL context/cluster/index_html/absolute_url;
             global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname" />
     </span>
-    <h2>IP Address Resource Configuration</h2>
+    <strong>IP Address Resource Configuration</strong>
     <form name="ip_form" id="ip_form" method="get" tal:attributes="action processURL">
       <input name="pagetype" type="hidden" value="35"/>
       <input name="clustername" type="hidden" tal:attributes="value cluname"/>
       <input name="oldname" type="hidden"
              tal:attributes="value res/name"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="edit" type="hidden" value="1"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
      <input name="type" type="hidden" value="ip"/>
       <table id="ipResourceTable" border="0" cellspacing="0" width="200" style="background-color: #dee7ec">
         <tr>
@@ -207,8 +209,9 @@
     <input name="submitButton" type="button" value="Submit" onClick="validate(ip_form);" />
   </div>
   <div id="FS" metal:define-macro="fs_macro">
-    <span tal:condition="python:ptype == '33'">
+    <span tal:condition="python:ptype == '33' or ptype == '24'">
       <span tal:define="
+        global edit python:True;
         global resName res/name;
         global mountPoint res/attrs/mountpoint;
         global device res/attrs/device;
@@ -224,6 +227,7 @@
     </span>
     <span tal:condition="python:ptype != '33'">
       <span tal:define="
+        global edit python:False;
         global force_unmount string:0;
         global reboot_fail string:0;
 	global fstype string:0;
@@ -232,15 +236,15 @@
         tmp_URL context/cluster/index_html/absolute_url;
         global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname" />
     </span>
-    <h2>File System Resource Configuration</h2>
+    <strong>File System Resource Configuration</strong>
       <form name="fs_form" action="" method="get" tal:attributes="action processURL">
       <input name="pagetype" type="hidden" value="35"/>
       <input name="clustername" type="hidden" tal:attributes="value cluname"/>
       <input name="oldname" type="hidden"
              tal:attributes="value res/name"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="edit" type="hidden" value="1"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
      <input name="type" type="hidden" value="fs"/>
       <table id="fileSystemTable" border="0" cellspacing="0">
         <tr>
@@ -253,11 +257,11 @@
           <div>
 	    <strong>File System Type:</strong>
 	    <select id="fstype" name="fstype">
-	      <span tal:condition="python: ptype != '33' or fstype == 'ext2'">
+	      <span tal:condition="python: edit == nothing or fstype == 'ext2'">
     	        <option name="ext2" value="ext2">ext2</option>
                 <option name="ext3" value="ext3" selected>ext3</option>
 	      </span>
-	      <span tal:condition="python: ptype == '33' and fstype != 'ext3'">
+	      <span tal:condition="python: edit == True and fstype != 'ext3'">
     	        <option name="ext2" value="ext2" selected>ext2</option>
                 <option name="ext3" value="ext3">ext3</option>
 	      </span>
@@ -320,8 +324,9 @@
     <input type="button" value="Submit" onClick="validate(fs_form);"/>
   </div>
   <div id="GFS" metal:define-macro="gfs_macro">
-    <span tal:condition="python:ptype == '33'">
+    <span tal:condition="python:ptype == '33' or ptype =='24'">
       <span tal:define="
+        global edit python:True;
         global resName res/name;
         global mountPoint res/attrs/mountpoint;
         global device res/attrs/device;
@@ -335,20 +340,21 @@
     </span>
     <span tal:condition="python:ptype != '33'">
       <span tal:define="
+        global edit python:False;
         global force_unmount string:0;
         global cluname request/clustername;
         tmp_URL context/cluster/index_html/absolute_url;
         global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname" />
     </span>
-    <h2>GFS Resource Configuration</h2>
+    <strong>GFS Resource Configuration</strong>
     <form name="gfs_form" action="" method="post" tal:attributes="action processURL">
       <input name="pagetype" type="hidden" value="35"/>
       <input name="clustername" type="hidden" tal:attributes="value cluname"/>
       <input name="oldname" type="hidden"
              tal:attributes="value res/name"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="edit" type="hidden" value="1"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
      <input name="type" type="hidden" value="gfs"/>
       <table id="gfsTable" border="0" cellspacing="0">
         <tr>
@@ -401,8 +407,9 @@
     </div>
 
   <div id="NFSM" metal:define-macro="nfsm_macro">
-    <span tal:condition="python:ptype == '33'">
+    <span tal:condition="python:ptype == '33' or ptype =='24'">
       <span tal:define="
+        global edit python:True;
         global resName res/name;
         global mountpoint res/attrs/mountpoint;
         global opt res/attrs/options;
@@ -416,21 +423,22 @@
     </span>
     <span tal:condition="python:ptype != '33'">
       <span tal:define="
+        global edit python:False;
         global force_unmount string:0;
         global cluname request/clustername;
         tmp_URL context/cluster/index_html/absolute_url;
         global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname" />
     </span>
-  <h2>NFS Mount Resource Configuration</h2>
+  <strong>NFS Mount Resource Configuration</strong>
   <form name="nfsm_form" action="" method="post">
     <form name="gfs_form" action="" method="post" tal:attributes="action processURL">
       <input name="pagetype" type="hidden" value="35"/>
       <input name="clustername" type="hidden" tal:attributes="value cluname"/>
       <input name="oldname" type="hidden"
              tal:attributes="value res/name"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="edit" type="hidden" value="1"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="type" type="hidden" value="nfsm"/>
       <table id="nfsMountTable" border="0" cellspacing="0">
         <tr>
@@ -463,11 +471,11 @@
         </tr>
         <tr>
           <div>
-	    <span tal:condition="python: ptype != '33' or nfstype == 'nfs'">
+	    <span tal:condition="python: edit == nothing or nfstype == 'nfs'">
     	      <input type="radio" name="nfstype" value="nfs" checked>NFS
 	      <input type="radio" name="nfstype" value="nfs4">NFS4
 	    </span>
-	    <span tal:condition="python: ptype == '33' and nfstype != 'nfs4'">
+	    <span tal:condition="python: edit == True and nfstype != 'nfs4'">
     	      <input type="radio" name="nfstype" value="nfs">NFS
 	      <input type="radio" name="nfstype" value="nfs4" checked>NFS4
 	    </span>
@@ -495,8 +503,9 @@
   </div>
 
   <div id="NFSC" metal:define-macro="nfsc_macro">
-    <span tal:condition="python:ptype == '33'">
+    <span tal:condition="python:ptype == '33' or ptype == '24'">
       <span tal:define="
+        global edit python:True;
         global resName res/name;
         global target res/attrs/target;
         global opt res/attrs/options;
@@ -507,19 +516,20 @@
     </span>
     <span tal:condition="python:ptype != '33'">
       <span tal:define="
+        global edit python:False;
         global cluname request/clustername;
         tmp_URL context/cluster/index_html/absolute_url;
         global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname" />
     </span>
-    <h2>NFS Client Resource Configuration</h2>
+    <strong>NFS Client Resource Configuration</strong>
     <form name="nfsc_form" action="" method="post" tal:attributes="action processURL">
       <input name="pagetype" type="hidden" value="35"/>
       <input name="clustername" type="hidden" tal:attributes="value cluname"/>
       <input name="oldname" type="hidden"
              tal:attributes="value res/name"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="edit" type="hidden" value="1"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="type" type="hidden" value="nfsc"/>
       <table id="nfsClientTable" border="0" cellspacing="0">
         <tr>
@@ -549,8 +559,9 @@
   </div>
 
 <div id="NFSX" metal:define-macro="nfsx_macro">
-    <span tal:condition="python:ptype == '33'">
+    <span tal:condition="python:ptype == '33' or ptype == '24'">
       <span tal:define="
+        global edit python:True;
         global resName res/name;
         global cluname request/clustername;
         tmp_URL context/cluster/index_html/absolute_url;
@@ -562,15 +573,15 @@
         tmp_URL context/cluster/index_html/absolute_url;
         global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname" />
     </span>
-    <h2>NFS Export Resource Configuration</h2>
+    <strong>NFS Export Resource Configuration</strong>
     <form name="nfsx_form" action="" method="post" tal:attributes="action processURL">
       <input name="pagetype" type="hidden" value="35"/>
       <input name="clustername" type="hidden" tal:attributes="value cluname"/>
       <input name="oldname" type="hidden"
              tal:attributes="value res/name"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="edit" type="hidden" value="1"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="type" type="hidden" value="nfsx"/>
       <table id="nfsExportTable" border="0" cellspacing="0">
         <tr>
@@ -586,8 +597,9 @@
   </div>
 
   <div id="SCR" metal:define-macro="scr_macro">
-    <span tal:condition="python:ptype == '33'">
+    <span tal:condition="python:ptype == '33' or ptype == '24'">
       <span tal:define="
+        global edit string:true;
         global resName res/name;
         global filename res/attrs/file;
         global cluname request/clustername;
@@ -600,15 +612,15 @@
         tmp_URL context/cluster/index_html/absolute_url;
         global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname"/>
     </span>
-    <h2>Script Resource Configuration</h2>
+    <strong>Script Resource Configuration</strong>
     <form name="scr_form" action="" method="post" tal:attributes="action processURL">
       <input name="pagetype" type="hidden" value="35"/>
       <input name="clustername" type="hidden" tal:attributes="value cluname"/>
       <input name="oldname" type="hidden"
              tal:attributes="value res/name"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == 'true'" />
       <input name="edit" type="hidden" value="1"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == 'true'" />
       <input name="type" type="hidden" value="scr"/>
       <table id="scriptTable" border="0" cellspacing="0">
         <tr>
@@ -631,8 +643,9 @@
   </div>
 
   <div id="SMB" metal:define-macro="smb_macro">
-    <span tal:condition="python:ptype == '33'">
+    <span tal:condition="python:ptype == '33' or ptype == '24'">
       <span tal:define="
+        global edit python:True;
         global resName res/name;
         global workgroup res/attrs/workgroup;
         global cluname request/clustername;
@@ -641,19 +654,20 @@
     </span>
     <span tal:condition="python:ptype != '33'">
       <span tal:define="
+	global edit python:false;
         global cluname request/clustername;
         tmp_URL context/cluster/index_html/absolute_url;
         global processURL python:tmp_URL+'?pagetype=35&clustername='+cluname"/>
     </span>
-    <h2>Samba Server Configuration</h2>
+    <strong tal:condition="python:edit != 'true'">Samba Server Configuration</strong>
     <form name="smb_form" action="" method="post" tal:attributes="action processURL">
       <input name="pagetype" type="hidden" value="35"/>
       <input name="clustername" type="hidden" tal:attributes="value cluname"/>
       <input name="oldname" type="hidden"
              tal:attributes="value res/name"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="edit" type="hidden" value="1"
-             tal:condition="python:ptype == '33'" />
+             tal:condition="python:edit == True" />
       <input name="type" type="hidden" value="smb"/>
       <table id="sambaTable" border="0" cellspacing="0">
         <tr>
--- conga/luci/cluster/resource_form_handlers.js	2006/08/10 19:46:09	1.2
+++ conga/luci/cluster/resource_form_handlers.js	2006/08/10 23:06:20	1.3
@@ -5,12 +5,12 @@
   if (!container_element) {
     alert('Can\'t find element with id = ' + container_id);
     return (-1)
-      }
+  }
   child_element = document.getElementById(element_id);
   if (!child_element) {
     alert('Can\'t find element with id = ' + element_id);
     return (-1)
-      }
+  }
   for(child in child_element.children){
     alert(child);
   }
@@ -21,7 +21,7 @@
   if (!invisible_div) {
     alert('No invisible div');
     return (-1)
-      } 
+  } 
   
   invisible_div.appendChild(temp);
 }




More information about the Cluster-devel mailing list