summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-06-07 16:53:13 +0200
committerRémy Coutable <remy@rymai.me>2017-06-09 17:21:39 +0200
commit651eb51ececf9c256416eabe87c062ef33f45502 (patch)
tree6c77ca71fd5af17db2cba2c51113c97cda03f4c3 /vendor
parent5f218eb5c3ceabb42c42109bb7fe7427bd72e12f (diff)
downloadgitlab-ce-651eb51ececf9c256416eabe87c062ef33f45502.tar.gz
Display queries duration in performance bar queries modal
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'vendor')
-rw-r--r--vendor/assets/javascripts/peek.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/vendor/assets/javascripts/peek.js b/vendor/assets/javascripts/peek.js
index 51d797ffd12..0aec31ee2cb 100644
--- a/vendor/assets/javascripts/peek.js
+++ b/vendor/assets/javascripts/peek.js
@@ -15,25 +15,31 @@ requestId = null;
return $('#peek').length;
};
updatePerformanceBar = function(results) {
- var key, label, data, table, html, tr, td;
+ var key, label, data, table, html, tr, duration_td, sql_td, strong;
for (key in results.data) {
for (label in results.data[key]) {
data = results.data[key][label];
- console.log(data);
- if (Array.isArray(data)) {
+ if (label == 'queries') {
table = document.createElement('table');
for (var i = 0; i < data.length; i += 1) {
tr = document.createElement('tr');
- td = document.createElement('td');
+ duration_td = document.createElement('td');
+ sql_td = document.createElement('td');
+ strong = document.createElement('strong');
+
+ strong.append(data[i]['duration'] + 'ms');
+ duration_td.appendChild(strong);
+ tr.appendChild(duration_td);
+
+ sql_td.appendChild(document.createTextNode(data[i]['sql']));
+ tr.appendChild(sql_td);
- td.appendChild(document.createTextNode(data[i]));
- tr.appendChild(td);
table.appendChild(tr);
}
- $table = $(table).addClass('table');
- $("[data-defer-to=" + key + "-" + label + "]").html($table);
+ table.className = 'table';
+ $("[data-defer-to=" + key + "-" + label + "]").html(table);
}
else {
$("[data-defer-to=" + key + "-" + label + "]").text(results.data[key][label]);