Fix lua converting empty port object to empty array. (#858)

Lua confuses empty objects and empty arrays when converting to JSON.
This commit is contained in:
Tim Wilkinson 2023-06-01 18:47:50 -07:00 committed by GitHub
parent a61dfcdafe
commit 225773cf06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -466,6 +466,11 @@ html.print([[
html.print([[
<script>
const configs = ]] .. luci.jsonc.stringify(configs, true) .. [[;
configs.forEach(config => {
if (Array.isArray(config.ports)) {
config.ports = {}
}
});
function port_change(input, network, port, checked) {
console.log(network, port, checked)
const config = configs.find(c => c.name == network);