rails-pg-extras-web 1.5.3 → 1.6.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7f43ce0a38a6e61ba4c9424cd92614afd7f6609436d9da8aa0365365ad08a87
|
4
|
+
data.tar.gz: e0ffa21d94bc8c12069c081d746410b954d9dd56b2e88809b36fd456e94bca30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55039e4b67cc04e64545ab07092bf135f9844ae84414d1a7688957fdcad0124918f538b4f3f020e133b7fedabfe86e4b3b5682654887794429c6d9c75ee99834
|
7
|
+
data.tar.gz: 368e5bcda5b27669152df55c5fec5940a7575bd1557628af8d206cd2f4221700eedf91818dfdad08dd7262bd37866eab47be7d018559eec368cb91df9158dbc4
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module RailsPgExtrasWeb
|
2
2
|
class QueriesController < ApplicationController
|
3
|
+
REQUIRED_EXTENSIONS = {
|
4
|
+
pg_stat_statements: %i[calls outliers],
|
5
|
+
pg_buffercache: %i[buffercache_stats buffercache_usage]
|
6
|
+
}
|
7
|
+
|
3
8
|
before_action :load_queries
|
4
|
-
helper_method :
|
9
|
+
helper_method :unavailable_extensions
|
5
10
|
|
6
11
|
def index
|
7
12
|
@query_name = params[:query_name]&.to_sym.presence_in(@all_queries.keys)
|
@@ -26,11 +31,21 @@ module RailsPgExtrasWeb
|
|
26
31
|
end
|
27
32
|
|
28
33
|
def query_disabled?(query_name)
|
29
|
-
query_name
|
34
|
+
case query_name
|
35
|
+
when :calls, :outliers
|
36
|
+
unavailable_extensions.key?(:pg_stat_statements)
|
37
|
+
when :buffercache_stats, :buffercache_usage
|
38
|
+
unavailable_extensions.key?(:pg_buffercache)
|
39
|
+
else
|
40
|
+
false
|
41
|
+
end
|
30
42
|
end
|
31
43
|
|
32
|
-
def
|
33
|
-
|
44
|
+
def unavailable_extensions
|
45
|
+
return @unavailable_extensions if defined?(@unavailable_extensions)
|
46
|
+
|
47
|
+
extensions = ActiveRecord::Base.connection.extensions
|
48
|
+
@unavailable_extensions = REQUIRED_EXTENSIONS.select { |extension, _| !extensions.include?(extension.to_s) }
|
34
49
|
end
|
35
50
|
end
|
36
51
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<% if unavailable_extensions.any? && !@result %>
|
2
|
+
<% unavailable_extensions.each do |extension, queries| %>
|
3
|
+
<span style='color: orange'>
|
4
|
+
WARNING: Queries <%= queries.map { |q| "<b><u>#{q}</u></b>" }.join(", ").html_safe %> require extension: <b><%= extension %></b>
|
5
|
+
</span>
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
<h4>Rails</h4>
|
8
|
+
<pre style='background-color: #e2e2e2; padding: 10px'>ActiveRecord::Base.connection.enable_extension "<%= extension %>"</pre>
|
9
|
+
<h4>SQL</h4>
|
10
|
+
<pre style='background-color: #e2e2e2; padding: 10px'>CREATE EXTENSION <%= extension %></pre>
|
11
|
+
<% end %>
|
10
12
|
<% end %>
|
11
13
|
|
12
14
|
<% if @error %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-pg-extras-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Mazur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.6.0
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- tomasz.mazur@hey.com
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.1.
|
78
|
+
rubygems_version: 3.1.6
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Web UI for rails-pg-extras
|