2024-02-05 02:56:29 +00:00
import React , { useState , useEffect , useCallback } from 'react' ;
2024-01-04 09:33:36 +00:00
import { Link , useLocation } from 'react-router-dom' ;
2023-12-26 06:35:38 +00:00
2024-01-04 09:33:36 +00:00
import * as EgovNet from 'api/egovFetch' ;
import URL from 'constants/url' ;
2023-12-26 06:35:38 +00:00
2024-01-04 09:33:36 +00:00
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin' ;
import EgovPaging from 'components/EgovPaging' ;
import { itemIdxByPage } from 'utils/calc' ;
function PrivacyConnections ( props ) {
// console.group("EgovAdminPrivacyList");
// console.log("[Start] EgovAdminPrivacyList ------------------------------");
// console.log("EgovAdminPrivacyList [props] : ", props);
const location = useLocation ( ) ;
// console.log("EgovAdminPrivacyList [location] : ", location);
// const cndRef = useRef();
// const wrdRef = useRef();
// eslint-disable-next-line no-unused-vars
const [ searchCondition , setSearchCondition ] = useState ( location . state ? . searchCondition || { pageIndex : 1 , searchCnd : '0' , searchWrd : '' } ) ; // 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시
const [ paginationInfo , setPaginationInfo ] = useState ( { } ) ;
const [ listTag , setListTag ] = useState ( [ ] ) ;
const retrieveList = useCallback ( ( srchCnd ) => {
// console.groupCollapsed("EgovAdminUsageList.retrieveList()");
const retrieveListURL = '/admin/logs/privacy' ;
const requestOptions = {
method : "POST" ,
headers : {
'Content-type' : 'application/json' ,
} ,
body : JSON . stringify ( srchCnd )
}
EgovNet . requestFetch ( retrieveListURL ,
requestOptions ,
( resp ) => {
setPaginationInfo ( resp . result . paginationInfo ) ;
let mutListTag = [ ] ;
listTag . push ( < p className = "no_data" key = "0" > 데이터가 없습니다 . < / p > ) ; // 게시판 목록 초기값
const resultCnt = parseInt ( resp . result . resultCnt ) ;
2024-01-05 08:56:07 +00:00
const currentPageNo = resp . result . paginationInfo . pageIndex ;
const pageSize = resp . result . paginationInfo . rowCnt ;
2024-01-04 09:33:36 +00:00
const startIndex = ( currentPageNo - 1 ) * pageSize ;
const endIndex = Math . min ( startIndex + pageSize , resultCnt ) ;
// 리스트 항목 구성
for ( let index = startIndex ; index < endIndex ; index ++ ) {
const listIdx = itemIdxByPage ( resultCnt , currentPageNo , 0 , index ) ; // pageSize 로 넣으면 listIdx값이 2배씩 줄어서 0으로 수정
const item = resp . result . resultList [ index ] ;
mutListTag . push (
< div key = { listIdx } className = "list_item" >
< div > { listIdx } < / div >
< div > { item . userId } < / div >
< div > { item . targetUserId } < / div >
< div > { item . accessType === "PRV_LIST" ? "사용자현황 조회" : item . accessType === "PRV_VIEW" ? "User 상세조회" : "User 수정" } < / div >
< div > { item . ipAddress } < / div >
< div > { item . accessDt } < / div >
< / div >
) ;
}
setListTag ( mutListTag ) ;
} ,
function ( resp ) {
console . log ( "err response : " , resp ) ;
}
) ;
// console.groupEnd("EgovAdminPrivacyList.retrieveList()");
2024-02-05 02:56:29 +00:00
// eslint-disable-next-line react-hooks/exhaustive-deps
2024-01-04 09:33:36 +00:00
} , [ listTag ] ) ;
useEffect ( ( ) => {
retrieveList ( searchCondition ) ;
// eslint-disable-next-line react-hooks/exhaustive-deps
} , [ ] ) ;
// console.log("------------------------------EgovAdminPrivacyList [End]");
// console.groupEnd("EgovAdminPrivacyList");
2023-12-26 06:35:38 +00:00
return (
< div className = "container" >
2024-01-04 09:33:36 +00:00
< div className = "c_wrap" >
{ /* <!-- Location --> */ }
< div className = "location" >
< ul >
< li > < Link to = { URL . MAIN } className = "home" > Home < / Link > < / li >
< li > < Link to = { URL . ADMIN } > 사이트관리 < / Link > < / li >
< li > 로그현황 < / li >
2024-01-12 06:06:29 +00:00
< li > 개인정보 로그현황 < / li >
2024-01-04 09:33:36 +00:00
< / ul >
< / div >
{ /* <!--// Location --> */ }
< div className = "layout" >
{ /* <!-- Navigation --> */ }
< EgovLeftNav > < / EgovLeftNav >
{ /* <!--// Navigation --> */ }
< div className = "contents NOTICE_LIST" id = "contents" >
{ /* <!-- 본문 --> */ }
< div className = "top_tit" >
< h1 className = "tit_1" > 개인정보 로그현황 < / h1 >
< / div >
2024-01-12 06:06:29 +00:00
{ /* <!-- 개인정보 로그목록 --> */ }
2024-01-04 09:33:36 +00:00
< div className = "board_list BRD009" >
< div className = "head" >
< span > 번호 < / span >
< span > 관리자 ID < / span >
< span > 수정 ID < / span >
< span > 타입 < / span >
< span > 접속IP < / span >
< span > 변경일자 < / span >
< / div >
< div className = "result" >
{ listTag }
< / div >
< / div >
2024-01-12 06:06:29 +00:00
{ /* <!--// 개인정보 로그목록 --> */ }
2024-01-04 09:33:36 +00:00
< div className = "board_bot" >
{ /* <!-- Paging --> */ }
< EgovPaging pagination = { paginationInfo } moveToPage = { passedPage => {
retrieveList ( { ... searchCondition , pageIndex : passedPage } ) //, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value
} } / >
{ /* <!--/ Paging --> */ }
< / div >
{ /* <!--// 본문 --> */ }
< / div >
< / div >
< / div >
2023-12-26 06:35:38 +00:00
< / div >
) ;
}
2024-01-04 09:33:36 +00:00
export default PrivacyConnections ;