mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-31 07:12:23 -07:00
FE: initCheck moved into systeminfo
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user