Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions SimpleSchedulerBlazorWasm/Components/Jobs/JobRow.razor
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
</button>
</div>
}
else if (Job.StatusCode == "ACK")
{
<div>
<button class="btn btn-xs btn-outline-success" @onclick="RunJob">
<i class="bi bi-play"></i>
Re-run
</button>
</div>
}
else if (Job.StatusCode == "SUC")
{
<div>
Expand Down
20 changes: 20 additions & 0 deletions SimpleSchedulerBlazorWasm/Components/Jobs/JobRow.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
using Microsoft.JSInterop;
using SimpleSchedulerApiModels;
using SimpleSchedulerApiModels.Reply.Jobs;
using SimpleSchedulerApiModels.Reply.Workers;
using SimpleSchedulerApiModels.Request.Jobs;
using SimpleSchedulerApiModels.Request.Workers;
using SimpleSchedulerServiceClient;
using Timer = System.Timers.Timer;

Expand Down Expand Up @@ -185,4 +187,22 @@ private Task GoToWorker()
Nav.NavigateTo($"workers/filter/{Worker.ID}");
return Task.CompletedTask;
}

private async Task RunJob()
{
Loading = true;
(Error? error, _) = await ServiceClient.PostAsync<RunNowRequest, RunNowReply>(
"Workers/RunNow",
new(Worker.ID)
);

if (error is not null)
{
await Swal.FireAsync("Error", error.Message, SweetAlertIcon.Error);
Loading = false;
return;
}

await ReloadJobAsync();
}
}