-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathConflictedResourcesTable.tsx
More file actions
49 lines (43 loc) · 1.77 KB
/
ConflictedResourcesTable.tsx
File metadata and controls
49 lines (43 loc) · 1.77 KB
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
import { useMemo } from 'react'
import { FiltersTypeEnum, PaginationEnum, Table, TableViewWrapperProps } from '../Table'
import { RowsType } from '../Table/types'
import { CONFLICTED_RESOURCES_COLUMNS } from './constants'
import { ConflictedResourcesTableProps, ResourceConflictItemType } from './types'
import './ConflictedResourcesTable.scss'
const Wrapper = ({ children }: TableViewWrapperProps<unknown, FiltersTypeEnum.STATE>) => (
<div className="dc__overflow-hidden flexbox-col flex-grow-1">{children}</div>
)
const ConflictedResourcesTable = ({ resourceConflictDetails }: ConflictedResourcesTableProps) => {
const rows: RowsType<ResourceConflictItemType> = useMemo(
() =>
(resourceConflictDetails || []).map<RowsType<ResourceConflictItemType>[number]>((resource) => ({
data: resource,
id: resource.id,
})),
[resourceConflictDetails],
)
return (
<Table<ResourceConflictItemType, FiltersTypeEnum.STATE>
id="table__resource-conflict-details"
columns={CONFLICTED_RESOURCES_COLUMNS}
rows={rows}
emptyStateConfig={{
noRowsConfig: {
title: 'No resource found',
},
noRowsForFilterConfig: {
title: 'No results',
subTitle: "We couldn't find any matching results",
},
}}
paginationVariant={PaginationEnum.NOT_PAGINATED}
additionalFilterProps={{
initialSortKey: 'name' satisfies keyof ResourceConflictItemType,
}}
filtersVariant={FiltersTypeEnum.STATE}
ViewWrapper={Wrapper}
filter={null}
/>
)
}
export default ConflictedResourcesTable