diff --git a/awx/ui/client/features/output/details.component.js b/awx/ui/client/features/output/details.component.js index 696cfb8adf..13358e9abb 100644 --- a/awx/ui/client/features/output/details.component.js +++ b/awx/ui/client/features/output/details.component.js @@ -236,6 +236,17 @@ function getLicenseErrorDetails () { return { label, value }; } +function getHostLimitErrorDetails () { + if (!resource.model.has('org_host_limit_error')) { + return null; + } + + const label = strings.get('labels.HOST_LIMIT_ERROR'); + const value = resource.model.get('org_host_limit_error'); + + return { label, value }; +} + function getLaunchedByDetails () { const createdBy = resource.model.get('summary_fields.created_by'); const jobTemplate = resource.model.get('summary_fields.job_template'); @@ -804,6 +815,7 @@ function JobDetailsController ( vm.overwrite = getOverwriteDetails(); vm.overwriteVars = getOverwriteVarsDetails(); vm.licenseError = getLicenseErrorDetails(); + vm.hostLimitError = getHostLimitErrorDetails(); // Relaunch and Delete Components vm.job = angular.copy(_.get(resource.model, 'model.GET', {})); diff --git a/awx/ui/client/features/output/details.partial.html b/awx/ui/client/features/output/details.partial.html index 0e7cc3620a..9d5b621864 100644 --- a/awx/ui/client/features/output/details.partial.html +++ b/awx/ui/client/features/output/details.partial.html @@ -81,6 +81,14 @@ + +
+ +
+ {{ vm.hostLimitError.value }} +
+
+
diff --git a/awx/ui/client/features/output/output.strings.js b/awx/ui/client/features/output/output.strings.js index b47eff0ace..7ab92c7d84 100644 --- a/awx/ui/client/features/output/output.strings.js +++ b/awx/ui/client/features/output/output.strings.js @@ -57,6 +57,7 @@ function OutputStrings (BaseString) { EXTRA_VARS: t.s('Extra Variables'), FINISHED: t.s('Finished'), FORKS: t.s('Forks'), + HOST_LIMIT_ERROR: t.s('Host Limit Error'), INSTANCE_GROUP: t.s('Instance Group'), INVENTORY: t.s('Inventory'), INVENTORY_SCM: t.s('Source Project'), diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js index 207bdf4f8f..3513652a98 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/hosts/add/host-add.controller.js @@ -5,9 +5,9 @@ *************************************************/ export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition', 'ParseTypeChange', - 'GenerateForm', 'HostsService', 'rbacUiControlService', 'GetBasePath', 'ToJSON', 'canAdd', + 'GenerateForm', 'HostsService', 'GetBasePath', 'ToJSON', 'canAdd', function($state, $stateParams, $scope, RelatedHostsFormDefinition, ParseTypeChange, - GenerateForm, HostsService, rbacUiControlService, GetBasePath, ToJSON, canAdd) { + GenerateForm, HostsService, GetBasePath, ToJSON, canAdd) { init(); diff --git a/awx/ui/client/src/inventories-hosts/shared/hosts.service.js b/awx/ui/client/src/inventories-hosts/shared/hosts.service.js index 8624146892..ceddb8ca07 100644 --- a/awx/ui/client/src/inventories-hosts/shared/hosts.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/hosts.service.js @@ -17,9 +17,9 @@ url: function(){ return ''; }, - error: function(data, status) { - ProcessErrors($rootScope, data.data, status, null, { hdr: 'Error!', - msg: 'Call to ' + this.url + '. GET returned: ' + status }); + error: function(data) { + ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!', + msg: 'Call to ' + this.url + '. GET returned: ' + data.status }); }, success: function(data){ return data; diff --git a/awx/ui/client/src/organizations/add/organizations-add.controller.js b/awx/ui/client/src/organizations/add/organizations-add.controller.js index 6acccc4296..f13a9b09c6 100644 --- a/awx/ui/client/src/organizations/add/organizations-add.controller.js +++ b/awx/ui/client/src/organizations/add/organizations-add.controller.js @@ -24,8 +24,6 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', init(); function init(){ - // @issue What is this doing, why - $scope.$emit("HideOrgListHeader"); const virtualEnvs = ConfigData.custom_virtualenvs || []; $scope.custom_virtualenvs_visible = virtualEnvs.length > 1; $scope.custom_virtualenvs_options = virtualEnvs.filter( @@ -43,15 +41,15 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', // Save $scope.formSave = function() { + var fld, params = {}; Wait('start'); + for (fld in form.fields) { + params[fld] = $scope[fld]; + } var url = GetBasePath(base); url += (base !== 'organizations') ? $stateParams.project_id + '/organizations/' : ''; Rest.setUrl(url); - Rest.post({ - name: $scope.name, - description: $scope.description, - custom_virtualenv: $scope.custom_virtualenv - }) + Rest.post(params) .then(({data}) => { const organization_id = data.id, instance_group_url = data.related.instance_groups; diff --git a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js index e58b19aa6d..c6a54eca5a 100644 --- a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js +++ b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js @@ -38,7 +38,6 @@ export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup', } }); - $scope.$emit("HideOrgListHeader"); $scope.instance_groups = InstanceGroupsData; const virtualEnvs = ConfigData.custom_virtualenvs || []; $scope.custom_virtualenvs_visible = virtualEnvs.length > 1; diff --git a/awx/ui/client/src/organizations/organizations.form.js b/awx/ui/client/src/organizations/organizations.form.js index 56cfbebeae..a4a22deee4 100644 --- a/awx/ui/client/src/organizations/organizations.form.js +++ b/awx/ui/client/src/organizations/organizations.form.js @@ -54,6 +54,20 @@ export default ['NotificationsList', 'i18n', dataPlacement: 'right', ngDisabled: '!(organization_obj.summary_fields.user_capabilities.edit || canAdd)', ngShow: 'custom_virtualenvs_visible' + }, + max_hosts: { + label: i18n._('Max Hosts'), + type: 'number', + integer: true, + min: 0, + default: 0, + spinner: true, + dataTitle: i18n._('Max Hosts'), + dataPlacement: 'right', + dataContainer: 'body', + awPopOver: "

" + i18n._("The maximum number of hosts allowed to be managed by this organization. Value defaults to 0 which means no limit. Refer to the Ansible documentation for more details.") + "

", + ngDisabled: '!current_user.is_superuser', + ngShow: 'BRAND_NAME === "Tower"' } },