semantic markup update

This commit is contained in:
2026-01-18 21:29:54 +03:00
parent 11c59fb420
commit 76baeb1038
85 changed files with 7020 additions and 5953 deletions

View File

@@ -17,6 +17,8 @@
// [DEF:fetchTasks:Function]
// @PURPOSE: Fetches the list of recent tasks from the API.
// @PRE: None.
// @POST: tasks array is updated and selectedTask status synchronized.
async function fetchTasks() {
try {
const res = await fetch('/api/tasks?limit=10');
@@ -47,6 +49,8 @@
// [DEF:clearTasks:Function]
// @PURPOSE: Clears tasks from the history, optionally filtered by status.
// @PRE: User confirms deletion via prompt.
// @POST: Tasks are deleted from backend and list is re-fetched.
async function clearTasks(status = null) {
if (!confirm('Are you sure you want to clear tasks?')) return;
try {
@@ -66,6 +70,8 @@
// [DEF:selectTask:Function]
// @PURPOSE: Selects a task and fetches its full details.
// @PRE: task object is provided.
// @POST: selectedTask store is updated with full task details.
async function selectTask(task) {
try {
// Fetch the full task details (including logs) before setting it as selected
@@ -86,6 +92,8 @@
// [DEF:getStatusColor:Function]
// @PURPOSE: Returns the CSS color class for a given task status.
// @PRE: status string is provided.
// @POST: Returns tailwind color class string.
function getStatusColor(status) {
switch (status) {
case 'SUCCESS': return 'bg-green-100 text-green-800';
@@ -100,6 +108,8 @@
// [DEF:onMount:Function]
// @PURPOSE: Initializes the component by fetching tasks and starting polling.
// @PRE: Component is mounting.
// @POST: Tasks are fetched and 5s polling interval is started.
onMount(() => {
fetchTasks();
interval = setInterval(fetchTasks, 5000); // Poll every 5s
@@ -108,6 +118,8 @@
// [DEF:onDestroy:Function]
// @PURPOSE: Cleans up the polling interval when the component is destroyed.
// @PRE: Component is being destroyed.
// @POST: Polling interval is cleared.
onDestroy(() => {
clearInterval(interval);
});