Skip to content

Commit

Permalink
Fix [Artifacts] UI crash when artifact doesn't have a producer (#2068)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariana-furyk authored Nov 9, 2023
1 parent 5940d5d commit 34a418f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
54 changes: 28 additions & 26 deletions src/elements/TableProducerCell/TableProducerCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,34 @@ const TableProducerCell = ({ bodyCellClassName, className, producer }) => {
const cellClassNames = classnames('table-body__cell', className, bodyCellClassName)

return (
<td className={cellClassNames}>
{producer.name && uid && (
<Link
className="data-ellipsis"
to={`/projects/${project}/jobs/${MONITOR_JOBS_TAB}/${producer.name}/${
uid.split('-')[0]
}/${overviewTab.id}`}
>
<div className="link">
<Tooltip
template={
<ProducerTooltipTemplate
kind={producer.kind}
owner={producer.owner ? producer.owner : ''}
/>
}
>
{producer.name}
</Tooltip>
</div>
</Link>
)}
{producer.name && !uid && (
<Tooltip template={<TextTooltipTemplate text={producer.name} />}>{producer.name}</Tooltip>
)}
</td>
producer && (
<td className={cellClassNames}>
{producer?.name && uid && (
<Link
className="data-ellipsis"
to={`/projects/${project}/jobs/${MONITOR_JOBS_TAB}/${producer.name}/${
uid.split('-')[0]
}/${overviewTab.id}`}
>
<div className="link">
<Tooltip
template={
<ProducerTooltipTemplate
kind={producer.kind}
owner={producer.owner ? producer.owner : ''}
/>
}
>
{producer.name}
</Tooltip>
</div>
</Link>
)}
{producer?.name && !uid && (
<Tooltip template={<TextTooltipTemplate text={producer.name} />}>{producer.name}</Tooltip>
)}
</td>
)
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/utils/createArtifactsContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const createModelsRowData = (artifact, project, frontendSpec, showExpandB
id: `producer.${artifact.ui.identifierUnique}`,
headerId: 'producer',
headerLabel: 'Producer',
value: artifact.producer.name || '',
value: artifact.producer?.name || '',
template: <TableProducerCell className="table-cell-1" producer={artifact.producer} />,
className: 'table-cell-1',
type: 'producer'
Expand Down Expand Up @@ -302,7 +302,7 @@ export const createFilesRowData = (artifact, project, frontendSpec, showExpandBu
id: `producer.${artifact.ui.identifierUnique}`,
headerId: 'producer',
headerLabel: 'Producer',
value: artifact.producer.name || '',
value: artifact.producer?.name || '',
template: <TableProducerCell className="table-cell-1" producer={artifact.producer} />,
className: 'table-cell-1',
type: 'producer'
Expand Down Expand Up @@ -512,7 +512,7 @@ export const createDatasetsRowData = (artifact, project, frontendSpec, showExpan
id: `producer.${artifact.ui.identifierUnique}`,
headerId: 'producer',
headerLabel: 'Producer',
value: artifact.producer.name || '',
value: artifact.producer?.name || '',
template: <TableProducerCell className="table-cell-1" producer={artifact.producer} />,
className: 'table-cell-1',
type: 'producer'
Expand Down

0 comments on commit 34a418f

Please sign in to comment.