Skip to content

Kitto.Web.Handler.Notification ​

Attribute-routed endpoints for the notification center and background-job results: the notifications partial (polled by the bell), the artifact download, and job removal (cancel a running job / delete a completed one / dismiss a failed one). The badge count equals the number of jobs currently in the list; a job leaves the list — deleting its artifact — when it is downloaded, cancelled, deleted or dismissed.

TKXNotificationHandler class ​

Serves the notification-center partial, job artifact downloads and job removal.

pascal
procedure HandleNotifications;

Returns the HTML fragment with the current user's jobs (running with a percentage and Cancel, completed with Download and Delete, failed with Remove) plus a data-count for the bell badge. Polled by htmx. Also runs the retention cleanup of forgotten jobs.

pascal
procedure HandleJobDownload([TKXPathParam('JobId')] const AJobId: string);

Streams the artifact produced by a completed job to the client, then removes the job from the list and deletes its artifact (downloading takes it out of the list). [TKXNavigable]: reachable by the top-level browser navigation of the download link, still requiring the auth cookie.

pascal
procedure HandleJobRemove([TKXPathParam('JobId')] const AJobId: string);

Removes a job from the list — stopping it if running — and deletes its artifact. Serves Cancel (running/queued), Delete (completed) and Remove (failed). Returns the refreshed notifications partial.

pascal
procedure HandleClearAll;

Removes every job of the current user in one go (the "clear all" trash in the panel header), deleting their artifacts, and returns the refreshed (empty) notifications partial.

Released under Apache License, Version 2.0.