From 09a8415aec98963aa575d04f0de8950d185398da Mon Sep 17 00:00:00 2001
From: Mike Salvatore <mike.s.salvatore@gmail.com>
Date: Mon, 1 Feb 2021 07:14:15 -0500
Subject: [PATCH] ui: remove disabled/readonly from AdvancedMultiSelect

---
 .../src/components/ui-components/AdvancedMultiSelect.js  | 9 +++------
 .../cc/ui/src/components/ui-components/ChildCheckbox.js  | 8 +++-----
 .../cc/ui/src/components/ui-components/MasterCheckbox.js | 3 +--
 3 files changed, 7 insertions(+), 13 deletions(-)

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 0dc813dc6..670b99cd7 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
@@ -11,7 +11,6 @@ import {getFullDefinitionByKey} from './JsonSchemaHelpers';
 function AdvancedMultiSelectHeader(props) {
   const {
     title,
-    disabled,
     onCheckboxClick,
     checkboxState,
     hideReset,
@@ -20,7 +19,7 @@ function AdvancedMultiSelectHeader(props) {
 
   return (
     <Card.Header className="d-flex justify-content-between">
-      <MasterCheckbox title={title} disabled={disabled} onClick={onCheckboxClick} checkboxState={checkboxState}/>
+      <MasterCheckbox title={title} onClick={onCheckboxClick} checkboxState={checkboxState}/>
       <Button className={'reset-safe-defaults'} type={'reset'} variant={'warning'}
         hidden={hideReset} onClick={onResetClick}>
         Reset to safe defaults
@@ -165,8 +164,6 @@ class AdvancedMultiSelect extends React.Component {
       schema,
       id,
       required,
-      disabled,
-      readonly,
       multiple,
       autofocus
     } = this.props;
@@ -174,12 +171,12 @@ class AdvancedMultiSelect extends React.Component {
     return (
       <div className={'advanced-multi-select'}>
         <AdvancedMultiSelectHeader title={schema.title}
-          disabled={disabled} onCheckboxClick={this.onMasterCheckboxClick}
+          onCheckboxClick={this.onMasterCheckboxClick}
           checkboxState={this.state.masterCheckboxState}
           hideReset={this.state.hideReset} onResetClick={this.onResetClick}/>
 
         <ChildCheckboxContainer id={id} multiple={multiple} required={required}
-          disabled={disabled || readonly} autoFocus={autofocus} isSafe={this.isSafe}
+          autoFocus={autofocus} isSafe={this.isSafe}
           onPaneClick={this.setPaneInfo} onCheckboxClick={this.onChildCheckboxClick}
           selectedValues={this.props.value} enumOptions={this.enumOptions}/>
 
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
index 6ebe69985..055087e42 100644
--- a/monkey/monkey_island/cc/ui/src/components/ui-components/ChildCheckbox.js
+++ b/monkey/monkey_island/cc/ui/src/components/ui-components/ChildCheckbox.js
@@ -14,7 +14,6 @@ function ChildCheckboxContainer(props) {
     id,
     multiple,
     required,
-    disabled,
     autofocus,
     onPaneClick,
     onCheckboxClick,
@@ -26,13 +25,13 @@ function ChildCheckboxContainer(props) {
     <Form.Group
       style={{height: `${getComponentHeight(enumOptions.length)}px`}}
       id={id} multiple={multiple} className='choice-block form-control'
-      required={required} disabled={disabled} autoFocus={autofocus}>
+      required={required} autoFocus={autofocus}>
       {
         enumOptions.map(({value, label}, i) => {
           return (
             <ChildCheckbox key={i} onPaneClick={onPaneClick}
             onClick={onCheckboxClick} value={value}
-            disabled={disabled} label={label} checkboxState={selectedValues.includes(value)}
+            label={label} checkboxState={selectedValues.includes(value)}
             safe={isSafe(value)}/>
           );
         }
@@ -46,7 +45,6 @@ function ChildCheckbox(props) {
     onPaneClick,
     onClick,
     value,
-    disabled,
     label,
     checkboxState,
     safe
@@ -54,7 +52,7 @@ function ChildCheckbox(props) {
 
   return (
     <Form.Group onClick={() => onPaneClick(value)}>
-      <Button value={value} variant={'link'} disabled={disabled} onClick={() => onClick(value)}>
+      <Button value={value} variant={'link'} onClick={() => onClick(value)}>
         <FontAwesomeIcon icon={checkboxState ? faCheckSquare : faSquare}/>
       </Button>
       <span key={'label'} className={'option-text'}>{label}</span>
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
index b5a646aca..907ccf08f 100644
--- a/monkey/monkey_island/cc/ui/src/components/ui-components/MasterCheckbox.js
+++ b/monkey/monkey_island/cc/ui/src/components/ui-components/MasterCheckbox.js
@@ -15,7 +15,6 @@ const MasterCheckboxState = {
 function MasterCheckbox(props) {
   const {
     title,
-    disabled,
     onClick,
     checkboxState
   } = props;
@@ -30,7 +29,7 @@ function MasterCheckbox(props) {
 
   return (
     <div className={'master-checkbox'}>
-      <Button key={`${title}-button`} variant={'link'} disabled={disabled} onClick={onClick}>
+      <Button key={`${title}-button`} variant={'link'} onClick={onClick}>
         <FontAwesomeIcon icon={newCheckboxIcon}/>
       </Button>
       <span className={'header-title'}>{title}</span>