|
@@ -1,25 +1,24 @@
|
|
use crate::entities::parser::NotEmptyStr;
|
|
use crate::entities::parser::NotEmptyStr;
|
|
use crate::entities::{
|
|
use crate::entities::{
|
|
- AlterFilterParams, AlterFilterPayloadPB, AlterSortParams, AlterSortPayloadPB, DeleteFilterParams,
|
|
|
|
- DeleteFilterPayloadPB, DeleteGroupParams, DeleteGroupPayloadPB, DeleteSortParams,
|
|
|
|
- DeleteSortPayloadPB, InsertGroupParams, InsertGroupPayloadPB, RepeatedFilterPB,
|
|
|
|
|
|
+ AlterFilterParams, AlterFilterPayloadPB, AlterSortParams, AlterSortPayloadPB, CalendarSettingsPB,
|
|
|
|
+ DeleteFilterParams, DeleteFilterPayloadPB, DeleteGroupParams, DeleteGroupPayloadPB,
|
|
|
|
+ DeleteSortParams, DeleteSortPayloadPB, InsertGroupParams, InsertGroupPayloadPB, RepeatedFilterPB,
|
|
RepeatedGroupConfigurationPB, RepeatedSortPB,
|
|
RepeatedGroupConfigurationPB, RepeatedSortPB,
|
|
};
|
|
};
|
|
use database_model::LayoutRevision;
|
|
use database_model::LayoutRevision;
|
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
|
use flowy_error::ErrorCode;
|
|
use flowy_error::ErrorCode;
|
|
use std::convert::TryInto;
|
|
use std::convert::TryInto;
|
|
-use strum::IntoEnumIterator;
|
|
|
|
use strum_macros::EnumIter;
|
|
use strum_macros::EnumIter;
|
|
|
|
|
|
/// [DatabaseViewSettingPB] defines the setting options for the grid. Such as the filter, group, and sort.
|
|
/// [DatabaseViewSettingPB] defines the setting options for the grid. Such as the filter, group, and sort.
|
|
#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]
|
|
#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]
|
|
pub struct DatabaseViewSettingPB {
|
|
pub struct DatabaseViewSettingPB {
|
|
#[pb(index = 1)]
|
|
#[pb(index = 1)]
|
|
- pub support_layouts: Vec<ViewLayoutPB>,
|
|
|
|
|
|
+ pub current_layout: LayoutTypePB,
|
|
|
|
|
|
#[pb(index = 2)]
|
|
#[pb(index = 2)]
|
|
- pub current_layout: LayoutTypePB,
|
|
|
|
|
|
+ pub layout_setting: LayoutSettingPB,
|
|
|
|
|
|
#[pb(index = 3)]
|
|
#[pb(index = 3)]
|
|
pub filters: RepeatedFilterPB,
|
|
pub filters: RepeatedFilterPB,
|
|
@@ -31,23 +30,6 @@ pub struct DatabaseViewSettingPB {
|
|
pub sorts: RepeatedSortPB,
|
|
pub sorts: RepeatedSortPB,
|
|
}
|
|
}
|
|
|
|
|
|
-#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]
|
|
|
|
-pub struct ViewLayoutPB {
|
|
|
|
- #[pb(index = 1)]
|
|
|
|
- ty: LayoutTypePB,
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-impl ViewLayoutPB {
|
|
|
|
- pub fn all() -> Vec<ViewLayoutPB> {
|
|
|
|
- let mut layouts = vec![];
|
|
|
|
- for layout_ty in LayoutTypePB::iter() {
|
|
|
|
- layouts.push(ViewLayoutPB { ty: layout_ty })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- layouts
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum, EnumIter)]
|
|
#[derive(Debug, Clone, PartialEq, Eq, ProtoBuf_Enum, EnumIter)]
|
|
#[repr(u8)]
|
|
#[repr(u8)]
|
|
pub enum LayoutTypePB {
|
|
pub enum LayoutTypePB {
|
|
@@ -176,3 +158,15 @@ impl DatabaseSettingChangesetParams {
|
|
self.insert_filter.is_some() || self.delete_filter.is_some()
|
|
self.insert_filter.is_some() || self.delete_filter.is_some()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+#[derive(Debug, Eq, PartialEq, Default, ProtoBuf, Clone)]
|
|
|
|
+pub struct LayoutSettingPB {
|
|
|
|
+ #[pb(index = 1, one_of)]
|
|
|
|
+ pub calendar: Option<CalendarSettingsPB>,
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+impl LayoutSettingPB {
|
|
|
|
+ pub fn new() -> Self {
|
|
|
|
+ Self::default()
|
|
|
|
+ }
|
|
|
|
+}
|