From 40506333a704d4af03a9b460eebb4c1082a137ac Mon Sep 17 00:00:00 2001 From: alfredorubin96 Date: Tue, 9 Jul 2024 19:20:53 +0100 Subject: [PATCH 1/3] adding param to manage SSO redirection --- src/application/ApplicationThunks.ts | 34 +++++----------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/src/application/ApplicationThunks.ts b/src/application/ApplicationThunks.ts index 5076e855c..33a31db9c 100644 --- a/src/application/ApplicationThunks.ts +++ b/src/application/ApplicationThunks.ts @@ -261,7 +261,6 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => { if (dashboardDatabase) { dispatch(setStandaloneDashboardDatabase(dashboardDatabase)); } - if (urlParams.get('credentials')) { setWelcomeScreenOpen(false); const connection = decodeURIComponent(urlParams.get('credentials')); @@ -271,32 +270,6 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => { const database = connection.split('@')[1].split(':')[0]; const url = connection.split('@')[1].split(':')[1]; const port = connection.split('@')[1].split(':')[2]; - // if (url == password) { - // // Special case where a connect link is generated without a password. - // // Here, the format is parsed incorrectly and we open the connection window instead. - // dispatch(setConnectionProperties(protocol, url, port, database, username.split('@')[0], '')); - // dispatch( - // setShareDetailsFromUrl( - // type, - // id, - // standalone, - // protocol, - // url, - // port, - // database, - // username.split('@')[0], - // '', - // dashboardDatabase, - // true - // ) - // ); - // setDashboardToLoadAfterConnecting(id); - // window.history.pushState({}, document.title, window.location.pathname); - // dispatch(setConnectionModalOpen(true)); - // dispatch(setWelcomeScreenOpen(false)); - // // window.history.pushState({}, document.title, "/"); - // return; - // } dispatch(setConnectionModalOpen(false)); dispatch( @@ -385,6 +358,7 @@ export const onConfirmLoadSharedDashboardThunk = () => (dispatch: any, getState: } if (shareDetails.standalone == true) { dispatch(setStandaloneMode(true)); + localStorage.setItem('standaloneShared', 'true'); // EDGE CASE: redirect SSO removes the shareDetails when redirecting } dispatch(resetShareDetails()); } catch (e) { @@ -455,7 +429,10 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState: dispatch(setSSOEnabled(config.ssoEnabled, state.application.cachedSSODiscoveryUrl)); dispatch(setSSOProviders(config.ssoProviders)); - const { standalone } = config; + // Check if we are in standalone mode + const standaloneShared = localStorage.getItem('standaloneShared') == 'true'; // EDGE case: from url param it could happen that we lose the value due to SSO redirect + const standalone = config.standalone || standaloneShared; + // if a dashboard database was previously set, remember to use it. const dashboardDatabase = state.application.standaloneDashboardDatabase; @@ -478,6 +455,7 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState: config.standaloneDatabaseList ) ); + localStorage.removeItem('standaloneShared'); dispatch(setLoggingMode(config.loggingMode)); dispatch(setLoggingDatabase(config.loggingDatabase)); From 59b2adecb6bd013bc127801db2ddb7b05ae51eb4 Mon Sep 17 00:00:00 2001 From: alfredorubin96 Date: Wed, 10 Jul 2024 13:03:41 +0100 Subject: [PATCH 2/3] added standalone when not sharing credentials --- src/application/ApplicationThunks.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/application/ApplicationThunks.ts b/src/application/ApplicationThunks.ts index 33a31db9c..2ace4b7de 100644 --- a/src/application/ApplicationThunks.ts +++ b/src/application/ApplicationThunks.ts @@ -300,7 +300,7 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => { setShareDetailsFromUrl( type, id, - undefined, + standalone, undefined, undefined, undefined, @@ -331,6 +331,7 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => { */ export const onConfirmLoadSharedDashboardThunk = () => (dispatch: any, getState: any) => { try { + console.log('IN'); const state = getState(); const { shareDetails } = state.application; dispatch(setWelcomeScreenOpen(false)); @@ -430,12 +431,14 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState: dispatch(setSSOProviders(config.ssoProviders)); // Check if we are in standalone mode - const standaloneShared = localStorage.getItem('standaloneShared') == 'true'; // EDGE case: from url param it could happen that we lose the value due to SSO redirect - const standalone = config.standalone || standaloneShared; + // const standaloneShared = localStorage.getItem('standaloneShared') == 'true'; // EDGE case: from url param it could happen that we lose the value due to SSO redirect + const {standalone} = config; + // || standaloneShared; // if a dashboard database was previously set, remember to use it. const dashboardDatabase = state.application.standaloneDashboardDatabase; - + console.log(`Standalone: ${ standalone}`); + console.log(`Standalone Shared${ localStorage.getItem('standaloneShared')}`); dispatch( setStandaloneEnabled( standalone, From 1312a68f47685cdc4c2d6951a18bfd0b250c15d3 Mon Sep 17 00:00:00 2001 From: Niels de Jong Date: Mon, 11 Nov 2024 09:32:41 +0100 Subject: [PATCH 3/3] Removed superfluous log statements --- src/application/ApplicationThunks.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/application/ApplicationThunks.ts b/src/application/ApplicationThunks.ts index 2ace4b7de..6af4b6339 100644 --- a/src/application/ApplicationThunks.ts +++ b/src/application/ApplicationThunks.ts @@ -331,7 +331,6 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => { */ export const onConfirmLoadSharedDashboardThunk = () => (dispatch: any, getState: any) => { try { - console.log('IN'); const state = getState(); const { shareDetails } = state.application; dispatch(setWelcomeScreenOpen(false)); @@ -432,13 +431,11 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState: // Check if we are in standalone mode // const standaloneShared = localStorage.getItem('standaloneShared') == 'true'; // EDGE case: from url param it could happen that we lose the value due to SSO redirect - const {standalone} = config; + const { standalone } = config; // || standaloneShared; // if a dashboard database was previously set, remember to use it. const dashboardDatabase = state.application.standaloneDashboardDatabase; - console.log(`Standalone: ${ standalone}`); - console.log(`Standalone Shared${ localStorage.getItem('standaloneShared')}`); dispatch( setStandaloneEnabled( standalone,