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