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

Commit2ecf1df

Browse files
committed
support stopped workspaces
1 parenta65e550 commit2ecf1df

File tree

1 file changed

+28
-31
lines changed

1 file changed

+28
-31
lines changed

‎src/commands.ts

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -397,20 +397,13 @@ export class Commands {
397397
thrownewError("You are not logged in")
398398
}
399399

400-
constagent=treeItem.workspaceAgent
401-
if(!agent){
402-
// `openFromSidebar` is only callable on agents or single-agent workspaces,
403-
// where this will always be set.
404-
return
405-
}
406-
407400
try{
408401
awaitopenWorkspace(
409402
this.restClient,
410403
baseUrl,
411404
treeItem.workspaceOwner,
412405
treeItem.workspaceName,
413-
agent,
406+
treeItem.workspaceAgent,
414407
treeItem.workspaceFolderPath,
415408
true,
416409
)
@@ -592,37 +585,41 @@ async function openWorkspace(
592585
baseUrl:string,
593586
workspaceOwner:string,
594587
workspaceName:string,
595-
workspaceAgent:string,
588+
workspaceAgent:string|undefined,
596589
folderPath:string|undefined,
597590
openRecent:boolean|undefined,
598591
){
599592
letremoteAuthority=toRemoteAuthority(baseUrl,workspaceOwner,workspaceName,workspaceAgent)
600593

601-
lethostnameSuffix="coder"
602-
try{
603-
constsshConfig=awaitrestClient.getDeploymentSSHConfig()
604-
// If the field is undefined, it's an older server, and always 'coder'
605-
hostnameSuffix=sshConfig.hostname_suffix??hostnameSuffix
606-
}catch(error){
607-
if(!isAxiosError(error)){
608-
throwerror
609-
}
610-
switch(error.response?.status){
611-
case404:{
612-
// Likely a very old deployment, just use the default.
613-
break
614-
}
615-
case401:{
594+
// When called from `openFromSidebar`, the workspaceAgent will only not be set
595+
// if the workspace is stopped, in which case we can't use Coder Connect
596+
// When called from `open`, the workspaceAgent will always be set.
597+
if(workspaceAgent){
598+
lethostnameSuffix="coder"
599+
try{
600+
constsshConfig=awaitrestClient.getDeploymentSSHConfig()
601+
// If the field is undefined, it's an older server, and always 'coder'
602+
hostnameSuffix=sshConfig.hostname_suffix??hostnameSuffix
603+
}catch(error){
604+
if(!isAxiosError(error)){
616605
throwerror
617606
}
618-
default:
619-
throwerror
607+
switch(error.response?.status){
608+
case404:{
609+
// Likely a very old deployment, just use the default.
610+
break
611+
}
612+
case401:{
613+
throwerror
614+
}
615+
default:
616+
throwerror
617+
}
618+
}
619+
constcoderConnectAddr=awaitmaybeCoderConnectAddr(workspaceAgent,workspaceName,workspaceOwner,hostnameSuffix)
620+
if(coderConnectAddr){
621+
remoteAuthority=`ssh-remote+${coderConnectAddr}`
620622
}
621-
}
622-
623-
constcoderConnectAddr=awaitmaybeCoderConnectAddr(workspaceAgent,workspaceName,workspaceOwner,hostnameSuffix)
624-
if(coderConnectAddr){
625-
remoteAuthority=`ssh-remote+${coderConnectAddr}`
626623
}
627624

628625
letnewWindow=true

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp