You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
860 B
35 lines
860 B
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
|
import { asJson, jsonArrayFilter } from "utils/proxy/api-helpers";
|
|
|
|
const widget = {
|
|
api: "{url}/api/v2.0/{endpoint}",
|
|
proxyHandler: credentialedProxyHandler,
|
|
|
|
mappings: {
|
|
alerts: {
|
|
endpoint: "alert/list",
|
|
map: (data) => ({
|
|
pending: jsonArrayFilter(data, (item) => item?.dismissed === false).length,
|
|
}),
|
|
},
|
|
status: {
|
|
endpoint: "system/info",
|
|
validate: ["loadavg", "uptime_seconds"],
|
|
},
|
|
pools: {
|
|
endpoint: "pool",
|
|
map: (data) =>
|
|
asJson(data).map((entry) => ({
|
|
id: entry.name,
|
|
name: entry.name,
|
|
healthy: entry.healthy,
|
|
allocated: entry.allocated,
|
|
free: entry.free,
|
|
data: entry.topology.data,
|
|
})),
|
|
},
|
|
},
|
|
};
|
|
|
|
export default widget;
|