This commit is contained in:
unknown
2026-03-21 07:26:38 +09:00
parent 166d94fca4
commit 40150cd66d
406 changed files with 34179 additions and 55658 deletions
+500 -203
View File
@@ -31,9 +31,37 @@
<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">
<select id="script" name="script" class="form-select" required autocomplete="off">
<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() %}
@@ -81,16 +109,16 @@
</div>
</label>
<textarea id="ips" name="ips" class="form-control font-monospace flex-grow-1"
placeholder="예:&#10;192.168.1.1&#10;192.168.1.2" required style="resize: none;"></textarea>
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-2 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move">
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-5"></i>
<i class="bi bi-play-circle-fill fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.8rem;">처리 시작</span>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">처리 시작</span>
</button>
</div>
</form>
@@ -123,29 +151,29 @@
<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-2 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move h-100">
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-5"></i>
<i class="bi bi-file-earmark-spreadsheet fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.8rem;">MAC to Excel</span>
<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-2 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move h-100">
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-5"></i>
<i class="bi bi-file-earmark-excel fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.8rem;">GUID to Excel</span>
<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-2 d-flex flex-column align-items-center justify-content-center gap-1 btn-quick-move h-100">
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-5"></i>
<i class="bi bi-gpu-card fs-6"></i>
</div>
<span class="fw-medium text-dark" style="font-size: 0.8rem;">GPU to Excel</span>
<span class="fw-medium text-dark" style="font-size: 0.75rem;">GPU to Excel</span>
</button>
</div>
</div>
@@ -155,8 +183,104 @@
</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">
@@ -202,7 +326,7 @@
<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
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>
@@ -295,213 +419,344 @@
</div>
</div>
{# 처리된 파일 목록 #}
<div class="row mb-4 processed-list">
{# 통합 파일 관리 섹션 (탭 인터페이스) #}
<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-light border-0 py-2 d-flex justify-content-between align-items-center">
<h6 class="mb-0 d-flex align-items-center">
<i class="bi bi-files me-2"></i>
처리된 파일 목록
{% if files_to_display %}
<span class="badge bg-primary ms-3">{{ files_to_display|length }} 파일</span>
{% endif %}
</h6>
</div>
<div class="card-body p-4">
{% if files_to_display and files_to_display|length > 0 %}
<div class="row g-3">
{% for file_info in files_to_display %}
<div class="col-auto">
<div class="file-card-compact border rounded p-2 text-center">
<a href="{{ url_for('main.download_file', filename=file_info.file) }}"
class="text-decoration-none text-dark fw-semibold d-block mb-2 text-nowrap px-2" download
title="{{ file_info.name or file_info.file }}">
{{ file_info.name or file_info.file }}
</a>
<div class="file-card-buttons d-flex gap-2 justify-content-center">
<button type="button" class="btn btn-sm btn-outline btn-view-processed flex-fill"
data-bs-toggle="modal" data-bs-target="#fileViewModal" data-folder="idrac_info"
data-filename="{{ file_info.file }}">
보기
</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-outline btn-delete-processed flex-fill"
onclick="return confirm('삭제하시겠습니까?');">
삭제
</button>
</form>
</div>
</div>
</div>
{% endfor %}
</div>
<!-- 페이지네이션 -->
{% if total_pages > 1 %}
<nav aria-label="Processed files pagination" class="mt-4">
<ul class="pagination justify-content-center mb-0">
<!-- 이전 페이지 -->
{% 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 %}
<!-- 페이지 번호 (최대 10개 표시) -->
{% 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>
<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 %}
</ul>
</nav>
{% endif %}
<!-- /페이지네이션 -->
{% else %}
<div class="text-center py-5">
<i class="bi bi-inbox fs-1 text-muted mb-3"></i>
<p class="text-muted mb-0">표시할 파일이 없습니다.</p>
</div>
{% 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>
</div>
</div>
{# 백업된 파일 목록 #}
<div class="row backup-list">
<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-archive me-2"></i>
백업된 파일 목록
</h6>
</div>
<div class="card-body p-4">
{% if backup_files and backup_files|length > 0 %}
<div class="list-group">
{% for date, info in backup_files.items() %}
<div class="list-group-item border rounded mb-2 p-0 overflow-hidden">
<div class="d-flex justify-content-between align-items-center p-3 bg-light">
<div class="d-flex align-items-center">
<i class="bi bi-calendar3 text-primary me-2"></i>
<strong>{{ date }}</strong>
<span class="badge bg-primary ms-3">{{ info.count }} 파일</span>
<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>
<button class="btn btn-sm btn-outline-secondary" type="button" data-bs-toggle="collapse"
data-bs-target="#collapse-{{ loop.index }}" aria-expanded="false">
<i class="bi bi-chevron-down"></i>
</button>
</div>
<div id="collapse-{{ loop.index }}" class="collapse">
<div class="p-3">
<div class="row g-3 backup-files-container" data-folder="{{ date }}" style="min-height: 50px;">
{% for file in info.files %}
<div class="col-auto backup-file-item" data-filename="{{ file }}">
<div class="file-card-compact border rounded p-2 text-center bg-white">
<a href="{{ url_for('main.download_backup_file', date=date, filename=file) }}"
class="text-decoration-none text-dark fw-semibold d-block mb-2 text-nowrap px-2" download
title="{{ file }}">
{{ file.rsplit('.', 1)[0] }}
</a>
<div class="file-card-single-button">
<button type="button" class="btn btn-sm btn-outline btn-view-backup w-100"
data-bs-toggle="modal" data-bs-target="#fileViewModal" data-folder="backup"
data-date="{{ date }}" data-filename="{{ file }}">
보기
<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>
{% endfor %}
</div> <!-- End Tab 2 -->
</div>
<!-- 백업 목록 페이지네이션 -->
{% if total_backup_pages > 1 %}
<nav aria-label="Backup pagination" class="mt-4">
<ul class="pagination justify-content-center mb-0">
<!-- 이전 페이지 -->
{% 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>
{% else %}
<li class="page-item disabled">
<span class="page-link"><i class="bi bi-chevron-left"></i> 이전</span>
</li>
{% endif %}
<!-- 페이지 번호 -->
{% set start_b_page = ((backup_page - 1) // 10) * 10 + 1 %}
{% set end_b_page = [start_b_page + 9, total_backup_pages]|min %}
{% for p in range(start_b_page, end_b_page + 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>
{% else %}
<li class="page-item disabled">
<span class="page-link">다음 <i class="bi bi-chevron-right"></i></span>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
<div class="text-center py-5">
<i class="bi bi-inbox fs-1 text-muted mb-3"></i>
<p class="text-muted mb-0">백업된 파일이 없습니다.</p>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{# 파일 보기 모달 #}
@@ -547,11 +802,53 @@
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') }}"
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>