cards show when a server errors/is offline
This commit is contained in:
parent
3cbc66a580
commit
d85d4334f8
4 changed files with 14 additions and 2 deletions
|
|
@ -14,4 +14,5 @@ public class ServerDTO
|
|||
public string Owner { get; set; } = string.Empty;
|
||||
public string Url { get; set; } = string.Empty;
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public bool Errored { get; set; } = false;
|
||||
}
|
||||
|
|
@ -37,6 +37,17 @@ public class ServerService : IServerService
|
|||
dtos.Add(dto);
|
||||
}
|
||||
|
||||
foreach (var server in servers)
|
||||
{
|
||||
if (dtos.Find(d => d.Url == server.Url) == null)
|
||||
{
|
||||
var dto = new ServerDTO(server);
|
||||
dto.Errored = true;
|
||||
|
||||
dtos.Add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
return dtos.ToArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const ServerList = () => {
|
|||
{servers ?
|
||||
servers.length > 0 ?
|
||||
servers.map(server => {
|
||||
return (<ServerCard name={server.owner} online={true} linkTo={server.url} key={server.name} />)
|
||||
return (<ServerCard name={server.owner} online={!server.errored} linkTo={server.url} key={server.name} />)
|
||||
})
|
||||
:
|
||||
<h1>No servers found</h1>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { apiUrl } from "./api";
|
|||
export interface Server {
|
||||
name?: string;
|
||||
id: string;
|
||||
online?: boolean;
|
||||
errored: boolean;
|
||||
owner: string;
|
||||
url: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue