diff --git a/src/presentation/controllers/create/subcommands/environment/errors.rs b/src/presentation/controllers/create/subcommands/environment/errors.rs index 9afeabbd..d6284892 100644 --- a/src/presentation/controllers/create/subcommands/environment/errors.rs +++ b/src/presentation/controllers/create/subcommands/environment/errors.rs @@ -8,7 +8,7 @@ use std::path::PathBuf; use thiserror::Error; use crate::application::command_handlers::create::CreateCommandHandlerError; -use crate::presentation::progress::ProgressReporterError; +use crate::presentation::views::progress::ProgressReporterError; /// Format of configuration file #[derive(Debug, Clone, Copy)] diff --git a/src/presentation/controllers/create/subcommands/environment/handler.rs b/src/presentation/controllers/create/subcommands/environment/handler.rs index 45ad0a9d..65e3ab84 100644 --- a/src/presentation/controllers/create/subcommands/environment/handler.rs +++ b/src/presentation/controllers/create/subcommands/environment/handler.rs @@ -14,7 +14,7 @@ use crate::application::command_handlers::CreateCommandHandler; use crate::domain::environment::state::Created; use crate::domain::Environment; use crate::infrastructure::persistence::repository_factory::RepositoryFactory; -use crate::presentation::progress::ProgressReporter; +use crate::presentation::views::progress::ProgressReporter; use crate::presentation::views::UserOutput; use crate::shared::clock::Clock; diff --git a/src/presentation/controllers/create/subcommands/template/errors.rs b/src/presentation/controllers/create/subcommands/template/errors.rs index fe136261..cdd7c831 100644 --- a/src/presentation/controllers/create/subcommands/template/errors.rs +++ b/src/presentation/controllers/create/subcommands/template/errors.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; use thiserror::Error; -use crate::presentation::progress::ProgressReporterError; +use crate::presentation::views::progress::ProgressReporterError; /// Errors that can occur during template generation commands /// diff --git a/src/presentation/controllers/create/subcommands/template/handler.rs b/src/presentation/controllers/create/subcommands/template/handler.rs index 8571927d..7e420ea1 100644 --- a/src/presentation/controllers/create/subcommands/template/handler.rs +++ b/src/presentation/controllers/create/subcommands/template/handler.rs @@ -10,7 +10,7 @@ use std::sync::Arc; use parking_lot::ReentrantMutex; use crate::application::command_handlers::create::config::EnvironmentCreationConfig; -use crate::presentation::progress::ProgressReporter; +use crate::presentation::views::progress::ProgressReporter; use crate::presentation::views::UserOutput; use super::errors::CreateEnvironmentTemplateCommandError; diff --git a/src/presentation/controllers/destroy/errors.rs b/src/presentation/controllers/destroy/errors.rs index 8fc606a8..b9f78e5a 100644 --- a/src/presentation/controllers/destroy/errors.rs +++ b/src/presentation/controllers/destroy/errors.rs @@ -8,7 +8,7 @@ use thiserror::Error; use crate::application::command_handlers::destroy::DestroyCommandHandlerError; use crate::domain::environment::name::EnvironmentNameError; -use crate::presentation::progress::ProgressReporterError; +use crate::presentation::views::progress::ProgressReporterError; /// Destroy command specific errors /// diff --git a/src/presentation/controllers/destroy/handler.rs b/src/presentation/controllers/destroy/handler.rs index d058ee0b..331f7ec8 100644 --- a/src/presentation/controllers/destroy/handler.rs +++ b/src/presentation/controllers/destroy/handler.rs @@ -14,7 +14,7 @@ use crate::domain::environment::repository::EnvironmentRepository; use crate::domain::environment::state::Destroyed; use crate::domain::environment::Environment; use crate::infrastructure::persistence::repository_factory::RepositoryFactory; -use crate::presentation::progress::ProgressReporter; +use crate::presentation::views::progress::ProgressReporter; use crate::presentation::views::UserOutput; use crate::shared::clock::Clock; diff --git a/src/presentation/mod.rs b/src/presentation/mod.rs index d824d36a..7f63f6e8 100644 --- a/src/presentation/mod.rs +++ b/src/presentation/mod.rs @@ -66,8 +66,8 @@ //! │ └── mod.rs # Controller layer exports //! │ //! ├── views/ # ✅ Views Layer - Output formatting and presentation +//! │ ├── progress/ # ✅ Progress indicators (moved from root) //! │ └── ... # User interface output and formatting -//! ├── progress.rs # ⏳ Will move to views/progress/ //! ├── errors.rs # Unified error types for all commands //! └── mod.rs # This file - layer exports and documentation //! ``` @@ -150,11 +150,11 @@ //! //! With the Controllers layer complete, the next phase focuses on organizing the Views layer: //! -//! 1. **Rename `user_output/` to `views/`**: Align with MVC terminology -//! 2. **Organize view submodules**: Group related presentation concerns -//! 3. **Move `progress.rs` to `views/progress/`**: Place progress indicators with other views -//! 4. **Implement theme system**: Structured output formatting and customization -//! 5. **Channel separation**: Proper stdout/stderr management for Unix conventions +//! 1. ✅ **Rename `user_output/` to `views/`**: Align with MVC terminology +//! 2. ✅ **Organize view submodules**: Group related presentation concerns +//! 3. ✅ **Move `progress.rs` to `views/progress/`**: Place progress indicators with other views +//! 4. ✅ **Implement theme system**: Structured output formatting and customization +//! 5. ✅ **Channel separation**: Proper stdout/stderr management for Unix conventions //! //! After Proposal #4, the final steps will be: //! - **Proposal #5**: Enhanced error presentation and help system integration @@ -173,7 +173,6 @@ pub mod dispatch; pub mod error; pub mod errors; pub mod input; -pub mod progress; pub mod views; // Re-export commonly used presentation types for convenience @@ -187,7 +186,7 @@ pub use error::handle_error; pub use errors::CommandError; pub use input::{Cli, Commands, GlobalArgs}; -pub use progress::ProgressReporter; +pub use views::progress::ProgressReporter; pub use views::{Theme, UserOutput, VerbosityLevel}; #[cfg(test)] diff --git a/src/presentation/tests/reentrancy_fix_test.rs b/src/presentation/tests/reentrancy_fix_test.rs index 4dd8c7a8..f7537743 100644 --- a/src/presentation/tests/reentrancy_fix_test.rs +++ b/src/presentation/tests/reentrancy_fix_test.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use parking_lot::ReentrantMutex; -use crate::presentation::progress::ProgressReporter; +use crate::presentation::views::progress::ProgressReporter; use crate::presentation::views::{UserOutput, VerbosityLevel}; /// Test to verify that `ReentrantMutex` fixes the reentrancy deadlock issue #164 diff --git a/src/presentation/views/mod.rs b/src/presentation/views/mod.rs index 1674d10d..19d7ce67 100644 --- a/src/presentation/views/mod.rs +++ b/src/presentation/views/mod.rs @@ -60,6 +60,10 @@ //! - **stdout**: Deployment results, configuration summaries, structured data (JSON) //! - **stderr**: Step progress, status updates, warnings, error messages with actionable guidance //! +//! ## Progress Indicators +//! +//! The [`progress`] module provides components for displaying real-time progress during long operations. +//! //! See also: [`docs/research/UX/user-output-vs-logging-separation.md`](../../docs/research/UX/user-output-vs-logging-separation.md) // Re-export core types and traits for backward compatibility @@ -85,5 +89,8 @@ mod theme; mod traits; mod verbosity; +// Progress indicators module (moved from presentation root for clear ownership) +pub mod progress; + // Test support module (public for use in tests across the codebase) pub mod test_support; diff --git a/src/presentation/progress.rs b/src/presentation/views/progress/mod.rs similarity index 96% rename from src/presentation/progress.rs rename to src/presentation/views/progress/mod.rs index bc8cd773..b6b5a465 100644 --- a/src/presentation/progress.rs +++ b/src/presentation/views/progress/mod.rs @@ -18,7 +18,7 @@ //! use std::sync::Arc; //! use std::cell::RefCell; //! use parking_lot::ReentrantMutex; -//! use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; +//! use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; //! use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; //! //! # fn main() -> Result<(), Box> { @@ -99,7 +99,7 @@ Tip: This is a critical bug - please report it with full logs using --log-output /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; -/// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; +/// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// # fn main() -> Result<(), Box> { @@ -137,7 +137,7 @@ impl ProgressReporter { /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; - /// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; + /// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// let output = Arc::new(ReentrantMutex::new(RefCell::new(UserOutput::new(VerbosityLevel::Normal)))); @@ -187,7 +187,7 @@ impl ProgressReporter { /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; - /// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; + /// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// # fn main() -> Result<(), Box> { @@ -232,7 +232,7 @@ impl ProgressReporter { /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; - /// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; + /// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// # fn main() -> Result<(), Box> { @@ -284,7 +284,7 @@ impl ProgressReporter { /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; - /// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; + /// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// # fn main() -> Result<(), Box> { @@ -325,7 +325,7 @@ impl ProgressReporter { /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; - /// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; + /// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// # fn main() -> Result<(), Box> { @@ -355,7 +355,7 @@ impl ProgressReporter { /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; - /// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; + /// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// let output = Arc::new(ReentrantMutex::new(RefCell::new(UserOutput::new(VerbosityLevel::Normal)))); @@ -386,7 +386,7 @@ impl ProgressReporter { /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; - /// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; + /// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// # fn main() -> Result<(), Box> { @@ -423,7 +423,7 @@ impl ProgressReporter { /// use std::sync::Arc; /// use std::cell::RefCell; /// use parking_lot::ReentrantMutex; - /// use torrust_tracker_deployer_lib::presentation::progress::ProgressReporter; + /// use torrust_tracker_deployer_lib::presentation::views::progress::ProgressReporter; /// use torrust_tracker_deployer_lib::presentation::views::{UserOutput, VerbosityLevel}; /// /// # fn main() -> Result<(), Box> {