Varaverk: suggested cron hints left of every cron input
- vv_script_children() now calls vv_script_suggested_cron() per child, adding suggested_cron and suggested_label to each child entry - Orch rows (non-event) and regular script child rows render a faint .vv-cron-hint span to the left of the cron input showing the suggested cron from the script's # Schedule: header - Clicking the hint fills in the cron input (data-cron + onclick) - Tooltip shows full "suggested_cron — label" string on hover - .vv-cron-hint: color #444, brightens to #888 on hover
This commit is contained in:
@@ -57,6 +57,10 @@
|
|||||||
cursor: default; }
|
cursor: default; }
|
||||||
.vv-cron { flex: 0 0 110px; width: 110px; background: #111; border: 1px solid #444; color: #ddd;
|
.vv-cron { flex: 0 0 110px; width: 110px; background: #111; border: 1px solid #444; color: #ddd;
|
||||||
padding: 4px 6px; border-radius: 4px; font-family: monospace; font-size: 13px; }
|
padding: 4px 6px; border-radius: 4px; font-family: monospace; font-size: 13px; }
|
||||||
|
.vv-cron-hint { font-size: 11px; font-family: monospace; color: #444; cursor: pointer;
|
||||||
|
white-space: nowrap; flex-shrink: 0; padding: 3px 5px; border-radius: 3px;
|
||||||
|
user-select: none; transition: color 0.15s; }
|
||||||
|
.vv-cron-hint:hover { color: #888; background: rgba(255,255,255,0.04); }
|
||||||
.vv-event-badge { flex: 0 0 auto; padding: 3px 8px; border-radius: 4px; font-size: 12px;
|
.vv-event-badge { flex: 0 0 auto; padding: 3px 8px; border-radius: 4px; font-size: 12px;
|
||||||
background: #1a3a1a; border: 1px solid #2e6b2e; color: #6fcf6f;
|
background: #1a3a1a; border: 1px solid #2e6b2e; color: #6fcf6f;
|
||||||
white-space: nowrap; font-weight: 500; }
|
white-space: nowrap; font-weight: 500; }
|
||||||
|
|||||||
@@ -400,16 +400,19 @@ function vv_script_children(string $orchPath, array $schedule): array {
|
|||||||
$seen[$rel] = true;
|
$seen[$rel] = true;
|
||||||
$entry = $schedule[$rel] ?? ['enabled' => false, 'cron' => ''];
|
$entry = $schedule[$rel] ?? ['enabled' => false, 'cron' => ''];
|
||||||
$conf = $confMap[$rel] ?? ['array' => null, 'enabled' => null, 'managed' => false];
|
$conf = $confMap[$rel] ?? ['array' => null, 'enabled' => null, 'managed' => false];
|
||||||
|
$suggested = vv_script_suggested_cron("$scriptsDir/$rel");
|
||||||
$children[] = [
|
$children[] = [
|
||||||
'id' => $rel,
|
'id' => $rel,
|
||||||
'label' => basename($rel, '.sh'),
|
'label' => basename($rel, '.sh'),
|
||||||
'desc' => vv_script_description("$scriptsDir/$rel"),
|
'desc' => vv_script_description("$scriptsDir/$rel"),
|
||||||
'type' => 'script',
|
'type' => 'script',
|
||||||
'enabled' => (bool)($entry['enabled'] ?? false),
|
'enabled' => (bool)($entry['enabled'] ?? false),
|
||||||
'cron' => $entry['cron'] ?? '',
|
'cron' => $entry['cron'] ?? '',
|
||||||
'log_enabled' => (bool)($entry['log_enabled'] ?? false),
|
'log_enabled' => (bool)($entry['log_enabled'] ?? false),
|
||||||
'conf_managed' => $conf['managed'],
|
'conf_managed' => $conf['managed'],
|
||||||
'conf_enabled' => $conf['enabled'], // null if not in any *_SCRIPTS array
|
'conf_enabled' => $conf['enabled'], // null if not in any *_SCRIPTS array
|
||||||
|
'suggested_cron' => $suggested['cron'],
|
||||||
|
'suggested_label' => $suggested['label'],
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,14 @@ foreach ($tree as $orch) {
|
|||||||
<span class="vv-event-badge"><?= $orch['cron'] === '@array_start' ? '⚡ Array Start' : '⚡ Array Stop' ?></span>
|
<span class="vv-event-badge"><?= $orch['cron'] === '@array_start' ? '⚡ Array Start' : '⚡ Array Stop' ?></span>
|
||||||
<input type="hidden" class="vv-cron" value="<?= htmlspecialchars($orch['cron']) ?>">
|
<input type="hidden" class="vv-cron" value="<?= htmlspecialchars($orch['cron']) ?>">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<?php if ($orch['suggested_cron']): ?>
|
||||||
|
<span class="vv-cron-hint"
|
||||||
|
data-cron="<?= htmlspecialchars($orch['suggested_cron']) ?>"
|
||||||
|
onclick="this.nextElementSibling.value=this.dataset.cron"
|
||||||
|
title="Suggested: <?= htmlspecialchars($orch['suggested_cron'] . ($orch['suggested_label'] ? ' — ' . $orch['suggested_label'] : '')) ?>">
|
||||||
|
<?= htmlspecialchars($orch['suggested_cron']) ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
<input type="text" class="vv-cron" value="<?= htmlspecialchars($orch['cron']) ?>"
|
<input type="text" class="vv-cron" value="<?= htmlspecialchars($orch['cron']) ?>"
|
||||||
placeholder="cron expression">
|
placeholder="cron expression">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -106,6 +114,14 @@ foreach ($tree as $orch) {
|
|||||||
<span class="vv-slider"></span>
|
<span class="vv-slider"></span>
|
||||||
</label>
|
</label>
|
||||||
<span class="vv-job-label"><?= htmlspecialchars($child['label']) ?></span>
|
<span class="vv-job-label"><?= htmlspecialchars($child['label']) ?></span>
|
||||||
|
<?php if (!empty($child['suggested_cron'])): ?>
|
||||||
|
<span class="vv-cron-hint"
|
||||||
|
data-cron="<?= htmlspecialchars($child['suggested_cron']) ?>"
|
||||||
|
onclick="this.nextElementSibling.value=this.dataset.cron"
|
||||||
|
title="Suggested: <?= htmlspecialchars($child['suggested_cron'] . (!empty($child['suggested_label']) ? ' — ' . $child['suggested_label'] : '')) ?>">
|
||||||
|
<?= htmlspecialchars($child['suggested_cron']) ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
<input type="text" class="vv-cron" value="<?= htmlspecialchars($child['cron']) ?>"
|
<input type="text" class="vv-cron" value="<?= htmlspecialchars($child['cron']) ?>"
|
||||||
placeholder="cron (orch off only)">
|
placeholder="cron (orch off only)">
|
||||||
<span class="vv-save-check"></span>
|
<span class="vv-save-check"></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user