forked from p15670423/monkey
Island UI: add island scenario/mode to the top of the side navigation if it's chosen
This commit is contained in:
parent
c760e06f03
commit
8584217e3b
|
@ -186,12 +186,21 @@ class AppComponent extends AuthComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSideNavHeader() {
|
||||||
|
if(this.state.islandMode === 'ransomware'){
|
||||||
|
return "Ransomware"
|
||||||
|
} else {
|
||||||
|
return "Custom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
let defaultSideNavProps = {completedSteps: this.state.completedSteps,
|
let defaultSideNavProps = {completedSteps: this.state.completedSteps,
|
||||||
onStatusChange: this.updateStatus,
|
onStatusChange: this.updateStatus,
|
||||||
islandMode: this.state.islandMode,
|
islandMode: this.state.islandMode,
|
||||||
defaultReport: this.getDefaultReport()}
|
defaultReport: this.getDefaultReport(),
|
||||||
|
sideNavHeader: this.getSideNavHeader()}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
|
|
|
@ -18,11 +18,15 @@ const infectionMonkeyImage = require('../images/infection-monkey.svg');
|
||||||
type Props = {
|
type Props = {
|
||||||
disabled?: boolean,
|
disabled?: boolean,
|
||||||
completedSteps: CompletedSteps,
|
completedSteps: CompletedSteps,
|
||||||
defaultReport: string
|
defaultReport: string,
|
||||||
|
header?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const SideNavComponent = ({disabled, completedSteps, defaultReport}: Props) => {
|
const SideNavComponent = ({disabled,
|
||||||
|
completedSteps,
|
||||||
|
defaultReport,
|
||||||
|
header=''}: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -34,6 +38,14 @@ const SideNavComponent = ({disabled, completedSteps, defaultReport}: Props) => {
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
|
||||||
<ul className='navigation'>
|
<ul className='navigation'>
|
||||||
|
{(header !== '') &&
|
||||||
|
<>
|
||||||
|
<li>
|
||||||
|
<h4 className={'text-muted'}>{header}</h4>
|
||||||
|
</li>
|
||||||
|
<hr/>
|
||||||
|
</>}
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<NavLink to={Routes.RunMonkeyPage} className={getNavLinkClass()}>
|
<NavLink to={Routes.RunMonkeyPage} className={getNavLinkClass()}>
|
||||||
<span className='number'>1.</span>
|
<span className='number'>1.</span>
|
||||||
|
|
|
@ -7,6 +7,7 @@ const SidebarLayoutComponent = ({component: Component,
|
||||||
sideNavDisabled = false,
|
sideNavDisabled = false,
|
||||||
completedSteps = null,
|
completedSteps = null,
|
||||||
defaultReport = '',
|
defaultReport = '',
|
||||||
|
sideNavHeader = '',
|
||||||
...other
|
...other
|
||||||
}) => (
|
}) => (
|
||||||
<Route {...other} render={() => {
|
<Route {...other} render={() => {
|
||||||
|
@ -15,7 +16,8 @@ const SidebarLayoutComponent = ({component: Component,
|
||||||
<Col sm={3} md={3} lg={3} xl={2} className='sidebar'>
|
<Col sm={3} md={3} lg={3} xl={2} className='sidebar'>
|
||||||
<SideNavComponent disabled={sideNavDisabled}
|
<SideNavComponent disabled={sideNavDisabled}
|
||||||
completedSteps={completedSteps}
|
completedSteps={completedSteps}
|
||||||
defaultReport={defaultReport}/>
|
defaultReport={defaultReport}
|
||||||
|
header={sideNavHeader}/>
|
||||||
</Col>
|
</Col>
|
||||||
<Component {...other} />
|
<Component {...other} />
|
||||||
</Row>)
|
</Row>)
|
||||||
|
|
Loading…
Reference in New Issue