Files
server-manager/views/servers/services.php

56 lines
2.8 KiB
PHP

<?php
$server = $server ?? [];
$services = $services ?? [];
$perPage = 25;
$totalPages = max(1, ceil(count($services) / $perPage));
?>
<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"><i class="fas fa-cogs"></i> Services</h1>
<p class="page-subtitle"><?= htmlspecialchars($server['name']) ?> &middot; <?= count($services) ?> services</p>
</div>
<div class="page-header-right">
<button class="btn btn-secondary" onclick="location.reload()"><i class="fas fa-sync-alt"></i></button>
</div>
</div>
<div class="card">
<div class="card-body" style="padding:0">
<div class="table-responsive">
<table class="table table-sm" id="servicesTable">
<thead>
<tr><th>Service</th><th style="width:100px">Status</th><th style="width:320px">Actions</th></tr>
<tr class="pma-filter-row">
<td><input type="text" id="filterName" class="form-input" placeholder="Filter service..." style="font-size:0.78rem;padding:0.25rem 0.4rem;width:100%;box-sizing:border-box" oninput="applyFilters()"></td>
<td><select id="filterStatus" class="form-select" style="font-size:0.78rem;padding:0.25rem 0.4rem;width:100%;box-sizing:border-box" onchange="applyFilters()"><option value="">All</option><option value="active">active</option><option value="inactive">inactive</option><option value="other">other</option></select></td>
<td></td>
</tr>
</thead>
<tbody id="servicesBody"></tbody>
</table>
</div>
<div id="servicesPagination" style="display:flex;gap:0.35rem;padding:0.75rem 1rem;border-top:1px solid var(--border-color);justify-content:center;flex-wrap:wrap"></div>
</div>
</div>
<div id="serviceResultModal" class="modal">
<div class="modal-dialog" style="max-width:600px">
<div class="modal-header"><h3 id="srTitle">Result</h3><button class="modal-close" onclick="closeSrModal()">&times;</button></div>
<div class="modal-body">
<p id="srMessage"></p>
<div id="srOutput" class="nginx-config-viewer nginx-test-output" style="display:none;margin-top:0.75rem"><pre><code id="srOutputText"></code></pre></div>
</div>
<div class="modal-footer"><button class="btn btn-secondary" onclick="closeSrModal()">Close</button></div>
</div>
</div>
<script>
const allServices = <?= json_encode($services, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES) ?>;
const perPage = <?= $perPage ?>;
const serverId = <?= $server['id'] ?>;
</script>
<script src="/assets/js/server-services.js?v=<?= asset_version() ?>"></script>