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>
            html

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 <https://github.com/angular-ui/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:

 $stateProvider
   .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

Status:
Started
Approver:
Rob Cresswell
Priority:
Medium
Drafter:
Richard Jones
Direction:
Approved
Assignee:
None
Definition:
Approved
Series goal:
Accepted for future
Implementation:
Needs Code Review
Milestone target:
milestone icon next
Started by
Richard Jones

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/swift-ui-functionality,n,z

Addressed by: https://review.openstack.org/350523 - Abandoned
    WIP: use ui-router for swift ui panel construction

Gerrit topic: https://review.openstack.org/#q,topic:bp/ui-router,n,z

Addressed by: https://review.openstack.org/347114 - Merged
    Migrate Swift to use ResourceType

Addressed by: https://review.openstack.org/348741 - 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.

Subscribers

No subscribers.