@@ -39,82 +39,82 @@ func (u *UI) createImportTab(w fyne.Window) fyne.CanvasObject {
3939 // --- Destination Server ---
4040 restoreLocalCheck := widget .NewCheck ("Restore to Localhost?" , nil )
4141
42- connTypeSelect : = widget .NewSelect ([]string {string (models .ConnectionTypeSSH ), string (models .ConnectionTypeWordPress )}, nil )
43- connTypeSelect .SetSelected (string (models .ConnectionTypeSSH ))
42+ u . impConnectionTypeSelect = widget .NewSelect ([]string {string (models .ConnectionTypeSSH ), string (models .ConnectionTypeWordPress )}, nil )
43+ u . impConnectionTypeSelect .SetSelected (string (models .ConnectionTypeSSH ))
4444
4545 // SSH Fields
46- hostEntry : = widget .NewEntry ()
47- hostEntry .SetPlaceHolder ("192.168.1.100" )
48- portEntry : = widget .NewEntry ()
49- portEntry .SetText ("22" )
50- sshUserEntry : = widget .NewEntry ()
51- sshUserEntry .SetPlaceHolder ("root" )
46+ u . impHostEntry = widget .NewEntry ()
47+ u . impHostEntry .SetPlaceHolder ("192.168.1.100" )
48+ u . impPortEntry = widget .NewEntry ()
49+ u . impPortEntry .SetText ("22" )
50+ u . impSSHUserEntry = widget .NewEntry ()
51+ u . impSSHUserEntry .SetPlaceHolder ("root" )
5252
53- authTypeSelect : = widget .NewSelect ([]string {string (models .AuthTypePassword ), string (models .AuthTypeKeyFile )}, nil )
54- authTypeSelect .SetSelected (string (models .AuthTypePassword ))
53+ u . impAuthTypeSelect = widget .NewSelect ([]string {string (models .AuthTypePassword ), string (models .AuthTypeKeyFile )}, nil )
54+ u . impAuthTypeSelect .SetSelected (string (models .AuthTypePassword ))
5555
56- sshPasswordEntry : = widget .NewPasswordEntry ()
57- sshPasswordEntry .SetPlaceHolder ("SSH Password" )
56+ u . impSSHPassEntry = widget .NewPasswordEntry ()
57+ u . impSSHPassEntry .SetPlaceHolder ("SSH Password" )
5858
59- keyPathEntry : = widget .NewEntry ()
60- keyPathEntry .SetPlaceHolder ("/path/to/private/key" )
59+ u . impKeyPathEntry = widget .NewEntry ()
60+ u . impKeyPathEntry .SetPlaceHolder ("/path/to/private/key" )
6161 keyPathBtn := widget .NewButton ("Select Key" , func () {
6262 fd := dialog .NewFileOpen (func (reader fyne.URIReadCloser , err error ) {
6363 if err == nil && reader != nil {
64- keyPathEntry .SetText (reader .URI ().Path ())
64+ u . impKeyPathEntry .SetText (reader .URI ().Path ())
6565 }
6666 }, w )
6767 fd .Show ()
6868 })
69- keyAuthContainer := container .NewBorder (nil , nil , nil , keyPathBtn , keyPathEntry )
69+ keyAuthContainer := container .NewBorder (nil , nil , nil , keyPathBtn , u . impKeyPathEntry )
7070 keyAuthContainer .Hide ()
7171
72- authTypeSelect .OnChanged = func (s string ) {
72+ u . impAuthTypeSelect .OnChanged = func (s string ) {
7373 if s == string (models .AuthTypePassword ) {
74- sshPasswordEntry .Show ()
74+ u . impSSHPassEntry .Show ()
7575 keyAuthContainer .Hide ()
7676 } else {
77- sshPasswordEntry .Hide ()
77+ u . impSSHPassEntry .Hide ()
7878 keyAuthContainer .Show ()
7979 }
8080 }
8181
8282 sshForm := widget .NewForm (
83- widget .NewFormItem ("Host" , hostEntry ),
84- widget .NewFormItem ("Port" , portEntry ),
85- widget .NewFormItem ("SSH User" , sshUserEntry ),
86- widget .NewFormItem ("Auth Type" , authTypeSelect ),
83+ widget .NewFormItem ("Host" , u . impHostEntry ),
84+ widget .NewFormItem ("Port" , u . impPortEntry ),
85+ widget .NewFormItem ("SSH User" , u . impSSHUserEntry ),
86+ widget .NewFormItem ("Auth Type" , u . impAuthTypeSelect ),
8787 )
88- sshContainer := container .NewVBox (sshForm , sshPasswordEntry , keyAuthContainer )
88+ sshContainer := container .NewVBox (sshForm , u . impSSHPassEntry , keyAuthContainer )
8989
9090 // WP Fields
91- wpUrlEntry : = widget .NewEntry ()
92- wpUrlEntry .SetPlaceHolder ("https://example.com" )
93- wpKeyEntry : = widget .NewEntry ()
94- wpKeyEntry .SetPlaceHolder ("API Key" )
91+ u . impWPUrlEntry = widget .NewEntry ()
92+ u . impWPUrlEntry .SetPlaceHolder ("https://example.com" )
93+ u . impWPKeyEntry = widget .NewEntry ()
94+ u . impWPKeyEntry .SetPlaceHolder ("API Key" )
9595
9696 wpContainer := container .NewVBox (
9797 widget .NewForm (
98- widget .NewFormItem ("WordPress URL" , wpUrlEntry ),
99- widget .NewFormItem ("API Key" , wpKeyEntry ),
98+ widget .NewFormItem ("WordPress URL" , u . impWPUrlEntry ),
99+ widget .NewFormItem ("API Key" , u . impWPKeyEntry ),
100100 ),
101101 )
102102 wpContainer .Hide ()
103103
104104 // Toggle Logic
105105 restoreLocalCheck .OnChanged = func (b bool ) {
106106 if b {
107- connTypeSelect .Hide ()
107+ u . impConnectionTypeSelect .Hide ()
108108 sshContainer .Hide ()
109109 wpContainer .Hide ()
110110 } else {
111- connTypeSelect .Show ()
111+ u . impConnectionTypeSelect .Show ()
112112 // Trigger conn type change
113- connTypeSelect . OnChanged (connTypeSelect .Selected )
113+ u . impConnectionTypeSelect . OnChanged (u . impConnectionTypeSelect .Selected )
114114 }
115115 }
116116
117- connTypeSelect .OnChanged = func (s string ) {
117+ u . impConnectionTypeSelect .OnChanged = func (s string ) {
118118 if restoreLocalCheck .Checked {
119119 return
120120 }
@@ -130,7 +130,7 @@ func (u *UI) createImportTab(w fyne.Window) fyne.CanvasObject {
130130
131131 // Test Server Connectivity (Import)
132132 testServerBtn := widget .NewButton ("Test Connectivity" , func () {
133- connType := models .ConnectionType (connTypeSelect .Selected )
133+ connType := models .ConnectionType (u . impConnectionTypeSelect .Selected )
134134 if restoreLocalCheck .Checked {
135135 dialog .ShowInformation ("Info" , "Localhost selected. No connection test needed." , w )
136136 return
@@ -145,12 +145,12 @@ func (u *UI) createImportTab(w fyne.Window) fyne.CanvasObject {
145145 loading := u .showLoading ("Testing Connection" , "Connecting to server..." )
146146 go func () {
147147 p := models.Profile {
148- Host : strings .TrimSpace (hostEntry .Text ),
149- Port : strings .TrimSpace (portEntry .Text ),
150- SSHUser : strings .TrimSpace (sshUserEntry .Text ),
151- SSHPassword : strings .TrimSpace (sshPasswordEntry .Text ),
152- AuthType : models .AuthType (authTypeSelect .Selected ),
153- AuthKeyPath : strings .TrimSpace (keyPathEntry .Text ),
148+ Host : strings .TrimSpace (u . impHostEntry .Text ),
149+ Port : strings .TrimSpace (u . impPortEntry .Text ),
150+ SSHUser : strings .TrimSpace (u . impSSHUserEntry .Text ),
151+ SSHPassword : strings .TrimSpace (u . impSSHPassEntry .Text ),
152+ AuthType : models .AuthType (u . impAuthTypeSelect .Selected ),
153+ AuthKeyPath : strings .TrimSpace (u . impKeyPathEntry .Text ),
154154 }
155155
156156 client , err := ssh .NewClient (p )
@@ -167,39 +167,39 @@ func (u *UI) createImportTab(w fyne.Window) fyne.CanvasObject {
167167
168168 serverGroup := widget .NewCard ("Destination Server" , "" , container .NewVBox (
169169 restoreLocalCheck ,
170- widget .NewForm (widget .NewFormItem ("Type" , connTypeSelect )),
170+ widget .NewForm (widget .NewFormItem ("Type" , u . impConnectionTypeSelect )),
171171 sshContainer ,
172172 wpContainer ,
173173 widget .NewSeparator (),
174174 testServerBtn ,
175175 ))
176176
177177 // --- Destination Database ---
178- isDockerCheck : = widget .NewCheck ("Is Docker Container?" , nil )
179- containerIDEntry : = widget .NewEntry ()
180- containerIDEntry .SetPlaceHolder ("mysql_container_name" )
181- containerIDEntry .Disable ()
178+ u . impIsDockerCheck = widget .NewCheck ("Is Docker Container?" , nil )
179+ u . impContainerIDEntry = widget .NewEntry ()
180+ u . impContainerIDEntry .SetPlaceHolder ("mysql_container_name" )
181+ u . impContainerIDEntry .Disable ()
182182
183- isDockerCheck .OnChanged = func (b bool ) {
183+ u . impIsDockerCheck .OnChanged = func (b bool ) {
184184 if b {
185- containerIDEntry .Enable ()
185+ u . impContainerIDEntry .Enable ()
186186 } else {
187- containerIDEntry .Disable ()
187+ u . impContainerIDEntry .Disable ()
188188 }
189189 }
190190
191- dbTypeSelect : = widget .NewSelect ([]string {string (models .DBTypeMySQL ), string (models .DBTypeMariaDB ), string (models .DBTypePostgreSQL )}, nil )
192- dbTypeSelect .SetSelected (string (models .DBTypeMySQL ))
191+ u . impDBTypeSelect = widget .NewSelect ([]string {string (models .DBTypeMySQL ), string (models .DBTypeMariaDB ), string (models .DBTypePostgreSQL )}, nil )
192+ u . impDBTypeSelect .SetSelected (string (models .DBTypeMySQL ))
193193
194- dbHostEntry : = widget .NewEntry ()
195- dbHostEntry .SetText ("127.0.0.1" )
196- dbPortEntry : = widget .NewEntry ()
197- dbPortEntry .SetText ("3306" )
198- dbUserEntry : = widget .NewEntry ()
199- dbUserEntry .SetPlaceHolder ("root" )
200- dbPasswordEntry : = widget .NewPasswordEntry ()
201- targetDBEntry : = widget .NewEntry ()
202- targetDBEntry .SetPlaceHolder ("target_database" )
194+ u . impDBHostEntry = widget .NewEntry ()
195+ u . impDBHostEntry .SetText ("127.0.0.1" )
196+ u . impDBPortEntry = widget .NewEntry ()
197+ u . impDBPortEntry .SetText ("3306" )
198+ u . impDBUserEntry = widget .NewEntry ()
199+ u . impDBUserEntry .SetPlaceHolder ("root" )
200+ u . impDBPassEntry = widget .NewPasswordEntry ()
201+ u . impTargetDBEntry = widget .NewEntry ()
202+ u . impTargetDBEntry .SetPlaceHolder ("target_database" )
203203
204204 // Test DB Connectivity (Import)
205205 testDBBtn := widget .NewButton ("Test DB Connectivity" , func () {
@@ -215,19 +215,19 @@ func (u *UI) createImportTab(w fyne.Window) fyne.CanvasObject {
215215 loading := u .showLoading ("Testing DB" , "Connecting to Database..." )
216216 go func () {
217217 p := models.Profile {
218- Host : strings .TrimSpace (hostEntry .Text ),
219- Port : strings .TrimSpace (portEntry .Text ),
220- SSHUser : strings .TrimSpace (sshUserEntry .Text ),
221- SSHPassword : strings .TrimSpace (sshPasswordEntry .Text ),
222- AuthType : models .AuthType (authTypeSelect .Selected ),
223- AuthKeyPath : strings .TrimSpace (keyPathEntry .Text ),
224- DBHost : strings .TrimSpace (dbHostEntry .Text ),
225- DBPort : strings .TrimSpace (dbPortEntry .Text ),
226- DBUser : strings .TrimSpace (dbUserEntry .Text ),
227- DBPassword : strings .TrimSpace (dbPasswordEntry .Text ),
228- DBType : models .DBType (dbTypeSelect .Selected ),
229- IsDocker : isDockerCheck .Checked ,
230- ContainerID : strings .TrimSpace (containerIDEntry .Text ),
218+ Host : strings .TrimSpace (u . impHostEntry .Text ),
219+ Port : strings .TrimSpace (u . impPortEntry .Text ),
220+ SSHUser : strings .TrimSpace (u . impSSHUserEntry .Text ),
221+ SSHPassword : strings .TrimSpace (u . impSSHPassEntry .Text ),
222+ AuthType : models .AuthType (u . impAuthTypeSelect .Selected ),
223+ AuthKeyPath : strings .TrimSpace (u . impKeyPathEntry .Text ),
224+ DBHost : strings .TrimSpace (u . impDBHostEntry .Text ),
225+ DBPort : strings .TrimSpace (u . impDBPortEntry .Text ),
226+ DBUser : strings .TrimSpace (u . impDBUserEntry .Text ),
227+ DBPassword : strings .TrimSpace (u . impDBPassEntry .Text ),
228+ DBType : models .DBType (u . impDBTypeSelect .Selected ),
229+ IsDocker : u . impIsDockerCheck .Checked ,
230+ ContainerID : strings .TrimSpace (u . impContainerIDEntry .Text ),
231231 }
232232
233233 client , err := ssh .NewClient (p )
@@ -277,15 +277,15 @@ func (u *UI) createImportTab(w fyne.Window) fyne.CanvasObject {
277277 })
278278
279279 dbGroup := widget .NewCard ("Destination Database" , "" , container .NewVBox (
280- isDockerCheck ,
280+ u . impIsDockerCheck ,
281281 widget .NewForm (
282- widget .NewFormItem ("DB Type" , dbTypeSelect ),
283- widget .NewFormItem ("Container Name/ID" , containerIDEntry ),
284- widget .NewFormItem ("DB Host" , dbHostEntry ),
285- widget .NewFormItem ("DB Port" , dbPortEntry ),
286- widget .NewFormItem ("DB User" , dbUserEntry ),
287- widget .NewFormItem ("DB Password" , dbPasswordEntry ),
288- widget .NewFormItem ("Target DB Name" , targetDBEntry ),
282+ widget .NewFormItem ("DB Type" , u . impDBTypeSelect ),
283+ widget .NewFormItem ("Container Name/ID" , u . impContainerIDEntry ),
284+ widget .NewFormItem ("DB Host" , u . impDBHostEntry ),
285+ widget .NewFormItem ("DB Port" , u . impDBPortEntry ),
286+ widget .NewFormItem ("DB User" , u . impDBUserEntry ),
287+ widget .NewFormItem ("DB Password" , u . impDBPassEntry ),
288+ widget .NewFormItem ("Target DB Name" , u . impTargetDBEntry ),
289289 ),
290290 widget .NewSeparator (),
291291 testDBBtn ,
@@ -301,13 +301,13 @@ func (u *UI) createImportTab(w fyne.Window) fyne.CanvasObject {
301301 return
302302 }
303303
304- connType := models .ConnectionType (connTypeSelect .Selected )
304+ connType := models .ConnectionType (u . impConnectionTypeSelect .Selected )
305305 isLocal := restoreLocalCheck .Checked
306306
307307 if ! isLocal && connType == models .ConnectionTypeWordPress {
308308 // WP Import
309- wpUrl := wpUrlEntry .Text
310- wpKey := wpKeyEntry .Text
309+ wpUrl := u . impWPUrlEntry .Text
310+ wpKey := u . impWPKeyEntry .Text
311311
312312 go func () {
313313 u .log ("Import (WP)" , "Starting import to WordPress" , "" , "In Progress" , "" )
@@ -345,20 +345,20 @@ func (u *UI) createImportTab(w fyne.Window) fyne.CanvasObject {
345345 }
346346
347347 p := models.Profile {
348- Host : strings .TrimSpace (hostEntry .Text ),
349- Port : strings .TrimSpace (portEntry .Text ),
350- SSHUser : strings .TrimSpace (sshUserEntry .Text ),
351- SSHPassword : strings .TrimSpace (sshPasswordEntry .Text ),
352- AuthType : models .AuthType (authTypeSelect .Selected ),
353- AuthKeyPath : strings .TrimSpace (keyPathEntry .Text ),
354- DBHost : strings .TrimSpace (dbHostEntry .Text ),
355- DBPort : strings .TrimSpace (dbPortEntry .Text ),
356- DBUser : strings .TrimSpace (dbUserEntry .Text ),
357- DBPassword : strings .TrimSpace (dbPasswordEntry .Text ),
358- DBType : models .DBType (dbTypeSelect .Selected ),
359- IsDocker : isDockerCheck .Checked ,
360- ContainerID : strings .TrimSpace (containerIDEntry .Text ),
361- TargetDBName : strings .TrimSpace (targetDBEntry .Text ),
348+ Host : strings .TrimSpace (u . impHostEntry .Text ),
349+ Port : strings .TrimSpace (u . impPortEntry .Text ),
350+ SSHUser : strings .TrimSpace (u . impSSHUserEntry .Text ),
351+ SSHPassword : strings .TrimSpace (u . impSSHPassEntry .Text ),
352+ AuthType : models .AuthType (u . impAuthTypeSelect .Selected ),
353+ AuthKeyPath : strings .TrimSpace (u . impKeyPathEntry .Text ),
354+ DBHost : strings .TrimSpace (u . impDBHostEntry .Text ),
355+ DBPort : strings .TrimSpace (u . impDBPortEntry .Text ),
356+ DBUser : strings .TrimSpace (u . impDBUserEntry .Text ),
357+ DBPassword : strings .TrimSpace (u . impDBPassEntry .Text ),
358+ DBType : models .DBType (u . impDBTypeSelect .Selected ),
359+ IsDocker : u . impIsDockerCheck .Checked ,
360+ ContainerID : strings .TrimSpace (u . impContainerIDEntry .Text ),
361+ TargetDBName : strings .TrimSpace (u . impTargetDBEntry .Text ),
362362 }
363363
364364 go func () {
0 commit comments