feat(catalog): show entity tags in the catalog table

This commit is contained in:
Oliver Sand
2020-08-18 19:52:49 +02:00
parent bd6195d79f
commit f06588def7
2 changed files with 18 additions and 2 deletions
+2 -1
View File
@@ -127,7 +127,8 @@ function convertColumns<T extends object>(
): TableColumn<T>[] {
return columns.map(column => {
const headerStyle: React.CSSProperties = {};
const cellStyle: React.CSSProperties = {};
const cellStyle: React.CSSProperties =
typeof column.cellStyle === 'object' ? column.cellStyle : {};
if (column.highlight) {
headerStyle.color = theme.palette.textContrast;
@@ -15,7 +15,7 @@
*/
import { Entity, LocationSpec } from '@backstage/catalog-model';
import { Table, TableColumn, TableProps } from '@backstage/core';
import { Link } from '@material-ui/core';
import { Link, Chip } from '@material-ui/core';
import Edit from '@material-ui/icons/Edit';
import GitHub from '@material-ui/icons/GitHub';
import { Alert } from '@material-ui/lab';
@@ -63,6 +63,21 @@ const columns: TableColumn<Entity>[] = [
title: 'Description',
field: 'metadata.description',
},
{
title: 'Tags',
field: 'metadata.tags',
cellStyle: {
padding: '0px 16px 0px 20px',
},
render: (entity: Entity) => (
<>
{entity.metadata.tags &&
entity.metadata.tags.map(t => (
<Chip label={t} color="secondary" style={{ marginBottom: '0px' }} />
))}
</>
),
},
];
type CatalogTableProps = {