Merge "[web] update tenant page to PF4"
This commit is contained in:
commit
fb57e35626
|
@ -16,12 +16,26 @@ import * as React from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { Table } from 'patternfly-react'
|
import {
|
||||||
import { PageSection, PageSectionVariants } from '@patternfly/react-core'
|
BuildIcon,
|
||||||
|
CubeIcon,
|
||||||
|
CubesIcon,
|
||||||
|
DesktopIcon,
|
||||||
|
FolderIcon,
|
||||||
|
HomeIcon,
|
||||||
|
RepositoryIcon,
|
||||||
|
TrendUpIcon
|
||||||
|
} from '@patternfly/react-icons'
|
||||||
|
import {
|
||||||
|
Table,
|
||||||
|
TableHeader,
|
||||||
|
TableBody,
|
||||||
|
TableVariant,
|
||||||
|
} from '@patternfly/react-table'
|
||||||
import { Fetching } from '../containers/Fetching'
|
import { Fetching } from '../containers/Fetching'
|
||||||
import { fetchTenantsIfNeeded } from '../actions/tenants'
|
import { fetchTenantsIfNeeded } from '../actions/tenants'
|
||||||
|
import { PageSection, PageSectionVariants } from '@patternfly/react-core'
|
||||||
|
import { IconProperty } from '../containers/build/Misc'
|
||||||
|
|
||||||
class TenantsPage extends React.Component {
|
class TenantsPage extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -47,54 +61,65 @@ class TenantsPage extends React.Component {
|
||||||
return <Fetching />
|
return <Fetching />
|
||||||
}
|
}
|
||||||
|
|
||||||
const tenants = remoteData.tenants
|
const tenants = remoteData.tenants.map((tenant) => {
|
||||||
const headerFormat = value => <Table.Heading>{value}</Table.Heading>
|
return {
|
||||||
const cellFormat = (value) => (
|
cells: [
|
||||||
<Table.Cell>{value}</Table.Cell>)
|
{title: (<b>{tenant.name}</b>)},
|
||||||
const columns = []
|
{title: (<Link to={'/t/' + tenant.name + '/status'}>Status</Link>)},
|
||||||
const myColumns = [
|
{title: (<Link to={'/t/' + tenant.name + '/projects'}>Projects</Link>)},
|
||||||
'name', 'status', 'projects', 'jobs', 'builds', 'buildsets',
|
{title: (<Link to={'/t/' + tenant.name + '/jobs'}>Jobs</Link>)},
|
||||||
'projects count', 'queue']
|
{title: (<Link to={'/t/' + tenant.name + '/builds'}>Builds</Link>)},
|
||||||
myColumns.forEach(column => {
|
{title: (<Link to={'/t/' + tenant.name + '/buildsets'}>Buildsets</Link>)},
|
||||||
let prop = column
|
tenant.projects,
|
||||||
if (column === 'projects count') {
|
tenant.queue
|
||||||
prop = 'projects'
|
]}})
|
||||||
} else if (column === 'projects') {
|
const columns = [
|
||||||
prop = 'projects_link'
|
{
|
||||||
|
title: <IconProperty icon={<HomeIcon />} value="Name"/>,
|
||||||
|
dataLabel: 'Name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <IconProperty icon={<DesktopIcon />} value="Status"/>,
|
||||||
|
dataLabel: 'Status',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <IconProperty icon={<CubeIcon />} value="Projects"/>,
|
||||||
|
dataLabel: 'Projects',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <IconProperty icon={<BuildIcon />} value="Jobs"/>,
|
||||||
|
dataLabel: 'Jobs',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <IconProperty icon={<FolderIcon />} value="Builds"/>,
|
||||||
|
dataLabel: 'Builds',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <IconProperty icon={<RepositoryIcon />} value="Buildsets"/>,
|
||||||
|
dataLabel: 'Buildsets',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <IconProperty icon={<CubesIcon />} value="Project count"/>,
|
||||||
|
dataLabel: 'Project count',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <IconProperty icon={<TrendUpIcon />} value="Queue"/>,
|
||||||
|
dataLabel: 'Queue',
|
||||||
}
|
}
|
||||||
columns.push({
|
]
|
||||||
header: {label: column,
|
|
||||||
formatters: [headerFormat]},
|
|
||||||
property: prop,
|
|
||||||
cell: {formatters: [cellFormat]}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
tenants.forEach(tenant => {
|
|
||||||
tenant.status = (
|
|
||||||
<Link to={'/t/' + tenant.name + '/status'}>Status</Link>)
|
|
||||||
tenant.projects_link = (
|
|
||||||
<Link to={'/t/' + tenant.name + '/projects'}>Projects</Link>)
|
|
||||||
tenant.jobs = (
|
|
||||||
<Link to={'/t/' + tenant.name + '/jobs'}>Jobs</Link>)
|
|
||||||
tenant.builds = (
|
|
||||||
<Link to={'/t/' + tenant.name + '/builds'}>Builds</Link>)
|
|
||||||
tenant.buildsets = (
|
|
||||||
<Link to={'/t/' + tenant.name + '/buildsets'}>Buildsets</Link>)
|
|
||||||
})
|
|
||||||
return (
|
return (
|
||||||
<PageSection variant={PageSectionVariants.light}>
|
<PageSection variant={PageSectionVariants.light}>
|
||||||
<Table.PfProvider
|
<Table
|
||||||
striped
|
aria-label="Tenant Table"
|
||||||
bordered
|
variant={TableVariant.compact}
|
||||||
hover
|
cells={columns}
|
||||||
columns={columns}
|
rows={tenants}
|
||||||
>
|
className="zuul-tenant-table"
|
||||||
<Table.Header/>
|
>
|
||||||
<Table.Body
|
<TableHeader />
|
||||||
rows={tenants}
|
<TableBody />
|
||||||
rowKey="name"
|
</Table>
|
||||||
/>
|
|
||||||
</Table.PfProvider>
|
|
||||||
</PageSection>
|
</PageSection>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue