Skip to content

Commit

Permalink
Show IP addresses on server instances view (part of #531)
Browse files Browse the repository at this point in the history
  • Loading branch information
turtle0x1 committed Aug 26, 2022
1 parent 9f5694d commit b281359
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Unreleased

Added
Show IP addresses on server instances view (#531)

Changed
Update SNAP apache version to 2.4.54

Expand Down
8 changes: 6 additions & 2 deletions src/views/boxes/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<td> Instance </td>
<td> Disk Usage </td>
<td> Memory Usage </td>
<td> IP Addresses </td>
<td> <a href="#" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Excluding local interface bytes sent & received"> Network Usage </a> </td>
<td> Gather Metrics</td>
</tr>
Expand Down Expand Up @@ -358,12 +359,14 @@ function loadHostOverview(req){
let storageUsage = instance.state.disk == null || instance.state.disk.length == 0 ? "N/A" : formatBytes(instance.state.disk.root.usage);

let bytesSent = 0, bytesRecieved = 0;

let ipAddresses = ``;
$.each(instance.state.network, (networkName, network)=>{
if(networkName == "lo"){
return true;
}

$.each(network.addresses, (_, address)=>{
ipAddresses += `<div>${networkName}: <span>${address.address}</span></div>`
});
bytesSent += network.counters.bytes_sent;
bytesRecieved += network.counters.bytes_received;
});
Expand All @@ -383,6 +386,7 @@ function loadHostOverview(req){
<td>${name}</td>
<td>${storageUsage}</td>
<td>${formatBytes(instance.state.memory.usage)}</td>
<td>${ipAddresses}</td>
<td>R: ${formatBytes(bytesRecieved)} <br/> S: ${formatBytes(bytesSent)}</td>
<td>${metricsButton}</td>
</tr>`
Expand Down

0 comments on commit b281359

Please sign in to comment.