feat: upload Excel via explorateur de fichier dans le VWB

- Bouton "Parcourir..." ouvre l'explorateur natif du navigateur
- Upload vers /api/v3/upload-excel, sauvegarde dans data/uploads/
- Nom de table auto-suggéré depuis le nom du fichier

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-03-16 23:17:05 +01:00
parent 9da804bb6e
commit 97cb2957d5
2 changed files with 98 additions and 7 deletions

View File

@@ -1033,13 +1033,55 @@ export default function PropertiesPanel({ step, onUpdateParams, onDelete }: Prop
<span className="icon">📥</span> Import Excel
</div>
<div className="prop-field">
<label>Chemin du fichier Excel</label>
<input
type="text"
value={String(params.file_path || '')}
onChange={(e) => updateParam('file_path', e.target.value)}
placeholder="/chemin/vers/fichier.xlsx"
/>
<label>Fichier Excel</label>
<div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
<input
type="text"
value={String(params.file_path || '')}
onChange={(e) => updateParam('file_path', e.target.value)}
placeholder="Cliquez sur Parcourir..."
style={{ flex: 1 }}
readOnly
/>
<label style={{
padding: '6px 14px',
background: '#1976d2',
color: 'white',
borderRadius: '4px',
cursor: 'pointer',
fontSize: '13px',
whiteSpace: 'nowrap',
}}>
Parcourir...
<input
type="file"
accept=".xlsx,.xls"
style={{ display: 'none' }}
onChange={async (e) => {
const file = e.target.files?.[0];
if (!file) return;
const formData = new FormData();
formData.append('file', file);
try {
const resp = await fetch('/api/v3/upload-excel', {
method: 'POST',
body: formData,
});
const data = await resp.json();
if (data.path) {
updateParam('file_path', data.path);
if (!params.table_name) {
updateParam('table_name', data.suggested_table || '');
}
}
} catch (err) {
console.error('Upload failed:', err);
}
}}
/>
</label>
</div>
<small className="field-hint">Formats acceptés : .xlsx, .xls</small>
</div>
<div className="prop-field">
<label>Nom de la table (optionnel)</label>