Merge pull request #1021 from guardicore/fix-master-checkbox-rendering
Fix master checkbox rendering
This commit is contained in:
commit
ba8acf2a64
|
@ -43,7 +43,7 @@ class AdvancedMultiSelect extends React.Component {
|
||||||
infoPaneParams: getDefaultPaneParams(
|
infoPaneParams: getDefaultPaneParams(
|
||||||
this.infoPaneRefString,
|
this.infoPaneRefString,
|
||||||
this.registry,
|
this.registry,
|
||||||
this.isUnsafeOptionSelected(this.props.value)
|
this.isUnsafeOptionSelected(props.value)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -94,9 +94,11 @@ class AdvancedMultiSelect extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
setMasterCheckboxState(selectValues) {
|
setMasterCheckboxState(selectValues) {
|
||||||
this.setState(() => ({
|
let newState = this.getMasterCheckboxState(selectValues);
|
||||||
masterCheckboxState: this.getMasterCheckboxState(selectValues)
|
|
||||||
}));
|
if (newState != this.state.masterCheckboxState) {
|
||||||
|
this.setState({masterCheckboxState: newState});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getMasterCheckboxState(selectValues) {
|
getMasterCheckboxState(selectValues) {
|
||||||
|
@ -162,11 +164,12 @@ class AdvancedMultiSelect extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
schema,
|
autofocus,
|
||||||
id,
|
id,
|
||||||
required,
|
|
||||||
multiple,
|
multiple,
|
||||||
autofocus
|
required,
|
||||||
|
schema,
|
||||||
|
value
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -179,7 +182,7 @@ class AdvancedMultiSelect extends React.Component {
|
||||||
<ChildCheckboxContainer id={id} multiple={multiple} required={required}
|
<ChildCheckboxContainer id={id} multiple={multiple} required={required}
|
||||||
autoFocus={autofocus} isSafe={this.isSafe}
|
autoFocus={autofocus} isSafe={this.isSafe}
|
||||||
onPaneClick={this.setPaneInfo} onCheckboxClick={this.onChildCheckboxClick}
|
onPaneClick={this.setPaneInfo} onCheckboxClick={this.onChildCheckboxClick}
|
||||||
selectedValues={this.props.value} enumOptions={this.enumOptions}/>
|
selectedValues={value} enumOptions={this.enumOptions}/>
|
||||||
|
|
||||||
<InfoPane title={this.state.infoPaneParams.title}
|
<InfoPane title={this.state.infoPaneParams.title}
|
||||||
body={this.state.infoPaneParams.content}
|
body={this.state.infoPaneParams.content}
|
||||||
|
@ -188,6 +191,10 @@ class AdvancedMultiSelect extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(_prevProps) {
|
||||||
|
this.setMasterCheckboxState(this.props.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AdvancedMultiSelect;
|
export default AdvancedMultiSelect;
|
||||||
|
|
Loading…
Reference in New Issue