dashboard.ejs
4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html lang="id">
<head><%- include('partials/head') %></head>
<body class="app-page">
<%- include('partials/nav') %>
<main class="main-content">
<div class="page-header">
<div>
<h1 class="page-title">DASHBOARD</h1>
<p class="page-sub">Status File & Sistem PXE Server</p>
</div>
<div class="header-time">
<span class="status-dot active"></span>
<span id="live-clock"></span>
</div>
</div>
<%- include('partials/flash') %>
<!-- File Status Cards -->
<section class="section">
<h2 class="section-title">STATUS FILE</h2>
<div class="card-grid">
<div class="file-card <%= stats.bootFileExists ? 'ok' : 'missing' %>">
<div class="file-card-header">
<span class="file-type-badge">IPXE</span>
<span class="file-status-icon"><%= stats.bootFileExists ? '✓' : '✕' %></span>
</div>
<div class="file-name">boot.ipxe</div>
<div class="file-path"><%= stats.pxeRoot %>/</div>
<div class="file-size"><%= stats.bootFileExists ? formatSize(stats.bootFileSize) : 'TIDAK ADA' %></div>
<a href="/files/boot-editor" class="file-action">Edit File →</a>
</div>
<div class="file-card <%= stats.vmlinuzExists ? 'ok' : 'missing' %>">
<div class="file-card-header">
<span class="file-type-badge">KERNEL</span>
<span class="file-status-icon"><%= stats.vmlinuzExists ? '✓' : '✕' %></span>
</div>
<div class="file-name">vmlinuz</div>
<div class="file-path"><%= stats.liveDir %>/</div>
<div class="file-size"><%= stats.vmlinuzExists ? formatSize(stats.vmlinuzSize) : 'TIDAK ADA' %></div>
<a href="/files/upload" class="file-action">Upload →</a>
</div>
<div class="file-card <%= stats.initrdExists ? 'ok' : 'missing' %>">
<div class="file-card-header">
<span class="file-type-badge">INITRD</span>
<span class="file-status-icon"><%= stats.initrdExists ? '✓' : '✕' %></span>
</div>
<div class="file-name">initrd.img</div>
<div class="file-path"><%= stats.liveDir %>/</div>
<div class="file-size"><%= stats.initrdExists ? formatSize(stats.initrdSize) : 'TIDAK ADA' %></div>
<a href="/files/upload" class="file-action">Upload →</a>
</div>
<div class="file-card <%= stats.squashfsExists ? 'ok' : 'missing' %>">
<div class="file-card-header">
<span class="file-type-badge">SQUASH</span>
<span class="file-status-icon"><%= stats.squashfsExists ? '✓' : '✕' %></span>
</div>
<div class="file-name">filesystem.squashfs</div>
<div class="file-path"><%= stats.liveDir %>/</div>
<div class="file-size"><%= stats.squashfsExists ? formatSize(stats.squashfsSize) : 'TIDAK ADA' %></div>
<a href="/files/upload" class="file-action">Upload →</a>
</div>
</div>
</section>
<!-- Quick Actions -->
<section class="section">
<h2 class="section-title">AKSI CEPAT</h2>
<div class="action-grid">
<a href="/files/boot-editor" class="action-card">
<div class="action-icon">📝</div>
<div class="action-label">Edit boot.ipxe</div>
<div class="action-desc">Ubah konfigurasi boot IPXE</div>
</a>
<a href="/files/upload" class="action-card">
<div class="action-icon">📤</div>
<div class="action-label">Upload File Live</div>
<div class="action-desc">Replace vmlinuz, initrd, squashfs</div>
</a>
<a href="/service/status" class="action-card">
<div class="action-icon">⚙️</div>
<div class="action-label">Monitor Services</div>
<div class="action-desc">DNSMAQ, NGINX, IPXE</div>
</a>
</div>
</section>
</main>
<%- include('partials/footer') %>
<script>
function formatSize(bytes) {
if (bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B','KB','MB','GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
function tick() {
document.getElementById('live-clock').textContent = new Date().toLocaleString('id-ID');
}
tick(); setInterval(tick, 1000);
</script>
</body>
</html>
<% function formatSize(bytes) {
if (!bytes || bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B','KB','MB','GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
} %>