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

Commitc9f4ca4

Browse files
committed
ui-wip
1 parente0e8bfd commitc9f4ca4

File tree

4 files changed

+48
-29
lines changed

4 files changed

+48
-29
lines changed

‎site/src/api/typesGenerated.ts

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

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

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
importtype{
2+
Template,
23
Workspace,
34
WorkspaceAgent,
45
WorkspaceAgentDevcontainer,
@@ -30,12 +31,16 @@ import {
3031
}from"./SSHButton/SSHButton";
3132
import{TerminalLink}from"./TerminalLink/TerminalLink";
3233
import{VSCodeDevContainerButton}from"./VSCodeDevContainerButton/VSCodeDevContainerButton";
34+
import{useFeatureVisibility}from"modules/dashboard/useFeatureVisibility";
35+
import{useProxy}from"contexts/ProxyContext";
36+
import{PortForwardButton}from"./PortForwardButton";
3337

3438
typeAgentDevcontainerCardProps={
3539
parentAgent:WorkspaceAgent;
3640
subAgents:WorkspaceAgent[];
3741
devcontainer:WorkspaceAgentDevcontainer;
3842
workspace:Workspace;
43+
template:Template;
3944
wildcardHostname:string;
4045
};
4146

@@ -44,10 +49,13 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
4449
subAgents,
4550
devcontainer,
4651
workspace,
52+
template,
4753
wildcardHostname,
4854
})=>{
55+
const{ browser_only}=useFeatureVisibility();
56+
const{ proxy}=useProxy();
57+
4958
const[isRecreating,setIsRecreating]=useState(false);
50-
const[subAgent,setSubAgent]=useState<WorkspaceAgent|null>(null);
5159

5260
consthandleRecreateDevcontainer=async()=>{
5361
setIsRecreating(true);
@@ -83,24 +91,24 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
8391
}
8492
};
8593

94+
constsubAgent=subAgents.find((sub)=>sub.id===devcontainer.agent?.id);
95+
constshouldDisplaySubAgentApps=
96+
subAgent?.status==="connected"||subAgent?.status==="connecting";
97+
8698
// If the devcontainer is starting, reflect this in the recreate button.
8799
useEffect(()=>{
100+
console.log(
101+
"Devcontainer status:",
102+
devcontainer.status,
103+
"Sub agent status:",
104+
subAgent?.status,
105+
);
88106
if(devcontainer.status==="starting"){
89107
setIsRecreating(true);
90108
}else{
91109
setIsRecreating(false);
92110
}
93-
},[devcontainer.id,devcontainer.status]);
94-
95-
constshouldDisplayAgentApps=
96-
subAgent?.status==="connected"||subAgent?.status==="connecting";
97-
98-
// Woot! We have a sub agent, so we can display the forwarded ports.
99-
useEffect(()=>{
100-
setSubAgent(
101-
subAgents.find((sub)=>sub.id===devcontainer.agent?.id)||null,
102-
);
103-
},[subAgents,devcontainer.agent?.id]);
111+
},[devcontainer]);
104112

105113
return(
106114
<section
@@ -148,26 +156,41 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
148156
Recreate
149157
</Button>
150158

151-
{subAgent&&subAgent.display_apps.includes("ssh_helper")&&(
152-
<AgentSSHButton
153-
workspaceName={workspace.name}
154-
agentName={subAgent.name}
155-
workspaceOwnerUsername={workspace.owner_name}
156-
/>
157-
)}
159+
{shouldDisplaySubAgentApps&&
160+
!browser_only&&
161+
// TODO(mafredri): We could use subAgent display apps here but we currently set none.
162+
parentAgent.display_apps.includes("ssh_helper")&&(
163+
<AgentSSHButton
164+
workspaceName={workspace.name}
165+
agentName={subAgent.name}
166+
workspaceOwnerUsername={workspace.owner_name}
167+
/>
168+
)}
169+
170+
{shouldDisplaySubAgentApps&&
171+
proxy.preferredWildcardHostname===""&&
172+
// TODO(mafredri): We could use subAgent display apps here but we currently set none.
173+
parentAgent.display_apps.includes("port_forwarding_helper")&&(
174+
<PortForwardButton
175+
host={proxy.preferredWildcardHostname}
176+
workspace={workspace}
177+
agent={subAgent}
178+
template={template}
179+
/>
180+
)}
158181
</div>
159182
</header>
160183

161-
{subAgent&&devcontainer.container&&(
184+
{shouldDisplaySubAgentApps&&devcontainer.container&&(
162185
<>
163186
<h4className="m-0 text-xl font-semibold mb-2">Forwarded ports</h4>
164187
<divclassName="flex gap-4 flex-wrap mt-4">
165188
<VSCodeDevContainerButton
166189
userName={workspace.owner_name}
167190
workspaceName={workspace.name}
168191
devContainerName={devcontainer.container.name}
169-
devContainerFolder={subAgent.directory??""}// This will always be set.
170-
displayApps={subAgent.display_apps}
192+
devContainerFolder={subAgent.directory??"/"}// This will always be set on subagents but provide fallback anyway.
193+
displayApps={parentAgent.display_apps}// TODO(mafredri): We could use subAgent display apps here but we currently set none.
171194
agentName={parentAgent.name}
172195
/>
173196

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ export const AgentRow: FC<AgentRowProps> = ({
294294
key={devcontainer.id}
295295
devcontainer={devcontainer}
296296
workspace={workspace}
297+
template={template}
297298
wildcardHostname={proxy.preferredWildcardHostname}
298299
parentAgent={agent}
299300
subAgents={subAgents??[]}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ export const VSCodeDevContainerButton: FC<VSCodeDevContainerButtonProps> = (
101101
</>
102102
) :includesVSCodeDesktop ?(
103103
<VSCodeButton{...props}/>
104-
) :(
104+
) :includesVSCodeInsiders ?(
105105
<VSCodeInsidersButton{...props}/>
106-
);
106+
) :null;
107107
};
108108

109109
constVSCodeButton:FC<VSCodeDevContainerButtonProps>=({

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp