diff --git a/repertory/repertory/src/ui/mgmt_app_config.cpp b/repertory/repertory/src/ui/mgmt_app_config.cpp index b227f08c..bb2704cc 100644 --- a/repertory/repertory/src/ui/mgmt_app_config.cpp +++ b/repertory/repertory/src/ui/mgmt_app_config.cpp @@ -46,8 +46,12 @@ namespace { } for (auto &[prov, map] : map_of_maps) { - for (const auto &[key, value] : - json[repertory::provider_type_to_string(prov)].items()) { + auto prov_str = repertory::provider_type_to_string(prov); + if (!json.contains(prov_str)) { + continue; + } + + for (const auto &[key, value] : json.at(prov_str).items()) { map[key] = value; } } diff --git a/web/repertory/lib/models/mount.dart b/web/repertory/lib/models/mount.dart index 8cc797e9..03b1a7a0 100644 --- a/web/repertory/lib/models/mount.dart +++ b/web/repertory/lib/models/mount.dart @@ -85,6 +85,29 @@ class Mount with ChangeNotifier { } } + Future getMountLocation() async { + try { + final response = await http.get( + Uri.parse( + Uri.encodeFull( + '${getBaseUri()}/api/v1/mount_location?name=$name&type=$type', + ), + ), + ); + + if (response.statusCode != 200) { + return null; + } + + final location = jsonDecode(response.body)['Location'] as String; + return location.trim().isEmpty ? null : location; + } catch (e) { + debugPrint('$e'); + } + + return null; + } + Future mount(bool unmount, {String? location}) async { try { _isMounting = true; @@ -166,27 +189,4 @@ class Mount with ChangeNotifier { debugPrint('$e'); } } - - Future getMountLocation() async { - try { - final response = await http.get( - Uri.parse( - Uri.encodeFull( - '${getBaseUri()}/api/v1/mount_location?name=$name&type=$type', - ), - ), - ); - - if (response.statusCode != 200) { - return null; - } - - final location = jsonDecode(response.body)['Location'] as String; - return location.trim().isEmpty ? null : location; - } catch (e) { - debugPrint('$e'); - } - - return null; - } } diff --git a/web/repertory/lib/widgets/mount_widget.dart b/web/repertory/lib/widgets/mount_widget.dart index 9b2c4296..80d9079a 100644 --- a/web/repertory/lib/widgets/mount_widget.dart +++ b/web/repertory/lib/widgets/mount_widget.dart @@ -109,13 +109,16 @@ class _MountWidgetState extends State { final success = await mount.mount(mounted, location: location); if (success || - mount.mounted! || + mounted || constants.navigatorKey.currentContext == null || !constants.navigatorKey.currentContext!.mounted) { return cleanup(); } - displayErrorMessage(context, "Mount location is not available"); + displayErrorMessage( + context, + "Mount location is not available: $location", + ); cleanup(); } : null;