This commit is contained in:
lollipopkit
2023-08-08 17:46:04 +08:00
parent 159942de95
commit d35d106ad4
7 changed files with 94 additions and 66 deletions

View File

@@ -149,10 +149,16 @@ class _ServerPageState extends State<ServerPage>
}
return GestureDetector(
key: Key(si.spi.id + (_tag ?? '')),
onTap: () => AppRoute(
ServerDetailPage(si.spi.id),
'server detail page',
).go(context),
onTap: () {
if (si.state == ServerState.connected) {
AppRoute(
ServerDetailPage(si.spi.id),
'server detail page',
).go(context);
} else {
_showFailReason(si.status);
}
},
child: RoundRectCard(
Padding(
padding: const EdgeInsets.all(13),
@@ -260,19 +266,7 @@ class _ServerPageState extends State<ServerPage>
);
if (cs == ServerState.failed && ss.failedInfo != null) {
return GestureDetector(
onTap: () => showRoundDialog(
context: context,
title: Text(_s.error),
child: SingleChildScrollView(
child: Text(ss.failedInfo!),
),
actions: [
TextButton(
onPressed: () => copy2Clipboard(ss.failedInfo!),
child: Text(_s.copy),
)
],
),
onTap: () => _showFailReason(ss),
child: Text(
_s.viewErr,
style: textSize12Grey,
@@ -287,6 +281,22 @@ class _ServerPageState extends State<ServerPage>
);
}
void _showFailReason(ServerStatus ss) {
showRoundDialog(
context: context,
title: Text(_s.error),
child: SingleChildScrollView(
child: Text(ss.failedInfo!),
),
actions: [
TextButton(
onPressed: () => copy2Clipboard(ss.failedInfo!),
child: Text(_s.copy),
)
],
);
}
Widget _buildSSHBtn(ServerPrivateInfo spi) {
return GestureDetector(
child: const Icon(Icons.terminal, size: 21),