Skip to content

Commit

Permalink
Fixes #23699 - Remediation Support for Host Status
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay-mendhe committed Oct 13, 2018
1 parent 336a5be commit 57617ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
21 changes: 21 additions & 0 deletions app/models/host_status/build_status.rb
Expand Up @@ -5,21 +5,28 @@ class BuildStatus < Status
BUILD_FAILED = 3
BUILT = 0

@@build_status_help_text = {}

def self.status_name
N_("Build")
end

def to_label(options = {})
case to_status
when PENDING
@@build_status_help_text["Pending installation"] = "Wait for sometime and if build fails, rebuild again"
N_("Pending installation")
when TOKEN_EXPIRED
@@build_status_help_text["Token expired"] = "Cancel your build and regenerate token by initiating build again"
N_("Token expired")
when BUILT
@@build_status_help_text["Installed"] = "Done!"
N_("Installed")
when BUILD_FAILED
@@build_status_help_text["Installation error"] = "Check audit log"
N_("Installation error")
else
@@build_status_help_text["Unknown build status"] = "Unknow status"
N_("Unknown build status")
end
end
Expand Down Expand Up @@ -64,6 +71,20 @@ def token_expired?
def build_errors?
host && host.build_errors.present?
end

def self.host_build_status_help_text(value)
if value.include? "Pending installation"
@@build_status_help_text["Pending installation"]
elsif value.include? "Token expired"
@@build_status_help_text["Token expired"]
elsif value.include? "Installed"
@@build_status_help_text["Installed"]
elsif value.include? "Installation error"
@@build_status_help_text["Installation error"]
elsif value.include? "Unknown build status"
@@build_status_help_text["Unknown build status"]
end
end
end
end

Expand Down
6 changes: 5 additions & 1 deletion app/views/hosts/_overview.html.erb
Expand Up @@ -8,7 +8,11 @@
<% overview_fields(host).each do |name, value| %>
<tr>
<td><%= name %></td>
<td><%= value %></td>
<% if name == "Build" %>
<td><%= content_tag(:span, value, { :'data-original-title' => HostStatus::BuildStatus.host_build_status_help_text(value), :rel => 'twipsy' }).html_safe %></td>
<% else %>
<td><%= value %></td>
<% end %>
</tr>
<% end %>
</tbody>
Expand Down

0 comments on commit 57617ff

Please sign in to comment.