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
This commit is contained in:
parent
42650393b6
commit
696b4316da
@ -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)
|
||||||
|
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
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user