Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 11 additions & 30 deletions src/application/ApplicationThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -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(
Expand Down Expand Up @@ -327,7 +300,7 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => {
setShareDetailsFromUrl(
type,
id,
undefined,
standalone,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -358,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));
Expand Down Expand Up @@ -385,6 +359,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) {
Expand Down Expand Up @@ -455,10 +430,15 @@ 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;
// || 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,
Expand All @@ -478,6 +458,7 @@ export const loadApplicationConfigThunk = () => async (dispatch: any, getState:
config.standaloneDatabaseList
)
);
localStorage.removeItem('standaloneShared');

dispatch(setLoggingMode(config.loggingMode));
dispatch(setLoggingDatabase(config.loggingDatabase));
Expand Down