Skip to content

Commit d4ed8c2

Browse files
author
Paul Howells
committed
Add Related Resources Card
1 parent 181f6d7 commit d4ed8c2

4 files changed

Lines changed: 68 additions & 2 deletions

File tree

plugins/catalog-dataset/src/components/CatalogDataset/CatalogDatasetPage.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { LineageAndQualityCard } from './LineageAndQualityCard';
1717
import { VersioningAndChangeGovernanceCard } from './VersioningAndChangeGovernanceCard';
1818
import { SupportCard } from './SupportCard';
1919
import { DatasetApisDialog } from './DatasetApisDialog';
20+
import { RelatedResourcesCard } from './RelatedResourcesCard';
2021

2122
export const CatalogDatasetPage = () => {
2223
const { entity } = useEntity();
@@ -120,6 +121,10 @@ export const CatalogDatasetPage = () => {
120121
/>
121122

122123
<SupportCard support={spec.support} />
124+
125+
<RelatedResourcesCard
126+
relatedResources={spec.relatedResources}
127+
/>
123128
</Grid>
124129
</Grid>
125130

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import {
2+
Card,
3+
CardHeader,
4+
CardContent,
5+
Typography,
6+
Link,
7+
} from '@material-ui/core';
8+
9+
type RelatedResource = {
10+
url: string;
11+
title?: string;
12+
};
13+
14+
type Props = {
15+
relatedResources?: RelatedResource[];
16+
};
17+
18+
export const RelatedResourcesCard = ({
19+
relatedResources,
20+
}: Props) => {
21+
return (
22+
<Card
23+
style={{
24+
borderRadius: 8,
25+
marginBottom: 16,
26+
border: '2px solid rgba(0,0,0,0.23)',
27+
}}
28+
variant="outlined"
29+
>
30+
<CardHeader title="Related resources" />
31+
<CardContent>
32+
{relatedResources?.length ? (
33+
<ul style={{ margin: 0, paddingLeft: 20 }}>
34+
{relatedResources.map(resource => (
35+
<li key={`${resource.url}-${resource.title ?? ''}`}>
36+
<Typography variant="body2">
37+
<Link
38+
href={resource.url}
39+
target="_blank"
40+
rel="noopener noreferrer"
41+
>
42+
{resource.title ?? resource.url}
43+
</Link>
44+
</Typography>
45+
</li>
46+
))}
47+
</ul>
48+
) : (
49+
<Typography variant="body2">No related resources defined.</Typography>
50+
)}
51+
</CardContent>
52+
</Card>
53+
);
54+
};

plugins/catalog-dataset/src/components/CatalogDataset/SchemaCard.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
TableRow,
99
TableCell,
1010
TableBody,
11+
Link,
1112
} from '@material-ui/core';
1213

1314
type SchemaField = {
@@ -123,6 +124,12 @@ export const SchemaCard = ({ tables }: Props) => {
123124
) : (
124125
<Typography variant="body2">No schema available.</Typography>
125126
)}
127+
<Link
128+
href="https://www.notimplemented.net/"
129+
target="_blank"
130+
>
131+
{'Download schema'}
132+
</Link>
126133
</CardContent>
127134
</Card>
128135
);

plugins/catalog-dataset/src/components/CatalogDataset/SupportCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ export const SupportCard = ({ support }: Props) => {
103103
<ul style={{ margin: '0 0 8px 0', paddingLeft: 20 }}>
104104
<li>
105105
<Typography variant="body2">
106-
{support?.dataCustodian ?? 'N/A'}
106+
Data Custodian: {support?.dataCustodian ?? 'N/A'}
107107
</Typography>
108108
</li>
109109
<li>
110110
<Typography variant="body2">
111-
{support?.governanceAuthority ?? 'N/A'}
111+
Governance Authority: {support?.governanceAuthority ?? 'N/A'}
112112
</Typography>
113113
</li>
114114
</ul>

0 commit comments

Comments
 (0)