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: override default delete confirmation dialog#61

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

Merged
fioan89 merged 4 commits intomainfromfix-delete-confirmation-dialog
Apr 3, 2025
Merged
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
1 change: 1 addition & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@
### Fixed

- SSH config is regenerated correctly when Workspaces are added or removed
- only one confirmation dialog is shown when removing a Workspace

## 0.1.0 - 2025-04-01

Expand Down
61 changes: 31 additions & 30 deletionssrc/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@ import com.coder.toolbox.sdk.v2.models.WorkspaceAgent
import com.coder.toolbox.util.withPath
import com.coder.toolbox.views.Action
import com.coder.toolbox.views.EnvironmentView
import com.jetbrains.toolbox.api.remoteDev.DeleteEnvironmentConfirmationParams
import com.jetbrains.toolbox.api.remoteDev.EnvironmentVisibilityState
import com.jetbrains.toolbox.api.remoteDev.RemoteProviderEnvironment
import com.jetbrains.toolbox.api.remoteDev.environments.EnvironmentContentsView
Expand DownExpand Up@@ -149,42 +150,42 @@ class CoderRemoteEnvironment(
}
}

override fun getDeleteEnvironmentConfirmationParams(): DeleteEnvironmentConfirmationParams? {
return object : DeleteEnvironmentConfirmationParams {
override val cancelButtonText: String = "Cancel"
override val confirmButtonText: String = "Delete"
override val message: String =
if (wsRawStatus.canStop()) "Workspace will be closed and all the information will be lost, including all files, unsaved changes, historical info and usage data."
else "All the information in this workspace will be lost, including all files, unsaved changes, historical info and usage data."
override val title: String = if (wsRawStatus.canStop()) "Delete running workspace?" else "Delete workspace?"
}
}

override fun onDelete() {
context.cs.launch {
val shouldDelete = if (wsRawStatus.canStop()) {
context.ui.showOkCancelPopup(
context.i18n.ptrl("Delete running workspace?"),
context.i18n.ptrl("Workspace will be closed and all the information in this workspace will be lost, including all files, unsaved changes and historical."),
context.i18n.ptrl("Delete"),
context.i18n.ptrl("Cancel")
)
} else {
context.ui.showOkCancelPopup(
context.i18n.ptrl("Delete workspace?"),
context.i18n.ptrl("All the information in this workspace will be lost, including all files, unsaved changes and historical."),
context.i18n.ptrl("Delete"),
context.i18n.ptrl("Cancel")
)
}
if (shouldDelete) {
try {
client.removeWorkspace(workspace)
context.cs.launch {
withTimeout(5.minutes) {
var workspaceStillExists = true
while (context.cs.isActive && workspaceStillExists) {
if (wsRawStatus == WorkspaceAndAgentStatus.DELETING || wsRawStatus == WorkspaceAndAgentStatus.DELETED) {
workspaceStillExists = false
context.envPageManager.showPluginEnvironmentsPage()
} else {
delay(1.seconds)
}
try {
client.removeWorkspace(workspace)
// mark the env as deleting otherwise we will have to
// wait for the poller to update the status in the next 5 seconds
state.update {
WorkspaceAndAgentStatus.DELETING.toRemoteEnvironmentState(context)
}

context.cs.launch {
withTimeout(5.minutes) {
var workspaceStillExists = true
while (context.cs.isActive && workspaceStillExists) {
if (wsRawStatus == WorkspaceAndAgentStatus.DELETING || wsRawStatus == WorkspaceAndAgentStatus.DELETED) {
workspaceStillExists = false
context.envPageManager.showPluginEnvironmentsPage()
} else {
delay(1.seconds)
}
}
}
} catch (e: APIResponseException) {
context.ui.showErrorInfoPopup(e)
}
} catch (e: APIResponseException) {
context.ui.showErrorInfoPopup(e)
}
}
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,7 +131,7 @@ class CoderRemoteProvider(
}
lastEnvironments.apply {
clear()
addAll(resolvedEnvironments)
addAll(resolvedEnvironments.sortedBy { it.id })
}
} catch (_: CancellationException) {
context.logger.debug("${client.url} polling loop canceled")
Expand Down
15 changes: 0 additions & 15 deletionssrc/main/resources/localization/defaultMessages.po
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,24 +28,9 @@ msgstr ""
msgid "Save"
msgstr ""

msgid "Delete"
msgstr ""

msgid "Cancel"
msgstr ""

msgid "Delete running workspace?"
msgstr ""

msgid "Delete workspace?"
msgstr ""

msgid "Workspace will be closed and all the information in this workspace will be lost, including all files, unsaved changes and historical."
msgstr ""

msgid "All the information in this workspace will be lost, including all files, unsaved changes and historical."
msgstr ""

msgid "Session Token"
msgstr ""

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp