From 131d9093b00ffa11db0531f10cbb1cbd0f0ccb29 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sat, 23 May 2026 17:22:52 -0400 Subject: [PATCH] Scheduler: Run button, single card-level Save, remove per-row Save MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Run button (blue) fires script immediately, opens log panel; stamps log with manual run timestamp before exec - Save moved to card footer — one button saves all cron expressions for the orchestrator and all its children at once - Toggle still auto-saves immediately on flip (enable/disable is instant) - Removed onblur from cron inputs — cron only saves on explicit Save - api/run.php: validates id, appends timestamp, execs script in background --- .../local/emhttp/plugins/varaverk/api/run.php | 28 ++++++ .../emhttp/plugins/varaverk/css/varaverk.css | 11 +++ .../plugins/varaverk/pages/scheduler.php | 99 ++++++++++++++----- 3 files changed, 114 insertions(+), 24 deletions(-) create mode 100644 Plugin/usr/local/emhttp/plugins/varaverk/api/run.php diff --git a/Plugin/usr/local/emhttp/plugins/varaverk/api/run.php b/Plugin/usr/local/emhttp/plugins/varaverk/api/run.php new file mode 100644 index 0000000..e438617 --- /dev/null +++ b/Plugin/usr/local/emhttp/plugins/varaverk/api/run.php @@ -0,0 +1,28 @@ + false, 'error' => 'Invalid id']); + exit; +} + +$script = SCRIPTS_DIR . '/' . $id; +if (!file_exists($script)) { + echo json_encode(['ok' => false, 'error' => 'Script not found: ' . $id]); + exit; +} + +$logFile = vv_job_log_path($id); +$logDir = dirname($logFile); +if (!is_dir($logDir)) mkdir($logDir, 0755, true); + +// Stamp the log so the panel shows when the run started +file_put_contents($logFile, date('[Y-m-d H:i:s]') . " Manual run started\n", FILE_APPEND); + +exec('bash ' . escapeshellarg($script) . ' >> ' . escapeshellarg($logFile) . ' 2>&1 &'); + +echo json_encode(['ok' => true]); diff --git a/Plugin/usr/local/emhttp/plugins/varaverk/css/varaverk.css b/Plugin/usr/local/emhttp/plugins/varaverk/css/varaverk.css index ef38636..1f5ac25 100644 --- a/Plugin/usr/local/emhttp/plugins/varaverk/css/varaverk.css +++ b/Plugin/usr/local/emhttp/plugins/varaverk/css/varaverk.css @@ -51,6 +51,17 @@ .vv-btn-sm:hover { border-color: #888; color: #fff; } .vv-btn-sm.active { border-color: #4caf50; color: #4caf50; } +/* Card footer */ +.vv-card-footer { display: flex; align-items: center; gap: 10px; + margin-top: 12px; padding-top: 10px; border-top: 1px solid #333; } +.vv-save-btn { padding: 5px 18px; background: #4caf50; border: none; color: #fff; + border-radius: 4px; cursor: pointer; font-size: 13px; } +.vv-save-btn:hover { background: #388e3c; } +.vv-save-status { font-size: 12px; color: #aaa; } +.vv-run-btn { border-color: #2196f3 !important; color: #2196f3 !important; } +.vv-run-btn:hover { background: #0d47a1 !important; color: #fff !important; + border-color: #2196f3 !important; } + /* Log panel */ .vv-log-panel { margin-top: 10px; border-top: 1px solid #333; padding-top: 8px; } .vv-log-toolbar { display: flex; justify-content: space-between; align-items: center; diff --git a/Plugin/usr/local/emhttp/plugins/varaverk/pages/scheduler.php b/Plugin/usr/local/emhttp/plugins/varaverk/pages/scheduler.php index 94ec3bd..dc37cc8 100644 --- a/Plugin/usr/local/emhttp/plugins/varaverk/pages/scheduler.php +++ b/Plugin/usr/local/emhttp/plugins/varaverk/pages/scheduler.php @@ -4,16 +4,16 @@ $tree = vv_job_tree(); ?>
-

Orchestrators run their child scripts in the correct order. - Disable an orchestrator and enable individual scripts below it to run them - in isolation for debugging or testing.

+

Toggle enables/saves immediately. Edit cron expressions then hit + Save at the bottom of the card. Run fires the script + now and opens its log.

-
- + @@ -77,22 +83,67 @@ $tree = vv_job_tree();