Skip to content

HMS-9490: create templates with extended support repos#849

Draft
katarinazaprazna wants to merge 6 commits intocontent-services:mainfrom
katarinazaprazna:create-templates-with-extended-support-repos
Draft

HMS-9490: create templates with extended support repos#849
katarinazaprazna wants to merge 6 commits intocontent-services:mainfrom
katarinazaprazna:create-templates-with-extended-support-repos

Conversation

@katarinazaprazna
Copy link
Contributor

@katarinazaprazna katarinazaprazna commented Jan 26, 2026

Summary

This PR aligns the frontend template logic with upcoming changes in the content-sources-backend. It ensures the UI handles extended support features and point-release targeting in parity with the evolving API contract.

The frontend logic is designed to integrate with the following backend updates:

Screenshots

User without EUS subscription

Screenshot From 2026-02-25 15-46-13

User with EUS subscription

Screenshot From 2026-02-25 19-32-19 Screenshot From 2026-02-25 19-33-38 Screenshot From 2026-02-25 19-35-04

Testing steps

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 26, 2026

Reviewer's Guide

Extends the templates creation/editing flow to support extended support (EUS/E4S) content versioning, updates the shared context and wizard step logic accordingly, and wires the new data fields through API types, routing, and tests.

Class diagram for updated template and content models

classDiagram
  class AddOrEditTemplateContextInterface {
    +QueryClient queryClient
    +NameLabel[] distribution_arches
    +NameLabel[] distribution_versions
    +NameLabel[] extended_release_features
    +DistributionMinorVersion[] distribution_minor_versions
    +Partial_TemplateRequest templateRequest
    +setTemplateRequest(value)
    +Set~string~ selectedRedhatRepos
    +setSelectedRedhatRepos(uuidSet)
    +Set~string~ selectedCustomRepos
    +setSelectedCustomRepos(uuidSet)
    +Set~string~ hardcodedRedhatRepositoryUUIDS
    +hasInvalidSteps(index) boolean
    +boolean isEdit
    +string editUUID
  }

  class TemplateRequest {
    +string arch
    +string version
    +boolean use_extended_support
    +string extended_release
    +string extended_release_version
    +string date
    +string description
    +string name
    +string[] repository_uuids
    +boolean use_latest
  }

  class TemplateItem {
    +string uuid
    +string name
    +string description
    +SnapshotItem[] snapshots
    +SnapshotItem[] to_be_deleted_snapshots
    +string arch
    +string version
    +boolean use_extended_support
    +string extended_release
    +string extended_release_version
    +string date
    +boolean use_latest
    +string created_at
  }

  class RepositoryParamsResponse {
    +NameLabel[] distribution_versions
    +NameLabel[] distribution_arches
    +NameLabel[] extended_release_features
    +DistributionMinorVersion[] distribution_minor_versions
  }

  class NameLabel {
    +string name
    +string label
  }

  class DistributionMinorVersion {
    +string name
    +string label
    +string major
    +string[] feature_names
  }

  class ContentItem {
    +string uuid
    +string name
    +string url
    +number package_count
    +string? extended_release
    +string? extended_release_version
  }

  class FilterData {
    +string search
    +string[] versions
    +string[] arches
    +string extended_release
    +string extended_release_version
    +string[] statuses
    +string[] uuids
    +string[] urls
  }

  AddOrEditTemplateContextInterface --> TemplateRequest : manages
  AddOrEditTemplateContextInterface --> RepositoryParamsResponse : uses
  RepositoryParamsResponse --> NameLabel : contains
  RepositoryParamsResponse --> DistributionMinorVersion : contains
  DistributionMinorVersion --> NameLabel : compatible labels
  TemplateItem --> TemplateRequest : related shape
  ContentItem --> DistributionMinorVersion : associated via extended_release_version
  FilterData --> ContentItem : filters
Loading

File-Level Changes

Change Details Files
Refactor the Add Template context into a shared AddOrEdit context and enrich it with extended support data and validation.
  • Rename AddTemplateContext to AddOrEditTemplateContext (including provider and hook) and update all imports/usages.
  • Initialize templateRequest state with extended support fields (use_extended_support, extended_release, extended_release_version).
  • Fetch extended_release_features and distribution_minor_versions from useRepositoryParams and expose them via context.
  • Replace per-step validity array with a stepValidationSequence that includes extended support validation and expose a hasInvalidSteps helper.
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/AddTemplateContext.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/*.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/*.test.tsx
Insert a new "Content versioning" wizard step to configure extended support behavior and adjust wizard navigation and routing.
  • Rename AddOrEditTemplate component file to AddOrEditTemplateModal and adjust route elements accordingly.
  • Introduce ExtendedSupportStep with radios for latest vs extended support and dropdowns for update stream and minor version, wired to templateRequest and repository params.
  • Gate the new step behind hasExtendedSupportCheck and ensure step enabling/Next button logic uses hasInvalidSteps with updated indices.
  • Fix URL/tab syncing and default step index constants to account for the inserted step.
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/AddOrEditTemplateModal.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/ExtendedSupportStep.tsx
src/Routes/index.tsx
src/Pages/Templates/TemplatesTable/components/templateHelpers.ts
Extend backend-facing types and test fixtures to support extended support metadata and new repository parameters.
  • Add extended_release and extended_release_version to ContentItem and FilterData, plus NameLabel and DistributionMinorVersion types.
  • Extend RepositoryParamsResponse to carry extended_release_features and distribution_minor_versions.
  • Add extended support fields to TemplateRequest and TemplateItem interfaces, and initialize them in defaultTemplateItem fixtures.
  • Update testRepositoryParamsResponse with example extended_release_features and distribution_minor_versions for tests.
src/services/Content/ContentApi.ts
src/services/Templates/TemplateApi.ts
src/testingHelpers.tsx
Adjust tests and small utilities to align with the new context and extended support fields.
  • Switch jest mocks from useAddTemplateContext to useAddOrEditTemplateContext where appropriate.
  • Ensure DefineContentStep tests provide extended_release_features and distribution_minor_versions to context.
  • Rename AddNavigateButton to AddTemplateButton and update review step usage.
  • Add hasExtendedSupportCheck helper and use it where needed.
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/AddTemplateButton.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/SetUpDateStep.test.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/CustomRepositoriesStep.test.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/RedhatRepositoriesStep.test.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/DefineContentStep.test.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/DetailStep.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/CustomRepositoriesStep.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/DefineContentStep.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/RedhatRepositoriesStep.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/ReviewStep.tsx
src/Pages/Templates/TemplatesTable/components/AddOrEditTemplate/steps/SetUpDateStep.tsx
src/Pages/Templates/TemplatesTable/components/TemplatesTable/components/templateHelpers.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@xbhouse
Copy link
Contributor

xbhouse commented Jan 26, 2026

@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch 3 times, most recently from c279f94 to 31d66cd Compare January 27, 2026 01:59
@rverdile rverdile self-assigned this Jan 27, 2026
Copy link
Contributor

@rverdile rverdile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good so far. I think we still need to hear from UX, but these are some changes that will move us in the right direction either way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want the template extended release or release version to be editable. We will make the version editable in a followup ticket.

@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch 4 times, most recently from 2118b41 to 8023d2a Compare January 29, 2026 18:27
@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch 8 times, most recently from b13758f to 7365801 Compare February 10, 2026 13:39
@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch 8 times, most recently from 551a936 to 8b301c4 Compare February 23, 2026 03:49
@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch 4 times, most recently from 7b9f0d1 to b57646b Compare February 24, 2026 16:16
Comment on lines 36 to 41
/** Converts an OS label (e.g., "9") or array of labels to a user-friendly display string (e.g., "RHEL 9" or "RHEL 8, RHEL 9"). */
const getVersionName = useCallback(
(version?: string | string[]): string => {
if (!version) return '';
const versions = Array.isArray(version) ? version : [version];
const displayNames = versions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we would leave this conversion out of the frontend, in favor of changing what the API returns on a different ticket?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change would impact more than just extended release support, so it makes sense to handle is separately

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part was implemented before our discussion, but I'm completely on board with moving it. Even with the conversion inside getVersionName, we didn't manage to catch every instance, so handling this on the BE is definitely the way to go. Once that’s ready, I’ll strip this logic out of the FE

I'll make sure to document all these decisions and trade-offs in the PR description by Thursday

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we remove it from here? Meaning let's just have the UI say "el" instead of "RHEL" for now. Once backend is updated then there shouldn't be any changes needed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we’re okay with this skipping the upcoming demo, I can just remove it for now to keep things clean :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that's okay :) It came out of our UX meetings for this, but it's really an app-wide change

? getMinorVersionName(major, minor)
: getVersionName(major) || 'Select version',
Architecture: getArchName(arch) || 'Select architecture',
'Core Red Hat repositories': redHatCoreRepos.size,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was changing it to "core red hat repositories" suggested by Maria? Otherwise I think we should leave it as "pre-selected"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We touched on this during a quick UX review and there weren't any objections, but I've followed up with her now for an explicit confirmation. Will keep you posted

Copy link
Contributor

@rverdile rverdile Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that creation fails because the label for the extended release is wrong ("RHEL-EUS-x86_64" vs "eus"). There's two issues here, one is the repository_parameters API should be updated to return the correct label. The other is that the template API should have proper validation.

I opened a ticket to address these issues: https://issues.redhat.com/browse/HMS-10252

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what I'd suggest. On your PR, let's convert "RHEL-EUS-x86_64" to "eus" for now, since it looks like you've already written a method to do that, featureNameToExtendedRelease. And assuming this PR merges first, we can update the UI again once the backend is fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rverdile I've just noticed the architecture locator was enabled by default in the original code. With the new EUS logic, I’ve kept it disabled for all paths

The reason for this is to gate the arch selection until the Stream and OS are picked. This prevents invalid configurations. For example, RHEL 9.6 EUS wasn't available on ARM yet, so picking Stream -> OS -> Arch ensures the user only sees compatible options

The two failing tests were trying to select the Arch before the OS, which was a leftover from my earlier test fixes. I’ve updated those tests now to follow the correct order, and they should be passing

@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch 5 times, most recently from 5c9daa1 to 9e905f7 Compare February 25, 2026 01:06
- Updated template request model to include `extended_release` and
`extended_release_version` fields
- Initialized template request with default extended support values to
prevent undefined state
- Integrated repository parameters API to fetch extended release
features and distribution minor versions
Redesign the template creation modal to consolidate OS and arch
selection into a single step. Rename and refactor all related components
 for better clarity.

- Merge DefineContentStep and ExtendedSupportStep into
OSAndArchitectureStep
- Update step validation and context management for new workflow
- Update templateHelpers for consolidated repo URL generation
- Improve core repository preselection logic and timing
- Refactor useDistributionDetails hook methods
- Rename RedhatRepositoriesStep to RedHatRepositoriesStep (casing fix)
Rename the hook and its return values to better convey that it
checks for Insights-registered systems compatible with a template's
configuration (arch, OS version, stream), not just any registered
systems.

While working on the rename, I discovered that the Patch API returns a
404 when querying /templates/{id}/systems for templates with no assigned
systems. This caused an ugly "Unable to find systems" error notification
on every visit to such a template's Systems tab. We now catch the 404 in
the API service layer and normalize it to an empty response, so
consumers treat "no systems assigned" as an expected empty state rather
than an error.
Extend the system assignment flow to distinguish between Standard and
EUS/E4S templates. Standard templates only allow systems on a major
release, while EUS templates require systems pinned to a minor release.

Additionally:
- Show the minor version and abbreviated stream name (e.g. "EUS") in the
  TemplateDetails header for extended support templates.
- Disable the release stream dropdown during template editing, since
  changing it after creation is not supported.
@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch from 9e905f7 to fb22916 Compare February 26, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants