mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
Merge pull request #8446 from nixocio/ui_issue_4950
Hide max hosts field on org form Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -4,7 +4,6 @@ import { useHistory } from 'react-router-dom';
|
||||
import { PageSection, Card } from '@patternfly/react-core';
|
||||
|
||||
import { OrganizationsAPI } from '../../../api';
|
||||
import { Config } from '../../../contexts/Config';
|
||||
import { CardBody } from '../../../components/Card';
|
||||
import OrganizationForm from '../shared/OrganizationForm';
|
||||
|
||||
@@ -38,16 +37,11 @@ function OrganizationAdd() {
|
||||
<PageSection>
|
||||
<Card>
|
||||
<CardBody>
|
||||
<Config>
|
||||
{({ me }) => (
|
||||
<OrganizationForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={handleCancel}
|
||||
me={me || {}}
|
||||
submitError={formError}
|
||||
/>
|
||||
)}
|
||||
</Config>
|
||||
<OrganizationForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={handleCancel}
|
||||
submitError={formError}
|
||||
/>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</PageSection>
|
||||
|
||||
@@ -18,6 +18,7 @@ import ContentLoading from '../../../components/ContentLoading';
|
||||
import DeleteButton from '../../../components/DeleteButton';
|
||||
import ErrorDetail from '../../../components/ErrorDetail';
|
||||
import useRequest, { useDismissableError } from '../../../util/useRequest';
|
||||
import { useConfig } from '../../../contexts/Config';
|
||||
|
||||
function OrganizationDetail({ i18n, organization }) {
|
||||
const {
|
||||
@@ -37,6 +38,7 @@ function OrganizationDetail({ i18n, organization }) {
|
||||
const [hasContentLoading, setHasContentLoading] = useState(true);
|
||||
const [instanceGroups, setInstanceGroups] = useState([]);
|
||||
const history = useHistory();
|
||||
const { license_info = {} } = useConfig();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
@@ -85,7 +87,9 @@ function OrganizationDetail({ i18n, organization }) {
|
||||
dataCy="organization-detail-name"
|
||||
/>
|
||||
<Detail label={i18n._(t`Description`)} value={description} />
|
||||
<Detail label={i18n._(t`Max Hosts`)} value={`${max_hosts}`} />
|
||||
{license_info?.license_type !== 'open' && (
|
||||
<Detail label={i18n._(t`Max Hosts`)} value={`${max_hosts}`} />
|
||||
)}
|
||||
<Detail
|
||||
label={i18n._(t`Ansible Environment`)}
|
||||
value={custom_virtualenv}
|
||||
|
||||
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { CardBody } from '../../../components/Card';
|
||||
import { OrganizationsAPI } from '../../../api';
|
||||
import { Config } from '../../../contexts/Config';
|
||||
import { getAddedAndRemoved } from '../../../util/lists';
|
||||
import OrganizationForm from '../shared/OrganizationForm';
|
||||
|
||||
@@ -64,17 +63,12 @@ function OrganizationEdit({ organization }) {
|
||||
|
||||
return (
|
||||
<CardBody>
|
||||
<Config>
|
||||
{({ me }) => (
|
||||
<OrganizationForm
|
||||
organization={organization}
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={handleCancel}
|
||||
me={me || {}}
|
||||
submitError={formError}
|
||||
/>
|
||||
)}
|
||||
</Config>
|
||||
<OrganizationForm
|
||||
organization={organization}
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={handleCancel}
|
||||
submitError={formError}
|
||||
/>
|
||||
</CardBody>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { t } from '@lingui/macro';
|
||||
import { Form, FormGroup } from '@patternfly/react-core';
|
||||
|
||||
import { OrganizationsAPI } from '../../../api';
|
||||
import { ConfigContext } from '../../../contexts/Config';
|
||||
import { ConfigContext, useConfig } from '../../../contexts/Config';
|
||||
import AnsibleSelect from '../../../components/AnsibleSelect';
|
||||
import ContentError from '../../../components/ContentError';
|
||||
import ContentLoading from '../../../components/ContentLoading';
|
||||
@@ -18,14 +18,10 @@ import { required, minMaxValue } from '../../../util/validators';
|
||||
import { FormColumnLayout } from '../../../components/FormLayout';
|
||||
import CredentialLookup from '../../../components/Lookup/CredentialLookup';
|
||||
|
||||
function OrganizationFormFields({
|
||||
i18n,
|
||||
me,
|
||||
instanceGroups,
|
||||
setInstanceGroups,
|
||||
}) {
|
||||
function OrganizationFormFields({ i18n, instanceGroups, setInstanceGroups }) {
|
||||
const { setFieldValue } = useFormikContext();
|
||||
const [venvField] = useField('custom_virtualenv');
|
||||
const { license_info = {}, me = {} } = useConfig();
|
||||
|
||||
const [
|
||||
galaxyCredentialsField,
|
||||
@@ -63,20 +59,23 @@ function OrganizationFormFields({
|
||||
type="text"
|
||||
label={i18n._(t`Description`)}
|
||||
/>
|
||||
<FormField
|
||||
id="org-max_hosts"
|
||||
name="max_hosts"
|
||||
type="number"
|
||||
label={i18n._(t`Max Hosts`)}
|
||||
tooltip={i18n._(
|
||||
t`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.`
|
||||
)}
|
||||
validate={minMaxValue(0, Number.MAX_SAFE_INTEGER, i18n)}
|
||||
me={me || {}}
|
||||
isDisabled={!me.is_superuser}
|
||||
/>
|
||||
{license_info?.license_type !== 'open' && (
|
||||
<FormField
|
||||
id="org-max_hosts"
|
||||
name="max_hosts"
|
||||
type="number"
|
||||
label={i18n._(t`Max Hosts`)}
|
||||
tooltip={i18n._(
|
||||
t`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.`
|
||||
)}
|
||||
validate={minMaxValue(0, Number.MAX_SAFE_INTEGER, i18n)}
|
||||
me={me}
|
||||
isDisabled={!me.is_superuser}
|
||||
/>
|
||||
)}
|
||||
|
||||
{custom_virtualenvs && custom_virtualenvs.length > 1 && (
|
||||
<FormGroup
|
||||
fieldId="org-custom-virtualenv"
|
||||
|
||||
Reference in New Issue
Block a user