Fix the path of the panel navigator
This commit also introduces an admin_urls module, because there are two containers panels (admin and project) and each panel need to have a dedicate instance of urlpatterns. In before, both panels share the same urlpattern in the urls module, which lead to issues that both panels try to set the 'dashboard' and 'panel' parameters in the same view. As a result, the UI could use the wrong dashboard and panel to render the view. Change-Id: I046742fa5889be6b2cf9e616b7fd2f62928c7147 Closes-Bug: #1822925
This commit is contained in:
parent
7204d987af
commit
aad1d14050
23
zun_ui/content/container/containers/admin_urls.py
Normal file
23
zun_ui/content/container/containers/admin_urls.py
Normal file
@ -0,0 +1,23 @@
|
||||
# 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.conf.urls import url
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon.browsers import views
|
||||
from zun_ui.content.container.containers import views as zun_views
|
||||
|
||||
title = _("Containers")
|
||||
urlpatterns = [
|
||||
url(r'^(?P<container_id>[^/]+)/console',
|
||||
zun_views.SerialConsoleView.as_view(), name='console'),
|
||||
url('', views.AngularIndexView.as_view(title=title), name='index'),
|
||||
]
|
@ -26,3 +26,4 @@ class Containers(horizon.Panel):
|
||||
class ContainersForAdmin(horizon.Panel):
|
||||
name = _("Containers")
|
||||
slug = "container.containers"
|
||||
urls = "admin_urls"
|
||||
|
@ -22,7 +22,6 @@
|
||||
'$location',
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.zun',
|
||||
'horizon.framework.util.navigations.service'
|
||||
];
|
||||
|
||||
/*
|
||||
@ -33,7 +32,7 @@
|
||||
* This service provides functions that are used through
|
||||
* the containers features.
|
||||
*/
|
||||
function containersService($location, detailRoute, zun, navigation) {
|
||||
function containersService($location, detailRoute, zun) {
|
||||
return {
|
||||
getDefaultIndexUrl: getDefaultIndexUrl,
|
||||
getDetailsPath: getDetailsPath,
|
||||
@ -42,19 +41,14 @@
|
||||
};
|
||||
|
||||
function getDefaultIndexUrl() {
|
||||
var dashboard, breadcrumbDashboard;
|
||||
var dashboard;
|
||||
var path = "/container/containers";
|
||||
if (zun.isAdmin()) {
|
||||
dashboard = "/admin";
|
||||
breadcrumbDashboard = gettext("Admin");
|
||||
} else {
|
||||
dashboard = "/project";
|
||||
breadcrumbDashboard = gettext("Project");
|
||||
}
|
||||
var url = dashboard + path + "/";
|
||||
navigation.setBreadcrumb([
|
||||
breadcrumbDashboard, gettext("Container"), gettext("Containers")]);
|
||||
navigation.expandNavigationByUrl(url);
|
||||
return url;
|
||||
}
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user