-
Notifications
You must be signed in to change notification settings - Fork 14
feat(TC-5554): Add version display to Exploit Intelligence UI #309
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
TamarW0
wants to merge
10
commits into
main
Choose a base branch
from
worktree-tc-5554-version-display
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fff6566
feat(TC-5554): Add version display to Exploit Intelligence UI
48a0252
feat(TC-5554): Refine About modal layout to match Figma specs
1d241eb
fix(TC-5554): Address PR review comments
5cc0d04
fix(TC-5554): Final About modal polish — fit-content height and descr…
3fdf9cc
chore: remove unnecessary comments and ticket ID references
ab6b4b8
refactor: inline getEnvOrDefault — only one call site
4db8187
fix: add required brandImageSrc/brandImageAlt props to satisfy TypeSc…
c8e500f
fix: use actual Red Hat logo for required brand props instead of empt…
4f7a268
Update href
TamarW0 e665a2e
revert href
TamarW0 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
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,39 @@ | ||
| // Simple mock server for testing version API | ||
| const http = require('http'); | ||
|
|
||
| const server = http.createServer((req, res) => { | ||
| // Enable CORS | ||
| res.setHeader('Access-Control-Allow-Origin', '*'); | ||
| res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS'); | ||
| res.setHeader('Access-Control-Allow-Headers', 'Content-Type'); | ||
|
|
||
| if (req.method === 'OPTIONS') { | ||
| res.writeHead(200); | ||
| res.end(); | ||
| return; | ||
| } | ||
|
|
||
| if (req.url === '/api/v1/version') { | ||
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify({ | ||
| version: '3.1.0', | ||
| components: { | ||
| engine: { version: 'v0.0.3-e5f6g7h' }, | ||
| webapp: { version: 'v0.0.3-9k8j7h6' }, | ||
| cache: { version: 'v0.0.3-4m3n2bl' } | ||
| } | ||
| })); | ||
| } else if (req.url === '/api/v1/user') { | ||
| res.writeHead(200, { 'Content-Type': 'application/json' }); | ||
| res.end(JSON.stringify({ name: 'Test User' })); | ||
| } else { | ||
| res.writeHead(404); | ||
| res.end('Not Found'); | ||
| } | ||
| }); | ||
|
|
||
| const PORT = 8080; | ||
| server.listen(PORT, () => { | ||
| console.log(`Mock server running on http://localhost:${PORT}`); | ||
| console.log(`Version API: http://localhost:${PORT}/api/v1/version`); | ||
| }); |
44 changes: 44 additions & 0 deletions
44
src/main/java/com/redhat/ecosystemappeng/exploitiq/rest/VersionResource.java
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,44 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright (c) 2026, Red Hat Inc. & AFFILIATES. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.redhat.ecosystemappeng.exploitiq.rest; | ||
|
|
||
| import jakarta.ws.rs.GET; | ||
| import jakarta.ws.rs.Path; | ||
| import jakarta.ws.rs.Produces; | ||
| import jakarta.ws.rs.core.MediaType; | ||
| import jakarta.ws.rs.core.Response; | ||
|
|
||
| import org.eclipse.microprofile.openapi.annotations.Operation; | ||
| import org.eclipse.microprofile.openapi.annotations.tags.Tag; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| @Path("/version") | ||
| @Tag(name = "Version", description = "Application version information") | ||
| public class VersionResource { | ||
|
|
||
| @GET | ||
| @Produces(MediaType.APPLICATION_JSON) | ||
| @Operation(summary = "Get application version", description = "Returns version information for the Exploit Intelligence application") | ||
| public Response getVersion() { | ||
| Map<String, Object> versionInfo = new HashMap<>(); | ||
|
|
||
| String version = System.getenv("EXPLOIT_IQ_VERSION"); | ||
| versionInfo.put("version", version != null ? version : "unknown"); | ||
|
|
||
| return Response.ok(versionInfo).build(); | ||
| } | ||
| } |
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,16 @@ | ||
| /* We render the logo inside custom content, so remove the default brand/header | ||
| grid rows and let content start from the top alongside the close button. */ | ||
| .ei-about-modal.pf-v6-c-about-modal-box { | ||
| grid-template-areas: "content close" !important; | ||
| grid-template-rows: auto !important; | ||
| height: fit-content !important; | ||
| } | ||
|
|
||
| .ei-about-modal.pf-v6-c-about-modal-box .pf-v6-c-about-modal-box__brand, | ||
| .ei-about-modal.pf-v6-c-about-modal-box .pf-v6-c-about-modal-box__header { | ||
| display: none !important; | ||
| } | ||
|
|
||
| .ei-about-modal.pf-v6-c-about-modal-box .pf-v6-c-about-modal-box__close { | ||
| padding-block-start: var(--pf-t--global--spacer--xl); | ||
| } |
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,118 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026, Red Hat Inc. & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| import React from 'react'; | ||
| import { AboutModal as PFAboutModal } from '@patternfly/react-core'; | ||
| import { useVersion } from '../hooks/useVersion'; | ||
| import './AboutModal.css'; | ||
|
|
||
| interface AboutModalProps { | ||
| isOpen: boolean; | ||
| onClose: () => void; | ||
| } | ||
|
|
||
| const AboutModal: React.FC<AboutModalProps> = ({ isOpen, onClose }) => { | ||
| const { versionInfo, loading } = useVersion(); | ||
|
|
||
| const components = versionInfo?.components; | ||
|
|
||
| return ( | ||
| <PFAboutModal | ||
| isOpen={isOpen} | ||
| onClose={onClose} | ||
| trademark="COPYRIGHT © 2026" | ||
| brandImageSrc="/redhat.svg" | ||
| brandImageAlt="Red Hat" | ||
| className="ei-about-modal" | ||
| > | ||
| <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--pf-t--global--spacer--2xl)' }}> | ||
| <div style={{ display: 'flex', alignItems: 'center', gap: '8px', height: '32px' }}> | ||
| <img | ||
| src="/redhat.svg" | ||
| alt="Red Hat" | ||
| style={{ width: '37px', height: '28px' }} | ||
| /> | ||
| <h1 style={{ | ||
| fontSize: 'var(--pf-t--global--font--size--2xl)', | ||
| fontWeight: 'var(--pf-t--global--font--weight--heading--bold)' as any, | ||
| margin: 0, | ||
| color: '#151515', | ||
| }}> | ||
| Red Hat Trusted Profile Analyzer | ||
| </h1> | ||
| </div> | ||
|
|
||
| <h2 style={{ | ||
| fontSize: 'var(--pf-t--global--font--size--heading--xl)', | ||
| fontWeight: 500, | ||
| margin: 0, | ||
| color: '#151515', | ||
| }}> | ||
| Exploit Intelligence | ||
| </h2> | ||
|
|
||
| <div> | ||
| <p style={{ margin: 0 }}> | ||
| Exploit Intelligence is an AI-powered exploitability analysis engine that performs | ||
| deep, function-level analysis on application code paths to determine if detected | ||
| vulnerabilities (CVEs) are reachable and executable in your environment. | ||
| <br /> | ||
| For more information refer to{' '} | ||
| <a | ||
| href="https://docs.redhat.com/en/documentation/red_hat_trusted_profile_analyzer" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| Red Hat Exploit Intelligence documentation | ||
| </a> | ||
| </p> | ||
| </div> | ||
|
|
||
| <dl style={{ margin: 0, display: 'flex', flexDirection: 'column', gap: 'var(--pf-t--global--spacer--md)' }}> | ||
| <div style={{ display: 'flex', gap: 'var(--pf-t--global--spacer--sm)' }}> | ||
| <dt style={{ fontWeight: 700, minWidth: '165px' }}>Version</dt> | ||
| <dd style={{ margin: 0 }}>{loading ? 'Loading...' : versionInfo?.version || 'unknown'}</dd> | ||
| </div> | ||
|
|
||
| {components && ( | ||
| <> | ||
| <div style={{ display: 'flex', gap: 'var(--pf-t--global--spacer--sm)' }}> | ||
| <dt style={{ fontWeight: 700 }}>Components</dt> | ||
| </div> | ||
|
|
||
| {components.engine && ( | ||
| <div style={{ display: 'flex', gap: 'var(--pf-t--global--spacer--sm)', paddingLeft: 'var(--pf-t--global--spacer--lg)' }}> | ||
| <dt style={{ fontWeight: 700, minWidth: '125px' }}>EI engine</dt> | ||
| <dd style={{ margin: 0 }}>{components.engine.version}</dd> | ||
| </div> | ||
| )} | ||
| {components.webapp && ( | ||
| <div style={{ display: 'flex', gap: 'var(--pf-t--global--spacer--sm)', paddingLeft: 'var(--pf-t--global--spacer--lg)' }}> | ||
| <dt style={{ fontWeight: 700, minWidth: '125px' }}>EI webapp</dt> | ||
| <dd style={{ margin: 0 }}>{components.webapp.version}</dd> | ||
| </div> | ||
| )} | ||
| {components.cache && ( | ||
| <div style={{ display: 'flex', gap: 'var(--pf-t--global--spacer--sm)', paddingLeft: 'var(--pf-t--global--spacer--lg)' }}> | ||
| <dt style={{ fontWeight: 700, minWidth: '125px' }}>Nginx cache</dt> | ||
| <dd style={{ margin: 0 }}>{components.cache.version}</dd> | ||
| </div> | ||
| )} | ||
| </> | ||
| )} | ||
| </dl> | ||
| </div> | ||
| </PFAboutModal> | ||
| ); | ||
| }; | ||
|
|
||
| export default AboutModal; |
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 |
|---|---|---|
|
|
@@ -29,7 +29,11 @@ import { | |
| import { UserIcon } from "@patternfly/react-icons"; | ||
| import { useAuth, logout } from "../hooks/useAuth"; | ||
|
|
||
| const UserAvatarDropdown: React.FC = () => { | ||
| interface UserAvatarDropdownProps { | ||
| onAboutClick?: () => void; | ||
| } | ||
|
|
||
| const UserAvatarDropdown: React.FC<UserAvatarDropdownProps> = ({ onAboutClick }) => { | ||
| const [isOpen, setIsOpen] = useState(false); | ||
| const { userName, loading, error } = useAuth(); | ||
|
|
||
|
|
@@ -41,6 +45,13 @@ const UserAvatarDropdown: React.FC = () => { | |
| setIsOpen(false); | ||
| }; | ||
|
|
||
| const handleAbout = () => { | ||
| setIsOpen(false); | ||
| if (onAboutClick) { | ||
| onAboutClick(); | ||
| } | ||
| }; | ||
|
|
||
| const handleLogout = async () => { | ||
| setIsOpen(false); | ||
| try { | ||
|
|
@@ -86,9 +97,14 @@ const UserAvatarDropdown: React.FC = () => { | |
| } | ||
|
|
||
| const userDropdownItems = ( | ||
| <DropdownItem key="logout" onClick={handleLogout}> | ||
| Logout | ||
| </DropdownItem> | ||
| <> | ||
| <DropdownItem key="about" onClick={handleAbout}> | ||
| About | ||
| </DropdownItem> | ||
| <DropdownItem key="logout" onClick={handleLogout}> | ||
| Logout | ||
| </DropdownItem> | ||
| </> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ); | ||
|
|
||
| return ( | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional chaining
?.()is exactly the language feature for "call this if it exists", so the explicit null check is just a verbose way of writing the same thing.