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 overview blank #317

Merged
Merged
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
14 changes: 14 additions & 0 deletions src/plugins/workspace/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { WorkspaceFatalError } from './components/workspace_fatal_error';
import { WorkspaceCreatorApp } from './components/workspace_creator_app';
import { WorkspaceUpdaterApp } from './components/workspace_updater_app';
import { Services } from './types';
import { WorkspaceOverviewApp } from './components/workspace_overview_app';

export const renderCreatorApp = ({ element }: AppMountParameters, services: Services) => {
ReactDOM.render(
Expand Down Expand Up @@ -66,3 +67,16 @@ export const renderListApp = ({ element }: AppMountParameters, services: Service
ReactDOM.unmountComponentAtNode(element);
};
};

export const renderOverviewApp = ({ element }: AppMountParameters, services: Services) => {
ReactDOM.render(
<OpenSearchDashboardsContextProvider services={services}>
<WorkspaceOverviewApp />
</OpenSearchDashboardsContextProvider>,
element
);

return () => {
ReactDOM.unmountComponentAtNode(element);
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
import { useObservable } from 'react-use';
import { of } from 'rxjs';

import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';

export const WorkspaceOverview = () => {
const {
services: { workspaces },
} = useOpenSearchDashboards();

const currentWorkspace = useObservable(workspaces ? workspaces.currentWorkspace$ : of(null));

return (
<>
<EuiPanel>
<EuiTitle size="m">
<h3>Workspace</h3>
</EuiTitle>
<EuiSpacer />
{JSON.stringify(currentWorkspace)}
</EuiPanel>
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React, { useEffect } from 'react';
import { I18nProvider } from '@osd/i18n/react';
import { i18n } from '@osd/i18n';
import { useOpenSearchDashboards } from '../../../opensearch_dashboards_react/public';
import { WorkspaceOverview } from './workspace_overview/workspace_overview';

export const WorkspaceOverviewApp = () => {
const {
services: { chrome },
} = useOpenSearchDashboards();

/**
* set breadcrumbs to chrome
*/
useEffect(() => {
chrome?.setBreadcrumbs([
{
text: i18n.translate('workspace.workspaceOverviewTitle', {
defaultMessage: 'Workspace overview',
}),
},
]);
}, [chrome]);

return (
<I18nProvider>
<WorkspaceOverview />
</I18nProvider>
);
};
13 changes: 13 additions & 0 deletions src/plugins/workspace/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,19 @@ export class WorkspacePlugin implements Plugin<{}, {}> {
},
});

// overview
core.application.register({
id: WORKSPACE_OVERVIEW_APP_ID,
title: i18n.translate('workspace.settings.workspaceOverview', {
defaultMessage: 'Workspace Overview',
}),
navLinkStatus: AppNavLinkStatus.hidden,
async mount(params: AppMountParameters) {
const { renderOverviewApp } = await import('./application');
return mountWorkspaceApp(params, renderOverviewApp);
},
});

// workspace fatal error
core.application.register({
id: WORKSPACE_FATAL_ERROR_APP_ID,
Expand Down
Loading