mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Add option to specify volume in Diskstation widget
This commit is contained in:
parent
2a56fd9992
commit
f55ba3b67a
@ -249,7 +249,8 @@ export function cleanServiceGroups(groups) {
|
|||||||
podSelector,
|
podSelector,
|
||||||
wan, // opnsense widget,
|
wan, // opnsense widget,
|
||||||
enableBlocks, // emby/jellyfin
|
enableBlocks, // emby/jellyfin
|
||||||
enableNowPlaying
|
enableNowPlaying,
|
||||||
|
volume // diskstation widget
|
||||||
} = cleanedService.widget;
|
} = cleanedService.widget;
|
||||||
|
|
||||||
const fieldsList = typeof fields === 'string' ? JSON.parse(fields) : fields;
|
const fieldsList = typeof fields === 'string' ? JSON.parse(fields) : fields;
|
||||||
@ -284,6 +285,9 @@ export function cleanServiceGroups(groups) {
|
|||||||
if (enableBlocks) cleanedService.widget.enableBlocks = enableBlocks === 'true';
|
if (enableBlocks) cleanedService.widget.enableBlocks = enableBlocks === 'true';
|
||||||
if (enableNowPlaying) cleanedService.widget.enableNowPlaying = enableNowPlaying === 'true';
|
if (enableNowPlaying) cleanedService.widget.enableNowPlaying = enableNowPlaying === 'true';
|
||||||
}
|
}
|
||||||
|
if (type === "diskstation") {
|
||||||
|
if (volume) cleanedService.widget.volume = volume;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cleanedService;
|
return cleanedService;
|
||||||
|
@ -33,8 +33,16 @@ export default function Component({ service }) {
|
|||||||
const uptime = `${ t("common.number", { value: days }) } ${ t("diskstation.days") }`;
|
const uptime = `${ t("common.number", { value: days }) } ${ t("diskstation.days") }`;
|
||||||
|
|
||||||
// storage info
|
// storage info
|
||||||
// TODO: figure out how to display info for more than one volume
|
const volumeName = widget.volume;
|
||||||
const volume = storageData.data.vol_info?.[0];
|
|
||||||
|
let volume;
|
||||||
|
|
||||||
|
if (volumeName) {
|
||||||
|
volume = storageData.data.vol_info?.find(vol => vol.name === volumeName)
|
||||||
|
} else {
|
||||||
|
volume = storageData.data.vol_info?.[0];
|
||||||
|
}
|
||||||
|
|
||||||
const usedBytes = parseFloat(volume?.used_size);
|
const usedBytes = parseFloat(volume?.used_size);
|
||||||
const totalBytes = parseFloat(volume?.total_size);
|
const totalBytes = parseFloat(volume?.total_size);
|
||||||
const freeBytes = totalBytes - usedBytes;
|
const freeBytes = totalBytes - usedBytes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user