Files
iDRAC_Info/backend/templates/index.html
T
unknown 40150cd66d update
2026-03-21 07:26:38 +09:00

1001 lines
49 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="container-fluid py-4">
{# 헤더 섹션 #}
<div class="row mb-4">
<div class="col">
<h2 class="fw-bold mb-1">
<i class="bi bi-server text-primary me-2"></i>
서버 관리 대시보드
</h2>
<p class="text-muted mb-0">IP 처리 및 파일 관리를 위한 통합 관리 도구</p>
</div>
</div>
{# 메인 작업 영역 #}
<div class="row g-4 mb-4">
{# IP 처리 카드 #}
<div class="col-lg-6">
<div class="card border shadow-sm h-100">
<div class="card-header bg-light border-0 py-2">
<h6 class="mb-0">
<i class="bi bi-hdd-network me-2"></i>
IP 처리
</h6>
</div>
<div class="card-body p-4 h-100 d-flex flex-column">
<form id="ipForm" method="post" action="{{ url_for('main.process_ips') }}" class="h-100 d-flex flex-column">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{# 작업 유형 선택 #}
<div class="mb-3">
<label for="job_type" class="form-label d-flex justify-content-between">
<span>작업 유형</span>
<a href="{{ url_for('script_manager.index') }}" class="text-decoration-none small">
<i class="bi bi-gear-fill me-1"></i>프로파일 관리
</a>
</label>
<select id="job_type" name="job_type" class="form-select" required>
<option value="" disabled selected>작업을 선택하세요</option>
<option value="mac">MAC 주소 수집</option>
<option value="server_info">서버 정보 수집</option>
<option value="guid">GUID 수집</option>
<option value="gpu">GPU 시리얼 수집</option>
<option value="legacy">기존 스크립트 사용 (Legacy)</option>
</select>
</div>
{# 프로파일 선택 (동적) #}
<div class="mb-3" id="profileGroup" style="display:none;">
<label for="profile" class="form-label">프로파일 선택</label>
<select id="profile" name="profile" class="form-select">
<option value="">프로파일을 선택하세요</option>
</select>
<div class="form-text small" id="profileDesc"></div>
</div>
{# 기존 스크립트 선택 (Legacy) #}
<div class="mb-3" id="legacyScriptGroup" style="display:none;">
<label for="script" class="form-label">스크립트 선택</label>
<select id="script" name="script" class="form-select" autocomplete="off">
<option value="">스크립트를 선택하세요</option>
{% if grouped_scripts %}
{% for category, s_list in grouped_scripts.items() %}
<optgroup label="{{ category }}">
{% for script in s_list %}
<option value="{{ script }}">{{ script }}</option>
{% endfor %}
</optgroup>
{% endfor %}
{% else %}
{# 만약 grouped_scripts가 없는 경우(하위 호환) #}
{% for script in scripts %}
<option value="{{ script }}">{{ script }}</option>
{% endfor %}
{% endif %}
</select>
</div>
{# XML 파일 선택 (조건부) #}
<div class="mb-3" id="xmlFileGroup" style="display:none;">
<select id="xmlFile" name="xmlFile" class="form-select">
<option value="">XML 파일 선택</option>
{% for xml_file in xml_files %}
<option value="{{ xml_file }}">{{ xml_file }}</option>
{% endfor %}
</select>
</div>
{# IP 주소 입력 #}
<div class="mb-3 flex-grow-1 d-flex flex-column">
<label for="ips" class="form-label w-100 d-flex justify-content-between align-items-end mb-2">
<span class="mb-1">
IP 주소
<span class="badge bg-secondary ms-1" id="ipLineCount">0</span>
</span>
<div class="d-flex align-items-center gap-1">
<button type="button" class="btn btn-sm btn-outline-secondary px-2 py-1" id="btnClearIps"
title="입력 내용 지우기" style="font-size: 0.75rem;">
<i class="bi bi-trash me-1"></i>지우기
</button>
<button type="button" class="btn btn-sm btn-outline-primary px-2 py-1" id="btnStartScan"
title="10.10.0.1 ~ 255 자동 스캔" style="font-size: 0.75rem;">
<i class="bi bi-search me-1"></i>IP 스캔
</button>
</div>
</label>
<textarea id="ips" name="ips" class="form-control font-monospace flex-grow-1"
placeholder="iDRAC IP 정보를 입력하세요&#10;10.10.0.2&#10;10.10.0.3" required style="resize: none;"></textarea>
</div>
<div class="mt-auto">
<button type="submit"
class="btn btn-white bg-white border shadow-sm w-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move">
<div class="rounded-circle bg-primary bg-opacity-10 text-primary p-1">
<i class="bi bi-play-circle-fill fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">처리 시작</span>
</button>
</div>
</form>
</div>
</div>
</div>
{# 공유 작업 카드 #}
<div class="col-lg-6">
<div class="card border shadow-sm h-100">
<div class="card-header bg-light border-0 py-2">
<h6 class="mb-0">
<i class="bi bi-share me-2"></i>
공유 작업
</h6>
</div>
<div class="card-body p-4">
<form id="sharedForm" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label for="server_list_content" class="form-label">
서버 리스트 (덮어쓰기)
<span class="badge bg-secondary ms-2" id="serverLineCount">0 대설정</span>
</label>
<textarea id="server_list_content" name="server_list_content" rows="8" class="form-control font-monospace"
style="font-size: 0.95rem;" placeholder="서버 리스트를 입력하세요..."></textarea>
</div>
<div class="row g-2">
<div class="col-4">
<button type="submit" formaction="{{ url_for('utils.update_server_list') }}"
class="btn btn-white bg-white border shadow-sm w-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move h-100">
<div class="rounded-circle bg-primary bg-opacity-10 text-primary p-1">
<i class="bi bi-file-earmark-spreadsheet fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">MAC to Excel</span>
</button>
</div>
<div class="col-4">
<button type="button" data-bs-toggle="modal" data-bs-target="#slotPriorityModal"
class="btn btn-white bg-white border shadow-sm w-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move h-100">
<div class="rounded-circle bg-success bg-opacity-10 text-success p-1">
<i class="bi bi-file-earmark-excel fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">GUID to Excel</span>
</button>
</div>
<div class="col-4">
<button type="submit" formaction="{{ url_for('utils.update_gpu_list') }}"
class="btn btn-white bg-white border shadow-sm w-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move h-100">
<div class="rounded-circle bg-danger bg-opacity-10 text-danger p-1">
<i class="bi bi-gpu-card fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">GPU to Excel</span>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{# 시스템 제어 패널 #}
<div class="row mb-4">
<div class="col">
<div class="card border shadow-sm">
<div class="card-header bg-light border-0 py-2 d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="bi bi-terminal me-2"></i>
시스템 제어 (System Control)
<small class="text-muted ms-2 fw-normal">- 위 "IP 주소" 입력란의 대상을 제어합니다.</small>
</h6>
<div class="d-flex align-items-center gap-2">
<small id="systemControlHint" class="text-primary fw-bold"
style="font-size: 0.75rem; cursor: pointer;">(클릭하여 열기)</small>
<button class="btn btn-sm btn-link text-secondary p-0 text-decoration-none" type="button"
data-bs-toggle="collapse" data-bs-target="#systemControlPanel" aria-expanded="false"
aria-controls="systemControlPanel">
<i class="bi bi-chevron-down"></i>
</button>
</div>
</div>
<div id="systemControlPanel" class="collapse">
<div class="card-body p-4">
<div class="row g-2">
<!-- Power ON -->
<div class="col-md-2">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
onclick="runControl('power_on')">
<div class="rounded-circle bg-success bg-opacity-10 text-success p-1">
<i class="bi bi-power fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.7rem;">Power ON</span>
</button>
</div>
<!-- Power OFF -->
<div class="col-md-2">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
onclick="runControl('power_off')">
<div class="rounded-circle bg-danger bg-opacity-10 text-danger p-1">
<i class="bi bi-person-x fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.7rem;">Power OFF</span>
</button>
</div>
<!-- Log Clear -->
<div class="col-md-2">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
onclick="runControl('log_clear')">
<div class="rounded-circle bg-warning bg-opacity-10 text-warning p-1">
<i class="bi bi-eraser fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.7rem;">Log Clear</span>
</button>
</div>
<!-- Job Delete -->
<div class="col-md-2">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
onclick="runControl('job_delete')">
<div class="rounded-circle bg-secondary bg-opacity-10 text-secondary p-1">
<i class="bi bi-trash fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.7rem;">Job Delete</span>
</button>
</div>
<!-- TSR Collect -->
<div class="col-md-2">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
onclick="runControl('tsr_collect')">
<div class="rounded-circle bg-info bg-opacity-10 text-info p-1">
<i class="bi bi-collection fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.7rem;">TSR Collect</span>
</button>
</div>
<!-- TSR Save -->
<div class="col-md-2">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
onclick="runControl('tsr_save')">
<div class="rounded-circle bg-primary bg-opacity-10 text-primary p-1">
<i class="bi bi-save fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.7rem;">TSR Save</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{# 진행바 #}
<div class="row mb-4" id="progressSection" style="display: none;">
<div class="col">
<div class="card border-0 shadow-sm">
<div class="card-body p-3">
<div class="d-flex align-items-center mb-2">
<i class="bi bi-activity text-primary me-2"></i>
<span class="fw-semibold">처리 진행률</span>
</div>
<div class="progress" style="height: 25px;">
<div id="progressBar" class="progress-bar progress-bar-striped progress-bar-animated bg-success"
role="progressbar" style="width:0%;" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
<span class="fw-semibold">0%</span>
</div>
</div>
</div>
</div>
</div>
</div>
{# 파일 관리 도구 #}
<div class="row mb-4">
<div class="col">
<div class="card border shadow-sm">
<div class="card-header bg-light border-0 py-2">
<h6 class="mb-0">
<i class="bi bi-tools me-2"></i>
파일 관리 도구
</h6>
</div>
<div class="card-body p-4 file-tools">
<div class="d-flex flex-column gap-3">
<!-- 상단: 입력형 도구 (다운로드/백업) -->
<div class="row g-2">
<!-- ZIP 다운로드 -->
<div class="col-6">
<div class="card h-100 border-primary-subtle bg-primary-subtle bg-opacity-10">
<div class="card-body p-2 d-flex flex-column justify-content-center">
<h6 class="card-title fw-bold text-primary mb-1 small" style="font-size: 0.75rem;">
<i class="bi bi-file-earmark-zip me-1"></i>ZIP
</h6>
<form method="post" action="{{ url_for('main.download_zip') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="input-group input-group-sm">
<input type="text" class="form-control border-primary-subtle form-control-sm"
name="zip_filename" placeholder="파일명 또는 백업폴더명" required
style="font-size: 0.75rem; padding: 0.2rem 0.5rem;">
<button class="btn btn-primary btn-sm px-2" type="submit">
<i class="bi bi-download" style="font-size: 0.75rem;"></i>
</button>
</div>
</form>
</div>
</div>
</div>
<!-- 파일 백업 -->
<div class="col-6">
<div class="card h-100 border-success-subtle bg-success-subtle bg-opacity-10">
<div class="card-body p-2 d-flex flex-column justify-content-center">
<h6 class="card-title fw-bold text-success mb-1 small" style="font-size: 0.75rem;">
<i class="bi bi-hdd-network me-1"></i>백업
</h6>
<form method="post" action="{{ url_for('main.backup_files') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="input-group input-group-sm">
<input type="text" class="form-control border-success-subtle form-control-sm"
name="backup_prefix" placeholder="ex)PO-20251117-0015_20251223_판교_R6615(TY1A)"
style="font-size: 0.75rem; padding: 0.2rem 0.5rem;">
<button class="btn btn-success btn-sm px-2" type="submit">
<i class="bi bi-save" style="font-size: 0.75rem;"></i>
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- 하단: 원클릭 액션 (파일 정리) -->
<div class="card bg-light border-0">
<div class="card-body p-3">
<small class="text-muted fw-bold text-uppercase mb-2 d-block">
<i class="bi bi-folder-symlink me-1"></i>파일 정리 (Quick Move)
</small>
<div class="row g-2">
<!-- MAC Move -->
<div class="col-4">
<form id="macMoveForm" method="post" action="{{ url_for('utils.move_mac_files') }}" class="h-100">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
type="submit">
<div class="rounded-circle bg-primary bg-opacity-10 text-primary p-1">
<i class="bi bi-cpu fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">MAC</span>
</button>
</form>
</div>
<!-- GUID Move -->
<div class="col-4">
<form id="guidMoveForm" method="post" action="{{ url_for('utils.move_guid_files') }}" class="h-100">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
type="submit">
<div class="rounded-circle bg-success bg-opacity-10 text-success p-1">
<i class="bi bi-fingerprint fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">GUID</span>
</button>
</form>
</div>
<div class="col-4">
<form id="gpuMoveForm" method="post" action="{{ url_for('utils.move_gpu_files') }}" class="h-100">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button
class="btn btn-white bg-white border shadow-sm w-100 h-100 py-1 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move"
type="submit">
<div class="rounded-circle bg-danger bg-opacity-10 text-danger p-1">
<i class="bi bi-gpu-card fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">GPU</span>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{# 통합 파일 관리 섹션 (탭 인터페이스) #}
<style>
/* 탭/필 텍스트 가시성 강제 설정 (강제 덮어쓰기) */
/* 기본(비활성) 상태: 무조건 검은색 */
#fileTabs .nav-link,
#repoTabs .nav-link {
color: #000 !important;
font-weight: 500;
}
/* 메인 탭 활성 상태: 검은색 텍스트 + 흰색 배경 */
#fileTabs .nav-link.active {
color: #000 !important;
background-color: #fff !important;
border-color: #dee2e6 #dee2e6 #fff !important;
font-weight: bold;
}
/* 서브 탭(Pills) 활성 상태: 흰색 텍스트 + 파란색 배경 */
#repoTabs .nav-link.active {
color: #fff !important;
background-color: #0d6efd !important;
}
/* 커스텀 탭 패널 가시성 제어 */
.custom-tab-panel {
display: none !important;
}
.custom-tab-panel.custom-active {
display: block !important;
}
/* 커스텀 서브 탭 패널 가시성 제어 */
.custom-sub-panel {
display: none !important;
}
.custom-sub-panel.custom-sub-active {
display: block !important;
}
</style>
<div class="row mb-5">
<div class="col">
<div class="card border shadow-sm">
<div class="card-header bg-white border-0 py-3">
<ul class="nav nav-tabs card-header-tabs" id="fileTabs" role="tablist">
{# 탭 1: 처리된 파일 #}
<li class="nav-item" role="presentation">
<button class="nav-link active" id="processed-tab" data-custom-toggle="tab" data-bs-target="#processed"
type="button" role="tab" aria-controls="processed" aria-selected="true">
<i class="bi bi-check-circle-fill text-success me-2"></i>처리된 파일
{% if files_to_display %}
<span class="badge bg-secondary ms-1 rounded-pill">{{ files_to_display|length }}</span>
{% endif %}
</button>
</li>
{# 탭 2: 백업 및 저장소 (드롭다운으로 할지, 서브탭으로 할지 결정. 여기서는 메인 탭 내부 서브탭 방식 채택) #}
<li class="nav-item" role="presentation">
<button class="nav-link" id="repository-tab" data-custom-toggle="tab" data-bs-target="#repository-panel"
type="button" role="tab" aria-controls="repository-panel" aria-selected="false">
<i class="bi bi-archive-fill text-primary me-2"></i>백업 및 저장소
</button>
</li>
</ul>
</div>
<div class="card-body p-4">
<div class="custom-tabs-container" id="fileTabsContent">
{# ===================== [TAB 1] 처리된 파일 ===================== #}
<div class="custom-tab-panel custom-active" id="processed" role="tabpanel" aria-labelledby="processed-tab">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="text-muted small mb-0"><i class="bi bi-info-circle me-1"></i>현재 스테이징 폴더(data/temp/staging)에
있는 파일들입니다.</h6>
<div class="input-group input-group-sm w-auto">
<span class="input-group-text bg-light border-end-0"><i class="bi bi-search"></i></span>
<input type="text" class="form-control border-start-0" id="searchProcessed" placeholder="파일 검색..."
onkeyup="filterTable('tableProcessed', this.value)">
</div>
</div>
<div class="table-responsive bg-white border rounded">
<table class="table table-hover align-middle mb-0" id="tableProcessed">
<thead class="bg-light">
<tr>
<th class="ps-3" style="cursor:pointer;" onclick="sortTable('tableProcessed', 0)">파일명 <i
class="bi bi-arrow-down-up small text-muted"></i></th>
<th style="width: 150px;">작업</th>
</tr>
</thead>
<tbody>
{% if files_to_display and files_to_display|length > 0 %}
{% for file_info in files_to_display %}
<tr>
<td class="ps-3">
<div class="d-flex align-items-center">
<i class="bi bi-file-earmark-text text-secondary fs-5 me-3"></i>
<div>
<a href="{{ url_for('main.download_file', filename=file_info.file) }}"
class="text-decoration-none fw-semibold text-dark" download>
{{ file_info.name or file_info.file }}
</a>
</div>
</div>
</td>
<td>
<div class="d-flex gap-2">
<button type="button" class="btn btn-sm btn-light text-primary bg-primary-subtle border-0"
data-bs-toggle="modal" data-bs-target="#fileViewModal" data-folder="idrac_info"
data-filename="{{ file_info.file }}" title="내용 보기">
<i class="bi bi-eye-fill"></i>
</button>
<form action="{{ url_for('main.delete_file', filename=file_info.file) }}" method="post"
class="d-inline">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-sm btn-light text-danger bg-danger-subtle border-0"
onclick="return confirm('이 파일을 삭제하시겠습니까?');" title="삭제">
<i class="bi bi-trash-fill"></i>
</button>
</form>
</div>
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="4" class="text-center py-4 text-muted">표시할 파일이 없습니다.</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
{# 페이지네이션 (기존 로직 유지) #}
{% if total_pages > 1 %}
<nav aria-label="Processed files pagination" class="mt-4">
<ul class="pagination justify-content-center mb-0 pagination-sm">
{% if page > 1 %}
<li class="page-item">
<a class="page-link" href="{{ url_for('main.index', page=page-1) }}"><i
class="bi bi-chevron-left"></i></a>
</li>
{% else %}
<li class="page-item disabled"><span class="page-link"><i class="bi bi-chevron-left"></i></span></li>
{% endif %}
{% set start_page = ((page - 1) // 10) * 10 + 1 %}
{% set end_page = [start_page + 9, total_pages]|min %}
{% for p in range(start_page, end_page + 1) %}
<li class="page-item {% if p == page %}active{% endif %}">
<a class="page-link" href="{{ url_for('main.index', page=p) }}">{{ p }}</a>
</li>
{% endfor %}
{% if page < total_pages %} <li class="page-item"><a class="page-link"
href="{{ url_for('main.index', page=page+1) }}"><i class="bi bi-chevron-right"></i></a></li>
{% else %}
<li class="page-item disabled"><span class="page-link"><i class="bi bi-chevron-right"></i></span>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
</div>
{# ===================== [TAB 2] 백업 및 저장소 ===================== #}
<div class="custom-tab-panel" id="repository-panel" role="tabpanel" aria-labelledby="repository-tab"
style="display: none !important;">
{# 서브 탭 (Pills) #}
<ul class="nav nav-pills mb-3 gap-2" id="repoTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active btn-sm" id="subpanel-backup-tab" data-custom-toggle="pill"
data-bs-target="#subpanel-backup" type="button" role="tab" aria-selected="true">
<i class="bi bi-hdd-server me-1"></i>서버 정보
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link btn-sm" id="subpanel-mac-tab" data-custom-toggle="pill"
data-bs-target="#subpanel-mac" type="button" role="tab" aria-selected="false">
<i class="bi bi-cpu me-1"></i>MAC
<span class="badge bg-light text-dark ms-1">{{ mac_files|length }}</span>
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link btn-sm" id="subpanel-guid-tab" data-custom-toggle="pill"
data-bs-target="#subpanel-guid" type="button" role="tab" aria-selected="false">
<i class="bi bi-fingerprint me-1"></i>GUID
<span class="badge bg-light text-dark ms-1">{{ guid_files|length }}</span>
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link btn-sm" id="subpanel-gpu-tab" data-custom-toggle="pill"
data-bs-target="#subpanel-gpu" type="button" role="tab" aria-selected="false">
<i class="bi bi-gpu-card me-1"></i>GPU
<span class="badge bg-light text-dark ms-1">{{ gpu_files|length }}</span>
</button>
</li>
</ul>
<div class="custom-sub-tabs-container" id="repoTabsContent">
{# ----- 서브탭 1: 일별 백업 (기존 아코디언 스타일 유지 + 파일 목록 테이블화) ----- #}
<div class="custom-sub-panel" id="subpanel-backup" role="tabpanel">
{% if server_info_files and server_info_files|length > 0 %}
<div class="accordion" id="backupAccordion">
{% for folder_name, info in server_info_files.items() %}
<div class="accordion-item mb-2 border rounded overflow-hidden">
<h2 class="accordion-header" id="heading-{{ loop.index }}">
<div class="d-flex align-items-center bg-light w-100 px-0">
<button class="accordion-button collapsed bg-light py-2 shadow-none border-0" type="button"
data-bs-toggle="collapse" data-bs-target="#collapse-{{ loop.index }}" aria-expanded="false"
style="width: auto; flex-grow: 1;">
<div class="d-flex align-items-center">
<i class="bi bi-hdd-server text-primary me-2"></i>
<span class="fw-semibold me-3">{{ folder_name
}}</span>
<span class="badge bg-secondary rounded-pill">{{ info.count }} 파일</span>
</div>
</button>
{# 폴더 액션 버튼 (버튼 밖으로 이동하여 HTML 표준 준수) #}
<div class="d-flex gap-2 pe-3 me-4">
<form action="{{ url_for('main.archive_backup_folder', folder_name=folder_name) }}"
method="post" class="d-inline">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-xs btn-outline-secondary" title="아카이브로 이동"
onclick="return confirm('아카이브하시겠습니까?');">
<i class="bi bi-archive"></i>
</button>
</form>
<form action="{{ url_for('main.delete_backup_folder', folder_name=folder_name) }}"
method="post" class="d-inline">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-xs btn-outline-danger" title="폴더 삭제"
onclick="return confirm('영구 삭제하시겠습니까?');">
<i class="bi bi-trash"></i>
</button>
</form>
</div>
</div>
</h2>
<div id="collapse-{{ loop.index }}" class="accordion-collapse collapse">
<div class="accordion-body p-0">
{# 백업 파일 테이블 (내부 검색/정렬은 생략하거나 필요시 추가) #}
<div class="table-responsive" style="max-height: 400px;">
<table class="table table-sm table-hover mb-0 font-monospace" style="font-size: 0.9rem;">
<thead class="bg-light sticky-top">
<tr>
<th class="ps-3">파일명</th>
<th class="text-end pe-3" style="width: 100px;">보기</th>
</tr>
</thead>
<tbody class="backup-files-container" data-folder="{{ folder_name }}">
{% for file in info.files %}
<tr class="backup-file-item" data-filename="{{ file }}">
<td class="ps-3 align-middle">
<a href="{{ url_for('main.download_backup_file', date=folder_name, filename=file) }}"
class="text-decoration-none text-dark d-block text-truncate" download>
{{ file }}
</a>
</td>
<td class="text-end pe-3">
<button type="button" class="btn btn-xs btn-link text-secondary p-0 btn-view-backup"
data-bs-toggle="modal" data-bs-target="#fileViewModal" data-folder="server_info"
data-date="{{ folder_name }}" data-filename="{{ file }}">
<i class="bi bi-eye"></i>
</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{# 백업 페이지네이션 #}
{% if total_backup_pages > 1 %}
<nav class="mt-3">
<ul class="pagination pagination-sm justify-content-center">
{% if backup_page > 1 %}
<li class="page-item"><a class="page-link"
href="{{ url_for('main.index', backup_page=backup_page-1, page=page) }}"><i
class="bi bi-chevron-left"></i></a></li>
{% endif %}
{% set start_b = ((backup_page - 1) // 10) * 10 + 1 %}
{% set end_b = [start_b + 9, total_backup_pages]|min %}
{% for p in range(start_b, end_b + 1) %}
<li class="page-item {% if p == backup_page %}active{% endif %}"><a class="page-link"
href="{{ url_for('main.index', backup_page=p, page=page) }}">{{ p }}</a></li>
{% endfor %}
{% if backup_page < total_backup_pages %} <li class="page-item"><a class="page-link"
href="{{ url_for('main.index', backup_page=backup_page+1, page=page) }}"><i
class="bi bi-chevron-right"></i></a></li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
<div class="text-center py-5 text-muted">백업된 파일이 없습니다.</div>
{% endif %}
</div>
{# ----- 서브탭 2: MAC ----- #}
<div class="custom-sub-panel d-none" id="subpanel-mac" role="tabpanel">
{% with table_id="tableMac", files=mac_files, folder="mac", empty_msg="MAC 파일이 없습니다." %}
{% include "snippets/repo_file_table.html" %}
{% endwith %}
</div>
{# ----- 서브탭 3: GUID ----- #}
<div class="custom-sub-panel d-none" id="subpanel-guid" role="tabpanel">
{% with table_id="tableGuid", files=guid_files, folder="guid", empty_msg="GUID 파일이 없습니다." %}
{% include "snippets/repo_file_table.html" %}
{% endwith %}
</div>
{# ----- 서브탭 4: GPU ----- #}
<div class="custom-sub-panel d-none" id="subpanel-gpu" role="tabpanel">
{% with table_id="tableGpu", files=gpu_files, folder="gpu", empty_msg="GPU 파일이 없습니다." %}
{% include "snippets/repo_file_table.html" %}
{% endwith %}
</div>
</div>
</div> <!-- End Tab 2 -->
</div>
</div>
</div>
</div>
</div>
</div>
{# 파일 보기 모달 #}
<div class="modal fade" id="fileViewModal" tabindex="-1" aria-labelledby="fileViewModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="fileViewModalLabel">
<i class="bi bi-file-text me-2"></i>
파일 보기
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="닫기"></button>
</div>
<div class="modal-body bg-light">
<pre id="fileViewContent" class="mb-0 p-3 bg-white border rounded font-monospace"
style="white-space:pre-wrap;word-break:break-word;max-height:70vh;">불러오는 중...</pre>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
<i class="bi bi-x-circle me-1"></i>닫기
</button>
</div>
</div>
</div>
</div>
{% endblock %}
{% block extra_css %}
<!-- Tom Select CSS (Bootstrap 5 theme) -->
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.bootstrap5.min.css" rel="stylesheet">
{% endblock %}
{% block scripts %}
{{ super() }}
<!-- Tom Select JS -->
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/js/tom-select.complete.min.js"></script>
<script>
window.APP_CONFIG = {
moveBackupUrl: "{{ url_for('main.move_backup_files') }}",
csrfToken: "{{ csrf_token() }}",
downloadBaseUrl: "{{ url_for('main.download_backup_file', date='PLACEHOLDER_DATE', filename='PLACEHOLDER_FILE') }}",
systemControlUrl: "{{ url_for('utils.system_control') }}"
};
</script>
<script src="{{ url_for('static', filename='js/dashboard.js') }}?v={{ range(1, 100000) | random }}"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
async function runControl(action) {
// 메인 IP 입력란('ips')에서 값을 가져옴
const ipText = document.getElementById("ips").value.trim();
if (!ipText) {
alert("IP 처리에 입력된 IP 주소가 없습니다.\n먼저 'IP 처리' 카드에 IP를 입력해주세요.");
document.getElementById("ips").focus();
return;
}
if (!confirm(`정말로 ${action} 작업을 진행하시겠습니까?`)) return;
// Simple loading indicator (can be improved)
const btn = event.target.closest('button');
const originalText = btn.innerHTML;
btn.disabled = true;
btn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> 처리중...';
try {
const response = await axios.post(window.APP_CONFIG.systemControlUrl, {
action: action,
ips: ipText.split("\n").filter(ip => ip.trim() !== "")
}, {
headers: {
'X-CSRFToken': window.APP_CONFIG.csrfToken
}
});
if (response.data.success) {
alert("작업 완료: " + response.data.message);
} else {
alert("오류 발생: " + response.data.error);
}
} catch (error) {
alert("서버 통신 오류: " + (error.response?.data?.error || error.message));
} finally {
btn.disabled = false;
btn.innerHTML = originalText;
}
}
</script>
<!-- SortableJS for Drag and Drop -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.15.0/Sortable.min.js"></script>
<!-- 슬롯 우선순위 설정 모달 (Premium Design) -->
<div class="modal fade" id="slotPriorityModal" tabindex="-1" aria-hidden="true" data-bs-backdrop="static">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content border-0 shadow-lg" style="border-radius: 1rem; overflow: hidden;">
<!-- 헤더: 깔끔한 모던 스타일 -->
<div class="modal-header border-bottom p-4 bg-white">
<div>
<h5 class="modal-title fw-bold text-dark mb-1">
<i class="bi bi-layers text-primary me-2"></i>GUID 슬롯 우선순위 설정
</h5>
<p class="mb-0 text-muted" style="font-size: 0.85rem;">
엑셀 변환 시 적용될 슬롯의 순서를 설정합니다.
</p>
</div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="닫기"></button>
</div>
<div class="modal-body p-0 bg-light">
<form id="slotPriorityForm" action="{{ url_for('utils.update_guid_list') }}" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="server_list_content" id="modal_server_list_content">
<input type="hidden" name="slot_priority" id="slot_priority_input">
<div class="row g-0">
<!-- 왼쪽: 입력 및 프리셋 -->
<div class="col-lg-5 border-end bg-white p-4 d-flex flex-column">
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="fw-bold text-dark mb-0 small text-uppercase">
<i class="bi bi-keyboard me-1"></i>슬롯 번호 입력
</h6>
</div>
<div class="position-relative flex-grow-1">
<textarea id="slotNumbersInput"
class="form-control bg-light border-0 font-monospace p-3 text-dark h-100"
style="resize: none; font-size: 0.9rem; min-height: 200px;"
placeholder="슬롯 번호를 입력하세요.&#10;구분자: 쉼표(,) 공백( ) 줄바꿈&#10;&#10;예시: 38, 39, 37"></textarea>
<div class="position-absolute bottom-0 end-0 p-2">
<button type="button" id="btnClearSlots" class="btn btn-sm btn-link text-decoration-none text-muted"
style="font-size: 0.75rem;">
<i class="bi bi-x-circle me-1"></i>지우기
</button>
</div>
</div>
<!-- 미니멀한 프리셋 설정 (숫자 입력) -->
<div class="mt-3 pt-3 border-top border-light d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center">
<span class="small text-muted me-2" style="font-size: 0.75rem;">카드 개수 설정:</span>
<div class="input-group input-group-sm" style="width: 120px;">
<span class="input-group-text bg-white border-end-0 text-muted"
style="font-size: 0.75rem;">개수</span>
<input type="number" id="presetCountInput" class="form-control border-start-0 text-center"
value="10" min="1" max="10" style="font-size: 0.8rem;">
</div>
</div>
<button type="button" id="btnApplyPreset" class="btn btn-sm btn-outline-primary rounded-pill px-3"
style="font-size: 0.75rem;">
적용
</button>
</div>
</div>
<!-- 오른쪽: 시각화 및 확인 -->
<div class="col-lg-7 p-4 bg-light d-flex flex-column">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="fw-bold text-secondary mb-0 small text-uppercase">
<i class="bi bi-sort-numeric-down me-1"></i>적용 순서
</h6>
<span class="badge bg-white text-dark border rounded-pill px-3 py-1" id="slotCountDisplay">0개</span>
</div>
<!-- 미리보기 영역 -->
<div class="flex-grow-1 bg-white border rounded-3 p-4 shadow-sm mb-4 position-relative"
style="min-height: 250px; max-height: 400px; overflow-y: auto;">
<div id="slotPreview" class="d-flex flex-wrap gap-2 align-content-start h-100">
<!-- Empty State -->
<div
class="d-flex flex-column align-items-center justify-content-center w-100 h-100 text-muted opacity-50">
<i class="bi bi-layers fs-1 mb-2"></i>
<span class="small">프리셋을 선택하거나 번호를 입력하세요.</span>
</div>
</div>
</div>
<div class="mt-auto">
<div class="d-flex align-items-center mb-3">
<i class="bi bi-info-circle text-primary me-2"></i>
<span class="small text-muted">입력된 순서대로 <strong>GUID 컬럼</strong><strong>슬롯 데이터</strong>
정렬됩니다.</span>
</div>
<button type="submit" class="btn btn-primary w-100 py-2 fw-semibold shadow-sm">
설정 확인 및 변환
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- 중복 파일 확인 모달 -->
<div class="modal fade" id="duplicateCheckModal" tabindex="-1" aria-hidden="true" data-bs-backdrop="static">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content border-0 shadow-lg">
<div class="modal-header border-bottom-0 pb-0">
<h5 class="modal-title fw-bold text-warning">
<i class="bi bi-exclamation-triangle-fill me-2"></i>중복 파일 발견
</h5>
</div>
<div class="modal-body pt-3">
<p class="text-secondary mb-3">
대상 폴더에 이미 동일한 이름의 파일이 <strong id="dupCount" class="text-dark">0</strong>개 존재합니다.<br>
덮어쓰시겠습니까?
</p>
<div class="bg-light rounded p-3 mb-3 border font-monospace text-muted small"
style="max-height: 150px; overflow-y: auto;">
<ul id="dupList" class="list-unstyled mb-0">
<!-- JS로 주입됨 -->
</ul>
<div id="dupMore" class="text-center mt-2 fst-italic display-none" style="display:none;">...외 <span
id="dupMoreCount">0</span></div>
</div>
<p class="small text-muted mb-0">
<i class="bi bi-info-circle me-1"></i>덮어쓰기를 선택하면 기존 파일은 삭제됩니다.
</p>
</div>
<div class="modal-footer border-top-0 pt-0">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">취소</button>
<button type="button" class="btn btn-warning text-white fw-bold" id="btnConfirmOverwrite">
<i class="bi bi-arrow-repeat me-1"></i>덮어쓰기 (Overwrite)
</button>
</div>
</div>
</div>
</div>
<!-- Styles moved to index_custom.css -->
<!-- Scripts moved to index_custom.js -->
{% endblock %}