mirror of
https://github.com/gethomepage/homepage.git
synced 2025-05-23 17:52:35 -04:00
Enhancement: Add support for specifying a datastore to PBS widget (#4614)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
parent
a35da39c03
commit
4a9ca62efd
@ -362,6 +362,9 @@ export function cleanServiceGroups(groups) {
|
||||
// proxmox
|
||||
node,
|
||||
|
||||
// proxmoxbackupserver
|
||||
datastore,
|
||||
|
||||
// speedtest
|
||||
bitratePrecision,
|
||||
|
||||
@ -437,6 +440,9 @@ export function cleanServiceGroups(groups) {
|
||||
if (type === "proxmox") {
|
||||
if (node) widget.node = node;
|
||||
}
|
||||
if (type === "proxmoxbackupserver") {
|
||||
if (datastore) widget.datastore = datastore;
|
||||
}
|
||||
if (type === "kubernetes") {
|
||||
if (namespace) widget.namespace = namespace;
|
||||
if (app) widget.app = app;
|
||||
|
@ -29,7 +29,18 @@ export default function Component({ service }) {
|
||||
);
|
||||
}
|
||||
|
||||
const datastoreUsage = datastoreData.data ? (datastoreData.data[0].used / datastoreData.data[0].total) * 100 : 0;
|
||||
const datastoreIndex = !!widget.datastore
|
||||
? datastoreData.data.findIndex(function (ds) {
|
||||
return ds.store == widget.datastore;
|
||||
})
|
||||
: -1;
|
||||
const datastoreUsage =
|
||||
datastoreIndex > -1
|
||||
? (datastoreData.data[datastoreIndex].used / datastoreData.data[datastoreIndex].total) * 100
|
||||
: (datastoreData.data.reduce((sum, datastore) => sum + datastore.used, 0) /
|
||||
datastoreData.data.reduce((sum, datastore) => sum + datastore.total, 0)) *
|
||||
100;
|
||||
|
||||
const cpuUsage = hostData.data.cpu * 100;
|
||||
const memoryUsage = (hostData.data.memory.used / hostData.data.memory.total) * 100;
|
||||
const failedTasks = tasksData.total >= 100 ? "99+" : tasksData.total;
|
||||
|
Loading…
x
Reference in New Issue
Block a user