| 14 | }; |
| 15 | |
| 16 | export function ModuleSummary({ componentName, moduleName, graphManager, weightService }: Props) { |
| 17 | const graphModule = graphManager.getModule(componentName, moduleName); |
| 18 | const history = useHistory(); |
| 19 | |
| 20 | if (!graphModule) { |
| 21 | return ( |
| 22 | <div> |
| 23 | Cannot find ${graphModule} module in ${componentName} graph |
| 24 | </div> |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | return ( |
| 29 | <div className="card"> |
| 30 | <div className="card-content"> |
| 31 | <div className="card-title"> |
| 32 | Module: {graphModule.key} |
| 33 | </div> |
| 34 | |
| 35 | <h6>Bindings</h6> |
| 36 | {graphModule.bindings.map(node => { |
| 37 | return ( |
| 38 | <NodeLink |
| 39 | key={node!.key} |
| 40 | weight={weightService.getWeight(ALL_COMPONENTS, node!.key)} |
| 41 | scoped={true} |
| 42 | node={node!} |
| 43 | onSelect={node => { |
| 44 | history.push(Routes.GraphNode(componentName, node)); |
| 45 | }} |
| 46 | /> |
| 47 | ); |
| 48 | })} |
| 49 | </div> |
| 50 | </div> |
| 51 | ); |
| 52 | } |