Files
VITEC-website/packages/vitec/Resources/Public/Javascript/ssr-module.js
T
orascheandClaude Fable 5.1 086a178341 SSR module: rebuilt on TYPO3 module layout, cards and core components
Ticket 0096-FE (aehm): the module now uses the core Module layout (DocHeader with reload and shortcut, module-body spacing), a Status card as description list with one badge style, an Actions card with core buttons and icons, help texts below the buttons and TYPO3 modal confirmations (ssr-module.js) instead of window.confirm, and three protocol cards. Purge protocol rows show a one-line time, the trigger as badge plus user, paths as count + first two + disclosure, result and duration right-aligned, with 30/100/500 row switches. Status shows the last health sample with relative age and the cache limit (new optional SSR_CACHE_LIMIT_MB in var/vitec-ssr-purge.env, SsrPurgeService::getCacheLimitMb). ssr-warm-progress.js now also disables the Warm button with a spinner while a run is active. backend-ssr.css holds only layout glue with core CSS variables (dark mode safe). Verified in the backend: layout, modal, running progress bar, protocol tables.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-11 10:15:42 +01:00

43 lines
1.3 KiB
JavaScript

/**
* VITEC SSR module: TYPO3 modal confirmation for the destructive / heavy
* actions (Purge everything, Warm cache) instead of window.confirm.
* A form opts in with data-confirm="text" (+ data-confirm-title,
* data-confirm-ok, data-confirm-severity="danger|primary").
*/
import Modal from '@typo3/backend/modal.js';
import Severity from '@typo3/backend/severity.js';
document.querySelectorAll('form[data-confirm]').forEach((form) => {
form.addEventListener('submit', (event) => {
if (form.dataset.confirmed === '1') {
return;
}
event.preventDefault();
const danger = form.dataset.confirmSeverity === 'danger';
Modal.confirm(
form.dataset.confirmTitle || 'Please confirm',
form.dataset.confirm,
danger ? Severity.error : Severity.warning,
[
{
text: 'Cancel',
btnClass: 'btn-default',
name: 'cancel',
trigger: (e, modal) => modal.hideModal(),
},
{
text: form.dataset.confirmOk || 'Continue',
btnClass: danger ? 'btn-danger' : 'btn-primary',
name: 'ok',
active: true,
trigger: (e, modal) => {
modal.hideModal();
form.dataset.confirmed = '1';
form.requestSubmit();
},
},
],
);
});
});