Skip to content

Commit 455ee42

Browse files
adding param to manage SSO redirection (#918)
* adding param to manage SSO redirection * added standalone when not sharing credentials * Removed superfluous log statements --------- Co-authored-by: Niels de Jong <[email protected]>
1 parent 1555b81 commit 455ee42

File tree

1 file changed

+7
-29
lines changed

1 file changed

+7
-29
lines changed

src/application/ApplicationThunks.ts

Lines changed: 7 additions & 29 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(
@@ -327,7 +300,7 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => {
327300
setShareDetailsFromUrl(
328301
type,
329302
id,
330-
undefined,
303+
standalone,
331304
undefined,
332305
undefined,
333306
undefined,
@@ -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,10 +429,13 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
455429
dispatch(setSSOEnabled(config.ssoEnabled, state.application.cachedSSODiscoveryUrl));
456430
dispatch(setSSOProviders(config.ssoProviders));
457431

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
458434
const { standalone } = config;
435+
// || standaloneShared;
436+
459437
// if a dashboard database was previously set, remember to use it.
460438
const dashboardDatabase = state.application.standaloneDashboardDatabase;
461-
462439
dispatch(
463440
setStandaloneEnabled(
464441
standalone,
@@ -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)