diff --git a/src/components/command.rs b/src/components/command.rs index 1ef72c4..961b8c6 100644 --- a/src/components/command.rs +++ b/src/components/command.rs @@ -3,6 +3,7 @@ use crate::config::KeyConfig; static CMD_GROUP_GENERAL: &str = "-- General --"; static CMD_GROUP_TABLE: &str = "-- Table --"; static CMD_GROUP_DATABASES: &str = "-- Databases --"; +static CMD_GROUP_PROPERTIES: &str = "-- Properties --"; #[derive(Clone, PartialEq, PartialOrd, Ord, Eq)] pub struct CommandText { @@ -145,14 +146,23 @@ pub fn tab_properties(key: &KeyConfig) -> CommandText { pub fn toggle_tabs(key_config: &KeyConfig) -> CommandText { CommandText::new( format!( - "Tab [{},{},{},{},{}]", - key_config.tab_records, + "Tab [{},{},{}]", + key_config.tab_records, key_config.tab_properties, key_config.tab_sql_editor + ), + CMD_GROUP_GENERAL, + ) +} + +pub fn toggle_property_tabs(key_config: &KeyConfig) -> CommandText { + CommandText::new( + format!( + "Tab [{},{},{},{}]", key_config.tab_columns, key_config.tab_constraints, key_config.tab_foreign_keys, key_config.tab_indexes ), - CMD_GROUP_GENERAL, + CMD_GROUP_PROPERTIES, ) } diff --git a/src/components/properties.rs b/src/components/properties.rs index bfdcdef..5c9299d 100644 --- a/src/components/properties.rs +++ b/src/components/properties.rs @@ -121,11 +121,6 @@ impl PropertiesComponent { Ok(()) } - pub fn reset(&mut self) { - // self.table.reset(); - // self.filter.reset(); - } - fn tab_names(&self) -> Vec<(Focus, String)> { vec![ (Focus::Column, command::tab_columns(&self.key_config).name), @@ -178,7 +173,11 @@ impl StatefulDrawableComponent for PropertiesComponent { #[async_trait] impl Component for PropertiesComponent { - fn commands(&self, out: &mut Vec) {} + fn commands(&self, out: &mut Vec) { + out.push(CommandInfo::new(command::toggle_property_tabs( + &self.key_config, + ))); + } fn event(&mut self, key: Key) -> Result { self.focused_component().event(key)?;