mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
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:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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)?;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user