fix(linear): clarify setup actions and MCP configuration

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-23 18:29:52 +08:00
1 parent d699088705
commit 1fc44e091b
20 files changed
+228 -121

No files matched your search

+6
View File
@@ -25,6 +25,7 @@ export type ChannelPluginPanelProps = {
showBrandLogos: boolean;
onAction: ChannelFeatureAction;
onFeaturesUpdate: (payload: NanobotFeaturesPayload) => void;
onConfigureMcp?: (name: string) => void;
onBeforeCloseChange?: (handler: (() => Promise<boolean>) | null) => void;
};
@@ -36,10 +37,15 @@ export type ChannelPluginConnectFlowProps = {
onFeaturesUpdate: (payload: NanobotFeaturesPayload) => void;
};
export type ChannelPluginHelpProps = {
feature: NanobotFeatureInfo;
};
export type ChannelUiContribution = {
presentation: ChannelPresentation;
aliases?: Record<string, Partial<ChannelPresentation>>;
Panel?: ComponentType<ChannelPluginPanelProps>;
HelpContent?: ComponentType<ChannelPluginHelpProps>;
ConnectFlow?: ComponentType<ChannelPluginConnectFlowProps>;
canConnectBeforeConfigured?: boolean;
};
@@ -81,6 +81,7 @@ export function SettingsPage({
hostChromeInset,
}: SettingsPageProps) {
const [dialogLayoutAnchor, setDialogLayoutAnchor] = useState<HTMLDivElement | null>(null);
const [mcpSetupName, setMcpSetupName] = useState<string | null>(null);
const [pendingExit, setPendingExit] = useState<(() => void) | null>(null);
const [automationDetailReturn, setAutomationDetailReturn] =
useState<SessionAutomationJob | null>(null);
@@ -485,6 +486,12 @@ export function SettingsPage({
case "channels":
return (
<ChannelsSettings
onConfigureMcp={(name) => {
setMcpSetupName(name);
setAppsKindFilter("mcp");
setAppsQuery(name);
selectSection("apps");
}}
token={token}
nanobotFeatures={nanobotFeatures}
loading={nanobotFeaturesLoading}
@@ -506,6 +513,8 @@ export function SettingsPage({
return (
<div className="settings-stack">
<AppsCatalogSettings
setupName={mcpSetupName}
onSetupOpened={() => setMcpSetupName(null)}
cliApps={cliApps}
mcpPresets={mcpPresets}
cliAppsLoading={cliAppsLoading}
@@ -1,3 +1,4 @@
import { channelUiContribution } from "@/channel-plugins/registry";
import { CircleHelp, ExternalLink } from "lucide-react";
import { useTranslation } from "react-i18next";
import { channelSetup } from "@/components/settings/channels/ChannelIdentity";
@@ -16,7 +17,8 @@ export function ChannelHelpMenu({ feature, chatAppsDocsUrl }: {
{ url: setup.officialUrl, label: setup.officialLabel },
{ url: docsUrlWithBase(setup.docsUrl, chatAppsDocsUrl), label: setup.docsLabel },
].filter((link) => link.url);
if (!links.length) return null;
const HelpContent = channelUiContribution(feature.name, feature.webui)?.HelpContent;
if (!links.length && !HelpContent) return null;
const label = t("settings.channels.help", { defaultValue: "Help" });
return (
<TooltipProvider>
@@ -33,6 +35,7 @@ export function ChannelHelpMenu({ feature, chatAppsDocsUrl }: {
<TooltipContent>{label}</TooltipContent>
</Tooltip>
<DropdownMenuContent align="end">
{HelpContent ? <HelpContent feature={feature} /> : null}
{links.map((link) => (
<DropdownMenuItem key={link.url} asChild>
<a href={link.url} target="_blank" rel="noreferrer">
@@ -79,6 +79,7 @@ export function ChannelSetupPanel({
onFeaturesUpdate,
connectRequestId = 0,
onBeforeCloseChange,
onConfigureMcp,
}: {
token: string;
feature: NanobotFeatureInfo;
@@ -87,6 +88,7 @@ export function ChannelSetupPanel({
onAction: ChannelFeatureAction;
onFeaturesUpdate: (payload: NanobotFeaturesPayload) => void;
connectRequestId?: number;
onConfigureMcp?: (name: string) => void;
onBeforeCloseChange?: (handler: (() => Promise<boolean>) | null) => void;
}) {
const { t, i18n } = useTranslation();
@@ -108,6 +110,7 @@ export function ChannelSetupPanel({
onAction={onAction}
onFeaturesUpdate={onFeaturesUpdate}
onBeforeCloseChange={onBeforeCloseChange}
onConfigureMcp={onConfigureMcp}
/>
</Suspense>
);
@@ -1,5 +1,6 @@
import {
forwardRef,
useEffect,
useId,
useMemo,
useState,
@@ -94,6 +95,8 @@ export const DEFAULT_CUSTOM_MCP_FORM: CustomMcpForm = {
};
export function AppsCatalogSettings({
setupName,
onSetupOpened,
cliApps,
mcpPresets,
cliAppsLoading,
@@ -137,6 +140,8 @@ export function AppsCatalogSettings({
onRestart,
isRestarting,
}: {
setupName?: string | null;
onSetupOpened?: () => void;
cliApps: CliAppsPayload | null;
mcpPresets: McpPresetsPayload | null;
cliAppsLoading: boolean;
@@ -321,6 +326,8 @@ export function AppsCatalogSettings({
<McpAppsCatalogRow
key={item.id}
preset={item.preset}
openConnection={setupName === item.preset.name}
onConnectionOpened={onSetupOpened}
values={mcpFieldValues[item.preset.name] ?? {}}
actionKey={mcpActionKey}
oauthFlow={mcpOAuthFlow?.name === item.preset.name ? mcpOAuthFlow : null}
@@ -484,6 +491,8 @@ function CliAppsCatalogRow({
}
function McpAppsCatalogRow({
openConnection = false,
onConnectionOpened,
preset,
values,
actionKey,
@@ -503,6 +512,8 @@ function McpAppsCatalogRow({
onOAuthComplete,
onToolsChange,
}: {
openConnection?: boolean;
onConnectionOpened?: () => void;
preset: McpPresetInfo;
values: Record<string, string>;
actionKey: string | null;
@@ -526,6 +537,12 @@ function McpAppsCatalogRow({
const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });
const [managementOpen, setManagementOpen] = useState(false);
const [managementTab, setManagementTab] = useState<McpManagementTab>("overview");
useEffect(() => {
if (!openConnection) return;
setManagementTab("connection");
setManagementOpen(true);
onConnectionOpened?.();
}, [openConnection, onConnectionOpened]);
const enableBusy = actionKey === `enable:${preset.name}`;
const disableBusy = actionKey === `disable:${preset.name}`;
const removeBusy = actionKey === `remove:${preset.name}`;
@@ -19,7 +19,7 @@ type ChannelFilter = "all" | "enabled";
export function ChannelsSettings({
token, nanobotFeatures, loading, actionKey, chatAppsDocsUrl, showBrandLogos,
error, requiresRestartPending, onAction, onFeaturesUpdate, onDismissStatus,
onRestart, isRestarting,
onRestart, isRestarting, onConfigureMcp,
}: {
token: string;
nanobotFeatures: NanobotFeaturesPayload | null;
@@ -32,6 +32,7 @@ export function ChannelsSettings({
onAction: ChannelFeatureAction;
onFeaturesUpdate: (payload: NanobotFeaturesPayload) => void;
onDismissStatus: () => void;
onConfigureMcp?: (name: string) => void;
onRestart?: () => void;
isRestarting?: boolean;
}) {
@@ -176,6 +177,7 @@ export function ChannelsSettings({
{selectedChannel ? <ChannelSetupPanel token={token} feature={selectedChannel} actionKey={actionKey}
showBrandLogos={showBrandLogos}
onAction={onAction} onFeaturesUpdate={onFeaturesUpdate} connectRequestId={connectRequestId}
onConfigureMcp={onConfigureMcp}
onBeforeCloseChange={setBeforeChannelClose} /> : null}
</div>
</div>