Skip to content

Commit

Permalink
feat: temperature info
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Dec 3, 2024
1 parent a1630d0 commit a447857
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/components/ServerDetailOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,22 @@ export default function ServerDetailOverview({
</section>
</CardContent>
</Card>
{server?.state.temperatures && server?.state.temperatures.length > 0 && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground">{"温度"}</p>
<section className="flex items-start gap-2">
{server?.state.temperatures.map((item,index) => (
<div className="text-xs flex items-center" key={index}>
<p className=" font-semibold">{item.Name}</p>: {item.Temperature.toFixed(2)} °C
</div>
))}
</section>
</section>
</CardContent>
</Card>
)}
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
Expand Down
9 changes: 7 additions & 2 deletions src/types/nezha-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ export interface NezhaServerStatus {
tcp_conn_count: number;
udp_conn_count: number;
process_count: number;
temperatures: number;
gpu: number;
temperatures: temperature[];
gpu: number[];
}

interface temperature {
Name: string;
Temperature: number;
}

export interface ServerGroupResponse {
Expand Down

0 comments on commit a447857

Please sign in to comment.