2 /* Live form updating for the create VM template */
7 var mode
= $("#id_mode");
8 var node
= $("#id_node");
9 var iallocator
= $("#id_iallocator");
10 var iallocator_hostname
= $("#id_iallocator_hostname");
11 var using_str
= " Using: ";
17 /* initialize the live form updater */
20 // disable the iallocator stuff by default
21 if(!iallocator_hostname
.attr("value")){
22 iallocator
.attr("readonly", "readonly");
26 using_str
+ iallocator_hostname
.val() +
31 // only disable iallocator by default if there is no cluster selected
32 // or the cluster already selected does not support iallocator
33 var def_iallocator
= iallocator_hostname
.val();
34 if (!iallocator
.is(":checked")
35 && (def_iallocator
== undefined|| def_iallocator
== '')
40 // fire off some initial changes
45 function _initChangeHooks(){
46 /* setup change hooks for the form elements */
48 iallocator
.live("change", function() {
49 if(!iallocator
.attr("readonly")) {
50 if(iallocator
.is(":checked")) {
56 if(!iallocator
.is(":checked")){
62 mode
.live("change", function(){
63 if ('replace_new_secondary' == mode
.val()) {
65 var def_iallocator
= iallocator_hostname
.val();
66 if (def_iallocator
== undefined || def_iallocator
== ''){
79 function _nodeEnable(){
80 /* Disable and hide all of the node stuffs */
81 node
.parent().parent().show();
82 node
.removeAttr("disabled")
86 function _iallocatorEnable(){
87 /* Disable and hide all of the iallocator stuffs */
88 iallocator
.parent().parent("tr").show();
89 iallocator
.removeAttr("disabled")
93 function _nodeDisable(){
94 /* Disable and hide all of the node stuffs */
95 node
.parent().parent().hide();
96 node
.attr("disabled", "disabled")
100 function _iallocatorDisable(){
101 /* Disable and hide all of the iallocator stuffs */
102 iallocator
.parent().parent("tr").hide();
103 iallocator
.attr("disabled", "disabled")