Skip to main content

ConfigTabState

Struct ConfigTabState 

Source
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: ConfigScope

Currently 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

Source

pub fn new() -> Self

Create a new ConfigTabState with default values.

Source

pub fn selected_scope(&self) -> &ConfigScope

Returns the currently selected config scope.

Source

pub fn set_selected_scope(&mut self, scope: ConfigScope)

Sets the selected config scope.

Source

pub fn scope_projects(&self) -> &[String]

Returns the cached list of project names for config scope selection.

Source

pub fn project_has_config(&self, project_name: &str) -> bool

Returns whether a project has its own config file.

Source

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.

Source

pub fn load_global_config(&mut self)

Load the global configuration from disk. Called when Global scope is selected in the Config tab.

Source

pub fn cached_global_config(&self) -> Option<&Config>

Returns the cached global config, if loaded.

Source

pub fn global_config_error(&self) -> Option<&str>

Returns the global config error, if any.

Source

pub fn cached_project_config(&self, project_name: &str) -> Option<&Config>

Returns the cached project config for a specific project, if loaded.

Source

pub fn project_config_error(&self) -> Option<&str>

Returns the project config error, if any.

Source

pub fn load_project_config(&mut self, project_name: &str)

Load project configuration for a specific project.

Source

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.

Source

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).

Source

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).

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConfigTabState

Source§

fn default() -> ConfigTabState

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more