fix: missing changes for job
This commit is contained in:
parent
6e2ba7acab
commit
4e98b1001b
5 changed files with 13 additions and 35 deletions
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
ffmpegConfig = ffmpegDefault;
|
||||
ffmpegConfig = { ...ffmpegDefault };
|
||||
|
||||
notificationController.show({
|
||||
message: 'Reset FFmpeg settings to default',
|
||||
|
|
|
@ -3,14 +3,17 @@
|
|||
notificationController,
|
||||
NotificationType,
|
||||
} from '$lib/components/shared-components/notification/notification';
|
||||
import { api, JobName, SystemConfigDto, SystemConfigJobDto } from '@api';
|
||||
import { api, JobName, SystemConfigJobDto } from '@api';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import { fade } from 'svelte/transition';
|
||||
import { handleError } from '../../../../utils/handle-error';
|
||||
import SettingButtonsRow from '../setting-buttons-row.svelte';
|
||||
import SettingInputField, { SettingInputFieldType } from '../setting-input-field.svelte';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
save: SystemConfigJobDto;
|
||||
}>();
|
||||
|
||||
export let config: SystemConfigDto;
|
||||
export let jobConfig: SystemConfigJobDto; // this is the config that is being edited
|
||||
export let jobDefault: SystemConfigJobDto;
|
||||
export let savedConfig: SystemConfigJobDto;
|
||||
|
@ -18,25 +21,6 @@
|
|||
const ignoredJobs = [JobName.BackgroundTask, JobName.Search] as JobName[];
|
||||
const jobNames = Object.values(JobName).filter((jobName) => !ignoredJobs.includes(jobName as JobName));
|
||||
|
||||
async function saveSetting() {
|
||||
try {
|
||||
const { data } = await api.systemConfigApi.updateConfig({
|
||||
systemConfigDto: {
|
||||
...config,
|
||||
job: jobConfig,
|
||||
},
|
||||
});
|
||||
|
||||
jobConfig = { ...data.job };
|
||||
savedConfig = { ...data.job };
|
||||
config = { ...data };
|
||||
|
||||
notificationController.show({ message: 'Job settings saved', type: NotificationType.Info });
|
||||
} catch (error) {
|
||||
handleError(error, 'Unable to save settings');
|
||||
}
|
||||
}
|
||||
|
||||
async function reset() {
|
||||
jobConfig = { ...savedConfig };
|
||||
|
||||
|
@ -47,7 +31,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
jobConfig = jobDefault;
|
||||
jobConfig = { ...jobDefault };
|
||||
|
||||
notificationController.show({
|
||||
message: 'Reset Job settings to default',
|
||||
|
@ -75,7 +59,7 @@
|
|||
<div class="ml-4">
|
||||
<SettingButtonsRow
|
||||
on:reset={reset}
|
||||
on:save={saveSetting}
|
||||
on:save={() => dispatch('save', jobConfig)}
|
||||
on:reset-to-default={resetToDefault}
|
||||
showResetToDefault={!isEqual(jobConfig, jobDefault)}
|
||||
/>
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
async function resetToDefault() {
|
||||
oauthConfig = oauthDefault;
|
||||
oauthConfig = { ...oauthDefault };
|
||||
|
||||
notificationController.show({
|
||||
message: 'Reset OAuth settings to default',
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
export let passwordLoginConfig: SystemConfigPasswordLoginDto; // this is the config that is being edited
|
||||
export let passwordLoginDefault: SystemConfigPasswordLoginDto;
|
||||
export let savedConfig: SystemConfigPasswordLoginDto;
|
||||
console.log(config);
|
||||
console.log(passwordLoginConfig);
|
||||
console.log(savedConfig);
|
||||
|
||||
let isConfirmOpen = false;
|
||||
let handleConfirm: (value: boolean) => void;
|
||||
|
||||
|
|
|
@ -41,9 +41,6 @@
|
|||
});
|
||||
}
|
||||
};
|
||||
$: {
|
||||
console.log(config);
|
||||
}
|
||||
</script>
|
||||
|
||||
<SettingAccordion title="Thumbnail Settings" subtitle="Manage the resolution of thumbnail sizes">
|
||||
|
@ -74,7 +71,7 @@
|
|||
...currentConfig,
|
||||
ffmpeg,
|
||||
},
|
||||
'ffmpeg',
|
||||
'FFmpeg',
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
@ -87,7 +84,6 @@
|
|||
>
|
||||
<JobSettings
|
||||
bind:savedConfig={currentConfig.job}
|
||||
bind:config
|
||||
bind:jobConfig={config.job}
|
||||
jobDefault={defaultConfig.job}
|
||||
on:save={({ detail: job }) => {
|
||||
|
@ -96,7 +92,7 @@
|
|||
...currentConfig,
|
||||
job,
|
||||
},
|
||||
'Password Authentication',
|
||||
'Job Settings',
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
|
Loading…
Add table
Reference in a new issue