forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workspace overview blank (opensearch-project#317)
* Add workspace overview page (opensearch-project#19) * feat: add workspace overview page Signed-off-by: Lin Wang <[email protected]> * refactor: move paths to common constants Signed-off-by: Lin Wang <[email protected]> * feat: add workspace overview item by custom nav in start phase Signed-off-by: Lin Wang <[email protected]> * refactor: change to currentWorkspace$ in workspace client Signed-off-by: Lin Wang <[email protected]> --------- Signed-off-by: Lin Wang <[email protected]> * restore yml Signed-off-by: Hailong Cui <[email protected]> --------- Signed-off-by: Lin Wang <[email protected]> Signed-off-by: Hailong Cui <[email protected]> Co-authored-by: Lin Wang <[email protected]>
- Loading branch information
1 parent
55d9b82
commit 43c4e96
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/plugins/workspace/public/components/workspace_overview/workspace_overview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</> | ||
); | ||
}; |
35 changes: 35 additions & 0 deletions
35
src/plugins/workspace/public/components/workspace_overview_app.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters