Remove all logging from console

This commit is contained in:
glax 2024-10-20 20:16:32 +02:00
parent d97eff9796
commit 67bed57ab6
8 changed files with 55 additions and 55 deletions

View File

@ -49,7 +49,7 @@ export default function App(){
<hr/>
</>
: <></>}
<MonitorJobsList apiUri={apiUri} onStartSearch={() => setShowSearch(true)} onJobsChanged={() => console.info("jobsChanged")} connectedToBackend={connected} />
<MonitorJobsList apiUri={apiUri} onStartSearch={() => setShowSearch(true)} onJobsChanged={() => console.debug("jobsChanged")} connectedToBackend={connected} />
</>
: <h1>No connection to backend</h1>}
<Footer apiUri={apiUri} connectedToBackend={connected} />

View File

@ -9,10 +9,10 @@ export class Job
}
static async GetAllJobs(apiUri: string): Promise<string[]> {
console.info("Getting all Jobs");
//console.info("Getting all Jobs");
return getData(`${apiUri}/v2/Jobs`)
.then((json) => {
console.info("Got all Jobs");
//console.info("Got all Jobs");
const ret = json as string[];
//console.debug(ret);
return (ret);
@ -20,10 +20,10 @@ export class Job
}
static async GetRunningJobs(apiUri: string): Promise<string[]> {
console.info("Getting all running Jobs");
//console.info("Getting all running Jobs");
return getData(`${apiUri}/v2/Jobs/Running`)
.then((json) => {
console.info("Got all running Jobs");
//console.info("Got all running Jobs");
const ret = json as string[];
//console.debug(ret);
return (ret);
@ -31,10 +31,10 @@ export class Job
}
static async GetWaitingJobs(apiUri: string): Promise<string[]> {
console.info("Getting all waiting Jobs");
//console.info("Getting all waiting Jobs");
return getData(`${apiUri}/v2/Jobs/Waiting`)
.then((json) => {
console.info("Got all waiting Jobs");
//console.info("Got all waiting Jobs");
const ret = json as string[];
//console.debug(ret);
return (ret);
@ -42,10 +42,10 @@ export class Job
}
static async GetStandbyJobs(apiUri: string): Promise<string[]> {
console.info("Getting all standby Jobs");
//console.info("Getting all standby Jobs");
return getData(`${apiUri}/v2/Jobs/Standby`)
.then((json) => {
console.info("Got all standby Jobs");
//console.info("Got all standby Jobs");
const ret = json as string[];
//console.debug(ret);
return (ret);
@ -53,10 +53,10 @@ export class Job
}
static async GetMonitoringJobs(apiUri: string): Promise<string[]> {
console.info("Getting all monitoring Jobs");
//console.info("Getting all monitoring Jobs");
return getData(`${apiUri}/v2/Jobs/Monitoring`)
.then((json) => {
console.info("Got all monitoring Jobs");
//console.info("Got all monitoring Jobs");
const ret = json as string[];
//console.debug(ret);
return (ret);
@ -68,10 +68,10 @@ export class Job
console.error(`JobId was not provided`);
return Promise.reject();
}
console.info(`Getting Job ${jobId}`);
//console.info(`Getting Job ${jobId}`);
return getData(`${apiUri}/v2/Job/${jobId}`)
.then((json) => {
console.info(`Got Job ${jobId}`);
//console.info(`Got Job ${jobId}`);
const ret = json as IJob;
//console.debug(ret);
return (ret);
@ -84,10 +84,10 @@ export class Job
return Promise.reject();
}
let reqStr = jobIds.join(",");
console.info(`Getting Jobs ${reqStr}`);
//console.info(`Getting Jobs ${reqStr}`);
return getData(`${apiUri}/v2/Job?jobIds=${reqStr}`)
.then((json) => {
console.info(`Got Jobs ${reqStr}`);
//console.info(`Got Jobs ${reqStr}`);
const ret = json as IJob[];
//console.debug(ret);
return (ret);
@ -95,10 +95,10 @@ export class Job
}
static async GetJobProgress(apiUri: string, jobId: string): Promise<IProgressToken> {
console.info(`Getting Job ${jobId} Progress`);
//console.info(`Getting Job ${jobId} Progress`);
return getData(`${apiUri}/v2/Job/${jobId}/Progress`)
.then((json) => {
console.info(`Got Job ${jobId} Progress`);
//console.info(`Got Job ${jobId} Progress`);
const ret = json as IProgressToken;
//console.debug(ret);
return (ret);
@ -111,7 +111,7 @@ export class Job
static async CreateJob(apiUri: string, internalId: string, jobType: string, interval: string): Promise<null> {
const validate = /(?:[0-9]{1,2}\.)?[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?/
console.info(`Creating Job for Manga ${internalId} at ${interval} interval`);
//console.info(`Creating Job for Manga ${internalId} at ${interval} interval`);
if(!validate.test(interval)){
console.error("Interval was in incorrect format.");
return Promise.reject();
@ -122,7 +122,7 @@ export class Job
};
return postData(`${apiUri}/v2/Job/Create/${jobType}`, data)
.then((json) => {
console.info(`Created Job for Manga ${internalId} at ${interval} interval`);
//console.info(`Created Job for Manga ${internalId} at ${interval} interval`);
return null;
});
}

View File

@ -4,10 +4,10 @@ import { getData } from '../App';
export class Manga
{
static async GetAllManga(apiUri: string): Promise<IManga[]> {
console.info("Getting all Manga");
//console.info("Getting all Manga");
return getData(`${apiUri}/v2/Mangas`)
.then((json) => {
console.info("Got all Manga");
//console.info("Got all Manga");
const ret = json as IManga[];
//console.debug(ret);
return (ret);
@ -15,10 +15,10 @@ export class Manga
}
static async SearchManga(apiUri: string, name: string): Promise<IManga[]> {
console.info(`Getting Manga ${name} from all Connectors`);
//console.info(`Getting Manga ${name} from all Connectors`);
return await getData(`${apiUri}/v2/Manga/Search?title=${name}`)
.then((json) => {
console.info(`Got Manga ${name}`);
//console.info(`Got Manga ${name}`);
const ret = json as IManga[];
//console.debug(ret);
return (ret);
@ -26,10 +26,10 @@ export class Manga
}
static async GetMangaById(apiUri: string, internalId: string): Promise<IManga> {
console.info(`Getting Manga ${internalId}`);
//console.info(`Getting Manga ${internalId}`);
return await getData(`${apiUri}/v2/Manga/${internalId}`)
.then((json) => {
console.info(`Got Manga ${internalId}`);
//console.info(`Got Manga ${internalId}`);
const ret = json as IManga;
//console.debug(ret);
return (ret);
@ -37,10 +37,10 @@ export class Manga
}
static async GetMangaByIds(apiUri: string, internalIds: string[]): Promise<IManga[]> {
console.debug(`Getting Mangas ${internalIds.join(",")}`);
//console.debug(`Getting Mangas ${internalIds.join(",")}`);
return await getData(`${apiUri}/v2/Manga?mangaIds=${internalIds.join(",")}`)
.then((json) => {
console.debug(`Got Manga ${internalIds.join(",")}`);
//console.debug(`Got Manga ${internalIds.join(",")}`);
const ret = json as IManga[];
//console.debug(ret);
return (ret);
@ -48,7 +48,7 @@ export class Manga
}
static GetMangaCoverUrl(apiUri: string, internalId: string): string {
console.debug(`Getting Manga Cover-Url ${internalId}`);
//console.debug(`Getting Manga Cover-Url ${internalId}`);
return `${apiUri}/v2/Manga/${internalId}/Cover`;
}
}

View File

@ -5,28 +5,28 @@ import { getData } from '../App';
export class MangaConnector
{
static async GetAllConnectors(): Promise<IMangaConnector[]> {
console.info("Getting all MangaConnectors");
//console.info("Getting all MangaConnectors");
return getData("http://127.0.0.1:6531/v2/Connector/Types")
.then((json) => {
console.info("Got all MangaConnectors");
//console.info("Got all MangaConnectors");
return (json as IMangaConnector[]);
});
}
static async GetMangaFromConnectorByTitle(connector: IMangaConnector, name: string): Promise<IManga[]> {
console.info(`Getting Manga ${name}`);
//console.info(`Getting Manga ${name}`);
return await getData(`http://127.0.0.1:6531/v2/Connector/${connector.name}/GetManga?title=${name}`)
.then((json) => {
console.info(`Got Manga ${name}`);
//console.info(`Got Manga ${name}`);
return (json as IManga[]);
});
}
static async GetMangaFromConnectorByUrl(connector: IMangaConnector, url: string): Promise<IManga> {
console.info(`Getting Manga ${url}`);
//console.info(`Getting Manga ${url}`);
return await getData(`http://127.0.0.1:6531/v2/Connector/${connector.name}/GetManga?url=${url}`)
.then((json) => {
console.info(`Got Manga ${url}`);
//console.info(`Got Manga ${url}`);
return (json as IManga);
});
}

View File

@ -14,7 +14,7 @@ export default function MonitorJobsList({onStartSearch, onJobsChanged, connected
const [joblistUpdateInterval, setJoblistUpdateInterval] = React.useState<number>();
useEffect(() => {
console.debug("Updating display list.");
//console.debug("Updating display list.");
//Remove all Manga that are not associated with a Job
setAllManga(AllManga.filter(manga => MonitoringJobs.find(job => job.mangaInternalId == manga.internalId)));
//Fetch Manga that are missing (from Jobs)
@ -41,7 +41,7 @@ export default function MonitorJobsList({onStartSearch, onJobsChanged, connected
}, [connectedToBackend]);
function UpdateMonitoringJobsList(){
console.debug("Updating MonitoringJobsList");
//console.debug("Updating MonitoringJobsList");
Job.GetMonitoringJobs(apiUri)
.then((jobs) => {
if(jobs.length > 0)
@ -65,13 +65,13 @@ export default function MonitorJobsList({onStartSearch, onJobsChanged, connected
const DeleteJob : MouseEventHandler = (e) => {
const jobId = e.currentTarget.id.slice(e.currentTarget.id.indexOf("-")+1);
console.info(`Pressed ${e.currentTarget.id} => ${jobId}`);
//console.info(`Pressed ${e.currentTarget.id} => ${jobId}`);
Job.DeleteJob(apiUri, jobId).then(() => onJobsChanged(jobId));
}
const StartJob : MouseEventHandler = (e) => {
const jobId = e.currentTarget.id.slice(e.currentTarget.id.indexOf("-")+1);
console.info(`Pressed ${e.currentTarget.id} => ${jobId}`);
//console.info(`Pressed ${e.currentTarget.id} => ${jobId}`);
Job.StartJob(apiUri, jobId);
}

View File

@ -22,10 +22,10 @@ export default function QueuePopUp({children, apiUri} : {children: JSX.Element[]
return [];
})
.then((jobs) => {
console.debug("Removing Metadata Jobs");
console.log(StandbyJobs)
//console.debug("Removing Metadata Jobs");
//console.log(StandbyJobs)
setStandbyJobs(jobs.filter(job => job.jobType <= 1));
console.log(StandbyJobs)
//console.log(StandbyJobs)
});
Job.GetRunningJobs(apiUri)
.then((jobs) => {
@ -34,7 +34,7 @@ export default function QueuePopUp({children, apiUri} : {children: JSX.Element[]
return [];
})
.then((jobs) =>{
console.debug("Removing Metadata Jobs");
//console.debug("Removing Metadata Jobs");
setRunningJobs(jobs.filter(job => job.jobType <= 1));
});
}, []);
@ -43,7 +43,7 @@ export default function QueuePopUp({children, apiUri} : {children: JSX.Element[]
if(StandbyJobs.length < 1)
return;
const mangaIds = StandbyJobs.filter(job => job.jobType<=2).map((job) => job.mangaInternalId != undefined ? job.mangaInternalId : job.chapter != undefined ? job.chapter.parentManga.internalId : "");
console.debug(`Waiting mangaIds: ${mangaIds.join(",")}`);
//console.debug(`Waiting mangaIds: ${mangaIds.join(",")}`);
Manga.GetMangaByIds(apiUri, mangaIds)
.then(setStandbyJobsManga);
}, [StandbyJobs]);
@ -51,9 +51,9 @@ export default function QueuePopUp({children, apiUri} : {children: JSX.Element[]
useEffect(() => {
if(RunningJobs.length < 1)
return;
console.log(RunningJobs);
//console.log(RunningJobs);
const mangaIds = RunningJobs.filter(job => job.jobType<=2).map((job) => job.mangaInternalId != undefined ? job.mangaInternalId : job.chapter != undefined ? job.chapter.parentManga.internalId : "");
console.debug(`Running mangaIds: ${mangaIds.join(",")}`);
//console.debug(`Running mangaIds: ${mangaIds.join(",")}`);
Manga.GetMangaByIds(apiUri, mangaIds)
.then(setRunningJobsManga);
}, [RunningJobs]);
@ -79,7 +79,7 @@ export default function QueuePopUp({children, apiUri} : {children: JSX.Element[]
return <div key={"QueueJob-" + job.id}>Error. Could not find matching manga
for {job.id}</div>
return <div className="QueueJob" key={"QueueJob-" + job.id}>
<img src={Manga.GetMangaCoverUrl(apiUri, manga.internalId)}/>
<img src={Manga.GetMangaCoverUrl(apiUri, manga.internalId)} alt="Manga Cover" />
<p>{JobTypeFromNumber(job.jobType)}</p>
</div>;
})}
@ -94,7 +94,7 @@ export default function QueuePopUp({children, apiUri} : {children: JSX.Element[]
return <div key={"QueueJob-" + job.id}>Error. Could not find matching manga
for {job.id}</div>
return <div className="QueueJob" key={"QueueJob-" + job.id}>
<img src={Manga.GetMangaCoverUrl(apiUri, manga.internalId)}/>
<img src={Manga.GetMangaCoverUrl(apiUri, manga.internalId)} alt="Manga Cover" />
<p className="QueueJob-Name">{manga.sortName}</p>
<p className="QueueJob-JobType">{JobTypeFromNumber(job.jobType)}</p>
<p className="QueueJob-additional">{job.jobType == 0 ? `Vol.${job.chapter?.volumeNumber} Ch.${job.chapter?.chapterNumber}` : ""}</p>

View File

@ -60,7 +60,7 @@ export default function Search({createJob, closeSearch} : {createJob: (internalI
console.error("Tried initiating search while not all fields where submitted.")
return;
}
console.info(`Searching Name: ${searchBoxValue} Connector: ${selectedConnector.name} Language: ${selectedLanguage}`);
//console.info(`Searching Name: ${searchBoxValue} Connector: ${selectedConnector.name} Language: ${selectedLanguage}`);
if(isValidUri(searchBoxValue) && !selectedConnector.BaseUris.find((uri: string) => {
const match = searchBoxValue.match(pattern);
if(match === null)

View File

@ -1,5 +1,5 @@
import React, {KeyboardEventHandler, useEffect, useState} from 'react';
import IFrontendSettings, {FrontendSettingsWith} from "./interfaces/IFrontendSettings";
import IFrontendSettings from "./interfaces/IFrontendSettings";
import '../styles/settings.css';
import IBackendSettings from "./interfaces/IBackendSettings";
import {getData} from "../App";
@ -22,10 +22,10 @@ export default function Settings({backendConnected, apiUri, settings, changeSett
}, [showSettings]);
async function GetSettings(apiUri: string) : Promise<IBackendSettings> {
console.info("Getting Settings");
//console.info("Getting Settings");
return getData(`${apiUri}/v2/Settings`)
.then((json) => {
console.info("Got Settings");
//console.info("Got Settings");
const ret = json as IBackendSettings;
//console.debug(ret);
return (ret);
@ -34,10 +34,10 @@ export default function Settings({backendConnected, apiUri, settings, changeSett
}
async function GetLibraryConnectors(apiUri: string) : Promise<ILibraryConnector[]> {
console.info("Getting Library Connectors");
//console.info("Getting Library Connectors");
return getData(`${apiUri}/v2/LibraryConnector`)
.then((json) => {
console.info("Got Library Connectors");
//console.info("Got Library Connectors");
const ret = json as ILibraryConnector[];
//console.debug(ret);
return (ret);
@ -46,10 +46,10 @@ export default function Settings({backendConnected, apiUri, settings, changeSett
}
async function GetNotificationConnectors(apiUri: string) : Promise<INotificationConnector[]> {
console.info("Getting Notification Connectors");
//console.info("Getting Notification Connectors");
return getData(`${apiUri}/v2/NotificationConnector`)
.then((json) => {
console.info("Got Notification Connectors");
//console.info("Got Notification Connectors");
const ret = json as INotificationConnector[];
//console.debug(ret);
return (ret);