mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-04-17 16:10:34 +00:00
commit
84e8ccc43a
18 changed files with 257 additions and 48 deletions
|
|
@ -298,6 +298,9 @@ class _ProfileEditState extends State<ProfileEditWidget> {
|
|||
String name = "";
|
||||
String server = "";
|
||||
|
||||
bool? serverStatus;
|
||||
bool serverChecking = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
|
@ -411,6 +414,49 @@ class _ProfileEditState extends State<ProfileEditWidget> {
|
|||
return null;
|
||||
},
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton.icon(
|
||||
label: Text(L10().connectionCheck),
|
||||
icon: serverStatus == true
|
||||
? Icon(TablerIcons.circle_check, color: COLOR_SUCCESS)
|
||||
: serverStatus == false
|
||||
? Icon(TablerIcons.circle_x, color: COLOR_DANGER)
|
||||
: Icon(TablerIcons.question_mark, color: COLOR_WARNING),
|
||||
onPressed: serverChecking
|
||||
? null
|
||||
: () async {
|
||||
if (serverChecking) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
serverStatus = null;
|
||||
serverChecking = true;
|
||||
});
|
||||
}
|
||||
|
||||
formKey.currentState!.save();
|
||||
|
||||
InvenTreeAPI().checkServer(server: server).then((
|
||||
result,
|
||||
) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
serverStatus = result;
|
||||
serverChecking = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue