Permalink
Browse files

Disable New VM form controls unless template is selected (ON-5)

  • Loading branch information...
Petar Grgic authored and mmikulicic committed May 10, 2012
1 parent b94909d commit e1327bd5dff4f1f31b9e62b6744d74b238fc4694
Showing with 11 additions and 1 deletion.
  1. +11 −1 app/view/compute/NewVmView.js
@@ -59,6 +59,14 @@ Ext.define('Onc.view.compute.NewVmView', {
component.setMaxValue(max * multiplier);
},
+ disableControls: function (boolValue){
+ var controls = ['num_cores', 'num_cores_slider', 'cpu_limit', 'cpu_limit_slider', 'memory', 'memory_slider', 'diskspace', 'diskspace_slider', 'hostname', 'ipv4_address', 'dns1', 'dns2', 'root_password', 'root_password_repeat', 'start_on_boot'];
+
+ Ext.Array.forEach(controls,function(control){
+ Ext.getCmp(control).setDisabled(boolValue);
+ });
+ },
+
listeners: {
'afterrender': function(){
var tooltipMap = {
@@ -82,7 +90,7 @@ Ext.define('Onc.view.compute.NewVmView', {
'start_on_boot': 'Start VM on boot'
};
-
+ this.disableControls(true);
Ext.iterate(tooltipMap, function(controlName, tooltip) {
Ext.create('Ext.tip.ToolTip', {
target: controlName,
@@ -146,6 +154,8 @@ Ext.define('Onc.view.compute.NewVmView', {
this.setValue('dns1', 'nameserver');
this.setValue('dns2', 'nameserver');
this.setValue('root_password', 'password');
+
+ this.disableControls(false);
}.bind(this)
}
}]

0 comments on commit e1327bd

Please sign in to comment.