+ {fileName} + {/* tslint:disable-next-line jsx-no-lambda */} + handleDownload(url, fileName, OPENSRP_UPLOAD_DOWNLOAD_ENDPOINT)}> + {`(${DOWNLOAD})`} + +
, + row.providerID, + row.uploadDate, + ]; + }); +}; + +export const ClientListView = (props: ClientListViewProps & RouteComponentProps) => { + const { location, files, clientLabel } = props; + React.useEffect(() => { + if (!(files && files.length)) { + /** + * Fetch files incase the files are not available e.g when page is refreshed + */ + loadFiles().catch(err => displayError(err)); + } + /** + * We do not need to re-run since this effect doesn't depend on any values from api yet + */ + }, []); + /** Overide renderRows to render html inside td */ + let listViewProps; + if (files && files.length) { + listViewProps = { + data: buildListViewData(files), + headerItems: [FILE_NAME, OWNER, UPLOAD_DATE], + tableClass: TABLE_BORDERED_CLASS, + }; + } + /** Load Modal once we hit this route */ + if (location.pathname === UPLOAD_CLIENT_CSV_URL) { + return{LOADING}
; + } + + return{FILE_SUBMISSION_READY}
; +}; +export default UploadStatus; diff --git a/src/containers/pages/MDAPoint/ClientUploadStatus/tests/__snapshots__/index.test.tsx.snap b/src/containers/pages/MDAPoint/ClientUploadStatus/tests/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000000..46ac940992 --- /dev/null +++ b/src/containers/pages/MDAPoint/ClientUploadStatus/tests/__snapshots__/index.test.tsx.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`components/ClientUploadStatus Matches snapshot 1`] = ` ++ loading... +
+