commit 3951198256252b8691ff43e4512e7a7df282d76b Author: kric_jspark Date: Fri Oct 24 10:24:44 2025 +0900 firts commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b98026 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +.cursor/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# lock 파일 업데이트 방지 +pnpm-lock.yaml +package-lock.json +yarn.lock +tsconfig.node.tsbuildinfo \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..92c9a93 --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +# Getting Started with Create React App + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in your browser. + +The page will reload when you make changes.\ +You may also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.\ +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can't go back!** + +If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. + +You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +### Code Splitting + +This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) + +### Analyzing the Bundle Size + +This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) + +### Making a Progressive Web App + +This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) + +### Advanced Configuration + +This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) + +### Deployment + +This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) + +### `npm run build` fails to minify + +This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) + + +# 2022-07-19 hwkim start \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..24b0b39 --- /dev/null +++ b/package.json @@ -0,0 +1,59 @@ +{ + "name": "start-areact-app", + "version": "0.1.0", + "private": true, + "dependencies": { + "@testing-library/jest-dom": "^5.16.1", + "@testing-library/react": "^12.1.2", + "@testing-library/user-event": "^13.5.0", + "axios": "^0.27.2", + "chart.js": "^3.9.1", + "chartjs-plugin-zoom": "^1.2.1", + "cors": "^2.8.5", + "echarts": "^5.4.0", + "echarts-for-react": "^3.0.2", + "express": "^4.18.1", + "immutability-helper": "^3.1.1", + "mssql": "^7.3.5", + "react": "^17.0.2", + "react-beautiful-dnd": "^13.1.0", + "react-chartjs-2": "^4.3.1", + "react-device-detect": "^2.2.2", + "react-dnd": "^16.0.1", + "react-dnd-html5-backend": "^16.0.1", + "react-dom": "^17.0.2", + "react-router-dom": "^5.3.3", + "react-scripts": "^5.0.1", + "react-slide-toggle": "^0.3.5", + "react-spinners": "^0.13.4", + "react-wordcloud": "^1.2.7", + "recoil": "^0.7.4", + "recoil-persist": "^4.2.0", + "redux": "^4.1.2", + "web-vitals": "^2.1.4" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..9f3d37d Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon_kart.png b/public/favicon_kart.png new file mode 100644 index 0000000..165f6e3 Binary files /dev/null and b/public/favicon_kart.png differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..bb61bcc --- /dev/null +++ b/public/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + + KART + + +
+ + diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..15d513d --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "KART", + "name": "KRI Analysis Report Tool", + "icons": [ + { + "src": "favicon_kart.png", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#1CAE81", + "background_color": "#ffffff" +} diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/server/config/db.js b/server/config/db.js new file mode 100644 index 0000000..1a71cc5 --- /dev/null +++ b/server/config/db.js @@ -0,0 +1,9 @@ +var mssql = require('mssql'); +const db = mssql.createPool({ + host : '10.10.11.7:20022', + user : 'kri', + password : 'kri#51304', + database : 'kon_db' +}); + +module.exports = db; \ No newline at end of file diff --git a/server/server.js b/server/server.js new file mode 100644 index 0000000..55d843e --- /dev/null +++ b/server/server.js @@ -0,0 +1,23 @@ +const express = require('express'); +const app = express(); +const PORT = process.env.PORT || 4000; +const db = require('./config/db'); + +app.listen(PORT, () => { + console.log(`Server On : http://localhost:${PORT}/`); +}) + +//const express = require('express'); +//const path = require('path'); +//const app = express(); +// +//const http = require('http').createServer(app); +//http.listen(8080, function () { +// console.log('listening on 8080') +//}); +// +//app.use(express.static( path.join(__dirname, 'public'))) +// +//app.get('/',function(request, response){ +// response.sendFile( path.join(__dirname, 'public/main.html')) +//}) \ No newline at end of file diff --git a/src/App.js b/src/App.js new file mode 100644 index 0000000..769e67d --- /dev/null +++ b/src/App.js @@ -0,0 +1,47 @@ +import React, {useEffect} from 'react'; +import { Switch, Route, useLocation } from 'react-router-dom'; +import { useSetRecoilState } from 'recoil'; +import { pageState } from './states/Token'; + +import {AuthRoute} from './components/AuthRoute' +import Main from './views/Main'; +import Current from './views/Report/Current'; +import Quota from './views/Report/Quota'; +import Tabulation from './views/Report/Tabulation'; +import Crosstab from './views/Report/Crosstab'; +import Derived from './views/Management/Derived'; +import Exim from './views/Management/Exim'; +import Login from './views/Login'; +import Logout from './views/Logout'; +import External from './views/External'; +import { PageLoading } from './components/Loading'; + +import './resources/css/style.css'; +import { Suspense } from 'react'; + +function App(props) { + const location = useLocation(); + const setIsLoading = useSetRecoilState(pageState); + + useEffect(() => { + setIsLoading(true); + }, [location]); + + return ( + + + + + + + + + + + + + + ) +} + +export default App; \ No newline at end of file diff --git a/src/components/AuthRoute.js b/src/components/AuthRoute.js new file mode 100644 index 0000000..b9afdcf --- /dev/null +++ b/src/components/AuthRoute.js @@ -0,0 +1,50 @@ +import React, { useEffect, useState } from 'react'; +import {Redirect, Route, useHistory, } from 'react-router-dom'; +import { useRecoilValue } from 'recoil'; +import { tokenState, ptokenState } from '../states/Token'; +import {SetOption,SyncAxios,URL_KART_NS} from '../modules/Axios'; + + +export const AuthRoute = (props) => { + const history = useHistory(); + const [isAuth, setIsAuth] = useState(null); + const token = useRecoilValue(tokenState); + const pToken = useRecoilValue(ptokenState); + + useEffect(() =>{ + const url = URL_KART_NS + '/encrypt/authentication'; + const method = 'GET'; + const headers = {'Accept':'application/json', 'Content-Type': 'application/json;charset=UTP-8', "token":token.token}; + const body = {}; + + const options = SetOption(false, url, method, headers, body); + SyncAxios(options).then(response => { + if(response.status === 200){ + setIsAuth(true); + } + else{ + setIsAuth(false); + } + }); + }); + + if(isAuth === null) return null; + if(isAuth === false){ + return ; + } + if(props.useSkey && (pToken.skey === null || pToken.skey === '')){ + history.push("/Logout"); + return + } + else if(props.path === "/" || pToken.onlyPage === 0){ + return + } + else if(pToken.onlyPage === 1){ + if(pToken.path.toLowerCase() === props.path.toLowerCase()){ + return + } + else{ + history.goBack(); + } + } +} \ No newline at end of file diff --git a/src/components/Bookmark.js b/src/components/Bookmark.js new file mode 100644 index 0000000..76e25ca --- /dev/null +++ b/src/components/Bookmark.js @@ -0,0 +1,130 @@ +import React, { useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { tokenState, ptokenState } from '../states/Token'; +import { bookmarkFormat } from '../states/Format'; +import {SetOption,SyncAxios, URL_KART_NS} from '../modules/Axios'; +import Slider from 'react-slick'; +import Img from '../components/Img'; +import 'slick-carousel/slick/slick.css'; +import 'slick-carousel/slick/slick-theme.css'; + +const NextArrow = (props) => { + const { className, style } = props; + return ( +
+ ); + }; + + const PrevArrow = (props) => { + const { className, style } = props; + return ( +
+ ); + }; + +export const BookmarkList = (props) => { + const sliderRef = React.createRef(); + const token = useRecoilValue(tokenState); + const pToken = useRecoilValue(ptokenState); + const [dataList, setdataList] = useState([]); + + let settings = { + className:"slick_width", + infinite: false, + speed: 500, + initialSlide: 0, + slidesToScroll: 2, + variableWidth: true, + prevArrow:, + nextArrow: + }; + + const setBookMarkList = () => { + const url = URL_KART_NS + '/project/bookmark/'+ props.page.toUpperCase(); + const method = 'GET'; + const headers = {'Accept':'application/json', 'Content-Type': 'application/json;charset=UTP-8', "token":token.token, "skey":pToken.skey}; + const body = {}; + const options = SetOption(true, url, method, headers, body); + SyncAxios(options).then(response => { + let responseData = []; + if(response.data.length > 0){ + for(let i = 0; i < response.data.length; i++){ + responseData.push({ + 'id': response.data[i].BOOKMARK_ID, + 'title': response.data[i].BOOKMARK_TITLE, + 'json' : response.data[i].BOOKMARK_JSON, + 'info' : response.data[i].BOOKMARK_INFO, + 'ismine' : response.data[i].IS_MINE, + 'isopen' : response.data[i].IS_OPEN + }); + } + } + + settings["slidesToShow"] = response.data.length; + setdataList(responseData); + }); + } + + useEffect(() => { + if(props.isMobile && dataList.length > 0){ + props.setSelectedBookMark(dataList[0]); + } + },[pToken.skey,dataList]) + + useEffect(() => { + setBookMarkList(); + },[pToken.skey]) + + useEffect(() => { + if(props.isViewBookMark){ + setBookMarkList(); + } + },[props.isViewBookMark]) + + return ( + props.isMobile==false? +
+
+ { + dataList.length < 9 ? null : + {sliderRef.current.slickPrev()}} > + + + } +
+ + + { + dataList.map((data, i) => ( +
{props.setSelectedBookMark(data)}} >{data.title}
+ )) + } + +
+
+ { + dataList.length < 9 ? null : + {sliderRef.current.slickNext()}} > + + + } +
+
+ : +
+
    + { + dataList.map((data, i) => ( +
  • {props.setSelectedBookMark(data)}} >{data.title}
  • + )) + } +
+
+ ); +} diff --git a/src/components/BookmarkArea.js b/src/components/BookmarkArea.js new file mode 100644 index 0000000..51e765e --- /dev/null +++ b/src/components/BookmarkArea.js @@ -0,0 +1,151 @@ +import React, { useEffect, useState } from 'react'; +import { useRecoilValue } from 'recoil'; +import { tokenState, ptokenState } from '../states/Token'; +import { bookmarkFormat,bookmarkJsonFormat } from '../states/Format'; +import {SetOption,SyncAxios,URL_KART_NS} from '../modules/Axios'; +import Img from './Img'; + +export const BookMarkArea = (props) => { + const token = useRecoilValue(tokenState); + const pToken = useRecoilValue(ptokenState); + const [titleValue, setTitleValue] = useState(props.selectedBookMark.title); + const [isChecked, setIsChecked] = useState(false); + const [infoValue, setInfoValue] = useState(props.selectedBookMark.info); + + const changeTitleValue = (e) => { + setTitleValue(e.target.value) + } + + const changeTextValue = (e) => { + setInfoValue(e.target.value) + } + + const updateBookMark = (isCreate) => { + let mode = 'update'; + let bookmarkID = props.selectedBookMark.id; + let bookmarkJson = JSON.parse(JSON.stringify(bookmarkJsonFormat)); + let isOpen = '1'; + let tempBannerArray = []; + + if(bookmarkID ==='' || isCreate){ + mode = 'create'; + bookmarkID = ''; + } + + //banner 정리 + props.selectedBanner.forEach((ele,i)=>{ + if(ele.length > 0){ + tempBannerArray.push(ele.join('|')); + } + }); + + bookmarkJson.INDEX = props.selectedIndex.join(','); + bookmarkJson.BANNER = tempBannerArray.join(','); + bookmarkJson.FILTER_CONDITION = props.filterCondition; + bookmarkJson.REAL_FILTER_CONDITION = props.realFilterCondition; + bookmarkJson.FILTER_ARRAY = props.filterArray; + bookmarkJson.OPTION = JSON.parse(props.optionString); + + if(isChecked){ + isOpen = '0'; + } + + const url = URL_KART_NS + '/project/bookmark/'+mode; + const method = 'POST'; + const headers = {'Accept':'application/json', 'Content-Type': 'application/json;charset=UTP-8', "token":token.token, "skey":pToken.skey}; + const body = { + bookmarkPage: props.page.toUpperCase(), + bookmarkID: bookmarkID, + bookmarkTitle: titleValue, + bookmarkInfo: infoValue, + bookmarkJson: JSON.stringify(bookmarkJson), + isOpen: isOpen + }; + const options = SetOption(true, url, method, headers, body); + SyncAxios(options).then(response => { + if(response.status === 200){ + props.setSelectedBookMark({ + id: response.data, + title: titleValue, + json : JSON.stringify(bookmarkJson), + ismine : "1", + isopen : isOpen, + info : infoValue + }) + props.onClose(false); + } + }); + } + + const deleteBookmark = () => { + if (window.confirm("정말 삭제 하시겠습니까?")) { + let bookmarkID = props.selectedBookMark.id; + const url = URL_KART_NS + '/project/bookmark/delete/'+bookmarkID; + const method = 'POST'; + const headers = {'Accept':'application/json', 'Content-Type': 'application/json;charset=UTP-8', "token":token.token, "skey":pToken.skey}; + const body = {}; + const options = SetOption(true, url, method, headers, body); + SyncAxios(options).then(response => { + if(response.status === 200){ + props.setSelectedBookMark(JSON.parse(JSON.stringify(bookmarkFormat))); + props.onClose(false); + } + }); + } + } + + useEffect(()=>{ + if(props.selectedBookMark.isopen === 1 || props.selectedBookMark.isopen === "1"){ + setIsChecked(false) + } + else{ + setIsChecked(true) + } + },[]) + + return ( +