add disk usage task
This commit is contained in:
@@ -10,6 +10,8 @@ exports = module.exports = {
|
||||
isRebootRequired,
|
||||
getConfig,
|
||||
getDisks,
|
||||
getDiskUsage,
|
||||
updateDiskUsage,
|
||||
getMemory,
|
||||
getUpdateInfo,
|
||||
update,
|
||||
@@ -169,6 +171,20 @@ async function getDisks(req, res, next) {
|
||||
next(new HttpSuccess(200, { disks: result }));
|
||||
}
|
||||
|
||||
async function getDiskUsage(req, res, next) {
|
||||
const [error, result] = await safe(system.getDiskUsage());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(201, { usage: result }));
|
||||
}
|
||||
|
||||
async function updateDiskUsage(req, res, next) {
|
||||
const [error, taskId] = await safe(cloudron.updateDiskUsage());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(201, { taskId }));
|
||||
}
|
||||
|
||||
async function getMemory(req, res, next) {
|
||||
const [error, result] = await safe(system.getMemory());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
Reference in New Issue
Block a user