summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-lxc/luasrc/view
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2018-05-26 19:32:39 +0200
committerDirk Brenken <dev@brenken.org>2018-05-27 20:46:13 +0200
commitd9b6c5dd781fec6603e7941b72774b9af140e858 (patch)
tree4aa99a1d39c05c418e5c5609f7b0c13540d13f8d /applications/luci-app-lxc/luasrc/view
parentfa4dc6be91ad86dbaa0959b40bdb14f50ad21a67 (diff)
luci-app-lxc: fix "plain-vanilla" integration, part 2
I've tried to get the lxc app in a more usable state. Tested with mips and amd64 targets. * check /etc/config/lxc in controller, not in cbi * more controller cleanups * remove unused 'fork_exec' function * check path before container creation * check space requirements before container creation * support new uci options 'min_space' and 'min_temp', default for both is 100000 KB * both options are configurable via LuCI CBI template * write messages to log in case of an error * validate the container name during creation, automatically remove invalid chars * inform the user that only a stopped container can be destroyed * add experimental ssl support (untested, disabled by default) Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-lxc/luasrc/view')
-rw-r--r--applications/luci-app-lxc/luasrc/view/lxc.htm17
1 files changed, 11 insertions, 6 deletions
diff --git a/applications/luci-app-lxc/luasrc/view/lxc.htm b/applications/luci-app-lxc/luasrc/view/lxc.htm
index c1b44f8671..e02c3a7888 100644
--- a/applications/luci-app-lxc/luasrc/view/lxc.htm
+++ b/applications/luci-app-lxc/luasrc/view/lxc.htm
@@ -107,9 +107,9 @@ table.cbi-section-table td,
function lxc_create(tr)
{
- var lxc_name = tr.querySelector("#tx_name").value.replace(/\s/g,'')
+ var lxc_name = tr.querySelector("#tx_name").value.replace(/[\s!@#$%^&*()+=\[\]{};':"\\|,<>\/?]/g,'')
var lxc_template = tr.querySelector("#s_template").value
- var bt_create = tr.querySelector("#bt_create")
+ var bt_create = tr.querySelector("#bt_create")
if (t_lxc_list.querySelector("[data-id='" + lxc_name + "']") != null)
return info_message(output_add, "Container with that name already exists!", 4000)
@@ -224,6 +224,14 @@ table.cbi-section-table td,
else if (action == "destroy")
{
+ var tr = self.parentNode.parentNode
+ var img = tr.querySelector('img')
+ if (img.getAttribute('src') != window.img["red"])
+ {
+ bt_action.disabled = false
+ return info_message(output_list,"Container is still running!")
+ }
+
if (!confirm("This will completely remove a stopped LXC container from disk. Are you sure?"))
return
@@ -389,9 +397,6 @@ table.cbi-section-table td,
function set_empty_template()
{
- if (document.getElementById('tr_holder') !== null)
- return
-
var row_count = t_lxc_create.rows.length;
while(--row_count) t_lxc_create.deleteRow(row_count);
@@ -399,7 +404,7 @@ table.cbi-section-table td,
row.id = 'tr_holder'
var cell = row.insertCell(0);
cell.colSpan = 3;
- cell.innerHTML = '<em><br />There are no templates for your architecture (<%=target%>) available, please select another Containers URL.</em>';
+ cell.innerHTML = '<em><br />There are no templates for your architecture (<%=target%>) available, please select another containers URL.</em>';
}
function lxc_list_update()