diff --git a/components/job_form.templ b/components/job_form.templ index c6df338..4d2b8cd 100644 --- a/components/job_form.templ +++ b/components/job_form.templ @@ -295,9 +295,11 @@ templ scheduleBuilderScript() { const updateCronExpression = () => { const scheduleType = scheduleTypeSelect.value; let cronExpression = ''; + let hasError = false; switch (scheduleType) { case 'interval': + const intervalValueEl = document.getElementById(`${prefixId}interval-value`); const intervalValue = document.getElementById(`${prefixId}interval-value`).value || '15'; const intervalUnit = document.getElementById(`${prefixId}interval-unit`).value || 'minutes'; @@ -457,13 +459,25 @@ templ scheduleBuilderScript() { if (scheduleTypeSelect.value !== 'custom') { updateCronExpression(); } + + // Also validate the schedule builder when type changes + if (window.validateScheduleFields) { + window.validateScheduleFields(prefixId); + } }); // Add listeners to all schedule builder inputs const attachListeners = (selector) => { const elements = document.querySelectorAll(selector); elements.forEach(el => { - el.addEventListener('change', updateCronExpression); + el.addEventListener('change', () => { + updateCronExpression(); + + // Also validate this field when value changes + if (window.validateScheduleFields) { + window.validateScheduleFields(prefixId); + } + }); el.addEventListener('input', updateCronExpression); }); }; @@ -482,10 +496,480 @@ templ scheduleBuilderScript() { } +templ formValidationScript() { + +} + templ JobForm(ctx context.Context, data JobFormData) { @LayoutWithContext(getJobFormTitle(data.IsNew), ctx) { @configSearchScript() @scheduleBuilderScript() + @formValidationScript() @@ -520,6 +1004,16 @@ templ JobForm(ctx context.Context, data JobFormData) { if data.IsNew { + + + + + Please fix the following errors: + + + + + @@ -541,6 +1035,7 @@ templ JobForm(ctx context.Context, data JobFormData) { id="name" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full ps-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Daily Production Backup" + maxlength="100" /> @@ -552,7 +1047,7 @@ templ JobForm(ctx context.Context, data JobFormData) { - Schedule Type + Schedule Type * @@ -618,6 +1114,7 @@ templ JobForm(ctx context.Context, data JobFormData) { class="bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" min="0" max="59" + placeholder="MM" value="0" /> @@ -763,6 +1260,7 @@ templ JobForm(ctx context.Context, data JobFormData) { name="schedule" id="schedule" required + aria-required="true" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full ps-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="*/15 * * * *" value="*/15 * * * *" @@ -874,13 +1372,23 @@ templ JobForm(ctx context.Context, data JobFormData) { Cancel - + Create Job } else { + + + + + Please fix the following errors: + + + + + @@ -889,7 +1397,7 @@ templ JobForm(ctx context.Context, data JobFormData) { - + Job Name @@ -899,10 +1407,11 @@ templ JobForm(ctx context.Context, data JobFormData) { @@ -914,7 +1423,7 @@ templ JobForm(ctx context.Context, data JobFormData) { - Schedule Type + Schedule Type * @@ -980,6 +1490,7 @@ templ JobForm(ctx context.Context, data JobFormData) { class="bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5" min="0" max="59" + placeholder="MM" value="0" /> @@ -1126,6 +1637,7 @@ templ JobForm(ctx context.Context, data JobFormData) { id="edit-schedule" value={ data.Job.Schedule } required + aria-required="true" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full ps-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="*/15 * * * *" /> @@ -1239,7 +1751,7 @@ templ JobForm(ctx context.Context, data JobFormData) { Cancel - + Save Changes diff --git a/internal/logging/logger.go b/internal/logging/logger.go index f1264a7..ecdf698 100644 --- a/internal/logging/logger.go +++ b/internal/logging/logger.go @@ -114,13 +114,13 @@ func (l *Logger) Write(p []byte) (n int, err error) { level, source, message := parseLogEntry(logLine) // *** DEBUG: Print parsed result to stderr *** - fmt.Fprintf(os.Stderr, "[DEBUG-LOGGER-V2] Parsed: Level='%s', Source='%s', Message='%s'\n", level, source, strings.TrimSpace(message)) + fmt.Fprintf(os.Stderr, "[DEBUG-LOGGER] Parsed: Level='%s', Source='%s', Message='%s'\n", level, source, strings.TrimSpace(message)) // --- TEMPORARILY DISABLED FILTER --- /* // Don't broadcast logs about WebSocket activity to avoid potential loops if source == "handler" || source == "admin_handlers" || strings.Contains(message, "WebSocket") || strings.Contains(message, "Broadcasting log") || source == "routes" { - fmt.Fprintf(os.Stderr, "[DEBUG-LOGGER-V2] Filtered out log from source '%s'\n", source) + fmt.Fprintf(os.Stderr, "[DEBUG-LOGGER] Filtered out log from source '%s'\n", source) return n, nil } */ @@ -128,10 +128,10 @@ func (l *Logger) Write(p []byte) (n int, err error) { // Broadcast to WebSocket clients if handlers are initialized if handlers, ok := web.GetHandlersInstance(); ok && handlers != nil { - fmt.Fprintf(os.Stderr, "[DEBUG-LOGGER-V2] Broadcasting: Level='%s', Source='%s'\n", level, source) + fmt.Fprintf(os.Stderr, "[DEBUG-LOGGER] Broadcasting: Level='%s', Source='%s'\n", level, source) handlers.BroadcastLog(level, message, source) // Pass parsed values } else { - fmt.Fprintf(os.Stderr, "[DEBUG-LOGGER-V2] Skipped broadcast: handlers not ready\n") + fmt.Fprintf(os.Stderr, "[DEBUG-LOGGER] Skipped broadcast: handlers not ready\n") } return n, nil // Return the number of bytes written and no error
@@ -552,7 +1047,7 @@ templ JobForm(ctx context.Context, data JobFormData) {
@@ -914,7 +1423,7 @@ templ JobForm(ctx context.Context, data JobFormData) {