Modal upload forms with FileField revert to un-modal on validation error

Bug #1158501 reported by Steve Baker
38
This bug affects 7 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Timur Sufiev

Bug Description

Any modal form which contains a FileField will revert to being non-modal when the form is re-displayed for a validation error.

Currently this would affect the following forms:
Images and Snapshots -> Create Image
Containers -> Upload Object

This is happening because the ajax POST technique doesn't work for enctype="multipart/form-data" forms.

A short term workaround could be to start these forms as non-modal, even though this isn't consistent with the look of other forms, is less disconcerting than triggering this bug.

A long term fix would be to implement ajax uploading (google 'django ajax upload'), which may be worthy of a blueprint.

description: updated
Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

Agreed on the problem. The behavior was semi-intentional given the problem with multipart uploads you pointed out. Having a bug to remember this and to address it in the future is good, though.

Changed in horizon:
importance: Undecided → Low
milestone: none → havana-1
status: New → Confirmed
Changed in horizon:
milestone: havana-1 → havana-2
Revision history for this message
Ladislav Smola (lsmola) wrote :

The blueprints that should implement system for uploads already exists here:

https://blueprints.launchpad.net/horizon/+spec/file-upload-redux
https://blueprints.launchpad.net/horizon/+spec/multi-file-upload
https://blueprints.launchpad.net/horizon/+spec/swift-direct-upload

So this should be also connected to File Upload solution from the blueprints

Changed in horizon:
milestone: havana-2 → havana-3
summary: - Modal upload forms revert to un-modal on validation error
+ Modal upload forms with FileField revert to un-modal on validation error
Changed in horizon:
milestone: havana-3 → none
Revision history for this message
Prathyusha Vanka (prathyusha-vanka) wrote :

Presently there is a comment especially for "enctype"
" AJAX upload for files is not currently supported ".
Can we proceed to solve this bug?

Changed in horizon:
assignee: nobody → Prathyusha Vanka (prathyusha-vanka)
Revision history for this message
Cindy Lu (clu-m) wrote :

Another example of problem is seen on 'Launch Stack' modal. After you select a template and press "Next", it reverts to un-modal.

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

Prathyusha, do you mind if I take this bug?

David Lyle (david-lyle)
Changed in horizon:
assignee: Prathyusha Vanka (prathyusha-vanka) → Timur Sufiev (tsufiev-x)
David Lyle (david-lyle)
Changed in horizon:
milestone: none → juno-2
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/107769

Changed in horizon:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Timur Sufiev (<email address hidden>) on branch: master
Review: https://review.openstack.org/108402
Reason: Wrong change id

Changed in horizon:
milestone: juno-2 → juno-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

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

commit b88aaa16d3e718cfe5f0509c5a47c51887884f35
Author: Timur Sufiev <email address hidden>
Date: Mon Jul 21 19:13:15 2014 +0400

    Allow form to stay modal after uploading file

    Use HTML5 FormData browser API together with FileList API to make
    possible AJAX file uploads (see http://tinyurl.com/kmznw2n on FormData
    examples). Feature detection is the same as in jQuery Form Plugin (see
    http://tinyurl.com/n6v5dsx). Browsers without FormData support (most
    importantly, IE<10) do not support setting custom AJAX request
    headers, so form with File Upload field will lose modality in them
    anyway.

    Change-Id: Id3b91a49a71c6de314c6a7cbee5357fe13679490
    Closes-Bug: #1158501

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-3 → 2014.2
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