Skip to content

Commit 865a363

Browse files
committed
Some UI changes to the container page
Couple of mobile UI adjustments Add networks page Add a docker kill endpoint
1 parent 5cbc9fa commit 865a363

File tree

18 files changed

+1434
-1093
lines changed

18 files changed

+1434
-1093
lines changed

root/app/www/public/ajax/commands.php

+43-45
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,54 @@
1111

1212
if ($_POST['m'] == 'init') {
1313
?>
14-
<div class="container-fluid pt-4 px-4">
15-
<div class="bg-secondary rounded h-100 p-4">
16-
<div class="row">
17-
<div class="col-sm-3">
18-
<div class="row">
19-
<div class="col-sm-12 mb-2">
20-
<select class="form-select" id="command">
21-
<optgroup label="docker">
22-
<option value="docker-inspect">inspect {container}</option>
23-
<option value="docker-networks">network {params}</option>
24-
<option value="docker-port">port {container}</option>
25-
<option value="docker-processList">ps</option>
26-
</optgroup>
27-
</select>
28-
</div>
29-
<div class="col-sm-12 col-md-6">
30-
<input id="command-container" type="text" placeholder="container" class="form-control">
31-
</div>
32-
<div class="col-sm-12 col-md-6">
33-
<input id="command-parameters" type="text" placeholder="params" class="form-control">
34-
</div>
14+
<div class="bg-secondary rounded p-4">
15+
<div class="row">
16+
<div class="col-sm-3">
17+
<div class="row">
18+
<div class="col-sm-12 mb-2">
19+
<select class="form-select" id="command">
20+
<optgroup label="docker">
21+
<option value="docker-inspect">inspect {container}</option>
22+
<option value="docker-networks">network {params}</option>
23+
<option value="docker-port">port {container}</option>
24+
<option value="docker-processList">ps</option>
25+
</optgroup>
26+
</select>
3527
</div>
36-
<table class="table">
37-
<thead>
38-
<tr>
39-
<th>Run</th>
40-
<th>Server</th>
41-
</tr>
42-
</thead>
43-
<tbody>
44-
<?php
45-
foreach ($serversTable as $serverId => $serverData) {
46-
?>
47-
<tr>
48-
<td><input type="checkbox" class="form-check-input" id="command-<?= $serverId ?>"></td>
49-
<td><?= $serverData['name'] ?></td>
50-
</tr>
51-
<?php
52-
}
28+
<div class="col-sm-12 col-md-6">
29+
<input id="command-container" type="text" placeholder="container" class="form-control">
30+
</div>
31+
<div class="col-sm-12 col-md-6">
32+
<input id="command-parameters" type="text" placeholder="params" class="form-control">
33+
</div>
34+
</div>
35+
<table class="table">
36+
<thead>
37+
<tr>
38+
<th>Run</th>
39+
<th>Server</th>
40+
</tr>
41+
</thead>
42+
<tbody>
43+
<?php
44+
foreach ($serversTable as $serverId => $serverData) {
5345
?>
5446
<tr>
55-
<td colspan="2" align="center">
56-
<button class="btn btn-outline-info" onclick="runCommand()">Run Command</button>
57-
</td>
47+
<td><input type="checkbox" class="form-check-input" id="command-<?= $serverId ?>"></td>
48+
<td><?= $serverData['name'] ?></td>
5849
</tr>
59-
</tbody>
60-
</table>
61-
</div>
62-
<div class="col-sm-9" id="commandResults"></div>
50+
<?php
51+
}
52+
?>
53+
<tr>
54+
<td colspan="2" align="center">
55+
<button class="btn btn-outline-info" onclick="runCommand()">Run Command</button>
56+
</td>
57+
</tr>
58+
</tbody>
59+
</table>
6360
</div>
61+
<div class="col-sm-9" id="commandResults"></div>
6462
</div>
6563
</div>
6664
<?php

root/app/www/public/ajax/compose.php

+72-76
Original file line numberDiff line numberDiff line change
@@ -38,87 +38,83 @@
3838
if ($_SESSION['activeServerId'] != APP_SERVER_ID) {
3939
echo 'Remote compose management is not supported. Please do that on the Dockwatch instance directly.';
4040
} else {
41-
?>
42-
<div class="container-fluid pt-4 px-4 mb-5">
43-
<div class="bg-secondary rounded h-100 p-4">
44-
<h6>Add new compose</h6>
45-
<span class="small-text"><code><?= COMPOSE_PATH ?>{name}/docker-compose.yml</code></span>
46-
<div class="table-responsive">
47-
<table class="table">
48-
<thead>
49-
<tr>
50-
<th>Name</th>
51-
<th>Compose</th>
52-
<th></th>
53-
</tr>
54-
</thead>
55-
<tbody>
56-
<tr>
57-
<td><input id="new-compose-name" class="form-control" type="text" placeholder="dockwatch"></td>
58-
<td><textarea id="new-compose-data" class="form-control" rows="10" placeholder="<?= htmlspecialchars($composeExample) ?>"></textarea></td>
59-
<td align="center"><input class="btn btn-outline-success" type="button" value="Add Compose" onclick="composeAdd()"></td>
60-
</tr>
61-
</tbody>
62-
<tfoot>
63-
<tr>
64-
<td colspan="3">
65-
Important notes:<br>
66-
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>
67-
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
68-
</td>
69-
</tr>
70-
</tfoot>
71-
</table>
72-
</div>
41+
?>
42+
<div class="bg-secondary rounded h-100 p-4">
43+
<h6>Add new compose</h6>
44+
<span class="small-text"><code><?= COMPOSE_PATH ?>{name}/docker-compose.yml</code></span>
45+
<div class="table-responsive">
46+
<table class="table">
47+
<thead>
48+
<tr>
49+
<th>Name</th>
50+
<th>Compose</th>
51+
<th></th>
52+
</tr>
53+
</thead>
54+
<tbody>
55+
<tr>
56+
<td><input id="new-compose-name" class="form-control" type="text" placeholder="dockwatch"></td>
57+
<td><textarea id="new-compose-data" class="form-control" rows="10" placeholder="<?= htmlspecialchars($composeExample) ?>"></textarea></td>
58+
<td align="center"><input class="btn btn-outline-success" type="button" value="Add Compose" onclick="composeAdd()"></td>
59+
</tr>
60+
</tbody>
61+
<tfoot>
62+
<tr>
63+
<td colspan="3">
64+
Important notes:<br>
65+
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>
66+
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
67+
</td>
68+
</tr>
69+
</tfoot>
70+
</table>
7371
</div>
7472
</div>
75-
<div class="container-fluid pt-4 px-4 mb-5">
76-
<div class="bg-secondary rounded h-100 p-4">
77-
<h6>Compose management</h6>
78-
<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>
79-
<div class="table-responsive">
80-
<table class="table">
81-
<thead>
82-
<tr>
83-
<th>Compose Location</th>
84-
<th>Controls</th>
85-
</tr>
86-
</thead>
87-
<tbody>
88-
<?php
89-
if ($existingComposeFolders) {
90-
foreach ($existingComposeFolders as $existingComposeFolder) {
91-
$composeExists = false;
92-
if (file_exists($existingComposeFolder . '/docker-compose.yml')) {
93-
$composeExists = true;
73+
<div class="bg-secondary rounded mt-3 p-4">
74+
<h6>Compose management</h6>
75+
<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>
76+
<div class="table-responsive">
77+
<table class="table">
78+
<thead>
79+
<tr>
80+
<th>Compose Location</th>
81+
<th>Controls</th>
82+
</tr>
83+
</thead>
84+
<tbody>
85+
<?php
86+
if ($existingComposeFolders) {
87+
foreach ($existingComposeFolders as $existingComposeFolder) {
88+
$composeExists = false;
89+
if (file_exists($existingComposeFolder . '/docker-compose.yml')) {
90+
$composeExists = true;
91+
}
92+
?>
93+
<tr>
94+
<td><?= $existingComposeFolder ?></td>
95+
<?php
96+
if ($composeExists) {
97+
?>
98+
<td>
99+
<input type="button" class="btn btn-outline-info" value="docker-compose pull" onclick="composePull('<?= $existingComposeFolder ?>')">
100+
<input type="button" class="btn btn-outline-info" value="docker-compose up -d" onclick="composeUp('<?= $existingComposeFolder ?>')">
101+
<input type="button" class="btn btn-outline-warning" value="Modify" onclick="composeModify('<?= $existingComposeFolder ?>')">
102+
<input type="button" class="btn btn-outline-danger" value="Delete" onclick="composeDelete('<?= $existingComposeFolder ?>')">
103+
</td>
104+
<?php
105+
} else {
106+
?>
107+
<td colspan="2">docker-compose.yml is missing / has invalid permissions</td>
108+
<?php
94109
}
95110
?>
96-
<tr>
97-
<td><?= $existingComposeFolder ?></td>
98-
<?php
99-
if ($composeExists) {
100-
?>
101-
<td>
102-
<input type="button" class="btn btn-outline-info" value="docker-compose pull" onclick="composePull('<?= $existingComposeFolder ?>')">
103-
<input type="button" class="btn btn-outline-info" value="docker-compose up -d" onclick="composeUp('<?= $existingComposeFolder ?>')">
104-
<input type="button" class="btn btn-outline-warning" value="Modify" onclick="composeModify('<?= $existingComposeFolder ?>')">
105-
<input type="button" class="btn btn-outline-danger" value="Delete" onclick="composeDelete('<?= $existingComposeFolder ?>')">
106-
</td>
107-
<?php
108-
} else {
109-
?>
110-
<td colspan="2">docker-compose.yml is missing / has invalid permissions</td>
111-
<?php
112-
}
113-
?>
114-
</tr>
115-
<?php
116-
}
111+
</tr>
112+
<?php
117113
}
118-
?>
119-
</tbody>
120-
</table>
121-
</div>
114+
}
115+
?>
116+
</tbody>
117+
</table>
122118
</div>
123119
</div>
124120
<?php

0 commit comments

Comments
 (0)