From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/cluster form-macros resource-form-m ...
Date: 2 Oct 2006 20:21:48 -0000 [thread overview]
Message-ID: <20061002202148.6709.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-10-02 20:21:47
Modified files:
luci/cluster : form-macros resource-form-macros
resource_form_handlers.js
Log message:
cleanup resources and services and fix some other bugs
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.74&r2=1.75
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.16&r2=1.17
--- conga/luci/cluster/form-macros 2006/09/28 20:20:12 1.74
+++ conga/luci/cluster/form-macros 2006/10/02 20:21:47 1.75
@@ -129,9 +129,11 @@
<div metal:define-macro="clusteradd-form">
- <script type="text/javascript" src="/luci/homebase/homebase_common.js">
+ <script type="text/javascript"
+ src="/luci/homebase/homebase_common.js">
</script>
- <script type="text/javascript" src="/luci/homebase/validate_cluster_add.js">
+ <script type="text/javascript"
+ src="/luci/homebase/validate_cluster_add.js">
</script>
<tal:block tal:omit-tag=""
@@ -326,8 +328,12 @@
</ul>
<div id="configTabContent" tal:condition="python: configTabNum == 1">
- <script type="text/javascript" src="/luci/homebase/homebase_common.js"></script>
- <script type="text/javascript" src="/luci/cluster/validate_config_general.js"></script>
+ <script type="text/javascript"
+ src="/luci/homebase/homebase_common.js">
+ </script>
+ <script type="text/javascript"
+ src="/luci/cluster/validate_config_general.js">
+ </script>
<form name="basecluster" action="" method="post">
<input type="hidden" name="pagetype"
@@ -380,9 +386,11 @@
<input type="hidden" name="pagetype"
tal:attributes="value request/pagetype | request/form/pagetype"
/>
- <script type="text/javascript" src="/luci/homebase/homebase_common.js">
+ <script type="text/javascript"
+ src="/luci/homebase/homebase_common.js">
</script>
- <script type="text/javascript" src="/luci/cluster/validate_config_fence.js">
+ <script type="text/javascript"
+ src="/luci/cluster/validate_config_fence.js">
</script>
<table id="systemsTable" class="systemsTable" border="0" cellspacing="0">
@@ -426,9 +434,11 @@
</div>
<div id="configTabContent" tal:condition="python: configTabNum == 3">
- <script type="text/javascript" src="/luci/homebase/homebase_common.js">
+ <script type="text/javascript"
+ src="/luci/homebase/homebase_common.js">
</script>
- <script type="text/javascript" src="/luci/cluster/validate_config_multicast.js">
+ <script type="text/javascript"
+ src="/luci/cluster/validate_config_multicast.js">
</script>
<form name="multicast" action="" method="post">
@@ -491,8 +501,12 @@
</div>
<div id="configTabContent" tal:condition="python: configTabNum == 4">
- <script type="text/javascript" src="/luci/homebase/homebase_common.js"></script>
- <script type="text/javascript" src="/luci/cluster/validate_config_qdisk.js"></script>
+ <script type="text/javascript"
+ src="/luci/homebase/homebase_common.js">
+ </script>
+ <script type="text/javascript"
+ src="/luci/cluster/validate_config_qdisk.js">
+ </script>
<form name="quorum_partition" action="" method="post">
<input type="hidden" name="pagetype"
tal:attributes="value request/pagetype | request/form/pagetype"
@@ -702,9 +716,9 @@
onClick="validate_form(this.form);"
>
</div>
- <script tal:condition="python: clusterinfo['is_quorumd'] != 'True'">
- disableChildrenInput('quorumdisk');
- </script>
+ <script tal:condition="python: clusterinfo['is_quorumd'] != 'True'">
+ disableChildrenInput('quorumdisk');
+ </script>
</form>
</div>
</div>
@@ -1179,10 +1193,12 @@
</div>
<div metal:define-macro="nodeadd-form">
- <script type="text/javascript" src="/luci/homebase/homebase_common.js">
+ <script type="text/javascript"
+ src="/luci/homebase/homebase_common.js">
</script>
- <script type="text/javascript" src="/luci/homebase/validate_cluster_add.js">
+ <script type="text/javascript"
+ src="/luci/homebase/validate_cluster_add.js">
</script>
<input type="hidden" name="clusterName"
@@ -1348,11 +1364,18 @@
</div>
<div class="service_comp_list">
- <form name="master">
+ <form name="master" method="post">
+ <tal:block
+ tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
<input type="button" value="Add a resource to this service"
onclick="add_child_resource(this.form);" />
+ <input type="hidden" name="pagetype"
+ tal:attributes="
+ value request/pagetype | request/form/pagetype | nothing" />
+ <input type="hidden" name="clustername"
+ tal:attributes="value clusterinfo/clustername" />
<input type="button" value="Submit"
- onClick="forms_to_xml()" />
+ onClick="forms_to_xml(this.form)" />
<input type="hidden" name="uuid" value="toplevel" />
<input type="hidden" name="parent_uuid" value="_toplevel" />
<input type="hidden" name="tree_level" value="-1" />
@@ -1425,6 +1448,7 @@
<script type="text/javascript"
src="/luci/cluster/resource_form_handlers.js">
</script>
+
<tal:block tal:define="
global ricci_agent python: here.getRicciAgentForCluster(request);
global global_resources python: here.getResourcesInfo(modelb, request);
@@ -1447,7 +1471,7 @@
<td class="cluster service service_name">
<strong class="service_name">Service Name:</strong>
<span
- tal:content="sinfo/name"
+ tal:content="sinfo/name | nothing"
tal:attributes="class python: running and 'running' or 'stopped'" />
</td>
<td class="cluster service service_action">
@@ -1515,11 +1539,18 @@
</div>
</div>
<div class="service_comp_list">
- <form name="master">
+ <form name="master" method="post">
+ <tal:block
+ tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
+ <input type="hidden" name="pagetype"
+ tal:attributes="
+ value request/pagetype | request/form/pagetype | nothing" />
+ <input type="hidden" name="clustername"
+ tal:attributes="value clusterinfo/clustername" />
<input type="button" value="Add a resource to this service"
onclick="add_child_resource(this.form);" />
<input type="button" value="Save changes"
- onClick="forms_to_xml()" />
+ onClick="forms_to_xml(this.form)" />
<input type="hidden" name="uuid" value="toplevel" />
<input type="hidden" name="parent_uuid" value="_toplevel" />
<input type="hidden" name="tree_level" value="-1" />
--- conga/luci/cluster/resource-form-macros 2006/09/27 22:24:11 1.17
+++ conga/luci/cluster/resource-form-macros 2006/10/02 20:21:47 1.18
@@ -83,14 +83,11 @@
<div metal:define-macro="resourceremove-form">
<h2>Resources Remove Form</h2>
- <tal:block
- tal:define="
- global cluname request/clustername;
- global ragent python: here.getRicciAgentForCluster(request);
- global edited request/edit | nothing;
- global msg python: here.delResource(request, ragent)" />
-
- <div tal:condition="msg" tal:content="msg" />
+ <tal:block tal:define="
+ ragent python: here.getRicciAgentForCluster(request);
+ msg python: here.delResource(request, ragent)">
+ <div tal:condition="msg" tal:content="msg" />
+ </tal:block>
</div>
<div metal:define-macro="resource-swap-form">
@@ -185,6 +182,9 @@
<div metal:define-macro="resourceadd-form">
<script type="text/javascript"
+ src="/luci/homebase/homebase_common.js">
+ </script>
+ <script type="text/javascript"
src="/luci/cluster/resource_form_handlers.js">
</script>
@@ -225,46 +225,40 @@
<div metal:define-macro="resourceprocess-form">
- <tal:block
- tal:define="
- global cluname request/clustername;
- global edited request/edit | nothing;
- global ragent python: here.getRicciAgentForCluster(request)" />
-
- <h2>Resource <span tal:replace="python: request['edit'] and 'Edited' or 'Added'" /></h2>
+ <h2>Resource <span tal:replace="python: ('edit' in request and request['edit']) and 'Edited' or 'Added'" /></h2>
- <tal:block
- tal:define="global msg python: here.addResource(request, ragent)" />
- <div tal:condition="msg" tal:content="msg" />
+ <div tal:content="
+ python: here.addResource(request, here.getRicciAgentForCluster(request))" />
</div>
<div metal:define-macro="resourceconfig-form">
- <script type="text/javascript"
- src="/luci/cluster/resource_form_handlers.js">
- </script>
-
- <tal:block tal:define="
- global restoedit request/resourcename | nothing" />
-
- <tal:block tal:condition="restoedit"
+ <tal:block tal:condition="request/resourcename"
tal:define="
global msg python: here.appendModel(request, modelb);
global res python: here.getResourceInfo(modelb, request);
global type python: 'tag_name' in res and res['tag_name'] or ''">
- <h2>Configure <span tal:replace="python: res['name']" /></h2>
+ <script type="text/javascript"
+ src="/luci/homebase/homebase_common.js">
+ </script>
+ <script type="text/javascript"
+ src="/luci/cluster/resource_form_handlers.js">
+ </script>
+
+ <h2>Configure <span tal:replace="res/name | string: resource" /></h2>
<div class="reschoose">
+
<span tal:omit-tag="" tal:condition="python: type == 'ip'">
- <div metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
+ <div metal:use-macro="here/resource-form-macros/macros/ip_macro" />
</span>
<span tal:omit-tag="" tal:condition="python: type == 'fs'">
- <div metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
+ <div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
</span>
<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
- <div metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
+ <div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
</span>
<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
@@ -290,35 +284,20 @@
</tal:block>
</div>
-<div class="rescfg" name="IP" tal:attributes="id res/name | nothing" metal:define-macro="ip_macro">
-<tal:block tal:condition="python: ptype == '33' or ptype == '24'"
- tal:define="
- global edit python: True;
- global editDisabled resourceIsRef | nothing;
- global resName res/name | nothing;
- global ip_address python: resName;
- 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'" />
-
-<tal:block
- tal:condition="python: ptype != '33'"
- 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" />
+<div class="rescfg" name="IP"
+ tal:attributes="id res/name | nothing" metal:define-macro="ip_macro">
<p class="reshdr">IP Address Resource Configuration</p>
- <form method="get"
- tal:attributes="
- action processURL | nothing;
- name res/parent_uuid | nothing">
+ <form method="post"
+ tal:define="editDisabled resourceIsRef | nothing"
+ tal:attributes="name res/parent_uuid | nothing">
- <input name="pagetype" type="hidden" value="35" />
+ <input name="edit" type="hidden"
+ tal:attributes="value python: ptype == '33' and True or False" />
+
+ <input name="pagetype" type="hidden"
+ tal:attributes="value python: ptype" />
<input name="global" type="hidden"
tal:attributes="value resourceIsRef | nothing" />
@@ -333,15 +312,13 @@
tal:attributes="value res/indent_ctr | string:0" />
<input name="clustername" type="hidden"
- tal:attributes="value cluname | nothing" />
+ tal:attributes="
+ value request/clustername | request/form/clustername | nothing" />
<input name="oldname" type="hidden"
tal:attributes="value res/name | nothing" />
- <input name="edit" type="hidden" value="1"
- tal:condition="python: edit == True" />
-
- <input name="type" type="hidden" value="ip"/>
+ <input name="type" type="hidden" value="ip" />
<table class="systemsTable">
<tr class="systemsTable">
@@ -350,7 +327,7 @@
<input size="15" name="ip_address" type="text" maxlength="15"
tal:attributes="
disabled python: editDisabled;
- value ip_address | nothing" />
+ value res/name | nothing" />
</td>
</tr>
<tr class="systemsTable">
@@ -359,7 +336,7 @@
<input type="checkbox" name="monitorLink"
tal:attributes="
disabled python: editDisabled;
- checked python: monitor_link == '1' and 'checked'" />
+ checked res/attrs/monitor_link | string: 1" />
</td>
</tr>
</table>
@@ -368,43 +345,20 @@
</form>
</div>
-<div class="rescfg" name="FS" tal:attributes="id res/name | nothing" metal:define-macro="fs_macro">
-<tal:block tal:condition="python: ptype == '33' or ptype == '24'"
- tal:define="
- global edit python: True;
- global editDisabled resourceIsRef | nothing;
- global resName res/name | nothing;
- global mountPoint res/attrs/mountpoint | nothing;
- global device res/attrs/device | nothing;
- global fstype res/attrs/fstype | nothing;
- global opt res/attrs/options | nothing;
- global fsid res/attrs/fsid | nothing;
- global force_unmount res/attrs/force_unmount | nothing;
- global reboot_fail res/attrs/self_fence | nothing;
- global fscheck res/attrs/force_fsck | nothing;
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname+'&edit=1'" />
-
-<tal:block tal:condition="python: ptype != '33'"
- tal:define="
- global edit python: False;
- global force_unmount string:0;
- global reboot_fail string:0;
- global fstype string:0;
- global fscheck string:0;
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
+<div class="rescfg" name="FS"
+ tal:attributes="id res/name | nothing" metal:define-macro="fs_macro">
<p class="reshdr">File System Resource Configuration</p>
- <form method="get"
- tal:attributes="
- action processURL | nothing;
- name res/parent_uuid | nothing">
+ <form method="post"
+ tal:attributes="name res/parent_uuid | nothing"
+ tal:define="editDisabled resourceIsRef | nothing">
+
+ <input name="edit" type="hidden"
+ tal:attributes="value python: ptype == '33' and True or False" />
- <input name="pagetype" type="hidden" value="35" />
+ <input name="pagetype" type="hidden"
+ tal:attributes="value python: ptype" />
<input name="global" type="hidden"
tal:attributes="value resourceIsRef | nothing" />
@@ -419,14 +373,12 @@
tal:attributes="value res/indent_ctr | string:0" />
<input name="clustername" type="hidden"
- tal:attributes="value cluname | nothing" />
+ tal:attributes="
+ value request/clustername | request/form/clustername | nothing" />
<input name="oldname" type="hidden"
tal:attributes="value res/name | nothing" />
- <input name="edit" type="hidden" value="1"
- tal:condition="python: edit == True" />
-
<input name="type" type="hidden" value="fs" />
<table class="systemsTable">
@@ -436,20 +388,23 @@
<input type="text" size="20" name="resourceName"
tal:attributes="
disabled python: editDisabled;
- value resName | nothing"/>
+ value res/name | nothing"/>
</td>
</tr>
<tr class="systemsTable">
<td class="systemsTable">File system type</td>
<td class="systemsTable">
- <select name="fstype">
+ <select name="fstype"
+ tal:define="fstype res/attrs/fstype | string: ext3"
+ tal:attributes="disabled python: editDisabled">
+
<option name="ext3" value="ext3"
tal:content="string: ext3"
- tal:attributes="checked python: (edit == nothing or fstype == 'ext3') and 'checked'" />
+ tal:attributes="checked python: fstype == 'ext3' and 'checked'" />
<option name="ext2" value="ext2"
tal:content="string: ext2"
- tal:attributes="checked python: (edit == True and fstype == 'ext2') and 'checked'" />
+ tal:attributes="checked python: fstype == 'ext2' and 'checked'" />
</select>
</td>
</tr>
@@ -458,7 +413,9 @@
<td class="systemsTable">Mount point</td>
<td class="systemsTable">
<input type="text" size="20" name="mountpoint"
- tal:attributes="value mountPoint | nothing" />
+ tal:attributes="
+ disabled python: editDisabled;
+ value res/attrs/mountpoint | nothing" />
</td>
</tr>
@@ -468,7 +425,7 @@
<input type="text" size="20" name="device"
tal:attributes="
disabled python: editDisabled;
- value device | nothing" />
+ value res/attrs/device | nothing" />
</td>
</tr>
@@ -478,7 +435,7 @@
<input type="text" size="20" name="options"
tal:attributes="
disabled python: editDisabled;
- value opt | nothing" />
+ value res/attrs/options | nothing" />
</td>
</tr>
@@ -488,7 +445,7 @@
<input type="text" size="20" name="fsid"
tal:attributes="
disabled python: editDisabled;
- value fsid | nothing" />
+ value res/attrs/fsid | nothing" />
</td>
</tr>
@@ -498,7 +455,7 @@
<input type="checkbox" name="forceunmount"
tal:attributes="
disabled python: editDisabled;
- checked python: force_unmount == '1' and 'checked'" />
+ checked res/attrs/force_unmount | nothing" />
</td>
</tr>
@@ -508,7 +465,7 @@
<input type="checkbox" name="selffence"
tal:attributes="
disabled python: editDisabled;
- checked python: reboot_fail == '1' and 'checked'" />
+ checked res/attrs/self_fence | nothing" />
</td>
</tr>
@@ -518,7 +475,7 @@
<input type="checkbox" name="checkfs"
tal:attributes="
disabled python: editDisabled;
- checked python: fscheck == '1' and 'checked'" />
+ checked res/attrs/force_fsck | nothing" />
</td>
</tr>
</table>
@@ -527,38 +484,20 @@
</form>
</div>
-<div class="rescfg" name="GFS" tal:attributes="id res/name | nothing" metal:define-macro="gfs_macro">
-<tal:block tal:condition="python: ptype == '33' or ptype =='24'"
- tal:define="
- global edit python: True;
- global editDisabled resourceIsRef | nothing;
- global resName res/name | nothing;
- global mountPoint res/attrs/mountpoint | nothing;
- global device res/attrs/device | nothing;
- global fstype res/attrs/fstype | nothing;
- global opt res/attrs/options | nothing;
- global fsid res/attrs/fsid | nothing;
- global force_unmount res/attrs/force_unmount | nothing;
- global cluname request/clustername | nothing;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname+'&edit=1'" />
-
-<tal:block tal:condition="python: ptype != '33'"
- 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" />
+<div class="rescfg" name="GFS"
+ tal:attributes="id res/name | nothing" metal:define-macro="gfs_macro">
<p class="reshdr">GFS Resource Configuration</p>
- <form method="get"
- tal:attributes="
- action processURL | nothing;
- name res/parent_uuid | nothing">
+ <form method="post"
+ tal:attributes="name res/parent_uuid | nothing"
+ tal:define="editDisabled resourceIsRef | nothing">
- <input name="pagetype" type="hidden" value="35" />
+ <input name="edit" type="hidden"
+ tal:attributes="value python: ptype == '33' and True or False" />
+
+ <input name="pagetype" type="hidden"
+ tal:attributes="value python: ptype" />
<input name="global" type="hidden"
tal:attributes="value resourceIsRef | nothing" />
@@ -573,14 +512,12 @@
tal:attributes="value res/indent_ctr | string:0" />
<input name="clustername" type="hidden"
- tal:attributes="value cluname | nothing" />
+ tal:attributes="
+ value request/clustername | request/form/clustername | nothing" />
<input name="oldname" type="hidden"
tal:attributes="value res/name | nothing" />
- <input name="edit" type="hidden" value="1"
- tal:condition="python: edit == True" />
-
<input name="type" type="hidden" value="gfs" />
<table class="systemsTable">
@@ -590,7 +527,7 @@
<input type="text" size="20" name="resourceName"
tal:attributes="
disabled python: editDisabled;
- value resName | nothing" />
+ value res/name | nothing" />
</td>
</tr>
@@ -600,7 +537,7 @@
<input type="text" size="20" name="mountpoint"
tal:attributes="
disabled python: editDisabled;
- value mountpoint | nothing" />
+ value res/attrs/mountpoint | nothing" />
</td>
</tr>
@@ -610,7 +547,7 @@
<input type="text" size="20" name="device"
tal:attributes="
disabled python: editDisabled;
- value device | nothing" />
+ value res/attrs/device | nothing" />
</td>
</tr>
@@ -620,7 +557,7 @@
<input type="text" size="20" name="options"
tal:attributes="
disabled python: editDisabled;
- value opt | nothing" />
+ value res/attrs/options | nothing" />
</td>
</tr>
@@ -630,7 +567,7 @@
<input type="text" size="20" name="fsid"
tal:attributes="
disabled python: editDisabled;
- value fsid | nothing" />
+ value res/attrs/fsid | nothing" />
</td>
</tr>
@@ -640,7 +577,7 @@
<input type="checkbox" name="forceunmount"
tal:attributes="
disabled python: editDisabled;
- checked python: force_unmount == '1' and 'checked'" />
+ checked res/attrs/force_unmount | nothing" />
</td>
</tr>
</table>
@@ -649,38 +586,20 @@
</form>
</div>
-<div class="rescfg" name="NFSM" tal:attributes="id res/name | nothing" metal:define-macro="nfsm_macro">
-<tal:block tal:condition="python: ptype == '33' or ptype =='24'"
- tal:define="
- global edit python: True;
- global editDisabled resourceIsRef | nothing;
- global resName res/name | nothing;
- global mountpoint res/attrs/mountpoint | nothing;
- global opt res/attrs/options | nothing;
- global expath res/attrs/export | nothing;
- global nfstype res/attrs/fstype | nothing;
- global hostname res/attrs/host | nothing;
- global force_unmount res/attrs/force_unmount | nothing;
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname+'&edit=1'" />
-
-<tal:block tal:condition="python: ptype != '33'"
- 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" />
+<div class="rescfg" name="NFSM"
+ tal:attributes="id res/name | nothing" metal:define-macro="nfsm_macro">
<p class="reshdr">NFS Mount Resource Configuration</p>
- <form method="get"
- tal:attributes="
- action processURL | nothing;
- name res/parent_uuid | nothing">
+ <form method="post"
+ tal:attributes="name res/parent_uuid | nothing"
+ tal:define="editDisabled resourceIsRef | nothing">
+
+ <input name="edit" type="hidden"
+ tal:attributes="value python: ptype == '33' and True or False" />
- <input name="pagetype" type="hidden" value="35" />
+ <input name="pagetype" type="hidden"
+ tal:attributes="value python: ptype" />
<input name="global" type="hidden"
tal:attributes="value resourceIsRef | nothing" />
@@ -695,14 +614,12 @@
tal:attributes="value res/indent_ctr | string:0" />
<input name="clustername" type="hidden"
- tal:attributes="value cluname | nothing" />
+ tal:attributes="
+ value request/clustername | request/form/clustername | nothing" />
<input name="oldname" type="hidden"
tal:attributes="value res/name | nothing" />
- <input name="edit" type="hidden" value="1"
- tal:condition="python: edit == True" />
-
<input name="type" type="hidden" value="nfsm" />
<table class="systemsTable">
@@ -712,7 +629,7 @@
<input type="text" size="20" name="resourceName"
tal:attributes="
disabled python: editDisabled;
- value resName | nothing" />
+ value res/name | nothing" />
</td>
</tr>
@@ -722,7 +639,7 @@
<input type="text" size="20" name="mountpoint"
tal:attributes="
disabled python: editDisabled;
- value mountpoint | nothing" />
+ value res/attrs/mountpoint | nothing" />
</td>
</tr>
@@ -732,7 +649,7 @@
<input type="text" size="20" name="host"
tal:attributes="
disabled python: editDisabled;
- value hostname | nothing" />
+ value res/attrs/host | nothing" />
</td>
</tr>
@@ -742,24 +659,25 @@
<input type="text" size="20" name="exportpath"
tal:attributes="
disabled python: editDisabled;
- value expath | nothing" />
+ value res/attrs/readOnly | nothing" />
</td>
</tr>
<tr class="systemsTable">
<td class="systemsTable">NFS version</td>
- <td class="systemsTable">
+ <td class="systemsTable"
+ tal:define="nfstype res/attrs/fstype | string: nfs">
<input type="radio" name="nfstype" value="nfs"
tal:attributes="
disabled python: editDisabled;
- checked python: (edit == nothing or nfstype == 'nfs') and 'checked'" />
- NFS (version 3)
+ content string: NFS (version 3);
+ checked python: nfstype == 'nfs' and 'checked'" />
<br/>
<input type="radio" name="nfstype" value="nfs4"
tal:attributes="
disabled python: editDisabled;
- checked python: (edit == True and nfstype == 'nfs4') and 'checked'">
- NFS4
+ content string: NFS4;
+ checked python: nfstype == 'nfs4' and 'checked'" />
</td>
</tr>
@@ -769,7 +687,7 @@
<input type="text" size="20" name="options"
tal:attributes="
disabled python: editDisabled;
- value opt | nothing" />
+ value res/attrs/options | nothing" />
</td>
</tr>
@@ -779,7 +697,7 @@
<input type="checkbox" name="forceunmount"
tal:attributes="
disabled python: editDisabled;
- checked python: force_unmount == '1' and 'checked'" />
+ checked res/attrs/force_unmount | nothing" />
</td>
</tr>
</table>
@@ -788,34 +706,20 @@
</form>
</div>
-<div class="rescfg" name="NFSC" tal:attributes="id res/name | nothing" metal:define-macro="nfsc_macro">
-<tal:block tal:condition="python: ptype == '33' or ptype == '24'"
- tal:define="
- global edit python: True;
- global editDisabled resourceIsRef | nothing;
- global resName res/name | nothing;
- global target res/attrs/target | nothing;
- global opt res/attrs/options | nothing;
- global expath res/attrs/readOnly | nothing;
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname+'&edit=1'" />
-
-<tal:block tal:condition="python: ptype != '33'"
- 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" />
+<div class="rescfg" name="NFSC"
+ tal:attributes="id res/name | nothing" metal:define-macro="nfsc_macro">
<p class="reshdr">NFS Client Resource Configuration</p>
<form method="post"
- tal:attributes="
- action processURL | nothing;
- name res/parent_uuid | nothing">
+ tal:attributes="name res/parent_uuid | nothing"
+ tal:define="editDisabled resourceIsRef | nothing">
+
+ <input name="edit" type="hidden"
+ tal:attributes="value python: ptype == '33' and True or False" />
- <input name="pagetype" type="hidden" value="35" />
+ <input name="pagetype" type="hidden"
+ tal:attributes="value python: ptype" />
<input name="global" type="hidden"
tal:attributes="value resourceIsRef | nothing" />
@@ -830,15 +734,13 @@
tal:attributes="value res/indent_ctr | string:0" />
<input name="clustername" type="hidden"
- tal:attributes="value cluname | nothing" />
+ tal:attributes="
+ value request/clustername | request/form/clustername | nothing" />
<input name="oldname" type="hidden"
tal:attributes="value res/name | nothing" />
- <input name="edit" type="hidden" value="1"
- tal:condition="python: edit == True" />
-
- <input name="type" type="hidden" value="nfsc"/>
+ <input name="type" type="hidden" value="nfsc" />
<table class="systemsTable">
<tr class="systemsTable">
@@ -847,7 +749,7 @@
<input type="text" size="20" name="resourceName"
tal:attributes="
disabled python: editDisabled;
- value resName | nothing" />
+ value res/name | nothing" />
</td>
</tr>
@@ -857,7 +759,7 @@
<input type="text" size="20" name="target"
tal:attributes="
disabled python: editDisabled;
- value target | nothing"/>
+ value res/attrs/target | nothing"/>
</td>
</tr>
@@ -867,7 +769,7 @@
<input type="text" size="20" name="options"
tal:attributes="
disabled python: editDisabled;
- value opt | nothing"/>
+ value res/attrs/options | nothing"/>
</td>
</tr>
</table>
@@ -876,30 +778,20 @@
</form>
</div>
-<div class="rescfg" name="NFSX" tal:attributes="id res/name | nothing" metal:define-macro="nfsx_macro">
-<tal:block tal:condition="python: ptype == '33' or ptype == '24'"
- tal:define="
- global edit python: True;
- global editDisabled resourceIsRef | nothing;
- global resName res/name | nothing;
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname+'&edit=1'" />
-
-<tal:block tal:condition="python: ptype != '33'"
- tal:define="
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
+<div class="rescfg" name="NFSX"
+ tal:attributes="id res/name | nothing" metal:define-macro="nfsx_macro">
<p class="reshdr">NFS Export Resource Configuration</p>
<form method="post"
- tal:attributes="
- action processURL | nothing;
- name res/parent_uuid | nothing">
+ tal:attributes="name res/parent_uuid | nothing"
+ tal:define="editDisabled resourceIsRef | nothing">
+
+ <input name="edit" type="hidden"
+ tal:attributes="value python: ptype == '33' and True or False" />
- <input name="pagetype" type="hidden" value="35" />
+ <input name="pagetype" type="hidden"
+ tal:attributes="value python: ptype" />
<input name="global" type="hidden"
tal:attributes="value resourceIsRef | nothing" />
@@ -914,14 +806,12 @@
tal:attributes="value res/indent_ctr | string:0" />
<input name="clustername" type="hidden"
- tal:attributes="value cluname | nothing" />
+ tal:attributes="
+ value request/clustername | request/form/clustername | nothing" />
<input name="oldname" type="hidden"
tal:attributes="value res/name | nothing" />
- <input name="edit" type="hidden" value="1"
- tal:condition="python: edit == True" />
-
<input name="type" type="hidden" value="nfsx" />
<table class="systemsTable">
@@ -931,7 +821,7 @@
<input type="text" size="20" name="resourceName"
tal:attributes="
disabled python: editDisabled;
- value resName | nothing" />
+ value res/name | nothing" />
</td>
</tr>
</table>
@@ -940,31 +830,20 @@
</form>
</div>
-<div class="rescfg" name="SCR" tal:attributes="id res/name | nothing" metal:define-macro="scr_macro">
-<tal:block tal:condition="python: ptype == '33' or ptype == '24'"
- tal:define="
- global edit string:true;
- global editDisabled resourceIsRef | nothing;
- global resName res/name | nothing;
- global filename res/attrs/file | nothing;
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname+'&edit=1'" />
-
-<tal:block tal:condition="python: ptype != '33'"
- tal:define="
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
+<div class="rescfg" name="SCR"
+ tal:attributes="id res/name | nothing" metal:define-macro="scr_macro">
<p class="reshdr">Script Resource Configuration</p>
<form method="post"
- tal:attributes="
- action processURL | nothing;
- name res/parent_uuid | nothing">
+ tal:define="editDisabled resourceIsRef | nothing"
+ tal:attributes="name res/parent_uuid | nothing">
- <input name="pagetype" type="hidden" value="35" />
+ <input name="edit" type="hidden"
+ tal:attributes="value python: ptype == '33' and True or False" />
+
+ <input name="pagetype" type="hidden"
+ tal:attributes="value python: ptype" />
<input name="global" type="hidden"
tal:attributes="value resourceIsRef | nothing" />
@@ -979,14 +858,12 @@
tal:attributes="value res/indent_ctr | string:0" />
<input name="clustername" type="hidden"
- tal:attributes="value cluname | nothing" />
+ tal:attributes="
+ value request/clustername | request/form/clustername | nothing" />
<input name="oldname" type="hidden"
tal:attributes="value res/name | nothing" />
- <input name="edit" type="hidden" value="1"
- tal:condition="python: edit == 'true'" />
-
<input name="type" type="hidden" value="scr" />
<table class="systemsTable">
@@ -996,7 +873,7 @@
<input type="text" size="20" name="resourceName"
tal:attributes="
disabled python: editDisabled;
- value resName | nothing" />
+ value res/name | nothing" />
</td>
</tr>
@@ -1006,7 +883,7 @@
<input type="text" size="20" name="file"
tal:attributes="
disabled python: editDisabled;
- value filename | nothing" />
+ value res/attrs/file | nothing" />
</td>
</tr>
</table>
@@ -1015,32 +892,20 @@
</form>
</div>
-<div class="rescfg" name="SMB" tal:attributes="id res/name | nothing" metal:define-macro="smb_macro">
-<tal:block tal:condition="python: ptype == '33' or ptype == '24'"
- tal:define="
- global edit python: True;
- global editDisabled resourceIsRef | nothing;
- global resName res/name | nothing;
- global workgroup res/attrs/workgroup | nothing;
- global cluname request/clustername;
- tmp_URL context/cluster/index_html/absolute_url;
- global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname+'&edit=1'" />
-
-<tal:block tal:condition="python: ptype != '33'"
- 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" />
+<div class="rescfg" name="SMB"
+ tal:attributes="id res/name | nothing" metal:define-macro="smb_macro">
<p class="reshdr">Samba Server Configuration</p>
<form method="post"
- tal:attributes="
- action processURL | nothing;
- name res/parent_uuid | nothing">
+ tal:define="editDisabled resourceIsRef | nothing"
+ tal:attributes="name res/parent_uuid | nothing">
- <input name="pagetype" type="hidden" value="35" />
+ <input name="edit" type="hidden"
+ tal:attributes="value python: ptype == '33' and True or False" />
+
+ <input name="pagetype" type="hidden"
+ tal:attributes="value python: ptype" />
<input name="global" type="hidden"
tal:attributes="value resourceIsRef | nothing" />
@@ -1055,14 +920,12 @@
tal:attributes="value res/indent_ctr | string:0" />
<input name="clustername" type="hidden"
- tal:attributes="value cluname | nothing" />
+ tal:attributes="
+ value request/clustername | request/form/clustername | nothing" />
<input name="oldname" type="hidden"
tal:attributes="value res/name | nothing" />
- <input name="edit" type="hidden" value="1"
- tal:condition="python: edit == True" />
-
<input name="type" type="hidden" value="smb" />
<table class="systemsTable">
@@ -1072,7 +935,7 @@
<input type="text" size="20" name="resourceName"
tal:attributes="
disabled python: editDisabled;
- value resName | nothing" />
+ value res/name | nothing" />
</td>
</tr>
@@ -1082,7 +945,7 @@
<input type="text" size="20" name="workgroup"
tal:attributes="
disabled python: editDisabled;
- value workgroup | nothing" />
+ value res/attrs/workgroup | nothing" />
</td>
</tr>
</table>
--- conga/luci/cluster/resource_form_handlers.js 2006/09/29 21:41:43 1.16
+++ conga/luci/cluster/resource_form_handlers.js 2006/10/02 20:21:47 1.17
@@ -83,16 +83,17 @@
if (!form.ip_address || str_is_blank(form.ip_address.value)) {
errors.push('No IP address was given.');
- set_form_error(form.ip_address);
+ set_form_err(form.ip_address);
return (errors);
}
var ipstr = form.ip_address.value;
- if (!isValidHost(ipstr)) {
- errors.push('\"' + ipstr + '\" is an invalid IP address.');
- set_form_error(form.ip_address);
+ var err = isValidHost(ipstr);
+ if (err) {
+ errors.push('Error: \"' + ipstr + '\": ' + err);
+ set_form_err(form.ip_address);
} else
- clr_form_error(form.ip_address);
+ clr_form_err(form.ip_address);
return (errors);
}
@@ -102,21 +103,21 @@
if (!form.mountpoint || str_is_blank(form.mounpoint.value)) {
errors.push('No mount point was given.');
- set_form_error(form.mountpoint);
+ set_form_err(form.mountpoint);
} else
- clr_form_error(form.mountpoint);
+ clr_form_err(form.mountpoint);
if (!form.host || str_is_blank(form.host.value)) {
errors.push('No NFS server host was given.');
- set_form_error(form.host);
+ set_form_err(form.host);
} else
- clr_form_error(form.host);
+ clr_form_err(form.host);
if (!form.exportpath || str_is_blank(form.exportpath.value)) {
errors.push('No NFS export path was given.');
- set_form_error(form.exportpath);
+ set_form_err(form.exportpath);
} else
- clr_form_error(form.exportpath);
+ clr_form_err(form.exportpath);
return (errors);
}
@@ -220,11 +221,10 @@
form_validators['scr'] = validate_script;
form_validators['smb'] = validate_samba;
-function validate_form(form) {
+function check_form(form) {
var valfn = form_validators[form.type.value];
if (!valfn)
return (-1);
-
var errors = valfn(form);
if (form.type.value != 'ip') {
if (!form.resourceName || str_is_blank(form.resourceName.value)) {
@@ -234,6 +234,11 @@
clr_form_err(form.resourceName);
}
+ return (errors)
+}
+
+function validate_form(form) {
+ var errors = check_form(form);
if (error_dialog(errors))
return (-1);
form.submit();
@@ -372,20 +377,15 @@
pdiv.appendChild(child_div);
}
-function forms_to_xml() {
- var form = document.getElementsByTagName('form');
- var master_form = null;
- var form_xml = '';
+function forms_to_xml(master_form) {
var errors = new Array();
+ var form_xml = '';
+ var form = document.getElementsByTagName('form');
for (var i = 0 ; i < form.length ; i++) {
- if (form[i].name == 'master') {
- master_form = form[i];
+ if (form[i].name == 'master' || !form[i].uuid || !form[i].uuid.value)
continue;
- } else if (!form[i].uuid || !form[i].uuid.value)
- continue;
-
- var err = validate_form(form[i]);
+ var err = check_form(form[i]);
if (err)
errors.concat(err);
var temp = form[i].innerHTML.match(/<input [^>]+>/ig).toString().replace(/>(,|$)/g, '/>');
@@ -395,13 +395,16 @@
form[i].parent_uuid.value + '">' + temp + '</form>';
}
- if (error_dialog(errors))
- return (-1);
+ if (!form_xml)
+ errors.push('No resource information was submitted.')
- if (!master_form || !form_xml)
+ if (error_dialog(errors))
return (-1);
/* sort this out in the backend */
master_form.form_xml.value = form_xml;
- master_form.submit();
+ alert(form_xml);
+ if (confirm('Save changes to this service?'))
+ master_form.submit();
+ return (0);
}
next reply other threads:[~2006-10-02 20:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-02 20:21 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-09-22 21:59 [Cluster-devel] conga/luci/cluster form-macros resource-form-m rmccabe
2006-09-22 18:22 rmccabe
2006-09-06 22:13 rmccabe
2006-08-29 23:23 rmccabe
2006-08-10 23:06 shuennek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061002202148.6709.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.