add properties group

pull/128/head
Takayuki Maeda 3 years ago
parent 89af49af61
commit e445c258c2

@ -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,
)
}

@ -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<CommandInfo>) {}
fn commands(&self, out: &mut Vec<CommandInfo>) {
out.push(CommandInfo::new(command::toggle_property_tabs(
&self.key_config,
)));
}
fn event(&mut self, key: Key) -> Result<EventState> {
self.focused_component().event(key)?;

Loading…
Cancel
Save