Simplify Builds page

Rather than showing the word "link" over and over in some columns,
hyperlink appropriate values instead.

Change -> change
Result -> build

Change-Id: I9fadb72a8b375631b24ea0cfcc17f6d54183a308
This commit is contained in:
James E. Blair 2018-10-12 10:58:04 -07:00
parent 99c38c9375
commit 3dded2796a
1 changed files with 9 additions and 16 deletions

View File

@ -51,7 +51,7 @@ class BuildsPage extends TableFilters {
}
componentDidMount () {
document.title = 'Zuul Build'
document.title = 'Zuul Builds'
if (this.props.tenant.name) {
this.updateData(this.getFilterFromUrl())
}
@ -67,47 +67,40 @@ class BuildsPage extends TableFilters {
const headerFormat = value => <Table.Heading>{value}</Table.Heading>
const cellFormat = (value) => (
<Table.Cell>{value}</Table.Cell>)
const linkCellFormat = (value) => (
const linkBuildFormat = (value, rowdata) => (
<Table.Cell>
<a href={value} target='_blank' rel='noopener noreferrer'>link</a>
<Link to={this.props.tenant.linkPrefix + '/build/' + rowdata.rowData.uuid}>{value}</Link>
</Table.Cell>
)
const linkBuildFormat = (value) => (
const linkChangeFormat = (value, rowdata) => (
<Table.Cell>
<Link to={this.props.tenant.linkPrefix + '/build/' + value}>link</Link>
<a href={rowdata.rowData.ref_url}>{value ? rowdata.rowData.change+','+rowdata.rowData.patchset : rowdata.rowData.newrev.substring(7,1)}</a>
</Table.Cell>
)
this.columns = []
this.filterTypes = []
const myColumns = [
'build',
'job',
'project',
'branch',
'pipeline',
'change',
'duration',
'log',
'start time',
'result']
myColumns.forEach(column => {
let prop = column
let formatter = cellFormat
// Adapt column name and property name
if (column === 'build') {
prop = 'uuid'
formatter = linkBuildFormat
}
if (column === 'job') {
prop = 'job_name'
} else if (column === 'start time') {
prop = 'start_time'
} else if (column === 'change') {
prop = 'ref_url'
formatter = linkCellFormat
} else if (column === 'log') {
prop = 'log_url'
formatter = linkCellFormat
prop = 'change'
formatter = linkChangeFormat
} else if (column === 'result') {
formatter = linkBuildFormat
}
const label = column.charAt(0).toUpperCase() + column.slice(1)
this.columns.push({