@@ -7,6 +7,7 @@ import Linkify from 'react-linkify';
77import {
88 selectLicensingInfo ,
99 selectError ,
10+ selectWarnings ,
1011 selectOverlayHidable ,
1112 selectInformationDetails ,
1213 selectAuthEnabled ,
@@ -22,6 +23,7 @@ function Information({
2223} ) {
2324 const licensingInfo = useSelector ( selectLicensingInfo ) ;
2425 const error = useSelector ( selectError ) ;
26+ const warnings = useSelector ( selectWarnings ) ;
2527 const overlayHidable = useSelector ( selectOverlayHidable ) ;
2628
2729 const [ token , setToken ] = useState ( '' ) ;
@@ -33,9 +35,7 @@ function Information({
3335 const tokenInput = useRef ( ) ;
3436
3537 const [ errorLogsExpanded , setErrorLogsExpanded ] = useState ( false ) ;
36- const errorLogsExpandedToggle = ( ) => {
37- setErrorLogsExpanded ( ! errorLogsExpanded ) ;
38- } ;
38+ const [ warningsExpanded , setWarningsExpanded ] = useState ( true ) ;
3939
4040 let info ;
4141 switch ( licensingInfo ?. type ) {
@@ -73,8 +73,8 @@ function Information({
7373
7474 const errorLogsNode = ( error && error . logs !== null && error . logs . length > 0 ) ? (
7575 < div className = "expand_collapse error-logs-container" >
76- < h4 className = { `expand_trigger ${ errorLogsExpanded ? 'expanded' : 'collapsed' } ` }
77- onClick = { errorLogsExpandedToggle } >
76+ < h4 className = { `expand_trigger ${ errorLogsExpanded ? 'expanded' : 'collapsed' } ` }
77+ onClick = { ( ) => setErrorLogsExpanded ( ! errorLogsExpanded ) } >
7878 < span className = "icon-arrow-open-down" > </ span >
7979 < span className = "icon-arrow-open-right" > </ span >
8080 Error logs
@@ -89,6 +89,31 @@ function Information({
8989 </ div >
9090 ) : null ;
9191
92+ const linkDecorator = ( href , text , key ) => (
93+ < a href = { href } key = { key } target = "_blank" rel = "noopener noreferrer" >
94+ { text }
95+ </ a >
96+ ) ;
97+
98+
99+ const warningsNode = ( warnings && warnings . length > 0 ) ? (
100+ < div className = "expand_collapse warnings-container" >
101+ < h4 className = { `expand_trigger ${ warningsExpanded ? 'expanded' : 'collapsed' } ` }
102+ onClick = { ( ) => setWarningsExpanded ( ! warningsExpanded ) } >
103+ < span className = "icon-arrow-open-down" > </ span >
104+ < span className = "icon-arrow-open-right" > </ span >
105+ Warnings
106+ </ h4 >
107+ < div id = "warnings"
108+ className = { `expand_target warnings-container alert alert-warning ${ warningsExpanded ? 'expanded' : 'collapsed' } ` }
109+ aria-expanded = { warningsExpanded } >
110+ < Linkify componentDecorator = { linkDecorator } >
111+ < div className = "warnings-msg" > { warnings . map ( ( warning , index ) => ( index + 1 ) . toString ( ) + ")" + warning . trim ( ) ) . join ( "\n\n" ) } </ div >
112+ </ Linkify >
113+ </ div >
114+ </ div >
115+ ) : null ;
116+
92117 const onCloseClick = event => {
93118 if ( event . target === event . currentTarget ) {
94119 event . preventDefault ( ) ;
@@ -197,6 +222,7 @@ function Information({
197222 </ div >
198223 { errorMessageNode }
199224 { errorLogsNode }
225+ { warningsNode }
200226 </ div >
201227 < div className = "modal-footer" >
202228 { children }
0 commit comments