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

@ -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) => {