Skip to content

Commit

Permalink
feat: all deps have a id
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenLoc committed Jun 18, 2024
1 parent 73d5762 commit 8caed1f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Using:
- tauri
- react
- material ui
- github api
- github api
1 change: 0 additions & 1 deletion src-tauri/src/github/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub async fn get_deps_from_github(
println!("getting repos for : {:?}", org);
let result = github.get_repos(org, token).await?;
let mut deps: Vec<GitHubDep> = vec![];
println!("repos: {:?}", result);
for repo in result {
let graph = github.get_graph(org, &repo.name, token).await;

Expand Down
9 changes: 6 additions & 3 deletions src-tauri/src/github/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Github {
};

let mut headers = header::HeaderMap::new();
headers.insert("Accept", "application/vnd.github+json".parse().unwrap());
headers.insert("Accept", "application/json".parse().unwrap());
headers.insert("X-GitHub-Api-Version", "2022-11-28".parse().unwrap());
headers.insert("User-Agent", "Dreamy-App".parse().unwrap());

Expand All @@ -42,12 +42,15 @@ impl Github {
let res = self
.client
.get(url)
.query(&[("per_page", "100"), ("page", "100")])
.query(&[("per_page", "100"), ("page", "1")])
.headers(headers)
.send()
.await
.map_err(|f| f.to_string());
let json: Vec<GithubRepo> = res?.json().await.map_err(|f| f.to_string())?;

let as_text = res?.text().await.map_err(|f| f.to_string())?;

let json: Vec<GithubRepo> = serde_json::from_str(&as_text).map_err(|f| f.to_string())?;

Ok(json)
}
Expand Down
6 changes: 6 additions & 0 deletions src/FlatDep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ function FlatDepComp(props: {
}

const columns: GridColDef<FlatDep>[] = [
{
field: "uuid",
headerName: "Id",
width: 100,
editable: false,
},
{
field: "org",
headerName: "Organization",
Expand Down
10 changes: 2 additions & 8 deletions src/Represenation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface FlatDep {
uuid: string;
org: string;
repo: string;
packageType: string;
Expand All @@ -7,12 +8,5 @@ export interface FlatDep {
}

export function flatDepKey(fd: FlatDep) {
return (
fd.org +
fd.currentValue +
fd.depName +
fd.repo +
fd.packageType +
Math.random()
);
return fd.uuid;
}

0 comments on commit 8caed1f

Please sign in to comment.