|
@@ -8,6 +8,10 @@ export const Volumes = async function(req, res) {
|
|
|
|
|
|
let volume_list = `
|
|
|
<thead>
|
|
|
+ <!-- Hidden checkbox so that the form returns an array each time -->
|
|
|
+ <tr class="d-none">
|
|
|
+ <td><input class="form-check-input m-0 align-middle" name="select" value="on" type="checkbox" checked="" aria-label="Select"></td>
|
|
|
+ </tr>
|
|
|
<tr>
|
|
|
<th class="w-1"><input class="form-check-input m-0 align-middle" name="select" type="checkbox" aria-label="Select all" onclick="selectAll()"></th>
|
|
|
<th><button class="table-sort" data-sort="sort-name">Name</button></th>
|
|
@@ -17,10 +21,6 @@ export const Volumes = async function(req, res) {
|
|
|
<th><button class="table-sort" data-sort="sort-quantity">Size</button></th>
|
|
|
<th><button class="table-sort" data-sort="sort-progress">Action</button></th>
|
|
|
</tr>
|
|
|
- <!-- Hidden checkbox so that the form returns an array each time -->
|
|
|
- <tr class="d-none">
|
|
|
- <td><input class="form-check-input m-0 align-middle" name="select" value="on" type="checkbox" checked="" aria-label="Select"></td>
|
|
|
- </tr>
|
|
|
</thead>
|
|
|
<tbody class="table-tbody">`
|
|
|
|
|
@@ -73,22 +73,33 @@ export const Volumes = async function(req, res) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+export const createVolume = async function(req, res) {
|
|
|
+
|
|
|
+ let name = req.body.name;
|
|
|
+
|
|
|
+ docker.createVolume({
|
|
|
+ Name: name
|
|
|
+ });
|
|
|
+ res.redirect("/volumes");
|
|
|
+}
|
|
|
|
|
|
|
|
|
export const removeVolume = async function(req, res) {
|
|
|
let volumes = req.body.select;
|
|
|
|
|
|
- for (let i = 0; i < volumes.length; i++) {
|
|
|
+ console.log(volumes);
|
|
|
+
|
|
|
+ // for (let i = 0; i < volumes.length; i++) {
|
|
|
|
|
|
- if (volumes[i] != 'on') {
|
|
|
- try {
|
|
|
- console.log(`Removing volume: ${volumes[i]}`);
|
|
|
- let volume = docker.getVolume(volumes[i]);
|
|
|
- await volume.remove();
|
|
|
- } catch (error) {
|
|
|
- console.log(`Unable to remove volume: ${volumes[i]}`);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (volumes[i] != 'on') {
|
|
|
+ // try {
|
|
|
+ // console.log(`Removing volume: ${volumes[i]}`);
|
|
|
+ // let volume = docker.getVolume(volumes[i]);
|
|
|
+ // await volume.remove();
|
|
|
+ // } catch (error) {
|
|
|
+ // console.log(`Unable to remove volume: ${volumes[i]}`);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
res.redirect("/volumes");
|
|
|
}
|