Add org Lookup implementation and WIP credential_type

This commit is contained in:
gconsidine
2017-06-23 16:13:54 -04:00
parent b7982bf202
commit 2fa4b3db5b
6 changed files with 117 additions and 40 deletions

View File

@@ -6,7 +6,6 @@ function EditCredentialsController (models, $state, $scope) {
let me = models.me;
let credential = models.credential;
let credentialType = models.credentialType;
let organization = models.organization;
vm.tab = {
details: {
@@ -21,9 +20,9 @@ function EditCredentialsController (models, $state, $scope) {
};
$scope.$watch('$state.current.name', (value) => {
if (value === 'credentials.edit') {
if (/credentials.edit($|\.organization$)/.test(value)) {
vm.tab.details._active = true;
vm.tab.details._permissions = false;
vm.tab.permissions._active = false;
} else {
vm.tab.permissions._active = true;
vm.tab.details._active = false;
@@ -39,13 +38,10 @@ 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.organization._resource = 'organization';
vm.form.organization._route = 'credentials.edit.organization';
vm.form.organization._value = credential.get('summary_fields.organization.id');
vm.form.organization._displayValue = credential.get('summary_fields.organization.name');
vm.form.credential_type._data = credentialType.get('results');
vm.form.credential_type._format = 'grouped-object';