394 lines
12 KiB
HTML
394 lines
12 KiB
HTML
<!doctype html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Admin - DokkuStatus</title>
|
|
<link rel="icon"
|
|
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='0.9em' font-size='90'>⚡</text></svg>" />
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap"
|
|
rel="stylesheet">
|
|
<style>
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'JetBrains Mono', monospace;
|
|
margin: 0;
|
|
padding: 0;
|
|
background: #0a0e17;
|
|
min-height: 100vh;
|
|
color: #c9d1d9;
|
|
}
|
|
|
|
.container {
|
|
max-width: 1600px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
}
|
|
|
|
.header-terminal {
|
|
background: #161b22;
|
|
border: 2px solid #00d9ff;
|
|
box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
|
|
padding: 20px 24px;
|
|
margin-bottom: 20px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
h1 {
|
|
margin: 0;
|
|
font-size: 24px;
|
|
font-weight: 700;
|
|
color: #00d9ff;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
}
|
|
|
|
h2 {
|
|
font-size: 18px;
|
|
font-weight: 700;
|
|
letter-spacing: 2px;
|
|
color: #00d9ff;
|
|
margin: 32px 0 16px 0;
|
|
text-transform: uppercase;
|
|
padding-left: 12px;
|
|
border-left: 3px solid #00ff88;
|
|
}
|
|
|
|
.logout-btn {
|
|
background: rgba(255, 85, 85, 0.1);
|
|
border: 1px solid #ff5555;
|
|
color: #ff5555;
|
|
padding: 6px 16px;
|
|
text-decoration: none;
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
letter-spacing: 1px;
|
|
transition: all 0.2s ease;
|
|
display: inline-block;
|
|
}
|
|
|
|
.logout-btn:hover {
|
|
background: rgba(255, 85, 85, 0.2);
|
|
}
|
|
|
|
.refresh-btn {
|
|
background: rgba(0, 255, 136, 0.1);
|
|
border: 1px solid #00ff88;
|
|
color: #00ff88;
|
|
padding: 6px 16px;
|
|
text-decoration: none;
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
letter-spacing: 1px;
|
|
transition: all 0.2s ease;
|
|
display: inline-block;
|
|
cursor: pointer;
|
|
margin-right: 12px;
|
|
}
|
|
|
|
.refresh-btn:hover {
|
|
background: rgba(0, 255, 136, 0.2);
|
|
box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
|
|
}
|
|
|
|
.card {
|
|
border: 2px solid #30363d;
|
|
margin-bottom: 16px;
|
|
background: rgba(0, 217, 255, 0.02);
|
|
}
|
|
|
|
.card-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 12px 16px;
|
|
cursor: pointer;
|
|
background: rgba(0, 0, 0, 0.2);
|
|
border-bottom: 2px solid #30363d;
|
|
}
|
|
|
|
.card-header:hover {
|
|
background: rgba(0, 217, 255, 0.05);
|
|
}
|
|
|
|
.app-name {
|
|
font-weight: 700;
|
|
color: #00d9ff;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.btn-group {
|
|
display: flex;
|
|
gap: 8px;
|
|
}
|
|
|
|
.btn {
|
|
background: rgba(0, 217, 255, 0.1);
|
|
border: 1px solid #00d9ff;
|
|
color: #00d9ff;
|
|
padding: 4px 12px;
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
cursor: pointer;
|
|
pointer-events: none;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.btn-clickable {
|
|
pointer-events: auto;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-clickable:hover {
|
|
background: rgba(0, 217, 255, 0.2);
|
|
box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
|
|
}
|
|
|
|
.card-content {
|
|
display: none;
|
|
padding: 16px;
|
|
background: #0a0e17;
|
|
}
|
|
|
|
.controls {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.label {
|
|
color: #00d9ff;
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
letter-spacing: 2px;
|
|
}
|
|
|
|
.copy-btn {
|
|
background: rgba(0, 255, 136, 0.1);
|
|
border: 1px solid #00ff88;
|
|
color: #00ff88;
|
|
padding: 4px 10px;
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.copy-btn:hover {
|
|
background: rgba(0, 255, 136, 0.2);
|
|
}
|
|
|
|
.viewer {
|
|
background: #000;
|
|
border: 1px solid #30363d;
|
|
padding: 12px;
|
|
max-height: 400px;
|
|
overflow-y: auto;
|
|
font-size: 11px;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.log-line {
|
|
margin: 2px 0;
|
|
}
|
|
|
|
.log-error {
|
|
color: #ff5555;
|
|
}
|
|
|
|
.log-warn {
|
|
color: #ffb86c;
|
|
}
|
|
|
|
.log-info {
|
|
color: #8b949e;
|
|
}
|
|
|
|
.info-grid {
|
|
display: grid;
|
|
grid-template-columns: 200px 1fr;
|
|
gap: 8px 16px;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.info-label {
|
|
color: #8b949e;
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
letter-spacing: 1px;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.info-value {
|
|
color: #c9d1d9;
|
|
font-size: 11px;
|
|
word-break: break-all;
|
|
}
|
|
|
|
.status-running {
|
|
color: #00ff88;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.status-stopped {
|
|
color: #ff5555;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.env-list {
|
|
background: #000;
|
|
border: 1px solid #30363d;
|
|
padding: 8px;
|
|
max-height: 300px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.env-item {
|
|
display: grid;
|
|
grid-template-columns: 250px 1fr;
|
|
gap: 12px;
|
|
padding: 4px 0;
|
|
border-bottom: 1px solid #30363d;
|
|
font-size: 10px;
|
|
}
|
|
|
|
.env-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.env-key {
|
|
color: #00d9ff;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.env-value {
|
|
color: #c9d1d9;
|
|
word-break: break-all;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<div class="header-terminal">
|
|
<h1>[ ADMIN PANEL ]</h1>
|
|
<div>
|
|
<button onclick="location.reload()" class="refresh-btn">[REFRESH]</button>
|
|
<a href="/logout" class="logout-btn">[LOGOUT]</a>
|
|
</div>
|
|
</div>
|
|
|
|
{% for r in data.apps %}
|
|
<div class="card">
|
|
<div class="card-header" onclick="toggleSection('app-{{ loop.index }}')">
|
|
<div class="app-name">[{{ r.app }}]</div>
|
|
<div class="btn-group">
|
|
<button class="btn">[EXPAND]</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="app-{{ loop.index }}" class="card-content">
|
|
<!-- Logs Section -->
|
|
<h2>Container Logs</h2>
|
|
<div class="controls">
|
|
<div class="label">[LAST 50 LINES]</div>
|
|
<button class="copy-btn" onclick="copyText('logs-{{ loop.index }}')">COPY</button>
|
|
</div>
|
|
<div id="logs-{{ loop.index }}" class="viewer">
|
|
{% if r.logs %}
|
|
{% for log in r.logs %}
|
|
<div class="log-line log-{{ log.level }}">{{ log.text }}</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div class="log-info">[no logs available]</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Container Details Section -->
|
|
<h2>Container Details</h2>
|
|
<div id="details-{{ loop.index }}" data-container="{{ r.container }}" data-loaded="false">
|
|
<div style="text-align: center; padding: 20px; color: #8b949e;">
|
|
<button onclick="loadDetails('{{ r.container }}', {{ loop.index }})" class="btn btn-clickable">
|
|
[LOAD CONTAINER INFO]
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<script>
|
|
function toggleSection(id) {
|
|
const el = document.getElementById(id);
|
|
el.style.display = el.style.display === 'none' ? 'block' : 'none';
|
|
}
|
|
|
|
function copyText(id) {
|
|
const el = document.getElementById(id);
|
|
navigator.clipboard.writeText(el.innerText).then(() => {
|
|
const btn = event.target;
|
|
const orig = btn.textContent;
|
|
btn.textContent = 'COPIED!';
|
|
btn.style.background = 'rgba(0, 255, 136, 0.3)';
|
|
setTimeout(() => {
|
|
btn.textContent = orig;
|
|
btn.style.background = 'rgba(0, 255, 136, 0.1)';
|
|
}, 1500);
|
|
});
|
|
}
|
|
|
|
function loadDetails(containerName, index) {
|
|
const detailsDiv = document.getElementById(`details-${index}`);
|
|
|
|
if (detailsDiv.dataset.loaded === 'true') {
|
|
return;
|
|
}
|
|
|
|
detailsDiv.innerHTML = '<div style="text-align: center; padding: 20px; color: #00d9ff;">Loading...</div>';
|
|
|
|
fetch(`/api/container/${containerName}`)
|
|
.then(res => res.json())
|
|
.then(data => {
|
|
detailsDiv.dataset.loaded = 'true';
|
|
detailsDiv.innerHTML = renderContainerDetails(data);
|
|
})
|
|
.catch(err => {
|
|
detailsDiv.innerHTML = `<div style="color: #ff5555; padding: 20px;">Error: ${err.message}</div>`;
|
|
});
|
|
}
|
|
|
|
function renderContainerDetails(c) {
|
|
let html = '<div class="info-grid">';
|
|
html += `<div class="info-label">Container ID</div><div class="info-value">${c.id || '—'}</div>`;
|
|
html += `<div class="info-label">Image</div><div class="info-value">${c.image || '—'}</div>`;
|
|
html += `<div class="info-label">Status</div><div class="info-value ${c.state?.running ? 'status-running' : 'status-stopped'}">${(c.state?.status || 'unknown').toUpperCase()}</div>`;
|
|
html += `<div class="info-label">IP Address</div><div class="info-value">${c.ip_address || '—'}</div>`;
|
|
html += `<div class="info-label">Networks</div><div class="info-value">${(c.networks || []).join(', ') || '—'}</div>`;
|
|
html += '</div>';
|
|
|
|
// Environment variables
|
|
if (c.env && c.env.length > 0) {
|
|
html += '<h2 style="margin-top: 24px;">Environment Variables</h2>';
|
|
html += '<div class="env-list">';
|
|
c.env.forEach(env => {
|
|
const parts = env.split('=', 2);
|
|
html += `<div class="env-item"><div class="env-key">${parts[0]}</div><div class="env-value">${parts[1] || ''}</div></div>`;
|
|
});
|
|
html += '</div>';
|
|
}
|
|
|
|
return html;
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |