forked from p15670423/monkey
Merge pull request #1319 from guardicore/report-tabs-order-based-on-mode
Make ransomware report tab the default if in ransomware mode
This commit is contained in:
commit
1a4d2eb76c
|
@ -15,7 +15,7 @@ class ReportPageComponent extends AuthComponent {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.sectionsOrder = ['security', 'zeroTrust', 'attack', 'ransomware'];
|
this.sections = ['security', 'zeroTrust', 'attack', 'ransomware'];
|
||||||
this.state = {
|
this.state = {
|
||||||
securityReport: {},
|
securityReport: {},
|
||||||
attackReport: {},
|
attackReport: {},
|
||||||
|
@ -23,8 +23,8 @@ class ReportPageComponent extends AuthComponent {
|
||||||
ransomwareReport: {},
|
ransomwareReport: {},
|
||||||
allMonkeysAreDead: false,
|
allMonkeysAreDead: false,
|
||||||
runStarted: true,
|
runStarted: true,
|
||||||
selectedSection: ReportPageComponent.selectReport(this.sectionsOrder),
|
selectedSection: ReportPageComponent.selectReport(this.sections),
|
||||||
sections: [{key: 'security', title: 'Security report'},
|
orderedSections: [{key: 'security', title: 'Security report'},
|
||||||
{key: 'zeroTrust', title: 'Zero trust report'},
|
{key: 'zeroTrust', title: 'Zero trust report'},
|
||||||
{key: 'attack', title: 'ATT&CK report'}]
|
{key: 'attack', title: 'ATT&CK report'}]
|
||||||
};
|
};
|
||||||
|
@ -66,7 +66,7 @@ class ReportPageComponent extends AuthComponent {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (this.shouldShowRansomwareReport(this.state.ransomwareReport)) {
|
if (this.shouldShowRansomwareReport(this.state.ransomwareReport)) {
|
||||||
this.state.sections.push({key: 'ransomware', title: 'Ransomware report'})
|
this.addRansomwareReportTab();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,26 @@ class ReportPageComponent extends AuthComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addRansomwareReportTab() { // TODO: Fetch mode from API endpoint
|
||||||
|
let ransomwareTab = {key: 'ransomware', title: 'Ransomware report'};
|
||||||
|
|
||||||
|
// let mode = "";
|
||||||
|
// this.authFetch('/api/mode')
|
||||||
|
// .then(res => res.json())
|
||||||
|
// .then(res => {
|
||||||
|
// mode = res.mode
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
let mode = 'ransomware';
|
||||||
|
if (mode === 'ransomware') {
|
||||||
|
this.state.orderedSections.splice(0, 0, ransomwareTab);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.state.orderedSections.push(ransomwareTab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
clearInterval(this.state.ztReportRefreshInterval);
|
clearInterval(this.state.ztReportRefreshInterval);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +158,7 @@ class ReportPageComponent extends AuthComponent {
|
||||||
history.push(key)
|
history.push(key)
|
||||||
}}
|
}}
|
||||||
className={'report-nav'}>
|
className={'report-nav'}>
|
||||||
{this.state.sections.map(section => this.renderNavButton(section))}
|
{this.state.orderedSections.map(section => this.renderNavButton(section))}
|
||||||
</Nav>)}/>)
|
</Nav>)}/>)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue