Skip to content

Commit

Permalink
Changed data from Client to Server (#17)
Browse files Browse the repository at this point in the history
## Pull Request 
Changed data from Client to Server

## Description
Changed data from Client to Server

## Related Issues
 List any related issues or tickets here 

## Checklist
<<<<<<< HEAD
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
=======
Go over all the following points, and put an `x` in all the boxes that
apply.
If you're unsure about any of these, don't hesitate to ask. We're here
to help!
>>>>>>> e0be905
- [ ] My code follows the code style of this project.
- [ ] I have reviewed my code and ensured it's functioning as expected.
- [x] I have added appropriate comments to my code, particularly in
hard-to-understand areas.
- [ ] I have updated the documentation accordingly.
- [x] My changes generate no new warnings or errors.
- [x] I have tested my changes locally.

## Additional Notes
<!--- Any additional information or notes you want to add -->
  • Loading branch information
SSameer20 authored Apr 16, 2024
2 parents ca879d0 + 8fa78f3 commit be3f2f9
Show file tree
Hide file tree
Showing 11 changed files with 617 additions and 126 deletions.
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules/
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
2 changes: 1 addition & 1 deletion client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Hackverse - </title>
<title>Hackverse </title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
23 changes: 19 additions & 4 deletions client/src/components/Containers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'
import '../style/container.css'
import usage from '../data/cpu_usage';
import mem from '../data/cpu_memory.json'
// import usage from '../data/cpu_usage';
// import mem from '../data/cpu_memory.json'
import { FaRunning, FaRegStopCircle } from "react-icons/fa";
import { MdNotStarted } from "react-icons/md";

Expand All @@ -10,8 +10,23 @@ export default function Containers() {
const [memory, setMemory] = useState([]);

useEffect(() => {
setCpu(usage);
setMemory(mem);

fetch('http://localhost:3001/api/data/cpu/usage')
.then((response)=>{
return response.json();
})
.then((usage)=>{
console.log(usage)
setCpu(usage);
})

fetch('http://localhost:3001/api/data/cpu/memory')
.then((response)=>{
return response.json();
})
.then((mem)=>{
setMemory(mem);
})
})


Expand Down
34 changes: 0 additions & 34 deletions client/src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ export default function Home() {

}

// const getDetails = (){
// console.log("button is working")
// useEffect(() => {
// fetch('/getdata')
// .then((data) => {
// return data.json()
// })
// .then((res) => {
// console.log(res);
// setData(res)

// })
// })
// }
return (
<div>
<div className="content">
Expand All @@ -51,26 +37,6 @@ export default function Home() {

<button onClick={getDetails}>Get Started</button>

<div className="information">
<div className="table-head">
<p>Container Id</p>
<p>Process name</p>
</div>

<div className="table-data">

{
data.map((item)=>{
return <div className="data">
<p>{item["Container Id"]}</p>
<p>{item["Process name"]}</p>
</div>

})
}

</div>
</div>
{/* <Link to="/container">Get Started</Link> */}
</div>
</div>
Expand Down
File renamed without changes.
File renamed without changes.
82 changes: 0 additions & 82 deletions server/data/cpu_utilization.json

This file was deleted.

Loading

0 comments on commit be3f2f9

Please sign in to comment.