feat: version list with verification + deployed badge (stage 3)
- pulp_client: list_versions / list_distributions / get_publication
- GET /repos/{uuid}/versions: 버전 목록 페이지(최신순)
- 현재 운영 배포 버전 판별: Distribution→publication→repository_version 역추적
- views.build_version_view: vN, 생성일시, 패키지 수, 증감(+/-), 검증 배지, 배포 여부
- views.verification_detail: gpgcheck/repo-gpgcheck/checksum 상세 (화면4)
- 대시보드 저장소명 → 버전 페이지 링크, [이 버전 배포] 버튼은 단계4용 placeholder
- 단계1 TODO(배포 버전 역추적) 해소
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
44
app/views.py
44
app/views.py
@@ -37,12 +37,17 @@ def version_number(version_href: str | None) -> int | None:
|
||||
return None
|
||||
|
||||
|
||||
def _content_count(version: dict[str, Any], section: str) -> int:
|
||||
"""content_summary[section] (present/added/removed) 의 카운트 합계."""
|
||||
data = (version.get("content_summary") or {}).get(section) or {}
|
||||
return sum((info or {}).get("count", 0) for info in data.values())
|
||||
|
||||
|
||||
def package_count(version: dict[str, Any] | None) -> int | None:
|
||||
"""RepositoryVersion 의 content_summary.present 카운트 합계."""
|
||||
if version is None:
|
||||
return None
|
||||
present = (version.get("content_summary") or {}).get("present") or {}
|
||||
return sum((info or {}).get("count", 0) for info in present.values())
|
||||
return _content_count(version, "present")
|
||||
|
||||
|
||||
def _uuid_from_href(href: str) -> str:
|
||||
@@ -69,6 +74,41 @@ def build_repo_view(
|
||||
}
|
||||
|
||||
|
||||
def build_version_view(
|
||||
version: dict[str, Any],
|
||||
deployed_number: int | None = None,
|
||||
gpg: dict[str, str] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""RepositoryVersion → 버전 목록 행 모델.
|
||||
|
||||
gpg 검증은 저장소 단위 설정(repo_config)이라 모든 버전이 같은 값을 공유한다 —
|
||||
호출부에서 repo 의 gpg_status() 를 주입한다.
|
||||
"""
|
||||
number = version_number(version.get("pulp_href"))
|
||||
return {
|
||||
"number": number,
|
||||
"created": version.get("pulp_created"),
|
||||
"package_count": _content_count(version, "present"),
|
||||
"added": _content_count(version, "added"),
|
||||
"removed": _content_count(version, "removed"),
|
||||
"gpg": gpg,
|
||||
"is_deployed": number is not None and number == deployed_number,
|
||||
}
|
||||
|
||||
|
||||
def verification_detail(repo: dict[str, Any]) -> dict[str, Any]:
|
||||
"""검증 상태 상세 (화면 4): GPG/checksum 설정값 + 종합 배지."""
|
||||
cfg = repo.get("repo_config") or {}
|
||||
return {
|
||||
"status": gpg_status(repo),
|
||||
"gpgcheck": int(bool(cfg.get("gpgcheck", 0))),
|
||||
"repo_gpgcheck": int(bool(cfg.get("repo-gpgcheck", 0))),
|
||||
"checksum_type": repo.get("metadata_checksum_type")
|
||||
or cfg.get("checksum_type")
|
||||
or "—",
|
||||
}
|
||||
|
||||
|
||||
def summarize(repo_views: list[dict[str, Any]], syncing: int = 0) -> dict[str, int]:
|
||||
"""상단 요약 카드 수치. syncing 은 task_store.active_count() 에서 주입."""
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user