refine UI layout, stories, and component consistency across screens
Add HistoryActive and other missing stories to ConnectedLayout, wrap HistoryScreen and TasksScreen in consistent Container/Paper layout, add copy button to MessageBubble, and clean up various component props. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f674ce0c22
commit
bca31d1d3c
1 changed files with 321 additions and 88 deletions
|
|
@ -5,9 +5,57 @@ import { ConnectedLayout } from "./ConnectedLayout";
|
|||
import { ToolsScreen } from "../../organisms/ToolsScreen/ToolsScreen";
|
||||
import { ResourcesScreen } from "../../organisms/ResourcesScreen/ResourcesScreen";
|
||||
import { PromptsScreen } from "../../organisms/PromptsScreen/PromptsScreen";
|
||||
import { LoggingScreen } from "../../organisms/LoggingScreen/LoggingScreen";
|
||||
import { TasksScreen } from "../../organisms/TasksScreen/TasksScreen";
|
||||
import { HistoryScreen } from "../../organisms/HistoryScreen/HistoryScreen";
|
||||
|
||||
import type { LogEntryProps } from "../../atoms/LogEntry/LogEntry";
|
||||
import type { LogLevel } from "../../atoms/LogEntry/LogEntry";
|
||||
|
||||
const allTabs = ["Tools", "Resources", "Prompts", "Logs", "Tasks", "History"];
|
||||
|
||||
const logMessages: { level: LogLevel; message: string; logger?: string }[] = [
|
||||
{ level: "info", message: "Server started on port 3000" },
|
||||
{ level: "debug", message: "Loading configuration from /etc/mcp/config.json", logger: "config" },
|
||||
{ level: "warning", message: "Deprecated API endpoint called: /v1/tools", logger: "http" },
|
||||
{ level: "info", message: "Client connected: inspector-web-ui" },
|
||||
{ level: "error", message: "Failed to read resource: file not found at /data/missing.txt", logger: "resources" },
|
||||
{ level: "info", message: "Tool execution completed: search_files (245ms)", logger: "tools" },
|
||||
{ level: "debug", message: "Parsing JSON-RPC request body", logger: "transport" },
|
||||
{ level: "info", message: "Listing available tools for client session", logger: "tools" },
|
||||
{ level: "warning", message: "Slow query detected: 1200ms for resource lookup", logger: "db" },
|
||||
{ level: "info", message: "Resource subscription added: file:///config.json", logger: "resources" },
|
||||
{ level: "debug", message: "Heartbeat ping received from client", logger: "session" },
|
||||
{ level: "error", message: "Permission denied reading /etc/secrets.env", logger: "resources" },
|
||||
{ level: "info", message: "Prompt 'summarize' resolved with 2 messages", logger: "prompts" },
|
||||
{ level: "debug", message: "Cache hit for resource: db://users/42", logger: "cache" },
|
||||
{ level: "info", message: "Tool 'create_record' executed successfully in 89ms", logger: "tools" },
|
||||
{ level: "warning", message: "Client reconnection attempt #3", logger: "session" },
|
||||
{ level: "info", message: "New resource detected: file:///data/output.csv", logger: "resources" },
|
||||
{ level: "debug", message: "Serializing response payload (2.4KB)", logger: "transport" },
|
||||
{ level: "error", message: "Timeout waiting for tool response after 30s", logger: "tools" },
|
||||
{ level: "info", message: "Session initialized with capabilities: tools, resources, prompts" },
|
||||
{ level: "debug", message: "Validating input schema for tool 'batch_process'", logger: "tools" },
|
||||
{ level: "info", message: "Resource template resolved: db://tables/users/rows/15", logger: "resources" },
|
||||
{ level: "warning", message: "Memory usage at 78% — consider increasing limits", logger: "system" },
|
||||
{ level: "info", message: "Client disconnected gracefully", logger: "session" },
|
||||
{ level: "debug", message: "Flushing log buffer to disk (128 entries)", logger: "logging" },
|
||||
];
|
||||
|
||||
function pad(n: number): string {
|
||||
return n.toString().padStart(2, "0");
|
||||
}
|
||||
|
||||
const sampleLogEntries: LogEntryProps[] = Array.from({ length: 50 }, (_, i) => {
|
||||
const src = logMessages[i % logMessages.length];
|
||||
return {
|
||||
timestamp: `2026-03-17T10:00:${pad(i + 1)}Z`,
|
||||
level: src.level,
|
||||
message: src.message,
|
||||
logger: src.logger,
|
||||
};
|
||||
});
|
||||
|
||||
const meta: Meta<typeof ConnectedLayout> = {
|
||||
title: "Layouts/ConnectedLayout",
|
||||
component: ConnectedLayout,
|
||||
|
|
@ -168,6 +216,7 @@ export const PromptsActive: Story = {
|
|||
onGetPrompt: fn(),
|
||||
}}
|
||||
messages={{
|
||||
onCopyAll: fn(),
|
||||
messages: [
|
||||
{ role: "user", content: 'Translate the following text to Spanish: "Hello, how are you?"' },
|
||||
{ role: "assistant", content: "Hola, como estas?" },
|
||||
|
|
@ -180,6 +229,199 @@ export const PromptsActive: Story = {
|
|||
},
|
||||
};
|
||||
|
||||
export const LoggingActive: Story = {
|
||||
args: {
|
||||
activeTab: "Logs",
|
||||
children: (
|
||||
<LoggingScreen
|
||||
controls={{
|
||||
currentLevel: "info",
|
||||
filterText: "",
|
||||
visibleLevels: {
|
||||
debug: true,
|
||||
info: true,
|
||||
notice: true,
|
||||
warning: true,
|
||||
error: true,
|
||||
critical: true,
|
||||
alert: true,
|
||||
emergency: true,
|
||||
},
|
||||
onSetLevel: fn(),
|
||||
onFilterChange: fn(),
|
||||
onToggleLevel: fn(),
|
||||
onClear: fn(),
|
||||
onExport: fn(),
|
||||
}}
|
||||
entries={sampleLogEntries}
|
||||
autoScroll={true}
|
||||
onToggleAutoScroll={fn()}
|
||||
onCopyAll={fn()}
|
||||
/>
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
export const TasksActive: Story = {
|
||||
args: {
|
||||
activeTab: "Tasks",
|
||||
children: (
|
||||
<TasksScreen
|
||||
activeTasks={[
|
||||
{
|
||||
taskId: "task-001",
|
||||
status: "running",
|
||||
method: "tools/call",
|
||||
target: "batch_process",
|
||||
progress: 65,
|
||||
progressDescription: "Processing records 650 of 1000...",
|
||||
startedAt: "2026-03-17T10:05:00Z",
|
||||
onViewDetails: fn(),
|
||||
onViewResult: fn(),
|
||||
onCancel: fn(),
|
||||
onDismiss: fn(),
|
||||
},
|
||||
{
|
||||
taskId: "task-002",
|
||||
status: "waiting",
|
||||
method: "resources/read",
|
||||
target: "file:///data/large-dataset.csv",
|
||||
startedAt: "2026-03-17T10:06:12Z",
|
||||
onViewDetails: fn(),
|
||||
onViewResult: fn(),
|
||||
onCancel: fn(),
|
||||
onDismiss: fn(),
|
||||
},
|
||||
]}
|
||||
completedTasks={[
|
||||
{
|
||||
taskId: "task-000",
|
||||
status: "completed",
|
||||
method: "tools/call",
|
||||
target: "send_message",
|
||||
startedAt: "2026-03-17T09:58:00Z",
|
||||
completedAt: "2026-03-17T09:58:02Z",
|
||||
elapsed: "2s",
|
||||
onViewDetails: fn(),
|
||||
onViewResult: fn(),
|
||||
onCancel: fn(),
|
||||
onDismiss: fn(),
|
||||
},
|
||||
{
|
||||
taskId: "task-099",
|
||||
status: "failed",
|
||||
method: "tools/call",
|
||||
target: "delete_records",
|
||||
startedAt: "2026-03-17T09:50:00Z",
|
||||
completedAt: "2026-03-17T09:50:30Z",
|
||||
elapsed: "30s",
|
||||
error: "Timeout waiting for tool response after 30s",
|
||||
onViewDetails: fn(),
|
||||
onViewResult: fn(),
|
||||
onCancel: fn(),
|
||||
onDismiss: fn(),
|
||||
},
|
||||
]}
|
||||
onRefresh={fn()}
|
||||
onClearHistory={fn()}
|
||||
/>
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
export const HistoryActive: Story = {
|
||||
args: {
|
||||
activeTab: "History",
|
||||
children: (
|
||||
<HistoryScreen
|
||||
entries={[
|
||||
{
|
||||
timestamp: "2026-03-17T10:32:00Z",
|
||||
method: "tools/call",
|
||||
target: "complex_operation",
|
||||
status: "success",
|
||||
durationMs: 1250,
|
||||
isPinned: false,
|
||||
isExpanded: true,
|
||||
parameters: {
|
||||
action: "process",
|
||||
},
|
||||
response: {
|
||||
result: "completed",
|
||||
},
|
||||
childEntries: [
|
||||
{
|
||||
timestamp: "+120ms",
|
||||
method: "sampling/createMessage",
|
||||
target: "gpt-4",
|
||||
status: "success",
|
||||
durationMs: 800,
|
||||
},
|
||||
{
|
||||
timestamp: "+950ms",
|
||||
method: "elicitation/create",
|
||||
target: "confirm_action",
|
||||
status: "success",
|
||||
durationMs: 200,
|
||||
},
|
||||
],
|
||||
onToggleExpand: fn(),
|
||||
onReplay: fn(),
|
||||
onTogglePin: fn(),
|
||||
},
|
||||
{
|
||||
timestamp: "2026-03-17T10:31:15Z",
|
||||
method: "tools/call",
|
||||
target: "query_database",
|
||||
status: "error",
|
||||
durationMs: 3200,
|
||||
isPinned: false,
|
||||
isExpanded: false,
|
||||
onToggleExpand: fn(),
|
||||
onReplay: fn(),
|
||||
onTogglePin: fn(),
|
||||
},
|
||||
{
|
||||
timestamp: "2026-03-17T10:30:00Z",
|
||||
method: "tools/call",
|
||||
target: "get_weather",
|
||||
status: "success",
|
||||
durationMs: 142,
|
||||
isPinned: false,
|
||||
isExpanded: false,
|
||||
onToggleExpand: fn(),
|
||||
onReplay: fn(),
|
||||
onTogglePin: fn(),
|
||||
},
|
||||
]}
|
||||
pinnedEntries={[
|
||||
{
|
||||
timestamp: "2026-03-17T10:33:00Z",
|
||||
method: "resources/read",
|
||||
target: "config.json",
|
||||
status: "success",
|
||||
durationMs: 45,
|
||||
isPinned: true,
|
||||
pinLabel: "Baseline",
|
||||
isExpanded: false,
|
||||
onToggleExpand: fn(),
|
||||
onReplay: fn(),
|
||||
onTogglePin: fn(),
|
||||
},
|
||||
]}
|
||||
searchText=""
|
||||
totalCount={4}
|
||||
displayedCount={4}
|
||||
onSearchChange={fn()}
|
||||
onMethodFilterChange={fn()}
|
||||
onLoadMore={fn()}
|
||||
onClearAll={fn()}
|
||||
onExport={fn()}
|
||||
/>
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
export const LimitedTabs: Story = {
|
||||
args: {
|
||||
availableTabs: ["Tools", "Resources", "Prompts"],
|
||||
|
|
|
|||
Loading…
Reference in a new issue