mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Disable edit fields for managed EE, except pull
Disable edit fields for managed EE, except pull options. See: https://github.com/ansible/tower/issues/5016
This commit is contained in:
parent
487d78cc72
commit
77b0b9a4e3
@ -74,7 +74,10 @@ function ExecutionEnvironmentFormFields({
|
||||
: null
|
||||
}
|
||||
autoPopulate={!me?.is_superuser ? !executionEnvironment?.id : null}
|
||||
isDisabled={!!isOrgLookupDisabled && isGloballyAvailable.current}
|
||||
isDisabled={
|
||||
(!!isOrgLookupDisabled && isGloballyAvailable.current) ||
|
||||
executionEnvironment?.managed
|
||||
}
|
||||
validate={
|
||||
!me?.is_superuser
|
||||
? required(t`Select a value for this field`)
|
||||
@ -93,6 +96,7 @@ function ExecutionEnvironmentFormFields({
|
||||
type="text"
|
||||
validate={required(null)}
|
||||
isRequired
|
||||
isDisabled={executionEnvironment?.managed || false}
|
||||
/>
|
||||
<FormField
|
||||
id="execution-environment-image"
|
||||
@ -101,6 +105,7 @@ function ExecutionEnvironmentFormFields({
|
||||
type="text"
|
||||
validate={required(null)}
|
||||
isRequired
|
||||
isDisabled={executionEnvironment?.managed || false}
|
||||
tooltip={
|
||||
<span>
|
||||
{t`The full image location, including the container registry, image name, and version tag.`}
|
||||
@ -142,6 +147,7 @@ function ExecutionEnvironmentFormFields({
|
||||
label={t`Description`}
|
||||
name="description"
|
||||
type="text"
|
||||
isDisabled={executionEnvironment?.managed || false}
|
||||
/>
|
||||
{isOrgLookupDisabled && isGloballyAvailable.current ? (
|
||||
<Tooltip
|
||||
@ -162,6 +168,7 @@ function ExecutionEnvironmentFormFields({
|
||||
onChange={onCredentialChange}
|
||||
value={credentialField.value}
|
||||
tooltip={t`Credential to authenticate with a protected container registry.`}
|
||||
isDisabled={executionEnvironment?.managed || false}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -271,4 +271,46 @@ describe('<ExecutionEnvironmentForm/>', () => {
|
||||
newWrapper.update();
|
||||
expect(newWrapper.find('OrganizationLookup').prop('value')).toEqual(null);
|
||||
});
|
||||
|
||||
test('should disable edition for managed EEs, except pull option', async () => {
|
||||
let newWrapper;
|
||||
await act(async () => {
|
||||
newWrapper = mountWithContexts(
|
||||
<ExecutionEnvironmentForm
|
||||
onCancel={onCancel}
|
||||
onSubmit={onSubmit}
|
||||
executionEnvironment={{ ...executionEnvironment, managed: true }}
|
||||
options={mockOptions}
|
||||
me={mockMe}
|
||||
/>
|
||||
);
|
||||
});
|
||||
await waitForElement(newWrapper, 'ContentLoading', el => el.length === 0);
|
||||
expect(newWrapper.find('OrganizationLookup').prop('isDisabled')).toEqual(
|
||||
true
|
||||
);
|
||||
expect(newWrapper.find('CredentialLookup').prop('isDisabled')).toEqual(
|
||||
true
|
||||
);
|
||||
expect(
|
||||
newWrapper
|
||||
.find('TextInputBase[id="execution-environment-name"]')
|
||||
.prop('isDisabled')
|
||||
).toEqual(true);
|
||||
expect(
|
||||
newWrapper
|
||||
.find('TextInputBase[id="execution-environment-description"]')
|
||||
.prop('isDisabled')
|
||||
).toEqual(true);
|
||||
expect(
|
||||
newWrapper
|
||||
.find('TextInputBase[id="execution-environment-image"]')
|
||||
.prop('isDisabled')
|
||||
).toEqual(true);
|
||||
expect(
|
||||
newWrapper
|
||||
.find('FormSelect[id="container-pull-options"]')
|
||||
.prop('isDisabled')
|
||||
).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user