From d9b6c5dd781fec6603e7941b72774b9af140e858 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sat, 26 May 2018 19:32:39 +0200 Subject: 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 --- applications/luci-app-lxc/luasrc/view/lxc.htm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'applications/luci-app-lxc/luasrc/view/lxc.htm') 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 = '
There are no templates for your architecture (<%=target%>) available, please select another Containers URL.
'; + cell.innerHTML = '
There are no templates for your architecture (<%=target%>) available, please select another containers URL.
'; } function lxc_list_update() -- cgit v1.2.3