Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed data from Client to Server #17

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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