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

Proposed by Gary Poster
Status: Merged
Merged at revision: 1031
Proposed branch: lp://staging/~gary/juju-gui/fixSuccessiveConflicts
Merge into: lp://staging/juju-gui/experimental
Diff against target: 164 lines (+63/-26)
3 files modified
app/views/databinding.js (+5/-0)
app/views/inspector.js (+34/-26)
test/test_inspector_constraints.js (+24/-0)
To merge this branch: bzr merge lp://staging/~gary/juju-gui/fixSuccessiveConflicts
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+185100@code.staging.launchpad.net

Description of the change

fix successive conflict UX calls

if you set a model value and then set a new one, the newest one will be lost. This branch fixes that problem, and adds a test for simpler conflict UX.

https://codereview.appspot.com/13663043/

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

Reviewers: mp+185100_code.launchpad.net,

Message:
Please take a look.

Description:
fix successive conflict UX calls

if you set a model value and then set a new one, the newest one will be
lost. This branch fixes that problem, and adds a test for simpler
conflict UX.

https://code.launchpad.net/~gary/juju-gui/fixSuccessiveConflicts/+merge/185100

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/13663043/

Affected files (+65, -26 lines):
   A [revision details]
   M app/views/databinding.js
   M app/views/inspector.js
   M test/test_inspector_constraints.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_constraints.js
=== modified file 'test/test_inspector_constraints.js'
--- test/test_inspector_constraints.js 2013-09-11 00:22:45 +0000
+++ test/test_inspector_constraints.js 2013-09-11 15:40:06 +0000
@@ -247,4 +247,28 @@
      assert.isTrue(controls.hasClass('closed'));
    });

+ it('handles conflicts correctly', function() {
+ var viewlet = getViewlet(inspector);
+ changeForm(viewlet, 'arch', 'i386');
+ inspector.model.set('constraints', {arch: 'lcars'});
+ var node =
viewlet.container.one('input[data-bind="constraints.arch"]');
+ node.simulate('click');
+ var wrapper = node.ancestor('.settings-wrapper');
+ var option = wrapper.one('.resolver .config-field');
+ assert.equal(option.getHTML(), 'lcars');
+ });
+
+ it('handles successive conflicts correctly', function() {
+ var viewlet = getViewlet(inspector);
+ changeForm(viewlet, 'arch', 'i386');
+ inspector.model.set('constraints', {arch: 'lcars'});
+ // This is the successive change.
+ inspector.model.set('constraints', {arch: 'arm64'});
+ var node =
viewlet.container.one('input[data-bind="constraints.arch"]');
+ node.simulate('click');
+ var wrapper = node.ancestor('.settings-wrapper');
+ var option = wrapper.one('.resolver .config-field');
+ assert.equal(option.getHTML(), 'arm64');
+ });
+
  });

Index: app/views/databinding.js
=== modified file 'app/views/databinding.js'
--- app/views/databinding.js 2013-09-11 14:22:16 +0000
+++ app/views/databinding.js 2013-09-11 15:34:27 +0000
@@ -300,6 +300,8 @@

         * name: A string that is the binding name. It references a
(possibly
                 nested) attribute of the associated viewlet's model.
+ * annotations: A hash on which viewlets can scribble whatever they
want
+ to.
         * viewlet: (optional) The viewlet that is matched with this binding.
         * target: (optional) Associated DOM node. If this exists, then it
is
                   unique: no other binding in this engine shares it.
@@ -350,6 +352,9 @@
        }

        binding.viewlet = viewlet;
+ if (binding.annotations === undefined) {
+ binding.annotations = {};
+ }
        this._bindings.push(binding);
...

Read more...

Revision history for this message
Richard Harding (rharding) wrote :

Per irc, tests pass in IE10. Will review as a follow up.

https://codereview.appspot.com/13663043/

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

*** Submitted:

fix successive conflict UX calls

if you set a model value and then set a new one, the newest one will be
lost. This branch fixes that problem, and adds a test for simpler
conflict UX.

R=rharding
CC=
https://codereview.appspot.com/13663043

https://codereview.appspot.com/13663043/

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