mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
populate org and description on app detail view
This commit is contained in:
parent
6ab64590d7
commit
11560ab7bb
@ -42,7 +42,7 @@ function AddApplicationsController (models, $state, strings) {
|
|||||||
vm.form.organization._resource = 'organization';
|
vm.form.organization._resource = 'organization';
|
||||||
vm.form.organization._route = 'applications.add.organization';
|
vm.form.organization._route = 'applications.add.organization';
|
||||||
vm.form.organization._model = organization;
|
vm.form.organization._model = organization;
|
||||||
vm.form.organization._placeholder = strings.get('SELECT AN ORGANIZATION');
|
vm.form.organization._placeholder = strings.get('inputs.ORGANIZATION_PLACEHOLDER');
|
||||||
|
|
||||||
vm.form.name.required = true;
|
vm.form.name.required = true;
|
||||||
vm.form.organization.required = true;
|
vm.form.organization.required = true;
|
||||||
|
@ -25,6 +25,10 @@ function ApplicationsStrings (BaseString) {
|
|||||||
ROW_ITEM_LABEL_ORGANIZATION: t.s('ORG'),
|
ROW_ITEM_LABEL_ORGANIZATION: t.s('ORG'),
|
||||||
ROW_ITEM_LABEL_MODIFIED: t.s('LAST MODIFIED')
|
ROW_ITEM_LABEL_MODIFIED: t.s('LAST MODIFIED')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ns.inputs = {
|
||||||
|
ORGANIZATION_PLACEHOLDER: t.s('SELECT AN ORGANIZATION')
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationsStrings.$inject = ['BaseStringService'];
|
ApplicationsStrings.$inject = ['BaseStringService'];
|
||||||
|
@ -52,37 +52,25 @@ function EditApplicationsController (models, $state, strings, $scope) {
|
|||||||
|
|
||||||
vm.form.disabled = !isEditable;
|
vm.form.disabled = !isEditable;
|
||||||
|
|
||||||
|
vm.form.name.required = true;
|
||||||
|
vm.form.redirect_uris.required = true;
|
||||||
|
|
||||||
const isOrgAdmin = _.some(me.get('related.admin_of_organizations.results'), (org) => org.id === organization.get('id'));
|
const isOrgAdmin = _.some(me.get('related.admin_of_organizations.results'), (org) => org.id === organization.get('id'));
|
||||||
const isSuperuser = me.get('is_superuser');
|
const isSuperuser = me.get('is_superuser');
|
||||||
const isCurrentAuthor = Boolean(application.get('summary_fields.created_by.id') === me.get('id'));
|
const isCurrentAuthor = Boolean(application.get('summary_fields.created_by.id') === me.get('id'));
|
||||||
|
|
||||||
vm.form.organization = {
|
|
||||||
type: 'field',
|
|
||||||
label: 'Organization',
|
|
||||||
id: 'organization'
|
|
||||||
};
|
|
||||||
vm.form.description = {
|
|
||||||
type: 'String',
|
|
||||||
label: 'Description',
|
|
||||||
id: 'description'
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.form.organization._resource = 'organization';
|
|
||||||
vm.form.organization._route = 'applications.edit.organization';
|
|
||||||
vm.form.organization._model = organization;
|
|
||||||
vm.form.organization._placeholder = strings.get('SELECT AN ORGANIZATION');
|
|
||||||
|
|
||||||
// TODO: org not returned via api endpoint, check on this
|
|
||||||
vm.form.organization._value = application.get('organization');
|
|
||||||
|
|
||||||
vm.form.organization._disabled = true;
|
vm.form.organization._disabled = true;
|
||||||
|
|
||||||
if (isSuperuser || isOrgAdmin || (application.get('organization') === null && isCurrentAuthor)) {
|
if (isSuperuser || isOrgAdmin || (application.get('organization') === null && isCurrentAuthor)) {
|
||||||
vm.form.organization._disabled = false;
|
vm.form.organization._disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.form.name.required = true;
|
vm.form.organization._resource = 'organization';
|
||||||
|
vm.form.organization._model = organization;
|
||||||
|
vm.form.organization._route = 'applications.edit.organization';
|
||||||
|
vm.form.organization._value = application.get('summary_fields.organization.id');
|
||||||
|
vm.form.organization._displayValue = application.get('summary_fields.organization.name');
|
||||||
|
vm.form.organization._placeholder = strings.get('inputs.ORGANIZATION_PLACEHOLDER');
|
||||||
vm.form.organization.required = true;
|
vm.form.organization.required = true;
|
||||||
vm.form.redirect_uris.required = true;
|
|
||||||
|
|
||||||
delete vm.form.name.help_text;
|
delete vm.form.name.help_text;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user