upgrade & opt

- flutter 3.0.1
- show snackbar when no server to ping
- server detail page replace nice to iowait
- make script show stdout when error
This commit is contained in:
Junyuan Feng
2022-05-21 20:39:52 +08:00
parent b4d42eecf3
commit 228f228d44
14 changed files with 53 additions and 23 deletions

View File

@@ -45,5 +45,12 @@ class Cpu2Status {
return used.isNaN ? 0 : used * 100;
}
double get iowait {
if (now.length != pre.length) return 0;
final delta = now[0].iowait - pre[0].iowait;
final used = delta / totalDelta;
return used.isNaN ? 0 : used * 100;
}
double get idle => 100 - usedPercent();
}

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 137;
static const int build = 138;
static const String engine =
"Flutter 3.0.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision ee4e09cce0 (11 days ago) • 2022-05-09 16:45:18 -0700\nEngine • revision d1b9a6938a\nTools • Dart 2.17.0 • DevTools 2.12.2\n";
static const String buildAt = "2022-05-20 19:48:33.039675";
static const int modifications = 7;
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (2 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
static const String buildAt = "2022-05-21 20:15:15.896932";
static const int modifications = 6;
}

View File

@@ -148,6 +148,8 @@ class MessageLookup extends MessageLookupByLibrary {
"pingAvg": MessageLookupByLibrary.simpleMessage("Avg:"),
"pingInputIP": MessageLookupByLibrary.simpleMessage(
"Please input a target IP/domain."),
"pingNoServer": MessageLookupByLibrary.simpleMessage(
"No server to ping.\nPlease add a server in server tab."),
"platformNotSupportUpdate": MessageLookupByLibrary.simpleMessage(
"Current platform does not support in app update.\nPlease build from source and install it."),
"plzEnterHost":

View File

@@ -130,6 +130,8 @@ class MessageLookup extends MessageLookupByLibrary {
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
"pingAvg": MessageLookupByLibrary.simpleMessage("平均:"),
"pingInputIP": MessageLookupByLibrary.simpleMessage("请输入目标IP或域名"),
"pingNoServer": MessageLookupByLibrary.simpleMessage(
"没有服务器可用于Ping\n请在服务器tab添加服务器后再试"),
"platformNotSupportUpdate":
MessageLookupByLibrary.simpleMessage("当前平台不支持更新,请编译最新源码后手动安装"),
"plzEnterHost": MessageLookupByLibrary.simpleMessage("请输入主机"),

View File

@@ -1220,6 +1220,16 @@ class S {
args: [],
);
}
/// `No server to ping.\nPlease add a server in server tab.`
String get pingNoServer {
return Intl.message(
'No server to ping.\nPlease add a server in server tab.',
name: 'pingNoServer',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View File

@@ -115,5 +115,6 @@
"platformNotSupportUpdate": "Current platform does not support in app update.\nPlease build from source and install it.",
"invalidVersionHelp": "Please make sure that docker is installed correctly, or that you are using a non-self-compiled version. If you don't have the above issues, please submit an issue on {url}.",
"noInterface": "No interface",
"lastTry": "Last try!"
"lastTry": "Last try!",
"pingNoServer": "No server to ping.\nPlease add a server in server tab."
}

View File

@@ -115,5 +115,6 @@
"platformNotSupportUpdate": "当前平台不支持更新,请编译最新源码后手动安装",
"invalidVersionHelp": "请确保正确安装了docker或者使用的非自编译版本。如果没有以上问题请在 {url} 提交问题。",
"noInterface": "没有可用的接口",
"lastTry": "最后尝试"
"lastTry": "最后尝试",
"pingNoServer": "没有服务器可用于Ping\n请在服务器tab添加服务器后再试"
}

View File

@@ -21,6 +21,7 @@ class _PingPageState extends State<PingPage>
late TextEditingController _textEditingController;
late MediaQueryData _media;
final List<PingResult> _results = [];
final _serverProvider = locator<ServerProvider>();
late S s;
static const summaryTextStyle = TextStyle(
fontSize: 12,
@@ -106,7 +107,12 @@ class _PingPageState extends State<PingPage>
return;
}
await Future.wait(locator<ServerProvider>().servers.map((e) async {
if (_serverProvider.servers.isEmpty) {
showSnackBar(context, Text(s.pingNoServer));
return;
}
await Future.wait(_serverProvider.servers.map((e) async {
if (e.client == null) {
return;
}

View File

@@ -100,7 +100,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
SizedBox(
width: _media.size.width * 0.03,
),
_buildCPUTimePercent(ss.cpu2Status.nice, 'nice'),
_buildCPUTimePercent(ss.cpu2Status.iowait, 'io'),
SizedBox(
width: _media.size.width * 0.03,
),