Skip to content
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

[Workspace] Refactor new home page #8467

Open
wants to merge 15 commits into
base: main
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
2 changes: 2 additions & 0 deletions changelogs/fragments/8467.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
refactor:
- [Workspace] Refactor new home page. ([#8467](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8467))
3 changes: 3 additions & 0 deletions src/plugins/home/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@
navLinkStatus: AppNavLinkStatus.hidden,
mount: async (params: AppMountParameters) => {
const [coreStart, { navigation }] = await core.getStartServices();
if (!!coreStart.application.capabilities.workspaces?.enabled) {
coreStart.application.navigateToApp('workspace_initial');

Check warning on line 170 in src/plugins/home/public/plugin.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/home/public/plugin.ts#L170

Added line #L170 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
coreStart.application.navigateToApp('workspace_initial');
coreStart.application.navigateToApp('workspace_initial');
return ;

What about we return early here to avoid unnecessary code execution below.

}
setCommonService();
coreStart.chrome.docTitle.change(
i18n.translate('home.pageTitle', { defaultMessage: 'Home' })
Expand Down
15 changes: 9 additions & 6 deletions src/plugins/workspace/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { WorkspaceDetailApp } from './components/workspace_detail_app';
import { WorkspaceDetailProps } from './components/workspace_detail/workspace_detail';
import { WorkspaceInitialApp } from './components/workspace_initial_app';
import { WorkspaceUseCaseOverviewApp } from './components/workspace_use_case_overview_app';
import { WorkspaceInitialProps } from './components/workspace_initial/workspace_initial';

export const renderCreatorApp = (
{ element }: AppMountParameters,
Expand Down Expand Up @@ -101,18 +102,20 @@ export const renderDetailApp = (
};
};

export const renderInitialApp = ({}: AppMountParameters, services: Services) => {
const rootElement = document.getElementById('opensearch-dashboards-body');

export const renderInitialApp = (
{ element }: AppMountParameters,
services: Services,
props: WorkspaceInitialProps
) => {
ReactDOM.render(
<OpenSearchDashboardsContextProvider services={services}>
<WorkspaceInitialApp />
<WorkspaceInitialApp {...props} />
</OpenSearchDashboardsContextProvider>,
rootElement
element
);

return () => {
ReactDOM.unmountComponentAtNode(rootElement!);
ReactDOM.unmountComponentAtNode(element);
};
};

Expand Down
363 changes: 0 additions & 363 deletions src/plugins/workspace/public/assets/background_dark.svg

This file was deleted.

363 changes: 0 additions & 363 deletions src/plugins/workspace/public/assets/background_light.svg

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading