I think this is exactly on the right path. I'd tweak a few things. I
think the View can be a bit simpler by dealing with a single ATTR for a
model instance or a token id and that logic should be pushed to the
store. That way all those decisions are made there.
We can chat about details later but looks good and thanks for working on
getting this into play.
https://codereview.appspot.com/14153043/diff/4001/app/store/charmworld.js#newcode242
app/store/charmworld.js:242: bundle: function(bundleID, callbacks,
bindScope) {
if you compare this to the charm call, there's some work we could do
here around the caching. We should add support for caching details as we
do in the charms so that subsequent calls will be instantly available.
The cache is maintained by the store instance I think as I know it's
shared around both Browser and main app code.
Or even adding a thing to the model to have a type.
this.call('_render' + token.type + 'View') or something.
https://codereview.appspot.com/14153043/diff/4001/app/subapps/browser/views/charm.js#newcode793
app/subapps/browser/views/charm.js:793: if (charmID.indexOf('bundle')
=== -1) {
I feel like this check should be in the store vs here in the view. Maybe
the cleanest thing is to combine .charm/.bundle into a method where you
pass an id and the store does the logic. Checking for 'bundle' in the id
seems to be an implementation detail of the store and not something I'd
have Views worry about.
I think this is exactly on the right path. I'd tweak a few things. I
think the View can be a bit simpler by dealing with a single ATTR for a
model instance or a token id and that logic should be pushed to the
store. That way all those decisions are made there.
We can chat about details later but looks good and thanks for working on
getting this into play.
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js charmworld. js (right):
File app/store/
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js#newcode34 charmworld. js:34: juju.charmworld = ns;
app/store/
ns is already defined? why do we need juju.charmworld
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js#newcode234 charmworld. js:234: Public method to make an API call to fetch
app/store/
a bundle from Charmworld.
don't need "Public method" we already can tell that.
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js#newcode242 charmworld. js:242: bundle: function(bundleID, callbacks,
app/store/
bindScope) {
if you compare this to the charm call, there's some work we could do
here around the caching. We should add support for caching details as we
do in the charms so that subsequent calls will be instantly available.
The cache is maintained by the store instance I think as I know it's
shared around both Browser and main app code.
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js#newcode247 charmworld. js:247: API call to fetch a charm's details.
app/store/
bundle's details.
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js#newcode273 charmworld. js:273: promiseCharm: function(charmId, cache,
app/store/
defaultSeries) {
should we have a promiseBundle? This came after the original charm call
and maybe working with a promise from the start would be nice here?
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js#newcode383 charmworld. js:383: iconpath: function(charmID) {
app/store/
did you verify this works for bundle ids?
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js#newcode415 charmworld. js:415: buildCategoryIc onPath: function( categoryID)
app/store/
{
any calls to this are hints that we need to look for the later check for
using the default charm icon and add a check for default bundle icon.
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/store/ charmworld. js#newcode509 charmworld. js:509: related: function(charmID, callbacks,
app/store/
bindScope) {
we'll need a bundle related method as well. Per the call with Gary
today, related bundles are lists of other bundles in the same basket as
the current one.
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/subapps/ browser/ browser. js browser/ browser. js (right):
File app/subapps/
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/subapps/ browser/ browser. js#newcode924 browser/ browser. js:924: if (idBits.length > 1) {
app/subapps/
I'm assuming existing tests pass with this change?
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/subapps/ browser/ views/charm. js browser/ views/charm. js (right):
File app/subapps/
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/subapps/ browser/ views/charm. js#newcode36 browser/ views/charm. js:36: ns.BrowserCharmView = create( 'browser- view-charmview' , Y.View, [
app/subapps/
Y.Base.
I'd change this to BrowserTokenView
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/subapps/ browser/ views/charm. js#newcode762 browser/ views/charm. js:762: _renderBundleView:
app/subapps/
function(bundle) {
this seems to be missing a bunch of shared logic with _renderCharmView.
The check for use in the inspector, are there any tabs? What about
sharing icon/setup?
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/subapps/ browser/ views/charm. js#newcode781 browser/ views/charm. js:781: charmID = this.get( 'charmID' ),
app/subapps/
so again, maybe the tokenID is the new thing?
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/subapps/ browser/ views/charm. js#newcode786 browser/ views/charm. js:786: if (this.get('charm')) {
app/subapps/
rather than having diff charm/bundle attrs what about var token =
this.get('token'); if (token.isCharm()) else if (token.isBundle()) ?
Or even adding a thing to the model to have a type.
this.call('_render' + token.type + 'View') or something.
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/subapps/ browser/ views/charm. js#newcode793 browser/ views/charm. js:793: if (charmID. indexOf( 'bundle' )
app/subapps/
=== -1) {
I feel like this check should be in the store vs here in the view. Maybe
the cleanest thing is to combine .charm/.bundle into a method where you
pass an id and the store does the logic. Checking for 'bundle' in the id
seems to be an implementation detail of the store and not something I'd
have Views worry about.
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/templates/ bundle. handlebars bundle. handlebars (right):
File app/templates/
https:/ /codereview. appspot. com/14153043/ diff/4001/ app/templates/ bundle. handlebars# newcode7 bundle. handlebars: 7: <img src="{{storeId}}" alt="{{ name
app/templates/
}} icon" class="icon">
this needs to exist for bundles. They'll have icons as well.
https:/ /codereview. appspot. com/14153043/