This commit is contained in:
2025-10-17 00:29:03 +02:00
parent f927da1d40
commit a857325fad
5 changed files with 48 additions and 39 deletions

View File

@@ -25,10 +25,20 @@
<UNavigationMenu :items="items" orientation="horizontal" variant="link" color="neutral" />
</template>
<template #right>
<UButton icon="i-lucide-brick-wall-shield" :to="`/actions?return=${$route.fullPath}`" :disabled="$route.fullPath.startsWith('/actions')" variant="soft" color="secondary" />
<UButton
icon="i-lucide-brick-wall-shield"
:to="`/actions?return=${$route.fullPath}`"
:disabled="$route.fullPath.startsWith('/actions')"
variant="soft"
color="secondary" />
<UButton icon="i-lucide-plus" to="/search" color="primary" label="Manga" />
<UColorModeButton color="secondary" />
<UButton icon="i-lucide-settings" variant="ghost" :to="`/settings?return=${$route.fullPath}`" :disabled="$route.fullPath.startsWith('/settings')" color="secondary" />
<UButton
icon="i-lucide-settings"
variant="ghost"
:to="`/settings?return=${$route.fullPath}`"
:disabled="$route.fullPath.startsWith('/settings')"
color="secondary" />
</template>
</UHeader>
<UMain>

View File

@@ -25,7 +25,7 @@
<slot name="actions" />
</div>
</div>
<div :class="[$slots.left ? rimless ? '' : 'min-md:mr-4 max-md:mx-2' : rimless ? '' : 'mx-4', 'h-full']">
<div :class="[$slots.left ? (rimless ? '' : 'min-md:mr-4 max-md:mx-2') : rimless ? '' : 'mx-4', 'h-full']">
<slot />
</div>
</div>

View File

@@ -6,5 +6,5 @@ export const FetchKeys = {
Metadata: { Fetchers: 'Metadata', Links: 'Metadata/Links', Manga: (mangaId: string) => `Metadata/Links/${mangaId}` },
Libraries: { All: 'Libraries', Id: (id: string) => `Libraries/${id}` },
Settings: { All: 'Settings' },
Actions: { Types: 'Actions/Types'}
Actions: { Types: 'Actions/Types' },
};

View File

@@ -19,10 +19,22 @@
{{ new Date(row.original.performedAt).toLocaleString() }}
</template>
<template #manga-cell="{ row }">
<UButton v-if="row.original.mangaId" :to="`/manga/${row.original.mangaId}?return=${$route.fullPath}`" variant="ghost" color="primary">Manga</UButton>
<UButton
v-if="row.original.mangaId"
:to="`/manga/${row.original.mangaId}?return=${$route.fullPath}`"
variant="ghost"
color="primary"
>Manga</UButton
>
</template>
<template #chapter-cell="{ row }">
<UButton v-if="row.original.chapterId" :to="`/manga/${row.original.chapterId}?return=${$route.fullPath}`" variant="ghost" color="secondary">Chapter</UButton>
<UButton
v-if="row.original.chapterId"
:to="`/manga/${row.original.chapterId}?return=${$route.fullPath}`"
variant="ghost"
color="secondary"
>Chapter</UButton
>
</template>
<template #additional-cell="{ row }">
<p v-if="row.original.from">From: {{ row.original.from }}</p>
@@ -43,46 +55,29 @@ type ActionRecord = components['schemas']['ActionRecord'];
const { $api } = useNuxtApp();
const timezoneOffsetMillis = new Date().getTimezoneOffset() * 60 * 1000;
const params = ref<Partial<Filter>>({ ...useRoute().query,
start: new Date(Date.now()-(24 * 60 * 60 * 1000) - timezoneOffsetMillis).toISOString().slice(0, 16),
end: new Date(Date.now() - timezoneOffsetMillis).toISOString().slice(0, 16)
const params = ref<Partial<Filter>>({
...useRoute().query,
start: new Date(Date.now() - 24 * 60 * 60 * 1000 - timezoneOffsetMillis).toISOString().slice(0, 16),
end: new Date(Date.now() - timezoneOffsetMillis).toISOString().slice(0, 16),
});
const data = ref(await $api('/v2/Actions/Filter', { method: 'POST', body: params.value }));
const { data: ActionTypes } = useApi('/v2/Actions/Types', { key : FetchKeys.Actions.Types });
const { data: ActionTypes } = useApi('/v2/Actions/Types', { key: FetchKeys.Actions.Types });
const columns: TableColumn<ActionRecord>[] = [
{
id: 'action',
accessorKey: 'action',
header: 'Action'
},
{
id: 'timestamp',
accessorKey: 'performedAt',
header: 'Timestamp'
},
{
id: 'manga',
accessorKey: 'mangaId',
header: 'Manga'
},
{
id: 'chapter',
accessorKey: 'chapterId',
header: 'Chapter'
},
{
id: 'additional',
header: 'Additional'
},
{ id: 'action', accessorKey: 'action', header: 'Action' },
{ id: 'timestamp', accessorKey: 'performedAt', header: 'Timestamp' },
{ id: 'manga', accessorKey: 'mangaId', header: 'Manga' },
{ id: 'chapter', accessorKey: 'chapterId', header: 'Chapter' },
{ id: 'additional', header: 'Additional' },
];
const resetFilter = () => {
params.value = { ...useRoute().query,
start: new Date(Date.now()-(24 * 60 * 60 * 1000) - timezoneOffsetMillis).toISOString().slice(0, 16),
end: new Date(Date.now() - timezoneOffsetMillis).toISOString().slice(0, 16)
params.value = {
...useRoute().query,
start: new Date(Date.now() - 24 * 60 * 60 * 1000 - timezoneOffsetMillis).toISOString().slice(0, 16),
end: new Date(Date.now() - timezoneOffsetMillis).toISOString().slice(0, 16),
};
}
};
const refreshData = async (): Promise<void> => {
data.value = await $api('/v2/Actions/Filter', { method: 'POST', body: params.value });

View File

@@ -66,7 +66,11 @@
</div>
</div>
<template #actions>
<UButton icon="i-lucide-brick-wall-shield" :to="`/actions?mangaId=${mangaId}&return=${$route.fullPath}`" variant="soft" color="secondary" />
<UButton
icon="i-lucide-brick-wall-shield"
:to="`/actions?mangaId=${mangaId}&return=${$route.fullPath}`"
variant="soft"
color="secondary" />
<UButton trailing-icon="i-lucide-merge" :to="`/manga/${manga?.key}/merge?return=${$route.fullPath}`" color="secondary"
>Merge</UButton
>