more random junk at the wall (#221)

This commit is contained in:
Michael Quigley 2024-10-23 13:59:12 -04:00
parent fe97b6d4cd
commit 492e53bbae
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
3 changed files with 14 additions and 16 deletions

View File

@ -37,18 +37,16 @@ const AgentUi = () => {
}
}, []);
const newStatus = (err, data) => {
if(err) {
console.log("newState", err);
setOverview([]);
} else {
setOverview(buildOverview(data));
}
}
useEffect(() => {
let interval = setInterval(() => {
getAgentApi().agentStatus(newStatus);
getAgentApi().agentStatus((err, data) => {
if(err) {
console.log("agentStatus", err);
setOverview([]);
} else {
setOverview(structuredClone(buildOverview(data)));
}
});
}, 1000);
return () => {
clearInterval(interval);

View File

@ -12,11 +12,11 @@ const Overview = (props) => {
props.overview.forEach((row) => {
switch(row.type) {
case "share":
cards.push(<ShareCard releaseShare={props.releaseShare} share={row.v} />);
cards.push(<ShareCard key={row.v.token} releaseShare={props.releaseShare} share={row.v} />);
break;
case "access":
cards.push(<AccessCard releaseAccess={props.releaseAccess} access={row.v} />);
cards.push(<AccessCard key={row.v.frontendToken} releaseAccess={props.releaseAccess} access={row.v} />);
break;
}
});

View File

@ -5,7 +5,7 @@ import {Card} from "@mui/material";
const ShareCard = (props) => {
let frontends = [];
props.share.frontendEndpoint.map((fe) => {
frontends.push(<a href={fe.toString()} target={"_"}>{fe}</a>);
frontends.push(<a key={props.share.token} href={fe.toString()} target={"_"}>{fe}</a>);
})
const releaseClicked = () => {
@ -15,11 +15,11 @@ const ShareCard = (props) => {
return (
<Card>
<h2>{props.share.token} [<ShareIcon />]</h2>
<p>({props.share.shareMode}, {props.share.backendMode})</p>
<p>
{props.share.backendEndpoint} &rarr; {frontends}
({props.share.shareMode}, {props.share.backendMode}) <br/>
{props.share.backendEndpoint} &rarr; {frontends} <br/>
<DeleteIcon onClick={releaseClicked}/>
</p>
<p><DeleteIcon onClick={releaseClicked}/></p>
</Card>
);
}