Add app source and tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
32
lib/Peach/see/server/editor/ViewServerEditor.dart
Normal file
32
lib/Peach/see/server/editor/ViewServerEditor.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user