pub struct ConfigTabState {
pub selected_scope: ConfigScope,
pub scope_projects: Vec<String>,
pub scope_has_config: HashMap<String, bool>,
pub cached_global_config: Option<Config>,
pub global_config_error: Option<String>,
pub cached_project_config: Option<(String, Config)>,
pub project_config_error: Option<String>,
pub last_modified: Option<Instant>,
}Expand description
State for the Config tab.
This struct holds all the state needed for the Config tab, including the currently selected scope, cached configurations, and UI state.
Fields§
§selected_scope: ConfigScopeCurrently selected config scope in the Config tab. Defaults to Global when the Config tab is first opened.
scope_projects: Vec<String>Cached list of project names for the config scope selector.
Loaded from ~/.config/autom8/*/ directories.
scope_has_config: HashMap<String, bool>Cached information about which projects have their own config file.
Maps project name to whether it has a config.toml file.
cached_global_config: Option<Config>Cached global configuration for editing.
Loaded via config::load_global_config() when Global scope is selected.
global_config_error: Option<String>Error message if global config failed to load.
cached_project_config: Option<(String, Config)>Cached project configuration for editing. Loaded when a project with its own config file is selected. Key is the project name, value is the loaded config.
project_config_error: Option<String>Error message if project config failed to load.
last_modified: Option<Instant>Timestamp of the last config modification. Used to show the “Changes take effect on next run” notice. Set to Some(Instant) when a config field is modified, cleared after timeout.
Implementations§
Source§impl ConfigTabState
impl ConfigTabState
Sourcepub fn selected_scope(&self) -> &ConfigScope
pub fn selected_scope(&self) -> &ConfigScope
Returns the currently selected config scope.
Sourcepub fn set_selected_scope(&mut self, scope: ConfigScope)
pub fn set_selected_scope(&mut self, scope: ConfigScope)
Sets the selected config scope.
Sourcepub fn scope_projects(&self) -> &[String]
pub fn scope_projects(&self) -> &[String]
Returns the cached list of project names for config scope selection.
Sourcepub fn project_has_config(&self, project_name: &str) -> bool
pub fn project_has_config(&self, project_name: &str) -> bool
Returns whether a project has its own config file.
Sourcepub fn refresh_scope_data(&mut self)
pub fn refresh_scope_data(&mut self)
Refresh the config scope data (project list and config file status). Called when the Config tab is rendered or data needs to be refreshed.
Sourcepub fn load_global_config(&mut self)
pub fn load_global_config(&mut self)
Load the global configuration from disk. Called when Global scope is selected in the Config tab.
Sourcepub fn cached_global_config(&self) -> Option<&Config>
pub fn cached_global_config(&self) -> Option<&Config>
Returns the cached global config, if loaded.
Sourcepub fn global_config_error(&self) -> Option<&str>
pub fn global_config_error(&self) -> Option<&str>
Returns the global config error, if any.
Sourcepub fn cached_project_config(&self, project_name: &str) -> Option<&Config>
pub fn cached_project_config(&self, project_name: &str) -> Option<&Config>
Returns the cached project config for a specific project, if loaded.
Sourcepub fn project_config_error(&self) -> Option<&str>
pub fn project_config_error(&self) -> Option<&str>
Returns the project config error, if any.
Sourcepub fn load_project_config(&mut self, project_name: &str)
pub fn load_project_config(&mut self, project_name: &str)
Load project configuration for a specific project.
Sourcepub fn create_project_config_from_global(
&mut self,
project_name: &str,
) -> Result<(), String>
pub fn create_project_config_from_global( &mut self, project_name: &str, ) -> Result<(), String>
Create a project config from the global config (US-005).
Copies the global configuration values to create a new project-specific config file, then updates the UI state to reflect the new config.
Sourcepub fn apply_bool_changes(
&mut self,
is_global: bool,
project_name: Option<&str>,
changes: &[(ConfigBoolField, bool)],
)
pub fn apply_bool_changes( &mut self, is_global: bool, project_name: Option<&str>, changes: &[(ConfigBoolField, bool)], )
Apply boolean field changes to the config (US-006).
Sourcepub fn apply_text_changes(
&mut self,
is_global: bool,
project_name: Option<&str>,
changes: &[(ConfigTextField, String)],
)
pub fn apply_text_changes( &mut self, is_global: bool, project_name: Option<&str>, changes: &[(ConfigTextField, String)], )
Apply text field changes to the config (US-007).
Sourcepub fn reset_to_defaults(&mut self, is_global: bool, project_name: Option<&str>)
pub fn reset_to_defaults(&mut self, is_global: bool, project_name: Option<&str>)
Reset config to application defaults (US-009).
Replaces the current config with Config::default() values:
- review = true
- commit = true
- pull_request = true
- worktree = true
- worktree_path_pattern = “{repo}-wt-{branch}”
- worktree_cleanup = false
The config is saved immediately and the UI updates to reflect the new values.
Trait Implementations§
Source§impl Debug for ConfigTabState
impl Debug for ConfigTabState
Source§impl Default for ConfigTabState
impl Default for ConfigTabState
Source§fn default() -> ConfigTabState
fn default() -> ConfigTabState
Auto Trait Implementations§
impl Freeze for ConfigTabState
impl RefUnwindSafe for ConfigTabState
impl Send for ConfigTabState
impl Sync for ConfigTabState
impl Unpin for ConfigTabState
impl UnwindSafe for ConfigTabState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more