Page context menu: Purge from SSR cache

SsrPurgeItemProvider adds the item behind Clear cache for real pages (doktype < 199) whenever the purge endpoint is configured. The callback module posts the page uid to the new vitec_ssr_purge_page ajax route, which resolves the page path through the site router, purges it via SsrPurgeService (trigger contextmenu:username, logged as usual) and reports back as a toast notification.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
orascheandClaude Fable 5 committed 2026-11-09 21:10:30 +01:00
1 parent fa63871da7
commit 5b524bfce9
4 files changed
+132

No files matched your search

@@ -0,0 +1,27 @@
/**
* Context menu action "Purge from SSR cache" (SsrPurgeItemProvider).
* Posts the page uid to the vitec_ssr_purge_page ajax route and shows
* the outcome as a backend notification.
*/
import AjaxRequest from '@typo3/core/ajax/ajax-request.js';
import Notification from '@typo3/backend/notification.js';
class SsrContextMenuActions {
ssrPurge(table, uid) {
new AjaxRequest(TYPO3.settings.ajaxUrls.vitec_ssr_purge_page)
.post({ pageUid: uid })
.then(async (response) => {
const data = await response.resolve();
if (data.success) {
Notification.success('SSR cache purged', data.path + ' (' + data.message + ')', 5);
} else {
Notification.error('SSR purge failed', data.message || 'Unknown error', 8);
}
})
.catch(() => {
Notification.error('SSR purge failed', 'Request error - see purge protocol in the VITEC SSR module', 8);
});
}
}
export default new SsrContextMenuActions();