cc: Rename "sections" -> "orderedSections", and "sectionsOrder" -> "sections" in `ReportPage.js`

`sectionsOrder` was not handling the order of the sections.
It was only being used to render the selected section.
`sections` is what was actually handling the order of the sections,
which is now `orderedSections`.
This commit is contained in:
Shreya 2021-07-13 14:25:41 +05:30
parent 278a09e039
commit 8efd562935
1 changed files with 6 additions and 6 deletions

View File

@ -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'}]
};
@ -117,10 +117,10 @@ class ReportPageComponent extends AuthComponent {
let mode = 'ransomware';
if (mode === 'ransomware') {
this.state.sections.splice(0, 0, ransomwareTab);
this.state.orderedSections.splice(0, 0, ransomwareTab);
}
else {
this.state.sections.push(ransomwareTab);
this.state.orderedSections.push(ransomwareTab);
}
}
@ -160,7 +160,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>)}/>)
};