#!/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.Tabs: The results dashboard component tabs. """ # Create a Tabs component directly instead of wrapping in a Group results_tabs = gr.Tabs(visible=False) # Executive Summary Tab with results_tabs: with gr.TabItem("Executive Summary"): gr.Markdown("### 📊 Analysis Results") 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.TabItem("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.TabItem("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.TabItem("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.TabItem("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_tabs