From 01ba5ef351f479f29c89f5ac580f9fc74b6a9411 Mon Sep 17 00:00:00 2001 From: Ioan Faur Date: Wed, 29 Jun 2022 16:12:59 +0300 Subject: [PATCH 1/2] Fix: regression in opening a recent connection - the gateway client is not launched when user clicks on a recent connection action button. - this is caused by an NPE due to missing information about the web terminal link, which was removed by mistake in a previous commit while adding support for creating new connections from the recents view panel. --- .../views/CoderGatewayRecentWorkspaceConnectionsView.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt b/src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt index 9b919585..7ef350cd 100644 --- a/src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt +++ b/src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt @@ -145,7 +145,8 @@ class CoderGatewayRecentWorkspaceConnectionsView : GatewayRecentConnections, Dis "project_path" to connectionDetails.projectPath!!, "ide_product_code" to product.productCode, "ide_build_number" to "${connectionDetails.ideBuildNumber}", - "ide_download_link" to "${connectionDetails.downloadSource}" + "ide_download_link" to "${connectionDetails.downloadSource}", + "web_terminal_link" to "${connectionDetails.webTerminalLink}" ) ) } From 3b47a7cd986b81510fab824d2ffa3b4bc172001d Mon Sep 17 00:00:00 2001 From: Ioan Faur Date: Wed, 29 Jun 2022 22:11:55 +0300 Subject: [PATCH 2/2] Fix: horizontal resize hides the new connection action button --- ...erGatewayRecentWorkspaceConnectionsView.kt | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt b/src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt index 7ef350cd..6c2f9e59 100644 --- a/src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt +++ b/src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt @@ -62,39 +62,36 @@ class CoderGatewayRecentWorkspaceConnectionsView : GatewayRecentConnections, Dis label(CoderGatewayBundle.message("gateway.connector.recentconnections.title")).applyToComponent { font = JBFont.h3().asBold() } - panel { - row { - searchBar = cell(SearchTextField(false)).applyToComponent { - minimumSize = Dimension(350, -1) - textEditor.border = JBUI.Borders.empty(2, 5, 2, 0) - addDocumentListener(object : DocumentAdapter() { - override fun textChanged(e: DocumentEvent) { - val toSearchFor = this@applyToComponent.text - val filteredConnections = recentConnectionsService.getAllRecentConnections().filter { it.coderWorkspaceHostname?.toLowerCase()?.contains(toSearchFor) ?: false || it.projectPath?.toLowerCase()?.contains(toSearchFor) ?: false } - updateContentView(filteredConnections.groupBy { it.coderWorkspaceHostname }) - } - }) - }.component + label("").resizableColumn().horizontalAlign(HorizontalAlign.FILL) + searchBar = cell(SearchTextField(false)).applyToComponent { + minimumSize = Dimension(350, -1) + textEditor.border = JBUI.Borders.empty(2, 5, 2, 0) + addDocumentListener(object : DocumentAdapter() { + override fun textChanged(e: DocumentEvent) { + val toSearchFor = this@applyToComponent.text + val filteredConnections = recentConnectionsService.getAllRecentConnections().filter { it.coderWorkspaceHostname?.toLowerCase()?.contains(toSearchFor) ?: false || it.projectPath?.toLowerCase()?.contains(toSearchFor) ?: false } + updateContentView(filteredConnections.groupBy { it.coderWorkspaceHostname }) + } + }) + }.component - actionButton( - object : DumbAwareAction(CoderGatewayBundle.message("gateway.connector.recentconnections.new.wizard.button.tooltip"), null, AllIcons.General.Add) { - override fun actionPerformed(e: AnActionEvent) { + actionButton( + object : DumbAwareAction(CoderGatewayBundle.message("gateway.connector.recentconnections.new.wizard.button.tooltip"), null, AllIcons.General.Add) { + override fun actionPerformed(e: AnActionEvent) { + rootPanel.apply { + removeAll() + addToCenter(CoderGatewayConnectorWizardWrapperView { rootPanel.apply { removeAll() - addToCenter(CoderGatewayConnectorWizardWrapperView { - rootPanel.apply { - removeAll() - addToCenter(contentPanel) - updateUI() - } - }.component) + addToCenter(contentPanel) updateUI() } - } - }, - ).gap(RightGap.SMALL) - } - }.horizontalAlign(HorizontalAlign.RIGHT) + }.component) + updateUI() + } + } + }, + ).gap(RightGap.SMALL) }.bottomGap(BottomGap.MEDIUM) separator(background = WelcomeScreenUIManager.getSeparatorColor()) row {