conga/luci cluster/form-macros cluster/resourc ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-12-05 23:32:35
Modified files:
luci/cluster : form-macros resource_form_handlers.js
luci/site/luci/Extensions: cluster_adapters.py
Log message:
service add and edit fixes
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.120&r2=1.121
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.171&r2=1.172
luci/cluster/form-macros +20 -2
@@ -2857,6 +2857,14 @@ <input type="text" length="20" name="service_name" value="" /> </td> </tr> + <tr class="systemsTable"> + <td class="systemsTable"> + Automatically start this service + </td> + <td class="systemsTable"> + <input type="checkbox" name="autostart" checked="checked" /> + </td> + </tr> </table> </form> </div>
@@ -2880,6 +2888,7 @@ <input type="hidden" name="parent_uuid" value="_toplevel" /> <input type="hidden" name="tree_level" value="-1" /> <input type="hidden" name="svc_name" value="" /> + <input type="hidden" name="autostart" value="" /> <input type="hidden" name="form_xml" /> <input type="hidden" name="action" value="add" /> </form>
@@ -3022,7 +3031,8 @@ tal:content="sinfo/name | nothing" tal:attributes="class python: running and 'running' or 'stopped'" /> </td> - <td class="cluster service service_action"> + <td class="cluster service service_action" + tal:condition="python: sinfo and 'innermap' in sinfo"> <form method="post" onSubmit="return dropdown(this.gourl)"> <input type="hidden" name="pagetype" tal:attributes=" value request/pagetype | request/form/pagetype | nothing" />
@@ -3090,9 +3100,16 @@ </div> <div class="service_comp_list"> <form name="service_name_form"> + <table class="rescfg"> + <tr><td> + Automatically start this service + </td> + <td><input type="checkbox" name="autostart" tal:attributes="checked sinfo/autostart | nothing" /></td></tr> + </table> <input type="hidden" name="service_name" - tal:attributes="value sinfo/name | nothing" /> + tal:attributes="value sinfo/name | string:1" /> </form> + <form name="master" method="post"> <tal:block tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
@@ -3109,6 +3126,7 @@ <input type="hidden" name="parent_uuid" value="_toplevel" /> <input type="hidden" name="tree_level" value="-1" /> <input type="hidden" name="svc_name" value="" /> + <input type="hidden" name="autostart" value="" /> <input type="hidden" name="form_xml" /> <input type="hidden" name="action" value="edit" /> </form>
luci/cluster/resource_form_handlers.js +28 -3
@@ -381,6 +381,7 @@ var errors = new Array(); var form_xml = ''; var svc_name = null; + var autostart = 1; var form = document.getElementsByTagName('form'); for (var i = 0 ; i < form.length ; i++) {
@@ -393,17 +394,40 @@ clr_form_err(form[i].service_name); svc_name = form[i].service_name.value; } + if (!form[i].autostart.checked) + autostart = 0; continue; } if (form[i].name == 'master' || !form[i].uuid || !form[i].uuid.value) continue; + var err = check_form(form[i]); if (err) errors = errors.concat(err); - var temp = form[i].innerHTML.match(/<input [^>]+>/ig).toString().replace(/>(,|$)/g, '/>'); - if (!temp) - continue; + var temp = ''; + + var input_elem = form[i].getElementsByTagName('input'); + for (var j = 0 ; j < input_elem.length ; j++) { + var res_type = input_elem[j].type; + if (res_type == 'hidden' || res_type == 'text' || + res_type == 'password') + { + temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />'; + } else if (res_type == 'checkbox' || res_type == 'radio') { + if (input_elem[j].checked) + temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" checked="checked"'; + if (res_type == 'radio') + temp += ' value="' + input_elem[j].value + '"'; + temp += ' />'; + } + } + + var select_elem = form[i].getElementsByTagName('select'); + for (var j = 0 ; j < select_elem.length ; j++) { + temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />'; + } + form_xml += '<form id="' + form[i].uuid.value + '" parent="' + form[i].parent_uuid.value + '">' + temp + '</form>'; }
@@ -420,6 +444,7 @@ /* sort this out in the backend */ master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>'; master_form.svc_name.value = svc_name; + master_form.autostart = autostart; var confirm_msg = null; if (master_form.action.value == 'add')
luci/site/luci/Extensions/cluster_adapters.py +129 -10
199 lines not on this page · raw message