Fix drivelist import bug in BasicMetrics.ts

This commit is contained in:
Simon Larsen 2024-04-01 11:54:44 +01:00
parent e793456980
commit 28f4f0f37c
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE

View File

@ -5,7 +5,9 @@ import BasicInfrastructureMetrics, {
CPUMetrics,
MemoryMetrics,
} from '../Types/BasicMetrics';
import drivelist from 'drivelist';
// This is a workaround for a bug in the type definitions of the drivelist package. import does not work.
const drivelist: any = require('drivelist');
export class BasicMetircs {
public static async getBasicMetrics(): Promise<BasicInfrastructureMetrics> {
@ -23,7 +25,7 @@ export class BasicMetircs {
}
public static async getDiskPaths(): Promise<Array<string>> {
const drives: Array<drivelist.Drive> = await drivelist.list();
const drives: Array<any> = await drivelist.list();
const mountPoints: Array<string> = [];
@ -33,7 +35,8 @@ export class BasicMetircs {
}
}
return mountPoints;
// remove duplicates
return Array.from(new Set(mountPoints));
}
public static async getDiskUsage(