Phase 2: Refactor History cluster to use MessageEntry
Replace ad hoc flat props with MessageEntry from core/mcp/types.ts
across the History group components and HistoryScreen.
- HistoryEntry: accept `entry: MessageEntry` instead of flat props
(timestamp, method, target, status, durationMs, parameters, response);
derive method/target/status from embedded JSON-RPC objects; fix
Collapse animation by removing outer {isExpanded && ...} wrapper;
drop childEntries (not part of MessageEntry)
- HistoryControls: type onMethodFilterChange as (string | undefined)
- HistoryListPanel: accept `MessageEntry[]` + `pinnedIds: Set<string>`
instead of separate entries/pinnedEntries arrays with pre-bound
callbacks; pass onReplay/onTogglePin by entry ID
- HistoryScreen: accept `MessageEntry[]` + `pinnedIds` + ID-based
callbacks; collapse two-array model into single list with pinned
overlay
- Delete local HistoryEntryProps data shape, HistoryChildEntry type
- Update all stories with real JSON-RPC MessageEntry fixtures
- Update ConnectedView HistoryActive story
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0db955ea7e
commit
f104e6e21a
2 changed files with 479 additions and 380 deletions
|
|
@ -5,12 +5,6 @@ import { HistoryControls } from "./HistoryControls";
|
|||
const meta: Meta<typeof HistoryControls> = {
|
||||
title: "Groups/HistoryControls",
|
||||
component: HistoryControls,
|
||||
};
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof HistoryControls>;
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
searchText: "",
|
||||
onSearchChange: fn(),
|
||||
|
|
@ -18,11 +12,14 @@ export const Default: Story = {
|
|||
},
|
||||
};
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof HistoryControls>;
|
||||
|
||||
export const Default: Story = {};
|
||||
|
||||
export const WithFilters: Story = {
|
||||
args: {
|
||||
searchText: "tools",
|
||||
methodFilter: "tools/call",
|
||||
onSearchChange: fn(),
|
||||
onMethodFilterChange: fn(),
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export interface HistoryControlsProps {
|
|||
searchText: string;
|
||||
methodFilter?: string;
|
||||
onSearchChange: (text: string) => void;
|
||||
onMethodFilterChange: (method: string) => void;
|
||||
onMethodFilterChange: (method: string | undefined) => void;
|
||||
}
|
||||
|
||||
export function HistoryControls({
|
||||
|
|
@ -38,7 +38,7 @@ export function HistoryControls({
|
|||
placeholder="All methods"
|
||||
data={METHOD_OPTIONS}
|
||||
value={methodFilter ?? null}
|
||||
onChange={(value) => onMethodFilterChange(value ?? "")}
|
||||
onChange={(value) => onMethodFilterChange(value ?? undefined)}
|
||||
clearable
|
||||
/>
|
||||
</Stack>
|
||||
|
|
|
|||
Loading…
Reference in a new issue