activetracker 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa285082d179d3e5e8ee686c1012c334af277e81d8de2b897c9ad732ce45f407
4
- data.tar.gz: 5c297f61f2d0731cf0bde0833b609153510ce5c7833dca5ab30a7f11715eb268
3
+ metadata.gz: 1e63a184eb0383b6a3b026b154906ee136da8897003079c08846159c42f8b9f3
4
+ data.tar.gz: 1fd517ea2dd413013e2c205144c6090a83ea95b2e0748a6fcd42723697cfb1cd
5
5
  SHA512:
6
- metadata.gz: faf8ae02103b763883fdd7bf6bd796abd1a03e1208a5c7ca259910ffb6f3904f31f1710893d3eb433ab2318674d6f8075a2366d1f7b944d83701f44ce1395420
7
- data.tar.gz: bf60a7177ce99e7c924943ca059a3eef83ef5d881a32a9816b876f15d4fe064e4c5af33f8962d9e2a14bf2938828fcc0a7bf0e939ca48bc09aaa55a32950207f
6
+ metadata.gz: e270d4d2bbc749e747083568e383999951444823055611d7ff8016877021cd0ffb543cc5fb883806b1945a8a8e91a4591e838f28fc1c68ec0c1fe7b2016310ef
7
+ data.tar.gz: 570a780b051840c76f1adcfc6491406dd70745bae55a1320331cbd7fe2587640a18415b79ca2c78c92f6f59c249fd0303ef3bb23d72e2700df23fca00468566d
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.9] - 2019-11-06
10
+ ### Added
11
+ - Pretty printing of JSON responses and minor display tweaks
12
+
9
13
  ## [0.4.8] - 2019-11-05
10
14
  ### Fixed
11
15
  - Removed unnecessary ActionMailer class
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activetracker (0.4.8)
4
+ activetracker (0.4.9)
5
5
  redis (~> 4.0)
6
6
 
7
7
  GEM
@@ -4,6 +4,11 @@ module ActiveTracker
4
4
 
5
5
  layout "active_tracker/active_tracker"
6
6
 
7
+ helper ActiveTracker::ImagesHelper
8
+ helper ActiveTracker::ApplicationHelper
9
+ helper ActiveTracker::PaginationHelper
10
+ helper ActiveTracker::OutputHelper
11
+
7
12
  before_action do
8
13
  if ActiveTracker::Configuration.authentication.is_a? String
9
14
  username, password = ActiveTracker::Configuration.authentication.split(":")
@@ -5,15 +5,15 @@
5
5
  <div class="flex flex-grow mt-10 items-center">
6
6
  <div class="rounded-lg bg-white text-sm text-gray-600 flex-1">
7
7
  <div class="flex flex-grow items-center">
8
- <div class="bg-gray-200 text-gray-600 uppercase w-32 p-4">Method</div>
8
+ <div class="bg-gray-200 text-gray-600 uppercase w-32 p-4 flex-shrink-0">Method</div>
9
9
  <div class="pl-4"><span class="bg-gray-200 text-gray-600 rounded-full px-2 py-1 text-sm font-bold"><%= @request.tags[:method] %></span></div>
10
10
  </div>
11
11
  <div class="flex flex-grow items-center">
12
- <div class="bg-gray-200 text-gray-600 uppercase w-32 p-4">Path</div>
12
+ <div class="bg-gray-200 text-gray-600 uppercase w-32 p-4 flex-shrink-0">Path</div>
13
13
  <div class="pl-4"><%= @request.tags[:url] %></div>
14
14
  </div>
15
15
  <div class="flex flex-grow items-center">
16
- <div class="bg-gray-200 text-gray-600 uppercase w-32 p-4">Status</div>
16
+ <div class="bg-gray-200 text-gray-600 uppercase w-32 p-4 flex-shrink-0">Status</div>
17
17
  <% if @request.tags[:status].start_with?("2") %>
18
18
  <div class="pl-4"><span class="bg-green-100 text-green-600 rounded-full px-2 py-1 text-sm font-bold"><%= @request.tags[:status] %></span></div>
19
19
  <% elsif @request.tags[:status].start_with?("3") %>
@@ -25,7 +25,7 @@
25
25
  <% end %>
26
26
  </div>
27
27
  <div class="flex flex-grow items-center">
28
- <div class="bg-gray-200 text-gray-600 uppercase w-32 p-4">When</div>
28
+ <div class="bg-gray-200 text-gray-600 uppercase w-32 p-4 flex-shrink-0">When</div>
29
29
  <div class="pl-4"><%= time_ago_in_words @request.log_at %> ago</div>
30
30
  </div>
31
31
  </div>
@@ -55,7 +55,15 @@
55
55
  </div>
56
56
 
57
57
  <div class="bg-black text-white font-mono whitespace-pre-wrap text-sm rounded-lg mt-2 p-4 overflow-x-auto js-activetracker-tab-content" data-content="logs"><%= escape_ansi @request.log.strip %></div>
58
- <div class="bg-black text-white font-mono whitespace-pre-wrap text-sm rounded-lg mt-2 p-4 overflow-x-auto js-activetracker-tab-content hidden" data-content="response"><%= @request.output.strip %></div>
58
+ <div class="bg-black text-white font-mono whitespace-pre-wrap text-sm rounded-lg mt-2 p-4 overflow-x-auto js-activetracker-tab-content hidden" data-content="response"><%=
59
+ output = @request.output
60
+
61
+ if (@request.content_type || "")["application/json"]
62
+ output = JSON.pretty_generate(JSON.parse(output))
63
+ end
64
+
65
+ output.strip
66
+ %></div>
59
67
  <div class="bg-white rounded-b-lg mt-2 overflow-x-auto js-activetracker-tab-content hidden" data-content="queries">
60
68
  <div class="bg-gray-200 text-gray-600 uppercase tracking-tight leading-none py-2 px-4 flex flex-grow">
61
69
  <div class="flex-1">SQL</div>
@@ -4,15 +4,6 @@ module ActiveTracker
4
4
  config.eager_load_paths += Dir["#{config.root}/lib/**/"]
5
5
  config.eager_load_paths += Dir["#{config.root}/app/**/"]
6
6
 
7
- initializer 'active_tracker_helper.action_controller' do
8
- ActiveSupport.on_load :action_controller do
9
- helper ActiveTracker::ImagesHelper
10
- helper ActiveTracker::ApplicationHelper
11
- helper ActiveTracker::PaginationHelper
12
- helper ActiveTracker::OutputHelper
13
- end
14
- end
15
-
16
7
  config.generators do |g|
17
8
  g.test_framework :rspec, fixture: false
18
9
  g.fixture_replacement :factory_girl, dir: 'spec/factories'
@@ -9,12 +9,12 @@ module ActiveTracker
9
9
  status, headers, response = @app.call(env)
10
10
  [status, headers, response]
11
11
  ensure
12
- capture(response)
12
+ capture(response, headers)
13
13
  duration = (Time.current.to_f - start_time.to_f) * 1000
14
14
  ActiveTracker::Plugin::Request.record_duration(duration)
15
15
  end
16
16
 
17
- def capture(response)
17
+ def capture(response, headers)
18
18
  body = response.body rescue nil
19
19
  unless body.is_a?(String)
20
20
  body = body.to_a rescue [body.body] rescue "No body given"
@@ -30,7 +30,7 @@ module ActiveTracker
30
30
  output = body.to_s
31
31
  end
32
32
 
33
- ActiveTracker::Plugin::Request.output_capture(output)
33
+ ActiveTracker::Plugin::Request.output_capture(output, headers["Content-type"])
34
34
  end
35
35
 
36
36
  end
@@ -108,8 +108,9 @@ module ActiveTracker
108
108
  tag_current app: app_name
109
109
  end
110
110
 
111
- def self.output_capture(output)
111
+ def self.output_capture(output, content_type)
112
112
  @output = output
113
+ @content_type = content_type
113
114
  end
114
115
 
115
116
  def self.record_duration(duration)
@@ -125,7 +126,7 @@ module ActiveTracker
125
126
  log = apply_redactions(log)
126
127
  @output = apply_redactions(@output)
127
128
 
128
- ActiveTracker::Model.save("Request", {log: log, output: @output},
129
+ ActiveTracker::Model.save("Request", {log: log, output: @output, content_type: @content_type},
129
130
  tags: ActiveTracker::Plugin::Request.current_tags,
130
131
  data_type: "full",
131
132
  expiry: 7.days,
@@ -1,3 +1,3 @@
1
1
  module ActiveTracker
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activetracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-05 00:00:00.000000000 Z
11
+ date: 2019-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler