1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-06 06:07:29 +02:00

refactor(web): use callbacks for admin setting events (#10997)

This commit is contained in:
Michel Heusschen
2024-07-10 15:57:18 +02:00
committed by GitHub
parent 545b206076
commit 1dd1d36120
20 changed files with 125 additions and 153 deletions

View File

@ -1,9 +1,8 @@
<script lang="ts">
import { LogLevel, type SystemConfigDto } from '@immich/sdk';
import { isEqual } from 'lodash-es';
import { createEventDispatcher } from 'svelte';
import { fade } from 'svelte/transition';
import type { SettingsEventType } from '../admin-settings';
import type { SettingsResetEvent, SettingsSaveEvent } from '../admin-settings';
import SettingButtonsRow from '$lib/components/shared-components/settings/setting-buttons-row.svelte';
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
@ -13,8 +12,8 @@
export let defaultConfig: SystemConfigDto;
export let config: SystemConfigDto; // this is the config that is being edited
export let disabled = false;
const dispatch = createEventDispatcher<SettingsEventType>();
export let onReset: SettingsResetEvent;
export let onSave: SettingsSaveEvent;
</script>
<div>
@ -44,8 +43,8 @@
/>
<SettingButtonsRow
on:reset={({ detail }) => dispatch('reset', { ...detail, configKeys: ['logging'] })}
on:save={() => dispatch('save', { logging: config.logging })}
onReset={(options) => onReset({ ...options, configKeys: ['logging'] })}
onSave={() => onSave({ logging: config.logging })}
showResetToDefault={!isEqual(savedConfig.logging, defaultConfig.logging)}
{disabled}
/>