@@ -23,9 +23,8 @@ export default function ConfigSection(props: ConfigSectionProps) {
2323 }
2424
2525 const SectionHeader = ( ) => {
26-
2726 return (
28- < section className = "mr-1" >
27+ < section className = "text-nowrap mr-1" >
2928 < div className = "custom-control custom-radio" >
3029 < input
3130 className = "custom-control-input"
@@ -34,13 +33,15 @@ export default function ConfigSection(props: ConfigSectionProps) {
3433 value = { props . config . name }
3534 id = { props . config . title || props . config . name }
3635 onChange = { ( ) => {
37- props . setActiveKey ( props . config . name )
3836 props . loadScriptRunner ( props . config )
37+ if ( ! props . config . errorStatus ) {
38+ props . setActiveKey ( props . config . name )
39+ }
3940 props . _paq . push ( [ 'trackEvent' , 'scriptRunnerPlugin' , 'loadScriptRunnerConfig' , props . config . name ] )
4041 } }
41- checked = { props . activeKey === props . config . name }
42+ checked = { ( props . activeConfig && props . activeConfig . name === props . config . name ) }
4243 />
43- < label className = "form-check-label custom-control-label" htmlFor = { `${ props . config . title || props . config . name } ` }
44+ < label className = "pointer form-check-label custom-control-label" htmlFor = { `${ props . config . title || props . config . name } ` }
4445 data-id = { `sr-load-${ props . config . name } ` } >
4546 < div data-id = { `sr-loaded-${ props . config . name } ` } className = "pl-2" > { props . config . title || props . config . name } </ div >
4647 </ label >
@@ -84,50 +85,49 @@ export default function ConfigSection(props: ConfigSectionProps) {
8485 < section className = "mb-2" >
8586 < section className = "d-flex flex-row " >
8687 < SectionHeader />
87- < div >
88- { ! props . config . isLoading && ! props . config . errorStatus && ! props . config . error &&
89- < div onClick = { ( ) => props . loadScriptRunner ( props . config ) } className = "pointer px-2 pb-1" >
90- { props . activeConfig && props . activeConfig . name === props . config . name &&
91- < div className = { `${ ! isVisible ? 'd-flex flex-row align-items-center justify-content-center pt-1' : 'd-flex flex-row pb-1 align-items-center justify-content-center' } ` } >
92- < FontAwesomeIcon data-id = { `sr-loaded-${ props . config . name } ` } className = "text-success ml-3" icon = { faCheck } > </ FontAwesomeIcon >
93- { isVisible && < span onAnimationEnd = { handleAnimationEnd } className = "text-success px-3" style = { { animation : 'fadeOut 5s forwards' , animationFillMode : 'forwards' } } > Config loaded</ span > }
94- </ div >
88+ < label htmlFor = { `${ props . config . title || props . config . name } ` } className = "pointer w-100 d-flex flex-row mb-0" >
89+ < div >
90+ { ! props . config . isLoading && ! props . config . errorStatus && ! props . config . error &&
91+ < div onClick = { ( ) => props . loadScriptRunner ( props . config ) } className = "pointer px-2 pb-1 mb-0 pb-0" >
92+ { props . activeConfig && props . activeConfig . name === props . config . name &&
93+ < div className = "d-flex flex-row mt-1" >
94+ < FontAwesomeIcon data-id = { `sr-loaded-${ props . config . name } ` } className = "text-success ml-3" icon = { faCheck } > </ FontAwesomeIcon >
95+ { isVisible && < span onAnimationEnd = { handleAnimationEnd } className = "text-success px-3 mb-0 pb-0" style = { { animation : 'fadeOut 5s forwards' , animationFillMode : 'forwards' } } > Config loaded</ span > }
96+ </ div >
97+ }
98+ </ div >
9599 }
96100 </ div >
97- }
98- </ div >
99- { props . config . isLoading && < div className = "d-flex flex-row mx-4" >
100- < div className = "d-flex flex-row pb-1 align-items-center justify-content-center" >
101- < i className = "fas fa-spinner fa-spin" > </ i > < span className = 'pl-3' > Loading config</ span >
102- </ div >
103- </ div > }
104- < div className = "ml-4 d-flex" id = "errorSection" >
105- { props . config . errorStatus && props . config . error && < div className = "text-danger" >
106- < CustomTooltip tooltipText = { props . config . error } >
107- < FontAwesomeIcon data-id = { `sr-error-${ props . config . name } ` } icon = { faTimes } > </ FontAwesomeIcon >
108- </ CustomTooltip >
109-
110- </ div > }
111- { ! props . config . isLoading && props . config . errorStatus && props . config . error &&
112- < div
113- onClick = { ( ) => {
114- props . loadScriptRunner ( props . config )
115- props . _paq . push ( [ 'trackEvent' , 'scriptRunnerPlugin' , 'error_reloadScriptRunnerConfig' , props . config . name ] )
116- } }
117- className = "pointer px-2 text-danger d-flex flex-row"
118- >
119- < span className = "pr-1 text-danger font-weight-bold" > Loading error</ span >
120- < span className = "text-danger" > We are not able to load your requested configuration for now, please try again later.</ span >
101+ { props . config . isLoading && < div className = "d-flex flex-row mx-4" >
102+ < div className = "d-flex flex-row pb-1 align-items-center justify-content-center" >
103+ < i className = "fas fa-spinner fa-spin" > </ i > < span className = 'pl-3' > Loading config</ span >
121104 </ div >
122- }
123- </ div >
105+ </ div > }
106+ < div className = "ml-4 d-flex" id = "errorSection" >
107+ { ! props . config . isLoading && props . config . errorStatus && props . config . error &&
108+ < div
109+ onClick = { ( ) => {
110+ props . loadScriptRunner ( props . config )
111+ props . _paq . push ( [ 'trackEvent' , 'scriptRunnerPlugin' , 'error_reloadScriptRunnerConfig' , props . config . name ] )
112+ } }
113+ className = "pointer text-danger d-flex flex-row"
114+ >
115+ < CustomTooltip tooltipText = { props . config . error } >
116+ < FontAwesomeIcon className = "mt-1 pr-4" data-id = { `sr-error-${ props . config . name } ` } icon = { faTimes } > </ FontAwesomeIcon >
117+ </ CustomTooltip >
118+ < span className = "pr-2 mt-1 text-nowrap text-danger font-weight-bold" > Loading error.</ span >
119+ < span className = "text-danger mt-1 " > We are not able to load your requested configuration for now, please try again later.</ span >
120+ </ div >
121+ }
122+ </ div >
123+ </ label >
124124 </ section >
125125
126126 < section className = "d-flex flex-column w-100" >
127127 < div className = "mt-2 mb-4 bg-dark p-3 " >
128128 < p className = "text-dark text-monospace" > { props . config . description } </ p >
129129 < p className = "text-dark" > Dependencies</ p >
130- < ul className = "list-unstyled " >
130+ < ul className = "list-unstyled m-0 " >
131131 < Dependencies />
132132 </ ul >
133133 </ div >
0 commit comments