mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
Stores scheduler page display preferences per user
This commit is contained in:
1 parent
ab8ab51397
commit
237be9e2c8
50 files changed
+3144
-60
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#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 the display preferences of the scheduler page.
|
||||
/// </summary>
|
||||
/// <param name="UserId">The unique identifier of the user that owns the display preferences.</param>
|
||||
/// <param name="JobTypeFilter">The type of the scheduled job tasks whose executions are shown on the scheduler page, or <see langword="null"/> when all of them are shown.</param>
|
||||
/// <param name="DisplayTimeSpan">The time span, expressed in <paramref name="DisplayTimeUnit"/>, that the scheduler page shows.</param>
|
||||
/// <param name="DisplayTimeUnit">The unit in which the displayed time span of the scheduler page is expressed.</param>
|
||||
[DebuggerDisplay("UserId: {UserId}, DisplayTimeSpan: {DisplayTimeSpan} {DisplayTimeUnit}")]
|
||||
public record SchedulerDisplayPreferencesDto(
|
||||
Guid UserId,
|
||||
ScheduledTaskType? JobTypeFilter,
|
||||
int DisplayTimeSpan,
|
||||
SchedulerDisplayTimeUnit DisplayTimeUnit
|
||||
);
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Lumina.Presentation.Web.Common.Enums.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration for the units in which the display time span of the scheduler page is expressed.
|
||||
/// </summary>
|
||||
public enum SchedulerDisplayTimeUnit
|
||||
{
|
||||
/// <summary>
|
||||
/// The display time span is expressed in minutes.
|
||||
/// </summary>
|
||||
Minutes,
|
||||
|
||||
/// <summary>
|
||||
/// The display time span is expressed in hours.
|
||||
/// </summary>
|
||||
Hours,
|
||||
|
||||
/// <summary>
|
||||
/// The display time span is expressed in days.
|
||||
/// </summary>
|
||||
Days
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.Scheduling;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
|
||||
/// <summary>
|
||||
/// Request for updating the display preferences of the scheduler page of the current user.
|
||||
/// </summary>
|
||||
/// <param name="JobTypeFilter">The type of the scheduled job tasks whose executions are shown on the scheduler page, or <see langword="null"/> when all of them are shown.</param>
|
||||
/// <param name="DisplayTimeSpan">The time span, expressed in <paramref name="DisplayTimeUnit"/>, that the scheduler page shows. Required.</param>
|
||||
/// <param name="DisplayTimeUnit">The unit in which the displayed time span of the scheduler page is expressed. Required.</param>
|
||||
[DebuggerDisplay("DisplayTimeSpan: {DisplayTimeSpan} {DisplayTimeUnit}")]
|
||||
public record UpdateSchedulerDisplayPreferencesRequest(
|
||||
ScheduledTaskType? JobTypeFilter,
|
||||
int DisplayTimeSpan,
|
||||
SchedulerDisplayTimeUnit DisplayTimeUnit
|
||||
);
|
||||
@@ -17,5 +17,7 @@ public static partial class ApiRoutes
|
||||
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";
|
||||
public const string GET_DISPLAY_PREFERENCES = "scheduled-jobs/display-preferences";
|
||||
public const string UPDATE_DISPLAY_PREFERENCES = "scheduled-jobs/display-preferences";
|
||||
}
|
||||
}
|
||||
@@ -18,5 +18,7 @@ public static partial class WebRoutes
|
||||
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";
|
||||
public const string GET_DISPLAY_PREFERENCES = "{culture}/admin/api-scheduled-jobs/display-preferences";
|
||||
public const string UPDATE_DISPLAY_PREFERENCES = "{culture}/admin/api-scheduled-jobs/display-preferences";
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Authorization;
|
||||
using Lumina.Presentation.Web.Common.DTO.Scheduling;
|
||||
using Lumina.Presentation.Web.Common.Routes;
|
||||
using Lumina.Presentation.Web.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Scheduler.GetSchedulerDisplayPreferences;
|
||||
|
||||
/// <summary>
|
||||
/// API endpoint for the <c>/{culture}/admin/api-scheduled-jobs/display-preferences</c> route.
|
||||
/// </summary>
|
||||
public class GetSchedulerDisplayPreferencesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
{
|
||||
private readonly IApiHttpClient _apiHttpClient;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetSchedulerDisplayPreferencesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
|
||||
public GetSchedulerDisplayPreferencesEndpoint(IApiHttpClient apiHttpClient)
|
||||
{
|
||||
_apiHttpClient = apiHttpClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the endpoint.
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
base.Configure();
|
||||
Verbs(Http.GET);
|
||||
Routes(WebRoutes.Scheduler.GET_DISPLAY_PREFERENCES);
|
||||
DontAutoTag();
|
||||
Options(options => options.WithTags("Admin"));
|
||||
Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the display preferences of the scheduler page of the current user.
|
||||
/// </summary>
|
||||
/// <param name="request">The request object.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
SchedulerDisplayPreferencesDto displayPreferences = await _apiHttpClient.GetAsync<SchedulerDisplayPreferencesDto>(ApiRoutes.ScheduledJobs.GET_DISPLAY_PREFERENCES, cancellationToken).ConfigureAwait(false);
|
||||
return JsonSuccess(displayPreferences);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.DTO.Scheduling;
|
||||
using Lumina.Presentation.Web.Common.Enums.Scheduling;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Scheduler.GetSchedulerDisplayPreferences;
|
||||
|
||||
/// <summary>
|
||||
/// Class used for providing a textual description for the <see cref="GetSchedulerDisplayPreferencesEndpoint"/> endpoint, for OpenAPI.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetSchedulerDisplayPreferencesEndpointSummary : Summary<GetSchedulerDisplayPreferencesEndpoint, EmptyRequest>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetSchedulerDisplayPreferencesEndpointSummary"/> class.
|
||||
/// </summary>
|
||||
public GetSchedulerDisplayPreferencesEndpointSummary()
|
||||
{
|
||||
Summary = "Gets the display preferences of the scheduler page.";
|
||||
Description = "Retrieves the display preferences of the scheduler page of the current user, or the default display preferences when none are stored yet.";
|
||||
|
||||
Response(200, "The display preferences of the scheduler page are returned.", example: new SuccessResponse<SchedulerDisplayPreferencesDto>(true, new SchedulerDisplayPreferencesDto(
|
||||
UserId: Guid.NewGuid(),
|
||||
JobTypeFilter: ScheduledTaskType.ScanMediaLibraries,
|
||||
DisplayTimeSpan: 10,
|
||||
DisplayTimeUnit: SchedulerDisplayTimeUnit.Minutes
|
||||
)));
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Authorization;
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using Lumina.Presentation.Web.Common.Routes;
|
||||
using Lumina.Presentation.Web.Core.Endpoints.Common;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Scheduler.UpdateSchedulerDisplayPreferences;
|
||||
|
||||
/// <summary>
|
||||
/// API endpoint for the <c>/{culture}/admin/api-scheduled-jobs/display-preferences</c> route.
|
||||
/// </summary>
|
||||
public class UpdateSchedulerDisplayPreferencesEndpoint : BaseEndpoint<UpdateSchedulerDisplayPreferencesRequest, IResult>
|
||||
{
|
||||
private readonly IApiHttpClient _apiHttpClient;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateSchedulerDisplayPreferencesEndpoint"/> class.
|
||||
/// </summary>
|
||||
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
|
||||
public UpdateSchedulerDisplayPreferencesEndpoint(IApiHttpClient apiHttpClient)
|
||||
{
|
||||
_apiHttpClient = apiHttpClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the endpoint.
|
||||
/// </summary>
|
||||
public override void Configure()
|
||||
{
|
||||
base.Configure();
|
||||
Verbs(Http.PUT);
|
||||
Routes(WebRoutes.Scheduler.UPDATE_DISPLAY_PREFERENCES);
|
||||
DontAutoTag();
|
||||
Options(options => options.WithTags("Admin"));
|
||||
Policies(AuthorizationPolicies.REQUIRE_ADMIN_ROLE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the display preferences of the scheduler page of the current user.
|
||||
/// </summary>
|
||||
/// <param name="request">The request containing the display preferences of the scheduler page of the current user.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(UpdateSchedulerDisplayPreferencesRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
await _apiHttpClient.PutAsync<Web.Common.Requests.Common.EmptyRequest, UpdateSchedulerDisplayPreferencesRequest>(ApiRoutes.ScheduledJobs.UPDATE_DISPLAY_PREFERENCES, request, cancellationToken).ConfigureAwait(false);
|
||||
return JsonSuccess();
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Presentation.Web.Common.DTO.Common;
|
||||
using Lumina.Presentation.Web.Common.Enums.Scheduling;
|
||||
using Lumina.Presentation.Web.Common.Requests.Scheduling;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Endpoints.Admin.Scheduler.UpdateSchedulerDisplayPreferences;
|
||||
|
||||
/// <summary>
|
||||
/// Class used for providing a textual description for the <see cref="UpdateSchedulerDisplayPreferencesEndpoint"/> endpoint, for OpenAPI.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class UpdateSchedulerDisplayPreferencesEndpointSummary : Summary<UpdateSchedulerDisplayPreferencesEndpoint, UpdateSchedulerDisplayPreferencesRequest>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateSchedulerDisplayPreferencesEndpointSummary"/> class.
|
||||
/// </summary>
|
||||
public UpdateSchedulerDisplayPreferencesEndpointSummary()
|
||||
{
|
||||
Summary = "Updates the display preferences of the scheduler page.";
|
||||
Description = "Stores the display preferences of the scheduler page of the current user, so that they are restored on every client the user signs in from.";
|
||||
|
||||
RequestParam(r => r.JobTypeFilter, "The type of the scheduled job tasks whose executions are shown on the scheduler page, or null when all of them are shown.");
|
||||
RequestParam(r => r.DisplayTimeSpan, "The time span, expressed in the display time unit, that the scheduler page shows. Required.");
|
||||
RequestParam(r => r.DisplayTimeUnit, "The unit in which the displayed time span of the scheduler page is expressed. Required.");
|
||||
|
||||
ExampleRequest = new UpdateSchedulerDisplayPreferencesRequest(
|
||||
JobTypeFilter: ScheduledTaskType.ScanMediaLibraries,
|
||||
DisplayTimeSpan: 10,
|
||||
DisplayTimeUnit: SchedulerDisplayTimeUnit.Minutes
|
||||
);
|
||||
|
||||
Response(200, "The display preferences of the scheduler page were successfully updated.", example: new SuccessResponse(true));
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>المهمة المجدولة بهذا الاسم موجودة بالفعل!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>تنفيذ المهمة المجدولة موجود بالفعل!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>لم يتم العثور على تنفيذ المهمة المجدولة!</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>يمكن إكمال المهمة المجدولة قيد التشغيل فقط!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>يجب أن تكون الفترة الزمنية للعرض في صفحة الجدولة رقمًا موجبًا!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>نوع الجدول غير صالح!</value>
|
||||
</data>
|
||||
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>Ein geplanter Auftrag mit diesem Namen ist bereits vorhanden!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>Die Ausführung des geplanten Auftrags existiert bereits!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>Die Ausführung des geplanten Auftrags wurde nicht gefunden!</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>Nur ein laufender geplanter Auftrag kann abgeschlossen werden!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>Der Anzeigezeitraum der Scheduler-Seite muss eine positive Zahl sein!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>Der Zeitplantyp ist ungültig!</value>
|
||||
</data>
|
||||
|
||||
+3
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>Only a running scheduled job can be completed!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>The display time span of the scheduler page must be a positive number!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>The schedule type is invalid!</value>
|
||||
</data>
|
||||
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>Ya existe una tarea programada con este nombre!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>La ejecución de la tarea programada ya existe!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>No se encontró la ejecución de la tarea programada!</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>Solo se puede completar una tarea programada en ejecución!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>El intervalo de visualización de la página de tareas programadas debe ser un número positivo!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>El tipo de programación no es válido!</value>
|
||||
</data>
|
||||
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>Un travail planifié portant ce nom existe déjà !</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>L'exécution du travail planifié existe déjà !</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>L'exécution du travail planifié est introuvable !</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>Seul un travail planifié en cours d'exécution peut être terminé !</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>La durée d'affichage de la page des travaux planifiés doit être un nombre positif !</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>Le type de planification n'est pas valide !</value>
|
||||
</data>
|
||||
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>Esiste già un processo pianificato con questo nome!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>L'esecuzione del processo pianificato esiste già!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>L'esecuzione del processo pianificato non è stata trovata!</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>Solo un processo pianificato in esecuzione può essere completato!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>L'intervallo di visualizzazione della pagina dei processi pianificati deve essere un numero positivo!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>Il tipo di pianificazione non è valido!</value>
|
||||
</data>
|
||||
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>この名前のスケジュールされたジョブは既に存在します!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>スケジュールされたジョブの実行は既に存在します!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>スケジュールされたジョブの実行が見つかりません!</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>実行中のスケジュールされたジョブのみ完了できます!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>スケジューラーページの表示期間は正の数である必要があります!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>スケジュールタイプが無効です!</value>
|
||||
</data>
|
||||
|
||||
+3
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>Only a running scheduled job can be completed!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>The display time span of the scheduler page must be a positive number!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>The schedule type is invalid!</value>
|
||||
</data>
|
||||
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>Există deja un job programat cu acest nume!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>Execuția jobului programat există deja!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>Execuția jobului programat nu a fost găsită!</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>Doar un job programat în execuție poate fi finalizat!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>Durata de afișare a paginii joburilor programate trebuie să fie un număr pozitiv!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>Tipul de programare este invalid!</value>
|
||||
</data>
|
||||
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>Плановане завдання з таким ім'ям вже існує!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>Виконання планованого завдання вже існує!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>Виконання планованого завдання не знайдено!</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>Завершити можна лише плановане завдання, що виконується!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>Період відображення сторінки планувальника має бути додатним числом!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>Тип розкладу недійсний!</value>
|
||||
</data>
|
||||
|
||||
+4
-1
@@ -757,7 +757,7 @@
|
||||
<value>已存在同名计划任务!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionAlreadyExists" xml:space="preserve">
|
||||
<value>The execution of the scheduled job already exists!</value>
|
||||
<value>计划任务的执行记录已存在!</value>
|
||||
</data>
|
||||
<data name="ScheduledJobExecutionNotFound" xml:space="preserve">
|
||||
<value>未找到计划任务的执行记录!</value>
|
||||
@@ -774,6 +774,9 @@
|
||||
<data name="CanOnlyCompleteRunningScheduledJob" xml:space="preserve">
|
||||
<value>只有运行中的计划任务才能完成!</value>
|
||||
</data>
|
||||
<data name="SchedulerDisplayTimeSpanMustBePositive" xml:space="preserve">
|
||||
<value>计划任务页面的显示时长必须是正数!</value>
|
||||
</data>
|
||||
<data name="InvalidScheduleType" xml:space="preserve">
|
||||
<value>调度类型无效!</value>
|
||||
</data>
|
||||
|
||||
@@ -214,6 +214,8 @@
|
||||
const removeJobUrlTemplate = '@_urlService.GetAbsoluteUrl(WebRoutes.Scheduler.REMOVE_SCHEDULED_JOB, new { scheduledJobId = default(Guid) })';
|
||||
const accessTokenUrl = '@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.GET_API_ACCESS_TOKEN)';
|
||||
const schedulerHubUrl = '@scheduledJobsHubUrl';
|
||||
const getDisplayPreferencesUrl = '@_urlService.GetAbsoluteUrl(WebRoutes.Scheduler.GET_DISPLAY_PREFERENCES)';
|
||||
const updateDisplayPreferencesUrl = '@_urlService.GetAbsoluteUrl(WebRoutes.Scheduler.UPDATE_DISPLAY_PREFERENCES)';
|
||||
|
||||
function getComboboxValue(combobox) {
|
||||
const selected = combobox.querySelector('.enlightenment-selected-text');
|
||||
@@ -238,26 +240,33 @@
|
||||
return () => combobox.removeEventListener('click', handler);
|
||||
}
|
||||
|
||||
// Persists the display preferences of the scheduler page (the job type filter, the time span and its unit) in the
|
||||
// browser, so that they are restored when the page is reloaded, and the graph and the jobs list respect them.
|
||||
const schedulerSettingsKey = 'luminaSchedulerSettings';
|
||||
|
||||
function readSchedulerSettings() {
|
||||
try {
|
||||
const storedSettings = localStorage.getItem(schedulerSettingsKey);
|
||||
return storedSettings ? JSON.parse(storedSettings) : {};
|
||||
} catch (error) {
|
||||
console.error('Failed to read the scheduler settings:', error);
|
||||
return {};
|
||||
}
|
||||
// Reads the display preferences of the scheduler page from its controls, as the payload sent to the update endpoint.
|
||||
function getDisplayPreferencesPayload() {
|
||||
const selectedJobType = getComboboxValue(jobTypeFilter) || 'All';
|
||||
return {
|
||||
jobTypeFilter: selectedJobType === 'All' ? null : selectedJobType,
|
||||
displayTimeSpan: Number(timespanInput.value),
|
||||
displayTimeUnit: getComboboxValue(timeunitSelect)
|
||||
};
|
||||
}
|
||||
|
||||
function writeSchedulerSettings(settings) {
|
||||
try {
|
||||
localStorage.setItem(schedulerSettingsKey, JSON.stringify(settings));
|
||||
} catch (error) {
|
||||
console.error('Failed to store the scheduler settings:', error);
|
||||
}
|
||||
// Persists the display preferences of the scheduler page (the job type filter, the time span and its unit) on the
|
||||
// server, so that they are shared by every client the current user signs in from, not only by the browser that changed them.
|
||||
async function persistDisplayPreferences() {
|
||||
await callApiPutAsync(updateDisplayPreferencesUrl, getDisplayPreferencesPayload());
|
||||
}
|
||||
|
||||
// Loads the display preferences of the current user from the server, and applies them to the controls, before the graph and
|
||||
// the jobs list are loaded; the server returns the default display preferences when none are stored for the user yet.
|
||||
async function applyDisplayPreferences() {
|
||||
const displayPreferences = await callApiGetAsync(getDisplayPreferencesUrl);
|
||||
if (!displayPreferences)
|
||||
return;
|
||||
setComboboxValue(jobTypeFilter, displayPreferences.jobTypeFilter || 'All');
|
||||
setComboboxValue(timeunitSelect, displayPreferences.displayTimeUnit || 'Minutes');
|
||||
const storedTimeSpan = Number(displayPreferences.displayTimeSpan);
|
||||
if (Number.isFinite(storedTimeSpan) && storedTimeSpan >= 1)
|
||||
timespanInput.value = storedTimeSpan;
|
||||
}
|
||||
|
||||
function setComboboxValue(combobox, value) {
|
||||
@@ -271,27 +280,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function persistDisplayPreferences() {
|
||||
const settings = {
|
||||
jobType: getComboboxValue(jobTypeFilter) || 'All',
|
||||
timespan: timespanInput.value,
|
||||
timeUnit: getComboboxValue(timeunitSelect)
|
||||
};
|
||||
writeSchedulerSettings(settings);
|
||||
}
|
||||
|
||||
// Restores the stored display preferences on the controls, before the graph and the jobs list are loaded.
|
||||
function applyDisplayPreferences() {
|
||||
const settings = readSchedulerSettings();
|
||||
if (settings.jobType)
|
||||
setComboboxValue(jobTypeFilter, settings.jobType);
|
||||
if (settings.timeUnit)
|
||||
setComboboxValue(timeunitSelect, settings.timeUnit);
|
||||
const storedTimespan = Number(settings.timespan);
|
||||
if (Number.isFinite(storedTimespan) && storedTimespan >= 1)
|
||||
timespanInput.value = storedTimespan;
|
||||
}
|
||||
|
||||
// Graph state.
|
||||
const taskTypeOrder = ['ScanMediaLibraries', 'CleanTemporaryFiles'];
|
||||
const graphState = {
|
||||
@@ -640,7 +628,7 @@
|
||||
async function updateTimeSpanAsync() {
|
||||
adjustTimeScale();
|
||||
graphState.dataPoints = [];
|
||||
persistDisplayPreferences();
|
||||
await persistDisplayPreferences();
|
||||
await loadHistoryAsync();
|
||||
}
|
||||
|
||||
@@ -744,7 +732,7 @@
|
||||
//+----------------------------------------------------------------------------------------+
|
||||
|
||||
async function initialize() {
|
||||
applyDisplayPreferences();
|
||||
await applyDisplayPreferences();
|
||||
renderLegend();
|
||||
graphState.startTime = new Date();
|
||||
graphState.startTime.setMinutes(0, 0, 0);
|
||||
@@ -767,16 +755,19 @@
|
||||
toggleScheduleFields();
|
||||
|
||||
// Persist the display preferences when they change, and reload the history when the job type filter changes,
|
||||
// so that the graph and the jobs list always respect the selected filter.
|
||||
const handleJobTypeFilterChange = () => {
|
||||
persistDisplayPreferences();
|
||||
// so that the graph and the jobs list always respect the selected filter, on every client of the current user.
|
||||
const handleJobTypeFilterChange = async () => {
|
||||
renderJobsTable();
|
||||
updateTimeSpanAsync();
|
||||
await updateTimeSpanAsync();
|
||||
};
|
||||
const unbindJobTypeFilterChange = bindComboboxChange(jobTypeFilter, handleJobTypeFilterChange);
|
||||
const unbindTimeUnitChange = bindComboboxChange(timeunitSelect, persistDisplayPreferences);
|
||||
const handleTimespanChange = () => persistDisplayPreferences();
|
||||
timespanInput.addEventListener('input', handleTimespanChange);
|
||||
const handleTimeUnitChange = async () => {
|
||||
await persistDisplayPreferences();
|
||||
};
|
||||
const unbindTimeUnitChange = bindComboboxChange(timeunitSelect, handleTimeUnitChange);
|
||||
const handleTimespanChange = async () => {
|
||||
await persistDisplayPreferences();
|
||||
};
|
||||
timespanInput.addEventListener('change', handleTimespanChange);
|
||||
updateTimespanButton.addEventListener('click', updateTimeSpanAsync);
|
||||
addJobButton.addEventListener('click', addJobAsync);
|
||||
@@ -790,7 +781,6 @@
|
||||
unbindScheduleTypeChange();
|
||||
unbindJobTypeFilterChange();
|
||||
unbindTimeUnitChange();
|
||||
timespanInput.removeEventListener('input', handleTimespanChange);
|
||||
timespanInput.removeEventListener('change', handleTimespanChange);
|
||||
updateTimespanButton.removeEventListener('click', updateTimeSpanAsync);
|
||||
addJobButton.removeEventListener('click', addJobAsync);
|
||||
|
||||
Reference in new issue
Block a user