@mcp-shark/mcp-shark 1.4.0
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/LICENSE +85 -0
- package/README.md +724 -0
- package/bin/mcp-shark.js +93 -0
- package/mcp-server/.editorconfig +15 -0
- package/mcp-server/.prettierignore +11 -0
- package/mcp-server/.prettierrc +12 -0
- package/mcp-server/README.md +280 -0
- package/mcp-server/commitlint.config.cjs +42 -0
- package/mcp-server/eslint.config.js +131 -0
- package/mcp-server/lib/auditor/audit.js +228 -0
- package/mcp-server/lib/common/error.js +15 -0
- package/mcp-server/lib/server/external/all.js +32 -0
- package/mcp-server/lib/server/external/config.js +59 -0
- package/mcp-server/lib/server/external/kv.js +102 -0
- package/mcp-server/lib/server/external/single/client.js +35 -0
- package/mcp-server/lib/server/external/single/request.js +49 -0
- package/mcp-server/lib/server/external/single/run.js +75 -0
- package/mcp-server/lib/server/external/single/transport.js +57 -0
- package/mcp-server/lib/server/internal/handlers/common.js +20 -0
- package/mcp-server/lib/server/internal/handlers/error.js +7 -0
- package/mcp-server/lib/server/internal/handlers/prompts-get.js +22 -0
- package/mcp-server/lib/server/internal/handlers/prompts-list.js +12 -0
- package/mcp-server/lib/server/internal/handlers/resources-list.js +12 -0
- package/mcp-server/lib/server/internal/handlers/resources-read.js +19 -0
- package/mcp-server/lib/server/internal/handlers/tools-call.js +37 -0
- package/mcp-server/lib/server/internal/handlers/tools-list.js +14 -0
- package/mcp-server/lib/server/internal/run.js +49 -0
- package/mcp-server/lib/server/internal/server.js +63 -0
- package/mcp-server/lib/server/internal/session.js +39 -0
- package/mcp-server/mcp-shark.js +72 -0
- package/mcp-server/package-lock.json +4784 -0
- package/mcp-server/package.json +30 -0
- package/package.json +103 -0
- package/ui/README.md +212 -0
- package/ui/index.html +16 -0
- package/ui/package-lock.json +3574 -0
- package/ui/package.json +12 -0
- package/ui/paths.js +282 -0
- package/ui/public/og-image.png +0 -0
- package/ui/server/routes/backups.js +251 -0
- package/ui/server/routes/composite.js +244 -0
- package/ui/server/routes/config.js +175 -0
- package/ui/server/routes/conversations.js +25 -0
- package/ui/server/routes/help.js +43 -0
- package/ui/server/routes/logs.js +32 -0
- package/ui/server/routes/playground.js +152 -0
- package/ui/server/routes/requests.js +235 -0
- package/ui/server/routes/sessions.js +27 -0
- package/ui/server/routes/smartscan/discover.js +117 -0
- package/ui/server/routes/smartscan/scans/clearCache.js +22 -0
- package/ui/server/routes/smartscan/scans/createBatchScans.js +123 -0
- package/ui/server/routes/smartscan/scans/createScan.js +42 -0
- package/ui/server/routes/smartscan/scans/getCachedResults.js +51 -0
- package/ui/server/routes/smartscan/scans/getScan.js +41 -0
- package/ui/server/routes/smartscan/scans/listScans.js +24 -0
- package/ui/server/routes/smartscan/scans.js +13 -0
- package/ui/server/routes/smartscan/token.js +56 -0
- package/ui/server/routes/smartscan/transport.js +53 -0
- package/ui/server/routes/smartscan.js +24 -0
- package/ui/server/routes/statistics.js +83 -0
- package/ui/server/utils/config-update.js +212 -0
- package/ui/server/utils/config.js +98 -0
- package/ui/server/utils/paths.js +23 -0
- package/ui/server/utils/port.js +28 -0
- package/ui/server/utils/process.js +80 -0
- package/ui/server/utils/scan-cache/all-results.js +180 -0
- package/ui/server/utils/scan-cache/directory.js +35 -0
- package/ui/server/utils/scan-cache/file-operations.js +104 -0
- package/ui/server/utils/scan-cache/hash.js +47 -0
- package/ui/server/utils/scan-cache/server-operations.js +80 -0
- package/ui/server/utils/scan-cache.js +12 -0
- package/ui/server/utils/serialization.js +13 -0
- package/ui/server/utils/smartscan-token.js +42 -0
- package/ui/server.js +199 -0
- package/ui/src/App.jsx +153 -0
- package/ui/src/CompositeLogs.jsx +164 -0
- package/ui/src/CompositeSetup.jsx +285 -0
- package/ui/src/HelpGuide/HelpGuideContent.jsx +118 -0
- package/ui/src/HelpGuide/HelpGuideFooter.jsx +58 -0
- package/ui/src/HelpGuide/HelpGuideHeader.jsx +56 -0
- package/ui/src/HelpGuide.jsx +65 -0
- package/ui/src/IntroTour.jsx +140 -0
- package/ui/src/LogDetail.jsx +122 -0
- package/ui/src/LogTable.jsx +242 -0
- package/ui/src/PacketDetail.jsx +190 -0
- package/ui/src/PacketFilters.jsx +222 -0
- package/ui/src/PacketList.jsx +183 -0
- package/ui/src/SmartScan.jsx +178 -0
- package/ui/src/TabNavigation.jsx +143 -0
- package/ui/src/components/App/HelpButton.jsx +64 -0
- package/ui/src/components/App/TrafficTab.jsx +69 -0
- package/ui/src/components/App/useAppState.js +163 -0
- package/ui/src/components/BackupList.jsx +192 -0
- package/ui/src/components/CollapsibleSection.jsx +82 -0
- package/ui/src/components/ConfigFileSection.jsx +84 -0
- package/ui/src/components/ConfigViewerModal.jsx +141 -0
- package/ui/src/components/ConfirmationModal.jsx +129 -0
- package/ui/src/components/DetailsTab/BodySection.jsx +27 -0
- package/ui/src/components/DetailsTab/CollapsibleRequestResponse.jsx +70 -0
- package/ui/src/components/DetailsTab/HeadersSection.jsx +25 -0
- package/ui/src/components/DetailsTab/InfoSection.jsx +28 -0
- package/ui/src/components/DetailsTab/NetworkInfoSection.jsx +63 -0
- package/ui/src/components/DetailsTab/ProtocolInfoSection.jsx +75 -0
- package/ui/src/components/DetailsTab/RequestDetailsSection.jsx +46 -0
- package/ui/src/components/DetailsTab/ResponseDetailsSection.jsx +66 -0
- package/ui/src/components/DetailsTab.jsx +31 -0
- package/ui/src/components/DetectedPathsList.jsx +171 -0
- package/ui/src/components/FileInput.jsx +144 -0
- package/ui/src/components/GroupHeader.jsx +76 -0
- package/ui/src/components/GroupedByMcpView.jsx +103 -0
- package/ui/src/components/GroupedByServerView.jsx +134 -0
- package/ui/src/components/GroupedBySessionView.jsx +127 -0
- package/ui/src/components/GroupedViews.jsx +2 -0
- package/ui/src/components/HexTab.jsx +188 -0
- package/ui/src/components/LogsDisplay.jsx +93 -0
- package/ui/src/components/LogsToolbar.jsx +193 -0
- package/ui/src/components/McpPlayground/LoadingModal.jsx +113 -0
- package/ui/src/components/McpPlayground/PromptsSection/PromptCallPanel.jsx +125 -0
- package/ui/src/components/McpPlayground/PromptsSection/PromptItem.jsx +48 -0
- package/ui/src/components/McpPlayground/PromptsSection/PromptsList.jsx +45 -0
- package/ui/src/components/McpPlayground/PromptsSection.jsx +106 -0
- package/ui/src/components/McpPlayground/ResourcesSection/ResourceCallPanel.jsx +89 -0
- package/ui/src/components/McpPlayground/ResourcesSection/ResourceItem.jsx +59 -0
- package/ui/src/components/McpPlayground/ResourcesSection/ResourcesList.jsx +45 -0
- package/ui/src/components/McpPlayground/ResourcesSection.jsx +91 -0
- package/ui/src/components/McpPlayground/ToolsSection/ToolCallPanel.jsx +125 -0
- package/ui/src/components/McpPlayground/ToolsSection/ToolItem.jsx +48 -0
- package/ui/src/components/McpPlayground/ToolsSection/ToolsList.jsx +45 -0
- package/ui/src/components/McpPlayground/ToolsSection.jsx +107 -0
- package/ui/src/components/McpPlayground/common/EmptyState.jsx +17 -0
- package/ui/src/components/McpPlayground/common/ErrorState.jsx +17 -0
- package/ui/src/components/McpPlayground/common/LoadingState.jsx +17 -0
- package/ui/src/components/McpPlayground/useMcpPlayground.js +280 -0
- package/ui/src/components/McpPlayground.jsx +171 -0
- package/ui/src/components/MessageDisplay.jsx +28 -0
- package/ui/src/components/PacketDetailHeader.jsx +88 -0
- package/ui/src/components/PacketFilters/ExportControls.jsx +126 -0
- package/ui/src/components/PacketFilters/FilterInput.jsx +59 -0
- package/ui/src/components/RawTab.jsx +142 -0
- package/ui/src/components/RequestRow/OrphanedResponseRow.jsx +155 -0
- package/ui/src/components/RequestRow/RequestRowMain.jsx +240 -0
- package/ui/src/components/RequestRow/ResponseRow.jsx +158 -0
- package/ui/src/components/RequestRow.jsx +70 -0
- package/ui/src/components/ServerControl.jsx +133 -0
- package/ui/src/components/ServiceSelector.jsx +209 -0
- package/ui/src/components/SetupHeader.jsx +30 -0
- package/ui/src/components/SharkLogo.jsx +21 -0
- package/ui/src/components/SmartScan/AnalysisResult.jsx +64 -0
- package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultItem.jsx +215 -0
- package/ui/src/components/SmartScan/BatchResultsDisplay/BatchResultsHeader.jsx +94 -0
- package/ui/src/components/SmartScan/BatchResultsDisplay.jsx +26 -0
- package/ui/src/components/SmartScan/DebugInfoSection.jsx +53 -0
- package/ui/src/components/SmartScan/EmptyState.jsx +57 -0
- package/ui/src/components/SmartScan/ErrorDisplay.jsx +48 -0
- package/ui/src/components/SmartScan/ExpandableSection.jsx +93 -0
- package/ui/src/components/SmartScan/FindingsTable.jsx +257 -0
- package/ui/src/components/SmartScan/ListViewContent.jsx +75 -0
- package/ui/src/components/SmartScan/NotablePatternsSection.jsx +75 -0
- package/ui/src/components/SmartScan/OverallSummarySection.jsx +72 -0
- package/ui/src/components/SmartScan/RawDataSection.jsx +52 -0
- package/ui/src/components/SmartScan/RecommendationsSection.jsx +78 -0
- package/ui/src/components/SmartScan/ScanDetailHeader.jsx +92 -0
- package/ui/src/components/SmartScan/ScanDetailView.jsx +141 -0
- package/ui/src/components/SmartScan/ScanListView/ScanListHeader.jsx +49 -0
- package/ui/src/components/SmartScan/ScanListView/ScanListItem.jsx +201 -0
- package/ui/src/components/SmartScan/ScanListView.jsx +73 -0
- package/ui/src/components/SmartScan/ScanOverviewSection.jsx +123 -0
- package/ui/src/components/SmartScan/ScanResultsDisplay.jsx +35 -0
- package/ui/src/components/SmartScan/ScanViewContent.jsx +68 -0
- package/ui/src/components/SmartScan/ScanningProgress.jsx +47 -0
- package/ui/src/components/SmartScan/ServerInfoSection.jsx +43 -0
- package/ui/src/components/SmartScan/ServerSelectionRow.jsx +207 -0
- package/ui/src/components/SmartScan/SingleResultDisplay.jsx +269 -0
- package/ui/src/components/SmartScan/SmartScanControls.jsx +290 -0
- package/ui/src/components/SmartScan/SmartScanHeader.jsx +77 -0
- package/ui/src/components/SmartScan/ViewModeTabs.jsx +57 -0
- package/ui/src/components/SmartScan/hooks/useCacheManagement.js +34 -0
- package/ui/src/components/SmartScan/hooks/useMcpDiscovery.js +121 -0
- package/ui/src/components/SmartScan/hooks/useScanList.js +193 -0
- package/ui/src/components/SmartScan/hooks/useScanOperations.js +87 -0
- package/ui/src/components/SmartScan/hooks/useServerStatus.js +26 -0
- package/ui/src/components/SmartScan/hooks/useTokenManagement.js +53 -0
- package/ui/src/components/SmartScan/scanDataUtils.js +98 -0
- package/ui/src/components/SmartScan/useSmartScan.js +72 -0
- package/ui/src/components/SmartScan/utils.js +19 -0
- package/ui/src/components/SmartScanIcons.jsx +58 -0
- package/ui/src/components/TabNavigation/DesktopTabs.jsx +111 -0
- package/ui/src/components/TabNavigation/MobileDropdown.jsx +140 -0
- package/ui/src/components/TabNavigation.jsx +97 -0
- package/ui/src/components/TabNavigationIcons.jsx +40 -0
- package/ui/src/components/TableHeader.jsx +164 -0
- package/ui/src/components/TourOverlay.jsx +117 -0
- package/ui/src/components/TourTooltip/TourTooltipButtons.jsx +117 -0
- package/ui/src/components/TourTooltip/TourTooltipHeader.jsx +70 -0
- package/ui/src/components/TourTooltip/TourTooltipIcons.jsx +45 -0
- package/ui/src/components/TourTooltip/useTooltipPosition.js +108 -0
- package/ui/src/components/TourTooltip.jsx +83 -0
- package/ui/src/components/ViewModeTabs.jsx +91 -0
- package/ui/src/components/WhatThisDoesSection.jsx +61 -0
- package/ui/src/config/tourSteps.jsx +141 -0
- package/ui/src/hooks/useAnimation.js +92 -0
- package/ui/src/hooks/useConfigManagement.js +124 -0
- package/ui/src/hooks/useServiceExtraction.js +51 -0
- package/ui/src/index.css +42 -0
- package/ui/src/main.jsx +10 -0
- package/ui/src/theme.js +65 -0
- package/ui/src/utils/animations.js +170 -0
- package/ui/src/utils/groupingUtils.js +93 -0
- package/ui/src/utils/hexUtils.js +24 -0
- package/ui/src/utils/mcpGroupingUtils.js +262 -0
- package/ui/src/utils/requestUtils.js +297 -0
- package/ui/vite.config.js +18 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { colors, fonts } from '../../theme';
|
|
2
|
+
import anime from 'animejs';
|
|
3
|
+
|
|
4
|
+
export default function FilterInput({
|
|
5
|
+
type = 'text',
|
|
6
|
+
placeholder,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
style = {},
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
const defaultStyle = {
|
|
13
|
+
padding: '8px 12px',
|
|
14
|
+
background: colors.bgCard,
|
|
15
|
+
border: `1px solid ${colors.borderLight}`,
|
|
16
|
+
color: colors.textPrimary,
|
|
17
|
+
fontSize: '13px',
|
|
18
|
+
fontFamily:
|
|
19
|
+
type === 'number' || placeholder?.includes('JSON-RPC') || placeholder?.includes('HTTP')
|
|
20
|
+
? fonts.mono
|
|
21
|
+
: fonts.body,
|
|
22
|
+
borderRadius: '8px',
|
|
23
|
+
transition: 'all 0.2s',
|
|
24
|
+
...style,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const handleFocus = (e) => {
|
|
28
|
+
anime({
|
|
29
|
+
targets: e.currentTarget,
|
|
30
|
+
borderColor: colors.accentBlue,
|
|
31
|
+
boxShadow: [`0 0 0 0px ${colors.accentBlue}20`, `0 0 0 3px ${colors.accentBlue}20`],
|
|
32
|
+
duration: 200,
|
|
33
|
+
easing: 'easeOutQuad',
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleBlur = (e) => {
|
|
38
|
+
anime({
|
|
39
|
+
targets: e.currentTarget,
|
|
40
|
+
borderColor: colors.borderLight,
|
|
41
|
+
boxShadow: 'none',
|
|
42
|
+
duration: 200,
|
|
43
|
+
easing: 'easeOutQuad',
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<input
|
|
49
|
+
type={type}
|
|
50
|
+
placeholder={placeholder}
|
|
51
|
+
value={value || ''}
|
|
52
|
+
onChange={onChange}
|
|
53
|
+
style={defaultStyle}
|
|
54
|
+
onFocus={handleFocus}
|
|
55
|
+
onBlur={handleBlur}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { colors, fonts } from '../theme';
|
|
3
|
+
|
|
4
|
+
const ChevronDown = ({ size = 14, color = 'currentColor', rotated = false }) => (
|
|
5
|
+
<svg
|
|
6
|
+
width={size}
|
|
7
|
+
height={size}
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
fill="none"
|
|
10
|
+
stroke={color}
|
|
11
|
+
strokeWidth="2.5"
|
|
12
|
+
strokeLinecap="round"
|
|
13
|
+
strokeLinejoin="round"
|
|
14
|
+
style={{
|
|
15
|
+
display: 'inline-block',
|
|
16
|
+
verticalAlign: 'middle',
|
|
17
|
+
transform: rotated ? 'rotate(-90deg)' : 'rotate(0deg)',
|
|
18
|
+
transition: 'transform 0.2s ease',
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<polyline points="6 9 12 15 18 9" />
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
function CollapsibleRequestResponse({ title, titleColor, children, defaultExpanded = true }) {
|
|
26
|
+
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
background: colors.bgCard,
|
|
32
|
+
borderRadius: '8px',
|
|
33
|
+
border: `1px solid ${colors.borderLight}`,
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
marginBottom: '20px',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
onClick={() => setIsExpanded(!isExpanded)}
|
|
40
|
+
style={{
|
|
41
|
+
padding: '16px 20px',
|
|
42
|
+
background: isExpanded ? colors.bgCard : colors.bgSecondary,
|
|
43
|
+
borderBottom: isExpanded ? `1px solid ${colors.borderLight}` : 'none',
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
userSelect: 'none',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'space-between',
|
|
49
|
+
transition: 'background-color 0.15s ease',
|
|
50
|
+
}}
|
|
51
|
+
onMouseEnter={(e) => {
|
|
52
|
+
e.currentTarget.style.background = colors.bgHover;
|
|
53
|
+
}}
|
|
54
|
+
onMouseLeave={(e) => {
|
|
55
|
+
e.currentTarget.style.background = isExpanded ? colors.bgCard : colors.bgSecondary;
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<div
|
|
59
|
+
style={{
|
|
60
|
+
fontSize: '13px',
|
|
61
|
+
fontWeight: '600',
|
|
62
|
+
color: titleColor,
|
|
63
|
+
textTransform: 'uppercase',
|
|
64
|
+
letterSpacing: '0.05em',
|
|
65
|
+
fontFamily: fonts.body,
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
gap: '8px',
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<ChevronDown size={14} color={titleColor} rotated={!isExpanded} />
|
|
72
|
+
{title}
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
{isExpanded && <div style={{ padding: '20px' }}>{children}</div>}
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function RawTab({ requestFullText, responseFullText, hasRequest, hasResponse }) {
|
|
81
|
+
return (
|
|
82
|
+
<div style={{ padding: '20px', overflow: 'auto', flex: 1, background: colors.bgPrimary }}>
|
|
83
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '0' }}>
|
|
84
|
+
{hasRequest && (
|
|
85
|
+
<CollapsibleRequestResponse
|
|
86
|
+
title="Raw Request Data"
|
|
87
|
+
titleColor={colors.accentBlue}
|
|
88
|
+
defaultExpanded={true}
|
|
89
|
+
>
|
|
90
|
+
<pre
|
|
91
|
+
style={{
|
|
92
|
+
background: colors.bgSecondary,
|
|
93
|
+
padding: '16px',
|
|
94
|
+
borderRadius: '8px',
|
|
95
|
+
overflow: 'auto',
|
|
96
|
+
fontSize: '12px',
|
|
97
|
+
fontFamily: fonts.mono,
|
|
98
|
+
color: colors.textPrimary,
|
|
99
|
+
border: `1px solid ${colors.borderLight}`,
|
|
100
|
+
whiteSpace: 'pre-wrap',
|
|
101
|
+
wordBreak: 'break-all',
|
|
102
|
+
lineHeight: '1.5',
|
|
103
|
+
maxHeight: 'calc(100vh - 300px)',
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{requestFullText || '(empty)'}
|
|
107
|
+
</pre>
|
|
108
|
+
</CollapsibleRequestResponse>
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
{hasResponse && (
|
|
112
|
+
<CollapsibleRequestResponse
|
|
113
|
+
title="Raw Response Data"
|
|
114
|
+
titleColor={colors.accentGreen}
|
|
115
|
+
defaultExpanded={true}
|
|
116
|
+
>
|
|
117
|
+
<pre
|
|
118
|
+
style={{
|
|
119
|
+
background: colors.bgSecondary,
|
|
120
|
+
padding: '16px',
|
|
121
|
+
borderRadius: '8px',
|
|
122
|
+
overflow: 'auto',
|
|
123
|
+
fontSize: '12px',
|
|
124
|
+
fontFamily: fonts.mono,
|
|
125
|
+
color: colors.textPrimary,
|
|
126
|
+
border: `1px solid ${colors.borderLight}`,
|
|
127
|
+
whiteSpace: 'pre-wrap',
|
|
128
|
+
wordBreak: 'break-all',
|
|
129
|
+
lineHeight: '1.5',
|
|
130
|
+
maxHeight: 'calc(100vh - 300px)',
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
{responseFullText || '(empty)'}
|
|
134
|
+
</pre>
|
|
135
|
+
</CollapsibleRequestResponse>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export default RawTab;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { colors, fonts, withOpacity } from '../../theme';
|
|
2
|
+
import {
|
|
3
|
+
formatRelativeTime,
|
|
4
|
+
formatDateTime,
|
|
5
|
+
getSourceDest,
|
|
6
|
+
getEndpoint,
|
|
7
|
+
} from '../../utils/requestUtils.js';
|
|
8
|
+
|
|
9
|
+
export default function OrphanedResponseRow({ response, selected, firstRequestTime, onSelect }) {
|
|
10
|
+
const isSelected = selected?.frame_number === response.frame_number;
|
|
11
|
+
const { source, dest } = getSourceDest(response);
|
|
12
|
+
const relativeTime = formatRelativeTime(response.timestamp_iso, firstRequestTime);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<tr
|
|
16
|
+
onClick={() => onSelect(response)}
|
|
17
|
+
style={{
|
|
18
|
+
cursor: 'pointer',
|
|
19
|
+
background: isSelected ? colors.bgSelected : colors.bgUnpaired,
|
|
20
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
21
|
+
fontFamily: fonts.body,
|
|
22
|
+
transition: 'background-color 0.15s ease',
|
|
23
|
+
opacity: 0.85,
|
|
24
|
+
}}
|
|
25
|
+
onMouseEnter={(e) => {
|
|
26
|
+
if (!isSelected) {
|
|
27
|
+
e.currentTarget.style.background = withOpacity(colors.accentOrange, 0.1);
|
|
28
|
+
}
|
|
29
|
+
}}
|
|
30
|
+
onMouseLeave={(e) => {
|
|
31
|
+
if (!isSelected) {
|
|
32
|
+
e.currentTarget.style.background = colors.bgUnpaired;
|
|
33
|
+
}
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<td
|
|
37
|
+
style={{
|
|
38
|
+
padding: '16px',
|
|
39
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
40
|
+
color: colors.textPrimary,
|
|
41
|
+
textAlign: 'right',
|
|
42
|
+
fontFamily: fonts.mono,
|
|
43
|
+
fontSize: '12px',
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<span style={{ color: colors.accentOrange, fontWeight: '500' }}>
|
|
47
|
+
#{response.frame_number} (orphaned)
|
|
48
|
+
</span>
|
|
49
|
+
</td>
|
|
50
|
+
<td
|
|
51
|
+
style={{
|
|
52
|
+
padding: '16px',
|
|
53
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
54
|
+
color: colors.textPrimary,
|
|
55
|
+
fontFamily: fonts.mono,
|
|
56
|
+
fontSize: '12px',
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{relativeTime}
|
|
60
|
+
</td>
|
|
61
|
+
<td
|
|
62
|
+
style={{
|
|
63
|
+
padding: '16px',
|
|
64
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
65
|
+
color: colors.textPrimary,
|
|
66
|
+
fontFamily: fonts.body,
|
|
67
|
+
fontSize: '12px',
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{formatDateTime(response.timestamp_iso)}
|
|
71
|
+
</td>
|
|
72
|
+
<td
|
|
73
|
+
style={{
|
|
74
|
+
padding: '16px',
|
|
75
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
76
|
+
color: colors.accentOrange,
|
|
77
|
+
fontFamily: fonts.mono,
|
|
78
|
+
fontSize: '12px',
|
|
79
|
+
fontWeight: '500',
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
{source}
|
|
83
|
+
</td>
|
|
84
|
+
<td
|
|
85
|
+
style={{
|
|
86
|
+
padding: '16px',
|
|
87
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
88
|
+
color: colors.accentOrange,
|
|
89
|
+
fontFamily: fonts.mono,
|
|
90
|
+
fontSize: '12px',
|
|
91
|
+
fontWeight: '500',
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{dest}
|
|
95
|
+
</td>
|
|
96
|
+
<td
|
|
97
|
+
style={{
|
|
98
|
+
padding: '16px',
|
|
99
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
100
|
+
color: colors.textPrimary,
|
|
101
|
+
fontFamily: fonts.mono,
|
|
102
|
+
fontSize: '12px',
|
|
103
|
+
fontWeight: '500',
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{response.protocol || 'HTTP'}
|
|
107
|
+
</td>
|
|
108
|
+
<td
|
|
109
|
+
style={{
|
|
110
|
+
padding: '16px',
|
|
111
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
112
|
+
color: colors.textSecondary,
|
|
113
|
+
fontFamily: fonts.mono,
|
|
114
|
+
fontSize: '12px',
|
|
115
|
+
fontWeight: '500',
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
-
|
|
119
|
+
</td>
|
|
120
|
+
<td
|
|
121
|
+
style={{
|
|
122
|
+
padding: '16px',
|
|
123
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
124
|
+
fontFamily: fonts.mono,
|
|
125
|
+
fontSize: '12px',
|
|
126
|
+
fontWeight: '500',
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
<div
|
|
130
|
+
style={{
|
|
131
|
+
color:
|
|
132
|
+
response.status_code >= 400
|
|
133
|
+
? colors.error
|
|
134
|
+
: response.status_code >= 300
|
|
135
|
+
? colors.warning
|
|
136
|
+
: colors.success,
|
|
137
|
+
fontWeight: '600',
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
{response.status_code || '-'}
|
|
141
|
+
</div>
|
|
142
|
+
</td>
|
|
143
|
+
<td
|
|
144
|
+
style={{
|
|
145
|
+
padding: '16px',
|
|
146
|
+
color: colors.textPrimary,
|
|
147
|
+
fontFamily: fonts.mono,
|
|
148
|
+
fontSize: '12px',
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
{getEndpoint(response)}
|
|
152
|
+
</td>
|
|
153
|
+
</tr>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { colors, fonts, withOpacity } from '../../theme';
|
|
2
|
+
import {
|
|
3
|
+
formatRelativeTime,
|
|
4
|
+
formatDateTime,
|
|
5
|
+
getSourceDest,
|
|
6
|
+
getEndpoint,
|
|
7
|
+
} from '../../utils/requestUtils.js';
|
|
8
|
+
import { IconChevronDown } from '@tabler/icons-react';
|
|
9
|
+
|
|
10
|
+
const ChevronDown = ({ size = 12, rotated = false }) => (
|
|
11
|
+
<IconChevronDown
|
|
12
|
+
size={size}
|
|
13
|
+
stroke={1.5}
|
|
14
|
+
style={{
|
|
15
|
+
display: 'inline-block',
|
|
16
|
+
verticalAlign: 'middle',
|
|
17
|
+
transform: rotated ? 'rotate(-90deg)' : 'rotate(0deg)',
|
|
18
|
+
transition: 'transform 0.2s ease',
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default function RequestRowMain({
|
|
24
|
+
request,
|
|
25
|
+
response,
|
|
26
|
+
selected,
|
|
27
|
+
firstRequestTime,
|
|
28
|
+
onSelect,
|
|
29
|
+
isExpanded,
|
|
30
|
+
onToggleExpand,
|
|
31
|
+
isUnpaired,
|
|
32
|
+
}) {
|
|
33
|
+
const isSelected = selected?.frame_number === request.frame_number;
|
|
34
|
+
const { source, dest } = getSourceDest(request);
|
|
35
|
+
const relativeTime = formatRelativeTime(request.timestamp_iso, firstRequestTime);
|
|
36
|
+
const hasResponse = !!response;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<tr
|
|
41
|
+
onClick={() => onSelect(request)}
|
|
42
|
+
style={{
|
|
43
|
+
cursor: 'pointer',
|
|
44
|
+
background: isSelected
|
|
45
|
+
? colors.bgSelected
|
|
46
|
+
: isUnpaired
|
|
47
|
+
? colors.bgUnpaired
|
|
48
|
+
: colors.bgSecondary,
|
|
49
|
+
borderBottom: `1px solid ${colors.borderLight}`,
|
|
50
|
+
fontFamily: fonts.body,
|
|
51
|
+
transition: 'background-color 0.15s ease',
|
|
52
|
+
opacity: isUnpaired ? 0.85 : 1,
|
|
53
|
+
}}
|
|
54
|
+
onMouseEnter={(e) => {
|
|
55
|
+
if (!isSelected) {
|
|
56
|
+
e.currentTarget.style.background = isUnpaired
|
|
57
|
+
? withOpacity(colors.accentOrange, 0.1)
|
|
58
|
+
: colors.bgCard;
|
|
59
|
+
}
|
|
60
|
+
}}
|
|
61
|
+
onMouseLeave={(e) => {
|
|
62
|
+
if (!isSelected) {
|
|
63
|
+
e.currentTarget.style.background = isUnpaired ? colors.bgUnpaired : colors.bgSecondary;
|
|
64
|
+
}
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<td
|
|
68
|
+
style={{
|
|
69
|
+
padding: '16px',
|
|
70
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
71
|
+
color: colors.textPrimary,
|
|
72
|
+
textAlign: 'right',
|
|
73
|
+
fontFamily: fonts.mono,
|
|
74
|
+
fontSize: '12px',
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<div
|
|
78
|
+
style={{
|
|
79
|
+
display: 'flex',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
gap: '8px',
|
|
82
|
+
justifyContent: 'flex-end',
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{hasResponse && (
|
|
86
|
+
<button
|
|
87
|
+
onClick={(e) => {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
onToggleExpand();
|
|
90
|
+
}}
|
|
91
|
+
style={{
|
|
92
|
+
background: 'none',
|
|
93
|
+
border: 'none',
|
|
94
|
+
cursor: 'pointer',
|
|
95
|
+
padding: '2px',
|
|
96
|
+
display: 'flex',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
color: colors.textSecondary,
|
|
99
|
+
}}
|
|
100
|
+
onMouseEnter={(e) => {
|
|
101
|
+
e.currentTarget.style.color = colors.textPrimary;
|
|
102
|
+
}}
|
|
103
|
+
onMouseLeave={(e) => {
|
|
104
|
+
e.currentTarget.style.color = colors.textSecondary;
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<ChevronDown size={14} rotated={!isExpanded} />
|
|
108
|
+
</button>
|
|
109
|
+
)}
|
|
110
|
+
<span
|
|
111
|
+
style={{
|
|
112
|
+
color: isUnpaired ? colors.accentOrange : colors.accentBlue,
|
|
113
|
+
fontWeight: '500',
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
#{request.frame_number}
|
|
117
|
+
{isUnpaired && (
|
|
118
|
+
<span
|
|
119
|
+
style={{
|
|
120
|
+
fontSize: '10px',
|
|
121
|
+
color: colors.textSecondary,
|
|
122
|
+
marginLeft: '4px',
|
|
123
|
+
fontStyle: 'italic',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
(no response)
|
|
127
|
+
</span>
|
|
128
|
+
)}
|
|
129
|
+
</span>
|
|
130
|
+
</div>
|
|
131
|
+
</td>
|
|
132
|
+
<td
|
|
133
|
+
style={{
|
|
134
|
+
padding: '16px',
|
|
135
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
136
|
+
color: colors.textPrimary,
|
|
137
|
+
fontFamily: fonts.mono,
|
|
138
|
+
fontSize: '12px',
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
{relativeTime}
|
|
142
|
+
</td>
|
|
143
|
+
<td
|
|
144
|
+
style={{
|
|
145
|
+
padding: '16px',
|
|
146
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
147
|
+
color: colors.textPrimary,
|
|
148
|
+
fontFamily: fonts.body,
|
|
149
|
+
fontSize: '12px',
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
{formatDateTime(request.timestamp_iso)}
|
|
153
|
+
</td>
|
|
154
|
+
<td
|
|
155
|
+
style={{
|
|
156
|
+
padding: '16px',
|
|
157
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
158
|
+
color: colors.accentBlue,
|
|
159
|
+
fontFamily: fonts.mono,
|
|
160
|
+
fontSize: '12px',
|
|
161
|
+
fontWeight: '500',
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
{source}
|
|
165
|
+
</td>
|
|
166
|
+
<td
|
|
167
|
+
style={{
|
|
168
|
+
padding: '16px',
|
|
169
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
170
|
+
color: colors.accentBlue,
|
|
171
|
+
fontFamily: fonts.mono,
|
|
172
|
+
fontSize: '12px',
|
|
173
|
+
fontWeight: '500',
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
{dest}
|
|
177
|
+
</td>
|
|
178
|
+
<td
|
|
179
|
+
style={{
|
|
180
|
+
padding: '16px',
|
|
181
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
182
|
+
color: colors.textPrimary,
|
|
183
|
+
fontFamily: fonts.mono,
|
|
184
|
+
fontSize: '12px',
|
|
185
|
+
fontWeight: '500',
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
{request.protocol || 'HTTP'}
|
|
189
|
+
</td>
|
|
190
|
+
<td
|
|
191
|
+
style={{
|
|
192
|
+
padding: '16px',
|
|
193
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
194
|
+
color: colors.textPrimary,
|
|
195
|
+
fontFamily: fonts.mono,
|
|
196
|
+
fontSize: '12px',
|
|
197
|
+
fontWeight: '500',
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
<div style={{ color: colors.accentBlue }}>{request.method || 'REQ'}</div>
|
|
201
|
+
</td>
|
|
202
|
+
<td
|
|
203
|
+
style={{
|
|
204
|
+
padding: '16px',
|
|
205
|
+
borderRight: `1px solid ${colors.borderLight}`,
|
|
206
|
+
fontFamily: fonts.mono,
|
|
207
|
+
fontSize: '12px',
|
|
208
|
+
fontWeight: '500',
|
|
209
|
+
}}
|
|
210
|
+
>
|
|
211
|
+
{hasResponse && (
|
|
212
|
+
<div
|
|
213
|
+
style={{
|
|
214
|
+
color:
|
|
215
|
+
response.status_code >= 400
|
|
216
|
+
? colors.error
|
|
217
|
+
: response.status_code >= 300
|
|
218
|
+
? colors.warning
|
|
219
|
+
: colors.success,
|
|
220
|
+
fontWeight: '600',
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
{response.status_code || '-'}
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
</td>
|
|
227
|
+
<td
|
|
228
|
+
style={{
|
|
229
|
+
padding: '16px',
|
|
230
|
+
color: colors.textPrimary,
|
|
231
|
+
fontFamily: fonts.mono,
|
|
232
|
+
fontSize: '12px',
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
{getEndpoint(request)}
|
|
236
|
+
</td>
|
|
237
|
+
</tr>
|
|
238
|
+
</>
|
|
239
|
+
);
|
|
240
|
+
}
|