Skip to content

Commit bcec7c9

Browse files
committed
feat: Add restart button
1 parent 6cb2dd8 commit bcec7c9

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/renderer/lib/containers/container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const containerLogger = createLogger(path.join(WINBOAT_DIR, "container.lo
99

1010
export type ComposeDirection = "up" | "down";
1111
export type ComposeArguments = "--no-start";
12-
export type ContainerAction = "start" | "stop" | "pause" | "unpause";
12+
export type ContainerAction = "start" | "stop" | "pause" | "unpause" | "restart";
1313

1414
export abstract class ContainerManager {
1515
abstract readonly defaultCompose: ComposeConfig;

src/renderer/lib/winboat.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,20 @@ export class Winboat {
504504
this.containerActionLoading.value = false;
505505
}
506506

507+
async restartContainer() {
508+
logger.info("Restarting WinBoat container...");
509+
this.containerActionLoading.value = true;
510+
try {
511+
await this.containerMgr!.container("restart");
512+
} catch (e) {
513+
logger.error("There was an error restarting the container.");
514+
logger.error(e);
515+
throw e;
516+
}
517+
logger.info("Successfully restarted WinBoat container");
518+
this.containerActionLoading.value = false;
519+
}
520+
507521
async pauseContainer() {
508522
logger.info("Pausing WinBoat container...");
509523
this.containerActionLoading.value = true;

src/renderer/views/Home.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@
7979
>
8080
<Icon class="w-20 h-20 text-red-300" icon="mingcute:stop-fill"></Icon>
8181
</button>
82+
<button
83+
title="Restart"
84+
class="generic-hover"
85+
v-if="winboat.containerStatus.value === ContainerStatus.RUNNING"
86+
@click="winboat.restartContainer()"
87+
>
88+
<Icon class="w-20 h-20 text-orange-300" icon="mingcute:refresh-3-line"></Icon>
89+
</button>
8290

8391
<button
8492
title="Pause / Unpause"

0 commit comments

Comments
 (0)