Add copy-all-logs buttons and log status refresh failures
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -234,6 +234,19 @@ class _LogsPageBodyState extends State<LogsPageBody> {
|
||||
Wrap(
|
||||
spacing: 12,
|
||||
children: [
|
||||
OutlinedButton(
|
||||
onPressed: () async {
|
||||
await Clipboard.setData(
|
||||
ClipboardData(text: widget.logs.join('\n')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('已复制全部 ${widget.logs.length} 条日志')),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('复制全部日志'),
|
||||
),
|
||||
OutlinedButton(
|
||||
onPressed: () async {
|
||||
await Clipboard.setData(
|
||||
|
||||
@@ -348,6 +348,7 @@ class _LabScreenState extends State<LabScreen> {
|
||||
setState(() => status = next);
|
||||
}
|
||||
} catch (e) {
|
||||
log('状态刷新失败 · $e');
|
||||
if (mounted && proxySession?.state == 'Failed') {
|
||||
setState(() {
|
||||
status = {'state': 'Failed', 'peer_count': 0};
|
||||
@@ -1055,7 +1056,17 @@ class _LabScreenState extends State<LabScreen> {
|
||||
]),
|
||||
speedPanel(),
|
||||
if (logs.isNotEmpty)
|
||||
panel('最近事件', logs.take(3).map((line) => Text(line)).toList()),
|
||||
panel('最近事件', [
|
||||
...logs.take(3).map((line) => Text(line)),
|
||||
TextButton.icon(
|
||||
onPressed: () async {
|
||||
await Clipboard.setData(ClipboardData(text: logs.join('\n')));
|
||||
log('已复制全部运行日志(${logs.length} 条)');
|
||||
},
|
||||
icon: const Icon(Icons.copy),
|
||||
label: Text('复制全部日志(${logs.length} 条)'),
|
||||
),
|
||||
]),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -1155,18 +1166,24 @@ class _LabScreenState extends State<LabScreen> {
|
||||
label: const Text('复制网络诊断'),
|
||||
),
|
||||
]),
|
||||
panel(
|
||||
'最近事件',
|
||||
logs
|
||||
panel('最近事件', [
|
||||
...logs
|
||||
.take(4)
|
||||
.map(
|
||||
(v) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: Text(v),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
TextButton.icon(
|
||||
onPressed: () async {
|
||||
await Clipboard.setData(ClipboardData(text: logs.join('\n')));
|
||||
log('已复制全部运行日志(${logs.length} 条)');
|
||||
},
|
||||
icon: const Icon(Icons.copy),
|
||||
label: Text('复制全部日志(${logs.length} 条)'),
|
||||
),
|
||||
]),
|
||||
],
|
||||
);
|
||||
Widget nodes() => Column(
|
||||
|
||||
Reference in New Issue
Block a user