You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we append &embed=true to the dashboard URL, it should enter the embed mode; however, if we change &embed=false, it should exit embed mode. However, the current dashboard will still stay in the embed mode. The error is coming from this line since Boolean('false') will still be set to true.
After investigation, this behavior is expected because of this initVisibility() function in chrome service. It will be in embed mode if we have embed in the query string, no matter embed=true or embed=false.
/**
* These observables allow consumers to toggle the chrome visibility via either:
* 1. Using setIsVisible() to trigger the next chromeHidden$
* 2. Setting `chromeless` when registering an application, which will
* reset the visibility whenever the next application is mounted
* 3. Having "embed" in the query string
*/
private initVisibility(application: StartDeps['application']) {
// Start off the chrome service hidden if "embed" is in the hash query string.
const isEmbedded = new URL(location.hash.slice(1), location.origin).searchParams.has('embed');
this.isForceHidden$ = new BehaviorSubject(isEmbedded);
const appHidden$ = merge(
// For the isVisible$ logic, having no mounted app is equivalent to having a hidden app
// in the sense that the chrome UI should not be displayed until a non-chromeless app is mounting or mounted
of(true),
application.currentAppId$.pipe(
flatMap((appId) =>
application.applications$.pipe(
map((applications) => {
return !!appId && applications.has(appId) && !!applications.get(appId)!.chromeless;
})
)
)
)
I was misleading by this dashboard functional test, so i thought we are only going to enter exit mode by having embed=true and we are supposed to exit out embed mode when it is embed=false.
it('hides the chrome', async () => {
const globalNavShown = await globalNav.exists();
expect(globalNavShown).to.be(true);
const currentUrl = await browser.getCurrentUrl();
const newUrl = currentUrl + '&embed=true';
// Embed parameter only works on a hard refresh.
const useTimeStamp = true;
await browser.get(newUrl.toString(), useTimeStamp);
await retry.try(async () => {
const globalNavHidden = !(await globalNav.exists());
expect(globalNavHidden).to.be(true);
});
});
Describe the bug
When we append
&embed=true
to the dashboard URL, it should enter the embed mode; however, if we change&embed=false
, it should exit embed mode. However, the current dashboard will still stay in the embed mode. The error is coming from this line sinceBoolean('false')
will still be set to true.OpenSearch-Dashboards/src/plugins/dashboard/public/application/dashboard_app_controller.tsx
Line 175 in d95504c
similarly, this causes similar error for other optional URL params:
* show-top-menu
* show-query-input
* show-time-filter
* hide-filter-bar
OpenSearch-Dashboards/src/plugins/dashboard/public/application/dashboard_app_controller.tsx
Line 179 in d95504c
The functional tests on this can also be enhanced so we can test on all scenarios.
To Reproduce
Screen.Recording.2023-06-23.at.11.32.45.AM.mov
Expected behavior
A clear and concise description of what you expected to happen.
OpenSearch Version
Please list the version of OpenSearch being used.
Dashboards Version
Please list the version of OpenSearch Dashboards being used.
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: