@@ -39,6 +39,7 @@ public class MainWindowViewModel : ViewModelBase {
39
39
public MainWindowViewModel ( ) {
40
40
OnShowCommandsCommand = ReactiveCommand . Create ( OnShowCommands ) ;
41
41
OnRestartCommand = ReactiveCommand . Create ( OnRestart ) ;
42
+ OnRestartImagesCommand = ReactiveCommand . Create ( OnRestartImages ) ;
42
43
Task . Factory . StartNew ( PingServer ) ;
43
44
Task . Factory . StartNew ( PingSite ) ;
44
45
ServerAddress = Configuration . Instance . ServerAddress ;
@@ -169,6 +170,11 @@ public string? SshPassword {
169
170
/// </summary>
170
171
public ICommand OnRestartCommand { get ; set ; }
171
172
173
+ /// <summary>
174
+ /// Restarts the remote docker images.
175
+ /// </summary>
176
+ public ICommand OnRestartImagesCommand { get ; set ; }
177
+
172
178
/// <summary>
173
179
/// Restarts the remote machine.
174
180
/// </summary>
@@ -179,6 +185,24 @@ private async Task OnRestart() {
179
185
using SshCommand ? ssh = client . RunCommand ( $ "echo { _sshPassword } | sudo -S { command } ") ;
180
186
}
181
187
188
+ /// <summary>
189
+ /// Restarts the docker images.
190
+ /// </summary>
191
+ private async Task OnRestartImages ( ) {
192
+ using SshClient client = new ( _serverAddress ! , _sshUsername ! , _sshPassword ! ) ;
193
+ await client . ConnectAsync ( CancellationToken . None ) ;
194
+ string [ ] command = [
195
+ "docker compose -p nullinside-ui restart" ,
196
+ "docker compose -p nullinside-api restart" ,
197
+ "docker compose -p nullinside-api-null restart" ,
198
+ "docker compose -p nullinside-api-twitch-bot restart"
199
+ ] ;
200
+
201
+ foreach ( string line in command ) {
202
+ using SshCommand ? ssh = client . RunCommand ( $ "echo { _sshPassword } | sudo -S { line } ") ;
203
+ }
204
+ }
205
+
182
206
/// <summary>
183
207
/// Handles showing the server commands.
184
208
/// </summary>
0 commit comments