mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore(server) Add job for storage migration (#1117)
This commit is contained in:
parent
8998a79ff9
commit
de69d0031e
33 changed files with 398 additions and 241 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
let allJobsStatus: AllJobStatusResponseDto;
|
||||
let setIntervalHandler: NodeJS.Timer;
|
||||
|
||||
onMount(async () => {
|
||||
const { data } = await api.jobApi.getAllJobsStatus();
|
||||
allJobsStatus = data;
|
||||
|
|
@ -104,6 +105,33 @@
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
const runTemplateMigration = async () => {
|
||||
try {
|
||||
const { data } = await api.jobApi.sendJobCommand(JobId.StorageTemplateMigration, {
|
||||
command: JobCommand.Start
|
||||
});
|
||||
|
||||
if (data) {
|
||||
notificationController.show({
|
||||
message: `Storage migration started`,
|
||||
type: NotificationType.Info
|
||||
});
|
||||
} else {
|
||||
notificationController.show({
|
||||
message: `All files have been migrated to the new storage template`,
|
||||
type: NotificationType.Info
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('[ERROR] runTemplateMigration', e);
|
||||
|
||||
notificationController.show({
|
||||
message: `Error running template migration job, check console for more detail`,
|
||||
type: NotificationType.Error
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-10">
|
||||
|
|
@ -135,4 +163,20 @@
|
|||
>
|
||||
Note that some asset does not have any object detected, this is normal.
|
||||
</JobTile>
|
||||
|
||||
<JobTile
|
||||
title={'Storage migration'}
|
||||
subtitle={''}
|
||||
on:click={runTemplateMigration}
|
||||
jobStatus={allJobsStatus?.isStorageMigrationActive}
|
||||
waitingJobCount={allJobsStatus?.storageMigrationQueueCount.waiting}
|
||||
activeJobCount={allJobsStatus?.storageMigrationQueueCount.active}
|
||||
>
|
||||
Apply the current
|
||||
<a
|
||||
href="/admin/system-settings?open=storage-template"
|
||||
class="text-immich-primary dark:text-immich-dark-primary">Storage template</a
|
||||
>
|
||||
to previously uploaded assets
|
||||
</JobTile>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
export let title: string;
|
||||
export let subtitle = '';
|
||||
|
||||
let isOpen = false;
|
||||
export let isOpen = false;
|
||||
const toggle = () => (isOpen = !isOpen);
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -214,6 +214,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="migration-info" class="text-sm mt-4">
|
||||
<p>
|
||||
Template changes will only apply to new assets. To retroactively apply the template to
|
||||
previously uploaded assets, run the <a
|
||||
href="/admin/jobs-status"
|
||||
class="text-immich-primary dark:text-immich-dark-primary">Storage Migration Job</a
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<SettingButtonsRow
|
||||
on:reset={reset}
|
||||
on:save={saveSetting}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue