Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: tauri folder display (#2176)
Nathan.foooddd3fbb17855
diff --git a/.gitignore b/.gitignoreindex 5eeae980bc..bce47974c4 100644--- a/.gitignore+++ b/.gitignore@@ -35,3 +35,5 @@ pubspec.lock.githooks/gitlint.githooks/gitlint.exe.fvm/++**/AppFlowy-Collab/diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dartindex dfff5279a2..86e6da42be 100644--- a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart@@ -79,7 +79,7 @@ class DatabaseController {final DatabaseViewBackendService _databaseViewBackendSvc;final FieldController fieldController;late DatabaseViewCache _viewCache;- final LayoutTypePB layoutType;+ final DatabaseLayoutPB layoutType;// CallbacksDatabaseCallbacks? _databaseCallbacks;@@ -110,7 +110,7 @@ class DatabaseController {_listenOnFieldsChanged();_listenOnGroupChanged();_listenOnLayoutChanged();- if (layoutType == LayoutTypePB.Calendar) {+ if (layoutType == DatabaseLayoutPB.Calendar) {_listenOnCalendarLayoutChanged();}}diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dartindex 44896c0883..bc6dd6e699 100644--- a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart@@ -86,7 +86,7 @@ class DatabaseViewBackendService {}Future<Either<LayoutSettingPB, FlowyError>> getLayoutSetting(- LayoutTypePB layoutType) {+ DatabaseLayoutPB layoutType) {final payload = DatabaseLayoutIdPB.create()..viewId = viewId..layout = layoutType;diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dartindex d91cd68558..6acfbfc650 100644--- a/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart@@ -30,7 +30,7 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {BoardBloc({required ViewPB view}): _databaseController = DatabaseController(view: view,- layoutType: LayoutTypePB.Board,+ layoutType: DatabaseLayoutPB.Board,),super(BoardState.initial(view.id)) {boardController = AppFlowyBoardController(diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/board/board.dart b/frontend/appflowy_flutter/lib/plugins/database_view/board/board.dartindex c6d2922cb2..15adee1187 100644--- a/frontend/appflowy_flutter/lib/plugins/database_view/board/board.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/board/board.dart@@ -29,7 +29,7 @@ class BoardPluginBuilder implements PluginBuilder {PluginType get pluginType => PluginType.board;@override- ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Board;+ ViewLayoutPB? get layoutType => ViewLayoutPB.Board;}class BoardPluginConfig implements PluginConfig {diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_bloc.dartindex 147e7531cc..db5150d8d4 100644--- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_bloc.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_bloc.dart@@ -28,7 +28,7 @@ class CalendarBloc extends Bloc<CalendarEvent, CalendarState> {CalendarBloc({required ViewPB view}): _databaseController = DatabaseController(view: view,- layoutType: LayoutTypePB.Calendar,+ layoutType: DatabaseLayoutPB.Calendar,),super(CalendarState.initial()) {on<CalendarEvent>(diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/calendar.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/calendar.dartindex 9e29fc8d06..558db1419a 100644--- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/calendar.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/calendar.dart@@ -29,7 +29,7 @@ class CalendarPluginBuilder extends PluginBuilder {PluginType get pluginType => PluginType.calendar;@override- ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Calendar;+ ViewLayoutPB? get layoutType => ViewLayoutPB.Calendar;}class CalendarPluginConfig implements PluginConfig {diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/grid.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/grid.dartindex 213e74ebe2..283eca5701 100644--- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/grid.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/grid.dart@@ -29,7 +29,7 @@ class GridPluginBuilder implements PluginBuilder {PluginType get pluginType => PluginType.grid;@override- ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Grid;+ ViewLayoutPB? get layoutType => ViewLayoutPB.Grid;}class GridPluginConfig implements PluginConfig {diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/grid_page.dartindex 2971542529..2db3051642 100755--- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/grid_page.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/grid_page.dart@@ -38,7 +38,7 @@ class GridPage extends StatefulWidget {Key? key,}) : databaseController = DatabaseController(view: view,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,),super(key: key);diff --git a/frontend/appflowy_flutter/lib/plugins/document/document.dart b/frontend/appflowy_flutter/lib/plugins/document/document.dartindex 1a61742870..904dfd527f 100644--- a/frontend/appflowy_flutter/lib/plugins/document/document.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/document.dart@@ -34,7 +34,7 @@ class DocumentPluginBuilder extends PluginBuilder {PluginType get pluginType => PluginType.editor;@override- ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Document;+ ViewLayoutPB? get layoutType => ViewLayoutPB.Document;}class DocumentPlugin extends Plugin<int> {diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/base/insert_page_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/base/insert_page_command.dartindex cb286d69ae..fae8652fad 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/base/insert_page_command.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/base/insert_page_command.dart@@ -30,9 +30,9 @@ extension InsertPage on EditorState {String _convertPageType(ViewPB viewPB) {switch (viewPB.layout) {- case ViewLayoutTypePB.Grid:+ case ViewLayoutPB.Grid:return kGridType;- case ViewLayoutTypePB.Board:+ case ViewLayoutPB.Board:return kBoardType;default:throw Exception('Unknown layout type');diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/base/link_to_page_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/base/link_to_page_widget.dartindex 4a5c879fbf..bf7670dd1f 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/base/link_to_page_widget.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/base/link_to_page_widget.dart@@ -17,7 +17,7 @@ void showLinkToPageMenu(EditorState editorState,SelectionMenuService menuService,BuildContext context,- ViewLayoutTypePB pageType,+ ViewLayoutPB pageType,) {final alignment = menuService.alignment;final offset = menuService.offset;@@ -27,10 +27,10 @@ void showLinkToPageMenu(String hintText = '';switch (pageType) {- case ViewLayoutTypePB.Grid:+ case ViewLayoutPB.Grid:hintText = LocaleKeys.document_slashMenu_grid_selectAGridToLinkTo.tr();break;- case ViewLayoutTypePB.Board:+ case ViewLayoutPB.Board:hintText = LocaleKeys.document_slashMenu_board_selectABoardToLinkTo.tr();break;default:@@ -82,7 +82,7 @@ class LinkToPageMenu extends StatefulWidget {});final EditorState editorState;- final ViewLayoutTypePB layoutType;+ final ViewLayoutPB layoutType;final String hintText;final void Function(ViewPB view, ViewPB childView) onSelected;@@ -174,9 +174,9 @@ class _LinkToPageMenuState extends State<LinkToPageMenu> {String _iconName(ViewPB viewPB) {switch (viewPB.layout) {- case ViewLayoutTypePB.Grid:+ case ViewLayoutPB.Grid:return 'editor/grid';- case ViewLayoutTypePB.Board:+ case ViewLayoutPB.Board:return 'editor/board';default:throw Exception('Unknown layout type');diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/board/board_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/board/board_menu_item.dartindex 90bd0d68ec..8390f9201f 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/board/board_menu_item.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/board/board_menu_item.dart@@ -24,7 +24,7 @@ SelectionMenuItem boardMenuItem = SelectionMenuItem(editorState,menuService,context,- ViewLayoutTypePB.Board,+ ViewLayoutPB.Board,);},);diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/board/board_view_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/board/board_view_menu_item.dartindex 40f3c9ce86..56c55ba1bd 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/board/board_view_menu_item.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/board/board_view_menu_item.dart@@ -23,17 +23,17 @@ SelectionMenuItem boardViewMenuItem(DocumentBloc documentBloc) =>// TODO(a-wallen): Translate keywords.keywords: ['board', 'kanban'],handler: (editorState, menuService, context) async {- if (!documentBloc.view.hasAppId()) {+ if (!documentBloc.view.hasParentViewId()) {return;}- final appId = documentBloc.view.appId;+ final appId = documentBloc.view.parentViewId;final service = AppBackendService();final result = (await service.createView(appId: appId,name: LocaleKeys.menuAppHeader_defaultNewPageName.tr(),- layoutType: ViewLayoutTypePB.Board,+ layoutType: ViewLayoutPB.Board,)).getLeftOrNull();diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/grid/grid_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/grid/grid_menu_item.dartindex aaf976274e..09806b4eb0 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/grid/grid_menu_item.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/grid/grid_menu_item.dart@@ -23,7 +23,7 @@ SelectionMenuItem gridMenuItem = SelectionMenuItem(editorState,menuService,context,- ViewLayoutTypePB.Grid,+ ViewLayoutPB.Grid,);},);diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/grid/grid_view_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/grid/grid_view_menu_item.dartindex a3fa5fd8af..96cc8861cb 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/grid/grid_view_menu_item.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/plugins/grid/grid_view_menu_item.dart@@ -22,17 +22,17 @@ SelectionMenuItem gridViewMenuItem(DocumentBloc documentBloc) =>},keywords: ['grid'],handler: (editorState, menuService, context) async {- if (!documentBloc.view.hasAppId()) {+ if (!documentBloc.view.hasParentViewId()) {return;}- final appId = documentBloc.view.appId;+ final appId = documentBloc.view.parentViewId;final service = AppBackendService();final result = (await service.createView(appId: appId,name: LocaleKeys.menuAppHeader_defaultNewPageName.tr(),- layoutType: ViewLayoutTypePB.Grid,+ layoutType: ViewLayoutPB.Grid,)).getLeftOrNull();diff --git a/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart b/frontend/appflowy_flutter/lib/startup/plugin/plugin.dartindex 87b0ef7c4b..f6d6cad9fa 100644--- a/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart+++ b/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart@@ -52,7 +52,7 @@ abstract class PluginBuilder {PluginType get pluginType;- ViewLayoutTypePB? get layoutType => ViewLayoutTypePB.Document;+ ViewLayoutPB? get layoutType => ViewLayoutPB.Document;}abstract class PluginConfig {diff --git a/frontend/appflowy_flutter/lib/workspace/application/app/app_service.dart b/frontend/appflowy_flutter/lib/workspace/application/app/app_service.dartindex 110c906afb..5cc0e0439c 100644--- a/frontend/appflowy_flutter/lib/workspace/application/app/app_service.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/app/app_service.dart@@ -12,7 +12,7 @@ class AppBackendService {required String appId,required String name,String? desc,- required ViewLayoutTypePB layoutType,+ required ViewLayoutPB layoutType,/// The initial data should be the JSON of the document./// Currently, only support create document with initial data.@@ -90,7 +90,7 @@ class AppBackendService {}Future<List<Tuple2<ViewPB, List<ViewPB>>>> fetchViews(- ViewLayoutTypePB layoutType) async {+ ViewLayoutPB layoutType) async {final result = <Tuple2<ViewPB, List<ViewPB>>>[];return FolderEventReadCurrentWorkspace().send().then((value) async {final workspaces = value.getLeftOrNull<WorkspaceSettingPB>();diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dartindex 29173d7f0f..069cc8e07f 100644--- a/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart@@ -42,13 +42,13 @@ extension ViewExtension on ViewPB {PluginType get pluginType {switch (layout) {- case ViewLayoutTypePB.Board:+ case ViewLayoutPB.Board:return PluginType.board;- case ViewLayoutTypePB.Calendar:+ case ViewLayoutPB.Calendar:return PluginType.calendar;- case ViewLayoutTypePB.Document:+ case ViewLayoutPB.Document:return PluginType.editor;- case ViewLayoutTypePB.Grid:+ case ViewLayoutPB.Grid:return PluginType.grid;}diff --git a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dartindex 533b839fc6..a3e075f84e 100644--- a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart+++ b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart@@ -9,7 +9,7 @@ import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'CreateViewPayloadPB,MoveFolderItemPayloadPB,MoveFolderItemType,- ViewLayoutTypePB,+ ViewLayoutPB,ViewPB;import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart';@@ -26,7 +26,7 @@ class WorkspaceService {..belongToId = workspaceId..name = name..desc = desc ?? ""- ..layout = ViewLayoutTypePB.Document;+ ..layout = ViewLayoutPB.Document;return FolderEventCreateView(payload).send();}diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_screen.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_screen.dartindex 02dce780a9..b35da5cf9a 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_screen.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_screen.dart@@ -261,7 +261,7 @@ class HomeScreenStackAdaptor extends HomeStackDelegate {@overridevoid didDeleteStackWidget(ViewPB view, int? index) {final homeService = HomeService();- homeService.readApp(appId: view.appId).then((result) {+ homeService.readApp(appId: view.parentViewId).then((result) {result.fold((parentView) {final List<ViewPB> views = parentView.belongings;diff --git a/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart b/frontend/appflowy_flutter/test/bloc_test/board_test/util.dartindex 3ffe8cbf5b..da0722bb04 100644--- a/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart+++ b/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart@@ -43,7 +43,7 @@ class AppFlowyBoardTest {view,DatabaseController(view: view,- layoutType: LayoutTypePB.Board,+ layoutType: DatabaseLayoutPB.Board,),);final result = await context._boardDataController.open();diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/create_filter_test.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/create_filter_test.dartindex f6342904c2..cff1390ef2 100644--- a/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/create_filter_test.dart+++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/create_filter_test.dart@@ -53,7 +53,7 @@ void main() {final service = FilterBackendService(viewId: context.gridView.id);final gridController = DatabaseController(view: context.gridView,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,);final gridBloc = GridBloc(view: context.gridView,@@ -77,7 +77,7 @@ void main() {final service = FilterBackendService(viewId: context.gridView.id);final gridController = DatabaseController(view: context.gridView,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,);final gridBloc = GridBloc(view: context.gridView,@@ -121,7 +121,7 @@ void main() {final service = FilterBackendService(viewId: context.gridView.id);final gridController = DatabaseController(view: context.gridView,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,);final gridBloc = GridBloc(view: context.gridView,@@ -143,7 +143,7 @@ void main() {final service = FilterBackendService(viewId: context.gridView.id);final gridController = DatabaseController(view: context.gridView,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,);final gridBloc = GridBloc(view: context.gridView,diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dartindex b7b409f0e5..2d7d9babef 100644--- a/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart+++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart@@ -21,7 +21,7 @@ Future<GridTestContext> createTestFilterGrid(AppFlowyGridTest gridTest) async {view,DatabaseController(view: view,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,));final result = await context.gridController.open();diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/grid_bloc_test.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/grid_bloc_test.dartindex a2ccbbd164..0129955344 100644--- a/frontend/appflowy_flutter/test/bloc_test/grid_test/grid_bloc_test.dart+++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/grid_bloc_test.dart@@ -23,7 +23,7 @@ void main() {view: context.gridView,databaseController: DatabaseController(view: context.gridView,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,))..add(const GridEvent.initial()),act: (bloc) => bloc.add(const GridEvent.createRow()),@@ -39,7 +39,7 @@ void main() {view: context.gridView,databaseController: DatabaseController(view: context.gridView,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,))..add(const GridEvent.initial()),act: (bloc) async {diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dartindex 32a1c4f1ce..79d0736ffd 100644--- a/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart+++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart@@ -178,7 +178,7 @@ class AppFlowyGridTest {view,DatabaseController(view: view,- layoutType: LayoutTypePB.Grid,+ layoutType: DatabaseLayoutPB.Grid,));final result = await context.gridController.open();result.fold((l) => null, (r) => throw Exception(r));diff --git a/frontend/appflowy_flutter/test/bloc_test/home_test/create_page_test.dart b/frontend/appflowy_flutter/test/bloc_test/home_test/create_page_test.dartindex f0862643ce..98a640b6e5 100644--- a/frontend/appflowy_flutter/test/bloc_test/home_test/create_page_test.dart+++ b/frontend/appflowy_flutter/test/bloc_test/home_test/create_page_test.dart@@ -23,7 +23,7 @@ void main() {assert(bloc.state.views.length == 1);assert(bloc.state.views.last.name == "Test document");- assert(bloc.state.views.last.layout == ViewLayoutTypePB.Document);+ assert(bloc.state.views.last.layout == ViewLayoutPB.Document);});test('create a grid', () async {@@ -36,7 +36,7 @@ void main() {assert(bloc.state.views.length == 1);assert(bloc.state.views.last.name == "Test grid");- assert(bloc.state.views.last.layout == ViewLayoutTypePB.Grid);+ assert(bloc.state.views.last.layout == ViewLayoutPB.Grid);});test('create a kanban', () async {@@ -49,7 +49,7 @@ void main() {assert(bloc.state.views.length == 1);assert(bloc.state.views.last.name == "Test board");- assert(bloc.state.views.last.layout == ViewLayoutTypePB.Board);+ assert(bloc.state.views.last.layout == ViewLayoutPB.Board);});test('create a calendar', () async {@@ -62,6 +62,6 @@ void main() {assert(bloc.state.views.length == 1);assert(bloc.state.views.last.name == "Test calendar");- assert(bloc.state.views.last.layout == ViewLayoutTypePB.Calendar);+ assert(bloc.state.views.last.layout == ViewLayoutPB.Calendar);});}diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lockindex 4d56fe6426..93a06be85a 100644--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock@@ -564,7 +564,7 @@ dependencies = [[[package]]name = "collab"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f25ce7f#f25ce7f71ef3f0a2a35260ebdf74d75534bfad45"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab#9b3f895bb6f8e92830acd90cfb68b69aece83095"dependencies = ["anyhow","bytes",@@ -582,7 +582,7 @@ dependencies = [[[package]]name = "collab-derive"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f25ce7f#f25ce7f71ef3f0a2a35260ebdf74d75534bfad45"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab#9b3f895bb6f8e92830acd90cfb68b69aece83095"dependencies = ["proc-macro2","quote",@@ -594,7 +594,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f25ce7f#f25ce7f71ef3f0a2a35260ebdf74d75534bfad45"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab#9b3f895bb6f8e92830acd90cfb68b69aece83095"dependencies = ["anyhow","collab",@@ -612,7 +612,7 @@ dependencies = [[[package]]name = "collab-persistence"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f25ce7f#f25ce7f71ef3f0a2a35260ebdf74d75534bfad45"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab#9b3f895bb6f8e92830acd90cfb68b69aece83095"dependencies = ["bincode","chrono",diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.tomlindex b99aa67948..085164b8fc 100644--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml@@ -33,8 +33,13 @@ default = ["custom-protocol"]custom-protocol = ["tauri/custom-protocol"][patch.crates-io]-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f25ce7f" }-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f25ce7f" }-collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f25ce7f" }+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab" }+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab" }+collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab" }+#collab = { path = "../../AppFlowy-Collab/collab" }+#collab-folder = { path = "../../AppFlowy-Collab/collab-folder" }+#collab-persistence = { path = "../../AppFlowy-Collab/collab-persistence" }++diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.tsindex e7187384fa..e39dc29ec0 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts@@ -5,11 +5,11 @@ import { useAppDispatch } from '$app/stores/store';import loadField from './loadField';import { FieldInfo } from '$app/stores/effects/database/field/field_controller';import { RowInfo } from '$app/stores/effects/database/row/row_cache';-import { ViewLayoutTypePB } from '@/services/backend';+import { ViewLayoutPB } from '@/services/backend';import { DatabaseGroupController } from '$app/stores/effects/database/group/group_controller';import { OnDragEndResponder } from 'react-beautiful-dnd';-export const useDatabase = (viewId: string, type?: ViewLayoutTypePB) => {+export const useDatabase = (viewId: string, type?: ViewLayoutPB) => {const dispatch = useAppDispatch();const [controller, setController] = useState<DatabaseController>();const [rows, setRows] = useState<readonly RowInfo[]>([]);@@ -58,7 +58,7 @@ export const useDatabase = (viewId: string, type?: ViewLayoutTypePB) => {});await controller.open();- if (type === ViewLayoutTypePB.Board) {+ if (type === ViewLayoutPB.Board) {const fieldId = await controller.getGroupByFieldId();setGroupByFieldId(fieldId.unwrap());setGroups(controller.groups.value);diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/board/Board.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/board/Board.tsxindex 7df79ede9a..b4b00d1796 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/board/Board.tsx+++ b/frontend/appflowy_tauri/src/appflowy_app/components/board/Board.tsx@@ -3,17 +3,14 @@ import { SearchInput } from '../_shared/SearchInput';import { BoardBlock } from './BoardBlock';import { NewBoardBlock } from './NewBoardBlock';import { useDatabase } from '../_shared/database-hooks/useDatabase';-import { ViewLayoutTypePB } from '@/services/backend';+import { ViewLayoutPB } from '@/services/backend';import { DragDropContext } from 'react-beautiful-dnd';import { useState } from 'react';import { RowInfo } from '$app/stores/effects/database/row/row_cache';import { EditRow } from '$app/components/_shared/EditRow/EditRow';export const Board = ({ viewId }: { viewId: string }) => {- const { controller, rows, groups, groupByFieldId, onNewRowClick, onDragEnd } = useDatabase(- viewId,- ViewLayoutTypePB.Board- );+ const { controller, rows, groups, groupByFieldId, onNewRowClick, onDragEnd } = useDatabase(viewId, ViewLayoutPB.Board);const [showBoardRow, setShowBoardRow] = useState(false);const [boardRowInfo, setBoardRowInfo] = useState<RowInfo>();diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.tsindex 1d94beaf92..34850a89c3 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts@@ -2,7 +2,7 @@ import { foldersActions, IFolder } from '../../../stores/reducers/folders/slice'import { useEffect, useState } from 'react';import { useAppDispatch, useAppSelector } from '../../../stores/store';import { IPage, pagesActions } from '../../../stores/reducers/pages/slice';-import { AppPB, ViewLayoutTypePB } from '@/services/backend';+import { ViewLayoutPB } from '@/services/backend';import { AppBackendService } from '../../../stores/effects/folder/app/app_bd_svc';import { WorkspaceBackendService } from '../../../stores/effects/folder/workspace/workspace_bd_svc';import { useError } from '../../error/Error.hooks';@@ -42,7 +42,7 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {const views = change.val;const updatedPages: IPage[] = views.items.map((view) => ({id: view.id,- folderId: view.app_id,+ folderId: view.parent_view_id,pageType: view.layout,title: view.name,}));@@ -129,13 +129,13 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {try {const newView = await appBackendService.createView({name: 'New Document 1',- layoutType: ViewLayoutTypePB.Document,+ layoutType: ViewLayoutPB.Document,});appDispatch(pagesActions.addPage({folderId: folder.id,- pageType: ViewLayoutTypePB.Document,+ pageType: ViewLayoutPB.Document,title: newView.name,id: newView.id,})@@ -154,7 +154,7 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {try {const newView = await appBackendService.createView({name: 'New Board 1',- layoutType: ViewLayoutTypePB.Board,+ layoutType: ViewLayoutPB.Board,});setShowPages(true);@@ -162,7 +162,7 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {appDispatch(pagesActions.addPage({folderId: folder.id,- pageType: ViewLayoutTypePB.Board,+ pageType: ViewLayoutPB.Board,title: newView.name,id: newView.id,})@@ -179,7 +179,7 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {try {const newView = await appBackendService.createView({name: 'New Grid 1',- layoutType: ViewLayoutTypePB.Grid,+ layoutType: ViewLayoutPB.Grid,});setShowPages(true);@@ -187,7 +187,7 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {appDispatch(pagesActions.addPage({folderId: folder.id,- pageType: ViewLayoutTypePB.Grid,+ pageType: ViewLayoutPB.Grid,title: newView.name,id: newView.id,})diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/NavigationPanel.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/NavigationPanel.hooks.tsindex d728c1e838..a3ef4c1752 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/NavigationPanel.hooks.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/NavigationPanel.hooks.ts@@ -1,7 +1,7 @@import { useAppSelector } from '../../../stores/store';import { useNavigate } from 'react-router-dom';import { IPage } from '../../../stores/reducers/pages/slice';-import { ViewLayoutTypePB } from '@/services/backend';+import { ViewLayoutPB } from '@/services/backend';import { useState } from 'react';export const useNavigationPanelHooks = function () {@@ -23,12 +23,12 @@ export const useNavigationPanelHooks = function () {const onPageClick = (page: IPage) => {let pageTypeRoute = (() => {switch (page.pageType) {- case ViewLayoutTypePB.Document:+ case ViewLayoutPB.Document:return 'document';break;- case ViewLayoutTypePB.Grid:+ case ViewLayoutPB.Grid:return 'grid';- case ViewLayoutTypePB.Board:+ case ViewLayoutPB.Board:return 'board';default:return 'document';diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.tsxindex b1736c1435..e00f37d0f9 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.tsx+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.tsx@@ -7,7 +7,7 @@ import { IPage } from '../../../stores/reducers/pages/slice';import { Button } from '../../_shared/Button';import { usePageEvents } from './PageItem.hooks';import { RenamePopup } from './RenamePopup';-import { ViewLayoutTypePB } from '@/services/backend';+import { ViewLayoutPB } from '@/services/backend';import { useEffect, useRef, useState } from 'react';import { PAGE_ITEM_HEIGHT } from '../../_shared/constants';@@ -47,9 +47,9 @@ export const PageItem = ({ page, onPageClick }: { page: IPage; onPageClick: () =><button className={'flex min-w-0 flex-1 items-center'}><i className={'ml-1 mr-1 h-[16px] w-[16px]'}>- {page.pageType === ViewLayoutTypePB.Document && <DocumentSvg></DocumentSvg>}- {page.pageType === ViewLayoutTypePB.Board && <BoardSvg></BoardSvg>}- {page.pageType === ViewLayoutTypePB.Grid && <GridSvg></GridSvg>}+ {page.pageType === ViewLayoutPB.Document && <DocumentSvg></DocumentSvg>}+ {page.pageType === ViewLayoutPB.Board && <BoardSvg></BoardSvg>}+ {page.pageType === ViewLayoutPB.Grid && <GridSvg></GridSvg>}</i><span className={'ml-2 min-w-0 flex-1 overflow-hidden overflow-ellipsis whitespace-nowrap text-left'}>{page.title}diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.tsindex 548ff6816b..6930e7c0e1 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts@@ -1,7 +1,7 @@import {FieldType,SingleSelectTypeOptionPB,- ViewLayoutTypePB,+ ViewLayoutPB,ViewPB,WorkspaceSettingPB,} from '../../../services/backend';@@ -29,7 +29,7 @@ import { SelectOptionBackendService } from '../../stores/effects/database/cell/s// Create a database view for specific layout type// Do not use it production code. Just for testing-export async function createTestDatabaseView(layout: ViewLayoutTypePB): Promise<ViewPB> {+export async function createTestDatabaseView(layout: ViewLayoutPB): Promise<ViewPB> {const workspaceSetting: WorkspaceSettingPB = await FolderEventReadCurrentWorkspace().then((result) => result.unwrap());const app = workspaceSetting.workspace.views[0];const appService = new AppBackendService(app.id);diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DocumentTestHelper.ts b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DocumentTestHelper.tsindex 67ababa3b5..4656d06577 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DocumentTestHelper.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DocumentTestHelper.ts@@ -1,4 +1,4 @@-import { ViewLayoutTypePB, WorkspaceSettingPB } from '@/services/backend';+import { ViewLayoutPB, WorkspaceSettingPB } from '@/services/backend';import { FolderEventReadCurrentWorkspace } from '@/services/backend/events/flowy-folder2';import { AppBackendService } from '$app/stores/effects/folder/app/app_bd_svc';@@ -6,5 +6,5 @@ export async function createTestDocument() {const workspaceSetting: WorkspaceSettingPB = await FolderEventReadCurrentWorkspace().then((result) => result.unwrap());const app = workspaceSetting.workspace.views[0];const appService = new AppBackendService(app.id);- return await appService.createView({ name: 'New Document', layoutType: ViewLayoutTypePB.Document });+ return await appService.createView({ name: 'New Document', layoutType: ViewLayoutPB.Document });}diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGrid.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGrid.tsxindex 1a3925c82c..e44d334861 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGrid.tsx+++ b/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGrid.tsx@@ -1,11 +1,5 @@import React from 'react';-import {- FieldType,- NumberFormat,- NumberTypeOptionPB,- SelectOptionCellDataPB,- ViewLayoutTypePB,-} from '@/services/backend';+import { FieldType, NumberFormat, NumberTypeOptionPB, SelectOptionCellDataPB, ViewLayoutPB } from '@/services/backend';import { Log } from '$app/utils/log';import {assert,@@ -60,7 +54,7 @@ export const RunAllGridTests = () => {};async function createBuildInGrid() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);databaseController.subscribe({onViewChanged: (databasePB) => {@@ -82,7 +76,7 @@ async function createBuildInGrid() {}async function testEditGridCell() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -95,7 +89,7 @@ async function testEditGridCell() {}async function testEditTextCell() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -117,7 +111,7 @@ async function testEditTextCell() {}async function testEditURLCell() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -144,7 +138,7 @@ async function testEditURLCell() {}async function testEditDateCell() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -169,7 +163,7 @@ async function testEditDateCell() {}async function testCheckboxCell() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -195,7 +189,7 @@ async function testCheckboxCell() {}async function testCreateRow() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());await assertNumberOfRows(view.id, 3);@@ -207,7 +201,7 @@ async function testCreateRow() {}async function testDeleteRow() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -226,7 +220,7 @@ async function testDeleteRow() {}async function testCreateOptionInCell() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());for (const [index, row] of databaseController.databaseViewCache.rowInfos.entries()) {@@ -253,7 +247,7 @@ async function testCreateOptionInCell() {}async function testMoveField() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -271,7 +265,7 @@ async function testMoveField() {}async function testGetSingleSelectFieldData() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -296,7 +290,7 @@ async function testGetSingleSelectFieldData() {}async function testSwitchFromSingleSelectToNumber() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -322,7 +316,7 @@ async function testSwitchFromSingleSelectToNumber() {}async function testSwitchFromMultiSelectToRichText() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -372,7 +366,7 @@ async function testSwitchFromMultiSelectToRichText() {}async function testEditField() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());const fieldInfos = databaseController.fieldController.fieldInfos;@@ -390,7 +384,7 @@ async function testEditField() {}async function testCreateNewField() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());await assertNumberOfFields(view.id, 3);@@ -403,7 +397,7 @@ async function testCreateNewField() {}async function testDeleteField() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Grid);+ const view = await createTestDatabaseView(ViewLayoutPB.Grid);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGroup.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGroup.tsxindex bbcf7a860c..b612d9ab9c 100644--- a/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGroup.tsx+++ b/frontend/appflowy_tauri/src/appflowy_app/components/tests/TestGroup.tsx@@ -5,7 +5,7 @@ import {createTestDatabaseView,openTestDatabase,} from './DatabaseTestHelper';-import { FieldType, ViewLayoutTypePB } from '../../../services/backend';+import { FieldType, ViewLayoutPB } from '../../../services/backend';import React from 'react';export const TestAllKanbanTests = () => {@@ -29,7 +29,7 @@ export const TestAllKanbanTests = () => {};async function createBuildInBoard() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Board);+ const view = await createTestDatabaseView(ViewLayoutPB.Board);const databaseController = await openTestDatabase(view.id);databaseController.subscribe({onGroupByField: (groups) => {@@ -49,7 +49,7 @@ async function createBuildInBoard() {}async function createKanbanBoardRow() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Board);+ const view = await createTestDatabaseView(ViewLayoutPB.Board);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -62,7 +62,7 @@ async function createKanbanBoardRow() {}async function moveKanbanBoardRow() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Board);+ const view = await createTestDatabaseView(ViewLayoutPB.Board);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -113,7 +113,7 @@ async function moveKanbanBoardRow() {}async function createKanbanBoardColumn() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Board);+ const view = await createTestDatabaseView(ViewLayoutPB.Board);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());@@ -128,7 +128,7 @@ async function createKanbanBoardColumn() {}async function createColumnInBoard() {- const view = await createTestDatabaseView(ViewLayoutTypePB.Board);+ const view = await createTestDatabaseView(ViewLayoutPB.Board);const databaseController = await openTestDatabase(view.id);await databaseController.open().then((result) => result.unwrap());diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/app/app_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/app/app_bd_svc.tsindex 53cd18680b..57cabe7705 100644--- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/app/app_bd_svc.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/app/app_bd_svc.ts@@ -4,7 +4,7 @@ import {FolderEventMoveItem,FolderEventReadView,FolderEventUpdateView,- ViewLayoutTypePB,+ ViewLayoutPB,} from '@/services/backend/events/flowy-folder2';import {CreateViewPayloadPB,@@ -29,7 +29,7 @@ export class AppBackendService {createView = async (params: {name: string;desc?: string;- layoutType: ViewLayoutTypePB;+ layoutType: ViewLayoutPB;/// The initial data should be the JSON of the document/// For example: {"document":{"type":"editor","children":[]}}initialData?: string;diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/app/app_observer.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/app/app_observer.tsindex d46ffdef6f..a2c430d92f 100644--- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/app/app_observer.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/app/app_observer.ts@@ -1,5 +1,5 @@import { Ok, Result } from 'ts-results';-import { AppPB, FlowyError, FolderNotification, RepeatedViewPB } from '@/services/backend';+import { FlowyError, FolderNotification, RepeatedViewPB } from '@/services/backend';import { ChangeNotifier } from '$app/utils/change_notifier';import { FolderNotificationObserver } from '../notifications/observer';diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/workspace/workspace_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/workspace/workspace_bd_svc.tsindex 8dcfce6930..c92169ade7 100644--- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/workspace/workspace_bd_svc.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/workspace/workspace_bd_svc.ts@@ -9,7 +9,7 @@ import {CreateViewPayloadPB,FlowyError,MoveFolderItemPayloadPB,- ViewLayoutTypePB,+ ViewLayoutPB,WorkspaceIdPB,} from '@/services/backend';import assert from 'assert';@@ -22,7 +22,7 @@ export class WorkspaceBackendService {belong_to_id: this.workspaceId,name: params.name,desc: params.desc || '',- layout: ViewLayoutTypePB.Document,+ layout: ViewLayoutPB.Document,});const result = await FolderEventCreateView(payload);diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/workspace/workspace_observer.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/workspace/workspace_observer.tsindex e668fa06a1..7fd72c6622 100644--- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/workspace/workspace_observer.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/folder/workspace/workspace_observer.ts@@ -1,13 +1,5 @@import { Ok, Result } from 'ts-results';-import {- AppPB,- FolderNotification,- RepeatedAppPB,- WorkspacePB,- FlowyError,- RepeatedViewPB,- ViewPB,-} from '@/services/backend';+import { FolderNotification, WorkspacePB, FlowyError, RepeatedViewPB, ViewPB } from '@/services/backend';import { ChangeNotifier } from '$app/utils/change_notifier';import { FolderNotificationObserver } from '../notifications/observer';diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/pages/slice.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/pages/slice.tsindex 804038444f..7ad447601c 100644--- a/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/pages/slice.ts+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/pages/slice.ts@@ -1,10 +1,10 @@import { createSlice, PayloadAction } from '@reduxjs/toolkit';-import { ViewLayoutTypePB } from '@/services/backend';+import { ViewLayoutPB } from '@/services/backend';export interface IPage {id: string;title: string;- pageType: ViewLayoutTypePB;+ pageType: ViewLayoutPB;folderId: string;}diff --git a/frontend/rust-lib/.gitignore b/frontend/rust-lib/.gitignoreindex 264aad238c..740f8d77a7 100644--- a/frontend/rust-lib/.gitignore+++ b/frontend/rust-lib/.gitignore@@ -12,4 +12,5 @@bin/**/src/protobuf**/resources/proto-.idea/\ No newline at end of file+.idea/+AppFlowy-Collab/\ No newline at end of filediff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex 3127146c89..a61256f6b9 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -491,7 +491,7 @@ dependencies = [[[package]]name = "collab"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f25ce7f#f25ce7f71ef3f0a2a35260ebdf74d75534bfad45"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab#306f27e56481eb2a998da4cb9f13763699dade76"dependencies = ["anyhow","bytes",@@ -509,7 +509,7 @@ dependencies = [[[package]]name = "collab-derive"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f25ce7f#f25ce7f71ef3f0a2a35260ebdf74d75534bfad45"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab#306f27e56481eb2a998da4cb9f13763699dade76"dependencies = ["proc-macro2","quote",@@ -521,7 +521,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f25ce7f#f25ce7f71ef3f0a2a35260ebdf74d75534bfad45"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab#306f27e56481eb2a998da4cb9f13763699dade76"dependencies = ["anyhow","collab",@@ -539,7 +539,7 @@ dependencies = [[[package]]name = "collab-persistence"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f25ce7f#f25ce7f71ef3f0a2a35260ebdf74d75534bfad45"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab#306f27e56481eb2a998da4cb9f13763699dade76"dependencies = ["bincode","chrono",diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex a941760c75..a7e271a950 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -8,7 +8,7 @@ members = ["flowy-user","flowy-test","flowy-sqlite",-# "flowy-folder",+# "flowy-folder",r"flowy-folder2","flowy-notification","flowy-document",@@ -37,8 +37,10 @@ opt-level = 3## the amount of IO and the size of ./target, which make caching less effective.incremental = false-[patch.crates-io]-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f25ce7f" }-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f25ce7f" }-collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f25ce7f" }+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab" }+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab" }+collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab" }+#collab = { path = "../AppFlowy-Collab/collab" }+#collab-folder = { path = "../AppFlowy-Collab/collab-folder" }+#collab-persistence = { path = "../AppFlowy-Collab/collab-persistence" }diff --git a/frontend/rust-lib/flowy-core/Cargo.toml b/frontend/rust-lib/flowy-core/Cargo.tomlindex 608b145b2a..98903e60f6 100644--- a/frontend/rust-lib/flowy-core/Cargo.toml+++ b/frontend/rust-lib/flowy-core/Cargo.toml@@ -46,7 +46,7 @@ use_bunyan = ["lib-log/use_bunyan"]dart = ["flowy-user/dart","flowy-net/dart",- "flowy-folder/dart",+# "flowy-folder/dart","flowy-folder2/dart","flowy-database/dart","flowy-document/dart",@@ -54,7 +54,7 @@ dart = [ts = ["flowy-user/ts","flowy-net/ts",- "flowy-folder/ts",+# "flowy-folder/ts","flowy-folder2/ts","flowy-database/ts","flowy-document/ts",diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/folder2_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/folder2_deps.rsindex e8d61e932a..c33d990730 100644--- a/frontend/rust-lib/flowy-core/src/deps_resolve/folder2_deps.rs+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/folder2_deps.rs@@ -1,13 +1,14 @@use bytes::Bytes;use collab_persistence::CollabKV;use database_model::BuildDatabaseContext;-use flowy_database::entities::LayoutTypePB;+use flowy_database::entities::DatabaseLayoutPB;use flowy_database::manager::{create_new_database, link_existing_database, DatabaseManager};use flowy_database::util::{make_default_board, make_default_calendar, make_default_grid};use flowy_document::editor::make_transaction_from_document_content;use flowy_document::DocumentManager;use flowy_error::FlowyError;+use flowy_folder2::entities::ViewLayoutPB;use flowy_folder2::manager::{Folder2Manager, FolderUser};use flowy_folder2::view_ext::{ViewDataProcessor, ViewDataProcessorMap};use flowy_folder2::ViewLayout;@@ -183,9 +184,9 @@ impl ViewDataProcessor for DatabaseViewDataProcessor {match DatabaseExtParams::from_map(ext).map(|params| params.database_id) {None => {let (build_context, layout) = match layout {- ViewLayout::Grid => (make_default_grid(), LayoutTypePB::Grid),- ViewLayout::Board => (make_default_board(), LayoutTypePB::Board),- ViewLayout::Calendar => (make_default_calendar(), LayoutTypePB::Calendar),+ ViewLayout::Grid => (make_default_grid(), DatabaseLayoutPB::Grid),+ ViewLayout::Board => (make_default_board(), DatabaseLayoutPB::Board),+ ViewLayout::Calendar => (make_default_calendar(), DatabaseLayoutPB::Calendar),ViewLayout::Document => {return FutureResult::new(async move {Err(FlowyError::internal().context(format!("Can't handle {:?} layout type", layout)))@@ -197,7 +198,7 @@ impl ViewDataProcessor for DatabaseViewDataProcessor {})},Some(database_id) => {- let layout = layout_type_from_view_layout(layout);+ let layout = layout_type_from_view_layout(layout.into());FutureResult::new(async move {link_existing_database(&view_id, name, &database_id, layout, database_manager).await})@@ -220,7 +221,7 @@ impl ViewDataProcessor for DatabaseViewDataProcessor {) -> FutureResult<(), FlowyError> {let view_id = view_id.to_string();let database_manager = self.0.clone();- let layout = layout_type_from_view_layout(layout);+ let layout = layout_type_from_view_layout(layout.into());let name = name.to_string();match DatabaseExtParams::from_map(ext).map(|params| params.database_id) {None => FutureResult::new(async move {@@ -248,11 +249,11 @@ impl DatabaseExtParams {}}-pub fn layout_type_from_view_layout(layout: ViewLayout) -> LayoutTypePB {+pub fn layout_type_from_view_layout(layout: ViewLayoutPB) -> DatabaseLayoutPB {match layout {- ViewLayout::Grid => LayoutTypePB::Grid,- ViewLayout::Board => LayoutTypePB::Board,- ViewLayout::Calendar => LayoutTypePB::Calendar,- ViewLayout::Document => LayoutTypePB::Grid,+ ViewLayoutPB::Grid => DatabaseLayoutPB::Grid,+ ViewLayoutPB::Board => DatabaseLayoutPB::Board,+ ViewLayoutPB::Calendar => DatabaseLayoutPB::Calendar,+ ViewLayoutPB::Document => DatabaseLayoutPB::Grid,}}diff --git a/frontend/rust-lib/flowy-core/src/lib.rs b/frontend/rust-lib/flowy-core/src/lib.rsindex f614315b33..7539f87826 100644--- a/frontend/rust-lib/flowy-core/src/lib.rs+++ b/frontend/rust-lib/flowy-core/src/lib.rs@@ -3,7 +3,7 @@ pub mod module;use crate::deps_resolve::*;use flowy_client_ws::{listen_on_websocket, FlowyWebSocketConnect, NetworkType};-use flowy_database::entities::LayoutTypePB;+use flowy_database::entities::DatabaseLayoutPB;use flowy_database::manager::DatabaseManager;use flowy_document::entities::DocumentVersionPB;use flowy_document::{DocumentConfig, DocumentManager};@@ -320,7 +320,7 @@ impl UserStatusListener {layout_type_from_view_layout(view.layout),)})- .collect::<Vec<(String, String, LayoutTypePB)>>()+ .collect::<Vec<(String, String, DatabaseLayoutPB)>>()});self.database_managerdiff --git a/frontend/rust-lib/flowy-database/src/entities/database_entities.rs b/frontend/rust-lib/flowy-database/src/entities/database_entities.rsindex 998b1db9b0..59026ebaee 100644--- a/frontend/rust-lib/flowy-database/src/entities/database_entities.rs+++ b/frontend/rust-lib/flowy-database/src/entities/database_entities.rs@@ -1,5 +1,5 @@use crate::entities::parser::NotEmptyStr;-use crate::entities::{FieldIdPB, LayoutTypePB, RowPB};+use crate::entities::{DatabaseLayoutPB, FieldIdPB, RowPB};use flowy_derive::ProtoBuf;use flowy_error::ErrorCode;@@ -201,5 +201,5 @@ pub struct DatabaseLayoutIdPB {pub view_id: String,#[pb(index = 2)]- pub layout: LayoutTypePB,+ pub layout: DatabaseLayoutPB,}diff --git a/frontend/rust-lib/flowy-database/src/entities/setting_entities.rs b/frontend/rust-lib/flowy-database/src/entities/setting_entities.rsindex 49c4edbcbf..78ffd0e82f 100644--- a/frontend/rust-lib/flowy-database/src/entities/setting_entities.rs+++ b/frontend/rust-lib/flowy-database/src/entities/setting_entities.rs@@ -15,7 +15,7 @@ use strum_macros::EnumIter;#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]pub struct DatabaseViewSettingPB {#[pb(index = 1)]- pub current_layout: LayoutTypePB,+ pub current_layout: DatabaseLayoutPB,#[pb(index = 2)]pub layout_setting: LayoutSettingPB,@@ -32,34 +32,34 @@ pub struct DatabaseViewSettingPB {#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum, EnumIter)]#[repr(u8)]-pub enum LayoutTypePB {+pub enum DatabaseLayoutPB {Grid = 0,Board = 1,Calendar = 2,}-impl std::default::Default for LayoutTypePB {+impl std::default::Default for DatabaseLayoutPB {fn default() -> Self {- LayoutTypePB::Grid+ DatabaseLayoutPB::Grid}}-impl std::convert::From<LayoutRevision> for LayoutTypePB {+impl std::convert::From<LayoutRevision> for DatabaseLayoutPB {fn from(rev: LayoutRevision) -> Self {match rev {- LayoutRevision::Grid => LayoutTypePB::Grid,- LayoutRevision::Board => LayoutTypePB::Board,- LayoutRevision::Calendar => LayoutTypePB::Calendar,+ LayoutRevision::Grid => DatabaseLayoutPB::Grid,+ LayoutRevision::Board => DatabaseLayoutPB::Board,+ LayoutRevision::Calendar => DatabaseLayoutPB::Calendar,}}}-impl std::convert::From<LayoutTypePB> for LayoutRevision {- fn from(layout: LayoutTypePB) -> Self {+impl std::convert::From<DatabaseLayoutPB> for LayoutRevision {+ fn from(layout: DatabaseLayoutPB) -> Self {match layout {- LayoutTypePB::Grid => LayoutRevision::Grid,- LayoutTypePB::Board => LayoutRevision::Board,- LayoutTypePB::Calendar => LayoutRevision::Calendar,+ DatabaseLayoutPB::Grid => LayoutRevision::Grid,+ DatabaseLayoutPB::Board => LayoutRevision::Board,+ DatabaseLayoutPB::Calendar => LayoutRevision::Calendar,}}}@@ -70,7 +70,7 @@ pub struct DatabaseSettingChangesetPB {pub view_id: String,#[pb(index = 2)]- pub layout_type: LayoutTypePB,+ pub layout_type: DatabaseLayoutPB,#[pb(index = 3, one_of)]pub alter_filter: Option<AlterFilterPayloadPB>,diff --git a/frontend/rust-lib/flowy-database/src/manager.rs b/frontend/rust-lib/flowy-database/src/manager.rsindex 860f748fbb..c93e963fd5 100644--- a/frontend/rust-lib/flowy-database/src/manager.rs+++ b/frontend/rust-lib/flowy-database/src/manager.rs@@ -1,4 +1,4 @@-use crate::entities::LayoutTypePB;+use crate::entities::DatabaseLayoutPB;use crate::services::database::{make_database_block_rev_manager, DatabaseEditor, DatabaseRefIndexerQuery,DatabaseRevisionCloudService, DatabaseRevisionMergeable, DatabaseRevisionSerde,@@ -83,7 +83,7 @@ impl DatabaseManager {&self,user_id: i64,_token: &str,- get_views_fn: Fut<Vec<(String, String, LayoutTypePB)>>,+ get_views_fn: Fut<Vec<(String, String, DatabaseLayoutPB)>>,) -> FlowyResult<()> {self.migration.run(user_id, get_views_fn).await?;Ok(())@@ -327,7 +327,7 @@ pub async fn link_existing_database(view_id: &str,name: String,database_id: &str,- layout: LayoutTypePB,+ layout: DatabaseLayoutPB,database_manager: Arc<DatabaseManager>,) -> FlowyResult<()> {tracing::trace!(@@ -358,7 +358,7 @@ pub async fn link_existing_database(pub async fn create_new_database(view_id: &str,name: String,- layout: LayoutTypePB,+ layout: DatabaseLayoutPB,database_manager: Arc<DatabaseManager>,build_context: BuildDatabaseContext,) -> FlowyResult<()> {diff --git a/frontend/rust-lib/flowy-database/src/services/persistence/migration/mod.rs b/frontend/rust-lib/flowy-database/src/services/persistence/migration/mod.rsindex b0719c928c..aba2449d83 100644--- a/frontend/rust-lib/flowy-database/src/services/persistence/migration/mod.rs+++ b/frontend/rust-lib/flowy-database/src/services/persistence/migration/mod.rs@@ -1,6 +1,6 @@mod database_migration;mod database_view_migration;-use crate::entities::LayoutTypePB;+use crate::entities::DatabaseLayoutPB;use crate::manager::DatabaseUser;use crate::services::persistence::database_ref::DatabaseRefs;use crate::services::persistence::migration::database_migration::{@@ -31,7 +31,7 @@ impl DatabaseMigration {pub async fn run(&self,user_id: i64,- get_views_fn: Fut<Vec<(String, String, LayoutTypePB)>>,+ get_views_fn: Fut<Vec<(String, String, DatabaseLayoutPB)>>,) -> FlowyResult<()> {let pool = self.user.db_pool()?;diff --git a/frontend/rust-lib/flowy-database/src/services/setting/setting_builder.rs b/frontend/rust-lib/flowy-database/src/services/setting/setting_builder.rsindex bec5e44fc9..1b5ba1d4d1 100644--- a/frontend/rust-lib/flowy-database/src/services/setting/setting_builder.rs+++ b/frontend/rust-lib/flowy-database/src/services/setting/setting_builder.rs@@ -1,5 +1,5 @@use crate::entities::{- AlterFilterParams, DatabaseSettingChangesetParams, DeleteFilterParams, LayoutTypePB,+ AlterFilterParams, DatabaseLayoutPB, DatabaseSettingChangesetParams, DeleteFilterParams,};pub struct GridSettingChangesetBuilder {@@ -7,7 +7,7 @@ pub struct GridSettingChangesetBuilder {}impl GridSettingChangesetBuilder {- pub fn new(grid_id: &str, layout_type: &LayoutTypePB) -> Self {+ pub fn new(grid_id: &str, layout_type: &DatabaseLayoutPB) -> Self {let params = DatabaseSettingChangesetParams {view_id: grid_id.to_string(),layout_type: layout_type.clone().into(),diff --git a/frontend/rust-lib/flowy-database/tests/database/database_editor.rs b/frontend/rust-lib/flowy-database/tests/database/database_editor.rsindex ff0ebf925e..90b0dcbf4d 100644--- a/frontend/rust-lib/flowy-database/tests/database/database_editor.rs+++ b/frontend/rust-lib/flowy-database/tests/database/database_editor.rs@@ -26,32 +26,32 @@ pub struct DatabaseEditorTest {impl DatabaseEditorTest {pub async fn new_grid() -> Self {- Self::new(LayoutTypePB::Grid).await+ Self::new(DatabaseLayoutPB::Grid).await}pub async fn new_board() -> Self {- Self::new(LayoutTypePB::Board).await+ Self::new(DatabaseLayoutPB::Board).await}pub async fn new_calendar() -> Self {- Self::new(LayoutTypePB::Calendar).await+ Self::new(DatabaseLayoutPB::Calendar).await}- pub async fn new(layout: LayoutTypePB) -> Self {+ pub async fn new(layout: DatabaseLayoutPB) -> Self {let sdk = FlowySDKTest::default();let _ = sdk.init_user().await;let test = match layout {- LayoutTypePB::Grid => {+ DatabaseLayoutPB::Grid => {let build_context = make_test_grid();let view_data: Bytes = build_context.into();ViewTest::new_grid_view(&sdk, view_data.to_vec()).await},- LayoutTypePB::Board => {+ DatabaseLayoutPB::Board => {let build_context = make_test_board();let view_data: Bytes = build_context.into();ViewTest::new_board_view(&sdk, view_data.to_vec()).await},- LayoutTypePB::Calendar => {+ DatabaseLayoutPB::Calendar => {let build_context = make_test_calendar();let view_data: Bytes = build_context.into();ViewTest::new_calendar_view(&sdk, view_data.to_vec()).awaitdiff --git a/frontend/rust-lib/flowy-database/tests/database/filter_test/script.rs b/frontend/rust-lib/flowy-database/tests/database/filter_test/script.rsindex e4a0e566e0..a66751c29f 100644--- a/frontend/rust-lib/flowy-database/tests/database/filter_test/script.rs+++ b/frontend/rust-lib/flowy-database/tests/database/filter_test/script.rs@@ -7,7 +7,7 @@ use std::time::Duration;use bytes::Bytes;use futures::TryFutureExt;use tokio::sync::broadcast::Receiver;-use flowy_database::entities::{AlterFilterParams, AlterFilterPayloadPB, DeleteFilterParams, LayoutTypePB, DatabaseSettingChangesetParams, DatabaseViewSettingPB, RowPB, TextFilterConditionPB, FieldType, NumberFilterConditionPB, CheckboxFilterConditionPB, DateFilterConditionPB, DateFilterContentPB, SelectOptionConditionPB, TextFilterPB, NumberFilterPB, CheckboxFilterPB, DateFilterPB, SelectOptionFilterPB, CellChangesetPB, FilterPB, ChecklistFilterConditionPB, ChecklistFilterPB};+use flowy_database::entities::{AlterFilterParams, AlterFilterPayloadPB, DeleteFilterParams, DatabaseLayoutPB, DatabaseSettingChangesetParams, DatabaseViewSettingPB, RowPB, TextFilterConditionPB, FieldType, NumberFilterConditionPB, CheckboxFilterConditionPB, DateFilterConditionPB, DateFilterContentPB, SelectOptionConditionPB, TextFilterPB, NumberFilterPB, CheckboxFilterPB, DateFilterPB, SelectOptionFilterPB, CellChangesetPB, FilterPB, ChecklistFilterConditionPB, ChecklistFilterPB};use flowy_database::services::field::{SelectOptionCellChangeset, SelectOptionIds};use flowy_database::services::setting::GridSettingChangesetBuilder;use database_model::{FieldRevision, FieldTypeRevision};diff --git a/frontend/rust-lib/flowy-folder2/src/entities/app.rs b/frontend/rust-lib/flowy-folder2/src/entities/app.rsdeleted file mode 100644index ffff29eab4..0000000000--- a/frontend/rust-lib/flowy-folder2/src/entities/app.rs+++ /dev/null@@ -1,183 +0,0 @@-use crate::entities::parser::app::{AppColorStyle, AppIdentify, AppName};-use crate::entities::parser::workspace::WorkspaceIdentify;-use crate::entities::RepeatedViewPB;--use flowy_derive::ProtoBuf;-use flowy_error::ErrorCode;-use std::convert::TryInto;--#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]-pub struct AppPB {- #[pb(index = 1)]- pub id: String,-- #[pb(index = 2)]- pub workspace_id: String,-- #[pb(index = 3)]- pub name: String,-- #[pb(index = 4)]- pub belongings: RepeatedViewPB,-- #[pb(index = 5)]- pub create_time: i64,-}--#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)]-pub struct RepeatedAppPB {- #[pb(index = 1)]- pub items: Vec<AppPB>,-}--#[derive(ProtoBuf, Default)]-pub struct CreateAppPayloadPB {- #[pb(index = 1)]- pub workspace_id: String,-- #[pb(index = 2)]- pub name: String,-- #[pb(index = 3)]- pub desc: String,-- #[pb(index = 4)]- pub color_style: ColorStylePB,-}--#[derive(ProtoBuf, Default, Debug, Clone)]-pub struct ColorStylePB {- #[pb(index = 1)]- pub theme_color: String,-}--#[derive(Debug)]-pub struct CreateAppParams {- pub workspace_id: String,- pub name: String,- pub desc: String,- pub color_style: ColorStylePB,-}--impl TryInto<CreateAppParams> for CreateAppPayloadPB {- type Error = ErrorCode;-- fn try_into(self) -> Result<CreateAppParams, Self::Error> {- let name = AppName::parse(self.name)?;- let id = WorkspaceIdentify::parse(self.workspace_id)?;- let color_style = AppColorStyle::parse(self.color_style.theme_color.clone())?;-- Ok(CreateAppParams {- workspace_id: id.0,- name: name.0,- desc: self.desc,- color_style: color_style.into(),- })- }-}--impl std::convert::From<AppColorStyle> for ColorStylePB {- fn from(data: AppColorStyle) -> Self {- ColorStylePB {- theme_color: data.theme_color,- }- }-}--#[derive(ProtoBuf, Default, Clone, Debug)]-pub struct AppIdPB {- #[pb(index = 1)]- pub value: String,-}--impl AppIdPB {- pub fn new(app_id: &str) -> Self {- Self {- value: app_id.to_string(),- }- }-}--#[derive(ProtoBuf, Default)]-pub struct UpdateAppPayloadPB {- #[pb(index = 1)]- pub app_id: String,-- #[pb(index = 2, one_of)]- pub name: Option<String>,-- #[pb(index = 3, one_of)]- pub desc: Option<String>,-- #[pb(index = 4, one_of)]- pub color_style: Option<ColorStylePB>,-- #[pb(index = 5, one_of)]- pub is_trash: Option<bool>,-}--#[derive(Debug, Clone)]-pub struct UpdateAppParams {- pub app_id: String,-- pub name: Option<String>,-- pub desc: Option<String>,-- pub color_style: Option<ColorStylePB>,-- pub is_trash: Option<bool>,-}--impl UpdateAppParams {- pub fn new(app_id: &str) -> Self {- Self {- app_id: app_id.to_string(),- name: None,- desc: None,- color_style: None,- is_trash: None,- }- }-- pub fn name(mut self, name: &str) -> Self {- self.name = Some(name.to_string());- self- }-- pub fn desc(mut self, desc: &str) -> Self {- self.desc = Some(desc.to_string());- self- }-- pub fn trash(mut self) -> Self {- self.is_trash = Some(true);- self- }-}--impl TryInto<UpdateAppParams> for UpdateAppPayloadPB {- type Error = ErrorCode;-- fn try_into(self) -> Result<UpdateAppParams, Self::Error> {- let app_id = AppIdentify::parse(self.app_id)?.0;-- let name = match self.name {- None => None,- Some(name) => Some(AppName::parse(name)?.0),- };-- let color_style = match self.color_style {- None => None,- Some(color_style) => Some(AppColorStyle::parse(color_style.theme_color)?.into()),- };-- Ok(UpdateAppParams {- app_id,- name,- desc: self.desc,- color_style,- is_trash: self.is_trash,- })- }-}diff --git a/frontend/rust-lib/flowy-folder2/src/entities/mod.rs b/frontend/rust-lib/flowy-folder2/src/entities/mod.rsindex d5370f0786..a596bf648c 100644--- a/frontend/rust-lib/flowy-folder2/src/entities/mod.rs+++ b/frontend/rust-lib/flowy-folder2/src/entities/mod.rs@@ -1,10 +1,8 @@-pub mod app;mod parser;pub mod trash;pub mod view;pub mod workspace;-pub use app::*;pub use trash::*;pub use view::*;pub use workspace::*;diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_color_style.rs b/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_color_style.rsdeleted file mode 100644index b98b809f3d..0000000000--- a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_color_style.rs+++ /dev/null@@ -1,13 +0,0 @@-use flowy_error::ErrorCode;--#[derive(Debug)]-pub struct AppColorStyle {- pub theme_color: String,-}--impl AppColorStyle {- pub fn parse(theme_color: String) -> Result<AppColorStyle, ErrorCode> {- // TODO: verify the color style format- Ok(AppColorStyle { theme_color })- }-}diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_desc.rs b/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_desc.rsdeleted file mode 100644index 24cc2dcab8..0000000000--- a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_desc.rs+++ /dev/null@@ -1,20 +0,0 @@-use unicode_segmentation::UnicodeSegmentation;-#[derive(Debug)]-pub struct AppDesc(pub String);--impl AppDesc {- #[allow(dead_code)]- pub fn parse(s: String) -> Result<AppDesc, String> {- if s.graphemes(true).count() > 1024 {- return Err("Workspace description too long".to_string());- }-- Ok(Self(s))- }-}--impl AsRef<str> for AppDesc {- fn as_ref(&self) -> &str {- &self.0- }-}diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_id.rs b/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_id.rsdeleted file mode 100644index 2311001089..0000000000--- a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_id.rs+++ /dev/null@@ -1,20 +0,0 @@-use flowy_error::ErrorCode;--#[derive(Debug)]-pub struct AppIdentify(pub String);--impl AppIdentify {- pub fn parse(s: String) -> Result<AppIdentify, ErrorCode> {- if s.trim().is_empty() {- return Err(ErrorCode::AppIdInvalid);- }-- Ok(Self(s))- }-}--impl AsRef<str> for AppIdentify {- fn as_ref(&self) -> &str {- &self.0- }-}diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_name.rs b/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_name.rsdeleted file mode 100644index f14670c650..0000000000--- a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/app_name.rs+++ /dev/null@@ -1,20 +0,0 @@-use flowy_error::ErrorCode;--#[derive(Debug)]-pub struct AppName(pub String);--impl AppName {- pub fn parse(s: String) -> Result<AppName, ErrorCode> {- if s.trim().is_empty() {- return Err(ErrorCode::AppNameInvalid);- }-- Ok(Self(s))- }-}--impl AsRef<str> for AppName {- fn as_ref(&self) -> &str {- &self.0- }-}diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/mod.rs b/frontend/rust-lib/flowy-folder2/src/entities/parser/app/mod.rsdeleted file mode 100644index fcf6f4bd3f..0000000000--- a/frontend/rust-lib/flowy-folder2/src/entities/parser/app/mod.rs+++ /dev/null@@ -1,9 +0,0 @@-mod app_color_style;-mod app_desc;-mod app_id;-mod app_name;--pub use app_color_style::*;-pub use app_desc::*;-pub use app_id::*;-pub use app_name::*;diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/mod.rs b/frontend/rust-lib/flowy-folder2/src/entities/parser/mod.rsindex 3ee0f4b591..7b8d7cc9d5 100644--- a/frontend/rust-lib/flowy-folder2/src/entities/parser/mod.rs+++ b/frontend/rust-lib/flowy-folder2/src/entities/parser/mod.rs@@ -1,4 +1,4 @@-pub mod app;+// pub mod app;pub mod trash;pub mod view;pub mod workspace;diff --git a/frontend/rust-lib/flowy-folder2/src/entities/view.rs b/frontend/rust-lib/flowy-folder2/src/entities/view.rsindex f952fd65e5..e20827f7a1 100644--- a/frontend/rust-lib/flowy-folder2/src/entities/view.rs+++ b/frontend/rust-lib/flowy-folder2/src/entities/view.rs@@ -1,7 +1,4 @@-use crate::entities::parser::{- app::AppIdentify,- view::{ViewDesc, ViewIdentify, ViewName, ViewThumbnail},-};+use crate::entities::parser::view::{ViewDesc, ViewIdentify, ViewName, ViewThumbnail};use crate::view_ext::gen_view_id;use collab_folder::core::{View, ViewLayout};use flowy_derive::{ProtoBuf, ProtoBuf_Enum};@@ -16,7 +13,7 @@ pub struct ViewPB {pub id: String,#[pb(index = 2)]- pub app_id: String,+ pub parent_view_id: String,#[pb(index = 3)]pub name: String,@@ -28,14 +25,14 @@ pub struct ViewPB {pub belongings: Vec<ViewPB>,#[pb(index = 6)]- pub layout: ViewLayoutTypePB,+ pub layout: ViewLayoutPB,}impl std::convert::From<View> for ViewPB {fn from(view: View) -> Self {ViewPB {id: view.id,- app_id: view.bid,+ parent_view_id: view.bid,name: view.name,create_time: view.created_at,belongings: Default::default(),@@ -45,26 +42,35 @@ impl std::convert::From<View> for ViewPB {}#[derive(Eq, PartialEq, Hash, Debug, ProtoBuf_Enum, Clone)]-pub enum ViewLayoutTypePB {+pub enum ViewLayoutPB {Document = 0,Grid = 3,Board = 4,Calendar = 5,}-impl std::default::Default for ViewLayoutTypePB {+impl std::default::Default for ViewLayoutPB {fn default() -> Self {- ViewLayoutTypePB::Grid+ ViewLayoutPB::Grid}}-impl std::convert::From<ViewLayout> for ViewLayoutTypePB {+impl ViewLayoutPB {+ pub fn is_database(&self) -> bool {+ matches!(+ self,+ ViewLayoutPB::Grid | ViewLayoutPB::Board | ViewLayoutPB::Calendar+ )+ }+}++impl std::convert::From<ViewLayout> for ViewLayoutPB {fn from(rev: ViewLayout) -> Self {match rev {- ViewLayout::Grid => ViewLayoutTypePB::Grid,- ViewLayout::Board => ViewLayoutTypePB::Board,- ViewLayout::Document => ViewLayoutTypePB::Document,- ViewLayout::Calendar => ViewLayoutTypePB::Calendar,+ ViewLayout::Grid => ViewLayoutPB::Grid,+ ViewLayout::Board => ViewLayoutPB::Board,+ ViewLayout::Document => ViewLayoutPB::Document,+ ViewLayout::Calendar => ViewLayoutPB::Calendar,}}}@@ -75,12 +81,8 @@ pub struct RepeatedViewPB {pub items: Vec<ViewPB>,}-impl std::convert::From<Vec<View>> for RepeatedViewPB {- fn from(views: Vec<View>) -> Self {- let items = views- .into_iter()- .map(|value| value.into())- .collect::<Vec<ViewPB>>();+impl std::convert::From<Vec<ViewPB>> for RepeatedViewPB {+ fn from(items: Vec<ViewPB>) -> Self {RepeatedViewPB { items }}}@@ -120,7 +122,7 @@ pub struct CreateViewPayloadPB {pub thumbnail: Option<String>,#[pb(index = 5)]- pub layout: ViewLayoutTypePB,+ pub layout: ViewLayoutPB,#[pb(index = 6)]pub initial_data: Vec<u8>,@@ -134,7 +136,7 @@ pub struct CreateViewParams {pub belong_to_id: String,pub name: String,pub desc: String,- pub layout: ViewLayoutTypePB,+ pub layout: ViewLayoutPB,pub view_id: String,pub initial_data: Vec<u8>,pub ext: HashMap<String, String>,@@ -145,7 +147,7 @@ impl TryInto<CreateViewParams> for CreateViewPayloadPB {fn try_into(self) -> Result<CreateViewParams, Self::Error> {let name = ViewName::parse(self.name)?.0;- let belong_to_id = AppIdentify::parse(self.belong_to_id)?.0;+ let belong_to_id = ViewIdentify::parse(self.belong_to_id)?.0;let view_id = gen_view_id();Ok(CreateViewParams {diff --git a/frontend/rust-lib/flowy-folder2/src/entities/workspace.rs b/frontend/rust-lib/flowy-folder2/src/entities/workspace.rsindex f0c027377e..c0b1553fd7 100644--- a/frontend/rust-lib/flowy-folder2/src/entities/workspace.rs+++ b/frontend/rust-lib/flowy-folder2/src/entities/workspace.rs@@ -22,6 +22,18 @@ pub struct WorkspacePB {pub create_time: i64,}+impl std::convert::From<(Workspace, Vec<ViewPB>)> for WorkspacePB {+ fn from(params: (Workspace, Vec<ViewPB>)) -> Self {+ let (workspace, views) = params;+ WorkspacePB {+ id: workspace.id,+ name: workspace.name,+ views,+ create_time: workspace.created_at,+ }+ }+}+impl std::convert::From<Workspace> for WorkspacePB {fn from(workspace: Workspace) -> Self {WorkspacePB {diff --git a/frontend/rust-lib/flowy-folder2/src/event_handler.rs b/frontend/rust-lib/flowy-folder2/src/event_handler.rsindex 38bc761964..17b9fb9ecc 100644--- a/frontend/rust-lib/flowy-folder2/src/event_handler.rs+++ b/frontend/rust-lib/flowy-folder2/src/event_handler.rs@@ -39,7 +39,8 @@ pub(crate) async fn open_workspace_handler(None => Err(FlowyError::workspace_id().context("workspace id should not be empty")),Some(workspace_id) => {let workspace = folder.open_workspace(&workspace_id).await?;- let workspace_pb: WorkspacePB = workspace.into();+ let views = folder.get_workspace_views(&workspace_id).await?;+ let workspace_pb: WorkspacePB = (workspace, views).into();data_result_ok(workspace_pb)},}@@ -67,7 +68,9 @@ pub(crate) async fn read_workspaces_handler(pub async fn read_cur_workspace_setting_handler(folder: AFPluginState<Arc<Folder2Manager>>,) -> DataResult<WorkspaceSettingPB, FlowyError> {- let workspace: WorkspacePB = folder.get_current_workspace().await?.into();+ let workspace = folder.get_current_workspace().await?;+ let views = folder.get_workspace_views(&workspace.id).await?;+ let workspace: WorkspacePB = (workspace, views).into();let latest_view: Option<ViewPB> = folder.get_current_view().await;data_result_ok(WorkspaceSettingPB {workspace,diff --git a/frontend/rust-lib/flowy-folder2/src/manager.rs b/frontend/rust-lib/flowy-folder2/src/manager.rsindex 396c74cca2..cd4d8a6acf 100644--- a/frontend/rust-lib/flowy-folder2/src/manager.rs+++ b/frontend/rust-lib/flowy-folder2/src/manager.rs@@ -63,41 +63,28 @@ impl Folder2Manager {}}- pub async fn get_current_workspace_views(&self) -> FlowyResult<Vec<View>> {- let views = self.with_folder(vec![], |folder| {- let trash_ids = folder- .trash- .get_all_trash()- .into_iter()- .map(|trash| trash.id)- .collect::<Vec<String>>();+ pub async fn get_current_workspace_views(&self) -> FlowyResult<Vec<ViewPB>> {+ let workspace_id = self+ .folder+ .lock()+ .as_ref()+ .map(|folder| folder.get_current_workspace_id());++ if let Some(Some(workspace_id)) = workspace_id {+ self.get_workspace_views(&workspace_id).await+ } else {+ Ok(vec![])+ }+ }- let mut views = folder.get_views_belong_to_current_workspace();- views.retain(|view| !trash_ids.contains(&view.id));- views+ pub async fn get_workspace_views(&self, workspace_id: &str) -> FlowyResult<Vec<ViewPB>> {+ let views = self.with_folder(vec![], |folder| {+ get_workspace_view_pbs(workspace_id, folder)});Ok(views)}- pub async fn get_workspace_views<F>(- &self,- workspace_id: &str,- filter: F,- ) -> FlowyResult<Vec<View>>- where- F: Fn(&ViewLayout) -> bool,- {- Ok(self.with_folder(vec![], |folder| {- folder- .views- .get_views_belong_to(workspace_id)- .into_iter()- .filter(|view| filter(&view.layout))- .collect::<Vec<_>>()- }))- }-/// Called immediately after the application launched with the user sign in/sign up.#[tracing::instrument(level = "trace", skip(self), err)]pub async fn initialize(&self, user_id: i64) -> FlowyResult<()> {@@ -532,6 +519,34 @@ fn listen_on_trash_change(mut rx: TrashChangeReceiver, folder: Folder) {});}+fn get_workspace_view_pbs(workspace_id: &str, folder: &InnerFolder) -> Vec<ViewPB> {+ let trash_ids = folder+ .trash+ .get_all_trash()+ .into_iter()+ .map(|trash| trash.id)+ .collect::<Vec<String>>();++ let mut views = folder.get_workspace_views(workspace_id);+ views.retain(|view| !trash_ids.contains(&view.id));++ views+ .into_iter()+ .map(|view| {+ let mut parent_view: ViewPB = view.into();++ // Get child views+ parent_view.belongings = folder+ .views+ .get_views_belong_to(&parent_view.id)+ .into_iter()+ .map(|view| view.into())+ .collect();+ parent_view+ })+ .collect()+}+#[tracing::instrument(level = "debug", skip(folder, parent_view_ids))]fn notify_parent_view_did_change<T: AsRef<str>>(folder: Folder,@@ -553,9 +568,7 @@ fn notify_parent_view_did_change<T: AsRef<str>>(// if the view's bid is equal to workspace id. Then it will fetch the current// workspace views. Because the the workspace is not a view stored in the views map.if parent_view_id == workspace_id {- let mut child_views = folder.get_views_belong_to_current_workspace();- child_views.retain(|view| !trash_ids.contains(&view.id));- let repeated_view: RepeatedViewPB = child_views.into();+ let repeated_view: RepeatedViewPB = get_workspace_view_pbs(&workspace_id, folder).into();send_notification(&workspace_id, FolderNotification::DidUpdateWorkspaceViews).payload(repeated_view).send();diff --git a/frontend/rust-lib/flowy-folder2/src/test_helper.rs b/frontend/rust-lib/flowy-folder2/src/test_helper.rsindex f6a243336a..b7fe61d22f 100644--- a/frontend/rust-lib/flowy-folder2/src/test_helper.rs+++ b/frontend/rust-lib/flowy-folder2/src/test_helper.rs@@ -1,4 +1,4 @@-use crate::entities::{CreateViewParams, ViewLayoutTypePB};+use crate::entities::{CreateViewParams, ViewLayoutPB};use crate::manager::Folder2Manager;use crate::view_ext::gen_view_id;use std::collections::HashMap;@@ -12,7 +12,7 @@ impl Folder2Manager {ext: HashMap<String, String>,) -> String {self- .create_test_view(app_id, name, ViewLayoutTypePB::Grid, ext)+ .create_test_view(app_id, name, ViewLayoutPB::Grid, ext).await}@@ -23,7 +23,7 @@ impl Folder2Manager {ext: HashMap<String, String>,) -> String {self- .create_test_view(app_id, name, ViewLayoutTypePB::Board, ext)+ .create_test_view(app_id, name, ViewLayoutPB::Board, ext).await}@@ -31,7 +31,7 @@ impl Folder2Manager {&self,app_id: &str,name: &str,- layout: ViewLayoutTypePB,+ layout: ViewLayoutPB,ext: HashMap<String, String>,) -> String {let view_id = gen_view_id();diff --git a/frontend/rust-lib/flowy-folder2/src/view_ext.rs b/frontend/rust-lib/flowy-folder2/src/view_ext.rsindex fa371840d7..87d7b3b437 100644--- a/frontend/rust-lib/flowy-folder2/src/view_ext.rs+++ b/frontend/rust-lib/flowy-folder2/src/view_ext.rs@@ -1,4 +1,4 @@-use crate::entities::{CreateViewParams, ViewLayoutTypePB};+use crate::entities::{CreateViewParams, ViewLayoutPB};use bytes::Bytes;use collab_folder::core::{View, ViewLayout};use flowy_error::FlowyError;@@ -43,13 +43,13 @@ pub trait ViewDataProcessor {pub type ViewDataProcessorMap = Arc<HashMap<ViewLayout, Arc<dyn ViewDataProcessor + Send + Sync>>>;-impl From<ViewLayoutTypePB> for ViewLayout {- fn from(pb: ViewLayoutTypePB) -> Self {+impl From<ViewLayoutPB> for ViewLayout {+ fn from(pb: ViewLayoutPB) -> Self {match pb {- ViewLayoutTypePB::Document => ViewLayout::Document,- ViewLayoutTypePB::Grid => ViewLayout::Grid,- ViewLayoutTypePB::Board => ViewLayout::Board,- ViewLayoutTypePB::Calendar => ViewLayout::Calendar,+ ViewLayoutPB::Document => ViewLayout::Document,+ ViewLayoutPB::Grid => ViewLayout::Grid,+ ViewLayoutPB::Board => ViewLayout::Board,+ ViewLayoutPB::Calendar => ViewLayout::Calendar,}}}diff --git a/frontend/rust-lib/flowy-test/src/helper.rs b/frontend/rust-lib/flowy-test/src/helper.rsindex cd6a10f22c..01a8fcd721 100644--- a/frontend/rust-lib/flowy-test/src/helper.rs+++ b/frontend/rust-lib/flowy-test/src/helper.rs@@ -1,7 +1,6 @@use crate::prelude::*;use flowy_folder2::entities::{- CreateViewPayloadPB, CreateWorkspacePayloadPB, ViewLayoutTypePB, ViewPB, WorkspaceIdPB,- WorkspacePB,+ CreateViewPayloadPB, CreateWorkspacePayloadPB, ViewLayoutPB, ViewPB, WorkspaceIdPB, WorkspacePB,};use flowy_folder2::event_map::FolderEvent::{CreateView, CreateWorkspace, OpenWorkspace};use flowy_user::{@@ -21,7 +20,7 @@ pub struct ViewTest {impl ViewTest {#[allow(dead_code)]- pub async fn new(sdk: &FlowySDKTest, layout: ViewLayoutTypePB, data: Vec<u8>) -> Self {+ pub async fn new(sdk: &FlowySDKTest, layout: ViewLayoutPB, data: Vec<u8>) -> Self {let workspace = create_workspace(sdk, "Workspace", "").await;open_workspace(sdk, &workspace.id).await;let app = create_app(sdk, "App", "AppFlowy GitHub Project", &workspace.id).await;@@ -35,19 +34,19 @@ impl ViewTest {}pub async fn new_grid_view(sdk: &FlowySDKTest, data: Vec<u8>) -> Self {- Self::new(sdk, ViewLayoutTypePB::Grid, data).await+ Self::new(sdk, ViewLayoutPB::Grid, data).await}pub async fn new_board_view(sdk: &FlowySDKTest, data: Vec<u8>) -> Self {- Self::new(sdk, ViewLayoutTypePB::Board, data).await+ Self::new(sdk, ViewLayoutPB::Board, data).await}pub async fn new_calendar_view(sdk: &FlowySDKTest, data: Vec<u8>) -> Self {- Self::new(sdk, ViewLayoutTypePB::Calendar, data).await+ Self::new(sdk, ViewLayoutPB::Calendar, data).await}pub async fn new_document_view(sdk: &FlowySDKTest) -> Self {- Self::new(sdk, ViewLayoutTypePB::Document, vec![]).await+ Self::new(sdk, ViewLayoutPB::Document, vec![]).await}}@@ -82,7 +81,7 @@ async fn create_app(sdk: &FlowySDKTest, name: &str, desc: &str, workspace_id: &sname: name.to_string(),desc: desc.to_string(),thumbnail: None,- layout: ViewLayoutTypePB::Document,+ layout: ViewLayoutPB::Document,initial_data: vec![],ext: Default::default(),};@@ -98,7 +97,7 @@ async fn create_app(sdk: &FlowySDKTest, name: &str, desc: &str, workspace_id: &sasync fn create_view(sdk: &FlowySDKTest,app_id: &str,- layout: ViewLayoutTypePB,+ layout: ViewLayoutPB,data: Vec<u8>,) -> ViewPB {let payload = CreateViewPayloadPB {