Monitor layout (8-col grid): - Row 1: System | Power | CPU | Memory | Network - Row 2: Scripts | Partner & Fallback (span 3) | Containers & VMs (span 4) - Row 3: GPU (span 2) | Transcode (span 2) | Streams (span 4) - Row 4: Parity (cols 1-2) | Pools (cols 3-4) | Array (cols 5-8) New Containers & VMs card: - Reads FolderView3 folders from docker.json; expand/collapse per folder - VMs listed first (virsh); containers show start/stop/webui/edit actions - 2-column balanced layout; collapses to 1 column below 900px - Docker WebUI URLs resolved from dockerMan template XMLs New files: include/vms.php, include/docker_folders.php, api/docker_action.php, api/snapshot.php Responsive: explicit grid-column placements reset at 1024px breakpoint
46 lines
1.6 KiB
PHP
46 lines
1.6 KiB
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
require_once dirname(__DIR__) . '/include/scheduler.php';
|
|
|
|
// Batch save — all entries in one load/write/rebuild cycle
|
|
if (!empty($_POST['batch'])) {
|
|
$entries = json_decode($_POST['batch'], true) ?: [];
|
|
$clean = [];
|
|
foreach ($entries as $e) {
|
|
$id = trim($e['id'] ?? '');
|
|
$cron = trim($e['cron'] ?? '');
|
|
if (!$id) continue;
|
|
if ($cron && !in_array($cron, ['@array_start', '@array_stop'], true)
|
|
&& !preg_match('/^(\S+\s+){4}\S+$/', $cron)) $cron = '';
|
|
$clean[] = [
|
|
'id' => $id,
|
|
'enabled' => ($e['enabled'] ?? '0') === '1',
|
|
'cron' => $cron,
|
|
'log_enabled' => ($e['log_enabled'] ?? '0') === '1',
|
|
];
|
|
}
|
|
$ok = vv_schedule_update_batch($clean);
|
|
echo json_encode(['ok' => $ok, 'error' => $ok ? null : 'Failed to write schedule']);
|
|
exit;
|
|
}
|
|
|
|
$id = trim($_POST['id'] ?? '');
|
|
$enabled = (bool)($_POST['enabled'] ?? false);
|
|
$cron = trim($_POST['cron'] ?? '');
|
|
$log_enabled = ($_POST['log_enabled'] ?? '0') === '1';
|
|
|
|
if (!$id) {
|
|
echo json_encode(['ok' => false, 'error' => 'Missing id']);
|
|
exit;
|
|
}
|
|
|
|
// Basic cron validation — 5 fields, or known @event trigger, or empty
|
|
if ($cron && !in_array($cron, ['@array_start', '@array_stop'], true)
|
|
&& !preg_match('/^(\S+\s+){4}\S+$/', $cron)) {
|
|
echo json_encode(['ok' => false, 'error' => 'Invalid cron expression']);
|
|
exit;
|
|
}
|
|
|
|
$ok = vv_schedule_update($id, $enabled, $cron, $log_enabled);
|
|
echo json_encode(['ok' => $ok, 'error' => $ok ? null : 'Failed to write schedule']);
|