feat/admin #33
@ -117,6 +117,7 @@ export interface ContentProviderDTO {
|
|||||||
name: string;
|
name: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
|
supportsContentFetch?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContentProviderListDTO {
|
export interface ContentProviderListDTO {
|
||||||
@ -214,9 +215,9 @@ export interface PageMangaImportJobDTO {
|
|||||||
number?: number;
|
number?: number;
|
||||||
pageable?: PageableObject;
|
pageable?: PageableObject;
|
||||||
numberOfElements?: number;
|
numberOfElements?: number;
|
||||||
|
sort?: SortObject;
|
||||||
first?: boolean;
|
first?: boolean;
|
||||||
last?: boolean;
|
last?: boolean;
|
||||||
sort?: SortObject;
|
|
||||||
empty?: boolean;
|
empty?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,9 +278,9 @@ export interface PageMangaListDTO {
|
|||||||
number?: number;
|
number?: number;
|
||||||
pageable?: PageableObject;
|
pageable?: PageableObject;
|
||||||
numberOfElements?: number;
|
numberOfElements?: number;
|
||||||
|
sort?: SortObject;
|
||||||
first?: boolean;
|
first?: boolean;
|
||||||
last?: boolean;
|
last?: boolean;
|
||||||
sort?: SortObject;
|
|
||||||
empty?: boolean;
|
empty?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import {
|
|||||||
import { Badge } from "@/components/ui/badge.tsx";
|
import { Badge } from "@/components/ui/badge.tsx";
|
||||||
import { Button } from "@/components/ui/button.tsx";
|
import { Button } from "@/components/ui/button.tsx";
|
||||||
import { Card } from "@/components/ui/card.tsx";
|
import { Card } from "@/components/ui/card.tsx";
|
||||||
|
import {toast} from "sonner";
|
||||||
|
|
||||||
export const ProviderManager = () => {
|
export const ProviderManager = () => {
|
||||||
const { data } = useGetContentProviders();
|
const { data } = useGetContentProviders();
|
||||||
@ -15,12 +16,26 @@ export const ProviderManager = () => {
|
|||||||
const {
|
const {
|
||||||
mutate: mutateFetchContentProviderMangas,
|
mutate: mutateFetchContentProviderMangas,
|
||||||
isPending: isPendingFetchContentProviderMangas,
|
isPending: isPendingFetchContentProviderMangas,
|
||||||
} = useFetchContentProviderMangas();
|
} = useFetchContentProviderMangas({
|
||||||
|
mutation: {
|
||||||
|
onSuccess: () => {
|
||||||
|
toast.success("Content Provider mangas update queued successfully!");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
mutate: mutateFetchAllContentProviderMangas,
|
mutate: mutateFetchAllContentProviderMangas,
|
||||||
isPending: isPendingFetchAllContentProviderMangas,
|
isPending: isPendingFetchAllContentProviderMangas,
|
||||||
} = useFetchAllContentProviderMangas();
|
} = useFetchAllContentProviderMangas(
|
||||||
|
{
|
||||||
|
mutation: {
|
||||||
|
onSuccess: () => {
|
||||||
|
toast.success("All Content Provider mangas update queued successfully!");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const activeCount = providers?.filter((p) => p.active).length;
|
const activeCount = providers?.filter((p) => p.active).length;
|
||||||
|
|
||||||
@ -104,26 +119,28 @@ export const ProviderManager = () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button
|
{provider.supportsContentFetch && (
|
||||||
variant="outline"
|
<Button
|
||||||
size="sm"
|
variant="outline"
|
||||||
onClick={() =>
|
size="sm"
|
||||||
mutateFetchContentProviderMangas({
|
onClick={() =>
|
||||||
providerId: provider?.id ?? -1,
|
mutateFetchContentProviderMangas({
|
||||||
})
|
providerId: provider?.id ?? -1,
|
||||||
}
|
})
|
||||||
disabled={
|
}
|
||||||
!provider.active || isPendingFetchContentProviderMangas
|
disabled={
|
||||||
}
|
!provider.active || isPendingFetchContentProviderMangas
|
||||||
className="gap-2 shrink-0"
|
}
|
||||||
>
|
className="gap-2 shrink-0"
|
||||||
{isPendingFetchContentProviderMangas ? (
|
>
|
||||||
<Loader2 className="h-3 w-3 animate-spin" />
|
{isPendingFetchContentProviderMangas ? (
|
||||||
) : (
|
<Loader2 className="h-3 w-3 animate-spin" />
|
||||||
<RefreshCw className="h-3 w-3" />
|
) : (
|
||||||
)}
|
<RefreshCw className="h-3 w-3" />
|
||||||
Update
|
)}
|
||||||
</Button>
|
Update
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user