feat(update): floating notif + banner saat restart diperlukan
All checks were successful
CI / test (push) Successful in 1m32s
All checks were successful
CI / test (push) Successful in 1m32s
- marker .restart-required ditulis setelah update sukses - API /admin/api/restart-required + polling 30s di sidebar - banner di halaman Update sampai restart - marker dihapus saat boot proses baru - versi 0.5.19
This commit is contained in:
@@ -241,3 +241,31 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
return false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<div id="restart-fab" style="display:none;position:fixed;right:18px;bottom:84px;z-index:9999;max-width:330px">
|
||||
<div style="background:#7c2d12;color:#fff;border:1px solid #f59e0b;border-radius:12px;padding:12px 14px;box-shadow:0 10px 30px rgba(0,0,0,.35);font-size:13px;line-height:1.45">
|
||||
<b><i class="bi bi-exclamation-triangle-fill"></i> Billing perlu restart</b>
|
||||
<div id="restart-fab-text" style="margin-top:4px;color:#fde68a">Update sudah diterapkan, tetapi kode lama masih berjalan.</div>
|
||||
<a href="/admin/update" style="display:inline-block;margin-top:8px;background:#f59e0b;color:#111;font-weight:700;padding:6px 10px;border-radius:8px;text-decoration:none">Cara restart</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
function checkRestartRequired() {
|
||||
fetch('/admin/api/restart-required', { cache: 'no-store' })
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (d) {
|
||||
var el = document.getElementById('restart-fab');
|
||||
if (!el) return;
|
||||
el.style.display = (d && d.pending) ? 'block' : 'none';
|
||||
if (d && d.pending && d.version) {
|
||||
var t = document.getElementById('restart-fab-text');
|
||||
if (t) t.textContent = 'Update v' + d.version + ' sudah diterapkan. Restart aplikasi agar fitur/fix baru aktif.';
|
||||
}
|
||||
})
|
||||
.catch(function () {});
|
||||
}
|
||||
checkRestartRequired();
|
||||
setInterval(checkRestartRequired, 30000);
|
||||
})();
|
||||
</script>
|
||||
|
||||
@@ -23,6 +23,18 @@
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<% if (typeof restartPending !== 'undefined' && restartPending) { %>
|
||||
<div class="alert alert-d" style="display:flex;gap:10px;align-items:flex-start">
|
||||
<i class="bi bi-exclamation-triangle-fill" style="font-size:18px;margin-top:1px"></i>
|
||||
<div>
|
||||
<b>Restart diperlukan.</b>
|
||||
Update ke versi <b><%= restartPending.version || '-' %></b> sudah diterapkan ke file,
|
||||
tetapi aplikasi masih menjalankan kode lama. Fitur/fix baru belum aktif sampai aplikasi di-restart.
|
||||
<a href="#restart-help" style="color:inherit;text-decoration:underline;font-weight:700">Lihat cara restart</a>.
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<div class="card mb16">
|
||||
<div class="card-hd"><h6><i class="bi bi-git"></i> <%= t('admin.update.status_title', 'Status Versi') %></h6></div>
|
||||
<div class="card-bd">
|
||||
@@ -79,7 +91,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb16">
|
||||
<div class="card mb16" id="restart-help">
|
||||
<div class="card-hd"><h6><i class="bi bi-arrow-repeat"></i> <%= t('admin.update.restart_title', 'Cara Restart Aplikasi') %></h6></div>
|
||||
<div class="card-bd" style="display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:14px;font-size:12px">
|
||||
<div style="border:1px solid var(--border);border-radius:12px;padding:12px 14px;background:rgba(255,255,255,.02);line-height:1.75">
|
||||
|
||||
Reference in New Issue
Block a user