Added report loader to attack report

This commit is contained in:
VakarisZ 2019-11-27 15:48:54 +02:00
parent b601ef266b
commit 5dbf0d39a6
1 changed files with 9 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import {ScanStatus} from '../attack/techniques/Helpers';
import Matrix from './attack/ReportMatrix'; import Matrix from './attack/ReportMatrix';
import SelectedTechnique from './attack/SelectedTechnique'; import SelectedTechnique from './attack/SelectedTechnique';
import TechniqueDropdowns from './attack/TechniqueDropdowns'; import TechniqueDropdowns from './attack/TechniqueDropdowns';
import ReportLoader from './common/ReportLoader';
import T1210 from '../attack/techniques/T1210'; import T1210 from '../attack/techniques/T1210';
import T1197 from '../attack/techniques/T1197'; import T1197 from '../attack/techniques/T1197';
@ -70,11 +71,13 @@ class AttackReport extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
schema: this.props.report['schema'],
techniques: AttackReport.addLinksToTechniques(this.props.report['schema'], this.props.report['techniques']),
selectedTechnique: false, selectedTechnique: false,
collapseOpen: '', collapseOpen: '',
}; };
if (typeof this.props.report.schema !== 'undefined' && typeof this.props.report.techniques !== 'undefined'){
this.state['schema'] = this.props.report['schema'];
this.state['techniques'] = AttackReport.addLinksToTechniques(this.props.report['schema'], this.props.report['techniques']);
}
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
@ -171,8 +174,8 @@ class AttackReport extends React.Component {
} }
render() { render() {
if (Object.keys(this.state.techniques).length === 0 && this.state.runStarted) { if (typeof this.state.schema === 'undefined' || typeof this.state.techniques === 'undefined') {
return (<h1>No techniques were scanned</h1>); return (<ReportLoader/>);
} else { } else {
return (<div> {this.generateReportContent()}</div>); return (<div> {this.generateReportContent()}</div>);
} }