pghero 2.8.3 → 3.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -0
  3. data/LICENSE.txt +1 -1
  4. data/app/assets/javascripts/pghero/Chart.bundle.js +23379 -19766
  5. data/app/assets/javascripts/pghero/application.js +13 -12
  6. data/app/assets/javascripts/pghero/chartkick.js +834 -764
  7. data/app/assets/javascripts/pghero/highlight.min.js +440 -0
  8. data/app/assets/javascripts/pghero/jquery.js +318 -197
  9. data/app/assets/javascripts/pghero/nouislider.js +676 -1066
  10. data/app/assets/stylesheets/pghero/application.css +8 -2
  11. data/app/assets/stylesheets/pghero/nouislider.css +4 -10
  12. data/app/controllers/pg_hero/home_controller.rb +103 -37
  13. data/app/helpers/pg_hero/home_helper.rb +2 -2
  14. data/app/views/layouts/pg_hero/application.html.erb +4 -2
  15. data/app/views/pg_hero/home/_query_stats_slider.html.erb +6 -6
  16. data/app/views/pg_hero/home/connections.html.erb +6 -6
  17. data/app/views/pg_hero/home/explain.html.erb +4 -2
  18. data/app/views/pg_hero/home/index.html.erb +3 -1
  19. data/app/views/pg_hero/home/queries.html.erb +4 -2
  20. data/app/views/pg_hero/home/relation_space.html.erb +1 -1
  21. data/app/views/pg_hero/home/show_query.html.erb +17 -13
  22. data/app/views/pg_hero/home/space.html.erb +44 -40
  23. data/app/views/pg_hero/home/system.html.erb +6 -6
  24. data/lib/generators/pghero/query_stats_generator.rb +1 -0
  25. data/lib/generators/pghero/space_stats_generator.rb +1 -0
  26. data/lib/generators/pghero/templates/config.yml.tt +6 -0
  27. data/lib/pghero/database.rb +0 -7
  28. data/lib/pghero/engine.rb +1 -1
  29. data/lib/pghero/methods/basic.rb +6 -9
  30. data/lib/pghero/methods/connections.rb +5 -5
  31. data/lib/pghero/methods/constraints.rb +1 -1
  32. data/lib/pghero/methods/explain.rb +34 -0
  33. data/lib/pghero/methods/indexes.rb +8 -8
  34. data/lib/pghero/methods/kill.rb +1 -1
  35. data/lib/pghero/methods/maintenance.rb +4 -4
  36. data/lib/pghero/methods/queries.rb +2 -2
  37. data/lib/pghero/methods/query_stats.rb +28 -29
  38. data/lib/pghero/methods/replication.rb +2 -2
  39. data/lib/pghero/methods/sequences.rb +3 -3
  40. data/lib/pghero/methods/settings.rb +1 -1
  41. data/lib/pghero/methods/space.rb +20 -14
  42. data/lib/pghero/methods/suggested_indexes.rb +40 -110
  43. data/lib/pghero/methods/system.rb +16 -16
  44. data/lib/pghero/methods/tables.rb +4 -5
  45. data/lib/pghero/methods/users.rb +12 -4
  46. data/lib/pghero/version.rb +1 -1
  47. data/lib/pghero.rb +90 -65
  48. data/lib/tasks/pghero.rake +11 -1
  49. data/licenses/LICENSE-chart.js.txt +1 -1
  50. data/licenses/LICENSE-date-fns.txt +21 -20
  51. data/licenses/LICENSE-kurkle-color.txt +9 -0
  52. metadata +9 -8
  53. 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,7 @@ function initSlider() {
152
153
  refreshStats(true);
153
154
  });
154
155
  updateText();
155
- $( function () {
156
+ $(function () {
156
157
  refreshStats(false);
157
158
  });
158
159
  }