1
- import React , { useState , useEffect } from 'react' ;
1
+ import React , { useEffect } from 'react' ;
2
2
import propTypes from 'prop-types' ;
3
3
import { useSelector , shallowEqual } from 'react-redux' ;
4
4
import useFormApi from '@data-driven-forms/react-form-renderer/use-form-api' ;
5
5
import {
6
6
Text ,
7
7
TextContent ,
8
8
Stack ,
9
- StackItem ,
10
- Radio ,
11
- TextVariants
9
+ StackItem
12
10
} from '@patternfly/react-core' ;
13
11
import { intl } from '../../../Utilities/IntlProvider' ;
14
12
import messages from '../../../Messages' ;
15
- import SelectExistingSets from '../InputFields/SelectExistingSets' ;
16
13
import ConfigurationFields from '../InputFields/ConfigurationFields' ;
17
14
18
- const ConfigurationStepFields = ( { systemsIDs , patchSetID } ) => {
15
+ const ConfigurationStepFields = ( { patchSetID } ) => {
19
16
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 ( [ ] ) ;
26
17
27
18
const { patchSet, status, areTakenTemplateNamesLoading } =
28
19
useSelector ( ( { SpecificPatchSetReducer } ) => SpecificPatchSetReducer , shallowEqual ) ;
29
20
30
- const handleRadioChange = ( ) => {
31
- setShouldCreateNew ( ! shouldCreateNew ) ;
32
- setShouldApplyExisting ( ! shouldApplyExisting ) ;
33
- } ;
34
-
35
21
useEffect ( ( ) => {
36
22
if ( patchSetID ) {
37
23
const { name, description } = patchSet ;
@@ -53,54 +39,16 @@ const ConfigurationStepFields = ({ systemsIDs, patchSetID }) => {
53
39
< StackItem >
54
40
{ intl . formatMessage ( messages . templateDetailStepText ) }
55
41
</ 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 > }
64
42
< 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
+ />
97
46
</ StackItem >
98
47
</ Stack >
99
48
) ;
100
49
} ;
101
50
102
51
ConfigurationStepFields . propTypes = {
103
- systemsIDs : propTypes . array ,
104
52
patchSetID : propTypes . string
105
53
} ;
106
54
export default ConfigurationStepFields ;
0 commit comments