1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Default empty max hosts to 0

This commit is contained in:
mabashian 2019-02-26 15:58:28 -05:00 committed by Jeff Bradberry
parent 98c5cb1c4c
commit 1b94b616f0
2 changed files with 8 additions and 2 deletions

View File

@ -46,6 +46,9 @@ export default ['$scope', '$rootScope', '$location', '$stateParams',
for (fld in form.fields) {
params[fld] = $scope[fld];
}
if (!params.max_hosts || params.max_hosts === '') {
params.max_hosts = 0;
}
var url = GetBasePath(base);
url += (base !== 'organizations') ? $stateParams.project_id + '/organizations/' : '';
Rest.setUrl(url);
@ -71,7 +74,7 @@ export default ['$scope', '$rootScope', '$location', '$stateParams',
let explanation = _.has(data, "name") ? data.name[0] : "";
ProcessErrors($scope, data, status, OrganizationForm, {
hdr: 'Error!',
msg: `Failed to save organization. PUT status: ${status}. ${explanation}`
msg: `Failed to save organization. POST status: ${status}. ${explanation}`
});
});
};

View File

@ -56,7 +56,7 @@ export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
$scope.organization_name = data.name;
for (fld in form.fields) {
if (data[fld]) {
if (typeof data[fld] !== 'undefined') {
$scope[fld] = data[fld];
master[fld] = data[fld];
}
@ -97,6 +97,9 @@ export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
for (fld in form.fields) {
params[fld] = $scope[fld];
}
if (!params.max_hosts || params.max_hosts === '') {
params.max_hosts = 0;
}
Rest.setUrl(defaultUrl + id + '/');
Rest.put(params)
.then(() => {