Adding identity ng-roles panel
This patch adds an angular roles table. To be added in subsequent patches: - Actions - filterFacets - Integration to Searchlight To test, v3 needs to be enabled in local_settings.py and set 'roles_panel' to True in settings.py Change-Id: Ie0eb168774f15536c778917abeb293e79d3b34e8 Co-Authored-By: Allen <chen.qiaomin@99cloud.net> Co-Authored-By: kenji-i <ken-ishii@sx.jp.nec.com> Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com> Partially-implements: blueprint ng-roles
This commit is contained in:
parent
e5dac64cb0
commit
001c2a1879
@ -12,10 +12,20 @@
|
|||||||
# 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 import settings
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from horizon.browsers.views import AngularIndexView
|
||||||
|
|
||||||
from openstack_dashboard.dashboards.identity.roles import views
|
from openstack_dashboard.dashboards.identity.roles import views
|
||||||
|
|
||||||
|
if settings.ANGULAR_FEATURES.get('roles_panel', False):
|
||||||
|
# New angular panel
|
||||||
|
title = _('Roles')
|
||||||
|
urlpatterns = [
|
||||||
|
url(r'^$', AngularIndexView.as_view(title=title), name='index'),
|
||||||
|
]
|
||||||
|
else:
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||||
url(r'^(?P<role_id>[^/]+)/update/$',
|
url(r'^(?P<role_id>[^/]+)/update/$',
|
||||||
|
@ -27,7 +27,19 @@
|
|||||||
angular
|
angular
|
||||||
.module('horizon.dashboard.identity', [
|
.module('horizon.dashboard.identity', [
|
||||||
'horizon.dashboard.identity.users',
|
'horizon.dashboard.identity.users',
|
||||||
'horizon.dashboard.identity.projects'
|
'horizon.dashboard.identity.projects',
|
||||||
]);
|
'horizon.dashboard.identity.roles'
|
||||||
|
])
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
config.$inject = [
|
||||||
|
'$provide',
|
||||||
|
'$windowProvider'
|
||||||
|
];
|
||||||
|
|
||||||
|
function config($provide, $windowProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/identity/';
|
||||||
|
$provide.constant('horizon.dashboard.identity.basePath', path);
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2015 IBM Corp.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe('horizon.dashboard.identity', function() {
|
||||||
|
it('should exist', function() {
|
||||||
|
expect(angular.module('horizon.dashboard.identity')).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('horizon.dashboard.identity.basePath constant', function() {
|
||||||
|
var identityBasePath, staticUrl;
|
||||||
|
|
||||||
|
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||||
|
beforeEach(module('horizon.dashboard.identity'));
|
||||||
|
beforeEach(module('horizon.framework'));
|
||||||
|
beforeEach(inject(function($injector) {
|
||||||
|
identityBasePath = $injector.get('horizon.dashboard.identity.basePath');
|
||||||
|
staticUrl = $injector.get('$window').STATIC_URL;
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should equal to "/static/dashboard/identity/"', function() {
|
||||||
|
expect(identityBasePath).toEqual(staticUrl + 'dashboard/identity/');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,4 @@
|
|||||||
|
<hz-resource-panel resource-type-name="OS::Keystone::Role">
|
||||||
|
<hz-resource-table resource-type-name="OS::Keystone::Role">
|
||||||
|
</hz-resource-table>
|
||||||
|
</hz-resource-panel>
|
@ -0,0 +1,84 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2016 99Cloud
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ngdoc overview
|
||||||
|
* @ngname horizon.dashboard.identity.roles
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* Provides all of the services and widgets required
|
||||||
|
* to support and display roles related content.
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.identity.roles', [
|
||||||
|
'ngRoute'
|
||||||
|
])
|
||||||
|
.constant('horizon.dashboard.identity.roles.resourceType', 'OS::Keystone::Role')
|
||||||
|
.run(run)
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
run.$inject = [
|
||||||
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
|
'horizon.app.core.openstack-service-api.keystone',
|
||||||
|
'horizon.dashboard.identity.roles.resourceType'
|
||||||
|
];
|
||||||
|
|
||||||
|
function run(registry, keystone, roleResourceType) {
|
||||||
|
registry.getResourceType(roleResourceType)
|
||||||
|
.setNames(gettext('Role'), gettext('Roles'))
|
||||||
|
.setProperties(roleProperties())
|
||||||
|
.setListFunction(listFunction)
|
||||||
|
.tableColumns
|
||||||
|
.append({
|
||||||
|
id: 'name',
|
||||||
|
priority: 1,
|
||||||
|
sortDefault: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'id',
|
||||||
|
priority: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
function listFunction() {
|
||||||
|
return keystone.getRoles();
|
||||||
|
}
|
||||||
|
|
||||||
|
function roleProperties() {
|
||||||
|
return {
|
||||||
|
name: { label: gettext('Name'), filters: ['noName'] },
|
||||||
|
id: { label: gettext('ID'), filters: ['noValue'] }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.$inject = [
|
||||||
|
'$provide',
|
||||||
|
'$windowProvider',
|
||||||
|
'$routeProvider'
|
||||||
|
];
|
||||||
|
|
||||||
|
function config($provide, $windowProvider, $routeProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/identity/roles/';
|
||||||
|
$provide.constant('horizon.dashboard.identity.roles.basePath', path);
|
||||||
|
|
||||||
|
$routeProvider.when('/identity/roles', {
|
||||||
|
templateUrl: path + 'panel.html'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2016 99Cloud
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe('horizon.dashboard.identity.roles', function () {
|
||||||
|
it('should exist', function () {
|
||||||
|
expect(angular.module('horizon.dashboard.identity.roles')).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('horizon.dashboard.identity.roles.basePath constant', function() {
|
||||||
|
var rolesBasePath, staticUrl;
|
||||||
|
|
||||||
|
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||||
|
beforeEach(module('horizon.dashboard.identity'));
|
||||||
|
beforeEach(module('horizon.framework'));
|
||||||
|
beforeEach(inject(function($injector) {
|
||||||
|
rolesBasePath = $injector.get('horizon.dashboard.identity.roles.basePath');
|
||||||
|
staticUrl = $injector.get('$window').STATIC_URL;
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should equal to "/static/dashboard/identity/roles"', function() {
|
||||||
|
expect(rolesBasePath).toEqual(staticUrl + 'dashboard/identity/roles/');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
@ -323,6 +323,7 @@ ANGULAR_FEATURES = {
|
|||||||
'images_panel': True,
|
'images_panel': True,
|
||||||
'flavors_panel': False,
|
'flavors_panel': False,
|
||||||
'users_panel': False,
|
'users_panel': False,
|
||||||
|
'roles_panel': False
|
||||||
}
|
}
|
||||||
|
|
||||||
# Notice all customizable configurations should be above this line
|
# Notice all customizable configurations should be above this line
|
||||||
|
@ -101,6 +101,7 @@ HORIZON_CONFIG = {
|
|||||||
ANGULAR_FEATURES = {
|
ANGULAR_FEATURES = {
|
||||||
'images_panel': False, # Use the legacy panel so unit tests are still run
|
'images_panel': False, # Use the legacy panel so unit tests are still run
|
||||||
'flavors_panel': False,
|
'flavors_panel': False,
|
||||||
|
'roles_panel': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
STATICFILES_DIRS = settings_utils.get_xstatic_dirs(
|
STATICFILES_DIRS = settings_utils.get_xstatic_dirs(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user