Skip to content

Commit

Permalink
fix: display cpu without id
Browse files Browse the repository at this point in the history
  • Loading branch information
lideming committed Nov 26, 2023
1 parent 5e18123 commit f579b29
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions neetbox/frontend/src/services/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ export class Project {
if (!this.status.value.enablePolling) return false;

fetch("/web/status/" + this.name).then(async (res) => {
const data = await res.json();
const data = (await res.json()) as ProjectStatus;
data.hardware.value.cpus.forEach((cpu, idx) => {
if (typeof cpu.id != "number" || cpu.id < 0) cpu.id = idx;
});
const projectData = { ...this.status.value };
projectData.current = data;
projectData.history = slideWindow(projectData.history, data, 60);
Expand All @@ -95,7 +98,11 @@ export class Project {
this.logs.value = slideWindow(this.logs.value, log, 200); // TODO
}

sendAction(action: string, args: Record<string, string>, onReply?: () => void) {
sendAction(
action: string,
args: Record<string, string>,
onReply?: () => void,
) {
this.wsClient.send(
{
"event-type": "action",
Expand All @@ -104,7 +111,7 @@ export class Project {
args,
},
},
onReply
onReply,
);
}
}
Expand Down

0 comments on commit f579b29

Please sign in to comment.