From e26ec6a371043a88d10e137446d94bdb95ffa04a Mon Sep 17 00:00:00 2001 From: Ritik Jain Date: Mon, 31 May 2021 03:25:46 +0530 Subject: [PATCH 1/2] Fixed Bugs and add DockerFile --- Aidan/.dockerignore | 5 + Aidan/Dockerfile | 12 + Aidan/nginx.conf | 15 + Aidan/package.json | 4 +- Aidan/src/components/Alterdash.js | 83 +- Aidan/src/components/Dashboard.js | 2 +- Aidan/src/components/listItems.js | 1 - Aidan/src/index.js | 2 - Aidan/yarn.lock | 6856 +++++++++++++++++------------ 9 files changed, 4013 insertions(+), 2967 deletions(-) create mode 100644 Aidan/.dockerignore create mode 100644 Aidan/Dockerfile create mode 100644 Aidan/nginx.conf diff --git a/Aidan/.dockerignore b/Aidan/.dockerignore new file mode 100644 index 0000000..d6680ba --- /dev/null +++ b/Aidan/.dockerignore @@ -0,0 +1,5 @@ +.git +node_modules +build +.gitignore +*.md \ No newline at end of file diff --git a/Aidan/Dockerfile b/Aidan/Dockerfile new file mode 100644 index 0000000..0c90cd5 --- /dev/null +++ b/Aidan/Dockerfile @@ -0,0 +1,12 @@ +FROM node:11 as react-build +WORKDIR /app +COPY . ./ +RUN yarn +RUN yarn build + +# Production environment +FROM nginx:alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=react-build /app/build /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/Aidan/nginx.conf b/Aidan/nginx.conf new file mode 100644 index 0000000..5727b7e --- /dev/null +++ b/Aidan/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri /index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file diff --git a/Aidan/package.json b/Aidan/package.json index 8d99912..33e8096 100644 --- a/Aidan/package.json +++ b/Aidan/package.json @@ -4,7 +4,7 @@ "private": true, "dependencies": { "@date-io/date-fns": "^1.3.13", - "@material-ui/core": "^4.8.3", + "@material-ui/core": "^4.11.4", "@material-ui/icons": "^4.5.1", "@material-ui/lab": "^4.0.0-alpha.39", "@material-ui/pickers": "^3.2.10", @@ -22,7 +22,7 @@ "react-draggable": "^4.2.0", "react-grid-layout": "^0.17.1", "react-router": "^5.1.2", - "react-scripts": "3.3.0", + "react-scripts": "^3.4.1", "universal-cookie": "^4.0.3", "vega": "^5.9.1", "vega-embed": "^6.2.1", diff --git a/Aidan/src/components/Alterdash.js b/Aidan/src/components/Alterdash.js index 84aa2f4..bdd02de 100644 --- a/Aidan/src/components/Alterdash.js +++ b/Aidan/src/components/Alterdash.js @@ -19,7 +19,6 @@ import Link from '@material-ui/core/Link'; import MenuIcon from '@material-ui/icons/Menu'; import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import NotificationsIcon from '@material-ui/icons/Notifications'; -// import {MainListItems, SecondaryListItems} from './listItems'; import ListItem from '@material-ui/core/ListItem'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; @@ -32,7 +31,6 @@ import LayersIcon from '@material-ui/icons/Layers'; import AssignmentIcon from '@material-ui/icons/Assignment'; import Button from '@material-ui/core/Button'; import Input from '@material-ui/core/Input'; -// import Chart from './Chart'; import Deposits from './Deposits'; import Orders from './Orders'; import GridLayout from 'react-grid-layout'; @@ -67,15 +65,9 @@ const makeid = (length) => { } var uid = makeid(6); -console.log(uid) - var layout1 = {}; -// var dashname1 = uid; - var port = "http://192.168.43.119:8080"; -// var port = "http://localhost:8080"; - const ResponsiveGridLayout = WidthProvider(Responsive); var datajson = { todos: [ @@ -102,11 +94,7 @@ var datajson = { }] } -// const { todos, closedTasks, draggedTask} = datajson; - - function Copyright() { - return ( {'Copyright © '} @@ -232,10 +220,6 @@ export default function Dashboard() { // {i: 'e', x: 10, y: 0, minH: 2.4, minW: 4}, ]); - - - - const onLayoutChange = layout => { setLayouts(layout); layout1 = layout; @@ -315,10 +299,6 @@ export default function Dashboard() { var k = layout1[j].i; } - // function parse(spec, k) { - // vegaEmbed.parse.spec(spec, function(error, chart) { chart({el:"#"+k}).update(); }); - // } - useEffect(() => timer, []); const redraw = () => { @@ -330,7 +310,6 @@ export default function Dashboard() { .catch(err => console.error(err)) } ) - // console.log("hello") } var timer = setInterval( redraw, 2000); @@ -362,18 +341,6 @@ export default function Dashboard() { function MainListItems() { return (
- {/* - - - - - - - - - - - */} { todos.map(todo => ) } - {/* - - - - - - - - - - - - - - - - - */}
); }; @@ -445,21 +394,6 @@ export default function Dashboard() { }; const [logindone, setLogindone] = useState(false); - - // var options = []; - - // function populateOptions(data){ - // console.log(data.results) - // for(var i = 0; i res.json()) - // .then((data) => populateOptions(data.results)) - // .catch(err => console.error(err)) const [options, setOptions] = useState([ 'None', @@ -477,16 +411,12 @@ export default function Dashboard() { 'Triton', 'Umbriel', ]); - - // const ITEM_HEIGHT = 48; - + const [anchorEl, setAnchorEl] = React.useState(uid); - // const openMenu = Boolean(anchorEl); const [openMenu, setOpenMenu] = React.useState(false); const handleClickMenu = event => { setOpenMenu(true); - // setAnchorEl(event.target.value); }; const handleCloseMenuList = event => { @@ -525,12 +455,6 @@ export default function Dashboard() { open={openMenu} onClose={handleCloseMenuList} transformOrigin={{ vertical: "bottom", horizontal: "right" }} - // PaperProps={{ - // style: { - // maxHeight: ITEM_HEIGHT * 4.5, - // width: 200, - // }, - // }} > @@ -567,11 +491,6 @@ export default function Dashboard() { {(logindone)?"All Changes Saved !":" Not Authorized to make changes, Login"} - {/* - - - - */} diff --git a/Aidan/src/components/Dashboard.js b/Aidan/src/components/Dashboard.js index 3899506..8f87fd6 100644 --- a/Aidan/src/components/Dashboard.js +++ b/Aidan/src/components/Dashboard.js @@ -479,7 +479,7 @@ export default function Dashboard() { ? "All Changes Saved !" : " Not Authorized to make changes, Login"}
-