diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js new file mode 100644 index 000000000..1fbf8b0b3 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js @@ -0,0 +1,37 @@ +import React from 'react'; +import {Modal, Button} from 'react-bootstrap'; + +function UnsafeOptionsConfirmationModal(props) { + return ( + + +

+
Warning
+

+

+ You have selected some options which are not safe for all environments. + These options could cause some systems to become unstable or malfunction. + Are you sure you want to use the selected settings? +

+
+ + +
+
+
+ ) +} + +export default UnsafeOptionsConfirmationModal; diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index b0990fc8c..8345ca588 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -11,6 +11,7 @@ import {faExclamationCircle} from '@fortawesome/free-solid-svg-icons/faExclamati import {formValidationFormats} from '../configuration-components/ValidationFormats'; import transformErrors from '../configuration-components/ValidationErrorMessages'; import InternalConfig from '../configuration-components/InternalConfig'; +import UnsafeOptionsConfirmationModal from '../configuration-components/UnsafeOptionsConfirmationModal.js'; const ATTACK_URL = '/api/attack'; const CONFIG_URL = '/api/configuration/island'; @@ -76,6 +77,17 @@ class ConfigurePageComponent extends AuthComponent { }); }; + onUnsafeConfirmationCancelClick = () => { + this.setState({showUnsafeOptionsConfirmation: false}) + } + + onUnsafeConfirmationContinueClick = () => { + this.setState( + {unsafeOptionsConfirmed: true, showUnsafeOptionsConfirmation: false}, + () => {this.onSubmit()} + ); + } + updateConfig = () => { this.authFetch(CONFIG_URL) .then(res => res.json()) @@ -255,45 +267,6 @@ class ConfigurePageComponent extends AuthComponent { ) }; - renderUnsafeOptionsConfirmationModal = () => { - return ( - - -

-
Warning
-

-

- You have selected some options which are not safe for all environments. - These options could cause some systems to become unstable or malfunction. - Are you sure you want to use the selected settings? -

-
- - -
-
-
- ) - } - userChangedConfig() { if (JSON.stringify(this.state.configuration) === JSON.stringify(this.initialConfig)) { if (Object.keys(this.currentFormData).length === 0 || @@ -503,7 +476,11 @@ class ConfigurePageComponent extends AuthComponent { lg={{offset: 3, span: 8}} xl={{offset: 2, span: 8}} className={'main'}> {this.renderAttackAlertModal()} - {this.renderUnsafeOptionsConfirmationModal()} +

Monkey Configuration

{this.renderNav()} {content}