From 0e35c370bad253985bade92a4fec6ff2cdafc454 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 6 Apr 2020 22:19:43 +1000 Subject: [PATCH] Report server instance name --- lib/api.dart | 8 +++++++- lib/settings.dart | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/api.dart b/lib/api.dart index a02303f3..069a6fb2 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -72,8 +72,11 @@ class InvenTreeAPI { // Authentication token (initially empty, must be requested) String _token = ""; + // Server instance information + String instance = ''; + // Server version information - String _version; + String _version = ''; // Getter for server version information String get version => _version; @@ -174,6 +177,9 @@ class InvenTreeAPI { _version = data["version"]; + // Record the instance name of the server + instance = data['instance'] ?? ''; + // Request token from the server if we do not already have one if (_token.isNotEmpty) { print("Already have token - $_token"); diff --git a/lib/settings.dart b/lib/settings.dart index 48d8d363..9a640a9b 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -61,6 +61,10 @@ class _InvenTreeSettingsState extends State { title: Text("Server Version"), subtitle: Text(InvenTreeAPI().version.isNotEmpty ? InvenTreeAPI().version : "Not connected"), ), + ListTile( + title: Text("Server Instance"), + subtitle: Text(InvenTreeAPI().instance.isNotEmpty ? InvenTreeAPI().instance : "Not connected"), + ), Divider(), ListTile( title: Text("App Name"),