Mirror of https://github.com/roostorg/osprey
github.com/roostorg/osprey
1import styles from './BulkActionPage.module.css';
2import { BulkActionJobTable } from './BulkActionTable';
3import BulkActionStartModalContainer from './BulkActionStartModal';
4import useBulkActionStore from '../../stores/BulkActionStore';
5import { useEffect } from 'react';
6
7export const BulkActionPage = () => {
8 const { getJobs, jobs, cancelJob, jobPollingInProgress } = useBulkActionStore();
9
10 useEffect(() => {
11 let cleanup: (() => void) | undefined;
12
13 getJobs().then((cleanupFn) => {
14 if (cleanupFn) {
15 cleanup = cleanupFn;
16 }
17 });
18
19 return () => {
20 if (cleanup) {
21 cleanup();
22 }
23 };
24 }, []);
25
26 return (
27 <div className={styles.viewContainer}>
28 <div className={styles.content}>
29 <div className={styles.header}>
30 <span>Start a new Bulk Action Job</span>
31 <BulkActionStartModalContainer />
32 </div>
33 <BulkActionJobTable jobs={jobs} onCancelJob={cancelJob} jobPollingInProgress={jobPollingInProgress} />
34 </div>
35 </div>
36 );
37};