Add app source and tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
25
lib/Peach/see/docker/run/ViewDockerRun.dart
Normal file
25
lib/Peach/see/docker/run/ViewDockerRun.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import '../../../about/external/data/Docker.dart';
|
||||
import '../../../about/internal/application/ServerProfile.dart';
|
||||
import '../../../comms/Comms.dart' show LogLine;
|
||||
import '../../parent/ParentViewModel.dart';
|
||||
import 'ConnectDockerRun.dart';
|
||||
|
||||
class ViewDockerRun extends ParentViewModel {
|
||||
ConnectDockerRun connection;
|
||||
|
||||
ViewDockerRun(super.context, this.connection);
|
||||
|
||||
/// The command's output as it runs, shown in the console.
|
||||
Stream<LogLine> get logs => getDataManager().logs;
|
||||
|
||||
void runContainer(ServerProfile server, DockerRunSpec spec) async {
|
||||
if (!await canReach(server, () => runContainer(server, spec))) return;
|
||||
try {
|
||||
final (started, output) = await getDataManager().dockerRun(server, spec);
|
||||
connection.onRunFinished(started, output);
|
||||
} catch (error) {
|
||||
connection.onRunFinished(false, error.toString());
|
||||
handleError(error, () => runContainer(server, spec), () {}, "Retry");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user