Angular controllers (routes being evaluated) on django navbar clicks (hash routing)

Bug #1543327 reported by Travis Tripp
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Wang Bo

Bug Description

While evaluating another patch, I found that if I'm on an angular page (ng-images) that whenever I click an accordion on the horizon navbar (e.g. start on Project --> Images, then click Admin) this is causing the current angular controller to refresh.

See picture, but note that I have paused the debugger in a Keystone API hit, that you can see the requests in the terminal window, and that in the URL you can see #sidebar-accordion-admin.

http://pasteboard.co/1pw530qO.png

Tags: angularjs
Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :

This actually appears to alter the URL on all pages, not just angular ones.

tags: added: angularjs
Changed in horizon:
status: New → Confirmed
status: Confirmed → New
Changed in horizon:
status: New → Confirmed
importance: Undecided → Low
milestone: none → next
Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :

Looking into this more, seems like it hits the APIs with a full reload every time.

Changed in horizon:
importance: Low → High
Revision history for this message
Richard Jones (r1chardj0n3s) wrote :

Rob, could you be clearer what you mean by a "full reload"? I'm not seeing that, I think.

I'm certainly not seeing what Travis described as "causing the current angular controller to refresh." When I'm on the Swift UI page, for example, and click out to Images, the Swift page does not refresh, we go to the Images page and it's loaded as per normal (I see an images load and a projects load, which I'd expect to see on a Django page load - definitely none of the Swift controller loading API hits).

Changed in horizon:
status: Confirmed → Incomplete
Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :

Try opening a panel group or dashboard, not a panel and watch the APIs on your swift endpoint. For me, it seemed to be causing a reload. This means that if someone is just looking for something, they'll be spamming the APIs.

Changed in horizon:
status: Incomplete → Confirmed
Revision history for this message
Richard Jones (r1chardj0n3s) wrote :

Ah, I see what you mean now.

Revision history for this message
Richard Jones (r1chardj0n3s) wrote :

I *think* the appropriate thing to do would be to have the sidebar call event.stopPropagation().

Revision history for this message
Wang Bo (chestack) wrote :

Run into the same issue.
Find that the url "project/ngimages/#sidebar-accordion-****" hits the route url[1] which resulted in reload. Should we use "data-target" instead of "href"?[2].
The patch is: https://review.openstack.org/#/c/317293/.

[1]https://github.com/openstack/horizon/blob/master/openstack_dashboard/static/app/core/images/images.module.js#L190.
[2]https://github.com/openstack/xstatic-bootstrap-scss/blob/master/xstatic/pkg/bootstrap_scss/data/js/bootstrap.js#L505

Changed in horizon:
assignee: nobody → Wang Bo (chestack)
status: Confirmed → In Progress
Changed in horizon:
milestone: next → newton-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/317293
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=18b351b9c47f180118b10dcf3229e6265c811493
Submitter: Jenkins
Branch: master

commit 18b351b9c47f180118b10dcf3229e6265c811493
Author: wangbo <wangbo_bupt@163.com>
Date: Tue May 17 15:12:40 2016 +0800

    Angular pages will reload if collapse/expand sidebar

    use ng-images as example to explan the issue:
    1.enable ng-images page and go into this page.
    2.click left sidebar to collapse/expand a dashboard or panel-group
    3.the url change to "project/ngimages/#sidebar-accordion-***" which
      match the route[1]. Current page will reload even it's not change.

    Use "data-target" instead of "href" to fix it. ref:[2]

    [1]https://github.com/openstack/horizon/blob/master/
    openstack_dashboard/static/app/core/images/images.module.js#L190
    [2]https://github.com/openstack/xstatic-bootstrap-scss/blob/
    master/xstatic/pkg/bootstrap_scss/data/js/bootstrap.js#L505

    Change-Id: I1c84c6af49a67bf2833ad5b0103f6cbd4abd0ddb
    Closes-Bug: #1543327

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/horizon 10.0.0.0b1

This issue was fixed in the openstack/horizon 10.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.