Format packet count with toLocaleString (#4600)

This adjusts to the user's preference: in an English browser, 1234567890 will be shown as 1,234,567,890. JavaScript is already required for widgets to work, adding these toLocaleString calls is not an issue in that regard, and the function is supported in all browsers as far as I can see https://caniuse.com/mdn-javascript_builtins_number_tolocalestring
This commit is contained in:
bleetsheep 2021-01-24 20:16:05 +01:00 committed by GitHub
parent cde8b431c2
commit 8a607e7552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,8 +80,8 @@ $ifvalues = array(
// fill in stats, use column index to determine td location
var item_index = $("#interface_statistics_widget_intf_" + interface_data['descr']).index();
if (item_index != -1) {
$("#interface_statistics_widget_val_pkg_in > td:eq("+item_index+")").html(interface_data['inpkts']);
$("#interface_statistics_widget_val_pkg_out > td:eq("+item_index+")").html(interface_data['outpkts']);
$("#interface_statistics_widget_val_pkg_in > td:eq("+item_index+")").html(parseInt(interface_data['inpkts']).toLocaleString());
$("#interface_statistics_widget_val_pkg_out > td:eq("+item_index+")").html(parseInt(interface_data['outpkts']).toLocaleString());
$("#interface_statistics_widget_val_bytes_in > td:eq("+item_index+")").html(interface_data['inbytes_frmt']);
$("#interface_statistics_widget_val_bytes_out > td:eq("+item_index+")").html(interface_data['outbytes_frmt']);
$("#interface_statistics_widget_val_errors_in > td:eq("+item_index+")").html(interface_data['inerrs']);