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();