소스 수정

This commit is contained in:
2025-12-28 17:42:50 +09:00
parent 1aeeab4d40
commit ce90c41f0c
2 changed files with 104 additions and 87 deletions

View File

@@ -1,8 +1,7 @@
<template> <template>
<div class="location-stats-card"> <div class="location-stats-card">
<div class="card-header"> <div class="card-header">
<span class="card-icon">🏢</span> <span class="card-title">🏢 물리공간</span>
<span class="card-title">물리공간</span>
</div> </div>
<div class="location-list"> <div class="location-list">
<div <div
@@ -11,22 +10,25 @@
class="location-item" class="location-item"
:class="getTempClass(loc.avgTemp)" :class="getTempClass(loc.avgTemp)"
> >
<div class="loc-name">{{ loc.location }}</div> <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="loc-stats">
<div class="stat-row temp"> <div class="stat-temp">
<span class="stat-icon">🌡</span> <span class="temp-value">{{ loc.avgTemp ? loc.avgTemp + '°' : '-' }}</span>
<span class="stat-value">{{ loc.avgTemp ? loc.avgTemp + '°C' : '-' }}</span>
</div> </div>
<div class="stat-row traffic"> <div class="stat-traffic">
<span class="stat-icon"></span> <div class="traffic-row">
<span class="stat-value rx">{{ formatBytes(loc.totalRx) }}</span> <span class="traffic-label"></span>
</div> <span class="traffic-value rx">{{ formatBytes(loc.totalRx) }}</span>
<div class="stat-row traffic"> </div>
<span class="stat-icon"></span> <div class="traffic-row">
<span class="stat-value tx">{{ formatBytes(loc.totalTx) }}</span> <span class="traffic-label"></span>
<span class="traffic-value tx">{{ formatBytes(loc.totalTx) }}</span>
</div>
</div> </div>
</div> </div>
<div class="loc-servers">{{ loc.serverCount }}</div>
</div> </div>
<div v-if="!locations || locations.length === 0" class="no-data"> <div v-if="!locations || locations.length === 0" class="no-data">
데이터 없음 데이터 없음
@@ -56,11 +58,11 @@ function getTempClass(temp: number | null): string {
} }
function formatBytes(bytes: number): string { function formatBytes(bytes: number): string {
if (!bytes || bytes === 0) return '0 B/s' if (!bytes || bytes === 0) return '0B'
if (bytes >= 1024 * 1024 * 1024) return (bytes / (1024 * 1024 * 1024)).toFixed(1) + ' GB/s' if (bytes >= 1024 * 1024 * 1024) return (bytes / (1024 * 1024 * 1024)).toFixed(1) + 'G'
if (bytes >= 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(1) + ' MB/s' if (bytes >= 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(1) + 'M'
if (bytes >= 1024) return (bytes / 1024).toFixed(1) + ' KB/s' if (bytes >= 1024) return (bytes / 1024).toFixed(0) + 'K'
return bytes.toFixed(0) + ' B/s' return bytes.toFixed(0) + 'B'
} }
</script> </script>
@@ -68,8 +70,8 @@ function formatBytes(bytes: number): string {
.location-stats-card { .location-stats-card {
background: var(--bg-secondary); background: var(--bg-secondary);
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 12px; border-radius: 10px;
padding: 12px; padding: 10px;
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -78,21 +80,17 @@ function formatBytes(bytes: number): string {
} }
.card-header { .card-header {
display: flex; margin-bottom: 8px;
align-items: center; padding-bottom: 6px;
gap: 6px;
margin-bottom: 10px;
padding-bottom: 8px;
border-bottom: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
} }
.card-icon { font-size: 18px; } .card-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.location-list { .location-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 6px;
overflow-y: auto; overflow-y: auto;
flex: 1; flex: 1;
} }
@@ -100,61 +98,87 @@ function formatBytes(bytes: number): string {
.location-item { .location-item {
background: var(--bg-tertiary, #f8fafc); background: var(--bg-tertiary, #f8fafc);
border-radius: 8px; border-radius: 8px;
padding: 10px; padding: 8px 10px;
border-left: 3px solid #22c55e; border-left: 3px solid #22c55e;
} }
.location-item.temp-warning { border-left-color: #f59e0b; } .location-item.temp-warning { border-left-color: #f59e0b; }
.location-item.temp-critical { border-left-color: #ef4444; } .location-item.temp-critical { border-left-color: #ef4444; }
.loc-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 6px;
}
.loc-name { .loc-name {
font-size: 12px; font-size: 11px;
font-weight: 600; font-weight: 600;
color: var(--text-primary); color: var(--text-primary);
margin-bottom: 6px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.loc-stats {
display: flex;
flex-direction: column;
gap: 3px;
}
.stat-row {
display: flex;
align-items: center;
gap: 4px;
font-size: 11px;
}
.stat-icon {
width: 14px;
text-align: center;
color: var(--text-muted);
}
.stat-value {
color: var(--text-secondary);
font-family: monospace;
}
.stat-value.rx { color: #06b6d4; }
.stat-value.tx { color: #f59e0b; }
.loc-servers { .loc-servers {
font-size: 10px; font-size: 10px;
color: var(--text-muted); color: var(--text-muted);
text-align: right; flex-shrink: 0;
margin-top: 4px;
} }
.no-data { .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; font-size: 12px;
color: var(--text-muted); 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; text-align: center;
padding: 20px 0; padding: 16px 0;
} }
</style> </style>

View File

@@ -1,14 +1,8 @@
<template> <template>
<div :class="['network-card', statusClass]" @click="goToList"> <div :class="['network-card', statusClass]" @click="goToList">
<div class="card-icon">{{ icon }}</div> <div class="card-row">
<div class="card-title">{{ title }}</div> <span class="card-title">{{ icon }} {{ title }}</span>
<div class="card-status" v-if="status && status.last_checked_at"> <span class="status-badge">{{ status?.is_healthy ? '✅' : status?.last_checked_at ? '❌' : '⚪' }}</span>
<span class="status-icon">{{ status.is_healthy ? '✅' : '❌' }}</span>
<span class="status-text">{{ status.is_healthy ? '정상' : '오류' }}</span>
</div>
<div class="card-status" v-else>
<span class="status-icon"></span>
<span class="status-text">대기</span>
</div> </div>
<div class="card-time" v-if="status && status.last_checked_at"> <div class="card-time" v-if="status && status.last_checked_at">
{{ formatTimeAgo(status.last_checked_at) }} {{ formatTimeAgo(status.last_checked_at) }}
@@ -55,30 +49,29 @@ function formatTimeAgo(datetime: string | null): string {
.network-card { .network-card {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; padding: 8px 10px;
padding: 10px 8px;
background: var(--bg-secondary); background: var(--bg-secondary);
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 10px; border-radius: 8px;
cursor: pointer; cursor: pointer;
transition: all 0.2s; transition: all 0.2s;
text-align: center;
} }
.network-card:hover { .network-card:hover {
background: var(--bg-tertiary, #f8fafc); background: var(--bg-tertiary, #f8fafc);
transform: translateY(-2px); box-shadow: 0 2px 8px rgba(0,0,0,0.06);
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
} }
.network-card.healthy { border-top: 4px solid #22c55e; } .network-card.healthy { border-left: 3px solid #22c55e; }
.network-card.unhealthy { border-top: 4px solid #ef4444; } .network-card.unhealthy { border-left: 3px solid #ef4444; }
.network-card.pending { border-top: 4px solid #9ca3af; } .network-card.pending { border-left: 3px solid #9ca3af; }
.card-icon { font-size: 22px; margin-bottom: 4px; } .card-row {
.card-title { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; } display: flex;
justify-content: space-between;
align-items: center;
}
.card-status { display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 2px; } .card-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.status-icon { font-size: 14px; } .status-badge { font-size: 12px; }
.status-text { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.card-time { font-size: 10px; color: var(--text-muted); } .card-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
</style> </style>