Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 6 additions & 11 deletions site/src/modules/resources/AgentDevcontainerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import {
HelpTooltipTitle,
HelpTooltipTrigger,
} from "components/HelpTooltip/HelpTooltip";
import { Spinner } from "components/Spinner/Spinner";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "components/Tooltip/Tooltip";
import { ExternalLinkIcon, Loader2Icon } from "lucide-react";
import { ExternalLinkIcon } from "lucide-react";
import type { FC } from "react";
import { useEffect, useState } from "react";
import { portForwardURL } from "utils/portForward";
Expand Down Expand Up @@ -95,7 +96,8 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
<header className="flex justify-between items-center mb-4">
<div className="flex items-center gap-2">
<h3 className="m-0 text-xs font-medium text-content-secondary">
{container.name}
dev container:{" "}
<span className="font-semibold">{container.name}</span>
</h3>
{container.devcontainer_dirty && (
<HelpTooltip>
Expand All @@ -117,18 +119,11 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
<Button
variant="outline"
size="sm"
className="text-xs font-medium"
onClick={handleRecreateDevcontainer}
disabled={isRecreating}
>
{isRecreating ? (
<>
<Loader2Icon className="mr-2 h-4 w-4 animate-spin" />
Recreating...
</>
) : (
"Recreate"
)}
<Spinner loading={isRecreating} />
Recreate
</Button>

<AgentDevcontainerSSHButton
Expand Down
8 changes: 8 additions & 0 deletions site/src/modules/resources/AgentRow.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,11 @@ export const GroupApp: Story = {
await userEvent.click(canvas.getByText("group"));
},
};

export const Devcontainer: Story = {
beforeEach: () => {
spyOn(API, "getAgentContainers").mockResolvedValue({
containers: [M.MockWorkspaceAgentContainer],
});
},
};
35 changes: 27 additions & 8 deletions site/src/modules/resources/AgentRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Interpolation, Theme } from "@emotion/react";
import Button from "@mui/material/Button";
import Collapse from "@mui/material/Collapse";
import Divider from "@mui/material/Divider";
import Skeleton from "@mui/material/Skeleton";
Expand All @@ -12,6 +11,7 @@ import type {
WorkspaceApp,
} from "api/typesGenerated";
import { isAxiosError } from "axios";
import { Button } from "components/Button/Button";
import { DropdownArrow } from "components/DropdownArrow/DropdownArrow";
import {
DropdownMenu,
Expand Down Expand Up @@ -71,7 +71,7 @@ export const AgentRow: FC<AgentRowProps> = ({
const appSections = organizeAgentApps(agent.apps);
const hasAppsToDisplay =
!browser_only || appSections.some((it) => it.apps.length > 0);
const shouldDisplayApps =
const shouldDisplayAgentApps =
(agent.status === "connected" && hasAppsToDisplay) ||
agent.status === "connecting";
const hasVSCodeApp =
Expand Down Expand Up @@ -160,6 +160,14 @@ export const AgentRow: FC<AgentRowProps> = ({
},
});

// This is used to show the parent apps of the devcontainer.
const [showParentApps, setShowParentApps] = useState(false);

let shouldDisplayAppsSection = shouldDisplayAgentApps;
if (containers && containers.length > 0 && !showParentApps) {
shouldDisplayAppsSection = false;
}

return (
<Stack
key={agent.id}
Expand Down Expand Up @@ -191,7 +199,18 @@ export const AgentRow: FC<AgentRowProps> = ({
)}
</div>

<div css={{ display: "flex" }}>
<div className="flex items-center gap-2">
{containers && containers.length > 0 && (
<Button
variant="outline"
size="sm"
onClick={() => setShowParentApps((show) => !show)}
>
Show parent apps
<DropdownArrow close={showParentApps} margin={false} />
</Button>
)}

{!browser_only && agent.display_apps.includes("ssh_helper") && (
<AgentSSHButton
workspaceName={workspace.name}
Expand All @@ -218,9 +237,9 @@ export const AgentRow: FC<AgentRowProps> = ({
</section>
)}

{agent.status === "connected" && (
{shouldDisplayAppsSection && (
<section css={styles.apps}>
{shouldDisplayApps && (
{shouldDisplayAgentApps && (
<>
{showVSCode && (
<VSCodeDesktopButton
Expand Down Expand Up @@ -319,11 +338,11 @@ export const AgentRow: FC<AgentRowProps> = ({

<Stack css={{ padding: "12px 16px" }} direction="row" spacing={1}>
<Button
variant="text"
size="small"
startIcon={<DropdownArrow close={showLogs} margin={false} />}
size="sm"
variant="subtle"
onClick={() => setShowLogs((v) => !v)}
>
<DropdownArrow close={showLogs} margin={false} />
Logs
</Button>
<Divider orientation="vertical" variant="middle" flexItem />
Expand Down
8 changes: 2 additions & 6 deletions site/src/modules/resources/SSHButton/SSHButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@ export const AgentSSHButton: FC<AgentSSHButtonProps> = ({
return (
<Popover>
<PopoverTrigger>
<Button
size="sm"
variant="subtle"
css={{ fontSize: 13, padding: "8px 12px" }}
>
<Button size="sm" variant="subtle">
Connect via SSH
<ChevronDownIcon className="size-4 ml-2" />
<ChevronDownIcon />
</Button>
</PopoverTrigger>

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy