summaryrefslogtreecommitdiff
path: root/horizon/base.py
diff options
context:
space:
mode:
authorlin-hua-cheng <lin-hua.cheng@hp.com>2014-08-27 00:34:33 -0700
committerlin-hua-cheng <lin-hua.cheng@hp.com>2014-08-27 00:34:33 -0700
commit292fc881d093195c87b05495847c9e5aec4dc5f0 (patch)
tree3310a5923ed58b21b83e676365376c9995f07d8e /horizon/base.py
parent9c3725c14bbdf3a8de0c6c294ddb4b369cb9d921 (diff)
downloadhorizon-292fc881d093195c87b05495847c9e5aec4dc5f0.tar.gz
Fix for adding panel to panel group via plugin
When adding panels to panel group, it should also be added to the list of panels at the class atttribute. Otherwise, it will lose the reference to the panels when _autodiscover() is triggered. Change-Id: Ifa530d5a39f48d9fd9cd0ea66f6c16594447058b Closes-Bug: #1329050
Diffstat (limited to 'horizon/base.py')
-rw-r--r--horizon/base.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/horizon/base.py b/horizon/base.py
index 16b387750..7a7ba3367 100644
--- a/horizon/base.py
+++ b/horizon/base.py
@@ -889,10 +889,11 @@ class Site(Registry, HorizonComponent):
except ImportError:
LOG.warning("Could not load panel: %s", mod_path)
return
-
panel = getattr(mod, panel_cls)
dashboard_cls.register(panel)
if panel_group:
+ dashboard_cls.get_panel_group(panel_group).__class__.\
+ panels.append(panel.slug)
dashboard_cls.get_panel_group(panel_group).\
panels.append(panel.slug)
else:
@@ -923,7 +924,8 @@ class Site(Registry, HorizonComponent):
panel_group = type(panel_group_slug,
(PanelGroup, ),
{'slug': panel_group_slug,
- 'name': panel_group_name},)
+ 'name': panel_group_name,
+ 'panels': []},)
# Add the panel group to dashboard
panels = list(dashboard_cls.panels)
panels.append(panel_group)