Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve link between folder and database #5024

Merged
merged 7 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions frontend/appflowy_tauri/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions frontend/appflowy_tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "390
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
14 changes: 7 additions & 7 deletions frontend/appflowy_web/wasm-libs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "390
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
14 changes: 7 additions & 7 deletions frontend/appflowy_web_app/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions frontend/appflowy_web_app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "390
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
14 changes: 7 additions & 7 deletions frontend/rust-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions frontend/rust-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ client-api = { git = " https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "39
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "f1ef8ef3c179a7340d91ad6e5e176cc980accb9c" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5e32057ac8e6939368a8e75df91bcbce2ac143e7" }
21 changes: 16 additions & 5 deletions frontend/rust-lib/flowy-database2/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl DatabaseManager {

pub async fn duplicate_database(&self, view_id: &str) -> FlowyResult<Vec<u8>> {
let wdb = self.get_workspace_database().await?;
let data = wdb.get_database_duplicated_data(view_id).await?;
let data = wdb.get_database_data(view_id).await?;
let json_bytes = data.to_json_bytes()?;
Ok(json_bytes)
}
Expand All @@ -294,11 +294,22 @@ impl DatabaseManager {
view_id: &str,
data: Vec<u8>,
) -> FlowyResult<()> {
let mut database_data = DatabaseData::from_json_bytes(data)?;
database_data.view.id = view_id.to_string();
let database_data = DatabaseData::from_json_bytes(data)?;

let mut create_database_params = CreateDatabaseParams::from_database_data(database_data);
let old_view_id = create_database_params.inline_view_id.clone();
create_database_params.inline_view_id = view_id.to_string();

if let Some(create_view_params) = create_database_params
.views
.iter_mut()
.find(|view| view.view_id == old_view_id)
{
create_view_params.view_id = view_id.to_string();
}

let wdb = self.get_workspace_database().await?;
let _ = wdb.create_database_with_data(database_data)?;
let _ = wdb.create_database(create_database_params)?;
Ok(())
}

Expand Down Expand Up @@ -346,7 +357,7 @@ impl DatabaseManager {
.map_err(internal_error)??;
let result = ImportResult {
database_id: params.database_id.clone(),
view_id: params.view_id.clone(),
view_id: params.inline_view_id.clone(),
};
self.create_database_with_params(params).await?;
Ok(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,16 @@ impl DatabaseViewEditor {
&self,
params: CreateRowPayloadPB,
) -> FlowyResult<CreateRowParams> {
let timestamp = timestamp();
let mut result = CreateRowParams {
collab_params: collab_database::rows::CreateRowParams {
id: gen_row_id(),
cells: Cells::new(),
height: 60,
visibility: true,
row_position: params.row_position.try_into()?,
timestamp: timestamp(),
created_at: timestamp,
modified_at: timestamp,
},
open_after_create: false,
};
Expand Down
Loading
Loading