Skip to content

Commit

Permalink
Merge pull request #2555 from ChrisBr/fix_rpmlint
Browse files Browse the repository at this point in the history
[webui] Fix rpmlint rendering
  • Loading branch information
bgeuken committed Jan 17, 2017
2 parents aa79066 + e4db4ea commit ce75482
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/api/app/controllers/webui/package_controller.rb
Expand Up @@ -990,19 +990,9 @@ def get_rpmlint_log(project, package, repository, architecture)
def rpmlint_log
required_parameters :project, :package, :repository, :architecture
begin
rpmlint_log = get_rpmlint_log(params[:project], params[:package], params[:repository], params[:architecture])
rpmlint_log.encode!(xml: :text)
res = ''
rpmlint_log.lines.each do |line|
if line.match(/\w+(?:\.\w+)+: W: /)
res += "<span style=\"color: olive;\">#{line}</span>"
elsif line.match(/\w+(?:\.\w+)+: E: /)
res += "<span style=\"color: red;\">#{line}</span>"
else
res += line
end
end
render html: res
@log = get_rpmlint_log(params[:project], params[:package], params[:repository], params[:architecture])
@log.encode!(xml: :text)
render partial: 'rpmlint_log'
rescue ActiveXML::Transport::NotFoundError
render plain: 'No rpmlint log'
end
Expand Down
7 changes: 7 additions & 0 deletions src/api/app/views/webui/package/rpmlint_log.html.haml
@@ -0,0 +1,7 @@
- @log.lines.each do |line|
- if line.match(/\w+(?:\.\w+)+: W: /)
= content_tag(:span, line.strip, style: 'color: olive;')
- elsif line.match(/\w+(?:\.\w+)+: E: /)
= content_tag(:span, line.strip, style: 'color: red;')
- else
= line.strip

0 comments on commit ce75482

Please sign in to comment.