mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 05:55:59 -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 { PageSection, Card } from '@patternfly/react-core';
|
||||||
|
|
||||||
import { OrganizationsAPI } from '../../../api';
|
import { OrganizationsAPI } from '../../../api';
|
||||||
import { Config } from '../../../contexts/Config';
|
|
||||||
import { CardBody } from '../../../components/Card';
|
import { CardBody } from '../../../components/Card';
|
||||||
import OrganizationForm from '../shared/OrganizationForm';
|
import OrganizationForm from '../shared/OrganizationForm';
|
||||||
|
|
||||||
@@ -38,16 +37,11 @@ function OrganizationAdd() {
|
|||||||
<PageSection>
|
<PageSection>
|
||||||
<Card>
|
<Card>
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<Config>
|
<OrganizationForm
|
||||||
{({ me }) => (
|
onSubmit={handleSubmit}
|
||||||
<OrganizationForm
|
onCancel={handleCancel}
|
||||||
onSubmit={handleSubmit}
|
submitError={formError}
|
||||||
onCancel={handleCancel}
|
/>
|
||||||
me={me || {}}
|
|
||||||
submitError={formError}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Config>
|
|
||||||
</CardBody>
|
</CardBody>
|
||||||
</Card>
|
</Card>
|
||||||
</PageSection>
|
</PageSection>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import ContentLoading from '../../../components/ContentLoading';
|
|||||||
import DeleteButton from '../../../components/DeleteButton';
|
import DeleteButton from '../../../components/DeleteButton';
|
||||||
import ErrorDetail from '../../../components/ErrorDetail';
|
import ErrorDetail from '../../../components/ErrorDetail';
|
||||||
import useRequest, { useDismissableError } from '../../../util/useRequest';
|
import useRequest, { useDismissableError } from '../../../util/useRequest';
|
||||||
|
import { useConfig } from '../../../contexts/Config';
|
||||||
|
|
||||||
function OrganizationDetail({ i18n, organization }) {
|
function OrganizationDetail({ i18n, organization }) {
|
||||||
const {
|
const {
|
||||||
@@ -37,6 +38,7 @@ function OrganizationDetail({ i18n, organization }) {
|
|||||||
const [hasContentLoading, setHasContentLoading] = useState(true);
|
const [hasContentLoading, setHasContentLoading] = useState(true);
|
||||||
const [instanceGroups, setInstanceGroups] = useState([]);
|
const [instanceGroups, setInstanceGroups] = useState([]);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const { license_info = {} } = useConfig();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -85,7 +87,9 @@ function OrganizationDetail({ i18n, organization }) {
|
|||||||
dataCy="organization-detail-name"
|
dataCy="organization-detail-name"
|
||||||
/>
|
/>
|
||||||
<Detail label={i18n._(t`Description`)} value={description} />
|
<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
|
<Detail
|
||||||
label={i18n._(t`Ansible Environment`)}
|
label={i18n._(t`Ansible Environment`)}
|
||||||
value={custom_virtualenv}
|
value={custom_virtualenv}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
|||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { CardBody } from '../../../components/Card';
|
import { CardBody } from '../../../components/Card';
|
||||||
import { OrganizationsAPI } from '../../../api';
|
import { OrganizationsAPI } from '../../../api';
|
||||||
import { Config } from '../../../contexts/Config';
|
|
||||||
import { getAddedAndRemoved } from '../../../util/lists';
|
import { getAddedAndRemoved } from '../../../util/lists';
|
||||||
import OrganizationForm from '../shared/OrganizationForm';
|
import OrganizationForm from '../shared/OrganizationForm';
|
||||||
|
|
||||||
@@ -64,17 +63,12 @@ function OrganizationEdit({ organization }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<Config>
|
<OrganizationForm
|
||||||
{({ me }) => (
|
organization={organization}
|
||||||
<OrganizationForm
|
onSubmit={handleSubmit}
|
||||||
organization={organization}
|
onCancel={handleCancel}
|
||||||
onSubmit={handleSubmit}
|
submitError={formError}
|
||||||
onCancel={handleCancel}
|
/>
|
||||||
me={me || {}}
|
|
||||||
submitError={formError}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Config>
|
|
||||||
</CardBody>
|
</CardBody>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { t } from '@lingui/macro';
|
|||||||
import { Form, FormGroup } from '@patternfly/react-core';
|
import { Form, FormGroup } from '@patternfly/react-core';
|
||||||
|
|
||||||
import { OrganizationsAPI } from '../../../api';
|
import { OrganizationsAPI } from '../../../api';
|
||||||
import { ConfigContext } from '../../../contexts/Config';
|
import { ConfigContext, useConfig } from '../../../contexts/Config';
|
||||||
import AnsibleSelect from '../../../components/AnsibleSelect';
|
import AnsibleSelect from '../../../components/AnsibleSelect';
|
||||||
import ContentError from '../../../components/ContentError';
|
import ContentError from '../../../components/ContentError';
|
||||||
import ContentLoading from '../../../components/ContentLoading';
|
import ContentLoading from '../../../components/ContentLoading';
|
||||||
@@ -18,14 +18,10 @@ import { required, minMaxValue } from '../../../util/validators';
|
|||||||
import { FormColumnLayout } from '../../../components/FormLayout';
|
import { FormColumnLayout } from '../../../components/FormLayout';
|
||||||
import CredentialLookup from '../../../components/Lookup/CredentialLookup';
|
import CredentialLookup from '../../../components/Lookup/CredentialLookup';
|
||||||
|
|
||||||
function OrganizationFormFields({
|
function OrganizationFormFields({ i18n, instanceGroups, setInstanceGroups }) {
|
||||||
i18n,
|
|
||||||
me,
|
|
||||||
instanceGroups,
|
|
||||||
setInstanceGroups,
|
|
||||||
}) {
|
|
||||||
const { setFieldValue } = useFormikContext();
|
const { setFieldValue } = useFormikContext();
|
||||||
const [venvField] = useField('custom_virtualenv');
|
const [venvField] = useField('custom_virtualenv');
|
||||||
|
const { license_info = {}, me = {} } = useConfig();
|
||||||
|
|
||||||
const [
|
const [
|
||||||
galaxyCredentialsField,
|
galaxyCredentialsField,
|
||||||
@@ -63,20 +59,23 @@ function OrganizationFormFields({
|
|||||||
type="text"
|
type="text"
|
||||||
label={i18n._(t`Description`)}
|
label={i18n._(t`Description`)}
|
||||||
/>
|
/>
|
||||||
<FormField
|
{license_info?.license_type !== 'open' && (
|
||||||
id="org-max_hosts"
|
<FormField
|
||||||
name="max_hosts"
|
id="org-max_hosts"
|
||||||
type="number"
|
name="max_hosts"
|
||||||
label={i18n._(t`Max Hosts`)}
|
type="number"
|
||||||
tooltip={i18n._(
|
label={i18n._(t`Max Hosts`)}
|
||||||
t`The maximum number of hosts allowed to be managed by this organization.
|
tooltip={i18n._(
|
||||||
Value defaults to 0 which means no limit. Refer to the Ansible
|
t`The maximum number of hosts allowed to be managed by this organization.
|
||||||
documentation for more details.`
|
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 || {}}
|
validate={minMaxValue(0, Number.MAX_SAFE_INTEGER, i18n)}
|
||||||
isDisabled={!me.is_superuser}
|
me={me}
|
||||||
/>
|
isDisabled={!me.is_superuser}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{custom_virtualenvs && custom_virtualenvs.length > 1 && (
|
{custom_virtualenvs && custom_virtualenvs.length > 1 && (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
fieldId="org-custom-virtualenv"
|
fieldId="org-custom-virtualenv"
|
||||||
|
|||||||
Reference in New Issue
Block a user