mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 20:35:02 -02:30
Merge pull request #11003 from AlexSCorey/5252-tower-Settings-deprecation
Adds deprecation banner
This commit is contained in:
@@ -2,8 +2,9 @@ import React, { useEffect, useCallback } from 'react';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Button } from '@patternfly/react-core';
|
import { Button, Alert as PFAlert } from '@patternfly/react-core';
|
||||||
import { CaretLeftIcon } from '@patternfly/react-icons';
|
import { CaretLeftIcon } from '@patternfly/react-icons';
|
||||||
|
import styled from 'styled-components';
|
||||||
import { CardBody, CardActionsRow } from 'components/Card';
|
import { CardBody, CardActionsRow } from 'components/Card';
|
||||||
import ContentLoading from 'components/ContentLoading';
|
import ContentLoading from 'components/ContentLoading';
|
||||||
import ContentError from 'components/ContentError';
|
import ContentError from 'components/ContentError';
|
||||||
@@ -15,6 +16,10 @@ import { useConfig } from 'contexts/Config';
|
|||||||
import { useSettings } from 'contexts/Settings';
|
import { useSettings } from 'contexts/Settings';
|
||||||
import { SettingDetail } from '../../shared';
|
import { SettingDetail } from '../../shared';
|
||||||
|
|
||||||
|
const Alert = styled(PFAlert)`
|
||||||
|
margin-bottom: 20px;
|
||||||
|
`;
|
||||||
|
|
||||||
function RADIUSDetail() {
|
function RADIUSDetail() {
|
||||||
const { me } = useConfig();
|
const { me } = useConfig();
|
||||||
const { GET: options } = useSettings();
|
const { GET: options } = useSettings();
|
||||||
@@ -61,22 +66,30 @@ function RADIUSDetail() {
|
|||||||
{isLoading && <ContentLoading />}
|
{isLoading && <ContentLoading />}
|
||||||
{!isLoading && error && <ContentError error={error} />}
|
{!isLoading && error && <ContentError error={error} />}
|
||||||
{!isLoading && radius && (
|
{!isLoading && radius && (
|
||||||
<DetailList>
|
<>
|
||||||
{Object.keys(radius).map((key) => {
|
<Alert
|
||||||
const record = options?.[key];
|
variant="info"
|
||||||
return (
|
isInline
|
||||||
<SettingDetail
|
data-cy="RADIUS-deprecation-warning"
|
||||||
key={key}
|
title={t`This feature is deprecated and will be removed in a future release.`}
|
||||||
id={key}
|
/>
|
||||||
helpText={record?.help_text}
|
<DetailList>
|
||||||
label={record?.label}
|
{Object.keys(radius).map((key) => {
|
||||||
type={record?.type}
|
const record = options?.[key];
|
||||||
unit={record?.unit}
|
return (
|
||||||
value={radius?.[key]}
|
<SettingDetail
|
||||||
/>
|
key={key}
|
||||||
);
|
id={key}
|
||||||
})}
|
helpText={record?.help_text}
|
||||||
</DetailList>
|
label={record?.label}
|
||||||
|
type={record?.type}
|
||||||
|
unit={record?.unit}
|
||||||
|
value={radius?.[key]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</DetailList>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
{me?.is_superuser && (
|
{me?.is_superuser && (
|
||||||
<CardActionsRow>
|
<CardActionsRow>
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ describe('<RADIUSDetail />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should render expected details', () => {
|
test('should render expected details', () => {
|
||||||
|
expect(wrapper.find('Alert').prop('title')).toBe(
|
||||||
|
'This feature is deprecated and will be removed in a future release.'
|
||||||
|
);
|
||||||
assertDetail(wrapper, 'RADIUS Server', 'example.org');
|
assertDetail(wrapper, 'RADIUS Server', 'example.org');
|
||||||
assertDetail(wrapper, 'RADIUS Port', '1812');
|
assertDetail(wrapper, 'RADIUS Port', '1812');
|
||||||
assertDetail(wrapper, 'RADIUS Secret', 'Encrypted');
|
assertDetail(wrapper, 'RADIUS Secret', 'Encrypted');
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ import React, { useEffect, useCallback } from 'react';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { Button } from '@patternfly/react-core';
|
import { Button, Alert as PFAlert } from '@patternfly/react-core';
|
||||||
import { CaretLeftIcon } from '@patternfly/react-icons';
|
import { CaretLeftIcon } from '@patternfly/react-icons';
|
||||||
|
import styled from 'styled-components';
|
||||||
import { CardBody, CardActionsRow } from 'components/Card';
|
import { CardBody, CardActionsRow } from 'components/Card';
|
||||||
import ContentLoading from 'components/ContentLoading';
|
import ContentLoading from 'components/ContentLoading';
|
||||||
import ContentError from 'components/ContentError';
|
import ContentError from 'components/ContentError';
|
||||||
@@ -15,6 +16,10 @@ import { useConfig } from 'contexts/Config';
|
|||||||
import { useSettings } from 'contexts/Settings';
|
import { useSettings } from 'contexts/Settings';
|
||||||
import { SettingDetail } from '../../shared';
|
import { SettingDetail } from '../../shared';
|
||||||
|
|
||||||
|
const Alert = styled(PFAlert)`
|
||||||
|
margin-bottom: 20px;
|
||||||
|
`;
|
||||||
|
|
||||||
function TACACSDetail() {
|
function TACACSDetail() {
|
||||||
const { me } = useConfig();
|
const { me } = useConfig();
|
||||||
const { GET: options } = useSettings();
|
const { GET: options } = useSettings();
|
||||||
@@ -53,7 +58,12 @@ function TACACSDetail() {
|
|||||||
id: 0,
|
id: 0,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
if (isLoading) {
|
||||||
|
return <ContentLoading />;
|
||||||
|
}
|
||||||
|
if (!isLoading && error) {
|
||||||
|
return <ContentError error={error} />;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<RoutedTabs tabsArray={tabsArray} />
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
@@ -61,22 +71,30 @@ function TACACSDetail() {
|
|||||||
{isLoading && <ContentLoading />}
|
{isLoading && <ContentLoading />}
|
||||||
{!isLoading && error && <ContentError error={error} />}
|
{!isLoading && error && <ContentError error={error} />}
|
||||||
{!isLoading && tacacs && (
|
{!isLoading && tacacs && (
|
||||||
<DetailList>
|
<>
|
||||||
{Object.keys(tacacs).map((key) => {
|
<Alert
|
||||||
const record = options?.[key];
|
variant="info"
|
||||||
return (
|
isInline
|
||||||
<SettingDetail
|
data-cy="TACACS-deprecation-warning"
|
||||||
key={key}
|
title={t`This feature is deprecated and will be removed in a future release.`}
|
||||||
id={key}
|
/>
|
||||||
helpText={record?.help_text}
|
<DetailList>
|
||||||
label={record?.label}
|
{Object.keys(tacacs).map((key) => {
|
||||||
type={record?.type}
|
const record = options?.[key];
|
||||||
unit={record?.unit}
|
return (
|
||||||
value={tacacs?.[key]}
|
<SettingDetail
|
||||||
/>
|
key={key}
|
||||||
);
|
id={key}
|
||||||
})}
|
helpText={record?.help_text}
|
||||||
</DetailList>
|
label={record?.label}
|
||||||
|
type={record?.type}
|
||||||
|
unit={record?.unit}
|
||||||
|
value={tacacs?.[key]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</DetailList>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
{me?.is_superuser && (
|
{me?.is_superuser && (
|
||||||
<CardActionsRow>
|
<CardActionsRow>
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ describe('<TACACSDetail />', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should render expected details', () => {
|
test('should render expected details', () => {
|
||||||
|
expect(wrapper.find('Alert').prop('title')).toBe(
|
||||||
|
'This feature is deprecated and will be removed in a future release.'
|
||||||
|
);
|
||||||
assertDetail(wrapper, 'TACACS+ Server', 'mockhost');
|
assertDetail(wrapper, 'TACACS+ Server', 'mockhost');
|
||||||
assertDetail(wrapper, 'TACACS+ Port', '49');
|
assertDetail(wrapper, 'TACACS+ Port', '49');
|
||||||
assertDetail(wrapper, 'TACACS+ Secret', 'Encrypted');
|
assertDetail(wrapper, 'TACACS+ Secret', 'Encrypted');
|
||||||
|
|||||||
Reference in New Issue
Block a user