Fix linting, route, and specs

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-06-07 23:51:13 +02:00
parent af0c691706
commit b173ae6b48
7 changed files with 12 additions and 18 deletions

View File

@ -1,16 +1,16 @@
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();
});

View File

@ -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?

View File

@ -1,8 +1,8 @@
%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

View File

@ -17,6 +17,7 @@ Peek.into Peek::Views::Sidekiq
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 PEEK_DB_CLIENT
self.query_details = Concurrent::Array.new
end
# rubocop:disable Style/ClassAndModuleCamelCase
PEEK_DB_VIEW.prepend ::Gitlab::PerformanceBar::PeekQueryTracker

View File

@ -11,7 +11,6 @@ Rails.application.routes.draw do
post :toggle_award_emoji, on: :member
end
mount Peek::Railtie => '/peek'
draw :sherlock
draw :development
draw :ci
@ -43,6 +42,7 @@ Rails.application.routes.draw do
get 'liveness' => 'health#liveness'
get 'readiness' => 'health#readiness'
resources :metrics, only: [:index]
mount Peek::Railtie => '/peek'
end
# Koding route

View File

@ -20,8 +20,8 @@ describe Commit, models: true do
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)

View File

@ -1,13 +1,7 @@
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()
},