Skip to content
Snippets Groups Projects
Commit 696b4316 authored by Matthias Schiffer's avatar Matthias Schiffer Committed by Martin Weinelt
Browse files

gluon-web-autoupdater: use human-readable names as branch labels, sort by label

Use the value of the `name` site.conf field as label (it was
accidentally unused before).

Our site.conf currently doesn't define a specific order for the branch
entries. To avoid changing branch orders, sort entries by this label.

Fixes: #1961
parent 42650393
No related branches found
No related tags found
No related merge requests found
...@@ -22,11 +22,18 @@ function o:write(data) ...@@ -22,11 +22,18 @@ function o:write(data)
end end
o = s:option(ListValue, "branch", translate("Branch")) o = s:option(ListValue, "branch", translate("Branch"))
uci:foreach("autoupdater", "branch",
function (section) local branches = {}
o:value(section[".name"]) uci:foreach("autoupdater", "branch", function(branch)
end table.insert(branches, branch)
) end)
table.sort(branches, function(a, b)
return a.name < b.name
end)
for _, branch in ipairs(branches) do
o:value(branch[".name"], branch.name)
end
o.default = uci:get("autoupdater", autoupdater, "branch") o.default = uci:get("autoupdater", autoupdater, "branch")
function o:write(data) function o:write(data)
uci:set("autoupdater", autoupdater, "branch", data) uci:set("autoupdater", autoupdater, "branch", data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment