Skip to content

Commit

Permalink
CLAPPS: Add defaultImage logic (#4674)
Browse files Browse the repository at this point in the history
* Add defaultImage logic

* Remove additional is-this-an-app? logic
  • Loading branch information
Jskobos authored Mar 18, 2019
1 parent 7fa2b23 commit de80e66
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/features/linodes/LinodesCreate/LinodeCreateContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,11 @@ class LinodeCreateContainer extends React.PureComponent<CombinedProps, State> {
defaultData?: any
) => {
/**
* reset the selected Image but only if we're creating a Linode from
* a StackScript and not an app
* If we're switching from one cloud app to another,
* usually the only compatible image will be Debian 9. If this
* is the case, preselect that value.
*/
if (this.props.createType !== 'fromApp') {
this.setState({ selectedImageID: undefined });
}
const defaultImage = images.length === 1 ? images[0].id : undefined;

this.setState({
selectedStackScriptID: id,
Expand All @@ -230,7 +229,7 @@ class LinodeCreateContainer extends React.PureComponent<CombinedProps, State> {
availableStackScriptImages: images,
udfs: defaultData,
/** reset image because stackscript might not be compatible with selected one */
selectedImageID: undefined,
selectedImageID: defaultImage,
errors: undefined
});
};
Expand Down

0 comments on commit de80e66

Please sign in to comment.