File tree Expand file tree Collapse file tree
TablePro/Views/Connection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,22 @@ struct ConnectionFormView: View {
2323 // Computed property for isNew
2424 private var isNew : Bool { connectionId == nil }
2525
26+ private var availableDatabaseTypes : [ DatabaseType ] {
27+ let pluginManager = PluginManager . shared
28+ pluginManager. loadPendingPlugins ( )
29+ let enabled = DatabaseType . allCases. filter { dbType in
30+ pluginManager. plugins. contains { entry in
31+ entry. isEnabled && ( entry. databaseTypeId == dbType. pluginTypeId
32+ || entry. additionalTypeIds. contains ( dbType. pluginTypeId) )
33+ }
34+ }
35+ // When editing, always include the current type so the picker binding stays valid
36+ if !isNew, !enabled. contains ( type) {
37+ return [ type] + enabled
38+ }
39+ return enabled
40+ }
41+
2642 @State private var name : String = " "
2743 @State private var host : String = " "
2844 @State private var port : String = " "
@@ -178,7 +194,7 @@ struct ConnectionFormView: View {
178194 Form {
179195 Section {
180196 Picker ( String ( localized: " Type " ) , selection: $type) {
181- ForEach ( DatabaseType . allCases ) { t in
197+ ForEach ( availableDatabaseTypes ) { t in
182198 Text ( t. rawValue) . tag ( t)
183199 }
184200 }
You can’t perform that action at this time.
0 commit comments