code-review-agent / src /ui /components /results_dashboard.py
c1r3x's picture
Review Agent: Uploaded remaining files
aa300a4 verified
raw
history blame
4.07 kB
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Results Dashboard Component
This module provides the UI component for displaying the code review results.
"""
import gradio as gr
import logging
logger = logging.getLogger(__name__)
def create_results_dashboard():
"""
Create the results dashboard component.
Returns:
gr.Group: The results dashboard component group.
"""
with gr.Group(visible=False) as results_group:
gr.Markdown("### πŸ“Š Analysis Results")
# Executive Summary Tab
with gr.Tab("Executive Summary"):
with gr.Row():
with gr.Column(scale=2):
gr.Markdown("#### πŸ“ Overview")
summary_text = gr.Markdown("")
with gr.Column(scale=1):
gr.Markdown("#### πŸ“ˆ Key Metrics")
with gr.Row():
gr.Label("Code Quality Score", value="N/A")
with gr.Row():
gr.Label("Security Score", value="N/A")
with gr.Row():
gr.Label("Performance Score", value="N/A")
# Technical Details Tab
with gr.Tab("Technical Details"):
with gr.Accordion("Repository Structure", open=True):
repo_structure = gr.Markdown("")
with gr.Accordion("Language Breakdown", open=True):
language_breakdown = gr.BarPlot(
x="Language",
y="Lines of Code",
title="Language Distribution",
tooltip=["Language", "Lines of Code"],
height=300,
)
with gr.Accordion("Code Quality Issues", open=True):
quality_issues = gr.Dataframe(
headers=["File", "Line", "Issue", "Severity", "Description"],
datatype=["str", "number", "str", "str", "str"],
row_count=10,
)
# Security Analysis Tab
with gr.Tab("Security Analysis"):
with gr.Accordion("Vulnerabilities", open=True):
vulnerabilities = gr.Dataframe(
headers=["File", "Line", "Vulnerability", "Severity", "Description", "Recommendation"],
datatype=["str", "number", "str", "str", "str", "str"],
row_count=10,
)
with gr.Accordion("Dependency Issues", open=True):
dependency_issues = gr.Dataframe(
headers=["Package", "Current Version", "Recommended Version", "Vulnerability", "Severity"],
datatype=["str", "str", "str", "str", "str"],
row_count=10,
)
# Performance Analysis Tab
with gr.Tab("Performance Analysis"):
with gr.Accordion("Performance Hotspots", open=True):
performance_hotspots = gr.Dataframe(
headers=["File", "Function", "Issue", "Impact", "Recommendation"],
datatype=["str", "str", "str", "str", "str"],
row_count=10,
)
with gr.Accordion("Resource Usage", open=True):
resource_usage = gr.BarPlot(
x="Component",
y="Usage",
title="Resource Usage",
tooltip=["Component", "Usage"],
height=300,
)
# Recommendations Tab
with gr.Tab("Recommendations"):
with gr.Accordion("High Priority", open=True):
high_priority_recs = gr.Markdown("")
with gr.Accordion("Medium Priority", open=True):
medium_priority_recs = gr.Markdown("")
with gr.Accordion("Low Priority", open=True):
low_priority_recs = gr.Markdown("")
return results_group