[openstack-dev] Angular dependencies and the hz.dashboard namespace

Richard Jones r1chardj0n3s at gmail.com
Fri Jun 19 22:41:55 UTC 2015

The "Adding Angular Identity Dashboard"[1] patch exposed an issue I saw
previously that worried me[2].

I believe during recent Horizon work the concept of angular module
namespaces and dependencies have been conflated. There's this idea that if
you create a submodule inside a module namespace you *must* have that
module depend on that submodule. I believe that is incorrect - just look at
the angular codebase itself, and how it is used. If you want the ngCookies
module in a couple of places then you have those modules depend on
ngCookies (or, more likely, you just add it as a dependency to the app).
The point is it's not just added automatically to the "ng" module as a
dependency. If you need to use a module's functionality, you depend on the
module. You don't just have all your modules *automatically* pulled in as
dependencies. I have proposed a patch to remedy this for the existing
"optional"[3] project dashboard[4].

I believe it is unnecessary to add extension of the hz.dashboard dependency
list[5] since we already have an extensible dependency list for the
application itself (which the hz.dashboard dependency list just extends).

To answer the question explicitly raised "what is the point of having the
hz.dashboard module if it has no dependencies?" It does two things: it
defines the namespace in a formal manner (by itself unnecessary, but it's
still nice to do) and it defines a constant which is used by other code.
Eventually it may define more. There is an important difference between
Python modules and Angular modules here - using a Python module like
hz.dashboard in this way could cause problems because of the way Python
sub-module namespaces and import ordering work. Angular's modules work very
differently, and are not burdened by the same issues. In Python that
constant would most likely have to be pushed out to a sub-module to avoid
import loops.


[1] https://review.openstack.org/190852
[2] https://bugs.launchpad.net/horizon/+bug/1466713
[3] There may be other issues that prevent the project dashboard being
optional - there are dependencies in Python-land from the admin dashboard
hard-coded over to the project dashboard, for example. It might be a good
idea to remedy that, since I think it probably exposes some other
structural issues in the plugin mechanism we're providing to deployers.
[4] https://review.openstack.org/#/c/193401/
[5] https://review.openstack.org/193671
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150619/d8f04079/attachment.html>

More information about the OpenStack-dev mailing list