@@ -9,8 +9,15 @@ import {
99import { ToggleField } from '../common/FormElement' ;
1010import styles from './index.module.scss' ;
1111import { useService } from './useService' ;
12+ import { routePaths } from '../../../routes/routePaths' ;
13+ import { useSelector } from 'react-redux' ;
14+ import { secretSelectors , workspaceSelectors } from '../../../redux/selectors' ;
15+ import { useHistory } from '../../hooks' ;
1216
1317export const NonEditableConfig : React . FC < { details : any } > = ( { details } ) => {
18+ const secrets = useSelector ( secretSelectors . mySecrets ) ;
19+ const selectedWorkspace = useSelector ( workspaceSelectors . selectedWorkspace ) ;
20+ const history = useHistory ( ) ;
1421 const { flavor } = useService ( {
1522 details,
1623 } ) ;
@@ -27,12 +34,26 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
2734
2835 const getFormElement : any = ( elementName : any , elementSchema : any ) => {
2936 if ( flavor ?. config_schema ?. properties [ elementName ] ?. type === 'string' ) {
37+ const extracted = elementSchema . split ( / \. / ) [ 0 ] ;
38+ const secretName = extracted . replace ( / { { | } } | \. / g, '' ) . trim ( ) ;
39+ const filteredSecret = secrets ?. filter (
40+ ( item ) => item . name === secretName ,
41+ ) ;
3042 return (
3143 < >
3244 { flavor ?. config_schema ?. properties [ elementName ] . sensitive ? (
33- < Box marginTop = "lg" style = { { width : '417px ' } } >
45+ < Box marginTop = "lg" style = { { width : '30vw ' } } >
3446 < EditField
3547 disabled
48+ viewSecretDetail = { ( ) => {
49+ history . push (
50+ routePaths . secret . configuration (
51+ filteredSecret [ 0 ] ?. id ,
52+ selectedWorkspace ,
53+ ) ,
54+ ) ;
55+ } }
56+ filteredSecretId = { filteredSecret [ 0 ] ?. id }
3657 // onKeyDown={(e: any) => onPressEnter(e, 'string', elementName)}
3758 // onChangeText={(e: any) => onPressEnter(e, 'string', elementName)}
3859 label = { titleCase ( elementName ) + ' (Secret)' }
@@ -44,7 +65,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
4465 />
4566 </ Box >
4667 ) : (
47- < Box marginTop = "lg" style = { { width : '417px ' } } >
68+ < Box marginTop = "lg" style = { { width : '30vw ' } } >
4869 < EditField
4970 disabled
5071 // onKeyDown={(e: any) => onPressEnter(e, 'string', elementName)}
@@ -75,7 +96,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
7596 < label htmlFor = "key" > { titleCase ( elementName ) } </ label >
7697 </ Paragraph >
7798 </ Box >
78- < FlexBox marginTop = "sm" style = { { width : '417px ' } } >
99+ < FlexBox marginTop = "sm" style = { { width : '30vw ' } } >
79100 < textarea
80101 disabled
81102 className = { styles . textArea }
@@ -118,7 +139,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
118139 // }
119140 if ( flavor ?. config_schema ?. properties [ elementName ] ?. type === 'object' ) {
120141 return (
121- < Box marginTop = "lg" style = { { width : '417px ' } } >
142+ < Box marginTop = "lg" style = { { width : '30vw ' } } >
122143 < Paragraph size = "body" style = { { color : 'black' } } >
123144 < label htmlFor = { elementName } > { titleCase ( elementName ) } </ label >
124145 </ Paragraph >
@@ -144,7 +165,10 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
144165 >
145166 < FlexBox . Row >
146167 < Box
147- style = { { display : 'flex' , alignItems : 'center' } }
168+ style = { {
169+ display : 'flex' ,
170+ alignItems : 'center' ,
171+ } }
148172 marginTop = "sm"
149173 >
150174 < div
@@ -228,7 +252,11 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
228252 { Object . entries ( elementSchema ) . map ( ( [ key , value ] , index ) => (
229253 < FlexBox . Row >
230254 < Box
231- style = { { display : 'flex' , alignItems : 'center' } }
255+ style = { {
256+ display : 'flex' ,
257+ alignItems : 'center' ,
258+ width : '29.8vw' ,
259+ } }
232260 marginTop = "sm"
233261 >
234262 < div
@@ -342,7 +370,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
342370 ➤
343371 </ div >
344372
345- < div className = "form-group" style = { { width : '390px ' } } >
373+ < div className = "form-group" style = { { width : '28.3vw ' } } >
346374 < EditField
347375 disabled
348376 className = { styles . field }
@@ -454,7 +482,7 @@ export const NonEditableConfig: React.FC<{ details: any }> = ({ details }) => {
454482 < FlexBox . Column marginTop = "xl" fullWidth >
455483 < FlexBox . Row flexDirection = "column" >
456484 { /* <Container> */ }
457- < Box style = { { width : '417px ' } } >
485+ < Box style = { { width : '30vw ' } } >
458486 < EditField
459487 disabled
460488 onChangeText = { ( ) => console . log ( '' ) }
0 commit comments