opt.: custom diskIgnorePath
This commit is contained in:
@@ -299,6 +299,12 @@ abstract class S {
|
|||||||
/// **'Disconnected'**
|
/// **'Disconnected'**
|
||||||
String get disconnected;
|
String get disconnected;
|
||||||
|
|
||||||
|
/// No description provided for @diskIgnorePath.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Ignore path for disk'**
|
||||||
|
String get diskIgnorePath;
|
||||||
|
|
||||||
/// No description provided for @dl2Local.
|
/// No description provided for @dl2Local.
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ class SDe extends S {
|
|||||||
@override
|
@override
|
||||||
String get disconnected => 'Disconnected';
|
String get disconnected => 'Disconnected';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get diskIgnorePath => 'Pfad für Platte ignorieren';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String dl2Local(Object fileName) {
|
String dl2Local(Object fileName) {
|
||||||
return 'Datei \"$fileName\" herunterladen?';
|
return 'Datei \"$fileName\" herunterladen?';
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ class SEn extends S {
|
|||||||
@override
|
@override
|
||||||
String get disconnected => 'Disconnected';
|
String get disconnected => 'Disconnected';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get diskIgnorePath => 'Ignore path for disk';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String dl2Local(Object fileName) {
|
String dl2Local(Object fileName) {
|
||||||
return 'Download $fileName to local?';
|
return 'Download $fileName to local?';
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ class SZh extends S {
|
|||||||
@override
|
@override
|
||||||
String get disconnected => '连接断开';
|
String get disconnected => '连接断开';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get diskIgnorePath => '忽略的磁盘路径';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String dl2Local(Object fileName) {
|
String dl2Local(Object fileName) {
|
||||||
return '下载 $fileName 到本地?';
|
return '下载 $fileName 到本地?';
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
final _seperator = RegExp(' +');
|
||||||
|
|
||||||
class DockerPsItem {
|
class DockerPsItem {
|
||||||
late String containerId;
|
late String containerId;
|
||||||
late String image;
|
late String image;
|
||||||
@@ -7,11 +9,18 @@ class DockerPsItem {
|
|||||||
late String ports;
|
late String ports;
|
||||||
late String name;
|
late String name;
|
||||||
|
|
||||||
DockerPsItem(this.containerId, this.image, this.command, this.created,
|
DockerPsItem(
|
||||||
this.status, this.ports, this.name);
|
this.containerId,
|
||||||
|
this.image,
|
||||||
|
this.command,
|
||||||
|
this.created,
|
||||||
|
this.status,
|
||||||
|
this.ports,
|
||||||
|
this.name,
|
||||||
|
);
|
||||||
|
|
||||||
DockerPsItem.fromRawString(String rawString) {
|
DockerPsItem.fromRawString(String rawString) {
|
||||||
List<String> parts = rawString.split(RegExp(' +'));
|
List<String> parts = rawString.split(_seperator);
|
||||||
parts = parts.map((e) => e.trim()).toList();
|
parts = parts.map((e) => e.trim()).toList();
|
||||||
|
|
||||||
containerId = parts[0];
|
containerId = parts[0];
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import '../../../core/extension/stringx.dart';
|
import '../../../core/extension/stringx.dart';
|
||||||
import '../../res/misc.dart';
|
import '../../res/misc.dart';
|
||||||
|
|
||||||
///
|
|
||||||
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
|
|
||||||
///
|
|
||||||
class ConnStatus {
|
class ConnStatus {
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ enum Dist {
|
|||||||
alpine,
|
alpine,
|
||||||
rocky;
|
rocky;
|
||||||
|
|
||||||
String? get iconPath {
|
String get iconPath {
|
||||||
return 'assets/linux/$name.png';
|
return 'assets/linux/$name.png';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import 'package:toolbox/core/persistant_store.dart';
|
|||||||
import 'package:toolbox/core/utils/platform.dart';
|
import 'package:toolbox/core/utils/platform.dart';
|
||||||
|
|
||||||
class SettingStore extends PersistentStore {
|
class SettingStore extends PersistentStore {
|
||||||
StoreProperty<int> get primaryColor =>
|
StoreProperty<int> get primaryColor => property(
|
||||||
property('primaryColor', defaultValue: Colors.pink.value);
|
'primaryColor',
|
||||||
|
defaultValue: const Color.fromARGB(255, 145, 58, 31).value,
|
||||||
|
);
|
||||||
|
|
||||||
StoreProperty<int> get serverStatusUpdateInterval =>
|
StoreProperty<int> get serverStatusUpdateInterval =>
|
||||||
property('serverStatusUpdateInterval', defaultValue: 3);
|
property('serverStatusUpdateInterval', defaultValue: 3);
|
||||||
@@ -47,4 +49,15 @@ class SettingStore extends PersistentStore {
|
|||||||
// SSH term font size
|
// SSH term font size
|
||||||
StoreProperty<double> get termFontSize =>
|
StoreProperty<double> get termFontSize =>
|
||||||
property('termFontSize', defaultValue: 13);
|
property('termFontSize', defaultValue: 13);
|
||||||
|
|
||||||
|
/// Server detail disk ignore path
|
||||||
|
StoreProperty<List<String>> get diskIgnorePath =>
|
||||||
|
property('diskIgnorePath', defaultValue: [
|
||||||
|
'udev',
|
||||||
|
'tmpfs',
|
||||||
|
'devtmpfs',
|
||||||
|
'overlay',
|
||||||
|
'run',
|
||||||
|
'none',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
"decode": "Decode",
|
"decode": "Decode",
|
||||||
"delete": "Löschen",
|
"delete": "Löschen",
|
||||||
"disconnected": "Disconnected",
|
"disconnected": "Disconnected",
|
||||||
|
"diskIgnorePath": "Pfad für Platte ignorieren",
|
||||||
"dl2Local": "Datei \"{fileName}\" herunterladen?",
|
"dl2Local": "Datei \"{fileName}\" herunterladen?",
|
||||||
"dockerEditHost": "DOCKER_HOST bearbeiten",
|
"dockerEditHost": "DOCKER_HOST bearbeiten",
|
||||||
"dockerEmptyRunningItems": "Keine aktiven Container.\n\nWomöglich wird die Umgebungsvariable DOCKER_HOST nicht richtig erkannt. Du kannst sie finden, indem du `echo $DOCKER_HOST` im Terminal ausführst.",
|
"dockerEmptyRunningItems": "Keine aktiven Container.\n\nWomöglich wird die Umgebungsvariable DOCKER_HOST nicht richtig erkannt. Du kannst sie finden, indem du `echo $DOCKER_HOST` im Terminal ausführst.",
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
"decode": "Decode",
|
"decode": "Decode",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"disconnected": "Disconnected",
|
"disconnected": "Disconnected",
|
||||||
|
"diskIgnorePath": "Ignore path for disk",
|
||||||
"dl2Local": "Download {fileName} to local?",
|
"dl2Local": "Download {fileName} to local?",
|
||||||
"dockerEditHost": "Edit DOCKER_HOST",
|
"dockerEditHost": "Edit DOCKER_HOST",
|
||||||
"dockerEmptyRunningItems": "No running container. \nIt may be that the env DOCKER_HOST is not read correctly. You can found it by running `echo $DOCKER_HOST` in terminal.",
|
"dockerEmptyRunningItems": "No running container. \nIt may be that the env DOCKER_HOST is not read correctly. You can found it by running `echo $DOCKER_HOST` in terminal.",
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
"decode": "解码",
|
"decode": "解码",
|
||||||
"delete": "删除",
|
"delete": "删除",
|
||||||
"disconnected": "连接断开",
|
"disconnected": "连接断开",
|
||||||
|
"diskIgnorePath": "忽略的磁盘路径",
|
||||||
"dl2Local": "下载 {fileName} 到本地?",
|
"dl2Local": "下载 {fileName} 到本地?",
|
||||||
"dockerEditHost": "编辑 DOCKER_HOST",
|
"dockerEditHost": "编辑 DOCKER_HOST",
|
||||||
"dockerEmptyRunningItems": "没有正在运行的容器。\n这可能是因为环境变量 DOCKER_HOST 没有被正确读取。你可以通过在终端内运行 `echo $DOCKER_HOST` 来获取。",
|
"dockerEmptyRunningItems": "没有正在运行的容器。\n这可能是因为环境变量 DOCKER_HOST 没有被正确读取。你可以通过在终端内运行 `echo $DOCKER_HOST` 来获取。",
|
||||||
|
|||||||
@@ -27,14 +27,13 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late S _s;
|
late S _s;
|
||||||
bool _showDistLogo = true;
|
final _setting = locator<SettingStore>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_s = S.of(context)!;
|
_s = S.of(context)!;
|
||||||
_showDistLogo = locator<SettingStore>().showDistLogo.fetch()!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -76,7 +75,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildLinuxIcon(String sysVer) {
|
Widget _buildLinuxIcon(String sysVer) {
|
||||||
if (!_showDistLogo) return placeholder;
|
if (!_setting.showDistLogo.fetch()!) return placeholder;
|
||||||
final iconPath = sysVer.dist?.iconPath;
|
final iconPath = sysVer.dist?.iconPath;
|
||||||
if (iconPath == null) return placeholder;
|
if (iconPath == null) return placeholder;
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
@@ -262,13 +261,13 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDiskView(ServerStatus ss) {
|
Widget _buildDiskView(ServerStatus ss) {
|
||||||
final clone = ss.disk.toList();
|
ss.disk.removeWhere((e) {
|
||||||
for (var item in ss.disk) {
|
for (final ingorePath in _setting.diskIgnorePath.fetch()!) {
|
||||||
if (_ignorePath.any((ele) => item.path.startsWith(ele))) {
|
if (e.path.startsWith(ingorePath)) return true;
|
||||||
clone.remove(item);
|
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
final children = clone
|
});
|
||||||
|
final children = ss.disk
|
||||||
.map((disk) => Padding(
|
.map((disk) => Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -344,14 +343,14 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNetSpeedItem(NetSpeed ns, String device) {
|
Widget _buildNetSpeedItem(NetSpeed ns, String device) {
|
||||||
final width = (_media.size.width - 34 - 34) / 3;
|
final width = (_media.size.width - 34 - 34) / 2.9;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: width,
|
width: width / 1.2,
|
||||||
child: Text(
|
child: Text(
|
||||||
device,
|
device,
|
||||||
style: textSize11,
|
style: textSize11,
|
||||||
@@ -364,7 +363,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
'${ns.speedIn(device: device)} | ${ns.totalIn(device: device)}',
|
'${ns.speedIn(device: device)} | ${ns.totalIn(device: device)}',
|
||||||
style: textSize11,
|
style: textSize11,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textScaleFactor: 0.9,
|
textScaleFactor: 0.87,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -373,7 +372,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
'${ns.speedOut(device: device)} | ${ns.totalOut(device: device)}',
|
'${ns.speedOut(device: device)} | ${ns.totalOut(device: device)}',
|
||||||
style: textSize11,
|
style: textSize11,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
textScaleFactor: 0.9,
|
textScaleFactor: 0.87,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -393,7 +392,10 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
Icon(Icons.arrow_downward, size: 17),
|
Icon(Icons.arrow_downward, size: 17),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Padding(padding: EdgeInsets.symmetric(vertical: 3), child: Divider(height: 7),),
|
const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 3),
|
||||||
|
child: Divider(height: 7),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
children.addAll(ss.temps.devices.map((key) => Row(
|
children.addAll(ss.temps.devices.map((key) => Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
@@ -415,6 +417,4 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
child: Column(children: children),
|
child: Column(children: children),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const _ignorePath = ['udev', 'tmpfs', 'devtmpfs'];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -135,6 +136,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_buildDistLogoSwitch(),
|
_buildDistLogoSwitch(),
|
||||||
_buildUpdateInterval(),
|
_buildUpdateInterval(),
|
||||||
_buildMaxRetry(),
|
_buildMaxRetry(),
|
||||||
|
_buildDiskIgnorePath(),
|
||||||
].map((e) => RoundRectCard(e)).toList(),
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -568,4 +570,30 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildDiskIgnorePath() {
|
||||||
|
final paths = _setting.diskIgnorePath.fetch()!;
|
||||||
|
return ListTile(
|
||||||
|
title: Text(_s.diskIgnorePath),
|
||||||
|
trailing: Text(_s.edit, style: textSize15,),
|
||||||
|
onTap: () {
|
||||||
|
showRoundDialog(context: context, child: Input(
|
||||||
|
controller: TextEditingController(text: json.encode(paths)),
|
||||||
|
label: 'JSON',
|
||||||
|
type: TextInputType.visiblePassword,
|
||||||
|
maxLines: 3,
|
||||||
|
onSubmitted: (p0) {
|
||||||
|
try {
|
||||||
|
final list = List<String>.from(json.decode(p0));
|
||||||
|
_setting.diskIgnorePath.put(list);
|
||||||
|
context.pop();
|
||||||
|
showSnackBar(context, Text(_s.success));
|
||||||
|
} catch (e) {
|
||||||
|
showSnackBar(context, Text(e.toString()));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user