summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/controller
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-02-07 19:10:34 +0100
committerJo-Philipp Wich <jo@mein.io>2019-07-07 15:25:49 +0200
commitfda4ba598c0ba1c06f5de43554b40cf0d415d047 (patch)
treed8158138283846efcd93726eec778790ebcd78ce /modules/luci-base/luasrc/controller
parent1dd910148eaf7b9ed7130d1a067465dd43940da3 (diff)
luci-base: replace uci change pages with client side modal dialog
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/luasrc/controller')
-rw-r--r--modules/luci-base/luasrc/controller/admin/uci.lua49
1 files changed, 18 insertions, 31 deletions
diff --git a/modules/luci-base/luasrc/controller/admin/uci.lua b/modules/luci-base/luasrc/controller/admin/uci.lua
index 1d955dd982..6b19c62f81 100644
--- a/modules/luci-base/luasrc/controller/admin/uci.lua
+++ b/modules/luci-base/luasrc/controller/admin/uci.lua
@@ -1,5 +1,5 @@
-- Copyright 2008 Steven Barth <steven@midlink.org>
--- Copyright 2010-2015 Jo-Philipp Wich <jow@openwrt.org>
+-- Copyright 2010-2019 Jo-Philipp Wich <jo@mein.io>
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.admin.uci", package.seeall)
@@ -9,8 +9,7 @@ function index()
or table.concat(luci.dispatcher.context.request, "/")
entry({"admin", "uci"}, nil, _("Configuration"))
- entry({"admin", "uci", "changes"}, post_on({ trigger_apply = true }, "action_changes"), _("Changes"), 40).query = {redir=redir}
- entry({"admin", "uci", "revert"}, post("action_revert"), _("Revert"), 30).query = {redir=redir}
+ entry({"admin", "uci", "revert"}, post("action_revert"), nil)
local node
local authen = function(checkpass, allowed_users)
@@ -31,34 +30,6 @@ function index()
end
-function action_changes()
- local uci = require "luci.model.uci"
- local changes = uci:changes()
-
- luci.template.render("admin_uci/changes", {
- changes = next(changes) and changes,
- timeout = timeout,
- trigger_apply = luci.http.formvalue("trigger_apply") and true or false
- })
-end
-
-function action_revert()
- local uci = require "luci.model.uci"
- local changes = uci:changes()
-
- -- Collect files to be reverted
- local r, tbl
- for r, tbl in pairs(changes) do
- uci:revert(r)
- end
-
- luci.template.render("admin_uci/revert", {
- changes = next(changes) and changes,
- trigger_revert = true
- })
-end
-
-
local function ubus_state_to_http(errstr)
local map = {
["Invalid command"] = 400,
@@ -107,3 +78,19 @@ function action_confirm()
local _, errstr = uci:confirm(token)
ubus_state_to_http(errstr)
end
+
+function action_revert()
+ local uci = require "luci.model.uci"
+ local changes = uci:changes()
+
+ -- Collect files to be reverted
+ local _, errstr, r, tbl
+ for r, tbl in pairs(changes) do
+ _, errstr = uci:revert(r)
+ if errstr then
+ break
+ end
+ end
+
+ ubus_state_to_http(errstr or "OK")
+end