Skip to content

Commit cfeace1

Browse files
committed
Fix overlaping components in the Connections view
- `Recent Coder Workspaces` overlaps with the search bar. - reworked the first row to workaround the DSL limitations. - resolves #44
1 parent a64ed3f commit cfeace1

File tree

2 files changed

+47
-38
lines changed

2 files changed

+47
-38
lines changed

CHANGELOG.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
22

3-
# coder-gateway Changelog
4-
5-
## [Unreleased]
6-
7-
## [2.0.0]
3+
# coder-gateway Changelog
4+
5+
## [Unreleased]
6+
### Fixed
7+
- `Recent Coder Workspaces` label overlaps with the search bar in the `Connections` view
8+
9+
## [2.0.0]
810
### Added
911
- support for Gateway 2022.2
10-
11-
12+
13+
1214
### Changed
1315
- Java 17 is now required to run the plugin
14-
- adapted the code to the new SSH API provided by Gateway
15-
16-
## [1.0.0]
17-
### Added
16+
- adapted the code to the new SSH API provided by Gateway
17+
18+
## [1.0.0]
19+
### Added
1820
- initial scaffold for Gateway plugin
1921
- browser based authentication on Coder environments
2022
- REST client for Coder V2 public API

src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt

+34-27
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import kotlinx.coroutines.cancel
3939
import kotlinx.coroutines.launch
4040
import java.awt.Dimension
4141
import javax.swing.JComponent
42+
import javax.swing.JLabel
4243
import javax.swing.event.DocumentEvent
4344

4445
class CoderGatewayRecentWorkspaceConnectionsView : GatewayRecentConnections, Disposable {
@@ -62,36 +63,42 @@ class CoderGatewayRecentWorkspaceConnectionsView : GatewayRecentConnections, Dis
6263
label(CoderGatewayBundle.message("gateway.connector.recentconnections.title")).applyToComponent {
6364
font = JBFont.h3().asBold()
6465
}
65-
label("").resizableColumn().horizontalAlign(HorizontalAlign.FILL)
66-
searchBar = cell(SearchTextField(false)).applyToComponent {
67-
minimumSize = Dimension(350, -1)
68-
textEditor.border = JBUI.Borders.empty(2, 5, 2, 0)
69-
addDocumentListener(object : DocumentAdapter() {
70-
override fun textChanged(e: DocumentEvent) {
71-
val toSearchFor = this@applyToComponent.text
72-
val filteredConnections = recentConnectionsService.getAllRecentConnections().filter { it.coderWorkspaceHostname?.toLowerCase()?.contains(toSearchFor) ?: false || it.projectPath?.toLowerCase()?.contains(toSearchFor) ?: false }
73-
updateContentView(filteredConnections.groupBy { it.coderWorkspaceHostname })
74-
}
75-
})
76-
}.component
66+
panel {
67+
indent {
68+
row {
69+
cell(JLabel()).resizableColumn().horizontalAlign(HorizontalAlign.FILL)
70+
searchBar = cell(SearchTextField(false)).resizableColumn().horizontalAlign(HorizontalAlign.FILL).applyToComponent {
71+
minimumSize = Dimension(350, -1)
72+
textEditor.border = JBUI.Borders.empty(2, 5, 2, 0)
73+
addDocumentListener(object : DocumentAdapter() {
74+
override fun textChanged(e: DocumentEvent) {
75+
val toSearchFor = this@applyToComponent.text
76+
val filteredConnections = recentConnectionsService.getAllRecentConnections().filter { it.coderWorkspaceHostname?.toLowerCase()?.contains(toSearchFor) ?: false || it.projectPath?.toLowerCase()?.contains(toSearchFor) ?: false }
77+
updateContentView(filteredConnections.groupBy { it.coderWorkspaceHostname })
78+
}
79+
})
80+
}.component
7781

78-
actionButton(
79-
object : DumbAwareAction(CoderGatewayBundle.message("gateway.connector.recentconnections.new.wizard.button.tooltip"), null, AllIcons.General.Add) {
80-
override fun actionPerformed(e: AnActionEvent) {
81-
rootPanel.apply {
82-
removeAll()
83-
addToCenter(CoderGatewayConnectorWizardWrapperView {
84-
rootPanel.apply {
85-
removeAll()
86-
addToCenter(contentPanel)
87-
updateUI()
82+
actionButton(
83+
object : DumbAwareAction(CoderGatewayBundle.message("gateway.connector.recentconnections.new.wizard.button.tooltip"), null, AllIcons.General.Add) {
84+
override fun actionPerformed(e: AnActionEvent) {
85+
rootPanel.apply {
86+
removeAll()
87+
addToCenter(CoderGatewayConnectorWizardWrapperView {
88+
rootPanel.apply {
89+
removeAll()
90+
addToCenter(contentPanel)
91+
updateUI()
92+
}
93+
}.component)
94+
updateUI()
95+
}
8896
}
89-
}.component)
90-
updateUI()
91-
}
97+
},
98+
).gap(RightGap.SMALL)
9299
}
93-
},
94-
).gap(RightGap.SMALL)
100+
}
101+
}
95102
}.bottomGap(BottomGap.MEDIUM)
96103
separator(background = WelcomeScreenUIManager.getSeparatorColor())
97104
row {

0 commit comments

Comments
 (0)