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(
|
Wrap(
|
||||||
spacing: 12,
|
spacing: 12,
|
||||||
children: [
|
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(
|
OutlinedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Clipboard.setData(
|
await Clipboard.setData(
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ class _LabScreenState extends State<LabScreen> {
|
|||||||
setState(() => status = next);
|
setState(() => status = next);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
log('状态刷新失败 · $e');
|
||||||
if (mounted && proxySession?.state == 'Failed') {
|
if (mounted && proxySession?.state == 'Failed') {
|
||||||
setState(() {
|
setState(() {
|
||||||
status = {'state': 'Failed', 'peer_count': 0};
|
status = {'state': 'Failed', 'peer_count': 0};
|
||||||
@@ -1055,7 +1056,17 @@ class _LabScreenState extends State<LabScreen> {
|
|||||||
]),
|
]),
|
||||||
speedPanel(),
|
speedPanel(),
|
||||||
if (logs.isNotEmpty)
|
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('复制网络诊断'),
|
label: const Text('复制网络诊断'),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
panel(
|
panel('最近事件', [
|
||||||
'最近事件',
|
...logs
|
||||||
logs
|
|
||||||
.take(4)
|
.take(4)
|
||||||
.map(
|
.map(
|
||||||
(v) => Padding(
|
(v) => Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 8),
|
padding: const EdgeInsets.only(bottom: 8),
|
||||||
child: Text(v),
|
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(
|
Widget nodes() => Column(
|
||||||
|
|||||||
Reference in New Issue
Block a user