import * as React from 'react'; import * as moment from "moment"; import Throbber from "./throbber"; export default class Build extends React.Component { render () { let builds: any = this.props.data; let buildsTable: any = []; let table: any; if (Object.keys(builds).length === 0) { buildsTable.push('Loading') table = } else { // Get Builds builds.forEach((element, i) => { let tags: Array = [] element.tags.forEach(tag => { tags.push( {tag} ); }); 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( {phase} {buildId} {message} {moment(started).format('l')} {tags} ) }); // Build the table table = ( {buildsTable}
BUILD ID TRIGGERED BY DATE STARTED TAGS
); } return(
{table}
); } }