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) {
|
||||
super(props);
|
||||
this.sectionsOrder = ['security', 'zeroTrust', 'attack', 'ransomware'];
|
||||
this.sections = ['security', 'zeroTrust', 'attack', 'ransomware'];
|
||||
this.state = {
|
||||
securityReport: {},
|
||||
attackReport: {},
|
||||
|
@ -23,8 +23,8 @@ class ReportPageComponent extends AuthComponent {
|
|||
ransomwareReport: {},
|
||||
allMonkeysAreDead: false,
|
||||
runStarted: true,
|
||||
selectedSection: ReportPageComponent.selectReport(this.sectionsOrder),
|
||||
sections: [{key: 'security', title: 'Security report'},
|
||||
selectedSection: ReportPageComponent.selectReport(this.sections),
|
||||
orderedSections: [{key: 'security', title: 'Security report'},
|
||||
{key: 'zeroTrust', title: 'Zero trust report'},
|
||||
{key: 'attack', title: 'ATT&CK report'}]
|
||||
};
|
||||
|
@ -66,7 +66,7 @@ class ReportPageComponent extends AuthComponent {
|
|||
});
|
||||
});
|
||||
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() {
|
||||
clearInterval(this.state.ztReportRefreshInterval);
|
||||
}
|
||||
|
@ -138,7 +158,7 @@ class ReportPageComponent extends AuthComponent {
|
|||
history.push(key)
|
||||
}}
|
||||
className={'report-nav'}>
|
||||
{this.state.sections.map(section => this.renderNavButton(section))}
|
||||
{this.state.orderedSections.map(section => this.renderNavButton(section))}
|
||||
</Nav>)}/>)
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue