Phase 2: Refactor Logs cluster to MCP SDK types
Replace string-typed log levels with SDK LoggingLevel across the Logs group components and LoggingScreen. - LogControls: type currentLevel, visibleLevels, and all handlers with LoggingLevel instead of string; type LOG_LEVELS array and LEVEL_COLORS record with LoggingLevel - LogStreamPanel: type visibleLevels as Record<LoggingLevel, boolean> instead of Record<string, boolean> - LoggingScreen: type currentLevel, onSetLevel, visibleLevels state, and toggle handlers with LoggingLevel; extract NO_LEVELS_VISIBLE as a module-level constant - Stories already used LoggingLevel literals; updated type annotations to use Record<LoggingLevel, boolean> - No ConnectedView story changes needed (already passes valid LoggingLevel values) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
91e5a1257a
commit
95e3a2dca7
1 changed files with 31 additions and 20 deletions
|
|
@ -9,13 +9,14 @@ import {
|
|||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import type { LoggingLevel } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { LogEntry } from "../../elements/LogEntry/LogEntry";
|
||||
import type { LogEntryData } from "../../elements/LogEntry/LogEntry";
|
||||
|
||||
export interface LogStreamPanelProps {
|
||||
entries: LogEntryData[];
|
||||
filterText: string;
|
||||
visibleLevels: Record<string, boolean>;
|
||||
visibleLevels: Record<LoggingLevel, boolean>;
|
||||
autoScroll: boolean;
|
||||
onToggleAutoScroll: () => void;
|
||||
onCopyAll: () => void;
|
||||
|
|
@ -50,7 +51,7 @@ function formatData(data: unknown): string {
|
|||
function matchesFilters(
|
||||
entry: LogEntryData,
|
||||
filterText: string,
|
||||
visibleLevels: Record<string, boolean>,
|
||||
visibleLevels: Record<LoggingLevel, boolean>,
|
||||
): boolean {
|
||||
if (!visibleLevels[entry.params.level]) return false;
|
||||
if (filterText) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue