This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/js/directives/components/pages/repo-page/build.tsx

65 lines
1.6 KiB
TypeScript
Raw Normal View History

2016-12-12 20:05:22 +00:00
import * as React from 'react';
import * as moment from "moment";
import Throbber from "./throbber";
2016-12-12 20:05:22 +00:00
export default class Build extends React.Component<any, any> {
render () {
let builds: any = this.props.data;
let buildsTable: any = [];
let table: any;
2016-12-12 20:05:22 +00:00
if (Object.keys(builds).length === 0) {
buildsTable.push('Loading')
table = <Throbber />
2016-12-12 20:05:22 +00:00
}
else {
// Get Builds
2016-12-12 20:05:22 +00:00
builds.forEach((element, i) => {
let tags: Array<any> = []
element.tags.forEach(tag => {
tags.push(
<span className="building-tag">
<span className="tag-span rp-tagSpan">
<i className="fa fa-tag"></i> {tag}
</span>
</span>
);
});
let buildId: string = element.id.split('-')[0];
buildsTable.push(
<tr key={buildId}>
<td>{element.phase}</td>
<td>{buildId}</td>
<td>{element.trigger_metadata.commit_info.message}</td>
<td>{moment(element.started).format('l')}</td>
<td>{tags}</td>
</tr>
)
});
// Build the table
table = (
<table className="co-table">
<thead>
<tr>
<td></td>
<td>BUILD ID</td>
<td>TRIGGERED BY</td>
<td>DATE STARTED</td>
<td>TAGS</td>
</tr>
</thead>
<tbody>
{buildsTable}
</tbody>
</table>
);
2016-12-12 20:05:22 +00:00
}
return(
<div className="row">
{table}
</div>
2016-12-12 20:05:22 +00:00
);
}
}