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

Issue 6749046: Separate environment and store charms

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 6 months ago by gary.poster
Modified:
11 years, 6 months ago
Reviewers:
mp+130464
Visibility:
Public.

Description

Separate environment and store charms On discussion with Kapil, a significant problem from a previous refactoring of mine became clear. Charm ids are only reliably unique within a given context, such as juju environment vs charm store. Therefore, charms from the two sources need to be stored separately. We discussed some approaches. He suggested storing environment charms in the database and store charms in the browser, and I liked that idea. He also requested that I factor out the charm model code into a separate file, even while keeping it in the juju.models package. Finally, he suggested that charm ids should always include revisions in order to guarantee uniqueness, and to make it possible to consider whether charms from the different sources are identical. I wrote a long explanation of this in the app/models/charms.js file, including additional considerations. The charm store needed to send the revision itself, which Kapil changed it to do. I ended up also factoring out a charm store object, with the ability to get the data from a search, organized as we like it; and to get the data for a specific charm. A nice fall out from the tests of this code is that it exposed some pre-existing problems with sorting code, which I addressed. The change is quite large because it touches so many of the files. On the bright side, many of the test changes are mechanical, and much of the code is moved and only slightly refactored and changed from other sources, so deletions and moves account for much of the churn. Kapil made some great changes to the charm store after reviewing this branch that will let us simplify this branch's code in a follow on. https://code.launchpad.net/~gary/juju-gui/charmdivision/+merge/130464 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 1

Patch Set 2 : Separate environment and store charms #

Unified diffs Side-by-side diffs Delta from patch set Stats (+891 lines, -402 lines) Patch
M .jshintrc View 1 chunk +1 line, -0 lines 0 comments Download
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M app/app.js View 3 chunks +6 lines, -5 lines 0 comments Download
A app/models/charm.js View 1 chunk +310 lines, -0 lines 0 comments Download
M app/models/models.js View 4 chunks +5 lines, -186 lines 0 comments Download
M app/modules.js View 1 chunk +6 lines, -1 line 0 comments Download
M app/store/charm.js View 1 chunk +119 lines, -6 lines 0 comments Download
M app/templates/charm-search-result.handlebars View 1 chunk +2 lines, -4 lines 0 comments Download
M app/views/charm.js View 3 chunks +7 lines, -2 lines 0 comments Download
M app/views/charm-search.js View 5 chunks +38 lines, -85 lines 0 comments Download
A test/data/search_results.json View 1 chunk +64 lines, -0 lines 0 comments Download
A test/data/series_search_results.json View 1 chunk +48 lines, -0 lines 0 comments Download
M test/index.html View 1 chunk +1 line, -0 lines 0 comments Download
M test/test_app.js View 3 chunks +10 lines, -10 lines 0 comments Download
M test/test_charm_configuration.js View 15 chunks +15 lines, -15 lines 0 comments Download
M test/test_charm_search.js View 11 chunks +17 lines, -12 lines 0 comments Download
A test/test_charm_store.js View 1 chunk +166 lines, -0 lines 0 comments Download
M test/test_charm_view.js View 3 chunks +15 lines, -8 lines 0 comments Download
M test/test_model.js View 8 chunks +55 lines, -64 lines 0 comments Download
M test/test_service_config_view.js View 2 chunks +2 lines, -2 lines 0 comments Download
M test/test_unit_view.js View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 4
gary.poster
Please take a look.
11 years, 6 months ago (2012-10-19 02:11:04 UTC) #1
hazmat
The branch looks good. I'm concerned a bit about the ambiguity and work we're carrying ...
11 years, 6 months ago (2012-10-19 19:02:34 UTC) #2
gary.poster
*** Submitted: Separate environment and store charms On discussion with Kapil, a significant problem from ...
11 years, 6 months ago (2012-10-20 14:49:27 UTC) #3
gary.poster
11 years, 6 months ago (2012-10-20 14:54:52 UTC) #4
On 2012/10/19 19:02:34, hazmat wrote:
> The branch looks good. I'm concerned a bit about the ambiguity and work we're
> carrying forward to support that. I've update the charm browser to always
return
> store_url as part of search results as an unambigious qualifier. results
without
> a store_url are filtered by the server. Also we can now retrieve charm details
> with a revision identifier (the backend doesn't do anything with this revision
> at the moment, but we can fix that on the backend later). I think that should
> make some of the bits here a bit simpler (baseId vs id).
> 
> Also with that i'd like to drop the extraneous information we're carrying in
the
> search results list. ie.. given
> 
>     {
>       "data_url": "/charms/precise/lamp/json", 
>       "name": "lamp", 
>       "store_url": "cs:precise/lamp-1", 
>       "series": "precise", 
>       "summary": "set up an apache server with php and supports a connection
to
> mysql", 
>       "relevance": 19.82845289740461, 
>       "owner": "charmers"
>     }, 
> 
> name/series/owner/data_url keys can all be obsoleted.

That all sounds great--except maybe data_url.  I think keeping that might be a
nice convenience.  But you're still right, even that is arguably duplicate--as
long as we keep the same URL patterns in the charm store.

> 
> https://codereview.appspot.com/6749046/diff/1/app/app.js
> File app/app.js (right):
> 
> https://codereview.appspot.com/6749046/diff/1/app/app.js#newcode617
> app/app.js:617: 'juju-charm-store']
> i think this can get rolled up into models in modules

The charm and charm list are part of models.  the charm store is not--it
represents interactions with the charm store and returns data, not models.  We
*could* collapse it with env if you wanted.  I didn't do it because I didn't see
a win or a real conceptual connection with the juju environment, but I wouldn't
object.

Thanks!

Gary
Sign in to reply to this message.

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