Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Update preset description when props received
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad committed Jan 27, 2022
1 parent 2598700 commit bdd99ac
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/components/PresetSelection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,34 @@ export default class PresetSelection extends React.Component {
this.description = "";

this.handlePresetSelectClick = this.handlePresetSelectClick.bind(this);
this.updatePresetDescription = this.updatePresetDescription.bind(this);
}

handlePresetSelectClick = (event, value) => {
this.setState({ presetSelected: value });

this.updatePresetDescription(value);

if(this.props.onChanged !== null) {
this.props.onChange(value);
}
};

updatePresetDescription(value) {
if(value === "podman") {
this.description = this.props.podmanDescription;
}
if(value === "openshift") {
this.description = this.props.openshiftDescription;
}

if(this.props.onChanged !== null) {
this.props.onChange(value);
}
};
}

componentWillReceiveProps(nextProps) {
this.setState({
presetSelected: nextProps.value
})

// handlePresetSelectClick()
this.updatePresetDescription(nextProps.value);
}

render() {
Expand Down

0 comments on commit bdd99ac

Please sign in to comment.