Skip to content

Commit

Permalink
feat: complete the feature
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
  • Loading branch information
SuZhou-Joe committed Apr 7, 2024
1 parent 01dbbc1 commit 9bf5468
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/core/public/application/application_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ export class ApplicationService {
workspaces.currentWorkspaceId$.value &&
targetApp?.visibility === AppVisibility.homeOnly
) {
// If user is inside a workspace and the target app is homeOnly
// refresh the page by doing a hard navigation
window.location.assign(getAppUrl(availableMounters, appId, path));
return;
}

if (shouldNavigate) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export interface App<HistoryLocationState = unknown> {
* Defaulting to `both`
* See {@link AppVisibility}
*/
visibility: AppVisibility;
visibility?: AppVisibility;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/core/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export {
AppUpdater,
ScopedHistory,
NavigateToAppOptions,
AppVisibility,
} from './application';

export {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/home/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { DataPublicPluginStart } from '../../data/public';
import { TelemetryPluginStart } from '../../telemetry/public';
import { UsageCollectionSetup } from '../../usage_collection/public';
import { UrlForwardingSetup, UrlForwardingStart } from '../../url_forwarding/public';
import { AppNavLinkStatus } from '../../../core/public';
import { AppNavLinkStatus, AppVisibility } from '../../../core/public';
import { PLUGIN_ID, HOME_APP_BASE_PATH } from '../common/constants';
import { DataSourcePluginStart } from '../../data_source/public';

Expand Down Expand Up @@ -130,6 +130,7 @@ export class HomePublicPlugin
const { renderApp } = await import('./application');
return await renderApp(params.element, coreStart, params.history);
},
visibility: AppVisibility.homeOnly,
});
urlForwarding.forwardApp('home', 'home');

Expand Down

0 comments on commit 9bf5468

Please sign in to comment.