#88 #74 fix: firstWhere

This commit is contained in:
lollipopkit
2023-08-04 22:53:26 +08:00
parent 0250589be2
commit ee3e30d9b5
7 changed files with 52 additions and 27 deletions

View File

@@ -47,3 +47,26 @@ List<Disk> parseDisk(String raw) {
}
return list;
}
/// Issue 88
///
/// Due to performance issues,
/// if there is no `Disk.loc == '/' || Disk.loc == '/sysroot'`,
/// return the first [Disk] of [disks].
///
/// If we find out the biggest [Disk] of [disks],
/// the fps may lower than 60.
Disk? findRootDisk(List<Disk> disks) {
if (disks.isEmpty) return null;
final roots = disks.where((element) => element.loc == '/');
if (roots.isEmpty) {
final sysRoots = disks.where((element) => element.loc == '/sysroot');
if (sysRoots.isEmpty) {
return disks.first;
} else {
return sysRoots.first;
}
} else {
return roots.first;
}
}

View File

@@ -123,6 +123,7 @@ class DockerProvider extends BusyProvider {
(element) => element.contains(item.containerId),
orElse: () => '',
);
if (statsLine.isEmpty) continue;
item.parseStats(statsLine);
}
} catch (e) {

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 406;
static const int build = 412;
static const String engine = "3.10.6";
static const String buildAt = "2023-08-02 23:34:08.619104";
static const int modifications = 2;
static const String buildAt = "2023-08-04 22:48:00.585855";
static const int modifications = 4;
}