pgbouncerhero 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/app/views/pg_bouncer_hero/database/summary.js.haml +2 -0
- data/app/views/pg_bouncer_hero/home/_card.html.haml +6 -8
- data/app/views/pg_bouncer_hero/home/_card_content.html.haml +28 -26
- data/app/views/pg_bouncer_hero/home/index.html.haml +8 -5
- data/lib/pgbouncerhero/connection.rb +4 -3
- data/lib/pgbouncerhero/methods/basics.rb +8 -6
- data/lib/pgbouncerhero/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e99b6949ad102047e0cbef15d498da34637d2fd5
|
4
|
+
data.tar.gz: c6e4afdfbdec05be13c7f1a19212458ebf3d9f31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8226446112e91797a812d689d80fa10c4dbb83c54e36d7229d97cd7401de49c2f9894bf88f68c16d2fa8eef298f6060b16296356919f9058c26bea6782c60a9
|
7
|
+
data.tar.gz: ba8b50b569a64fbb6b58be2ba80239c341b064f18f56f82a67b0d9b0ff2edf4e4bd984a130915d8bcbc4af1f02b35d3ab79e7ab938d885add176d052c18b8ab3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
$("#segment_status_#{@database.group.name.parameterize}_#{@database.name.parameterize}").html("#{j(@database.connection ? "Online" : "Offline")}")
|
2
|
+
$("#segment_status_#{@database.group.name.parameterize}_#{@database.name.parameterize}").removeClass("grey negative positive").addClass("#{j(@database.connection ? "positive" : "negative")}")
|
1
3
|
$("#segment_content_#{@database.group.name.parameterize}_#{@database.name.parameterize}").replaceWith("#{j(render partial: 'pg_bouncer_hero/home/card_content', locals: {database: @database, id: "segment_content_#{@database.group.name.parameterize}_#{@database.name.parameterize}"})}")
|
2
4
|
$("#segment_refreshed_#{@database.group.name.parameterize}_#{@database.name.parameterize}").css('display', '')
|
3
5
|
$("#segment_content_#{@database.group.name.parameterize}_#{@database.name.parameterize} .ui.progress").each(function(idx, el) { $(el).progress({ text: {active: '{value} of {total} connections'}, autoSuccess: false }); });
|
@@ -1,4 +1,3 @@
|
|
1
|
-
- connected = database.connection
|
2
1
|
.eight.wide.column{id: "segment_href_#{database.group.name.parameterize}_#{database.name.parameterize}", data: {href: summary_path(group: database.group.name.parameterize, database: database.name.parameterize)}}
|
3
2
|
= link_to databases_path(group: database.group.name.parameterize, database: database.name.parameterize), style: 'text-decoration: none !important; color: inherit !important' do
|
4
3
|
.ui.segments{style: 'margin-bottom: 10px;'}
|
@@ -6,10 +5,9 @@
|
|
6
5
|
%div{style: 'float: left;'}
|
7
6
|
%div{style: 'font-size: 16px; font-weight: bold;'}= database.name
|
8
7
|
%div{style: 'font-size: 12px; color: grey'}= database.host
|
9
|
-
%button.ui.button.basic.button{style: 'float: right;', class:
|
10
|
-
|
11
|
-
|
12
|
-
.
|
13
|
-
|
14
|
-
|
15
|
-
= Time.now.strftime("%H:%M:%S GMT%z (%Z)") # Same as new Date().toTimeString() in JS
|
8
|
+
%button.ui.button.basic.button{id: "segment_status_#{database.group.name.parameterize}_#{database.name.parameterize}", style: 'float: right;', class: 'grey'}= 'N/A'
|
9
|
+
= render partial: partial, locals: {database: database, id: "segment_content_#{database.group.name.parameterize}_#{database.name.parameterize}"}
|
10
|
+
.ui.segment{id: "segment_refreshed_#{database.group.name.parameterize}_#{database.name.parameterize}", style: 'height: 35px; display: none;'}
|
11
|
+
%span.right.floated{id: "segment_refreshed_span_#{database.group.name.parameterize}_#{database.name.parameterize}", style: 'float:right; margin-top: -6px; color: grey'}
|
12
|
+
Last refresh:
|
13
|
+
= Time.now.strftime("%H:%M:%S GMT%z (%Z)") # Same as new Date().toTimeString() in JS
|
@@ -1,26 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
%
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
- connected = database.connection
|
2
|
+
- if connected
|
3
|
+
.ui.horizontal.segments{id: id, style: 'background-color: white !important;'}
|
4
|
+
.ui.segment
|
5
|
+
- summary = database.summary
|
6
|
+
%div
|
7
|
+
%i.users.icon
|
8
|
+
- number = summary.select { |row| row['list'] == 'users' }.first['items']
|
9
|
+
= pluralize(number, 'user')
|
10
|
+
%div
|
11
|
+
%i.database.icon
|
12
|
+
- number = summary.select { |row| row['list'] == 'databases' }.first['items'].to_i - 1 # Removed pgbouncer
|
13
|
+
= pluralize(number, 'database')
|
14
|
+
%div
|
15
|
+
%i.plug.icon
|
16
|
+
- number = summary.select { |row| row['list'] == 'pools' }.first['items'].to_i - 1 # Removed pgbouncer
|
17
|
+
= pluralize(number, 'pool')
|
18
|
+
.ui.segment
|
19
|
+
%ul{style: 'margin: 0; padding-left: 5px;'}
|
20
|
+
- summary.select{ |row| row.key?(:databases_details) }.first[:databases_details].each do |db|
|
21
|
+
%li{style: 'margin: 0; list-style-type: none;'}
|
22
|
+
%span
|
23
|
+
%i.database.icon
|
24
|
+
%strong=db['name']
|
25
|
+
.ui.progress.small.success{data:{value: db['current_connections'], total: db['max_connections']}, style: 'float:right; width: 150px; margin-top:4px;'}
|
26
|
+
.bar
|
27
|
+
.progress
|
28
|
+
.label Connections
|
@@ -7,7 +7,7 @@
|
|
7
7
|
.sixteen.wide.row
|
8
8
|
.sixteen.wide.column
|
9
9
|
%h3.ui.dividing.header{style: 'margin-bottom: 10px;'}= group.name
|
10
|
-
= render partial: "card", collection: group.databases, as: :database, locals: {partial: 'card_loading_content'}
|
10
|
+
= render partial: "card", collection: group.databases, as: :database, locals: {partial: 'card_loading_content', lazy: true}
|
11
11
|
|
12
12
|
:javascript
|
13
13
|
document.addEventListener("DOMContentLoaded", function(event) {
|
@@ -22,10 +22,13 @@
|
|
22
22
|
var id = el.attr('id');
|
23
23
|
var href = el.data('href');
|
24
24
|
var refreshed_id = id.replace('href', 'refreshed_span');
|
25
|
-
document.getElementById(refreshed_id)
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
var refreshed_div = document.getElementById(refreshed_id);
|
26
|
+
if (refreshed_div) {
|
27
|
+
refreshed_div.innerHTML = 'Refreshing...';
|
28
|
+
$.get(href, function(data) {
|
29
|
+
refreshed_div.innerHTML = 'Last refresh: ' + new Date().toTimeString();
|
30
|
+
});
|
31
|
+
}
|
29
32
|
});
|
30
33
|
}, 60 * 1000)
|
31
34
|
});
|
@@ -7,6 +7,7 @@ module PgBouncerHero
|
|
7
7
|
@user = user
|
8
8
|
@password = password
|
9
9
|
@dbname = dbname
|
10
|
+
@timeout = ENV["PGBOUNCERHERO_TIMEOUT"] || 5
|
10
11
|
end
|
11
12
|
|
12
13
|
def connection
|
@@ -18,10 +19,10 @@ module PgBouncerHero
|
|
18
19
|
user: @user,
|
19
20
|
password: @password,
|
20
21
|
dbname: @dbname,
|
21
|
-
connect_timeout:
|
22
|
+
connect_timeout: @timeout
|
22
23
|
)
|
23
|
-
rescue => e
|
24
|
-
Rails.logger.
|
24
|
+
rescue Exception => e
|
25
|
+
Rails.logger.error("[PGBouncerHero] Host:#{@host} | Database Name:#{@dbname} | Timeout: #{@timeout}s => #{e}")
|
25
26
|
nil
|
26
27
|
end
|
27
28
|
end
|
@@ -2,12 +2,14 @@ module PgBouncerHero
|
|
2
2
|
module Methods
|
3
3
|
module Basics
|
4
4
|
def summary
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
if connection
|
6
|
+
l = lists
|
7
|
+
d = databases
|
8
|
+
l = l.as_json
|
9
|
+
d = d.as_json.reject { |a| a['name'] == 'pgbouncer' }
|
10
|
+
l.push({databases_details: d})
|
11
|
+
l
|
12
|
+
end
|
11
13
|
end
|
12
14
|
def databases
|
13
15
|
connection.exec("SHOW databases")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgbouncerhero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Quentin Rousseau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.5.2
|
184
|
+
rubygems_version: 2.5.2.2
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: A graphical user interface for your PGBouncers
|