firewall enable disable update

This commit is contained in:
Devdatt Bhatt 2026-05-17 16:25:37 +00:00
parent f6b1e179b5
commit f01c24255d
2 changed files with 23 additions and 18 deletions

View File

@ -23,7 +23,7 @@ $data = $defaults;
if (is_file($jsonFile)) { if (is_file($jsonFile)) {
$stored = json_decode(file_get_contents($jsonFile), true); $stored = json_decode(file_get_contents($jsonFile), true);
if (is_array($undecoded)) { // Fixed potential typo from $stored to $stored if (is_array($stored)) {
$data = $stored; $data = $stored;
} }
} }
@ -132,16 +132,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
window.onload = attachValidation; window.onload = attachValidation;
</script> </script>
<div class="containerindex"> <div class="containerindex">
<!-- Firewall Status Toggle (Right Aligned) --> <!-- Firewall Status Toggle (Left Aligned & Modernized) -->
<div style="display: flex; justify-content: flex-end; margin-bottom: 15px;"> <div style="display: flex; justify-content: flex-start; margin-bottom: 20px;">
<div style="text-align: right;"> <div style="display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, 0.05); padding: 6px 14px; border-radius: 50px; border: 1px solid var(--border);">
<span style="padding: 5px 10px; border-radius: 4px; background: <?= $currentStatus === 'enabled' ? '#d4edda' : '#f8d7da' ?>; color: <?= $currentStatus === 'enabled' ? '#155724' : '#721c24' ?>; font-weight: bold; margin-right: 10px;"> <span style="font-size: 13px; font-weight: 600; color: <?= $currentStatus === 'enabled' ? '#4ade80' : '#f87171' ?>; text-transform: uppercase; letter-spacing: 0.5px;">
Firewall : <?= ucfirst($currentStatus) ?> <?= $currentStatus === 'enabled' ? 'Active' : 'Inactive' ?>
</span> </span>
<form method="post" style="display: inline;"> <div style="width: 1px; height: 18px; background: var(--border);"></div>
<button type="submit" name="toggle_subject" value="toggle" style="display:none;"></button> <form method="post" style="display: inline; margin: 0;">
<button type="submit" name="toggle_status" value="<?= $currentStatus === 'enabled' ? 'disable' : 'enable' ?>" style="background: <?= $currentStatus === 'enabled' ? '#dc3545' : '#28a745' ?>; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer;"> <button type="submit" name="toggle_status" value="<?= $currentStatus === 'enabled' ? 'disable' : 'enable' ?>" style="background: transparent; color: var(--text); border: none; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0;">
<?= $currentStatus === 'enabled' ? 'Disable' : 'Enable' ?> <?= $currentStatus === 'enabled' ? 'Disable Firewall' : 'Enable Firewall' ?>
</button> </button>
</form> </form>
</div> </div>

View File

@ -359,6 +359,11 @@ include 'static.php';
grid-column: 1 / -1; grid-column: 1 / -1;
} }
.firewall-status-container {
display: flex;
justify-content: flex-start;
}
/* slightly taller only for GPU chart */ /* slightly taller only for GPU chart */
.card:has(#gpuChart) .chart-wrap { .card:has(#gpuChart) .chart-wrap {
height: 260px; height: 260px;
@ -868,7 +873,7 @@ include 'static.php';
border-radius: 14px; border-radius: 14px;
background: linear-gradient(180deg, #020617, #020617); background: linear-gradient(180deg, #020617, #020617);
border: 1px solid var(--border); border: 1px solid var(--border);
color: #cbd5 : e1; color: #cbd5: e1;
font-size: 14px; font-size: 14px;
line-height: 1.65; line-height: 1.65;
} }
@ -1189,7 +1194,7 @@ include 'static.php';
.control .row span:last-child { .control .row span:last-child {
color: #fff; color: #fff;
font-weight: 60 : 42px; font-weight: 60: 42px;
text-align: right; text-align: right;
} }