#!/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 |