🔐 JWT 기반 로그인 시스템: - 로그인 페이지: 아름다운 애니메이션과 보안 정보 표시 - JWT 토큰: 24시간 또는 30일 (Remember Me) 만료 설정 - 비밀번호 암호화: bcrypt 해싱으로 안전한 저장 - 계정 잠금: 5회 실패 시 15분 자동 잠금 👥 사용자 계정 관리: - admin/admin123 (관리자 권한) - hyungi/hyungi123 (시스템 권한) - 역할 기반 접근 제어 (RBAC) 🛡️ 보안 기능: - 토큰 자동 검증 및 만료 처리 - 감사 로그: 로그인/로그아웃/관리 작업 추적 - 안전한 세션 관리 및 토큰 정리 - 클라이언트 사이드 토큰 검증 🎨 UI/UX 개선: - 로그인 페이지: 그라디언트 배경, 플로팅 아이콘 애니메이션 - 사용자 메뉴: 헤더에 사용자명과 로그아웃 버튼 표시 - 보안 표시: SSL, 세션 타임아웃, JWT 인증 정보 - 반응형 디자인 및 다크모드 지원 🔧 기술 구현: - FastAPI HTTPBearer 보안 스키마 - PyJWT 토큰 생성/검증 - bcrypt 비밀번호 해싱 - 클라이언트-서버 토큰 동기화 새 파일: - templates/login.html: 로그인 페이지 HTML - static/login.css: 로그인 페이지 스타일 - static/login.js: 로그인 JavaScript 로직 - server/auth.py: JWT 인증 시스템 (실제 서버용) 수정된 파일: - test_admin.py: 테스트 서버에 JWT 인증 추가 - static/admin.js: JWT 토큰 기반 API 요청으로 변경 - templates/admin.html: 사용자 메뉴 및 로그아웃 버튼 추가 - static/admin.css: 사용자 메뉴 스타일 추가 보안 레벨: Phase 1 (API Key) → Phase 3 (JWT + 감사로그)
672 lines
12 KiB
CSS
672 lines
12 KiB
CSS
/* AI Server Admin Dashboard CSS */
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: #f5f7fa;
|
|
color: #2c3e50;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.admin-layout {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* Header */
|
|
.admin-header {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
padding: 1rem 2rem;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.header-content {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.header-content h1 {
|
|
font-size: 1.8rem;
|
|
font-weight: 600;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.header-info {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.server-status {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.3rem;
|
|
padding: 0.3rem 0.8rem;
|
|
border-radius: 20px;
|
|
font-size: 0.9rem;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.server-status.online {
|
|
background: rgba(46, 204, 113, 0.2);
|
|
border: 1px solid rgba(46, 204, 113, 0.3);
|
|
}
|
|
|
|
.server-status.offline {
|
|
background: rgba(231, 76, 60, 0.2);
|
|
border: 1px solid rgba(231, 76, 60, 0.3);
|
|
}
|
|
|
|
.current-time {
|
|
font-size: 0.9rem;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.user-menu {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.user-info {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.9rem;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.logout-btn {
|
|
background: rgba(255, 255, 255, 0.2);
|
|
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
color: white;
|
|
padding: 0.4rem 0.8rem;
|
|
border-radius: 6px;
|
|
font-size: 0.8rem;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.3rem;
|
|
}
|
|
|
|
.logout-btn:hover {
|
|
background: rgba(255, 255, 255, 0.3);
|
|
border-color: rgba(255, 255, 255, 0.5);
|
|
}
|
|
|
|
/* Main Content */
|
|
.admin-main {
|
|
flex: 1;
|
|
padding: 2rem;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
width: 100%;
|
|
}
|
|
|
|
.dashboard-section {
|
|
margin-bottom: 3rem;
|
|
}
|
|
|
|
.dashboard-section h2 {
|
|
color: #2c3e50;
|
|
margin-bottom: 1.5rem;
|
|
font-size: 1.4rem;
|
|
font-weight: 600;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
border-bottom: 2px solid #ecf0f1;
|
|
padding-bottom: 0.5rem;
|
|
}
|
|
|
|
/* Status Grid */
|
|
.status-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
gap: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.status-card {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
box-shadow: 0 4px 6px rgba(0,0,0,0.07);
|
|
border: 1px solid #e1e8ed;
|
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
}
|
|
|
|
.status-card:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.card-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.8rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.card-header i {
|
|
font-size: 1.5rem;
|
|
color: #667eea;
|
|
}
|
|
|
|
.card-header h3 {
|
|
font-size: 1.1rem;
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
.card-content {
|
|
text-align: center;
|
|
}
|
|
|
|
.status-value {
|
|
font-size: 1.8rem;
|
|
font-weight: 700;
|
|
color: #27ae60;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.status-value.error {
|
|
color: #e74c3c;
|
|
}
|
|
|
|
.status-value.warning {
|
|
color: #f39c12;
|
|
}
|
|
|
|
.status-detail {
|
|
font-size: 0.9rem;
|
|
color: #7f8c8d;
|
|
}
|
|
|
|
/* Tables */
|
|
.models-container, .api-keys-container {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
box-shadow: 0 4px 6px rgba(0,0,0,0.07);
|
|
border: 1px solid #e1e8ed;
|
|
}
|
|
|
|
.models-header, .api-keys-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.models-table table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.models-table th,
|
|
.models-table td {
|
|
text-align: left;
|
|
padding: 1rem;
|
|
border-bottom: 1px solid #ecf0f1;
|
|
}
|
|
|
|
.models-table th {
|
|
background: #f8f9fa;
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
font-size: 0.9rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.models-table tr:hover {
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.loading {
|
|
text-align: center;
|
|
color: #7f8c8d;
|
|
font-style: italic;
|
|
padding: 2rem;
|
|
}
|
|
|
|
/* Buttons */
|
|
.btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
padding: 0.6rem 1.2rem;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 0.9rem;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #667eea;
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #5a6fd8;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-success {
|
|
background: #27ae60;
|
|
color: white;
|
|
}
|
|
|
|
.btn-success:hover {
|
|
background: #229954;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-danger {
|
|
background: #e74c3c;
|
|
color: white;
|
|
}
|
|
|
|
.btn-danger:hover {
|
|
background: #c0392b;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-small {
|
|
padding: 0.4rem 0.8rem;
|
|
font-size: 0.8rem;
|
|
}
|
|
|
|
/* API Keys */
|
|
.api-key-item {
|
|
background: #f8f9fa;
|
|
border: 1px solid #e1e8ed;
|
|
border-radius: 8px;
|
|
padding: 1rem;
|
|
margin-bottom: 1rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.api-key-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.api-key-name {
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
margin-bottom: 0.3rem;
|
|
}
|
|
|
|
.api-key-value {
|
|
font-family: 'Monaco', 'Menlo', monospace;
|
|
font-size: 0.8rem;
|
|
color: #7f8c8d;
|
|
background: white;
|
|
padding: 0.3rem 0.6rem;
|
|
border-radius: 4px;
|
|
border: 1px solid #ddd;
|
|
margin-bottom: 0.3rem;
|
|
}
|
|
|
|
.api-key-meta {
|
|
font-size: 0.8rem;
|
|
color: #95a5a6;
|
|
}
|
|
|
|
.api-key-actions {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
/* Status Badges */
|
|
.status-badge {
|
|
display: inline-block;
|
|
padding: 0.2rem 0.6rem;
|
|
border-radius: 12px;
|
|
font-size: 0.8rem;
|
|
font-weight: 500;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.status-badge.active {
|
|
background: #d5f4e6;
|
|
color: #27ae60;
|
|
}
|
|
|
|
.status-badge.inactive {
|
|
background: #fadbd8;
|
|
color: #e74c3c;
|
|
}
|
|
|
|
.status-badge.loading {
|
|
background: #fef9e7;
|
|
color: #f39c12;
|
|
}
|
|
|
|
/* Phase 2: System Monitoring Styles */
|
|
.monitoring-container {
|
|
background: white;
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
box-shadow: 0 4px 6px rgba(0,0,0,0.07);
|
|
border: 1px solid #e1e8ed;
|
|
}
|
|
|
|
.monitoring-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.monitor-card {
|
|
background: #f8f9fa;
|
|
border-radius: 8px;
|
|
padding: 1.5rem;
|
|
text-align: center;
|
|
border: 1px solid #e9ecef;
|
|
}
|
|
|
|
.monitor-card .card-header {
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.progress-circle {
|
|
position: relative;
|
|
width: 80px;
|
|
height: 80px;
|
|
margin: 0 auto 1rem;
|
|
border-radius: 50%;
|
|
background: conic-gradient(#667eea 0deg, #e9ecef 0deg);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.progress-circle::before {
|
|
content: '';
|
|
position: absolute;
|
|
width: 60px;
|
|
height: 60px;
|
|
border-radius: 50%;
|
|
background: white;
|
|
}
|
|
|
|
.progress-text {
|
|
position: relative;
|
|
z-index: 1;
|
|
font-size: 0.9rem;
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
.monitor-details {
|
|
font-size: 0.8rem;
|
|
color: #7f8c8d;
|
|
}
|
|
|
|
/* Progress circle colors */
|
|
.progress-circle.low {
|
|
background: conic-gradient(#27ae60 var(--progress, 0deg), #e9ecef var(--progress, 0deg));
|
|
}
|
|
|
|
.progress-circle.medium {
|
|
background: conic-gradient(#f39c12 var(--progress, 0deg), #e9ecef var(--progress, 0deg));
|
|
}
|
|
|
|
.progress-circle.high {
|
|
background: conic-gradient(#e74c3c var(--progress, 0deg), #e9ecef var(--progress, 0deg));
|
|
}
|
|
|
|
/* Modal Styles */
|
|
.modal {
|
|
display: none;
|
|
position: fixed;
|
|
z-index: 1000;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: rgba(0,0,0,0.5);
|
|
backdrop-filter: blur(4px);
|
|
}
|
|
|
|
.modal-content {
|
|
background-color: white;
|
|
margin: 5% auto;
|
|
padding: 0;
|
|
border-radius: 12px;
|
|
width: 90%;
|
|
max-width: 600px;
|
|
box-shadow: 0 10px 30px rgba(0,0,0,0.3);
|
|
animation: modalSlideIn 0.3s ease;
|
|
}
|
|
|
|
@keyframes modalSlideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-50px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
.modal-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 1.5rem;
|
|
border-bottom: 1px solid #e1e8ed;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
border-radius: 12px 12px 0 0;
|
|
}
|
|
|
|
.modal-header h3 {
|
|
margin: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.close-btn {
|
|
background: none;
|
|
border: none;
|
|
font-size: 1.5rem;
|
|
color: white;
|
|
cursor: pointer;
|
|
padding: 0;
|
|
width: 30px;
|
|
height: 30px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 50%;
|
|
transition: background-color 0.2s ease;
|
|
}
|
|
|
|
.close-btn:hover {
|
|
background-color: rgba(255,255,255,0.2);
|
|
}
|
|
|
|
.modal-body {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.modal-actions {
|
|
display: flex;
|
|
gap: 1rem;
|
|
justify-content: flex-end;
|
|
margin-top: 1.5rem;
|
|
padding-top: 1rem;
|
|
border-top: 1px solid #e1e8ed;
|
|
}
|
|
|
|
/* Available Models List */
|
|
.available-model-item {
|
|
background: #f8f9fa;
|
|
border: 1px solid #e1e8ed;
|
|
border-radius: 8px;
|
|
padding: 1rem;
|
|
margin-bottom: 1rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
transition: border-color 0.2s ease;
|
|
}
|
|
|
|
.available-model-item:hover {
|
|
border-color: #667eea;
|
|
}
|
|
|
|
.model-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.model-name {
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
margin-bottom: 0.3rem;
|
|
}
|
|
|
|
.model-description {
|
|
font-size: 0.9rem;
|
|
color: #7f8c8d;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.model-tags {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.model-tag {
|
|
background: #667eea;
|
|
color: white;
|
|
padding: 0.2rem 0.5rem;
|
|
border-radius: 12px;
|
|
font-size: 0.7rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.model-tag.code {
|
|
background: #e74c3c;
|
|
}
|
|
|
|
.model-tag.lightweight {
|
|
background: #27ae60;
|
|
}
|
|
|
|
.model-tag.recommended {
|
|
background: #f39c12;
|
|
}
|
|
|
|
.model-size {
|
|
font-size: 0.9rem;
|
|
color: #95a5a6;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
.model-delete-info {
|
|
background: #fadbd8;
|
|
border: 1px solid #f1948a;
|
|
border-radius: 8px;
|
|
padding: 1rem;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.model-delete-info strong {
|
|
color: #e74c3c;
|
|
}
|
|
|
|
/* Enhanced Models Table */
|
|
.models-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 1.5rem;
|
|
flex-wrap: wrap;
|
|
gap: 1rem;
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 768px) {
|
|
.admin-main {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.status-grid {
|
|
grid-template-columns: 1fr;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.monitoring-grid {
|
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
gap: 1rem;
|
|
}
|
|
|
|
.header-content {
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.models-table {
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.models-header {
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
}
|
|
|
|
.api-key-item {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.api-key-actions {
|
|
width: 100%;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.available-model-item {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.modal-content {
|
|
width: 95%;
|
|
margin: 2% auto;
|
|
}
|
|
|
|
.modal-actions {
|
|
flex-direction: column;
|
|
}
|
|
}
|