new: pve dashboard (#307)

This commit is contained in:
lollipopkit
2024-03-18 23:11:30 -06:00
parent 26264ecdea
commit 2597f99571
15 changed files with 390 additions and 114 deletions

View File

@@ -28,12 +28,12 @@ enum PveResType {
}
String get toStr => switch (this) {
PveResType.node => l10n.node,
PveResType.qemu => 'QEMU',
PveResType.lxc => 'LXC',
PveResType.storage => l10n.storage,
PveResType.sdn => 'SDN',
};
PveResType.node => l10n.node,
PveResType.qemu => 'QEMU',
PveResType.lxc => 'LXC',
PveResType.storage => l10n.storage,
PveResType.sdn => 'SDN',
};
}
sealed class PveResIface {
@@ -121,6 +121,15 @@ final class PveLxc extends PveResIface {
netout: json['netout'],
);
}
bool get isRunning => status == 'running';
String get topRight {
if (isRunning) {
return uptime.secondsToDuration().toStr;
}
return l10n.stopped;
}
}
final class PveQemu extends PveResIface {
@@ -190,7 +199,7 @@ final class PveQemu extends PveResIface {
bool get isRunning => status == 'running';
String get topRight {
if (!isRunning) {
if (isRunning) {
return uptime.secondsToDuration().toStr;
}
return l10n.stopped;
@@ -236,6 +245,15 @@ final class PveNode extends PveResIface {
maxcpu: json['maxcpu'],
);
}
bool get isRunning => status == 'online';
String get topRight {
if (isRunning) {
return uptime.secondsToDuration().toStr;
}
return l10n.stopped;
}
}
final class PveStorage extends PveResIface {