summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/identity/static
diff options
context:
space:
mode:
Diffstat (limited to 'openstack_dashboard/dashboards/identity/static')
-rw-r--r--openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.js16
-rw-r--r--openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.spec.js41
-rw-r--r--openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/panel.html4
-rw-r--r--openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js84
-rw-r--r--openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.spec.js40
5 files changed, 183 insertions, 2 deletions
diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.js b/openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.js
index bedb1a1f4..5dcdef3d3 100644
--- a/openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.js
+++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.js
@@ -27,7 +27,19 @@
angular
.module('horizon.dashboard.identity', [
'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);
+ }
})();
diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.spec.js b/openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.spec.js
new file mode 100644
index 000000000..bd05556f9
--- /dev/null
+++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/identity.module.spec.js
@@ -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/');
+ });
+ });
+
+})();
diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/panel.html b/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/panel.html
new file mode 100644
index 000000000..0026ad7db
--- /dev/null
+++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/panel.html
@@ -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>
diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js b/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js
new file mode 100644
index 000000000..6ca5340fa
--- /dev/null
+++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js
@@ -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'
+ });
+ }
+})();
diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.spec.js b/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.spec.js
new file mode 100644
index 000000000..6600511cb
--- /dev/null
+++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.spec.js
@@ -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/');
+ });
+ });
+})();