From 3b4d40a6c35e8158ec4886530eabd9e09a61a207 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 1 Mar 2017 16:29:21 -0500 Subject: [PATCH] update credentials --- awx/ui/client/src/app.js | 3 +- .../add/credentials-add.controller.js | 13 ++-- .../credentials.form.js} | 6 +- .../credentials.list.js} | 6 +- .../edit/credentials-edit.controller.js | 18 ++--- .../list/credentials-list.controller.js | 11 ++- awx/ui/client/src/credentials/main.js | 4 + .../src/credentials/ownerList.partial.html | 37 ++++++--- awx/ui/client/src/forms.js | 2 - awx/ui/client/src/lists.js | 6 +- awx/ui/client/src/lists/CloudCredentials.js | 77 ------------------- 11 files changed, 57 insertions(+), 126 deletions(-) rename awx/ui/client/src/{forms/Credentials.js => credentials/credentials.form.js} (99%) rename awx/ui/client/src/{lists/Credentials.js => credentials/credentials.list.js} (95%) delete mode 100644 awx/ui/client/src/lists/CloudCredentials.js diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index a298b634bd..0830b0e651 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -140,8 +140,7 @@ var tower = angular.module('Tower', [ 'GroupListDefinition', 'TeamsListDefinition', 'TeamFormDefinition', - 'CredentialsListDefinition', - 'CredentialFormDefinition', + 'TeamHelper', 'TemplatesListDefinition', 'PortalJobTemplatesListDefinition', 'JobTemplateFormDefinition', diff --git a/awx/ui/client/src/credentials/add/credentials-add.controller.js b/awx/ui/client/src/credentials/add/credentials-add.controller.js index 5671128323..e6daef660f 100644 --- a/awx/ui/client/src/credentials/add/credentials-add.controller.js +++ b/awx/ui/client/src/credentials/add/credentials-add.controller.js @@ -4,14 +4,13 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$compile', '$location', - '$log', '$stateParams', 'CredentialForm', 'GenerateForm', 'Rest', 'Alert', - 'ProcessErrors', 'ClearScope', 'GetBasePath', 'GetChoices', 'Empty', 'KindChange', 'BecomeMethodChange', +export default ['$scope', '$rootScope', '$stateParams', 'CredentialForm', + 'GenerateForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath', + 'GetChoices', 'Empty', 'KindChange', 'BecomeMethodChange', 'OwnerChange', 'CredentialFormSave', '$state', 'CreateSelect2', 'i18n', - function($scope, $rootScope, $compile, $location, $log, - $stateParams, CredentialForm, GenerateForm, Rest, Alert, ProcessErrors, - ClearScope, GetBasePath, GetChoices, Empty, KindChange, BecomeMethodChange, - OwnerChange, CredentialFormSave, $state, CreateSelect2, i18n) { + function($scope, $rootScope, $stateParams, CredentialForm, GenerateForm, + Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices, Empty, KindChange, + BecomeMethodChange, OwnerChange, CredentialFormSave, $state, CreateSelect2, i18n) { ClearScope(); diff --git a/awx/ui/client/src/forms/Credentials.js b/awx/ui/client/src/credentials/credentials.form.js similarity index 99% rename from awx/ui/client/src/forms/Credentials.js rename to awx/ui/client/src/credentials/credentials.form.js index 89af5ea7b9..d2a201fdd1 100644 --- a/awx/ui/client/src/forms/Credentials.js +++ b/awx/ui/client/src/credentials/credentials.form.js @@ -10,9 +10,7 @@ * @description This form is for adding/editing a Credential */ -export default - angular.module('CredentialFormDefinition', []) - .factory('CredentialForm', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { addTitle: i18n._('CREATE CREDENTIAL'), //Legend in add mode @@ -474,4 +472,4 @@ export default } } } - };}]); + };}]; diff --git a/awx/ui/client/src/lists/Credentials.js b/awx/ui/client/src/credentials/credentials.list.js similarity index 95% rename from awx/ui/client/src/lists/Credentials.js rename to awx/ui/client/src/credentials/credentials.list.js index 152e182b35..dcbe4db556 100644 --- a/awx/ui/client/src/lists/Credentials.js +++ b/awx/ui/client/src/credentials/credentials.list.js @@ -7,9 +7,7 @@ -export default - angular.module('CredentialsListDefinition', []) - .factory('CredentialList', ['i18n', function(i18n) { +export default ['i18n', function(i18n) { return { name: 'credentials', @@ -95,4 +93,4 @@ export default ngShow: 'credential.summary_fields.user_capabilities.delete' } } - };}]); + };}]; diff --git a/awx/ui/client/src/credentials/edit/credentials-edit.controller.js b/awx/ui/client/src/credentials/edit/credentials-edit.controller.js index 9073b80bdb..2f1d04a0b8 100644 --- a/awx/ui/client/src/credentials/edit/credentials-edit.controller.js +++ b/awx/ui/client/src/credentials/edit/credentials-edit.controller.js @@ -4,15 +4,15 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$compile', '$location', - '$log', '$stateParams', 'CredentialForm', 'Rest', 'Alert', - 'ProcessErrors', 'ClearScope', 'Prompt', 'GetBasePath', 'GetChoices', - 'KindChange', 'BecomeMethodChange', 'Empty', 'OwnerChange', - 'CredentialFormSave', 'Wait', '$state', 'CreateSelect2', 'Authorization', 'i18n', - function($scope, $rootScope, $compile, $location, $log, - $stateParams, CredentialForm, Rest, Alert, ProcessErrors, ClearScope, Prompt, - GetBasePath, GetChoices, KindChange, BecomeMethodChange, Empty, OwnerChange, CredentialFormSave, Wait, - $state, CreateSelect2, Authorization, i18n) { +export default ['$scope', '$rootScope', '$location', '$stateParams', + 'CredentialForm', 'Rest', 'ProcessErrors', 'ClearScope', 'Prompt', + 'GetBasePath', 'GetChoices', 'KindChange', 'BecomeMethodChange', 'Empty', + 'OwnerChange', 'Wait', '$state', 'CreateSelect2', + 'Authorization', 'i18n', 'CredentialFormSave', + function($scope, $rootScope, $location, $stateParams, CredentialForm, Rest, + ProcessErrors, ClearScope, Prompt, GetBasePath, GetChoices, KindChange, + BecomeMethodChange, Empty, OwnerChange, Wait, $state, + CreateSelect2, Authorization, i18n, CredentialFormSave) { ClearScope(); diff --git a/awx/ui/client/src/credentials/list/credentials-list.controller.js b/awx/ui/client/src/credentials/list/credentials-list.controller.js index 6f420f2cd9..b8bc553a2a 100644 --- a/awx/ui/client/src/credentials/list/credentials-list.controller.js +++ b/awx/ui/client/src/credentials/list/credentials-list.controller.js @@ -4,12 +4,11 @@ * All Rights Reserved *************************************************/ -export default ['$scope', '$rootScope', '$location', '$log', - '$stateParams', 'Rest', 'Alert', 'CredentialList', 'Prompt', 'ClearScope', - 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'i18n', - function($scope, $rootScope, $location, $log, - $stateParams, Rest, Alert, CredentialList, Prompt, ClearScope, - ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset, +export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ClearScope', + 'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter', + 'rbacUiControlService', 'Dataset', 'i18n', + function($scope, Rest, CredentialList, Prompt, ClearScope, ProcessErrors, + GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset, i18n) { ClearScope(); diff --git a/awx/ui/client/src/credentials/main.js b/awx/ui/client/src/credentials/main.js index e4bb2f6f2d..0dfe1d8d5d 100644 --- a/awx/ui/client/src/credentials/main.js +++ b/awx/ui/client/src/credentials/main.js @@ -12,6 +12,8 @@ import BecomeMethodChange from './factories/become-method-change.factory'; import CredentialFormSave from './factories/credential-form-save.factory'; import KindChange from './factories/kind-change.factory'; import OwnerChange from './factories/owner-change.factory'; +import CredentialList from './credentials.list'; +import CredentialForm from './credentials.form'; import { N_ } from '../i18n'; export default @@ -24,6 +26,8 @@ export default .controller('CredentialsList', CredentialsList) .controller('CredentialsAdd', CredentialsAdd) .controller('CredentialsEdit', CredentialsEdit) + .factory('CredentialList', CredentialList) + .factory('CredentialForm', CredentialForm) .config(['$stateProvider', 'stateDefinitionsProvider', function($stateProvider, stateDefinitionsProvider) { let stateDefinitions = stateDefinitionsProvider.$get(); diff --git a/awx/ui/client/src/credentials/ownerList.partial.html b/awx/ui/client/src/credentials/ownerList.partial.html index 5c73ac4d15..a0faea839b 100644 --- a/awx/ui/client/src/credentials/ownerList.partial.html +++ b/awx/ui/client/src/credentials/ownerList.partial.html @@ -1,12 +1,29 @@ -
- diff --git a/awx/ui/client/src/forms.js b/awx/ui/client/src/forms.js index f51be2d458..83de6838c2 100644 --- a/awx/ui/client/src/forms.js +++ b/awx/ui/client/src/forms.js @@ -5,7 +5,6 @@ *************************************************/ import ActivityDetail from "./forms/ActivityDetail"; -import Credentials from "./forms/Credentials"; import EventsViewer from "./forms/EventsViewer"; import Groups from "./forms/Groups"; import HostGroups from "./forms/HostGroups"; @@ -27,7 +26,6 @@ import Workflows from "./forms/Workflows"; export { ActivityDetail, - Credentials, EventsViewer, Groups, HostGroups, diff --git a/awx/ui/client/src/lists.js b/awx/ui/client/src/lists.js index ffe7da6d55..dc2e952485 100644 --- a/awx/ui/client/src/lists.js +++ b/awx/ui/client/src/lists.js @@ -4,10 +4,8 @@ * All Rights Reserved *************************************************/ -import CloudCredentials from "./lists/CloudCredentials"; import CompletedJobs from "./lists/CompletedJobs"; import AllJobs from "./lists/AllJobs"; -import Credentials from "./lists/Credentials"; import Groups from "./lists/Groups"; import Hosts from "./lists/Hosts"; import Inventories from "./lists/Inventories"; @@ -28,10 +26,8 @@ import Templates from "./lists/Templates"; import Users from "./lists/Users"; export - { CloudCredentials, - CompletedJobs, + { CompletedJobs, AllJobs, - Credentials, Groups, Hosts, Inventories, diff --git a/awx/ui/client/src/lists/CloudCredentials.js b/awx/ui/client/src/lists/CloudCredentials.js deleted file mode 100644 index 0010390436..0000000000 --- a/awx/ui/client/src/lists/CloudCredentials.js +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - - - -export default - angular.module('CloudCredentialsListDefinition', []) - .value('CloudCredentialList', { - - name: 'cloudcredentials', - iterator: 'cloudcredential', - selectTitle: 'Add Cloud Credentials', - editTitle: 'CLOUD CREDENTIALS', - selectInstructions: '

Select existing credentials by clicking each credential or checking the related checkbox. When finished, click the blue ' + - 'Select button, located bottom right.

Create a brand new credential by clicking the button.

', - index: false, - hover: true, - - fields: { - name: { - key: true, - label: 'Name' - }, - description: { - label: 'Description', - excludeModal: false - }, - team: { - label: 'Team', - ngBind: 'credential.team_name', - sourceModel: 'team', - sourceField: 'name', - excludeModal: true - }, - user: { - label: 'User', - ngBind: 'credential.user_username', - sourceModel: 'user', - sourceField: 'username', - excludeModal: true - } - }, - - actions: { - add: { - mode: 'all', // One of: edit, select, all - ngClick: 'addCredential()', - awToolTip: 'Create a new credential', - actionClass: 'btn btn-sm List-buttonSubmit', - buttonContent: '+ ADD' - } - }, - - fieldActions: { - edit: { - ngClick: "editCredential(credential.id)", - icon: 'fa-edit', - label: 'Edit', - "class": 'btn-sm', - awToolTip: 'Edit credential', - dataPlacement: 'top' - }, - - "delete": { - ngClick: "deleteCredential(credential.id, credential.name)", - icon: 'fa-trash-o', - label: 'Delete', - "class": 'btn-sm', - awToolTip: 'Delete credential', - dataPlacement: 'top' - } - } - });