conga/luci cluster/form-macros cluster/resourc ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-12-05 06:44:10
Modified files:
luci/cluster : form-macros resource-form-macros
resource_form_handlers.js
luci/site/luci/Extensions: cluster_adapters.py
Log message:
fixes for adding and editing services
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.119&r2=1.120
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.170&r2=1.171
luci/cluster/form-macros +48 -24
@@ -2879,7 +2879,9 @@ <input type="hidden" name="uuid" value="toplevel" /> <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="form_xml" /> + <input type="hidden" name="action" value="add" /> </form> </div>
@@ -2939,30 +2941,46 @@ </div> <div metal:define-macro="serviceconfig-type-macro" tal:omit-tag=""> - <span tal:omit-tag="" tal:condition="python: type == 'ip'"> - <tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" /> - </span> - <span tal:omit-tag="" tal:condition="python: type == 'fs'"> - <tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" /> - </span> - <span tal:omit-tag="" tal:condition="python: type == 'gfs'"> - <tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" /> - </span> - <span tal:omit-tag="" tal:condition="python: type == 'nfsm'"> - <tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" /> - </span> - <span tal:omit-tag="" tal:condition="python: type == 'nfsx'"> - <tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" /> - </span> - <span tal:omit-tag="" tal:condition="python: type == 'nfsc'"> - <tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" /> - </span> - <span tal:omit-tag="" tal:condition="python: type == 'smb'"> - <tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" /> - </span> - <span tal:omit-tag="" tal:condition="python: type == 'script'"> - <tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" /> - </span> + <tal:block tal:condition="python: type == 'ip' or type == 'IP Address: '"> + <tal:block + metal:use-macro="here/resource-form-macros/macros/ip_macro" /> + </tal:block> + + <tal:block tal:condition="python: type == 'fs' or type == 'File System: '"> + <tal:block + metal:use-macro="here/resource-form-macros/macros/fs_macro" /> + </tal:block> + + <tal:block tal:condition="python: type == 'gfs' or type == 'GFS: '"> + <tal:block + metal:use-macro="here/resource-form-macros/macros/gfs_macro" /> + </tal:block> + + <tal:block tal:condition="python: type == 'nfsm' or type == 'NFS Mount: '"> + <tal:block + metal:use-macro="here/resource-form-macros/macros/nfsm_macro" /> + </tal:block> + + <tal:block tal:condition="python: type == 'nfsx' or type == 'NFS Export: '"> + <tal:block + metal:use-macro="here/resource-form-macros/macros/nfsx_macro" /> + </tal:block> + + <tal:block tal:condition="python: type == 'nfsc' or type == 'NFS Client: '"> + <tal:block + metal:use-macro="here/resource-form-macros/macros/nfsc_macro" /> + </tal:block> + + <tal:block + tal:condition="python: type == 'smb' or type == 'Samba Service: '"> + <tal:block + metal:use-macro="here/resource-form-macros/macros/smb_macro" /> + </tal:block> + + <tal:block tal:condition="python: type == 'script' or type == 'Script: '"> + <tal:block + metal:use-macro="here/resource-form-macros/macros/scr_macro" /> + </tal:block> </div> <div metal:define-macro="service-config-head-macro" tal:omit-tag="">
@@ -3071,6 +3089,10 @@ </div> </div> <div class="service_comp_list"> + <form name="service_name_form"> + <input type="hidden" name="service_name" + tal:attributes="value sinfo/name | nothing" /> + </form> <form name="master" method="post"> <tal:block tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
@@ -3086,7 +3108,9 @@ <input type="hidden" name="uuid" value="toplevel" /> <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="form_xml" /> + <input type="hidden" name="action" value="edit" /> </form> </div>
luci/cluster/resource-form-macros +33 -9
96 lines not on this page · raw message
luci/cluster/resource_form_handlers.js +25 -2
@@ -380,14 +380,27 @@ function forms_to_xml(master_form) { var errors = new Array(); var form_xml = ''; + var svc_name = null; var form = document.getElementsByTagName('form'); for (var i = 0 ; i < form.length ; i++) { + if (form[i].name == 'service_name_form') { + if (!form[i].service_name || + str_is_blank(form[i].service_name.value)) + { + set_form_err(form[i].service_name); + } else { + clr_form_err(form[i].service_name); + svc_name = form[i].service_name.value; + } + continue; + } + if (form[i].name == 'master' || !form[i].uuid || !form[i].uuid.value) continue; var err = check_form(form[i]); if (err) - errors.concat(err); + errors = errors.concat(err); var temp = form[i].innerHTML.match(/<input [^>]+>/ig).toString().replace(/>(,|$)/g, '/>'); if (!temp) continue;
@@ -395,6 +408,9 @@ form[i].parent_uuid.value + '">' + temp + '</form>'; } + if (!svc_name) + errors.push('No name was given for this service.'); + if (!form_xml) errors.push('No resource information was submitted.');
@@ -403,7 +419,14 @@ /* sort this out in the backend */ master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>'; - if (confirm('Save changes to this service?')) + master_form.svc_name.value = svc_name; + + var confirm_msg = null; + if (master_form.action.value == 'add') + confirm_msg = 'Create this service?'; + else + confirm_msg = 'Save changes to this service?'; + if (confirm(confirm_msg)) master_form.submit(); return (0); }
luci/site/luci/Extensions/cluster_adapters.py +32 -11
90 lines not on this page · raw message