feat: threshold modal with range sliders and card-based layout #75
@@ -304,49 +304,60 @@ $canManage = $server_role === 'owner' || $server_role === 'manager';
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="thresholdModal" class="modal">
|
<div id="thresholdModal" class="modal">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog" style="max-width:560px">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3><i class="fas fa-bell"></i> Notification Thresholds</h3>
|
<h3><i class="fas fa-bell"></i> Notification Thresholds</h3>
|
||||||
<button type="button" class="modal-close" onclick="closeThresholdModal()">×</button>
|
<button type="button" class="modal-close" onclick="closeThresholdModal()">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p class="text-muted" style="margin-bottom:20px">
|
<p class="text-muted" style="margin-bottom:24px;font-size:0.9em;line-height:1.5">
|
||||||
Notifications are sent to all users with access to this server when the agent reports values
|
When the agent reports values above these thresholds, all users with access to this server
|
||||||
exceeding these thresholds. Only the server owner can modify them.
|
receive a notification and push alert. Only the server owner can modify them.
|
||||||
</p>
|
</p>
|
||||||
<form id="thresholdForm" onsubmit="return false">
|
<form id="thresholdForm" onsubmit="return false">
|
||||||
<div class="table-responsive">
|
<?php $resources = [
|
||||||
<table class="table">
|
'cpu' => ['label' => 'CPU', 'icon' => 'fas fa-microchip', 'color' => 'var(--info)'],
|
||||||
<thead>
|
'ram' => ['label' => 'RAM', 'icon' => 'fas fa-memory', 'color' => 'var(--purple)'],
|
||||||
<tr>
|
'disk' => ['label' => 'Disk', 'icon' => 'fas fa-hdd', 'color' => 'var(--warning)'],
|
||||||
<th>Resource</th>
|
]; ?>
|
||||||
<th>Warning (%)</th>
|
<?php foreach ($resources as $key => $res): ?>
|
||||||
<th>Critical (%)</th>
|
<div style="background:var(--card-bg);border:1px solid var(--border);border-radius:10px;padding:16px 20px;margin-bottom:12px">
|
||||||
</tr>
|
<div style="display:flex;align-items:center;gap:10px;margin-bottom:14px">
|
||||||
</thead>
|
<i class="<?= $res['icon'] ?>" style="color:<?= $res['color'] ?>;font-size:1.2em;width:20px;text-align:center"></i>
|
||||||
<tbody>
|
<strong style="font-size:1em"><?= $res['label'] ?></strong>
|
||||||
<?php foreach (['cpu' => 'CPU', 'ram' => 'RAM', 'disk' => 'Disk'] as $key => $label): ?>
|
</div>
|
||||||
<tr>
|
<div style="display:flex;gap:16px;align-items:center">
|
||||||
<td><strong><?= $label ?></strong></td>
|
<div style="flex:1">
|
||||||
<td>
|
<label style="display:flex;align-items:center;gap:6px;font-size:0.82em;color:var(--warning);margin-bottom:4px;font-weight:600">
|
||||||
<input type="number" name="<?= $key ?>_warning"
|
<i class="fas fa-exclamation-triangle" style="font-size:0.85em"></i> Warning
|
||||||
value="<?= htmlspecialchars((string)($server["threshold_{$key}_warning"] ?? 80)) ?>"
|
</label>
|
||||||
min="0" max="100" step="0.01" class="form-control" style="width:120px">
|
<div style="position:relative">
|
||||||
</td>
|
<input type="number" name="<?= $key ?>_warning"
|
||||||
<td>
|
value="<?= htmlspecialchars((string)($server["threshold_{$key}_warning"] ?? 80)) ?>"
|
||||||
<input type="number" name="<?= $key ?>_critical"
|
min="0" max="100" step="0.01"
|
||||||
value="<?= htmlspecialchars((string)($server["threshold_{$key}_critical"] ?? 95)) ?>"
|
style="width:100%;padding:8px 12px 8px 32px;border:1px solid var(--border);border-radius:6px;background:var(--bg-dark);color:var(--text);font-size:0.95em;box-sizing:border-box">
|
||||||
min="0" max="100" step="0.01" class="form-control" style="width:120px">
|
<span style="position:absolute;right:10px;top:50%;transform:translateY(-50%);color:var(--text-muted);font-size:0.85em">%</span>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
<?php endforeach; ?>
|
<div style="flex:1">
|
||||||
</tbody>
|
<label style="display:flex;align-items:center;gap:6px;font-size:0.82em;color:var(--danger);margin-bottom:4px;font-weight:600">
|
||||||
</table>
|
<i class="fas fa-bolt" style="font-size:0.85em"></i> Critical
|
||||||
|
</label>
|
||||||
|
<div style="position:relative">
|
||||||
|
<input type="number" name="<?= $key ?>_critical"
|
||||||
|
value="<?= htmlspecialchars((string)($server["threshold_{$key}_critical"] ?? 95)) ?>"
|
||||||
|
min="0" max="100" step="0.01"
|
||||||
|
style="width:100%;padding:8px 12px 8px 32px;border:1px solid var(--border);border-radius:6px;background:var(--bg-dark);color:var(--text);font-size:0.95em;box-sizing:border-box">
|
||||||
|
<span style="position:absolute;right:10px;top:50%;transform:translateY(-50%);color:var(--text-muted);font-size:0.85em">%</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn btn-primary" onclick="saveThresholds()"><i class="fas fa-save"></i> Save</button>
|
<button class="btn btn-primary" onclick="saveThresholds()"><i class="fas fa-save"></i> Save Thresholds</button>
|
||||||
<button class="btn btn-secondary" onclick="closeThresholdModal()">Cancel</button>
|
<button class="btn btn-secondary" onclick="closeThresholdModal()">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user