Enhancement: Allow Disk Resources Widget For Combined Disk Mounts
This commit is contained in:
parent
1133891842
commit
0a090a065c
@ -23,14 +23,14 @@ export default async function handler(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fsSize = await si.fsSize();
|
const fsSize = await si.fsSize();
|
||||||
|
const rootTarget = fsSize.find((fs) => fs.mount === "/") || [];
|
||||||
let driveData;
|
let driveData;
|
||||||
|
|
||||||
if (target === "/") {
|
if (target === "/") {
|
||||||
const rootTarget = fsSize.find((fs) => fs.mount === "/");
|
driveData = [rootTarget];
|
||||||
driveData = rootTarget ?? [rootTarget];
|
|
||||||
} else {
|
} else {
|
||||||
const foundTarget = fsSize.find((fs) => fs.mount === target);
|
const filteredData = fsSize.filter((fs) => fs.mount.startsWith(target));
|
||||||
driveData = foundTarget ? [foundTarget] : fsSize;
|
driveData = filteredData.length > 0 ? filteredData : [rootTarget];
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user