import '../../../about/internal/application/NotificationType.dart'; import '../../../about/internal/application/ServerProfile.dart'; import '../../parent/ParentViewModel.dart'; import 'ConnectServerEditor.dart'; class ViewServerEditor extends ParentViewModel { ConnectServerEditor connection; ViewServerEditor(super.context, this.connection); /// Opens an SSH session with the details as entered, so the user finds out /// now — not at first deploy — whether they work. void testConnection(ServerProfile server) async { showLoading("Connecting to ${server.host} …"); try { await getDataManager().connect(server); closeLoading(); connection.onConnectionVerified(server); showApplicationNotification( NotificationType.success, "Connection verified", "Peach signed in to ${server.username}@${server.host}:${server.port} " "successfully.", true, true, null, ); } catch (error) { handleError(error, () => testConnection(server), () {}, "Retry"); } } }