File size: 1,631 Bytes
88d205f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Progress Tracker Component

This module provides the UI component for tracking the progress of the code review process.
"""

import gradio as gr
import logging

logger = logging.getLogger(__name__)


def create_progress_tracker():
    """
    Create the progress tracker component.
    
    Returns:
        tuple: A tuple containing (overall_progress, status_message, step_progress_dict)
    """
    # Overall progress bar
    overall_progress = gr.Slider(
        minimum=0,
        maximum=100,
        value=0,
        label="Overall Progress",
        interactive=False,
    )
    
    # Status message
    status_message = gr.Markdown(
        "*Initializing...*"
    )
    
    # Detailed progress steps
    steps = [
        "Repository Cloning",
        "Language Detection",
        "Code Analysis",
        "Security Scanning",
        "Performance Analysis",
        "AI Review",
        "Report Generation"
    ]
    
    with gr.Accordion("Detailed Progress", open=False):
        step_progress = {}
        for step in steps:
            with gr.Row(variant="panel"):
                with gr.Column(scale=1, min_width=150):
                    gr.Markdown(f"**{step}**")
                with gr.Column(scale=4):
                    step_progress[step] = gr.Slider(
                        minimum=0,
                        maximum=100,
                        value=0,
                        label="",
                        interactive=False,
                        scale=2
                    )
    
    return overall_progress, status_message, step_progress