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

Commit49d3b8b

Browse files
committed
impl: bump plugin API version to o.6
1 parent102fdab commit49d3b8b

File tree

7 files changed

+22
-48
lines changed

7 files changed

+22
-48
lines changed

‎gradle/libs.versions.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
toolbox-plugin-api ="0.2"
2+
toolbox-plugin-api ="0.6.2.6.0.37447"
33
kotlin ="2.0.10"
44
coroutines ="1.7.3"
55
serialization ="1.5.0"

‎src/main/kotlin/com/coder/gateway/CoderGatewayExtension.kt‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import com.jetbrains.toolbox.api.remoteDev.RemoteDevExtension
77
importcom.jetbrains.toolbox.api.remoteDev.RemoteEnvironmentConsumer
88
importcom.jetbrains.toolbox.api.remoteDev.RemoteProvider
99
importcom.jetbrains.toolbox.api.ui.ToolboxUi
10-
importcom.jetbrains.toolbox.api.ui.observables.ObservablePropertiesFactory
1110
importkotlinx.coroutines.CoroutineScope
1211
importokhttp3.OkHttpClient
1312

@@ -16,13 +15,14 @@ import okhttp3.OkHttpClient
1615
*/
1716
classCoderGatewayExtension :RemoteDevExtension {
1817
// All services must be passed in here and threaded as necessary.
19-
overridefuncreateRemoteProviderPluginInstance(serviceLocator:ServiceLocator):RemoteProvider=CoderRemoteProvider(
20-
serviceLocator.getService(OkHttpClient::class.java),
21-
serviceLocator.getService(RemoteEnvironmentConsumer::class.java),
22-
serviceLocator.getService(CoroutineScope::class.java),
23-
serviceLocator.getService(ToolboxUi::class.java),
24-
serviceLocator.getService(PluginSettingsStore::class.java),
25-
serviceLocator.getService(PluginSecretStore::class.java),
26-
serviceLocator.getService(ObservablePropertiesFactory::class.java),
27-
)
18+
overridefuncreateRemoteProviderPluginInstance(serviceLocator:ServiceLocator):RemoteProvider {
19+
returnCoderRemoteProvider(
20+
serviceLocator.getService(OkHttpClient::class.java),
21+
serviceLocator.getService(RemoteEnvironmentConsumer::class.java),
22+
serviceLocator.getService(CoroutineScope::class.java),
23+
serviceLocator.getService(ToolboxUi::class.java),
24+
serviceLocator.getService(PluginSettingsStore::class.java),
25+
serviceLocator.getService(PluginSecretStore::class.java),
26+
)
27+
}
2828
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import com.jetbrains.toolbox.api.remoteDev.EnvironmentVisibilityState
1111
importcom.jetbrains.toolbox.api.remoteDev.environments.EnvironmentContentsView
1212
importcom.jetbrains.toolbox.api.remoteDev.states.EnvironmentStateConsumer
1313
importcom.jetbrains.toolbox.api.ui.ToolboxUi
14-
importcom.jetbrains.toolbox.api.ui.observables.ObservablePropertiesFactory
1514
importjava.util.concurrent.CompletableFuture
1615

1716
/**
@@ -24,8 +23,7 @@ class CoderRemoteEnvironment(
2423
privatevarworkspace:Workspace,
2524
privatevaragent:WorkspaceAgent,
2625
privatevalui:ToolboxUi,
27-
observablePropertiesFactory:ObservablePropertiesFactory,
28-
) : AbstractRemoteProviderEnvironment(observablePropertiesFactory) {
26+
) : AbstractRemoteProviderEnvironment() {
2927
overridefungetId():String="${workspace.name}.${agent.name}"
3028
overridefungetName():String="${workspace.name}.${agent.name}"
3129
privatevar status=WorkspaceAndAgentStatus.from(workspace, agent)

‎src/main/kotlin/com/coder/gateway/CoderRemoteProvider.kt‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import com.jetbrains.toolbox.api.ui.ToolboxUi
2626
importcom.jetbrains.toolbox.api.ui.actions.RunnableActionDescription
2727
importcom.jetbrains.toolbox.api.ui.components.AccountDropdownField
2828
importcom.jetbrains.toolbox.api.ui.components.UiPage
29-
importcom.jetbrains.toolbox.api.ui.observables.ObservablePropertiesFactory
3029
importkotlinx.coroutines.CoroutineScope
3130
importkotlinx.coroutines.Job
3231
importkotlinx.coroutines.delay
@@ -46,7 +45,6 @@ class CoderRemoteProvider(
4645
privatevalui:ToolboxUi,
4746
settingsStore:PluginSettingsStore,
4847
secretsStore:PluginSecretStore,
49-
privatevalobservablePropertiesFactory:ObservablePropertiesFactory,
5048
) : RemoteProvider {
5149
privateval logger=LoggerFactory.getLogger(javaClass)
5250

@@ -98,7 +96,7 @@ class CoderRemoteProvider(
9896
it.name
9997
}?.map { agent->
10098
// If we have an environment already, update that.
101-
val env=CoderRemoteEnvironment(client, ws, agent, ui, observablePropertiesFactory)
99+
val env=CoderRemoteEnvironment(client, ws, agent, ui)
102100
lastEnvironments?.firstOrNull { it== env }?.let {
103101
it.update(ws, agent)
104102
it
@@ -122,7 +120,7 @@ class CoderRemoteProvider(
122120
cli.configSsh(newEnvironments.map { it.name }.toSet())
123121
}
124122

125-
consumer.consumeEnvironments(environments)
123+
consumer.consumeEnvironments(environments,true)
126124

127125
lastEnvironments= environments
128126
}catch (_:CancellationException) {
@@ -157,9 +155,7 @@ class CoderRemoteProvider(
157155
overridefungetAccountDropDown():AccountDropdownField? {
158156
val username= client?.me?.username
159157
if (username!=null) {
160-
returnAccountDropdownField(username) {
161-
logout()
162-
}
158+
returnAccountDropdownField(username,Runnable { logout() })
163159
}
164160
returnnull
165161
}
@@ -183,7 +179,7 @@ class CoderRemoteProvider(
183179
pollJob?.cancel()
184180
client=null
185181
lastEnvironments=null
186-
consumer.consumeEnvironments(emptyList())
182+
consumer.consumeEnvironments(emptyList(),true)
187183
}
188184

189185
overridefungetName():String="Coder Gateway"

‎src/main/kotlin/com/coder/gateway/views/CoderPage.kt‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ abstract class CoderPage(
3333
/** Toolbox uses this to show notifications on the page.*/
3434
privatevar notifier:Consumer<Throwable>?=null
3535

36-
/** Used to get field values.*/
37-
privatevar stateAccessor:UiPage.UiFieldStateAccessor?=null
38-
3936
/** Let Toolbox know the fields should be updated.*/
4037
protectedvar listener:Consumer<UiField?>?=null
4138

@@ -71,19 +68,9 @@ abstract class CoderPage(
7168
* to be able to do `myField.value`.
7269
*/
7370
funget(field:UiField):Any? {
74-
return stateAccessor?.get(field)
75-
}
76-
77-
/**
78-
* Used to update fields when they change (like validation fields).
79-
*/
80-
overridefunsetPageChangedListener(listener:Consumer<UiField?>) {
81-
this.listener= listener
82-
}
83-
84-
85-
overridefunsetStateAccessor(stateAccessor:UiPage.UiFieldStateAccessor?) {
86-
this.stateAccessor= stateAccessor
71+
//return stateAccessor?.get(field)
72+
// TODO - check this later
73+
returnnull
8774
}
8875

8976
/**

‎src/main/resources/dependencies.json‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
3-
"name":"com.jetbrains.toolbox.gateway:gateway-api",
4-
"version":"2.5.0.32871",
3+
"name":"Toolbox App plugin API",
4+
"version":"2.1.0.16946",
55
"url":"https://jetbrains.com/toolbox-app/",
66
"license":"The Apache Software License, Version 2.0",
77
"licenseUrl":"https://www.apache.org/licenses/LICENSE-2.0.txt"
@@ -27,13 +27,6 @@
2727
"license":"The Apache Software License, Version 2.0",
2828
"licenseUrl":"http://www.apache.org/licenses/LICENSE-2.0.txt"
2929
},
30-
{
31-
"name":"org.jetbrains.kotlin:kotlin-stdlib-jdk8",
32-
"version":"1.9.10",
33-
"url":"https://kotlinlang.org/",
34-
"license":"The Apache License, Version 2.0",
35-
"licenseUrl":"http://www.apache.org/licenses/LICENSE-2.0.txt"
36-
},
3730
{
3831
"name":"org.jetbrains.kotlinx:kotlinx-coroutines-core",
3932
"version":"1.7.3",

‎src/main/resources/extension.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"vendor":"Coder",
88
"url":"https://github.com/coder/jetbrains-coder"
99
},
10-
"apiVersion":"0.1.0",
10+
"apiVersion":"0.3.0",
1111
"compatibleVersionRange": {
1212
"from":"2.6.0.0",
1313
"to":"2.6.0.99999"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp