<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 20 June 2015 at 09:11, Thai Q Tran <span dir="ltr"><<a href="mailto:tqtran@us.ibm.com" target="_blank">tqtran@us.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font color="#990099" style="font-family:Verdana,Arial,Helvetica,sans-serif">-----Richard Jones <<a href="mailto:r1chardj0n3s@gmail.com" target="_blank">r1chardj0n3s@gmail.com</a>> wrote: -----</font><div style="font-family:Verdana,Arial,Helvetica,sans-serif;padding-left:5px"><div style="padding-right:0px;padding-left:5px;border-left-style:solid;border-left-color:black;border-left-width:2px">To: "OpenStack Development Mailing List (not for usage questions)" <<a href="mailto:openstack-dev@lists.openstack.org" target="_blank">openstack-dev@lists.openstack.org</a>><br>From: Richard Jones <<a href="mailto:r1chardj0n3s@gmail.com" target="_blank">r1chardj0n3s@gmail.com</a>><br>Date: 06/19/2015 03:49PM<br>Subject: [openstack-dev] Angular dependencies and the hz.dashboard namespace<div><div class="h5"><br><br><div dir="ltr">The "Adding Angular Identity Dashboard"[1] patch exposed an issue I saw previously that worried me[2].<div><br></div><div>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].</div><div><br></div><div>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).</div><div><br></div><div>To answer the question explicitly raised "<span style="font-size:13.1999998092651px;line-height:19.7999992370605px">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.</span></div><div><br><div><br></div><div>     Richard</div><div><br></div><div><div>[1] <a href="https://review.openstack.org/190852" rel="noreferrer" target="_blank" style="font-size:13.1999998092651px;line-height:19.7999992370605px">https://review.openstack.org/190852</a></div><div>[2] <a href="https://bugs.launchpad.net/horizon/+bug/1466713" target="_blank">https://bugs.launchpad.net/horizon/+bug/1466713</a></div>[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.<br><div>[4] <a href="https://review.openstack.org/#/c/193401/" target="_blank">https://review.openstack.org/#/c/193401/</a></div></div></div></div></div></div></div></div><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div style="font-family:Verdana,Arial,Helvetica,sans-serif"><span style="color:rgb(80,0,80)">[5] </span><a href="https://review.openstack.org/193671" rel="noreferrer" target="_blank" style="font-size:13.1999998092651px;line-height:19.7999992370605px">https://review.openstack.org/193671</a></div></font></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div style="font-family:Verdana,Arial,Helvetica,sans-serif">1. </div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Need to retain the same file structure so that pluggins continue to work. </div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Example: <a href="https://github.com/stackforge/monasca-ui/tree/master/monitoring" target="_blank">https://github.com/stackforge/monasca-ui/tree/master/monitoring</a></div><div style="font-family:Verdana,Arial,Helvetica,sans-serif"><br></div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Basically we have existing pluggins that use this file structure, we need to honor it.</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">This is not directly related to what we are talking about, but it does mean that we need to move static files out of </div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">/openstack_dashboard/static/MYDASHBOARD/* and into</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">/openstack_dashboard/dashboards/MYDASHBOARD/static/*</div></font></blockquote><div><br></div><div>Yep!</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Auto-discovery of static resources will need to also honor the pluggin model above, hence the file structure above.</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">You will still need to manually define the ADD_ANGULAR_MODULES in your enabled file, auto-discovery doesn't know what you want enabled.</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Sean's patch is going to do that, but having some issues with SCSS.</div><div><font face="Verdana, Arial, Helvetica, sans-serif"><a href="https://review.openstack.org/#/c/191592/" target="_blank">https://review.openstack.org/#/c/191592/</a></font></div></font></blockquote><div><br></div><div>As far as I can tell that patch doesn't alter the current <span style="font-family:Verdana,Arial,Helvetica,sans-serif">ADD_ANGULAR_MODULES behaviour?</span></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div><font face="Verdana, Arial, Helvetica, sans-serif"></font></div><div><span style="font-family:Verdana,Arial,Helvetica,sans-serif">hz.dashboard module will be empty because the hz.dashboard.MYDASHBOARD module will live at the app level via</span><br></div><div><font face="Verdana, Arial, Helvetica, sans-serif">ADD_ANGULAR_MODULES. I would argue that it makes no sense to have an empty module, my preference is to just delete it.</font></div><div><font face="Verdana, Arial, Helvetica, sans-serif">Constants are globally available in the app, something I think actually should be avoided, not encouraged.</font></div></font></blockquote><div><br></div><div>OK, seems reasonable.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div><span style="font-family:Verdana,Arial,Helvetica,sans-serif">Having hz.dashboard.tech-debt and workflow in the enabled file is not correct.</span><br></div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">They are core components needed by all dashboards and should be loaded by default, not via the pluggin mechanism.</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif"><a href="https://review.openstack.org/#/c/193401/4/openstack_dashboard/enabled/_10_project.py" target="_blank">https://review.openstack.org/#/c/193401/4/openstack_dashboard/enabled/_10_project.py</a></div><div style="font-family:Verdana,Arial,Helvetica,sans-serif"><br></div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Lets say I have my own dashboard call MYDASHBOARD, and I decided to disable all other dashboards except mine,</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">all of a sudden, things will break horribly because tech-debt and workflow are not loaded. I would have to either:</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">a. load the _10_project enabled file</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">b. copy/paste over the dependencies from _10_project</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif"><br></div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Furthermore, if I have hz.dashboard module, where do I load that, in _10_project or _x_MYDASHBOARD?</div><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Same issue when I disable entire dashboards.</div></font></blockquote><div><br></div><div>I completely agree!</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div style="font-family:Verdana,Arial,Helvetica,sans-serif">Tyr's patch will address this problem by having a core module.<br></div><div><font face="Verdana, Arial, Helvetica, sans-serif"><a href="https://review.openstack.org/#/c/193681/" target="_blank">https://review.openstack.org/#/c/193681/</a></font></div></font></blockquote><div><br></div><div>Wow, that's a lot of shuffling of deckchairs! I agree with the approach, but it seems like the only thing we're going to get done in Liberty is move a bunch of files around :/</div><div><br></div><div><br></div><div>      Richard</div><div><br></div></div></div></div>