diff --git a/src/components/common/User/UserIOCList.js b/src/components/common/User/UserIOCList.js deleted file mode 100644 index 7fbe2963ac9d95af0628e6425501791111d6deeb..0000000000000000000000000000000000000000 --- a/src/components/common/User/UserIOCList.js +++ /dev/null @@ -1,72 +0,0 @@ -import { useContext } from "react"; -import { Card, CardHeader } from "@mui/material"; -import { useEffect } from "react"; -import { initRequestParams } from "../Helper"; -import IOCTable from "../../IOC/IOCTable"; -import { apiContext } from "../../../api/DeployApi"; -import { useAPIMethod, usePagination } from "@ess-ics/ce-ui-common"; - -export function UserIocList({ userName }) { - const client = useContext(apiContext); - - const { - value: iocs, - wrapper: getIocs, - loading, - dataReady, - abort - } = useAPIMethod({ - fcn: client.apis.IOCs.listIocs, - call: false - }); - - const rowsPerPage = [20, 50]; - const { pagination, setPagination } = usePagination({ - rowsPerPageOptions: rowsPerPage, - initLimit: rowsPerPage[0], - initPage: 0 - }); - - // update pagination whenever search result total pages change - useEffect(() => { - setPagination({ totalCount: iocs?.totalCount ?? 0 }); - }, [setPagination, iocs?.totalCount]); - - // Request more results when pagination changes - useEffect(() => { - let requestParams = initRequestParams(pagination); - - requestParams.created_by = userName; - - getIocs(requestParams); - - return () => { - abort(); - }; - }, [getIocs, pagination, userName, abort]); - - // Invoked by Table on change to pagination - const onPage = (params) => { - setPagination(params); - abort(); - }; - - return ( - <Card variant="plain"> - <CardHeader - title={"IOCs registered"} - titleTypographyProps={{ - variant: "h2", - component: "h2" - }} - /> - <IOCTable - iocs={iocs?.iocList} - loading={loading || !dataReady} - rowType="explore" - pagination={pagination} - onPage={onPage} - /> - </Card> - ); -} diff --git a/src/components/common/User/index.js b/src/components/common/User/index.js index 416c1fc44ff1a708b7b8c28bf8597077ee8f2184..9359a560d4f8a2e33aec28892c68513b90db931f 100644 --- a/src/components/common/User/index.js +++ b/src/components/common/User/index.js @@ -1,6 +1,5 @@ -import { UserIocList } from "./UserIOCList"; import { UserOperationList } from "./UserOperationList"; import { UserProfile } from "./UserProfile"; import { UserAvatar } from "./UserAvatar"; -export { UserIocList, UserOperationList, UserProfile, UserAvatar }; +export { UserOperationList, UserProfile, UserAvatar }; diff --git a/src/views/UserPage/UserPageView.js b/src/views/UserPage/UserPageView.js index 3c1becaf22347e9b330b408ac1aa1f9830b8d1c6..2f92f8b5254515befb6dec10706b4a1783a52fd0 100644 --- a/src/views/UserPage/UserPageView.js +++ b/src/views/UserPage/UserPageView.js @@ -3,7 +3,6 @@ import { Grid } from "@mui/material"; import { GlobalAppBarContext } from "@ess-ics/ce-ui-common"; import { applicationTitle } from "../../components/common/Helper"; import { UserProfile } from "../../components/common/User/UserProfile"; -import { UserIocList } from "../../components/common/User/UserIOCList"; import { UserOperationList } from "../../components/common/User/UserOperationList"; export function UserPageView({ userName, userInfo }) { @@ -21,12 +20,6 @@ export function UserPageView({ userName, userInfo }) { > <UserProfile userInfo={userInfo} /> </Grid> - <Grid - item - xs={12} - > - <UserIocList userName={userName} /> - </Grid> <Grid item xs={12}