fixes
This commit is contained in:
parent
d209b52848
commit
1a7dc51c4b
@ -16,7 +16,7 @@ class MountList with ChangeNotifier {
|
|||||||
UnmodifiableListView<MountConfig> get items =>
|
UnmodifiableListView<MountConfig> get items =>
|
||||||
UnmodifiableListView<MountConfig>(_mountList);
|
UnmodifiableListView<MountConfig>(_mountList);
|
||||||
|
|
||||||
bool hasBucketName(String mountType, String name, {String? excludeName}) {
|
bool hasBucketName(String mountType, String bucket, {String? excludeName}) {
|
||||||
return (excludeName == null
|
return (excludeName == null
|
||||||
? items
|
? items
|
||||||
: items.whereNot(
|
: items.whereNot(
|
||||||
@ -25,9 +25,9 @@ class MountList with ChangeNotifier {
|
|||||||
))
|
))
|
||||||
.firstWhereOrNull(
|
.firstWhereOrNull(
|
||||||
(item) =>
|
(item) =>
|
||||||
(item.settings["${mountType}Config"]["Bucket"] as String)
|
item.type.toLowerCase() == mountType.toLowerCase() &&
|
||||||
.toLowerCase() ==
|
item.bucket != null &&
|
||||||
name.toLowerCase(),
|
item.bucket!.toLowerCase() == bucket.toLowerCase(),
|
||||||
) !=
|
) !=
|
||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ class _AddMountScreenState extends State<AddMountScreen> {
|
|||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
"Configuration '${_mountNameController.text}' already exists",
|
"Configuration name '${_mountNameController.text}' already exists",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:repertory/helpers.dart' show initialCaps;
|
||||||
|
|
||||||
class MountConfig {
|
class MountConfig {
|
||||||
final String _name;
|
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 name => _name;
|
||||||
String get path => _path;
|
String get path => _path;
|
||||||
UnmodifiableMapView<String, dynamic> get settings =>
|
UnmodifiableMapView<String, dynamic> get settings =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user