Add basic interface information on Settings->System page

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-07-14 17:33:23 +02:00
parent 9d8a3dfc31
commit b732092348
2 changed files with 31 additions and 0 deletions

View File

@@ -362,4 +362,23 @@ $(function () {
},
},
});
$.ajax({
url: "/api/network/gateway",
})
.done(function (data) {
const gateway = data.gateway;
// Get first object in gateway that has family == "inet"
const inet = gateway.find(obj => obj.family === "inet");
// Get first object in gateway that has family == "inet6"
const inet6 = gateway.find(obj => obj.family === "inet6");
$("#sysinfo-gw-v4-addr").text(inet ? inet.local.join('\n') : "N/A");
$("#sysinfo-gw-v4-iface").text(inet ? inet.interface : "N/A");
$("#sysinfo-gw-v6-addr").text(inet6 ? inet6.local.join('\n') : "N/A");
$("#sysinfo-gw-v6-iface").text(inet6 ? inet6.interface : "N/A");
})
.fail(function (data) {
apiFailure(data);
});
});