mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-07-06 19:04:18 +02:00
Compare commits
77 Commits
b4b4479e9b
...
b8350602c5
Author | SHA1 | Date | |
---|---|---|---|
b8350602c5 | |||
b4e25a9f54 | |||
5c78896a5d | |||
6bee507d93 | |||
7ec740da82 | |||
e253ae3d20 | |||
84f9dc176e | |||
84e9d70d34 | |||
95f4086c24 | |||
4c81c571a4 | |||
49fe38962d | |||
2ef7ee6b39 | |||
46729bade3 | |||
fed7ff987e | |||
594103689e | |||
6ab431fde0 | |||
18257cd584 | |||
c6dc3cd107 | |||
94c47b904d | |||
2a4316cf1d | |||
89586ef891 | |||
33514ee375 | |||
526e129fb7 | |||
d1dae83387 | |||
9199a7a0e4 | |||
d9fa4185e2 | |||
717c8cd33e | |||
483c2d564b | |||
5807844281 | |||
77d9e6eee1 | |||
e45e7bd5f5 | |||
ccab3a8027 | |||
5eca8dac5d | |||
0b34ca7723 | |||
eb943ccbed | |||
514cd06d2b | |||
2035bc8f4e | |||
ece175d1db | |||
da3867962b | |||
ec15732e57 | |||
6d10c81dff | |||
a3842ba20f | |||
74b71d57b7 | |||
6a5e340882 | |||
95801828c6 | |||
b70dfbf482 | |||
0bc93a7e5c | |||
ddd9512469 | |||
c26e208822 | |||
c656e5face | |||
4addacb229 | |||
c1aece8200 | |||
6bd9a0b1db | |||
c72e152a7e | |||
38572a3a46 | |||
5b52577610 | |||
3b99dbd487 | |||
3eb7b63fa6 | |||
793561dad7 | |||
acb22d770d | |||
e0093c65ff | |||
ecf9e1a243 | |||
5af3005179 | |||
d33ac16c7d | |||
a2e0a2375a | |||
9c0a7a0a50 | |||
d05b8ea76b | |||
e9937c02bf | |||
ef5524d7b6 | |||
8f9700ec02 | |||
4b86cd7104 | |||
61e3fbd500 | |||
657a3d1857 | |||
b4cf22b6eb | |||
2216e13c49 | |||
0a68da2b49 | |||
b87c159823 |
12
.github/workflows/docker-image-cuttingedge.yml
vendored
12
.github/workflows/docker-image-cuttingedge.yml
vendored
@ -3,6 +3,8 @@ name: Docker Image CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "cuttingedge" ]
|
branches: [ "cuttingedge" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "cuttingedge" ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -17,12 +19,12 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/docker/setup-qemu-action#usage
|
# https://github.com/docker/setup-qemu-action#usage
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3.2.0
|
uses: docker/setup-qemu-action@v3.6.0
|
||||||
|
|
||||||
# https://github.com/marketplace/actions/docker-setup-buildx
|
# https://github.com/marketplace/actions/docker-setup-buildx
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3.6.1
|
uses: docker/setup-buildx-action@v3.11.1
|
||||||
|
|
||||||
# https://github.com/docker/login-action#docker-hub
|
# https://github.com/docker/login-action#docker-hub
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
@ -33,12 +35,12 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/docker/build-push-action#multi-platform-image
|
# https://github.com/docker/build-push-action#multi-platform-image
|
||||||
- name: Build and push Website
|
- name: Build and push Website
|
||||||
uses: docker/build-push-action@v6.7.0
|
uses: docker/build-push-action@v6.18.0
|
||||||
with:
|
with:
|
||||||
context: ./Website
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64,linux/arm64
|
||||||
pull: true
|
pull: true
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
|
10
.github/workflows/docker-image-master.yml
vendored
10
.github/workflows/docker-image-master.yml
vendored
@ -17,12 +17,12 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/docker/setup-qemu-action#usage
|
# https://github.com/docker/setup-qemu-action#usage
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3.2.0
|
uses: docker/setup-qemu-action@v3.6.0
|
||||||
|
|
||||||
# https://github.com/marketplace/actions/docker-setup-buildx
|
# https://github.com/marketplace/actions/docker-setup-buildx
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3.6.1
|
uses: docker/setup-buildx-action@v3.11.1
|
||||||
|
|
||||||
# https://github.com/docker/login-action#docker-hub
|
# https://github.com/docker/login-action#docker-hub
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
@ -33,12 +33,12 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/docker/build-push-action#multi-platform-image
|
# https://github.com/docker/build-push-action#multi-platform-image
|
||||||
- name: Build and push Website
|
- name: Build and push Website
|
||||||
uses: docker/build-push-action@v6.7.0
|
uses: docker/build-push-action@v6.18.0
|
||||||
with:
|
with:
|
||||||
context: ./Website
|
context: ./
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64,linux/arm64
|
||||||
pull: true
|
pull: true
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
|
@ -17,12 +17,12 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/docker/setup-qemu-action#usage
|
# https://github.com/docker/setup-qemu-action#usage
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3.2.0
|
uses: docker/setup-qemu-action@v3.6.0
|
||||||
|
|
||||||
# https://github.com/marketplace/actions/docker-setup-buildx
|
# https://github.com/marketplace/actions/docker-setup-buildx
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3.6.1
|
uses: docker/setup-buildx-action@v3.11.1
|
||||||
|
|
||||||
# https://github.com/docker/login-action#docker-hub
|
# https://github.com/docker/login-action#docker-hub
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
@ -33,12 +33,12 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/docker/build-push-action#multi-platform-image
|
# https://github.com/docker/build-push-action#multi-platform-image
|
||||||
- name: Build and push Website
|
- name: Build and push Website
|
||||||
uses: docker/build-push-action@v6.7.0
|
uses: docker/build-push-action@v6.18.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64,linux/arm64
|
||||||
pull: true
|
pull: true
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
<!-- ABOUT THE PROJECT -->
|
<!-- ABOUT THE PROJECT -->
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
|||
|
|  |  |  |
|
||||||
|---|---|---|
|
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
|
||||||
|||
|
|  |  |  |
|
||||||
|
|
||||||
## About The Project
|
## About The Project
|
||||||
|
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import React, {ReactElement, useContext, useState} from "react";
|
import React, {ReactElement, useContext, useState} from "react";
|
||||||
import IChapter from "../api/types/IChapter.ts";
|
import IChapter from "../api/types/IChapter.ts";
|
||||||
import {Box, Chip, Link, Stack, Typography} from "@mui/joy";
|
import {Box, Chip, Link, Stack, Tooltip, Typography} from "@mui/joy";
|
||||||
import {MangaFromId} from "./Manga.tsx";
|
import {MangaFromId} from "./Manga.tsx";
|
||||||
import {ChapterContext} from "../api/Contexts/ChapterContext.tsx";
|
import {ChapterContext} from "../api/Contexts/ChapterContext.tsx";
|
||||||
import Drawer from "@mui/joy/Drawer";
|
import Drawer from "@mui/joy/Drawer";
|
||||||
import ModalClose from "@mui/joy/ModalClose";
|
import ModalClose from "@mui/joy/ModalClose";
|
||||||
|
import {Archive} from "@mui/icons-material";
|
||||||
|
|
||||||
export function ChapterPopupFromId({chapterId, open, setOpen, children}: { chapterId: string | null, open: boolean, setOpen: React.Dispatch<React.SetStateAction<boolean>>, children?: ReactElement<any, any> | ReactElement<any, any>[] | undefined }) {
|
export function ChapterPopupFromId({chapterId, open, setOpen, children}: { chapterId: string | null, open: boolean, setOpen: React.Dispatch<React.SetStateAction<boolean>>, children?: ReactElement<any, any> | ReactElement<any, any>[] | undefined }) {
|
||||||
return (
|
return (
|
||||||
<Drawer open={open} onClose={() => setOpen(false)}>
|
<Drawer anchor={"bottom"} open={open} onClose={() => setOpen(false)}>
|
||||||
<ModalClose />
|
<ModalClose />
|
||||||
{
|
{
|
||||||
chapterId !== null ?
|
chapterId !== null ?
|
||||||
@ -35,13 +36,13 @@ export function ChapterFromId({chapterId, children} : { chapterId: string, child
|
|||||||
|
|
||||||
export function Chapter({chapter, children} : { chapter: IChapter, children?: ReactElement<any, any> | ReactElement<any, any>[] | undefined }){
|
export function Chapter({chapter, children} : { chapter: IChapter, children?: ReactElement<any, any> | ReactElement<any, any>[] | undefined }){
|
||||||
return (
|
return (
|
||||||
<Stack direction={"row"}>
|
<Stack direction={"row"} spacing={5} sx={{paddingTop: "10px"}}>
|
||||||
<MangaFromId mangaId={chapter.parentMangaId} />
|
<MangaFromId mangaId={chapter.parentMangaId} />
|
||||||
<Box>
|
<Box>
|
||||||
<Link target={"_blank"} level={"title-lg"} href={chapter.url}>{chapter.title}</Link>
|
<Link target={"_blank"} level={"title-lg"} href={chapter.url}>{chapter.title}</Link>
|
||||||
<Typography>Volume <Chip>{chapter.volumeNumber}</Chip></Typography>
|
<Typography>Volume <Chip>{chapter.volumeNumber}</Chip></Typography>
|
||||||
<Typography>Chapter <Chip>{chapter.chapterNumber}</Chip></Typography>
|
<Typography>Chapter <Chip>{chapter.chapterNumber}</Chip></Typography>
|
||||||
<Typography>Title <Chip>{chapter.title}</Chip></Typography>
|
<Tooltip title={chapter.fullArchiveFilePath} placement={"bottom-start"}><Archive /></Tooltip>
|
||||||
</Box>
|
</Box>
|
||||||
{children}
|
{children}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
@ -9,11 +9,11 @@ import {
|
|||||||
Table,
|
Table,
|
||||||
Typography
|
Typography
|
||||||
} from "@mui/joy";
|
} from "@mui/joy";
|
||||||
import {GetJobsInState, GetJobsOfTypeAndWithState, GetJobsWithType} from "../api/Job.tsx";
|
import {GetJobsInState, GetJobsOfTypeAndWithState, GetJobsWithType, StartJob} from "../api/Job.tsx";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import {useCallback, useContext, useEffect, useState} from "react";
|
import {useCallback, useContext, useEffect, useState} from "react";
|
||||||
import {ApiUriContext} from "../api/fetchApi.tsx";
|
import {ApiUriContext} from "../api/fetchApi.tsx";
|
||||||
import IJob, {JobState, JobType} from "../api/types/Jobs/IJob.ts";
|
import IJob, {JobState, JobStateToString, JobType, JobTypeToString} from "../api/types/Jobs/IJob.ts";
|
||||||
import ModalClose from "@mui/joy/ModalClose";
|
import ModalClose from "@mui/joy/ModalClose";
|
||||||
import {MangaPopupFromId} from "./MangaPopup.tsx";
|
import {MangaPopupFromId} from "./MangaPopup.tsx";
|
||||||
import IJobWithMangaId from "../api/types/Jobs/IJobWithMangaId.ts";
|
import IJobWithMangaId from "../api/types/Jobs/IJobWithMangaId.ts";
|
||||||
@ -86,6 +86,10 @@ export default function JobsDrawer({open, connected, setOpen} : {open: boolean,
|
|||||||
setChapterPopupOpen(true);
|
setChapterPopupOpen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ReRunJob = useCallback((jobId: string) => {
|
||||||
|
StartJob(apiUri, jobId, false);
|
||||||
|
}, [apiUri]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer size={"lg"} anchor={"left"} open={open} onClose={() => setOpen(false)}>
|
<Drawer size={"lg"} anchor={"left"} open={open} onClose={() => setOpen(false)}>
|
||||||
<ModalClose />
|
<ModalClose />
|
||||||
@ -95,13 +99,13 @@ export default function JobsDrawer({open, connected, setOpen} : {open: boolean,
|
|||||||
<Typography>State</Typography>
|
<Typography>State</Typography>
|
||||||
}>
|
}>
|
||||||
<Option value={null}>None</Option>
|
<Option value={null}>None</Option>
|
||||||
{Object.keys(JobState).map((state) => <Option value={state}>{state}</Option>)}
|
{Object.keys(JobState).map((state) => <Option value={state}>{JobStateToString(state)}</Option>)}
|
||||||
</Select>
|
</Select>
|
||||||
<Select placeholder={"Type"} value={filterType} onChange={handleChangeType} startDecorator={
|
<Select placeholder={"Type"} value={filterType} onChange={handleChangeType} startDecorator={
|
||||||
<Typography>Type</Typography>
|
<Typography>Type</Typography>
|
||||||
}>
|
}>
|
||||||
<Option value={null}>None</Option>
|
<Option value={null}>None</Option>
|
||||||
{Object.keys(JobType).map((type) => <Option value={type}>{type}</Option>)}
|
{Object.keys(JobType).map((type) => <Option value={type}>{JobTypeToString(type)}</Option>)}
|
||||||
</Select>
|
</Select>
|
||||||
<Input type={"number"}
|
<Input type={"number"}
|
||||||
value={page}
|
value={page}
|
||||||
@ -111,23 +115,25 @@ export default function JobsDrawer({open, connected, setOpen} : {open: boolean,
|
|||||||
endDecorator={<Typography>/{Math.ceil(allJobs.length / pageSize)}</Typography>}/>
|
endDecorator={<Typography>/{Math.ceil(allJobs.length / pageSize)}</Typography>}/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Table borderAxis={"xBetween"} stickyHeader>
|
<Table borderAxis={"bothBetween"} stickyHeader sx={{tableLayout: "auto", width: "100%"}}>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>State</th>
|
<th>State</th>
|
||||||
<th>Last Execution</th>
|
<th>Last Execution</th>
|
||||||
<th>NextExecution</th>
|
<th>Next Execution</th>
|
||||||
|
<th></th>
|
||||||
<th>Extra</th>
|
<th>Extra</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{allJobs.slice((page-1)*pageSize, page*pageSize).map((job) => (
|
{allJobs.slice((page-1)*pageSize, page*pageSize).map((job) => (
|
||||||
<tr key={job.jobId}>
|
<tr key={job.jobId}>
|
||||||
<td>{job.jobType}</td>
|
<td>{JobTypeToString(job.jobType)}</td>
|
||||||
<td>{job.state}</td>
|
<td>{JobStateToString(job.state)}</td>
|
||||||
<td>{new Date(job.lastExecution).toLocaleString()}</td>
|
<td>{new Date(job.lastExecution).toLocaleString()}</td>
|
||||||
<td>{new Date(job.nextExecution).toLocaleString()}</td>
|
<td>{new Date(job.nextExecution).toLocaleString()}</td>
|
||||||
|
<td style={{whiteSpace: "nowrap"}}><Button onClick={() => ReRunJob(job.jobId)}>Re-Run</Button></td>
|
||||||
<td>{ExtraContent(job, OpenMangaPopupDrawer, OpenChapterPopupDrawer)}</td>
|
<td>{ExtraContent(job, OpenMangaPopupDrawer, OpenChapterPopupDrawer)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
@ -150,8 +156,7 @@ function ExtraContent(job: IJob, OpenMangaPopupDrawer: (mangaId: string) => void
|
|||||||
case JobType.MoveMangaLibraryJob:
|
case JobType.MoveMangaLibraryJob:
|
||||||
return <Button onClick={() => OpenMangaPopupDrawer((job as IJobWithMangaId).mangaId)}>Open Manga</Button>
|
return <Button onClick={() => OpenMangaPopupDrawer((job as IJobWithMangaId).mangaId)}>Open Manga</Button>
|
||||||
case JobType.DownloadSingleChapterJob:
|
case JobType.DownloadSingleChapterJob:
|
||||||
case JobType.UpdateSingleChapterDownloadedJob:
|
return <Button onClick={() => OpenChapterPopupDrawer((job as IJobWithChapterId).chapterId)}>Show Chapter</Button>
|
||||||
return <Button onClick={() => OpenChapterPopupDrawer((job as IJobWithChapterId).chapterId)}>ShowChapter</Button>
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,9 @@ const coverSx : SxProps = {
|
|||||||
const coverCss : CSSProperties = {
|
const coverCss : CSSProperties = {
|
||||||
maxHeight: "calc("+CardHeight+"px + 2rem)",
|
maxHeight: "calc("+CardHeight+"px + 2rem)",
|
||||||
maxWidth: "calc("+CardWidth+"px + 2rem)",
|
maxWidth: "calc("+CardWidth+"px + 2rem)",
|
||||||
|
objectFit: "cover",
|
||||||
|
width: "calc("+CardHeight+"px + 2rem)",
|
||||||
|
height: "calc("+CardHeight+"px + 2rem)",
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MangaFromId({mangaId, children} : { mangaId: string, children?: ReactElement<any, any> | ReactElement<any, any>[] | undefined }){
|
export function MangaFromId({mangaId, children} : { mangaId: string, children?: ReactElement<any, any> | ReactElement<any, any>[] | undefined }){
|
||||||
@ -34,7 +37,7 @@ export function MangaFromId({mangaId, children} : { mangaId: string, children?:
|
|||||||
<Badge sx={{margin:"8px !important"}} badgeContent={<Skeleton><Tooltip title={"Loading"}><img width={"24pt"} height={"24pt"} src={"/blahaj.png"} /></Tooltip></Skeleton>} color={ReleaseStatusToPalette(MangaReleaseStatus.Completed)} size={"lg"}>
|
<Badge sx={{margin:"8px !important"}} badgeContent={<Skeleton><Tooltip title={"Loading"}><img width={"24pt"} height={"24pt"} src={"/blahaj.png"} /></Tooltip></Skeleton>} color={ReleaseStatusToPalette(MangaReleaseStatus.Completed)} size={"lg"}>
|
||||||
<Card sx={{height:"fit-content",width:"fit-content"}}>
|
<Card sx={{height:"fit-content",width:"fit-content"}}>
|
||||||
<CardCover>
|
<CardCover>
|
||||||
<img style={coverCss} src={"/blahaj.png"} alt="Manga Cover"/>
|
<img loading={"lazy"} style={coverCss} src={"/blahaj.png"} alt="Manga Cover"/>
|
||||||
</CardCover>
|
</CardCover>
|
||||||
<CardCover sx={{
|
<CardCover sx={{
|
||||||
background:
|
background:
|
||||||
@ -94,9 +97,9 @@ export function Manga({manga: manga, children} : { manga: IManga, children?: Rea
|
|||||||
setExpanded(!expanded)}
|
setExpanded(!expanded)}
|
||||||
}>
|
}>
|
||||||
<CardCover>
|
<CardCover>
|
||||||
<img style={coverCss} src={GetMangaCoverImageUrl(apiUri, manga.mangaId, CoverRef.current)} alt="Manga Cover"
|
<img loading={"lazy"} style={coverCss} src={GetMangaCoverImageUrl(apiUri, manga.mangaId, CoverRef.current)} alt="Manga Cover"
|
||||||
ref={CoverRef}
|
ref={CoverRef}
|
||||||
onLoad={LoadMangaCover}/>
|
onError={LoadMangaCover}/>
|
||||||
</CardCover>
|
</CardCover>
|
||||||
<CardCover sx={{
|
<CardCover sx={{
|
||||||
background:
|
background:
|
||||||
|
@ -27,17 +27,12 @@ export default function MangaList({connected, setShowSearch}: {connected: boolea
|
|||||||
StartJob(apiUri, jobId, true).finally(() => getJobList());
|
StartJob(apiUri, jobId, true).finally(() => getJobList());
|
||||||
},[apiUri]);
|
},[apiUri]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getJobList();
|
|
||||||
}, [apiUri]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
updateTimer();
|
updateTimer();
|
||||||
getJobList();
|
}, [connected, apiUri]);
|
||||||
}, [connected]);
|
|
||||||
|
|
||||||
const timerRef = React.useRef<ReturnType<typeof setInterval>>(undefined);
|
const timerRef = React.useRef<ReturnType<typeof setInterval>>(undefined);
|
||||||
const updateTimer = () => {
|
const updateTimer = useCallback(() => {
|
||||||
if(!connected){
|
if(!connected){
|
||||||
clearTimeout(timerRef.current);
|
clearTimeout(timerRef.current);
|
||||||
return;
|
return;
|
||||||
@ -45,12 +40,10 @@ export default function MangaList({connected, setShowSearch}: {connected: boolea
|
|||||||
if(timerRef.current === undefined) {
|
if(timerRef.current === undefined) {
|
||||||
console.log("Added timer!");
|
console.log("Added timer!");
|
||||||
getJobList();
|
getJobList();
|
||||||
timerRef.current = setInterval(() => {
|
timerRef.current = setInterval(getJobList, 2000);
|
||||||
getJobList();
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, [getJobList, connected, timerRef]);
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<Stack direction="row" spacing={1} flexWrap={"wrap"} sx={{overflowX: 'hidden', overflowY: 'auto' /* Badge overflow */}} paddingTop={"6px" /* Badge overflow */}>
|
<Stack direction="row" spacing={1} flexWrap={"wrap"} sx={{overflowX: 'hidden', overflowY: 'auto' /* Badge overflow */}} paddingTop={"6px" /* Badge overflow */}>
|
||||||
|
@ -116,7 +116,7 @@ export default function MangaPopup({manga, open, setOpen, children} : {manga: IM
|
|||||||
}, [manga, apiUri]);
|
}, [manga, apiUri]);
|
||||||
|
|
||||||
const [updatingThreshold, setUpdatingThreshold] = useState<boolean>(false);
|
const [updatingThreshold, setUpdatingThreshold] = useState<boolean>(false);
|
||||||
const updateIgnoreThreshhold = useCallback((value: number) => {
|
const updateIgnoreThreshold = useCallback((value: number) => {
|
||||||
if(manga == null)
|
if(manga == null)
|
||||||
return;
|
return;
|
||||||
setUpdatingThreshold(true);
|
setUpdatingThreshold(true);
|
||||||
@ -176,7 +176,7 @@ export default function MangaPopup({manga, open, setOpen, children} : {manga: IM
|
|||||||
}
|
}
|
||||||
sx={{width:"min-content"}}
|
sx={{width:"min-content"}}
|
||||||
size={"md"}
|
size={"md"}
|
||||||
onChange={(e) => updateIgnoreThreshhold(e.currentTarget.valueAsNumber)}
|
onChange={(e) => updateIgnoreThreshold(e.currentTarget.valueAsNumber)}
|
||||||
/>
|
/>
|
||||||
{children}
|
{children}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
@ -14,22 +14,22 @@ export const GetJobsWithIds = async (apiUri: string, jobIds: string[]) : Promise
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GetJobsInState = async (apiUri: string, state: JobState) : Promise<IJob[]> => {
|
export const GetJobsInState = async (apiUri: string, state: JobState) : Promise<IJob[]> => {
|
||||||
if(state == null || state == undefined)
|
if(state == null)
|
||||||
return Promise.reject("state was not provided");
|
return Promise.reject("state was not provided");
|
||||||
return await getData(`${apiUri}/v2/Job/State/${state}`) as Promise<IJob[]>;
|
return await getData(`${apiUri}/v2/Job/State/${state}`) as Promise<IJob[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GetJobsWithType = async (apiUri: string, jobType: JobType) : Promise<IJob[]> => {
|
export const GetJobsWithType = async (apiUri: string, jobType: JobType) : Promise<IJob[]> => {
|
||||||
if(jobType == null || jobType == undefined) {
|
if(jobType == null) {
|
||||||
return Promise.reject("jobType was not provided");
|
return Promise.reject("jobType was not provided");
|
||||||
}
|
}
|
||||||
return await getData(`${apiUri}/v2/Job/Type/${jobType}`) as Promise<IJob[]>;
|
return await getData(`${apiUri}/v2/Job/Type/${jobType}`) as Promise<IJob[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GetJobsOfTypeAndWithState = async (apiUri: string, jobType: JobType, state: JobState) : Promise<IJob[]> => {
|
export const GetJobsOfTypeAndWithState = async (apiUri: string, jobType: JobType, state: JobState) : Promise<IJob[]> => {
|
||||||
if(jobType == null || jobType == undefined)
|
if(jobType == null)
|
||||||
return Promise.reject("jobType was not provided");
|
return Promise.reject("jobType was not provided");
|
||||||
if(state == null || state == undefined)
|
if(state == null)
|
||||||
return Promise.reject("state was not provided");
|
return Promise.reject("state was not provided");
|
||||||
return await getData(`${apiUri}/v2/Job/TypeAndState/${jobType}/${state}`) as Promise<IJob[]>;
|
return await getData(`${apiUri}/v2/Job/TypeAndState/${jobType}/${state}`) as Promise<IJob[]>;
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,13 @@ export const DeleteManga = async (apiUri: string, mangaId: string) : Promise<voi
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const GetMangaCoverImageUrl = (apiUri: string, mangaId: string, ref: HTMLImageElement | undefined | null) : string => {
|
export const GetMangaCoverImageUrl = (apiUri: string, mangaId: string, ref: HTMLImageElement | undefined | null) : string => {
|
||||||
if(ref == null || ref == undefined)
|
if(ref == null || mangaId === DefaultManga.mangaId)
|
||||||
return `${apiUri}/v2/Manga/${mangaId}/Cover?width=64&height=64`;
|
|
||||||
if(mangaId === DefaultManga.mangaId)
|
|
||||||
return "/blahaj.png";
|
return "/blahaj.png";
|
||||||
return `${apiUri}/v2/Manga/${mangaId}/Cover?width=${ref.clientWidth}&height=${ref.clientHeight}`;
|
return `${apiUri}/v2/Manga/${mangaId}/Cover?width=${ref.clientWidth}&height=${ref.clientHeight}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GetChapters = async (apiUri: string, mangaId: string) : Promise<IChapter[]> => {
|
export const GetChapters = async (apiUri: string, mangaId: string) : Promise<IChapter[]> => {
|
||||||
if(mangaId === undefined || mangaId === null || mangaId.length < 1)
|
if(mangaId === null || mangaId.length < 1)
|
||||||
return Promise.reject("mangaId was not provided");
|
return Promise.reject("mangaId was not provided");
|
||||||
if(mangaId === DefaultManga.mangaId)
|
if(mangaId === DefaultManga.mangaId)
|
||||||
return Promise.reject("Default Manga was requested");
|
return Promise.reject("Default Manga was requested");
|
||||||
|
@ -16,10 +16,13 @@ export enum JobType {
|
|||||||
RetrieveChaptersJob = "RetrieveChaptersJob",
|
RetrieveChaptersJob = "RetrieveChaptersJob",
|
||||||
UpdateChaptersDownloadedJob = "UpdateChaptersDownloadedJob",
|
UpdateChaptersDownloadedJob = "UpdateChaptersDownloadedJob",
|
||||||
MoveMangaLibraryJob = "MoveMangaLibraryJob",
|
MoveMangaLibraryJob = "MoveMangaLibraryJob",
|
||||||
UpdateSingleChapterDownloadedJob = "UpdateSingleChapterDownloadedJob",
|
|
||||||
UpdateCoverJob = "UpdateCoverJob"
|
UpdateCoverJob = "UpdateCoverJob"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function JobTypeToString(job: JobType | string): string {
|
||||||
|
return job.replace(/([A-Z])/g, ' $1').replace("Job", "").trim();
|
||||||
|
}
|
||||||
|
|
||||||
export enum JobState {
|
export enum JobState {
|
||||||
FirstExecution = "FirstExecution",
|
FirstExecution = "FirstExecution",
|
||||||
Running = "Running",
|
Running = "Running",
|
||||||
@ -27,3 +30,7 @@ export enum JobState {
|
|||||||
CompletedWaiting = "CompletedWaiting",
|
CompletedWaiting = "CompletedWaiting",
|
||||||
Failed = "Failed"
|
Failed = "Failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function JobStateToString(state: JobState | string): string {
|
||||||
|
return state.replace(/([A-Z])/g, ' $1').trim();
|
||||||
|
}
|
Reference in New Issue
Block a user