支持添加删除服务器信息,以在服务器状态页显示CPU、内存等

This commit is contained in:
LollipopKit
2021-09-17 00:28:58 +08:00
parent c922bad90c
commit 6b72bc9509
15 changed files with 759 additions and 138 deletions

View File

@@ -0,0 +1,46 @@
class DiskInfo {
/*
{
"mountPath": "",
"mountLocation": "",
"usedPercent": 0,
"used": "",=
"size": "",
"avail": ""
}
*/
String? mountPath;
String? mountLocation;
double? usedPercent;
String? used;
String? size;
String? avail;
DiskInfo({
this.mountPath,
this.mountLocation,
this.usedPercent,
this.used,
this.size,
this.avail,
});
DiskInfo.fromJson(Map<String, dynamic> json) {
mountPath = json["mountPath"]?.toString();
mountLocation = json["mountLocation"]?.toString();
usedPercent = double.parse(json["usedPercent"]);
used = json["used"]?.toString();
size = json["size"]?.toString();
avail = json["avail"]?.toString();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data["mountPath"] = mountPath;
data["mountLocation"] = mountLocation;
data["usedPercent"] = usedPercent;
data["used"] = used;
data["size"] = size;
data["avail"] = avail;
return data;
}
}