⚙ Settings #779

This commit is contained in:
jokob-sk
2024-09-06 07:59:35 +10:00
parent 8c0da1d0df
commit 43aa40efbb
7 changed files with 56 additions and 40 deletions

View File

@@ -745,6 +745,18 @@ height: 50px;
.infobox_label {
font-size: 16px !important;
}
.deviceSelector
{
display: block;
}
.deviceSelector input
{
width: 100% !important;
display: inline-grid;
}
/* --------------------------------------------------------- */
/* report */
/* --------------------------------------------------------- */

View File

@@ -1135,6 +1135,35 @@ function arraysContainSameValues(arr1, arr2) {
}
}
// -----------------------------------------------------------------------------
// Hide elements on the page based on the supplied setting
function hideUIelements(settingKey) {
hiddenSectionsSetting = getSetting(settingKey)
if(hiddenSectionsSetting != "") // handle if settings not yet initialized
{
sectionsArray = createArray(hiddenSectionsSetting)
// remove spaces to get IDs
var newArray = $.map(sectionsArray, function(value) {
return value.replace(/\s/g, '');
});
$.each(newArray, function(index, hiddenSection) {
if($('#' + hiddenSection))
{
$('#' + hiddenSection).hide()
}
});
}
}
// -----------------------------------------------------------------------------
// apply dark mode

View File

@@ -68,38 +68,6 @@ function initDeviceSelectors(devicesListAll_JSON) {
}
// -----------------------------------------------------------------------------
// Hide elements on the page based on the supplied setting
function hideUIelements(settingKey) {
hiddenSectionsSetting = getSetting(settingKey)
if(hiddenSectionsSetting != "") // handle if settings not yet initialized
{
sectionsArray = createArray(hiddenSectionsSetting)
// remove spaces to get IDs
var newArray = $.map(sectionsArray, function(value) {
return value.replace(/\s/g, '');
});
$.each(newArray, function(index, hiddenSection) {
if($('#' + hiddenSection))
{
$('#' + hiddenSection).hide()
}
});
}
}
// -----------------------------------------------------------------------------
// Updates the icon preview
function updateIconPreview (inputId) {
@@ -284,10 +252,15 @@ function initSelect2() {
}
}
// try to initialize select2
setTimeout(() => {
initSelect2()
}, 1000);
// init select2 after dom laoded
window.addEventListener("load", function() {
// try to initialize select2
setTimeout(() => {
initSelect2()
}, 1000);
});
console.log("init ui_components.js")

View File

@@ -20,7 +20,7 @@
require 'php/templates/header.php';
?>
<!-- Page ------------------------------------------------------------------ -->
<div class="content-wrapper">
<div class="content-wrapper" id="maintenancePage">
<!-- Content header--------------------------------------------------------- -->
<section class="content-header">

View File

@@ -13,7 +13,7 @@
<h3 class="box-title"><?= lang('Gen_Selected_Devices');?></h3>
</div>
<div class="deviceSelector col-md-9" style="z-index:5"></div>
<div class="deviceSelector col-md-9 col-sm-12" style="z-index:5"></div>
<div class="col-md-3">
<button type="button" class="btn btn-default" onclick="markAllSelected()">

View File

@@ -54,7 +54,7 @@
<!-- NetAlertX -->
<script src="js/handle_version.js"></script>
<script src="js/ui_components.js?v=<?php include 'php/templates/version.php'; ?>"></script>
<script defer src="js/ui_components.js?v=<?php include 'php/templates/version.php'; ?>"></script>
<!-- Select2 JavaScript -->

View File

@@ -552,7 +552,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
});
// EVENTS
// process events (e.g. run ascan, or test a notification) if associated with the setting
// process events (e.g. run a scan, or test a notification) if associated with the setting
let eventsHtml = "";
const eventsList = createArray(set['Events']);
@@ -591,6 +591,8 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
}, 50);
setupSmoothScrolling()
// try to initialize select2
initSelect2()
hideSpinner()
}