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 a00f7c9d9..3588c0303 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 @@ -34,7 +34,6 @@ class AdvancedMultiSelect extends React.Component { super(props); this.infoPaneRefString = props.schema.items.$ref; this.registry = props.registry; - this.enumOptions = props.options.enumOptions.sort(this.compareOptions); this.pluginNames = props.value.map(v => v.name); this.state = { @@ -50,6 +49,10 @@ class AdvancedMultiSelect extends React.Component { }; } + getOptionList = () => { + return this.props.options.enumOptions.sort(this.compareOptions); + } + onChange = (strValues) => { let newValues = []; for (let j = 0; j < strValues.length; j++) { @@ -88,7 +91,7 @@ class AdvancedMultiSelect extends React.Component { if (checkboxState === MasterCheckboxState.ALL) { var newValues = []; } else { - newValues = this.enumOptions.map(({value}) => value); + newValues = this.getOptionList().map(({value}) => value); } this.onChange(newValues); @@ -124,7 +127,7 @@ class AdvancedMultiSelect extends React.Component { return MasterCheckboxState.NONE; } - if (selectValues.length !== this.enumOptions.length) { + if (selectValues.length !== this.getOptionList().length) { return MasterCheckboxState.MIXED; } @@ -152,6 +155,7 @@ class AdvancedMultiSelect extends React.Component { } isSafe = (itemKey) => { + console.log(getFullDefinitionByKey(this.infoPaneRefString, this.registry, itemKey)) return getFullDefinitionByKey(this.infoPaneRefString, this.registry, itemKey).safe; } @@ -201,7 +205,7 @@ class AdvancedMultiSelect extends React.Component { onPaneClick={this.setPaneInfo} onCheckboxClick={this.onChildCheckboxClick} selectedValues={this.state.pluginNames} - enumOptions={this.enumOptions}/> + enumOptions={this.getOptionList()}/>