Merge lp://staging/~gary/juju-gui/bug1236427 into lp://staging/juju-gui/experimental

Proposed by Gary Poster
Status: Merged
Merged at revision: 1130
Proposed branch: lp://staging/~gary/juju-gui/bug1236427
Merge into: lp://staging/juju-gui/experimental
Diff against target: 49 lines (+20/-1)
2 files modified
app/views/inspector.js (+3/-1)
test/test_inspector_overview.js (+17/-0)
To merge this branch: bzr merge lp://staging/~gary/juju-gui/bug1236427
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+190750@code.staging.launchpad.net

Description of the change

After units are deployed, re-enable unit control

https://codereview.appspot.com/14512056/

To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

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):
   A [revision details]
   M app/views/inspector.js
   M test/test_inspector_overview.js

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
=== modified file 'test/test_inspector_overview.js'
--- test/test_inspector_overview.js 2013-10-09 20:32:53 +0000
+++ test/test_inspector_overview.js 2013-10-11 19:33:07 +0000
@@ -196,6 +196,23 @@
         assert.equal(4, message.Params.NumUnits);
       });

+ it('should disable and enable the unit control appropriately',
function() {
+ setUpInspector();
+ var control = container.one('.num-units-control');
+ control.set('value', 7);
+ control.simulate('keydown', { keyCode: ENTER });
+ // confirm the 'please confirm constraints' dialogue
+ container.one('.confirm-num-units').simulate('click');
+ assert.isTrue(control.get('disabled'));
+ var message = conn.last_message();
+ conn.msg({
+ RequestId: message.RequestId,
+ Error: undefined,
+ Response: {Units: message.Params.NumUnits}
+ });
+ assert.isFalse(control.get('disabled'));
+ });
+
    it('should set the constraints before deploying any more units',
       function() {
         setUpInspector();

Index: app/views/inspector.js
=== modified file 'app/views/inspector.js'
--- app/views/inspector.js 2013-10-02 12:15:05 +0000
+++ app/views/inspector.js 2013-10-11 19:33:07 +0000
@@ -201,6 +201,8 @@
      },

      _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);
      },

      _removeUnitCallback: function(ev) {

Revision history for this message
Jeff Pihach (hatch) wrote :
Revision history for this message
Jeff Pihach (hatch) wrote :
Revision history for this message
Gary Poster (gary) wrote :

*** Submitted:

After units are deployed, re-enable unit control

R=jeff.pihach
CC=
https://codereview.appspot.com/14512056

https://codereview.appspot.com/14512056/

Revision history for this message
Gary Poster (gary) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches