From 1a7dc51c4b16b7d1f45574cfe58a6bc6cd70eca1 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Sat, 15 Mar 2025 09:13:18 -0500 Subject: [PATCH] fixes --- web/repertory/lib/models/mount_list.dart | 8 ++++---- web/repertory/lib/screens/add_mount_screen.dart | 2 +- web/repertory/lib/types/mount_config.dart | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/web/repertory/lib/models/mount_list.dart b/web/repertory/lib/models/mount_list.dart index 593de8c6..0c2cc57f 100644 --- a/web/repertory/lib/models/mount_list.dart +++ b/web/repertory/lib/models/mount_list.dart @@ -16,7 +16,7 @@ class MountList with ChangeNotifier { UnmodifiableListView get items => UnmodifiableListView(_mountList); - bool hasBucketName(String mountType, String name, {String? excludeName}) { + bool hasBucketName(String mountType, String bucket, {String? excludeName}) { return (excludeName == null ? items : items.whereNot( @@ -25,9 +25,9 @@ class MountList with ChangeNotifier { )) .firstWhereOrNull( (item) => - (item.settings["${mountType}Config"]["Bucket"] as String) - .toLowerCase() == - name.toLowerCase(), + item.type.toLowerCase() == mountType.toLowerCase() && + item.bucket != null && + item.bucket!.toLowerCase() == bucket.toLowerCase(), ) != null; } diff --git a/web/repertory/lib/screens/add_mount_screen.dart b/web/repertory/lib/screens/add_mount_screen.dart index bc9b6a53..d6572a28 100644 --- a/web/repertory/lib/screens/add_mount_screen.dart +++ b/web/repertory/lib/screens/add_mount_screen.dart @@ -158,7 +158,7 @@ class _AddMountScreenState extends State { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - "Configuration '${_mountNameController.text}' already exists", + "Configuration name '${_mountNameController.text}' already exists", textAlign: TextAlign.center, ), ), diff --git a/web/repertory/lib/types/mount_config.dart b/web/repertory/lib/types/mount_config.dart index 3992fe71..e462b203 100644 --- a/web/repertory/lib/types/mount_config.dart +++ b/web/repertory/lib/types/mount_config.dart @@ -1,5 +1,6 @@ import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; +import 'package:repertory/helpers.dart' show initialCaps; class MountConfig { final String _name; @@ -15,6 +16,8 @@ class MountConfig { } } + String? get bucket => + _settings['${initialCaps(_type)}Config']?["Bucket"] as String; String get name => _name; String get path => _path; UnmodifiableMapView get settings =>