Revert fix from bug #1329050, which adds a plugin panel to its dashboard's
class. Adding a plugin panel to a dashboard whose class has its panels defined
in a tuple will fail because the new plugin cannot be appended to the tuple.
The code errors out before the panel gets added to the dashboard's panel list.
However, at this point, the panel has already been registered with the
dashboard. This causes Dashboard.get_panels() to see the panel in its registry
but not in its panel groups. Consequently, the panel gets put in the "Other"
panel group instead of its configured one, as described in bug #1378558.
By not adding the the plugin panel to its dashboard's class, the panel gets
added to its dashboard's panel list. Now the original issue from bug #1329050
resurfaces. The root cause of that is that every time Dashboard._autodiscover()
is called, it instantiates all its panel group classes, wiping out any panels
previously added to any of the panel groups. Avoid this by always processing
all the plugin panel groups before any of the plugin panels, which also ensures
that the panel groups exist before their panels.
Making this change exposed an issue where the Horizon URLs were being loaded
twice during the plugin infrastructure's unit tests, causing plugin panels to
be added multiple times to their dashboards. Fix that by removing the second,
unnecessary call. Also create a second test plugin panel group and panel to
test the scenarios described in the two bugs addressed here, adding two panel
groups at a time.
Change-Id: Id6a99c3ff18102c8f47431638d4dda98f14ec641
Closes-Bug: 1378558
(cherry picked from commit e2ef492311a427fe3b5b41a6df6bd9be5a22c174)
(cherry picked from commit 5c1604275bfbe621e5e168f8ba1f937d308d6ab8)
Reviewed: https:/ /review. openstack. org/192215 /git.openstack. org/cgit/ openstack/ horizon/ commit/ ?id=6b9f019959e 47221291ca1f472 3f389e6c6cda93
Committed: https:/
Submitter: Jenkins
Branch: stable/juno
commit 6b9f019959e4722 1291ca1f4723f38 9e6c6cda93
Author: Janet Yu <email address hidden>
Date: Fri Mar 13 13:50:42 2015 -0700
Fix addition of plugin panel to panel group
Revert fix from bug #1329050, which adds a plugin panel to its dashboard's get_panels( ) to see the panel in its registry
class. Adding a plugin panel to a dashboard whose class has its panels defined
in a tuple will fail because the new plugin cannot be appended to the tuple.
The code errors out before the panel gets added to the dashboard's panel list.
However, at this point, the panel has already been registered with the
dashboard. This causes Dashboard.
but not in its panel groups. Consequently, the panel gets put in the "Other"
panel group instead of its configured one, as described in bug #1378558.
By not adding the the plugin panel to its dashboard's class, the panel gets _autodiscover( )
added to its dashboard's panel list. Now the original issue from bug #1329050
resurfaces. The root cause of that is that every time Dashboard.
is called, it instantiates all its panel group classes, wiping out any panels
previously added to any of the panel groups. Avoid this by always processing
all the plugin panel groups before any of the plugin panels, which also ensures
that the panel groups exist before their panels.
Making this change exposed an issue where the Horizon URLs were being loaded
twice during the plugin infrastructure's unit tests, causing plugin panels to
be added multiple times to their dashboards. Fix that by removing the second,
unnecessary call. Also create a second test plugin panel group and panel to
test the scenarios described in the two bugs addressed here, adding two panel
groups at a time.
Change-Id: Id6a99c3ff18102 c8f47431638d4dd a98f14ec641 e3b5b41a6df6bd9 be5a22c174) 1e5e168f8ba1f93 7d308d6ab8)
Closes-Bug: 1378558
(cherry picked from commit e2ef492311a427f
(cherry picked from commit 5c1604275bfbe62