Skip to content

Commit

Permalink
Request specific attributes needed for edit from the API
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalis committed May 4, 2017
1 parent 5c11830 commit c35c8fb
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -18,6 +18,7 @@ ManageIQ.angular.app.controller('repositoryFormController', ['$scope', 'reposito
scm_update_on_launch: false,
};

vm.attributes = ['name', 'description', 'scm_type', 'scm_url', 'authentication_id', 'scm_branch:', 'scm_clean', 'scm_delete_on_update', 'scm_update_on_launch'];
vm.model = 'repositoryModel';

ManageIQ.angular.scope = vm;
Expand All @@ -30,7 +31,7 @@ ManageIQ.angular.app.controller('repositoryFormController', ['$scope', 'reposito
.catch(miqService.handleFailure);

if (repositoryId !== 'new') {
API.get('/api/configuration_script_sources/' + repositoryId)
API.get('/api/configuration_script_sources/' + repositoryId + '?attributes=' + vm.attributes.join(','))
.then(getRepositoryFormData)
.catch(miqService.handleFailure);
} else {
Expand Down Expand Up @@ -79,11 +80,10 @@ ManageIQ.angular.app.controller('repositoryFormController', ['$scope', 'reposito

var getRepositoryFormData = function(response) {
var data = response;
for (var key in vm.repositoryModel) {
if (vm.repositoryModel.hasOwnProperty( key ) && data.hasOwnProperty( key ) ) {
vm.repositoryModel[key] = data[key];
}
if (data.hasOwnProperty( 'href' )){
delete data.href;
}
Object.assign(vm.repositoryModel, data);
setForm();
};

Expand Down

0 comments on commit c35c8fb

Please sign in to comment.