Add ui-router to Horizon

Registered by Richard Jones

Horizon currently uses ngRoute for angularjs routing. This has a limitation that it can only control a single ng-view at a time. It cannot control nested ng-views - that is:

 html <ng-view>
       html <ng-view>

This has become a burdensome restriction on the Swift UI where the design of the code is overly complex because of the lack of nesting. The top view (selected container) and the nested view (selected folder) must know about each other in complex ways in order to keep consistent. A single view might be used that simplified things, but would result in re-loading the container information on every folder path change.

The solution is to switch to ui-router <>, which is an add-on to angularjs. ui-router operates with two concepts: states and views. States represent a "place" in the application and are positioned in HTML using "<div ui-view></div>" which is filled in with state templates (which will typically have a controller associated with them). Those templates may have "<div ui-view></div>" within them, indicating where child states go with their own template and controller. So for example, in Swift UI, the states could look like:

   .state('containers', {
        url: "/containers",
        templateUrl: 'containers.html'
   .state('containers.container', {
        url: "/:container",
        templateUrl: 'container.html'
   .state('containers.container.objects', {
        url: "/*folder",
        templateUrl: 'objects.html'

Concrete steps to take:

0. bundle ui-router as an xstatic package for testing
1. create a Proof Of Concept patch using ui-router
2. assuming #1 is a success migrate Swift UI to use ui-router

Blueprint information

Rob Cresswell
Richard Jones
Series goal:
Accepted for future
Needs Code Review
Milestone target:
milestone icon next
Started by
Richard Jones

Related branches



Gerrit topic:,topic:bp/swift-ui-functionality,n,z

Addressed by: - Abandoned
    WIP: use ui-router for swift ui panel construction

Gerrit topic:,topic:bp/ui-router,n,z

Addressed by: - Merged
    Migrate Swift to use ResourceType

Addressed by: - Abandoned
    WIP: expose more of Swift to ResourceType

Questions in irc on if this provides ways to extend or change certain behaviors. It's not yet clear as to what this might make possible for extension points, but it is worth some thought / examination.


Work Items

This blueprint contains Public information 
Everyone can see this information.


No subscribers.