185 lines
3.9 KiB
Vue
185 lines
3.9 KiB
Vue
<template>
|
|
<div class="location-stats-card">
|
|
<div class="card-header">
|
|
<span class="card-title">🏢 물리공간</span>
|
|
</div>
|
|
<div class="location-list">
|
|
<div
|
|
v-for="loc in locations"
|
|
:key="loc.location"
|
|
class="location-item"
|
|
:class="getTempClass(loc.avgTemp)"
|
|
>
|
|
<div class="loc-header">
|
|
<span class="loc-name">{{ loc.location }}</span>
|
|
<span class="loc-servers">{{ loc.serverCount }}대</span>
|
|
</div>
|
|
<div class="loc-stats">
|
|
<div class="stat-temp">
|
|
<span class="temp-value">{{ loc.avgTemp ? loc.avgTemp + '°' : '-' }}</span>
|
|
</div>
|
|
<div class="stat-traffic">
|
|
<div class="traffic-row">
|
|
<span class="traffic-label">↓</span>
|
|
<span class="traffic-value rx">{{ formatBytes(loc.totalRx) }}</span>
|
|
</div>
|
|
<div class="traffic-row">
|
|
<span class="traffic-label">↑</span>
|
|
<span class="traffic-value tx">{{ formatBytes(loc.totalTx) }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div v-if="!locations || locations.length === 0" class="no-data">
|
|
데이터 없음
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
interface LocationStat {
|
|
location: string
|
|
serverCount: number
|
|
avgTemp: number | null
|
|
totalRx: number
|
|
totalTx: number
|
|
}
|
|
|
|
defineProps<{
|
|
locations: LocationStat[]
|
|
}>()
|
|
|
|
function getTempClass(temp: number | null): string {
|
|
if (temp === null) return ''
|
|
if (temp >= 70) return 'temp-critical'
|
|
if (temp >= 60) return 'temp-warning'
|
|
return 'temp-normal'
|
|
}
|
|
|
|
function formatBytes(bytes: number): string {
|
|
if (!bytes || bytes === 0) return '0B'
|
|
if (bytes >= 1024 * 1024 * 1024) return (bytes / (1024 * 1024 * 1024)).toFixed(1) + 'G'
|
|
if (bytes >= 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(1) + 'M'
|
|
if (bytes >= 1024) return (bytes / 1024).toFixed(0) + 'K'
|
|
return bytes.toFixed(0) + 'B'
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.location-stats-card {
|
|
background: var(--bg-secondary);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 10px;
|
|
padding: 10px;
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 0;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.card-header {
|
|
margin-bottom: 8px;
|
|
padding-bottom: 6px;
|
|
border-bottom: 1px solid var(--border-color);
|
|
}
|
|
|
|
.card-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
|
|
|
|
.location-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 6px;
|
|
overflow-y: auto;
|
|
flex: 1;
|
|
}
|
|
|
|
.location-item {
|
|
background: var(--bg-tertiary, #f8fafc);
|
|
border-radius: 8px;
|
|
padding: 8px 10px;
|
|
border-left: 3px solid #22c55e;
|
|
}
|
|
|
|
.location-item.temp-warning { border-left-color: #f59e0b; }
|
|
.location-item.temp-critical { border-left-color: #ef4444; }
|
|
|
|
.loc-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.loc-name {
|
|
font-size: 11px;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.loc-servers {
|
|
font-size: 10px;
|
|
color: var(--text-muted);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.loc-stats {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.stat-temp {
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.temp-value {
|
|
font-size: 20px;
|
|
font-weight: 700;
|
|
color: var(--text-primary);
|
|
font-family: monospace;
|
|
}
|
|
|
|
.temp-warning .temp-value { color: #f59e0b; }
|
|
.temp-critical .temp-value { color: #ef4444; }
|
|
|
|
.stat-traffic {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
}
|
|
|
|
.traffic-row {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
}
|
|
|
|
.traffic-label {
|
|
font-size: 12px;
|
|
color: var(--text-muted);
|
|
width: 12px;
|
|
}
|
|
|
|
.traffic-value {
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
font-family: monospace;
|
|
}
|
|
|
|
.traffic-value.rx { color: #06b6d4; }
|
|
.traffic-value.tx { color: #f59e0b; }
|
|
|
|
.no-data {
|
|
font-size: 11px;
|
|
color: var(--text-muted);
|
|
text-align: center;
|
|
padding: 16px 0;
|
|
}
|
|
</style>
|