Removed not working "Back" button from run monkey page, also removed unnecessary code

This commit is contained in:
VakarisZ 2020-09-18 15:35:34 +03:00
parent c4f4a8ef95
commit 38b1cfacaa
3 changed files with 8 additions and 21 deletions

View File

@ -5,7 +5,6 @@ import {Container} from 'react-bootstrap';
import RunServerPage from 'components/pages/RunServerPage';
import ConfigurePage from 'components/pages/ConfigurePage';
import RunMonkeyPage from 'components/pages/RunMonkeyPage/RunMonkeyPage';
import RunMonkeyPage2 from 'components/pages/RunMonkeyPage/RunMonkeyPage2';
import MapPage from 'components/pages/MapPage';
import TelemetryPage from 'components/pages/TelemetryPage';
import StartOverPage from 'components/pages/StartOverPage';
@ -149,10 +148,6 @@ class AppComponent extends AuthComponent {
<StandardLayoutComponent component={RunMonkeyPage}
onStatusChange={this.updateStatus}
completedSteps={this.state.completedSteps}/>)}
{this.renderRoute('/run-monkey2',
<StandardLayoutComponent component={RunMonkeyPage2}
onStatusChange={this.updateStatus}
completedSteps={this.state.completedSteps}/>)}
{this.renderRoute('/infection/map',
<StandardLayoutComponent component={MapPage}
onStatusChange={this.updateStatus}

View File

@ -7,10 +7,14 @@ import GenerateLocalWindowsPowershell from './commands/local_windows_powershell'
import GenerateLocalLinuxWget from './commands/local_linux_wget';
import GenerateLocalLinuxCurl from './commands/local_linux_curl';
import CommandDisplay from './CommandDisplay';
import RunOptions from './RunOptions';
const LocalManualRunOptions = (props) => {
return InlineSelection(getContents, props)
return InlineSelection(getContents, {
...props,
onBackButtonClick: () => {props.setComponent()}
})
}
const getContents = (props) => {
@ -35,12 +39,12 @@ const getContents = (props) => {
}
function generateCommands() {
if(osType === OS_TYPES.WINDOWS_64 || osType === OS_TYPES.WINDOWS_32) {
if (osType === OS_TYPES.WINDOWS_64 || osType === OS_TYPES.WINDOWS_32) {
return [{type: 'CMD', command: GenerateLocalWindowsCmd(selectedIp, osType)},
{type: 'Powershell', command: GenerateLocalWindowsPowershell(selectedIp, osType)}]
{type: 'Powershell', command: GenerateLocalWindowsPowershell(selectedIp, osType)}]
} else {
return [{type: 'CURL', command: GenerateLocalLinuxCurl(selectedIp, osType)},
{type: 'WGET', command: GenerateLocalLinuxWget(selectedIp, osType)}]
{type: 'WGET', command: GenerateLocalLinuxWget(selectedIp, osType)}]
}
}

View File

@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import BackButton from './BackButton';
import ManualRunOptions from '../../pages/RunMonkeyPage/RunOptions';
import {Col, Row, Container} from 'react-bootstrap';
@ -21,22 +20,11 @@ export default function InlineSelection(WrappedComponent, props) {
function renderBackButton(props){
if(props.onBackButtonClick !== undefined){
return (<BackButton onClick={props.onBackButtonClick}/>);
} else if(props.previousComponent === undefined){
return (<BackButton onClick={() => {setPreviousComponent(props, props.previousComponent)}}/>);
}
}
function setPreviousComponent(props) {
if (props.previousComponent === ManualRunOptions) {
return props.setComponent()
} else {
return props.setComponent(props.previousComponent, props)
}
}
InlineSelection.propTypes = {
setComponent: PropTypes.func,
ips: PropTypes.arrayOf(PropTypes.string),
previousComponent: PropTypes.object,
onBackButtonClick: PropTypes.func
}