Skip to content

Commit

Permalink
Merge pull request #67 from jorgenbele/feat-details-url-and-source-name
Browse files Browse the repository at this point in the history
Make `Source` table column display source name and merge with `Details URL` column
  • Loading branch information
ddabble committed Jun 17, 2020
2 parents 003c7ef + 59f90fd commit f7ca589
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/components/react-table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,31 @@ type AlertsProps = {
// 2014-09-15T11:25:42.833000+02:00
//}

const SourceDetailUrl = (row: { value: string, original: { details_url: string }}) => {
return (
<a href={row.original.details_url} rel="noopener noreferrer" target='_blank'>
{' '}
{row.value}{' '}
</a>
)
}

const Table: React.FC<AlertsProps> = props => {
const columns: any = [
{
Header: 'Timestamp',
accessor: 'timestamp'
accessor: 'timestamp',
id: 'timestamp_col',
},
{ Header: 'Problem type', accessor: 'problem_type.name' },
{ Header: 'Description', accessor: 'description' },
{ Header: 'Object', accessor: 'object.name' },
{ Header: 'Parent object', accessor: 'parent_object.name' },
{ Header: 'Source', accessor: 'source.type' },
{ Header: 'Problem type', accessor: 'problem_type.name', id: 'problem_type_col', },
{ Header: 'Description', accessor: 'description', id: 'description_col', },
{ Header: 'Object', accessor: 'object.name', id: 'object_col', },
{ Header: 'Parent object', accessor: 'parent_object.name', id: 'parent_object_col', },
{
Header: 'Details URL',
accessor: 'details_url',
Cell: (row: { value: string }) => (
<a href={row.value} rel="noopener noreferrer" target='_blank'>
{' '}
{row.value}{' '}
</a>
)
Header: 'Source',
accessor: (row: any, i: any) => String(row.source.name),
id: 'source_col',
Cell: SourceDetailUrl,
}
];

Expand Down

0 comments on commit f7ca589

Please sign in to comment.