From 0cdcd8ce5c2919f91c88a8023c5bc7fcadf0cb1c Mon Sep 17 00:00:00 2001 From: Patrick Grimm Date: Sun, 25 Aug 2024 16:09:45 +0200 Subject: luci-app-babeld: use an array for routing lists use underscore in key name for libubox/jshn.sh compat change format specifiers for bool and decimal Fix: openwrt/luci/issues/6342 Fix: openwrt/routing/issues/966 Depends: faec308d95c99747b1efb09a72e499b4e3647b83 Signed-off-by: Patrick Grimm --- .../htdocs/luci-static/resources/babeld.js | 50 +++++++++++----------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'applications/luci-app-babeld/htdocs/luci-static/resources/babeld.js') diff --git a/applications/luci-app-babeld/htdocs/luci-static/resources/babeld.js b/applications/luci-app-babeld/htdocs/luci-static/resources/babeld.js index 6bcbdf0e29..24df941535 100644 --- a/applications/luci-app-babeld/htdocs/luci-static/resources/babeld.js +++ b/applications/luci-app-babeld/htdocs/luci-static/resources/babeld.js @@ -24,9 +24,9 @@ function renderTableXRoutes(ubus_data, target_div) { for (var prefix in data[protocol]) { var prefixRow = document.createElement('tr'); prefixRow.setAttribute('class', 'tr'); - var prefixContent = '' + '%h'.format(prefix) + '\ - ' + '%h'.format(data[protocol][prefix]["metric"]) + '\ - ' + '%h'.format(data[protocol][prefix]["src-prefix"]) + ''; + var prefixContent = '' + '%h'.format(data[protocol][prefix]["address"]) + '\ + ' + '%d'.format(data[protocol][prefix]["metric"]) + '\ + ' + '%h'.format(data[protocol][prefix]["src_prefix"]) + ''; prefixRow.innerHTML = prefixContent; table.appendChild(prefixRow); @@ -57,7 +57,6 @@ function renderTableRoutes(ubus_data, target_div) { Refmetric\ ID\ Seq. No.\ - Channes\ Age\ Via\ Nexthop\ @@ -70,19 +69,18 @@ function renderTableRoutes(ubus_data, target_div) { for (var prefix in data[protocol]) { var prefixRow = document.createElement('tr'); prefixRow.setAttribute('class', 'tr'); - var prefixContent = '' + '%h'.format(prefix) + '\ - ' + '%h'.format(data[protocol][prefix]["src-prefix"]) + '\ - ' + '%h'.format(data[protocol][prefix]["route_metric"]) + '\ - ' + '%h'.format(data[protocol][prefix]["route_smoothed_metric"]) + '\ - ' + '%h'.format(data[protocol][prefix]["refmetric"]) + '\ + var prefixContent = '' + '%h'.format(data[protocol][prefix]["address"]) + '\ + ' + '%h'.format(data[protocol][prefix]["src_prefix"]) + '\ + ' + '%d'.format(data[protocol][prefix]["route_metric"]) + '\ + ' + '%d'.format(data[protocol][prefix]["route_smoothed_metric"]) + '\ + ' + '%d'.format(data[protocol][prefix]["refmetric"]) + '\ ' + '%h'.format(data[protocol][prefix]["id"]) + '\ - ' + '%h'.format(data[protocol][prefix]["seqno"]) + '\ - ' + '%h'.format(data[protocol][prefix]["channels"]) + '\ - ' + '%h'.format(data[protocol][prefix]["age"]) + '\ + ' + '%d'.format(data[protocol][prefix]["seqno"]) + '\ + ' + '%d'.format(data[protocol][prefix]["age"]) + '\ ' + '%h'.format(data[protocol][prefix]["via"]) + '\ ' + '%h'.format(data[protocol][prefix]["nexthop"]) + '\ - ' + '%h'.format(data[protocol][prefix]["installed"]) + '\ - ' + '%h'.format(data[protocol][prefix]["feasible"]) + ''; + ' + '%b'.format(data[protocol][prefix]["installed"]) + '\ + ' + '%b'.format(data[protocol][prefix]["feasible"]) + ''; prefixRow.innerHTML = prefixContent; table.appendChild(prefixRow); @@ -108,11 +106,11 @@ function renderTableNeighbours(ubus_data, target_div) { headerRow.setAttribute('class', 'tr table-titles'); var headerContent = '' + '%h'.format(protocol) + ' Neighbour\ Device\ - Hello-Reach\ + Multicast Hellos\ + Unicast Hellos\ RX cost\ TX cost\ RTT\ - Channel\ Interface up'; headerRow.innerHTML = headerContent; @@ -121,14 +119,14 @@ function renderTableNeighbours(ubus_data, target_div) { for (var neighbour in data[protocol]) { var neighbourRow = document.createElement('tr'); neighbourRow.setAttribute('class', 'tr'); - var neighbourContent = '' + '%h'.format(neighbour) + '\ + var neighbourContent = '' + '%h'.format(data[protocol][neighbour]["address"]) + '\ ' + '%h'.format(data[protocol][neighbour]["dev"]) + '\ - ' + '%h'.format(data[protocol][neighbour]["hello-reach"]) + '\ - ' + '%h'.format(data[protocol][neighbour]["rxcost"]) + '\ - ' + '%h'.format(data[protocol][neighbour]["txcost"]) + '\ - ' + '%h'.format(data[protocol][neighbour]["rtt"]) + '\ - ' + '%h'.format(data[protocol][neighbour]["channel"]) + '\ - ' + '%h'.format(data[protocol][neighbour]["if_up"]) + ''; + ' + '%d'.format(data[protocol][neighbour]["hello_reach"]) + '\ + ' + '%d'.format(data[protocol][neighbour]["uhello_reach"]) + '\ + ' + '%d'.format(data[protocol][neighbour]["rxcost"]) + '\ + ' + '%d'.format(data[protocol][neighbour]["txcost"]) + '\ + ' + '%d'.format(data[protocol][neighbour]["rtt"]) + '\ + ' + '%b'.format(data[protocol][neighbour]["if_up"]) + ''; neighbourRow.innerHTML = neighbourContent; table.appendChild(neighbourRow); @@ -161,9 +159,9 @@ function renderTableInfo(ubus_data, target_div) { var neighbourRow = document.createElement('tr'); neighbourRow.setAttribute('class', 'tr'); - var neighbourContent = '' + '%h'.format(data["babeld-version"]) + '\ - ' + '%h'.format(data["my-id"]) + '\ - ' + '%h'.format(data["host"]) + ''; + var neighbourContent = '' + '%h'.format(data["babeld_version"]) + '\ + ' + '%h'.format(data["my_id"]) + '\ + ' + '%h'.format(data["host"]) + ''; neighbourRow.innerHTML = neighbourContent; table.appendChild(neighbourRow); -- cgit v1.2.3