Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add deps graph #860

Merged
merged 28 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5a6be69
feat: first draft for deps graph
mbhrznr Dec 7, 2024
ab50303
feat: add custom hook and controls to graph
mbhrznr Dec 7, 2024
e2cfb6d
feat: dependency graph
crowlKats Nov 26, 2024
679bdca
clean up
crowlKats Dec 1, 2024
665311f
hook up backend and frontend
crowlKats Dec 8, 2024
c67a6f7
add scroll to zoom and drag to pan
crowlKats Dec 8, 2024
05de22d
feat: add rankdir to digraph
mbhrznr Dec 8, 2024
4028eaa
cleanup dependency render and fixes
crowlKats Dec 8, 2024
b9a7a7d
cleanup code
crowlKats Dec 8, 2024
2b09027
chore: center graph with sensible defaults on load
mbhrznr Dec 8, 2024
204c84a
chore: tweak reset
mbhrznr Dec 8, 2024
122ed7b
chore: tweak reset
mbhrznr Dec 8, 2024
a589338
chore: improve rendering of deps
mbhrznr Dec 8, 2024
6fc672a
grouping of dependencies
crowlKats Dec 9, 2024
5560a81
make more readable
crowlKats Dec 9, 2024
7a58950
chore: cleanup
mbhrznr Dec 22, 2024
9b3c89d
chore: add button to access deps graph
mbhrznr Dec 22, 2024
657d6dc
chore: prevent accidental click on links during pan events
mbhrznr Dec 31, 2024
2dad120
Merge branch 'main' into feat/deps-graph
mbhrznr Dec 31, 2024
82d29aa
chore: add missing wasm cases to matches
mbhrznr Dec 31, 2024
3a82d66
fix: ci
mbhrznr Dec 31, 2024
0327e53
Merge branch 'main' into feat/deps-graph
mbhrznr Jan 9, 2025
3f280b0
use exports keys instead of path
crowlKats Jan 15, 2025
1b40613
remove testing assrtion
crowlKats Jan 15, 2025
cfacba6
Merge branch 'main' into feat/deps-graph
crowlKats Jan 15, 2025
bffe107
fmt
crowlKats Jan 15, 2025
3c19f68
add test
crowlKats Jan 17, 2025
2b2a882
increase cache time
crowlKats Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
678 changes: 671 additions & 7 deletions api/src/api/package.rs

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions api/src/api/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,36 @@ impl From<PublishingTask> for ApiPublishingTask {
}
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ApiDependencyGraphItem {
pub dependency: super::package::DependencyKind,
pub children: Vec<usize>,
pub size: Option<u64>,
pub media_type: Option<String>,
}

impl
From<(
super::package::DependencyKind,
super::package::DependencyInfo,
)> for ApiDependencyGraphItem
{
fn from(
(kind, info): (
super::package::DependencyKind,
super::package::DependencyInfo,
),
) -> Self {
Self {
dependency: kind,
children: info.children,
size: info.size,
media_type: info.media_type.map(|media_type| media_type.to_string()),
}
}
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ApiUser {
Expand Down
1 change: 1 addition & 0 deletions api/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ where
pub struct CacheDuration(pub usize);
impl CacheDuration {
pub const ONE_MINUTE: CacheDuration = CacheDuration(60);
pub const ONE_DAY: CacheDuration = CacheDuration(60 * 60 * 24);
}

pub fn cache<H, HF>(
Expand Down
19 changes: 19 additions & 0 deletions frontend/components/icons/ChevronUp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
export function ChevronUp(props: { class?: string }) {
return (
<svg
class={`h-4 w-4 ${props.class ?? ""}`}
viewBox="0 0 14 14"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
transform="translate(-1 0) rotate(270 7 7)"
fill-rule="evenodd"
clip-rule="evenodd"
d="M3.96967 12.5303C3.67678 12.2374 3.67678 11.7626 3.96967 11.4697L8.43934 7L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L10.0303 6.46967C10.3232 6.76256 10.3232 7.23744 10.0303 7.53033L5.03033 12.5303C4.73744 12.8232 4.26256 12.8232 3.96967 12.5303Z"
fill="currentColor"
/>
</svg>
);
}
18 changes: 18 additions & 0 deletions frontend/components/icons/Minus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
export function Minus(props: { class?: string }) {
return (
<svg
class={`w-4 h-4 ${props.class ?? ""}`}
aria-hidden="true"
viewBox="0 0 14 14"
fill="none"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M1 7C1 6.58579 1.33579 6.25 1.75 6.25H12.25C12.6642 6.25 13 6.58579 13 7C13 7.41421 12.6642 7.75 12.25 7.75H1.75C1.33579 7.75 1 7.41421 1 7Z"
fill="currentColor"
/>
</svg>
);
}
18 changes: 18 additions & 0 deletions frontend/components/icons/Reset.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2024 the JSR authors. All rights reserved. MIT license.
export function Reset(props: { class?: string }) {
return (
<svg
class={`w-4 h-4 ${props.class ?? ""}`}
aria-hidden="true"
viewBox="0 0 16 16"
fill="none"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M1.705 8.005a.75.75 0 0 1 .834.656 5.5 5.5 0 0 0 9.592 2.97l-1.204-1.204a.25.25 0 0 1 .177-.427h3.646a.25.25 0 0 1 .25.25v3.646a.25.25 0 0 1-.427.177l-1.38-1.38A7.002 7.002 0 0 1 1.05 8.84a.75.75 0 0 1 .656-.834ZM8 2.5a5.487 5.487 0 0 0-4.131 1.869l1.204 1.204A.25.25 0 0 1 4.896 6H1.25A.25.25 0 0 1 1 5.75V2.104a.25.25 0 0 1 .427-.177l1.38 1.38A7.002 7.002 0 0 1 14.95 7.16a.75.75 0 0 1-1.49.178A5.5 5.5 0 0 0 8 2.5Z"
fill="currentColor"
/>
</svg>
);
}
4 changes: 3 additions & 1 deletion frontend/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"@oramacloud/client": "npm:@oramacloud/client@^1",

"tailwindcss": "npm:[email protected]",
"postcss": "npm:[email protected]"
"postcss": "npm:[email protected]",

"@viz-js/viz": "npm:@viz-js/viz@^3.11.0"
},
"compilerOptions": {
"lib": [
Expand Down
5 changes: 5 additions & 0 deletions frontend/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading