summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/model/uci.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-08-04 22:09:49 +0200
committerJo-Philipp Wich <jo@mein.io>2018-08-13 09:23:22 +0200
commit849d153851db2fc193c1c82648dbe719463d3a38 (patch)
treed88b4e4332938f8451be33aaa502e5dbce798b73 /modules/luci-base/luasrc/model/uci.lua
parentc2d36ba280c50d81a5d6e6cfa30b995008c1a98e (diff)
treewide: rework uci change display
- Use native rpcd uci changes format instead of incompletely converting back and forth between the old and the new format - Rework uci changelog template to print the equivalent uci commands for the various changes - Rework theme headers to properly count the uncomitted changes - Rework theme CSS to properly style new changelog Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/luasrc/model/uci.lua')
-rw-r--r--modules/luci-base/luasrc/model/uci.lua38
1 files changed, 6 insertions, 32 deletions
diff --git a/modules/luci-base/luasrc/model/uci.lua b/modules/luci-base/luasrc/model/uci.lua
index b2c1e463b..2119a210b 100644
--- a/modules/luci-base/luasrc/model/uci.lua
+++ b/modules/luci-base/luasrc/model/uci.lua
@@ -95,41 +95,15 @@ end
function changes(self, config)
- local rv = call("changes", { config = config })
- local res = {}
+ local rv, err = call("changes", { config = config })
if type(rv) == "table" and type(rv.changes) == "table" then
- local package, changes
- for package, changes in pairs(rv.changes) do
- res[package] = {}
-
- local _, change
- for _, change in ipairs(changes) do
- local operation, section, option, value = unpack(change)
- if option and operation ~= "add" then
- res[package][section] = res[package][section] or { }
-
- if operation == "list-add" then
- local v = res[package][section][option]
- if type(v) == "table" then
- v[#v+1] = value or ""
- elseif v ~= nil then
- res[package][section][option] = { v, value }
- else
- res[package][section][option] = { value }
- end
- else
- res[package][section][option] = value or ""
- end
- else
- res[package][section] = res[package][section] or {}
- res[package][section][".type"] = option or ""
- end
- end
- end
+ return rv.changes
+ elseif err then
+ return nil, ERRSTR[err]
+ else
+ return { }
end
-
- return res
end