update credentials

This commit is contained in:
John Mitchell 2017-03-01 16:29:21 -05:00
parent a69dfced74
commit 3b4d40a6c3
11 changed files with 57 additions and 126 deletions

View File

@ -140,8 +140,7 @@ var tower = angular.module('Tower', [
'GroupListDefinition',
'TeamsListDefinition',
'TeamFormDefinition',
'CredentialsListDefinition',
'CredentialFormDefinition',
'TeamHelper',
'TemplatesListDefinition',
'PortalJobTemplatesListDefinition',
'JobTemplateFormDefinition',

View File

@ -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();

View File

@ -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
}
}
}
};}]);
};}];

View File

@ -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'
}
}
};}]);
};}];

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -1,12 +1,29 @@
<div class="OwnerList" ng-init="ownersLimit = 5; ownersLimitConst = 5; ">
<div class="OwnerList-Container" ng-repeat="owner in owners_list | limitTo:ownersLimit">
<a ng-if="owner.type === 'organization'" ui-sref="organizations.edit({ organization_id: owner.id })">{{ owner.name }}{{$last ? '' : ', '}}</a>
<a ng-if="owner.type === 'user'" ui-sref="users.edit({ user_id: owner.id })">{{ owner.name }}{{$last ? '' : ', '}}</a>
<a ng-if="owner.type === 'team'" ui-sref="teams.edit({ team_id: owner.id })">{{ owner.name }}{{$last ? '' : ', '}}</a>
<div class="OwnerList" ng-init="ownersLimit = 5; ownersLimitConst = 5;">
<div class="OwnerList-Container"
ng-repeat="owner in owners_list | limitTo:ownersLimit">
<a ng-if="owner.type === 'organization'"
ui-sref="organizations.edit({ organization_id: owner.id })">
{{ owner.name }}{{$last ? '' : ', '}}
</a>
<a ng-if="owner.type === 'user'"
ui-sref="users.edit({ user_id: owner.id })">
{{ owner.name }}{{$last ? '' : ', '}}
</a>
<a ng-if="owner.type === 'team'"
ui-sref="teams.edit({ team_id: owner.id })">
{{ owner.name }}{{$last ? '' : ', '}}
</a>
</div>
<div class="OwnerList-seeMore" ng-show="owners_list.length > ownersLimitConst && ownersLimit == ownersLimitConst"
ng-click="ownersLimit = owners_list.length">View More</div>
<div class="OwnerList-seeLess" ng-show="owners_list.length > ownersLimitConst && ownersLimit != ownersLimitConst"
ng-click="ownersLimit = ownersLimitConst">View Less</div>
</div>
<div class="OwnerList-seeMore"
ng-show="owners_list.length > ownersLimitConst && ownersLimit == ownersLimitConst"
ng-click="ownersLimit = owners_list.length">
View More
</div>
<div class="OwnerList-seeLess"
ng-show="owners_list.length > ownersLimitConst && ownersLimit != ownersLimitConst"
ng-click="ownersLimit = ownersLimitConst">
View Less
</div>
</div>

View File

@ -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,

View File

@ -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,

View File

@ -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: '<p>Select existing credentials by clicking each credential or checking the related checkbox. When finished, click the blue ' +
'<em>Select</em> button, located bottom right.</p> <p>Create a brand new credential by clicking the <i class=\"fa fa-plus"></i> button.</p>',
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: '&#43; 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'
}
}
});