From bbe4ad938ad7a5a4b3fefac024a86742c26f9e7c Mon Sep 17 00:00:00 2001 From: Jeppe B <2jepp9350@gmail.com> Date: Mon, 13 Jul 2026 19:47:08 +0200 Subject: [PATCH] Add cron worker controls and align superuser specs --- src/i18n/generated/global-v2.json | 24 +- src/i18n/source/global/shared/cron/index.json | 24 +- src/services/superuserCron.js | 8 +- .../system/CronOperations.vue | 245 ++++++++++++++++-- tests/e2e/superuser-cron.spec.ts | 174 +++++++++++-- tests/e2e/superuser-security.spec.ts | 10 +- tests/e2e/superuser-users.spec.ts | 19 +- 7 files changed, 442 insertions(+), 62 deletions(-) diff --git a/src/i18n/generated/global-v2.json b/src/i18n/generated/global-v2.json index 3f144e9b..08343c0d 100644 --- a/src/i18n/generated/global-v2.json +++ b/src/i18n/generated/global-v2.json @@ -2141,6 +2141,11 @@ "seconds": "Every {value} s" }, "loading": "Loading cron tasks...", + "messages": { + "queued": "{task} was queued for the cron worker.", + "worker_deploy_queued": "Cron worker deployment was queued.", + "worker_update_queued": "Cron worker deployment update was queued." + }, "nav": "@:{'cron.title'}", "replication": "Replication", "states": { @@ -2175,7 +2180,24 @@ "status": "@:{'cron.history.status'}", "task": "@:{'cron.history.task'}" }, - "title": "Cron tasks" + "title": "Cron tasks", + "workers": { + "deploy": "Deploy worker", + "deploy_to_coolify": "Deploy to Coolify", + "empty": "No cron workers found.", + "heartbeat": "Heartbeat", + "last_run_count": "Last run count", + "loading": "Loading cron workers...", + "name": "Worker", + "running": "@:{'cron.status.running'}", + "source": "@:{'cron.history.source'}", + "stale": "Stale", + "status": "@:{'cron.history.status'}", + "target": "Target", + "title": "Cron workers", + "total": "Workers", + "update_deployment": "Update Coolify deployment" + } }, "customer_creation": { "customer": { diff --git a/src/i18n/source/global/shared/cron/index.json b/src/i18n/source/global/shared/cron/index.json index f9e267f0..57de0328 100644 --- a/src/i18n/source/global/shared/cron/index.json +++ b/src/i18n/source/global/shared/cron/index.json @@ -31,6 +31,11 @@ "seconds": "Every {value} s" }, "loading": "Loading cron tasks...", + "messages": { + "queued": "{task} was queued for the cron worker.", + "worker_deploy_queued": "Cron worker deployment was queued.", + "worker_update_queued": "Cron worker deployment update was queued." + }, "nav": "@:{'cron.title'}", "replication": "Replication", "states": { @@ -65,6 +70,23 @@ "status": "@:{'cron.history.status'}", "task": "@:{'cron.history.task'}" }, - "title": "Cron tasks" + "title": "Cron tasks", + "workers": { + "deploy": "Deploy worker", + "deploy_to_coolify": "Deploy to Coolify", + "empty": "No cron workers found.", + "heartbeat": "Heartbeat", + "last_run_count": "Last run count", + "loading": "Loading cron workers...", + "name": "Worker", + "running": "@:{'cron.status.running'}", + "source": "@:{'cron.history.source'}", + "stale": "Stale", + "status": "@:{'cron.history.status'}", + "target": "Target", + "title": "Cron workers", + "total": "Workers", + "update_deployment": "Update Coolify deployment" + } } } diff --git a/src/services/superuserCron.js b/src/services/superuserCron.js index 881b7508..9245f4ce 100644 --- a/src/services/superuserCron.js +++ b/src/services/superuserCron.js @@ -1,7 +1,6 @@ import { authenticatedRequest } from "@/components/session/authenticatedRequest.vue"; -export const listCronTasks = () => - authenticatedRequest("/superuser/cron", "GET", {}); +export const listCronTasks = () => authenticatedRequest("/superuser/cron", "GET", {}); export const listCronRuns = ({ taskId = null, limit = 50 } = {}) => authenticatedRequest("/superuser/cron/runs", "GET", { @@ -9,6 +8,11 @@ export const listCronRuns = ({ taskId = null, limit = 50 } = {}) => limit, }); +export const listCronWorkers = () => authenticatedRequest("/superuser/cron/workers", "GET", {}); + +export const deployCronWorkers = (payload = {}) => + authenticatedRequest("/superuser/cron/workers/deploy", "POST", payload); + export const runCronTask = (taskId, { force = false } = {}) => authenticatedRequest("/superuser/cron/run", "POST", { task_id: taskId, diff --git a/src/views/dashboards/superUserDashboard/system/CronOperations.vue b/src/views/dashboards/superUserDashboard/system/CronOperations.vue index 1e5bb51f..54e8ddbf 100644 --- a/src/views/dashboards/superUserDashboard/system/CronOperations.vue +++ b/src/views/dashboards/superUserDashboard/system/CronOperations.vue @@ -1,45 +1,78 @@