From: Jan Provaznik <jprovazn(a)redhat.com>
https://www.aeolusproject.org/redmine/issues/3199
---
src/app/helpers/mustache_helper.rb | 4 ++--
src/app/models/deployment.rb | 16 +++-------------
src/app/views/pools/_deployments.html.haml | 4 ++--
src/config/locales/en.yml | 24 +++++++++++++++++++++---
4 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/src/app/helpers/mustache_helper.rb b/src/app/helpers/mustache_helper.rb
index 16464f1..eed0223 100644
--- a/src/app/helpers/mustache_helper.rb
+++ b/src/app/helpers/mustache_helper.rb
@@ -47,8 +47,8 @@ module MustacheHelper
:name => deployment.name,
:path => deployment_path(deployment),
:filter_view_path => deployment_path(deployment, :view => :filter),
- :status => deployment.status,
- :translated_state =>
I18n.t("deployments.status.#{deployment.status}"),
+ :status => deployment.state,
+ :translated_state =>
I18n.t("deployments.status_description.#{deployment.state}"),
:uptime => count_uptime(deployment.uptime_1st_instance),
:deployable_xml_name => deployment.deployable_xml.name,
:created_at => deployment.created_at.to_s,
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index fe8008a..4ad2082 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -387,16 +387,6 @@ class Deployment < ActiveRecord::Base
end
end
- def status
- if instances.any? and instances.all? {|i| i.state == Instance::STATE_RUNNING}
- :running
- elsif instances.empty? or instances.all? {|i| (Instance::FAILED_STATES +
[Instance::STATE_STOPPED]).include?(i.state)}
- :stopped
- else
- :pending
- end
- end
-
# A deployment "starts" when _all_ instances begin to run
def start_time
if instances.deployed.count == instances.count && ev =
events.find_by_status_code(:all_running)
@@ -419,9 +409,9 @@ class Deployment < ActiveRecord::Base
def as_json(options={})
json = super(options).merge({
:deployable_xml_name => deployable_xml.name,
- :status => status,
- :translated_status => I18n.t("instances.states.#{status}"),
- :status_description => I18n.t("deployments.status.#{status}"),
+ :status => state,
+ :translated_status => I18n.t("deployments.status.#{state}"),
+ :status_description =>
I18n.t("deployments.status_description.#{state}"),
:instances_count => instances.count,
:failed_instances_count => failed_instances.count,
:instances_count_text => I18n.t('instances.instances', :count =>
instances.count.to_i),
diff --git a/src/app/views/pools/_deployments.html.haml
b/src/app/views/pools/_deployments.html.haml
index 4052d91..c535f93 100644
--- a/src/app/views/pools/_deployments.html.haml
+++ b/src/app/views/pools/_deployments.html.haml
@@ -5,8 +5,8 @@
%li.deployment
%h3.name
= link_to deployment.name, deployment_path(deployment)
- %span{ :class => "status #{deployment.status}", :title =>
t("deployments.status.#{deployment.status}")}
- = deployment.status
+ %span{ :class => "status #{deployment.state}", :title =>
t("deployments.status_description.#{deployment.state}")}
+ = deployment.state
%dl.statistics
%ul
%li.right
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index f6d3623..c918ece 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -182,9 +182,27 @@ en:
list_of_events: List of deployment events
state: State
status:
- running: All instances are running
- pending: Some (but not all) instances are running
- stopped: No instances are currently running
+ new: New
+ pending: "Pending"
+ running: "Running"
+ incomplete: "Incomplete"
+ shutting_down: "Shutting down"
+ stopped: "Stopped"
+ failed: "Failed"
+ rollback_in_progress: "Rollback in progress"
+ rollback_complete: "Rollback complete"
+ rollback_failed: "Rollback failed"
+ status_description:
+ new: "Deployment wasn't started"
+ pending: "Deployment is starting up"
+ running: "All instances are running"
+ incomplete: "Some instances are not running"
+ shutting_down: "Deployment is shutting down"
+ stopped: "All instances are stopped"
+ failed: "All instances are in failed state"
+ rollback_in_progress: "Launch failed, rollback is in progress"
+ rollback_complete: "Rollback successfully completed"
+ rollback_failed: "Rollback failed, re-launch terminated"
launch_time_params:
title: "Launch-time parameters"
configure_launch_time_params: "Configure launch-time parameters for your
deployment:"
--
1.7.7.6