Skip to content

Comments

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

Draft
katarinazaprazna wants to merge 9 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 9 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:

Screenshot From 2026-02-19 01-43-27 Screenshot From 2026-02-19 01-43-07

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.

Image

For the red hat repositories step, The list should be filtered to the extended release type and version. For example, if I choose EUS 9.4, then the backend call to list the repositories would look like /repositories/?extended_release=eus&extended_release_version=9.4. We'd also want to pre-select the 9.4 BaseOS and Appstream Repositories instead of the latest release RHEL 9 repositories.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, thanks for clarifying the repo filtering! I'll be moving onto that shortly. I'm planning to finish the templates endpoint integration first to ensure a smooth handoff between the steps

Copy link
Contributor Author

@katarinazaprazna katarinazaprazna Feb 5, 2026

Choose a reason for hiding this comment

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

Note to self:

  • List should be filtered according to the extended release type and version
  • Pre-select BaseOS and Appstream repos

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
Comment on lines +20 to +22
export const featureNameToExtendedRelease = (featureName: string | undefined): ExtendedRelease =>
featureName === EUS ? 'eus' : featureName === E4S ? 'e4s' : 'none';

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think the API should be updated to just return "e4s" or "eus"? I don't see the names "RHEL-EUS-x86_64" or "RHEL-E4S-x86_64" being used anywhere, so that could make sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

you might could do this as part of the backend ticket you picked up

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 think it makes sense to handle the mapping on the BE side. It’ll save us from having to maintain that logic on the FE. I’m happy to take that on as part of my BE task :)

- Added new "Content versioning" step that allows users to choose
between rolling releases and extended support releases (EUS/E4S)
- Implemented validation logic to conditionally show the versioning step
 based on feature availability and architecture constraints
- 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
- Added `featureNameToExtendedRelease` helper to map feature names to
API-supported values
- Enhanced template logic to conditionally send extended release data
based on feature availability
@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch 5 times, most recently from e988311 to 122ee33 Compare February 18, 2026 00:20
@katarinazaprazna katarinazaprazna force-pushed the create-templates-with-extended-support-repos branch from 122ee33 to f2f631c Compare February 18, 2026 00:48
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