mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47:45 -02:30
Hide max hosts field on org form
Hide max hosts field on org form. Also, simplify the usage of context API to read the value of me parameter. Hide max hosts field on org form. See: https://github.com/ansible/awx/issues/4950
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>
|
||||
</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} />
|
||||
{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>
|
||||
</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,6 +59,7 @@ function OrganizationFormFields({
|
||||
type="text"
|
||||
label={i18n._(t`Description`)}
|
||||
/>
|
||||
{license_info?.license_type !== 'open' && (
|
||||
<FormField
|
||||
id="org-max_hosts"
|
||||
name="max_hosts"
|
||||
@@ -74,9 +71,11 @@ function OrganizationFormFields({
|
||||
documentation for more details.`
|
||||
)}
|
||||
validate={minMaxValue(0, Number.MAX_SAFE_INTEGER, i18n)}
|
||||
me={me || {}}
|
||||
me={me}
|
||||
isDisabled={!me.is_superuser}
|
||||
/>
|
||||
)}
|
||||
|
||||
{custom_virtualenvs && custom_virtualenvs.length > 1 && (
|
||||
<FormGroup
|
||||
fieldId="org-custom-virtualenv"
|
||||
|
||||
Reference in New Issue
Block a user