From a2cb7c639c544c07ac41e94e3cadedfaee4892fb Mon Sep 17 00:00:00 2001 From: DevITWay Date: Sat, 31 Jan 2026 16:29:39 +0000 Subject: [PATCH] style: fix formatting and ignore txt files --- .gitignore | 1 + nora-registry/src/repo_index.rs | 16 +++++++++++++--- nora-registry/src/ui/api.rs | 15 ++++++++++++--- nora-registry/src/ui/templates.rs | 11 ++++++++--- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index ced0ca7..73a18d4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ TODO.md ROADMAP*.md docs-site/ docs/ +*.txt diff --git a/nora-registry/src/repo_index.rs b/nora-registry/src/repo_index.rs index bafd2fd..a9596d0 100644 --- a/nora-registry/src/repo_index.rs +++ b/nora-registry/src/repo_index.rs @@ -181,9 +181,19 @@ async fn build_docker_index(storage: &Storage) -> Vec { if let Ok(data) = storage.get(key).await { if let Ok(m) = serde_json::from_slice::(&data) { - let cfg = m.get("config").and_then(|c| c.get("size")).and_then(|s| s.as_u64()).unwrap_or(0); - let layers: u64 = m.get("layers").and_then(|l| l.as_array()) - .map(|arr| arr.iter().filter_map(|l| l.get("size").and_then(|s| s.as_u64())).sum()) + let cfg = m + .get("config") + .and_then(|c| c.get("size")) + .and_then(|s| s.as_u64()) + .unwrap_or(0); + let layers: u64 = m + .get("layers") + .and_then(|l| l.as_array()) + .map(|arr| { + arr.iter() + .filter_map(|l| l.get("size").and_then(|s| s.as_u64())) + .sum() + }) .unwrap_or(0); entry.1 += cfg + layers; } diff --git a/nora-registry/src/ui/api.rs b/nora-registry/src/ui/api.rs index b8590c2..0b374eb 100644 --- a/nora-registry/src/ui/api.rs +++ b/nora-registry/src/ui/api.rs @@ -116,7 +116,13 @@ pub async fn api_stats(State(state): State>) -> Json>) -> Json { @@ -135,8 +141,11 @@ pub async fn api_dashboard(State(state): State>) -> Json String { @@ -304,7 +304,8 @@ pub fn render_registry_list_paginated( r##"
📭
No more items on this page
- "##.to_string() + "## + .to_string() } else { repos .iter() @@ -341,7 +342,11 @@ pub fn render_registry_list_paginated( // Pagination let total_pages = (total + limit - 1) / limit; - let start_item = if total == 0 { 0 } else { (page - 1) * limit + 1 }; + let start_item = if total == 0 { + 0 + } else { + (page - 1) * limit + 1 + }; let end_item = (start_item + repos.len()).saturating_sub(1); let pagination = if total_pages > 1 {