mirror of
https://github.com/gethomepage/homepage.git
synced 2026-10-01 00:11:18 -07:00
Performance: reduce json data transformations (#7175)
This commit is contained in:
@@ -8,10 +8,13 @@ const widget = {
|
||||
mappings: {
|
||||
workers: {
|
||||
endpoint: "workers/status",
|
||||
map: (data) => ({
|
||||
total_workers: asJson(data).workers_status.length,
|
||||
active_workers: asJson(data).workers_status.filter((worker) => !worker.idle).length,
|
||||
}),
|
||||
map: (data) => {
|
||||
const workers = asJson(data).workers_status;
|
||||
return {
|
||||
total_workers: workers.length,
|
||||
active_workers: workers.filter((worker) => !worker.idle).length,
|
||||
};
|
||||
},
|
||||
},
|
||||
pending: {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user