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" /> <UNavigationMenu :items="items" orientation="horizontal" variant="link" color="neutral" />
</template> </template>
<template #right> <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" /> <UButton icon="i-lucide-plus" to="/search" color="primary" label="Manga" />
<UColorModeButton color="secondary" /> <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> </template>
</UHeader> </UHeader>
<UMain> <UMain>

View File

@@ -25,7 +25,7 @@
<slot name="actions" /> <slot name="actions" />
</div> </div>
</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 /> <slot />
</div> </div>
</div> </div>

View File

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

View File

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

View File

@@ -66,7 +66,11 @@
</div> </div>
</div> </div>
<template #actions> <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" <UButton trailing-icon="i-lucide-merge" :to="`/manga/${manga?.key}/merge?return=${$route.fullPath}`" color="secondary"
>Merge</UButton >Merge</UButton
> >