mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Add support for max hosts on org
This commit is contained in:
committed by
Jeff Bradberry
parent
046385d72e
commit
ce5a85a53b
@@ -236,6 +236,17 @@ function getLicenseErrorDetails () {
|
|||||||
return { label, value };
|
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 () {
|
function getLaunchedByDetails () {
|
||||||
const createdBy = resource.model.get('summary_fields.created_by');
|
const createdBy = resource.model.get('summary_fields.created_by');
|
||||||
const jobTemplate = resource.model.get('summary_fields.job_template');
|
const jobTemplate = resource.model.get('summary_fields.job_template');
|
||||||
@@ -804,6 +815,7 @@ function JobDetailsController (
|
|||||||
vm.overwrite = getOverwriteDetails();
|
vm.overwrite = getOverwriteDetails();
|
||||||
vm.overwriteVars = getOverwriteVarsDetails();
|
vm.overwriteVars = getOverwriteVarsDetails();
|
||||||
vm.licenseError = getLicenseErrorDetails();
|
vm.licenseError = getLicenseErrorDetails();
|
||||||
|
vm.hostLimitError = getHostLimitErrorDetails();
|
||||||
|
|
||||||
// Relaunch and Delete Components
|
// Relaunch and Delete Components
|
||||||
vm.job = angular.copy(_.get(resource.model, 'model.GET', {}));
|
vm.job = angular.copy(_.get(resource.model, 'model.GET', {}));
|
||||||
|
|||||||
@@ -81,6 +81,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- HOST LIMIT ERROR DETAIL -->
|
||||||
|
<div class="JobResults-resultRow" ng-show="vm.hostLimitError">
|
||||||
|
<label class="JobResults-resultRowLabel">{{ vm.hostLimitError.label }}</label>
|
||||||
|
<div class="JobResults-resultRowText">
|
||||||
|
{{ vm.hostLimitError.value }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- START TIME DETAIL -->
|
<!-- START TIME DETAIL -->
|
||||||
<div class="JobResults-resultRow" ng-if="vm.started">
|
<div class="JobResults-resultRow" ng-if="vm.started">
|
||||||
<label class="JobResults-resultRowLabel">{{ vm.started.label }}</label>
|
<label class="JobResults-resultRowLabel">{{ vm.started.label }}</label>
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ function OutputStrings (BaseString) {
|
|||||||
EXTRA_VARS: t.s('Extra Variables'),
|
EXTRA_VARS: t.s('Extra Variables'),
|
||||||
FINISHED: t.s('Finished'),
|
FINISHED: t.s('Finished'),
|
||||||
FORKS: t.s('Forks'),
|
FORKS: t.s('Forks'),
|
||||||
|
HOST_LIMIT_ERROR: t.s('Host Limit Error'),
|
||||||
INSTANCE_GROUP: t.s('Instance Group'),
|
INSTANCE_GROUP: t.s('Instance Group'),
|
||||||
INVENTORY: t.s('Inventory'),
|
INVENTORY: t.s('Inventory'),
|
||||||
INVENTORY_SCM: t.s('Source Project'),
|
INVENTORY_SCM: t.s('Source Project'),
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition', 'ParseTypeChange',
|
export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition', 'ParseTypeChange',
|
||||||
'GenerateForm', 'HostsService', 'rbacUiControlService', 'GetBasePath', 'ToJSON', 'canAdd',
|
'GenerateForm', 'HostsService', 'GetBasePath', 'ToJSON', 'canAdd',
|
||||||
function($state, $stateParams, $scope, RelatedHostsFormDefinition, ParseTypeChange,
|
function($state, $stateParams, $scope, RelatedHostsFormDefinition, ParseTypeChange,
|
||||||
GenerateForm, HostsService, rbacUiControlService, GetBasePath, ToJSON, canAdd) {
|
GenerateForm, HostsService, GetBasePath, ToJSON, canAdd) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
url: function(){
|
url: function(){
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
error: function(data, status) {
|
error: function(data) {
|
||||||
ProcessErrors($rootScope, data.data, status, null, { hdr: 'Error!',
|
ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!',
|
||||||
msg: 'Call to ' + this.url + '. GET returned: ' + status });
|
msg: 'Call to ' + this.url + '. GET returned: ' + data.status });
|
||||||
},
|
},
|
||||||
success: function(data){
|
success: function(data){
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ export default ['$scope', '$rootScope', '$location', '$stateParams',
|
|||||||
init();
|
init();
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
// @issue What is this doing, why
|
|
||||||
$scope.$emit("HideOrgListHeader");
|
|
||||||
const virtualEnvs = ConfigData.custom_virtualenvs || [];
|
const virtualEnvs = ConfigData.custom_virtualenvs || [];
|
||||||
$scope.custom_virtualenvs_visible = virtualEnvs.length > 1;
|
$scope.custom_virtualenvs_visible = virtualEnvs.length > 1;
|
||||||
$scope.custom_virtualenvs_options = virtualEnvs.filter(
|
$scope.custom_virtualenvs_options = virtualEnvs.filter(
|
||||||
@@ -43,15 +41,15 @@ export default ['$scope', '$rootScope', '$location', '$stateParams',
|
|||||||
|
|
||||||
// Save
|
// Save
|
||||||
$scope.formSave = function() {
|
$scope.formSave = function() {
|
||||||
|
var fld, params = {};
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
for (fld in form.fields) {
|
||||||
|
params[fld] = $scope[fld];
|
||||||
|
}
|
||||||
var url = GetBasePath(base);
|
var url = GetBasePath(base);
|
||||||
url += (base !== 'organizations') ? $stateParams.project_id + '/organizations/' : '';
|
url += (base !== 'organizations') ? $stateParams.project_id + '/organizations/' : '';
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.post({
|
Rest.post(params)
|
||||||
name: $scope.name,
|
|
||||||
description: $scope.description,
|
|
||||||
custom_virtualenv: $scope.custom_virtualenv
|
|
||||||
})
|
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
const organization_id = data.id,
|
const organization_id = data.id,
|
||||||
instance_group_url = data.related.instance_groups;
|
instance_group_url = data.related.instance_groups;
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$emit("HideOrgListHeader");
|
|
||||||
$scope.instance_groups = InstanceGroupsData;
|
$scope.instance_groups = InstanceGroupsData;
|
||||||
const virtualEnvs = ConfigData.custom_virtualenvs || [];
|
const virtualEnvs = ConfigData.custom_virtualenvs || [];
|
||||||
$scope.custom_virtualenvs_visible = virtualEnvs.length > 1;
|
$scope.custom_virtualenvs_visible = virtualEnvs.length > 1;
|
||||||
|
|||||||
@@ -54,6 +54,20 @@ export default ['NotificationsList', 'i18n',
|
|||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
ngDisabled: '!(organization_obj.summary_fields.user_capabilities.edit || canAdd)',
|
ngDisabled: '!(organization_obj.summary_fields.user_capabilities.edit || canAdd)',
|
||||||
ngShow: 'custom_virtualenvs_visible'
|
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: "<p>" + 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.") + "</p>",
|
||||||
|
ngDisabled: '!current_user.is_superuser',
|
||||||
|
ngShow: 'BRAND_NAME === "Tower"'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user