Start, stop, monitor jobs from ui working.

This commit is contained in:
Jaret Burkett
2025-02-21 09:49:28 -07:00
parent d0214c0df9
commit ad87f72384
18 changed files with 475 additions and 41 deletions

29
ui/src/utils/jobs.ts Normal file
View File

@@ -0,0 +1,29 @@
export const startJob = (jobID: string) => {
return new Promise<void>((resolve, reject) => {
fetch(`/api/jobs/${jobID}/start`)
.then(res => res.json())
.then(data => {
console.log('Job started:', data);
resolve();
})
.catch(error => {
console.error('Error starting job:', error);
reject(error);
});
});
};
export const stopJob = (jobID: string) => {
return new Promise<void>((resolve, reject) => {
fetch(`/api/jobs/${jobID}/stop`)
.then(res => res.json())
.then(data => {
console.log('Job stopped:', data);
resolve();
})
.catch(error => {
console.error('Error stopping job:', error);
reject(error);
});
});
};