fix: launch review issues (#4075)

* chore: add a tooltip for fields in row detail page

* fix: grouping by field makes cell contents disappear

* chore: code cleanup

* chore: env var values in launch.json should be string

* fix: group orders not being saved

* test: fix test

* chore: more code cleanup

* fix: field settings not found

* chore: ellide cell text

* fix: alignment issues in row detail page
This commit is contained in:
Richard Shiue
2023-12-04 10:22:26 +08:00
committed by GitHub
parent 4ae679128f
commit 5fa441cbf5
16 changed files with 146 additions and 214 deletions

View File

@ -25,27 +25,16 @@ pub trait SelectTypeOptionSharedAction: Send + Sync {
/// If the option already exists, it will be updated.
/// If the option does not exist, it will be inserted at the beginning.
fn insert_option(&mut self, new_option: SelectOption) {
self.insert_option_at_index(new_option, None);
}
fn insert_option_at_index(&mut self, new_option: SelectOption, new_index: Option<usize>) {
let options = self.mut_options();
let safe_new_index = new_index.map(|index| {
if index > options.len() {
options.len()
} else {
index
}
});
if let Some(index) = options
.iter()
.position(|option| option.id == new_option.id || option.name == new_option.name)
{
options.remove(index);
options.insert(safe_new_index.unwrap_or(index), new_option);
options.insert(index, new_option);
} else {
options.insert(safe_new_index.unwrap_or(0), new_option);
options.insert(0, new_option);
}
}

View File

@ -477,12 +477,6 @@ fn merge_groups(
// The group is ordered in old groups. Add them before adding the new groups
for old in old_groups {
if let Some(index) = new_group_map.get_index_of(&old.id) {
let right = new_group_map.split_off(index);
merge_result.all_groups.extend(new_group_map.into_values());
new_group_map = right;
}
if let Some(new) = new_group_map.shift_remove(&old.id) {
merge_result.all_groups.push(new.clone());
} else {
@ -491,11 +485,10 @@ fn merge_groups(
}
// Find out the new groups
let new_groups = new_group_map.into_values();
for (_, group) in new_groups.into_iter().enumerate() {
merge_result.all_groups.push(group.clone());
merge_result.new_groups.push(group);
}
merge_result
.all_groups
.extend(new_group_map.values().cloned());
merge_result.new_groups.extend(new_group_map.into_values());
// The `No status` group index is initialized to 0
if let Some(no_status_group) = no_status_group {

View File

@ -101,10 +101,7 @@ impl GroupCustomize for SingleSelectGroupController {
) -> FlowyResult<(Option<TypeOptionData>, Option<InsertedGroupPB>)> {
let mut new_type_option = self.type_option.clone();
let new_select_option = self.type_option.create_option(&name);
new_type_option.insert_option_at_index(
new_select_option.clone(),
Some(new_type_option.options.len()),
);
new_type_option.insert_option(new_select_option.clone());
let new_group = Group::new(new_select_option.id, new_select_option.name);
let inserted_group_pb = self.context.add_new_group(new_group)?;

View File

@ -462,7 +462,7 @@ async fn group_insert_single_select_option_test() {
AssertGroupCount(5),
];
test.run_scripts(scripts).await;
let new_group = test.group_at_index(1).await;
let new_group = test.group_at_index(4).await;
assert_eq!(new_group.group_name, new_option_name);
}