feat: add new view_type, kanban

This commit is contained in:
appflowy
2022-02-26 17:28:23 +08:00
parent 01985848f9
commit c843571e3d
21 changed files with 87 additions and 89 deletions

View File

@ -7,8 +7,8 @@ edition = "2018"
[lib]
name = "dart_ffi"
# this value will change depending on the target os
# default cdylib
crate-type = ["cdylib"]
# default staticlib
crate-type = ["staticlib"]
[dependencies]

View File

@ -127,8 +127,9 @@ pub(crate) struct ViewTable {
impl ViewTable {
pub fn new(view: View) -> Self {
let view_type = match view.view_type {
ViewType::Blank => ViewTableType::Docs,
ViewType::Doc => ViewTableType::Docs,
ViewType::Kanban => ViewTableType::Kanban,
ViewType::QuillDocument => ViewTableType::QuillDocument,
ViewType::Blank => ViewTableType::QuillDocument,
};
ViewTable {
@ -150,7 +151,8 @@ impl ViewTable {
impl std::convert::From<ViewTable> for View {
fn from(table: ViewTable) -> Self {
let view_type = match table.view_type {
ViewTableType::Docs => ViewType::Doc,
ViewTableType::QuillDocument => ViewType::QuillDocument,
ViewTableType::Kanban => ViewType::Kanban,
};
View {
@ -215,22 +217,24 @@ impl ViewChangeset {
#[repr(i32)]
#[sql_type = "Integer"]
pub enum ViewTableType {
Docs = 0,
QuillDocument = 0,
Kanban = 1,
}
impl std::default::Default for ViewTableType {
fn default() -> Self {
ViewTableType::Docs
ViewTableType::QuillDocument
}
}
impl std::convert::From<i32> for ViewTableType {
fn from(value: i32) -> Self {
match value {
0 => ViewTableType::Docs,
0 => ViewTableType::QuillDocument,
1 => ViewTableType::Kanban,
o => {
log::error!("Unsupported view type {}, fallback to ViewType::Docs", o);
ViewTableType::Docs
ViewTableType::QuillDocument
}
}
}

View File

@ -68,7 +68,14 @@ impl FolderTest {
let _ = sdk.init_user().await;
let mut workspace = create_workspace(&sdk, "FolderWorkspace", "Folder test workspace").await;
let mut app = create_app(&sdk, &workspace.id, "Folder App", "Folder test app").await;
let view = create_view(&sdk, &app.id, "Folder View", "Folder test view", ViewType::Doc).await;
let view = create_view(
&sdk,
&app.id,
"Folder View",
"Folder test view",
ViewType::QuillDocument,
)
.await;
app.belongings = RepeatedView {
items: vec![view.clone()],
};
@ -146,7 +153,7 @@ impl FolderTest {
}
FolderScript::CreateView { name, desc } => {
let view = create_view(sdk, &self.app.id, &name, &desc, ViewType::Doc).await;
let view = create_view(sdk, &self.app.id, &name, &desc, ViewType::QuillDocument).await;
self.view = view;
}
FolderScript::AssertView(view) => {

View File

@ -67,7 +67,7 @@ fn crate_log_filter(level: String) -> String {
filters.push(format!("flowy_folder={}", level));
filters.push(format!("flowy_user={}", level));
filters.push(format!("flowy_document={}", level));
filters.push(format!("flowy_collaboration={}", level));
// filters.push(format!("flowy_collaboration={}", level));
filters.push(format!("dart_notify={}", level));
filters.push(format!("lib_ot={}", level));
filters.push(format!("lib_ws={}", level));

View File

@ -88,7 +88,7 @@ async fn create_view(sdk: &FlowySDKTest, app_id: &str) -> View {
name: "View A".to_string(),
desc: "".to_string(),
thumbnail: Some("http://1.png".to_string()),
view_type: ViewType::Doc,
view_type: ViewType::QuillDocument,
};
let view = FolderEventBuilder::new(sdk.clone())