|
| 1 | +import { |
| 2 | + DEFAULT_BASE_PAGE_SIZE, |
| 3 | + GenericFilterEmptyState, |
| 4 | + noop, |
| 5 | + Pagination, |
| 6 | + SortableTableHeaderCell, |
| 7 | + SortingOrder, |
| 8 | +} from '@devtron-labs/devtron-fe-common-lib' |
| 9 | +import { ExposureListProps } from '../security.types' |
| 10 | + |
| 11 | +const ExposureList = ({ |
| 12 | + appListResponse, |
| 13 | + areFiltersApplied, |
| 14 | + clearExposureListFilters, |
| 15 | + offset, |
| 16 | + pageSize, |
| 17 | + changePage, |
| 18 | + changePageSize, |
| 19 | +}: ExposureListProps) => { |
| 20 | + const appListLength = appListResponse.result.scanList.length |
| 21 | + if (!appListLength && areFiltersApplied) { |
| 22 | + return ( |
| 23 | + <div className="dc__position-rel" style={{ height: 'calc(100vh - 200px)' }}> |
| 24 | + <GenericFilterEmptyState handleClearFilters={clearExposureListFilters} /> |
| 25 | + </div> |
| 26 | + ) |
| 27 | + } |
| 28 | + return appListLength ? ( |
| 29 | + <> |
| 30 | + <div className="w-100"> |
| 31 | + <div className="fs-12 fw-6 lh-20 cn-7 pl-20 pr-20 dc__border-bottom px-20 vulnerability-exp-table-row h-36"> |
| 32 | + <SortableTableHeaderCell |
| 33 | + title="NAME" |
| 34 | + isSortable={false} |
| 35 | + isSorted |
| 36 | + triggerSorting={noop} |
| 37 | + disabled={false} |
| 38 | + sortOrder={SortingOrder.ASC} |
| 39 | + /> |
| 40 | + <SortableTableHeaderCell |
| 41 | + title="ENVIRONMENT" |
| 42 | + isSortable={false} |
| 43 | + isSorted |
| 44 | + triggerSorting={noop} |
| 45 | + disabled |
| 46 | + sortOrder={SortingOrder.ASC} |
| 47 | + /> |
| 48 | + <SortableTableHeaderCell |
| 49 | + title="POLICY" |
| 50 | + isSortable={false} |
| 51 | + isSorted |
| 52 | + triggerSorting={noop} |
| 53 | + disabled |
| 54 | + sortOrder={SortingOrder.ASC} |
| 55 | + /> |
| 56 | + </div> |
| 57 | + {appListResponse.result.scanList.map((cve) => ( |
| 58 | + <div |
| 59 | + key={`${cve.appName}-${cve.envName}`} |
| 60 | + className="dc__border-bottom-n1 dc__hover-n50 vulnerability-exp-table-row px-20 h-44 dc__align-items-center fs-13 lh-20 cn-9" |
| 61 | + > |
| 62 | + <span>{cve.appName}</span> |
| 63 | + <span>{cve.envName}</span> |
| 64 | + <span> |
| 65 | + <span className={`security-tab__cell-policy--${cve.policy}`}> |
| 66 | + {cve.policy.toUpperCase()} |
| 67 | + </span> |
| 68 | + </span> |
| 69 | + </div> |
| 70 | + ))} |
| 71 | + </div> |
| 72 | + {appListLength > DEFAULT_BASE_PAGE_SIZE && ( |
| 73 | + <Pagination |
| 74 | + rootClassName="flex dc__content-space px-20" |
| 75 | + size={appListLength} |
| 76 | + pageSize={pageSize} |
| 77 | + offset={offset} |
| 78 | + changePage={changePage} |
| 79 | + changePageSize={changePageSize} |
| 80 | + /> |
| 81 | + )} |
| 82 | + </> |
| 83 | + ) : null |
| 84 | +} |
| 85 | + |
| 86 | +export default ExposureList |
0 commit comments