mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor: fetch all select options from field type option instead of cell (#5122)
* refactor: fetch all options from type option * chore: rustfmt * ci: fix rust ci * chore: fix clippy
This commit is contained in:
@ -103,16 +103,10 @@ impl From<SelectOptionColorPB> for SelectOptionColor {
|
||||
}
|
||||
}
|
||||
|
||||
/// [SelectOptionCellDataPB] contains a list of user's selected options and a list of all the options
|
||||
/// that the cell can use.
|
||||
/// [SelectOptionCellDataPB] contains a list of user's selected options
|
||||
#[derive(Clone, Debug, Default, ProtoBuf)]
|
||||
pub struct SelectOptionCellDataPB {
|
||||
/// The available options that the cell can use.
|
||||
#[pb(index = 1)]
|
||||
pub options: Vec<SelectOptionPB>,
|
||||
|
||||
/// The selected options for the cell.
|
||||
#[pb(index = 2)]
|
||||
pub select_options: Vec<SelectOptionPB>,
|
||||
}
|
||||
|
||||
|
@ -47,18 +47,12 @@ pub enum SelectOptionColor {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SelectOptionCellData {
|
||||
pub options: Vec<SelectOption>,
|
||||
pub select_options: Vec<SelectOption>,
|
||||
}
|
||||
|
||||
impl From<SelectOptionCellData> for SelectOptionCellDataPB {
|
||||
fn from(data: SelectOptionCellData) -> Self {
|
||||
SelectOptionCellDataPB {
|
||||
options: data
|
||||
.options
|
||||
.into_iter()
|
||||
.map(|option| option.into())
|
||||
.collect(),
|
||||
select_options: data
|
||||
.select_options
|
||||
.into_iter()
|
||||
|
@ -58,10 +58,7 @@ pub trait SelectTypeOptionSharedAction: Send + Sync {
|
||||
select_options.truncate(number_of_max_options);
|
||||
},
|
||||
}
|
||||
SelectOptionCellData {
|
||||
options: self.options().clone(),
|
||||
select_options,
|
||||
}
|
||||
SelectOptionCellData { select_options }
|
||||
}
|
||||
|
||||
fn to_type_option_data(&self) -> TypeOptionData;
|
||||
|
Reference in New Issue
Block a user