From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 27 Sep 2006 22:24:13 -0000 Subject: [Cluster-devel] conga/luci/cluster clu_portlet_fetcher cluster ... Message-ID: <20060927222413.20838.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-09-27 22:24:11 Modified files: luci/cluster : clu_portlet_fetcher clusterportlet.css form-chooser form-macros index_html portlet_cluconfig portlet_cluconfig_macro resource-form-macros resource_form_handlers.js validate_config_fence.js validate_config_general.js validate_config_multicast.js validate_config_qdisk.js Log message: better javascript form validation and other minor cleanups Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/clu_portlet_fetcher.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/clusterportlet.css.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.72&r2=1.73 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.15&r2=1.16 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/portlet_cluconfig.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/portlet_cluconfig_macro.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_fence.js.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_general.js.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&r1=1.2&r2=1.3 --- conga/luci/cluster/clu_portlet_fetcher 2006/06/30 17:00:02 1.1 +++ conga/luci/cluster/clu_portlet_fetcher 2006/09/27 22:24:11 1.2 @@ -7,7 +7,7 @@ -
+
--- conga/luci/cluster/clusterportlet.css 2006/07/05 21:00:26 1.2 +++ conga/luci/cluster/clusterportlet.css 2006/09/27 22:24:11 1.3 @@ -11,29 +11,29 @@ border-collapse: collapse; border-spacing: 0; } - + #portal-column-one { vertical-align: top; width: 16em; } - + #portal-column-content { vertical-align: top; margin: 0; padding: 0; } - + #portal-column-two { vertical-align: top; width: 16em; } - + /* Padding for the columns */ - + #portal-column-one .visualPadding { padding: 2em 0em 1em 2em; } - + #portal-column-two .visualPadding { padding: 2em 2em 1em 0em; } @@ -159,7 +159,8 @@ * html li.cluConfigTreeCurrentItem a:hover { height: 1.6em; } -.type-nodecfg, .type-nodes, .type-node, .type-nodelist, + +.type-nodecfg, .type-nodes, .type-node, .type-nodelist, .type-nodegrid, .type-nodeadd { display: block; } --- conga/luci/cluster/form-chooser 2006/08/16 22:23:46 1.7 +++ conga/luci/cluster/form-chooser 2006/09/27 22:24:11 1.8 @@ -3,14 +3,14 @@ The title - +
- +
--- conga/luci/cluster/form-macros 2006/09/26 20:57:09 1.72 +++ conga/luci/cluster/form-macros 2006/09/27 22:24:11 1.73 @@ -738,7 +738,7 @@ - +
@@ -762,7 +762,7 @@ - +
@@ -785,7 +785,7 @@ - +
@@ -809,7 +809,7 @@ - +
@@ -837,7 +837,7 @@ Auth Type - +
@@ -1301,7 +1301,7 @@

Add a Service

@@ -1464,7 +1464,7 @@

Service Composition

--- conga/luci/cluster/index_html 2006/09/26 19:47:32 1.15 +++ conga/luci/cluster/index_html 2006/09/27 22:24:11 1.16 @@ -11,8 +11,8 @@ - - + + @@ -39,12 +39,12 @@ - + - + A slot where you can insert CSS in the header from a template - + @@ -101,7 +101,7 @@ alert('Can\'t find element with id = ' + container_id); return (-1); } - + var child_element = document.getElementById(element_id); if (!child_element) { alert('Can\'t find element with id = ' + element_id); @@ -157,7 +157,7 @@ -
+
@@ -184,14 +184,14 @@
- +
- + Page body text @@ -202,7 +202,7 @@

- +

Future Site of Forms

--- conga/luci/cluster/portlet_cluconfig 2006/06/30 17:00:02 1.1 +++ conga/luci/cluster/portlet_cluconfig 2006/09/27 22:24:11 1.2 @@ -4,17 +4,17 @@ -
- +
Clusters
- +
    @@ -33,14 +33,14 @@
    - +
    -
    - +
      --- conga/luci/cluster/portlet_cluconfig_macro 2006/06/30 17:00:02 1.1 +++ conga/luci/cluster/portlet_cluconfig_macro 2006/09/27 22:24:11 1.2 @@ -8,7 +8,7 @@ cur_item item/currentItem;" tal:condition="python: (cur_item or parent_shows_children or children)"> - +
+
@@ -250,7 +250,7 @@ tal:define=" global msg python: here.appendModel(request, modelb); global res python: here.getResourceInfo(modelb, request); - global type python: res['tag_name']"> + global type python: 'tag_name' in res and res['tag_name'] or ''">

Configure

@@ -403,7 +403,7 @@ tal:attributes=" action processURL | nothing; name res/parent_uuid | nothing"> - + 0 && form.mcast[0].checked) mcast = 0; else if (form.mcast.length > 1 && form.mcast[1].checked) mcast = 1; - else + else { errors.push('An invalid value was given while specifying how the multicast address should be chosen.'); + set_form_err(form.mcast[0]); + set_form_err(form.mcast[1]); + } - if (error_dialog(errors)) - return (-1); + if (mcast != null) { + clr_form_err(form.mcast[0]); + clr_form_err(form.mcast[1]); + clr_form_err(form.mcast_address); + } - if (mcast) { - if (!form.mcast_address || str_is_blank(form.mcast_address.value)) + if (mcast == 1) { + if (!form.mcast_address || str_is_blank(form.mcast_address.value)) { errors.push('No multicast address was given.'); - else { + set_form_err(form.mcast_address); + } else { var err = isValidHost(form.mcast_address.value); - if (err) + if (err) { errors.push(err); + set_form_err(form.mcast_address); + } + clr_form_err(form.mcast_address); } } --- conga/luci/cluster/validate_config_qdisk.js 2006/09/06 22:13:33 1.2 +++ conga/luci/cluster/validate_config_qdisk.js 2006/09/27 22:24:11 1.3 @@ -71,6 +71,7 @@ function check_heuristic(hnum, form) { var errors = new Array(); + var blank = 0; if (hnum < 0) errors.push('An invalid heuristic number was given: ' + hnum); @@ -83,41 +84,64 @@ var hstr = 'heuristic' + hnum; var hname = document.getElementById(hstr + ':hname'); - if (!hname || str_is_blank(hname.value)) + if (!hname || str_is_blank(hname.value)) { + ++blank; errors.push('No name was given for heuristic ' + (hnum + 1)); - else + set_form_err(hname); + } else { + /* XXX sanity check the name */ hname = hname.value; + clr_form_err(hname); + } var hpath = document.getElementById(hstr + ':hpath'); - if (!hpath || str_is_blank(hpath.value)) + if (!hpath || str_is_blank(hpath.value)) { + ++blank; errors.push('No path was given for heuristic ' + (hnum + 1)); - else + set_form_err(hpath); + } else { + /* XXX sanity check the path */ hpath = hpath.value; + clr_form_err(hpath); + } var hint = document.getElementById(hstr + ':hinterval'); - if (!hint || str_is_blank(hint.value)) + if (!hint || str_is_blank(hint.value)) { + ++blank; errors.push('No interval was given for heuristic ' + (hnum + 1)); - else + set_form_err(hint); + } else { hint = hint.value; + if (!is_valid_int(hint, 1, null)) { + errors.push('Heuristic interval values must be greater than 0.'); + set_form_err(hint); + } else + clr_form_err(hint); + } var hscore = document.getElementById(hstr + ':hscore'); - if (!hscore || str_is_blank(hscore.value)) + if (!hscore || str_is_blank(hscore.value)) { + ++blank; errors.push('No score was given for heuristic ' + (hnum + 1)); - else + set_form_err(hscore); + } else { hscore = hscore.value; + if (!is_valid_int(hscore, 0, null)) { + errors.push('Heuristic score values must be 0 or greater.'); + set_form_err(hscore); + } else + clr_form_err(hscore); + } - if (errors.length == 4) { + if (blank == 4) { /* The entry is blank -- ignore it. */ + clr_form_err(hname); + clr_form_err(hpath); + clr_form_err(hint); + clr_form_err(hscore); return (null); } - /* TODO: hname, hpath */ - if (hint && !is_valid_int(hint, 1, null)) - errors.push('Heuristic interval values must be integers greater than 0.'); - - if (hscore && !is_valid_int(hscore, null, null)) - errors.push('Heuristic score values must be integers.'); - if (errors.length > 0) return (errors); @@ -126,7 +150,10 @@ function validate_form(form) { var errors = new Array(); + if (!form || !form.quorumd) { + set_form_err(form.quorumd[0]); + set_form_err(form.quorumd[1]); errors.push('You did not specify whether or not to use a quorum partition.'); return (error_dialog(errors)); } @@ -138,50 +165,77 @@ qpart = 1; else { errors.push('You submitted an invalid value while specifying whether or not to use a quorum partition.'); + set_form_err(form.quorumd[0]); + set_form_err(form.quorumd[1]); return (error_dialog(errors)); } + if (qpart != null) { + clr_form_err(form.quorumd[0]); + clr_form_err(form.quorumd[1]); + } + if (qpart) { - if (!form.interval || str_is_blank(form.interval.value)) + if (!form.interval || str_is_blank(form.interval.value)) { errors.push('No interval setting was given.'); - else { - if (!is_valid_int(form.interval.value, 1, null)) + set_form_err(form.interval); + } else { + if (!is_valid_int(form.interval.value, 1, null)) { errors.push('Interval values must be integers greater than 0.'); + set_form_err(form.interval); + } else + clr_form_err(form.interval); } - if (!form.votes || str_is_blank(form.votes.value)) + if (!form.votes || str_is_blank(form.votes.value)) { errors.push('No votes setting was given.'); - else { - if (!is_valid_int(form.votes.value, null, null)) - errors.push('Votes values must be integers.'); + set_form_err(form.votes); + } else { + if (!is_valid_int(form.votes.value, 1, null)) { + errors.push('Votes values must be greater than 0.'); + set_form_err(form.votes); + } else + clr_form_err(form.votes); } - if (!form.tko || str_is_blank(form.tko.value)) + if (!form.tko || str_is_blank(form.tko.value)) { errors.push('No TKO setting was given.'); - else { - if (!is_valid_int(form.tko.value, null, null)) - errors.push('TKO values must be integers.'); + set_form_err(form.tko); + } else { + if (!is_valid_int(form.tko.value, 1, null)) { + errors.push('TKO values must be greater than 0.'); + set_form_err(form.tko); + } else + clr_form_err(form.tko); } - if (!form.min_score || str_is_blank(form.min_score.value)) + if (!form.min_score || str_is_blank(form.min_score.value)) { errors.push('No minimum score setting was given.'); - else { - if (!is_valid_int(form.min_score.value, null, null)) - errors.push('Minimum score values must be integers.'); + set_form_err(form.min_score); + } else { + if (!is_valid_int(form.min_score.value, 1, null)) { + errors.push('Minimum score values must be greater than 0.'); + set_form_err(form.min_score); + } else + clr_form_err(form.min_score); } - if (!form.device || str_is_blank(form.device.value)) + if (!form.device || str_is_blank(form.device.value)) { errors.push('No device setting was given.'); - else { + set_form_err(form.device); + } else { /* TODO: check this */ var device = form.device.value; + clr_form_err(form.device); } - if (!form.label || str_is_blank(form.label.value)) + if (!form.label || str_is_blank(form.label.value)) { errors.push('No label setting was given.'); - else { + set_form_err(form.label); + } else { /* TODO: check this */ var label = form.device.label; + clr_form_err(form.label); } var hnum = document.getElementById('num_heuristics'); @@ -195,11 +249,10 @@ errors = errors.concat(err); } } - - if (error_dialog(errors)) - return (-1); } + if (error_dialog(errors)) + return (-1); if (confirm('Update quorum partition properties?')) form.submit() }
Resource Name