Angular actions not evaluated properly when dependent on row update.

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

Bug Description

See: https://review.openstack.org/#/c/219925/6

Copying my comments from there:

Ok, I've verified this as well and looked at a little bit of the code, but this problem is NOT a problem specific to this patch. This patch works the same as the images table launch instance.

It appears to actually be a problem with how angular is being handled when rows are added to the table via the create action when the row goes through a row update via XHR. The link is not getting evaluated by angular after a create and therefore is never getting into scope. This means the ng-click is not actually have any affect.

You can tell by seeing that ng-scope is not added as a class by angular after create (right click on action and do inspect element). However, if you do a full page refresh after create (with browser refresh, coming back to the page, or clicking the volumes menu item), the action works and that is because it has been evaluated by angular and has a scope (it has an ng-scope class).

You can actually see the same behavior with the images table depending on how you choose to create the image.

Note that the images table is directly in the index and not nested underneath tabs like the volumes table, but that seems like a red herring.

On the images table, if you put in a link to an image URL and uncheck the box to copy data, you'll see that the launch instance link works (it has angular scope). In the background, only a DOCUMENT GET for the full page is issued. If, however, you checkbox the link to copy data, you see that the link does NOT work (no angular scope) and you can also observe that after the Document request for the full page is sent, an XHR request is set for row_update.

(e.g. https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/The_OpenStack_logo.svg/2000px-The_OpenStack_logo.svg.png)

I think we need a separate bug and patch for handling the row update case, because that could be tracked and backported independently.

Changed in horizon:
importance: Undecided → High
milestone: none → mitaka-rc1
status: New → Confirmed
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

I've noticed another problem that might be related to this one: when I delete a volume, and then press 'Create Volume' immediately after the row has disappeared from the table, it does nothing. Again, I have to reload the page. And once I reload it, I get as many 'Error: Unable to retrieve volume details.' as I clicked the button before.

Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Bug 1553314 has been filed for the above comment.

Timur Sufiev (tsufiev-x)
Changed in horizon:
assignee: nobody → Timur Sufiev (tsufiev-x)
Revision history for this message
Matt Borland (palecrow) wrote :

Tyr, Travis, and I have been doing some work in some patches that adds promises to Actions, which we think is a deficiency. This could help fix the problem, so perhaps we can put up a patch that:

1) Has the actions return Promises from their perform() function.

2) Modifies the actions/etc. directives to allow controllers to establish a handles for action completion.

3) Add the handler for that action completion to the Image controller.

Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Matt, Tyr, feel free to take it.

Changed in horizon:
assignee: Timur Sufiev (tsufiev-x) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/290800

Changed in horizon:
assignee: nobody → Tyr Johanson (tyr-6)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/290800
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=05b53f7d60c2e9e0c7538348656442a89a03d3fd
Submitter: Jenkins
Branch: master

commit 05b53f7d60c2e9e0c7538348656442a89a03d3fd
Author: Tyr Johanson <email address hidden>
Date: Wed Mar 9 12:22:44 2016 -0700

    Images Actions Return Promises

    The Angular images actions now consistently return a promise. This allows
    a view to fetch an image related action from the registry, call it, and
    have a consistent way to know that it is complete.

    For actions, promises are preferred over events because they require
    less setup and teardown, better handle the asynchronous nature of
    modals, don't require a parent-child scope relationship and finally
    allow for success/fail handler chaining.

    Future patches may add data to the promise so that the view can know
    which items were affected by the action.

    This patch simply returns promises from actions as this is
    a pattern I'd like to establish for Mitaka. Usage of these promises is
    left to a follow-on patch. Also, removing the event mechanism from actions
    is left to a follow-on patch.

    Change-Id: I78d189d6eb026bd98abba6451641010104fc5002
    Partially-Implements: blueprint angularize-images-table
    Closes-Bug: 1555929
    Partial-Bug: 1514627

David Lyle (david-lyle)
Changed in horizon:
importance: High → Medium
importance: Medium → High
assignee: Tyr Johanson (tyr-6) → nobody
status: In Progress → Confirmed
Changed in horizon:
assignee: nobody → Timur Sufiev (tsufiev-x)
status: Confirmed → In Progress
Changed in horizon:
assignee: Timur Sufiev (tsufiev-x) → Matt Borland (palecrow)
Timur Sufiev (tsufiev-x)
Changed in horizon:
assignee: Matt Borland (palecrow) → Timur Sufiev (tsufiev-x)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/289849
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=2de6baae34f13ae1e0e3e70e2f08eceae346cfcc
Submitter: Jenkins
Branch: master

commit 2de6baae34f13ae1e0e3e70e2f08eceae346cfcc
Author: Timur Sufiev <email address hidden>
Date: Tue Mar 8 13:32:22 2016 +0300

    Fix non-working Angular actions in jquery modified tables

    Fix the issue by re-$compile-ing the content dynamically inserted by
    jQuery. Ideally we should solve it by replacing jQuery insert with
    Angular one. This remains a TODO for Newton release.

    Closes-Bug: #1514627
    Co-Authored-By: Matt Borland <email address hidden>
    Change-Id: Ifbe063e9dd6c20930a1ed4fa14dddb2d0f762902

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/horizon 9.0.0.0rc1

This issue was fixed in the openstack/horizon 9.0.0.0rc1 release candidate.

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.