diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js index 5dca8e86e..9d82a1b8d 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js @@ -1,20 +1,13 @@ -import React from "react"; -import {Card, Button, Form} from 'react-bootstrap'; -import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; -import {faCheckSquare} from '@fortawesome/free-solid-svg-icons'; -import {faMinusSquare} from '@fortawesome/free-solid-svg-icons'; -import {faSquare} from '@fortawesome/free-regular-svg-icons'; +import React from 'react'; +import {Form} from 'react-bootstrap'; + import {cloneDeep} from 'lodash'; import {getComponentHeight} from './utils/HeightCalculator'; import {resolveObjectPath} from './utils/ObjectPathResolver'; import InfoPane from './InfoPane'; - -const MasterCheckboxState = { - NONE: 0, - MIXED: 1, - ALL: 2 -} +import {MasterCheckbox, MasterCheckboxState} from './MasterCheckbox'; +import ChildCheckbox from './ChildCheckbox'; function getFullDefinitionByKey(refString, registry, itemKey) { let fullArray = getFullDefinitionsFromRegistry(refString, registry); @@ -143,52 +136,4 @@ class AdvancedMultiSelect extends React.Component { } } -function MasterCheckbox(props) { - const { - title, - disabled, - onClick, - checkboxState - } = props; - - let newCheckboxIcon = faCheckSquare; - - if (checkboxState === MasterCheckboxState.NONE) { - newCheckboxIcon = faSquare; - } else if (checkboxState === MasterCheckboxState.MIXED) { - newCheckboxIcon = faMinusSquare; - } - - return ( - - - {title} - - ); -} - -function ChildCheckbox(props) { - const { - onPaneClick, - onClick, - value, - disabled, - label, - checkboxState - } = props; - - return ( - onPaneClick(value)}> - - - {label} - - - ); -} - export default AdvancedMultiSelect; diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/ChildCheckbox.js b/monkey/monkey_island/cc/ui/src/components/ui-components/ChildCheckbox.js new file mode 100644 index 000000000..353da4b22 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/ChildCheckbox.js @@ -0,0 +1,30 @@ +import React from 'react'; +import {Button, Form} from 'react-bootstrap'; + +import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; +import {faCheckSquare} from '@fortawesome/free-solid-svg-icons'; +import {faSquare} from '@fortawesome/free-regular-svg-icons'; + +function ChildCheckbox(props) { + const { + onPaneClick, + onClick, + value, + disabled, + label, + checkboxState + } = props; + + return ( + onPaneClick(value)}> + + + {label} + + + ); +} + +export default ChildCheckbox; diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/MasterCheckbox.js b/monkey/monkey_island/cc/ui/src/components/ui-components/MasterCheckbox.js new file mode 100644 index 000000000..0485e64eb --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/MasterCheckbox.js @@ -0,0 +1,41 @@ +import React from 'react'; +import {Card, Button} from 'react-bootstrap'; + +import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; +import {faCheckSquare} from '@fortawesome/free-solid-svg-icons'; +import {faMinusSquare} from '@fortawesome/free-solid-svg-icons'; +import {faSquare} from '@fortawesome/free-regular-svg-icons'; + +const MasterCheckboxState = { + NONE: 0, + MIXED: 1, + ALL: 2 +} + +function MasterCheckbox(props) { + const { + title, + disabled, + onClick, + checkboxState + } = props; + + let newCheckboxIcon = faCheckSquare; + + if (checkboxState === MasterCheckboxState.NONE) { + newCheckboxIcon = faSquare; + } else if (checkboxState === MasterCheckboxState.MIXED) { + newCheckboxIcon = faMinusSquare; + } + + return ( + + + {title} + + ); +} + +export {MasterCheckboxState, MasterCheckbox};