Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit bb860e6

Browse files
authored
Merge pull request #376 from GinaIsaia/profile
Profile page added
2 parents ad62f58 + 3163954 commit bb860e6

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lfai/egeria-ui-components",
3-
"version": "4.3.3",
3+
"version": "4.3.4",
44
"description": "Encapsulated reactjs components with business logic inside.",
55
"license": "Apache-2.0",
66
"repository": {

src/components/Demo/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import { EgeriaAssetDetails } from '../Assets/Details';
44
import { EgeriaAssetDetailsPrint } from '../Assets/Details/print';
55
import { EgeriaGlossary } from '../Glossary';
66
import { EgeriaLineageGraphRouteWrapper } from '../Lineage/Graph/RouteWrapper';
7-
import { ASSET_CATALOG_PATH, eNavigateTo, VISIBLE_COMPONENTS } from '@lfai/egeria-js-commons';
7+
import { ASSET_CATALOG_PATH, eNavigateTo, token, VISIBLE_COMPONENTS } from '@lfai/egeria-js-commons';
88
import { EgeriaApp, EgeriaLogin, EgeriaPageNotFound, RequireAuth, RequirePermissions } from '@lfai/egeria-ui-core';
99

1010
import './index.scss';
1111
import { EgeriaLineageGraphPrint } from '../Lineage/Graph/print';
12+
import { EgeriaProfile } from '../Profile';
1213

1314
console.log('API_URL', process.env.REACT_APP_API_URL);
1415

@@ -84,6 +85,12 @@ export function Demo() {
8485
element={<EgeriaGlossary />} />
8586
</RequireAuth> } />
8687

88+
<Route path={'/profile'} element={<RequireAuth>
89+
<RequirePermissions component={token.getValue() ? '*' : null}
90+
showAccessDenied={true}
91+
element={<EgeriaProfile />} />
92+
</RequireAuth> } />
93+
8794
<Route path={'/login'} element={
8895
<EgeriaLogin loginCallback={ () => eNavigateTo('/') }/>
8996
} />

src/components/Profile/index.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { JWTInterface, token } from '@lfai/egeria-js-commons';
2+
import { Avatar, List, Paper, Text, Title } from '@mantine/core';
3+
4+
export function EgeriaProfile() {
5+
const decodedToken: JWTInterface | null = token.decodedObject();
6+
7+
return (<>
8+
{ decodedToken && <><Paper radius='md' withBorder p='lg' mb='md'>
9+
<Avatar size={120} radius={120} mx='auto' />
10+
11+
<Text ta='center' fz='lg' weight={500} mt='md'>
12+
{ decodedToken?.sub }
13+
</Text>
14+
</Paper>
15+
16+
<Paper radius='md' withBorder p='lg' mb='md'>
17+
<Title order={2}>Scopes</Title>
18+
19+
<List ml='md'>
20+
{ decodedToken?.scope.map((component: any, index: number) => {
21+
return <List.Item key={index}><Text>{component}</Text></List.Item>
22+
}) }
23+
</List>
24+
</Paper>
25+
26+
<Paper radius='md' withBorder p='lg' mb='md'>
27+
<Title order={2}>Visible components</Title>
28+
29+
<List ml='md'>
30+
{ decodedToken?.visibleComponents.map((component: any, index: number) => {
31+
return <List.Item key={index}><Text>{component}</Text></List.Item>
32+
}) }
33+
</List>
34+
</Paper></> }
35+
</>);
36+
}

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { EgeriaAssetDetails } from './components/Assets/Details';
55
import { EgeriaAssetDetailsPrint } from './components/Assets/Details/print';
66
import { EgeriaAssetCatalog } from './components/Assets/Catalog';
77
import { EgeriaLineageGraphPrint } from './components/Lineage/Graph/print';
8+
import { EgeriaProfile } from './components/Profile';
89

910
export {
1011
// components
@@ -14,5 +15,6 @@ export {
1415
EgeriaGlossary,
1516
EgeriaLineageGraph,
1617
EgeriaLineageGraphRouteWrapper,
17-
EgeriaLineageGraphPrint
18+
EgeriaLineageGraphPrint,
19+
EgeriaProfile
1820
}

0 commit comments

Comments
 (0)