Use Horizon's plugin registration system

Magnum UI and their panels are currently registered via their `dashboard.py`
and `panel.py` files, but should use the enabled files.
This is standard in Horizon.

This patch changes registration method to enabled files.

For moving our dashboard to under the "project" dashbaord,
we need to change URLs. So, many files will be changed.

Since "/project/containers" is already used by Swift Container panel,
this patch uses "bays", "baymodels" and "bays/containers" for URLs.

Change-Id: Icedb984331bd46540f2e7d12bbefcc308aff214f
Closes-Bug: #1507679
This commit is contained in:
shu-mutou 2015-12-11 18:29:07 +09:00
parent d6a970b6e9
commit 7e5e888481
63 changed files with 216 additions and 174 deletions

View File

@ -1,4 +1,2 @@
include setup.py include setup.py
recursive-include magnum_ui/bay/templates * recursive-include magnum_ui/templates *
recursive-include magnum_ui/baymodel/templates *
recursive-include magnum_ui/static *

View File

@ -41,7 +41,12 @@ Install Magnum UI with all dependencies in your virtual environment::
And enable it in Horizon:: And enable it in Horizon::
cp ../magnum-ui/enabled/_50_add_containers_dashboard.py openstack_dashboard/local/enabled cp ../magnum-ui/enabled/_50_project_containers_panelgroup.py openstack_dashboard/local/enabled
cp ../magnum-ui/enabled/_51_project_containers_bays_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/enabled/_52_project_containers_baymodels_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/enabled/_53_project_containers_containers_panel.py openstack_dashboard/local/enabled
To run horizon with the newly enabled Magnum UI plugin run:: To run horizon with the newly enabled Magnum UI plugin run::

View File

@ -41,7 +41,10 @@ Install Magnum UI with all dependencies in your virtual environment::
And enable it in Horizon:: And enable it in Horizon::
cp ../magnum-ui/enabled/_50_add_containers_dashboard.py openstack_dashboard/local/enabled cp ../magnum-ui/enabled/_50_project_containers_panelgroup.py openstack_dashboard/local/enabled
cp ../magnum-ui/enabled/_51_project_containers_bays_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/enabled/_52_project_containers_baymodels_panel.py openstack_dashboard/local/enabled
cp ../magnum-ui/enabled/_53_project_containers_containers_panel.py openstack_dashboard/local/enabled
Release Notes Release Notes
============= =============

View File

@ -11,8 +11,15 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _
# The slug of the panel group to be added to HORIZON_CONFIG. Required.
PANEL_GROUP = 'containers'
# The display name of the PANEL_GROUP. Required.
PANEL_GROUP_NAME = _('Containers')
# The slug of the dashboard the PANEL_GROUP associated with. Required.
PANEL_GROUP_DASHBOARD = 'project'
DASHBOARD = 'containers'
ADD_INSTALLED_APPS = ['magnum_ui'] ADD_INSTALLED_APPS = ['magnum_ui']
ADD_ANGULAR_MODULES = [ ADD_ANGULAR_MODULES = [

View File

@ -0,0 +1,23 @@
# Copyright 2015 NEC Corporation, 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.
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'bays'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'containers'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'magnum_ui.content.bays.panel.Bays'

View File

@ -0,0 +1,23 @@
# Copyright 2015 NEC Corporation, 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.
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'baymodels'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'containers'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'magnum_ui.content.baymodels.panel.BayModels'

View File

@ -0,0 +1,23 @@
# Copyright 2015 NEC Corporation, 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.
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'bays.containers'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'containers'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'magnum_ui.content.bays.containers.panel.Containers'

View File

@ -1,30 +0,0 @@
# Copyright 2015 Cisco Systems, 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.core.urlresolvers import reverse
import horizon
from magnum_ui.containers.panel import Containers as containers_panel
from openstack_dashboard.test import helpers as test
class ContainerTests(test.TestCase):
def test_registration(self):
dashboard = horizon.get_dashboard('containers')
registered_panel = dashboard.get_panel('containers')
self.assertEqual(registered_panel.slug, containers_panel.slug)
def test_index(self):
index = reverse('horizon:containers:containers:index')
res = self.client.get(index)
self.assertTemplateUsed(res, 'containers/containers/index.html')

View File

@ -13,14 +13,9 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from magnum_ui import dashboard
import horizon import horizon
class BayModel(horizon.Panel): class BayModels(horizon.Panel):
name = _("Bay Models") name = _("Bay Models")
slug = "baymodel" slug = "baymodels"
dashboard.Containers.register(BayModel)

View File

@ -14,8 +14,7 @@
from django.conf.urls import patterns from django.conf.urls import patterns
from django.conf.urls import url from django.conf.urls import url
from magnum_ui.content.baymodels.views import IndexView
from magnum_ui.baymodel.views import IndexView
urlpatterns = patterns( urlpatterns = patterns(

View File

@ -14,9 +14,7 @@
from horizon import views from horizon import views
from magnum_ui.api.rest import magnum # noqa
class IndexView(views.APIView): class IndexView(views.APIView):
# A very simple class-based view... # A very simple class-based view...
template_name = 'containers/baymodel/index.html' template_name = 'baymodels/index.html'

View File

@ -14,12 +14,8 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import horizon import horizon
from magnum_ui import dashboard
class Containers(horizon.Panel): class Containers(horizon.Panel):
name = _("Containers") name = _("Containers")
slug = "containers" slug = "bays.containers"
dashboard.Containers.register(Containers)

View File

@ -0,0 +1,36 @@
# Copyright 2015 Cisco Systems, 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.core.urlresolvers import reverse
# import horizon
# from magnum_ui.containers.containers.panel import Containers
from openstack_dashboard.test import helpers as test
class ContainerTests(test.TestCase):
def test_me(self):
self.assertTrue(1 + 1 == 2)
# FIXME(shu-mutou): this tests seems not to work in new Horizon's plugin
# registration system
# def test_registration(self):
# dashboard = horizon.get_dashboard('project')
# registered_panel = dashboard.get_panel('containers.containers')
# self.assertEqual(registered_panel.slug, Containers.slug)
# def test_index(self):
# index = reverse('horizon:bays:containers:index')
# res = self.client.get(index)
# self.assertTemplateUsed(
# res, 'project/bays/containers/index.html')

View File

@ -14,12 +14,11 @@
from django.conf.urls import patterns from django.conf.urls import patterns
from django.conf.urls import url from django.conf.urls import url
from magnum_ui.content.bays.containers import views
from magnum_ui.containers.views import IndexView
urlpatterns = patterns( urlpatterns = patterns(
'', '',
url(r'^[0-9a-f\-]{36}$', IndexView.as_view(), name='detail'), url(r'^[0-9a-f\-]{36}$', views.IndexView.as_view(), name='detail'),
url(r'^$', IndexView.as_view(), name='index'), url(r'^$', views.IndexView.as_view(), name='index'),
) )

View File

@ -14,8 +14,6 @@
from horizon import views from horizon import views
from magnum_ui.api.rest import magnum # noqa
class IndexView(views.APIView): class IndexView(views.APIView):
template_name = 'containers/containers/index.html' template_name = 'bays.containers/index.html'

View File

@ -13,14 +13,9 @@
# under the License. # under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from magnum_ui import dashboard
import horizon import horizon
class Bay(horizon.Panel): class Bays(horizon.Panel):
name = _("Bays") name = _("Bays")
slug = "bay" slug = "bays"
dashboard.Containers.register(Bay)

View File

@ -12,14 +12,16 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from django.conf.urls import include
from django.conf.urls import patterns from django.conf.urls import patterns
from django.conf.urls import url from django.conf.urls import url
from magnum_ui.content.bays.containers import urls as containers_urls
from magnum_ui.bay.views import IndexView from magnum_ui.content.bays.views import IndexView
urlpatterns = patterns( urlpatterns = patterns(
'', '',
url(r'^containers/', include(containers_urls, namespace='containers')),
url(r'^[0-9a-f\-]{36}$', IndexView.as_view(), name='detail'), url(r'^[0-9a-f\-]{36}$', IndexView.as_view(), name='detail'),
url(r'^$', IndexView.as_view(), name='index'), url(r'^$', IndexView.as_view(), name='index'),
) )

View File

@ -19,4 +19,4 @@ from magnum_ui.api.rest import magnum # noqa
class IndexView(views.APIView): class IndexView(views.APIView):
# A very simple class-based view... # A very simple class-based view...
template_name = 'containers/bay/index.html' template_name = 'bays/index.html'

View File

@ -1,26 +0,0 @@
# Copyright 2015 Cisco Systems.
#
# 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 Containers(horizon.Dashboard):
name = _("Containers")
slug = "containers"
panels = ('bay', 'baymodel', 'containers')
default_panel = 'bay'
horizon.register(Containers)

View File

@ -19,7 +19,7 @@
/** /**
* @ngdoc overview * @ngdoc overview
* @name horizon.dashboard.containers.baymodel * @name horizon.dashboard.containers.baymodels
* @ngModule * @ngModule
* *
* @description * @description
@ -27,6 +27,5 @@
* panel * panel
*/ */
angular angular
.module('horizon.dashboard.containers.baymodel', []); .module('horizon.dashboard.containers.baymodels', []);
})(); })();

View File

@ -16,9 +16,9 @@
(function() { (function() {
'use strict'; 'use strict';
describe('horizon.dashboard.containers.baymodel', function() { describe('horizon.dashboard.containers.baymodels', function() {
it('should exist', function() { it('should exist', function() {
expect(angular.module('horizon.dashboard.containers.baymodel')).toBeDefined(); expect(angular.module('horizon.dashboard.containers.baymodels')).toBeDefined();
}); });
}); });

View File

@ -17,7 +17,7 @@
"use strict"; "use strict";
angular angular
.module('horizon.dashboard.containers') .module('horizon.dashboard.containers.baymodels')
.controller('BayModelDetailController', BayModelDetailController); .controller('BayModelDetailController', BayModelDetailController);
BayModelDetailController.$inject = [ BayModelDetailController.$inject = [

View File

@ -1,7 +1,7 @@
<div class="content" ng-controller="BayModelDetailController as ctrl"> <div class="content" ng-controller="BayModelDetailController as ctrl">
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="./baymodel" translate>Bay Models</a></li> <li><a ng-href="project/baymodels" translate>Bay Models</a></li>
<li class="active">{$ ctrl.baymodel.name $}</li> <li class="active">{$ ctrl.baymodel.name $}</li>
</ol> </ol>
</div> </div>
@ -44,7 +44,7 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>Image ID</dt> <dt translate>Image ID</dt>
<dd><a ng-href="../project/images/{$ ctrl.image_uuid $}/">{$ ctrl.baymodel.image_id $}</a></dd> <dd><a href="project/images/{$ ctrl.image_uuid $}/" target="_self">{$ ctrl.baymodel.image_id $}</a></dd>
</div> </div>
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>Flavor ID</dt> <dt translate>Flavor ID</dt>
@ -60,7 +60,7 @@
</div> </div>
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>Keypair ID</dt> <dt translate>Keypair ID</dt>
<dd><a ng-href="../project/access_and_security/keypairs/{$ ctrl.baymodel.keypair_id $}/">{$ ctrl.baymodel.keypair_id $}</a></dd> <dd><a href="project/access_and_security/keypairs/{$ ctrl.baymodel.keypair_id $}/" target="_self">{$ ctrl.baymodel.keypair_id $}</a></dd>
</div> </div>
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>SSH Authorized Key</dt> <dt translate>SSH Authorized Key</dt>

View File

@ -19,22 +19,22 @@
/** /**
* @ngdoc overview * @ngdoc overview
* @name containersBayModelTableController * @name containersBayModelsTableController
* @ngController * @ngController
* *
* @description * @description
* Controller for the containers bay model table * Controller for the containers bay model table
*/ */
angular angular
.module('horizon.dashboard.containers.baymodel') .module('horizon.dashboard.containers.baymodels')
.controller('containersBayModelTableController', containersBayModelTableController); .controller('containersBayModelsTableController', containersBayModelsTableController);
containersBayModelTableController.$inject = [ containersBayModelsTableController.$inject = [
'$scope', '$scope',
'horizon.app.core.openstack-service-api.magnum' 'horizon.app.core.openstack-service-api.magnum'
]; ];
function containersBayModelTableController($scope, magnum) { function containersBayModelsTableController($scope, magnum) {
var ctrl = this; var ctrl = this;
ctrl.ibaymodels = []; ctrl.ibaymodels = [];
ctrl.baymodels = []; ctrl.baymodels = [];

View File

@ -1,4 +1,4 @@
<table ng-controller="containersBayModelTableController as table" <table ng-controller="containersBayModelsTableController as table"
hz-table ng-cloak hz-table ng-cloak
st-table="table.ibaymodels" st-table="table.ibaymodels"
st-safe-src="table.baymodels" st-safe-src="table.baymodels"
@ -119,7 +119,7 @@
<dl class=dl-horizontal> <dl class=dl-horizontal>
<dt><translate>Name</translate></dt> <dt><translate>Name</translate></dt>
<dd><a ng-href="baymodel/{$ bm.id $}">{$ bm.name $}</a></dd> <dd><a ng-href="project/baymodels/{$ bm.id $}">{$ bm.name $}</a></dd>
<dt><translate>ID</translate></dt> <dt><translate>ID</translate></dt>
<dd>{$ bm.id $}</dd> <dd>{$ bm.id $}</dd>

View File

@ -19,7 +19,7 @@
/** /**
* @ngdoc overview * @ngdoc overview
* @name horizon.dashboard.containers.bay * @name horizon.dashboard.containers.bays
* @ngModule * @ngModule
* *
* @description * @description
@ -27,6 +27,5 @@
* panel * panel
*/ */
angular angular
.module('horizon.dashboard.containers.bay', []); .module('horizon.dashboard.containers.bays', []);
})(); })();

View File

@ -16,9 +16,9 @@
(function() { (function() {
'use strict'; 'use strict';
describe('horizon.dashboard.containers.bay', function() { describe('horizon.dashboard.containers.bays', function() {
it('should exist', function() { it('should exist', function() {
expect(angular.module('horizon.dashboard.containers.bay')).toBeDefined(); expect(angular.module('horizon.dashboard.containers.bays')).toBeDefined();
}); });
}); });

View File

@ -18,7 +18,7 @@
'use strict'; 'use strict';
angular angular
.module('horizon.dashboard.containers.bay') .module('horizon.dashboard.containers.bays')
.factory('bayModel', bayModel); .factory('bayModel', bayModel);
bayModel.$inject = [ bayModel.$inject = [

View File

@ -18,8 +18,8 @@
'use strict'; 'use strict';
angular angular
.module('horizon.dashboard.containers.bay') .module('horizon.dashboard.containers.bays')
.factory('horizon.dashboard.containers.bay.workflow', bayWorkflow); .factory('horizon.dashboard.containers.bays.workflow', bayWorkflow);
bayWorkflow.$inject = [ bayWorkflow.$inject = [
'horizon.dashboard.containers.basePath', 'horizon.dashboard.containers.basePath',
@ -33,20 +33,20 @@
steps: [ steps: [
{ {
title: gettext('Info'), title: gettext('Info'),
templateUrl: basePath + 'bay/create/info/info.html', templateUrl: basePath + 'bays/create/info/info.html',
helpUrl: basePath + 'bay/create/info/info.help.html', helpUrl: basePath + 'bays/create/info/info.help.html',
formName: 'bayInfoForm' formName: 'bayInfoForm'
}, },
{ {
title: gettext('Size'), title: gettext('Size'),
templateUrl: basePath + 'bay/create/size/size.html', templateUrl: basePath + 'bays/create/size/size.html',
helpUrl: basePath + 'bay/create/size/size.help.html', helpUrl: basePath + 'bays/create/size/size.help.html',
formName: 'baySizeForm' formName: 'baySizeForm'
}, },
{ {
title: gettext('Misc'), title: gettext('Misc'),
templateUrl: basePath + 'bay/create/misc/misc.html', templateUrl: basePath + 'bays/create/misc/misc.html',
helpUrl: basePath + 'bay/create/misc/misc.help.html', helpUrl: basePath + 'bays/create/misc/misc.help.html',
formName: 'bayMiscForm' formName: 'bayMiscForm'
} }
], ],

View File

@ -26,7 +26,7 @@
* Controller for the containers bay info step in create workflow * Controller for the containers bay info step in create workflow
*/ */
angular angular
.module('horizon.dashboard.containers.bay') .module('horizon.dashboard.containers.bays')
.controller('createBayInfoController', createBayInfoController); .controller('createBayInfoController', createBayInfoController);
createBayInfoController.$inject = [ createBayInfoController.$inject = [

View File

@ -26,7 +26,7 @@
* Controller for the containers bay misc step in create workflow * Controller for the containers bay misc step in create workflow
*/ */
angular angular
.module('horizon.dashboard.containers.bay') .module('horizon.dashboard.containers.bays')
.controller('createBayMiscController', createBayMiscController); .controller('createBayMiscController', createBayMiscController);
createBayMiscController.$inject = [ createBayMiscController.$inject = [

View File

@ -26,7 +26,7 @@
* Controller for the containers bay create modal * Controller for the containers bay create modal
*/ */
angular angular
.module('horizon.dashboard.containers.bay') .module('horizon.dashboard.containers.bays')
.controller('containersBayModalController', containersBayModalController); .controller('containersBayModalController', containersBayModalController);
containersBayModalController.$inject = [ containersBayModalController.$inject = [

View File

@ -26,7 +26,7 @@
* Controller for the containers bay size step in create workflow * Controller for the containers bay size step in create workflow
*/ */
angular angular
.module('horizon.dashboard.containers.bay') .module('horizon.dashboard.containers.bays')
.controller('createBaySizeController', createBaySizeController); .controller('createBaySizeController', createBaySizeController);
createBaySizeController.$inject = [ createBaySizeController.$inject = [

View File

@ -26,13 +26,13 @@
* Controller for the containers bay create modal * Controller for the containers bay create modal
*/ */
angular angular
.module('horizon.dashboard.containers.bay') .module('horizon.dashboard.containers.bays')
.controller('createBayWizardController', createBayWizardController); .controller('createBayWizardController', createBayWizardController);
createBayWizardController.$inject = [ createBayWizardController.$inject = [
'$scope', '$scope',
'bayModel', 'bayModel',
'horizon.dashboard.containers.bay.workflow' 'horizon.dashboard.containers.bays.workflow'
]; ];
function createBayWizardController($scope, model, workflow) { function createBayWizardController($scope, model, workflow) {

View File

@ -17,7 +17,7 @@
"use strict"; "use strict";
angular angular
.module('horizon.dashboard.containers') .module('horizon.dashboard.containers.bays')
.controller('BayDetailController', BayDetailController); .controller('BayDetailController', BayDetailController);
BayDetailController.$inject = [ BayDetailController.$inject = [

View File

@ -1,7 +1,7 @@
<div class="content" ng-controller="BayDetailController as ctrl"> <div class="content" ng-controller="BayDetailController as ctrl">
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="./" translate>Bays</a></li> <li><a ng-href="project/bays" translate>Bays</a></li>
<li class="active">{$ ctrl.bay.name $}</li> <li class="active">{$ ctrl.bay.name $}</li>
</ol> </ol>
</div> </div>
@ -14,7 +14,7 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>Name</dt> <dt translate>Name</dt>
<dd><a ng-href="baymodel/{$ ctrl.baymodel.uuid $}">{$ ctrl.baymodel.name $}</a></dd> <dd><a ng-href="project/baymodels/{$ ctrl.baymodel.uuid $}">{$ ctrl.baymodel.name $}</a></dd>
</div> </div>
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>ID</dt> <dt translate>ID</dt>

View File

@ -19,22 +19,22 @@
/** /**
* @ngdoc overview * @ngdoc overview
* @name containersBayTableController * @name containersBaysTableController
* @ngController * @ngController
* *
* @description * @description
* Controller for the containers bay table * Controller for the containers bay table
*/ */
angular angular
.module('horizon.dashboard.containers.bay') .module('horizon.dashboard.containers.bays')
.controller('containersBayTableController', containersBayTableController); .controller('containersBaysTableController', containersBaysTableController);
containersBayTableController.$inject = [ containersBaysTableController.$inject = [
'$scope', '$scope',
'horizon.app.core.openstack-service-api.magnum' 'horizon.app.core.openstack-service-api.magnum'
]; ];
function containersBayTableController($scope, magnum) { function containersBaysTableController($scope, magnum) {
var ctrl = this; var ctrl = this;
ctrl.ibays = []; ctrl.ibays = [];
ctrl.bays = []; ctrl.bays = [];

View File

@ -1,4 +1,4 @@
<table ng-controller="containersBayTableController as table" <table ng-controller="containersBaysTableController as table"
hz-table ng-cloak hz-table ng-cloak
st-table="table.ibays" st-table="table.ibays"
st-safe-src="table.bays" st-safe-src="table.bays"
@ -24,7 +24,7 @@
<button <button
class="btn btn-default btn-sm btn-launch ng-scope" class="btn btn-default btn-sm btn-launch ng-scope"
ng-controller="containersBayModalController as modal" ng-controller="containersBayModalController as modal"
ng-click="modal.openBayCreateWizard({successUrl: '/containers/'})"> ng-click="modal.openBayCreateWizard({successUrl: '/project/bays/'})">
<span class="fa fa-plus" translate>Create Bay</span> <span class="fa fa-plus" translate>Create Bay</span>
</button> </button>
</action-list> </action-list>
@ -133,7 +133,7 @@
<dl class=dl-horizontal> <dl class=dl-horizontal>
<dt translate>Name</dt> <dt translate>Name</dt>
<dd><a ng-href="{$ b.id $}">{$ b.name $}</a></dd> <dd><a ng-href="project/bays/{$ b.id $}">{$ b.name $}</a></dd>
<dt translate>ID</dt> <dt translate>ID</dt>
<dd>{$ b.id $}</dd> <dd>{$ b.id $}</dd>

View File

@ -26,47 +26,47 @@
*/ */
angular angular
.module('horizon.dashboard.containers', [ .module('horizon.dashboard.containers', [
'horizon.dashboard.containers.bay', 'horizon.dashboard.containers.bays',
'horizon.dashboard.containers.baymodel', 'horizon.dashboard.containers.baymodels',
'horizon.dashboard.containers.containers', 'horizon.dashboard.containers.containers',
'ngRoute' 'ngRoute'
]) ])
.config(config); .config(config)
config.$inject = ['$provide', '$windowProvider', config.$inject = ['$provide', '$windowProvider',
'$routeProvider', '$locationProvider']; '$routeProvider', '$locationProvider'];
function config($provide, $windowProvider, $routeProvider, $locationProvider) { function config($provide, $windowProvider, $routeProvider, $locationProvider) {
/* FIXME (shu-mutou): remove settings for $locationProvider if following patch is merged.
* https://review.openstack.org/#/c/260741/
*/
$locationProvider $locationProvider
.html5Mode({ .html5Mode({
enabled: true enabled: true
}); })
.hashPrefix('!');
var path = $windowProvider.$get().STATIC_URL + 'dashboard/containers/'; var path = $windowProvider.$get().STATIC_URL + 'dashboard/containers/';
$provide.constant('horizon.dashboard.containers.basePath', path); $provide.constant('horizon.dashboard.containers.basePath', path);
$routeProvider $routeProvider
.when('/containers', { .when('/project/bays/containers', {
templateUrl: path + 'containers/table/table.html' templateUrl: path + 'containers/table/table.html'
}) })
.when('/containers/:containerId', { .when('/project/bays/containers/:containerId', {
templateUrl: path + 'containers/detail/detail.html' templateUrl: path + 'containers/detail/detail.html'
}) })
.when('/baymodel', { .when('/project/baymodels', {
templateUrl: path + 'baymodel/table/table.html' templateUrl: path + 'baymodels/table/table.html'
}) })
.when('/baymodel/:baymodelId', { .when('/project/baymodels/:baymodelId', {
templateUrl: path + 'baymodel/detail/detail.html' templateUrl: path + 'baymodels/detail/detail.html'
}) })
.when('/', { .when('/project/bays', {
templateUrl: path + 'bay/table/table.html' templateUrl: path + 'bays/table/table.html'
}) })
.when('/:bayId', { .when('/project/bays/:bayId', {
templateUrl: path + 'bay/detail/detail.html' templateUrl: path + 'bays/detail/detail.html'
})
.otherwise({
redirectTo: '/'
}); });
} }
})(); })();

View File

@ -5,6 +5,6 @@
// Custom Style Variables // Custom Style Variables
@import "/custom/styles"; @import "/custom/styles";
@import "baymodel/baymodel"; @import "baymodels/baymodels";
@import "bay/bay"; @import "bays/bays";
@import "containers/containers"; @import "containers/containers";

View File

@ -17,7 +17,7 @@
"use strict"; "use strict";
angular angular
.module('horizon.dashboard.containers') .module('horizon.dashboard.containers.containers')
.controller('ContainerDetailController', ContainerDetailController); .controller('ContainerDetailController', ContainerDetailController);
ContainerDetailController.$inject = [ ContainerDetailController.$inject = [

View File

@ -1,7 +1,7 @@
<div class="content" ng-controller="ContainerDetailController as ctrl"> <div class="content" ng-controller="ContainerDetailController as ctrl">
<div class="page-header"> <div class="page-header">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a href="./containers" translate>Containers</a></li> <li><a ng-href="project/bays/containers" translate>Containers</a></li>
<li class="active">{$ ctrl.container.name $}</li> <li class="active">{$ ctrl.container.name $}</li>
</ol> </ol>
</div> </div>
@ -32,7 +32,7 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>Name</dt> <dt translate>Name</dt>
<dd><a ng-href="{$ ctrl.bay.uuid $}">{$ ctrl.bay.name $}</a></dd> <dd><a ng-href="project/bays/{$ ctrl.bay.uuid $}">{$ ctrl.bay.name $}</a></dd>
</div> </div>
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>ID</dt> <dt translate>ID</dt>
@ -60,7 +60,7 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>Name</dt> <dt translate>Name</dt>
<dd><a ng-href="baymodel/{$ ctrl.baymodel.uuid $}">{$ ctrl.baymodel.name $}</a></dd> <dd><a ng-href="project/baymodels/{$ ctrl.baymodel.uuid $}">{$ ctrl.baymodel.name $}</a></dd>
</div> </div>
<div class="{$ propertyClasses $}"> <div class="{$ propertyClasses $}">
<dt translate>ID</dt> <dt translate>ID</dt>

View File

@ -24,7 +24,7 @@
<button <button
class="btn btn-default btn-sm btn-launch ng-scope" class="btn btn-default btn-sm btn-launch ng-scope"
ng-controller="containersContainerModalController as modal" ng-controller="containersContainerModalController as modal"
ng-click="modal.openContainerCreateWizard({successUrl: '/containers/containers/'})"> ng-click="modal.openContainerCreateWizard({successUrl: '/project/bays/containers/'})">
<span class="fa fa-plus"> <translate>Create Container</translate></span> <span class="fa fa-plus"> <translate>Create Container</translate></span>
</button> </button>
</action-list> </action-list>
@ -141,7 +141,7 @@
<dl class=dl-horizontal> <dl class=dl-horizontal>
<dt><translate>Name</translate></dt> <dt><translate>Name</translate></dt>
<dd><a ng-href="containers/{$ c.id $}">{$ c.name $}</a></dd> <dd><a ng-href="project/bays/containers/{$ c.id $}">{$ c.name $}</a></dd>
<dt><translate>UUID</translate></dt> <dt><translate>UUID</translate></dt>
<dd>{$ c.id $}</dd> <dd>{$ c.id $}</dd>

View File

@ -10,7 +10,7 @@
{% endblock page_header %} {% endblock page_header %}
{% block ng_route_base %} {% block ng_route_base %}
<base href="{{ WEBROOT }}containers/"></base> <base href="{{ WEBROOT }}"></base>
{% endblock %} {% endblock %}
{% block main %} {% block main %}

View File

@ -10,7 +10,7 @@
{% endblock page_header %} {% endblock page_header %}
{% block ng_route_base %} {% block ng_route_base %}
<base href="{{ WEBROOT }}containers/"></base> <base href="{{ WEBROOT }}"></base>
{% endblock %} {% endblock %}
{% block main %} {% block main %}

View File

@ -10,7 +10,7 @@
{% endblock page_header %} {% endblock page_header %}
{% block ng_route_base %} {% block ng_route_base %}
<base href="{{ WEBROOT }}containers/"></base> <base href="{{ WEBROOT }}"></base>
{% endblock %} {% endblock %}
{% block main %} {% block main %}