Adds the scheduler page to the web application

This commit is contained in:
BinaryAlley committed 2026-09-03 12:50:17 -07:00
1 parent 29c7d536e0
commit f882f9192f
67 files changed
+4133 -8

No files matched your search

@@ -0,0 +1,34 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Scheduling;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Scheduling;
/// <summary>
/// Data transfer object for a scheduled job.
/// </summary>
/// <param name="Id">The unique identifier of the scheduled job.</param>
/// <param name="Name">The name of the scheduled job.</param>
/// <param name="TaskType">The type of the task executed by the scheduled job.</param>
/// <param name="ScheduleType">The type of the schedule of the scheduled job.</param>
/// <param name="IntervalMinutes">The interval in minutes of the schedule of the scheduled job.</param>
/// <param name="Hour">The hour of the schedule of the scheduled job.</param>
/// <param name="Minute">The minute of the schedule of the scheduled job.</param>
/// <param name="Status">The status of the scheduled job.</param>
/// <param name="LastStartedOnUtc">The optional date and time when the task of the scheduled job last started its execution.</param>
/// <param name="LastCompletedOnUtc">The optional date and time when the task of the scheduled job last completed its execution.</param>
[DebuggerDisplay("Id: {Id}, Name: {Name}, Status: {Status}")]
public record ScheduledJobDto(
Guid Id,
string Name,
ScheduledTaskType TaskType,
ScheduleType ScheduleType,
int? IntervalMinutes,
int? Hour,
int? Minute,
ScheduledJobStatus Status,
DateTime? LastStartedOnUtc,
DateTime? LastCompletedOnUtc
);
@@ -0,0 +1,26 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Scheduling;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Scheduling;
/// <summary>
/// Data transfer object for an execution of the task of a scheduled job.
/// </summary>
/// <param name="Id">The unique identifier of the execution.</param>
/// <param name="ScheduledJobId">The unique identifier of the scheduled job whose task was executed.</param>
/// <param name="TaskType">The type of the task that was executed.</param>
/// <param name="IsCycleRun"><see langword="true"/> when the execution was triggered by the execution cycle of the scheduled job.</param>
/// <param name="StartedOnUtc">The date and time when the execution started.</param>
/// <param name="CompletedOnUtc">The optional date and time when the execution completed.</param>
[DebuggerDisplay("Id: {Id}, ScheduledJobId: {ScheduledJobId}")]
public record ScheduledJobExecutionDto(
Guid Id,
Guid ScheduledJobId,
ScheduledTaskType TaskType,
bool IsCycleRun,
DateTime StartedOnUtc,
DateTime? CompletedOnUtc
);
@@ -0,0 +1,17 @@
namespace Lumina.Presentation.Web.Common.Enums.Scheduling;
/// <summary>
/// Enumeration for the types of schedules of scheduled jobs.
/// </summary>
public enum ScheduleType
{
/// <summary>
/// The scheduled job repeats with an interval measured in minutes.
/// </summary>
WithIntervalInMinutes,
/// <summary>
/// The scheduled job repeats daily at a fixed hour and minute.
/// </summary>
DailyAtHourAndMinute
}
@@ -0,0 +1,27 @@
namespace Lumina.Presentation.Web.Common.Enums.Scheduling;
/// <summary>
/// Enumeration for the statuses of scheduled jobs.
/// </summary>
public enum ScheduledJobStatus
{
/// <summary>
/// The scheduled job was added, but its execution cycle was not started.
/// </summary>
Added,
/// <summary>
/// The execution cycle of the scheduled job is active, and the job is waiting for its next scheduled execution.
/// </summary>
Active,
/// <summary>
/// The task of the scheduled job is currently being executed.
/// </summary>
Running,
/// <summary>
/// The scheduled job finished its latest one time execution.
/// </summary>
Completed
}
@@ -0,0 +1,17 @@
namespace Lumina.Presentation.Web.Common.Enums.Scheduling;
/// <summary>
/// Enumeration for the types of tasks a scheduled job can execute.
/// </summary>
public enum ScheduledTaskType
{
/// <summary>
/// The scheduled job scans all enabled media libraries.
/// </summary>
ScanMediaLibraries,
/// <summary>
/// The scheduled job cleans the temporary directory of the application.
/// </summary>
CleanTemporaryFiles
}
@@ -0,0 +1,26 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Scheduling;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Scheduling;
/// <summary>
/// Request for adding a scheduled job.
/// </summary>
/// <param name="Name">The name of the scheduled job. Required.</param>
/// <param name="TaskType">The type of the task executed by the scheduled job. Required.</param>
/// <param name="ScheduleType">The type of the schedule of the scheduled job. Required.</param>
/// <param name="IntervalMinutes">The interval in minutes of the schedule, when the schedule type is <see cref="ScheduleType.WithIntervalInMinutes"/>.</param>
/// <param name="Hour">The hour of the schedule, when the schedule type is <see cref="ScheduleType.DailyAtHourAndMinute"/>.</param>
/// <param name="Minute">The minute of the schedule, when the schedule type is <see cref="ScheduleType.DailyAtHourAndMinute"/>.</param>
[DebuggerDisplay("Name: {Name}")]
public record AddScheduledJobRequest(
string Name,
ScheduledTaskType TaskType,
ScheduleType ScheduleType,
int? IntervalMinutes,
int? Hour,
int? Minute
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Scheduling;
/// <summary>
/// Request for firing the task of a scheduled job once.
/// </summary>
/// <param name="ScheduledJobId">The unique identifier of the scheduled job whose task is fired. Required.</param>
[DebuggerDisplay("ScheduledJobId: {ScheduledJobId}")]
public record FireScheduledJobRequest(
Guid ScheduledJobId
);
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Scheduling;
/// <summary>
/// Request for getting the history of the executions of the tasks of scheduled jobs.
/// </summary>
/// <param name="From">The inclusive lower bound of the interval for which the history is requested. Optional.</param>
/// <param name="To">The inclusive upper bound of the interval for which the history is requested. Optional.</param>
[DebuggerDisplay("From: {From}, To: {To}")]
public record GetScheduledJobHistoryRequest(
DateTime? From,
DateTime? To
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Scheduling;
/// <summary>
/// Request for removing a scheduled job.
/// </summary>
/// <param name="ScheduledJobId">The unique identifier of the scheduled job to remove. Required.</param>
[DebuggerDisplay("ScheduledJobId: {ScheduledJobId}")]
public record RemoveScheduledJobRequest(
Guid ScheduledJobId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Scheduling;
/// <summary>
/// Request for starting the execution cycle of a scheduled job.
/// </summary>
/// <param name="ScheduledJobId">The unique identifier of the scheduled job whose execution cycle is started. Required.</param>
[DebuggerDisplay("ScheduledJobId: {ScheduledJobId}")]
public record StartScheduledJobRequest(
Guid ScheduledJobId
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Scheduling;
/// <summary>
/// Request for stopping the execution cycle of a scheduled job.
/// </summary>
/// <param name="ScheduledJobId">The unique identifier of the scheduled job whose execution cycle is stopped. Required.</param>
[DebuggerDisplay("ScheduledJobId: {ScheduledJobId}")]
public record StopScheduledJobRequest(
Guid ScheduledJobId
);
@@ -0,0 +1,21 @@
namespace Lumina.Presentation.Web.Common.Routes;
/// <summary>
/// Class for the collection of remote API routes called by this Web application.
/// </summary>
public static partial class ApiRoutes
{
/// <summary>
/// Routes for the scheduled job endpoints of the remote API.
/// </summary>
public static class ScheduledJobs
{
public const string GET_SCHEDULED_JOBS = "scheduled-jobs";
public const string ADD_SCHEDULED_JOB = "scheduled-jobs";
public const string GET_SCHEDULED_JOB_HISTORY = "scheduled-jobs/history";
public const string REMOVE_SCHEDULED_JOB = "scheduled-jobs/{scheduledJobId}";
public const string START_SCHEDULED_JOB = "scheduled-jobs/{scheduledJobId}/start";
public const string STOP_SCHEDULED_JOB = "scheduled-jobs/{scheduledJobId}/stop";
public const string FIRE_SCHEDULED_JOB = "scheduled-jobs/{scheduledJobId}/fire";
}
}
@@ -17,6 +17,7 @@ public static partial class WebRoutes
public const string PROFILE_VIEW = "{culture}/auth/profile";
public const string ACCESS_DENIED_VIEW = "{culture}/auth/access-denied";
public const string LOGOUT = "{culture}/auth/logout";
public const string GET_API_ACCESS_TOKEN = "{culture}/auth/api-access-token";
public const string REGISTER = "{culture}/auth/api-register";
public const string LOGIN = "{culture}/auth/api-login";
public const string RECOVER_PASSWORD = "{culture}/auth/api-recover-password";
@@ -0,0 +1,22 @@
namespace Lumina.Presentation.Web.Common.Routes;
/// <summary>
/// Class for the collection of routes defined in the Web application.
/// </summary>
public static partial class WebRoutes
{
/// <summary>
/// Routes for the scheduled jobs pages.
/// </summary>
public static class Scheduler
{
public const string INDEX = "{culture}/admin/scheduled-jobs";
public const string GET_SCHEDULED_JOBS = "{culture}/admin/api-scheduled-jobs";
public const string ADD_SCHEDULED_JOB = "{culture}/admin/api-scheduled-jobs/add";
public const string GET_SCHEDULED_JOB_HISTORY = "{culture}/admin/api-scheduled-jobs/history";
public const string REMOVE_SCHEDULED_JOB = "{culture}/admin/api-scheduled-jobs/{scheduledJobId}";
public const string START_SCHEDULED_JOB = "{culture}/admin/api-scheduled-jobs/{scheduledJobId}/start";
public const string STOP_SCHEDULED_JOB = "{culture}/admin/api-scheduled-jobs/{scheduledJobId}/stop";
public const string FIRE_SCHEDULED_JOB = "{culture}/admin/api-scheduled-jobs/{scheduledJobId}/fire";
}
}