- New Docker tab (between Scheduler and Watchdog) - Reads /boot/config/plugins/folder.view3/docker.json — fully compatible with folder.view3 plugin - Writes changes to both docker.json AND HOST*_DOCKER_FOLDER_MAP in host*.conf simultaneously - Edit mode: rename folders (inline input), delete folders, move containers via popover picker, create new folders - Drift banner: highlights containers where conf desired state doesn't match json actual state - Sync conf→JSON: apply conf desired state to json (fixes drift after onboard) - Sync JSON→conf: capture manual json edits back into conf - Ungrouped section shows all containers not assigned to any folder - Onboard scripts can read HOST*_DOCKER_FOLDER_MAP to auto-place new containers
32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
require_once dirname(__DIR__) . '/include/docker.php';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
|
echo json_encode(vv_dk_all());
|
|
exit;
|
|
}
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
http_response_code(405);
|
|
echo json_encode(['ok' => false, 'error' => 'GET or POST only']);
|
|
exit;
|
|
}
|
|
|
|
$action = trim($_POST['action'] ?? '');
|
|
$container = trim($_POST['container'] ?? '');
|
|
$folderId = trim($_POST['folder_id'] ?? '');
|
|
$name = trim($_POST['name'] ?? '');
|
|
|
|
$result = match ($action) {
|
|
'move_container' => vv_dk_move_container($container, $folderId),
|
|
'create_folder' => vv_dk_create_folder($name),
|
|
'rename_folder' => vv_dk_rename_folder($folderId, $name),
|
|
'delete_folder' => vv_dk_delete_folder($folderId),
|
|
'sync_conf_to_json'=> vv_dk_sync_conf_to_json(),
|
|
'sync_json_to_conf'=> vv_dk_sync_json_to_conf(),
|
|
default => ['ok' => false, 'error' => 'Unknown action: ' . $action],
|
|
};
|
|
|
|
echo json_encode($result);
|