Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12981)

Issue 11013043: View slots implementation

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by bcsaller
Modified:
10 years, 9 months ago
Reviewers:
mp+173604, jeff.pihach, benji, gary.poster
Visibility:
Public.

Description

View slots implementation Viewlet Container can define slots, a mapping of logical slot name to CSS selector within the ViewletContainer DOM. Viewlets can define slot, the logical name within the container to fill. showViewlet takes an optional model when showing a viewlet with a slot. This will remove any old bindings associated with the viewlet and bind in the new model. https://code.launchpad.net/~bcsaller/juju-gui/viewlet-slots/+merge/173604 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 26

Patch Set 2 : View slots implementation #

Total comments: 37

Patch Set 3 : View slots implementation #

Patch Set 4 : View slots implementation #

Patch Set 5 : View slots implementation #

Total comments: 19

Patch Set 6 : View slots implementation #

Unified diffs Side-by-side diffs Delta from patch set Stats (+298 lines, -74 lines) Patch
A [revision details] View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M app/templates/view-container.handlebars View 1 chunk +1 line, -0 lines 0 comments Download
M app/views/databinding.js View 1 2 3 4 5 8 chunks +96 lines, -25 lines 0 comments Download
M app/views/service.js View 1 2 3 chunks +2 lines, -9 lines 0 comments Download
M app/views/view-container.js View 1 2 3 4 5 11 chunks +106 lines, -17 lines 0 comments Download
M test/test_databinding.js View 1 2 11 chunks +16 lines, -12 lines 0 comments Download
M test/test_view_container.js View 1 2 3 4 5 5 chunks +75 lines, -11 lines 0 comments Download

Messages

Total messages: 16
bcsaller
Please take a look.
10 years, 9 months ago (2013-07-08 21:33:39 UTC) #1
jeff.pihach
This is looking really good thanks for putting in the time! I feel that any ...
10 years, 9 months ago (2013-07-08 22:46:57 UTC) #2
benjamin.saller
Thanks for the review, pushing changes next. https://codereview.appspot.com/11013043/diff/1/app/views/databinding.js File app/views/databinding.js (right): https://codereview.appspot.com/11013043/diff/1/app/views/databinding.js#newcode226 app/views/databinding.js:226: viewlet._events = ...
10 years, 9 months ago (2013-07-08 23:32:35 UTC) #3
bcsaller
Please take a look.
10 years, 9 months ago (2013-07-08 23:34:47 UTC) #4
gary.poster
THIS IS NOT A FULL REVIEW. PLEASE, SOMEONE ELSE, REVIEW THIS BRANCH. Hi Ben. This ...
10 years, 9 months ago (2013-07-09 01:57:07 UTC) #5
bac
Hi Ben, I like the work you've done but agree with the suggestions Gary has ...
10 years, 9 months ago (2013-07-09 12:58:56 UTC) #6
benjamin.saller
Thanks for review, I did rename a number of methods hoping to make things a ...
10 years, 9 months ago (2013-07-09 16:31:14 UTC) #7
bcsaller
Please take a look.
10 years, 9 months ago (2013-07-09 16:33:02 UTC) #8
bcsaller
Please take a look.
10 years, 9 months ago (2013-07-09 17:35:20 UTC) #9
bcsaller
Please take a look.
10 years, 9 months ago (2013-07-09 19:15:16 UTC) #10
jeff.pihach
Thanks for the great work! LGTM So many fixes in here but they were worth ...
10 years, 9 months ago (2013-07-09 19:32:35 UTC) #11
benji
LGTM. I had a few comments for your consideration. https://codereview.appspot.com/11013043/diff/24001/app/views/databinding.js File app/views/databinding.js (right): https://codereview.appspot.com/11013043/diff/24001/app/views/databinding.js#newcode360 app/views/databinding.js:360: ...
10 years, 9 months ago (2013-07-09 19:56:23 UTC) #12
benjamin.saller
Thanks for the reviews, make changes and card as needed. Submitting in a sec. https://codereview.appspot.com/11013043/diff/24001/app/views/databinding.js ...
10 years, 9 months ago (2013-07-09 20:20:21 UTC) #13
benji
Good stuff. https://codereview.appspot.com/11013043/diff/24001/app/views/view-container.js File app/views/view-container.js (right): https://codereview.appspot.com/11013043/diff/24001/app/views/view-container.js#newcode315 app/views/view-container.js:315: @param {Model} to bind to the slot. ...
10 years, 9 months ago (2013-07-09 20:34:03 UTC) #14
bcsaller
*** Submitted: View slots implementation Viewlet Container can define slots, a mapping of logical slot ...
10 years, 9 months ago (2013-07-09 20:38:08 UTC) #15
gary.poster
10 years, 9 months ago (2013-07-10 12:39:06 UTC) #16
On 07/09/2013 12:31 PM, benjamin.saller@canonical.com wrote:
...
>
https://codereview.appspot.com/11013043/diff/7001/app/views/databinding.js#ne...
> 
> app/views/databinding.js:192: var modelEvents = this.unbindModel(model);
> On 2013/07/09 01:57:07, gary.poster wrote:
>> On first reading, my reaction is to wonder why we unbind the model as
> soon as we
>> are asked to bind with it, and then to wonder why mutating the result
> of the
>> call (in the "push" line below) is useful.  Maybe it will make more
> sense as I
>> read more, but at first glance I don't like the way it reads.  At the
> very least
>> this needs some nice comments.  Perhaps it also needs some renaming,
> or
>> refactoring?  Hopefully I'll have a more fully-formed opinion after I
> read more.
> 
> I now call these methods resetModelChangeEvents and
> resetViewletDOMEvents, hope that helps. It is a bit odd perhaps that I
> return the list which can be appended to rather than resort to another
> lookup in the calling function. If that bothers you I can change it, but
> I don't think its that complex given the better naming.

I agree that the better naming resolves my concerns.  I still prefer the
other approach, but perhaps that preference approaches bikeshed painting.

>
https://codereview.appspot.com/11013043/diff/7001/app/views/databinding.js#ne...
> 
> app/views/databinding.js:225: if (viewlet.rebind) {
> On 2013/07/09 01:57:07, gary.poster wrote:
>> I still don't like this method name.  I think something explicit would
> be much
>> better, such as getBindModel or getTarget or findModel or
> findBindModel or
>> findTarget...
> 
> selectBindModel(model) -> model now, better?

Yes, better than all of my suggestions, thanks.

>
https://codereview.appspot.com/11013043/diff/7001/app/views/databinding.js#ne...
> 
> app/views/databinding.js:229: // When rebind doesn't return a valid
> target, skip the binding.
> On 2013/07/09 01:57:07, gary.poster wrote:
>> I guess this is a feature we need.  I can't help but wonder if we
> ought to write
>> something to the console in case this was unintentional, or make using
> this
>> feature more explicit (catching a specific error, for instance).  At
> the least,
>> if the comment is accurate, the conditional should go within the
> previous block;
>> and if it is not, the comment should be corrected.
> 
> This occurs in tests where service models might not have a units
> lazymodellist. I don't think we want console warning in those cases and
> we don't want to have to construct more state to test these things but
> if this still bugs you we can refactor some tests down the road.

Cool, fine with that.

>
https://codereview.appspot.com/11013043/diff/7001/app/views/databinding.js#ne...
> 
> app/views/databinding.js:362: var mID = model.get('id');
> On 2013/07/09 01:57:07, gary.poster wrote:
>> I worry about our need for POJO support.  It's coming in the unit
> view, yeah?
>> Because that information can change dynamically.  And then we have a
> bit of
>> thinking to do?
> 
>> That's an aside: I don't expect this branch to make the necessary
> changes here
>> or elsewhere.
> 
> I'd add an identity callback returning the id if/when we actually need
> this.

Right, with custom id code, I assume.

Thanks, Ben.

Gary
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b