Phase A — HTML removed from PHP files: - RateLimitMiddleware.php: heredoc moved to views/errors/429.php - public/index.php: inline HTML replaced with View::error() - AuthMiddleware.php: <script> redirect replaced with <meta refresh> Phase B — Inline CSS/JS extracted from views: - CSS: landing.css (459 lines), legal.css (shared by terms+privacy) - JS: 17 new files extracted from ~20 view files - main.js (layout sidebar + notifications) - dashboard-chart.js, server-show.js, server-services.js - nginx-manager.js, database-manager.js - terminal.js, team-show.js, team-index.js - server-list.js, server-permissions.js (shared by edit+create) - server-ssl.js, server-processes.js, system-users.js - admin-users.js, audit-log.js, admin-notifications.js, admin-security.js - notifications.js Total: -3264 lines from views, +288 lines in new assets
107 lines
4.5 KiB
PHP
107 lines
4.5 KiB
PHP
<?php
|
|
$server = $server ?? [];
|
|
$processList = $processList ?? [];
|
|
?>
|
|
|
|
<div class="page-header">
|
|
<div class="page-header-left">
|
|
<div class="back-link">
|
|
<a href="/servers/<?= $server['id'] ?>"><i class="fas fa-arrow-left"></i> Back to Server</a>
|
|
</div>
|
|
<h1 class="page-title">Processes</h1>
|
|
<p class="page-subtitle">
|
|
<?= htmlspecialchars($server['name']) ?>
|
|
· <?= count($processList) ?> processes
|
|
</p>
|
|
</div>
|
|
<div class="page-header-right">
|
|
<button class="btn btn-secondary" onclick="location.reload()">
|
|
<i class="fas fa-sync-alt"></i> Refresh
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<?php if (empty($processList)): ?>
|
|
<div class="empty-state">
|
|
<i class="fas fa-microchip empty-icon"></i>
|
|
<p>No process data available.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-sm" id="processTable">
|
|
<thead>
|
|
<tr>
|
|
<th>PID</th>
|
|
<th>User</th>
|
|
<th>CPU %</th>
|
|
<th>MEM %</th>
|
|
<th>RSS</th>
|
|
<th>STAT</th>
|
|
<th>Time</th>
|
|
<th>Command</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($processList as $p): ?>
|
|
<tr>
|
|
<td class="font-mono"><?= $p['pid'] ?></td>
|
|
<td><?= htmlspecialchars($p['user']) ?></td>
|
|
<td>
|
|
<span class="badge <?= $p['cpu'] > 50 ? 'badge-danger' : ($p['cpu'] > 10 ? 'badge-warning' : 'badge-info') ?>">
|
|
<?= number_format($p['cpu'], 1) ?>%
|
|
</span>
|
|
</td>
|
|
<td><?= number_format($p['mem'], 1) ?>%</td>
|
|
<td class="font-mono"><?= format_bytes($p['rss'] * 1024) ?></td>
|
|
<td><code><?= htmlspecialchars($p['stat']) ?></code></td>
|
|
<td class="font-mono"><?= htmlspecialchars($p['time']) ?></td>
|
|
<td class="cell-command" title="<?= htmlspecialchars($p['command']) ?>">
|
|
<code><?= htmlspecialchars(mb_substr($p['command'], 0, 60)) ?><?= mb_strlen($p['command']) > 60 ? '...' : '' ?></code>
|
|
</td>
|
|
<td>
|
|
<button class="btn btn-xs btn-danger" onclick="killProcess(<?= $p['pid'] ?>, this)"
|
|
title="Kill process <?= $p['pid'] ?>">
|
|
<i class="fas fa-times"></i> Kill
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="killModal" class="modal">
|
|
<div class="modal-dialog">
|
|
<div class="modal-header">
|
|
<h3><i class="fas fa-exclamation-triangle text-danger"></i> Kill Process</h3>
|
|
<button class="modal-close" onclick="closeKillModal()">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>Are you sure you want to terminate process <strong id="killPidDisplay"></strong>?</p>
|
|
<div class="form-group" style="margin-top: 1rem;">
|
|
<label class="checkbox-label">
|
|
<input type="checkbox" id="killForce">
|
|
<span>Force kill (SIGKILL -9) if process does not respond</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn btn-secondary" onclick="closeKillModal()">Cancel</button>
|
|
<button class="btn btn-danger" id="confirmKillBtn" onclick="confirmKill()">
|
|
<i class="fas fa-times"></i> Terminate
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const serverId = <?= $server['id'] ?>;
|
|
</script>
|
|
<script src="/assets/js/server-processes.js"></script>
|