forked from p15670423/monkey
Island UI: improve the side navigation with an icon of the chosen scenario
This commit is contained in:
parent
ff9d649b76
commit
e3921ed454
|
@ -29,6 +29,8 @@ import {CompletedSteps} from "./side-menu/CompletedSteps";
|
||||||
import Timeout = NodeJS.Timeout;
|
import Timeout = NodeJS.Timeout;
|
||||||
import IslandHttpClient from "./IslandHttpClient";
|
import IslandHttpClient from "./IslandHttpClient";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
||||||
|
import {faFileCode, faLightbulb} from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
|
|
||||||
let notificationIcon = require('../images/notification-logo-512x512.png');
|
let notificationIcon = require('../images/notification-logo-512x512.png');
|
||||||
|
@ -180,20 +182,28 @@ class AppComponent extends AuthComponent {
|
||||||
|
|
||||||
getDefaultReport() {
|
getDefaultReport() {
|
||||||
if(this.state.islandMode === 'ransomware'){
|
if(this.state.islandMode === 'ransomware'){
|
||||||
return Routes.RansomwareReport
|
return Routes.RansomwareReport;
|
||||||
} else {
|
} else {
|
||||||
return Routes.SecurityReport
|
return Routes.SecurityReport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getIslandModeTitle() {
|
getIslandModeTitle(){
|
||||||
if(this.state.islandMode === 'ransomware'){
|
if(this.state.islandMode === 'ransomware'){
|
||||||
return "Ransomware"
|
return this.formIslandModeTitle("Ransomware", faFileCode);
|
||||||
} else {
|
} else {
|
||||||
return "Custom"
|
return this.formIslandModeTitle("Custom", faLightbulb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formIslandModeTitle(title, icon){
|
||||||
|
return (<>
|
||||||
|
<h5 className={'text-muted'}>
|
||||||
|
<FontAwesomeIcon icon={icon} /> {title}
|
||||||
|
</h5>
|
||||||
|
</>)
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
let defaultSideNavProps = {completedSteps: this.state.completedSteps,
|
let defaultSideNavProps = {completedSteps: this.state.completedSteps,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React from 'react';
|
import React, {ReactFragment} from 'react';
|
||||||
import {NavLink} from 'react-router-dom';
|
import {NavLink} from 'react-router-dom';
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
||||||
import {faCheck} from '@fortawesome/free-solid-svg-icons/faCheck';
|
import {faCheck} from '@fortawesome/free-solid-svg-icons/faCheck';
|
||||||
|
@ -19,14 +19,14 @@ type Props = {
|
||||||
disabled?: boolean,
|
disabled?: boolean,
|
||||||
completedSteps: CompletedSteps,
|
completedSteps: CompletedSteps,
|
||||||
defaultReport: string,
|
defaultReport: string,
|
||||||
header?: string
|
header?: ReactFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const SideNavComponent = ({disabled,
|
const SideNavComponent = ({disabled,
|
||||||
completedSteps,
|
completedSteps,
|
||||||
defaultReport,
|
defaultReport,
|
||||||
header=''}: Props) => {
|
header=null}: Props) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -38,10 +38,10 @@ const SideNavComponent = ({disabled,
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
|
||||||
<ul className='navigation'>
|
<ul className='navigation'>
|
||||||
{(header !== '') &&
|
{(header !== null) &&
|
||||||
<>
|
<>
|
||||||
<li>
|
<li>
|
||||||
<h4 className={'text-muted'}>{header}</h4>
|
{header}
|
||||||
</li>
|
</li>
|
||||||
<hr/>
|
<hr/>
|
||||||
</>}
|
</>}
|
||||||
|
|
|
@ -7,7 +7,7 @@ const SidebarLayoutComponent = ({component: Component,
|
||||||
sideNavDisabled = false,
|
sideNavDisabled = false,
|
||||||
completedSteps = null,
|
completedSteps = null,
|
||||||
defaultReport = '',
|
defaultReport = '',
|
||||||
sideNavHeader = '',
|
sideNavHeader = (<></>),
|
||||||
...other
|
...other
|
||||||
}) => (
|
}) => (
|
||||||
<Route {...other} render={() => {
|
<Route {...other} render={() => {
|
||||||
|
|
Loading…
Reference in New Issue