-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathUploadValidationResultsTable.tsx
72 lines (67 loc) · 1.66 KB
/
UploadValidationResultsTable.tsx
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import Table from 'react-bootstrap/Table'
enum Severity {
Error = 'ERR',
Warning = 'WARN',
Info = 'INFO',
}
interface Props {
errors: {
severity: Severity
message: string
tab?: string
row?: string
col?: string
}[]
}
const UploadValidationResultsTable = ({ errors }: Props) => {
return (
<>
<div className="row">
<h3 className="col text-danger">Validation Results</h3>
</div>
<div className="row">
<div className="col">
<Table
striped
bordered
responsive="sm"
className=" col-sm-12 col-md-6"
>
<thead>
<tr>
<th>#</th>
<th>Level</th>
<th>Message</th>
<th>Tab</th>
<th>Row</th>
<th>Col</th>
</tr>
</thead>
<tbody>
{errors.map((error, i) => (
<tr key={i}>
<td>{i + 1}</td>
<td
className={
error.severity === Severity.Error
? 'table-danger'
: 'table-warning'
}
>
{error.severity === Severity.Error ? 'Error' : 'Warning'}
</td>
<td>{error.message}</td>
<td>{error.tab}</td>
<td>{error.row}</td>
<td>{error.col}</td>
</tr>
))}
</tbody>
</Table>
</div>
</div>
</>
)
}
export default UploadValidationResultsTable
export { Severity }