diff options
author | Jo-Philipp Wich <jo@mein.io> | 2018-07-12 16:50:40 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-07-12 18:10:10 +0200 |
commit | c4dca36795f00fefa7337f66d4b42191350f4a2c (patch) | |
tree | fba6b5c00da5a5f9d81c226b258fdb0a5c0d4c5e /modules/luci-mod-admin-full/luasrc/controller/admin | |
parent | 54c9a77bd34de1b37488431149e98f64f8c01547 (diff) |
luci-mod-admin-full: rework interface overview page
Convert interface enable, disable and delete actions to proper cbi
operations so that we can benefit from the apply/rollback workflow
when performing critical interface operations.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/controller/admin')
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/controller/admin/network.lua | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua index 4605ffaf33..4680687883 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua @@ -1,5 +1,5 @@ -- Copyright 2008 Steven Barth <steven@midlink.org> --- Copyright 2011-2015 Jo-Philipp Wich <jow@openwrt.org> +-- Copyright 2011-2018 Jo-Philipp Wich <jo@mein.io> -- Licensed to the public under the Apache License 2.0. module("luci.controller.admin.network", package.seeall) @@ -82,18 +82,12 @@ function index() page = entry({"admin", "network", "iface_add"}, form("admin_network/iface_add"), nil) page.leaf = true - page = entry({"admin", "network", "iface_delete"}, post("iface_delete"), nil) - page.leaf = true - page = entry({"admin", "network", "iface_status"}, call("iface_status"), nil) page.leaf = true page = entry({"admin", "network", "iface_reconnect"}, post("iface_reconnect"), nil) page.leaf = true - page = entry({"admin", "network", "iface_shutdown"}, post("iface_shutdown"), nil) - page.leaf = true - page = entry({"admin", "network", "network"}, arcombine(cbi("admin_network/network"), cbi("admin_network/ifaces")), _("Interfaces"), 10) page.leaf = true page.subindex = true @@ -276,34 +270,6 @@ function iface_reconnect(iface) luci.http.status(404, "No such interface") end -function iface_shutdown(iface) - local netmd = require "luci.model.network".init() - local net = netmd:get_network(iface) - if net then - luci.sys.call("env -i /sbin/ifdown %s >/dev/null 2>/dev/null" - % luci.util.shellquote(iface)) - luci.http.status(200, "Shutdown") - return - end - - luci.http.status(404, "No such interface") -end - -function iface_delete(iface) - local netmd = require "luci.model.network".init() - local net = netmd:del_network(iface) - if net then - luci.sys.call("env -i /sbin/ifdown %s >/dev/null 2>/dev/null" - % luci.util.shellquote(iface)) - luci.http.redirect(luci.dispatcher.build_url("admin/network/network")) - netmd:commit("network") - netmd:commit("wireless") - return - end - - luci.http.status(404, "No such interface") -end - function wifi_status(devs) local s = require "luci.tools.status" local rv = { } |