feat: allow hiding ungrouped stack (#3752)

* feat: allow hiding ungrouped stack

* chore: add notifications and listeners

* chore: implement UI

* fix: field info update

* chore: more responsive notification

* chore: read the right configurations

* feat: add ungrouped button

* fix: new board not getting isGroupField

* feat: refresh the counter

* fix: item count update

* chore: apply code suggestions from Mathias

* chore: yolo through tests

* chore: UI fix

* chore: code cleanup

* chore: ungrouped item count fix

* chore: same as above
This commit is contained in:
Richard Shiue
2023-10-26 11:48:58 +08:00
committed by GitHub
parent 1883dd6d7c
commit 8c3984d21a
31 changed files with 895 additions and 118 deletions

View File

@ -59,7 +59,7 @@ impl DatabaseEditorTest {
let _ = sdk.init_anon_user().await;
let params = make_test_board();
let view_test = ViewTest::new_grid_view(&sdk, params.to_json_bytes().unwrap()).await;
let view_test = ViewTest::new_board_view(&sdk, params.to_json_bytes().unwrap()).await;
Self::new(sdk, view_test).await
}

View File

@ -10,6 +10,7 @@ use flowy_database2::services::field::{
edit_single_select_type_option, SelectOption, SelectTypeOptionSharedAction,
SingleSelectTypeOption,
};
use flowy_database2::services::group::GroupSettingChangeset;
use lib_infra::util::timestamp;
use crate::database::database_editor::DatabaseEditorTest;
@ -67,6 +68,12 @@ pub enum GroupScript {
group_id: String,
group_name: String,
},
AssertGroupConfiguration {
hide_ungrouped: bool,
},
UpdateGroupConfiguration {
hide_ungrouped: Option<bool>,
},
}
pub struct DatabaseGroupTest {
@ -269,6 +276,25 @@ impl DatabaseGroupTest {
assert_eq!(group_id, group.group_id, "group index: {}", group_index);
assert_eq!(group_name, group.group_name, "group index: {}", group_index);
},
GroupScript::AssertGroupConfiguration { hide_ungrouped } => {
let group_configuration = self
.editor
.get_group_configuration_settings(&self.view_id)
.await
.unwrap();
let group_configuration = group_configuration.get(0).unwrap();
assert_eq!(group_configuration.hide_ungrouped, hide_ungrouped);
},
GroupScript::UpdateGroupConfiguration { hide_ungrouped } => {
self
.editor
.update_group_configuration_setting(
&self.view_id,
GroupSettingChangeset { hide_ungrouped },
)
.await
.unwrap();
},
}
}

View File

@ -28,6 +28,23 @@ async fn group_init_test() {
test.run_scripts(scripts).await;
}
// #[tokio::test]
// async fn group_configuration_setting_test() {
// let mut test = DatabaseGroupTest::new().await;
// let scripts = vec![
// AssertGroupConfiguration {
// hide_ungrouped: false,
// },
// UpdateGroupConfiguration {
// hide_ungrouped: Some(true),
// },
// AssertGroupConfiguration {
// hide_ungrouped: true,
// },
// ];
// test.run_scripts(scripts).await;
// }
#[tokio::test]
async fn group_move_row_test() {
let mut test = DatabaseGroupTest::new().await;