Skip to content

Commit 3c3bdd4

Browse files
committed
Implement basic connector view
- the view is able to request from the user a url to connecto to a coder environment - fixed some background issues with the bottom toolbar
1 parent a1b6b9b commit 3c3bdd4

File tree

6 files changed

+224
-5
lines changed

6 files changed

+224
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
### Added
88

99
* welcome screen
10-
* barebone connector view triggered by the Coder's welcome view.
10+
* basuc connector view triggered by the Coder's welcome view.
1111
* back button to return to the main welcome view
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package com.coder.gateway.views
22

33
import com.intellij.ui.components.panels.Wrapper
4+
import com.intellij.util.ui.JBUI
45
import com.jetbrains.gateway.api.GatewayConnectorView
56
import javax.swing.JComponent
67

78
class CoderGatewayConnectorView : GatewayConnectorView {
89
override val component: JComponent
9-
get() = Wrapper(CoderGatewayLoginView(0, 0))
10+
get() = Wrapper(CoderGatewayLoginView()).apply { border = JBUI.Borders.empty() }
1011
}

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

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,65 @@
11
package com.coder.gateway.views
22

3+
import com.coder.gateway.CoderGatewayBundle
34
import com.intellij.ide.IdeBundle
5+
import com.intellij.openapi.ui.panel.ComponentPanelBuilder
46
import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
7+
import com.intellij.ui.IconManager
58
import com.intellij.ui.SeparatorComponent
6-
import com.intellij.ui.components.DialogPanel
79
import com.intellij.ui.components.panels.VerticalLayout
10+
import com.intellij.ui.dsl.builder.BottomGap
11+
import com.intellij.ui.dsl.builder.TopGap
12+
import com.intellij.ui.dsl.builder.panel
13+
import com.intellij.ui.dsl.gridLayout.HorizontalAlign
14+
import com.intellij.util.ui.JBFont
815
import com.intellij.util.ui.JBUI
916
import com.intellij.util.ui.components.BorderLayoutPanel
1017
import com.jetbrains.gateway.api.GatewayUI
1118
import java.awt.Component
1219
import javax.swing.JButton
1320
import javax.swing.JPanel
1421

15-
class CoderGatewayLoginView(hgap: Int, vgap: Int) : BorderLayoutPanel(hgap, vgap) {
22+
class CoderGatewayLoginView : BorderLayoutPanel() {
1623
init {
1724
initView()
1825
}
1926

2027
private fun initView() {
28+
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
2129
addToCenter(createLoginComponent())
2230
addToBottom(createBackComponent())
2331
}
2432

2533
private fun createLoginComponent(): Component {
26-
return DialogPanel()
34+
return panel {
35+
indent {
36+
row {
37+
label(CoderGatewayBundle.message("gateway.connector.view.login.header.text")).applyToComponent {
38+
font = JBFont.h3().asBold()
39+
icon = IconManager.getInstance().getIcon("coder_logo_16.svg", CoderGatewayLoginView::class.java)
40+
}
41+
}.topGap(TopGap.SMALL).bottomGap(BottomGap.MEDIUM)
42+
row {
43+
cell(ComponentPanelBuilder.createCommentComponent(CoderGatewayBundle.message("gateway.connector.view.login.comment.text"), false, -1, true))
44+
}
45+
row {
46+
browserLink(CoderGatewayBundle.message("gateway.connector.view.login.documentation.action"), "https://coder.com/docs/coder/latest/workspaces")
47+
}.bottomGap(BottomGap.MEDIUM)
48+
row {
49+
label(CoderGatewayBundle.message("gateway.connector.view.login.url.label"))
50+
textField().resizableColumn().horizontalAlign(HorizontalAlign.FILL).applyToComponent {
51+
text = "https://dev.coder.com"
52+
}
53+
button(CoderGatewayBundle.message("gateway.connector.view.login.connect.action"), {}).applyToComponent {
54+
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
55+
border = JBUI.Borders.empty(3, 3, 3, 3)
56+
}
57+
cell()
58+
}
59+
}
60+
}.apply {
61+
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
62+
}
2763
}
2864

2965
private fun createBackComponent(): Component {
@@ -33,11 +69,14 @@ class CoderGatewayLoginView(hgap: Int, vgap: Int) : BorderLayoutPanel(hgap, vgap
3369
border = JBUI.Borders.empty(6, 24, 6, 0)
3470
addToLeft(JButton(IdeBundle.message("button.back")).apply {
3571
border = JBUI.Borders.empty(3, 3, 3, 3)
72+
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
3673
addActionListener {
3774
GatewayUI.Companion.getInstance().reset()
3875
}
3976
})
77+
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
4078
})
79+
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
4180
}
4281
}
4382

src/main/resources/coder_logo_16.svg

Lines changed: 87 additions & 0 deletions
Loading
Lines changed: 87 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
gateway.connector.title = Coder
22
gateway.connector.description = Connects to a dev environment running in Coder Workspaces
33
gateway.connector.action.text = Connect to Coder Workspaces
4+
gateway.connector.view.login.header.text = Coder Workspaces
5+
gateway.connector.view.login.comment.text = Self-hosted developer workspaces in the cloud or on premise. Coder Workspaces empower developers with secure, consistent, and fast developer workspaces.
6+
gateway.connector.view.login.documentation.action = Explore Coder Workspaces
7+
gateway.connector.view.login.url.label = Url:
8+
gateway.connector.view.login.connect.action = Connect

0 commit comments

Comments
 (0)