CSS and row count fixes

This commit is contained in:
Jokob-sk
2022-12-26 00:30:05 +11:00
parent 8c8eaeb92f
commit 923ab5b903
7 changed files with 52 additions and 35 deletions

View File

@@ -217,9 +217,6 @@ if (sys.version_info > (3,0)):
else:
execfile (fullConfPath)
deviceUrl = REPORT_DASHBOARD_URL + '/deviceDetails.php?mac='
#===============================================================================
# USER CONFIG VARIABLES - END
#===============================================================================
@@ -264,9 +261,13 @@ def main ():
upgradeDB()
while True:
# update NOW time
time_now = datetime.datetime.now()
# re-load user configuration
importConfig()
# proceed if 1 minute passed
if last_run + timedelta(minutes=1) < time_now :
@@ -282,9 +283,6 @@ def main ():
startTime = time_now
startTime = startTime.replace (microsecond=0)
# re-load user configuration
importConfig()
# determine run/scan type based on passed time
if last_internet_IP_scan + timedelta(minutes=3) < time_now:
cycle = 'internet_IP'
@@ -315,9 +313,12 @@ def main ():
# Close SQL
closeDB()
# Final menssage
# Final message
if cycle != "":
file_print('[', time_now.replace (microsecond=0), '] Last action: ', cycle)
action = str(cycle)
if cycle == "1":
action = "network_scan"
file_print('[', time_now.replace (microsecond=0), '] Last action: ', action)
cycle = ""
# Footer
@@ -566,7 +567,6 @@ def update_devices_MAC_vendors (pArg = ''):
recordsToUpdate.append ([vendor, device['dev_MAC']])
# Print log
file_print('')
file_print(" Devices Ignored: ", ignored)
file_print(" Vendors Not Found:", notFound)
file_print(" Vendors updated: ", len(recordsToUpdate) )
@@ -940,13 +940,13 @@ def print_scan_stats ():
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
WHERE cur_ScanMethod='arp-scan' AND cur_ScanCycle = ? """,
(cycle,))
file_print(' arp-scan detected....: ', str (sql.fetchone()[0]) )
file_print(' arp-scan detected..: ', str (sql.fetchone()[0]) )
# Devices Pi-hole
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
WHERE cur_ScanMethod='PiHole' AND cur_ScanCycle = ? """,
(cycle,))
file_print(' Pi-hole detected.....: +' + str (sql.fetchone()[0]) )
file_print(' Pi-hole detected...: +' + str (sql.fetchone()[0]) )
# New Devices
sql.execute ("""SELECT COUNT(*) FROM CurrentScan
@@ -961,7 +961,7 @@ def print_scan_stats ():
WHERE dev_MAC = cur_MAC AND dev_ScanCycle = cur_ScanCycle
AND dev_ScanCycle = ? """,
(cycle,))
file_print('')
file_print(' Devices in this cycle..: ' + str (sql.fetchone()[0]) )
# Down Alerts
@@ -1512,8 +1512,11 @@ json_final = []
def email_reporting ():
global mail_text
global mail_html
deviceUrl = REPORT_DASHBOARD_URL + '/deviceDetails.php?mac='
# Reporting section
file_print('\nCheck if something to report')
file_print('Check if something to report')
openDB()
# prepare variables for JSON construction
@@ -2211,9 +2214,20 @@ def start_mqtt_thread ():
# DB
#===============================================================================
def importConfig ():
openDB()
# file_print('pialertPath:', pialertPath)
# global SCAN_SUBNETS, PRINT_LOG, TIMEZONE, PIALERT_WEB_PROTECTION, PIALERT_WEB_PASSWORD, INCLUDED_SECTIONS, SCAN_CYCLE_MINUTES, DAYS_TO_KEEP_EVENTS, REPORT_DASHBOARD_URL
# load the variables from pialert.conf
if (sys.version_info > (3,0)):
# file_print(">>>>>oooooo>>>>", PRINT_LOG)
d = {}
exec(open(fullConfPath).read(), d ) #here
else:
execfile (fullConfPath, globals())
# file_print(">>>>>>>>>", PRINT_LOG)
openDB()
# Code_Name, Display_Name, Description, Type, Options, Value, Group
settings = [
@@ -2484,7 +2498,7 @@ def print_log (pText):
log_timestamp2 = datetime.datetime.now()
# Print line + time + elapsed time + text
file_print('[LOG_PRINT] > ',
file_print('[LOG_PRINT] ',
log_timestamp2, ' ',
log_timestamp2 - log_timestamp, ' ',
pText)

View File

@@ -579,18 +579,18 @@ height: 50px;
.setting_name
{
width:20%;
width:19%;
font-weight: 300;
}
.setting_description
{
width:50%;
width:46%;
}
.setting_input
{
width:30%;
width:35%;
}
.center
@@ -609,7 +609,7 @@ height: 50px;
.settings_content {
padding: 10px;
background-color: #272c30;
/* background-color: #272c30; */
margin: 10px;
}

View File

@@ -220,11 +220,16 @@
// -----------------------------------------------------------------------------
function main () {
// get parameter value
$.get('php/server/parameters.php?action=get&parameter='+ parTableRows, function(data) {
var result = JSON.parse(data);
result = parseInt(result, 10)
if (Number.isInteger (result) ) {
tableRows = result;
}
// get parameter value

View File

@@ -206,6 +206,7 @@ function main () {
// get parameter value
$.get('php/server/parameters.php?action=get&parameter='+ parTableRows, function(data) {
var result = JSON.parse(data);
result = parseInt(result, 10)
if (Number.isInteger (result) ) {
tableRows = result;
}

View File

@@ -390,7 +390,7 @@ if (submit && isset($_POST['langselector_set'])) {
<div><button class="btn btn-primary" onclick="logManage('pialert_front.log','cleanLog')"><?php echo $pia_lang['Gen_Purge'];?></button></div>
</div>
<div class="db_tools_table_cell_b">
<textarea id="pialert_log" class="logs" cols="70" rows="10" readonly><?php echo file_get_contents( "./log/pialert_front.log" ); ?>
<textarea id="pialert_front_log" class="logs" cols="70" rows="10" readonly><?php echo file_get_contents( "./log/pialert_front.log" ); ?>
</textarea>
</div>
</div>
@@ -684,6 +684,9 @@ function scrollDown()
var tempArea = $('#pialert_log');
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
tempArea = $('#pialert_front_log');
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
tempArea = $('#IP_changes_log');
$(tempArea[0]).scrollTop(tempArea[0].scrollHeight);
@@ -741,6 +744,7 @@ function setCache(key, data)
// load footer asynchronously not to block the page load/other sections
window.onload = function asyncFooter()
{
scrollDown();
$("#lastCommit").append('<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/jokob-sk/pi.alert/main?logo=github">');

View File

@@ -51,14 +51,6 @@ $timestamp = $date->format('Y-m-d_H-i-s');
// ###################################
// ## GUI settings processing start
// ###################################
if (file_exists('../db/setting_darkmode')) {
$ENABLED_DARKMODE = True;
}
foreach (glob("../db/setting_skin*") as $filename) {
$pia_skin_selected = str_replace('setting_','',basename($filename));
}
if (isset($pia_skin_selected) == FALSE or (strlen($pia_skin_selected) == 0)) {$pia_skin_selected = 'skin-blue';}
foreach (glob("../db/setting_language*") as $filename) {
$pia_lang_selected = str_replace('setting_language_','',basename($filename));
}

View File

@@ -72,7 +72,7 @@ $db->close();
<?php echo $pia_lang['Navigation_Settings'];?>
</h1>
</section>
<div class="content">
<?php
$html = "";
@@ -87,7 +87,7 @@ $db->close();
// create settings groups
foreach ($groups as $group) {
$html = $html.'<section class="settings_content">
$html = $html.'<section class="content box">
<h4>'.$group.'</h4>';
// populate settings for each group
@@ -95,7 +95,7 @@ $db->close();
if($set["Group"] == $group)
{
$html = $html.
'<div class="table_row" >
'<div class=" row table_row" >
<div class="table_cell setting_name bold" ><label>';
$html = $html.getString ($set['Code_Name'].'_name', $set['Display_Name'], $pia_lang).'</label>';
@@ -224,6 +224,7 @@ $db->close();
echo $html;
?>
</div>
<!-- /.content -->
<div class="row" >