[openstack-dev] [Horizon] naming of Javascript bits
Rajat Vig
rajatv at thoughtworks.com
Thu Jan 7 07:52:30 UTC 2016
Richard
My preference is the same as what you've got there.
Fully namespaced Services and Controller allow for better reusability and
possibly maintainability.
If all "deleteService" were named just that, it'll be mighty confusing to
use it in other places.
With regards to tying the folder path and the Service/Controller I'd mostly
go with that as that encourages simpler rules on how to namespace.
For the particular patch you mentioned, the namespaces had a bit of churn
which is sort of reflected in what exists in the patch now.
If we decide a convention, then we can go and change the bits when the
files change next.
-Rajat
On Wed, Jan 6, 2016 at 10:30 PM Richard Jones <r1chardj0n3s at gmail.com>
wrote:
> Hi Horizon folks,
>
> We've been pretty good about namespacing the new angular code (to the
> extreme of having a bunch of very similar module files littered around, but
> that's angular/JS for you, so I'm not going to go on about it <wink>).
>
> Anyhoo. One thing I've noticed is that the services, factories and
> controllers inside those modules aren't being consistently named. We have
> got a mix of:
>
> Launch Instance:
>
> .module('horizon.dashboard.project.workflow.launch-instance')
> .factory('launchInstanceModel', launchInstanceModel);
>
> The new Images panel:
>
> .module('horizon.app.core.images')
> .factory('horizon.app.core.images.row-actions.service', rowActions);
>
> and in the same patch:
>
> .module('horizon.app.core.images')
> .factory('horizon.app.core.images.actions.deleteService', deleteService);
>
> I actually prefer the second form because it matches the filename
> ("row-actions.service.js") even though the module namespace doesn't match
> the file path ("/static/app/core/images/table/").
>
> Your thoughts?
>
>
> Richard
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160107/7074a866/attachment.html>
More information about the OpenStack-dev
mailing list