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

fix: url refresh after log out and log in#67

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
fioan89 wants to merge2 commits intomainfromfix-url-refresh
Closed
Show file tree
Hide file tree
Changes fromall commits
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
3 changes: 2 additions & 1 deletionCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,8 @@

### Fixed

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

## 0.1.1 - 2025-04-03

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,7 @@ class CoderRemoteEnvironment(
while (context.cs.isActive && workspaceStillExists) {
if (wsRawStatus == WorkspaceAndAgentStatus.DELETING || wsRawStatus == WorkspaceAndAgentStatus.DELETED) {
workspaceStillExists = false
context.envPageManager.showPluginEnvironmentsPage()
context.envPageManager.showMainPageWithUrlVisible()
} else {
delay(1.seconds)
}
Expand Down
10 changes: 6 additions & 4 deletionssrc/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,8 @@ class CoderRemoteProvider(
// On the first load, automatically log in if we can.
private var firstRun = true
private val isInitialized: MutableStateFlow<Boolean> = MutableStateFlow(false)
private var coderHeaderPage = NewEnvironmentPage(context, context.i18n.pnotr(getDeploymentURL()?.first ?: ""))
private var coderHeaderPage =
NewEnvironmentPage(context, context.i18n.pnotr("Coder"), getDeploymentURL()?.first ?: "")
private val linkHandler = CoderProtocolHandler(context, dialogUi, isInitialized)
override val environments: MutableStateFlow<LoadableState<List<RemoteProviderEnvironment>>> = MutableStateFlow(
LoadableState.Value(emptyList())
Expand DownExpand Up@@ -243,7 +244,7 @@ class CoderRemoteProvider(
* this changes it would be nice to have a new spot to show the
* URL.
*/
override val canCreateNewEnvironments: Boolean =false
override val canCreateNewEnvironments: Boolean =true

/**
* Just displays the deployment URL at the moment, but we could use this as
Expand DownExpand Up@@ -273,7 +274,7 @@ class CoderRemoteProvider(
close()
// start initialization with the new settings
this@CoderRemoteProvider.client = restClient
coderHeaderPage = NewEnvironmentPage(context, context.i18n.pnotr(restClient.url.toString()))
coderHeaderPage.refreshUrl(restClient.url.toString())
pollJob = poll(restClient, cli)
}
}
Expand All@@ -287,7 +288,7 @@ class CoderRemoteProvider(
* than using multiple root pages.
*/
private fun goToEnvironmentsPage() {
context.envPageManager.showPluginEnvironmentsPage()
context.envPageManager.showMainPageWithUrlVisible()
}

/**
Expand DownExpand Up@@ -359,6 +360,7 @@ class CoderRemoteProvider(
pollError = null
pollJob?.cancel()
pollJob = poll(client, cli)
coderHeaderPage.refreshUrl(getDeploymentURL()?.first ?: "")
goToEnvironmentsPage()
}

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
package com.coder.toolbox

import com.jetbrains.toolbox.api.remoteDev.ui.EnvironmentUiPageManager

fun EnvironmentUiPageManager.showMainPageWithUrlVisible() {
showPluginEnvironmentsPage(true)
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@ import com.coder.toolbox.sdk.CoderRestClient
import com.coder.toolbox.sdk.v2.models.Workspace
import com.coder.toolbox.sdk.v2.models.WorkspaceAgent
import com.coder.toolbox.sdk.v2.models.WorkspaceStatus
import com.coder.toolbox.showMainPageWithUrlVisible
import com.jetbrains.toolbox.api.localization.LocalizableString
import kotlinx.coroutines.TimeoutCancellationException
import kotlinx.coroutines.delay
Expand DownExpand Up@@ -322,7 +323,7 @@ private suspend fun CoderToolboxContext.showInfoPopup(

private fun CoderToolboxContext.popupPluginMainPage() {
this.ui.showWindow()
this.envPageManager.showPluginEnvironmentsPage(true)
this.envPageManager.showMainPageWithUrlVisible()
}

/**
Expand Down
16 changes: 12 additions & 4 deletionssrc/main/kotlin/com/coder/toolbox/views/NewEnvironmentPage.kt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,9 +2,10 @@ package com.coder.toolbox.views

import com.coder.toolbox.CoderToolboxContext
import com.jetbrains.toolbox.api.localization.LocalizableString
import com.jetbrains.toolbox.api.ui.components.LinkField
import com.jetbrains.toolbox.api.ui.components.UiField
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update


/**
Expand All@@ -14,7 +15,14 @@ import kotlinx.coroutines.flow.StateFlow
* For now we just use this to display the deployment URL since we do not
* support creating environments from the plugin.
*/
class NewEnvironmentPage(context: CoderToolboxContext, deploymentURL: LocalizableString) :
CoderPage(context, deploymentURL) {
override val fields: StateFlow<List<UiField>> = MutableStateFlow(emptyList())
class NewEnvironmentPage(private val context: CoderToolboxContext, title: LocalizableString, initialUrl: String) :
CoderPage(context, title) {
override val fields: MutableStateFlow<List<UiField>> =
MutableStateFlow(listOf(LinkField(context.i18n.pnotr(initialUrl), initialUrl)))

fun refreshUrl(url: String) {
fields.update {
listOf(LinkField(context.i18n.pnotr(url), url))
}
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp