Class: UffizziCore::Api::Cli::V1::Projects::DeploymentSerializer
- Inherits:
-
BaseSerializer
- Object
- BaseSerializer
- UffizziCore::Api::Cli::V1::Projects::DeploymentSerializer
- Defined in:
- app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb
Instance Method Summary collapse
- #branch ⇒ Object
- #commit ⇒ Object
- #containers ⇒ Object
- #deployed_by ⇒ Object
- #image_id ⇒ Object
- #ingress_container_ready ⇒ Object
- #ingress_container_state ⇒ Object
- #preview_url ⇒ Object
- #state_from_activity_items ⇒ Object
- #tag ⇒ Object
Instance Method Details
#branch ⇒ Object
41 42 43 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 41 def branch object.ingress_container&.repo&.branch end |
#commit ⇒ Object
45 46 47 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 45 def commit object.ingress_container&.repo&.builds&.deployed&.last&.commit.to_s.slice(0..5) end |
#containers ⇒ Object
29 30 31 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 29 def containers object.containers.active end |
#deployed_by ⇒ Object
25 26 27 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 25 def deployed_by object.deployed_by end |
#image_id ⇒ Object
49 50 51 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 49 def image_id object.ingress_container&.repo&.name end |
#ingress_container_ready ⇒ Object
53 54 55 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 53 def ingress_container_ready !!object.ingress_container&.activity_items&.last&.events&.last&.deployed? end |
#ingress_container_state ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 57 def ingress_container_state last_event = object.ingress_container&.activity_items&.last&.events&.last case last_event&.state when UffizziCore::Event.state.deployed :deployed when UffizziCore::Event.state.failed, UffizziCore::Event.state.timeout, UffizziCore::Event.state.cancelled :failed else state_from_activity_items end end |
#preview_url ⇒ Object
33 34 35 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 33 def preview_url UffizziCore::DeploymentService.build_preview_url(object) end |
#state_from_activity_items ⇒ Object
70 71 72 73 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 70 def state_from_activity_items activity_items_count = object.ingress_container&.activity_items&.count activity_items_count.to_i > 1 ? :updating : :pending end |
#tag ⇒ Object
37 38 39 |
# File 'app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb', line 37 def tag object.ingress_container&.tag end |