2022-03-16 21:19:51 +08:00
|
|
|
use flowy_derive::ProtoBuf_Enum;
|
2023-01-26 15:40:23 +08:00
|
|
|
use flowy_notification::NotificationBuilder;
|
2022-03-16 21:19:51 +08:00
|
|
|
const OBSERVABLE_CATEGORY: &str = "Grid";
|
|
|
|
|
|
|
|
#[derive(ProtoBuf_Enum, Debug)]
|
2023-01-27 22:57:23 +08:00
|
|
|
pub enum GridNotification {
|
2022-03-16 21:19:51 +08:00
|
|
|
Unknown = 0,
|
2022-04-03 22:22:54 +08:00
|
|
|
DidCreateBlock = 11,
|
2022-12-09 20:03:39 +08:00
|
|
|
DidUpdateGridViewRows = 20,
|
|
|
|
DidUpdateGridViewRowsVisibility = 21,
|
|
|
|
DidUpdateGridFields = 22,
|
2022-04-05 22:46:23 +08:00
|
|
|
DidUpdateRow = 30,
|
2022-04-17 09:46:38 +08:00
|
|
|
DidUpdateCell = 40,
|
|
|
|
DidUpdateField = 50,
|
2022-08-21 13:56:06 +08:00
|
|
|
DidUpdateGroupView = 60,
|
|
|
|
DidUpdateGroup = 61,
|
2022-09-02 21:34:00 +08:00
|
|
|
DidGroupByNewField = 62,
|
2022-11-15 23:17:01 +08:00
|
|
|
DidUpdateFilter = 63,
|
2022-12-12 15:29:33 +08:00
|
|
|
DidUpdateSort = 64,
|
2022-12-26 20:28:18 +08:00
|
|
|
DidReorderRows = 65,
|
|
|
|
DidReorderSingleRow = 66,
|
2022-09-03 16:47:58 +08:00
|
|
|
DidUpdateGridSetting = 70,
|
2022-03-16 21:19:51 +08:00
|
|
|
}
|
|
|
|
|
2023-01-27 22:57:23 +08:00
|
|
|
impl std::default::Default for GridNotification {
|
2022-03-16 21:19:51 +08:00
|
|
|
fn default() -> Self {
|
2023-01-27 22:57:23 +08:00
|
|
|
GridNotification::Unknown
|
2022-03-16 21:19:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-27 22:57:23 +08:00
|
|
|
impl std::convert::From<GridNotification> for i32 {
|
|
|
|
fn from(notification: GridNotification) -> Self {
|
2022-03-16 21:19:51 +08:00
|
|
|
notification as i32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tracing::instrument(level = "trace")]
|
2023-01-27 22:57:23 +08:00
|
|
|
pub fn send_notification(id: &str, ty: GridNotification) -> NotificationBuilder {
|
2023-01-26 15:40:23 +08:00
|
|
|
NotificationBuilder::new(id, ty, OBSERVABLE_CATEGORY)
|
2022-03-16 21:19:51 +08:00
|
|
|
}
|