add endpoint for general stats

load build data to graph
redesign top info tiles
place add button on header
folder restructure
This commit is contained in:
2023-12-30 00:45:33 +01:00
parent ce7a260760
commit 600c2057fe
38 changed files with 563 additions and 886 deletions

View File

@@ -0,0 +1,17 @@
use std::path::PathBuf;
use std::{fs, io};
pub fn dir_size(path: impl Into<PathBuf>) -> io::Result<u64> {
fn dir_size(mut dir: fs::ReadDir) -> io::Result<u64> {
dir.try_fold(0, |acc, file| {
let file = file?;
let size = match file.metadata()? {
data if data.is_dir() => dir_size(fs::read_dir(file.path())?)?,
data => data.len(),
};
Ok(acc + size)
})
}
dir_size(fs::read_dir(path.into())?)
}

1
backend/src/utils/mod.rs Normal file
View File

@@ -0,0 +1 @@
pub mod dir_size;