forked from p15670423/monkey
Minor FindingsTable.js readability refactoring
This commit is contained in:
parent
789c58f0ac
commit
d9a5289c8d
|
@ -21,30 +21,13 @@ export class FindingsTable extends Component {
|
||||||
|
|
||||||
{
|
{
|
||||||
Header: 'Details', id: 'details',
|
Header: 'Details', id: 'details',
|
||||||
accessor: x => {
|
accessor: x => this.getFindingDetails(x),
|
||||||
if (x.finding_type === 'scoutsuite_finding') {
|
|
||||||
return <ScoutSuiteRuleButton scoutsuite_rules={x.details.scoutsuite_rules}
|
|
||||||
scoutsuite_data={this.props.scoutsuite_data}/>;
|
|
||||||
} else if (x.finding_type === 'monkey_finding') {
|
|
||||||
return <EventsButton finding_id={x.finding_id}
|
|
||||||
latest_events={x.details.latest_events}
|
|
||||||
oldest_events={x.details.oldest_events}
|
|
||||||
event_count={x.details.event_count}
|
|
||||||
exportFilename={'Events_' + x.test_key}/>;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
maxWidth: EVENTS_COLUMN_MAX_WIDTH
|
maxWidth: EVENTS_COLUMN_MAX_WIDTH
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
Header: 'Pillars', id: 'pillars',
|
Header: 'Pillars', id: 'pillars',
|
||||||
accessor: x => {
|
accessor: x => this.getFindingPillars(x),
|
||||||
const pillars = x.pillars;
|
|
||||||
const pillarLabels = pillars.map((pillar) =>
|
|
||||||
<PillarLabel key={pillar.name} pillar={pillar.name} status={pillar.status}/>
|
|
||||||
);
|
|
||||||
return <div style={{textAlign: 'center'}}>{pillarLabels}</div>;
|
|
||||||
},
|
|
||||||
maxWidth: PILLARS_COLUMN_MAX_WIDTH,
|
maxWidth: PILLARS_COLUMN_MAX_WIDTH,
|
||||||
style: {'whiteSpace': 'unset'}
|
style: {'whiteSpace': 'unset'}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +35,27 @@ export class FindingsTable extends Component {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
getFindingDetails(finding) {
|
||||||
|
if (finding.finding_type === 'scoutsuite_finding') {
|
||||||
|
return <ScoutSuiteRuleButton scoutsuite_rules={finding.details.scoutsuite_rules}
|
||||||
|
scoutsuite_data={this.props.scoutsuite_data}/>;
|
||||||
|
} else if (finding.finding_type === 'monkey_finding') {
|
||||||
|
return <EventsButton finding_id={finding.finding_id}
|
||||||
|
latest_events={finding.details.latest_events}
|
||||||
|
oldest_events={finding.details.oldest_events}
|
||||||
|
event_count={finding.details.event_count}
|
||||||
|
exportFilename={'Events_' + finding.test_key}/>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getFindingPillars(finding) {
|
||||||
|
const pillars = finding.pillars;
|
||||||
|
const pillarLabels = pillars.map((pillar) =>
|
||||||
|
<PillarLabel key={pillar.name} pillar={pillar.name} status={pillar.status}/>
|
||||||
|
);
|
||||||
|
return <div style={{textAlign: 'center'}}>{pillarLabels}</div>;
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <Fragment>
|
return <Fragment>
|
||||||
<h3>{<span style={{display: 'inline-block'}}><StatusLabel status={this.props.status} showText={true}/>
|
<h3>{<span style={{display: 'inline-block'}}><StatusLabel status={this.props.status} showText={true}/>
|
||||||
|
|
Loading…
Reference in New Issue