mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
reinstituted modularization to be more inline with the inventory scripts management jobs
This commit is contained in:
parent
5f2cfa1bfa
commit
d1b7b3a553
@ -4,9 +4,9 @@
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import userRoute from './permissions-user-add.route';
|
||||
import teamRoute from './permissions-team-add.route';
|
||||
import controller from './permissions-add.controller';
|
||||
import userRoute from './user-add.route';
|
||||
import teamRoute from './team-add.route';
|
||||
import controller from './add.controller';
|
||||
|
||||
export default
|
||||
angular.module('permissionsAdd', [])
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
export default {
|
||||
name: 'teamPermissionsAdd',
|
||||
route: '/teams/:team_id/permissions/add',
|
||||
templateUrl: templateUrl('permissions/team-permissions'),
|
||||
templateUrl: templateUrl('permissions/shared/team-permissions'),
|
||||
controller: 'addController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
export default {
|
||||
name: 'userPermissionsAdd',
|
||||
route: '/users/:user_id/permissions/add',
|
||||
templateUrl: templateUrl('permissions/user-permissions'),
|
||||
templateUrl: templateUrl('permissions/shared/user-permissions'),
|
||||
controller: 'addController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
@ -4,9 +4,9 @@
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import userRoute from './permissions-user-edit.route';
|
||||
import teamRoute from './permissions-team-edit.route';
|
||||
import controller from './permissions-edit.controller';
|
||||
import userRoute from './user-edit.route';
|
||||
import teamRoute from './team-edit.route';
|
||||
import controller from './edit.controller';
|
||||
|
||||
export default
|
||||
angular.module('permissionsEdit', [])
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
export default {
|
||||
name: 'teamPermissionsEdit',
|
||||
route: '/teams/:team_id/permissions/:permission_id',
|
||||
templateUrl: templateUrl('permissions/team-permissions'),
|
||||
templateUrl: templateUrl('permissions/shared/team-permissions'),
|
||||
controller: 'editController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
export default {
|
||||
name: 'userPermissionsEdit',
|
||||
route: '/users/:user_id/permissions/:permission_id',
|
||||
templateUrl: templateUrl('permissions/user-permissions'),
|
||||
templateUrl: templateUrl('permissions/shared/user-permissions'),
|
||||
controller: 'editController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
@ -4,9 +4,9 @@
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import userRoute from './permissions-user-list.route';
|
||||
import teamRoute from './permissions-team-list.route';
|
||||
import controller from './permissions-list.controller';
|
||||
import userRoute from './user-list.route';
|
||||
import teamRoute from './team-list.route';
|
||||
import controller from './list.controller';
|
||||
|
||||
export default
|
||||
angular.module('permissionsList', [])
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
export default {
|
||||
name: 'teamPermissionsList',
|
||||
route: '/teams/:team_id/permissions',
|
||||
templateUrl: templateUrl('permissions/team-permissions'),
|
||||
templateUrl: templateUrl('permissions/shared/team-permissions'),
|
||||
controller: 'permissionsListController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
||||
export default {
|
||||
name: 'userPermissionsList',
|
||||
route: '/users/:user_id/permissions',
|
||||
templateUrl: templateUrl('permissions/user-permissions'),
|
||||
templateUrl: templateUrl('permissions/shared/user-permissions'),
|
||||
controller: 'permissionsListController',
|
||||
resolve: {
|
||||
features: ['FeaturesService', function(FeaturesService) {
|
@ -4,13 +4,17 @@
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
import permissionsList from './permissions-list/main';
|
||||
import permissionsAdd from './permissions-add/main';
|
||||
import permissionsEdit from './permissions-edit/main';
|
||||
import list from './permissions-list';
|
||||
import form from './permissions-form';
|
||||
import permissionsCategoryChange from './permissions-category-change.factory';
|
||||
import permissionsLabel from './permissions-labels.factory';
|
||||
import permissionsList from './list/main';
|
||||
import permissionsAdd from './add/main';
|
||||
import permissionsEdit from './edit/main';
|
||||
|
||||
import list from './shared/permissions.list';
|
||||
import form from './shared/permissions.form';
|
||||
|
||||
import permissionsCategoryChange from './shared/category-change.factory';
|
||||
import permissionsChoices from './shared/get-choices.factory';
|
||||
import permissionsLabel from './shared/get-labels.factory';
|
||||
import permissionsSearchSelect from './shared/get-search-select.factory';
|
||||
|
||||
export default
|
||||
angular.module('permissions', [
|
||||
@ -21,4 +25,6 @@ export default
|
||||
.factory('permissionsList', list)
|
||||
.factory('permissionsForm', form)
|
||||
.factory('permissionsCategoryChange', permissionsCategoryChange)
|
||||
.factory('permissionsLabel', permissionsLabel);
|
||||
.factory('permissionsChoices', permissionsChoices)
|
||||
.factory('permissionsLabel', permissionsLabel)
|
||||
.factory('permissionsSearchSelect', permissionsSearchSelect);
|
||||
|
@ -25,16 +25,9 @@
|
||||
data = data.data;
|
||||
var choices = data.actions.GET.permission_type.choices;
|
||||
|
||||
// convert the choices from the API from the format
|
||||
// [["read", "Read Inventory"], ...] to
|
||||
// {read: "Read Inventory", ...}
|
||||
choices = choices.reduce(function(obj, kvp) {
|
||||
obj[kvp[0]] = kvp[1];
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
// manually add the adhoc label to the choices object
|
||||
choices['adhoc'] = data.actions.GET.run_ad_hoc_commands.label;
|
||||
choices.push(["adhoc",
|
||||
data.actions.GET.run_ad_hoc_commands.label]);
|
||||
|
||||
return choices;
|
||||
})
|
26
awx/ui/client/src/permissions/shared/get-labels.factory.js
Normal file
26
awx/ui/client/src/permissions/shared/get-labels.factory.js
Normal file
@ -0,0 +1,26 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name helpers.function:Permissions
|
||||
* @description
|
||||
* Gets permission type labels from the API and sets them as the permissions labels on the relevant radio buttons
|
||||
*
|
||||
*/
|
||||
|
||||
export default
|
||||
[function() {
|
||||
return function (params) {
|
||||
// convert the choices from the API from the format
|
||||
// [["read", "Read Inventory"], ...] to
|
||||
// {read: "Read Inventory", ...}
|
||||
return params.choices.reduce(function(obj, kvp) {
|
||||
obj[kvp[0]] = kvp[1];
|
||||
return obj;
|
||||
}, {});
|
||||
};
|
||||
}];
|
@ -0,0 +1,30 @@
|
||||
/*************************************************
|
||||
* Copyright (c) 2015 Ansible, Inc.
|
||||
*
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name helpers.function:Permissions
|
||||
* @description
|
||||
* Gets permission type labels from the API and sets them as the permissions labels on the relevant radio buttons
|
||||
*
|
||||
*/
|
||||
|
||||
export default
|
||||
[function() {
|
||||
return function (params) {
|
||||
// convert the choices from the API from the format
|
||||
// [["read", "Read Inventory"], ...] to
|
||||
// {name: "read", value: "Read Inventory", ...}
|
||||
return params.choices.reduce(function(obj, kvp) {
|
||||
// for now, remove adhoc from those choices
|
||||
if (kvp[0] !== adhoc) {
|
||||
return {name: kvp[0], value: kvp[1]};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}, {});
|
||||
};
|
||||
}];
|
Loading…
Reference in New Issue
Block a user