[openstack-dev] [Horizon] Routing in Horizon

Rajat Vig rajatv at thoughtworks.com
Thu Jan 7 08:53:55 UTC 2016

Hi Everyone

One of my recent patches which enabled HTML5 based routing via Angular
merged, some interesting things spun out.
I'd to scramble a few patches to get things
​​ back the same way
for all new Angular Panels.

I also realized that getting Horizon to an SPA with Angular requires more
thought than mere fixing the current burning issue.
This mail's intent is to spur a direction on how we do routing in Angular
and how do Angular Panels go back/forth between themselves and older Django

The patch https://review.openstack.org/#/c/173885/ is possibly the first of
many to use Angular based routing.
It currently uses ngRoute as the library was included in the
xstatic-angular package.

What I'm roughly thinking to solve some of the immediate issues (there's
possbily much more that I'm not)

1. If we are going to go with the SPA route, then all Panels need to
indicate that they are Angular based.
For panels that are Angular, they need to declare routes they'd like to

2. All tags on Angular Panels (including header, sidebar, footer) which
don't route to Angular Panels will need the attribute target="_self" else
Angular will not allow navigation to those links.

All sidebar links currently have the attribute set but headers and footers
Sidebar links for Angular shouldn't have the attribute else SPA like
behavior will not happen.
This will need to be documen

3. That implies yet another problem with the Spinner Modal which gets
activated on all sidebar clicks.
It'll need to be done differently for Angular routing vs hrefs still with
The current spinner relies on a browser page refresh to disappear.

Then there's ngRoute.
Routing needs in Angular may need to handle route conflicts and maybe
nested routes.
There are other, possibly better options that we could consider
1. https://github.com/angular-ui/ui-router
2. https://angular.github.io/router/

I've been part of the community for not long enough yet and I'm not yet
completely aware of what exists outside the Horizon codebase so I might be
missing somethings as well.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160107/681d0194/attachment.html>

More information about the OpenStack-dev mailing list