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
This commit is contained in:
Kirill Zaitsev 2016-06-30 03:19:34 +03:00 committed by Omar Shykhkerimov
parent 7d76fbc9c8
commit 1f8134ad5b
21 changed files with 111 additions and 35 deletions

View File

@ -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 %}
<div ng-cloak
ng-controller="appCatalogTableCtrl" ng-init='init({{ APP_CATALOG_SETTINGS }})'>
<ng-include src="'{{ STATIC_URL }}dashboard/project/app_catalog/main_panel.html'"></ng-include>
</div>
{% endblock %}

View File

@ -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'),
)
]

View File

@ -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'),
)
]

View File

@ -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):

28
app_catalog/dashboard.py Normal file
View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -27,7 +27,7 @@
<a ng-switch-when="false" ng-class="extraclasses" class="btn btn-default disabled ajax-modal" href="/">Unsupported</a>
<div ng-switch-when="true" ng-switch="asset.installed">
<a ng-switch-default ng-class="extraclasses" class="btn btn-default disabled ajax-modal" href="/">Checking</a>
<a ng-switch-when="false" ng-class="[extraclasses, installclasses]" class="btn btn-default ajax-modal" href="{$ WEBROOT $}murano/packages/upload?repo_name={$ asset.service.package_name | encodeURIComponent $}&import_type=by_name">Install</a>
<a ng-switch-when="false" ng-class="[extraclasses, installclasses]" class="btn btn-default ajax-modal" href="{$ WEBROOT $}app-catalog/packages/upload?repo_name={$ asset.service.package_name | encodeURIComponent $}&import_type=by_name">Install</a>
<div ng-switch-when="true" ng-switch="no_launch || '_undefined_'">
<a ng-switch-when="true" ng-class="extraclasses" class="btn btn-default disabled ajax-modal" href="/">Installed</a>
<a ng-switch-default ng-class="[extraclasses, launchclasses]" class="btn btn-default ajax-modal" href="{$ WEBROOT $}murano/catalog/quick-add/{$ asset.service.murano_id $}">Launch</a>
@ -39,7 +39,7 @@
<div ng-switch-default ng-switch="asset.has_murano">
<a ng-switch-when="false" ng-class="extraclasses" class="btn btn-default disabled ajax-modal" href="/">Unsupported</a>
<div ng-switch-when="true" ng-switch="asset.installed || '_undefined_'">
<a ng-switch-default ng-class="[extraclasses, installclasses] class="btn btn-default ajax-modal" href="{$ WEBROOT $}murano/packages/import_bundle?name={$ asset.service.murano_package_name | encodeURIComponent $}&import_type=by_repo">Install</a>
<a ng-switch-default ng-class="[extraclasses, installclasses] class="btn btn-default ajax-modal" href="{$ WEBROOT $}app-catalog/packages/import_bundle?name={$ asset.service.murano_package_name | encodeURIComponent $}&import_type=by_repo">Install</a>
<a ng-switch-when="true" ng-class="extraclasses" class="btn btn-default disabled ajax-modal" href="/">Installed</a>
</div>
</div>

View File

@ -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 %}
<div ng-cloak
ng-controller="appComponentCatalogTableCtrl" ng-init="init({{ APP_CATALOG_SETTINGS }})">
<ng-include src="'{{ STATIC_URL }}dashboard/project/app_catalog/main_panel.html'"></ng-include>
</div>
{% endblock %}

View File

@ -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

View File

@ -21,4 +21,8 @@ classifier =
[files]
packages =
app_catalog
component_catalog
[global]
setup-hooks =
pbr.hooks.setup_hook