소스 수정

This commit is contained in:
2025-12-28 16:27:46 +09:00
parent 56451c8070
commit 1fc6a9ccd9
6 changed files with 89 additions and 15 deletions

View File

@@ -37,6 +37,11 @@
<span>Server Status</span>
</NuxtLink>
<NuxtLink to="/settings/thresholds" class="nav-item nav-sub-item" :class="{ active: route.path === '/settings/thresholds' }">
<span class="icon"></span>
<span>Thresholds</span>
</NuxtLink>
<div class="nav-group-title">이상감지</div>
<NuxtLink to="/anomaly/short-term" class="nav-item nav-sub-item" :class="{ active: route.path === '/anomaly/short-term' }">
@@ -58,13 +63,6 @@
<span class="icon">📉</span>
<span>추세 분석</span>
</NuxtLink>
<div class="nav-group-title">설정</div>
<NuxtLink to="/settings/thresholds" class="nav-item nav-sub-item" :class="{ active: route.path === '/settings/thresholds' }">
<span class="icon"></span>
<span>임계값 설정</span>
</NuxtLink>
</nav>
</aside>
</template>

View File

@@ -138,9 +138,20 @@ const thresholds = ref(JSON.parse(JSON.stringify(defaultThresholds)))
async function fetchThresholds() {
try {
const data = await $fetch('/api/settings/thresholds')
const data = await $fetch('/api/settings/thresholds') as any
if (data) {
thresholds.value = data as typeof defaultThresholds
// 기본값과 병합 (API 응답이 불완전할 수 있음)
thresholds.value = {
server: {
cpu: { ...defaultThresholds.server.cpu, ...data.server?.cpu },
memory: { ...defaultThresholds.server.memory, ...data.server?.memory },
disk: { ...defaultThresholds.server.disk, ...data.server?.disk }
},
container: {
cpu: { ...defaultThresholds.container.cpu, ...data.container?.cpu },
memory: { ...defaultThresholds.container.memory, ...data.container?.memory }
}
}
}
} catch (err) {
console.error('Failed to fetch thresholds:', err)