Commit b173ae6b authored by Rémy Coutable's avatar Rémy Coutable

Fix linting, route, and specs

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent af0c6917
import 'vendor/peek';
import 'vendor/peek.performance_bar';
$(document).on('click', '#peek-show-queries', function(e) {
$(document).on('click', '#peek-show-queries', (e) => {
e.preventDefault();
$('.peek-rblineprof-modal').hide();
let $modal = $('#modal-peek-pg-queries');
const $modal = $('#modal-peek-pg-queries');
if ($modal.length) {
$modal.modal('toggle');
}
});
$(document).on('click', '.js-lineprof-file', function(e) {
$(document).on('click', '.js-lineprof-file', (e) => {
e.preventDefault();
$(this).parents('.heading').next('div').toggle();
});
......@@ -19,7 +19,7 @@ class ApplicationController < ActionController::Base
before_action :ldap_security_check
before_action :sentry_context
before_action :default_headers
before_action :add_gon_variables, unless: -> { request.path.start_with?('/peek') }
before_action :add_gon_variables, unless: -> { request.path.start_with?('/-/peek') }
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :require_email, unless: :devise_controller?
......
%strong
%a#peek-show-queries{ href: '#' }
%span{ data: { defer_to: "#{view.defer_key}-duration" }}...
%span{ data: { defer_to: "#{view.defer_key}-duration" } }...
\/
%span{ data: { defer_to: "#{view.defer_key}-calls" }}...
%span{ data: { defer_to: "#{view.defer_key}-calls" } }...
#modal-peek-pg-queries.modal{ tabindex: -1 }
.modal-dialog
#modal-peek-pg-queries-content.modal-content
......@@ -10,5 +10,5 @@
%a.close{ href: "#", "data-dismiss" => "modal" } ×
%h4
SQL queries
.modal-body{ data: { defer_to: "#{view.defer_key}-queries" }}...
.modal-body{ data: { defer_to: "#{view.defer_key}-queries" } }...
pg
......@@ -17,6 +17,7 @@
Peek.into Peek::Views::Rblineprof
Peek.into Peek::Views::GC
# rubocop:disable Style/ClassAndModuleCamelCase
class PEEK_DB_CLIENT
class << self
attr_accessor :query_details
......@@ -24,5 +25,4 @@ class << self
self.query_details = Concurrent::Array.new
end
# rubocop:disable Style/ClassAndModuleCamelCase
PEEK_DB_VIEW.prepend ::Gitlab::PerformanceBar::PeekQueryTracker
......@@ -11,7 +11,6 @@
post :toggle_award_emoji, on: :member
end
mount Peek::Railtie => '/peek'
draw :sherlock
draw :development
draw :ci
......@@ -43,6 +42,7 @@
get 'liveness' => 'health#liveness'
get 'readiness' => 'health#readiness'
resources :metrics, only: [:index]
mount Peek::Railtie => '/peek'
end
# Koding route
......
......@@ -20,8 +20,8 @@
end
it 'caches the author' do
allow(RequestStore).to receive(:active?).and_return(true)
user = create(:user, email: commit.author_email)
expect(RequestStore).to receive(:active?).and_return(true)
expect_any_instance_of(Commit).to receive(:find_author_by_any_email).and_call_original
expect(commit.author).to eq(user)
......
let requestId = null;
(function($) {
var fetchRequestResults, getRequestId, peekEnabled, toggleBar, updatePerformanceBar;
getRequestId = function() {
if (requestId != null) {
return requestId;
} else {
return $('#peek').data('request-id');
}
return $('#peek').data('request-id');
};
peekEnabled = function() {
return $('#peek').length;
......@@ -64,7 +58,7 @@ let requestId = null;
}
};
fetchRequestResults = function() {
return $.ajax('/peek/results', {
return $.ajax('/-/peek/results', {
data: {
request_id: getRequestId()
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment