Skip to content

Add service name class to Insights components to fix styling #1055

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

leSamo
Copy link

@leSamo leSamo commented Jul 31, 2025

What are the changes introduced in this pull request?

Multiple styling issues in Lightspeed are caused by apps not being wrapped in a container with class name same as their service name.

This is a practice used on HCC to isolate CSS so it does not bleed into other apps -- each app is automatically wrapped in a div with class name same as their service name and stylesheets are restricted to only apply within containers of their corresponding app.

Considerations taken when implementing this change?

--

What are the testing steps for this pull request?

Open Vulnerability app and expand any row inside the table. The expandable section title "CVE description" should be bold. If it's bold than the styles are being applied correctly.

Before

image image

After

image image

Summary by Sourcery

Scope CSS for Insights components by wrapping them in containers with service-specific class names

Enhancements:

  • Wrap remediation and host details components in a div/span with the "advisor" class
  • Add the "vulnerability" class to CVE host details, details page, and vulnerability list page containers

Copy link

sourcery-ai bot commented Jul 31, 2025

Reviewer's Guide

Ensure each Insights component is scoped with its service name for CSS isolation by wrapping or augmenting existing containers with the appropriate class (advisor or vulnerability).

Class diagram for updated container structure in Insights components

classDiagram
    class ScalprumComponent
    class RemediationModal
    class IopRecommendationsPage {
      +div.advisor
      +ScalprumComponent
    }
    class IopInsightsTab {
      +div.advisor
      +ScalprumComponent
    }
    class CVEsHostDetailsTab {
      +div.rh-cloud-insights-vulnerability-host-details-component.vulnerability
      +ScalprumComponent
    }
    class CveDetailsPage {
      +div.rh-cloud-cve-details-page.vulnerability
      +ScalprumComponent
    }
    class IopRecommendationDetails {
      +div.iop-recommendation-details-scalprum.advisor
      +ScalprumComponent
    }
    class InsightsVulnerabilityListPage {
      +div.rh-cloud-insights-vulnerability-page.vulnerability
      +ScalprumComponent
    }
    class IopRecommendationsCell {
      +span.rh-cloud-insights-recommendations-cell.advisor
      +ScalprumComponent
    }
Loading

File-Level Changes

Change Details Files
Wrap advisor components with a container having class 'advisor' for CSS scoping.
  • Added a div.advisor around ScalprumComponent in InsightsCloudSync
  • Added a div.advisor around ScalprumComponent in NewHostDetailsTab
webpack/InsightsCloudSync/InsightsCloudSync.js
webpack/InsightsHostDetailsTab/NewHostDetailsTab.js
Augment vulnerability components’ wrapper divs with 'vulnerability' class.
  • Added vulnerability class to host details tab container
  • Added vulnerability class to CVE details page container
  • Added vulnerability class to vulnerability list page container
webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js
webpack/CveDetailsPage/CveDetailsPage.js
webpack/InsightsVulnerability/InsightsVulnerabilityListPage.js
Add advisor class to recommendations cell span for CSS isolation.
  • Added advisor class to the recommendations cell wrapper span
webpack/ForemanColumnExtensions/index.js
Add advisor class to IOP recommendation details wrapper.
  • Added advisor class to iop-recommendation-details-scalprum div
webpack/IopRecommendationDetails/IopRecommendationDetails.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 @leSamo - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `webpack/ForemanColumnExtensions/index.js:26` </location>
<code_context>

   return (
-    <span className="rh-cloud-insights-recommendations-cell">
+    <span className="rh-cloud-insights-recommendations-cell advisor">
       <ScalprumComponent scope={scope} module={module} />
     </span>
</code_context>

<issue_to_address>
Adding 'advisor' class to a span may have unintended inline element effects.

Check that the 'advisor' class styles are suitable for use on a span and won't cause layout issues.
</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.

@@ -23,7 +23,7 @@ const IopRecommendationsCell = hostDetails => {
const module = './RecommendationsCellWrapped';

return (
<span className="rh-cloud-insights-recommendations-cell">
<span className="rh-cloud-insights-recommendations-cell advisor">
Copy link

Choose a reason for hiding this comment

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

issue: Adding 'advisor' class to a span may have unintended inline element effects.

Check that the 'advisor' class styles are suitable for use on a span and won't cause layout issues.

Comment on lines +70 to +71
<div className="advisor">
<ScalprumComponent
Copy link
Collaborator

Choose a reason for hiding this comment

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

cc @ColeHiggins2 This may change your locators or whatnot

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