Skip to content
Merged
Changes from 3 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,42 +261,15 @@
if (dashboardDatabase) {
dispatch(setStandaloneDashboardDatabase(dashboardDatabase));
}

if (urlParams.get('credentials')) {
setWelcomeScreenOpen(false);
const connection = decodeURIComponent(urlParams.get('credentials'));
const protocol = connection.split('://')[0];

Check warning on line 267 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Use array destructuring
const username = connection.split('://')[1].split(':')[0];

Check warning on line 268 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Use array destructuring
const password = connection.split('://')[1].split(':')[1].split('@')[0];

Check warning on line 269 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Use array destructuring
const database = connection.split('@')[1].split(':')[0];

Check warning on line 270 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Use array destructuring
const url = connection.split('@')[1].split(':')[1];

Check warning on line 271 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Use array destructuring
const port = connection.split('@')[1].split(':')[2];

Check warning on line 272 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Use array destructuring
// 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 @@
setShareDetailsFromUrl(
type,
id,
undefined,
standalone,
undefined,
undefined,
undefined,
Expand Down Expand Up @@ -358,6 +331,7 @@
*/
export const onConfirmLoadSharedDashboardThunk = () => (dispatch: any, getState: any) => {
try {
console.log('IN');

Check warning on line 334 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected console statement
const state = getState();
const { shareDetails } = state.application;
dispatch(setWelcomeScreenOpen(false));
Expand Down Expand Up @@ -385,6 +359,7 @@
}
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 @@
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}`);

Check warning on line 440 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected console statement
console.log(`Standalone Shared${ localStorage.getItem('standaloneShared')}`);

Check warning on line 441 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected console statement
dispatch(
setStandaloneEnabled(
standalone,
Expand All @@ -478,6 +458,7 @@
config.standaloneDatabaseList
)
);
localStorage.removeItem('standaloneShared');

dispatch(setLoggingMode(config.loggingMode));
dispatch(setLoggingDatabase(config.loggingDatabase));
Expand Down Expand Up @@ -580,7 +561,7 @@
dispatch(initializeApplicationAsEditorThunk(config, paramsToSetAfterConnecting));
}
} catch (e) {
console.log(e);

Check warning on line 564 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected console statement
dispatch(setWelcomeScreenOpen(false));
dispatch(
createNotificationThunk(
Expand Down
Loading