1- import React , { useState , useEffect } from 'react' ;
1+ import React , { useEffect } from 'react' ;
22import propTypes from 'prop-types' ;
33import { useSelector , shallowEqual } from 'react-redux' ;
44import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api' ;
55import {
66 Text ,
77 TextContent ,
88 Stack ,
9- StackItem ,
10- Radio ,
11- TextVariants
9+ StackItem
1210} from '@patternfly/react-core' ;
1311import { intl } from '../../../Utilities/IntlProvider' ;
1412import messages from '../../../Messages' ;
15- import SelectExistingSets from '../InputFields/SelectExistingSets' ;
1613import 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
10251ConfigurationStepFields . propTypes = {
103- systemsIDs : propTypes . array ,
10452 patchSetID : propTypes . string
10553} ;
10654export default ConfigurationStepFields ;
0 commit comments