Skip to content

Commit 557e4e0

Browse files
committed
refactor(TemplateWizard): Remove obsolete code
1 parent 6d3c8de commit 557e4e0

File tree

6 files changed

+6
-86
lines changed

6 files changed

+6
-86
lines changed

src/PresentationalComponents/Snippets/EmptyStates.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ export const NoPatchSetList = ({ Button }) => (
8181
{intl.formatMessage(messages.statesNoTemplateBody)}
8282
<br />
8383
<br />
84-
{/*
85-
<a href={TEMPLATES_DOCS_LINK} target="__blank" rel="noopener noreferrer">
86-
{intl.formatMessage(messages.statesNoTemplateLink)} <ExternalLinkAltIcon />
87-
</a>
88-
<br />
89-
<br />
90-
*/}
9184
<Button />
9285
</EmptyStateBody>
9386
</EmptyState>

src/SmartComponents/PatchSet/PatchSet.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,6 @@ const PatchSet = () => {
178178
bodyContent={
179179
intl.formatMessage(messages.templatePopoverBody)
180180
}
181-
/*
182-
footerContent={
183-
<a href={TEMPLATES_DOCS_LINK} target="__blank" rel="noopener noreferrer">
184-
{intl.formatMessage(messages.linksLearnMore)} <ExternalLinkAltIcon />
185-
</a>
186-
}
187-
*/
188181
>
189182
<Icon>
190183
<OutlinedQuestionCircleIcon

src/SmartComponents/PatchSetWizard/PatchSetWizard.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export const PatchSetWizard = ({ systemsIDs, setBaselineState, patchSetID }) =>
7777
},
7878
configurationStep: {
7979
component: ConfigurationStepFields,
80-
systemsIDs: systemsIDs || [],
8180
patchSetID
8281
},
8382
reviewSystems: {
@@ -129,11 +128,6 @@ export const PatchSetWizard = ({ systemsIDs, setBaselineState, patchSetID }) =>
129128
description={
130129
<Fragment>
131130
{intl.formatMessage(messages.templateDescription)}
132-
{/*<a href={TEMPLATES_DOCS_LINK} target="__blank" rel="noopener noreferrer"
133-
className="pf-v5-u-ml-sm">
134-
{intl.formatMessage(messages.labelsDocumentation)}
135-
<ExternalLinkAltIcon className="pf-v5-u-ml-xs"/>
136-
</a>*/}
137131
</Fragment>
138132
}
139133
steps={[

src/SmartComponents/PatchSetWizard/WizardAssets.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ export const schema = (wizardType) => {
101101
title: getWizardTitle(wizardType),
102102
description: <Fragment>
103103
{intl.formatMessage(messages.templateDescription)}
104-
{/*
105-
<a href={TEMPLATES_DOCS_LINK} target="__blank" rel="noopener noreferrer" className="pf-v5-u-ml-sm">
106-
{intl.formatMessage(messages.labelsDocumentation)}
107-
<ExternalLinkAltIcon className="pf-v5-u-ml-xs"/>
108-
</a>*/}
109104
</Fragment>,
110105
fields: [
111106
{
Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,23 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useEffect } from 'react';
22
import propTypes from 'prop-types';
33
import { useSelector, shallowEqual } from 'react-redux';
44
import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api';
55
import {
66
Text,
77
TextContent,
88
Stack,
9-
StackItem,
10-
Radio,
11-
TextVariants
9+
StackItem
1210
} from '@patternfly/react-core';
1311
import { intl } from '../../../Utilities/IntlProvider';
1412
import messages from '../../../Messages';
15-
import SelectExistingSets from '../InputFields/SelectExistingSets';
1613
import ConfigurationFields from '../InputFields/ConfigurationFields';
1714

18-
const ConfigurationStepFields = ({ systemsIDs, patchSetID }) => {
15+
const ConfigurationStepFields = ({ patchSetID }) => {
1916
const formOptions = useFormApi();
20-
// TODO: Cleanup this unused code later
21-
const shouldShowRadioButtons = false;
22-
23-
const [shouldApplyExisting, setShouldApplyExisting] = useState(false);
24-
const [shouldCreateNew, setShouldCreateNew] = useState(true);
25-
const [selectedPatchSet, setSelectedPatchSet] = useState([]);
2617

2718
const { patchSet, status, areTakenTemplateNamesLoading } =
2819
useSelector(({ SpecificPatchSetReducer }) => SpecificPatchSetReducer, shallowEqual);
2920

30-
const handleRadioChange = () => {
31-
setShouldCreateNew(!shouldCreateNew);
32-
setShouldApplyExisting(!shouldApplyExisting);
33-
};
34-
3521
useEffect(() => {
3622
if (patchSetID) {
3723
const { name, description } = patchSet;
@@ -53,54 +39,16 @@ const ConfigurationStepFields = ({ systemsIDs, patchSetID }) => {
5339
<StackItem>
5440
{intl.formatMessage(messages.templateDetailStepText)}
5541
</StackItem>
56-
{shouldShowRadioButtons && <TextContent style={{ marginTop: '-15px' }}>
57-
<Text component={TextVariants.p}>
58-
{intl.formatMessage(
59-
messages.textTemplateSelectedSystems,
60-
{ systemsCount: systemsIDs.length, b: (...chunks) => <b>{chunks}</b> }
61-
)}
62-
</Text>
63-
</TextContent>}
6442
<StackItem>
65-
<Stack hasGutter>
66-
{shouldShowRadioButtons && (<><StackItem>
67-
<Radio
68-
isChecked={shouldApplyExisting}
69-
name="radio"
70-
onChange={handleRadioChange}
71-
label={intl.formatMessage(messages.textTemplateAddToExisting)}
72-
id="existing-template"
73-
/>
74-
</StackItem>
75-
<StackItem>
76-
{shouldApplyExisting ? <SelectExistingSets
77-
setSelectedPatchSet={setSelectedPatchSet}
78-
selectedSets={selectedPatchSet}
79-
systems={systemsIDs}
80-
/> : null}
81-
</StackItem>
82-
<StackItem>
83-
<Radio
84-
isChecked={shouldCreateNew}
85-
name="radio"
86-
onChange={handleRadioChange}
87-
label={intl.formatMessage(messages.textTemplateCreateNew)}
88-
id="new-template"
89-
/>
90-
</StackItem></>) || null}
91-
<StackItem>
92-
{shouldCreateNew ? <ConfigurationFields
93-
isLoading={(patchSetID && status.isLoading) || areTakenTemplateNamesLoading}
94-
/> : null}
95-
</StackItem>
96-
</Stack>
43+
<ConfigurationFields
44+
isLoading={(patchSetID && status.isLoading) || areTakenTemplateNamesLoading}
45+
/>
9746
</StackItem>
9847
</Stack>
9948
);
10049
};
10150

10251
ConfigurationStepFields.propTypes = {
103-
systemsIDs: propTypes.array,
10452
patchSetID: propTypes.string
10553
};
10654
export default ConfigurationStepFields;

src/Utilities/constants.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,4 @@ export const featureFlags = {
311311
patch_set: 'patch.patch_set'
312312
};
313313

314-
export const TEMPLATES_DOCS_LINK = 'https://access.redhat.com/documentation/en-us/red_hat_insights/2022/html/'
315-
+ 'system_patching_using_ansible_playbooks_via_remediations/index';
316-
317314
export const NO_ADVISORIES_TEXT = 'There is no installable content that can be remediated with Ansible for selected systems.';

0 commit comments

Comments
 (0)