network update
This commit is contained in:
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# list of Docker images to use as base name for tags
|
# list of Docker images to use as base name for tags
|
||||||
images: |
|
images: |
|
||||||
jokobsk/pi.alert_dev
|
jokobsk/pi.alert
|
||||||
# generate Docker tags based on the following events/attributes
|
# generate Docker tags based on the following events/attributes
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ Instructions for [leiweibau's fork](https://github.com/leiweibau/Pi.Alert/)
|
|||||||
[screen2]: ./docs/img/2_2_device_sessions.jpg "Screen 2"
|
[screen2]: ./docs/img/2_2_device_sessions.jpg "Screen 2"
|
||||||
[screen3]: ./docs/img/2_3_device_presence.jpg "Screen 3"
|
[screen3]: ./docs/img/2_3_device_presence.jpg "Screen 3"
|
||||||
[screen4]: ./docs/img/3_presence.jpg "Screen 4"
|
[screen4]: ./docs/img/3_presence.jpg "Screen 4"
|
||||||
[screen5]: ./docs/img/2_4_device_nmap.jpg "Screen 5"
|
[screen5]: ./docs/img/2_4_network.png "Screen 5"
|
||||||
[screen6]: ./docs/img/2_5_device_nmap_ready.jpg "Screen 6"
|
[screen6]: ./docs/img/2_5_device_nmap_ready.jpg "Screen 6"
|
||||||
[report1]: ./docs/img/4_report_1.jpg "Report sample 1"
|
[report1]: ./docs/img/4_report_1.jpg "Report sample 1"
|
||||||
[report2]: ./docs/img/4_report_2.jpg "Report sample 2"
|
[report2]: ./docs/img/4_report_2.jpg "Report sample 2"
|
||||||
|
|||||||
BIN
docs/img/2_4_network.png
Normal file
BIN
docs/img/2_4_network.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
@@ -74,7 +74,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create pane content (displayed inside of the tabs)
|
// Create pane content (displayed inside of the tabs)
|
||||||
function createPane($node_mac, $node_name, $node_status, $node_type, $node_ports_count, $activetab){
|
function createPane($node_mac, $node_name, $node_status, $node_type, $node_ports_count, $node_parent_mac, $activetab){
|
||||||
global $pia_lang; //language strings
|
global $pia_lang; //language strings
|
||||||
|
|
||||||
// online/offline status circle (red/green)
|
// online/offline status circle (red/green)
|
||||||
@@ -117,6 +117,16 @@
|
|||||||
.$node_badge.
|
.$node_badge.
|
||||||
'</td>
|
'</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<b>'.$pia_lang['DevDetail_MainInfo_Network'].'</b>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="./deviceDetails.php?mac='.$node_parent_mac.'">
|
||||||
|
<b>'.$node_parent_mac.'</b>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<br>
|
<br>
|
||||||
@@ -217,7 +227,7 @@
|
|||||||
$str_table_close = '</tbody>
|
$str_table_close = '</tbody>
|
||||||
</table>';
|
</table>';
|
||||||
|
|
||||||
// no connected device - don't render table, just dispaly some info
|
// no connected device - don't render table, just display some info
|
||||||
if($str_table_rows == "")
|
if($str_table_rows == "")
|
||||||
{
|
{
|
||||||
$str_table = "<div>
|
$str_table = "<div>
|
||||||
@@ -254,24 +264,25 @@
|
|||||||
// \
|
// \
|
||||||
// PC (leaf)
|
// PC (leaf)
|
||||||
|
|
||||||
$sql = "SELECT node_name, node_mac, online, node_type, node_ports_count
|
$sql = "SELECT node_name, node_mac, online, node_type, node_ports_count, parent_mac
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT a.dev_Name as node_name,
|
SELECT a.dev_Name as node_name,
|
||||||
a.dev_MAC as node_mac,
|
a.dev_MAC as node_mac,
|
||||||
a.dev_PresentLastScan as online,
|
a.dev_PresentLastScan as online,
|
||||||
a.dev_DeviceType as node_type
|
a.dev_DeviceType as node_type,
|
||||||
FROM Devices a
|
a.dev_Network_Node_MAC_ADDR as parent_mac
|
||||||
WHERE a.dev_DeviceType in ('AP', 'Gateway', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router','USB LAN Adapter', 'USB WIFI Adapter', 'Internet')
|
FROM Devices a
|
||||||
) t1
|
WHERE a.dev_DeviceType in ('AP', 'Gateway', 'Powerline', 'Switch', 'WLAN', 'PLC', 'Router','USB LAN Adapter', 'USB WIFI Adapter', 'Internet')
|
||||||
LEFT JOIN
|
) t1
|
||||||
(
|
LEFT JOIN
|
||||||
SELECT b.dev_Network_Node_MAC_ADDR as node_mac_2,
|
(
|
||||||
count() as node_ports_count
|
SELECT b.dev_Network_Node_MAC_ADDR as node_mac_2,
|
||||||
FROM Devices b
|
count() as node_ports_count
|
||||||
WHERE b.dev_Network_Node_MAC_ADDR NOT NULL group by b.dev_Network_Node_MAC_ADDR
|
FROM Devices b
|
||||||
) t2
|
WHERE b.dev_Network_Node_MAC_ADDR NOT NULL group by b.dev_Network_Node_MAC_ADDR
|
||||||
ON (t1.node_mac = t2.node_mac_2);
|
) t2
|
||||||
|
ON (t1.node_mac = t2.node_mac_2);
|
||||||
";
|
";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@@ -284,6 +295,7 @@
|
|||||||
'node_name' => $row['node_name'],
|
'node_name' => $row['node_name'],
|
||||||
'online' => $row['online'],
|
'online' => $row['online'],
|
||||||
'node_type' => $row['node_type'],
|
'node_type' => $row['node_type'],
|
||||||
|
'parent_mac' => $row['parent_mac'],
|
||||||
'node_ports_count' => $row['node_ports_count']);
|
'node_ports_count' => $row['node_ports_count']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,6 +329,7 @@
|
|||||||
$row['online'],
|
$row['online'],
|
||||||
$row['node_type'],
|
$row['node_type'],
|
||||||
$row['node_ports_count'],
|
$row['node_ports_count'],
|
||||||
|
$row['parent_mac'],
|
||||||
$activetab);
|
$activetab);
|
||||||
|
|
||||||
$activetab = ""; // reset active tab indicator, only the first tab is active
|
$activetab = ""; // reset active tab indicator, only the first tab is active
|
||||||
@@ -326,11 +339,93 @@
|
|||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!-- /.tab-pane -->
|
<!-- /.tab-pane -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<!-- Unassigned devices -->
|
||||||
|
<?php
|
||||||
|
global $pia_lang; //language strings
|
||||||
|
OpenDB();
|
||||||
|
|
||||||
|
// Get all Unassigned / unconnected nodes
|
||||||
|
$func_sql = 'SELECT dev_MAC as mac,
|
||||||
|
dev_PresentLastScan as online,
|
||||||
|
dev_Name as name,
|
||||||
|
dev_LastIP as last_ip,
|
||||||
|
dev_Network_Node_MAC_ADDR
|
||||||
|
FROM Devices WHERE (dev_Network_Node_MAC_ADDR is null or dev_Network_Node_MAC_ADDR = "" or dev_Network_Node_MAC_ADDR = " " ) and dev_MAC not like "%internet%" order by name asc';
|
||||||
|
|
||||||
|
global $db;
|
||||||
|
$func_result = $db->query($func_sql);
|
||||||
|
|
||||||
|
// array
|
||||||
|
$tableData = array();
|
||||||
|
while ($row = $func_result -> fetchArray (SQLITE3_ASSOC)) {
|
||||||
|
// Push row data
|
||||||
|
$tableData[] = array( 'mac' => $row['mac'],
|
||||||
|
'online' => $row['online'],
|
||||||
|
'name' => $row['name'],
|
||||||
|
'last_ip' => $row['last_ip']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't do anything if empty
|
||||||
|
if (!(empty($tableData))) {
|
||||||
|
$str_table_header = '
|
||||||
|
<div class="content">
|
||||||
|
<div class="box box-aqua box-body">
|
||||||
|
<section>
|
||||||
|
<h4>
|
||||||
|
'.$pia_lang['Network_UnnasignedDevices'].'
|
||||||
|
</h4>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 100px">'.$pia_lang['Network_Table_State'].'</th>
|
||||||
|
<th>'.$pia_lang['Network_Table_Hostname'].'</th>
|
||||||
|
<th>'.$pia_lang['Network_Table_IP'].'</th>
|
||||||
|
</tr>';
|
||||||
|
|
||||||
|
$str_table_rows = "";
|
||||||
|
|
||||||
|
foreach ($tableData as $row) {
|
||||||
|
|
||||||
|
if ($row['online'] == 1) {
|
||||||
|
$state = badge_online;
|
||||||
|
} else {
|
||||||
|
$state = badge_offline;
|
||||||
|
}
|
||||||
|
|
||||||
|
$str_table_rows = $str_table_rows.
|
||||||
|
'<tr>
|
||||||
|
<td>'
|
||||||
|
.$state.
|
||||||
|
'</td>
|
||||||
|
<td style="padding-left: 10px;">
|
||||||
|
<a href="./deviceDetails.php?mac='.$row['mac'].'">
|
||||||
|
<b>'.$row['name'].'</b>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>'
|
||||||
|
.$row['last_ip'].
|
||||||
|
'</td>
|
||||||
|
</tr>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$str_table_close = '</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
// write the html
|
||||||
|
echo $str_table_header.$str_table_rows.$str_table_close;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
?>
|
||||||
|
|
||||||
<!-- /.content -->
|
<!-- /.content -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /.content-wrapper -->
|
<!-- /.content-wrapper -->
|
||||||
|
|||||||
@@ -334,5 +334,6 @@ $pia_lang['Network_ManageDel_Submit'] = 'Delete';
|
|||||||
$pia_lang['Network_Table_State'] = 'State';
|
$pia_lang['Network_Table_State'] = 'State';
|
||||||
$pia_lang['Network_Table_Hostname'] = 'Hostname';
|
$pia_lang['Network_Table_Hostname'] = 'Hostname';
|
||||||
$pia_lang['Network_Table_IP'] = 'IP';
|
$pia_lang['Network_Table_IP'] = 'IP';
|
||||||
|
$pia_lang['Network_UnnasignedDevices'] = 'Unnasigned devices';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user