mirror of
https://github.com/ansible/awx.git
synced 2026-02-18 11:40:05 -03:30
Add UI/UX polish in prep for merge
* Bring UI/UX inline with recent changes * Use select components as a stopgap for credential_types and orgs * Add tabs to permissions view * Add Organization model
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
const DEFAULT_ORGANIZATION_PLACEHOLDER = 'SELECT AN ORGANIZATION';
|
||||
|
||||
function EditCredentialsController (models, $state, $scope) {
|
||||
let vm = this || {};
|
||||
|
||||
let me = models.me;
|
||||
let credential = models.credential;
|
||||
let credentialType = models.credentialType;
|
||||
let organization = models.organization;
|
||||
|
||||
vm.tab = {
|
||||
details: {
|
||||
_active: true
|
||||
_active: true,
|
||||
_go: 'credentials.edit',
|
||||
_params: { credential_id: credential.get('id') }
|
||||
},
|
||||
permissions:{
|
||||
_go: 'credentials.edit.permissions',
|
||||
@@ -15,6 +20,16 @@ function EditCredentialsController (models, $state, $scope) {
|
||||
}
|
||||
};
|
||||
|
||||
$scope.$watch('$state.current.name', (value) => {
|
||||
if (value === 'credentials.edit') {
|
||||
vm.tab.details._active = true;
|
||||
vm.tab.details._permissions = false;
|
||||
} else {
|
||||
vm.tab.permissions._active = true;
|
||||
vm.tab.details._active = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Only exists for permissions compatibility
|
||||
$scope.credential_obj = credential.get();
|
||||
|
||||
@@ -24,6 +39,14 @@ function EditCredentialsController (models, $state, $scope) {
|
||||
omit: ['user', 'team', 'inputs']
|
||||
});
|
||||
|
||||
vm.form.organization._placeholder = DEFAULT_ORGANIZATION_PLACEHOLDER;
|
||||
vm.form.organization._data = organization.get('results');
|
||||
vm.form.organization._format = 'objects';
|
||||
vm.form.organization._exp = 'org as org.name for org in state._data';
|
||||
vm.form.organization._display = 'name';
|
||||
vm.form.organization._key = 'id';
|
||||
vm.form.organization._value = organization.getById(credential.get('organization'));
|
||||
|
||||
vm.form.credential_type._data = credentialType.get('results');
|
||||
vm.form.credential_type._format = 'grouped-object';
|
||||
vm.form.credential_type._display = 'name';
|
||||
|
||||
Reference in New Issue
Block a user