Skip to content

Commit

Permalink
Some UI changes to the container page
Browse files Browse the repository at this point in the history
Couple of mobile UI adjustments
Add networks page
Add a docker kill endpoint
  • Loading branch information
austinwbest committed Nov 24, 2024
1 parent 5cbc9fa commit 865a363
Show file tree
Hide file tree
Showing 18 changed files with 1,434 additions and 1,093 deletions.
88 changes: 43 additions & 45 deletions root/app/www/public/ajax/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,54 @@

if ($_POST['m'] == 'init') {
?>
<div class="container-fluid pt-4 px-4">
<div class="bg-secondary rounded h-100 p-4">
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-12 mb-2">
<select class="form-select" id="command">
<optgroup label="docker">
<option value="docker-inspect">inspect {container}</option>
<option value="docker-networks">network {params}</option>
<option value="docker-port">port {container}</option>
<option value="docker-processList">ps</option>
</optgroup>
</select>
</div>
<div class="col-sm-12 col-md-6">
<input id="command-container" type="text" placeholder="container" class="form-control">
</div>
<div class="col-sm-12 col-md-6">
<input id="command-parameters" type="text" placeholder="params" class="form-control">
</div>
<div class="bg-secondary rounded p-4">
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-12 mb-2">
<select class="form-select" id="command">
<optgroup label="docker">
<option value="docker-inspect">inspect {container}</option>
<option value="docker-networks">network {params}</option>
<option value="docker-port">port {container}</option>
<option value="docker-processList">ps</option>
</optgroup>
</select>
</div>
<table class="table">
<thead>
<tr>
<th>Run</th>
<th>Server</th>
</tr>
</thead>
<tbody>
<?php
foreach ($serversTable as $serverId => $serverData) {
?>
<tr>
<td><input type="checkbox" class="form-check-input" id="command-<?= $serverId ?>"></td>
<td><?= $serverData['name'] ?></td>
</tr>
<?php
}
<div class="col-sm-12 col-md-6">
<input id="command-container" type="text" placeholder="container" class="form-control">
</div>
<div class="col-sm-12 col-md-6">
<input id="command-parameters" type="text" placeholder="params" class="form-control">
</div>
</div>
<table class="table">
<thead>
<tr>
<th>Run</th>
<th>Server</th>
</tr>
</thead>
<tbody>
<?php
foreach ($serversTable as $serverId => $serverData) {
?>
<tr>
<td colspan="2" align="center">
<button class="btn btn-outline-info" onclick="runCommand()">Run Command</button>
</td>
<td><input type="checkbox" class="form-check-input" id="command-<?= $serverId ?>"></td>
<td><?= $serverData['name'] ?></td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-9" id="commandResults"></div>
<?php
}
?>
<tr>
<td colspan="2" align="center">
<button class="btn btn-outline-info" onclick="runCommand()">Run Command</button>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-9" id="commandResults"></div>
</div>
</div>
<?php
Expand Down
148 changes: 72 additions & 76 deletions root/app/www/public/ajax/compose.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,87 +38,83 @@
if ($_SESSION['activeServerId'] != APP_SERVER_ID) {
echo 'Remote compose management is not supported. Please do that on the Dockwatch instance directly.';
} else {
?>
<div class="container-fluid pt-4 px-4 mb-5">
<div class="bg-secondary rounded h-100 p-4">
<h6>Add new compose</h6>
<span class="small-text"><code><?= COMPOSE_PATH ?>{name}/docker-compose.yml</code></span>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Compose</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><input id="new-compose-name" class="form-control" type="text" placeholder="dockwatch"></td>
<td><textarea id="new-compose-data" class="form-control" rows="10" placeholder="<?= htmlspecialchars($composeExample) ?>"></textarea></td>
<td align="center"><input class="btn btn-outline-success" type="button" value="Add Compose" onclick="composeAdd()"></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">
Important notes:<br>
1. This <b>will not</b> validate the compose or yml. You need to make sure it is a valid compose (starts with <code>version: "2.1"</code> for example) and all spacing/indenting is accurate<br>
2. This is not really meant to run a full stack compose, it is done via the browser so it can possibly timeout if it takes to long to pull
</td>
</tr>
</tfoot>
</table>
</div>
?>
<div class="bg-secondary rounded h-100 p-4">
<h6>Add new compose</h6>
<span class="small-text"><code><?= COMPOSE_PATH ?>{name}/docker-compose.yml</code></span>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Compose</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><input id="new-compose-name" class="form-control" type="text" placeholder="dockwatch"></td>
<td><textarea id="new-compose-data" class="form-control" rows="10" placeholder="<?= htmlspecialchars($composeExample) ?>"></textarea></td>
<td align="center"><input class="btn btn-outline-success" type="button" value="Add Compose" onclick="composeAdd()"></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3">
Important notes:<br>
1. This <b>will not</b> validate the compose or yml. You need to make sure it is a valid compose (starts with <code>version: "2.1"</code> for example) and all spacing/indenting is accurate<br>
2. This is not really meant to run a full stack compose, it is done via the browser so it can possibly timeout if it takes to long to pull
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="container-fluid pt-4 px-4 mb-5">
<div class="bg-secondary rounded h-100 p-4">
<h6>Compose management</h6>
<span class="small-text text-muted">You can ssh into the container and run it manually <code>cd <?= COMPOSE_PATH ?>{name} && docker-compose pull</code></span>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Compose Location</th>
<th>Controls</th>
</tr>
</thead>
<tbody>
<?php
if ($existingComposeFolders) {
foreach ($existingComposeFolders as $existingComposeFolder) {
$composeExists = false;
if (file_exists($existingComposeFolder . '/docker-compose.yml')) {
$composeExists = true;
<div class="bg-secondary rounded mt-3 p-4">
<h6>Compose management</h6>
<span class="small-text text-muted">You can ssh into the container and run it manually <code>cd <?= COMPOSE_PATH ?>{name} && docker-compose pull</code></span>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Compose Location</th>
<th>Controls</th>
</tr>
</thead>
<tbody>
<?php
if ($existingComposeFolders) {
foreach ($existingComposeFolders as $existingComposeFolder) {
$composeExists = false;
if (file_exists($existingComposeFolder . '/docker-compose.yml')) {
$composeExists = true;
}
?>
<tr>
<td><?= $existingComposeFolder ?></td>
<?php
if ($composeExists) {
?>
<td>
<input type="button" class="btn btn-outline-info" value="docker-compose pull" onclick="composePull('<?= $existingComposeFolder ?>')">
<input type="button" class="btn btn-outline-info" value="docker-compose up -d" onclick="composeUp('<?= $existingComposeFolder ?>')">
<input type="button" class="btn btn-outline-warning" value="Modify" onclick="composeModify('<?= $existingComposeFolder ?>')">
<input type="button" class="btn btn-outline-danger" value="Delete" onclick="composeDelete('<?= $existingComposeFolder ?>')">
</td>
<?php
} else {
?>
<td colspan="2">docker-compose.yml is missing / has invalid permissions</td>
<?php
}
?>
<tr>
<td><?= $existingComposeFolder ?></td>
<?php
if ($composeExists) {
?>
<td>
<input type="button" class="btn btn-outline-info" value="docker-compose pull" onclick="composePull('<?= $existingComposeFolder ?>')">
<input type="button" class="btn btn-outline-info" value="docker-compose up -d" onclick="composeUp('<?= $existingComposeFolder ?>')">
<input type="button" class="btn btn-outline-warning" value="Modify" onclick="composeModify('<?= $existingComposeFolder ?>')">
<input type="button" class="btn btn-outline-danger" value="Delete" onclick="composeDelete('<?= $existingComposeFolder ?>')">
</td>
<?php
} else {
?>
<td colspan="2">docker-compose.yml is missing / has invalid permissions</td>
<?php
}
?>
</tr>
<?php
}
</tr>
<?php
}
?>
</tbody>
</table>
</div>
}
?>
</tbody>
</table>
</div>
</div>
<?php
Expand Down
Loading

0 comments on commit 865a363

Please sign in to comment.