In the access and security tab, for adding new rules, required port field is not marked with an asterisk

Bug #1292165 reported by mariam john on 2014-03-13
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Low
Akihiro Motoki

Bug Description

To recreate this, follow the link: Projects -> Access and Security -> Edit Rules (on any security group that has been created). The Port field is a required field but doesnt contain the asterisk symbol. I have attached a screen shot. Thank you.

mariam john (mariamj) wrote :
Changed in horizon:
assignee: nobody → Cristian Fiorentino (cristian-fiorentino)
David Lyle (david-lyle) on 2014-03-14
Changed in horizon:
status: New → Confirmed
importance: Undecided → Low

Having analyzed the issue, the problem is a little more complex and impacts not only the "Port" field but others in this form and in other Horizon forms.
Taking into account the Edit/Add Rules form, if 'Port Range' is selected in "Open Port" choice (instead of 'Port'), the missing asterisk is still missing in "From Port" and "To Port" fields.

Asterisks are painted making use of the CSS class for fields set as "required", as described in:
https://review.openstack.org/#/c/44091/

Setting the fields as "required" in this case is not straightforward, given that some logic is required: if 'Port' is selected in "Open Port" choice only the "Port" field needs to be selected as "required"; on the other hand if 'Port Range' is selected "From Port" and "To Port" fields need to be set as required, but not the "Port" field.

But the previous fields switching is implemented in Horizon using the swithchable-fields approach as described in the following link, and as I could see this aproach may only manage hiding/unhiding the fields: http://docs.openstack.org/developer/horizon/ref/forms.html#switchable-fields.

Besides the missing asterisk, required fields are properly validated using the Django "cleaning" mechanism, but this mechanism is activated once the Form is submitted (in this case after "Add" button is pressed): https://docs.djangoproject.com/en/dev/ref/forms/validation/

I have tried an approach to fix this managing self.fields['field_name'] in the __init__ function, but this is probably a hack and would replicate some behavior already implemented in the "Cleaning" mechanism.

I would appreciate any comments on the recommended approach for handling this case, as it seems deeper modification should be applied here (i.e. to modify the swithchable-fields approach for switching among required fields). Thanks.

Facundo Farias (facundo-farias) wrote :

I did solve some similar issue here, take a look: https://review.openstack.org/#/c/79430/
It is a bit of hacking, but as you described before I couldn't find another way to do it.

Thanks much for the comments Facundo.
Your proposal seems like a possible solution, but for this particular bug tests get broken following a similar approach.

Changed in horizon:
assignee: Cristian Fiorentino (cristian-fiorentino) → nobody
mariam john (mariamj) on 2014-07-13
Changed in horizon:
assignee: nobody → mariam john (mariamj)
Changed in horizon:
assignee: mariam john (mariamj) → Swati Shukla (swati-shukla1)
status: Confirmed → In Progress
summary: - In the access and security tab, for adding new rules, reuired port field
- is not marked with an asterisk
+ In the access and security tab, for adding new rules, required port
+ field is not marked with an asterisk
Changed in horizon:
milestone: none → kilo-rc1
David Lyle (david-lyle) on 2015-03-25
Changed in horizon:
milestone: kilo-rc1 → liberty-1
milestone: liberty-1 → next
vaibhav (vaibhav-j10) on 2015-07-28
Changed in horizon:
assignee: Swati Sharma (swati-shukla1) → vaibhav (vaibhav-j10)

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

vaibhav (vaibhav-j10) on 2015-08-26
Changed in horizon:
assignee: vaibhav (vaibhav-j10) → nobody
vaibhav (vaibhav-j10) on 2015-09-02
Changed in horizon:
assignee: nobody → vaibhav (vaibhav-j10)

Change abandoned by David Lyle (<email address hidden>) on branch: master
Review: https://review.openstack.org/207357
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Change abandoned by David Lyle (<email address hidden>) on branch: master
Review: https://review.openstack.org/133391
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

srikanth (k1039485) on 2016-09-09
Changed in horizon:
assignee: vaibhav (vaibhav-j10) → srikanth (k1039485)
srikanth (k1039485) on 2017-01-04
Changed in horizon:
assignee: srikanth (k1039485) → nobody
Ivan Kolodyazhny (e0ne) wrote :

We have to check if it's still actual.

Changed in horizon:
status: In Progress → New

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

Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: New → In Progress

Reviewed: https://review.openstack.org/555096
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=f8196331ea139f52b303eb87d0280152f06d9475
Submitter: Zuul
Branch: master

commit f8196331ea139f52b303eb87d0280152f06d9475
Author: Akihiro Motoki <email address hidden>
Date: Thu Mar 22 08:32:00 2018 +0900

    Add asterisk to conditionally required fields

    https://review.openstack.org/#/c/552247/ introduced a way to
    add asterisk mark to conditionally required fields.

    This commit covers several known forms:
    - Create Network / Create Subnet
    - Create Port
    - Attach Interface to Instance
    - Add Security Group Rule

    Change-Id: I809c23fd64dc2f379c3fdb585741c6b266ec5b1b
    Closes-Bug: #1420370
    Closes-Bug: #1292165
    Closes-Bug: #1755131

Changed in horizon:
status: In Progress → Fix Released

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

Akihiro Motoki (amotoki) on 2018-04-27
Changed in horizon:
milestone: next → rocky-1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers