MCPcopy Create free account
hub / github.com/Snapchat/dagger-browser / GraphBrowser

Function GraphBrowser

browser/src/components/GraphBrowser.tsx:27–181  ·  view source on GitHub ↗
({ graphManager, weightServiceManager, componentName }: Props)

Source from the content-addressed store, hash-verified

25}
26
27export const GraphBrowser = ({ graphManager, weightServiceManager, componentName }: Props) => {
28 const graph = useMemo(() => componentName && graphManager.getComponent(componentName), [
29 graphManager,
30 componentName
31 ]);
32
33 const history = useHistory();
34
35 const weightService = weightServiceManager.getWeightService();
36
37 const includeWeightSelector = weightServiceManager.getWeightServiceNames().length > 1;
38
39 return (
40 <div>
41 <div className="container">
42 <div className="row search-bar">
43 <div className={classNames("col", includeWeightSelector ? "s9": "s12")}>
44 <NodeAutosuggest
45 graphManager={graphManager}
46 weightService={weightService}
47 componentName={graph && graph.name}
48 onSelect={(componentName, node) =>
49 history.push(Routes.GraphNode(componentName || "", node))
50 }
51 />
52 </div>
53 {includeWeightSelector &&
54 <div className="col s3">
55 <WeightSelector
56 weightServiceManager={weightServiceManager}
57 onSelectWeight={weight => {
58 weightServiceManager.selectWeightService(weight);
59 // Refresh the app state without affecting history.
60 history.replace('#');
61 }
62 }
63 />
64 </div>
65 }
66 </div>
67 <Switch>
68 <Route
69 path={Paths.Module}
70 render={props => (
71 <ModuleSummary
72 graphManager={graphManager}
73 weightService={weightService}
74 moduleName={decodeURIComponent(props.match.params.module as string)}
75 componentName={componentName}
76 />
77 )}
78 ></Route>
79 <Route
80 path={Paths.GraphModule}
81 render={props => (
82 <ModuleSummary
83 graphManager={graphManager}
84 weightService={weightService}

Callers

nothing calls this directly

Calls 4

getComponentMethod · 0.80
getWeightServiceMethod · 0.80
getWeightServiceNamesMethod · 0.80
selectWeightServiceMethod · 0.80

Tested by

no test coverage detected