mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
Device Icons 0.1
This commit is contained in:
@@ -15,7 +15,7 @@ Scans for devices connected to your WIFI / LAN and alerts you if new and unknown
|
||||
[](https://hub.docker.com/r/jokobsk/pi.alert)
|
||||
[](https://hub.docker.com/r/jokobsk/pi.alert)
|
||||
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) | 📚 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md) | 🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/issues/138)
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) | 📚 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md) | 🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/releases)
|
||||
|
||||
## 🔍 Scan Methods
|
||||
The system continuously scans the network for, **New devices**, **New connections** (re-connections), **Disconnections**, **"Always Connected" devices down**, Devices **IP changes** and **Internet IP address changes**. Scanning methods are:
|
||||
|
||||
@@ -2730,6 +2730,17 @@ def upgradeDB ():
|
||||
ALTER TABLE "Devices" ADD "dev_Network_Node_port" INTEGER
|
||||
""")
|
||||
|
||||
# dev_Icon column
|
||||
dev_Icon_missing = sql.execute ("""
|
||||
SELECT COUNT(*) AS CNTREC FROM pragma_table_info('Devices') WHERE name='dev_Icon'
|
||||
""").fetchone()[0] == 0
|
||||
|
||||
if dev_Icon_missing :
|
||||
file_print("[upgradeDB] Adding dev_Icon to the Devices table")
|
||||
sql.execute("""
|
||||
ALTER TABLE "Devices" ADD "dev_Icon" TEXT
|
||||
""")
|
||||
|
||||
# Re-creating Parameters table
|
||||
file_print("[upgradeDB] Re-creating Parameters table")
|
||||
sql.execute("DROP TABLE Parameters;")
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
# 🐳 A docker image for Pi.Alert
|
||||
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) | 📚 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md) | 🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/issues/138)
|
||||
🐳 [Docker hub](https://registry.hub.docker.com/r/jokobsk/pi.alert) | 📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) | 📚 [Docker instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md) | 🆕 [Release notes](https://github.com/jokob-sk/Pi.Alert/releases)
|
||||
|
||||
<a href="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/devices_split.png" target="_blank">
|
||||
<img src="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/devices_split.png" width="300px" />
|
||||
|
||||
@@ -191,6 +191,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Icon -->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">
|
||||
<?php echo lang('DevDetail_Icon');?>
|
||||
<a href="https://fontawesome.com/search?q=laptop&o=r&m=free" target="_blank"><i class="fa fa-arrow-up-right-from-square"></i></a>
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" title="<?php echo lang('DevDetail_Icon_Descr');?>" id="txtIcon" type="text" value="--">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo lang('DevDetail_MainInfo_Vendor');?></label>
|
||||
@@ -250,31 +261,7 @@
|
||||
<textarea class="form-control" rows="3" id="txtComments"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Network -->
|
||||
<h4 class="bottom-border-aqua"><?php echo lang('DevDetail_MainInfo_Network_Title');?></h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo lang('DevDetail_MainInfo_Network');?></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
|
||||
<input class="form-control" id="txtNetworkNodeMac" type="text" value="--">
|
||||
<span class="input-group-addon"><i title="<?php echo lang('DevDetail_GoToNetworkNode');?>" class="fa fa-square-up-right drp-edit" onclick="goToNetworkNode('txtNetworkNodeMac');"></i></span>
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-info dropdown-toggle" data-mynodemac="" data-toggle="dropdown" aria-expanded="false" id="buttonNetworkNodeMac">
|
||||
<span class="fa fa-caret-down"></span></button>
|
||||
<ul id="dropdownNetworkNodeMac" class="dropdown-menu dropdown-menu-right">
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo lang('DevDetail_MainInfo_Network_Port');?></label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" id="txtNetworkPort" type="text" value="--">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -325,6 +312,32 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Network -->
|
||||
<h4 class="bottom-border-aqua"><?php echo lang('DevDetail_MainInfo_Network_Title');?></h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo lang('DevDetail_MainInfo_Network');?></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
|
||||
<input class="form-control" id="txtNetworkNodeMac" type="text" value="--">
|
||||
<span class="input-group-addon"><i title="<?php echo lang('DevDetail_GoToNetworkNode');?>" class="fa fa-square-up-right drp-edit" onclick="goToNetworkNode('txtNetworkNodeMac');"></i></span>
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-info dropdown-toggle" data-mynodemac="" data-toggle="dropdown" aria-expanded="false" id="buttonNetworkNodeMac">
|
||||
<span class="fa fa-caret-down"></span></button>
|
||||
<ul id="dropdownNetworkNodeMac" class="dropdown-menu dropdown-menu-right">
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"><?php echo lang('DevDetail_MainInfo_Network_Port');?></label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" id="txtNetworkPort" type="text" value="--">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -691,6 +704,11 @@ if ($ENABLED_DARKMODE === True) {
|
||||
// ------------------------------------------------------------
|
||||
function getDevicesListValue(idColumn, idValue, returnColumn)
|
||||
{
|
||||
if(emptyArr.includes(devicesList) || emptyArr.includes(idValue))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
return devicesList.find((item) => {return item[idColumn] == idValue})[returnColumn]
|
||||
}
|
||||
|
||||
@@ -1235,6 +1253,7 @@ function getDeviceData (readAllData=false) {
|
||||
$('#txtOwner').val ('--');
|
||||
$('#txtDeviceType').val ('--');
|
||||
$('#txtVendor').val ('--');
|
||||
$('#txtIcon').val ('--');
|
||||
|
||||
$('#chkFavorite').iCheck ('uncheck');
|
||||
$('#txtGroup').val ('--');
|
||||
@@ -1326,6 +1345,7 @@ function getDeviceData (readAllData=false) {
|
||||
$('#txtOwner').val (deviceData['dev_Owner']);
|
||||
$('#txtDeviceType').val (deviceData['dev_DeviceType']);
|
||||
$('#txtVendor').val (deviceData['dev_Vendor']);
|
||||
$('#txtIcon').val (initDefault(deviceData['dev_Icon'], 'laptop'));
|
||||
|
||||
if (deviceData['dev_Favorite'] == 1) {$('#chkFavorite').iCheck('check');} else {$('#chkFavorite').iCheck('uncheck');}
|
||||
$('#txtGroup').val (deviceData['dev_Group']);
|
||||
@@ -1436,6 +1456,15 @@ function performSwitch(direction)
|
||||
reloadTab()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
function initDefault (value, defaultVal) {
|
||||
if (emptyArr.includes(value))
|
||||
{
|
||||
return defaultVal;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
function setDeviceData (direction='', refreshCallback='') {
|
||||
// Check MAC
|
||||
@@ -1449,6 +1478,7 @@ function setDeviceData (direction='', refreshCallback='') {
|
||||
+ '&owner=' + $('#txtOwner').val()
|
||||
+ '&type=' + $('#txtDeviceType').val()
|
||||
+ '&vendor=' + $('#txtVendor').val()
|
||||
+ '&icon=' + $('#txtIcon').val()
|
||||
+ '&favorite=' + ($('#chkFavorite')[0].checked * 1)
|
||||
+ '&group=' + $('#txtGroup').val()
|
||||
+ '&location=' + $('#txtLocation').val()
|
||||
|
||||
@@ -154,6 +154,7 @@ function setDeviceData() {
|
||||
dev_Owner = "'. quotes($_REQUEST['owner']) .'",
|
||||
dev_DeviceType = "'. quotes($_REQUEST['type']) .'",
|
||||
dev_Vendor = "'. quotes($_REQUEST['vendor']) .'",
|
||||
dev_Icon = "'. quotes($_REQUEST['icon']) .'",
|
||||
dev_Favorite = "'. quotes($_REQUEST['favorite']) .'",
|
||||
dev_Group = "'. quotes($_REQUEST['group']) .'",
|
||||
dev_Location = "'. quotes($_REQUEST['location']) .'",
|
||||
|
||||
@@ -165,6 +165,8 @@ $lang['en_us'] = array(
|
||||
'DevDetail_MainInfo_Name' => 'Name',
|
||||
'DevDetail_MainInfo_Owner' => 'Owner',
|
||||
'DevDetail_MainInfo_Type' => 'Type',
|
||||
'DevDetail_Icon' => 'Icon',
|
||||
'DevDetail_Icon_Descr' => 'Enter a font awesome icon name without the fa- prefix.',
|
||||
'DevDetail_MainInfo_Vendor' => 'Vendor',
|
||||
'DevDetail_MainInfo_Favorite' => 'Favorite',
|
||||
'DevDetail_MainInfo_Group' => 'Group',
|
||||
|
||||
Reference in New Issue
Block a user