diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index e4104371..887b81c8 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -686,7 +686,8 @@
},
"urbackup": {
"ok" : "Ok",
- "errored": "Errored",
- "noRecent": "Out of Date"
+ "errored": "Errors",
+ "noRecent": "Out of Date",
+ "totalUsed": "Used Storage"
}
}
diff --git a/src/widgets/urbackup/component.jsx b/src/widgets/urbackup/component.jsx
index e1ad3fa7..c42efc3e 100644
--- a/src/widgets/urbackup/component.jsx
+++ b/src/widgets/urbackup/component.jsx
@@ -34,6 +34,7 @@ export default function Component({ service }) {
+ {urbackupData.diskUsage && }
);
}
diff --git a/src/widgets/urbackup/proxy.js b/src/widgets/urbackup/proxy.js
index a04ff11e..ce08b514 100644
--- a/src/widgets/urbackup/proxy.js
+++ b/src/widgets/urbackup/proxy.js
@@ -17,8 +17,14 @@ export default async function urbackupProxyHandler(req, res) {
await (async () => {
try {
const allClients = await server.getStatus({includeRemoved: false});
+ let diskUsage = false
+ if(serviceWidget.diskUsage)
+ {
+ diskUsage = await server.getUsage();
+ }
res.status(200).send({
- data: allClients,
+ clientStatuses: allClients,
+ diskUsage,
maxDays: serviceWidget.maxDays
});
} catch (error) {
diff --git a/src/widgets/urbackup/stats-helper.js b/src/widgets/urbackup/stats-helper.js
index 9c1dd3d6..48405afe 100644
--- a/src/widgets/urbackup/stats-helper.js
+++ b/src/widgets/urbackup/stats-helper.js
@@ -37,13 +37,13 @@ function determineClientStatus(client, maxDays){
return status;
}
-export default function determineStatuses(clientStatuses) {
+export default function determineStatuses(urbackupData) {
let ok = 0;
let errored = 0;
let noRecent = 0;
let result;
- clientStatuses.data.forEach((client) => {
- result = determineClientStatus(client, clientStatuses.maxDays);
+ urbackupData.clientStatuses.forEach((client) => {
+ result = determineClientStatus(client, urbackupData.maxDays);
switch (result)
{
case Status.ok:
@@ -60,7 +60,17 @@ export default function determineStatuses(clientStatuses) {
}
});
- return {ok, errored, noRecent};
+ let totalUsage = false;
+
+ // calculate total disk space if provided
+ if (urbackupData.diskUsage){
+ totalUsage = 0.0;
+ urbackupData.diskUsage.forEach((client) => {
+ totalUsage += client.used;
+ });
+ }
+
+ return {ok, errored, noRecent, totalUsage};
}