From 90c5723f89167c3ebf6474368728d54bcc331e51 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Fri, 13 Mar 2026 07:58:36 +0700 Subject: [PATCH 1/2] fix: remove auto-install plugin on database type selection --- .../Views/Connection/ConnectionFormView.swift | 44 +------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/TablePro/Views/Connection/ConnectionFormView.swift b/TablePro/Views/Connection/ConnectionFormView.swift index a2de7222..5fcad020 100644 --- a/TablePro/Views/Connection/ConnectionFormView.swift +++ b/TablePro/Views/Connection/ConnectionFormView.swift @@ -92,9 +92,6 @@ struct ConnectionFormView: View { @State private var isTesting: Bool = false @State private var testSucceeded: Bool = false - @State private var isInstallingPlugin = false - @State private var pluginInstallProgress: Double = 0 - @State private var pluginInstallConnection: DatabaseConnection? // Tab selection @@ -149,9 +146,6 @@ struct ConnectionFormView: View { if (newType == .sqlite || newType == .duckdb) && (selectedTab == .ssh || selectedTab == .ssl) { selectedTab = .general } - if newType.isDownloadablePlugin && !PluginManager.shared.isDriverAvailable(for: newType) { - installPluginForType(newType) - } additionalFieldValues = [:] if newType != .postgresql && newType != .redshift { usePgpass = false @@ -701,18 +695,6 @@ struct ConnectionFormView: View { private var footer: some View { VStack(alignment: .leading, spacing: 8) { - if isInstallingPlugin { - HStack(spacing: 6) { - ProgressView() - .controlSize(.small) - Text("Installing plugin...") - .font(.caption) - .foregroundStyle(.secondary) - } - .padding(.horizontal, 16) - .padding(.top, 8) - } - HStack { // Test connection Button(action: testConnection) { @@ -727,7 +709,7 @@ struct ConnectionFormView: View { Text("Test Connection") } } - .disabled(isTesting || isInstallingPlugin || !isValid) + .disabled(isTesting || !isValid) Spacer() @@ -749,7 +731,7 @@ struct ConnectionFormView: View { } .keyboardShortcut(.return) .buttonStyle(.borderedProminent) - .disabled(!isValid || isInstallingPlugin) + .disabled(!isValid) } .padding(.horizontal, 16) .padding(.vertical, 12) @@ -790,28 +772,6 @@ struct ConnectionFormView: View { return basicValid } - private func installPluginForType(_ databaseType: DatabaseType) { - isInstallingPlugin = true - pluginInstallProgress = 0 - let window = NSApp.keyWindow - - Task { - do { - try await PluginManager.shared.installMissingPlugin(for: databaseType) { progress in - pluginInstallProgress = progress - } - isInstallingPlugin = false - } catch { - isInstallingPlugin = false - AlertHelper.showErrorSheet( - title: String(localized: "Plugin Installation Failed"), - message: error.localizedDescription, - window: window - ) - } - } - } - private func updatePgpassStatus() { guard usePgpass, type == .postgresql || type == .redshift else { pgpassStatus = .notChecked From 9eff912fef143c4626df25181b01644eb5071096 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Fri, 13 Mar 2026 08:02:23 +0700 Subject: [PATCH 2/2] fix: show plugin install prompt on test connection with missing plugin --- TablePro/Views/Connection/ConnectionFormView.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/TablePro/Views/Connection/ConnectionFormView.swift b/TablePro/Views/Connection/ConnectionFormView.swift index 5fcad020..f858e0f5 100644 --- a/TablePro/Views/Connection/ConnectionFormView.swift +++ b/TablePro/Views/Connection/ConnectionFormView.swift @@ -1111,11 +1111,15 @@ struct ConnectionFormView: View { } catch { await MainActor.run { isTesting = false - AlertHelper.showErrorSheet( - title: String(localized: "Connection Test Failed"), - message: error.localizedDescription, - window: window - ) + if case PluginError.pluginNotInstalled = error { + pluginInstallConnection = testConn + } else { + AlertHelper.showErrorSheet( + title: String(localized: "Connection Test Failed"), + message: error.localizedDescription, + window: window + ) + } } } }