Class: Karafka::Web::Ui::Models::Status::Step
- Inherits:
-
Struct
- Object
- Struct
- Karafka::Web::Ui::Models::Status::Step
- Defined in:
- lib/karafka/web/ui/models/status/step.rb
Overview
Represents the result of a single status check step.
Each check in the status flow returns a Step that contains:
-
The status of the check (:success, :warning, :failure, or :halted)
-
Optional details hash with check-specific information
Instance Attribute Summary collapse
-
#details ⇒ Object
Returns the value of attribute details.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#partial_namespace ⇒ String
Returns the partial namespace for rendering the appropriate view.
-
#success? ⇒ Boolean
Checks if the step completed successfully (allows chain to continue).
-
#to_s ⇒ String
Returns the string representation of the status.
Instance Attribute Details
#details ⇒ Object
Returns the value of attribute details
19 20 21 |
# File 'lib/karafka/web/ui/models/status/step.rb', line 19 def details @details end |
#status ⇒ Object
Returns the value of attribute status
19 20 21 |
# File 'lib/karafka/web/ui/models/status/step.rb', line 19 def status @status end |
Instance Method Details
#partial_namespace ⇒ String
Returns the partial namespace for rendering the appropriate view.
Maps the status to a directory name used for view partial lookup:
-
:success -> ‘successes’
-
:warning -> ‘warnings’
-
:failure -> ‘failures’
-
:halted -> ‘failures’ (halted checks show failure partial)
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/karafka/web/ui/models/status/step.rb', line 40 def partial_namespace case status when :success then "successes" when :warning then "warnings" when :failure then "failures" when :halted then "failures" else raise ::Karafka::Errors::UnsupportedCaseError, status end end |
#success? ⇒ Boolean
Checks if the step completed successfully (allows chain to continue).
Both :success and :warning are considered successful because warnings don’t block the dependency chain - they just notify about potential issues.
26 27 28 |
# File 'lib/karafka/web/ui/models/status/step.rb', line 26 def success? %i[success warning].include?(status) end |
#to_s ⇒ String
Returns the string representation of the status.
Used by views to dynamically select the appropriate partial template.
56 57 58 |
# File 'lib/karafka/web/ui/models/status/step.rb', line 56 def to_s status.to_s end |