mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
@ -309,8 +309,6 @@ class SpaceManagementBloc
|
|||||||
await _api.deleteSpace(communityUuid, parent.uuid!);
|
await _api.deleteSpace(communityUuid, parent.uuid!);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(
|
|
||||||
'Error deleting space ${parent.name} (UUID: ${parent.uuid}, Community UUID: $communityUuid): $e');
|
|
||||||
rethrow; // Decide whether to stop execution or continue
|
rethrow; // Decide whether to stop execution or continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -342,7 +340,6 @@ class SpaceManagementBloc
|
|||||||
space.uuid = response?.uuid;
|
space.uuid = response?.uuid;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error creating space ${space.name}: $e');
|
|
||||||
rethrow; // Stop further execution on failure
|
rethrow; // Stop further execution on failure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,13 +133,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
isNameFieldInvalid = value.isEmpty;
|
isNameFieldInvalid = value.isEmpty;
|
||||||
|
|
||||||
if (!isNameFieldInvalid) {
|
if (!isNameFieldInvalid) {
|
||||||
if ((widget.parentSpace?.children.any(
|
if (_isNameConflict(value)) {
|
||||||
(child) => child.name == value) ??
|
|
||||||
false) ||
|
|
||||||
(widget.parentSpace?.name == value) ||
|
|
||||||
(widget.editSpace?.children.any(
|
|
||||||
(child) => child.name == value) ??
|
|
||||||
false)) {
|
|
||||||
isNameFieldExist = true;
|
isNameFieldExist = true;
|
||||||
isOkButtonEnabled = false;
|
isOkButtonEnabled = false;
|
||||||
} else {
|
} else {
|
||||||
@ -387,7 +381,14 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _isNameConflict(String value) {
|
||||||
|
return (widget.parentSpace?.children.any((child) => child.name == value) ??
|
||||||
|
false) ||
|
||||||
|
(widget.parentSpace?.name == value) ||
|
||||||
|
(widget.editSpace?.parent?.name == value) ||
|
||||||
|
(widget.editSpace?.children.any((child) => child.name == value) ??
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
String _mapIconToProduct(String uuid, List<ProductModel> products) {
|
String _mapIconToProduct(String uuid, List<ProductModel> products) {
|
||||||
// Find the product with the matching UUID
|
// Find the product with the matching UUID
|
||||||
|
Reference in New Issue
Block a user