summaryrefslogtreecommitdiff
path: root/vendor/assets/javascripts
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-06-07 19:55:07 +0200
committerRémy Coutable <remy@rymai.me>2017-06-09 17:21:39 +0200
commite85914532970d61d53f025f3ff0d85891bab2637 (patch)
treea54bac63e63570a31ff31d4cafffc31e1636a1a0 /vendor/assets/javascripts
parent55631e3d52dd2e16b69b02ffc99207b60a22989e (diff)
downloadgitlab-ce-e85914532970d61d53f025f3ff0d85891bab2637.tar.gz
Fix Rubocop offenses, improve SQL duration format and changelog entry
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'vendor/assets/javascripts')
-rw-r--r--vendor/assets/javascripts/peek.js30
1 files changed, 8 insertions, 22 deletions
diff --git a/vendor/assets/javascripts/peek.js b/vendor/assets/javascripts/peek.js
index 0aec31ee2cb..4db076d259a 100644
--- a/vendor/assets/javascripts/peek.js
+++ b/vendor/assets/javascripts/peek.js
@@ -1,6 +1,4 @@
-var requestId;
-
-requestId = null;
+let requestId = null;
(function($) {
var fetchRequestResults, getRequestId, peekEnabled, toggleBar, updatePerformanceBar;
@@ -16,9 +14,11 @@ requestId = null;
};
updatePerformanceBar = function(results) {
var key, label, data, table, html, tr, duration_td, sql_td, strong;
- for (key in results.data) {
- for (label in results.data[key]) {
+
+ Object.keys(results.data).forEach((key) => {
+ Object.keys(results.data[key]).forEach((label) => {
data = results.data[key][label];
+
if (label == 'queries') {
table = document.createElement('table');
@@ -40,12 +40,11 @@ requestId = null;
table.className = 'table';
$("[data-defer-to=" + key + "-" + label + "]").html(table);
- }
- else {
+ } else {
$("[data-defer-to=" + key + "-" + label + "]").text(results.data[key][label]);
}
- }
- }
+ });
+ });
return $(document).trigger('peek:render', [getRequestId(), results]);
};
toggleBar = function(event) {
@@ -77,19 +76,6 @@ requestId = null;
};
$(document).on('keypress', toggleBar);
$(document).on('peek:update', fetchRequestResults);
- $(document).on('pjax:end', function(event, xhr, options) {
- if (xhr != null) {
- requestId = xhr.getResponseHeader('X-Request-Id');
- }
- if (peekEnabled()) {
- return $(this).trigger('peek:update');
- }
- });
- $(document).on('page:change turbolinks:load', function() {
- if (peekEnabled()) {
- return $(this).trigger('peek:update');
- }
- });
return $(function() {
if (peekEnabled()) {
return $(this).trigger('peek:update');