@@ -291,7 +291,6 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => {
291291 if ( skipConfirmation === true ) {
292292 dispatch ( onConfirmLoadSharedDashboardThunk ( ) ) ;
293293 }
294-
295294 window . history . pushState ( { } , document . title , window . location . pathname ) ;
296295 } else {
297296 dispatch ( setConnectionModalOpen ( false ) ) ;
@@ -358,7 +357,6 @@ export const onConfirmLoadSharedDashboardThunk = () => (dispatch: any, getState:
358357 }
359358 if ( shareDetails . standalone == true ) {
360359 dispatch ( setStandaloneMode ( true ) ) ;
361- localStorage . setItem ( 'standaloneShared' , 'true' ) ; // EDGE CASE: redirect SSO removes the shareDetails when redirecting
362360 }
363361 dispatch ( resetShareDetails ( ) ) ;
364362 } catch ( e ) {
@@ -410,29 +408,35 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
410408
411409 try {
412410 // Parse the URL parameters to see if there's any deep linking of parameters.
411+ const state = getState ( ) ;
413412 const queryString = window . location . search ;
414413 const urlParams = new URLSearchParams ( queryString ) ;
414+ if ( state . application . waitForSSO ) {
415+ const paramsBeforeSSO = JSON . parse ( sessionStorage . getItem ( 'SSO_PARAMS_BEFORE_REDIRECT' ) || '{}' ) ;
416+ Object . entries ( paramsBeforeSSO ) . forEach ( ( [ key , value ] ) => {
417+ urlParams . set ( key , value ) ;
418+ } ) ;
419+ }
415420 const paramsToSetAfterConnecting = { } ;
416421 Array . from ( urlParams . entries ( ) ) . forEach ( ( [ key , value ] ) => {
417422 if ( key . startsWith ( 'neodash_' ) ) {
418423 paramsToSetAfterConnecting [ key ] = value ;
419424 }
420425 } ) ;
421-
426+ sessionStorage . getItem ( 'SSO_PARAMS_BEFORE_REDIRECT' ) ;
422427 const page = urlParams . get ( 'page' ) ;
423428 if ( page !== '' && page !== null ) {
424429 if ( ! isNaN ( page ) ) {
425430 dispatch ( setPageNumberThunk ( parseInt ( page ) ) ) ;
426431 }
427432 }
428- const state = getState ( ) ;
429433 dispatch ( setSSOEnabled ( config . ssoEnabled , state . application . cachedSSODiscoveryUrl ) ) ;
430434 dispatch ( setSSOProviders ( config . ssoProviders ) ) ;
431435
432436 // Check if we are in standalone mode
433- // const standaloneShared = localStorage.getItem('standaloneShared ') == 'true'; // EDGE case: from url param it could happen that we lose the value due to SSO redirect
434- const { standalone } = config ;
435- // || standaloneShared ;
437+ const standalone = config . standalone || urlParams . get ( 'standalone ') == 'Yes' ;
438+ console . log ( urlParams . get ( ' standalone' ) ) ;
439+ console . log ( standalone ) ;
436440
437441 // if a dashboard database was previously set, remember to use it.
438442 const dashboardDatabase = state . application . standaloneDashboardDatabase ;
@@ -455,7 +459,6 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
455459 config . standaloneDatabaseList
456460 )
457461 ) ;
458- localStorage . removeItem ( 'standaloneShared' ) ;
459462
460463 dispatch ( setLoggingMode ( config . loggingMode ) ) ;
461464 dispatch ( setLoggingDatabase ( config . loggingDatabase ) ) ;
@@ -491,6 +494,7 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
491494 dispatch ( setAboutModalOpen ( false ) ) ;
492495 dispatch ( setConnected ( false ) ) ;
493496 dispatch ( setWelcomeScreenOpen ( false ) ) ;
497+ console . log ( 'EDDAJE' ) ;
494498 const success = await initializeSSO ( state . application . cachedSSODiscoveryUrl , ( credentials ) => {
495499 if ( standalone ) {
496500 // Redirected from SSO and running in viewer mode, merge retrieved config with hardcoded credentials.
@@ -537,6 +541,7 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
537541 }
538542 dispatch ( setParametersToLoadAfterConnecting ( paramsToSetAfterConnecting ) ) ;
539543 }
544+ sessionStorage . removeItem ( 'SSO_PARAMS_BEFORE_REDIRECT' ) ;
540545 } ) ;
541546 dispatch ( setWaitForSSO ( false ) ) ;
542547 if ( ! success ) {
@@ -550,7 +555,13 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
550555 } else {
551556 return ;
552557 }
553- }
558+ } else if ( state . application . ssoEnabled && ! state . application . waitForSSO && urlParams ) {
559+ let paramsToStore = { } ;
560+ urlParams . forEach ( ( value , key ) => {
561+ paramsToStore [ key ] = value ;
562+ } ) ;
563+ sessionStorage . setItem ( 'SSO_PARAMS_BEFORE_REDIRECT' , JSON . stringify ( paramsToStore ) ) ;
564+ }
554565
555566 if ( standalone ) {
556567 dispatch ( initializeApplicationAsStandaloneThunk ( config , paramsToSetAfterConnecting ) ) ;
0 commit comments