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
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
import userRoute from './permissions-user-add.route';
|
import userRoute from './user-add.route';
|
||||||
import teamRoute from './permissions-team-add.route';
|
import teamRoute from './team-add.route';
|
||||||
import controller from './permissions-add.controller';
|
import controller from './add.controller';
|
||||||
|
|
||||||
export default
|
export default
|
||||||
angular.module('permissionsAdd', [])
|
angular.module('permissionsAdd', [])
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
|||||||
export default {
|
export default {
|
||||||
name: 'teamPermissionsAdd',
|
name: 'teamPermissionsAdd',
|
||||||
route: '/teams/:team_id/permissions/add',
|
route: '/teams/:team_id/permissions/add',
|
||||||
templateUrl: templateUrl('permissions/team-permissions'),
|
templateUrl: templateUrl('permissions/shared/team-permissions'),
|
||||||
controller: 'addController',
|
controller: 'addController',
|
||||||
resolve: {
|
resolve: {
|
||||||
features: ['FeaturesService', function(FeaturesService) {
|
features: ['FeaturesService', function(FeaturesService) {
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
|||||||
export default {
|
export default {
|
||||||
name: 'userPermissionsAdd',
|
name: 'userPermissionsAdd',
|
||||||
route: '/users/:user_id/permissions/add',
|
route: '/users/:user_id/permissions/add',
|
||||||
templateUrl: templateUrl('permissions/user-permissions'),
|
templateUrl: templateUrl('permissions/shared/user-permissions'),
|
||||||
controller: 'addController',
|
controller: 'addController',
|
||||||
resolve: {
|
resolve: {
|
||||||
features: ['FeaturesService', function(FeaturesService) {
|
features: ['FeaturesService', function(FeaturesService) {
|
@ -4,9 +4,9 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
import userRoute from './permissions-user-edit.route';
|
import userRoute from './user-edit.route';
|
||||||
import teamRoute from './permissions-team-edit.route';
|
import teamRoute from './team-edit.route';
|
||||||
import controller from './permissions-edit.controller';
|
import controller from './edit.controller';
|
||||||
|
|
||||||
export default
|
export default
|
||||||
angular.module('permissionsEdit', [])
|
angular.module('permissionsEdit', [])
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
|||||||
export default {
|
export default {
|
||||||
name: 'teamPermissionsEdit',
|
name: 'teamPermissionsEdit',
|
||||||
route: '/teams/:team_id/permissions/:permission_id',
|
route: '/teams/:team_id/permissions/:permission_id',
|
||||||
templateUrl: templateUrl('permissions/team-permissions'),
|
templateUrl: templateUrl('permissions/shared/team-permissions'),
|
||||||
controller: 'editController',
|
controller: 'editController',
|
||||||
resolve: {
|
resolve: {
|
||||||
features: ['FeaturesService', function(FeaturesService) {
|
features: ['FeaturesService', function(FeaturesService) {
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
|||||||
export default {
|
export default {
|
||||||
name: 'userPermissionsEdit',
|
name: 'userPermissionsEdit',
|
||||||
route: '/users/:user_id/permissions/:permission_id',
|
route: '/users/:user_id/permissions/:permission_id',
|
||||||
templateUrl: templateUrl('permissions/user-permissions'),
|
templateUrl: templateUrl('permissions/shared/user-permissions'),
|
||||||
controller: 'editController',
|
controller: 'editController',
|
||||||
resolve: {
|
resolve: {
|
||||||
features: ['FeaturesService', function(FeaturesService) {
|
features: ['FeaturesService', function(FeaturesService) {
|
@ -4,9 +4,9 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
import userRoute from './permissions-user-list.route';
|
import userRoute from './user-list.route';
|
||||||
import teamRoute from './permissions-team-list.route';
|
import teamRoute from './team-list.route';
|
||||||
import controller from './permissions-list.controller';
|
import controller from './list.controller';
|
||||||
|
|
||||||
export default
|
export default
|
||||||
angular.module('permissionsList', [])
|
angular.module('permissionsList', [])
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
|||||||
export default {
|
export default {
|
||||||
name: 'teamPermissionsList',
|
name: 'teamPermissionsList',
|
||||||
route: '/teams/:team_id/permissions',
|
route: '/teams/:team_id/permissions',
|
||||||
templateUrl: templateUrl('permissions/team-permissions'),
|
templateUrl: templateUrl('permissions/shared/team-permissions'),
|
||||||
controller: 'permissionsListController',
|
controller: 'permissionsListController',
|
||||||
resolve: {
|
resolve: {
|
||||||
features: ['FeaturesService', function(FeaturesService) {
|
features: ['FeaturesService', function(FeaturesService) {
|
@ -9,7 +9,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory';
|
|||||||
export default {
|
export default {
|
||||||
name: 'userPermissionsList',
|
name: 'userPermissionsList',
|
||||||
route: '/users/:user_id/permissions',
|
route: '/users/:user_id/permissions',
|
||||||
templateUrl: templateUrl('permissions/user-permissions'),
|
templateUrl: templateUrl('permissions/shared/user-permissions'),
|
||||||
controller: 'permissionsListController',
|
controller: 'permissionsListController',
|
||||||
resolve: {
|
resolve: {
|
||||||
features: ['FeaturesService', function(FeaturesService) {
|
features: ['FeaturesService', function(FeaturesService) {
|
@ -4,13 +4,17 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
import permissionsList from './permissions-list/main';
|
import permissionsList from './list/main';
|
||||||
import permissionsAdd from './permissions-add/main';
|
import permissionsAdd from './add/main';
|
||||||
import permissionsEdit from './permissions-edit/main';
|
import permissionsEdit from './edit/main';
|
||||||
import list from './permissions-list';
|
|
||||||
import form from './permissions-form';
|
import list from './shared/permissions.list';
|
||||||
import permissionsCategoryChange from './permissions-category-change.factory';
|
import form from './shared/permissions.form';
|
||||||
import permissionsLabel from './permissions-labels.factory';
|
|
||||||
|
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
|
export default
|
||||||
angular.module('permissions', [
|
angular.module('permissions', [
|
||||||
@ -21,4 +25,6 @@ export default
|
|||||||
.factory('permissionsList', list)
|
.factory('permissionsList', list)
|
||||||
.factory('permissionsForm', form)
|
.factory('permissionsForm', form)
|
||||||
.factory('permissionsCategoryChange', permissionsCategoryChange)
|
.factory('permissionsCategoryChange', permissionsCategoryChange)
|
||||||
.factory('permissionsLabel', permissionsLabel);
|
.factory('permissionsChoices', permissionsChoices)
|
||||||
|
.factory('permissionsLabel', permissionsLabel)
|
||||||
|
.factory('permissionsSearchSelect', permissionsSearchSelect);
|
||||||
|
@ -25,16 +25,9 @@
|
|||||||
data = data.data;
|
data = data.data;
|
||||||
var choices = data.actions.GET.permission_type.choices;
|
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
|
// 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;
|
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