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

Commit00502dc

Browse files
feat: hide parent apps on devcontainer agents (#18120)
**Demo:**https://github.com/user-attachments/assets/d68cbc33-5199-426b-8f97-35ee1c3ae133
1 parent696d264 commit00502dc

File tree

4 files changed

+43
-25
lines changed

4 files changed

+43
-25
lines changed

‎site/src/modules/resources/AgentDevcontainerCard.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import {
1212
HelpTooltipTitle,
1313
HelpTooltipTrigger,
1414
}from"components/HelpTooltip/HelpTooltip";
15+
import{Spinner}from"components/Spinner/Spinner";
1516
import{
1617
Tooltip,
1718
TooltipContent,
1819
TooltipProvider,
1920
TooltipTrigger,
2021
}from"components/Tooltip/Tooltip";
21-
import{ExternalLinkIcon,Loader2Icon}from"lucide-react";
22+
import{ExternalLinkIcon}from"lucide-react";
2223
importtype{FC}from"react";
2324
import{useEffect,useState}from"react";
2425
import{portForwardURL}from"utils/portForward";
@@ -95,7 +96,8 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
9596
<headerclassName="flex justify-between items-center mb-4">
9697
<divclassName="flex items-center gap-2">
9798
<h3className="m-0 text-xs font-medium text-content-secondary">
98-
{container.name}
99+
dev container:{" "}
100+
<spanclassName="font-semibold">{container.name}</span>
99101
</h3>
100102
{container.devcontainer_dirty&&(
101103
<HelpTooltip>
@@ -117,18 +119,11 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
117119
<Button
118120
variant="outline"
119121
size="sm"
120-
className="text-xs font-medium"
121122
onClick={handleRecreateDevcontainer}
122123
disabled={isRecreating}
123124
>
124-
{isRecreating ?(
125-
<>
126-
<Loader2IconclassName="mr-2 h-4 w-4 animate-spin"/>
127-
Recreating...
128-
</>
129-
) :(
130-
"Recreate"
131-
)}
125+
<Spinnerloading={isRecreating}/>
126+
Recreate
132127
</Button>
133128

134129
<AgentDevcontainerSSHButton

‎site/src/modules/resources/AgentRow.stories.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,11 @@ export const GroupApp: Story = {
284284
awaituserEvent.click(canvas.getByText("group"));
285285
},
286286
};
287+
288+
exportconstDevcontainer:Story={
289+
beforeEach:()=>{
290+
spyOn(API,"getAgentContainers").mockResolvedValue({
291+
containers:[M.MockWorkspaceAgentContainer],
292+
});
293+
},
294+
};

‎site/src/modules/resources/AgentRow.tsx

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
importtype{Interpolation,Theme}from"@emotion/react";
2-
importButtonfrom"@mui/material/Button";
32
importCollapsefrom"@mui/material/Collapse";
43
importDividerfrom"@mui/material/Divider";
54
importSkeletonfrom"@mui/material/Skeleton";
@@ -12,6 +11,7 @@ import type {
1211
WorkspaceApp,
1312
}from"api/typesGenerated";
1413
import{isAxiosError}from"axios";
14+
import{Button}from"components/Button/Button";
1515
import{DropdownArrow}from"components/DropdownArrow/DropdownArrow";
1616
import{
1717
DropdownMenu,
@@ -71,7 +71,7 @@ export const AgentRow: FC<AgentRowProps> = ({
7171
constappSections=organizeAgentApps(agent.apps);
7272
consthasAppsToDisplay=
7373
!browser_only||appSections.some((it)=>it.apps.length>0);
74-
constshouldDisplayApps=
74+
constshouldDisplayAgentApps=
7575
(agent.status==="connected"&&hasAppsToDisplay)||
7676
agent.status==="connecting";
7777
consthasVSCodeApp=
@@ -160,6 +160,14 @@ export const AgentRow: FC<AgentRowProps> = ({
160160
},
161161
});
162162

163+
// This is used to show the parent apps of the devcontainer.
164+
const[showParentApps,setShowParentApps]=useState(false);
165+
166+
letshouldDisplayAppsSection=shouldDisplayAgentApps;
167+
if(containers&&containers.length>0&&!showParentApps){
168+
shouldDisplayAppsSection=false;
169+
}
170+
163171
return(
164172
<Stack
165173
key={agent.id}
@@ -191,7 +199,18 @@ export const AgentRow: FC<AgentRowProps> = ({
191199
)}
192200
</div>
193201

194-
<divcss={{display:"flex"}}>
202+
<divclassName="flex items-center gap-2">
203+
{containers&&containers.length>0&&(
204+
<Button
205+
variant="outline"
206+
size="sm"
207+
onClick={()=>setShowParentApps((show)=>!show)}
208+
>
209+
Show parent apps
210+
<DropdownArrowclose={showParentApps}margin={false}/>
211+
</Button>
212+
)}
213+
195214
{!browser_only&&agent.display_apps.includes("ssh_helper")&&(
196215
<AgentSSHButton
197216
workspaceName={workspace.name}
@@ -218,9 +237,9 @@ export const AgentRow: FC<AgentRowProps> = ({
218237
</section>
219238
)}
220239

221-
{agent.status==="connected"&&(
240+
{shouldDisplayAppsSection&&(
222241
<sectioncss={styles.apps}>
223-
{shouldDisplayApps&&(
242+
{shouldDisplayAgentApps&&(
224243
<>
225244
{showVSCode&&(
226245
<VSCodeDesktopButton
@@ -319,11 +338,11 @@ export const AgentRow: FC<AgentRowProps> = ({
319338

320339
<Stackcss={{padding:"12px 16px"}}direction="row"spacing={1}>
321340
<Button
322-
variant="text"
323-
size="small"
324-
startIcon={<DropdownArrowclose={showLogs}margin={false}/>}
341+
size="sm"
342+
variant="subtle"
325343
onClick={()=>setShowLogs((v)=>!v)}
326344
>
345+
<DropdownArrowclose={showLogs}margin={false}/>
327346
Logs
328347
</Button>
329348
<Dividerorientation="vertical"variant="middle"flexItem/>

‎site/src/modules/resources/SSHButton/SSHButton.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,9 @@ export const AgentSSHButton: FC<AgentSSHButtonProps> = ({
3535
return(
3636
<Popover>
3737
<PopoverTrigger>
38-
<Button
39-
size="sm"
40-
variant="subtle"
41-
css={{fontSize:13,padding:"8px 12px"}}
42-
>
38+
<Buttonsize="sm"variant="subtle">
4339
Connect via SSH
44-
<ChevronDownIconclassName="size-4 ml-2"/>
40+
<ChevronDownIcon/>
4541
</Button>
4642
</PopoverTrigger>
4743

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp