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

Commitb85e6fe

Browse files
committed
fix: url refresh after log out and log in
- the main env header page API is quite limiting, in the sense that the title is never allowed to change. Today we display the Coder URL as the title. However, if the user switches between two deployments by logging out and then logging in, the URL is never refreshed, leading to a confusing UI (URL is old, while workspaces are from the new deployment)- to workaround the issue we redesigned the page, to have a static string as the page, and bellow the first row, have a link field reflecting the new URL. -resolves#66
1 parent91a91d7 commitb85e6fe

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

‎CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
###Fixed
66

7-
- after log out, user is redirected back to the initial log in screen
7+
- after log out, user is redirected back to the initial log in screen
8+
- url on the main page is now refreshed when switching between multiple deployments (via logout/login or URI handling)
89

910
##0.1.1 - 2025-04-03
1011

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class CoderRemoteEnvironment(
177177
while (context.cs.isActive&& workspaceStillExists) {
178178
if (wsRawStatus==WorkspaceAndAgentStatus.DELETING|| wsRawStatus==WorkspaceAndAgentStatus.DELETED) {
179179
workspaceStillExists=false
180-
context.envPageManager.showPluginEnvironmentsPage()
180+
context.envPageManager.showPluginEnvironmentsPage(true)
181181
}else {
182182
delay(1.seconds)
183183
}

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class CoderRemoteProvider(
6767
// On the first load, automatically log in if we can.
6868
privatevar firstRun=true
6969
privateval isInitialized:MutableStateFlow<Boolean>=MutableStateFlow(false)
70-
privatevar coderHeaderPage=NewEnvironmentPage(context, context.i18n.pnotr(getDeploymentURL()?.first?:""))
70+
privatevar coderHeaderPage=
71+
NewEnvironmentPage(context, context.i18n.pnotr("Coder"), getDeploymentURL()?.first?:"")
7172
privateval linkHandler=CoderProtocolHandler(context, dialogUi, isInitialized)
7273
overrideval environments:MutableStateFlow<LoadableState<List<RemoteProviderEnvironment>>>=MutableStateFlow(
7374
LoadableState.Value(emptyList())
@@ -243,7 +244,7 @@ class CoderRemoteProvider(
243244
* this changes it would be nice to have a new spot to show the
244245
* URL.
245246
*/
246-
overrideval canCreateNewEnvironments:Boolean=false
247+
overrideval canCreateNewEnvironments:Boolean=true
247248

248249
/**
249250
* Just displays the deployment URL at the moment, but we could use this as
@@ -273,7 +274,7 @@ class CoderRemoteProvider(
273274
close()
274275
// start initialization with the new settings
275276
this@CoderRemoteProvider.client= restClient
276-
coderHeaderPage=NewEnvironmentPage(context, context.i18n.pnotr(restClient.url.toString()))
277+
coderHeaderPage.refreshUrl(restClient.url.toString())
277278
pollJob= poll(restClient, cli)
278279
}
279280
}
@@ -287,7 +288,7 @@ class CoderRemoteProvider(
287288
* than using multiple root pages.
288289
*/
289290
privatefungoToEnvironmentsPage() {
290-
context.envPageManager.showPluginEnvironmentsPage()
291+
context.envPageManager.showPluginEnvironmentsPage(true)
291292
}
292293

293294
/**
@@ -359,6 +360,7 @@ class CoderRemoteProvider(
359360
pollError=null
360361
pollJob?.cancel()
361362
pollJob= poll(client, cli)
363+
coderHeaderPage.refreshUrl(getDeploymentURL()?.first?:"")
362364
goToEnvironmentsPage()
363365
}
364366

‎src/main/kotlin/com/coder/toolbox/views/NewEnvironmentPage.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package com.coder.toolbox.views
22

33
importcom.coder.toolbox.CoderToolboxContext
44
importcom.jetbrains.toolbox.api.localization.LocalizableString
5+
importcom.jetbrains.toolbox.api.ui.components.LinkField
56
importcom.jetbrains.toolbox.api.ui.components.UiField
67
importkotlinx.coroutines.flow.MutableStateFlow
7-
importkotlinx.coroutines.flow.StateFlow
8+
importkotlinx.coroutines.flow.update
89

910

1011
/**
@@ -14,7 +15,14 @@ import kotlinx.coroutines.flow.StateFlow
1415
* For now we just use this to display the deployment URL since we do not
1516
* support creating environments from the plugin.
1617
*/
17-
classNewEnvironmentPage(context:CoderToolboxContext,deploymentURL:LocalizableString) :
18-
CoderPage(context, deploymentURL) {
19-
overrideval fields:StateFlow<List<UiField>>=MutableStateFlow(emptyList())
18+
classNewEnvironmentPage(privatevalcontext:CoderToolboxContext,title:LocalizableString,initialUrl:String) :
19+
CoderPage(context, title) {
20+
overrideval fields:MutableStateFlow<List<UiField>>=
21+
MutableStateFlow(listOf(LinkField(context.i18n.pnotr(initialUrl), initialUrl)))
22+
23+
funrefreshUrl(url:String) {
24+
fields.update {
25+
listOf(LinkField(context.i18n.pnotr(url), url))
26+
}
27+
}
2028
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp