Scheduler: extra args input on script rows
- Tools and Custom: args input always visible (translucent at rest, full on hover) - Orch children: args input hidden when orch is on, shown when orch is off (same toggle as the cron field — orch off = standalone mode) - vvRunJob/vvDryRun: pick up .vv-script-args value, POST as extra_args - run.php / dryrun.php: accept extra_args, validate against shell metacharacters, append to run_job.sh invocation (flows through SCRIPT_ARGS to the script) - CSS: .vv-script-args — 30% opacity at rest, 100% on hover/focus
This commit is contained in:
@@ -185,6 +185,8 @@ $runningScripts = array_unique($runningScripts);
|
||||
onchange="vvSaveJob(this)">
|
||||
<span>Verbose</span>
|
||||
</label>
|
||||
<input type="text" class="vv-script-args" placeholder="extra args"
|
||||
style="display:<?= $orch['enabled'] ? 'none' : '' ?>">
|
||||
<span class="vv-job-dot"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -236,6 +238,7 @@ $runningScripts = array_unique($runningScripts);
|
||||
onchange="vvSaveJob(this)">
|
||||
<span>Verbose</span>
|
||||
</label>
|
||||
<input type="text" class="vv-script-args" placeholder="extra args">
|
||||
<span class="vv-job-dot"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -293,6 +296,7 @@ $runningScripts = array_unique($runningScripts);
|
||||
<?php $csLog = vv_job_log_path($cs['id']); ?>
|
||||
<button class="vv-btn-sm vv-log-btn<?= (file_exists($csLog) && filesize($csLog) > 0) ? ' vv-has-log' : '' ?>" onclick="vvSelectLog(this)">Log</button>
|
||||
<label class="vv-log-label"><input type="checkbox" class="vv-log-enabled" <?= $cs['log_enabled'] ? 'checked' : '' ?> onchange="vvSaveJob(this)"><span>Verbose</span></label>
|
||||
<input type="text" class="vv-script-args" placeholder="extra args">
|
||||
<span class="vv-job-dot"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -335,6 +339,7 @@ $runningScripts = array_unique($runningScripts);
|
||||
onchange="vvSaveJob(this)">
|
||||
<span>Verbose</span>
|
||||
</label>
|
||||
<input type="text" class="vv-script-args" placeholder="extra args">
|
||||
<span class="vv-job-dot"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1268,13 +1273,16 @@ function vvGitPull(btn) {
|
||||
}
|
||||
|
||||
function vvRunJob(btn) {
|
||||
const job = btn.closest('[data-id]');
|
||||
const id = job.dataset.id;
|
||||
const location = job.querySelector('.vv-rsync-location')?.value.trim() || '';
|
||||
const job = btn.closest('[data-id]');
|
||||
const id = job.dataset.id;
|
||||
const location = job.querySelector('.vv-rsync-location')?.value.trim() || '';
|
||||
const extra_args = job.querySelector('.vv-script-args')?.value.trim() || '';
|
||||
vvOpenRight(id);
|
||||
vvSetDot(id);
|
||||
vvRunningSet.add(id);
|
||||
const data = location ? {id, location} : {id};
|
||||
const data = {id};
|
||||
if (location) data.location = location;
|
||||
if (extra_args) data.extra_args = extra_args;
|
||||
vvPost('/plugins/varaverk/api/run.php', data)
|
||||
.then(d => {
|
||||
if (!d.ok) {
|
||||
@@ -1286,13 +1294,16 @@ function vvRunJob(btn) {
|
||||
}
|
||||
|
||||
function vvDryRun(btn) {
|
||||
const job = btn.closest('[data-id]');
|
||||
const id = job.dataset.id;
|
||||
const location = job.querySelector('.vv-rsync-location')?.value.trim() || '';
|
||||
const job = btn.closest('[data-id]');
|
||||
const id = job.dataset.id;
|
||||
const location = job.querySelector('.vv-rsync-location')?.value.trim() || '';
|
||||
const extra_args = job.querySelector('.vv-script-args')?.value.trim() || '';
|
||||
vvOpenRight(id);
|
||||
vvSetDot(id);
|
||||
vvRunningSet.add(id);
|
||||
const data = location ? {id, location} : {id};
|
||||
const data = {id};
|
||||
if (location) data.location = location;
|
||||
if (extra_args) data.extra_args = extra_args;
|
||||
vvPost('/plugins/varaverk/api/dryrun.php', data)
|
||||
.then(d => {
|
||||
if (!d.ok) {
|
||||
@@ -1395,18 +1406,21 @@ function vvApplyOrchState(orchCard, orchEnabled) {
|
||||
const confManaged = child.dataset.confManaged === '1';
|
||||
const confEnabled = child.dataset.confEnabled === '1';
|
||||
|
||||
const argsInput = child.querySelector('.vv-script-args');
|
||||
if (orchEnabled) {
|
||||
// Orch is god: set toggle from master.conf state; dim independent cron.
|
||||
// If not conf-managed (no *_SCRIPTS array, e.g. transcode), orch hardcodes the call —
|
||||
// show as enabled so the user sees the script is active.
|
||||
toggle.checked = confManaged ? confEnabled : true;
|
||||
toggle.disabled = false;
|
||||
if (cronInput) { cronInput.disabled = true; cronInput.style.opacity = '0.35'; }
|
||||
if (cronInput) { cronInput.disabled = true; cronInput.style.opacity = '0.35'; }
|
||||
if (argsInput) { argsInput.style.display = 'none'; }
|
||||
} else {
|
||||
// Orch off: all children switch off; cron field becomes active
|
||||
// Orch off: all children switch off; cron and args become active
|
||||
toggle.checked = false;
|
||||
toggle.disabled = false;
|
||||
if (cronInput) { cronInput.disabled = false; cronInput.style.opacity = ''; }
|
||||
if (cronInput) { cronInput.disabled = false; cronInput.style.opacity = ''; }
|
||||
if (argsInput) { argsInput.style.display = ''; }
|
||||
// Persist the off state to schedule.json so cron rebuild reflects it
|
||||
const cid = child.dataset.id;
|
||||
const ccron = cronInput?.value.trim() ?? '';
|
||||
|
||||
Reference in New Issue
Block a user