-
Notifications
You must be signed in to change notification settings - Fork 20
feat: separate Red Hat and Community profiles for HTML report #522
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
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0d9d642
feat: separate Red Hat and Community profiles for HTML report
soul2zimate bfaf296
feat: updat general solution for backend
soul2zimate 7e953a5
feat: add imageRecommendation refactor to programmatically get brandi…
soul2zimate b3a66ea
fix: simplify the logic
soul2zimate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| GENERATE_SOURCEMAP=false | ||
| GENERATE_SOURCEMAP=false | ||
|
|
||
| # Default branding mode when no specific profile is used | ||
| # Options: community, redhat | ||
| REACT_APP_BRANDING_MODE=community |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| REACT_APP_BRANDING_MODE=community | ||
| REACT_APP_BRAND_NAME=Trustify | ||
| REACT_APP_BRAND_TITLE=Trustify Overview of security issues | ||
| REACT_APP_REMEDIATION_TITLE=Remediations | ||
| REACT_APP_BRAND_ICON=trustify | ||
| REACT_APP_BRAND_URL=https://guac.sh/trustify/ | ||
| REACT_APP_EXPLORE_TITLE=Learn more about Trustify | ||
| REACT_APP_EXPLORE_DESCRIPTION=The Trustify project is a collection of software components that enables you to store and retrieve Software Bill of Materials (SBOMs), and advisory documents. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| REACT_APP_BRANDING_MODE=redhat | ||
| REACT_APP_BRAND_NAME=Red Hat | ||
| REACT_APP_BRAND_TITLE=Red Hat Overview of security Issues | ||
| REACT_APP_REMEDIATION_TITLE=Red Hat Remediations | ||
| REACT_APP_BRAND_ICON=redhat | ||
| REACT_APP_BRAND_URL=https://developers.redhat.com/products/trusted-profile-analyzer/overview | ||
| REACT_APP_EXPLORE_TITLE=Join to explore Red Hat TPA | ||
| REACT_APP_EXPLORE_DESCRIPTION=Check out our new Trustify to get visibility and insight into your software risk profile, for instance by exploring vulnerabilites or analyzing SBOMs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Branding Configuration | ||
|
|
||
| This project supports two branding modes: **Red Hat** (enterprise) and **Community** (Trustify). | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Prerequisites | ||
| Install the `env-cmd` package to enable environment-specific builds: | ||
| ```bash | ||
| npm install --save-dev env-cmd | ||
| ``` | ||
|
|
||
| ### Development | ||
| ```bash | ||
| # Start development server with Community branding (default) | ||
| npm run start:community | ||
|
|
||
| # Start development server with Red Hat branding | ||
| npm run start:redhat | ||
| ``` | ||
|
|
||
| ### Production Build | ||
| ```bash | ||
| # Build Community version | ||
| npm run build:community | ||
|
|
||
| # Build Red Hat version | ||
| npm run build:redhat | ||
| ``` | ||
|
|
||
| ## Configuration Files | ||
|
|
||
| ### `.env.community` - Community/Trustify Version | ||
| - Uses Trustify branding | ||
| - Points to https://guac.sh/trustify/ | ||
| - Shows "Trustify Overview of security issues" | ||
| - Uses Trustify icon for remediations | ||
|
|
||
| ### `.env.redhat` - Red Hat Enterprise Version | ||
| - Uses Red Hat branding | ||
| - Points to Red Hat developer portal | ||
| - Shows "Red Hat Overview of security Issues" | ||
| - Uses Red Hat icon for remediations | ||
| - Includes "from Red Hat" in remediation text | ||
|
|
||
| ## How It Works | ||
|
|
||
| 1. **Environment Variables**: Different `.env` files define branding configuration | ||
| 2. **Branding Config**: `src/config/branding.ts` reads environment variables and provides typed configuration | ||
| 3. **Conditional Rendering**: Components use `getBrandingConfig()` to conditionally render content based on branding mode | ||
|
|
||
| ## Customizing Branding | ||
|
|
||
| To modify branding, edit the respective `.env` file: | ||
|
|
||
| ```bash | ||
| REACT_APP_BRANDING_MODE=community|redhat | ||
| REACT_APP_BRAND_NAME=Your Brand Name | ||
| REACT_APP_BRAND_TITLE=Your Overview Title | ||
| REACT_APP_REMEDIATION_TITLE=Your Remediation Title | ||
| REACT_APP_BRAND_ICON=icon_name | ||
| REACT_APP_BRAND_URL=https://your-url.com | ||
| REACT_APP_EXPLORE_TITLE=Your Explore Title | ||
| REACT_APP_EXPLORE_DESCRIPTION=Your description text | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| export interface BrandingConfig { | ||
| mode: 'redhat' | 'community'; | ||
soul2zimate marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| brandName: string; | ||
soul2zimate marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| title: string; | ||
soul2zimate marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| remediationTitle: string; | ||
| icon: string; | ||
| url: string; | ||
soul2zimate marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| exploreTitle: string; | ||
| exploreDescription: string; | ||
| } | ||
|
|
||
| export const getBrandingConfig = (): BrandingConfig => { | ||
soul2zimate marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const mode = (process.env.REACT_APP_BRANDING_MODE as 'redhat' | 'community') || 'community'; | ||
|
|
||
| // Define defaults based on mode | ||
| const defaults = { | ||
| community: { | ||
| brandName: 'Trustify', | ||
| title: 'Trustify Overview of security issues', | ||
| remediationTitle: 'Remediations', | ||
| icon: 'trustify', | ||
| url: 'https://guac.sh/trustify/', | ||
| exploreTitle: 'Learn more about Trustify', | ||
| exploreDescription: 'The Trustify project is a collection of software components that enables you to store and retrieve Software Bill of Materials (SBOMs), and advisory documents.' | ||
| }, | ||
| redhat: { | ||
| brandName: 'Red Hat', | ||
| title: 'Red Hat Overview of security Issues', | ||
| remediationTitle: 'Red Hat Remediations', | ||
| icon: 'redhat', | ||
| url: 'https://developers.redhat.com/products/trusted-profile-analyzer/overview', | ||
| exploreTitle: 'Join to explore Red Hat TPA', | ||
| exploreDescription: 'Check out our new Trustify to get visibility and insight into your software risk profile, for instance by exploring vulnerabilites or analyzing SBOMs.' | ||
| } | ||
| }; | ||
|
|
||
| const modeDefaults = defaults[mode]; | ||
|
|
||
| return { | ||
| mode, | ||
| brandName: process.env.REACT_APP_BRAND_NAME || modeDefaults.brandName, | ||
| title: process.env.REACT_APP_BRAND_TITLE || modeDefaults.title, | ||
| remediationTitle: process.env.REACT_APP_REMEDIATION_TITLE || modeDefaults.remediationTitle, | ||
| icon: process.env.REACT_APP_BRAND_ICON || modeDefaults.icon, | ||
| url: process.env.REACT_APP_BRAND_URL || modeDefaults.url, | ||
| exploreTitle: process.env.REACT_APP_EXPLORE_TITLE || modeDefaults.exploreTitle, | ||
| exploreDescription: process.env.REACT_APP_EXPLORE_DESCRIPTION || modeDefaults.exploreDescription | ||
| }; | ||
| }; | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.