Check for null data on builds table

This commit is contained in:
Ian Minoso 2016-12-22 15:36:42 -05:00
parent a9cced3282
commit 451334a502

View file

@ -26,12 +26,21 @@ export default class Build extends React.Component<any, any> {
);
});
let buildId: string = element.id.split('-')[0];
let phase: string = element.phase ? element.phase : 'Cannot retrieve phase';
let started: string = element.started ? element.started : 'Cannot retrieve start date';
let message: string;
if (element.trigger_metadata && element.trigger_metadata.commit_info && element.trigger_metadata.commit_info.message){
message = element.trigger_metadata.commit_info.message;
}
else {
message = 'Cannot retrieve message';
}
buildsTable.push(
<tr key={buildId}>
<td>{element.phase}</td>
<td>{phase}</td>
<td>{buildId}</td>
<td>{element.trigger_metadata.commit_info.message}</td>
<td>{moment(element.started).format('l')}</td>
<td>{message}</td>
<td>{moment(started).format('l')}</td>
<td>{tags}</td>
</tr>
)