Schedule Jobs from UI
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user