-
Notifications
You must be signed in to change notification settings - Fork 9
Improve network data display #298
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -687,8 +687,199 @@ def update_visualization( | |
| @app.callback( | ||
| Output('info-panel', 'children'), [Input('cytoscape', 'tapNodeData'), Input('cytoscape', 'tapEdgeData')] | ||
| ) | ||
| def display_element_info(node_data, edge_data): | ||
| def display_element_data(node_data, edge_data): | ||
| ctx = callback_context | ||
|
|
||
| def display_node_info(data): | ||
| """Display node information""" | ||
| node_id = data['id'] | ||
| label = data.get('label', node_id) # Use label if available | ||
| parameters = data.get('parameters', '') | ||
|
|
||
| components = [ | ||
| html.H4( | ||
| f'Node: {node_id}', | ||
| style={ | ||
| 'color': 'white', | ||
| 'margin-bottom': '10px', | ||
| 'margin-top': '5px', | ||
| 'border-bottom': '1px solid #3498DB', | ||
| 'padding-bottom': '5px', | ||
| }, | ||
| ) | ||
| ] | ||
|
|
||
| # Add label if it's different from the ID | ||
| if label and label != node_id: | ||
| components.append( | ||
| html.Div( | ||
| [ | ||
| html.Strong('Label: ', style={'color': '#3498DB'}), | ||
| html.Span(label, style={'color': '#BDC3C7'}), | ||
| ], | ||
| style={'margin': '8px 0', 'line-height': '1.4'}, | ||
| ) | ||
| ) | ||
|
|
||
| # Add parameters section | ||
| if parameters: | ||
| components.append( | ||
| html.Div( | ||
| [ | ||
| html.Strong( | ||
| 'Parameters:', style={'color': '#3498DB', 'display': 'block', 'margin-bottom': '5px'} | ||
| ) | ||
| ] | ||
| ) | ||
| ) | ||
|
|
||
| if isinstance(parameters, str): | ||
| lines = parameters.split('\n') | ||
| for line in lines: | ||
| if line.strip(): | ||
| components.append( | ||
| html.Div( | ||
| line, | ||
| style={ | ||
| 'color': '#BDC3C7', | ||
| 'margin': '3px 0', | ||
| 'font-family': 'monospace', | ||
| 'font-size': '12px', | ||
| 'line-height': '1.3', | ||
| 'white-space': 'pre-wrap', | ||
| 'padding-left': '10px', | ||
| }, | ||
| ) | ||
| ) | ||
| else: | ||
| components.append(html.Div(style={'height': '8px'})) | ||
| elif isinstance(parameters, dict): | ||
| for k, v in parameters.items(): | ||
| components.append( | ||
| html.Div( | ||
| f'{k}: {v}', | ||
| style={ | ||
| 'color': '#BDC3C7', | ||
| 'margin': '3px 0', | ||
| 'font-family': 'monospace', | ||
| 'font-size': '12px', | ||
| 'line-height': '1.3', | ||
| 'padding-left': '10px', | ||
| }, | ||
| ) | ||
| ) | ||
| else: | ||
| components.append( | ||
| html.Div( | ||
| str(parameters), | ||
| style={ | ||
| 'color': '#BDC3C7', | ||
| 'font-family': 'monospace', | ||
| 'font-size': '12px', | ||
| 'white-space': 'pre-wrap', | ||
| 'padding-left': '10px', | ||
| }, | ||
| ) | ||
| ) | ||
|
|
||
| return components | ||
|
|
||
| def display_edge_info(data): | ||
| """Display edge information""" | ||
| source = data.get('source', '') | ||
| target = data.get('target', '') | ||
| label = data.get('label', '') | ||
| parameters = data.get('parameters', '') | ||
|
|
||
| components = [ | ||
| html.H4( | ||
| f'Edge: {source} → {target}', | ||
| style={ | ||
| 'color': 'white', | ||
| 'margin-bottom': '10px', | ||
| 'margin-top': '5px', | ||
| 'border-bottom': '1px solid #E67E22', | ||
| 'padding-bottom': '5px', | ||
| }, | ||
| ) | ||
| ] | ||
|
|
||
| # Add label section (same formatting as nodes) | ||
| if label: | ||
| components.append( | ||
| html.Div( | ||
| [ | ||
| html.Strong('Label: ', style={'color': '#E67E22'}), | ||
| html.Span(label, style={'color': '#BDC3C7'}), | ||
| ], | ||
| style={'margin': '8px 0', 'line-height': '1.4'}, | ||
| ) | ||
| ) | ||
|
|
||
| # Add parameters section (same formatting as nodes) | ||
| if parameters: | ||
| components.append( | ||
| html.Div( | ||
| [ | ||
| html.Strong( | ||
| 'Parameters:', style={'color': '#E67E22', 'display': 'block', 'margin-bottom': '5px'} | ||
| ) | ||
| ] | ||
| ) | ||
| ) | ||
|
|
||
| if isinstance(parameters, str): | ||
| lines = parameters.split('\n') | ||
| for line in lines: | ||
| if line.strip(): | ||
| components.append( | ||
| html.Div( | ||
| line, | ||
| style={ | ||
| 'color': '#BDC3C7', | ||
| 'margin': '3px 0', | ||
| 'font-family': 'monospace', | ||
| 'font-size': '12px', | ||
| 'line-height': '1.3', | ||
| 'white-space': 'pre-wrap', | ||
| 'padding-left': '10px', | ||
| }, | ||
| ) | ||
| ) | ||
| else: | ||
| components.append(html.Div(style={'height': '8px'})) | ||
| elif isinstance(parameters, dict): | ||
| for k, v in parameters.items(): | ||
| components.append( | ||
| html.Div( | ||
| f'{k}: {v}', | ||
| style={ | ||
| 'color': '#BDC3C7', | ||
| 'margin': '3px 0', | ||
| 'font-family': 'monospace', | ||
| 'font-size': '12px', | ||
| 'line-height': '1.3', | ||
| 'padding-left': '10px', | ||
| }, | ||
| ) | ||
| ) | ||
| else: | ||
| components.append( | ||
| html.Div( | ||
| str(parameters), | ||
| style={ | ||
| 'color': '#BDC3C7', | ||
| 'font-family': 'monospace', | ||
| 'font-size': '12px', | ||
| 'white-space': 'pre-wrap', | ||
| 'padding-left': '10px', | ||
| }, | ||
| ) | ||
| ) | ||
|
|
||
| return components | ||
|
Comment on lines
+787
to
+880
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Helper function defined but never called. Like To activate the new helper, replace lines 900-910 with: elif ctx.triggered[0]['prop_id'] == 'cytoscape.tapEdgeData' and edge_data:
- return [
- html.H5(
- f'Edge: {edge_data.get("label", "Unknown")}', style={'color': 'white', 'margin-bottom': '10px'}
- ),
- html.P(f'{edge_data.get("source", "")} → {edge_data.get("target", "")}', style={'color': '#E67E22'}),
- html.Pre(
- edge_data.get('parameters', 'No parameters'),
- style={'color': '#BDC3C7', 'font-size': '11px', 'white-space': 'pre-wrap'},
- ),
- ]
+ return display_edge_info(edge_data)🤖 Prompt for AI Agents |
||
|
|
||
| # Check which input triggered the callback | ||
| if not ctx.triggered: | ||
| return [ | ||
| html.P('Click on a node or edge to see details.', style={'color': '#95A5A6', 'font-style': 'italic'}) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Helper function defined but never called.
The
display_node_infohelper is defined but never invoked. The callback at lines 889-899 still uses the old simple rendering logic instead of calling this new helper. This means the structured HTML rendering introduced by this PR is not actually active.To activate the new helper, replace lines 889-899 with:
🤖 Prompt for AI Agents