@wallarm-org/design-system 4.10.0-rc-feat-parser.1 → 4.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/Badge/generateBadgeVariants.js +9 -28
- package/dist/components/Checkbox/CheckboxGroup.d.ts +2 -1
- package/dist/components/Checkbox/CheckboxGroup.js +16 -13
- package/dist/components/CodeSnippet/internal/FoldToggle.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +71 -84
- package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
- package/dist/components/Radio/RadioGroup.d.ts +2 -1
- package/dist/components/Radio/RadioGroup.js +16 -13
- package/dist/components/SimpleCharts/Chart/classes.js +1 -1
- package/dist/components/SimpleCharts/HorizontalBarStack/classes.js +1 -1
- package/dist/components/SimpleCharts/Metric/classes.d.ts +2 -2
- package/dist/components/SimpleCharts/Metric/classes.js +2 -2
- package/dist/components/Table/TableBody/TableBodyCell.js +4 -1
- package/dist/guidelines/patterns/complex-drawer.md +1084 -0
- package/dist/guidelines/patterns/confirmation-dialogs.md +3 -11
- package/dist/guidelines/patterns/detail-drawer.md +31 -13
- package/dist/guidelines/patterns/empty-states.md +6 -5
- package/dist/guidelines/patterns/entity-table.md +25 -29
- package/dist/guidelines/patterns/feedback-toasts.md +3 -11
- package/dist/guidelines/patterns/resource-list-page.md +14 -16
- package/dist/guidelines/rules.md +6 -5
- package/dist/guidelines/templates/ai-assistant.md +1133 -0
- package/dist/guidelines/templates/api-inventory.md +905 -0
- package/dist/guidelines/templates/attack-events.md +2722 -0
- package/dist/guidelines/templates/incident-detail.md +2085 -0
- package/dist/guidelines/templates/integrations-settings.md +836 -0
- package/dist/guidelines/templates/page-states.md +798 -0
- package/dist/guidelines/templates/rule-editor.md +886 -0
- package/dist/guidelines/templates/security-dashboard.md +681 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/metadata/components.json +20 -108
- package/dist/metadata/guidelines.json +1204 -37
- package/dist/theme/tokens.test.ts +52 -0
- package/package.json +1 -4
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +0 -14
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +0 -209
- package/dist/components/Rules/PointSelector/MatchStep.d.ts +0 -15
- package/dist/components/Rules/PointSelector/MatchStep.js +0 -186
- package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +0 -16
- package/dist/components/Rules/PointSelector/MenuFooterHints.js +0 -177
- package/dist/components/Rules/PointSelector/PointPreview.d.ts +0 -10
- package/dist/components/Rules/PointSelector/PointPreview.js +0 -88
- package/dist/components/Rules/PointSelector/PointSelector.d.ts +0 -17
- package/dist/components/Rules/PointSelector/PointSelector.js +0 -937
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +0 -12
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +0 -173
- package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorError.js +0 -275
- package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +0 -20
- package/dist/components/Rules/PointSelector/PointSelectorInput.js +0 -130
- package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorMenu.js +0 -317
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +0 -8
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +0 -73
- package/dist/components/Rules/PointSelector/SampleRequest.d.ts +0 -14
- package/dist/components/Rules/PointSelector/SampleRequest.js +0 -116
- package/dist/components/Rules/PointSelector/StepMenu.d.ts +0 -40
- package/dist/components/Rules/PointSelector/StepMenu.js +0 -210
- package/dist/components/Rules/PointSelector/VersionWarning.d.ts +0 -26
- package/dist/components/Rules/PointSelector/VersionWarning.js +0 -231
- package/dist/components/Rules/PointSelector/WhereBar.d.ts +0 -48
- package/dist/components/Rules/PointSelector/WhereBar.js +0 -263
- package/dist/components/Rules/PointSelector/classes.d.ts +0 -28
- package/dist/components/Rules/PointSelector/classes.js +0 -22
- package/dist/components/Rules/PointSelector/index.d.ts +0 -20
- package/dist/components/Rules/PointSelector/index.js +0 -18
- package/dist/components/Rules/PointSelector/liftLayer.d.ts +0 -8
- package/dist/components/Rules/PointSelector/liftLayer.js +0 -4
- package/dist/components/Rules/PointSelector/sampleValue.d.ts +0 -6
- package/dist/components/Rules/PointSelector/sampleValue.js +0 -51
- package/dist/components/Rules/PointSelector/sdkBridge.d.ts +0 -508
- package/dist/components/Rules/PointSelector/sdkBridge.js +0 -339
- package/dist/components/Rules/PointSelector/types.d.ts +0 -304
- package/dist/components/Rules/PointSelector/types.js +0 -0
- package/dist/components/Rules/PointSelector/usePointSelector.d.ts +0 -161
- package/dist/components/Rules/PointSelector/usePointSelector.js +0 -1088
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +0 -28
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +0 -208
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +0 -950
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +0 -21
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +0 -110
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +0 -20
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +0 -31
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +0 -131
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +0 -17
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +0 -14
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +0 -6
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +0 -6
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +0 -24
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +0 -245
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +0 -691
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +0 -72
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +0 -407
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +0 -269
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +0 -25
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +0 -99
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +0 -118
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +0 -446
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +0 -266
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +0 -35
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +0 -57
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +0 -10
- package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +0 -67
- package/dist/components/Rules/RuleBuilder/RuleBuilder.js +0 -366
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +0 -32
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +0 -420
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +0 -446
- package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +0 -7
- package/dist/components/Rules/RuleBuilder/Summary/index.js +0 -2
- package/dist/components/Rules/RuleBuilder/classes.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/classes.js +0 -18
- package/dist/components/Rules/RuleBuilder/index.d.ts +0 -55
- package/dist/components/Rules/RuleBuilder/index.js +0 -11
- package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +0 -31
- package/dist/components/Rules/RuleBuilder/models/actionModel.js +0 -276
- package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +0 -95
- package/dist/components/Rules/RuleBuilder/models/conditionModel.js +0 -418
- package/dist/components/Rules/RuleBuilder/models/index.d.ts +0 -3
- package/dist/components/Rules/RuleBuilder/models/index.js +0 -3
- package/dist/components/Rules/RuleBuilder/models/validation.d.ts +0 -176
- package/dist/components/Rules/RuleBuilder/models/validation.js +0 -242
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +0 -92
- package/dist/components/Rules/RuleBuilder/shared/index.d.ts +0 -1
- package/dist/components/Rules/RuleBuilder/shared/index.js +0 -1
- package/dist/components/Rules/RuleBuilder/types.d.ts +0 -384
- package/dist/components/Rules/RuleBuilder/types.js +0 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +0 -65
- package/dist/components/Rules/RuleBuilder/utils/constants.js +0 -356
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +0 -48
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +0 -42
- package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +0 -92
- package/dist/components/Rules/RuleBuilder/utils/helpers.js +0 -54
- package/dist/components/Rules/RuleBuilder/utils/index.d.ts +0 -2
- package/dist/components/Rules/RuleBuilder/utils/index.js +0 -2
|
@@ -0,0 +1,1133 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AI assistant
|
|
3
|
+
description: Use when building an AI security assistant screen: a full-page Wally conversation with reasoning and approvals, or Wally docked beside a product page.
|
|
4
|
+
components: [AppShell, AppShellHeader, AppShellRail, AppShellRemote, AppShellAside, TopHeader, NavRail, Chat, ChatHeader, ChatHeaderTitle, ChatHeaderActions, ChatFooter, ChatSuggestions, ChatSuggestion, ChatTrigger, Conversation, ConversationContent, ConversationEmptyState, ConversationScrollButton, UserMessage, UserMessageBubble, AssistantMessage, AssistantMessageContent, AssistantMessageMarkdown, ChainOfThought, ChainOfThoughtStep, MessageActions, MessageAction, MessageTimestamp, ApprovalCard, ApprovalCardContent, ApprovalCardActions, ChatInput, ChatInputTextarea, ChatInputSubmit, ChatPermissions, ChatPermissionsTrigger, ChatPermissionsContent, ChatPermissionsItem, Select, Copyable, InlineCodeSnippet, NotificationCenter, RemoteShell, Page, Table, DropdownMenu, Badge, Ip, HttpMethod, FormatDateTime]
|
|
5
|
+
keywords: [ai, assistant, wally, copilot, chat, conversation, agent, llm, reasoning, chain of thought, approval, human in the loop, streaming, prompts, suggestions, side panel, docked chat]
|
|
6
|
+
order: 60
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# AI assistant
|
|
10
|
+
|
|
11
|
+
Wally, the security assistant, as a full page in the console and as a panel docked beside a product page. The AI parts are dumb: the app feeds them messages, steps, approvals and run state from its own agent runtime, and the screen composes them inside the console frame.
|
|
12
|
+
|
|
13
|
+
## What it shows
|
|
14
|
+
|
|
15
|
+
- The console frame from [Application layout](../patterns/app-layout.md): `AppShell` with a top header and rail, the chat filling `AppShellRemote`, or docked in `AppShellAside` and toggled by `ChatTrigger`.
|
|
16
|
+
- A turn: `UserMessage`, then `AssistantMessage` with a `ChainOfThought` of tool steps and metrics, a markdown answer with a table, and a visible `MessageActions` row.
|
|
17
|
+
- Human in the loop: a pending `ApprovalCard` docked above the composer; Allow or Reject resolves it in place, and the confirmation follows.
|
|
18
|
+
- Stick-to-bottom: `Conversation` and `ConversationScrollButton` keep the latest message in view; on a wide page the message column and footer are centered to a reading width.
|
|
19
|
+
- Run state: `aria-busy` on the log, a shimmering running step, a streaming markdown tail, and Stop in place of Send.
|
|
20
|
+
- The composer: `ChatInput` with `ChatPermissions` for tool access and a context chip for the record the analyst picked.
|
|
21
|
+
- The docked variant keeps a full [Resource list page](../patterns/resource-list-page.md) next to the chat: toolbar search and status tabs, and an [Entity table](../patterns/entity-table.md) whose master-cell row menu has "Ask Wally" to attach the row to the chat.
|
|
22
|
+
- The empty landing: `ConversationEmptyState` with the live Wally character and suggested prompts that fill the composer.
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
The full-page investigation: reasoning, a summary and a denylist change waiting for approval.
|
|
27
|
+
|
|
28
|
+
The full-page assistant. The analyst asks about an attack spike; Wally shows its reasoning as
|
|
29
|
+
a `ChainOfThought`, answers with a markdown summary and a table, and proposes a denylist
|
|
30
|
+
change. The `ApprovalCard` is docked above the composer while the run waits, with Send
|
|
31
|
+
disabled and the log not busy; Allow or Reject resolves it in place and Wally confirms the outcome.
|
|
32
|
+
|
|
33
|
+
```tsx story=Default
|
|
34
|
+
import { type MouseEvent, useState } from 'react';
|
|
35
|
+
import { ApprovalCard, ApprovalCardActions, ApprovalCardContent, type ApprovalCardStatus } from '@wallarm-org/design-system/ApprovalCard';
|
|
36
|
+
import { AppShell, AppShellHeader, AppShellRail, AppShellRemote } from '@wallarm-org/design-system/AppShell';
|
|
37
|
+
import { AssistantMessage, AssistantMessageContent, AssistantMessageMarkdown } from '@wallarm-org/design-system/AssistantMessage';
|
|
38
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
39
|
+
import { ChainOfThought, ChainOfThoughtStep } from '@wallarm-org/design-system/ChainOfThought';
|
|
40
|
+
import { Chat, ChatFooter, ChatHeader, ChatHeaderActions, ChatHeaderTitle } from '@wallarm-org/design-system/Chat';
|
|
41
|
+
import { ChatInput, ChatInputSubmit, ChatInputTextarea } from '@wallarm-org/design-system/ChatInput';
|
|
42
|
+
import { ChatPermissions, ChatPermissionsContent, ChatPermissionsItem, type ChatPermissionsItemCheckedChangeDetails, ChatPermissionsTrigger } from '@wallarm-org/design-system/ChatPermissions';
|
|
43
|
+
import { InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
44
|
+
import { Conversation, ConversationContent, ConversationScrollButton } from '@wallarm-org/design-system/Conversation';
|
|
45
|
+
import { Copyable, CopyableIcon } from '@wallarm-org/design-system/Copyable';
|
|
46
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
47
|
+
import { Brain, ChevronUpDown, CircleHelp, Cloud, Database, Ellipsis, FlaskConical, Globe, History, Home, LogOut, MessageSquare, Plus, Search, Settings, ShieldBan, ThumbsDown, ThumbsUp, UserRound } from '@wallarm-org/design-system/icons';
|
|
48
|
+
import { Logo } from '@wallarm-org/design-system/Logo';
|
|
49
|
+
import { MessageAction, MessageActions, MessageTimestamp } from '@wallarm-org/design-system/MessageActions';
|
|
50
|
+
import { NavRail, NavRailBody, NavRailFooter, NavRailItem, NavRailSeparator } from '@wallarm-org/design-system/NavRail';
|
|
51
|
+
import { NotificationCenter, NotificationCenterTrigger } from '@wallarm-org/design-system/NotificationCenter';
|
|
52
|
+
import { Select, SelectButton, SelectContent, SelectOption, SelectOptionIndicator, SelectOptionText, SelectPositioner } from '@wallarm-org/design-system/Select';
|
|
53
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
54
|
+
import { TopHeader, TopHeaderActions, TopHeaderLogo, TopHeaderSeparator } from '@wallarm-org/design-system/TopHeader';
|
|
55
|
+
import { UserMessage, UserMessageBubble } from '@wallarm-org/design-system/UserMessage';
|
|
56
|
+
|
|
57
|
+
export const Default = () => {
|
|
58
|
+
const [value, setValue] = useState('');
|
|
59
|
+
const [thread, setThread] = useState(['spike']);
|
|
60
|
+
const [approval, setApproval] = useState<ApprovalCardStatus>('pending');
|
|
61
|
+
const [allowed, setAllowed] = useState(TOOL_DEFAULTS);
|
|
62
|
+
const pending = approval === 'pending';
|
|
63
|
+
|
|
64
|
+
const handleNavClick = (event: MouseEvent<HTMLAnchorElement>) => {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
onNavigate(event.currentTarget.getAttribute('href'));
|
|
67
|
+
};
|
|
68
|
+
const handleThreadChange = ({ value: next }: { value: string[] }) => setThread(next);
|
|
69
|
+
const handleSubmit = () => setValue('');
|
|
70
|
+
const handleApprove = () => setApproval('approved');
|
|
71
|
+
const handleReject = () => setApproval('rejected');
|
|
72
|
+
const handlePermissionChange = ({ checked, name }: ChatPermissionsItemCheckedChangeDetails) =>
|
|
73
|
+
setAllowed(previous => ({ ...previous, [name]: checked }));
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<AppShell data-testid='app-shell'>
|
|
77
|
+
<AppShellHeader>
|
|
78
|
+
<TopHeader>
|
|
79
|
+
<TopHeaderLogo href='/' onClick={handleNavClick}>
|
|
80
|
+
<Logo size='md' />
|
|
81
|
+
</TopHeaderLogo>
|
|
82
|
+
<TopHeaderActions>
|
|
83
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='Search'>
|
|
84
|
+
<Search />
|
|
85
|
+
</Button>
|
|
86
|
+
<TopHeaderSeparator />
|
|
87
|
+
<Button variant='ghost' color='neutral' size='small'>
|
|
88
|
+
Shop Demo
|
|
89
|
+
<ChevronUpDown />
|
|
90
|
+
</Button>
|
|
91
|
+
<NotificationCenter>
|
|
92
|
+
<NotificationCenterTrigger />
|
|
93
|
+
</NotificationCenter>
|
|
94
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='Help'>
|
|
95
|
+
<CircleHelp />
|
|
96
|
+
</Button>
|
|
97
|
+
</TopHeaderActions>
|
|
98
|
+
</TopHeader>
|
|
99
|
+
</AppShellHeader>
|
|
100
|
+
|
|
101
|
+
<AppShellRail>
|
|
102
|
+
<NavRail mode='collapsed'>
|
|
103
|
+
<NavRailBody>
|
|
104
|
+
<NavRailItem href='/' icon={Home} label='Home' onClick={handleNavClick} />
|
|
105
|
+
<NavRailItem
|
|
106
|
+
href='/assistant'
|
|
107
|
+
icon={MessageSquare}
|
|
108
|
+
label='Ask Wally'
|
|
109
|
+
active
|
|
110
|
+
onClick={handleNavClick}
|
|
111
|
+
/>
|
|
112
|
+
<NavRailSeparator />
|
|
113
|
+
<NavRailItem href='/edge' icon={Cloud} label='Edge' onClick={handleNavClick} />
|
|
114
|
+
<NavRailItem
|
|
115
|
+
href='/security-testing'
|
|
116
|
+
icon={FlaskConical}
|
|
117
|
+
label='Security Testing'
|
|
118
|
+
onClick={handleNavClick}
|
|
119
|
+
/>
|
|
120
|
+
</NavRailBody>
|
|
121
|
+
<NavRailFooter>
|
|
122
|
+
<NavRailItem
|
|
123
|
+
href='/settings'
|
|
124
|
+
icon={Settings}
|
|
125
|
+
label='Settings'
|
|
126
|
+
onClick={handleNavClick}
|
|
127
|
+
/>
|
|
128
|
+
<DropdownMenu positioning={{ placement: 'right-end', gutter: 6 }}>
|
|
129
|
+
<DropdownMenuTrigger>
|
|
130
|
+
<NavRailItem icon={UserRound} label='Alex Morgan' avatar />
|
|
131
|
+
</DropdownMenuTrigger>
|
|
132
|
+
<DropdownMenuContent className='w-200'>
|
|
133
|
+
<DropdownMenuItem onSelect={onSignOut}>
|
|
134
|
+
<DropdownMenuItemIcon>
|
|
135
|
+
<LogOut />
|
|
136
|
+
</DropdownMenuItemIcon>
|
|
137
|
+
<DropdownMenuItemText>Sign out</DropdownMenuItemText>
|
|
138
|
+
</DropdownMenuItem>
|
|
139
|
+
</DropdownMenuContent>
|
|
140
|
+
</DropdownMenu>
|
|
141
|
+
</NavRailFooter>
|
|
142
|
+
</NavRail>
|
|
143
|
+
</AppShellRail>
|
|
144
|
+
|
|
145
|
+
<AppShellRemote role='main'>
|
|
146
|
+
<Chat data-testid='wally-chat'>
|
|
147
|
+
<ChatHeader>
|
|
148
|
+
<ChatHeaderTitle>
|
|
149
|
+
<Select collection={THREADS} value={thread} onValueChange={handleThreadChange}>
|
|
150
|
+
<SelectButton variant='ghost' size='small' placeholder='New chat' />
|
|
151
|
+
<SelectPositioner>
|
|
152
|
+
<SelectContent>
|
|
153
|
+
{THREADS.items.map(item => (
|
|
154
|
+
<SelectOption key={item.value} item={item}>
|
|
155
|
+
<SelectOptionText>{item.label}</SelectOptionText>
|
|
156
|
+
<SelectOptionIndicator />
|
|
157
|
+
</SelectOption>
|
|
158
|
+
))}
|
|
159
|
+
</SelectContent>
|
|
160
|
+
</SelectPositioner>
|
|
161
|
+
</Select>
|
|
162
|
+
</ChatHeaderTitle>
|
|
163
|
+
<ChatHeaderActions>
|
|
164
|
+
<Button
|
|
165
|
+
variant='ghost'
|
|
166
|
+
color='neutral'
|
|
167
|
+
size='small'
|
|
168
|
+
aria-label='New chat'
|
|
169
|
+
onClick={onNewChat}
|
|
170
|
+
>
|
|
171
|
+
<Plus />
|
|
172
|
+
</Button>
|
|
173
|
+
<Separator orientation='vertical' />
|
|
174
|
+
<Button
|
|
175
|
+
variant='ghost'
|
|
176
|
+
color='neutral'
|
|
177
|
+
size='small'
|
|
178
|
+
aria-label='Chat history'
|
|
179
|
+
onClick={onOpenHistory}
|
|
180
|
+
>
|
|
181
|
+
<History />
|
|
182
|
+
</Button>
|
|
183
|
+
<DropdownMenu positioning={{ placement: 'bottom-end' }}>
|
|
184
|
+
<DropdownMenuTrigger asChild>
|
|
185
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='More actions'>
|
|
186
|
+
<Ellipsis />
|
|
187
|
+
</Button>
|
|
188
|
+
</DropdownMenuTrigger>
|
|
189
|
+
<DropdownMenuContent>
|
|
190
|
+
<DropdownMenuItem>Rename chat</DropdownMenuItem>
|
|
191
|
+
<DropdownMenuSeparator />
|
|
192
|
+
<DropdownMenuItem variant='destructive'>Delete chat</DropdownMenuItem>
|
|
193
|
+
</DropdownMenuContent>
|
|
194
|
+
</DropdownMenu>
|
|
195
|
+
</ChatHeaderActions>
|
|
196
|
+
</ChatHeader>
|
|
197
|
+
|
|
198
|
+
<Conversation autoScrollKey='q-1'>
|
|
199
|
+
<ConversationContent contentClassName='mx-auto w-full max-w-768'>
|
|
200
|
+
<UserMessage data-testid='wally-question'>
|
|
201
|
+
<UserMessageBubble>{QUESTION}</UserMessageBubble>
|
|
202
|
+
<MessageActions>
|
|
203
|
+
<MessageTimestamp dateTime='2026-11-06T14:02:00Z'>14:02</MessageTimestamp>
|
|
204
|
+
<Copyable text={QUESTION}>
|
|
205
|
+
<MessageAction aria-label='Copy'>
|
|
206
|
+
<CopyableIcon />
|
|
207
|
+
</MessageAction>
|
|
208
|
+
</Copyable>
|
|
209
|
+
</MessageActions>
|
|
210
|
+
</UserMessage>
|
|
211
|
+
|
|
212
|
+
<AssistantMessage data-testid='wally-answer'>
|
|
213
|
+
<ChainOfThought>
|
|
214
|
+
<ChainOfThoughtStep icon={<Brain />} label='Thought for 4s'>
|
|
215
|
+
<p>
|
|
216
|
+
Pull attacks on api.shop-demo.io for the last two hours, compare them with the
|
|
217
|
+
7-day baseline, then group by source network and target endpoint.
|
|
218
|
+
</p>
|
|
219
|
+
</ChainOfThoughtStep>
|
|
220
|
+
<ChainOfThoughtStep
|
|
221
|
+
icon={<Search />}
|
|
222
|
+
label='Searched attacks on api.shop-demo.io'
|
|
223
|
+
metric='18,420'
|
|
224
|
+
/>
|
|
225
|
+
<ChainOfThoughtStep
|
|
226
|
+
icon={<Database />}
|
|
227
|
+
label='Grouped by source network'
|
|
228
|
+
metric='3 networks'
|
|
229
|
+
/>
|
|
230
|
+
<ChainOfThoughtStep
|
|
231
|
+
icon={<Globe />}
|
|
232
|
+
label='Checked IP reputation'
|
|
233
|
+
metric='hosting'
|
|
234
|
+
/>
|
|
235
|
+
<ChainOfThoughtStep
|
|
236
|
+
icon={<ShieldBan />}
|
|
237
|
+
label='Proposed a denylist entry'
|
|
238
|
+
status={pending ? 'running' : 'done'}
|
|
239
|
+
/>
|
|
240
|
+
</ChainOfThought>
|
|
241
|
+
<AssistantMessageContent>
|
|
242
|
+
<AssistantMessageMarkdown text={SUMMARY} />
|
|
243
|
+
</AssistantMessageContent>
|
|
244
|
+
<MessageActions visible>
|
|
245
|
+
<Copyable text={SUMMARY}>
|
|
246
|
+
<MessageAction aria-label='Copy'>
|
|
247
|
+
<CopyableIcon />
|
|
248
|
+
</MessageAction>
|
|
249
|
+
</Copyable>
|
|
250
|
+
<MessageAction aria-label='Good response'>
|
|
251
|
+
<ThumbsUp />
|
|
252
|
+
</MessageAction>
|
|
253
|
+
<MessageAction aria-label='Bad response'>
|
|
254
|
+
<ThumbsDown />
|
|
255
|
+
</MessageAction>
|
|
256
|
+
<MessageTimestamp dateTime='2026-11-06T14:02:00Z'>14:02</MessageTimestamp>
|
|
257
|
+
</MessageActions>
|
|
258
|
+
</AssistantMessage>
|
|
259
|
+
|
|
260
|
+
{!pending && (
|
|
261
|
+
<AssistantMessage data-testid='wally-outcome'>
|
|
262
|
+
<AssistantMessageContent>
|
|
263
|
+
<p>
|
|
264
|
+
{approval === 'approved'
|
|
265
|
+
? 'Done. 203.0.113.0/24 and 198.51.100.0/24 are denied on api.shop-demo.io until 14:03 UTC tomorrow.'
|
|
266
|
+
: 'Okay, I left the denylist unchanged. The brute-force trigger keeps blocking these requests.'}
|
|
267
|
+
</p>
|
|
268
|
+
</AssistantMessageContent>
|
|
269
|
+
</AssistantMessage>
|
|
270
|
+
)}
|
|
271
|
+
</ConversationContent>
|
|
272
|
+
<ConversationScrollButton />
|
|
273
|
+
</Conversation>
|
|
274
|
+
|
|
275
|
+
<ChatFooter className='mx-auto w-full max-w-800'>
|
|
276
|
+
<ApprovalCard status={approval} data-testid='wally-approval'>
|
|
277
|
+
<ApprovalCardContent>
|
|
278
|
+
<p>
|
|
279
|
+
Add <InlineCodeSnippet code='203.0.113.0/24' size='sm' /> and{' '}
|
|
280
|
+
<InlineCodeSnippet code='198.51.100.0/24' size='sm' /> to the denylist on
|
|
281
|
+
api.shop-demo.io for 24 hours
|
|
282
|
+
</p>
|
|
283
|
+
</ApprovalCardContent>
|
|
284
|
+
<ApprovalCardActions>
|
|
285
|
+
<Button data-testid='wally-approve' onClick={handleApprove}>
|
|
286
|
+
Allow
|
|
287
|
+
</Button>
|
|
288
|
+
<Button
|
|
289
|
+
variant='secondary'
|
|
290
|
+
color='neutral'
|
|
291
|
+
data-testid='wally-reject'
|
|
292
|
+
onClick={handleReject}
|
|
293
|
+
>
|
|
294
|
+
Reject
|
|
295
|
+
</Button>
|
|
296
|
+
</ApprovalCardActions>
|
|
297
|
+
</ApprovalCard>
|
|
298
|
+
<ChatInput value={value} onValueChange={setValue} onSubmit={handleSubmit}>
|
|
299
|
+
<ChatInputTextarea />
|
|
300
|
+
<ChatPermissions>
|
|
301
|
+
<ChatPermissionsTrigger />
|
|
302
|
+
<ChatPermissionsContent>
|
|
303
|
+
{TOOLS.map(tool => (
|
|
304
|
+
<ChatPermissionsItem
|
|
305
|
+
key={tool.name}
|
|
306
|
+
name={tool.name}
|
|
307
|
+
title={tool.name}
|
|
308
|
+
description={tool.description}
|
|
309
|
+
checked={allowed[tool.name]}
|
|
310
|
+
onCheckedChange={handlePermissionChange}
|
|
311
|
+
/>
|
|
312
|
+
))}
|
|
313
|
+
</ChatPermissionsContent>
|
|
314
|
+
</ChatPermissions>
|
|
315
|
+
{/* The run waits on the approval, not on the model: Send is off, there is nothing to stop. */}
|
|
316
|
+
<ChatInputSubmit disabled={pending} />
|
|
317
|
+
</ChatInput>
|
|
318
|
+
</ChatFooter>
|
|
319
|
+
</Chat>
|
|
320
|
+
</AppShellRemote>
|
|
321
|
+
</AppShell>
|
|
322
|
+
);
|
|
323
|
+
};
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Wally docked beside the Attacks page, with the picked attack attached as context.
|
|
327
|
+
|
|
328
|
+
Wally docked beside a product page. The Attacks page keeps its own header, toolbar and table;
|
|
329
|
+
`AppShellAside` holds the chat and the header's `ChatTrigger` toggles it. "Ask Wally" in a row's
|
|
330
|
+
master-cell menu attaches the attack to the composer as a context chip and marks the row active.
|
|
331
|
+
|
|
332
|
+
```tsx story=DockedPanel
|
|
333
|
+
import { type MouseEvent, useRef, useState } from 'react';
|
|
334
|
+
import { AppShell, AppShellAside, AppShellHeader, AppShellRail, AppShellRemote } from '@wallarm-org/design-system/AppShell';
|
|
335
|
+
import { AssistantMessage, AssistantMessageContent, AssistantMessageMarkdown } from '@wallarm-org/design-system/AssistantMessage';
|
|
336
|
+
import { Badge } from '@wallarm-org/design-system/Badge';
|
|
337
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
338
|
+
import { ChainOfThought, ChainOfThoughtStep } from '@wallarm-org/design-system/ChainOfThought';
|
|
339
|
+
import { Chat, ChatFooter, ChatHeader, ChatHeaderActions, ChatHeaderTitle, ChatSuggestion, ChatSuggestions, ChatTrigger } from '@wallarm-org/design-system/Chat';
|
|
340
|
+
import { ChatInput, ChatInputSubmit, ChatInputTextarea } from '@wallarm-org/design-system/ChatInput';
|
|
341
|
+
import { Conversation, ConversationContent, ConversationScrollButton } from '@wallarm-org/design-system/Conversation';
|
|
342
|
+
import { Copyable, CopyableIcon } from '@wallarm-org/design-system/Copyable';
|
|
343
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
344
|
+
import { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIllustration, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
|
|
345
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
346
|
+
import { HttpMethod } from '@wallarm-org/design-system/HttpMethod';
|
|
347
|
+
import { CheckCheck, ChevronUpDown, CircleHelp, Cloud, Ellipsis, FilterX, FlaskConical, Globe, History, Home, LogOut, MessageSquare, Plus, Quote, Search, SearchX, Settings, ThumbsDown, ThumbsUp, UserRound, X } from '@wallarm-org/design-system/icons';
|
|
348
|
+
import { Ip, IpAddress, IpCountry } from '@wallarm-org/design-system/Ip';
|
|
349
|
+
import { Logo } from '@wallarm-org/design-system/Logo';
|
|
350
|
+
import { MessageAction, MessageActions, MessageTimestamp } from '@wallarm-org/design-system/MessageActions';
|
|
351
|
+
import { NavRail, NavRailBody, NavRailFooter, NavRailItem, NavRailSeparator } from '@wallarm-org/design-system/NavRail';
|
|
352
|
+
import { NotificationCenter, NotificationCenterBody, NotificationCenterContent, NotificationCenterEmpty, NotificationCenterHeader, NotificationCenterTitle, NotificationCenterTrigger } from '@wallarm-org/design-system/NotificationCenter';
|
|
353
|
+
import { NumericBadge } from '@wallarm-org/design-system/NumericBadge';
|
|
354
|
+
import { Page, PageContent, PageDescription, PageHeader, PageHeaderGroup, PageTitle, PageToolbar } from '@wallarm-org/design-system/Page';
|
|
355
|
+
import { RemoteShell, RemoteShellBreadcrumb, RemoteShellContent } from '@wallarm-org/design-system/RemoteShell';
|
|
356
|
+
import { SearchInput } from '@wallarm-org/design-system/SearchInput';
|
|
357
|
+
import { SegmentedTabs, SegmentedTabsList, SegmentedTabsTrigger } from '@wallarm-org/design-system/SegmentedTabs';
|
|
358
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
359
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
360
|
+
import { type TableCellContext, type TableColumnDef, type TableRow, Table, TableEmptyState } from '@wallarm-org/design-system/Table';
|
|
361
|
+
import { TagClose } from '@wallarm-org/design-system/Tag';
|
|
362
|
+
import { Text } from '@wallarm-org/design-system/Text';
|
|
363
|
+
import { TopHeader, TopHeaderActions, TopHeaderLogo, TopHeaderSeparator } from '@wallarm-org/design-system/TopHeader';
|
|
364
|
+
import { UserMessage, UserMessageBubble } from '@wallarm-org/design-system/UserMessage';
|
|
365
|
+
|
|
366
|
+
export const DockedPanel = () => {
|
|
367
|
+
const [pathname, setPathname] = useState('/edge/attacks');
|
|
368
|
+
const [asideOpen, setAsideOpen] = useState(true);
|
|
369
|
+
const [query, setQuery] = useState('');
|
|
370
|
+
const [status, setStatus] = useState('all');
|
|
371
|
+
const [contextId, setContextId] = useState<string | null>('atk-90412');
|
|
372
|
+
const [value, setValue] = useState('');
|
|
373
|
+
const toggleRef = useRef<HTMLButtonElement>(null);
|
|
374
|
+
|
|
375
|
+
const handleNavClick = (event: MouseEvent<HTMLAnchorElement>) => {
|
|
376
|
+
event.preventDefault();
|
|
377
|
+
onNavigate(event.currentTarget.getAttribute('href'));
|
|
378
|
+
};
|
|
379
|
+
const handleNavigate = (to: string) => {
|
|
380
|
+
onNavigate(to);
|
|
381
|
+
setPathname(to);
|
|
382
|
+
};
|
|
383
|
+
const handleAssistantToggle = () => setAsideOpen(open => !open);
|
|
384
|
+
const handleCloseChat = () => {
|
|
385
|
+
// Focus inside the panel would drop to <body> once it hides: hand it back to the toggle.
|
|
386
|
+
toggleRef.current?.focus();
|
|
387
|
+
setAsideOpen(false);
|
|
388
|
+
};
|
|
389
|
+
const handleContextRemove = () => setContextId(null);
|
|
390
|
+
const handleSuggestionClick = (event: MouseEvent<HTMLButtonElement>) =>
|
|
391
|
+
setValue(event.currentTarget.value);
|
|
392
|
+
const handleSubmit = () => setValue('');
|
|
393
|
+
const handleReset = () => {
|
|
394
|
+
setQuery('');
|
|
395
|
+
setStatus('all');
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const renderAttack = ({ row }: TableCellContext<AttackEvent, unknown>) => (
|
|
399
|
+
<VStack gap={2}>
|
|
400
|
+
<Text size='sm' weight='medium' truncate>
|
|
401
|
+
{row.original.type}
|
|
402
|
+
</Text>
|
|
403
|
+
<HStack gap={6}>
|
|
404
|
+
<HttpMethod method={row.original.method} size='small' />
|
|
405
|
+
<Text size='xs' color='secondary' truncate>
|
|
406
|
+
{row.original.path}
|
|
407
|
+
</Text>
|
|
408
|
+
</HStack>
|
|
409
|
+
</VStack>
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
const renderSource = ({ row }: TableCellContext<AttackEvent, unknown>) => (
|
|
413
|
+
<Ip>
|
|
414
|
+
<IpCountry code={row.original.country} />
|
|
415
|
+
<IpAddress>{row.original.sourceIp}</IpAddress>
|
|
416
|
+
</Ip>
|
|
417
|
+
);
|
|
418
|
+
|
|
419
|
+
const renderHits = ({ row }: TableCellContext<AttackEvent, unknown>) => row.original.hits;
|
|
420
|
+
|
|
421
|
+
const renderStatus = ({ row }: TableCellContext<AttackEvent, unknown>) => (
|
|
422
|
+
<Badge variant='dotted' type='secondary' color={ATTACK_STATUS[row.original.status].color}>
|
|
423
|
+
{ATTACK_STATUS[row.original.status].label}
|
|
424
|
+
</Badge>
|
|
425
|
+
);
|
|
426
|
+
|
|
427
|
+
const renderLastSeen = ({ row }: TableCellContext<AttackEvent, unknown>) => (
|
|
428
|
+
<FormatDateTime value={row.original.lastSeen} format='datetime' />
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
const renderMenuAction = (row: TableRow<AttackEvent>) => {
|
|
432
|
+
const attack = row.original;
|
|
433
|
+
const handleAsk = () => {
|
|
434
|
+
setContextId(attack.id);
|
|
435
|
+
setAsideOpen(true);
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
return (
|
|
439
|
+
<DropdownMenu data-testid='attacks-row-menu'>
|
|
440
|
+
<DropdownMenuTrigger asChild>
|
|
441
|
+
<Button
|
|
442
|
+
variant='ghost'
|
|
443
|
+
color='neutral'
|
|
444
|
+
size='small'
|
|
445
|
+
aria-label={`Actions for ${attack.type} from ${attack.sourceIp}`}
|
|
446
|
+
>
|
|
447
|
+
<Ellipsis />
|
|
448
|
+
</Button>
|
|
449
|
+
</DropdownMenuTrigger>
|
|
450
|
+
<DropdownMenuContent>
|
|
451
|
+
<DropdownMenuItem onSelect={handleAsk}>
|
|
452
|
+
<DropdownMenuItemIcon>
|
|
453
|
+
<MessageSquare />
|
|
454
|
+
</DropdownMenuItemIcon>
|
|
455
|
+
<DropdownMenuItemText>Ask Wally</DropdownMenuItemText>
|
|
456
|
+
</DropdownMenuItem>
|
|
457
|
+
</DropdownMenuContent>
|
|
458
|
+
</DropdownMenu>
|
|
459
|
+
);
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
const columns: TableColumnDef<AttackEvent>[] = [
|
|
463
|
+
{
|
|
464
|
+
accessorKey: 'type',
|
|
465
|
+
header: 'Attack',
|
|
466
|
+
size: 320,
|
|
467
|
+
cell: renderAttack,
|
|
468
|
+
meta: { renderMenuAction },
|
|
469
|
+
},
|
|
470
|
+
{ accessorKey: 'sourceIp', header: 'Source', size: 180, cell: renderSource },
|
|
471
|
+
{ accessorKey: 'hits', header: 'Hits', size: 100, cell: renderHits },
|
|
472
|
+
{ accessorKey: 'status', header: 'Status', size: 140, cell: renderStatus },
|
|
473
|
+
{ accessorKey: 'lastSeen', header: 'Last seen', size: 200, cell: renderLastSeen },
|
|
474
|
+
];
|
|
475
|
+
|
|
476
|
+
const search = query.trim().toLowerCase();
|
|
477
|
+
const matching = ATTACKS.filter(
|
|
478
|
+
attack =>
|
|
479
|
+
attack.type.toLowerCase().includes(search) ||
|
|
480
|
+
attack.path.toLowerCase().includes(search) ||
|
|
481
|
+
attack.sourceIp.includes(search),
|
|
482
|
+
);
|
|
483
|
+
const counts = {
|
|
484
|
+
all: matching.length,
|
|
485
|
+
blocked: matching.filter(attack => attack.status === 'blocked').length,
|
|
486
|
+
monitored: matching.filter(attack => attack.status === 'monitored').length,
|
|
487
|
+
};
|
|
488
|
+
const rows = status === 'all' ? matching : matching.filter(attack => attack.status === status);
|
|
489
|
+
const contextAttack = ATTACKS.find(attack => attack.id === contextId);
|
|
490
|
+
|
|
491
|
+
return (
|
|
492
|
+
<AppShell data-testid='app-shell'>
|
|
493
|
+
<AppShellHeader>
|
|
494
|
+
<TopHeader>
|
|
495
|
+
<TopHeaderLogo href='/' onClick={handleNavClick}>
|
|
496
|
+
<Logo size='md' />
|
|
497
|
+
</TopHeaderLogo>
|
|
498
|
+
<TopHeaderActions>
|
|
499
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='Search'>
|
|
500
|
+
<Search />
|
|
501
|
+
</Button>
|
|
502
|
+
<TopHeaderSeparator />
|
|
503
|
+
<Button variant='ghost' color='neutral' size='small'>
|
|
504
|
+
Shop Demo
|
|
505
|
+
<ChevronUpDown />
|
|
506
|
+
</Button>
|
|
507
|
+
<ChatTrigger
|
|
508
|
+
ref={toggleRef}
|
|
509
|
+
aria-pressed={asideOpen}
|
|
510
|
+
onClick={handleAssistantToggle}
|
|
511
|
+
data-testid='wally-toggle'
|
|
512
|
+
/>
|
|
513
|
+
<NotificationCenter data-testid='notifications'>
|
|
514
|
+
<NotificationCenterTrigger />
|
|
515
|
+
<NotificationCenterContent>
|
|
516
|
+
<NotificationCenterHeader>
|
|
517
|
+
<NotificationCenterTitle />
|
|
518
|
+
</NotificationCenterHeader>
|
|
519
|
+
<NotificationCenterBody>
|
|
520
|
+
<NotificationCenterEmpty>
|
|
521
|
+
<EmptyStateIllustration>
|
|
522
|
+
<CheckCheck size='lg' />
|
|
523
|
+
</EmptyStateIllustration>
|
|
524
|
+
<EmptyStateMessage>
|
|
525
|
+
<EmptyStateTitle>You're all caught up</EmptyStateTitle>
|
|
526
|
+
<EmptyStateDescription>No new notifications.</EmptyStateDescription>
|
|
527
|
+
</EmptyStateMessage>
|
|
528
|
+
</NotificationCenterEmpty>
|
|
529
|
+
</NotificationCenterBody>
|
|
530
|
+
</NotificationCenterContent>
|
|
531
|
+
</NotificationCenter>
|
|
532
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='Help'>
|
|
533
|
+
<CircleHelp />
|
|
534
|
+
</Button>
|
|
535
|
+
</TopHeaderActions>
|
|
536
|
+
</TopHeader>
|
|
537
|
+
</AppShellHeader>
|
|
538
|
+
|
|
539
|
+
<AppShellRail>
|
|
540
|
+
<NavRail mode='collapsed'>
|
|
541
|
+
<NavRailBody>
|
|
542
|
+
<NavRailItem href='/' icon={Home} label='Home' onClick={handleNavClick} />
|
|
543
|
+
<NavRailItem
|
|
544
|
+
href='/assistant'
|
|
545
|
+
icon={MessageSquare}
|
|
546
|
+
label='Ask Wally'
|
|
547
|
+
onClick={handleNavClick}
|
|
548
|
+
/>
|
|
549
|
+
<NavRailSeparator />
|
|
550
|
+
<NavRailItem href='/edge' icon={Cloud} label='Edge' active onClick={handleNavClick} />
|
|
551
|
+
<NavRailItem
|
|
552
|
+
href='/security-testing'
|
|
553
|
+
icon={FlaskConical}
|
|
554
|
+
label='Security Testing'
|
|
555
|
+
onClick={handleNavClick}
|
|
556
|
+
/>
|
|
557
|
+
</NavRailBody>
|
|
558
|
+
<NavRailFooter>
|
|
559
|
+
<NavRailItem
|
|
560
|
+
href='/settings'
|
|
561
|
+
icon={Settings}
|
|
562
|
+
label='Settings'
|
|
563
|
+
onClick={handleNavClick}
|
|
564
|
+
/>
|
|
565
|
+
<DropdownMenu positioning={{ placement: 'right-end', gutter: 6 }}>
|
|
566
|
+
<DropdownMenuTrigger>
|
|
567
|
+
<NavRailItem icon={UserRound} label='Alex Morgan' avatar />
|
|
568
|
+
</DropdownMenuTrigger>
|
|
569
|
+
<DropdownMenuContent className='w-200'>
|
|
570
|
+
<DropdownMenuItem onSelect={onSignOut}>
|
|
571
|
+
<DropdownMenuItemIcon>
|
|
572
|
+
<LogOut />
|
|
573
|
+
</DropdownMenuItemIcon>
|
|
574
|
+
<DropdownMenuItemText>Sign out</DropdownMenuItemText>
|
|
575
|
+
</DropdownMenuItem>
|
|
576
|
+
</DropdownMenuContent>
|
|
577
|
+
</DropdownMenu>
|
|
578
|
+
</NavRailFooter>
|
|
579
|
+
</NavRail>
|
|
580
|
+
</AppShellRail>
|
|
581
|
+
|
|
582
|
+
<AppShellRemote role='main'>
|
|
583
|
+
<RemoteShell
|
|
584
|
+
config={EDGE_NAV}
|
|
585
|
+
basePath='/edge'
|
|
586
|
+
pathname={pathname}
|
|
587
|
+
onNavigate={handleNavigate}
|
|
588
|
+
>
|
|
589
|
+
<RemoteShellBreadcrumb />
|
|
590
|
+
<RemoteShellContent>
|
|
591
|
+
<Page name='edge-attacks' fullSize fixedHeight data-testid='attacks-page'>
|
|
592
|
+
<PageHeader>
|
|
593
|
+
<PageHeaderGroup className='flex-1'>
|
|
594
|
+
<PageTitle>Attacks</PageTitle>
|
|
595
|
+
<PageDescription>
|
|
596
|
+
Malicious requests detected on api.shop-demo.io, grouped by attack and source.
|
|
597
|
+
</PageDescription>
|
|
598
|
+
</PageHeaderGroup>
|
|
599
|
+
</PageHeader>
|
|
600
|
+
|
|
601
|
+
<PageToolbar>
|
|
602
|
+
<SearchInput
|
|
603
|
+
value={query}
|
|
604
|
+
onChange={setQuery}
|
|
605
|
+
placeholder='Search attack, endpoint or IP'
|
|
606
|
+
className='w-[320px]'
|
|
607
|
+
data-testid='attacks-search'
|
|
608
|
+
/>
|
|
609
|
+
<SegmentedTabs value={status} onChange={setStatus}>
|
|
610
|
+
<SegmentedTabsList>
|
|
611
|
+
<SegmentedTabsTrigger value='all'>
|
|
612
|
+
All <NumericBadge>{counts.all}</NumericBadge>
|
|
613
|
+
</SegmentedTabsTrigger>
|
|
614
|
+
<SegmentedTabsTrigger value='blocked'>
|
|
615
|
+
Blocked <NumericBadge>{counts.blocked}</NumericBadge>
|
|
616
|
+
</SegmentedTabsTrigger>
|
|
617
|
+
<SegmentedTabsTrigger value='monitored'>
|
|
618
|
+
Monitored <NumericBadge>{counts.monitored}</NumericBadge>
|
|
619
|
+
</SegmentedTabsTrigger>
|
|
620
|
+
</SegmentedTabsList>
|
|
621
|
+
</SegmentedTabs>
|
|
622
|
+
</PageToolbar>
|
|
623
|
+
|
|
624
|
+
<PageContent>
|
|
625
|
+
<Table
|
|
626
|
+
aria-label='Attacks'
|
|
627
|
+
data={rows}
|
|
628
|
+
columns={columns}
|
|
629
|
+
getRowId={getAttackId}
|
|
630
|
+
activeRowId={contextId}
|
|
631
|
+
data-testid='attacks-table'
|
|
632
|
+
>
|
|
633
|
+
<TableEmptyState>
|
|
634
|
+
<EmptyState type='collection-empty'>
|
|
635
|
+
<EmptyStateIllustration>
|
|
636
|
+
<SearchX />
|
|
637
|
+
</EmptyStateIllustration>
|
|
638
|
+
<EmptyStateMessage>
|
|
639
|
+
<EmptyStateTitle>No results found</EmptyStateTitle>
|
|
640
|
+
<EmptyStateDescription>
|
|
641
|
+
No attacks match your search or status.
|
|
642
|
+
</EmptyStateDescription>
|
|
643
|
+
</EmptyStateMessage>
|
|
644
|
+
<EmptyStateActions>
|
|
645
|
+
<Button
|
|
646
|
+
size='medium'
|
|
647
|
+
variant='outline'
|
|
648
|
+
color='neutral'
|
|
649
|
+
onClick={handleReset}
|
|
650
|
+
>
|
|
651
|
+
<FilterX />
|
|
652
|
+
Reset filters
|
|
653
|
+
</Button>
|
|
654
|
+
</EmptyStateActions>
|
|
655
|
+
</EmptyState>
|
|
656
|
+
</TableEmptyState>
|
|
657
|
+
</Table>
|
|
658
|
+
</PageContent>
|
|
659
|
+
</Page>
|
|
660
|
+
</RemoteShellContent>
|
|
661
|
+
</RemoteShell>
|
|
662
|
+
</AppShellRemote>
|
|
663
|
+
|
|
664
|
+
<AppShellAside open={asideOpen} aria-label='Wally'>
|
|
665
|
+
<Chat className='min-h-0 flex-1' data-testid='wally-chat'>
|
|
666
|
+
<ChatHeader>
|
|
667
|
+
<ChatHeaderTitle />
|
|
668
|
+
<ChatHeaderActions>
|
|
669
|
+
<Button
|
|
670
|
+
variant='ghost'
|
|
671
|
+
color='neutral'
|
|
672
|
+
size='small'
|
|
673
|
+
aria-label='New chat'
|
|
674
|
+
onClick={onNewChat}
|
|
675
|
+
>
|
|
676
|
+
<Plus />
|
|
677
|
+
</Button>
|
|
678
|
+
<Button
|
|
679
|
+
variant='ghost'
|
|
680
|
+
color='neutral'
|
|
681
|
+
size='small'
|
|
682
|
+
aria-label='Chat history'
|
|
683
|
+
onClick={onOpenHistory}
|
|
684
|
+
>
|
|
685
|
+
<History />
|
|
686
|
+
</Button>
|
|
687
|
+
<Separator orientation='vertical' />
|
|
688
|
+
<Button
|
|
689
|
+
variant='ghost'
|
|
690
|
+
color='neutral'
|
|
691
|
+
size='small'
|
|
692
|
+
aria-label='Close chat'
|
|
693
|
+
onClick={handleCloseChat}
|
|
694
|
+
data-testid='wally-close'
|
|
695
|
+
>
|
|
696
|
+
<X />
|
|
697
|
+
</Button>
|
|
698
|
+
</ChatHeaderActions>
|
|
699
|
+
</ChatHeader>
|
|
700
|
+
|
|
701
|
+
<Conversation autoScrollKey='q-1'>
|
|
702
|
+
<ConversationContent>
|
|
703
|
+
<UserMessage>
|
|
704
|
+
<UserMessageBubble>{DOCKED_QUESTION}</UserMessageBubble>
|
|
705
|
+
<MessageActions>
|
|
706
|
+
<MessageTimestamp dateTime='2026-11-06T14:05:00Z'>14:05</MessageTimestamp>
|
|
707
|
+
</MessageActions>
|
|
708
|
+
</UserMessage>
|
|
709
|
+
<AssistantMessage>
|
|
710
|
+
<ChainOfThought>
|
|
711
|
+
<ChainOfThoughtStep
|
|
712
|
+
icon={<Search />}
|
|
713
|
+
label='Searched attacks on /api/v2/auth/login'
|
|
714
|
+
metric='16,279'
|
|
715
|
+
/>
|
|
716
|
+
<ChainOfThoughtStep icon={<Globe />} label='Checked IP reputation' />
|
|
717
|
+
</ChainOfThought>
|
|
718
|
+
<AssistantMessageContent>
|
|
719
|
+
<AssistantMessageMarkdown text={DOCKED_ANSWER} />
|
|
720
|
+
</AssistantMessageContent>
|
|
721
|
+
<MessageActions visible>
|
|
722
|
+
<Copyable text={DOCKED_ANSWER}>
|
|
723
|
+
<MessageAction aria-label='Copy'>
|
|
724
|
+
<CopyableIcon />
|
|
725
|
+
</MessageAction>
|
|
726
|
+
</Copyable>
|
|
727
|
+
<MessageAction aria-label='Good response'>
|
|
728
|
+
<ThumbsUp />
|
|
729
|
+
</MessageAction>
|
|
730
|
+
<MessageAction aria-label='Bad response'>
|
|
731
|
+
<ThumbsDown />
|
|
732
|
+
</MessageAction>
|
|
733
|
+
<MessageTimestamp dateTime='2026-11-06T14:05:00Z'>14:05</MessageTimestamp>
|
|
734
|
+
</MessageActions>
|
|
735
|
+
</AssistantMessage>
|
|
736
|
+
</ConversationContent>
|
|
737
|
+
<ConversationScrollButton />
|
|
738
|
+
</Conversation>
|
|
739
|
+
|
|
740
|
+
<ChatFooter>
|
|
741
|
+
<ChatSuggestions label='Suggestions'>
|
|
742
|
+
{DOCKED_FOLLOW_UPS.map(text => (
|
|
743
|
+
<ChatSuggestion key={text} value={text} onClick={handleSuggestionClick}>
|
|
744
|
+
{text}
|
|
745
|
+
</ChatSuggestion>
|
|
746
|
+
))}
|
|
747
|
+
</ChatSuggestions>
|
|
748
|
+
<ChatInput
|
|
749
|
+
value={value}
|
|
750
|
+
onValueChange={setValue}
|
|
751
|
+
onSubmit={handleSubmit}
|
|
752
|
+
data-testid='wally-input'
|
|
753
|
+
context={
|
|
754
|
+
contextAttack && (
|
|
755
|
+
<Badge type='secondary' color='blue' data-testid='wally-context'>
|
|
756
|
+
<Quote />
|
|
757
|
+
{contextAttack.type} · {contextAttack.sourceIp}
|
|
758
|
+
<TagClose
|
|
759
|
+
aria-label={`Remove ${contextAttack.type} from context`}
|
|
760
|
+
className='rounded-4 focus-visible:ring-3 focus-visible:ring-focus-primary'
|
|
761
|
+
onClick={handleContextRemove}
|
|
762
|
+
/>
|
|
763
|
+
</Badge>
|
|
764
|
+
)
|
|
765
|
+
}
|
|
766
|
+
>
|
|
767
|
+
<ChatInputTextarea />
|
|
768
|
+
<ChatInputSubmit />
|
|
769
|
+
</ChatInput>
|
|
770
|
+
</ChatFooter>
|
|
771
|
+
</Chat>
|
|
772
|
+
</AppShellAside>
|
|
773
|
+
</AppShell>
|
|
774
|
+
);
|
|
775
|
+
};
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
A reply in flight: the running step, a streaming answer and Stop.
|
|
779
|
+
|
|
780
|
+
A reply in flight. The finished steps stay, the current one shimmers, and the summary streams
|
|
781
|
+
in through `AssistantMessageMarkdown streaming`. `aria-busy` marks the log and the message,
|
|
782
|
+
and the submit turns into Stop; Stop (or Esc in the textarea) ends the run.
|
|
783
|
+
|
|
784
|
+
```tsx story=Streaming
|
|
785
|
+
import { type MouseEvent, useState } from 'react';
|
|
786
|
+
import { AppShell, AppShellHeader, AppShellRail, AppShellRemote } from '@wallarm-org/design-system/AppShell';
|
|
787
|
+
import { AssistantMessage, AssistantMessageContent, AssistantMessageMarkdown } from '@wallarm-org/design-system/AssistantMessage';
|
|
788
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
789
|
+
import { ChainOfThought, ChainOfThoughtStep } from '@wallarm-org/design-system/ChainOfThought';
|
|
790
|
+
import { Chat, ChatFooter, ChatHeader, ChatHeaderActions, ChatHeaderTitle } from '@wallarm-org/design-system/Chat';
|
|
791
|
+
import { ChatInput, ChatInputSubmit, ChatInputTextarea } from '@wallarm-org/design-system/ChatInput';
|
|
792
|
+
import { Conversation, ConversationContent, ConversationScrollButton } from '@wallarm-org/design-system/Conversation';
|
|
793
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
794
|
+
import { Brain, ChevronUpDown, CircleHelp, Cloud, Database, FlaskConical, History, Home, LogOut, MessageSquare, Plus, Search, Settings, UserRound } from '@wallarm-org/design-system/icons';
|
|
795
|
+
import { Logo } from '@wallarm-org/design-system/Logo';
|
|
796
|
+
import { MessageActions, MessageTimestamp } from '@wallarm-org/design-system/MessageActions';
|
|
797
|
+
import { NavRail, NavRailBody, NavRailFooter, NavRailItem, NavRailSeparator } from '@wallarm-org/design-system/NavRail';
|
|
798
|
+
import { NotificationCenter, NotificationCenterTrigger } from '@wallarm-org/design-system/NotificationCenter';
|
|
799
|
+
import { TopHeader, TopHeaderActions, TopHeaderLogo, TopHeaderSeparator } from '@wallarm-org/design-system/TopHeader';
|
|
800
|
+
import { UserMessage, UserMessageBubble } from '@wallarm-org/design-system/UserMessage';
|
|
801
|
+
|
|
802
|
+
export const Streaming = () => {
|
|
803
|
+
const [value, setValue] = useState('');
|
|
804
|
+
const [isRunning, setIsRunning] = useState(true);
|
|
805
|
+
|
|
806
|
+
const handleNavClick = (event: MouseEvent<HTMLAnchorElement>) => {
|
|
807
|
+
event.preventDefault();
|
|
808
|
+
onNavigate(event.currentTarget.getAttribute('href'));
|
|
809
|
+
};
|
|
810
|
+
const handleSubmit = () => setValue('');
|
|
811
|
+
const handleStop = () => setIsRunning(false);
|
|
812
|
+
|
|
813
|
+
return (
|
|
814
|
+
<AppShell data-testid='app-shell'>
|
|
815
|
+
<AppShellHeader>
|
|
816
|
+
<TopHeader>
|
|
817
|
+
<TopHeaderLogo href='/' onClick={handleNavClick}>
|
|
818
|
+
<Logo size='md' />
|
|
819
|
+
</TopHeaderLogo>
|
|
820
|
+
<TopHeaderActions>
|
|
821
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='Search'>
|
|
822
|
+
<Search />
|
|
823
|
+
</Button>
|
|
824
|
+
<TopHeaderSeparator />
|
|
825
|
+
<Button variant='ghost' color='neutral' size='small'>
|
|
826
|
+
Shop Demo
|
|
827
|
+
<ChevronUpDown />
|
|
828
|
+
</Button>
|
|
829
|
+
<NotificationCenter>
|
|
830
|
+
<NotificationCenterTrigger />
|
|
831
|
+
</NotificationCenter>
|
|
832
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='Help'>
|
|
833
|
+
<CircleHelp />
|
|
834
|
+
</Button>
|
|
835
|
+
</TopHeaderActions>
|
|
836
|
+
</TopHeader>
|
|
837
|
+
</AppShellHeader>
|
|
838
|
+
|
|
839
|
+
<AppShellRail>
|
|
840
|
+
<NavRail mode='collapsed'>
|
|
841
|
+
<NavRailBody>
|
|
842
|
+
<NavRailItem href='/' icon={Home} label='Home' onClick={handleNavClick} />
|
|
843
|
+
<NavRailItem
|
|
844
|
+
href='/assistant'
|
|
845
|
+
icon={MessageSquare}
|
|
846
|
+
label='Ask Wally'
|
|
847
|
+
active
|
|
848
|
+
onClick={handleNavClick}
|
|
849
|
+
/>
|
|
850
|
+
<NavRailSeparator />
|
|
851
|
+
<NavRailItem href='/edge' icon={Cloud} label='Edge' onClick={handleNavClick} />
|
|
852
|
+
<NavRailItem
|
|
853
|
+
href='/security-testing'
|
|
854
|
+
icon={FlaskConical}
|
|
855
|
+
label='Security Testing'
|
|
856
|
+
onClick={handleNavClick}
|
|
857
|
+
/>
|
|
858
|
+
</NavRailBody>
|
|
859
|
+
<NavRailFooter>
|
|
860
|
+
<NavRailItem
|
|
861
|
+
href='/settings'
|
|
862
|
+
icon={Settings}
|
|
863
|
+
label='Settings'
|
|
864
|
+
onClick={handleNavClick}
|
|
865
|
+
/>
|
|
866
|
+
<DropdownMenu positioning={{ placement: 'right-end', gutter: 6 }}>
|
|
867
|
+
<DropdownMenuTrigger>
|
|
868
|
+
<NavRailItem icon={UserRound} label='Alex Morgan' avatar />
|
|
869
|
+
</DropdownMenuTrigger>
|
|
870
|
+
<DropdownMenuContent className='w-200'>
|
|
871
|
+
<DropdownMenuItem onSelect={onSignOut}>
|
|
872
|
+
<DropdownMenuItemIcon>
|
|
873
|
+
<LogOut />
|
|
874
|
+
</DropdownMenuItemIcon>
|
|
875
|
+
<DropdownMenuItemText>Sign out</DropdownMenuItemText>
|
|
876
|
+
</DropdownMenuItem>
|
|
877
|
+
</DropdownMenuContent>
|
|
878
|
+
</DropdownMenu>
|
|
879
|
+
</NavRailFooter>
|
|
880
|
+
</NavRail>
|
|
881
|
+
</AppShellRail>
|
|
882
|
+
|
|
883
|
+
<AppShellRemote role='main'>
|
|
884
|
+
<Chat data-testid='wally-chat'>
|
|
885
|
+
<ChatHeader>
|
|
886
|
+
<ChatHeaderTitle />
|
|
887
|
+
<ChatHeaderActions>
|
|
888
|
+
<Button
|
|
889
|
+
variant='ghost'
|
|
890
|
+
color='neutral'
|
|
891
|
+
size='small'
|
|
892
|
+
aria-label='New chat'
|
|
893
|
+
onClick={onNewChat}
|
|
894
|
+
>
|
|
895
|
+
<Plus />
|
|
896
|
+
</Button>
|
|
897
|
+
<Button
|
|
898
|
+
variant='ghost'
|
|
899
|
+
color='neutral'
|
|
900
|
+
size='small'
|
|
901
|
+
aria-label='Chat history'
|
|
902
|
+
onClick={onOpenHistory}
|
|
903
|
+
>
|
|
904
|
+
<History />
|
|
905
|
+
</Button>
|
|
906
|
+
</ChatHeaderActions>
|
|
907
|
+
</ChatHeader>
|
|
908
|
+
|
|
909
|
+
<Conversation autoScrollKey='q-1'>
|
|
910
|
+
<ConversationContent aria-busy={isRunning} contentClassName='mx-auto w-full max-w-768'>
|
|
911
|
+
<UserMessage>
|
|
912
|
+
<UserMessageBubble>{QUESTION}</UserMessageBubble>
|
|
913
|
+
<MessageActions>
|
|
914
|
+
<MessageTimestamp dateTime='2026-11-06T14:02:00Z'>14:02</MessageTimestamp>
|
|
915
|
+
</MessageActions>
|
|
916
|
+
</UserMessage>
|
|
917
|
+
<AssistantMessage data-testid='wally-answer' aria-busy={isRunning}>
|
|
918
|
+
<ChainOfThought>
|
|
919
|
+
<ChainOfThoughtStep icon={<Brain />} label='Thought for 4s' />
|
|
920
|
+
<ChainOfThoughtStep
|
|
921
|
+
icon={<Search />}
|
|
922
|
+
label='Searched attacks on api.shop-demo.io'
|
|
923
|
+
metric='18,420'
|
|
924
|
+
/>
|
|
925
|
+
<ChainOfThoughtStep
|
|
926
|
+
icon={<Database />}
|
|
927
|
+
label={isRunning ? 'Grouping by source network...' : 'Stopped'}
|
|
928
|
+
status={isRunning ? 'running' : 'done'}
|
|
929
|
+
data-testid='wally-current-step'
|
|
930
|
+
/>
|
|
931
|
+
</ChainOfThought>
|
|
932
|
+
<AssistantMessageContent>
|
|
933
|
+
<AssistantMessageMarkdown text={STREAMING_SUMMARY} streaming={isRunning} />
|
|
934
|
+
</AssistantMessageContent>
|
|
935
|
+
</AssistantMessage>
|
|
936
|
+
</ConversationContent>
|
|
937
|
+
<ConversationScrollButton />
|
|
938
|
+
</Conversation>
|
|
939
|
+
|
|
940
|
+
<ChatFooter className='mx-auto w-full max-w-800'>
|
|
941
|
+
<ChatInput
|
|
942
|
+
value={value}
|
|
943
|
+
onValueChange={setValue}
|
|
944
|
+
onSubmit={handleSubmit}
|
|
945
|
+
isRunning={isRunning}
|
|
946
|
+
onStop={handleStop}
|
|
947
|
+
>
|
|
948
|
+
<ChatInputTextarea />
|
|
949
|
+
<ChatInputSubmit data-testid='wally-submit' />
|
|
950
|
+
</ChatInput>
|
|
951
|
+
</ChatFooter>
|
|
952
|
+
</Chat>
|
|
953
|
+
</AppShellRemote>
|
|
954
|
+
</AppShell>
|
|
955
|
+
);
|
|
956
|
+
};
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
The landing state before the first message, with suggested prompts.
|
|
960
|
+
|
|
961
|
+
The landing state before the first message: Wally greets over the `strong` background with
|
|
962
|
+
suggested prompts. A prompt fills the composer, where the tool permissions sit before Send.
|
|
963
|
+
|
|
964
|
+
```tsx story=Empty
|
|
965
|
+
import { type MouseEvent, useState } from 'react';
|
|
966
|
+
import { AppShell, AppShellHeader, AppShellRail, AppShellRemote } from '@wallarm-org/design-system/AppShell';
|
|
967
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
968
|
+
import { Chat, ChatFooter, ChatHeader, ChatHeaderActions, ChatHeaderTitle, ChatSuggestion, ChatSuggestions } from '@wallarm-org/design-system/Chat';
|
|
969
|
+
import { ChatInput, ChatInputSubmit, ChatInputTextarea } from '@wallarm-org/design-system/ChatInput';
|
|
970
|
+
import { ChatPermissions, ChatPermissionsContent, ChatPermissionsItem, type ChatPermissionsItemCheckedChangeDetails, ChatPermissionsTrigger } from '@wallarm-org/design-system/ChatPermissions';
|
|
971
|
+
import { Conversation, ConversationContent, ConversationEmptyState } from '@wallarm-org/design-system/Conversation';
|
|
972
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemText, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
973
|
+
import { ChevronUpDown, CircleHelp, Cloud, FlaskConical, History, Home, LogOut, MessageSquare, Search, Settings, UserRound } from '@wallarm-org/design-system/icons';
|
|
974
|
+
import { Logo } from '@wallarm-org/design-system/Logo';
|
|
975
|
+
import { NavRail, NavRailBody, NavRailFooter, NavRailItem, NavRailSeparator } from '@wallarm-org/design-system/NavRail';
|
|
976
|
+
import { NotificationCenter, NotificationCenterTrigger } from '@wallarm-org/design-system/NotificationCenter';
|
|
977
|
+
import { TopHeader, TopHeaderActions, TopHeaderLogo, TopHeaderSeparator } from '@wallarm-org/design-system/TopHeader';
|
|
978
|
+
|
|
979
|
+
export const Empty = () => {
|
|
980
|
+
const [value, setValue] = useState('');
|
|
981
|
+
const [allowed, setAllowed] = useState(TOOL_DEFAULTS);
|
|
982
|
+
|
|
983
|
+
const handleNavClick = (event: MouseEvent<HTMLAnchorElement>) => {
|
|
984
|
+
event.preventDefault();
|
|
985
|
+
onNavigate(event.currentTarget.getAttribute('href'));
|
|
986
|
+
};
|
|
987
|
+
const handlePromptClick = (event: MouseEvent<HTMLButtonElement>) =>
|
|
988
|
+
setValue(event.currentTarget.value);
|
|
989
|
+
const handleSubmit = () => setValue('');
|
|
990
|
+
const handlePermissionChange = ({ checked, name }: ChatPermissionsItemCheckedChangeDetails) =>
|
|
991
|
+
setAllowed(previous => ({ ...previous, [name]: checked }));
|
|
992
|
+
|
|
993
|
+
return (
|
|
994
|
+
<AppShell data-testid='app-shell'>
|
|
995
|
+
<AppShellHeader>
|
|
996
|
+
<TopHeader>
|
|
997
|
+
<TopHeaderLogo href='/' onClick={handleNavClick}>
|
|
998
|
+
<Logo size='md' />
|
|
999
|
+
</TopHeaderLogo>
|
|
1000
|
+
<TopHeaderActions>
|
|
1001
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='Search'>
|
|
1002
|
+
<Search />
|
|
1003
|
+
</Button>
|
|
1004
|
+
<TopHeaderSeparator />
|
|
1005
|
+
<Button variant='ghost' color='neutral' size='small'>
|
|
1006
|
+
Shop Demo
|
|
1007
|
+
<ChevronUpDown />
|
|
1008
|
+
</Button>
|
|
1009
|
+
<NotificationCenter>
|
|
1010
|
+
<NotificationCenterTrigger />
|
|
1011
|
+
</NotificationCenter>
|
|
1012
|
+
<Button variant='ghost' color='neutral' size='small' aria-label='Help'>
|
|
1013
|
+
<CircleHelp />
|
|
1014
|
+
</Button>
|
|
1015
|
+
</TopHeaderActions>
|
|
1016
|
+
</TopHeader>
|
|
1017
|
+
</AppShellHeader>
|
|
1018
|
+
|
|
1019
|
+
<AppShellRail>
|
|
1020
|
+
<NavRail mode='collapsed'>
|
|
1021
|
+
<NavRailBody>
|
|
1022
|
+
<NavRailItem href='/' icon={Home} label='Home' onClick={handleNavClick} />
|
|
1023
|
+
<NavRailItem
|
|
1024
|
+
href='/assistant'
|
|
1025
|
+
icon={MessageSquare}
|
|
1026
|
+
label='Ask Wally'
|
|
1027
|
+
active
|
|
1028
|
+
onClick={handleNavClick}
|
|
1029
|
+
/>
|
|
1030
|
+
<NavRailSeparator />
|
|
1031
|
+
<NavRailItem href='/edge' icon={Cloud} label='Edge' onClick={handleNavClick} />
|
|
1032
|
+
<NavRailItem
|
|
1033
|
+
href='/security-testing'
|
|
1034
|
+
icon={FlaskConical}
|
|
1035
|
+
label='Security Testing'
|
|
1036
|
+
onClick={handleNavClick}
|
|
1037
|
+
/>
|
|
1038
|
+
</NavRailBody>
|
|
1039
|
+
<NavRailFooter>
|
|
1040
|
+
<NavRailItem
|
|
1041
|
+
href='/settings'
|
|
1042
|
+
icon={Settings}
|
|
1043
|
+
label='Settings'
|
|
1044
|
+
onClick={handleNavClick}
|
|
1045
|
+
/>
|
|
1046
|
+
<DropdownMenu positioning={{ placement: 'right-end', gutter: 6 }}>
|
|
1047
|
+
<DropdownMenuTrigger>
|
|
1048
|
+
<NavRailItem icon={UserRound} label='Alex Morgan' avatar />
|
|
1049
|
+
</DropdownMenuTrigger>
|
|
1050
|
+
<DropdownMenuContent className='w-200'>
|
|
1051
|
+
<DropdownMenuItem onSelect={onSignOut}>
|
|
1052
|
+
<DropdownMenuItemIcon>
|
|
1053
|
+
<LogOut />
|
|
1054
|
+
</DropdownMenuItemIcon>
|
|
1055
|
+
<DropdownMenuItemText>Sign out</DropdownMenuItemText>
|
|
1056
|
+
</DropdownMenuItem>
|
|
1057
|
+
</DropdownMenuContent>
|
|
1058
|
+
</DropdownMenu>
|
|
1059
|
+
</NavRailFooter>
|
|
1060
|
+
</NavRail>
|
|
1061
|
+
</AppShellRail>
|
|
1062
|
+
|
|
1063
|
+
<AppShellRemote role='main'>
|
|
1064
|
+
<Chat background='strong' data-testid='wally-chat'>
|
|
1065
|
+
<ChatHeader>
|
|
1066
|
+
<ChatHeaderTitle />
|
|
1067
|
+
<ChatHeaderActions>
|
|
1068
|
+
<Button
|
|
1069
|
+
variant='ghost'
|
|
1070
|
+
color='neutral'
|
|
1071
|
+
size='small'
|
|
1072
|
+
aria-label='Chat history'
|
|
1073
|
+
onClick={onOpenHistory}
|
|
1074
|
+
>
|
|
1075
|
+
<History />
|
|
1076
|
+
</Button>
|
|
1077
|
+
</ChatHeaderActions>
|
|
1078
|
+
</ChatHeader>
|
|
1079
|
+
|
|
1080
|
+
<Conversation>
|
|
1081
|
+
<ConversationContent contentClassName='mx-auto w-full max-w-768'>
|
|
1082
|
+
<ConversationEmptyState title='What should we look into today?'>
|
|
1083
|
+
<ChatSuggestions placement='greeting' label='Suggestions'>
|
|
1084
|
+
{LANDING_PROMPTS.map((text, index) => (
|
|
1085
|
+
<ChatSuggestion
|
|
1086
|
+
key={text}
|
|
1087
|
+
value={text}
|
|
1088
|
+
onClick={handlePromptClick}
|
|
1089
|
+
data-testid={`wally-prompt-${index}`}
|
|
1090
|
+
>
|
|
1091
|
+
{text}
|
|
1092
|
+
</ChatSuggestion>
|
|
1093
|
+
))}
|
|
1094
|
+
</ChatSuggestions>
|
|
1095
|
+
</ConversationEmptyState>
|
|
1096
|
+
</ConversationContent>
|
|
1097
|
+
</Conversation>
|
|
1098
|
+
|
|
1099
|
+
<ChatFooter className='mx-auto w-full max-w-800'>
|
|
1100
|
+
<ChatInput value={value} onValueChange={setValue} onSubmit={handleSubmit}>
|
|
1101
|
+
<ChatInputTextarea data-testid='wally-textarea' />
|
|
1102
|
+
<ChatPermissions>
|
|
1103
|
+
<ChatPermissionsTrigger />
|
|
1104
|
+
<ChatPermissionsContent>
|
|
1105
|
+
{TOOLS.map(tool => (
|
|
1106
|
+
<ChatPermissionsItem
|
|
1107
|
+
key={tool.name}
|
|
1108
|
+
name={tool.name}
|
|
1109
|
+
title={tool.name}
|
|
1110
|
+
description={tool.description}
|
|
1111
|
+
checked={allowed[tool.name]}
|
|
1112
|
+
onCheckedChange={handlePermissionChange}
|
|
1113
|
+
/>
|
|
1114
|
+
))}
|
|
1115
|
+
</ChatPermissionsContent>
|
|
1116
|
+
</ChatPermissions>
|
|
1117
|
+
<ChatInputSubmit />
|
|
1118
|
+
</ChatInput>
|
|
1119
|
+
</ChatFooter>
|
|
1120
|
+
</Chat>
|
|
1121
|
+
</AppShellRemote>
|
|
1122
|
+
</AppShell>
|
|
1123
|
+
);
|
|
1124
|
+
};
|
|
1125
|
+
```
|
|
1126
|
+
|
|
1127
|
+
## Related
|
|
1128
|
+
|
|
1129
|
+
- [Application layout](../patterns/app-layout.md)
|
|
1130
|
+
- [Resource list page](../patterns/resource-list-page.md)
|
|
1131
|
+
- [Entity table](../patterns/entity-table.md)
|
|
1132
|
+
- [Filtering](../patterns/filtering.md)
|
|
1133
|
+
- [Empty states](../patterns/empty-states.md)
|