mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: migrate cloud document when the document content is not sync to … (#4108)
* fix: migrate cloud document when the document content is not sync to local * chore: clippy
This commit is contained in:
@ -147,7 +147,7 @@ impl DatabaseEditorTest {
|
||||
|
||||
pub fn get_multi_select_type_option(&self, field_id: &str) -> Vec<SelectOption> {
|
||||
let field_type = FieldType::MultiSelect;
|
||||
let field = self.get_field(field_id, field_type.clone());
|
||||
let field = self.get_field(field_id, field_type);
|
||||
let type_option = field
|
||||
.get_type_option::<MultiSelectTypeOption>(field_type)
|
||||
.unwrap();
|
||||
@ -156,7 +156,7 @@ impl DatabaseEditorTest {
|
||||
|
||||
pub fn get_single_select_type_option(&self, field_id: &str) -> SingleSelectTypeOption {
|
||||
let field_type = FieldType::SingleSelect;
|
||||
let field = self.get_field(field_id, field_type.clone());
|
||||
let field = self.get_field(field_id, field_type);
|
||||
field
|
||||
.get_type_option::<SingleSelectTypeOption>(field_type)
|
||||
.unwrap()
|
||||
@ -165,7 +165,7 @@ impl DatabaseEditorTest {
|
||||
#[allow(dead_code)]
|
||||
pub fn get_checklist_type_option(&self, field_id: &str) -> ChecklistTypeOption {
|
||||
let field_type = FieldType::Checklist;
|
||||
let field = self.get_field(field_id, field_type.clone());
|
||||
let field = self.get_field(field_id, field_type);
|
||||
field
|
||||
.get_type_option::<ChecklistTypeOption>(field_type)
|
||||
.unwrap()
|
||||
@ -174,7 +174,7 @@ impl DatabaseEditorTest {
|
||||
#[allow(dead_code)]
|
||||
pub fn get_checkbox_type_option(&self, field_id: &str) -> CheckboxTypeOption {
|
||||
let field_type = FieldType::Checkbox;
|
||||
let field = self.get_field(field_id, field_type.clone());
|
||||
let field = self.get_field(field_id, field_type);
|
||||
field
|
||||
.get_type_option::<CheckboxTypeOption>(field_type)
|
||||
.unwrap()
|
||||
|
@ -1,5 +1,6 @@
|
||||
use collab_database::fields::Field;
|
||||
use collab_database::views::OrderObjectPosition;
|
||||
|
||||
use flowy_database2::entities::{CreateFieldParams, FieldType};
|
||||
use flowy_database2::services::field::{
|
||||
type_option_to_pb, DateCellChangeset, DateFormat, DateTypeOption, FieldBuilder,
|
||||
@ -9,7 +10,7 @@ use flowy_database2::services::field::{
|
||||
pub fn create_text_field(grid_id: &str) -> (CreateFieldParams, Field) {
|
||||
let field_type = FieldType::RichText;
|
||||
let type_option = RichTextTypeOption::default();
|
||||
let text_field = FieldBuilder::new(field_type.clone(), type_option.clone())
|
||||
let text_field = FieldBuilder::new(field_type, type_option.clone())
|
||||
.name("Name")
|
||||
.visibility(true)
|
||||
.primary(true)
|
||||
@ -31,7 +32,7 @@ pub fn create_single_select_field(grid_id: &str) -> (CreateFieldParams, Field) {
|
||||
let mut type_option = SingleSelectTypeOption::default();
|
||||
type_option.options.push(SelectOption::new("Done"));
|
||||
type_option.options.push(SelectOption::new("Progress"));
|
||||
let single_select_field = FieldBuilder::new(field_type.clone(), type_option.clone())
|
||||
let single_select_field = FieldBuilder::new(field_type, type_option.clone())
|
||||
.name("Name")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -76,17 +77,15 @@ pub fn create_timestamp_field(grid_id: &str, field_type: FieldType) -> (CreateFi
|
||||
date_format: DateFormat::US,
|
||||
time_format: TimeFormat::TwentyFourHour,
|
||||
include_time: true,
|
||||
field_type: field_type.clone(),
|
||||
field_type,
|
||||
};
|
||||
|
||||
let field: Field = match field_type {
|
||||
FieldType::LastEditedTime => {
|
||||
FieldBuilder::new(field_type.clone(), timestamp_type_option.clone())
|
||||
.name("Updated At")
|
||||
.visibility(true)
|
||||
.build()
|
||||
},
|
||||
FieldType::CreatedTime => FieldBuilder::new(field_type.clone(), timestamp_type_option.clone())
|
||||
FieldType::LastEditedTime => FieldBuilder::new(field_type, timestamp_type_option.clone())
|
||||
.name("Updated At")
|
||||
.visibility(true)
|
||||
.build(),
|
||||
FieldType::CreatedTime => FieldBuilder::new(field_type, timestamp_type_option.clone())
|
||||
.name("Created At")
|
||||
.visibility(true)
|
||||
.build(),
|
||||
|
@ -1,7 +1,5 @@
|
||||
use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData};
|
||||
use collab_database::views::{DatabaseLayout, DatabaseView, LayoutSetting, LayoutSettings};
|
||||
use flowy_database2::services::field_settings::default_field_settings_for_fields;
|
||||
use flowy_database2::services::setting::BoardLayoutSetting;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use flowy_database2::entities::FieldType;
|
||||
@ -10,6 +8,8 @@ use flowy_database2::services::field::{
|
||||
DateFormat, DateTypeOption, FieldBuilder, MultiSelectTypeOption, SelectOption, SelectOptionColor,
|
||||
SingleSelectTypeOption, TimeFormat, TimestampTypeOption,
|
||||
};
|
||||
use flowy_database2::services::field_settings::default_field_settings_for_fields;
|
||||
use flowy_database2::services::setting::BoardLayoutSetting;
|
||||
|
||||
use crate::database::database_editor::TestRowBuilder;
|
||||
use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, TWITTER};
|
||||
@ -22,7 +22,7 @@ pub fn make_test_board() -> DatabaseData {
|
||||
for field_type in FieldType::iter() {
|
||||
match field_type {
|
||||
FieldType::RichText => {
|
||||
let text_field = FieldBuilder::from_field_type(field_type.clone())
|
||||
let text_field = FieldBuilder::from_field_type(field_type)
|
||||
.name("Name")
|
||||
.visibility(true)
|
||||
.primary(true)
|
||||
@ -31,7 +31,7 @@ pub fn make_test_board() -> DatabaseData {
|
||||
},
|
||||
FieldType::Number => {
|
||||
// Number
|
||||
let number_field = FieldBuilder::from_field_type(field_type.clone())
|
||||
let number_field = FieldBuilder::from_field_type(field_type)
|
||||
.name("Price")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -45,7 +45,7 @@ pub fn make_test_board() -> DatabaseData {
|
||||
timezone_id: "Etc/UTC".to_owned(),
|
||||
};
|
||||
let name = "Time";
|
||||
let date_field = FieldBuilder::new(field_type.clone(), date_type_option)
|
||||
let date_field = FieldBuilder::new(field_type, date_type_option)
|
||||
.name(name)
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -57,14 +57,14 @@ pub fn make_test_board() -> DatabaseData {
|
||||
date_format: DateFormat::US,
|
||||
time_format: TimeFormat::TwentyFourHour,
|
||||
include_time: true,
|
||||
field_type: field_type.clone(),
|
||||
field_type,
|
||||
};
|
||||
let name = match field_type {
|
||||
FieldType::LastEditedTime => "Last Modified",
|
||||
FieldType::CreatedTime => "Created At",
|
||||
_ => "",
|
||||
};
|
||||
let date_field = FieldBuilder::new(field_type.clone(), date_type_option)
|
||||
let date_field = FieldBuilder::new(field_type, date_type_option)
|
||||
.name(name)
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -79,7 +79,7 @@ pub fn make_test_board() -> DatabaseData {
|
||||
single_select_type_option
|
||||
.options
|
||||
.extend(vec![option1, option2, option3]);
|
||||
let single_select_field = FieldBuilder::new(field_type.clone(), single_select_type_option)
|
||||
let single_select_field = FieldBuilder::new(field_type, single_select_type_option)
|
||||
.name("Status")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -92,7 +92,7 @@ pub fn make_test_board() -> DatabaseData {
|
||||
let option3 = SelectOption::with_color(TWITTER, SelectOptionColor::Yellow);
|
||||
let mut type_option = MultiSelectTypeOption::default();
|
||||
type_option.options.extend(vec![option1, option2, option3]);
|
||||
let multi_select_field = FieldBuilder::new(field_type.clone(), type_option)
|
||||
let multi_select_field = FieldBuilder::new(field_type, type_option)
|
||||
.name("Platform")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -100,7 +100,7 @@ pub fn make_test_board() -> DatabaseData {
|
||||
},
|
||||
FieldType::Checkbox => {
|
||||
// Checkbox
|
||||
let checkbox_field = FieldBuilder::from_field_type(field_type.clone())
|
||||
let checkbox_field = FieldBuilder::from_field_type(field_type)
|
||||
.name("is urgent")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -108,7 +108,7 @@ pub fn make_test_board() -> DatabaseData {
|
||||
},
|
||||
FieldType::URL => {
|
||||
// URL
|
||||
let url = FieldBuilder::from_field_type(field_type.clone())
|
||||
let url = FieldBuilder::from_field_type(field_type)
|
||||
.name("link")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -120,7 +120,7 @@ pub fn make_test_board() -> DatabaseData {
|
||||
// let option3 = SelectOption::with_color(THIRD_THING, SelectOptionColor::Yellow);
|
||||
let type_option = ChecklistTypeOption::default();
|
||||
// type_option.options.extend(vec![option1, option2, option3]);
|
||||
let checklist_field = FieldBuilder::new(field_type.clone(), type_option)
|
||||
let checklist_field = FieldBuilder::new(field_type, type_option)
|
||||
.name("TODO")
|
||||
.visibility(true)
|
||||
.build();
|
||||
|
@ -1,6 +1,5 @@
|
||||
use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData};
|
||||
use collab_database::views::{DatabaseLayout, DatabaseView};
|
||||
use flowy_database2::services::field_settings::default_field_settings_for_fields;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use flowy_database2::entities::FieldType;
|
||||
@ -9,6 +8,7 @@ use flowy_database2::services::field::{
|
||||
DateFormat, DateTypeOption, FieldBuilder, MultiSelectTypeOption, NumberFormat, NumberTypeOption,
|
||||
SelectOption, SelectOptionColor, SingleSelectTypeOption, TimeFormat, TimestampTypeOption,
|
||||
};
|
||||
use flowy_database2::services::field_settings::default_field_settings_for_fields;
|
||||
|
||||
use crate::database::database_editor::TestRowBuilder;
|
||||
use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, TWITTER};
|
||||
@ -21,7 +21,7 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
for field_type in FieldType::iter() {
|
||||
match field_type {
|
||||
FieldType::RichText => {
|
||||
let text_field = FieldBuilder::from_field_type(field_type.clone())
|
||||
let text_field = FieldBuilder::from_field_type(field_type)
|
||||
.name("Name")
|
||||
.visibility(true)
|
||||
.primary(true)
|
||||
@ -33,7 +33,7 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
let mut type_option = NumberTypeOption::default();
|
||||
type_option.set_format(NumberFormat::USD);
|
||||
|
||||
let number_field = FieldBuilder::new(field_type.clone(), type_option)
|
||||
let number_field = FieldBuilder::new(field_type, type_option)
|
||||
.name("Price")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -47,7 +47,7 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
timezone_id: "Etc/UTC".to_owned(),
|
||||
};
|
||||
let name = "Time";
|
||||
let date_field = FieldBuilder::new(field_type.clone(), date_type_option)
|
||||
let date_field = FieldBuilder::new(field_type, date_type_option)
|
||||
.name(name)
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -59,14 +59,14 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
date_format: DateFormat::US,
|
||||
time_format: TimeFormat::TwentyFourHour,
|
||||
include_time: true,
|
||||
field_type: field_type.clone(),
|
||||
field_type,
|
||||
};
|
||||
let name = match field_type {
|
||||
FieldType::LastEditedTime => "Last Modified",
|
||||
FieldType::CreatedTime => "Created At",
|
||||
_ => "",
|
||||
};
|
||||
let timestamp_field = FieldBuilder::new(field_type.clone(), timestamp_type_option)
|
||||
let timestamp_field = FieldBuilder::new(field_type, timestamp_type_option)
|
||||
.name(name)
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -81,7 +81,7 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
single_select_type_option
|
||||
.options
|
||||
.extend(vec![option1, option2, option3]);
|
||||
let single_select_field = FieldBuilder::new(field_type.clone(), single_select_type_option)
|
||||
let single_select_field = FieldBuilder::new(field_type, single_select_type_option)
|
||||
.name("Status")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -94,7 +94,7 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
let option3 = SelectOption::with_color(TWITTER, SelectOptionColor::Yellow);
|
||||
let mut type_option = MultiSelectTypeOption::default();
|
||||
type_option.options.extend(vec![option1, option2, option3]);
|
||||
let multi_select_field = FieldBuilder::new(field_type.clone(), type_option)
|
||||
let multi_select_field = FieldBuilder::new(field_type, type_option)
|
||||
.name("Platform")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -102,7 +102,7 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
},
|
||||
FieldType::Checkbox => {
|
||||
// Checkbox
|
||||
let checkbox_field = FieldBuilder::from_field_type(field_type.clone())
|
||||
let checkbox_field = FieldBuilder::from_field_type(field_type)
|
||||
.name("is urgent")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -110,7 +110,7 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
},
|
||||
FieldType::URL => {
|
||||
// URL
|
||||
let url = FieldBuilder::from_field_type(field_type.clone())
|
||||
let url = FieldBuilder::from_field_type(field_type)
|
||||
.name("link")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -122,7 +122,7 @@ pub fn make_test_grid() -> DatabaseData {
|
||||
// let option3 = SelectOption::with_color(THIRD_THING, SelectOptionColor::Yellow);
|
||||
let type_option = ChecklistTypeOption::default();
|
||||
// type_option.options.extend(vec![option1, option2, option3]);
|
||||
let checklist_field = FieldBuilder::new(field_type.clone(), type_option)
|
||||
let checklist_field = FieldBuilder::new(field_type, type_option)
|
||||
.name("TODO")
|
||||
.visibility(true)
|
||||
.build();
|
||||
@ -274,7 +274,7 @@ pub fn make_no_date_test_grid() -> DatabaseData {
|
||||
for field_type in FieldType::iter() {
|
||||
match field_type {
|
||||
FieldType::RichText => {
|
||||
let text_field = FieldBuilder::from_field_type(field_type.clone())
|
||||
let text_field = FieldBuilder::from_field_type(field_type)
|
||||
.name("Name")
|
||||
.visibility(true)
|
||||
.primary(true)
|
||||
@ -286,7 +286,7 @@ pub fn make_no_date_test_grid() -> DatabaseData {
|
||||
let mut type_option = NumberTypeOption::default();
|
||||
type_option.set_format(NumberFormat::USD);
|
||||
|
||||
let number_field = FieldBuilder::new(field_type.clone(), type_option)
|
||||
let number_field = FieldBuilder::new(field_type, type_option)
|
||||
.name("Price")
|
||||
.visibility(true)
|
||||
.build();
|
||||
|
Reference in New Issue
Block a user