From e2e775c0732c0da7c0686bf3aacd695fe66e2177 Mon Sep 17 00:00:00 2001 From: Flaminel Date: Mon, 9 Jun 2025 00:52:53 +0300 Subject: [PATCH] fix some job stuff --- code/Common/Helpers/Constants.cs | 1 + code/Executable/Jobs/BackgroundJobManager.cs | 8 +- .../app/settings/styles/settings-shared.scss | 144 ++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) diff --git a/code/Common/Helpers/Constants.cs b/code/Common/Helpers/Constants.cs index 9cc8a11f..8e7de886 100644 --- a/code/Common/Helpers/Constants.cs +++ b/code/Common/Helpers/Constants.cs @@ -3,6 +3,7 @@ public static class Constants { public static readonly TimeSpan TriggerMaxLimit = TimeSpan.FromHours(6); + public static readonly TimeSpan TriggerMinLimit = TimeSpan.FromSeconds(30); public static readonly TimeSpan CacheLimitBuffer = TimeSpan.FromHours(2); public const string HttpClientWithRetryName = "retry"; diff --git a/code/Executable/Jobs/BackgroundJobManager.cs b/code/Executable/Jobs/BackgroundJobManager.cs index ce079552..5c30745a 100644 --- a/code/Executable/Jobs/BackgroundJobManager.cs +++ b/code/Executable/Jobs/BackgroundJobManager.cs @@ -1,5 +1,6 @@ using Common.Configuration.DownloadCleaner; using Common.Configuration.QueueCleaner; +using Common.Exceptions; using Common.Helpers; using Infrastructure.Configuration; using Infrastructure.Verticals.DownloadCleaner; @@ -160,7 +161,12 @@ public class BackgroundJobManager : IHostedService if (triggerValue > Constants.TriggerMaxLimit) { - throw new Exception($"{cronExpression} should have a fire time of maximum {Constants.TriggerMaxLimit.TotalHours} hours"); + throw new ValidationException($"{cronExpression} should have a fire time of maximum {Constants.TriggerMaxLimit.TotalHours} hours"); + } + + if (triggerValue < Constants.TriggerMinLimit) + { + throw new ValidationException($"{cronExpression} should have a fire time of minimum {Constants.TriggerMinLimit.TotalSeconds} seconds"); } if (triggerValue > StaticConfiguration.TriggerValue) diff --git a/code/UI/src/app/settings/styles/settings-shared.scss b/code/UI/src/app/settings/styles/settings-shared.scss index e69de29b..194680dd 100644 --- a/code/UI/src/app/settings/styles/settings-shared.scss +++ b/code/UI/src/app/settings/styles/settings-shared.scss @@ -0,0 +1,144 @@ +/* Queue Cleaner Settings Styles */ + +/* Card styles matching dashboard */ +::ng-deep .settings-card { + height: 100%; + transition: transform 0.3s, box-shadow 0.3s; + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); + border: 1px solid var(--surface-border); + + &:hover { + transform: translateY(-2px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); + } + + .p-card-header { + padding: 0; + } + + .card-title { + font-size: 1.25rem; + font-weight: 600; + margin-bottom: 0.25rem; + } + + .card-subtitle { + color: var(--text-color-secondary); + font-size: 0.875rem; + } + + .p-card-body { + height: 100%; + display: flex; + flex-direction: column; + padding: 0; + } + + .p-card-content { + flex-grow: 1; + padding: 1.5rem; + height: 100%; + } + + /* Accordion disabled state */ + .p-accordion .p-accordion-tab.p-disabled { + opacity: 0.6; + + .p-accordion-header .p-accordion-header-link { + cursor: not-allowed; + color: var(--text-color-secondary); + } + } +} + +/* Header title container and status tag styles */ +.header-title-container { + display: flex; + flex-direction: column; + + h2 { + margin: 0; + line-height: 1.2; + } + + .card-subtitle { + margin-top: 0.25rem; + } +} + +/* Form layout and structure */ +.field-row { + display: flex; + margin-bottom: 1.25rem; + align-items: flex-start; + + &:last-child { + margin-bottom: 0; + } +} + +.field-label { + flex: 0 0 200px; + padding-top: 0.5rem; + font-weight: 500; +} + +.field-input { + flex: 1; + max-width: 600px; +} + +.form-helper-text { + display: block; + margin-top: 0.25rem; + color: var(--text-color-secondary); + font-size: 0.85rem; +} + +/* Schedule input specific styles */ +.schedule-input { + display: flex; + align-items: center; + gap: 0.5rem; + + .schedule-label { + font-weight: 500; + margin-right: 0.5rem; + } + + .schedule-value { + width: 70px; + text-align: center; + } + + ::ng-deep .p-selectbutton .p-button { + padding: 0.5rem 0.75rem; + } +} + +/* Card footer styling */ +.card-footer { + display: flex; + justify-content: flex-end; + gap: 0.5rem; + padding-top: 1rem; + border-top: 1px solid var(--surface-border); +} + +/* Responsive adjustments */ +@media (max-width: 768px) { + .field-row { + flex-direction: column; + } + + .field-label { + flex: 0 0 auto; + margin-bottom: 0.5rem; + padding-top: 0; + } + + .field-input { + width: 100%; + max-width: 100%; + } +}