mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: pve dashboard (#307)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user