mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: rename update at and create at (#2672)
This commit is contained in:
parent
80f08d4bec
commit
09d61c79c9
@ -280,8 +280,8 @@
|
|||||||
"textFieldName": "Text",
|
"textFieldName": "Text",
|
||||||
"checkboxFieldName": "Checkbox",
|
"checkboxFieldName": "Checkbox",
|
||||||
"dateFieldName": "Date",
|
"dateFieldName": "Date",
|
||||||
"updatedAtFieldName": "Updated At",
|
"updatedAtFieldName": "Last modified time",
|
||||||
"createdAtFieldName": "Created At",
|
"createdAtFieldName": "Created time",
|
||||||
"numberFieldName": "Numbers",
|
"numberFieldName": "Numbers",
|
||||||
"singleSelectFieldName": "Select",
|
"singleSelectFieldName": "Select",
|
||||||
"multiSelectFieldName": "Multiselect",
|
"multiSelectFieldName": "Multiselect",
|
||||||
|
@ -40,8 +40,8 @@ class CellControllerBuilder {
|
|||||||
cellDataPersistence: TextCellDataPersistence(cellId: _cellId),
|
cellDataPersistence: TextCellDataPersistence(cellId: _cellId),
|
||||||
);
|
);
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
final cellDataLoader = CellDataLoader(
|
final cellDataLoader = CellDataLoader(
|
||||||
cellId: _cellId,
|
cellId: _cellId,
|
||||||
parser: DateCellDataParser(),
|
parser: DateCellDataParser(),
|
||||||
|
@ -356,8 +356,8 @@ class RowDataBuilder {
|
|||||||
assert(
|
assert(
|
||||||
[
|
[
|
||||||
FieldType.DateTime,
|
FieldType.DateTime,
|
||||||
FieldType.UpdatedAt,
|
FieldType.LastEditedTime,
|
||||||
FieldType.CreatedAt,
|
FieldType.CreatedTime,
|
||||||
].contains(fieldInfo.fieldType),
|
].contains(fieldInfo.fieldType),
|
||||||
);
|
);
|
||||||
final timestamp = date.millisecondsSinceEpoch ~/ 1000;
|
final timestamp = date.millisecondsSinceEpoch ~/ 1000;
|
||||||
|
@ -92,8 +92,8 @@ class FilterBackendService {
|
|||||||
assert(
|
assert(
|
||||||
[
|
[
|
||||||
FieldType.DateTime,
|
FieldType.DateTime,
|
||||||
FieldType.UpdatedAt,
|
FieldType.LastEditedTime,
|
||||||
FieldType.CreatedAt,
|
FieldType.CreatedTime,
|
||||||
].contains(fieldType),
|
].contains(fieldType),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -365,8 +365,8 @@ Widget? _buildHeaderIcon(GroupData customData) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
break;
|
break;
|
||||||
case FieldType.MultiSelect:
|
case FieldType.MultiSelect:
|
||||||
break;
|
break;
|
||||||
|
@ -93,8 +93,8 @@ class GridCreateFilterBloc
|
|||||||
condition: CheckboxFilterConditionPB.IsChecked,
|
condition: CheckboxFilterConditionPB.IsChecked,
|
||||||
);
|
);
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
final timestamp = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
final timestamp = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
return _filterBackendSvc.insertDateFilter(
|
return _filterBackendSvc.insertDateFilter(
|
||||||
fieldId: fieldId,
|
fieldId: fieldId,
|
||||||
|
@ -25,8 +25,8 @@ class FilterInfo {
|
|||||||
DateFilterPB? dateFilter() {
|
DateFilterPB? dateFilter() {
|
||||||
if (![
|
if (![
|
||||||
FieldType.DateTime,
|
FieldType.DateTime,
|
||||||
FieldType.UpdatedAt,
|
FieldType.LastEditedTime,
|
||||||
FieldType.CreatedAt,
|
FieldType.CreatedTime,
|
||||||
].contains(filter.fieldType)) {
|
].contains(filter.fieldType)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ Widget buildFilterChoicechip(FilterInfo filterInfo) {
|
|||||||
case FieldType.Checkbox:
|
case FieldType.Checkbox:
|
||||||
return CheckboxFilterChoicechip(filterInfo: filterInfo);
|
return CheckboxFilterChoicechip(filterInfo: filterInfo);
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return DateFilterChoicechip(filterInfo: filterInfo);
|
return DateFilterChoicechip(filterInfo: filterInfo);
|
||||||
case FieldType.MultiSelect:
|
case FieldType.MultiSelect:
|
||||||
return SelectOptionFilterChoicechip(filterInfo: filterInfo);
|
return SelectOptionFilterChoicechip(filterInfo: filterInfo);
|
||||||
|
@ -8,8 +8,8 @@ extension FieldTypeListExtension on FieldType {
|
|||||||
case FieldType.Checkbox:
|
case FieldType.Checkbox:
|
||||||
return "grid/field/checkbox";
|
return "grid/field/checkbox";
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return "grid/field/date";
|
return "grid/field/date";
|
||||||
case FieldType.MultiSelect:
|
case FieldType.MultiSelect:
|
||||||
return "grid/field/multi_select";
|
return "grid/field/multi_select";
|
||||||
@ -33,9 +33,9 @@ extension FieldTypeListExtension on FieldType {
|
|||||||
return LocaleKeys.grid_field_checkboxFieldName.tr();
|
return LocaleKeys.grid_field_checkboxFieldName.tr();
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
return LocaleKeys.grid_field_dateFieldName.tr();
|
return LocaleKeys.grid_field_dateFieldName.tr();
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
return LocaleKeys.grid_field_updatedAtFieldName.tr();
|
return LocaleKeys.grid_field_updatedAtFieldName.tr();
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return LocaleKeys.grid_field_createdAtFieldName.tr();
|
return LocaleKeys.grid_field_createdAtFieldName.tr();
|
||||||
case FieldType.MultiSelect:
|
case FieldType.MultiSelect:
|
||||||
return LocaleKeys.grid_field_multiSelectFieldName.tr();
|
return LocaleKeys.grid_field_multiSelectFieldName.tr();
|
||||||
|
@ -73,8 +73,8 @@ TypeOptionWidgetBuilder makeTypeOptionWidgetBuilder({
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return DateTypeOptionWidgetBuilder(
|
return DateTypeOptionWidgetBuilder(
|
||||||
makeTypeOptionContextWithDataController<DateTypeOptionPB>(
|
makeTypeOptionContextWithDataController<DateTypeOptionPB>(
|
||||||
viewId: viewId,
|
viewId: viewId,
|
||||||
@ -204,8 +204,8 @@ TypeOptionContext<T>
|
|||||||
dataParser: CheckboxTypeOptionWidgetDataParser(),
|
dataParser: CheckboxTypeOptionWidgetDataParser(),
|
||||||
) as TypeOptionContext<T>;
|
) as TypeOptionContext<T>;
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return DateTypeOptionContext(
|
return DateTypeOptionContext(
|
||||||
dataController: dataController,
|
dataController: dataController,
|
||||||
dataParser: DateTypeOptionDataParser(),
|
dataParser: DateTypeOptionDataParser(),
|
||||||
|
@ -39,8 +39,8 @@ class CardCellBuilder<CustomCardData> {
|
|||||||
key: key,
|
key: key,
|
||||||
);
|
);
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return DateCardCell<CustomCardData>(
|
return DateCardCell<CustomCardData>(
|
||||||
renderHook: renderHook?.renderHook[FieldType.DateTime],
|
renderHook: renderHook?.renderHook[FieldType.DateTime],
|
||||||
cellControllerBuilder: cellControllerBuilder,
|
cellControllerBuilder: cellControllerBuilder,
|
||||||
|
@ -39,8 +39,8 @@ class GridCellBuilder {
|
|||||||
key: key,
|
key: key,
|
||||||
style: style,
|
style: style,
|
||||||
);
|
);
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return GridDateCell(
|
return GridDateCell(
|
||||||
cellControllerBuilder: cellControllerBuilder,
|
cellControllerBuilder: cellControllerBuilder,
|
||||||
key: key,
|
key: key,
|
||||||
|
@ -337,8 +337,8 @@ GridCellStyle? _customCellStyle(FieldType fieldType) {
|
|||||||
case FieldType.Checkbox:
|
case FieldType.Checkbox:
|
||||||
return null;
|
return null;
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return DateCellStyle(
|
return DateCellStyle(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
);
|
);
|
||||||
|
@ -45,8 +45,8 @@ export class CellControllerBuilder {
|
|||||||
case FieldType.Number:
|
case FieldType.Number:
|
||||||
return this.makeNumberCellController();
|
return this.makeNumberCellController();
|
||||||
case FieldType.DateTime:
|
case FieldType.DateTime:
|
||||||
case FieldType.UpdatedAt:
|
case FieldType.LastEditedTime:
|
||||||
case FieldType.CreatedAt:
|
case FieldType.CreatedTime:
|
||||||
return this.makeDateCellController();
|
return this.makeDateCellController();
|
||||||
case FieldType.URL:
|
case FieldType.URL:
|
||||||
return this.makeURLCellController();
|
return this.makeURLCellController();
|
||||||
|
@ -492,8 +492,8 @@ pub enum FieldType {
|
|||||||
Checkbox = 5,
|
Checkbox = 5,
|
||||||
URL = 6,
|
URL = 6,
|
||||||
Checklist = 7,
|
Checklist = 7,
|
||||||
UpdatedAt = 8,
|
LastEditedTime = 8,
|
||||||
CreatedAt = 9,
|
CreatedTime = 9,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const RICH_TEXT_FIELD: FieldType = FieldType::RichText;
|
pub const RICH_TEXT_FIELD: FieldType = FieldType::RichText;
|
||||||
@ -504,8 +504,8 @@ pub const MULTI_SELECT_FIELD: FieldType = FieldType::MultiSelect;
|
|||||||
pub const CHECKBOX_FIELD: FieldType = FieldType::Checkbox;
|
pub const CHECKBOX_FIELD: FieldType = FieldType::Checkbox;
|
||||||
pub const URL_FIELD: FieldType = FieldType::URL;
|
pub const URL_FIELD: FieldType = FieldType::URL;
|
||||||
pub const CHECKLIST_FIELD: FieldType = FieldType::Checklist;
|
pub const CHECKLIST_FIELD: FieldType = FieldType::Checklist;
|
||||||
pub const UPDATED_AT_FIELD: FieldType = FieldType::UpdatedAt;
|
pub const UPDATED_AT_FIELD: FieldType = FieldType::LastEditedTime;
|
||||||
pub const CREATED_AT_FIELD: FieldType = FieldType::CreatedAt;
|
pub const CREATED_AT_FIELD: FieldType = FieldType::CreatedTime;
|
||||||
|
|
||||||
impl std::default::Default for FieldType {
|
impl std::default::Default for FieldType {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
@ -539,7 +539,7 @@ impl FieldType {
|
|||||||
|
|
||||||
pub fn default_cell_width(&self) -> i32 {
|
pub fn default_cell_width(&self) -> i32 {
|
||||||
match self {
|
match self {
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => 180,
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => 180,
|
||||||
_ => 150,
|
_ => 150,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -554,8 +554,8 @@ impl FieldType {
|
|||||||
FieldType::Checkbox => "Checkbox",
|
FieldType::Checkbox => "Checkbox",
|
||||||
FieldType::URL => "URL",
|
FieldType::URL => "URL",
|
||||||
FieldType::Checklist => "Checklist",
|
FieldType::Checklist => "Checklist",
|
||||||
FieldType::UpdatedAt => "Updated At",
|
FieldType::LastEditedTime => "Last edited time",
|
||||||
FieldType::CreatedAt => "Created At",
|
FieldType::CreatedTime => "Created time",
|
||||||
};
|
};
|
||||||
s.to_string()
|
s.to_string()
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ impl std::convert::From<&Filter> for FilterPB {
|
|||||||
let bytes: Bytes = match filter.field_type {
|
let bytes: Bytes = match filter.field_type {
|
||||||
FieldType::RichText => TextFilterPB::from(filter).try_into().unwrap(),
|
FieldType::RichText => TextFilterPB::from(filter).try_into().unwrap(),
|
||||||
FieldType::Number => NumberFilterPB::from(filter).try_into().unwrap(),
|
FieldType::Number => NumberFilterPB::from(filter).try_into().unwrap(),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
DateFilterPB::from(filter).try_into().unwrap()
|
DateFilterPB::from(filter).try_into().unwrap()
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => SelectOptionFilterPB::from(filter).try_into().unwrap(),
|
FieldType::SingleSelect => SelectOptionFilterPB::from(filter).try_into().unwrap(),
|
||||||
@ -200,7 +200,7 @@ impl TryInto<UpdateFilterParams> for UpdateFilterPayloadPB {
|
|||||||
condition = filter.condition as u8;
|
condition = filter.condition as u8;
|
||||||
content = filter.content;
|
content = filter.content;
|
||||||
},
|
},
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
let filter = DateFilterPB::try_from(bytes).map_err(|_| ErrorCode::ProtobufSerde)?;
|
let filter = DateFilterPB::try_from(bytes).map_err(|_| ErrorCode::ProtobufSerde)?;
|
||||||
condition = filter.condition as u8;
|
condition = filter.condition as u8;
|
||||||
content = DateFilterContentPB {
|
content = DateFilterContentPB {
|
||||||
|
@ -12,8 +12,8 @@ macro_rules! impl_into_field_type {
|
|||||||
5 => FieldType::Checkbox,
|
5 => FieldType::Checkbox,
|
||||||
6 => FieldType::URL,
|
6 => FieldType::URL,
|
||||||
7 => FieldType::Checklist,
|
7 => FieldType::Checklist,
|
||||||
8 => FieldType::UpdatedAt,
|
8 => FieldType::LastEditedTime,
|
||||||
9 => FieldType::CreatedAt,
|
9 => FieldType::CreatedTime,
|
||||||
_ => {
|
_ => {
|
||||||
tracing::error!("Can't parser FieldType from value: {}", ty);
|
tracing::error!("Can't parser FieldType from value: {}", ty);
|
||||||
FieldType::RichText
|
FieldType::RichText
|
||||||
|
@ -330,7 +330,7 @@ impl<'a> CellBuilder<'a> {
|
|||||||
cells.insert(field_id, insert_number_cell(num, field));
|
cells.insert(field_id, insert_number_cell(num, field));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
if let Ok(timestamp) = cell_str.parse::<i64>() {
|
if let Ok(timestamp) = cell_str.parse::<i64>() {
|
||||||
cells.insert(field_id, insert_date_cell(timestamp, Some(false), field));
|
cells.insert(field_id, insert_date_cell(timestamp, Some(false), field));
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ impl<'a> CellBuilder<'a> {
|
|||||||
for field in fields {
|
for field in fields {
|
||||||
if !cell_by_field_id.contains_key(&field.id) {
|
if !cell_by_field_id.contains_key(&field.id) {
|
||||||
let field_type = FieldType::from(field.field_type);
|
let field_type = FieldType::from(field.field_type);
|
||||||
if field_type == FieldType::UpdatedAt || field_type == FieldType::CreatedAt {
|
if field_type == FieldType::LastEditedTime || field_type == FieldType::CreatedTime {
|
||||||
cells.insert(
|
cells.insert(
|
||||||
field.id.clone(),
|
field.id.clone(),
|
||||||
insert_date_cell(timestamp(), Some(true), field),
|
insert_date_cell(timestamp(), Some(true), field),
|
||||||
|
@ -82,8 +82,8 @@ impl TypeCellData {
|
|||||||
|
|
||||||
pub fn is_date(&self) -> bool {
|
pub fn is_date(&self) -> bool {
|
||||||
self.field_type == FieldType::DateTime
|
self.field_type == FieldType::DateTime
|
||||||
|| self.field_type == FieldType::UpdatedAt
|
|| self.field_type == FieldType::LastEditedTime
|
||||||
|| self.field_type == FieldType::CreatedAt
|
|| self.field_type == FieldType::CreatedTime
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_single_select(&self) -> bool {
|
pub fn is_single_select(&self) -> bool {
|
||||||
|
@ -514,7 +514,7 @@ impl DatabaseEditor {
|
|||||||
.lock()
|
.lock()
|
||||||
.get_fields(view_id, None)
|
.get_fields(view_id, None)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|f| FieldType::from(f.field_type) == FieldType::UpdatedAt)
|
.filter(|f| FieldType::from(f.field_type) == FieldType::LastEditedTime)
|
||||||
.collect::<Vec<Field>>();
|
.collect::<Vec<Field>>();
|
||||||
|
|
||||||
self.database.lock().update_row(&row_id, |row_update| {
|
self.database.lock().update_row(&row_id, |row_update| {
|
||||||
|
@ -16,7 +16,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
/// The [DateTypeOption] is used by [FieldType::Date], [FieldType::UpdatedAt], and [FieldType::CreatedAt].
|
/// The [DateTypeOption] is used by [FieldType::Date], [FieldType::LastEditedTime], and [FieldType::CreatedTime].
|
||||||
/// So, storing the field type is necessary to distinguish the field type.
|
/// So, storing the field type is necessary to distinguish the field type.
|
||||||
/// Most of the cases, each [FieldType] has its own [TypeOption] implementation.
|
/// Most of the cases, each [FieldType] has its own [TypeOption] implementation.
|
||||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||||
|
@ -146,7 +146,7 @@ pub fn type_option_data_from_pb_or_default<T: Into<Bytes>>(
|
|||||||
FieldType::Number => {
|
FieldType::Number => {
|
||||||
NumberTypeOptionPB::try_from(bytes).map(|pb| NumberTypeOption::from(pb).into())
|
NumberTypeOptionPB::try_from(bytes).map(|pb| NumberTypeOption::from(pb).into())
|
||||||
},
|
},
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
DateTypeOptionPB::try_from(bytes).map(|pb| DateTypeOption::from(pb).into())
|
DateTypeOptionPB::try_from(bytes).map(|pb| DateTypeOption::from(pb).into())
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -181,7 +181,7 @@ pub fn type_option_to_pb(type_option: TypeOptionData, field_type: &FieldType) ->
|
|||||||
.try_into()
|
.try_into()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
},
|
},
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
let date_type_option: DateTypeOption = type_option.into();
|
let date_type_option: DateTypeOption = type_option.into();
|
||||||
DateTypeOptionPB::from(date_type_option).try_into().unwrap()
|
DateTypeOptionPB::from(date_type_option).try_into().unwrap()
|
||||||
},
|
},
|
||||||
@ -220,7 +220,7 @@ pub fn default_type_option_data_from_type(field_type: &FieldType) -> TypeOptionD
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => RichTextTypeOption::default().into(),
|
FieldType::RichText => RichTextTypeOption::default().into(),
|
||||||
FieldType::Number => NumberTypeOption::default().into(),
|
FieldType::Number => NumberTypeOption::default().into(),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => DateTypeOption {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => DateTypeOption {
|
||||||
field_type: field_type.clone(),
|
field_type: field_type.clone(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ impl<'a> TypeOptionCellExt<'a> {
|
|||||||
self.cell_data_cache.clone(),
|
self.cell_data_cache.clone(),
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => self
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => self
|
||||||
.field
|
.field
|
||||||
.get_type_option::<DateTypeOption>(field_type)
|
.get_type_option::<DateTypeOption>(field_type)
|
||||||
.map(|type_option| {
|
.map(|type_option| {
|
||||||
@ -472,7 +472,7 @@ fn get_type_option_transform_handler(
|
|||||||
FieldType::Number => {
|
FieldType::Number => {
|
||||||
Box::new(NumberTypeOption::from(type_option_data)) as Box<dyn TypeOptionTransformHandler>
|
Box::new(NumberTypeOption::from(type_option_data)) as Box<dyn TypeOptionTransformHandler>
|
||||||
},
|
},
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
Box::new(DateTypeOption::from(type_option_data)) as Box<dyn TypeOptionTransformHandler>
|
Box::new(DateTypeOption::from(type_option_data)) as Box<dyn TypeOptionTransformHandler>
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => Box::new(SingleSelectTypeOption::from(type_option_data))
|
FieldType::SingleSelect => Box::new(SingleSelectTypeOption::from(type_option_data))
|
||||||
|
@ -325,7 +325,7 @@ impl FilterController {
|
|||||||
.write()
|
.write()
|
||||||
.insert(field_id, NumberFilterPB::from_filter(filter.as_ref()));
|
.insert(field_id, NumberFilterPB::from_filter(filter.as_ref()));
|
||||||
},
|
},
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
self
|
self
|
||||||
.cell_filter_cache
|
.cell_filter_cache
|
||||||
.write()
|
.write()
|
||||||
|
@ -15,7 +15,7 @@ async fn created_at_field_test() {
|
|||||||
|
|
||||||
// Get created time of the new row.
|
// Get created time of the new row.
|
||||||
let row = test.get_rows().await.last().cloned().unwrap();
|
let row = test.get_rows().await.last().cloned().unwrap();
|
||||||
let updated_at_field = test.get_first_field(FieldType::CreatedAt);
|
let updated_at_field = test.get_first_field(FieldType::CreatedTime);
|
||||||
let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap();
|
let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap();
|
||||||
let created_at_timestamp = DateCellData::from(cell).timestamp.unwrap();
|
let created_at_timestamp = DateCellData::from(cell).timestamp.unwrap();
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ async fn created_at_field_test() {
|
|||||||
async fn update_at_field_test() {
|
async fn update_at_field_test() {
|
||||||
let mut test = DatabaseRowTest::new().await;
|
let mut test = DatabaseRowTest::new().await;
|
||||||
let row = test.get_rows().await.remove(0);
|
let row = test.get_rows().await.remove(0);
|
||||||
let updated_at_field = test.get_first_field(FieldType::UpdatedAt);
|
let updated_at_field = test.get_first_field(FieldType::LastEditedTime);
|
||||||
let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap();
|
let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap();
|
||||||
let old_updated_at = DateCellData::from(cell).timestamp.unwrap();
|
let old_updated_at = DateCellData::from(cell).timestamp.unwrap();
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ async fn update_at_field_test() {
|
|||||||
|
|
||||||
// Get the updated time of the row.
|
// Get the updated time of the row.
|
||||||
let row = test.get_rows().await.remove(0);
|
let row = test.get_rows().await.remove(0);
|
||||||
let updated_at_field = test.get_first_field(FieldType::UpdatedAt);
|
let updated_at_field = test.get_first_field(FieldType::LastEditedTime);
|
||||||
let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap();
|
let cell = row.cells.cell_for_field_id(&updated_at_field.id).unwrap();
|
||||||
let new_updated_at = DateCellData::from(cell).timestamp.unwrap();
|
let new_updated_at = DateCellData::from(cell).timestamp.unwrap();
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ async fn grid_cell_update() {
|
|||||||
let cell_changeset = match field_type {
|
let cell_changeset = match field_type {
|
||||||
FieldType::RichText => "".to_string(),
|
FieldType::RichText => "".to_string(),
|
||||||
FieldType::Number => "123".to_string(),
|
FieldType::Number => "123".to_string(),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
make_date_cell_string("123")
|
make_date_cell_string("123")
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -108,7 +108,7 @@ async fn url_cell_data_test() {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn update_updated_at_field_on_other_cell_update() {
|
async fn update_updated_at_field_on_other_cell_update() {
|
||||||
let mut test = DatabaseCellTest::new().await;
|
let mut test = DatabaseCellTest::new().await;
|
||||||
let updated_at_field = test.get_first_field(FieldType::UpdatedAt);
|
let updated_at_field = test.get_first_field(FieldType::LastEditedTime);
|
||||||
|
|
||||||
let text_field = test
|
let text_field = test
|
||||||
.fields
|
.fields
|
||||||
|
@ -31,7 +31,7 @@ async fn grid_create_field() {
|
|||||||
];
|
];
|
||||||
test.run_scripts(scripts).await;
|
test.run_scripts(scripts).await;
|
||||||
|
|
||||||
let (params, field) = create_date_field(&test.view_id(), FieldType::CreatedAt);
|
let (params, field) = create_date_field(&test.view_id(), FieldType::CreatedTime);
|
||||||
let scripts = vec![
|
let scripts = vec![
|
||||||
CreateField { params },
|
CreateField { params },
|
||||||
AssertFieldTypeOptionEqual {
|
AssertFieldTypeOptionEqual {
|
||||||
|
@ -55,11 +55,11 @@ pub fn create_date_field(grid_id: &str, field_type: FieldType) -> (CreateFieldPa
|
|||||||
.name("Date")
|
.name("Date")
|
||||||
.visibility(true)
|
.visibility(true)
|
||||||
.build(),
|
.build(),
|
||||||
FieldType::UpdatedAt => FieldBuilder::new(field_type.clone(), date_type_option.clone())
|
FieldType::LastEditedTime => FieldBuilder::new(field_type.clone(), date_type_option.clone())
|
||||||
.name("Updated At")
|
.name("Updated At")
|
||||||
.visibility(true)
|
.visibility(true)
|
||||||
.build(),
|
.build(),
|
||||||
FieldType::CreatedAt => FieldBuilder::new(field_type.clone(), date_type_option.clone())
|
FieldType::CreatedTime => FieldBuilder::new(field_type.clone(), date_type_option.clone())
|
||||||
.name("Created At")
|
.name("Created At")
|
||||||
.visibility(true)
|
.visibility(true)
|
||||||
.build(),
|
.build(),
|
||||||
|
@ -37,7 +37,7 @@ pub fn make_test_board() -> DatabaseData {
|
|||||||
.build();
|
.build();
|
||||||
fields.push(number_field);
|
fields.push(number_field);
|
||||||
},
|
},
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
// Date
|
// Date
|
||||||
let date_type_option = DateTypeOption {
|
let date_type_option = DateTypeOption {
|
||||||
date_format: DateFormat::US,
|
date_format: DateFormat::US,
|
||||||
@ -47,8 +47,8 @@ pub fn make_test_board() -> DatabaseData {
|
|||||||
};
|
};
|
||||||
let name = match field_type {
|
let name = match field_type {
|
||||||
FieldType::DateTime => "Time",
|
FieldType::DateTime => "Time",
|
||||||
FieldType::UpdatedAt => "Updated At",
|
FieldType::LastEditedTime => "Updated At",
|
||||||
FieldType::CreatedAt => "Created At",
|
FieldType::CreatedTime => "Created At",
|
||||||
_ => "",
|
_ => "",
|
||||||
};
|
};
|
||||||
let date_field = FieldBuilder::new(field_type.clone(), date_type_option)
|
let date_field = FieldBuilder::new(field_type.clone(), date_type_option)
|
||||||
@ -126,7 +126,7 @@ pub fn make_test_board() -> DatabaseData {
|
|||||||
FieldType::RichText => row_builder.insert_text_cell("A"),
|
FieldType::RichText => row_builder.insert_text_cell("A"),
|
||||||
FieldType::Number => row_builder.insert_number_cell("1"),
|
FieldType::Number => row_builder.insert_number_cell("1"),
|
||||||
// 1647251762 => Mar 14,2022
|
// 1647251762 => Mar 14,2022
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -146,7 +146,7 @@ pub fn make_test_board() -> DatabaseData {
|
|||||||
FieldType::RichText => row_builder.insert_text_cell("B"),
|
FieldType::RichText => row_builder.insert_text_cell("B"),
|
||||||
FieldType::Number => row_builder.insert_number_cell("2"),
|
FieldType::Number => row_builder.insert_number_cell("2"),
|
||||||
// 1647251762 => Mar 14,2022
|
// 1647251762 => Mar 14,2022
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -165,7 +165,7 @@ pub fn make_test_board() -> DatabaseData {
|
|||||||
FieldType::RichText => row_builder.insert_text_cell("C"),
|
FieldType::RichText => row_builder.insert_text_cell("C"),
|
||||||
FieldType::Number => row_builder.insert_number_cell("3"),
|
FieldType::Number => row_builder.insert_number_cell("3"),
|
||||||
// 1647251762 => Mar 14,2022
|
// 1647251762 => Mar 14,2022
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -187,7 +187,7 @@ pub fn make_test_board() -> DatabaseData {
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => row_builder.insert_text_cell("DA"),
|
FieldType::RichText => row_builder.insert_text_cell("DA"),
|
||||||
FieldType::Number => row_builder.insert_number_cell("4"),
|
FieldType::Number => row_builder.insert_number_cell("4"),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1668704685", None, None, &field_type)
|
row_builder.insert_date_cell("1668704685", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -204,7 +204,7 @@ pub fn make_test_board() -> DatabaseData {
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => row_builder.insert_text_cell("AE"),
|
FieldType::RichText => row_builder.insert_text_cell("AE"),
|
||||||
FieldType::Number => row_builder.insert_number_cell(""),
|
FieldType::Number => row_builder.insert_number_cell(""),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1668359085", None, None, &field_type)
|
row_builder.insert_date_cell("1668359085", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
|
@ -37,7 +37,7 @@ pub fn make_test_grid() -> DatabaseData {
|
|||||||
.build();
|
.build();
|
||||||
fields.push(number_field);
|
fields.push(number_field);
|
||||||
},
|
},
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
// Date
|
// Date
|
||||||
let date_type_option = DateTypeOption {
|
let date_type_option = DateTypeOption {
|
||||||
date_format: DateFormat::US,
|
date_format: DateFormat::US,
|
||||||
@ -47,8 +47,8 @@ pub fn make_test_grid() -> DatabaseData {
|
|||||||
};
|
};
|
||||||
let name = match field_type {
|
let name = match field_type {
|
||||||
FieldType::DateTime => "Time",
|
FieldType::DateTime => "Time",
|
||||||
FieldType::UpdatedAt => "Updated At",
|
FieldType::LastEditedTime => "Updated At",
|
||||||
FieldType::CreatedAt => "Created At",
|
FieldType::CreatedTime => "Created At",
|
||||||
_ => "",
|
_ => "",
|
||||||
};
|
};
|
||||||
let date_field = FieldBuilder::new(field_type.clone(), date_type_option)
|
let date_field = FieldBuilder::new(field_type.clone(), date_type_option)
|
||||||
@ -124,7 +124,7 @@ pub fn make_test_grid() -> DatabaseData {
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => row_builder.insert_text_cell("A"),
|
FieldType::RichText => row_builder.insert_text_cell("A"),
|
||||||
FieldType::Number => row_builder.insert_number_cell("1"),
|
FieldType::Number => row_builder.insert_number_cell("1"),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::MultiSelect => row_builder
|
FieldType::MultiSelect => row_builder
|
||||||
@ -145,7 +145,7 @@ pub fn make_test_grid() -> DatabaseData {
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => row_builder.insert_text_cell(""),
|
FieldType::RichText => row_builder.insert_text_cell(""),
|
||||||
FieldType::Number => row_builder.insert_number_cell("2"),
|
FieldType::Number => row_builder.insert_number_cell("2"),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::MultiSelect => row_builder
|
FieldType::MultiSelect => row_builder
|
||||||
@ -160,7 +160,7 @@ pub fn make_test_grid() -> DatabaseData {
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => row_builder.insert_text_cell("C"),
|
FieldType::RichText => row_builder.insert_text_cell("C"),
|
||||||
FieldType::Number => row_builder.insert_number_cell("3"),
|
FieldType::Number => row_builder.insert_number_cell("3"),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
row_builder.insert_date_cell("1647251762", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -179,7 +179,7 @@ pub fn make_test_grid() -> DatabaseData {
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => row_builder.insert_text_cell("DA"),
|
FieldType::RichText => row_builder.insert_text_cell("DA"),
|
||||||
FieldType::Number => row_builder.insert_number_cell("14"),
|
FieldType::Number => row_builder.insert_number_cell("14"),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1668704685", None, None, &field_type)
|
row_builder.insert_date_cell("1668704685", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -195,7 +195,7 @@ pub fn make_test_grid() -> DatabaseData {
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => row_builder.insert_text_cell("AE"),
|
FieldType::RichText => row_builder.insert_text_cell("AE"),
|
||||||
FieldType::Number => row_builder.insert_number_cell(""),
|
FieldType::Number => row_builder.insert_number_cell(""),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1668359085", None, None, &field_type)
|
row_builder.insert_date_cell("1668359085", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
@ -212,7 +212,7 @@ pub fn make_test_grid() -> DatabaseData {
|
|||||||
match field_type {
|
match field_type {
|
||||||
FieldType::RichText => row_builder.insert_text_cell("AE"),
|
FieldType::RichText => row_builder.insert_text_cell("AE"),
|
||||||
FieldType::Number => row_builder.insert_number_cell("5"),
|
FieldType::Number => row_builder.insert_number_cell("5"),
|
||||||
FieldType::DateTime | FieldType::UpdatedAt | FieldType::CreatedAt => {
|
FieldType::DateTime | FieldType::LastEditedTime | FieldType::CreatedTime => {
|
||||||
row_builder.insert_date_cell("1671938394", None, None, &field_type)
|
row_builder.insert_date_cell("1671938394", None, None, &field_type)
|
||||||
},
|
},
|
||||||
FieldType::SingleSelect => {
|
FieldType::SingleSelect => {
|
||||||
|
@ -96,8 +96,8 @@ async fn export_and_then_import_meta_csv_test() {
|
|||||||
FieldType::Checkbox => {},
|
FieldType::Checkbox => {},
|
||||||
FieldType::URL => {},
|
FieldType::URL => {},
|
||||||
FieldType::Checklist => {},
|
FieldType::Checklist => {},
|
||||||
FieldType::UpdatedAt => {},
|
FieldType::LastEditedTime => {},
|
||||||
FieldType::CreatedAt => {},
|
FieldType::CreatedTime => {},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic!(
|
panic!(
|
||||||
@ -177,8 +177,8 @@ async fn history_database_import_test() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
FieldType::Checklist => {},
|
FieldType::Checklist => {},
|
||||||
FieldType::UpdatedAt => {},
|
FieldType::LastEditedTime => {},
|
||||||
FieldType::CreatedAt => {},
|
FieldType::CreatedTime => {},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic!(
|
panic!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user