_addUnitCallback: function(ev) {
+ var container = this.viewletManager.get('container');
+ var field = container.one('.num-units-control');
var service, db;
service = this.viewletManager.get('model');
db = this.viewletManager.get('db');
@@ -224,7 +226,7 @@ 'unit_count', service.get('unit_count') + unit_names.length);
} db.fire('update');
- // View is redrawn so we do not need to enable field.
+ field.set('disabled', false);
},
Reviewers: mp+190750_ code.launchpad. net,
Message:
Please take a look.
Description:
After units are deployed, re-enable unit control
https:/ /code.launchpad .net/~gary/ juju-gui/ bug1236427/ +merge/ 190750
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/14512056/
Affected files (+22, -1 lines): inspector. js inspector_ overview. js
A [revision details]
M app/views/
M test/test_
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: test/test_ inspector_ overview. js inspector_ overview. js' inspector_ overview. js 2013-10-09 20:32:53 +0000 inspector_ overview. js 2013-10-11 19:33:07 +0000
assert. equal(4, message. Params. NumUnits) ;
=== modified file 'test/test_
--- test/test_
+++ test/test_
@@ -196,6 +196,23 @@
});
+ it('should disable and enable the unit control appropriately', one('.num- units-control' ); set('value' , 7); simulate( 'keydown' , { keyCode: ENTER }); one('.confirm- num-units' ).simulate( 'click' ); isTrue( control. get('disabled' )); message( ); Params. NumUnits} isFalse( control. get('disabled' ));
setUpInspecto r();
function() {
+ setUpInspector();
+ var control = container.
+ control.
+ control.
+ // confirm the 'please confirm constraints' dialogue
+ container.
+ assert.
+ var message = conn.last_
+ conn.msg({
+ RequestId: message.RequestId,
+ Error: undefined,
+ Response: {Units: message.
+ });
+ assert.
+ });
+
it('should set the constraints before deploying any more units',
function() {
Index: app/views/ inspector. js inspector. js' inspector. js 2013-10-02 12:15:05 +0000 inspector. js 2013-10-11 19:33:07 +0000
=== modified file 'app/views/
--- app/views/
+++ app/views/
@@ -201,6 +201,8 @@
},
_ addUnitCallback : function(ev) { ager.get( 'container' ); one('.num- units-control' ); ager.get( 'model' ); ager.get( 'db');
'unit_count' , service. get('unit_ count') + unit_names.length);
db.fire( 'update' ); 'disabled' , false);
+ var container = this.viewletMan
+ var field = container.
var service, db;
service = this.viewletMan
db = this.viewletMan
@@ -224,7 +226,7 @@
}
- // View is redrawn so we do not need to enable field.
+ field.set(
},
_ removeUnitCallb ack: function(ev) {