| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Export Manager Component | |
| This module provides the UI component for exporting the code review results in various formats. | |
| """ | |
| import gradio as gr | |
| import logging | |
| logger = logging.getLogger(__name__) | |
| def create_export_manager(): | |
| """ | |
| Create the export manager component. | |
| Returns: | |
| list: A list of tuples containing (export_button, export_format). | |
| """ | |
| export_buttons = [] | |
| export_formats = [] | |
| with gr.Group(): | |
| gr.Markdown("### π€ Export Results") | |
| with gr.Row(): | |
| # JSON Export | |
| json_btn = gr.Button("Export as JSON", variant="secondary") | |
| json_format = gr.Textbox(value="json", visible=False) | |
| export_buttons.append((json_btn, json_format)) | |
| export_formats.append(json_format) | |
| # HTML Export | |
| html_btn = gr.Button("Export as HTML", variant="secondary") | |
| html_format = gr.Textbox(value="html", visible=False) | |
| export_buttons.append((html_btn, html_format)) | |
| export_formats.append(html_format) | |
| # CSV Export | |
| csv_btn = gr.Button("Export as CSV", variant="secondary") | |
| csv_format = gr.Textbox(value="csv", visible=False) | |
| export_buttons.append((csv_btn, csv_format)) | |
| export_formats.append(csv_format) | |
| return export_buttons |