read from target dir and look up metadata from csv
This commit is contained in:
@@ -201,6 +201,7 @@ function buildCalendarScheduleData(currentScheduleData = {}, previousScheduleDat
|
||||
}
|
||||
|
||||
const DEFAULT_SETTINGS = {
|
||||
targetDir: '',
|
||||
p2pCoeCsvPath: '',
|
||||
p3pCsvPath: '',
|
||||
refResultDir: '',
|
||||
@@ -394,11 +395,13 @@ export default function App() {
|
||||
.split(',').map(s => s.trim()).filter(Boolean)
|
||||
await api.saveHolidays(holidayDates)
|
||||
|
||||
if (sanitizedSettings.p2pCoeCsvPath?.trim()) {
|
||||
await api.loadCsv(sanitizedSettings.p2pCoeCsvPath.trim())
|
||||
}
|
||||
if (sanitizedSettings.p3pCsvPath?.trim()) {
|
||||
await api.loadCsv(sanitizedSettings.p3pCsvPath.trim())
|
||||
const csvPaths = [
|
||||
sanitizedSettings.p2pCoeCsvPath?.trim(),
|
||||
sanitizedSettings.p3pCsvPath?.trim(),
|
||||
].filter(Boolean)
|
||||
|
||||
if (csvPaths.length > 0) {
|
||||
await api.loadCsv(csvPaths, sanitizedSettings.targetDir?.trim() ?? '')
|
||||
}
|
||||
|
||||
setSettings(sanitizedSettings)
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ export const api = {
|
||||
saveHolidays: (dates) => request('POST', '/holidays', { dates }),
|
||||
|
||||
// Tests
|
||||
loadCsv: (csv_path) => request('POST', '/tests/load', { csv_path }),
|
||||
loadCsv: (csv_paths, target_dir) => request('POST', '/tests/load', { csv_paths, target_dir }),
|
||||
|
||||
// Schedule
|
||||
compileSchedule: (opts) => request('POST', '/schedule/compile', opts),
|
||||
|
||||
@@ -97,6 +97,15 @@ export default function SettingsModal({ isOpen, onClose, settings, onSave, onRes
|
||||
File Paths
|
||||
</p>
|
||||
<div className="flex flex-col gap-3">
|
||||
<Field label="Target Directory" required>
|
||||
<input
|
||||
type="text"
|
||||
className={INPUT_CLS}
|
||||
placeholder="/path/to/target/directory"
|
||||
value={form.targetDir ?? ''}
|
||||
onChange={(e) => set('targetDir', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="P2P / COE CSV" required>
|
||||
<input
|
||||
type="text"
|
||||
|
||||
Reference in New Issue
Block a user