generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
816 additions
and
52 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 28 additions & 11 deletions
39
src/frontend_socket/international-dataspace-station/app/dashboard/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,42 @@ | ||
'use client'; | ||
import checkConnectorStatus from "./connector_status"; | ||
import React, { useState, useEffect } from 'react'; | ||
import axios from 'axios'; | ||
|
||
export default function Page() { | ||
const [cons, setCons] = useState(false); | ||
const [prov, setProv] = useState(false); | ||
|
||
useEffect(() => { | ||
async function fetchData() { | ||
try { | ||
const consResponse = await axios.get('/api/checkPortStatus?port=29191'); | ||
setCons(consResponse.data); | ||
|
||
const provResponse = await axios.get('/api/checkPortStatus?port=19191'); | ||
setProv(provResponse.data); | ||
} catch (error) { | ||
console.error('Error occurred while fetching port status:', error); | ||
} | ||
} | ||
fetchData(); | ||
}, []); | ||
|
||
export default async function Page() { | ||
const cons = await checkConnectorStatus(29191); | ||
const prov = await checkConnectorStatus(19191); | ||
return ( | ||
<main className="flex flex-col p-6"> | ||
<div className="grid grid-cols-2 gap-5"> | ||
<div className="flex justify-evenly items-center bg-gray-100 border-gray-200 border-2 rounded-lg p-5"> | ||
<p>Consumer: {cons ? 'UP': 'DOWN'}</p> | ||
<button onClick={ () => {console.log('click')}} className={`px-4 py-2 rounded-md hover:bg-neonBlue text-white ${cons ? 'bg-red-600' : 'bg-neonGreen'}`}> | ||
{cons ? 'Stop': 'Start'} | ||
<p>Consumer: {cons ? 'UP' : 'DOWN'}</p> | ||
<button onClick={() => {console.log('click')}} className={`px-4 py-2 rounded-md hover:bg-neonBlue text-white ${cons ? 'bg-red-600' : 'bg-neonGreen'}`}> | ||
{cons ? 'Stop' : 'Start'} | ||
</button> | ||
</div> | ||
<div className="flex justify-evenly items-center bg-gray-100 border-gray-200 border-2 rounded-lg p-5"> | ||
<p>Provider: {prov ? 'UP': 'DOWN'}</p> | ||
<button onClick={ () => {console.log('click')}} className={`px-4 py-2 rounded-md hover:bg-neonBlue text-white ${prov ? 'bg-red-600' : 'bg-neonGreen'}`}> | ||
{prov ? 'Stop': 'Start'} | ||
<p>Provider: {prov ? 'UP' : 'DOWN'}</p> | ||
<button onClick={() => {console.log('click')}} className={`px-4 py-2 rounded-md hover:bg-neonBlue text-white ${prov ? 'bg-red-600' : 'bg-neonGreen'}`}> | ||
{prov ? 'Stop' : 'Start'} | ||
</button> | ||
</div> | ||
</div> | ||
</main> | ||
); | ||
} | ||
} |
Oops, something went wrong.