-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
locale query string support on public links and static embeds #47186
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we skipping these three tests in that file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a mistake 🙃
@@ -122,7 +122,7 @@ export function useDashboardUrlQuery( | |||
}, [router, location, selectedTab, dispatch]); | |||
} | |||
|
|||
const QUERY_PARAMS_ALLOW_LIST = ["objectId"]; | |||
const QUERY_PARAMS_ALLOW_LIST = ["objectId", "locale"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should also update the parameters allow list for the SyncedParametersList
component (used for native question parameters)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 yes!
Thank you for pointing that out, let me change one of the e2e tests to cover that scenario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! It'd be great to unify this logic at some point in the future, but it's kind of hard to do while native question parameters are using history
instead of react-router-redux
. #44639 should have more context around that
Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested public dashboards with tabs and parameters. Refreshing still leaves the locale parameter 👍 I'd wait for the native question tests before giving you a stamp.
// > `url` - one that begins with `http`. By default `cy.request()` will use | ||
// > either the current window's origin or the `baseUrl` in | ||
// > `e2e/support/cypress.config.js`. Neither of those values were present. | ||
Cypress.config("baseUrl", originalBaseUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For anyone who is still confused about this line. Because of the way Cypress.config
works, it only is reset when the whole suite is completed, so this is a way to restore the value back in between tests.
By the way, it's used here.
Cypress.config("baseUrl", null); |
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new test native question with a parameter looks good, I also ran it locally, and it behaved as expected.
* keep locale in url query params * e2e tests * ugly fix for the missing baseUrl error * applies suggestion from Kelvin to make code more demure * Update e2e/test/scenarios/sharing/public-question.cy.spec.js Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com> * remove it.skip added by mistake * sort imports * handle native question/ SyncedParametersList too * shorter and more accurate comment 😅 * Update e2e/support/helpers/e2e-embedding-helpers.js Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> --------- Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com> Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
* keep locale in url query params * e2e tests * ugly fix for the missing baseUrl error * applies suggestion from Kelvin to make code more demure * Update e2e/test/scenarios/sharing/public-question.cy.spec.js Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com> * remove it.skip added by mistake * sort imports * handle native question/ SyncedParametersList too * shorter and more accurate comment 😅 * Update e2e/support/helpers/e2e-embedding-helpers.js Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> --------- Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com> Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
…embeds" (#47393) * locale query string support on public links and static embeds (#47186) * keep locale in url query params * e2e tests * ugly fix for the missing baseUrl error * applies suggestion from Kelvin to make code more demure * Update e2e/test/scenarios/sharing/public-question.cy.spec.js Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com> * remove it.skip added by mistake * sort imports * handle native question/ SyncedParametersList too * shorter and more accurate comment 😅 * Update e2e/support/helpers/e2e-embedding-helpers.js Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> --------- Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com> Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev> * fix tests, the button i was looking for is not on v50 --------- Co-authored-by: Nicolò Pretto <info@npretto.com> Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com> Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
This pr addresses Support language localization in static embedding.
The feature was apparently already working with one small caveat: we have some code that removes all querystring parameters that are not filters, this refreshing the page losing the locale as reported by Jeff on slack
The rest of the code changes are tests for the 4 different contexts (public/static, question/dashboard)