chore: create space view for imported notion zip file (#863)
This commit is contained in:
parent
38ff1874e4
commit
820db6564e
|
|
@ -2230,7 +2230,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collab"
|
name = "collab"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d7dc26a906e3ce5d72a309e933f853f1e75da1cb#d7dc26a906e3ce5d72a309e933f853f1e75da1cb"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f882a1720f7b35a874ea276e604434f0b5b04698#f882a1720f7b35a874ea276e604434f0b5b04698"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
|
|
@ -2255,7 +2255,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-database"
|
name = "collab-database"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d7dc26a906e3ce5d72a309e933f853f1e75da1cb#d7dc26a906e3ce5d72a309e933f853f1e75da1cb"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f882a1720f7b35a874ea276e604434f0b5b04698#f882a1720f7b35a874ea276e604434f0b5b04698"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|
@ -2294,7 +2294,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-document"
|
name = "collab-document"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d7dc26a906e3ce5d72a309e933f853f1e75da1cb#d7dc26a906e3ce5d72a309e933f853f1e75da1cb"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f882a1720f7b35a874ea276e604434f0b5b04698#f882a1720f7b35a874ea276e604434f0b5b04698"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
|
|
@ -2315,7 +2315,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-entity"
|
name = "collab-entity"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d7dc26a906e3ce5d72a309e933f853f1e75da1cb#d7dc26a906e3ce5d72a309e933f853f1e75da1cb"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f882a1720f7b35a874ea276e604434f0b5b04698#f882a1720f7b35a874ea276e604434f0b5b04698"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
@ -2335,7 +2335,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-folder"
|
name = "collab-folder"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d7dc26a906e3ce5d72a309e933f853f1e75da1cb#d7dc26a906e3ce5d72a309e933f853f1e75da1cb"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f882a1720f7b35a874ea276e604434f0b5b04698#f882a1720f7b35a874ea276e604434f0b5b04698"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
|
|
@ -2357,7 +2357,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-importer"
|
name = "collab-importer"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d7dc26a906e3ce5d72a309e933f853f1e75da1cb#d7dc26a906e3ce5d72a309e933f853f1e75da1cb"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f882a1720f7b35a874ea276e604434f0b5b04698#f882a1720f7b35a874ea276e604434f0b5b04698"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-recursion",
|
"async-recursion",
|
||||||
|
|
@ -2454,7 +2454,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-user"
|
name = "collab-user"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d7dc26a906e3ce5d72a309e933f853f1e75da1cb#d7dc26a906e3ce5d72a309e933f853f1e75da1cb"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=f882a1720f7b35a874ea276e604434f0b5b04698#f882a1720f7b35a874ea276e604434f0b5b04698"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"collab",
|
"collab",
|
||||||
|
|
|
||||||
14
Cargo.toml
14
Cargo.toml
|
|
@ -293,13 +293,13 @@ debug = true
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
# It's diffcult to resovle different version with the same crate used in AppFlowy Frontend and the Client-API crate.
|
# It's diffcult to resovle different version with the same crate used in AppFlowy Frontend and the Client-API crate.
|
||||||
# So using patch to workaround this issue.
|
# So using patch to workaround this issue.
|
||||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d7dc26a906e3ce5d72a309e933f853f1e75da1cb" }
|
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f882a1720f7b35a874ea276e604434f0b5b04698" }
|
||||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d7dc26a906e3ce5d72a309e933f853f1e75da1cb" }
|
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f882a1720f7b35a874ea276e604434f0b5b04698" }
|
||||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d7dc26a906e3ce5d72a309e933f853f1e75da1cb" }
|
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f882a1720f7b35a874ea276e604434f0b5b04698" }
|
||||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d7dc26a906e3ce5d72a309e933f853f1e75da1cb" }
|
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f882a1720f7b35a874ea276e604434f0b5b04698" }
|
||||||
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d7dc26a906e3ce5d72a309e933f853f1e75da1cb" }
|
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f882a1720f7b35a874ea276e604434f0b5b04698" }
|
||||||
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d7dc26a906e3ce5d72a309e933f853f1e75da1cb" }
|
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f882a1720f7b35a874ea276e604434f0b5b04698" }
|
||||||
collab-importer = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d7dc26a906e3ce5d72a309e933f853f1e75da1cb" }
|
collab-importer = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f882a1720f7b35a874ea276e604434f0b5b04698" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
history = []
|
history = []
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,7 @@ async fn process_unzip_file(
|
||||||
s3_client: &Arc<dyn S3Client>,
|
s3_client: &Arc<dyn S3Client>,
|
||||||
) -> Result<(), ImportError> {
|
) -> Result<(), ImportError> {
|
||||||
let notion_importer = NotionImporter::new(
|
let notion_importer = NotionImporter::new(
|
||||||
|
import_task.uid,
|
||||||
unzip_dir_path,
|
unzip_dir_path,
|
||||||
import_task.workspace_id.clone(),
|
import_task.workspace_id.clone(),
|
||||||
import_task.host.clone(),
|
import_task.host.clone(),
|
||||||
|
|
@ -326,7 +327,7 @@ async fn process_unzip_file(
|
||||||
.import()
|
.import()
|
||||||
.await
|
.await
|
||||||
.map_err(ImportError::ImportCollabError)?;
|
.map_err(ImportError::ImportCollabError)?;
|
||||||
let nested_views = imported.build_nested_views(import_task.uid).await;
|
let nested_views = imported.build_nested_views().await;
|
||||||
trace!(
|
trace!(
|
||||||
"[Import]: {} imported nested views:{}",
|
"[Import]: {} imported nested views:{}",
|
||||||
import_task.workspace_id,
|
import_task.workspace_id,
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,18 @@ use std::time::Duration;
|
||||||
async fn import_blog_post_test() {
|
async fn import_blog_post_test() {
|
||||||
let (client, imported_workspace_id) = import_zip("blog_post.zip").await;
|
let (client, imported_workspace_id) = import_zip("blog_post.zip").await;
|
||||||
let folder = client.get_folder(&imported_workspace_id).await;
|
let folder = client.get_folder(&imported_workspace_id).await;
|
||||||
let mut workspace_sub_views = folder.get_views_belong_to(&imported_workspace_id);
|
let mut space_views = folder.get_views_belong_to(&imported_workspace_id);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
workspace_sub_views.len(),
|
space_views.len(),
|
||||||
1,
|
1,
|
||||||
"Expected 1 view, found {:?}",
|
"Expected 1 view, found {:?}",
|
||||||
workspace_sub_views
|
space_views
|
||||||
);
|
);
|
||||||
|
|
||||||
let imported_view = workspace_sub_views.pop().unwrap();
|
let space_view = space_views.pop().unwrap();
|
||||||
assert_eq!(imported_view.name, "Blog Post");
|
assert_eq!(space_view.name, "blog_post");
|
||||||
|
let imported_view = folder.get_views_belong_to(&space_view.id).pop().unwrap();
|
||||||
|
|
||||||
let document = client
|
let document = client
|
||||||
.get_document(&imported_workspace_id, &imported_view.id)
|
.get_document(&imported_workspace_id, &imported_view.id)
|
||||||
.await;
|
.await;
|
||||||
|
|
@ -53,15 +55,18 @@ async fn import_project_and_task_zip_test() {
|
||||||
let (client, imported_workspace_id) = import_zip("project&task.zip").await;
|
let (client, imported_workspace_id) = import_zip("project&task.zip").await;
|
||||||
let folder = client.get_folder(&imported_workspace_id).await;
|
let folder = client.get_folder(&imported_workspace_id).await;
|
||||||
let workspace_database = client.get_workspace_database(&imported_workspace_id).await;
|
let workspace_database = client.get_workspace_database(&imported_workspace_id).await;
|
||||||
let mut workspace_sub_views = folder.get_views_belong_to(&imported_workspace_id);
|
let space_views = folder.get_views_belong_to(&imported_workspace_id);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
workspace_sub_views.len(),
|
space_views.len(),
|
||||||
1,
|
1,
|
||||||
"Expected 1 view, found {:?}",
|
"Expected 1 view, found {:?}",
|
||||||
workspace_sub_views
|
space_views
|
||||||
);
|
);
|
||||||
|
assert_eq!(space_views[0].name, "project&task");
|
||||||
|
assert!(space_views[0].space_info().is_some());
|
||||||
|
|
||||||
let imported_view = workspace_sub_views.pop().unwrap();
|
let mut sub_views = folder.get_views_belong_to(&space_views[0].id);
|
||||||
|
let imported_view = sub_views.pop().unwrap();
|
||||||
assert_eq!(imported_view.name, "Projects & Tasks");
|
assert_eq!(imported_view.name, "Projects & Tasks");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
imported_view.children.len(),
|
imported_view.children.len(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue