chore: remove inline view id reference

This commit is contained in:
Nathan 2025-04-16 22:03:14 +08:00
parent 954e844a21
commit e2896b2911
10 changed files with 34 additions and 61 deletions

View file

@ -143,12 +143,11 @@ class RelationCellBloc extends Bloc<RelationCellEvent, RelationCellState> {
(f) => null,
);
if (databaseMeta != null) {
final result =
await ViewBackendService.getView(databaseMeta.inlineViewId);
final result = await ViewBackendService.getView(databaseMeta.viewId);
return result.fold(
(s) => DatabaseMeta(
databaseId: databaseId,
inlineViewId: databaseMeta.inlineViewId,
viewId: databaseMeta.viewId,
databaseName: s.name,
),
(f) => null,

View file

@ -17,11 +17,11 @@ class RelationDatabaseListCubit extends Cubit<RelationDatabaseListState> {
.send()
.fold<List<DatabaseMetaPB>>((s) => s.items, (f) => []);
final futures = metaPBs.map((meta) {
return ViewBackendService.getView(meta.inlineViewId).then(
return ViewBackendService.getView(meta.viewId).then(
(result) => result.fold(
(s) => DatabaseMeta(
databaseId: meta.databaseId,
inlineViewId: meta.inlineViewId,
viewId: meta.viewId,
databaseName: s.name,
),
(f) => null,
@ -43,10 +43,10 @@ class DatabaseMeta with _$DatabaseMeta {
/// id of the database
required String databaseId,
/// id of the inline view
required String inlineViewId,
/// id of the view
required String viewId,
/// name of the database, currently identical to the name of the inline view
/// name of the database
required String databaseName,
}) = _DatabaseMeta;
}

View file

@ -256,7 +256,7 @@ class _CellEditorTitle extends StatelessWidget {
}
void _openRelatedDatbase(BuildContext context) {
FolderEventGetView(ViewIdPB(value: databaseMeta.inlineViewId))
FolderEventGetView(ViewIdPB(value: databaseMeta.viewId))
.send()
.then((result) {
result.fold(

View file

@ -1270,7 +1270,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=1920e21f47e88a238e11356be0b3ef2f3acdc23e#1920e21f47e88a238e11356be0b3ef2f3acdc23e"
dependencies = [
"anyhow",
"arc-swap",
@ -1295,7 +1295,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=1920e21f47e88a238e11356be0b3ef2f3acdc23e#1920e21f47e88a238e11356be0b3ef2f3acdc23e"
dependencies = [
"anyhow",
"async-trait",
@ -1335,7 +1335,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=1920e21f47e88a238e11356be0b3ef2f3acdc23e#1920e21f47e88a238e11356be0b3ef2f3acdc23e"
dependencies = [
"anyhow",
"arc-swap",
@ -1356,7 +1356,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=1920e21f47e88a238e11356be0b3ef2f3acdc23e#1920e21f47e88a238e11356be0b3ef2f3acdc23e"
dependencies = [
"anyhow",
"bytes",
@ -1376,7 +1376,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=1920e21f47e88a238e11356be0b3ef2f3acdc23e#1920e21f47e88a238e11356be0b3ef2f3acdc23e"
dependencies = [
"anyhow",
"arc-swap",
@ -1398,7 +1398,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=1920e21f47e88a238e11356be0b3ef2f3acdc23e#1920e21f47e88a238e11356be0b3ef2f3acdc23e"
dependencies = [
"anyhow",
"async-recursion",
@ -1461,7 +1461,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=1920e21f47e88a238e11356be0b3ef2f3acdc23e#1920e21f47e88a238e11356be0b3ef2f3acdc23e"
dependencies = [
"anyhow",
"async-stream",
@ -1539,7 +1539,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=1920e21f47e88a238e11356be0b3ef2f3acdc23e#1920e21f47e88a238e11356be0b3ef2f3acdc23e"
dependencies = [
"anyhow",
"collab",
@ -1786,7 +1786,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa",
"phf 0.11.2",
"phf 0.8.0",
"smallvec",
]
@ -5189,7 +5189,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [
"phf_macros 0.8.0",
"phf_macros",
"phf_shared 0.8.0",
"proc-macro-hack",
]
@ -5209,7 +5209,6 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_macros 0.11.3",
"phf_shared 0.11.2",
]
@ -5277,19 +5276,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "phf_macros"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"
dependencies = [
"phf_generator 0.11.2",
"phf_shared 0.11.2",
"proc-macro2",
"quote",
"syn 2.0.94",
]
[[package]]
name = "phf_shared"
version = "0.8.0"

View file

@ -141,14 +141,14 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1710120
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "1920e21f47e88a238e11356be0b3ef2f3acdc23e" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "1920e21f47e88a238e11356be0b3ef2f3acdc23e" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "1920e21f47e88a238e11356be0b3ef2f3acdc23e" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "1920e21f47e88a238e11356be0b3ef2f3acdc23e" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "1920e21f47e88a238e11356be0b3ef2f3acdc23e" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "1920e21f47e88a238e11356be0b3ef2f3acdc23e" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "1920e21f47e88a238e11356be0b3ef2f3acdc23e" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "1920e21f47e88a238e11356be0b3ef2f3acdc23e" }
# Working directory: frontend
# To update the commit ID, run:

View file

@ -26,9 +26,6 @@ pub struct DatabasePB {
#[pb(index = 4)]
pub layout_type: DatabaseLayoutPB,
#[pb(index = 5)]
pub is_linked: bool,
}
#[derive(ProtoBuf, Default)]
@ -208,7 +205,7 @@ pub struct DatabaseMetaPB {
pub database_id: String,
#[pb(index = 2)]
pub inline_view_id: String,
pub view_id: String,
}
#[derive(Debug, Default, ProtoBuf)]

View file

@ -900,7 +900,7 @@ pub(crate) async fn get_databases_handler(
if let Some(link_view) = meta.linked_views.first() {
items.push(DatabaseMetaPB {
database_id: meta.database_id,
inline_view_id: link_view.clone(),
view_id: link_view.clone(),
})
}
}

View file

@ -148,15 +148,6 @@ impl DatabaseManager {
Ok(())
}
pub async fn get_database_inline_view_id(&self, database_id: &str) -> FlowyResult<String> {
let lock = self.workspace_database()?;
let wdb = lock.read().await;
let database_collab = wdb.get_or_init_database(database_id).await?;
drop(wdb);
let lock_guard = database_collab.read().await;
Ok(lock_guard.get_inline_view_id())
}
pub async fn get_all_databases_meta(&self) -> Vec<DatabaseMeta> {
let mut items = vec![];
if let Some(lock) = self.workspace_database_manager.load_full() {

View file

@ -1505,7 +1505,7 @@ impl DatabaseEditor {
view_editor.set_row_orders(row_orders.clone()).await;
// Collect database details in a single block holding the `read` lock
let (database_id, fields, is_linked) = {
let (database_id, fields) = {
let database = self.database.read().await;
(
database.get_database_id(),
@ -1514,7 +1514,6 @@ impl DatabaseEditor {
.into_iter()
.map(FieldIdPB::from)
.collect::<Vec<_>>(),
database.is_inline_view(view_id),
)
};
@ -1557,7 +1556,6 @@ impl DatabaseEditor {
fields,
rows: order_rows,
layout_type: view_layout.into(),
is_linked,
});
// Mark that the opening process is complete
if let Some(tx) = self.is_loading_rows.load_full() {

View file

@ -28,8 +28,10 @@ impl CSVExport {
style: CSVFormat,
) -> FlowyResult<String> {
let mut wtr = csv::Writer::from_writer(vec![]);
let inline_view_id = database.get_inline_view_id();
let fields = database.get_fields_in_view(&inline_view_id, None);
let view_id = database
.get_first_database_view_id()
.ok_or_else(|| FlowyError::internal().with_context("failed to get first database view"))?;
let fields = database.get_fields_in_view(&view_id, None);
// Write fields
let field_records = fields
@ -49,7 +51,7 @@ impl CSVExport {
field_by_field_id.insert(field.id.clone(), field);
});
let rows = database
.get_rows_for_view(&inline_view_id, 20, None)
.get_rows_for_view(&view_id, 20, None)
.await
.filter_map(|result| async { result.ok() })
.collect::<Vec<_>>()