@@ -74,7 +74,6 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
7474 publicServiceProviderByDetail ( manageType , manageId )
7575 . then ( res => {
7676 setServiceProvider ( res ) ;
77- setLoading ( false ) ;
7877 const newMetaData = res . data . metaDataFields ;
7978 setMetaData ( newMetaData ) ;
8079 //See if this application is already connected
@@ -110,6 +109,7 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
110109 const idpId = user . identityProvider . id
111110 const orgMembership = user . organizationMemberships . find ( orgMembership => orgMembership . organization . manageIdentifier === idpId ) ;
112111 setIsAdminUser ( user . superUser || ( ! isEmpty ( orgMembership ) && orgMembership . authority === authorities . ADMIN ) ) ;
112+ setLoading ( false ) ;
113113 } )
114114 . catch ( ( ) => {
115115 navigate ( "/404" ) ;
@@ -242,12 +242,11 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
242242 //Because user is an useEffect dependency, everything will reload. Including change requests
243243 refreshUser ( ( ) => {
244244 //a small timeout to prevent flickering - connecting apps does not happen that often
245- setTimeout ( ( ) => setLoading ( false ) , 175 ) ;
245+ setTimeout ( ( ) => setLoading ( false ) , 75 ) ;
246246 } ) ;
247247
248248 }
249249 } )
250-
251250 }
252251 }
253252
@@ -317,6 +316,75 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
317316 )
318317 }
319318
319+ const renderAppAttributes = ( ) => {
320+ return (
321+ < div className = "details-panel" >
322+ < p className = "title" > { I18n . t ( "applicationDetail.attributes" ) } </ p >
323+ < p > { I18n . t ( "applicationDetail.attributesInfo" ) } </ p >
324+ { ! showAttributes && < a href = "/" onClick = { toggleShowAttributes } >
325+ { I18n . t ( "applicationDetail.details" ) }
326+ </ a > }
327+ { showAttributes && < div className = "arp-attributes" >
328+ { ! serviceProvider . data . arp . enabled &&
329+ < p > { I18n . t ( "applicationDetail.noArp" ) } </ p >
330+ }
331+ { serviceProvider . data . arp . enabled &&
332+ < >
333+ { Object . entries ( serviceProvider . data . arp . attributes ) . map ( ( entry , index ) => {
334+ const attribute = findArpEntry ( entry [ 0 ] ) ;
335+ //ARP entries only have one value / source
336+ const value = entry [ 1 ] [ 0 ] ;
337+ const source = I18n . t ( `applicationDetail.arpSources.${ value . source } ` ) ;
338+ return (
339+ < div className = "attribute" key = { index } >
340+ < span
341+ className = "attr-name" > { attribute . friendlyNames [ I18n . locale ] } </ span >
342+ { ! isEmpty ( value . motivation ) &&
343+ < span
344+ className = "attr-motivation" > { value . motivation } </ span > }
345+ { isEmpty ( value . motivation ) && < span
346+ className = "attr-motivation" > { I18n . t ( "applicationDetail.noMotivation" ) } </ span > }
347+ < span className = "attr-source" >
348+ { `${ entry [ 0 ] } - ${ I18n . t ( "applicationDetail.source" ) } ${ source } ` }
349+ </ span >
350+ </ div >
351+ ) ;
352+ } ) }
353+ </ >
354+ }
355+ </ div > }
356+ </ div >
357+ ) ;
358+ }
359+
360+ function renderAppPrivacy ( ) {
361+ return < div className = "details-panel" >
362+ < p className = "title" > { I18n . t ( "applicationDetail.privacy" ) } </ p >
363+ < p > { I18n . t ( "applicationDetail.privacyInfo" ) } </ p >
364+ { ! showPrivacy && < a href = "/" onClick = { toggleShowPrivacy } >
365+ { I18n . t ( "applicationDetail.details" ) }
366+ </ a > }
367+ { showPrivacy &&
368+ < div className = "privacy-questions" >
369+ { privacy . map ( ( item , index ) => {
370+ const question = item [ `info_${ I18n . locale } ` ] ;
371+ const strippedQuestion = question . substring ( question . indexOf ( " " ) + 1 ) ;
372+ const answer = metaData [ item . manage ]
373+ return (
374+ < div className = "privacy-question" key = { index } >
375+ < span className = "priv-name" > { strippedQuestion } </ span >
376+ { isEmpty ( answer ) && < span
377+ className = "priv-answer" > { I18n . t ( "applicationDetail.noPrivacyInfo" ) } </ span > }
378+ { ! isEmpty ( answer ) &&
379+ < span className = "priv-answer" > { answer } </ span > }
380+ </ div >
381+ ) ;
382+ }
383+ ) }
384+ </ div > }
385+ </ div > ;
386+ }
387+
320388 const renderNonAccessibleApp = ( ) => {
321389 return (
322390 < >
@@ -361,67 +429,8 @@ const ApplicationDetail = ({anonymous, refreshUser}) => {
361429 < div className = "details" >
362430 < div className = "left" >
363431 < p > { providerDescription ( I18n . locale , serviceProvider ) } </ p >
364- < div className = "details-panel" >
365- < p className = "title" > { I18n . t ( "applicationDetail.attributes" ) } </ p >
366- < p > { I18n . t ( "applicationDetail.attributesInfo" ) } </ p >
367- { ! showAttributes && < a href = "/" onClick = { toggleShowAttributes } >
368- { I18n . t ( "applicationDetail.details" ) }
369- </ a > }
370- { showAttributes && < div className = "arp-attributes" >
371- { ! serviceProvider . data . arp . enabled &&
372- < p > { I18n . t ( "applicationDetail.noArp" ) } </ p >
373- }
374- { serviceProvider . data . arp . enabled &&
375- < >
376- { Object . entries ( serviceProvider . data . arp . attributes ) . map ( ( entry , index ) => {
377- const attribute = findArpEntry ( entry [ 0 ] ) ;
378- //ARP entries only have one value / source
379- const value = entry [ 1 ] [ 0 ] ;
380- const source = I18n . t ( `applicationDetail.arpSources.${ value . source } ` ) ;
381- return (
382- < div className = "attribute" key = { index } >
383- < span
384- className = "attr-name" > { attribute . friendlyNames [ I18n . locale ] } </ span >
385- { ! isEmpty ( value . motivation ) &&
386- < span
387- className = "attr-motivation" > { value . motivation } </ span > }
388- { isEmpty ( value . motivation ) && < span
389- className = "attr-motivation" > { I18n . t ( "applicationDetail.noMotivation" ) } </ span > }
390- < span className = "attr-source" >
391- { `${ entry [ 0 ] } - ${ I18n . t ( "applicationDetail.source" ) } ${ source } ` }
392- </ span >
393- </ div >
394- ) ;
395- } ) }
396- </ >
397- }
398- </ div > }
399- </ div >
400- < div className = "details-panel" >
401- < p className = "title" > { I18n . t ( "applicationDetail.privacy" ) } </ p >
402- < p > { I18n . t ( "applicationDetail.privacyInfo" ) } </ p >
403- { ! showPrivacy && < a href = "/" onClick = { toggleShowPrivacy } >
404- { I18n . t ( "applicationDetail.details" ) }
405- </ a > }
406- { showPrivacy &&
407- < div className = "privacy-questions" >
408- { privacy . map ( ( item , index ) => {
409- const question = item [ `info_${ I18n . locale } ` ] ;
410- const strippedQuestion = question . substring ( question . indexOf ( " " ) + 1 ) ;
411- const answer = metaData [ item . manage ]
412- return (
413- < div className = "privacy-question" key = { index } >
414- < span className = "priv-name" > { strippedQuestion } </ span >
415- { isEmpty ( answer ) && < span
416- className = "priv-answer" > { I18n . t ( "applicationDetail.noPrivacyInfo" ) } </ span > }
417- { ! isEmpty ( answer ) &&
418- < span className = "priv-answer" > { answer } </ span > }
419- </ div >
420- ) ;
421- }
422- ) }
423- </ div > }
424- </ div >
432+ { renderAppAttributes ( ) }
433+ { renderAppPrivacy ( ) }
425434 </ div >
426435 < div className = "right" >
427436 < p className = "license" > { I18n . t ( `applicationDetail.license.${ metaData [ 'coin:ss:license_status' ] || 'license_not_required' } ` ) } </ p >
0 commit comments