From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 2 Oct 2006 20:21:48 -0000 Subject: [Cluster-devel] conga/luci/cluster form-macros resource-form-m ... Message-ID: <20061002202148.6709.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 @@
- -
- - + +
- - @@ -426,9 +434,11 @@
- - @@ -491,8 +501,12 @@
- - + +
- + @@ -1179,10 +1193,12 @@
- -
-
+ + + + + onClick="forms_to_xml(this.form)" /> @@ -1425,6 +1448,7 @@ + Service Name:
@@ -1515,11 +1539,18 @@
- + + + + + onClick="forms_to_xml(this.form)" /> --- 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 @@

Resources Remove Form

- - -
+ +
+
@@ -185,6 +182,9 @@
+ @@ -225,46 +225,40 @@
- - -

Resource

+

Resource

- -
+
- - - - - -

Configure

+ + + +

Configure

+ -
+
-
+
-
+
@@ -290,35 +284,20 @@
-
- - - +

IP Address Resource Configuration

- + - + + + @@ -333,15 +312,13 @@ tal:attributes="value res/indent_ctr | string:0" /> + tal:attributes=" + value request/clustername | request/form/clustername | nothing" /> - - - + @@ -350,7 +327,7 @@ + value res/name | nothing" /> @@ -359,7 +336,7 @@ + checked res/attrs/monitor_link | string: 1" />
@@ -368,43 +345,20 @@
-
- - - +

File System Resource Configuration

-
+ + + - + @@ -419,14 +373,12 @@ tal:attributes="value res/indent_ctr | string:0" /> + tal:attributes=" + value request/clustername | request/form/clustername | nothing" /> - - @@ -436,20 +388,23 @@ + value res/name | nothing"/> @@ -458,7 +413,9 @@ @@ -468,7 +425,7 @@ + value res/attrs/device | nothing" /> @@ -478,7 +435,7 @@ + value res/attrs/options | nothing" /> @@ -488,7 +445,7 @@ + value res/attrs/fsid | nothing" /> @@ -498,7 +455,7 @@ + checked res/attrs/force_unmount | nothing" /> @@ -508,7 +465,7 @@ + checked res/attrs/self_fence | nothing" /> @@ -518,7 +475,7 @@ + checked res/attrs/force_fsck | nothing" />
File system type - +
Mount point + tal:attributes=" + disabled python: editDisabled; + value res/attrs/mountpoint | nothing" />
@@ -527,38 +484,20 @@
-
- - - +

GFS Resource Configuration

-
+ - + + + @@ -573,14 +512,12 @@ tal:attributes="value res/indent_ctr | string:0" /> + tal:attributes=" + value request/clustername | request/form/clustername | nothing" /> - - @@ -590,7 +527,7 @@ + value res/name | nothing" /> @@ -600,7 +537,7 @@ + value res/attrs/mountpoint | nothing" /> @@ -610,7 +547,7 @@ + value res/attrs/device | nothing" /> @@ -620,7 +557,7 @@ + value res/attrs/options | nothing" /> @@ -630,7 +567,7 @@ + value res/attrs/fsid | nothing" /> @@ -640,7 +577,7 @@ + checked res/attrs/force_unmount | nothing" />
@@ -649,38 +586,20 @@
-
- - - +

NFS Mount Resource Configuration

-
+ + + - + @@ -695,14 +614,12 @@ tal:attributes="value res/indent_ctr | string:0" /> + tal:attributes=" + value request/clustername | request/form/clustername | nothing" /> - - @@ -712,7 +629,7 @@ + value res/name | nothing" /> @@ -722,7 +639,7 @@ + value res/attrs/mountpoint | nothing" /> @@ -732,7 +649,7 @@ + value res/attrs/host | nothing" /> @@ -742,24 +659,25 @@ + value res/attrs/readOnly | nothing" /> - @@ -769,7 +687,7 @@ + value res/attrs/options | nothing" /> @@ -779,7 +697,7 @@ + checked res/attrs/force_unmount | nothing" />
NFS version + - NFS (version 3) + content string: NFS (version 3); + checked python: nfstype == 'nfs' and 'checked'" />
- NFS4 + content string: NFS4; + checked python: nfstype == 'nfs4' and 'checked'" />
@@ -788,34 +706,20 @@
-
- - - +

NFS Client Resource Configuration

+ tal:attributes="name res/parent_uuid | nothing" + tal:define="editDisabled resourceIsRef | nothing"> + + - + @@ -830,15 +734,13 @@ tal:attributes="value res/indent_ctr | string:0" /> + tal:attributes=" + value request/clustername | request/form/clustername | nothing" /> - - - + @@ -847,7 +749,7 @@ + value res/name | nothing" /> @@ -857,7 +759,7 @@ + value res/attrs/target | nothing"/> @@ -867,7 +769,7 @@ + value res/attrs/options | nothing"/>
@@ -876,30 +778,20 @@
-
- - - +

NFS Export Resource Configuration

+ tal:attributes="name res/parent_uuid | nothing" + tal:define="editDisabled resourceIsRef | nothing"> + + - + @@ -914,14 +806,12 @@ tal:attributes="value res/indent_ctr | string:0" /> + tal:attributes=" + value request/clustername | request/form/clustername | nothing" /> - - @@ -931,7 +821,7 @@ + value res/name | nothing" />
@@ -940,31 +830,20 @@
-
- - - +

Script Resource Configuration

+ tal:define="editDisabled resourceIsRef | nothing" + tal:attributes="name res/parent_uuid | nothing"> - + + + @@ -979,14 +858,12 @@ tal:attributes="value res/indent_ctr | string:0" /> + tal:attributes=" + value request/clustername | request/form/clustername | nothing" /> - - @@ -996,7 +873,7 @@ + value res/name | nothing" /> @@ -1006,7 +883,7 @@ + value res/attrs/file | nothing" />
@@ -1015,32 +892,20 @@
-
- - - +

Samba Server Configuration

+ tal:define="editDisabled resourceIsRef | nothing" + tal:attributes="name res/parent_uuid | nothing"> - + + + @@ -1055,14 +920,12 @@ tal:attributes="value res/indent_ctr | string:0" /> + tal:attributes=" + value request/clustername | request/form/clustername | nothing" /> - - @@ -1072,7 +935,7 @@ + value res/name | nothing" /> @@ -1082,7 +945,7 @@ + value res/attrs/workgroup | nothing" />
--- 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(/]+>/ig).toString().replace(/>(,|$)/g, '/>'); @@ -395,13 +395,16 @@ form[i].parent_uuid.value + '">' + temp + '
'; } - 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); }