From 1f8134ad5bffe7197ae013b26a1305be282e4396 Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Thu, 30 Jun 2016 03:19:34 +0300 Subject: [PATCH] Move app-catalog's panels to App Catalog dashboard This commit moves panels of app-catalog-ui to 'App Catalog' dashboard, allowing to share single dashboard between muranodashboard and app-catalog-ui Renames dashboard and panels in accordance to https://etherpad.openstack.org/p/apps-dashboard-structure This commit should be tested in conjunction with Iea1439f2a23804c653fc60eb72e3c4b4e50c7498 Targets bp: catalog-dashboard-reorg Change-Id: I433bf09387dbfaf023b7b89be01b1daf504feaf4 --- .../app_catalog}/__init__.py | 0 .../app_catalog/app_catalog/index.html | 16 +++++++++++ .../app_catalog}/component_catalog/index.html | 0 app_catalog/{ => app_catalog}/panel.py | 0 app_catalog/{ => app_catalog}/urls.py | 8 +++--- app_catalog/{ => app_catalog}/views.py | 0 app_catalog/component_catalog/__init__.py | 0 .../component_catalog}/panel.py | 0 .../component_catalog}/tests.py | 0 .../component_catalog}/urls.py | 8 +++--- .../component_catalog}/views.py | 2 +- app_catalog/dashboard.py | 28 +++++++++++++++++++ app_catalog/enabled/_50_dashboard_catalog.py | 5 ++++ ...alog_panel_group.py => _51_app_catalog.py} | 17 +++++++---- app_catalog/enabled/_60_panel_group_browse.py | 8 ++++++ ...alog_panel.py => _61_app_catalog_panel.py} | 14 ++-------- ...=> _62_project_component_catalog_panel.py} | 8 ++---- .../dashboard/project/app_catalog/action.html | 4 +-- .../templates/component_catalog/index.html | 16 +++++++++++ devstack/plugin.sh | 6 +++- setup.cfg | 6 +++- 21 files changed, 111 insertions(+), 35 deletions(-) rename {component_catalog => app_catalog/app_catalog}/__init__.py (100%) create mode 100644 app_catalog/app_catalog/app_catalog/index.html rename {component_catalog/templates => app_catalog/app_catalog}/component_catalog/index.html (100%) rename app_catalog/{ => app_catalog}/panel.py (100%) rename app_catalog/{ => app_catalog}/urls.py (90%) rename app_catalog/{ => app_catalog}/views.py (100%) create mode 100644 app_catalog/component_catalog/__init__.py rename {component_catalog => app_catalog/component_catalog}/panel.py (100%) rename {component_catalog => app_catalog/component_catalog}/tests.py (100%) rename {component_catalog => app_catalog/component_catalog}/urls.py (89%) rename {component_catalog => app_catalog/component_catalog}/views.py (65%) create mode 100644 app_catalog/dashboard.py create mode 100644 app_catalog/enabled/_50_dashboard_catalog.py rename app_catalog/enabled/{_80_project_catalog_panel_group.py => _51_app_catalog.py} (65%) create mode 100644 app_catalog/enabled/_60_panel_group_browse.py rename app_catalog/enabled/{_90_project_app_catalog_panel.py => _61_app_catalog_panel.py} (70%) rename app_catalog/enabled/{_91_project_component_catalog_panel.py => _62_project_component_catalog_panel.py} (83%) create mode 100644 app_catalog/templates/component_catalog/index.html diff --git a/component_catalog/__init__.py b/app_catalog/app_catalog/__init__.py similarity index 100% rename from component_catalog/__init__.py rename to app_catalog/app_catalog/__init__.py diff --git a/app_catalog/app_catalog/app_catalog/index.html b/app_catalog/app_catalog/app_catalog/index.html new file mode 100644 index 0000000..f4c2ae3 --- /dev/null +++ b/app_catalog/app_catalog/app_catalog/index.html @@ -0,0 +1,16 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Application Catalog" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Application Catalog") %} +{% endblock page_header %} + +{% block main %} + +
+ +
+{% endblock %} + diff --git a/component_catalog/templates/component_catalog/index.html b/app_catalog/app_catalog/component_catalog/index.html similarity index 100% rename from component_catalog/templates/component_catalog/index.html rename to app_catalog/app_catalog/component_catalog/index.html diff --git a/app_catalog/panel.py b/app_catalog/app_catalog/panel.py similarity index 100% rename from app_catalog/panel.py rename to app_catalog/app_catalog/panel.py diff --git a/app_catalog/urls.py b/app_catalog/app_catalog/urls.py similarity index 90% rename from app_catalog/urls.py rename to app_catalog/app_catalog/urls.py index 112506f..fa56256 100644 --- a/app_catalog/urls.py +++ b/app_catalog/app_catalog/urls.py @@ -14,9 +14,9 @@ from django.conf import urls -from app_catalog import views +from app_catalog.app_catalog import views -urlpatterns = urls.patterns( - '', + +urlpatterns = [ urls.url(r'^$', views.IndexView.as_view(), name='index'), -) +] diff --git a/app_catalog/views.py b/app_catalog/app_catalog/views.py similarity index 100% rename from app_catalog/views.py rename to app_catalog/app_catalog/views.py diff --git a/app_catalog/component_catalog/__init__.py b/app_catalog/component_catalog/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/component_catalog/panel.py b/app_catalog/component_catalog/panel.py similarity index 100% rename from component_catalog/panel.py rename to app_catalog/component_catalog/panel.py diff --git a/component_catalog/tests.py b/app_catalog/component_catalog/tests.py similarity index 100% rename from component_catalog/tests.py rename to app_catalog/component_catalog/tests.py diff --git a/component_catalog/urls.py b/app_catalog/component_catalog/urls.py similarity index 89% rename from component_catalog/urls.py rename to app_catalog/component_catalog/urls.py index 174629d..db486a2 100644 --- a/component_catalog/urls.py +++ b/app_catalog/component_catalog/urls.py @@ -14,9 +14,9 @@ from django.conf import urls -from component_catalog import views +from app_catalog.component_catalog import views -urlpatterns = urls.patterns( - '', + +urlpatterns = [ urls.url(r'^$', views.IndexView.as_view(), name='index'), -) +] diff --git a/component_catalog/views.py b/app_catalog/component_catalog/views.py similarity index 65% rename from component_catalog/views.py rename to app_catalog/component_catalog/views.py index 2fd5c08..e95f145 100644 --- a/component_catalog/views.py +++ b/app_catalog/component_catalog/views.py @@ -1,4 +1,4 @@ -from app_catalog.views import IndexView as ACView +from app_catalog.app_catalog.views import IndexView as ACView class IndexView(ACView): diff --git a/app_catalog/dashboard.py b/app_catalog/dashboard.py new file mode 100644 index 0000000..a323631 --- /dev/null +++ b/app_catalog/dashboard.py @@ -0,0 +1,28 @@ +# Copyright (c) 2013 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from django.utils.translation import ugettext_lazy as _ +import horizon + + +class AppCatalog(horizon.Dashboard): + name = _("App Catalog") + slug = "app-catalog" + default_panel = "app_catalog" + supports_tenants = True + +try: + horizon.base.Horizon.registered('app-catalog') +except horizon.base.NotRegistered: + horizon.register(AppCatalog) diff --git a/app_catalog/enabled/_50_dashboard_catalog.py b/app_catalog/enabled/_50_dashboard_catalog.py new file mode 100644 index 0000000..e2520e0 --- /dev/null +++ b/app_catalog/enabled/_50_dashboard_catalog.py @@ -0,0 +1,5 @@ +# The name of the dashboard to be added to HORIZON['dashboards']. Required. +DASHBOARD = 'app-catalog' + +# If set to True, this dashboard will not be added to the settings. +DISABLED = False diff --git a/app_catalog/enabled/_80_project_catalog_panel_group.py b/app_catalog/enabled/_51_app_catalog.py similarity index 65% rename from app_catalog/enabled/_80_project_catalog_panel_group.py rename to app_catalog/enabled/_51_app_catalog.py index 4abff86..e0a4155 100644 --- a/app_catalog/enabled/_80_project_catalog_panel_group.py +++ b/app_catalog/enabled/_51_app_catalog.py @@ -10,9 +10,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The name of the panel group to be added to HORIZON_CONFIG. Required. -PANEL_GROUP = 'catalog_panel_group' -# The display name of the PANEL_GROUP. Required. -PANEL_GROUP_NAME = 'Catalog' -# The name of the dashboard the PANEL_GROUP associated with. Required. -PANEL_GROUP_DASHBOARD = 'project' +ADD_INSTALLED_APPS = [ + 'app_catalog', +] + +ADD_ANGULAR_MODULES = ['horizon.dashboard.project.app_catalog'] + +ADD_JS_FILES = ['dashboard/project/app_catalog/app_catalog.js'] + +ADD_SCSS_FILES = ['dashboard/project/app_catalog/app_catalog.scss'] + +FEATURE = True diff --git a/app_catalog/enabled/_60_panel_group_browse.py b/app_catalog/enabled/_60_panel_group_browse.py new file mode 100644 index 0000000..13428d8 --- /dev/null +++ b/app_catalog/enabled/_60_panel_group_browse.py @@ -0,0 +1,8 @@ +from django.utils.translation import ugettext_lazy as _ + +# The name of the panel group to be added to HORIZON_CONFIG. Required. +PANEL_GROUP = 'app-catalog_browse_group' +# The display name of the PANEL_GROUP. Required. +PANEL_GROUP_NAME = _('Browse') +# The name of the dashboard the PANEL_GROUP associated with. Required. +PANEL_GROUP_DASHBOARD = 'app-catalog' diff --git a/app_catalog/enabled/_90_project_app_catalog_panel.py b/app_catalog/enabled/_61_app_catalog_panel.py similarity index 70% rename from app_catalog/enabled/_90_project_app_catalog_panel.py rename to app_catalog/enabled/_61_app_catalog_panel.py index cb1639e..9fc6c64 100644 --- a/app_catalog/enabled/_90_project_app_catalog_panel.py +++ b/app_catalog/enabled/_61_app_catalog_panel.py @@ -13,17 +13,9 @@ # The name of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'app_catalog_panel' # The name of the dashboard the PANEL associated with. Required. -PANEL_DASHBOARD = 'project' +PANEL_DASHBOARD = 'app-catalog' # The name of the panel group the PANEL is associated with. -PANEL_GROUP = 'catalog_panel_group' +PANEL_GROUP = 'app-catalog_browse_group' # Python panel class of the PANEL to be added. -ADD_PANEL = 'app_catalog.panel.AppCatalog' - -ADD_INSTALLED_APPS = ['app_catalog'] - -ADD_ANGULAR_MODULES = ['horizon.dashboard.project.app_catalog'] - -ADD_JS_FILES = ['dashboard/project/app_catalog/app_catalog.js'] - -ADD_SCSS_FILES = ['dashboard/project/app_catalog/app_catalog.scss'] +ADD_PANEL = 'app_catalog.app_catalog.panel.AppCatalog' diff --git a/app_catalog/enabled/_91_project_component_catalog_panel.py b/app_catalog/enabled/_62_project_component_catalog_panel.py similarity index 83% rename from app_catalog/enabled/_91_project_component_catalog_panel.py rename to app_catalog/enabled/_62_project_component_catalog_panel.py index a3492ed..0c0f2fb 100644 --- a/app_catalog/enabled/_91_project_component_catalog_panel.py +++ b/app_catalog/enabled/_62_project_component_catalog_panel.py @@ -13,11 +13,9 @@ # The name of the panel to be added to HORIZON_CONFIG. Required. PANEL = 'component_catalog_panel' # The name of the dashboard the PANEL associated with. Required. -PANEL_DASHBOARD = 'project' +PANEL_DASHBOARD = 'app-catalog' # The name of the panel group the PANEL is associated with. -PANEL_GROUP = 'catalog_panel_group' +PANEL_GROUP = 'app-catalog_browse_group' # Python panel class of the PANEL to be added. -ADD_PANEL = 'component_catalog.panel.ComponentCatalog' - -ADD_INSTALLED_APPS = ['component_catalog'] +ADD_PANEL = 'app_catalog.component_catalog.panel.ComponentCatalog' diff --git a/app_catalog/static/dashboard/project/app_catalog/action.html b/app_catalog/static/dashboard/project/app_catalog/action.html index 6e416f1..55430a0 100644 --- a/app_catalog/static/dashboard/project/app_catalog/action.html +++ b/app_catalog/static/dashboard/project/app_catalog/action.html @@ -27,7 +27,7 @@ Unsupported
Checking - Install + Install
Installed Launch @@ -39,7 +39,7 @@
Unsupported
- Install + Install Installed
diff --git a/app_catalog/templates/component_catalog/index.html b/app_catalog/templates/component_catalog/index.html new file mode 100644 index 0000000..e0bd669 --- /dev/null +++ b/app_catalog/templates/component_catalog/index.html @@ -0,0 +1,16 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Component Catalog" %}{% endblock %} + +{% block page_header %} + {% include "horizon/common/_page_header.html" with title=_("Component Catalog ") %} +{% endblock page_header %} + +{% block main %} + +
+ +
+{% endblock %} + diff --git a/devstack/plugin.sh b/devstack/plugin.sh index f5cfa3f..2f59aa1 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -45,6 +45,10 @@ if is_service_enabled app-catalog-ui; then if [[ "$1" == "clean" ]]; then # Remove state and transient data # Remember clean.sh first calls unstack.sh - rm -f ${DEST}/horizon/openstack_dashboard/enabled/*_catalog_panel*.py* + rm -f ${DEST}/horizon/openstack_dashboard/enabled/_50_dashboard_catalog.* + rm -f ${DEST}/horizon/openstack_dashboard/enabled/_51_app_catalog.* + rm -f ${DEST}/horizon/openstack_dashboard/enabled/_60_panel_group_browse.* + rm -f ${DEST}/horizon/openstack_dashboard/enabled/_61_app_catalog_panel.* + rm -f ${DEST}/horizon/openstack_dashboard/enabled/_62_project_component_catalog_panel.* fi fi diff --git a/setup.cfg b/setup.cfg index 708435a..7ccf2d8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,4 +21,8 @@ classifier = [files] packages = app_catalog - component_catalog + + +[global] +setup-hooks = + pbr.hooks.setup_hook