pghero 3.1.0 → 3.7.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -1
  3. data/LICENSE.txt +1 -1
  4. data/README.md +2 -2
  5. data/app/assets/javascripts/pghero/Chart.bundle.js +23379 -19766
  6. data/app/assets/javascripts/pghero/application.js +27 -12
  7. data/app/assets/javascripts/pghero/chartkick.js +834 -764
  8. data/app/assets/javascripts/pghero/highlight.min.js +440 -0
  9. data/app/assets/javascripts/pghero/jquery.js +318 -197
  10. data/app/assets/javascripts/pghero/nouislider.js +676 -1066
  11. data/app/assets/stylesheets/pghero/application.css +108 -2
  12. data/app/assets/stylesheets/pghero/nouislider.css +4 -10
  13. data/app/controllers/pg_hero/home_controller.rb +53 -16
  14. data/app/helpers/pg_hero/home_helper.rb +3 -3
  15. data/app/views/layouts/pg_hero/application.html.erb +3 -3
  16. data/app/views/pg_hero/home/_connections_table.html.erb +1 -1
  17. data/app/views/pg_hero/home/_live_queries_table.html.erb +8 -8
  18. data/app/views/pg_hero/home/_queries_table.html.erb +5 -5
  19. data/app/views/pg_hero/home/_query_stats_slider.html.erb +8 -8
  20. data/app/views/pg_hero/home/_suggested_index.html.erb +6 -5
  21. data/app/views/pg_hero/home/connections.html.erb +12 -12
  22. data/app/views/pg_hero/home/explain.html.erb +2 -2
  23. data/app/views/pg_hero/home/index.html.erb +22 -20
  24. data/app/views/pg_hero/home/index_bloat.html.erb +6 -6
  25. data/app/views/pg_hero/home/maintenance.html.erb +3 -3
  26. data/app/views/pg_hero/home/queries.html.erb +7 -5
  27. data/app/views/pg_hero/home/relation_space.html.erb +4 -4
  28. data/app/views/pg_hero/home/show_query.html.erb +35 -31
  29. data/app/views/pg_hero/home/space.html.erb +50 -46
  30. data/app/views/pg_hero/home/system.html.erb +18 -18
  31. data/app/views/pg_hero/home/tune.html.erb +2 -2
  32. data/lib/generators/pghero/query_stats_generator.rb +1 -0
  33. data/lib/generators/pghero/space_stats_generator.rb +1 -0
  34. data/lib/pghero/database.rb +2 -2
  35. data/lib/pghero/engine.rb +4 -3
  36. data/lib/pghero/methods/basic.rb +26 -31
  37. data/lib/pghero/methods/connections.rb +4 -4
  38. data/lib/pghero/methods/constraints.rb +1 -1
  39. data/lib/pghero/methods/explain.rb +4 -3
  40. data/lib/pghero/methods/indexes.rb +8 -8
  41. data/lib/pghero/methods/kill.rb +1 -1
  42. data/lib/pghero/methods/maintenance.rb +3 -3
  43. data/lib/pghero/methods/queries.rb +2 -2
  44. data/lib/pghero/methods/query_stats.rb +34 -24
  45. data/lib/pghero/methods/replication.rb +2 -2
  46. data/lib/pghero/methods/sequences.rb +10 -5
  47. data/lib/pghero/methods/settings.rb +8 -1
  48. data/lib/pghero/methods/space.rb +20 -14
  49. data/lib/pghero/methods/suggested_indexes.rb +14 -7
  50. data/lib/pghero/methods/system.rb +12 -6
  51. data/lib/pghero/methods/tables.rb +4 -5
  52. data/lib/pghero/version.rb +1 -1
  53. data/lib/pghero.rb +35 -36
  54. data/lib/tasks/pghero.rake +11 -1
  55. data/licenses/LICENSE-chart.js.txt +1 -1
  56. data/licenses/LICENSE-date-fns.txt +21 -20
  57. data/licenses/LICENSE-kurkle-color.txt +9 -0
  58. metadata +8 -11
  59. data/app/assets/javascripts/pghero/highlight.pack.js +0 -2
@@ -2,11 +2,12 @@
2
2
  //= require ./nouislider
3
3
  //= require ./Chart.bundle
4
4
  //= require ./chartkick
5
- //= require ./highlight.pack
5
+ //= require ./highlight.min
6
6
 
7
7
  function highlightQueries() {
8
- $("pre code").each(function(i, block) {
9
- hljs.highlightBlock(block);
8
+ $("pre code").each(function (i, block) {
9
+ $(block).addClass("language-pgsql");
10
+ hljs.highlightElement(block);
10
11
  });
11
12
  }
12
13
 
@@ -45,9 +46,9 @@ function initSlider() {
45
46
  });
46
47
 
47
48
  // remove outline for mouse only
48
- $(".noUi-handle").mousedown(function() {
49
+ $(".noUi-handle").mousedown(function () {
49
50
  $(this).addClass("no-outline");
50
- }).blur(function() {
51
+ }).blur(function () {
51
52
  $(this).removeClass("no-outline");
52
53
  });
53
54
 
@@ -61,14 +62,14 @@ function initSlider() {
61
62
  var time = timeAt(offset);
62
63
 
63
64
  var html = "";
64
- if (time == now) {
65
- if (selector == "#range-end") {
65
+ if (time === now) {
66
+ if (selector === "#range-end") {
66
67
  html = "Now";
67
68
  }
68
69
  } else {
69
70
  html = time.getDate() + " " + months[time.getMonth()] + " " + pad(time.getHours()) + ":" + pad(time.getMinutes());
70
71
  }
71
- $(selector).html(html);
72
+ $(selector).text(html);
72
73
  }
73
74
 
74
75
  function timeAt(offset) {
@@ -77,7 +78,7 @@ function initSlider() {
77
78
  }
78
79
 
79
80
  function timeParam(time) {
80
- return time.toISOString();
81
+ return time.toISOString().replace(/\.000Z$/, "Z");
81
82
  }
82
83
 
83
84
  function queriesPath(params) {
@@ -115,7 +116,7 @@ function initSlider() {
115
116
 
116
117
  var path = queriesPath(params);
117
118
 
118
- $(".queries-table th a").each( function () {
119
+ $(".queries-table th a").each(function () {
119
120
  var p = $.extend({}, params, {sort: $(this).data("sort"), min_average_time: minAverageTime, min_calls: minCalls, debug: debug});
120
121
  if (!p.sort) {
121
122
  delete p.sort;
@@ -135,7 +136,7 @@ function initSlider() {
135
136
 
136
137
  var callback = function (response, status, xhr) {
137
138
  if (status === "error" ) {
138
- $(".queries-info").css("color", "red").html(xhr.status + " " + xhr.statusText);
139
+ $(".queries-info").css("color", "red").text(xhr.status + " " + xhr.statusText);
139
140
  } else {
140
141
  highlightQueries();
141
142
  }
@@ -152,7 +153,21 @@ function initSlider() {
152
153
  refreshStats(true);
153
154
  });
154
155
  updateText();
155
- $( function () {
156
+ $(function () {
156
157
  refreshStats(false);
157
158
  });
158
159
  }
160
+
161
+ $(document).on("click", ".query-code", function () {
162
+ this.style.maxHeight = "none";
163
+ });
164
+
165
+ $(document).on("click", ".migration-link", function (e) {
166
+ e.preventDefault();
167
+ $(this).parent().next(".migration").css("display", "block");
168
+ });
169
+
170
+ $(document).on("click", ".show-details", function () {
171
+ $(this).nextAll(".details").css("display", "block");
172
+ $(this).css("display", "none");
173
+ });