conga/luci/cluster form-macros index_html reso ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-26 19:47:32
Modified files:
luci/cluster : form-macros index_html
resource_form_handlers.js
Log message:
make fence device form swapping work
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.70&r2=1.71
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.13&r2=1.14
luci/cluster/form-macros +91 -81
@@ -688,6 +688,74 @@ <span tal:define="res python: here.processClusterProps(r_agent, request)"/> </div> +<div metal:define-macro="fence-option-list"> + <option name="fence_apc" value="fence_apc">APC Power Switch</option> + <option name="fence_wti" value="fence_wti">WTI Power Switch</option> + <option name="fence_ilo" value="fence_ilo">HP iLO</option> + <option name="fence_drac" value="fence_drac">Dell DRAC</option> + <option name="fence_rsa" value="fence_rsa">IBM RSA II</option> + <option name="fence_ipmilan" value="fence_ipmilan">IPMI Lan</option> +</div> + +<div metal:define-macro="fence-form-list"> + <div id="fence_apc"> + <table> + <tr><td>Name: </td><td><input name="name"></td></tr> + <tr><td>IP Address: </td><td><input name="ip_addr"></td></tr> + <tr><td>Login: </td><td><input name="login"></td></tr> + <tr><td>Password: </td><td><input name="password"></td></tr> + <input type="submit"/> + </table> + </div> + <div id="fence_wti"> + <table> + <tr><td>Name: </td><td><input name="name"></td></tr> + <tr><td>IP Address: </td><td><input name="ip_addr"></td></tr> + <tr><td>Password: </td><td><input name="password"></td></tr> + <input type="submit"/> + </table> + </div> + <div id="fence_ilo"> + <table> + <tr><td>Name: </td><td><input name="name"></td></tr> + <tr><td>Login: </td><td><input name="login"></td></tr> + <tr><td>Password: </td><td><input name="password"></td></tr> + <tr><td>Hostname: </td><td><input name="hostname"></td></tr> + <input type="submit"/> + </table> + </div> + <div id="fence_drac"> + <table> + <tr><td>Name: </td><td><input name="name"></td></tr> + <tr><td>IP Address: </td><td><input name="ip_addr"></td></tr> + <tr><td>Login: </td><td><input name="login"></td></tr> + <tr><td>Password: </td><td><input name="password"></td></tr> + <input type="submit"/> + </table> + </div> + <div id="fence_rsa"> + <table> + <tr><td>Name: </td><td><input name="name"></td></tr> + <tr><td>Login: </td><td><input name="login"></td></tr> + <tr><td>Password: </td><td><input name="password"></td></tr> + <tr><td>Hostname: </td><td><input name="hostname"></td></tr> + <input type="submit"/> + </table> + </div> + <div id="fence_ipmilan"> + <form name="fence_ipmilan"> + <table> + <tr><td>Name: </td><td><input name="name"></td></tr> + <tr><td>IP Address: </td><td><input name="ip_addr"></td></tr> + <tr><td>Login: </td><td><input name="login"></td></tr> + <tr><td>Password: </td><td><input name="password"></td></tr> + <tr><td>Auth Type: </td><td><input name="auth_type"></td></tr> + <input type="submit"/> + </table> + </form> + </div> +</div> + <div metal:define-macro="node-form"> <tal:comment tal:replace="nothing"> First table row is status icon, name, and dropdown
@@ -823,95 +891,37 @@ <hr/> + <div id="invisible" class="invisible"> + <tal:block metal:use-macro="here/form-macros/macros/fence-form-list" /> + </div> + <h3>Fencing</h3> <table class="cluster node" width="100%"> <tr class="cluster node info_top"> <td class="cluster node fence_main"> <strong class="cluster node">Main Fencing Method</strong> - <form name="main_fence_form"> - <select name="select_div" onChange="swap_fence_div('container'), main_fence_form.select_div.options[filler.select_div.selectedIndex].value);"> - <option name="fence_apc" value="fence_apc">APC Power Switch</option> - <option name="fence_wti" value="fence_wti">WTI Power Switch</option> - <option name="fence_ilo" value="fence_ilo">HP iLO</option> - <option name="fence_drac" value="fence_drac">Dell DRAC</option> - <option name="fence_rsa" value="fence_rsa">IBM RSA II</option> - <option name="fence_ipmilan" value="fence_ipmilan">IPMI Lan</option> - </select> - </form> - <div id="container">Container</div> - - <div id="invisible" style="visibility: hidden"> - <div id="fence_apc"> - <table> - <tr><td>Name: </td><td><input name="name"></td></tr> - <tr><td>IP Address: </td><td><input name="ip_addr"></td></tr> - <tr><td>Login: </td><td><input name="login"></td></tr> - <tr><td>Password: </td><td><input name="password"></td></tr> - <input type="submit"/> - </table> - </div> - <div id="fence_wti"> - <table> - <tr><td>Name: </td><td><input name="name"></td></tr> - <tr><td>IP Address: </td><td><input name="ip_addr"></td></tr> - <tr><td>Password: </td><td><input name="password"></td></tr> - <input type="submit"/> - </table> - </div> - <div id="fence_ilo"> - <table> - <tr><td>Name: </td><td><input name="name"></td></tr> - <tr><td>Login: </td><td><input name="login"></td></tr> - <tr><td>Password: </td><td><input name="password"></td></tr> - <tr><td>Hostname: </td><td><input name="hostname"></td></tr> - <input type="submit"/> - </table> - </div> - <div id="fence_drac"> - <table> - <tr><td>Name: </td><td><input name="name"></td></tr> - <tr><td>IP Address: </td><td><input name="ip_addr"></td></tr> - <tr><td>Login: </td><td><input name="login"></td></tr> - <tr><td>Password: </td><td><input name="password"></td></tr> - <input type="submit"/> - </table> - </div> - <div id="fence_rsa"> - <table> - <tr><td>Name: </td><td><input name="name"></td></tr> - <tr><td>Login: </td><td><input name="login"></td></tr> - <tr><td>Password: </td><td><input name="password"></td></tr> - <tr><td>Hostname: </td><td><input name="hostname"></td></tr> - <input type="submit"/> - </table> - </div> - <div id="fence_ipmilan"> - <form name="fence_ipmilan"> - <table> - <tr><td>Name: </td><td><input name="name"></td></tr> - <tr><td>IP Address: </td><td><input name="ip_addr"></td></tr> - <tr><td>Login: </td><td><input name="login"></td></tr> - <tr><td>Password: </td><td><input name="password"></td></tr> - <tr><td>Auth Type: </td><td><input name="auth_type"></td></tr> - <input type="submit"/> - </table> - </form> - </div> - - </div> + <form name="main_fence_form"> + <select name="select_div" + onChange="swap_fence_div('fence_container', + this.options[this.selectedIndex].value)"> + <tal:block metal:use-macro="here/form-macros/macros/fence-option-list" /> + </select> + </form> + <div id="fence_container"> + </div> </td> + <td class="cluster node fence_backup"> <strong class="cluster node">Backup Fencing Method</strong> - <form name="backup_fence_form"> - <select name="select_div" onChange="swap_fence_div('container'), backup_fence_form.select_div.options[backup_fence_form.select_div.selectedIndex].value);"> - <option name="fence_apc_b" value="fence_apc_b">APC Power Switch</option> - <option name="fence_wti_b" value="fence_wti_b">WTI Power Switch</option> - <option name="fence_ilo_b" value="fence_ilo_b">HP iLO</option> - <option name="fence_drac_b" value="fence_drac_b">Dell DRAC</option> - <option name="fence_rsa_b" value="fence_rsa_b">IBM RSA II</option> - <option name="fence_ipmilan_b" value="fence_ipmilan_b">IPMI Lan</option> - </select> - </form> + <form name="backup_fence_form"> + <select name="select_div" + onChange="swap_fence_div('fence_container_backup', + this.options[this.selectedIndex].value)"> + <tal:block metal:use-macro="here/form-macros/macros/fence-option-list" /> + </select> + </form> + <div id="fence_container_backup"> + </div> </td> </tr> </table>
luci/cluster/index_html +17 -22
@@ -95,29 +95,24 @@ return false; } - function swap_fence_div(container_id, element_id) { - container_element = document.getElementById(container_id) - if (!container_element) { - alert('Can\'t find element with id = ' + container_id); - return (-1); - } - - child_element = document.getElementById(element_id); - if (!child_element) { - alert('Can\'t find element with id = ' + element_id); - return (-1); - } - - temp = container_element.firstChild; - container_element.replaceChild(child_element, container_element.firstChild); - invisible_div = document.getElementById('invisible'); - if (!invisible_div) { - alert('No invisible div'); - return (-1); - } + function swap_fence_div(container_id, element_id) { + var container_element = document.getElementById(container_id) + if (!container_element) { + alert('Can\'t find element with id = ' + container_id); + return (-1); + } - invisible_div.appendChild(temp); - } + var child_element = document.getElementById(element_id); + if (!child_element) { + alert('Can\'t find element with id = ' + element_id); + return (-1); + } + if (container_element.firstChild) + container_element.removeChild(container_element.firstChild); + var target = child_element.cloneNode(1); + target.id = null; + container_element.appendChild(target); + } //--> </SCRIPT> <metal:javascriptslot define-slot="javascript_head_slot" />
luci/cluster/resource_form_handlers.js +1 -0
@@ -328,6 +328,7 @@ var form = document.getElementsByTagName('form'); var master_form = null; var form_xml = ''; + var errors = new Array(); for (var i = 0 ; i < form.length ; i++) { if (form[i].name == 'master') {