mirror of
https://github.com/immich-app/immich.git
synced 2026-05-24 08:32:28 -04:00
a16d233a0c
* feat: sort imports * fix: something?
32 lines
957 B
TypeScript
32 lines
957 B
TypeScript
import { MaintenanceAction, setMaintenanceMode, type SetMaintenanceModeDto } from '@immich/sdk';
|
|
import type { ActionItem } from '@immich/ui';
|
|
import { mdiProgressWrench } from '@mdi/js';
|
|
import type { MessageFormatter } from 'svelte-i18n';
|
|
import { handleError } from '$lib/utils/handle-error';
|
|
import { getFormatter } from '$lib/utils/i18n';
|
|
|
|
export const getMaintenanceAdminActions = ($t: MessageFormatter) => {
|
|
const StartMaintenance: ActionItem = {
|
|
title: $t('admin.maintenance_start'),
|
|
onAction: () =>
|
|
handleSetMaintenanceMode({
|
|
action: MaintenanceAction.Start,
|
|
}),
|
|
icon: mdiProgressWrench,
|
|
};
|
|
|
|
return { StartMaintenance };
|
|
};
|
|
|
|
export const handleSetMaintenanceMode = async (dto: SetMaintenanceModeDto) => {
|
|
const $t = await getFormatter();
|
|
|
|
try {
|
|
await setMaintenanceMode({
|
|
setMaintenanceModeDto: dto,
|
|
});
|
|
} catch (error) {
|
|
handleError(error, $t('admin.maintenance_start_error'));
|
|
}
|
|
};
|