mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-30 23:03:03 -07:00
FE: initCheck moved into systeminfo
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -40,7 +40,7 @@ There are several ways to check if the GraphQL server is running.
|
||||
|
||||
### Init Check
|
||||
|
||||
You can navigate to Maintenance -> Init Check to see if `isGraphQLServerRunning` is ticked:
|
||||
You can navigate to System Info -> Init Check to see if `isGraphQLServerRunning` is ticked:
|
||||
|
||||

|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 68 KiB |
@@ -5,24 +5,24 @@ function lockDatabase(delay=20) {
|
||||
url: 'php/server/dbHelper.php', // Replace with the actual path to your PHP file
|
||||
type: 'GET',
|
||||
data: { action: 'lockDatabase', delay: delay },
|
||||
success: function(response) {
|
||||
console.log('Executed');
|
||||
success: function(response) {
|
||||
console.log('Executed');
|
||||
},
|
||||
error: function() {
|
||||
console.log('Error ocurred');
|
||||
console.log('Error ocurred');
|
||||
}
|
||||
});
|
||||
|
||||
let times = delay;
|
||||
let times = delay;
|
||||
let countdownInterval = setInterval(() => {
|
||||
times--;
|
||||
console.log(`Remaining time: ${times} seconds`);
|
||||
|
||||
|
||||
if (times <= 0) {
|
||||
clearInterval(countdownInterval);
|
||||
console.log('Countdown finished');
|
||||
}
|
||||
}, 1000);
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ const requiredFiles = [
|
||||
function updateFileStatusUI(file, status) {
|
||||
const item = $(`#file-${file.replace(/[^a-z0-9]/gi, '-')}`);
|
||||
const icon = item.find('span.icon-wrap');
|
||||
|
||||
|
||||
if (status === 'ok') {
|
||||
icon.html('<i class="fa-solid fa-check "></i>');
|
||||
} else if (status === 'fail') {
|
||||
@@ -61,7 +61,7 @@ const requiredFiles = [
|
||||
icon.html('<i class="fa-solid fa-spinner fa-spin text-secondary"></i>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function checkAppInitializedJson() {
|
||||
requiredFiles.forEach(file => {
|
||||
@@ -77,17 +77,17 @@ const requiredFiles = [
|
||||
updateFileStatusUI(file, 'fail');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const allOk = requiredFiles.every(file => fileStatus[file] === 'ok');
|
||||
|
||||
|
||||
if (allOk) {
|
||||
checkInternalStatusAfterFiles();
|
||||
} else {
|
||||
setTimeout(checkAppInitializedJson, 1000);
|
||||
setTimeout(checkAppInitializedJson, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function checkInternalStatusAfterFiles() {
|
||||
const promises = [
|
||||
waitForAppInitialized().then(() => {
|
||||
@@ -97,7 +97,7 @@ const requiredFiles = [
|
||||
fileStatus['isAppInitialized'] = 'fail';
|
||||
updateFileStatusUI('isAppInitialized', 'fail');
|
||||
}),
|
||||
|
||||
|
||||
waitForGraphQLServer().then(() => {
|
||||
fileStatus['isGraphQLServerRunning'] = 'ok';
|
||||
updateFileStatusUI('isGraphQLServerRunning', 'ok');
|
||||
@@ -106,14 +106,14 @@ const requiredFiles = [
|
||||
updateFileStatusUI('isGraphQLServerRunning', 'fail');
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
Promise.allSettled(promises).then(() => {
|
||||
const allPassed = internalChecks.every(key => fileStatus[key] === 'ok');
|
||||
if (allPassed) {
|
||||
$('#check-status').show();
|
||||
$('#check-status-plc').hide();
|
||||
} else {
|
||||
setTimeout(checkInternalStatusAfterFiles, 1000);
|
||||
setTimeout(checkInternalStatusAfterFiles, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -132,8 +132,8 @@ function checkAppInitializedJsonInit() {
|
||||
const allItems = [...requiredFiles, ...internalChecks];
|
||||
|
||||
allItems.forEach(file => {
|
||||
|
||||
|
||||
|
||||
|
||||
$('#file-check-list').append(`
|
||||
<div class="panel panel-secondary col-xs-6 col-sm-4 col-md-3 col-lg-2 col-xxl-1 padding-5px">
|
||||
<div class="file-checking border rounded p-2 d-flex flex-column justify-content-between h-100" id="file-${file.replace(/[^a-z0-9]/gi, '-')}">
|
||||
@@ -151,7 +151,7 @@ function checkAppInitializedJsonInit() {
|
||||
checkAppInitializedJson();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<!-- Main content ---------------------------------------------------------- -->
|
||||
<section class="content">
|
||||
|
||||
|
||||
<script>
|
||||
showSpinner();
|
||||
</script>
|
||||
@@ -28,7 +28,7 @@ $nax_db_mod = file_exists($nax_db) ? date ("F d Y H:i:s", filemtime($nax_db)) :
|
||||
// Table sizes -----------------------------------------------------------------
|
||||
|
||||
$tableSizesHTML = "";
|
||||
|
||||
|
||||
// Open a connection to the SQLite database
|
||||
$db = new SQLite3($nax_db);
|
||||
|
||||
@@ -46,7 +46,7 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
|
||||
// Close the database connection
|
||||
$db->close();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -55,13 +55,13 @@ $db->close();
|
||||
<div class="box" id="Maintain-Status">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
<i class="fa fa-display"></i>
|
||||
<i class="fa fa-display"></i>
|
||||
<?= lang('Maintenance_Status');?>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body" style="padding-bottom: 5px;">
|
||||
<div class="db_info_table">
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_version');?>
|
||||
<a href="https://github.com/jokob-sk/NetAlertX/blob/main/docs/VERSIONS.md" target="_blank"> <span><i class="fa fa-circle-question"></i></a></span>
|
||||
</div>
|
||||
@@ -73,41 +73,41 @@ $db->close();
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_built_on');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo date("Y-m-d", ((int)file_get_contents( "buildtimestamp.txt")));?>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo date("Y-m-d", ((int)file_get_contents( "buildtimestamp.txt")));?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_Running_Version');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php include 'php/templates/version.php'; ?>
|
||||
<div class="db_info_table_cell">
|
||||
<?php include 'php/templates/version.php'; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_database_path');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo $nax_db;?>
|
||||
<?php echo $nax_db;?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell"><?= lang('Maintenance_database_size');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo $nax_db_size;?> (wal: <?php echo $nax_wal_size;?>)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell"><?= lang('Maintenance_database_rows');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo $tableSizesHTML;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell"><?= lang('Maintenance_database_lastmod');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo $nax_db_mod;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
@@ -118,34 +118,28 @@ $db->close();
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active">
|
||||
<a id="tab_DBTools_id" href="#tab_DBTools" data-toggle="tab">
|
||||
<i class="fa fa-toolbox"></i>
|
||||
<i class="fa fa-toolbox"></i>
|
||||
<?= lang('Maintenance_Tools_Tab_Tools');?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="tab_BackupRestore_id" href="#tab_BackupRestore" data-toggle="tab">
|
||||
<i class="fa fa-file-shield"></i>
|
||||
<i class="fa fa-file-shield"></i>
|
||||
<?= lang('Maintenance_Tools_Tab_BackupRestore');?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="tab_Logging_id" href="#tab_Logging" data-toggle="tab">
|
||||
<i class="fa fa-triangle-exclamation"></i>
|
||||
<i class="fa fa-triangle-exclamation"></i>
|
||||
<?= lang('Maintenance_Tools_Tab_Logging');?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="tab_multiEdit_id" href="#tab_multiEdit" data-toggle="tab">
|
||||
<i class="fa fa-pencil pointer" ></i>
|
||||
<i class="fa fa-pencil pointer" ></i>
|
||||
<?= lang('Device_MultiEdit');?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="tab_initCheck_id" href="#tab_initCheck" data-toggle="tab">
|
||||
<i class="fa-solid fa-check"></i>
|
||||
<?= lang('Maintenance_InitCheck');?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content spinnerTarget">
|
||||
<div class="tab-pane active" id="tab_DBTools">
|
||||
@@ -215,13 +209,13 @@ $db->close();
|
||||
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnImportPastedCSV" onclick="askImportPastedCSV()"><?= lang('Maintenance_Tool_ImportPastedCSV');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_ImportPastedCSV_text');?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" >
|
||||
<button type="button" class="btn btn-default pa-btn bg-green dbtools-button" id="btnDownloadConfig" onclick="DownloadConfig()"><?= lang('Maintenance_Tool_DownloadConfig');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_DownloadConfig_text');?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_tools_table_cell_a" >
|
||||
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnImportPastedConfig" onclick="askImportPastedConfig()"><?= lang('Maintenance_Tool_ImportPastedConfig');?></button>
|
||||
@@ -233,7 +227,7 @@ $db->close();
|
||||
<button type="button" class="btn btn-default pa-btn bg-green dbtools-button" id="btnDownloadWorkflows" onclick="DownloadWorkflows()"><?= lang('Maintenance_Tool_DownloadWorkflows');?></button>
|
||||
</div>
|
||||
<div class="db_tools_table_cell_b"><?= lang('Maintenance_Tool_DownloadWorkflows_text');?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ---------------------------Logging-------------------------------------------- -->
|
||||
@@ -257,17 +251,17 @@ $db->close();
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="form-inline toggle">
|
||||
<div class="form-inline toggle">
|
||||
<input class="form-control" type="text" id="logsFilter" oninput="applyFilter()" placeholder="Filter lines with text..." />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table">
|
||||
<div id="logsPlc"></div>
|
||||
<div class="db_info_table">
|
||||
<div id="logsPlc"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ---------------------------Bulk edit -------------------------------------------- -->
|
||||
<div class="tab-pane" id="tab_multiEdit">
|
||||
<div class="db_info_table">
|
||||
@@ -280,20 +274,6 @@ $db->close();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ---------------------------Init check -------------------------------------------- -->
|
||||
<div class="tab-pane" id="tab_initCheck">
|
||||
<div class="db_info_table">
|
||||
<div class="box box-solid">
|
||||
|
||||
<?php
|
||||
require 'initCheck.php';
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ------------------------------------------------------------------------------ -->
|
||||
|
||||
</div>
|
||||
@@ -302,22 +282,22 @@ $db->close();
|
||||
<div class="box-body " style="text-align: center;">
|
||||
<h5 class="text-aqua" style="font-size: 16px;">
|
||||
<span id="lastCommit">
|
||||
|
||||
|
||||
</span>
|
||||
<span id="lastDockerUpdate">
|
||||
|
||||
</span>
|
||||
|
||||
</span>
|
||||
</h5>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- /.content -->
|
||||
<?php
|
||||
@@ -340,13 +320,13 @@ var selectedTab = 'tab_DBTools_id';
|
||||
// -----------------------------------------------------------
|
||||
// delete devices with emty macs
|
||||
function askDeleteDevicesWithEmptyMACs () {
|
||||
// Ask
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Maintenance_Tool_del_empty_macs_noti');?>', '<?= lang('Maintenance_Tool_del_empty_macs_noti_text');?>',
|
||||
'Cancel', 'Delete', 'deleteDevicesWithEmptyMACs');
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
function deleteDevicesWithEmptyMACs()
|
||||
{
|
||||
{
|
||||
// Delete device
|
||||
$.get('php/server/devices.php?action=deleteAllWithEmptyMACs', function(msg) {
|
||||
showMessage (msg);
|
||||
@@ -355,15 +335,15 @@ function deleteDevicesWithEmptyMACs()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// delete all devices
|
||||
// delete all devices
|
||||
function askDeleteAllDevices () {
|
||||
// Ask
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Maintenance_Tool_del_alldev_noti');?>', '<?= lang('Maintenance_Tool_del_alldev_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Delete');?>', 'deleteAllDevices');
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
function deleteAllDevices()
|
||||
{
|
||||
{
|
||||
// Delete device
|
||||
$.get('php/server/devices.php?action=deleteAllDevices', function(msg) {
|
||||
showMessage (msg);
|
||||
@@ -372,15 +352,15 @@ function deleteAllDevices()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// delete all (unknown) devices
|
||||
// delete all (unknown) devices
|
||||
function askDeleteUnknown () {
|
||||
// Ask
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Maintenance_Tool_del_unknowndev_noti');?>', '<?= lang('Maintenance_Tool_del_unknowndev_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Delete');?>', 'deleteUnknownDevices');
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
function deleteUnknownDevices()
|
||||
{
|
||||
{
|
||||
// Execute
|
||||
$.get('php/server/devices.php?action=deleteUnknownDevices', function(msg) {
|
||||
showMessage (msg);
|
||||
@@ -389,15 +369,15 @@ function deleteUnknownDevices()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// delete all Events
|
||||
// delete all Events
|
||||
function askDeleteEvents () {
|
||||
// Ask
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Maintenance_Tool_del_allevents_noti');?>', '<?= lang('Maintenance_Tool_del_allevents_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Delete');?>', 'deleteEvents');
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
function deleteEvents()
|
||||
{
|
||||
{
|
||||
// Execute
|
||||
$.get('php/server/devices.php?action=deleteEvents', function(msg) {
|
||||
showMessage (msg);
|
||||
@@ -408,13 +388,13 @@ function deleteEvents()
|
||||
// -----------------------------------------------------------
|
||||
// delete all Events older than 30 days
|
||||
function askDeleteEvents30 () {
|
||||
// Ask
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Maintenance_Tool_del_allevents30_noti');?>', '<?= lang('Maintenance_Tool_del_allevents30_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Delete');?>', 'deleteEvents30');
|
||||
}
|
||||
// -----------------------------------------------------------
|
||||
function deleteEvents30()
|
||||
{
|
||||
{
|
||||
// Execute
|
||||
$.get('php/server/devices.php?action=deleteEvents30', function(msg) {
|
||||
showMessage (msg);
|
||||
@@ -423,14 +403,14 @@ function deleteEvents30()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// delete History
|
||||
// delete History
|
||||
function askDeleteActHistory () {
|
||||
// Ask
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Maintenance_Tool_del_ActHistory_noti');?>', '<?= lang('Maintenance_Tool_del_ActHistory_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Delete');?>', 'deleteActHistory');
|
||||
}
|
||||
function deleteActHistory()
|
||||
{
|
||||
{
|
||||
// Execute
|
||||
$.get('php/server/devices.php?action=deleteActHistory', function(msg) {
|
||||
showMessage (msg);
|
||||
@@ -441,7 +421,7 @@ function deleteActHistory()
|
||||
// Import pasted Config ASK
|
||||
function askImportPastedConfig() {
|
||||
|
||||
// Add new icon as base64 string
|
||||
// Add new icon as base64 string
|
||||
showModalInput ('<i class="fa fa-square-plus pointer"></i> <?= lang('Maintenance_Tool_ImportConfig_noti');?>', '<?= lang('Maintenance_Tool_ImportPastedConfig_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', 'UploadConfig');
|
||||
}
|
||||
@@ -449,15 +429,15 @@ function askImportPastedConfig() {
|
||||
// -----------------------------------------------------------
|
||||
// Upload Settings Config
|
||||
function UploadConfig()
|
||||
{
|
||||
{
|
||||
appConf = $('#modal-input-textarea').val()
|
||||
// encode for import
|
||||
appConfBase64 = btoa(appConf)
|
||||
|
||||
// import
|
||||
$.post('php/server/query_replace_config.php', { base64data: appConfBase64, fileName: "app.conf" }, function(msg) {
|
||||
console.log(msg);
|
||||
// showMessage(msg);
|
||||
console.log(msg);
|
||||
// showMessage(msg);
|
||||
write_notification(`[Maintenance]: ${msg}`, 'interrupt');
|
||||
});
|
||||
|
||||
@@ -466,7 +446,7 @@ function UploadConfig()
|
||||
// -----------------------------------------------------------
|
||||
// Download Settings Config
|
||||
function DownloadConfig()
|
||||
{
|
||||
{
|
||||
// Execute
|
||||
openInNewTab("php/server/query_config.php?file=app.conf&download=true")
|
||||
}
|
||||
@@ -475,7 +455,7 @@ function DownloadConfig()
|
||||
// Download Workflows
|
||||
|
||||
function DownloadWorkflows()
|
||||
{
|
||||
{
|
||||
// Execute
|
||||
openInNewTab("php/server/query_config.php?file=workflows.json&download=true")
|
||||
}
|
||||
@@ -485,7 +465,7 @@ function DownloadWorkflows()
|
||||
// -----------------------------------------------------------
|
||||
// Export CSV
|
||||
function ExportCSV()
|
||||
{
|
||||
{
|
||||
// Execute
|
||||
openInNewTab("php/server/devices.php?action=ExportCSV")
|
||||
}
|
||||
@@ -493,12 +473,12 @@ function ExportCSV()
|
||||
// -----------------------------------------------------------
|
||||
// Import CSV
|
||||
function askImportCSV() {
|
||||
// Ask
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Maintenance_Tool_ImportCSV_noti');?>', '<?= lang('Maintenance_Tool_ImportCSV_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', 'ImportCSV');
|
||||
}
|
||||
function ImportCSV()
|
||||
{
|
||||
{
|
||||
// Execute
|
||||
$.get('php/server/devices.php?action=ImportCSV', function(msg) {
|
||||
showMessage (msg);
|
||||
@@ -510,21 +490,21 @@ function ImportCSV()
|
||||
// Import pasted CSV
|
||||
function askImportPastedCSV() {
|
||||
|
||||
// Add new icon as base64 string
|
||||
// Add new icon as base64 string
|
||||
showModalInput ('<i class="fa fa-square-plus pointer"></i> <?= lang('Maintenance_Tool_ImportCSV_noti');?>', '<?= lang('Maintenance_Tool_ImportPastedCSV_noti_text');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', 'ImportPastedCSV');
|
||||
}
|
||||
|
||||
function ImportPastedCSV()
|
||||
{
|
||||
{
|
||||
var csv = $('#modal-input-textarea').val();
|
||||
|
||||
console.log(csv);
|
||||
|
||||
csvBase64 = utf8ToBase64(csv);
|
||||
csvBase64 = utf8ToBase64(csv);
|
||||
|
||||
console.log(csvBase64);
|
||||
|
||||
|
||||
|
||||
$.post('php/server/devices.php?action=ImportCSV', { content: csvBase64 }, function(msg) {
|
||||
showMessage(msg);
|
||||
@@ -537,7 +517,7 @@ function ImportPastedCSV()
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
// Clean log file
|
||||
// Clean log file
|
||||
var targetLogFile = "";
|
||||
var logFileAction = "";
|
||||
|
||||
@@ -547,17 +527,17 @@ var logFileAction = "";
|
||||
function logManage(callback) {
|
||||
targetLogFile = arguments[0]; // target
|
||||
logFileAction = arguments[1]; // action
|
||||
// Ask
|
||||
// Ask
|
||||
showModalWarning('<?= lang('Gen_Purge');?>' + ' ' + arguments[1], '<?= lang('Gen_AreYouSure');?>',
|
||||
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', "performLogManage");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
function performLogManage() {
|
||||
function performLogManage() {
|
||||
// Execute
|
||||
console.log("targetLogFile:" + targetLogFile)
|
||||
console.log("logFileAction:" + logFileAction)
|
||||
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "php/server/util.php",
|
||||
@@ -572,7 +552,7 @@ function performLogManage() {
|
||||
// --------------------------------------------------------
|
||||
// scroll down the log areas
|
||||
function scrollDown() {
|
||||
|
||||
|
||||
var elementToCheck = $("#tab_Logging_id");
|
||||
|
||||
// Check if the parent <li> is active
|
||||
@@ -583,14 +563,14 @@ function scrollDown() {
|
||||
$(this).scrollTop(this.scrollHeight);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
// General initialization
|
||||
// --------------------------------------------------------
|
||||
function initializeTabs() {
|
||||
function initializeTabs() {
|
||||
setTimeout(() => {
|
||||
const key = "activeMaintenanceTab";
|
||||
|
||||
@@ -608,7 +588,7 @@ function initializeTabs() {
|
||||
}
|
||||
|
||||
// update cookie if target specified
|
||||
if (target) {
|
||||
if (target) {
|
||||
selectedTab = target.endsWith("_id") ? target : `${target}_id`;
|
||||
setCache(key, selectedTab); // _id is added so it doesn't conflict with AdminLTE tab behavior
|
||||
}
|
||||
@@ -659,15 +639,15 @@ function toggleAutoRefresh() {
|
||||
// Manages the filter application on the logs
|
||||
function applyFilter() {
|
||||
const filterText = $("#logsFilter").val().toLowerCase();
|
||||
|
||||
|
||||
$(".logs").each(function() {
|
||||
const originalText = $(this).data('originalText') || $(this).val();
|
||||
|
||||
|
||||
if (!$(this).data('originalText')) {
|
||||
$(this).data('originalText', originalText);
|
||||
}
|
||||
|
||||
const filteredLines = originalText.split('\n').filter(line =>
|
||||
const filteredLines = originalText.split('\n').filter(line =>
|
||||
line.toLowerCase().includes(filterText)
|
||||
);
|
||||
|
||||
@@ -692,7 +672,7 @@ function renderLogs(customData) {
|
||||
{
|
||||
scrollDown(); // scroll down the logs
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching infoboxes:', error);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<!-- ---------------------------------------------------------------------------
|
||||
# NetAlertX
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector
|
||||
#
|
||||
# header.php - Front module. Common header to all the web pages
|
||||
# header.php - Front module. Common header to all the web pages
|
||||
#-------------------------------------------------------------------------------
|
||||
# Puche 2021 / 2022+ jokob jokob@duck.com GNU GPLv3
|
||||
#--------------------------------------------------------------------------- -->
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<!-- ----------------------------------------------------------------------- -->
|
||||
@@ -80,7 +80,7 @@
|
||||
<link id="favicon" rel="icon" type="image/x-icon" href="img/NetAlertX_logo.png">
|
||||
|
||||
<!-- For better UX on Mobile Devices using the Shortcut on the Homescreen -->
|
||||
<link rel="manifest" href="img/manifest.json" crossorigin="use-credentials">
|
||||
<link rel="manifest" href="img/manifest.json" crossorigin="use-credentials">
|
||||
<!-- Dark-Mode Patch -->
|
||||
|
||||
<?php
|
||||
@@ -102,12 +102,12 @@
|
||||
// -------------------------------------------------------------
|
||||
// Updates the backend application state/status in the header
|
||||
function updateState(){
|
||||
$.get('php/server/query_json.php', { file: 'app_state.json', nocache: Date.now() }, function(appState) {
|
||||
$.get('php/server/query_json.php', { file: 'app_state.json', nocache: Date.now() }, function(appState) {
|
||||
|
||||
document.getElementById('state').innerHTML = appState["currentState"].replaceAll('"', '');
|
||||
|
||||
setTimeout("updateState()", 1000);
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -160,13 +160,13 @@
|
||||
<a href="devices.php" class="logo">
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini">
|
||||
<img src="img/NetAlertX_logo.png" class="top-left-logo" alt="NetAlertX Logo"/>
|
||||
<img src="img/NetAlertX_logo.png" class="top-left-logo" alt="NetAlertX Logo"/>
|
||||
</span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg">Net<b>Alert</b><sup>x</sup>
|
||||
|
||||
</span>
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
<!-- ----------------------------------------------------------------------- -->
|
||||
@@ -175,35 +175,35 @@
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
|
||||
<i class="fa-solid fa-bars"></i>
|
||||
</a>
|
||||
|
||||
</a>
|
||||
|
||||
<!-- ticker message Placeholder for ticker announcement messages -->
|
||||
<div id="ticker_announcement_plc"></div>
|
||||
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- Back Button -->
|
||||
<ul class="nav navbar-nav">
|
||||
<!-- Back Button -->
|
||||
<li>
|
||||
<a id="back-button" href="javascript:history.go(-1);" role="button" span class='fa fa-arrow-left'></a>
|
||||
</li>
|
||||
<!-- Next Button -->
|
||||
<!-- Next Button -->
|
||||
<li>
|
||||
<a id="next-button" href="javascript:history.go(1);" role="button" span class='fa fa-arrow-right'></a>
|
||||
</li>
|
||||
<!-- Clear cache & Reload -->
|
||||
</li>
|
||||
<!-- Clear cache & Reload -->
|
||||
<li>
|
||||
<a id="reload-button" href='#' role="button" span onclick='clearCache()' class='fa-solid fa-rotate'></a>
|
||||
</li>
|
||||
<!-- Full Screen -->
|
||||
</li>
|
||||
<!-- Full Screen -->
|
||||
<li>
|
||||
<a id="fullscreen-button" href='#' role="button" span class='fa fa-arrows-alt' onclick='toggleFullscreen()'></a>
|
||||
</li>
|
||||
<!-- Notifications -->
|
||||
</li>
|
||||
<!-- Notifications -->
|
||||
<li>
|
||||
<a id="notifications-button" href='userNotifications.php' role="button" span class='fa-solid fa-bell'></a>
|
||||
<span id="unread-notifications-bell-count" title="" class="badge bg-red unread-notifications-bell" >0</span>
|
||||
</li>
|
||||
</li>
|
||||
<!-- Server Status -->
|
||||
<li>
|
||||
<a onclick="setCache('activeMaintenanceTab', 'tab_Logging_id')" href="maintenance.php#tab_Logging">
|
||||
@@ -220,7 +220,7 @@
|
||||
<div class="header-server-time small">
|
||||
<div>
|
||||
<?php echo gethostname();?>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span id="NAX_Servertime_plc"></span>
|
||||
<span id="NAX_TZ" class="hidden"></span>
|
||||
@@ -232,7 +232,7 @@
|
||||
<li class="dropdown user user-menu">
|
||||
<!-- Menu Toggle Button -->
|
||||
<a href="#" class="dropdown-toggle" style=" height: 50px;" data-toggle="dropdown">
|
||||
|
||||
|
||||
<span class="hidden-xs" ><!-- The user image in the navbar-->
|
||||
<img src="img/NetAlertX_logo.png" class="user-image" style="border-radius: initial" alt="NetAlertX Logo">
|
||||
<!-- hidden-xs hides the username on small devices so only the image appears. --></span>
|
||||
@@ -260,7 +260,7 @@
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
@@ -336,11 +336,11 @@
|
||||
</li>
|
||||
<li>
|
||||
<a href="report.php"> <?= lang("Navigation_Report");?> </a>
|
||||
</li>
|
||||
</li>
|
||||
<li>
|
||||
<a href="userNotifications.php"> <?= lang("Navigation_Notifications");?> </a>
|
||||
</li>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -374,10 +374,6 @@
|
||||
<li>
|
||||
<a href="maintenance.php#tab_multiEdit" onclick="initializeTabs()"> <?= lang("Device_MultiEdit");?> </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="maintenance.php#tab_initCheck" onclick="initializeTabs()"> <?= lang("Maintenance_InitCheck");?> </a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -408,7 +404,7 @@
|
||||
<li>
|
||||
<a href="settings.php#publishers_content_header"> <?= lang("settings_publishers_label");?> </a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -420,13 +416,13 @@
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu " style="display: <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('plugins.php', 'appEvents.php' ) ) ){ echo 'block'; } else {echo 'none';} ?>;">
|
||||
<ul class="treeview-menu " style="display: <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('plugins.php', 'appEvents.php' ) ) ){ echo 'block'; } else {echo 'none';} ?>;">
|
||||
<li>
|
||||
<a href="appEvents.php"><?= lang('Navigation_AppEvents');?></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="plugins.php"><?= lang("Navigation_Plugins");?> </a>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -443,16 +439,19 @@
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu " style="display: <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('systeminfo.php') ) ){ echo 'block'; } else {echo 'none';} ?>;">
|
||||
<ul class="treeview-menu " style="display: <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('systeminfo.php') ) ){ echo 'block'; } else {echo 'none';} ?>;">
|
||||
<li>
|
||||
<a href="systeminfo.php#panServer" onclick="setCache('activeSysinfoTab','tabServer');initializeTabs()"><?= lang('Systeminfo_System');?></a>
|
||||
</li>
|
||||
</li>
|
||||
<li>
|
||||
<a href="systeminfo.php#panNetwork" onclick="setCache('activeSysinfoTab','tabNetwork');initializeTabs()"><?= lang('Systeminfo_Network');?></a>
|
||||
</li>
|
||||
</li>
|
||||
<li>
|
||||
<a href="systeminfo.php#panStorage" onclick="setCache('activeSysinfoTab','tabStorage');initializeTabs()"><?= lang('Systeminfo_Storage');?></a>
|
||||
</li>
|
||||
</li>
|
||||
<li>
|
||||
<a href="systeminfo.php#panInitCheck" onclick="setCache('activeSysinfoTab','tabInitCheck');initializeTabs()"> <?= lang("Maintenance_InitCheck");?> </a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -475,7 +474,7 @@
|
||||
document.documentElement.requestFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
// Update server time in the header
|
||||
@@ -483,5 +482,5 @@
|
||||
|
||||
// Update server state in the header
|
||||
updateState()
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
#---------------------------------------------------------------------------------#
|
||||
# NetAlertX #
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector #
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector #
|
||||
# #
|
||||
# systeminfo.php - Front module. Server side. System Information #
|
||||
#---------------------------------------------------------------------------------#
|
||||
@@ -15,61 +15,72 @@
|
||||
?>
|
||||
<?php require 'php/templates/modals.php'; ?>
|
||||
<!-- ----------------------------------------------------------------------- -->
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
// show spinning icon
|
||||
showSpinner()
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Page ------------------------------------------------------------------ -->
|
||||
<div class="content-wrapper">
|
||||
|
||||
<!-- Main content ---------------------------------------------------------- -->
|
||||
<section class="content">
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-sm-12 col-xs-12">
|
||||
<!-- <div class="box-transparent"> -->
|
||||
<div id="navSysInfo" class="nav-tabs-custom">
|
||||
<ul class="nav nav-tabs" style="font-size:16px;">
|
||||
<li>
|
||||
<a id="tabServer" href="#panServer" data-toggle="tab">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<span class="dev-detail-tab-name">
|
||||
<?= lang('Systeminfo_System');?>
|
||||
<li>
|
||||
<a id="tabServer" href="#panServer" data-toggle="tab">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<span class="dev-detail-tab-name">
|
||||
<?= lang('Systeminfo_System');?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="tabNetwork" href="#panNetwork" data-toggle="tab">
|
||||
<i class="fa fa-sitemap fa-rotate-270"></i>
|
||||
<li>
|
||||
<a id="tabNetwork" href="#panNetwork" data-toggle="tab">
|
||||
<i class="fa fa-sitemap fa-rotate-270"></i>
|
||||
<span class="dev-detail-tab-name">
|
||||
<?= lang('Systeminfo_Network');?>
|
||||
<?= lang('Systeminfo_Network');?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="tabStorage" href="#panStorage" data-toggle="tab">
|
||||
<i class="fa fa-hdd"></i>
|
||||
<li>
|
||||
<a id="tabStorage" href="#panStorage" data-toggle="tab">
|
||||
<i class="fa fa-hdd"></i>
|
||||
<span class="dev-detail-tab-name">
|
||||
<?= lang('Systeminfo_Storage');?>
|
||||
<?= lang('Systeminfo_Storage');?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</li>
|
||||
<li>
|
||||
<a id="tabInitCheck" href="#panInitCheck" data-toggle="tab">
|
||||
<i class="fa fa-check"></i>
|
||||
<span class="dev-detail-tab-name">
|
||||
<?= lang('Maintenance_InitCheck');?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div class="tab-content spinnerTarget" style="min-height: 430px;">
|
||||
<div class="tab-pane fade" data-php-file="systeminfoServer.php" id="panServer">
|
||||
<!-- PLACEHOLDER -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" data-php-file="systeminfoNetwork.php" id="panNetwork">
|
||||
<!-- PLACEHOLDER -->
|
||||
<!-- PLACEHOLDER -->
|
||||
</div>
|
||||
<div class="tab-pane fade table-responsive" data-php-file="systeminfoStorage.php" id="panStorage">
|
||||
<!-- PLACEHOLDER -->
|
||||
</div>
|
||||
<div class="tab-pane fade table-responsive" data-php-file="systeminfoInitCheck.php" id="panInitCheck">
|
||||
<!-- PLACEHOLDER -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.tab-content -->
|
||||
</div>
|
||||
@@ -134,7 +145,7 @@ function initializeTabs() {
|
||||
}
|
||||
|
||||
window.onload = function async() {
|
||||
initializeTabs();
|
||||
initializeTabs();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
12
front/initCheck.php → front/systeminfoInitCheck.php
Executable file → Normal file
12
front/initCheck.php → front/systeminfoInitCheck.php
Executable file → Normal file
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
//------------------------------------------------------------------------------
|
||||
// check if authenticated
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/security.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/security.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/server/db.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/language/lang.php';
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/globals.php';
|
||||
?>
|
||||
|
||||
<div class="col-md-12">
|
||||
@@ -16,10 +19,10 @@
|
||||
<i class="fa-solid fa-check text-success"></i> <?= lang('Maintenance_InitCheck_Success');?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex flex-wrap gap-2 w-100" id="file-check-list"></div>
|
||||
<div class="d-flex flex-wrap gap-2 w-100" id="file-check-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -36,7 +39,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
function retryCheck() {
|
||||
// re-set page
|
||||
$('#file-check-list').empty();
|
||||
@@ -48,5 +51,6 @@
|
||||
|
||||
$(document).ready(() => {
|
||||
checkAppInitializedJsonInit();
|
||||
hideSpinner();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user