Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
- Remove middleware reference from Gitea Traefik labels (caused routing issues) - Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s) - Add explicit service reference in Traefik labels - Fix intermittent 504 timeouts by improving PostgreSQL connection handling Fixes Gitea unreachability via git.michaelschiemer.de
54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
import { FormHandler } from './form-handling/FormHandler.js';
|
|
import { Logger } from '../core/logger.js';
|
|
|
|
/**
|
|
* FormAutoSave - Wrapper for FormHandler autosave functionality
|
|
*
|
|
* This module provides a simple interface to initialize autosave
|
|
* for all forms on the page. The actual autosave logic is implemented
|
|
* in FormHandler.
|
|
*/
|
|
export class FormAutoSave {
|
|
/**
|
|
* Initialize autosave for all forms on the page
|
|
* @param {Object} options - Options for autosave initialization
|
|
* @returns {Array} Array of initialized FormHandler instances
|
|
*/
|
|
static initializeAll(options = {}) {
|
|
const forms = document.querySelectorAll('form[data-autosave]');
|
|
const instances = [];
|
|
|
|
forms.forEach(form => {
|
|
try {
|
|
const handler = FormHandler.create(form, {
|
|
enableAutosave: true,
|
|
...options
|
|
});
|
|
instances.push(handler);
|
|
} catch (error) {
|
|
Logger.error('[FormAutoSave] Failed to initialize autosave for form', {
|
|
form: form.id || 'unnamed',
|
|
error
|
|
});
|
|
}
|
|
});
|
|
|
|
Logger.info(`[FormAutoSave] Initialized autosave for ${instances.length} forms`);
|
|
return instances;
|
|
}
|
|
|
|
/**
|
|
* Initialize autosave for a specific form
|
|
* @param {HTMLFormElement} form - The form element
|
|
* @param {Object} options - Options for autosave
|
|
* @returns {FormHandler} The FormHandler instance
|
|
*/
|
|
static initialize(form, options = {}) {
|
|
return FormHandler.create(form, {
|
|
enableAutosave: true,
|
|
...options
|
|
});
|
|
}
|
|
}
|
|
|