Skip to content

feature: Add setting to remove/set custom workspace filter for connections view. #490

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
resolve asher's comments
  • Loading branch information
bcpeinhardt committed Oct 3, 2024
commit 4268bbf705de6be2be6e92e4a5db22a879828ae5
13 changes: 12 additions & 1 deletion src/main/kotlin/com/coder/gateway/cli/CoderCLIManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
.plus("\n")
.plus(
"""
Host ${getHostName(deploymentURL, it.first, currentUser, it.second)}--bg
Host ${getBackgroundHostName(deploymentURL, it.first, currentUser, it.second)}
ProxyCommand ${backgroundProxyArgs.joinToString(" ")} ${getWorkspaceParts(it.first, it.second)}
ConnectTimeout 0
StrictHostKeyChecking no
Expand Down Expand Up @@ -493,12 +493,23 @@
currentUser: User,
agent: WorkspaceAgent,
): String =
// For a user's own workspace, we use the old syntax without a username for backwards compatibility,
// since the user might have recent connections that still use the old syntax.
if (currentUser.username == workspace.ownerName) {
"coder-jetbrains--${workspace.name}.${agent.name}--${url.safeHost()}"
} else {
"coder-jetbrains--${workspace.ownerName}--${workspace.name}.${agent.name}--${url.safeHost()}"
}

fun getBackgroundHostName(
url: URL,
workspace: Workspace,
currentUser: User,
agent: WorkspaceAgent,
): String {
return getHostName(url, workspace, currentUser, agent) + "--bg"
}


/**
* This function returns the identifier for the workspace to pass to the
Expand All @@ -513,6 +524,6 @@
@JvmStatic
fun getBackgroundHostName(
hostname: String,
): String = hostname + "--bg"

Check notice on line 527 in src/main/kotlin/com/coder/gateway/cli/CoderCLIManager.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

String concatenation that can be converted to string template

'String' concatenation can be converted to a template
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class CoderWorkspaceProjectIDEStepView(
} else {
IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.connect-ssh"))
}
val executor = createRemoteExecutor(CoderCLIManager.getHostName(data.client.url, data.workspace, data.client.me, data.agent) + "--bg")
val executor = createRemoteExecutor(CoderCLIManager.getBackgroundHostName(data.client.url, data.workspace, data.client.me, data.agent))

if (ComponentValidator.getInstance(tfProject).isEmpty) {
logger.info("Installing remote path validator...")
Expand Down
Loading