Schedule Jobs from UI

This commit is contained in:
2025-12-08 22:02:57 +01:00
parent c94a3b41c9
commit 00c9584d03
4 changed files with 218 additions and 1 deletions

View File

@@ -129,6 +129,41 @@ public partial class Index : ComponentBase, IDisposable
await JSRuntime.InvokeVoidAsync("open", url, "_blank");
}
private async Task ScheduleJobs(string type)
{
isLoading = true;
try
{
(bool success, int jobsCreated, string message) result = type switch
{
"all" => await JobService.ScheduleAllJobsAsync(),
"imports" => await JobService.ScheduleImportJobsAsync(),
"processes" => await JobService.ScheduleProcessJobsAsync(),
_ => (false, 0, "Unknown job type")
};
if (result.success)
{
Snackbar.Add($"{result.message} ({result.jobsCreated} jobs created)", Severity.Success);
await LoadJobs();
}
else
{
Snackbar.Add(result.message, Severity.Error);
}
}
catch (Exception ex)
{
Console.WriteLine($"Scheduling jobs failed: {ex.Message}");
Snackbar.Add($"Failed to schedule jobs: {ex.Message}", Severity.Error);
}
finally
{
isLoading = false;
}
}
private Color GetStatusColor(JobStatus status)
{
return status switch