diff --git a/src/api/app/controllers/webui/package_controller.rb b/src/api/app/controllers/webui/package_controller.rb index 20a7e2f2807..e701f111832 100644 --- a/src/api/app/controllers/webui/package_controller.rb +++ b/src/api/app/controllers/webui/package_controller.rb @@ -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 += "#{line}" - elsif line.match(/\w+(?:\.\w+)+: E: /) - res += "#{line}" - 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 diff --git a/src/api/app/views/webui/package/rpmlint_log.html.haml b/src/api/app/views/webui/package/rpmlint_log.html.haml new file mode 100644 index 00000000000..811a66c3c46 --- /dev/null +++ b/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 \ No newline at end of file