diff options
-rw-r--r-- | app/assets/javascripts/peek.js | 6 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 2 | ||||
-rw-r--r-- | app/views/peek/views/_pg.html.haml | 6 | ||||
-rw-r--r-- | config/initializers/peek.rb | 2 | ||||
-rw-r--r-- | config/routes.rb | 2 | ||||
-rw-r--r-- | spec/models/commit_spec.rb | 2 | ||||
-rw-r--r-- | vendor/assets/javascripts/peek.js | 10 |
7 files changed, 12 insertions, 18 deletions
diff --git a/app/assets/javascripts/peek.js b/app/assets/javascripts/peek.js index 60f8bdd14c0..cdc6a54f4f5 100644 --- a/app/assets/javascripts/peek.js +++ b/app/assets/javascripts/peek.js @@ -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(); }); diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7c1a4759cf2..91694ebcd1d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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? diff --git a/app/views/peek/views/_pg.html.haml b/app/views/peek/views/_pg.html.haml index 7a1901eb7d2..e38c07a6097 100644 --- a/app/views/peek/views/_pg.html.haml +++ b/app/views/peek/views/_pg.html.haml @@ -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 diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb index c88ae4b62d2..c1c65cedccf 100644 --- a/config/initializers/peek.rb +++ b/config/initializers/peek.rb @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 9a117711083..4fd6cb5d439 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 3905240f48d..ba247dcc5cf 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -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) diff --git a/vendor/assets/javascripts/peek.js b/vendor/assets/javascripts/peek.js index 4db076d259a..427a8a3efad 100644 --- a/vendor/assets/javascripts/peek.js +++ b/vendor/assets/javascripts/peek.js @@ -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() }, |