Files
PeachDeployments/lib/Peach/see/server/editor/ViewServerEditor.dart
alvocool 38881d1fe1 Add app source and tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-11 10:15:30 +03:00

33 lines
1.1 KiB
Dart

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");
}
}
}