From 8a28d7c95021baeaa0fd7ec5d242fec93e8abf38 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 7 Mar 2018 16:55:16 -0500 Subject: [PATCH] remove permissions subview code from applications ui crud --- .../add-applications.controller.js | 1 - .../add-edit-applications.view.html | 9 +- .../applications/applications.strings.js | 4 +- .../edit-applications.controller.js | 15 +- awx/ui/client/features/applications/index.js | 164 ------------------ 5 files changed, 3 insertions(+), 190 deletions(-) diff --git a/awx/ui/client/features/applications/add-applications.controller.js b/awx/ui/client/features/applications/add-applications.controller.js index 5a23f4194e..173460157e 100644 --- a/awx/ui/client/features/applications/add-applications.controller.js +++ b/awx/ui/client/features/applications/add-applications.controller.js @@ -23,7 +23,6 @@ function AddApplicationsController (models, $state, strings) { vm.tab = { details: { _active: true }, - permissions: { _disabled: true }, users: { _disabled: true } }; diff --git a/awx/ui/client/features/applications/add-edit-applications.view.html b/awx/ui/client/features/applications/add-edit-applications.view.html index af1c7c41c3..a8d8d68e6c 100644 --- a/awx/ui/client/features/applications/add-edit-applications.view.html +++ b/awx/ui/client/features/applications/add-edit-applications.view.html @@ -5,11 +5,10 @@ {{:: vm.strings.get('tab.DETAILS') }} - {{:: vm.strings.get('tab.PERMISSIONS') }} {{:: vm.strings.get('tab.USERS') }} - + @@ -24,13 +23,7 @@ - -
-
-
- -
diff --git a/awx/ui/client/features/applications/applications.strings.js b/awx/ui/client/features/applications/applications.strings.js index 7f7f0eee0d..e70446946d 100644 --- a/awx/ui/client/features/applications/applications.strings.js +++ b/awx/ui/client/features/applications/applications.strings.js @@ -8,13 +8,11 @@ function ApplicationsStrings (BaseString) { LIST_BREADCRUMB_LABEL: t.s('APPLICATIONS'), ADD_BREADCRUMB_LABEL: t.s('CREATE APPLICATION'), EDIT_BREADCRUMB_LABEL: t.s('EDIT APPLICATION'), - USER_LIST_BREADCRUMB_LABEL: t.s('USERS'), - PERMISSIONS_BREADCRUMB_LABEL: t.s('PERMISSIONS') + USER_LIST_BREADCRUMB_LABEL: t.s('USERS') }; ns.tab = { DETAILS: t.s('Details'), - PERMISSIONS: t.s('Permissions'), USERS: t.s('Users') }; diff --git a/awx/ui/client/features/applications/edit-applications.controller.js b/awx/ui/client/features/applications/edit-applications.controller.js index b028eddaa3..dbd7c0e010 100644 --- a/awx/ui/client/features/applications/edit-applications.controller.js +++ b/awx/ui/client/features/applications/edit-applications.controller.js @@ -29,10 +29,6 @@ function EditApplicationsController (models, $state, strings, $scope) { _go: 'applications.edit', _params: { application_id: application.get('id') } }, - permissions: { - _go: 'applications.edit.permissions', - _params: { application_id: application.get('id') } - }, users: { _go: 'applications.edit.users', _params: { application_id: application.get('id') } @@ -42,22 +38,13 @@ function EditApplicationsController (models, $state, strings, $scope) { $scope.$watch('$state.current.name', (value) => { if (/applications.edit.users/.test(value)) { vm.tab.details._active = false; - vm.tab.permissions._active = false; vm.tab.users._active = true; - } else if (/applications.edit($|\.organization$)/.test(value)) { - vm.tab.details._active = true; - vm.tab.permissions._active = false; - vm.tab.users._active = false; } else { - vm.tab.details._active = false; - vm.tab.permissions._active = true; + vm.tab.details._active = true; vm.tab.users._active = false; } }); - // Only exists for permissions compatibility - $scope.application_obj = application.get(); - if (isEditable) { vm.form = application.createFormSchema('put', { omit }); } else { diff --git a/awx/ui/client/features/applications/index.js b/awx/ui/client/features/applications/index.js index 00a2ef4b99..97c3b07e79 100644 --- a/awx/ui/client/features/applications/index.js +++ b/awx/ui/client/features/applications/index.js @@ -256,170 +256,6 @@ function ApplicationsRun ($stateExtender, strings) { } }); - $stateExtender.addState({ - name: 'applications.edit.permissions', - route: '/permissions?{permission_search:queryset}', - ncyBreadcrumb: { - label: strings.get('state.PERMISSIONS_BREADCRUMB_LABEL'), - parent: 'applications.edit' - }, - params: { - permission_search: { - dynamic: true, - squash: '', - value: { - page_size: '20', - order_by: 'username' - } - } - }, - resolve: { - Dataset: ['QuerySet', '$stateParams', (qs, $stateParams) => { - const id = $stateParams.application_id; - // TODO: no access_list endpoint given by api - const path = `api/v2/applications/${id}/access_list/`; - - return qs.search(path, $stateParams.permission_search); - }], - ListDefinition: () => ({ - name: 'permissions', - disabled: 'organization === undefined', - ngClick: 'organization === undefined || $state.go(\'applications.edit.permissions\')', - awToolTip: '{{permissionsTooltip}}', - dataTipWatch: 'permissionsTooltip', - awToolTipTabEnabledInEditMode: true, - dataPlacement: 'right', - basePath: 'api/v2/applications/{{$stateParams.id}}/access_list/', - search: { - order_by: 'username' - }, - type: 'collection', - title: N_('Permissions'), - iterator: 'permission', - index: false, - open: false, - actions: { - add: { - ngClick: '$state.go(\'.add\')', - label: 'Add', - awToolTip: N_('Add a permission'), - actionClass: 'btn List-buttonSubmit', - buttonContent: `+ ${N_('ADD')}`, - ngShow: '(application_obj.summary_fields.user_capabilities.edit || canAdd)' - } - }, - fields: { - username: { - key: true, - label: N_('User'), - linkBase: 'users', - class: 'col-lg-3 col-md-3 col-sm-3 col-xs-4' - }, - role: { - label: N_('Role'), - type: 'role', - nosort: true, - class: 'col-lg-4 col-md-4 col-sm-4 col-xs-4' - }, - team_roles: { - label: N_('Team Roles'), - type: 'team_roles', - nosort: true, - class: 'col-lg-5 col-md-5 col-sm-5 col-xs-4' - } - } - }), - } - }); - - $stateExtender.addState({ - name: 'applications.edit.permissions.add', - url: '/add-permissions', - resolve: { - usersDataset: [ - 'addPermissionsUsersList', - 'QuerySet', - '$stateParams', - 'GetBasePath', - 'resourceData', - (list, qs, $stateParams, GetBasePath, resourceData) => { - let path; - - if (resourceData.data.organization) { - path = `${GetBasePath('organizations')}${resourceData.data.organization}/users`; - } else { - path = list.basePath || GetBasePath(list.name); - } - - return qs.search(path, $stateParams.user_search); - } - ], - teamsDataset: [ - 'addPermissionsTeamsList', - 'QuerySet', - '$stateParams', - 'GetBasePath', - 'resourceData', - (list, qs, $stateParams, GetBasePath, resourceData) => { - const path = GetBasePath(list.basePath) || GetBasePath(list.name); - const org = resourceData.data.organization; - - if (!org) { - return null; - } - - $stateParams[`${list.iterator}_search`].organization = org; - - return qs.search(path, $stateParams.team_search); - } - ], - resourceData: ['ApplicationModel', '$stateParams', (Application, $stateParams) => - new Application('get', $stateParams.application_id) - .then(application => ({ data: application.get() })) - ] - }, - params: { - user_search: { - value: { - order_by: 'username', - page_size: 5, - is_superuser: false - }, - dynamic: true - }, - team_search: { - value: { - order_by: 'name', - page_size: 5 - }, - dynamic: true - } - }, - ncyBreadcrumb: { - skip: true - }, - views: { - 'modal@applications.edit': { - template: ` - - ` - } - }, - onExit: $state => { - if ($state.transition) { - $('#add-permissions-modal').modal('hide'); - $('.modal-backdrop').remove(); - $('body').removeClass('modal-open'); - } - } - }); - $stateExtender.addState({ name: 'applications.edit.users', route: '/users',