Compare commits

..

17 Commits

Author SHA1 Message Date
7de9e25ed5 Merge branch 'dev' of https://github.com/SyncrowIOT/web into bugfix/update-space 2025-03-11 22:07:50 +04:00
123949aa86 update space with a space model 2025-03-11 22:05:36 +04:00
6d554c5953 Merge pull request #113 from SyncrowIOT/bugfix/remove-link
fixed issue in removing link
2025-03-10 16:55:02 +04:00
5ed87a5794 fixed issue in removing link 2025-03-10 11:47:00 +04:00
168c997240 Merge pull request #112 from SyncrowIOT:bugfix/empty-space-model
fixed issue in update
2025-03-09 17:32:38 +04:00
de65f79ccf Merge branch 'dev' of https://github.com/SyncrowIOT/web into bugfix/empty-space-model 2025-03-09 17:32:06 +04:00
eb0490fb16 fixed issue in update 2025-03-09 17:31:36 +04:00
a73fc04712 Merge pull request #110 from SyncrowIOT/SP-1297
fix model and SpaceModelCardWidget and LinkSpaceModelSpacesDialog
2025-03-09 16:11:18 +03:00
5237f3ae5b Merge pull request #111 from SyncrowIOT/bugfix/empty-space-model
fix the circular progress on empty space model
2025-03-09 16:49:36 +04:00
e017633b9b fixed space model 2025-03-09 16:48:42 +04:00
a1d15c9cea fix the circular progress on empty space model 2025-03-09 15:53:55 +04:00
16c006e7a9 Merge pull request #109 from SyncrowIOT/feat/fix-update-on-community-tree
Feat/fix-update-on-community-tree
2025-03-09 14:06:48 +04:00
24280549ec revert back color change 2025-03-09 14:06:33 +04:00
ada19a5992 fetch communities and spaces on space model update 2025-03-09 10:47:09 +04:00
c6702d4d5f Merge branch 'dev' of https://github.com/SyncrowIOT/web into dev 2025-03-09 10:29:05 +04:00
f78e2e2d36 Merge branch 'feat/update-space-model' of https://github.com/SyncrowIOT/web into dev 2025-03-09 10:26:34 +04:00
83b9555920 added padding to space tree on community structure 2025-03-09 10:26:30 +04:00
11 changed files with 93 additions and 70 deletions

View File

@ -101,7 +101,7 @@ class CustomExpansionTileState extends State<CustomExpansionTile> {
widget.children != null && widget.children != null &&
widget.children!.isNotEmpty) widget.children!.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.only(left: 48.0), // Indented children padding: const EdgeInsets.only(left: 24.0), // Indented children
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: widget.children!, children: widget.children!,

View File

@ -83,7 +83,7 @@ class CustomExpansionTileSpaceTree extends StatelessWidget {
), ),
if (isExpanded && children != null && children!.isNotEmpty) if (isExpanded && children != null && children!.isNotEmpty)
Padding( Padding(
padding: const EdgeInsets.only(left: 48.0), padding: const EdgeInsets.only(left: 24.0),
child: Column( child: Column(
children: children ?? [], children: children ?? [],
), ),

View File

@ -52,14 +52,24 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
Future<void> _updateSpaceModelCache( Future<void> _updateSpaceModelCache(
UpdateSpaceModelCache event, Emitter<SpaceManagementState> emit) async { UpdateSpaceModelCache event, Emitter<SpaceManagementState> emit) async {
if (_cachedSpaceModels != null) { final projectUuid = await ProjectManager.getProjectUUID() ?? '';
_cachedSpaceModels = _cachedSpaceModels!.map((model) {
return model.uuid == event.updatedModel.uuid ? event.updatedModel : model; List<SpaceTemplateModel> allSpaceModels = [];
}).toList();
bool hasNext = true;
int page = 1;
while (hasNext) {
final spaceModels = await _spaceModelApi.listSpaceModels(page: page, projectId: projectUuid);
if (spaceModels.isNotEmpty) {
allSpaceModels.addAll(spaceModels);
page++;
} else { } else {
_cachedSpaceModels = await fetchSpaceModels(); hasNext = false;
}
} }
_cachedSpaceModels = allSpaceModels;
await fetchTags(); await fetchTags();
emit(SpaceModelLoaded( emit(SpaceModelLoaded(
@ -599,6 +609,7 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
subspaces: subspaceUpdates, subspaces: subspaceUpdates,
tags: tagUpdates, tags: tagUpdates,
direction: space.incomingConnection?.direction, direction: space.incomingConnection?.direction,
spaceModelUuid: space.spaceModel?.uuid,
projectId: projectUuid); projectId: projectUuid);
} else { } else {
// Call create if the space does not have a UUID // Call create if the space does not have a UUID

View File

@ -22,7 +22,7 @@ class CommunityTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: const EdgeInsets.only(left: 16.0), padding: const EdgeInsets.all(8.0),
child: CustomExpansionTile( child: CustomExpansionTile(
title: title, title: title,
initiallyExpanded: isExpanded, initiallyExpanded: isExpanded,

View File

@ -297,6 +297,8 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
), ),
onDeleted: () => setState(() { onDeleted: () => setState(() {
this.selectedSpaceModel = null; this.selectedSpaceModel = null;
subspaces = widget.subspaces ?? [];
tags = widget.tags ?? [];
})), })),
], ],
), ),

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart'; import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
@ -80,15 +81,15 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
clipBehavior: Clip.none, clipBehavior: Clip.none,
children: [ children: [
widget.shouldNavigateToSpaceModelPage widget.shouldNavigateToSpaceModelPage
? _spaceModels.isNotEmpty
? Row( ? Row(
children: [ children: [
SizedBox(width: 300, child: SpaceTreeView(onSelect: () {})), SizedBox(width: 300, child: SpaceTreeView(onSelect: () {})),
Expanded( Expanded(
child: BlocProvider( child: BlocProvider(
create: (context) => SpaceModelBloc( create: (context) => SpaceModelBloc(
BlocProvider.of<SpaceTreeBloc>(context),
api: SpaceModelManagementApi(), api: SpaceModelManagementApi(),
initialSpaceModels: _spaceModels, initialSpaceModels: widget.spaceModels ?? [],
), ),
child: SpaceModelPage( child: SpaceModelPage(
products: widget.products, products: widget.products,
@ -99,13 +100,13 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
), ),
], ],
) )
: const Center(child: CircularProgressIndicator())
: Row( : Row(
children: [ children: [
SidebarWidget( SidebarWidget(
communities: widget.communities, communities: widget.communities,
selectedSpaceUuid: selectedSpaceUuid: widget.selectedSpace?.uuid ??
widget.selectedSpace?.uuid ?? widget.selectedCommunity?.uuid ?? '', widget.selectedCommunity?.uuid ??
'',
), ),
CommunityStructureArea( CommunityStructureArea(
selectedCommunity: widget.selectedCommunity, selectedCommunity: widget.selectedCommunity,

View File

@ -205,9 +205,11 @@ class _SidebarWidgetState extends State<SidebarWidget> {
); );
} }
Widget _buildSpaceTile(SpaceModel space, CommunityModel community) { Widget _buildSpaceTile(SpaceModel space, CommunityModel community, {int depth = 1}) {
bool isExpandedSpace = _isSpaceOrChildSelected(space); bool isExpandedSpace = _isSpaceOrChildSelected(space);
return SpaceTile( return Padding(
padding: EdgeInsets.only(left: depth * 16.0),
child: SpaceTile(
title: space.name, title: space.name,
key: ValueKey(space.uuid), key: ValueKey(space.uuid),
isSelected: _selectedId == space.uuid, isSelected: _selectedId == space.uuid,
@ -228,7 +230,7 @@ class _SidebarWidgetState extends State<SidebarWidget> {
children: space.children.isNotEmpty children: space.children.isNotEmpty
? space.children.map((childSpace) => _buildSpaceTile(childSpace, community)).toList() ? space.children.map((childSpace) => _buildSpaceTile(childSpace, community)).toList()
: [], // Recursively render child spaces if available : [], // Recursively render child spaces if available
); ));
} }
void _handleExpansionChange(String uuid, bool expanded) {} void _handleExpansionChange(String uuid, bool expanded) {}

View File

@ -35,7 +35,9 @@ class _SpaceTileState extends State<SpaceTile> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CustomExpansionTile( return Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0),
child: CustomExpansionTile(
isSelected: widget.isSelected, isSelected: widget.isSelected,
title: widget.title, title: widget.title,
initiallyExpanded: _isExpanded, initiallyExpanded: _isExpanded,
@ -47,6 +49,6 @@ class _SpaceTileState extends State<SpaceTile> {
widget.onExpansionChanged(expanded); widget.onExpansionChanged(expanded);
}, },
children: widget.children ?? [], children: widget.children ?? [],
); ));
} }
} }

View File

@ -1,7 +1,7 @@
import 'dart:developer';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/common/bloc/project_manager.dart'; import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_event.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_event.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_event.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_state.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_state.dart';
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
@ -9,8 +9,10 @@ import 'package:syncrow_web/services/space_model_mang_api.dart';
class SpaceModelBloc extends Bloc<SpaceModelEvent, SpaceModelState> { class SpaceModelBloc extends Bloc<SpaceModelEvent, SpaceModelState> {
final SpaceModelManagementApi api; final SpaceModelManagementApi api;
final SpaceTreeBloc _spaceTreeBloc;
SpaceModelBloc({ SpaceModelBloc(
this._spaceTreeBloc, {
required this.api, required this.api,
required List<SpaceTemplateModel> initialSpaceModels, required List<SpaceTemplateModel> initialSpaceModels,
}) : super(SpaceModelLoaded(spaceModels: initialSpaceModels)) { }) : super(SpaceModelLoaded(spaceModels: initialSpaceModels)) {
@ -50,6 +52,7 @@ class SpaceModelBloc extends Bloc<SpaceModelEvent, SpaceModelState> {
final updatedSpaceModels = currentState.spaceModels.map((model) { final updatedSpaceModels = currentState.spaceModels.map((model) {
return model.uuid == event.spaceModelUuid ? newSpaceModel : model; return model.uuid == event.spaceModelUuid ? newSpaceModel : model;
}).toList(); }).toList();
_spaceTreeBloc.add(InitialEvent());
emit(SpaceModelLoaded(spaceModels: updatedSpaceModels)); emit(SpaceModelLoaded(spaceModels: updatedSpaceModels));
} }
} catch (e) { } catch (e) {
@ -71,7 +74,7 @@ class SpaceModelBloc extends Bloc<SpaceModelEvent, SpaceModelState> {
final updatedSpaceModels = currentState.spaceModels final updatedSpaceModels = currentState.spaceModels
.where((model) => model.uuid != event.spaceModelUuid) .where((model) => model.uuid != event.spaceModelUuid)
.toList(); .toList();
_spaceTreeBloc.add(InitialEvent());
emit(SpaceModelLoaded(spaceModels: updatedSpaceModels)); emit(SpaceModelLoaded(spaceModels: updatedSpaceModels));
} }
} catch (e) { } catch (e) {

View File

@ -227,6 +227,7 @@ class CommunitySpaceManagementApi {
required Offset position, required Offset position,
List<TagModelUpdate>? tags, List<TagModelUpdate>? tags,
List<UpdateSubspaceTemplateModel>? subspaces, List<UpdateSubspaceTemplateModel>? subspaces,
String? spaceModelUuid,
required String projectId}) async { required String projectId}) async {
try { try {
final body = { final body = {
@ -238,6 +239,7 @@ class CommunitySpaceManagementApi {
'icon': icon, 'icon': icon,
'subspace': subspaces, 'subspace': subspaces,
'tags': tags, 'tags': tags,
'spaceModelUuid': spaceModelUuid,
}; };
if (parentId != null) { if (parentId != null) {
body['parentUuid'] = parentId; body['parentUuid'] = parentId;

View File

@ -52,7 +52,7 @@ abstract class ColorsManager {
static const Color semiTransparentBlackColor = Color(0x3F000000); static const Color semiTransparentBlackColor = Color(0x3F000000);
static const Color transparentColor = Color(0x00000000); static const Color transparentColor = Color(0x00000000);
static const Color spaceColor = Color(0xB2023DFE); static const Color spaceColor = Color(0xB2023DFE);
static const Color counterBackgroundColor = Color.fromARGB(204, 105, 2, 2); static const Color counterBackgroundColor = Color(0xCCF4F4F4);
static const Color neutralGray = Color(0xFFE5E5E5); static const Color neutralGray = Color(0xFFE5E5E5);
static const Color warningRed = Color(0xFFFF6465); static const Color warningRed = Color(0xFFFF6465);
static const Color borderColor = Color(0xFFE5E5E5); static const Color borderColor = Color(0xFFE5E5E5);