[32788f42] Keine Zusammenfassung angegeben.
Keine Zusammenfassung angegeben.
This commit is contained in:
@@ -41,9 +41,24 @@ function App() {
|
||||
const [reminderTaskId, setReminderTaskId] = useState<string | null>(null);
|
||||
const [reminderProgress, setReminderProgress] = useState<string>('');
|
||||
const [isReminderRunning, setIsReminderRunning] = useState(false);
|
||||
const [latestFile, setLatestFile] = useState<any>(null);
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://192.168.178.6:8002';
|
||||
|
||||
const fetchLatestFile = async () => {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/api/jobs/latest-file`);
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
if (data.has_file) {
|
||||
setLatestFile(data);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to fetch latest file info");
|
||||
}
|
||||
};
|
||||
|
||||
const fetchJobs = async (account: AccountType, forceRefresh = false) => {
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
@@ -67,6 +82,7 @@ function App() {
|
||||
if (jobsCache[activeTab] === null) {
|
||||
fetchJobs(activeTab, false);
|
||||
}
|
||||
fetchLatestFile();
|
||||
}, [activeTab]);
|
||||
|
||||
const handleRefresh = () => fetchJobs(activeTab, true);
|
||||
@@ -179,6 +195,7 @@ function App() {
|
||||
// da wir bei window.open nicht wissen, wann der Download fertig ist.
|
||||
setTimeout(() => {
|
||||
setProcessingJobId(null);
|
||||
fetchLatestFile();
|
||||
}, 3000);
|
||||
|
||||
} catch (err: any) {
|
||||
@@ -227,6 +244,7 @@ function App() {
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
fetchLatestFile();
|
||||
}, 100);
|
||||
} catch (err: any) {
|
||||
setError(err.message);
|
||||
@@ -244,6 +262,7 @@ function App() {
|
||||
|
||||
setTimeout(() => {
|
||||
setIsListGenerating(false);
|
||||
fetchLatestFile();
|
||||
}, 3000);
|
||||
} catch (err: any) {
|
||||
setError(`Listen-Fehler (${job.name}): ${err.message}`);
|
||||
@@ -272,6 +291,7 @@ function App() {
|
||||
const handleDownloadReminderCsv = async (taskId: string) => {
|
||||
try {
|
||||
window.open(`${API_BASE_URL}/api/tasks/${taskId}/download-csv`, '_blank');
|
||||
setTimeout(fetchLatestFile, 2000);
|
||||
} catch (err: any) {
|
||||
setError("Download fehlgeschlagen.");
|
||||
}
|
||||
@@ -296,6 +316,21 @@ function App() {
|
||||
<svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 19l-7-7m0 0l7-7m-7 7h18" /></svg>
|
||||
Zum Dashboard
|
||||
</a>
|
||||
|
||||
{latestFile && (
|
||||
<div className="hidden lg:flex items-center gap-2">
|
||||
<span className="text-xs text-gray-400">Letzte Datei:</span>
|
||||
<a
|
||||
href={`${API_BASE_URL}/api/jobs/download-latest`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-xs font-bold text-emerald-600 hover:text-emerald-700 underline flex items-center gap-1"
|
||||
>
|
||||
<svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 16v1a2 2 0 002 2h12a2 2 0 002-2v-1m-4-4l-4 4m0 0l-4-4m4 4V4" /></svg>
|
||||
{latestFile.display_name} ({latestFile.timestamp})
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Main Tabs */}
|
||||
|
||||
Reference in New Issue
Block a user