diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2021-05-19 09:31:13 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2021-05-19 10:51:50 +0200 |
commit | 29c2c73e14d90cfa803b21765c1dc6dc8a7252ad (patch) | |
tree | e8322f15c74be62e8244fdd6872c8bdf42187b35 /admin/WebConsole/principal/aula.php | |
parent | 7b99343cd5d935f4c8db58de9d75540e8f8d88ba (diff) |
#995 Fix client speed view inside a room
Before, speed information was not shown in the corresponding computer,
but from first to last element in the table, this did not take into
account for shutdown computers or the position inside the room for a
given computer.
This fix maps ips to speed information so it can later be indexed to
show information correctly.
Fixes: 8634dd3 (#995 Show client link speed if available)
Diffstat (limited to 'admin/WebConsole/principal/aula.php')
-rw-r--r-- | admin/WebConsole/principal/aula.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/admin/WebConsole/principal/aula.php b/admin/WebConsole/principal/aula.php index dedb01b8..9706e5b2 100644 --- a/admin/WebConsole/principal/aula.php +++ b/admin/WebConsole/principal/aula.php @@ -290,11 +290,16 @@ function pintaordenadores(){ global $map; global $max_col; - $clients = clients_v2(2, $Mip); - $get_speed = function($cli) { + $clients = clients_v2(2, $Mip)['clients']; + $addr_clients = function($cli) { + return $cli['addr']; + }; + $speed_clients = function($cli) { return $cli['speed'] ? $cli['speed'] : '-1'; }; - $speeds = array_map($get_speed, $clients['clients']); + $clients_speed = array_map($speed_clients, $clients); + $clients_addr = array_map($addr_clients, $clients); + $addr_speed_map = array_combine($clients_addr, $clients_speed); $ntr=0; // Numero de ordenadores por fila if ($nombreaula!=""){ @@ -324,11 +329,10 @@ function pintaordenadores(){ echo ' </br>'; echo ' <font color="#003300" size="1" face="Arial, Helvetica, sans-serif">'.$Mmac[$i].'</font>'; echo ' </br>'; - if ($speeds[$i] > 0 && $speeds[$i] < 1000) { - echo ' <font style="background-color: red" size="1" face="Arial, Helvetica, sans-serif">'.$speeds[$i].' Mbit</font>'; - } - if ($speeds[$i] > 0 && $speeds[$i] >= 1000) { - echo ' <font size="1" color="#007700" face="Arial, Helvetica, sans-serif">'.$speeds[$i].' Mbit</font>'; + if ($addr_speed_map[$Mip[$i]] > 0 && $addr_speed_map[$Mip[$i]] >= 1000) { + echo ' <font size="1" color="#007700" face="Arial, Helvetica, sans-serif">'.$addr_speed_map[$Mip[$i]].' Mbit</font>'; + } elseif ($addr_speed_map[$Mip[$i]] > 0 && $addr_speed_map[$Mip[$i]] < 1000) { + echo ' <font size="1" color="#990000" face="Arial, Helvetica, sans-serif">'.$addr_speed_map[$Mip[$i]].' Mbit</font>'; } echo '</td>'; echo '</tr>'; |