Skip to content

Commit 0f5aa11

Browse files
committed
Fix: disable the next button whe user selects a Windows or a macOS workspace
- for now only Linux is supported by Gateway - besides disabling the next button, a notification band pops-up at the bottom of the screen notifying the user that Windows and macOS is not yet supported - resolves #63
1 parent fc0016b commit 0f5aa11

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
### Fixed
1616
- terminal link for workspaces with a single agent
17+
- no longer allow users to open a connection to a Windows or macOS workspace. It's not yet supported by Gateway
1718

1819
## [2.0.2]
1920

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt

+19-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.coder.gateway.sdk.getOS
2424
import com.coder.gateway.sdk.toURL
2525
import com.coder.gateway.sdk.v2.models.Workspace
2626
import com.coder.gateway.sdk.withPath
27+
import com.intellij.icons.AllIcons
2728
import com.intellij.ide.ActivityTracker
2829
import com.intellij.ide.BrowserUtil
2930
import com.intellij.ide.IdeBundle
@@ -69,6 +70,7 @@ import org.zeroturnaround.exec.ProcessExecutor
6970
import java.awt.Component
7071
import java.awt.Dimension
7172
import javax.swing.Icon
73+
import javax.swing.JLabel
7274
import javax.swing.JTable
7375
import javax.swing.ListSelectionModel
7476
import javax.swing.table.DefaultTableCellRenderer
@@ -88,6 +90,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
8890
WorkspaceStatusColumnInfo("Status")
8991
)
9092

93+
private val notificationBand = JLabel()
9194
private var tableOfWorkspaces = TableView(listTableModelOfWorkspaces).apply {
9295
setEnableAntialiasing(true)
9396
rowSelectionAllowed = true
@@ -102,7 +105,16 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
102105

103106
setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
104107
selectionModel.addListSelectionListener {
105-
enableNextButtonCallback(selectedObject != null && selectedObject?.agentStatus == RUNNING)
108+
enableNextButtonCallback(selectedObject != null && selectedObject?.agentStatus == RUNNING && selectedObject?.agentOS == OS.LINUX)
109+
if (selectedObject?.agentOS != OS.LINUX) {
110+
notificationBand.apply {
111+
isVisible = true
112+
icon = AllIcons.General.Information
113+
text = CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.unsupported.os.info")
114+
}
115+
} else {
116+
notificationBand.isVisible = false
117+
}
106118
updateWorkspaceActions()
107119
}
108120
}
@@ -154,7 +166,12 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
154166
scrollCell(toolbar.createPanel()).resizableColumn().horizontalAlign(HorizontalAlign.FILL).verticalAlign(VerticalAlign.FILL)
155167
cell()
156168
}.topGap(TopGap.NONE).resizableRow()
157-
169+
row {
170+
cell(notificationBand).resizableColumn().horizontalAlign(HorizontalAlign.FILL).applyToComponent {
171+
font = JBFont.h4().asBold()
172+
isVisible = false
173+
}
174+
}
158175
}
159176
}.apply { background = WelcomeScreenUIManager.getMainAssociatedComponentBackground() }
160177

src/main/resources/messages/CoderGatewayBundle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ gateway.connector.view.coder.workspaces.next.text=Select IDE and Project
1414
gateway.connector.view.coder.workspaces.start.text=Start Workspace
1515
gateway.connector.view.coder.workspaces.stop.text=Stop Workspace
1616
gateway.connector.view.coder.workspaces.update.text=Update Workspace Template
17+
gateway.connector.view.coder.workspaces.unsupported.os.info=Gateway supports only Linux machines. The support for macOS and Windows will be coming in the next versions.
1718
gateway.connector.view.coder.remoteproject.loading.text=Retrieving products...
1819
gateway.connector.view.coder.remoteproject.ide.error.text=Could not retrieve any IDE for workspace {0} because an error was encountered
1920
gateway.connector.view.coder.remoteproject.next.text=Start IDE and Connect

0 commit comments

Comments
 (0)