Added start/stop control to Unity process

This commit is contained in:
2025-12-01 09:42:20 +01:00
parent b2c5d08ff4
commit 7df210aaf2
13 changed files with 203 additions and 103 deletions

View File

@@ -23,6 +23,12 @@ export class DashboardUnity {
restartButton: HTMLDivElement = document.querySelector(
'.ntsh_dashboard-unity-restart'
);
startButton: HTMLDivElement = document.querySelector(
'.ntsh_dashboard-unity-start'
);
stopButton: HTMLDivElement = document.querySelector(
'.ntsh_dashboard-unity-stop'
);
uptimeInfo: HTMLDivElement = document.querySelector(
'.ntsh_dashboard-unity-uptime'
@@ -103,9 +109,13 @@ export class DashboardUnity {
state.startTime = -1;
this.restartButton.style.display = 'none';
this.stopButton.style.display = 'none';
} else {
this.restartButton.style.display = 'flex';
this.stopButton.style.display = 'flex';
}
this.startButton.style.display =
state.state == 'STOPPED' ? 'flex' : 'none';
setStatusState(
this.processStatus,
@@ -603,6 +613,18 @@ export class DashboardUnity {
'Are you sure you want to restart the Unity Runner process?'
);
});
this.startButton.addEventListener('click', async () => {
this.executeCommand(
'start',
'Are you sure you want to start the Unity Runner process?'
);
});
this.stopButton.addEventListener('click', async () => {
this.executeCommand(
'stop',
'Are you sure you want to stop the Unity Runner process?'
);
});
this.enableOutOfServiceButton.addEventListener('click', async () => {
this.executeCommand(