This commit is contained in:
Scott E. Graves 2025-03-15 09:13:18 -05:00
parent d209b52848
commit 1a7dc51c4b
3 changed files with 8 additions and 5 deletions

View File

@ -16,7 +16,7 @@ class MountList with ChangeNotifier {
UnmodifiableListView<MountConfig> get items =>
UnmodifiableListView<MountConfig>(_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;
}

View File

@ -158,7 +158,7 @@ class _AddMountScreenState extends State<AddMountScreen> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
"Configuration '${_mountNameController.text}' already exists",
"Configuration name '${_mountNameController.text}' already exists",
textAlign: TextAlign.center,
),
),

View File

@ -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<String, dynamic> get settings =>