Skip to content

Support multiple values for a parameter in 'where in' clause in the url in standalone mode #1061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ To dynamically view a deployed NeoDash dashboard, you can deep-link into a deplo
the following deeplinking options are available via URL parameters:
- Appending `?page=1` to the URL will open up a dashboard at a given page. (Starting at zero).
- Appending `?neodash_person_name=Tom` to the URL will set a dashboard parameter as a default for the entire dashboard.
- Appending `?neodash_list_person_name=Tom&neodash_list_person_name=Peter` to the URL will pass one parameter person_name as an array you can use in WHERE IN clauses

Multiple parameters can be used in a deep-link by concatinating them:
....
Expand Down
6 changes: 5 additions & 1 deletion src/application/ApplicationThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@
const paramsToSetAfterConnecting = {};
Array.from(urlParams.entries()).forEach(([key, value]) => {
if (key.startsWith('neodash_')) {
paramsToSetAfterConnecting[key] = value;
if (key.startsWith('neodash_list_')) {
(paramsToSetAfterConnecting[key]??=[]).push(value);
} else {
paramsToSetAfterConnecting[key] = value;
}
}
});
if (Object.keys(paramsToSetAfterConnecting).length > 0) {
Expand All @@ -265,12 +269,12 @@
if (urlParams.get('credentials')) {
setWelcomeScreenOpen(false);
const connection = decodeURIComponent(urlParams.get('credentials'));
const protocol = connection.split('://')[0];

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
const username = connection.split('://')[1].split(':')[0];

Check warning on line 273 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 274 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 275 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 276 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 277 in src/application/ApplicationThunks.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Use array destructuring

dispatch(setConnectionModalOpen(false));
dispatch(
Expand Down Expand Up @@ -571,7 +575,7 @@
dispatch(initializeApplicationAsEditorThunk(config, paramsToSetAfterConnecting));
}
} catch (e) {
console.log(e);

Check warning on line 578 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