Skip to content

Add ask RH help panel link #3138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 11, 2025
Merged

Add ask RH help panel link #3138

merged 5 commits into from
Jul 11, 2025

Conversation

apinkert
Copy link
Contributor

@apinkert apinkert commented Jul 8, 2025

For RHCLOUD-40983. Unleash flags have been created on stage and prod.

image

Summary by Sourcery

Add an Ask Red Hat help link to the global header tools behind a feature flag and enhance the toolbar toggle to support icons in dropdown items.

New Features:

  • Add an “Ask Red Hat” link to the header tools that opens the Red Hat support page in a new tab, gated by the new feature flag platform.chrome.ask-redhat-help

Enhancements:

  • Extend ToolbarToggleDropdownItem to accept and render an optional icon in toolbar dropdown items

Documentation:

  • Add a new i18n message entry for the “Ask Red Hat” label

Copy link
Contributor

sourcery-ai bot commented Jul 8, 2025

Reviewer's Guide

This PR introduces a new feature-flagged “Ask Red Hat” link in the global header tools, enhances toolbar dropdown items to support icons, and adds the corresponding i18n message entry.

Class diagram for ToolbarToggleDropdownItem enhancement

classDiagram
    class ToolbarToggleDropdownItem {
      +string title
      +string? url
      +string? appId
      +string? target
      +string? rel
      +function? onClick
      +boolean? isHidden
      +boolean? isDisabled
      +React.ReactNode? icon
    }
Loading

Class diagram for Tools component update with Ask Red Hat link

classDiagram
    class Tools {
      +useFlag(flag: string): boolean
      +user
      +token
      +dropdownItems
    }
    Tools --> ToolbarToggleDropdownItem : uses
    ToolbarToggleDropdownItem <|-- AskRedHatDropdownItem
    class AskRedHatDropdownItem {
      +title = messages.askRedHat
      +icon = ask-redhat-icon.svg
      +onClick = open Red Hat support page
      +isHidden = askRedHatEnabled
    }
Loading

File-Level Changes

Change Details Files
Add feature-flagged “Ask Red Hat” link to header tools
  • Introduce askRedHatEnabled flag via useFlag
  • Insert dropdown item with title, icon, and onClick opening Red Hat support
  • Gate item visibility using the new feature flag
src/components/Header/Tools.tsx
Add i18n message entry for “Ask Red Hat” label
  • Define askRedHat key with id, description, and defaultMessage
src/locales/Messages.ts
Enhance ToolbarToggleDropdownItem to support icons
  • Extend dropdown item type with optional icon prop
  • Forward icon prop to PatternFly DropdownItem
src/components/Header/ToolbarToggle.tsx

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

@apinkert apinkert marked this pull request as ready for review July 8, 2025 12:52
Copy link
Contributor

@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 @apinkert - I've reviewed your changes - here's some feedback:

  • The isHidden prop is currently using askRedHatEnabled directly, which will hide the link when the flag is true—flip it to !askRedHatEnabled so the link appears only when the feature flag is enabled.
  • Include an alt attribute on the <img> icon for accessibility (e.g. alt="Ask Red Hat icon").
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `isHidden` prop is currently using `askRedHatEnabled` directly, which will hide the link when the flag is true—flip it to `!askRedHatEnabled` so the link appears only when the feature flag is enabled.
- Include an `alt` attribute on the `<img>` icon for accessibility (e.g. alt="Ask Red Hat icon").

## Individual Comments

### Comment 1
<location> `src/components/Header/Tools.tsx:195` </location>
<code_context>
+          title: intl.formatMessage(messages.askRedHat),
+          icon: <img className="pf-v6-c-button__icon" src="/apps/frontend-assets/ask-redhat/ask-redhat-icon.svg" />,
+          onClick: () => window.open('https://access.redhat.com/ask', '_blank'),
+          isHidden: askRedHatEnabled,
+        },
         {
</code_context>

<issue_to_address>
The logic for isHidden may be inverted.

The item is hidden when askRedHatEnabled is true. If it should be visible when enabled, use '!askRedHatEnabled' instead. Please confirm the intended logic.
</issue_to_address>

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.

Copy link
Contributor

@karelhala karelhala left a comment

Choose a reason for hiding this comment

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

Looking good! Just one small adjustment and we are golden

@@ -187,6 +188,12 @@ const Tools = () => {
},
]
: [
{
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be enabled if Help panel is enabled. We should move it and show/hide it similarly as to how enableGlobalLearningResourcesPage is used.

@apinkert
Copy link
Contributor Author

apinkert commented Jul 9, 2025

@karelhala is this the correct dropdown logic for helpPanelEnabled WRT the ask Redhat item?

@karelhala
Copy link
Contributor

/retest

@karelhala karelhala merged commit e47ac03 into master Jul 11, 2025
16 of 18 checks passed
@Hyperkid123 Hyperkid123 deleted the add-ask-RH branch July 11, 2025 12:49
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