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

Commit6bb0599

Browse files
authored
impl: support for Toolbox 2.6.3 (#124)
Toolbox 2.6.3 comes with a couple of new additions in the API which needthe following changes:- finish support for URI handling. The available API up to TBX 2.6.3 wasbuggy in terms of URI handling. It didn't allow plugins toprogrammatically install remote ides and launch them. The launchoperation only worked when the IDE was already installed and a projectwas already opened with the IDE.TBX 2.6.3 adds a new API, _RemoteToolboxHelp_ which provides routinesfor listing the availableIDEs on the remote, what is already installed and a command to installspecific versions of the IDE.Additionally, there were fixes provided to the existing _ClientHelper_which now launches the JBClientif a project was not specified. An additional quirk I've discovered isthat if we provide a project, andthat project was not already opened (present in the Projects tab) theIDE still won't open. And there is no API available to query the available projects. This PR uses the new API to: - query the installed ides - check if the provided ide is in the list of already installed IDEs.- if that's not the case we query the available list of IDEs and theavailable versions- if the provided ide and build no., is in the available list we willschedule it for install- if not, we select the latest available build number for the providedproduct code. - wait for the remote IDE to be installed- and then download and launch the JBClient with a project path if itwas provided.- update the minimum API requirement. Toolbox API is upgraded to1.1.41749 which comes with new API additions and some deprecations.Kotlin stdlib was also increased to a newer patch version- use new environment state API. The _CustomRemoteEnvironmentState_ isdeprecated, and replaced by a new class _CustomRemoteEnvironmentStateV2_which now supports i18n state labels- use the new ssh disconnect callback. Toolbox provides two callbacks,one before an SSH connection is established and another one whichexecutes when the ssh connection is stopped. The latter was deprecatedin the favor of a new callback that also provides hints on whether theuser requested the disconnect.- use the new delete callback API. Toolbox provides a callback forscenarios that involve the env. deletion. This allows plugins to reactand clean the internal state. With the new TBX API, the delete callbackAPI is deprecated in the favor of a mutable state flow, a reactiveapproach that allows consumers to observe and react to state changesover time.
1 parent09ecfcf commit6bb0599

File tree

16 files changed

+449
-342
lines changed

16 files changed

+449
-342
lines changed

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
##Unreleased
44

5+
###Added
6+
7+
- support for Toolbox 2.6.3 with improved URI handling
8+
59
##0.2.3 - 2025-05-26
610

711
###Changed

‎README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ If `ide_product_code` and `ide_build_number` is missing, Toolbox will only open
101101
page. Coder Toolbox will attempt to start the workspace if it’s not already running; however, for the most reliable
102102
experience, it’s recommended to ensure the workspace is running prior to initiating the connection.
103103

104+
>⚠️ Note:`folder` should point to a remote IDEA project that has already been opened and appears in the`Projects` tab.
105+
>If the path refers to a project that doesn't exist, the remote IDE won’t start or load it.
106+
107+
>Until[TBX-14952](https://youtrack.jetbrains.com/issue/TBX-14952/) is fixed, it's best to either use a path to a previously opened project or leave it empty.
108+
104109
##Configuring and Testing workspace polling with HTTP & SOCKS5 Proxy
105110

106111
This section explains how to set up a local proxy (without authentication which is not yet supported) and verify that

‎gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=0.2.3
1+
version=0.3.0
22
group=com.coder.toolbox
33
name=coder-toolbox

‎gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
2-
toolbox-plugin-api ="1.0.38881"
3-
kotlin ="2.1.0"
2+
toolbox-plugin-api ="1.1.41749"
3+
kotlin ="2.1.10"
44
coroutines ="1.10.1"
55
serialization ="1.8.0"
66
okhttp ="4.12.0"
@@ -9,7 +9,7 @@ marketplace-client = "2.0.46"
99
gradle-wrapper ="0.14.0"
1010
exec ="1.12"
1111
moshi ="1.15.2"
12-
ksp ="2.1.0-1.0.29"
12+
ksp ="2.1.10-1.0.31"
1313
retrofit ="2.11.0"
1414
changelog ="2.2.1"
1515
gettext ="0.7.0"

‎src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import com.squareup.moshi.Moshi
2727
importkotlinx.coroutines.Job
2828
importkotlinx.coroutines.delay
2929
importkotlinx.coroutines.flow.MutableStateFlow
30+
importkotlinx.coroutines.flow.StateFlow
3031
importkotlinx.coroutines.flow.update
3132
importkotlinx.coroutines.isActive
3233
importkotlinx.coroutines.launch
@@ -203,7 +204,7 @@ class CoderRemoteEnvironment(
203204

204205
privatefun File.doesNotExists():Boolean=!this.exists()
205206

206-
overridefunafterDisconnect() {
207+
overridefunafterDisconnect(isManual:Boolean) {
207208
context.logger.info("Stopping the network metrics poll job for$id")
208209
pollJob?.cancel()
209210
this.connectionRequest.update {false }
@@ -269,7 +270,7 @@ class CoderRemoteEnvironment(
269270
}
270271
}
271272

272-
overridefunonDelete() {
273+
overrideval deleteActionFlow:StateFlow<(()->Unit)?>=MutableStateFlow {
273274
context.cs.launch {
274275
try {
275276
client.removeWorkspace(workspace)

‎src/main/kotlin/com/coder/toolbox/CoderToolboxContext.kt

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ import com.jetbrains.toolbox.api.core.diagnostics.Logger
77
importcom.jetbrains.toolbox.api.core.os.LocalDesktopManager
88
importcom.jetbrains.toolbox.api.localization.LocalizableStringFactory
99
importcom.jetbrains.toolbox.api.remoteDev.connection.ClientHelper
10+
importcom.jetbrains.toolbox.api.remoteDev.connection.RemoteToolsHelper
1011
importcom.jetbrains.toolbox.api.remoteDev.connection.ToolboxProxySettings
1112
importcom.jetbrains.toolbox.api.remoteDev.states.EnvironmentStateColorPalette
1213
importcom.jetbrains.toolbox.api.remoteDev.ui.EnvironmentUiPageManager
1314
importcom.jetbrains.toolbox.api.ui.ToolboxUi
1415
importkotlinx.coroutines.CoroutineScope
1516
importjava.net.URL
17+
importjava.util.UUID
1618

19+
@Suppress("UnstableApiUsage")
1720
data classCoderToolboxContext(
1821
valui:ToolboxUi,
1922
valenvPageManager:EnvironmentUiPageManager,
2023
valenvStateColorPalette:EnvironmentStateColorPalette,
21-
valideOrchestrator:ClientHelper,
24+
valremoteIdeOrchestrator:RemoteToolsHelper,
25+
valjbClientOrchestrator:ClientHelper,
2226
valdesktop:LocalDesktopManager,
2327
valcs:CoroutineScope,
2428
vallogger:Logger,
@@ -44,4 +48,44 @@ data class CoderToolboxContext(
4448
}
4549
returnthis.settingsStore.defaultURL.toURL()
4650
}
51+
52+
suspendfunlogAndShowError(title:String,error:String) {
53+
logger.error(error)
54+
ui.showSnackbar(
55+
UUID.randomUUID().toString(),
56+
i18n.pnotr(title),
57+
i18n.pnotr(error),
58+
i18n.ptrl("OK")
59+
)
60+
}
61+
62+
suspendfunlogAndShowError(title:String,error:String,exception:Exception) {
63+
logger.error(exception, error)
64+
ui.showSnackbar(
65+
UUID.randomUUID().toString(),
66+
i18n.pnotr(title),
67+
i18n.pnotr(error),
68+
i18n.ptrl("OK")
69+
)
70+
}
71+
72+
suspendfunlogAndShowWarning(title:String,warning:String) {
73+
logger.warn(warning)
74+
ui.showSnackbar(
75+
UUID.randomUUID().toString(),
76+
i18n.pnotr(title),
77+
i18n.pnotr(warning),
78+
i18n.ptrl("OK")
79+
)
80+
}
81+
82+
suspendfunlogAndShowInfo(title:String,info:String) {
83+
logger.info(info)
84+
ui.showSnackbar(
85+
UUID.randomUUID().toString(),
86+
i18n.pnotr(title),
87+
i18n.pnotr(info),
88+
i18n.ptrl("OK")
89+
)
90+
}
4791
}

‎src/main/kotlin/com/coder/toolbox/CoderToolboxExtension.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.jetbrains.toolbox.api.localization.LocalizableStringFactory
1313
importcom.jetbrains.toolbox.api.remoteDev.RemoteDevExtension
1414
importcom.jetbrains.toolbox.api.remoteDev.RemoteProvider
1515
importcom.jetbrains.toolbox.api.remoteDev.connection.ClientHelper
16+
importcom.jetbrains.toolbox.api.remoteDev.connection.RemoteToolsHelper
1617
importcom.jetbrains.toolbox.api.remoteDev.connection.ToolboxProxySettings
1718
importcom.jetbrains.toolbox.api.remoteDev.states.EnvironmentStateColorPalette
1819
importcom.jetbrains.toolbox.api.remoteDev.ui.EnvironmentUiPageManager
@@ -31,6 +32,7 @@ class CoderToolboxExtension : RemoteDevExtension {
3132
serviceLocator.getService<ToolboxUi>(),
3233
serviceLocator.getService<EnvironmentUiPageManager>(),
3334
serviceLocator.getService<EnvironmentStateColorPalette>(),
35+
serviceLocator.getService<RemoteToolsHelper>(),
3436
serviceLocator.getService<ClientHelper>(),
3537
serviceLocator.getService<LocalDesktopManager>(),
3638
serviceLocator.getService<CoroutineScope>(),

‎src/main/kotlin/com/coder/toolbox/models/WorkspaceAndAgentStatus.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import com.coder.toolbox.sdk.v2.models.WorkspaceAgentLifecycleState
77
importcom.coder.toolbox.sdk.v2.models.WorkspaceAgentStatus
88
importcom.coder.toolbox.sdk.v2.models.WorkspaceStatus
99
importcom.jetbrains.toolbox.api.core.ui.color.StateColor
10-
importcom.jetbrains.toolbox.api.remoteDev.states.CustomRemoteEnvironmentState
10+
importcom.jetbrains.toolbox.api.remoteDev.states.CustomRemoteEnvironmentStateV2
1111
importcom.jetbrains.toolbox.api.remoteDev.states.EnvironmentStateIcons
1212
importcom.jetbrains.toolbox.api.remoteDev.states.StandardRemoteEnvironmentState
1313

@@ -61,9 +61,9 @@ enum class WorkspaceAndAgentStatus(val label: String, val description: String) {
6161
* Note that a reachable environment will always display "connected" or
6262
* "disconnected" regardless of the label we give that status.
6363
*/
64-
funtoRemoteEnvironmentState(context:CoderToolboxContext):CustomRemoteEnvironmentState {
65-
returnCustomRemoteEnvironmentState(
66-
label,
64+
funtoRemoteEnvironmentState(context:CoderToolboxContext):CustomRemoteEnvironmentStateV2 {
65+
returnCustomRemoteEnvironmentStateV2(
66+
context.i18n.pnotr(label),
6767
color= getStateColor(context),
6868
reachable= ready()|| unhealthy(),
6969
// TODO@JB: How does this work? Would like a spinner for pending states.
@@ -90,10 +90,10 @@ enum class WorkspaceAndAgentStatus(val label: String, val description: String) {
9090
elseEnvironmentStateIcons.NoIcon
9191
}
9292

93-
funtoSshConnectingEnvState(context:CoderToolboxContext):CustomRemoteEnvironmentState {
93+
funtoSshConnectingEnvState(context:CoderToolboxContext):CustomRemoteEnvironmentStateV2 {
9494
val existingState= toRemoteEnvironmentState(context)
95-
returnCustomRemoteEnvironmentState(
96-
"SSHing",
95+
returnCustomRemoteEnvironmentStateV2(
96+
context.i18n.pnotr("SSHing"),
9797
existingState.color,
9898
existingState.isReachable,
9999
EnvironmentStateIcons.Connecting

‎src/main/kotlin/com/coder/toolbox/sdk/CoderRestClient.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ open class CoderRestClient(
192192
}
193193

194194
/**
195-
* Maps thelist of workspaces to the associated agents.
195+
* Maps theavailable workspaces to the associated agents.
196196
*/
197-
suspendfungroupByAgents(workspaces:List<Workspace>):Set<Pair<Workspace,WorkspaceAgent>> {
197+
suspendfunworkspacesByAgents():Set<Pair<Workspace,WorkspaceAgent>> {
198198
// It is possible for there to be resources with duplicate names so we
199199
// need to use a set.
200-
return workspaces.flatMap { ws->
200+
return workspaces().flatMap { ws->
201201
when (ws.latestBuild.status) {
202202
WorkspaceStatus.RUNNING-> ws.latestBuild.resources
203203
else-> resources(ws)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp