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.
Add workspace overview page (opensearch-project#19)
* feat: add workspace overview page Signed-off-by: Lin Wang <wonglam@amazon.com> * refactor: move paths to common constants Signed-off-by: Lin Wang <wonglam@amazon.com> * feat: add workspace overview item by custom nav in start phase Signed-off-by: Lin Wang <wonglam@amazon.com> * refactor: change to currentWorkspace$ in workspace client Signed-off-by: Lin Wang <wonglam@amazon.com> --------- Signed-off-by: Lin Wang <wonglam@amazon.com>
- Loading branch information
Showing
4 changed files
with
61 additions
and
6 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
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
40 changes: 40 additions & 0 deletions
40
src/plugins/workspace/public/components/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,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiPageHeader, EuiButton, EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; | ||
import { useObservable } from 'react-use'; | ||
import { of } from 'rxjs'; | ||
|
||
import { useOpenSearchDashboards } from '../../../../../src/plugins/opensearch_dashboards_react/public'; | ||
|
||
export const WorkspaceOverview = () => { | ||
const { | ||
services: { workspaces }, | ||
} = useOpenSearchDashboards(); | ||
|
||
const currentWorkspace = useObservable( | ||
workspaces ? workspaces.client.currentWorkspace$ : of(null) | ||
); | ||
|
||
return ( | ||
<> | ||
<EuiPageHeader | ||
pageTitle="Overview" | ||
rightSideItems={[ | ||
<EuiButton color="danger">Delete</EuiButton>, | ||
<EuiButton>Update</EuiButton>, | ||
]} | ||
/> | ||
<EuiPanel> | ||
<EuiTitle size="m"> | ||
<h3>Workspace</h3> | ||
</EuiTitle> | ||
<EuiSpacer /> | ||
{JSON.stringify(currentWorkspace)} | ||
</EuiPanel> | ||
</> | ||
); | ||
}; |
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