From 259c23079b52f27f01f27ef61cc2eeece8eabb49 Mon Sep 17 00:00:00 2001 From: Cole White Date: Thu, 3 May 2018 13:49:52 -0600 Subject: [PATCH] new feature: enable add and delete highlighting in report view log output --- app/views/report.erb | 8 +++++++- public/stylesheet.css | 8 ++++++++ puppet-singularity.yml.example | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/views/report.erb b/app/views/report.erb index 142abeb..3fdb8ed 100644 --- a/app/views/report.erb +++ b/app/views/report.erb @@ -14,10 +14,16 @@

Logs

+<% if @@config['enable_report_highlighting'] %>
-<% @response['report']['logs'].each do |msg| %><%= msg['level'] %>: <%= msg['source'] %>: <%= Rack::Utils.escape_html(msg['message']) %> +<% @response['report']['logs'].each do |msg| %><%= msg['level'] %>: <%= msg['source'] %>: <% Rack::Utils.escape_html(msg['message']).each_line do |line| %><% if line != nil %><% if line[0] == '+' %><%= line %><% elsif line[0] == '-' %><%= line %><% else %><%= line %><% end %><% end %><% end %> <% end %>
+<% else %> +
+<% @response['report']['logs'].each do |msg| %><%= msg['level'] %>: <%= msg['source'] %>: <%= Rack::Utils.escape_html(msg['message']) %><% end %> +
+<% end %> <% if @response['report']['status'] != 'failed' %>

Time

diff --git a/public/stylesheet.css b/public/stylesheet.css index 955ea09..66b7d11 100644 --- a/public/stylesheet.css +++ b/public/stylesheet.css @@ -127,3 +127,11 @@ table > tbody > tr:nth-of-type(odd) { padding: 3px; font-family: "Monaco", "Courier New", Courier, fixed-width; } + +.highlight-add { + background-color: #006600; +} + +.highlight-delete { + background-color: #880000; +} diff --git a/puppet-singularity.yml.example b/puppet-singularity.yml.example index b7beacb..7e65419 100644 --- a/puppet-singularity.yml.example +++ b/puppet-singularity.yml.example @@ -13,5 +13,8 @@ # Will gzip every report. Saves a lot of space and does not generate a lot more viewing overhead. compress_every_report: true + # Highlight file additions and deletions in report view + enable_report_highlighting: false + reports_dir: /var/puppet-singularity/reports error_dir: /var/puppet/singularity/errors