mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: tap server tab disk io view to switch
This commit is contained in:
@@ -1118,6 +1118,12 @@ abstract class S {
|
|||||||
/// **'Password'**
|
/// **'Password'**
|
||||||
String get pwd;
|
String get pwd;
|
||||||
|
|
||||||
|
/// No description provided for @read.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Read'**
|
||||||
|
String get read;
|
||||||
|
|
||||||
/// No description provided for @reboot.
|
/// No description provided for @reboot.
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
@@ -1567,6 +1573,12 @@ abstract class S {
|
|||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Will take effect immediately'**
|
/// **'Will take effect immediately'**
|
||||||
String get willTakEeffectImmediately;
|
String get willTakEeffectImmediately;
|
||||||
|
|
||||||
|
/// No description provided for @write.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Write'**
|
||||||
|
String get write;
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SDelegate extends LocalizationsDelegate<S> {
|
class _SDelegate extends LocalizationsDelegate<S> {
|
||||||
|
|||||||
@@ -538,6 +538,9 @@ class SDe extends S {
|
|||||||
@override
|
@override
|
||||||
String get pwd => 'Passwort';
|
String get pwd => 'Passwort';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get read => 'Lesen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get reboot => 'Neustart';
|
String get reboot => 'Neustart';
|
||||||
|
|
||||||
@@ -778,4 +781,7 @@ class SDe extends S {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get willTakEeffectImmediately => 'Wird sofort angewendet';
|
String get willTakEeffectImmediately => 'Wird sofort angewendet';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get write => 'Schreiben';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -538,6 +538,9 @@ class SEn extends S {
|
|||||||
@override
|
@override
|
||||||
String get pwd => 'Password';
|
String get pwd => 'Password';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get read => 'Read';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get reboot => 'Reboot';
|
String get reboot => 'Reboot';
|
||||||
|
|
||||||
@@ -778,4 +781,7 @@ class SEn extends S {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get willTakEeffectImmediately => 'Will take effect immediately';
|
String get willTakEeffectImmediately => 'Will take effect immediately';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get write => 'Write';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -538,6 +538,9 @@ class SId extends S {
|
|||||||
@override
|
@override
|
||||||
String get pwd => 'Kata sandi';
|
String get pwd => 'Kata sandi';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get read => 'Baca';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get reboot => 'Reboot';
|
String get reboot => 'Reboot';
|
||||||
|
|
||||||
@@ -778,4 +781,7 @@ class SId extends S {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get willTakEeffectImmediately => 'Akan segera berlaku';
|
String get willTakEeffectImmediately => 'Akan segera berlaku';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get write => 'Tulis';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -538,6 +538,9 @@ class SZh extends S {
|
|||||||
@override
|
@override
|
||||||
String get pwd => '密码';
|
String get pwd => '密码';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get read => '读';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get reboot => '重启';
|
String get reboot => '重启';
|
||||||
|
|
||||||
@@ -778,6 +781,9 @@ class SZh extends S {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get willTakEeffectImmediately => '更改将会立即生效';
|
String get willTakEeffectImmediately => '更改将会立即生效';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get write => '写';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The translations for Chinese, as used in Taiwan (`zh_TW`).
|
/// The translations for Chinese, as used in Taiwan (`zh_TW`).
|
||||||
@@ -1318,6 +1324,9 @@ class SZhTw extends SZh {
|
|||||||
@override
|
@override
|
||||||
String get pwd => '密碼';
|
String get pwd => '密碼';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get read => '读';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get reboot => '重启';
|
String get reboot => '重启';
|
||||||
|
|
||||||
@@ -1558,4 +1567,7 @@ class SZhTw extends SZh {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get willTakEeffectImmediately => '更改將會立即生效';
|
String get willTakEeffectImmediately => '更改將會立即生效';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get write => '写';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,22 +35,22 @@ enum NetViewType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetViewData build(ServerStatus ss) {
|
(String, String) build(ServerStatus ss) {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case NetViewType.conn:
|
case NetViewType.conn:
|
||||||
return NetViewData(
|
return (
|
||||||
'Conn:\n${ss.tcp.maxConn}',
|
'${l10n.conn}:\n${ss.tcp.maxConn}',
|
||||||
'Fail:\n${ss.tcp.fail}',
|
'${l10n.failed}:\n${ss.tcp.fail}',
|
||||||
);
|
);
|
||||||
case NetViewType.speed:
|
case NetViewType.speed:
|
||||||
return NetViewData(
|
return (
|
||||||
'In:\n${ss.netSpeed.speedIn(all: true)}',
|
'↓:\n${ss.netSpeed.speedIn(all: true)}',
|
||||||
'Out:\n${ss.netSpeed.speedOut(all: true)}',
|
'↑:\n${ss.netSpeed.speedOut(all: true)}',
|
||||||
);
|
);
|
||||||
case NetViewType.traffic:
|
case NetViewType.traffic:
|
||||||
return NetViewData(
|
return (
|
||||||
'In:\n${ss.netSpeed.sizeIn(all: true)}',
|
'↓:\n${ss.netSpeed.sizeIn(all: true)}',
|
||||||
'Out:\n${ss.netSpeed.sizeOut(all: true)}',
|
'↑:\n${ss.netSpeed.sizeOut(all: true)}',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,10 +77,3 @@ enum NetViewType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NetViewData {
|
|
||||||
final String up;
|
|
||||||
final String down;
|
|
||||||
|
|
||||||
NetViewData(this.up, this.down);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -84,8 +84,10 @@ class DiskIO extends TimeSeq<DiskIOPiece> {
|
|||||||
final vals = item.split(Miscs.blankReg);
|
final vals = item.split(Miscs.blankReg);
|
||||||
if (vals.length < 10) continue;
|
if (vals.length < 10) continue;
|
||||||
try {
|
try {
|
||||||
|
final dev = vals[2];
|
||||||
|
if (dev.startsWith('loop')) continue;
|
||||||
items.add(DiskIOPiece(
|
items.add(DiskIOPiece(
|
||||||
dev: vals[2],
|
dev: dev,
|
||||||
sectorsRead: int.parse(vals[5]),
|
sectorsRead: int.parse(vals[5]),
|
||||||
sectorsWrite: int.parse(vals[9]),
|
sectorsWrite: int.parse(vals[9]),
|
||||||
time: time,
|
time: time,
|
||||||
|
|||||||
@@ -170,6 +170,7 @@
|
|||||||
"process": "Prozess",
|
"process": "Prozess",
|
||||||
"pushToken": "Push Token",
|
"pushToken": "Push Token",
|
||||||
"pwd": "Passwort",
|
"pwd": "Passwort",
|
||||||
|
"read": "Lesen",
|
||||||
"reboot": "Neustart",
|
"reboot": "Neustart",
|
||||||
"remotePath": "Entfernte Pfade",
|
"remotePath": "Entfernte Pfade",
|
||||||
"rename": "Umbenennen",
|
"rename": "Umbenennen",
|
||||||
@@ -244,5 +245,6 @@
|
|||||||
"waitConnection": "Bitte warte, bis die Verbindung hergestellt wurde.",
|
"waitConnection": "Bitte warte, bis die Verbindung hergestellt wurde.",
|
||||||
"watchNotPaired": "Keine gekoppelte Apple Watch",
|
"watchNotPaired": "Keine gekoppelte Apple Watch",
|
||||||
"whenOpenApp": "Beim Öffnen der App",
|
"whenOpenApp": "Beim Öffnen der App",
|
||||||
"willTakEeffectImmediately": "Wird sofort angewendet"
|
"willTakEeffectImmediately": "Wird sofort angewendet",
|
||||||
|
"write": "Schreiben"
|
||||||
}
|
}
|
||||||
@@ -170,6 +170,7 @@
|
|||||||
"process": "Process",
|
"process": "Process",
|
||||||
"pushToken": "Push token",
|
"pushToken": "Push token",
|
||||||
"pwd": "Password",
|
"pwd": "Password",
|
||||||
|
"read": "Read",
|
||||||
"reboot": "Reboot",
|
"reboot": "Reboot",
|
||||||
"remotePath": "Remote path",
|
"remotePath": "Remote path",
|
||||||
"rename": "Rename",
|
"rename": "Rename",
|
||||||
@@ -244,5 +245,6 @@
|
|||||||
"waitConnection": "Please wait for the connection to be established.",
|
"waitConnection": "Please wait for the connection to be established.",
|
||||||
"watchNotPaired": "No paired Apple Watch",
|
"watchNotPaired": "No paired Apple Watch",
|
||||||
"whenOpenApp": "When opening the app",
|
"whenOpenApp": "When opening the app",
|
||||||
"willTakEeffectImmediately": "Will take effect immediately"
|
"willTakEeffectImmediately": "Will take effect immediately",
|
||||||
|
"write": "Write"
|
||||||
}
|
}
|
||||||
@@ -170,6 +170,7 @@
|
|||||||
"process": "Proses",
|
"process": "Proses",
|
||||||
"pushToken": "Dorong token",
|
"pushToken": "Dorong token",
|
||||||
"pwd": "Kata sandi",
|
"pwd": "Kata sandi",
|
||||||
|
"read": "Baca",
|
||||||
"reboot": "Reboot",
|
"reboot": "Reboot",
|
||||||
"remotePath": "Jalur jarak jauh",
|
"remotePath": "Jalur jarak jauh",
|
||||||
"rename": "Ganti nama",
|
"rename": "Ganti nama",
|
||||||
@@ -244,5 +245,6 @@
|
|||||||
"waitConnection": "Harap tunggu koneksi akan dibuat.",
|
"waitConnection": "Harap tunggu koneksi akan dibuat.",
|
||||||
"watchNotPaired": "Tidak ada Apple Watch yang dipasangkan",
|
"watchNotPaired": "Tidak ada Apple Watch yang dipasangkan",
|
||||||
"whenOpenApp": "Saat membuka aplikasi",
|
"whenOpenApp": "Saat membuka aplikasi",
|
||||||
"willTakEeffectImmediately": "Akan segera berlaku"
|
"willTakEeffectImmediately": "Akan segera berlaku",
|
||||||
|
"write": "Tulis"
|
||||||
}
|
}
|
||||||
@@ -170,6 +170,7 @@
|
|||||||
"process": "进程",
|
"process": "进程",
|
||||||
"pushToken": "消息推送 Token",
|
"pushToken": "消息推送 Token",
|
||||||
"pwd": "密码",
|
"pwd": "密码",
|
||||||
|
"read": "读",
|
||||||
"reboot": "重启",
|
"reboot": "重启",
|
||||||
"remotePath": "远端路径",
|
"remotePath": "远端路径",
|
||||||
"rename": "重命名",
|
"rename": "重命名",
|
||||||
@@ -244,5 +245,6 @@
|
|||||||
"waitConnection": "请等待连接建立",
|
"waitConnection": "请等待连接建立",
|
||||||
"watchNotPaired": "没有已配对的 Apple Watch",
|
"watchNotPaired": "没有已配对的 Apple Watch",
|
||||||
"whenOpenApp": "当打开 App 时",
|
"whenOpenApp": "当打开 App 时",
|
||||||
"willTakEeffectImmediately": "更改将会立即生效"
|
"willTakEeffectImmediately": "更改将会立即生效",
|
||||||
|
"write": "写"
|
||||||
}
|
}
|
||||||
@@ -170,6 +170,7 @@
|
|||||||
"process": "進程",
|
"process": "進程",
|
||||||
"pushToken": "消息推送 Token",
|
"pushToken": "消息推送 Token",
|
||||||
"pwd": "密碼",
|
"pwd": "密碼",
|
||||||
|
"read": "读",
|
||||||
"reboot": "重启",
|
"reboot": "重启",
|
||||||
"remotePath": "遠端路徑",
|
"remotePath": "遠端路徑",
|
||||||
"rename": "重命名",
|
"rename": "重命名",
|
||||||
@@ -244,5 +245,6 @@
|
|||||||
"waitConnection": "請等待連接建立",
|
"waitConnection": "請等待連接建立",
|
||||||
"watchNotPaired": "沒有已配對的 Apple Watch",
|
"watchNotPaired": "沒有已配對的 Apple Watch",
|
||||||
"whenOpenApp": "當打開 App 時",
|
"whenOpenApp": "當打開 App 時",
|
||||||
"willTakEeffectImmediately": "更改將會立即生效"
|
"willTakEeffectImmediately": "更改將會立即生效",
|
||||||
|
"write": "写"
|
||||||
}
|
}
|
||||||
@@ -295,10 +295,10 @@ class _FullScreenPageState extends State<FullScreenPage> with AfterLayoutMixin {
|
|||||||
return ValueListenableBuilder<NetViewType>(
|
return ValueListenableBuilder<NetViewType>(
|
||||||
valueListenable: Stores.setting.netViewType.listenable(),
|
valueListenable: Stores.setting.netViewType.listenable(),
|
||||||
builder: (_, val, __) {
|
builder: (_, val, __) {
|
||||||
final data = val.build(ss);
|
final (a, b) = val.build(ss);
|
||||||
return AnimatedSwitcher(
|
return AnimatedSwitcher(
|
||||||
duration: const Duration(milliseconds: 177),
|
duration: const Duration(milliseconds: 177),
|
||||||
child: _buildIOData(data.up, data.down),
|
child: _buildIOData(a, b),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
final text = () {
|
final text = () {
|
||||||
final use = '${disk.used} / ${disk.size}';
|
final use = '${disk.used} / ${disk.size}';
|
||||||
if (read == null || write == null) return use;
|
if (read == null || write == null) return use;
|
||||||
return '$use\nR $read | W $write';
|
return '$use\n${l10n.read} $read | ${l10n.write} $write';
|
||||||
}();
|
}();
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
|
|
||||||
final _netViewType = <String, NetViewType>{};
|
final _netViewType = <String, NetViewType>{};
|
||||||
|
|
||||||
|
/// If true, display IO speed
|
||||||
|
final _diskViewSpeed = <String, bool>{};
|
||||||
|
|
||||||
String? _tag;
|
String? _tag;
|
||||||
bool _useDoubleColumn = false;
|
bool _useDoubleColumn = false;
|
||||||
|
|
||||||
@@ -302,7 +305,6 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildNormalCard(ServerStatus ss, ServerPrivateInfo spi) {
|
List<Widget> _buildNormalCard(ServerStatus ss, ServerPrivateInfo spi) {
|
||||||
final rootDisk = findRootDisk(ss.disk);
|
|
||||||
return [
|
return [
|
||||||
UIs.height13,
|
UIs.height13,
|
||||||
Padding(
|
Padding(
|
||||||
@@ -313,10 +315,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
_wrapWithSizedbox(_buildPercentCircle(ss.cpu.usedPercent())),
|
_wrapWithSizedbox(_buildPercentCircle(ss.cpu.usedPercent())),
|
||||||
_wrapWithSizedbox(_buildPercentCircle(ss.mem.usedPercent * 100)),
|
_wrapWithSizedbox(_buildPercentCircle(ss.mem.usedPercent * 100)),
|
||||||
_wrapWithSizedbox(_buildNet(ss, spi.id)),
|
_wrapWithSizedbox(_buildNet(ss, spi.id)),
|
||||||
_wrapWithSizedbox(_buildIOData(
|
_wrapWithSizedbox(_buildDisk(ss, spi.id)),
|
||||||
'Total:\n${rootDisk?.size}',
|
|
||||||
'Used:\n${rootDisk?.usedPercent}%',
|
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -421,28 +420,53 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNet(ServerStatus ss, String id) {
|
Widget _buildDisk(ServerStatus ss, String id) {
|
||||||
final type = _netViewType[id] ?? Stores.setting.netViewType.fetch();
|
final rootDisk = findRootDisk(ss.disk);
|
||||||
final data = type.build(ss);
|
final isSpeed = _diskViewSpeed[id] ?? true;
|
||||||
|
|
||||||
|
final (r, w) = ss.diskIO.getAllSpeed();
|
||||||
|
|
||||||
return AnimatedSwitcher(
|
return AnimatedSwitcher(
|
||||||
duration: const Duration(milliseconds: 377),
|
duration: const Duration(milliseconds: 377),
|
||||||
transitionBuilder: (Widget child, Animation<double> animation) {
|
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||||
return FadeTransition(opacity: animation, child: child);
|
return FadeTransition(opacity: animation, child: child);
|
||||||
},
|
},
|
||||||
child: _buildIOData(
|
child: _buildIOData(
|
||||||
data.up,
|
isSpeed ? '${l10n.read}:\n$r' : 'Total:\n${rootDisk?.size}',
|
||||||
data.down,
|
isSpeed ? '${l10n.write}:\n$w' : 'Used:\n${rootDisk?.usedPercent}%',
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
_diskViewSpeed[id] = !isSpeed;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
key: ValueKey(isSpeed),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildNet(ServerStatus ss, String id) {
|
||||||
|
final type = _netViewType[id] ?? Stores.setting.netViewType.fetch();
|
||||||
|
final (a, b) = type.build(ss);
|
||||||
|
return AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 377),
|
||||||
|
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||||
|
return FadeTransition(opacity: animation, child: child);
|
||||||
|
},
|
||||||
|
child: _buildIOData(
|
||||||
|
a,
|
||||||
|
b,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_netViewType[id] = type.next;
|
_netViewType[id] = type.next;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
key: ValueKey(type)
|
key: ValueKey(type),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIOData(String up, String down, {void Function()? onTap, Key? key}) {
|
Widget _buildIOData(String up, String down,
|
||||||
|
{void Function()? onTap, Key? key}) {
|
||||||
final child = Column(
|
final child = Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
|
|||||||
Reference in New Issue
Block a user