feat: 주문리스트를 /orderlist/ 리버스 프록시 경로로 통합
- 메뉴 카드 새 탭 열기 + /orderlist/health/db 헬스 배지 (온라인/오프라인) 추가 - CUSTOMER_ORDER_LIST_URL 기본값을 /orderlist/ 로 (NPM 같은 도메인 하위 경로) - orderlist 측 compose 정리 스크립트 추가 (ports 제거, npm_default 외부 네트워크 attach)
This commit is contained in:
+29
-2
@@ -55,7 +55,8 @@
|
||||
|
||||
<div class="card-grid">
|
||||
{% for item in menu_items %}
|
||||
<a class="menu-card" href="{{ item.url }}">
|
||||
<a class="menu-card" href="{{ item.url }}" target="_blank" rel="noopener noreferrer"
|
||||
{% if item.health_url %}data-health-url="{{ item.health_url }}"{% endif %}>
|
||||
<div class="card-icon">
|
||||
{% if loop.index == 1 %}
|
||||
<!-- 클립보드 / 발주 아이콘 -->
|
||||
@@ -98,7 +99,12 @@
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<p class="card-title">{{ item.title }}</p>
|
||||
<p class="card-title">
|
||||
{{ item.title }}
|
||||
{% if item.health_url %}
|
||||
<span class="status-badge" data-status="checking" aria-live="polite">확인 중</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p class="card-desc">{{ item.description }}</p>
|
||||
</div>
|
||||
|
||||
@@ -123,6 +129,27 @@
|
||||
const days = ["일요일","월요일","화요일","수요일","목요일","금요일","토요일"];
|
||||
document.getElementById("today-date").textContent =
|
||||
d.getFullYear() + "년 " + (d.getMonth()+1) + "월 " + d.getDate() + "일 " + days[d.getDay()];
|
||||
|
||||
// 헬스 배지 — data-health-url 이 있는 카드만 갱신
|
||||
async function refreshHealthBadges() {
|
||||
const cards = document.querySelectorAll(".menu-card[data-health-url]");
|
||||
await Promise.all(Array.from(cards).map(async (card) => {
|
||||
const url = card.getAttribute("data-health-url");
|
||||
const badge = card.querySelector(".status-badge");
|
||||
if (!badge) return;
|
||||
try {
|
||||
const res = await fetch(url, { cache: "no-store", credentials: "omit" });
|
||||
const ok = res.ok;
|
||||
badge.dataset.status = ok ? "online" : "offline";
|
||||
badge.textContent = ok ? "온라인" : "오프라인";
|
||||
} catch {
|
||||
badge.dataset.status = "offline";
|
||||
badge.textContent = "오프라인";
|
||||
}
|
||||
}));
|
||||
}
|
||||
refreshHealthBadges();
|
||||
setInterval(refreshHealthBadges, 30000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user