Merge pull request #2258 from iminoso/builds-null-check

Check for null data on builds table
This commit is contained in:
Ian Minoso 2016-12-22 15:52:44 -05:00 committed by GitHub
commit 82542619a3

View file

@ -26,12 +26,21 @@ export default class Build extends React.Component<any, any> {
); );
}); });
let buildId: string = element.id.split('-')[0]; 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( buildsTable.push(
<tr key={buildId}> <tr key={buildId}>
<td>{element.phase}</td> <td>{phase}</td>
<td>{buildId}</td> <td>{buildId}</td>
<td>{element.trigger_metadata.commit_info.message}</td> <td>{message}</td>
<td>{moment(element.started).format('l')}</td> <td>{moment(started).format('l')}</td>
<td>{tags}</td> <td>{tags}</td>
</tr> </tr>
) )