move set_id_as_name_if_empty to the api side for rule_list, fwaas_list and policy_list

Bug #1370986 reported by Liyingjun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Liyingjun
Liyingjun (liyingjun)
Changed in horizon:
assignee: nobody → Liyingjun (liyingjun)
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/122372

Changed in horizon:
status: New → In Progress
Revision history for this message
Akihiro Motoki (amotoki) wrote :

It is not limited to FWaaS panel. It is used in all of Neutron related panels.
I strongly suggest to clean up all of them.

In addition, simply moving set_id_as_name_if_empty() to the API layer is not a good idea and troublesome. This method actually changes the attribute "name" directly and this kind of decision should be delegated to the view layer (and the API layer should not change it implicitly). Assume a case of the detail page, If "name" is an empty, "name" should be displayed as an empty string rather than "(shortened UUID)". If the API layer does this, there is no way that the view layer controls it. This is the reason that set_id_as_name_if_empty() is called in the panel side.

My suggestion is to add name_or_id property to each firewall/policy/rule class and change the view layer (tables.py or related) to use name_or_id instead of "name". api.neutron.NeutronAPIDictWrapper already has "name_or_id" property, so what we need to do is to switch from set_id_as_name_if_empty to name_or_id.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

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

commit 403b81db29aa7e6ac64f446cccce0030f1937a9b
Author: liyingjun <email address hidden>
Date: Thu Sep 18 16:54:30 2014 +0800

    Replace set_id_as_name_if_empty with name_or_id

    we can replace set_id_as_name_if_empty with name_or_id in
    in all neutron related place to reduce a extra loop call
    since set_id_as_name_if_empty is called every after *_list.

    Change-Id: I341adb3a581337790e22e049e5b72df11b462b44
    Closes-bug: #1370986

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: kilo-2 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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