mirror of
https://github.com/ansible/awx.git
synced 2026-05-06 08:57:35 -02:30
Update subscription docs link to use single source of truth
This commit is contained in:
@@ -3,6 +3,7 @@ import { withI18n } from '@lingui/react';
|
|||||||
import { Trans, t } from '@lingui/macro';
|
import { Trans, t } from '@lingui/macro';
|
||||||
import { useField } from 'formik';
|
import { useField } from 'formik';
|
||||||
import { Button, Flex, FormGroup } from '@patternfly/react-core';
|
import { Button, Flex, FormGroup } from '@patternfly/react-core';
|
||||||
|
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
|
||||||
import { required } from '../../../../util/validators';
|
import { required } from '../../../../util/validators';
|
||||||
import FormField, {
|
import FormField, {
|
||||||
CheckboxField,
|
CheckboxField,
|
||||||
@@ -49,7 +50,9 @@ function AnalyticsStep({ i18n }) {
|
|||||||
more information, see{' '}
|
more information, see{' '}
|
||||||
<Button
|
<Button
|
||||||
component="a"
|
component="a"
|
||||||
href="http://docs.ansible.com/ansible-tower/latest/html/installandreference/user-data.html#index-0"
|
href={`${getDocsBaseUrl(
|
||||||
|
config
|
||||||
|
)}/html/installandreference/user-data.html#index-0`}
|
||||||
variant="link"
|
variant="link"
|
||||||
isInline
|
isInline
|
||||||
ouiaId="tower-documentation-link"
|
ouiaId="tower-documentation-link"
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ const emptyConfig = {
|
|||||||
license_info: {
|
license_info: {
|
||||||
valid_key: false,
|
valid_key: false,
|
||||||
},
|
},
|
||||||
|
setConfig: jest.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('<SubscriptionEdit />', () => {
|
describe('<SubscriptionEdit />', () => {
|
||||||
@@ -157,8 +158,9 @@ describe('<SubscriptionEdit />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('clicking next button should show analytics step', async () => {
|
test('clicking next button should show analytics step', async () => {
|
||||||
|
wrapper.update();
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Button[children="Next"]').simulate('click');
|
wrapper.find('button#subscription-wizard-next').simulate('click');
|
||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
expect(wrapper.find('AnalyticsStep').length).toBe(1);
|
expect(wrapper.find('AnalyticsStep').length).toBe(1);
|
||||||
@@ -185,27 +187,27 @@ describe('<SubscriptionEdit />', () => {
|
|||||||
|
|
||||||
test('clicking next button should show eula step', async () => {
|
test('clicking next button should show eula step', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Button[children="Next"]').simulate('click');
|
wrapper.find('button#subscription-wizard-next').simulate('click');
|
||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
expect(wrapper.find('EulaStep').length).toBe(1);
|
expect(wrapper.find('EulaStep').length).toBe(1);
|
||||||
expect(wrapper.find('CheckboxField').length).toBe(1);
|
expect(wrapper.find('CheckboxField').length).toBe(1);
|
||||||
expect(wrapper.find('Button[children="Submit"]').length).toBe(1);
|
expect(wrapper.find('button#subscription-wizard-submit').length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('checking EULA agreement should enable Submit button', async () => {
|
test('checking EULA agreement should enable Submit button', async () => {
|
||||||
expect(wrapper.find('Button[children="Submit"]').prop('isDisabled')).toBe(
|
expect(
|
||||||
true
|
wrapper.find('button#subscription-wizard-submit').prop('disabled')
|
||||||
);
|
).toBe(true);
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Checkbox[name="eula"] input').simulate('change', {
|
wrapper.find('Checkbox[name="eula"] input').simulate('change', {
|
||||||
target: { value: true, name: 'eula' },
|
target: { value: true, name: 'eula' },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
expect(wrapper.find('Button[children="Submit"]').prop('isDisabled')).toBe(
|
expect(
|
||||||
false
|
wrapper.find('button#subscription-wizard-submit').prop('disabled')
|
||||||
);
|
).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should successfully save on form submission', async () => {
|
test('should successfully save on form submission', async () => {
|
||||||
@@ -271,6 +273,7 @@ describe('<SubscriptionEdit />', () => {
|
|||||||
context: {
|
context: {
|
||||||
config: {
|
config: {
|
||||||
mockConfig,
|
mockConfig,
|
||||||
|
setConfig: jest.fn(),
|
||||||
},
|
},
|
||||||
me: {
|
me: {
|
||||||
is_superuser: true,
|
is_superuser: true,
|
||||||
@@ -370,7 +373,7 @@ describe('<SubscriptionEdit />', () => {
|
|||||||
});
|
});
|
||||||
test('next should skip analytics step and navigate to eula step', async () => {
|
test('next should skip analytics step and navigate to eula step', async () => {
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Button[children="Next"]').simulate('click');
|
wrapper.find('button#subscription-wizard-next').simulate('click');
|
||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
expect(wrapper.find('SubscriptionStep').length).toBe(0);
|
expect(wrapper.find('SubscriptionStep').length).toBe(0);
|
||||||
@@ -379,18 +382,18 @@ describe('<SubscriptionEdit />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('submit should be disabled until EULA agreement checked', async () => {
|
test('submit should be disabled until EULA agreement checked', async () => {
|
||||||
expect(wrapper.find('Button[children="Submit"]').prop('isDisabled')).toBe(
|
expect(
|
||||||
true
|
wrapper.find('button#subscription-wizard-submit').prop('disabled')
|
||||||
);
|
).toBe(true);
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
wrapper.find('Checkbox[name="eula"] input').simulate('change', {
|
wrapper.find('Checkbox[name="eula"] input').simulate('change', {
|
||||||
target: { value: true, name: 'eula' },
|
target: { value: true, name: 'eula' },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
expect(wrapper.find('Button[children="Submit"]').prop('isDisabled')).toBe(
|
expect(
|
||||||
false
|
wrapper.find('button#subscription-wizard-submit').prop('disabled')
|
||||||
);
|
).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should successfully send request to api on form submission', async () => {
|
test('should successfully send request to api on form submission', async () => {
|
||||||
@@ -420,7 +423,7 @@ describe('<SubscriptionEdit />', () => {
|
|||||||
el => el.length === 0
|
el => el.length === 0
|
||||||
);
|
);
|
||||||
await act(async () =>
|
await act(async () =>
|
||||||
wrapper.find('Button[children="Submit"]').prop('onClick')()
|
wrapper.find('button#subscription-wizard-submit').prop('onClick')()
|
||||||
);
|
);
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
waitForElement(wrapper, 'Alert[title="Save successful"]');
|
waitForElement(wrapper, 'Alert[title="Save successful"]');
|
||||||
@@ -441,7 +444,7 @@ describe('<SubscriptionEdit />', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.only('should throw a content error', async () => {
|
test('should throw a content error', async () => {
|
||||||
RootAPI.readAssetVariables.mockRejectedValueOnce(new Error());
|
RootAPI.readAssetVariables.mockRejectedValueOnce(new Error());
|
||||||
let wrapper;
|
let wrapper;
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { useConfig } from '../../../../contexts/Config';
|
import { useConfig } from '../../../../contexts/Config';
|
||||||
|
import getDocsBaseUrl from '../../../../util/getDocsBaseUrl';
|
||||||
import useModal from '../../../../util/useModal';
|
import useModal from '../../../../util/useModal';
|
||||||
import FormField, { PasswordField } from '../../../../components/FormField';
|
import FormField, { PasswordField } from '../../../../components/FormField';
|
||||||
import Popover from '../../../../components/Popover';
|
import Popover from '../../../../components/Popover';
|
||||||
@@ -150,7 +151,9 @@ function SubscriptionStep({ i18n }) {
|
|||||||
. For more information, see the{' '}
|
. For more information, see the{' '}
|
||||||
<Button
|
<Button
|
||||||
component="a"
|
component="a"
|
||||||
href="https://docs.ansible.com/ansible-tower/latest/html/userguide/import_license.html"
|
href={`${getDocsBaseUrl(
|
||||||
|
config
|
||||||
|
)}/html/userguide/import_license.html`}
|
||||||
variant="link"
|
variant="link"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
ouiaId="import-license-link"
|
ouiaId="import-license-link"
|
||||||
|
|||||||
Reference in New Issue
Block a user