Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add terminal in the task page#20396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 1 commit intomainfrombq/add-terminal
Oct 22, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletionssite/src/pages/TaskPage/TaskAppIframe.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ import { useProxy } from "contexts/ProxyContext";
import { EllipsisVertical, ExternalLinkIcon, HouseIcon } from "lucide-react";
import { useAppLink } from "modules/apps/useAppLink";
import type { Task, WorkspaceAppWithAgent } from "modules/tasks/tasks";
import { type FC, useRef } from "react";
import { type FC,type HTMLProps,useRef } from "react";
import { Link as RouterLink } from "react-router";
import { cn } from "utils/cn";
import { TaskWildcardWarning } from "./TaskWildcardWarning";
Expand DownExpand Up@@ -85,14 +85,7 @@ export const TaskAppIFrame: FC<TaskAppIFrameProps> = ({
)}

{app.health === "healthy" || app.health === "disabled" ? (
<iframe
ref={frameRef}
src={link.href}
title={link.label}
loading="eager"
className={"w-full h-full border-0"}
allow="clipboard-read; clipboard-write"
/>
<TaskIframe ref={frameRef} src={link.href} title={link.label} />
) : app.health === "unhealthy" ? (
<div className="w-full h-full flex flex-col items-center justify-center p-4">
<h3 className="m-0 font-medium text-content-primary text-base text-center">
Expand DownExpand Up@@ -145,3 +138,16 @@ export const TaskAppIFrame: FC<TaskAppIFrameProps> = ({
</div>
);
};

type TaskIframeProps = HTMLProps<HTMLIFrameElement>;

export const TaskIframe: FC<TaskIframeProps> = ({ className, ...props }) => {
return (
<iframe
loading="eager"
className={cn("w-full h-full border-0", className)}
allow="clipboard-read; clipboard-write"
{...props}
/>
);
};
69 changes: 53 additions & 16 deletionssite/src/pages/TaskPage/TaskApps.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,24 +9,26 @@ import { ExternalImage } from "components/ExternalImage/ExternalImage";
import { InfoTooltip } from "components/InfoTooltip/InfoTooltip";
import { Link } from "components/Link/Link";
import { ScrollArea, ScrollBar } from "components/ScrollArea/ScrollArea";
import { ChevronDownIcon, LayoutGridIcon } from "lucide-react";
import { ChevronDownIcon, LayoutGridIcon, TerminalIcon } from "lucide-react";
import { getTerminalHref } from "modules/apps/apps";
import { useAppLink } from "modules/apps/useAppLink";
import {
getTaskApps,
type Task,
type WorkspaceAppWithAgent,
} from "modules/tasks/tasks";
import type React from "react";
import { type FC, useState } from "react";
import { Link as RouterLink } from "react-router";
import {type LinkProps,Link as RouterLink } from "react-router";
import { cn } from "utils/cn";
import { docs } from "utils/docs";
import { TaskAppIFrame } from "./TaskAppIframe";
import { TaskAppIFrame, TaskIframe } from "./TaskAppIframe";

type TaskAppsProps = {
task: Task;
};

const TERMINAL_TAB_ID = "terminal";

export const TaskApps: FC<TaskAppsProps> = ({ task }) => {
const apps = getTaskApps(task).filter(
// The Chat UI app will be displayed in the sidebar, so we don't want to
Expand All@@ -39,6 +41,13 @@ export const TaskApps: FC<TaskAppsProps> = ({ task }) => {
const [activeAppId, setActiveAppId] = useState(embeddedApps.at(0)?.id);
const hasAvailableAppsToDisplay =
embeddedApps.length > 0 || externalApps.length > 0;
const taskAgent = apps.at(0)?.agent;
const terminalHref = getTerminalHref({
username: task.workspace.owner_name,
workspace: task.workspace.name,
agent: taskAgent?.name,
});
const isTerminalActive = activeAppId === TERMINAL_TAB_ID;

return (
<main className="flex flex-col h-full">
Expand All@@ -58,6 +67,17 @@ export const TaskApps: FC<TaskAppsProps> = ({ task }) => {
}}
/>
))}
<TaskTab
to={terminalHref}
active={isTerminalActive}
onClick={(e) => {
e.preventDefault();
setActiveAppId(TERMINAL_TAB_ID);
}}
>
<TerminalIcon />
Terminal
</TaskTab>
</div>
<ScrollBar orientation="horizontal" className="h-2" />
</ScrollArea>
Expand All@@ -78,6 +98,14 @@ export const TaskApps: FC<TaskAppsProps> = ({ task }) => {
task={task}
/>
))}

<TaskIframe
src={terminalHref}
title="Terminal"
className={cn({
hidden: !isTerminalActive,
})}
/>
</div>
) : (
<div className="mx-auto my-auto flex flex-col items-center">
Expand DownExpand Up@@ -161,11 +189,30 @@ const TaskAppTab: FC<TaskAppTabProps> = ({ task, app, active, onClick }) => {
workspace: task.workspace,
});

return (
<TaskTab active={active} to={link.href} onClick={onClick}>
{app.icon ? <ExternalImage src={app.icon} /> : <LayoutGridIcon />}
{link.label}
{app.health === "unhealthy" && (
<InfoTooltip
title="This app is unhealthy."
message="The health check failed."
type="warning"
/>
)}
</TaskTab>
);
};

type TaskTabProps = LinkProps & {
active: boolean;
};

const TaskTab: FC<TaskTabProps> = ({ active, ...routerLinkProps }) => {
return (
<Button
size="sm"
variant="subtle"
key={app.id}
asChild
className={cn([
"px-3",
Expand All@@ -176,17 +223,7 @@ const TaskAppTab: FC<TaskAppTabProps> = ({ task, app, active, onClick }) => {
{ "opacity-75 hover:opacity-100": !active },
])}
>
<RouterLink to={link.href} onClick={onClick}>
{app.icon ? <ExternalImage src={app.icon} /> : <LayoutGridIcon />}
{link.label}
{app.health === "unhealthy" && (
<InfoTooltip
title="This app is unhealthy."
message="The health check failed."
type="warning"
/>
)}
</RouterLink>
<RouterLink {...routerLinkProps} />
</Button>
);
};
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp