Skip to content

Commit

Permalink
Fixes #36295 - Auto activation key selection when there's only one
Browse files Browse the repository at this point in the history
  • Loading branch information
girijaasoni committed Apr 17, 2023
1 parent 2403f6f commit 9783099
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ const ActivationKeys = ({
};

// Validate field when hostgroup is changed (host group may have some keys)
useEffect(() => {
useEffect(() => {
handleInvalidField('Activation Keys', akHasValidValue(hostGroupId, pluginValues?.activationKeys, hostGroupActivationKeys));
}, [handleInvalidField, hostGroupId, hostGroupActivationKeys, pluginValues]);

useEffect(() => {
if (activationKeys?.length === 1) {
updatePluginValues([activationKeys[0]?.name]);
}
}, [activationKeys?.length]);

return (
<FormGroup
label={__('Activation Keys')}
Expand Down Expand Up @@ -88,7 +94,7 @@ ActivationKeys.propTypes = {
};

ActivationKeys.defaultProps = {
activationKeys: undefined,
activationKeys: [],
selectedKeys: [],
hostGroupActivationKeys: undefined,
hostGroupId: undefined,
Expand Down

0 comments on commit 9783099

Please sign in to comment.