-
Notifications
You must be signed in to change notification settings - Fork 12
/
Tasks.jsx
44 lines (41 loc) · 1.16 KB
/
Tasks.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from 'react';
import './Tasks.scss';
import { CircularProgress } from '@mui/material';
import { get, map, isEmpty } from 'lodash';
import Task from './Task'
const Tasks = ({ tasks, isLoading, error, onRevoke, onDownload }) => {
const [open, setOpen] = React.useState(null);
return (
<div className='col-md-12 tasks-container'>
{
isLoading &&
<div style={{textAlign: 'center'}}>
<CircularProgress />
</div>
}
{
error &&
<div className='failure' style={{padding: '10px'}}>
{ get(error, 'detail') || get(error, 'exception') || error }
</div>
}
{
isEmpty(tasks) && !error && !isLoading ?
'No Tasks Found.' :
map(
tasks,
task => <Task
key={task.id || task.task}
task={task}
open={(task?.id || task.task) == open}
onOpen={taskId => setOpen(taskId)}
onClose={() => setOpen(null)}
onRevoke={onRevoke}
onDownload={onDownload}
/>
)
}
</div>
)
}
export default Tasks