|
|
@@ -1,6 +1,7 @@
|
|
|
-import { useState } from "react"
|
|
|
-import { Button } from "@/components/ui/button"
|
|
|
+import React, { useState } from "react"
|
|
|
+import { Trans } from "react-i18next"
|
|
|
import {
|
|
|
+ VSCodeButton,
|
|
|
VSCodeCheckbox,
|
|
|
VSCodeLink,
|
|
|
VSCodePanels,
|
|
|
@@ -10,13 +11,21 @@ import {
|
|
|
|
|
|
import { McpServer } from "@roo/shared/mcp"
|
|
|
|
|
|
-import { vscode } from "@/utils/vscode"
|
|
|
-import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from "@/components/ui"
|
|
|
-
|
|
|
+import { vscode } from "@src/utils/vscode"
|
|
|
import { useExtensionState } from "@src/context/ExtensionStateContext"
|
|
|
import { useAppTranslation } from "@src/i18n/TranslationContext"
|
|
|
-import { Trans } from "react-i18next"
|
|
|
+import {
|
|
|
+ Button,
|
|
|
+ Dialog,
|
|
|
+ DialogContent,
|
|
|
+ DialogHeader,
|
|
|
+ DialogTitle,
|
|
|
+ DialogDescription,
|
|
|
+ DialogFooter,
|
|
|
+} from "@src/components/ui"
|
|
|
+
|
|
|
import { Tab, TabContent, TabHeader } from "../common/Tab"
|
|
|
+
|
|
|
import McpToolRow from "./McpToolRow"
|
|
|
import McpResourceRow from "./McpResourceRow"
|
|
|
import McpEnabledToggle from "./McpEnabledToggle"
|
|
|
@@ -158,7 +167,7 @@ const ServerRow = ({ server, alwaysAllowMcp }: { server: McpServer; alwaysAllowM
|
|
|
}
|
|
|
|
|
|
const handleRowClick = () => {
|
|
|
- if (!server.error) {
|
|
|
+ if (server.status === "connected") {
|
|
|
setIsExpanded(!isExpanded)
|
|
|
}
|
|
|
}
|
|
|
@@ -199,12 +208,12 @@ const ServerRow = ({ server, alwaysAllowMcp }: { server: McpServer; alwaysAllowM
|
|
|
alignItems: "center",
|
|
|
padding: "8px",
|
|
|
background: "var(--vscode-textCodeBlock-background)",
|
|
|
- cursor: server.error ? "default" : "pointer",
|
|
|
- borderRadius: isExpanded || server.error ? "4px 4px 0 0" : "4px",
|
|
|
+ cursor: server.status === "connected" ? "pointer" : "default",
|
|
|
+ borderRadius: isExpanded || server.status === "connected" ? "4px" : "4px 4px 0 0",
|
|
|
opacity: server.disabled ? 0.6 : 1,
|
|
|
}}
|
|
|
onClick={handleRowClick}>
|
|
|
- {!server.error && (
|
|
|
+ {server.status === "connected" && (
|
|
|
<span
|
|
|
className={`codicon codicon-chevron-${isExpanded ? "down" : "right"}`}
|
|
|
style={{ marginRight: "8px" }}
|
|
|
@@ -304,35 +313,7 @@ const ServerRow = ({ server, alwaysAllowMcp }: { server: McpServer; alwaysAllowM
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
- {server.error ? (
|
|
|
- <div
|
|
|
- style={{
|
|
|
- fontSize: "13px",
|
|
|
- background: "var(--vscode-textCodeBlock-background)",
|
|
|
- borderRadius: "0 0 4px 4px",
|
|
|
- width: "100%",
|
|
|
- }}>
|
|
|
- <div
|
|
|
- style={{
|
|
|
- color: "var(--vscode-testing-iconFailed)",
|
|
|
- marginBottom: "8px",
|
|
|
- padding: "0 10px",
|
|
|
- overflowWrap: "break-word",
|
|
|
- wordBreak: "break-word",
|
|
|
- }}>
|
|
|
- {server.error}
|
|
|
- </div>
|
|
|
- <Button
|
|
|
- variant="secondary"
|
|
|
- onClick={handleRestart}
|
|
|
- disabled={server.status === "connecting"}
|
|
|
- style={{ width: "calc(100% - 20px)", margin: "0 10px 10px 10px" }}>
|
|
|
- {server.status === "connecting"
|
|
|
- ? t("mcp:serverStatus.retrying")
|
|
|
- : t("mcp:serverStatus.retryConnection")}
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
- ) : (
|
|
|
+ {server.status === "connected" ? (
|
|
|
isExpanded && (
|
|
|
<div
|
|
|
style={{
|
|
|
@@ -434,6 +415,38 @@ const ServerRow = ({ server, alwaysAllowMcp }: { server: McpServer; alwaysAllowM
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|
|
|
+ ) : (
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ fontSize: "13px",
|
|
|
+ background: "var(--vscode-textCodeBlock-background)",
|
|
|
+ borderRadius: "0 0 4px 4px",
|
|
|
+ width: "100%",
|
|
|
+ }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ color: "var(--vscode-testing-iconFailed)",
|
|
|
+ marginBottom: "8px",
|
|
|
+ padding: "0 10px",
|
|
|
+ overflowWrap: "break-word",
|
|
|
+ wordBreak: "break-word",
|
|
|
+ }}>
|
|
|
+ {server.error &&
|
|
|
+ server.error.split("\n").map((item, index) => (
|
|
|
+ <React.Fragment key={index}>
|
|
|
+ {index > 0 && <br />}
|
|
|
+ {item}
|
|
|
+ </React.Fragment>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ <VSCodeButton
|
|
|
+ appearance="secondary"
|
|
|
+ onClick={handleRestart}
|
|
|
+ disabled={server.status === "connecting"}
|
|
|
+ style={{ width: "calc(100% - 20px)", margin: "0 10px 10px 10px" }}>
|
|
|
+ {server.status === "connecting" ? "Retrying..." : "Retry Connection"}
|
|
|
+ </VSCodeButton>
|
|
|
+ </div>
|
|
|
)}
|
|
|
|
|
|
{/* Delete Confirmation Dialog */}
|