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:
@@ -71,3 +71,72 @@ def test_dashboard_shows_error_when_pulp_down():
|
||||
resp = client.get("/")
|
||||
assert resp.status_code == 200 # 페이지는 뜨고 에러 메시지를 보여줌
|
||||
assert "불러오지 못했습니다" in resp.text
|
||||
|
||||
|
||||
# --- 검색 / 정렬 / 페이지네이션 -------------------------------------------------
|
||||
|
||||
PASS = {"gpgcheck": 1, "repo-gpgcheck": 1}
|
||||
|
||||
|
||||
class _ReposPulp:
|
||||
"""specs: (name, package_count) 목록. 검증은 모두 pass, 버전 1."""
|
||||
|
||||
def __init__(self, specs):
|
||||
self._repos = []
|
||||
self._counts = {}
|
||||
for i, (name, count) in enumerate(specs, start=1):
|
||||
href = f"/pulp/api/v3/repositories/rpm/rpm/{i:04d}/"
|
||||
vhref = f"{href}versions/1/"
|
||||
self._repos.append(
|
||||
{
|
||||
"pulp_href": href,
|
||||
"name": name,
|
||||
"latest_version_href": vhref,
|
||||
"repo_config": PASS,
|
||||
}
|
||||
)
|
||||
self._counts[vhref] = count
|
||||
|
||||
def list_repos(self):
|
||||
return self._repos
|
||||
|
||||
def get_version(self, href):
|
||||
return {
|
||||
"content_summary": {
|
||||
"present": {"rpm.package": {"count": self._counts.get(href, 0)}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def test_repos_table_search_filters_by_name():
|
||||
_use(
|
||||
_ReposPulp(
|
||||
[("rocky9-baseos", 10), ("ubuntu2204-main", 20), ("rocky8-baseos", 30)]
|
||||
)
|
||||
)
|
||||
body = client.get("/repos/table", params={"q": "rocky"}).text
|
||||
assert "rocky9-baseos" in body
|
||||
assert "rocky8-baseos" in body
|
||||
assert "ubuntu2204-main" not in body
|
||||
|
||||
|
||||
def test_repos_table_sort_by_packages_desc():
|
||||
_use(_ReposPulp([("alpha", 10), ("bravo", 300), ("charlie", 100)]))
|
||||
body = client.get("/repos/table", params={"sort": "packages", "dir": "desc"}).text
|
||||
# 패키지 많은 순: bravo(300) → charlie(100) → alpha(10)
|
||||
assert body.index("bravo") < body.index("charlie") < body.index("alpha")
|
||||
|
||||
|
||||
def test_repos_table_paginates():
|
||||
specs = [(f"repo-{i:02d}", i) for i in range(1, 26)] # 25개
|
||||
_use(_ReposPulp(specs))
|
||||
page1 = client.get(
|
||||
"/repos/table", params={"sort": "name", "dir": "asc", "page": 1}
|
||||
).text
|
||||
page2 = client.get(
|
||||
"/repos/table", params={"sort": "name", "dir": "asc", "page": 2}
|
||||
).text
|
||||
assert "repo-01" in page1 and "repo-20" in page1
|
||||
assert "repo-21" not in page1
|
||||
assert "repo-21" in page2 and "repo-25" in page2
|
||||
assert "1 / 2" in page1
|
||||
|
||||
Reference in New Issue
Block a user