diff --git a/Website/modules/Footer.tsx b/Website/modules/Footer.tsx index 1213ea9..b65bf17 100644 --- a/Website/modules/Footer.tsx +++ b/Website/modules/Footer.tsx @@ -2,17 +2,19 @@ import React, {useEffect} from 'react'; import '../styles/footer.css'; import {Job} from './Job'; import Icon from '@mdi/react'; -import { mdiRun, mdiCounter, mdiEyeCheck } from '@mdi/js'; +import { mdiRun, mdiCounter, mdiEyeCheck, mdiTrayFull } from '@mdi/js'; -export default function Footer(){ +export default function Footer({showQueue} : {showQueue(): void}){ const [MonitoringJobsCount, setMonitoringJobsCount] = React.useState(0); const [AllJobsCount, setAllJobsCount] = React.useState(0); const [RunningJobsCount, setRunningJobsCount] = React.useState(0); + const [StandbyJobsCount, setStandbyJobsCount] = React.useState(0); function UpdateBackendState(){ Job.GetMonitoringJobs().then((jobs) => setMonitoringJobsCount(jobs.length)); Job.GetAllJobs().then((jobs) => setAllJobsCount(jobs.length)); Job.GetRunningJobs().then((jobs) => setRunningJobsCount(jobs.length)); + Job.GetStandbyJobs().then((jobs) => setStandbyJobsCount(jobs.length)); } useEffect(() => { @@ -20,10 +22,11 @@ export default function Footer(){ }, []); return ( - ) + ) } \ No newline at end of file diff --git a/Website/modules/Job.tsx b/Website/modules/Job.tsx index bb261f7..fcacf56 100644 --- a/Website/modules/Job.tsx +++ b/Website/modules/Job.tsx @@ -37,6 +37,17 @@ export class Job }); } + static async GetStandbyJobs(): Promise { + console.info("Getting all standby Jobs"); + return getData("http://127.0.0.1:6531/v2/Jobs/Standby") + .then((json) => { + console.info("Got all standby Jobs"); + const ret = json as string[]; + console.debug(ret); + return (ret); + }); + } + static async GetMonitoringJobs(): Promise { console.info("Getting all monitoring Jobs"); return getData("http://127.0.0.1:6531/v2/Jobs/Monitoring") diff --git a/Website/modules/MonitorJobsList.tsx b/Website/modules/MonitorJobsList.tsx index 1536330..d6c0214 100644 --- a/Website/modules/MonitorJobsList.tsx +++ b/Website/modules/MonitorJobsList.tsx @@ -22,7 +22,8 @@ export default function MonitorJobsList({onStartSearch, onJobsChanged} : {onStar MonitoringJobs.forEach(job => { if(AllManga.find(manga => manga.internalId == job.mangaInternalId)) return; - Manga.GetMangaById(job.mangaInternalId).then((manga: IManga) => setAllManga([...AllManga, manga])); + Manga.GetMangaById(job.mangaInternalId != undefined ? job.mangaInternalId : job.chapter != undefined ? job.chapter.parentManga.internalId : ""). + then((manga: IManga) => setAllManga([...AllManga, manga])); }); }, [MonitoringJobs]); diff --git a/Website/modules/interfaces/IJob.tsx b/Website/modules/interfaces/IJob.tsx index 30b9fb9..85baf23 100644 --- a/Website/modules/interfaces/IJob.tsx +++ b/Website/modules/interfaces/IJob.tsx @@ -1,16 +1,28 @@ import IMangaConnector from "./IMangaConnector"; import IProgressToken from "./IProgressToken"; +import IChapter from "./IChapter"; export default interface IJob{ - jobType: number; - mangaInternalId: string; - translatedLanguage: string; progressToken: IProgressToken; recurring: boolean; recurrenceTime: string; lastExecution: Date; nextExecution: Date; id: string; + jobType: number; parentJobId: string | null; mangaConnector: IMangaConnector; + mangaInternalId: string | undefined; //only on DownloadNewChapters + translatedLanguage: string | undefined; //only on DownloadNewChapters + chapter: IChapter | undefined; //only on DownloadChapter +} + +export function JobTypeFromNumber(n: number): string { + switch(n) { + case 0: return "Download Chapter"; + case 1: return "Download New Chapters"; + case 2: return "Update Metadata"; + case 3: return "Monitor"; + } + return ""; } \ No newline at end of file diff --git a/Website/styles/footer.css b/Website/styles/footer.css index bdb38cd..50393a8 100644 --- a/Website/styles/footer.css +++ b/Website/styles/footer.css @@ -33,4 +33,8 @@ footer div { footer div > * { margin: 0 2px; padding: 3px 0; +} + +footer .hoverHand { + cursor: pointer; } \ No newline at end of file