Commit 8c3aacf5 authored by Mark Repka's avatar Mark Repka

Add better placeholder data

parent 8e0bb177
......@@ -7,6 +7,7 @@ const TempMonitor = () => {
const [availableClients, updateAvailableClients] = useState([]);
const [data, updateData] = useState([]);
const [clientid, updateClientid] = useState(null);
const [demoData, updateDemoData] = useState(false);
useEffect(() => {
fetch("https://api.repkam09.com/api/temp/clients")
......@@ -23,8 +24,11 @@ const TempMonitor = () => {
);
updateAvailableClients(jsonres);
updateClientid(jsonres[0]);
updateDemoData(false);
} else {
console.log("Got no results from the client lookup ");
updateClientid("donlakepi");
updateDemoData(true);
}
});
}, []);
......@@ -61,13 +65,24 @@ const TempMonitor = () => {
);
});
picker = (
<select
name="tempclients"
onChange={(event) => { updateClientid(event.currentTarget.value) }}
onBlur={(event) => { updateClientid(event.currentTarget.value) }}
>
{options}
</select>
<>
<span>Select a system to view data: </span>
<select
name="tempclients"
onChange={(event) => { updateClientid(event.currentTarget.value) }}
onBlur={(event) => { updateClientid(event.currentTarget.value) }}
>
{options}
</select>
</>
);
}
let demodatanote = null;
if (demoData) {
demodatanote = (
<p>No clients have recently connected. Showing the last known data.</p>
);
}
......@@ -80,8 +95,9 @@ const TempMonitor = () => {
<h1 className="page-content-title">Temperature Monitor</h1>
<section className="page-content">
<div className="chart-area">
<div>{demodatanote}</div>
<div>
<p>Select a system to view data: {picker}</p>
<p>{picker}</p>
</div>
<LineChart width={800} height={450} data={data}>
<Line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment