- Backend: logs export endpoint for CSV and Markdown formats - Frontend: ExportLogsModal with download button on run detail page - Updated i18n and CHANGELOG - Version bump: 1.9.1 -> 1.10.0
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
import { useTranslation } from 'react-i18next';
|
|
import { X, Download } from 'lucide-react';
|
|
import { Modal, Button } from '../../ui';
|
|
import styles from './ExportLogsModal.module.css';
|
|
|
|
export type LogExportFormat = 'md' | 'csv';
|
|
|
|
export interface ExportLogsModalProps {
|
|
open: boolean;
|
|
format: LogExportFormat;
|
|
onFormatChange: (format: LogExportFormat) => void;
|
|
onClose: () => void;
|
|
onExport: () => void;
|
|
isExporting: boolean;
|
|
}
|
|
|
|
export function ExportLogsModal({
|
|
open,
|
|
format,
|
|
onFormatChange,
|
|
onClose,
|
|
onExport,
|
|
isExporting,
|
|
}: ExportLogsModalProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<Modal
|
|
open={open}
|
|
title={t('runs.export_logs_modal_title')}
|
|
onClose={() => !isExporting && onClose()}
|
|
footer={
|
|
<>
|
|
<Button variant="secondary" onClick={onClose} disabled={isExporting}>
|
|
<X size={14} />
|
|
{t('common.button_cancel')}
|
|
</Button>
|
|
<Button variant="primary" onClick={onExport} disabled={isExporting}>
|
|
<Download size={14} />
|
|
{t('runs.action_export')}
|
|
</Button>
|
|
</>
|
|
}
|
|
>
|
|
<div className={styles.section}>
|
|
<h4 className={styles.sectionTitle}>{t('runs.export_logs_format')}</h4>
|
|
<label className={styles.radioRow}>
|
|
<input
|
|
type="radio"
|
|
name="log-export-format"
|
|
checked={format === 'md'}
|
|
onChange={() => onFormatChange('md')}
|
|
/>
|
|
<span>{t('runs.export_logs_format_md')}</span>
|
|
</label>
|
|
<label className={styles.radioRow}>
|
|
<input
|
|
type="radio"
|
|
name="log-export-format"
|
|
checked={format === 'csv'}
|
|
onChange={() => onFormatChange('csv')}
|
|
/>
|
|
<span>{t('runs.export_logs_format_csv')}</span>
|
|
</label>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
}
|