AppFlowy/frontend/rust-lib/flowy-database2/src/entities/view_entities.rs
Richard Shiue 9d61ca0278
feat: delete kanban board groups (#3925)
* feat: hide/unhide ui

* chore: implement collapsible side bar and adjust group header (#2)

* refactor: hidden columns into own file

* chore: adjust new group button position

* fix: flowy icon buton secondary color bleed

* chore: some UI adjustments

* fix: some regressions

* chore: proper group is_visible fetching

* chore: use a bloc to manage hidden groups

* fix: hiding groups not working

* chore: implement hidden group popups

* chore: proper ungrouped item column management

* chore: remove ungrouped items button

* chore: flowy hover build

* fix: clean up code

* test: integration tests

* fix: not null promise on null value

* fix: hide and unhide multiple groups

* chore: i18n and code review

* chore: missed review

* fix: rust-lib-test

* fix: dont completely remove flowyiconhovercolor

* chore: apply suggest

* fix: number of rows inside hidden groups not updating properly

* fix: hidden groups disappearing after collapse

* fix: hidden group title alignment

* fix: insert newly unhidden groups into the correct position

* chore: adjust padding all around

* feat: reorder hidden groups

* chore: adjust padding

* chore: collapse hidden groups section persist

* chore: no status group at beginning

* fix: hiding groups when grouping with other types

* chore: disable rename groups that arent supported

* chore: update appflowy board ref

* chore: better naming

* feat: delete kanban groups

* chore: forgot to save

* chore: fix build and small ui adjustments

* chore: add a confirm dialog when deleting a column

* fix: flutter lint

* test: add integration test

* chore: fix some design review issues

* chore: apply suggestions from Nathan

* fix: write lock on group controller

---------

Co-authored-by: Mathias Mogensen <mathias@appflowy.io>
2023-11-28 10:43:22 +08:00

99 lines
2.0 KiB
Rust

use collab_database::rows::RowDetail;
use flowy_derive::ProtoBuf;
use crate::entities::{InsertedRowPB, RowMetaPB, UpdatedRowPB};
#[derive(Debug, Default, Clone, ProtoBuf)]
pub struct RowsVisibilityChangePB {
#[pb(index = 1)]
pub view_id: String,
#[pb(index = 5)]
pub visible_rows: Vec<InsertedRowPB>,
#[pb(index = 6)]
pub invisible_rows: Vec<String>,
}
#[derive(Debug, Default, Clone, ProtoBuf)]
pub struct RowsChangePB {
#[pb(index = 1)]
pub inserted_rows: Vec<InsertedRowPB>,
#[pb(index = 2)]
pub deleted_rows: Vec<String>,
#[pb(index = 3)]
pub updated_rows: Vec<UpdatedRowPB>,
}
impl RowsChangePB {
pub fn from_insert(inserted_row: InsertedRowPB) -> Self {
Self {
inserted_rows: vec![inserted_row],
..Default::default()
}
}
pub fn from_delete(deleted_row: String) -> Self {
Self {
deleted_rows: vec![deleted_row],
..Default::default()
}
}
pub fn from_update(updated_row: UpdatedRowPB) -> Self {
Self {
updated_rows: vec![updated_row],
..Default::default()
}
}
pub fn from_move(deleted_rows: Vec<String>, inserted_rows: Vec<InsertedRowPB>) -> Self {
Self {
inserted_rows,
deleted_rows,
..Default::default()
}
}
pub fn is_empty(&self) -> bool {
self.deleted_rows.is_empty() && self.inserted_rows.is_empty() && self.updated_rows.is_empty()
}
}
#[derive(Debug, Default, ProtoBuf)]
pub struct DidFetchRowPB {
#[pb(index = 1)]
pub row_id: String,
#[pb(index = 2)]
pub height: i32,
#[pb(index = 3)]
pub visibility: bool,
#[pb(index = 4)]
pub created_at: i64,
#[pb(index = 5)]
pub modified_at: i64,
#[pb(index = 6)]
pub meta: RowMetaPB,
}
impl From<RowDetail> for DidFetchRowPB {
fn from(value: RowDetail) -> Self {
Self {
row_id: value.row.id.to_string(),
height: value.row.height,
visibility: value.row.visibility,
created_at: value.row.created_at,
modified_at: value.row.modified_at,
meta: RowMetaPB::from(value),
}
}
}