forked from Katello/katello
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #37572 - Extract logic and simplify initial AK selection (Katel…
- Loading branch information
1 parent
e2c7ad1
commit 22ed429
Showing
3 changed files
with
18 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
webpack/components/extensions/RegistrationCommands/helpers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const determineInitialAKSelection = (activationKeys, initialAKSelection) => { | ||
// If we've received the initialAKSelection from the URL, and it's a valid activation key, use it | ||
if (initialAKSelection && | ||
(activationKeys ?? []).some(ak => ak.name === initialAKSelection)) { | ||
return { activationKeys: initialAKSelection.split(',') }; | ||
} | ||
// If there's only one activation key, use it | ||
if (activationKeys?.length === 1) { | ||
return { activationKeys: [activationKeys[0].name] }; | ||
} | ||
// Otherwise, don't select any activation keys | ||
return { activationKeys: [] }; | ||
}; | ||
|
||
export default determineInitialAKSelection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters