FEAT [GUI] Add Home landing page and fix empty-chat message#1750
Open
romanlutz wants to merge 4 commits into
Open
FEAT [GUI] Add Home landing page and fix empty-chat message#1750romanlutz wants to merge 4 commits into
romanlutz wants to merge 4 commits into
Conversation
- Add a new Home view as the default landing page in Co-PyRIT GUI. The Home page shows a hero, the LabelsBar so users can set global labels (operator, operation), a Target card with a button to the Target Configuration page, and a Recent Operations grid that fetches the latest attacks via attacksApi.listAttacks and groups them by the operation label. - Add 'home' to the ViewName union and prepend a Home button in the sidebar Navigation (uses HomeRegular icon). - Replace MessageList's misleading "Welcome to PyRIT" empty state with "There are no messages in this conversation yet." so that opening a historical attack with zero stored messages reads correctly instead of looking like a brand-new chat. - Update App, Navigation, MessageList unit tests and e2e specs that previously assumed chat was the default view. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LabelsBar's root sets `flex: 1 1 0` which assumes a horizontal flex parent. Inside Home's column-flex card the LabelsBar collapsed to zero height so the operator/operation chips were invisible. Wrap LabelsBar in a dedicated row container with an explicit min-height so the chips render. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Three Playwright e2e tests broke when the Home landing page replaced Chat as the initial view: - chat.spec.ts `should disable input when no target is active`: navigate to Chat before asserting the no-target-banner, since Home does not render that element. - config.spec.ts `should enable chat input after a target is set`: same Chat navigation before the no-target-banner assertion. - accessibility.spec.ts `should be navigable with keyboard`: wait for the Home sidebar button to render and dispatch the initial Tab through `body` so the focus advances into the DOM reliably under parallel worker load. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
The Co-PyRIT GUI dropped users straight into the chat view with no guidance, and the chat empty state showed a generic "Welcome to PyRIT" screen even when an attack was explicitly opened from History. That made it impossible to tell whether the attack had actually loaded (it just had zero stored messages, e.g. an errored or pending one).
This PR adds a proper Home landing view (now the default) and fixes the misleading chat empty state.
Home view
A new tab is prepended to the sidebar with a
HomeRegularicon. The Home page contains:LabelsBarso users can review/updateoperator,operation, and any custom labels before kicking off an attack.attacksApi.listAttacks, group them client-side by theoperationlabel, and render up to 5 most-recent operation cards. Each card lists the 3 most recent attacks for that operation, click-to-open. Loading, error, and empty states are all handled.App.tsxis the central state container, so labels, active target,onNavigate, andonOpenAttackare shared between Home and Chat without duplication.Chat empty state
MessageList.tsxno longer renders the "Welcome to PyRIT" screen onmessages.length === 0. It now shows "There are no messages in this conversation yet." which reads correctly both for brand-new chats and for historical attacks with no stored messages.Notable details
LabelsBarusesflex: 1 1 0(sized for the horizontal chat ribbon) and collapsed to zero height inside Home's column-flex card. Fixed by wrapping it in alabelsRowflex container with a small min-height (commit 2).getByTitle("Chat")).App.test.tsxwere racing the asyncinitLabelseffect against a view-change re-render that consumed themockResolvedValueOnceoverride. They now assert on Home''s labels prop directly, no view switch required.Tests and Documentation
Home.test.tsx(11 tests covering hero, target card, navigation, empty / loading / error / grouped data states, and the "open attack" callback).App.test.tsx,Navigation.test.tsx,MessageList.test.tsx.chat,api,accessibility,errors) for the new default view.npm run lintclean. Global coverage 92.95% / 86.14% / 91.62% / 95.34% (above the 85/85/90/90 thresholds).Screenshots
Home view (dark, with seeded recent operations):
Home view (light theme):
Home view with no attacks yet (empty Recent operations state):
Sidebar with the new Home button at the top:
Chat empty state with the new copy (also shown for historical attacks with zero stored messages, which used to fall back to the misleading "Welcome to PyRIT" screen):
Same empty-state copy when an attack is opened from Home / History but has no messages: