pghero 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pghero might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5007ffa26cad91ceca6b39cf0049c0f935933637
4
- data.tar.gz: 505386ddd4f407457b0d88d06840007d3aa27059
3
+ metadata.gz: 29a21b5bab969343ade74d9df1643ac808cf81c5
4
+ data.tar.gz: cbfa3d06c92ec558cb28733fcfdf3a74ad56d295
5
5
  SHA512:
6
- metadata.gz: abb53d06f528e1e0461864b5afbc2e8a27cc2c425ad3a04e3ad4e1cee6bf45f4a1bd44d549dbb56df94052c0aa1bf53164d3a84d780530047368ee06fa190178
7
- data.tar.gz: d2ae582ac7093732798ad45b6914b6adc4caab8af229e229a899342811f3fe2a94aeb918babb40ad8ef316e3ba2740040e313829a5a2f6bbdbbc35ac7ca96f34
6
+ metadata.gz: 9b42030927945b2e8a7e6fc802ab74e65a4afaf101e3ba21e3d8f35346bbae1184a4fba4e07d774d591351ca86925a3089d92966ea68f5263a6694dcbbcea7f5
7
+ data.tar.gz: b44897c9ee84a0622c059f74254f0f15380ce6dba24bbe007a20cf037e884ace4255546c4b3c978edc769e6e96a134aaaa0425950c0963fae7903f632dd0c8f2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 1.0.1
2
+
3
+ - Fixed connection bad errors
4
+ - Restore previous connection properly for nested with blocks
5
+ - Added analyze button to explain page
6
+ - Added explain button to live queries page
7
+
1
8
  ## 1.0.0
2
9
 
3
10
  - More platforms!
data/README.md CHANGED
@@ -6,7 +6,7 @@ Postgres insights made easy
6
6
 
7
7
  [![Screenshot](https://pghero.herokuapp.com/assets/screenshot-34a33ee68c77d64c1f89f143f6297a47.png)](https://pghero.herokuapp.com/)
8
8
 
9
- :speech_balloon: Get [handcrafted updates](http://chartkick.us7.list-manage.com/subscribe?u=952c861f99eb43084e0a49f98&id=6ea6541e8e&group[0][32]=true) for new features
9
+ :speech_balloon: Get [handcrafted updates](http://chartkick.us7.list-manage.com/subscribe?u=952c861f99eb43084e0a49f98&id=6ea6541e8e&group[0][16]=true) for new features
10
10
 
11
11
  ## Installation
12
12
 
@@ -72,7 +72,7 @@ module PgHero
72
72
  # need to prevent CSRF and DoS
73
73
  if request.post? && @query
74
74
  begin
75
- @explanation = PgHero.explain(@query)
75
+ @explanation = PgHero.explain("#{params[:commit] == "Analyze" ? "ANALYZE " : ""}#{@query}")
76
76
  rescue ActiveRecord::StatementInvalid => e
77
77
  @error = e.message
78
78
  end
@@ -88,6 +88,10 @@
88
88
  color: #999;
89
89
  }
90
90
 
91
+ .text-right {
92
+ text-align: right;
93
+ }
94
+
91
95
  .percent {
92
96
  color: #999;
93
97
  font-size: 12px;
@@ -193,6 +197,10 @@
193
197
  text-decoration: none;
194
198
  }
195
199
 
200
+ .button_to, .button_to div {
201
+ display: inline;
202
+ }
203
+
196
204
  /*
197
205
  Simple Grid
198
206
  Learn More - http://dallasbass.com/simple-grid-a-lightweight-responsive-css-grid/
@@ -3,21 +3,23 @@
3
3
  <tr>
4
4
  <th style="width: 10%;">Pid</th>
5
5
  <th style="width: 10%;">State</th>
6
- <th>Source</th>
7
- <th style="width: 10%;">Waiting</th>
8
6
  <th style="width: 15%;">Duration</th>
9
- <th style="width: 10%;"></th>
7
+ <th>Source</th>
8
+ <th style="width: 25%;"></th>
10
9
  </tr>
11
10
  </thead>
12
11
  <tbody>
12
+ <% now = Time.now %>
13
13
  <% queries.each do |query| %>
14
14
  <tr>
15
15
  <td><%= query["pid"] %></td>
16
16
  <td><%= query["state"] %></td>
17
+ <td><%= query["started_at"] ? "#{number_with_delimiter(((now - Time.parse(query["started_at"])) * 1000).round)} ms" : nil %></td>
17
18
  <td><%= query["source"] %></td>
18
- <td><%= query["waiting"] == "t" ? "true" : "false" %></td>
19
- <td><%= query["started_at"] ? time_ago_in_words(query["started_at"], include_seconds: true) : nil %></td>
20
- <td class="text-right"><%= button_to "Kill", kill_path(pid: query["pid"]), class: "btn btn-info" %></td>
19
+ <td class="text-right">
20
+ <%= button_to "Explain", explain_path(query: query["query"]), form: {target: "_blank"}, class: "btn btn-info" %>
21
+ <%= button_to "Kill", kill_path(pid: query["pid"]), class: "btn btn-danger" %>
22
+ </td>
21
23
  </tr>
22
24
  <tr>
23
25
  <td colspan="6" style="border-top: none; padding: 0;"><pre><%= query["query"] %></pre></td>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <%= form_tag explain_path do %>
5
5
  <%= text_area_tag :query, @query, placeholder: "Enter a SQL query" %>
6
- <p><%= submit_tag "Explain", class: "btn btn-info" %></p>
6
+ <p><%= submit_tag "Explain", class: "btn btn-info" %> <%= submit_tag "Analyze", class: "btn btn-danger" %></p>
7
7
  <% end %>
8
8
 
9
9
  <% if @explanation %>
data/guides/Linux.md CHANGED
@@ -115,8 +115,6 @@ sudo service nginx restart
115
115
 
116
116
  ## Management
117
117
 
118
- Ubuntu, CentOS, and RHEL
119
-
120
118
  ```sh
121
119
  sudo service pghero status
122
120
  sudo service pghero start
@@ -124,12 +122,6 @@ sudo service pghero stop
124
122
  sudo service pghero restart
125
123
  ```
126
124
 
127
- Debian, Fedora, and SUSE
128
-
129
- ```sh
130
- #todo
131
- ```
132
-
133
125
  ## Query Stats
134
126
 
135
127
  Query stats can be enabled from the dashboard. If you run into issues, [view the guide](Query-Stats.md).
data/lib/pghero.rb CHANGED
@@ -66,10 +66,13 @@ module PgHero
66
66
  end
67
67
 
68
68
  def with(database)
69
- self.current_database = database
70
- yield
71
- ensure
72
- self.current_database = primary_database
69
+ previous_database = current_database
70
+ begin
71
+ self.current_database = database
72
+ yield
73
+ ensure
74
+ self.current_database = previous_database
75
+ end
73
76
  end
74
77
 
75
78
  def running_queries
@@ -595,10 +598,11 @@ module PgHero
595
598
  end
596
599
 
597
600
  def connection
598
- Thread.current[:pghero_connection] ||= begin
601
+ unless Thread.current[:pghero_connection]
599
602
  Connection.establish_connection(current_config["url"])
600
- Connection.connection
603
+ Thread.current[:pghero_connection] = true
601
604
  end
605
+ Connection.connection
602
606
  end
603
607
 
604
608
  # from ActiveSupport
@@ -1,3 +1,3 @@
1
1
  module PgHero
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pghero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-11 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord