Skip to content

Commit

Permalink
feat✨: Add basic structure
Browse files Browse the repository at this point in the history
  • Loading branch information
itscharukadeshan committed Aug 15, 2024
1 parent 38042ad commit b34810f
Showing 1 changed file with 62 additions and 74 deletions.
136 changes: 62 additions & 74 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,88 +1,76 @@
/** @format */

import "./index.css";
import axios from "axios";
import NavBar from "./components/NavBar";

function App() {
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

const handleRebootRouter1 = async () => {
const data = `isTest=false&goformId=REBOOT_DEVICE`;
const url = "http://192.168.8.2/goform/goform_set_cmd_process";

try {
const response_01 = await axios.post(url, data, {
headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
},
});

console.log(response_01);

const response_02 = await axios.post(url, data, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});

await delay(10);

console.log(response_02);
} catch (error) {
console.error("Error rebooting router 2:", error);
alert("Request forwarded successfully, but encountered an error");
}
};

const handleRebootRouter2 = async () => {
const data = `isTest=false&goformId=REBOOT_DEVICE`;
const url = "http://192.168.8.1/goform/goform_set_cmd_process";

try {
const response_01 = await axios.post(url, data, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});

console.log(response_01);

await delay(10);

const response_02 = await axios.post(url, data, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});

console.log(response_02);
} catch (error) {
console.error("Error rebooting router 2:", error);
alert("Request forwarded successfully, but encountered an error");
}
};

return (
<>
<NavBar />

<div className=' card w-96 bg-base-100 shadow-xl m-12'>
<div className='card-body'>
<h1 className=' card-title justify-center my-4'>
Router Control Panel
</h1>
<div className='card-actions justify-center'>
<button
className='btn btn-outline btn-warning my-4 mx-10'
onClick={handleRebootRouter1}>
Reboot Hutch
</button>
<button
className='btn btn-outline btn-error my-4 mx-10'
onClick={handleRebootRouter2}>
<div className='flex flex-col lg:flex-row w-full'>
<div className='card lg:card-normal bg-pink-950 shadow-2xl flex-1 m-6 ml-6'>
<div className='card-title mt-6 mx-auto font-serif font-extrabold text-warning '>
Dialog
</div>
<div className='card-body'>
<button className='btn btn-sm btn-ghost btn-outline w-fit mx-auto '>
Reboot Dialog
</button>
<div className='stats shadow stats-vertical bg-transparent my-6 lg:w-2/4 lg:mx-auto '>
<div className='stat place-items-center'>
<div className='stat-title text-gray-400 font-mono mb-2'>
Signal
</div>
<div className='stat-value'>1</div>
</div>

<div className='stat place-items-center'>
<div className='stat-title text-gray-400 font-mono mb-2'>
Sim status
</div>
<div className='stat-value '>4,200</div>
</div>

<div className='stat place-items-center'>
<div className='stat-title text-gray-400 font-mono mb-2'>
Sim status
</div>
<div className='stat-value '>4,200</div>
</div>
</div>
<div className='overflow-x-auto'></div>
</div>
</div>
<div className='card lg:card-normal bg-orange-950 shadow-2xl flex-1 m-6 ml-6'>
<div className='card-title mt-6 mx-auto font-serif font-extrabold text-warning'>
Hutch
</div>
<div className='card-body'>
<button className='btn btn-sm btn-ghost btn-outline w-fit mx-auto'>
Reboot Hutch
</button>
<div className='stats shadow stats-vertical my-6 bg-transparent lg:w-2/4 lg:mx-auto'>
<div className='stat place-items-center'>
<div className='stat-title text-gray-400 font-mono mb-2'>
Signal
</div>
<div className='stat-value'>1</div>
</div>

<div className='stat place-items-center'>
<div className='stat-title text-gray-400 font-mono mb-2'>
Sim status
</div>
<div className='stat-value '>4,200</div>
</div>

<div className='stat place-items-center'>
<div className='stat-title text-gray-400 font-mono mb-2'>
Sim status
</div>
<div className='stat-value '>4,200</div>
</div>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit b34810f

Please sign in to comment.