mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-15 05:42:08 +08:00
Add Unmanic service widget
This commit is contained in:
27
src/widgets/unmanic/widget.js
Normal file
27
src/widgets/unmanic/widget.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import unmanicProxyHandler from "./proxy";
|
||||
|
||||
import { asJson } from "utils/proxy/api-helpers";
|
||||
|
||||
const widget = {
|
||||
api: "{url}/unmanic/api/v2/{endpoint}",
|
||||
proxyHandler: unmanicProxyHandler,
|
||||
|
||||
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,
|
||||
})
|
||||
},
|
||||
pending: {
|
||||
method: "POST",
|
||||
endpoint: "pending/tasks",
|
||||
validate: [
|
||||
"recordsTotal"
|
||||
]
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default widget;
|
||||
Reference in New Issue
Block a user