mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 14:27:42 -02:30
Adds a link to the ee migration docs in a popover when ee is missing
This commit is contained in:
committed by
Shane McDonald
parent
4a85983eb7
commit
7c72be7025
@@ -1,10 +1,9 @@
|
|||||||
import 'styled-components/macro';
|
import 'styled-components/macro';
|
||||||
import React, { useState, useCallback } from 'react';
|
import React, { useState, useCallback } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Button, Tooltip, Chip } from '@patternfly/react-core';
|
import { Button, Popover, Tooltip, Chip } from '@patternfly/react-core';
|
||||||
import { Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
|
import { Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
|
||||||
import { t } from '@lingui/macro';
|
import { t, Trans } from '@lingui/macro';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ExclamationTriangleIcon,
|
ExclamationTriangleIcon,
|
||||||
PencilAltIcon,
|
PencilAltIcon,
|
||||||
@@ -12,25 +11,28 @@ import {
|
|||||||
RocketIcon,
|
RocketIcon,
|
||||||
} from '@patternfly/react-icons';
|
} from '@patternfly/react-icons';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { ActionsTd, ActionItem } from '../PaginatedTable';
|
import { ActionsTd, ActionItem } from '../PaginatedTable';
|
||||||
import { DetailList, Detail, DeletedDetail } from '../DetailList';
|
import { DetailList, Detail, DeletedDetail } from '../DetailList';
|
||||||
import ChipGroup from '../ChipGroup';
|
import ChipGroup from '../ChipGroup';
|
||||||
import CredentialChip from '../CredentialChip';
|
import CredentialChip from '../CredentialChip';
|
||||||
import ExecutionEnvironmentDetail from '../ExecutionEnvironmentDetail';
|
import ExecutionEnvironmentDetail from '../ExecutionEnvironmentDetail';
|
||||||
import { timeOfDay, formatDateString } from '../../util/dates';
|
import { timeOfDay, formatDateString } from '../../util/dates';
|
||||||
|
|
||||||
import { JobTemplatesAPI, WorkflowJobTemplatesAPI } from '../../api';
|
import { JobTemplatesAPI, WorkflowJobTemplatesAPI } from '../../api';
|
||||||
import { LaunchButton } from '../LaunchButton';
|
import { LaunchButton } from '../LaunchButton';
|
||||||
import Sparkline from '../Sparkline';
|
import Sparkline from '../Sparkline';
|
||||||
import { toTitleCase } from '../../util/strings';
|
import { toTitleCase } from '../../util/strings';
|
||||||
import CopyButton from '../CopyButton';
|
import CopyButton from '../CopyButton';
|
||||||
|
import getDocsBaseUrl from '../../util/getDocsBaseUrl';
|
||||||
|
import { useConfig } from '../../contexts/Config';
|
||||||
|
|
||||||
const ExclamationTriangleIconWarning = styled(ExclamationTriangleIcon)`
|
const ExclamationTriangleIconWarning = styled(ExclamationTriangleIcon)`
|
||||||
color: var(--pf-global--warning-color--100);
|
color: var(--pf-global--warning-color--100);
|
||||||
margin-left: 18px;
|
margin-left: 18px;
|
||||||
|
cursor: pointer;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
ExclamationTriangleIconWarning.displayName = 'ExclamationTriangleIconWarning';
|
||||||
|
|
||||||
function TemplateListItem({
|
function TemplateListItem({
|
||||||
template,
|
template,
|
||||||
isSelected,
|
isSelected,
|
||||||
@@ -39,10 +41,15 @@ function TemplateListItem({
|
|||||||
fetchTemplates,
|
fetchTemplates,
|
||||||
rowIndex,
|
rowIndex,
|
||||||
}) {
|
}) {
|
||||||
|
const config = useConfig();
|
||||||
const [isExpanded, setIsExpanded] = useState(false);
|
const [isExpanded, setIsExpanded] = useState(false);
|
||||||
const [isDisabled, setIsDisabled] = useState(false);
|
const [isDisabled, setIsDisabled] = useState(false);
|
||||||
const labelId = `check-action-${template.id}`;
|
const labelId = `check-action-${template.id}`;
|
||||||
|
|
||||||
|
const docsLink = `${getDocsBaseUrl(
|
||||||
|
config
|
||||||
|
)}/html/upgrade-migration-guide/upgrade_to_ees.html`;
|
||||||
|
|
||||||
const copyTemplate = useCallback(async () => {
|
const copyTemplate = useCallback(async () => {
|
||||||
if (template.type === 'job_template') {
|
if (template.type === 'job_template') {
|
||||||
await JobTemplatesAPI.copy(template.id, {
|
await JobTemplatesAPI.copy(template.id, {
|
||||||
@@ -139,13 +146,29 @@ function TemplateListItem({
|
|||||||
)}
|
)}
|
||||||
{missingExecutionEnvironment && (
|
{missingExecutionEnvironment && (
|
||||||
<span>
|
<span>
|
||||||
<Tooltip
|
<Popover
|
||||||
className="missing-execution-environment"
|
className="missing-execution-environment"
|
||||||
content={t`Custom virtual environment ${template.custom_virtualenv} must be replaced by an execution environment.`}
|
headerContent={<div>{t`Execution Environment Missing`}</div>}
|
||||||
|
bodyContent={
|
||||||
|
<div>
|
||||||
|
<Trans>
|
||||||
|
Custom virtual environment {template.custom_virtualenv}{' '}
|
||||||
|
must be replaced by an execution environment. For more
|
||||||
|
information about migrating to execution environments see{' '}
|
||||||
|
<a
|
||||||
|
href={docsLink}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
the documentation.
|
||||||
|
</a>
|
||||||
|
</Trans>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
position="right"
|
position="right"
|
||||||
>
|
>
|
||||||
<ExclamationTriangleIconWarning />
|
<ExclamationTriangleIconWarning />
|
||||||
</Tooltip>
|
</Popover>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</Td>
|
</Td>
|
||||||
|
|||||||
@@ -371,11 +371,8 @@ describe('<TemplateListItem />', () => {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
expect(
|
|
||||||
wrapper.find('.missing-execution-environment').prop('content')
|
expect(wrapper.find('ExclamationTriangleIconWarning').length).toBe(1);
|
||||||
).toEqual(
|
|
||||||
'Custom virtual environment /var/lib/awx/env must be replaced by an execution environment.'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render expected details in expanded section', async () => {
|
test('should render expected details in expanded section', async () => {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user