mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
chore(server) Add job for storage migration (#1117)
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user