Wizard: Move Users section from Advanced Settings to Image Overview (HMS-10579)#4467
Open
mgold1234 wants to merge 1 commit into
Open
Wizard: Move Users section from Advanced Settings to Image Overview (HMS-10579)#4467mgold1234 wants to merge 1 commit into
mgold1234 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4467 +/- ##
==========================================
+ Coverage 75.34% 75.36% +0.01%
==========================================
Files 229 229
Lines 7446 7452 +6
Branches 2770 2770
==========================================
+ Hits 5610 5616 +6
Misses 1578 1578
Partials 258 258
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
aa8e4f9 to
40353b9
Compare
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
isOnPremise && isImageModecondition for whether to render the Users section is duplicated in bothImageOverviewandAdvancedSettingsOverview; consider extracting this into a shared selector or helper to keep the visibility logic centralized and consistent. - Importing
Usersfrom../AdvancedSettings/componentscouplesImageOverviewto the Advanced Settings internals; it may be cleaner to moveUsersinto a shared components module that both overview sections can consume.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `isOnPremise && isImageMode` condition for whether to render the Users section is duplicated in both `ImageOverview` and `AdvancedSettingsOverview`; consider extracting this into a shared selector or helper to keep the visibility logic centralized and consistent.
- Importing `Users` from `../AdvancedSettings/components` couples `ImageOverview` to the Advanced Settings internals; it may be cleaner to move `Users` into a shared components module that both overview sections can consume.
## Individual Comments
### Comment 1
<location path="src/Components/CreateImageWizard/steps/Review/components/ImageOverview/index.tsx" line_range="79-80" />
<code_context>
<PrivateClouds environments={privateClouds} />
<PublicClouds environments={publicClouds} />
<MiscFormats environments={miscFormats} />
+ {isOnPremise && isImageMode && (
+ <Users shouldHide={restrictions.users.shouldHide} />
+ )}
</ReviewList>
</code_context>
<issue_to_address>
**suggestion:** Consider centralizing the condition that decides where the Users section is rendered.
You’re now using `isOnPremise && isImageMode` (and its negation) in both `ImageOverview` and `AdvancedSettingsOverview` to control where `Users` appears. Extracting a helper like `shouldShowUsersInOverview({ isOnPremise, isImageMode })` or at least a shared/local boolean would reduce duplication and the risk of these conditions drifting, and make it easier to evolve the logic if more modes/environments are added.
Suggested implementation:
```typescript
const { restrictions } = useCustomizationRestrictions({
selectedImageTypes: environments,
});
const releases = isOnPremise ? ON_PREM_RELEASES : RELEASES;
const showUsersInOverview = isOnPremise && isImageMode;
```
```typescript
<PrivateClouds environments={privateClouds} />
<PublicClouds environments={publicClouds} />
<MiscFormats environments={miscFormats} />
{showUsersInOverview && (
<Users shouldHide={restrictions.users.shouldHide} />
)}
```
To fully centralize the logic across both overview components, you should:
1. Apply the same pattern in `AdvancedSettingsOverview` (introduce a shared/local boolean or helper function).
2. If this logic is expected to evolve further (e.g., more environments/modes), consider extracting `shouldShowUsersInOverview({ isOnPremise, isImageMode })` into a shared utility module used by both `ImageOverview` and `AdvancedSettingsOverview`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
c6a6d68 to
7ebc776
Compare
…423) In the on-prem image mode wizard, Users are configured under Base Settings. The Review step now mirrors this by showing Users under Image Overview when both isOnPremise and isImageMode are true. For all other cases (hosted, or on-prem package mode), Users remain under Advanced Settings.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users are configured in Base Settings (for image mode in cockpit-image-builder), but the Review step displayed them under Advanced Settings.
Move the Users component to the Image Overview card so the review page matches where users are actually set.
JIRA: (HMS-10579)