Add container pause/resume/kill/rename + reusable context-menu component
First increment of the big WebUI feature-parity spec (see task list) — row-level actions were about to run out of icon-button space, so this adds a small anchored dropdown menu (app.js openContextMenu) for secondary per-container actions instead of cramming more buttons into every row. All four new actions verified live against the real podman API before wiring up the UI (same discipline as the CSRF/pull/compose bugs found earlier — field names and response shapes checked against the running socket, not assumed from docs). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,10 @@
|
||||
* stop POST {"id": "...", "timeout": 10}
|
||||
* restart POST {"id": "...", "timeout": 10}
|
||||
* remove POST {"id": "...", "force": false}
|
||||
* pause POST {"id": "..."}
|
||||
* unpause POST {"id": "..."}
|
||||
* kill POST {"id": "...", "signal": "SIGKILL"}
|
||||
* rename POST {"id": "...", "name": "..."}
|
||||
* logs GET (&id=...&tail=200) -> plain text
|
||||
* create POST {"image": "...", "name": "...", "networkMode": "bridge"|"host"|"none"|"<custom-network-name>",
|
||||
* "ports": [{"hostPort": 8080, "containerPort": 80, "protocol": "tcp"}],
|
||||
@@ -73,6 +77,34 @@ switch ($action) {
|
||||
podman_json_response(['status' => 'removed']);
|
||||
break;
|
||||
|
||||
case 'pause':
|
||||
$body = podman_read_json_body();
|
||||
$client->pauseContainer(require_id($body));
|
||||
podman_json_response(['status' => 'paused']);
|
||||
break;
|
||||
|
||||
case 'unpause':
|
||||
$body = podman_read_json_body();
|
||||
$client->unpauseContainer(require_id($body));
|
||||
podman_json_response(['status' => 'unpaused']);
|
||||
break;
|
||||
|
||||
case 'kill':
|
||||
$body = podman_read_json_body();
|
||||
$client->killContainer(require_id($body), (string) ($body['signal'] ?? 'SIGKILL'));
|
||||
podman_json_response(['status' => 'killed']);
|
||||
break;
|
||||
|
||||
case 'rename':
|
||||
$body = podman_read_json_body();
|
||||
$newName = trim((string) ($body['name'] ?? ''));
|
||||
if ($newName === '') {
|
||||
podman_json_error('Missing name in request body', 400);
|
||||
}
|
||||
$client->renameContainer(require_id($body), $newName);
|
||||
podman_json_response(['status' => 'renamed']);
|
||||
break;
|
||||
|
||||
case 'create':
|
||||
$body = podman_read_json_body();
|
||||
$image = trim((string) ($body['image'] ?? ''));
|
||||
|
||||
Reference in New Issue
Block a user