feat: repo list search, header sort, pagination (stage 6)

- list_repos: Pulp next 페이지 끝까지 순회 (첫-페이지-only 누락 수정)
- BFF 메모리 검색(이름)·정렬(이름/검증/버전/패키지/동기화)·페이지네이션(20/페이지)
- GET /repos/table 조각: 검색창은 표 밖(포커스 유지), 정렬헤더/페이저는 표 안,
  hx-include 로 검색어·정렬상태 상호 전송
- 폰트 재조정: 데이터 셀 14px, 헤더 13px, 배지/액션버튼 14px (동기화 버튼 대비 균형)
- 버전 페이지 제목↔검증상세 마진, 데모 저장소 26개로 확장

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 14:04:54 +09:00
parent 15bb0994be
commit abf8654b52
11 changed files with 477 additions and 158 deletions

View File

@@ -1,62 +1,88 @@
"""임시 데모용 가짜 Pulp 클라이언트 — 성공 대시보드 미리보기.
"""임시 데모용 가짜 Pulp 클라이언트 — 실제 Pulp 없이 화면 확인.
PULP_DEMO=true 일 때만 사용된다. 실제 Pulp 서버 없이 화면을 확인하기 위한 것.
정식 기능과 무관하므로 단계 5(또는 실제 Pulp 연동 시) 제거 가능.
PULP_DEMO=true 일 때만 사용. 검색·정렬·페이지네이션을 눈으로 보도록 저장소를 여러 개 생성한다.
정식 기능과 무관하므로 실제 Pulp 연동 시 제거 가능.
"""
from __future__ import annotations
from typing import Any
_REPOS: list[dict[str, Any]] = [
{
"pulp_href": "/pulp/api/v3/repositories/rpm/rpm/0001/",
"name": "rocky9-baseos",
"latest_version_href": "/pulp/api/v3/repositories/rpm/rpm/0001/versions/3/",
"repo_config": {"gpgcheck": 1, "repo-gpgcheck": 1},
},
{
"pulp_href": "/pulp/api/v3/repositories/rpm/rpm/0002/",
"name": "rocky9-appstream",
"latest_version_href": "/pulp/api/v3/repositories/rpm/rpm/0002/versions/2/",
"repo_config": {"gpgcheck": 1, "repo-gpgcheck": 1},
},
{
"pulp_href": "/pulp/api/v3/repositories/rpm/rpm/0003/",
"name": "ubuntu2204-main",
"latest_version_href": "/pulp/api/v3/repositories/rpm/rpm/0003/versions/5/",
"repo_config": {"gpgcheck": 1, "repo-gpgcheck": 0}, # 부분 검증
},
{
"pulp_href": "/pulp/api/v3/repositories/rpm/rpm/0004/",
"name": "internal-tools",
"latest_version_href": "/pulp/api/v3/repositories/rpm/rpm/0004/versions/1/",
"repo_config": {}, # 미설정
},
_NAMES = [
"rocky9-baseos",
"rocky9-appstream",
"rocky9-extras",
"rocky8-baseos",
"rocky8-appstream",
"almalinux9-baseos",
"almalinux9-appstream",
"ubuntu2204-main",
"ubuntu2204-updates",
"ubuntu2204-security",
"ubuntu2004-main",
"debian12-main",
"debian12-updates",
"epel9",
"epel8",
"centos-stream9",
"docker-ce",
"kubernetes",
"postgresql16",
"nginx-stable",
"grafana",
"elastic-8",
"hashicorp",
"internal-tools",
"internal-agents",
"monitoring-exporters",
]
_VERSIONS: dict[str, dict[str, Any]] = {
"/pulp/api/v3/repositories/rpm/rpm/0001/versions/3/": {
"pulp_created": "2026-06-15T02:11:00Z",
"content_summary": {"present": {"rpm.package": {"count": 4821}}},
},
"/pulp/api/v3/repositories/rpm/rpm/0002/versions/2/": {
"pulp_created": "2026-06-14T23:40:00Z",
"content_summary": {"present": {"rpm.package": {"count": 8934}}},
},
"/pulp/api/v3/repositories/rpm/rpm/0003/versions/5/": {
"pulp_created": "2026-06-16T08:05:00Z",
"content_summary": {"present": {"deb.package": {"count": 12500}}},
},
"/pulp/api/v3/repositories/rpm/rpm/0004/versions/1/": {
"pulp_created": "2026-05-30T11:20:00Z",
"content_summary": {"present": {"rpm.package": {"count": 87}}},
},
}
# 검증 상태를 섞는다: pass / warn(부분) / unset
_CFGS = [
{"gpgcheck": 1, "repo-gpgcheck": 1},
{"gpgcheck": 1, "repo-gpgcheck": 0},
{},
]
def _uuid(i: int) -> str:
return f"{i:04d}"
def _latest(i: int) -> int:
return (i % 5) + 1 # 1~5
_REPOS: list[dict[str, Any]] = [
{
"pulp_href": f"/pulp/api/v3/repositories/rpm/rpm/{_uuid(i)}/",
"name": name,
"latest_version_href": (
f"/pulp/api/v3/repositories/rpm/rpm/{_uuid(i)}/versions/{_latest(i)}/"
),
"repo_config": _CFGS[i % 3],
}
for i, name in enumerate(_NAMES, start=1)
]
def _synth_version(version_href: str) -> dict[str, Any]:
parts = version_href.rstrip("/").split("/")
n = int(parts[-1]) if parts[-1].isdigit() else 1
base = 800 + (int(parts[-3]) if parts[-3].isdigit() else 1) * 53
present = base + n * 137
return {
"pulp_created": f"2026-06-{(n * 5) % 27 + 1:02d}T0{n}:11:00Z",
"content_summary": {
"present": {"rpm.package": {"count": present}},
"added": {"rpm.package": {"count": n * 137}},
"removed": {"rpm.package": {"count": n * 7}},
},
}
class DemoPulpClient:
def close(self) -> None: # 인터페이스 호환
def close(self) -> None:
pass
def status(self) -> dict[str, Any]:
@@ -66,7 +92,7 @@ class DemoPulpClient:
return _REPOS
def get_version(self, version_href: str) -> dict[str, Any]:
return _VERSIONS.get(version_href, {})
return _synth_version(version_href)
def get_repo(self, uuid: str) -> dict[str, Any]:
for r in _REPOS:
@@ -74,59 +100,32 @@ class DemoPulpClient:
return {**r, "remote": "/pulp/api/v3/remotes/rpm/rpm/demo/"}
return {"remote": "/pulp/api/v3/remotes/rpm/rpm/demo/"}
def sync_repo(self, uuid: str, remote_href: str) -> str:
return f"/pulp/api/v3/tasks/demo-{uuid}/"
def get_task(self, task_href: str) -> dict[str, Any]:
# 데모: 첫 폴링에서 바로 완료 처리
return {
"state": "completed",
"progress_reports": [{"done": 120, "total": 120}],
"created_resources": ["/pulp/api/v3/repositories/rpm/rpm/demo/versions/9/"],
}
def list_versions(self, uuid: str) -> list[dict[str, Any]]:
base = f"/pulp/api/v3/repositories/rpm/rpm/{uuid}/versions/"
return [
{
"pulp_href": base + "1/",
"pulp_created": "2026-05-02T01:00:00Z",
"content_summary": {
"present": {"rpm.package": {"count": 4500}},
"added": {"rpm.package": {"count": 4500}},
"removed": {},
},
},
{
"pulp_href": base + "2/",
"pulp_created": "2026-05-28T04:30:00Z",
"content_summary": {
"present": {"rpm.package": {"count": 4700}},
"added": {"rpm.package": {"count": 250}},
"removed": {"rpm.package": {"count": 50}},
},
},
{
"pulp_href": base + "3/",
"pulp_created": "2026-06-15T02:11:00Z",
"content_summary": {
"present": {"rpm.package": {"count": 4821}},
"added": {"rpm.package": {"count": 130}},
"removed": {"rpm.package": {"count": 9}},
},
},
]
latest = 1
for i, r in enumerate(_NAMES, start=1):
if _uuid(i) == uuid:
latest = _latest(i)
break
out = []
for n in range(1, latest + 1):
href = f"{base}{n}/"
out.append({"pulp_href": href, **_synth_version(href)})
return out
def list_distributions(self) -> list[dict[str, Any]]:
# 저장소별 현재 배포 버전 (publication href 에 uuid-버전 인코딩)
deployed = {"0001": 2, "0002": 1, "0003": 3, "0004": 1}
return [
{
"pulp_href": f"/pulp/api/v3/distributions/rpm/rpm/{u}/",
"publication": f"/pulp/api/v3/publications/rpm/rpm/{u}-{v}/",
}
for u, v in deployed.items()
]
# 저장소별 현재 배포 버전 (보통 최신-1). publication href 에 uuid-버전 인코딩
dists = []
for i in range(1, len(_NAMES) + 1):
deployed = max(1, _latest(i) - 1)
u = _uuid(i)
dists.append(
{
"pulp_href": f"/pulp/api/v3/distributions/rpm/rpm/{u}/",
"publication": f"/pulp/api/v3/publications/rpm/rpm/{u}-{deployed}/",
}
)
return dists
def get_publication(self, publication_href: str) -> dict[str, Any]:
tail = publication_href.rstrip("/").split("/")[-1] # "0001-2"
@@ -137,6 +136,16 @@ class DemoPulpClient:
)
}
def sync_repo(self, uuid: str, remote_href: str) -> str:
return f"/pulp/api/v3/tasks/demo-{uuid}/"
def get_task(self, task_href: str) -> dict[str, Any]:
return {
"state": "completed",
"progress_reports": [{"done": 120, "total": 120}],
"created_resources": ["/pulp/api/v3/repositories/rpm/rpm/demo/versions/9/"],
}
def create_publication(self, version_href: str) -> str:
return "/pulp/api/v3/tasks/demo-pub/"
@@ -144,7 +153,6 @@ class DemoPulpClient:
return "/pulp/api/v3/tasks/demo-dist/"
def wait_for_task(self, task_href: str, attempts: int = 120, delay: float = 1.0):
# 데모: 즉시 완료. publication task 면 새 publication 리소스를 돌려준다.
created = (
["/pulp/api/v3/publications/rpm/rpm/demo-new/"]
if "pub" in task_href