41 lines
1.1 KiB
Rust
Raw Normal View History

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