Adding identity ng-groups panel
This patch adds angular groups table. To be added in subsequent patches: - Actions - filterFacets - Integration to Searchlight To Test - set 'groups_panel': True in settings.py - local_settings.py v3 enabled Co-Authored-By: Cindy Lu <clu@us.ibm.com> Co-Authored-By: Kenji Ishii <ken-ishii@sx.jp.nec.com> Co-Authored-By: Shu Muto <shu-mutou@rf.jp.nec.com> Change-Id: Ifcb3353762ae9d65b73981a4a8d6241273afd16a Implements: blueprint ng-groups
This commit is contained in:
@@ -50,9 +50,10 @@ Default:
|
|||||||
'images_panel': True,
|
'images_panel': True,
|
||||||
'key_pairs_panel': False,
|
'key_pairs_panel': False,
|
||||||
'flavors_panel': False,
|
'flavors_panel': False,
|
||||||
|
'domains_panel': False,
|
||||||
'users_panel': False,
|
'users_panel': False,
|
||||||
'roles_panel': False,
|
'groups_panel': False,
|
||||||
'domains_panel': False
|
'roles_panel': False
|
||||||
}
|
}
|
||||||
|
|
||||||
A dictionary of currently available AngularJS features. This allows simple
|
A dictionary of currently available AngularJS features. This allows simple
|
||||||
|
@@ -12,18 +12,28 @@
|
|||||||
# 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 horizon.browsers.views import AngularIndexView
|
||||||
|
|
||||||
|
from openstack_dashboard.dashboards.identity.groups import panel
|
||||||
from openstack_dashboard.dashboards.identity.groups import views
|
from openstack_dashboard.dashboards.identity.groups import views
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
if settings.ANGULAR_FEATURES.get('groups_panel', False):
|
||||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
title = panel.Groups.name
|
||||||
url(r'^create$', views.CreateView.as_view(), name='create'),
|
urlpatterns = [
|
||||||
url(r'^(?P<group_id>[^/]+)/update/$',
|
url(r'^$', AngularIndexView.as_view(title=title), name='index'),
|
||||||
views.UpdateView.as_view(), name='update'),
|
]
|
||||||
url(r'^(?P<group_id>[^/]+)/manage_members/$',
|
else:
|
||||||
views.ManageMembersView.as_view(), name='manage_members'),
|
urlpatterns = [
|
||||||
url(r'^(?P<group_id>[^/]+)/add_members/$',
|
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||||
views.NonMembersView.as_view(), name='add_members'),
|
url(r'^create$', views.CreateView.as_view(), name='create'),
|
||||||
]
|
url(r'^(?P<group_id>[^/]+)/update/$',
|
||||||
|
views.UpdateView.as_view(), name='update'),
|
||||||
|
url(r'^(?P<group_id>[^/]+)/manage_members/$',
|
||||||
|
views.ManageMembersView.as_view(), name='manage_members'),
|
||||||
|
url(r'^(?P<group_id>[^/]+)/add_members/$',
|
||||||
|
views.NonMembersView.as_view(), name='add_members'),
|
||||||
|
]
|
||||||
|
@@ -0,0 +1,123 @@
|
|||||||
|
/**
|
||||||
|
* 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.groups
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* Provides all of the services and widgets required
|
||||||
|
* to support and display groups related content.
|
||||||
|
*/
|
||||||
|
angular
|
||||||
|
.module('horizon.dashboard.identity.groups', [
|
||||||
|
'ngRoute'
|
||||||
|
])
|
||||||
|
.constant('horizon.dashboard.identity.groups.resourceType', 'OS::Keystone::Group')
|
||||||
|
.run(run)
|
||||||
|
.config(config);
|
||||||
|
|
||||||
|
run.$inject = [
|
||||||
|
'horizon.framework.conf.resource-type-registry.service',
|
||||||
|
'horizon.app.core.openstack-service-api.keystone',
|
||||||
|
'horizon.dashboard.identity.groups.basePath',
|
||||||
|
'horizon.dashboard.identity.groups.resourceType'
|
||||||
|
];
|
||||||
|
|
||||||
|
function run(registry, keystone, basePath, groupResourceType) {
|
||||||
|
registry.getResourceType(groupResourceType)
|
||||||
|
.setNames(gettext('Group'), gettext('Groups'))
|
||||||
|
.setProperties(groupProperties())
|
||||||
|
.setListFunction(listFunction)
|
||||||
|
.tableColumns
|
||||||
|
.append({
|
||||||
|
id: 'name',
|
||||||
|
priority: 1,
|
||||||
|
sortDefault: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'description',
|
||||||
|
priority: 1
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
id: 'id',
|
||||||
|
priority: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
registry.getResourceType(groupResourceType).filterFacets
|
||||||
|
.append({
|
||||||
|
label: gettext('Name'),
|
||||||
|
name: 'name',
|
||||||
|
singleton: true
|
||||||
|
})
|
||||||
|
.append({
|
||||||
|
label: gettext('ID'),
|
||||||
|
name: 'id',
|
||||||
|
singleton: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function listFunction() {
|
||||||
|
return keystone.getGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name groupProperties
|
||||||
|
* @description resource properties for group module
|
||||||
|
*/
|
||||||
|
function groupProperties() {
|
||||||
|
return {
|
||||||
|
name: {
|
||||||
|
label: gettext('Name'),
|
||||||
|
filters: ['noName']
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
label: gettext('Description'),
|
||||||
|
filters: ['noValue']
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
label: gettext('ID'),
|
||||||
|
filters: ['noValue']
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.$inject = [
|
||||||
|
'$provide',
|
||||||
|
'$windowProvider',
|
||||||
|
'$routeProvider'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name config
|
||||||
|
* @param {Object} $provide
|
||||||
|
* @param {Object} $windowProvider
|
||||||
|
* @param {Object} $routeProvider
|
||||||
|
* @description Routes used by this module.
|
||||||
|
* @returns {undefined} Returns nothing
|
||||||
|
*/
|
||||||
|
function config($provide, $windowProvider, $routeProvider) {
|
||||||
|
var path = $windowProvider.$get().STATIC_URL + 'dashboard/identity/groups/';
|
||||||
|
$provide.constant('horizon.dashboard.identity.groups.basePath', path);
|
||||||
|
|
||||||
|
$routeProvider.when('/identity/groups', {
|
||||||
|
templateUrl: path + 'panel.html'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
@@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2017 SUSE Linux.
|
||||||
|
*
|
||||||
|
* 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.groups', function () {
|
||||||
|
var $scope, registry, keystone;
|
||||||
|
var groups = {data: {items: [{id: '1234', name: 'test_group1'}]}};
|
||||||
|
|
||||||
|
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||||
|
beforeEach(module('horizon.dashboard.identity.groups'));
|
||||||
|
beforeEach(module('horizon.framework'));
|
||||||
|
beforeEach(inject(function($injector, $q, _$rootScope_) {
|
||||||
|
$scope = _$rootScope_.$new();
|
||||||
|
registry =
|
||||||
|
$injector.get('horizon.framework.conf.resource-type-registry.service');
|
||||||
|
keystone = $injector.get('horizon.app.core.openstack-service-api.keystone');
|
||||||
|
var deferredGroups = $q.defer();
|
||||||
|
deferredGroups.resolve(groups);
|
||||||
|
spyOn(keystone, 'getGroups').and.returnValue(deferredGroups.promise);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('registers name', function() {
|
||||||
|
expect(registry.getResourceType('OS::Keystone::Group').
|
||||||
|
getName()).toBe("Groups");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set facets for search', function () {
|
||||||
|
var group = registry.getResourceType('OS::Keystone::Group').filterFacets
|
||||||
|
.map(getName);
|
||||||
|
expect(group).toContain('name');
|
||||||
|
expect(group).toContain('id');
|
||||||
|
|
||||||
|
function getName(x) {
|
||||||
|
return x.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should load groups', function () {
|
||||||
|
registry.getResourceType('OS::Keystone::Group').list().then(function(responses) {
|
||||||
|
$scope.$apply();
|
||||||
|
expect(responses).toEqual(groups);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
@@ -0,0 +1,4 @@
|
|||||||
|
<hz-resource-panel resource-type-name="OS::Keystone::Group">
|
||||||
|
<hz-resource-table resource-type-name="OS::Keystone::Group">
|
||||||
|
</hz-resource-table>
|
||||||
|
</hz-resource-panel>
|
@@ -27,8 +27,9 @@
|
|||||||
angular
|
angular
|
||||||
.module('horizon.dashboard.identity', [
|
.module('horizon.dashboard.identity', [
|
||||||
'horizon.dashboard.identity.domains',
|
'horizon.dashboard.identity.domains',
|
||||||
'horizon.dashboard.identity.users',
|
|
||||||
'horizon.dashboard.identity.projects',
|
'horizon.dashboard.identity.projects',
|
||||||
|
'horizon.dashboard.identity.users',
|
||||||
|
'horizon.dashboard.identity.groups',
|
||||||
'horizon.dashboard.identity.roles'
|
'horizon.dashboard.identity.roles'
|
||||||
])
|
])
|
||||||
.config(config);
|
.config(config);
|
||||||
|
@@ -326,9 +326,10 @@ ANGULAR_FEATURES = {
|
|||||||
'images_panel': True,
|
'images_panel': True,
|
||||||
'key_pairs_panel': False,
|
'key_pairs_panel': False,
|
||||||
'flavors_panel': False,
|
'flavors_panel': False,
|
||||||
|
'domains_panel': False,
|
||||||
'users_panel': False,
|
'users_panel': False,
|
||||||
|
'groups_panel': False,
|
||||||
'roles_panel': False,
|
'roles_panel': False,
|
||||||
'domains_panel': False
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Notice all customizable configurations should be above this line
|
# Notice all customizable configurations should be above this line
|
||||||
|
Reference in New Issue
Block a user