chore: use new buttons for admin pages

pull/24205/head
izzy 2025-12-17 15:46:06 +00:00
parent 05acf74626
commit 16c2082721
No known key found for this signature in database
2 changed files with 27 additions and 38 deletions

View File

@ -12,10 +12,10 @@
MaintenanceAction, MaintenanceAction,
ManualJobName, ManualJobName,
setMaintenanceMode, setMaintenanceMode,
type MaintenanceIntegrityReportSummaryResponseDto, type IntegrityReportSummaryResponseDto,
type QueuesResponseLegacyDto, type QueuesResponseLegacyDto,
} from '@immich/sdk'; } from '@immich/sdk';
import { Button, HStack, Text, toastManager } from '@immich/ui'; import { Button, HStack, toastManager } from '@immich/ui';
import { mdiProgressWrench } from '@mdi/js'; import { mdiProgressWrench } from '@mdi/js';
import { onDestroy, onMount } from 'svelte'; import { onDestroy, onMount } from 'svelte';
import { t } from 'svelte-i18n'; import { t } from 'svelte-i18n';
@ -27,7 +27,7 @@
let { data }: Props = $props(); let { data }: Props = $props();
let integrityReport: MaintenanceIntegrityReportSummaryResponseDto = $state(data.integrityReport); let integrityReport: IntegrityReportSummaryResponseDto = $state(data.integrityReport);
const TYPES: IntegrityReportType[] = [ const TYPES: IntegrityReportType[] = [
IntegrityReportType.OrphanFile, IntegrityReportType.OrphanFile,
@ -98,21 +98,16 @@
}); });
</script> </script>
<AdminPageLayout breadcrumbs={[{ title: data.meta.title }]}> <AdminPageLayout
{#snippet buttons()} breadcrumbs={[{ title: data.meta.title }]}
<HStack gap={1}> actions={[
<Button {
leadingIcon={mdiProgressWrench} title: $t('admin.maintenance_start'),
size="small" onAction: switchToMaintenance,
variant="ghost" icon: mdiProgressWrench,
color="secondary" },
onclick={switchToMaintenance} ]}
> >
<Text class="hidden md:block">{$t('admin.maintenance_start')}</Text>
</Button>
</HStack>
{/snippet}
<section id="setting-content" class="flex place-content-center sm:mx-4"> <section id="setting-content" class="flex place-content-center sm:mx-4">
<section class="w-full pb-28 sm:w-5/6 md:w-[850px]"> <section class="w-full pb-28 sm:w-5/6 md:w-[850px]">
<p class="text-sm dark:text-immich-dark-fg uppercase">{$t('admin.maintenance_integrity_report')}</p> <p class="text-sm dark:text-immich-dark-fg uppercase">{$t('admin.maintenance_integrity_report')}</p>

View File

@ -4,12 +4,9 @@
import { handleError } from '$lib/utils/handle-error'; import { handleError } from '$lib/utils/handle-error';
import { createJob, deleteIntegrityReport, getBaseUrl, IntegrityReportType, ManualJobName } from '@immich/sdk'; import { createJob, deleteIntegrityReport, getBaseUrl, IntegrityReportType, ManualJobName } from '@immich/sdk';
import { import {
Button,
HStack,
IconButton, IconButton,
menuManager, menuManager,
modalManager, modalManager,
Text,
toastManager, toastManager,
type ContextMenuBaseProps, type ContextMenuBaseProps,
type MenuItems, type MenuItems,
@ -121,24 +118,21 @@
{ title: $t('admin.maintenance_integrity_report') }, { title: $t('admin.maintenance_integrity_report') },
{ title: data.meta.title }, { title: data.meta.title },
]} ]}
actions={[
{
title: 'Download CSV',
icon: mdiDownload,
onAction: () => {
location.href = `${getBaseUrl()}/admin/maintenance/integrity/report/${data.type}/csv`;
},
},
{
title: 'Delete All',
onAction: removeAll,
icon: mdiTrashCanOutline,
},
]}
> >
{#snippet buttons()}
<HStack gap={1}>
<Button
size="small"
variant="ghost"
color="secondary"
leadingIcon={mdiDownload}
href={`${getBaseUrl()}/admin/maintenance/integrity/report/${data.type}/csv`}
>
<Text class="hidden md:block">Download CSV</Text>
</Button>
<Button size="small" variant="ghost" color="danger" leadingIcon={mdiTrashCanOutline} onclick={removeAll}>
<Text class="hidden md:block">Delete All</Text>
</Button>
</HStack>
{/snippet}
<section id="setting-content" class="flex place-content-center sm:mx-4"> <section id="setting-content" class="flex place-content-center sm:mx-4">
<section class="w-full pb-28 sm:w-5/6 md:w-[850px]"> <section class="w-full pb-28 sm:w-5/6 md:w-[850px]">
<table class="mt-5 w-full text-start"> <table class="mt-5 w-full text-start">