Device Icons 0.1

This commit is contained in:
Jokob-sk
2023-01-15 17:27:23 +11:00
parent e0d8ade2d0
commit e7ac2321f2
6 changed files with 71 additions and 27 deletions

View File

@@ -15,7 +15,7 @@ Scans for devices connected to your WIFI / LAN and alerts you if new and unknown
[![Docker Pulls](https://img.shields.io/docker/pulls/jokobsk/pi.alert?label=Pulls&logo=docker&color=0aa8d2&logoColor=fff)](https://hub.docker.com/r/jokobsk/pi.alert) [![Docker Pulls](https://img.shields.io/docker/pulls/jokobsk/pi.alert?label=Pulls&logo=docker&color=0aa8d2&logoColor=fff)](https://hub.docker.com/r/jokobsk/pi.alert)
[![Docker Pushed](https://img.shields.io/badge/dynamic/json?color=0aa8d2&logoColor=fff&label=Pushed&query=last_updated&url=https%3A%2F%2Fhub.docker.com%2Fv2%2Frepositories%2Fjokobsk%2Fpi.alert%2F&logo=docker&link=http://left&link=https://hub.docker.com/repository/docker/jokobsk/pi.alert)](https://hub.docker.com/r/jokobsk/pi.alert) [![Docker Pushed](https://img.shields.io/badge/dynamic/json?color=0aa8d2&logoColor=fff&label=Pushed&query=last_updated&url=https%3A%2F%2Fhub.docker.com%2Fv2%2Frepositories%2Fjokobsk%2Fpi.alert%2F&logo=docker&link=http://left&link=https://hub.docker.com/repository/docker/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 ## 🔍 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: 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:

View File

@@ -2730,6 +2730,17 @@ def upgradeDB ():
ALTER TABLE "Devices" ADD "dev_Network_Node_port" INTEGER 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 # Re-creating Parameters table
file_print("[upgradeDB] Re-creating Parameters table") file_print("[upgradeDB] Re-creating Parameters table")
sql.execute("DROP TABLE Parameters;") sql.execute("DROP TABLE Parameters;")

View File

@@ -6,7 +6,7 @@
# 🐳 A docker image for Pi.Alert # 🐳 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"> <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" /> <img src="https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/devices_split.png" width="300px" />

View File

@@ -191,6 +191,17 @@
</div> </div>
</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 --> <!-- Vendor -->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"><?php echo lang('DevDetail_MainInfo_Vendor');?></label> <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> <textarea class="form-control" rows="3" id="txtComments"></textarea>
</div> </div>
</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>
@@ -324,6 +311,32 @@
<input class="checkbox blue hidden" id="chkStaticIP" type="checkbox"> <input class="checkbox blue hidden" id="chkStaticIP" type="checkbox">
</div> </div>
</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>
</div> </div>
@@ -691,6 +704,11 @@ if ($ENABLED_DARKMODE === True) {
// ------------------------------------------------------------ // ------------------------------------------------------------
function getDevicesListValue(idColumn, idValue, returnColumn) function getDevicesListValue(idColumn, idValue, returnColumn)
{ {
if(emptyArr.includes(devicesList) || emptyArr.includes(idValue))
{
return '';
}
return devicesList.find((item) => {return item[idColumn] == idValue})[returnColumn] return devicesList.find((item) => {return item[idColumn] == idValue})[returnColumn]
} }
@@ -1235,6 +1253,7 @@ function getDeviceData (readAllData=false) {
$('#txtOwner').val ('--'); $('#txtOwner').val ('--');
$('#txtDeviceType').val ('--'); $('#txtDeviceType').val ('--');
$('#txtVendor').val ('--'); $('#txtVendor').val ('--');
$('#txtIcon').val ('--');
$('#chkFavorite').iCheck ('uncheck'); $('#chkFavorite').iCheck ('uncheck');
$('#txtGroup').val ('--'); $('#txtGroup').val ('--');
@@ -1326,6 +1345,7 @@ function getDeviceData (readAllData=false) {
$('#txtOwner').val (deviceData['dev_Owner']); $('#txtOwner').val (deviceData['dev_Owner']);
$('#txtDeviceType').val (deviceData['dev_DeviceType']); $('#txtDeviceType').val (deviceData['dev_DeviceType']);
$('#txtVendor').val (deviceData['dev_Vendor']); $('#txtVendor').val (deviceData['dev_Vendor']);
$('#txtIcon').val (initDefault(deviceData['dev_Icon'], 'laptop'));
if (deviceData['dev_Favorite'] == 1) {$('#chkFavorite').iCheck('check');} else {$('#chkFavorite').iCheck('uncheck');} if (deviceData['dev_Favorite'] == 1) {$('#chkFavorite').iCheck('check');} else {$('#chkFavorite').iCheck('uncheck');}
$('#txtGroup').val (deviceData['dev_Group']); $('#txtGroup').val (deviceData['dev_Group']);
@@ -1436,6 +1456,15 @@ function performSwitch(direction)
reloadTab() reloadTab()
} }
// -----------------------------------------------------------------------------
function initDefault (value, defaultVal) {
if (emptyArr.includes(value))
{
return defaultVal;
}
return value;
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
function setDeviceData (direction='', refreshCallback='') { function setDeviceData (direction='', refreshCallback='') {
// Check MAC // Check MAC
@@ -1449,6 +1478,7 @@ function setDeviceData (direction='', refreshCallback='') {
+ '&owner=' + $('#txtOwner').val() + '&owner=' + $('#txtOwner').val()
+ '&type=' + $('#txtDeviceType').val() + '&type=' + $('#txtDeviceType').val()
+ '&vendor=' + $('#txtVendor').val() + '&vendor=' + $('#txtVendor').val()
+ '&icon=' + $('#txtIcon').val()
+ '&favorite=' + ($('#chkFavorite')[0].checked * 1) + '&favorite=' + ($('#chkFavorite')[0].checked * 1)
+ '&group=' + $('#txtGroup').val() + '&group=' + $('#txtGroup').val()
+ '&location=' + $('#txtLocation').val() + '&location=' + $('#txtLocation').val()

View File

@@ -154,6 +154,7 @@ function setDeviceData() {
dev_Owner = "'. quotes($_REQUEST['owner']) .'", dev_Owner = "'. quotes($_REQUEST['owner']) .'",
dev_DeviceType = "'. quotes($_REQUEST['type']) .'", dev_DeviceType = "'. quotes($_REQUEST['type']) .'",
dev_Vendor = "'. quotes($_REQUEST['vendor']) .'", dev_Vendor = "'. quotes($_REQUEST['vendor']) .'",
dev_Icon = "'. quotes($_REQUEST['icon']) .'",
dev_Favorite = "'. quotes($_REQUEST['favorite']) .'", dev_Favorite = "'. quotes($_REQUEST['favorite']) .'",
dev_Group = "'. quotes($_REQUEST['group']) .'", dev_Group = "'. quotes($_REQUEST['group']) .'",
dev_Location = "'. quotes($_REQUEST['location']) .'", dev_Location = "'. quotes($_REQUEST['location']) .'",

View File

@@ -165,6 +165,8 @@ $lang['en_us'] = array(
'DevDetail_MainInfo_Name' => 'Name', 'DevDetail_MainInfo_Name' => 'Name',
'DevDetail_MainInfo_Owner' => 'Owner', 'DevDetail_MainInfo_Owner' => 'Owner',
'DevDetail_MainInfo_Type' => 'Type', '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_Vendor' => 'Vendor',
'DevDetail_MainInfo_Favorite' => 'Favorite', 'DevDetail_MainInfo_Favorite' => 'Favorite',
'DevDetail_MainInfo_Group' => 'Group', 'DevDetail_MainInfo_Group' => 'Group',