[PATCH conductor 2/2] BZ798555 addded translation for instances and deployments statuses

jtomasek at redhat.com jtomasek at redhat.com
Tue Apr 3 15:22:55 UTC 2012


From: Jiri Tomasek <jtomasek at redhat.com>

---
 src/app/models/deployment.rb                       |    1 +
 src/app/models/instance.rb                         |    1 +
 src/app/views/deployments/_list.html.haml          |    4 ++--
 .../views/deployments/_pretty_view_show.html.haml  |    4 ++--
 src/app/views/instances/_list.html.haml            |    4 ++--
 src/app/views/instances/_properties.html.haml      |    2 +-
 src/config/locales/en.yml                          |    9 +++++++++
 7 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index cd2eb73..509bb10 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -405,6 +405,7 @@ class Deployment < ActiveRecord::Base
     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}"),
       :instances_count => instances.count,
       :failed_instances_count => failed_instances.count,
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 1b18d6e..ee5b8df 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -447,6 +447,7 @@ class Instance < ActiveRecord::Base
       :uptime => ApplicationHelper.count_uptime(uptime),
       :stop_enabled => available_actions.include?(InstanceTask::ACTION_STOP),
       :reboot_enabled => available_actions.include?(InstanceTask::ACTION_REBOOT),
+      :translated_state => I18n.t("instances.states.#{state}"),
       :is_failed => failed?
     })
 
diff --git a/src/app/views/deployments/_list.html.haml b/src/app/views/deployments/_list.html.haml
index 1425ceb..308a98d 100644
--- a/src/app/views/deployments/_list.html.haml
+++ b/src/app/views/deployments/_list.html.haml
@@ -36,7 +36,7 @@
     %td= link_to(deployment.name, deployment_path(deployment, :view => :filter))
     %td= deployment.created_at
     %td= deployment.deployable_xml.name
-    %td= deployment.status
+    %td= t("instances.states.#{deployment.status}")
     %td{:class => 'center'}= deployment.instances.size
     %td= link_to deployment.pool.name, pool_path(deployment.pool, :view => :filter)
     %td= owner_name(deployment)
@@ -61,7 +61,7 @@
       <td><a href="#{deployment_path('replace_id', :view => :filter).sub('replace_id', '${id}')}">${name}</a></td>
       <td>${created_at}</td>
       <td>${deployable_xml_name}</td>
-      <td>${status}</td>
+      <td>${translated_status}</td>
       <td class="center">${instances_count}</td>
       <td><a href="#{pool_path('replace_id', :view => :filter).sub('replace_id', '${pool.id}')}">${pool.name}</a></td>
       <td>${owner}</td>
diff --git a/src/app/views/deployments/_pretty_view_show.html.haml b/src/app/views/deployments/_pretty_view_show.html.haml
index 7798ed2..c354ca9 100644
--- a/src/app/views/deployments/_pretty_view_show.html.haml
+++ b/src/app/views/deployments/_pretty_view_show.html.haml
@@ -14,7 +14,7 @@
             %dd= instance.public_addresses.present? ? instance.public_addresses : t('deployments.pretty_view_show.no_ip_address')
           %li
             %dt.state= t('deployments.pretty_view_show.state')
-            %dd= instance.state
+            %dd= t("instances.states.#{instance.state}")
           - if instance.instance_key
             %li
               %dt
@@ -56,7 +56,7 @@
           </li>
           <li>
             <dt class="state">#{t('deployments.pretty_view_show.state')}</dt>
-            <dd>${state}</dd>
+            <dd>${translated_state}</dd>
           </li>
           {{if has_key}}
             <li>
diff --git a/src/app/views/instances/_list.html.haml b/src/app/views/instances/_list.html.haml
index ac33771..dac5d69 100644
--- a/src/app/views/instances/_list.html.haml
+++ b/src/app/views/instances/_list.html.haml
@@ -36,7 +36,7 @@
     %td{:class => 'alert'}= instance.failed? ? image_tag("sb_icon_instance_failure.png") : ""
     %td= link_to instance.name, instance_path(instance)
     %td= instance.public_addresses
-    %td= instance.state
+    %td= t("instances.states.#{instance.state}")
     %td= instance.provider_account ? instance.provider_account.provider.name : ''
     %td= owner_name(instance)
 
@@ -56,7 +56,7 @@
       </td>
       <td><a href="#{instance_path('replace_id').sub('replace_id', '${id}')}">${name}</a></td>
       <td>${public_addresses}</td>
-      <td>${state}</td>
+      <td>${translated_state}</td>
       <td>${provider}</td>
       <td>${owner}</td>
     </tr>
diff --git a/src/app/views/instances/_properties.html.haml b/src/app/views/instances/_properties.html.haml
index 61fe46c..ee5ffb7 100644
--- a/src/app/views/instances/_properties.html.haml
+++ b/src/app/views/instances/_properties.html.haml
@@ -4,7 +4,7 @@
     %span= @instance.name
   %li
     = label_tag :status, t('instances.properties.status')
-    %span= @instance.state
+    %span= t("instances.states.#{@instance.state}")
   %li
     = label_tag :public_addresses, t('instances.properties.public_addresses')
     %span= @instance.public_addresses
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index e2ee899..fb0abc6 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -346,6 +346,15 @@ en:
       shared_to: "Shared to: "
       error: "Error: "
       n_a: "N/A"
+    states:
+      new: New
+      pending: Pending
+      running: Running
+      shutting_down: Shutting down
+      stopped: Stopped
+      create_failed: Create failed
+      error: Error
+      vanished: Vanished
     confirm_terminate:
       terminate: "Terminate"
       terminate_instances: "Terminate Instances"
-- 
1.7.7.6




More information about the aeolus-devel mailing list