From c4dca36795f00fefa7337f66d4b42191350f4a2c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 12 Jul 2018 16:50:40 +0200 Subject: 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 --- .../luasrc/controller/admin/network.lua | 36 +--------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'modules/luci-mod-admin-full/luasrc/controller') 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 --- Copyright 2011-2015 Jo-Philipp Wich +-- Copyright 2011-2018 Jo-Philipp Wich -- 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 = { } -- cgit v1.2.3