in expanded_checklist/visual_interface/src/components/suite_summarizer/SuiteSummarizer.tsx [73:129]
public renderPerType(tests: TestResult[], maxNameLength: number): JSX.Element {
// first, get the types
const sources = tests.map(t => {
return {
name: t.name,
key: t.key(),
test: t,
fail_rate: t.testStats}
});
const columns: any[] = [
{
title: 'test name', dataIndex: 'name', key: 'name',
className: "test-name-col",
render: (name: string, __, _) => <pre
style={{ marginTop: 0, marginBottom: -1}}>{name.padEnd(maxNameLength)}</pre>
}, {
title: 'failure rate', dataIndex: 'fail_rate', key: 'fail_rate',
className: "test-stat-col",
render: (stats: TestStats, __, _) => <div style={{ marginTop: 0, marginBottom: -5}}>
<pre>
<span style={{"verticalAlign": "super", display: "inline"}}>
<code>{stats.strRate("fail", true)}</code></span>
<span style={{display: "inline", marginLeft: 10}}>
<TestStatsViz data={[stats]} type={"fail"}/></span>
</pre>
</div>
},
]
type RecordType = {name: string, key: string, test: TestResult, fail_rate: TestStats};
//console.log(testStore.testResult)
return <Table size="small" bordered className="full-width"
expandedRowKeys={testStore.testResult ? [testStore.testResult.key()] : []}
onExpand={
(expanded: boolean, record: RecordType) => {
//if (expanded) {
this.props.onSelect(record.test);
//} else {
// this.props.onSelect(null);
//}
}}
rowKey={(row) => row.key}
expandedRowRender={(record: {name: string, key: string, fail_rate: TestStats}) => {
const selectedTest = testStore.testResult;
const selectedKey = selectedTest ? selectedTest.key() : "NOT-A-KEY";
return selectedKey === record.key ? <div
className="full-width"
style={{backgroundColor: "white"}}
><TestSummarizer
forceSkip={selectedKey !== record.key}
key={`${record.key} ${selectedKey}`}
onFetch={() => {this.props.onFetch()}}
onSearch={() => {this.props.onSearch()}} /></div> : null
}}
pagination={false}
dataSource={sources} columns={columns} />;
}