Skip to content

Commit f306a99

Browse files
shafeeshafeemlieberman85
authored andcommitted
recompile gql, update docs, add minor build improvements
Signed-off-by: shafeeshafee <[email protected]>
1 parent b04abf1 commit f306a99

File tree

9 files changed

+55
-95
lines changed

9 files changed

+55
-95
lines changed

app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import "@/styles/globals.css";
22
import Footer from "@/components/layout/footer";
33
import Header from "@/components/layout/header";
4-
import { GuacVizThemeContextProvider } from "@/store/themeContext";
4+
import { GuacVizThemeContextProvider } from "@/app/themeContext";
55

66
export const metadata = {
77
title: "GUAC Visualizer",
File renamed without changes.

components/graph/ForceGraph2D.tsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { useCallback, useEffect, useRef, useState } from "react";
3+
import { useRef, useState } from "react";
44
import ForceGraph, {
55
LinkObject,
66
ForceGraphMethods,
@@ -77,23 +77,6 @@ const ForceGraph2D: React.FC<ForceGraph2DWrapperProps & ResponsiveProps> = ({
7777

7878
const fgRef = useRef<ForceGraphMethods>();
7979

80-
const centerGraph = () => {
81-
if (fgRef.current && width > 0 && height > 0) {
82-
fgRef.current.centerAt(width / 20, height / 10, 400);
83-
}
84-
};
85-
86-
useEffect(() => {
87-
centerGraph();
88-
}, [graphData, width, height]);
89-
90-
const handleClick = useCallback(
91-
(node: NodeObject) => {
92-
dataFetcher(node.id);
93-
},
94-
[dataFetcher]
95-
);
96-
9780
if (selectedNode) {
9881
const sn = graphData.nodes.find((node) => node.id === selectedNode.value);
9982
if (sn && fgRef.current) {

components/layout/header.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { useContext, useState } from "react";
44
import Image from "next/image";
55
import { MoonIcon, SunIcon, Bars3Icon } from "@heroicons/react/24/solid";
6-
import GuacVizThemeContext from "@/store/themeContext";
6+
import GuacVizThemeContext from "@/app/themeContext";
77
import Link from "next/link";
88
import packageJson from "../../package.json";
99

@@ -13,7 +13,7 @@ export default function Header() {
1313

1414
function NavigationLinks() {
1515
return (
16-
<>
16+
<div className="flex flex-col md:flex-row">
1717
<a
1818
className="block py-1 text-sm text-gray-800 dark:text-stone-300 hover:bg-white dark:hover:bg-black rounded-xl p-3 my-2"
1919
href="https://github.com/guacsec/guac-visualizer"
@@ -34,12 +34,12 @@ export default function Header() {
3434
>
3535
Community
3636
</a>
37-
</>
37+
</div>
3838
);
3939
}
4040

4141
return (
42-
<>
42+
<div>
4343
<div className="flex justify-between bg-stone-200 dark:bg-stone-800 text-zinc-600 px-4 md:px-8 py-4 items-center backdrop-blur-sm w-full font-mono transition-colors duration-500">
4444
<div className="flex items-center">
4545
<Link href="/">
@@ -94,6 +94,6 @@ export default function Header() {
9494
<NavigationLinks />
9595
</div>
9696
)}
97-
</>
97+
</div>
9898
);
9999
}

components/queryvuln/queryVuln.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const QueryCertifyVuln: React.FC = () => {
4747

4848
setGraphData(firstResultId);
4949
}
50-
}, [results]);
50+
}, [setGraphData, results]);
5151

5252
return (
5353
<div className="container mx-auto p-4">

docs/setup.md

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ the GUAC services. It acts as a way to visualize the software supply chain graph
77
as well as a means to explore the supply chain, and prototype policies.
88

99
Since the GUAC Visaulizer is still in an early experimental stage, it is likely
10-
that there may be some unexpected behavior or usage problems. For a more robust
11-
use of GUAC, we recommend using the [GraphQL interface directly](https://github.com/guacsec/guac/blob/main/demo/GraphQL.md).
10+
that there may be some unexpected behavior or usage problems. We recommend using the [GraphQL interface directly](https://github.com/guacsec/guac/blob/main/demo/GraphQL.md). Feedback is welcome as we continue to improve the visualizer!
1211

1312
## Requirements
1413

@@ -22,83 +21,44 @@ use of GUAC, we recommend using the [GraphQL interface directly](https://github.
2221
To use the GUAC visualizer, you need to have the main GUAC server running. For more information on how to do this, click
2322
[here](https://docs.guac.sh/getting-started/).
2423

25-
## Getting started
24+
## Step 1. Getting started
2625

27-
If you already haven't, clone the GUAC visualizer repo. We highly suggest
28-
cloning it in the same path as you clone the main
29-
[GUAC repo](https://github.com/guacsec/guac).
26+
Get the
27+
[source code for guac-visualizer `v0.3.0` here:](https://github.com/guacsec/guac-visualizer/releases/tag/v0.3.0)
3028

31-
```bash
32-
git clone [email protected]:guacsec/guac-visualizer.git
33-
```
34-
35-
Change directories into the repo.
29+
`cd` into it:
3630

3731
```bash
3832
cd guac-visualizer
3933
```
4034

41-
All commands run throughout this guide should be in this working directory.
42-
43-
## Running the visualizer from source
44-
45-
Install the dependencies:
35+
## Step 2. Install dependencies
4636

4737
```bash
4838
yarn install
4939
```
5040

51-
The output should look like:
52-
53-
````
54-
$ yarn install
55-
yarn install v1.22.19
56-
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
57-
[1/4] 🔍 Resolving packages...
58-
[2/4] 🚚 Fetching packages...
59-
warning Pattern ["@apollo/client@latest"] is trying to unpack in the same destination "/Users/lumb/Library/Caches/Yarn/v6/npm-@apollo-client-3.7.12-9ddd355d0788374cdb900e5f40298b196176952b-integrity/node_modules/@apollo/client" as pattern ["@apollo/client@^3.7.10"]. This could result in non-deterministic behavior, skipping.
60-
[3/4] 🔗 Linking dependencies...
61-
warning "@graphql-codegen/cli > @graphql-tools/code-file-loader > @graphql-tools/graphql-tag-pluck > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
62-
warning " > @graphql-codegen/[email protected]" has unmet peer dependency "graphql-tag@^2.0.0".
63-
warning "cosmos-over-cytoscape > [email protected]" has unmet peer dependency "webpack@^5.20.0".
64-
warning " > [email protected]" has incorrect peer dependency "react@>=16.8.25 <=16.13.1".
65-
warning " > [email protected]" has incorrect peer dependency "react-dom@>=16.8.25 <= 16.13.1".
66-
warning " > react-paginated-list@```markdown
67-
1.1.6" has incorrect peer dependency "react-scripts@>=2.1.8 <=3.4.1".
68-
[4/4] 🔨 Building fresh packages...
69-
70-
success Saved lockfile.
71-
✨ Done in 28.68s.
72-
````
73-
74-
## Configuration
75-
76-
By default, the GUAC Visualizer assumes that the GraphQL server is running on http://localhost:8080/query. However, you can optionally configure the visualizer to connect to a different GraphQL endpoint or to read from a `guac.yaml` config file from your curent working directory.
77-
78-
## Running the visualizer locally:
41+
## Step 3. Run the visualizer locally:
7942

8043
```bash
8144
yarn dev
8245
```
8346

84-
The output should look like:
47+
You can then go to [localhost:3000](http://localhost:3000) in your browser to
48+
start using the visualizer.
8549

8650
```
87-
$ yarn dev
88-
yarn run v1.22.19
51+
...
52+
8953
$ next dev
9054
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
9155
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
92-
```
9356
94-
You can then go to [localhost:3000](http://localhost:3000) in your browser to
95-
see the graph visualization.
57+
...
58+
```
9659

9760
<hr />
98-
<br />
99-
100-
### Using the GUAC visualizer will look something like this:
10161

102-
<br />
62+
**Using the GUAC visualizer will look something like this:**
10363

104-
![image](https://github.com/guacsec/guac-visualizer/assets/68356865/0b5460e2-0252-4ba6-8052-bb3426956410)
64+
![image](https://github.com/guacsec/guac-visualizer/assets/68356865/420c523e-9774-4a4f-82c1-b7e1d29ba9ac)

0 commit comments

Comments
 (0)