Files
spacedrive/interface/app/$libraryId/Layout/Sidebar/JobManager/useOrphanJobs.tsx
ameer2468 2a5d5be4c0 Job Manager improvement & refactor (#783)
* d

* wip

* Nit: margin and padding tweak

* UI design tweaks

* Update Job.tsx

* Improve UI

* [WIP] - Refactor job manager

* remove invalidate explorer event on thumb generation. the event above performs atomic updates on the front end when new thumbnails are generated, now just need to make that work

* prettier formatting + removed unused imports

* UI tweaks

* progress bar width adjustment

* tweaks

* fix em

* fix thumbnail generation

* fix progress bar

* fix time

---------

Co-authored-by: Jamie Pine <ijamespine@me.com>
Co-authored-by: Brendan Allan <brendonovich@outlook.com>
Co-authored-by: Oscar Beaumont <oscar@otbeaumont.me>
2023-05-08 22:31:49 +00:00

24 lines
559 B
TypeScript

import { useMemo } from 'react';
import { JobReport } from '@sd/client';
export function useOrphanJobs(jobs: JobReport[], runningJobs: JobReport[]) {
const runningJobsNoChildren = useMemo(() => {
const singleRunningJobs = [];
for (const job of jobs) {
for (const runningJob of runningJobs) {
if (
job.parent_id !== runningJob.id &&
job.id !== runningJob.id &&
job.id !== job.id
) {
singleRunningJobs.push(runningJob);
}
}
}
return singleRunningJobs;
}, [jobs, runningJobs]);
return runningJobsNoChildren;
}