Skip to content

Commit 4050633

Browse files
adding param to manage SSO redirection
1 parent 08dc5b6 commit 4050633

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

src/application/ApplicationThunks.ts

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => {
261261
if (dashboardDatabase) {
262262
dispatch(setStandaloneDashboardDatabase(dashboardDatabase));
263263
}
264-
265264
if (urlParams.get('credentials')) {
266265
setWelcomeScreenOpen(false);
267266
const connection = decodeURIComponent(urlParams.get('credentials'));
@@ -271,32 +270,6 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => {
271270
const database = connection.split('@')[1].split(':')[0];
272271
const url = connection.split('@')[1].split(':')[1];
273272
const port = connection.split('@')[1].split(':')[2];
274-
// if (url == password) {
275-
// // Special case where a connect link is generated without a password.
276-
// // Here, the format is parsed incorrectly and we open the connection window instead.
277-
// dispatch(setConnectionProperties(protocol, url, port, database, username.split('@')[0], ''));
278-
// dispatch(
279-
// setShareDetailsFromUrl(
280-
// type,
281-
// id,
282-
// standalone,
283-
// protocol,
284-
// url,
285-
// port,
286-
// database,
287-
// username.split('@')[0],
288-
// '',
289-
// dashboardDatabase,
290-
// true
291-
// )
292-
// );
293-
// setDashboardToLoadAfterConnecting(id);
294-
// window.history.pushState({}, document.title, window.location.pathname);
295-
// dispatch(setConnectionModalOpen(true));
296-
// dispatch(setWelcomeScreenOpen(false));
297-
// // window.history.pushState({}, document.title, "/");
298-
// return;
299-
// }
300273

301274
dispatch(setConnectionModalOpen(false));
302275
dispatch(
@@ -385,6 +358,7 @@ export const onConfirmLoadSharedDashboardThunk = () => (dispatch: any, getState:
385358
}
386359
if (shareDetails.standalone == true) {
387360
dispatch(setStandaloneMode(true));
361+
localStorage.setItem('standaloneShared', 'true'); // EDGE CASE: redirect SSO removes the shareDetails when redirecting
388362
}
389363
dispatch(resetShareDetails());
390364
} catch (e) {
@@ -455,7 +429,10 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
455429
dispatch(setSSOEnabled(config.ssoEnabled, state.application.cachedSSODiscoveryUrl));
456430
dispatch(setSSOProviders(config.ssoProviders));
457431

458-
const { standalone } = config;
432+
// 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.standalone || standaloneShared;
435+
459436
// if a dashboard database was previously set, remember to use it.
460437
const dashboardDatabase = state.application.standaloneDashboardDatabase;
461438

@@ -478,6 +455,7 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
478455
config.standaloneDatabaseList
479456
)
480457
);
458+
localStorage.removeItem('standaloneShared');
481459

482460
dispatch(setLoggingMode(config.loggingMode));
483461
dispatch(setLoggingDatabase(config.loggingDatabase));

0 commit comments

Comments
 (0)