Skip to content

SAT-42791 - Pass docs links through LinksController#1159

Merged
adamruzicka merged 1 commit intotheforeman:developfrom
ofedoren:sat-42791-use-link-helper
Feb 26, 2026
Merged

SAT-42791 - Pass docs links through LinksController#1159
adamruzicka merged 1 commit intotheforeman:developfrom
ofedoren:sat-42791-use-link-helper

Conversation

@ofedoren
Copy link
Member

@ofedoren ofedoren commented Feb 25, 2026

What are the changes introduced in this pull request?

Wrapping a static link to subscription service docs via foremanUrl, so it goes through LinksController.

Considerations taken when implementing this change?

This is needed so we can properly redirect this link to RHOKP.

What are the testing steps for this pull request?

Summary by Sourcery

Route the subscriptions service documentation link through Foreman’s LinksController instead of using a static URL.

New Features:

  • Add helper to generate the subscriptions service docs URL via the Foreman links endpoint.

Enhancements:

  • Update the inventory upload page description to use the new helper-based subscriptions docs link for redirect support.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 25, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Routes the Subscriptions service documentation link through Foreman’s LinksController by introducing a helper-generated URL and updating the page header link to use it, enabling environment-specific redirection (e.g., to RHOKP) instead of a hardcoded docs.redhat.com URL.

Sequence diagram for subscription docs link resolution via LinksController

sequenceDiagram
  actor User
  participant Browser
  participant PageDescription
  participant ForemanInventoryHelpers
  participant LinksController
  participant DocsDestination

  User->>Browser: Click subscription_docs_link
  Browser->>PageDescription: Render component
  PageDescription->>ForemanInventoryHelpers: getSubscriptionServiceDocsUrl()
  ForemanInventoryHelpers-->>PageDescription: /links/manual/?root_url=encoded_original_docs_url
  PageDescription-->>Browser: Render anchor_href=/links/manual/?root_url=...
  Browser->>LinksController: GET /links/manual/?root_url=encoded_original_docs_url
  LinksController->>DocsDestination: Determine_target_from_settings
  LinksController-->>Browser: HTTP 302 redirect to DocsDestination
  Browser->>DocsDestination: GET subscription_service_docs
  DocsDestination-->>Browser: Render documentation page
Loading

Updated class diagram for ForemanInventoryHelpers and PageDescription

classDiagram
  class ForemanInventoryHelpers {
    +getInventoryDocsUrl() string
    +getSubscriptionServiceDocsUrl() string
    +getActionsHistoryUrl() string
  }

  class PageDescription {
    +PageDescription()
  }

  PageDescription --> ForemanInventoryHelpers : uses_getSubscriptionServiceDocsUrl
Loading

File-Level Changes

Change Details Files
Introduce a helper to generate a LinksController-wrapped Subscriptions service docs URL.
  • Add getSubscriptionServiceDocsUrl helper that wraps the static Subscriptions docs URL with foremanUrl and the /links/manual/ endpoint.
  • Use URI.encode to safely embed the target documentation URL as the root_url query parameter.
webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js
Update the Foreman Inventory Upload page description to use the new helper-based documentation URL.
  • Import getSubscriptionServiceDocsUrl into the PageDescription component.
  • Replace the previously hardcoded Subscriptions service docs href with a call to getSubscriptionServiceDocsUrl in the anchor tag.
webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new getSubscriptionServiceDocsUrl helper encodes a different docs path (html-single/.../index) than the original link (html/.../index); if this change is not intentional, consider aligning the URL to preserve the original target and avoid unexpected redirects.
  • Since the subscription service docs URL is now abstracted into getSubscriptionServiceDocsUrl, consider scanning for any remaining hard-coded links to the same documentation and routing them through this helper for consistency.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `getSubscriptionServiceDocsUrl` helper encodes a different docs path (`html-single/.../index`) than the original link (`html/.../index`); if this change is not intentional, consider aligning the URL to preserve the original target and avoid unexpected redirects.
- Since the subscription service docs URL is now abstracted into `getSubscriptionServiceDocsUrl`, consider scanning for any remaining hard-coded links to the same documentation and routing them through this helper for consistency.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ofedoren
Copy link
Member Author

  • The new getSubscriptionServiceDocsUrl helper encodes a different docs path (html-single/.../index) than the original link (html/.../index); if this change is not intentional, consider aligning the URL to preserve the original target and avoid unexpected redirects.

This is intentional, we need all the links to point to html-single, this one was missed.

  • Since the subscription service docs URL is now abstracted into getSubscriptionServiceDocsUrl, consider scanning for any remaining hard-coded links to the same documentation and routing them through this helper for consistency.

I didn't find any that applicable.

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

LGTM, but let's hold this open until the counterpart in f-theme-satellite is also approved.

@adamruzicka adamruzicka merged commit f2d29a0 into theforeman:develop Feb 26, 2026
14 checks passed
@adamruzicka
Copy link
Contributor

Thank you @ofedoren !

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.

2 participants