Skip to content
Snippets Groups Projects
Commit 88542a5e authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent b570d73e
No related branches found
No related tags found
No related merge requests found
Showing
with 100 additions and 272 deletions
<script>
import { mapActions, mapState, mapGetters } from 'vuex';
import { mapActions, mapState } from 'vuex';
import {
GlEmptyState,
GlButton,
GlLink,
GlLoadingIcon,
GlTable,
GlSearchBoxByType,
GlSearchBoxByClick,
} from '@gitlab/ui';
import { visitUrl } from '~/lib/utils/url_utility';
import Icon from '~/vue_shared/components/icon.vue';
Loading
Loading
@@ -28,7 +28,7 @@ export default {
GlLink,
GlLoadingIcon,
GlTable,
GlSearchBoxByType,
GlSearchBoxByClick,
Icon,
TimeAgo,
},
Loading
Loading
@@ -64,10 +64,6 @@ export default {
},
computed: {
...mapState('list', ['errors', 'externalUrl', 'loading']),
...mapGetters('list', ['filterErrorsByTitle']),
filteredErrors() {
return this.errorSearchQuery ? this.filterErrorsByTitle(this.errorSearchQuery) : this.errors;
},
},
created() {
if (this.errorTrackingEnabled) {
Loading
Loading
@@ -76,6 +72,9 @@ export default {
},
methods: {
...mapActions('list', ['startPolling', 'restartPolling']),
filterErrors() {
this.startPolling(`${this.indexPath}?search_term=${this.errorSearchQuery}`);
},
trackViewInSentryOptions,
viewDetails(errorId) {
visitUrl(`error_tracking/${errorId}/details`);
Loading
Loading
@@ -87,17 +86,15 @@ export default {
<template>
<div>
<div v-if="errorTrackingEnabled">
<div v-if="loading" class="py-3">
<gl-loading-icon :size="3" />
</div>
<div v-else>
<div>
<div class="d-flex flex-row justify-content-around bg-secondary border">
<gl-search-box-by-type
<gl-search-box-by-click
v-model="errorSearchQuery"
class="col-lg-10 m-3 p-0"
:placeholder="__('Search or filter results...')"
type="search"
autofocus
@submit="filterErrors"
/>
<gl-button
v-track-event="trackViewInSentryOptions(externalUrl)"
Loading
Loading
@@ -111,9 +108,14 @@ export default {
</gl-button>
</div>
 
<div v-if="loading" class="py-3">
<gl-loading-icon size="md" />
</div>
<gl-table
v-else
class="mt-3"
:items="filteredErrors"
:items="errors"
:fields="$options.fields"
:show-empty="true"
fixed
Loading
Loading
Loading
Loading
@@ -4,7 +4,6 @@ import Vuex from 'vuex';
import * as listActions from './list/actions';
import listMutations from './list/mutations';
import listState from './list/state';
import * as listGetters from './list/getters';
 
import * as detailsActions from './details/actions';
import detailsMutations from './details/mutations';
Loading
Loading
@@ -21,7 +20,6 @@ export const createStore = () =>
state: listState(),
actions: listActions,
mutations: listMutations,
getters: listGetters,
},
details: {
namespaced: true,
Loading
Loading
Loading
Loading
@@ -7,6 +7,8 @@ import { __, sprintf } from '~/locale';
let eTagPoll;
 
export function startPolling({ commit, dispatch }, endpoint) {
commit(types.SET_LOADING, true);
eTagPoll = new Poll({
resource: Service,
method: 'getSentryData',
Loading
Loading
export const filterErrorsByTitle = state => errorQuery =>
state.errors.filter(error => error.title.match(new RegExp(`${errorQuery}`, 'i')));
export default () => {};
Loading
Loading
@@ -44,7 +44,11 @@ class Projects::ErrorTrackingController < Projects::ApplicationController
private
 
def render_index_json
service = ErrorTracking::ListIssuesService.new(project, current_user)
service = ErrorTracking::ListIssuesService.new(
project,
current_user,
list_issues_params
)
result = service.execute
 
return if handle_errors(result)
Loading
Loading
@@ -106,6 +110,10 @@ class Projects::ErrorTrackingController < Projects::ApplicationController
end
end
 
def list_issues_params
params.permit(:search_term)
end
def list_projects_params
params.require(:error_tracking_setting).permit([:api_host, :token])
end
Loading
Loading
Loading
Loading
@@ -5,6 +5,28 @@ module ErrorTracking
DEFAULT_ISSUE_STATUS = 'unresolved'
DEFAULT_LIMIT = 20
 
def execute
return error('Error Tracking is not enabled') unless enabled?
return error('Access denied', :unauthorized) unless can_read?
result = project_error_tracking_setting.list_sentry_issues(
issue_status: issue_status,
limit: limit,
search_term: search_term
)
# our results are not yet ready
unless result
return error('Not ready. Try again later', :no_content)
end
if result[:error].present?
return error(result[:error], http_status_for(result[:error_type]))
end
success(issues: result[:issues])
end
def external_url
project_error_tracking_setting&.sentry_external_url
end
Loading
Loading
@@ -26,5 +48,17 @@ module ErrorTracking
def limit
params[:limit] || DEFAULT_LIMIT
end
def search_term
params[:search_term].presence
end
def enabled?
project_error_tracking_setting&.enabled?
end
def can_read?
can?(current_user, :read_sentry_issue, project)
end
end
end
Loading
Loading
@@ -62,8 +62,6 @@ module MergeRequests
end
 
def updated_check!
return unless Feature.enabled?(:validate_merge_sha, merge_request.target_project, default_enabled: false)
unless source_matches?
raise_error('Branch has been updated since the merge was requested. '\
'Please review the changes.')
Loading
Loading
---
title: Validate the merge sha before merging, confirming that the merge will only
contain what the user saw
merge_request: 20348
author:
type: fixed
---
title: Remove done callbacks from vue_shared/components/markdown
merge_request: 16842
author: Lee Tickett
type: other
---
title: Search list of Sentry errors by title in GitLab
merge_request: 19439
author:
type: added
# frozen_string_literal: true
# for secondary email confirmations - uses the same confirmation controller as :users
devise_for :emails, path: 'profile/emails', controllers: { confirmations: :confirmations }
 
Loading
Loading
@@ -42,14 +44,6 @@ resource :profile, only: [:show, :update] do
end
end
 
Gitlab.ee do
resource :slack, only: [:edit] do
member do
get :slack_link
end
end
end
resources :chat_names, only: [:index, :new, :create, :destroy] do
collection do
delete :deny
Loading
Loading
@@ -73,10 +67,5 @@ resource :profile, only: [:show, :update] do
end
 
resources :u2f_registrations, only: [:destroy]
Gitlab.ee do
resources :pipeline_quota, only: [:index]
resources :billings, only: [:index]
end
end
end
resources :projects, only: [:index, :new, :create]
# frozen_string_literal: true
 
Gitlab.ee do
scope "/-/push_from_secondary/:geo_node_id" do
draw :git_http
end
end
resources :projects, only: [:index, :new, :create]
 
draw :git_http
 
Loading
Loading
@@ -87,22 +83,12 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resource :operations, only: [:show, :update]
resource :integrations, only: [:show]
 
Gitlab.ee do
resource :slack, only: [:destroy, :edit, :update] do
get :slack_auth
end
end
resource :repository, only: [:show], controller: :repository do
post :create_deploy_token, path: 'deploy_token/create'
post :cleanup
end
end
 
Gitlab.ee do
resources :feature_flags
end
resources :autocomplete_sources, only: [] do
collection do
get 'members'
Loading
Loading
@@ -268,16 +254,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
namespace :prometheus do
resources :metrics, constraints: { id: %r{[^\/]+} }, only: [:index, :new, :create, :edit, :update, :destroy] do
get :active_common, on: :collection
Gitlab.ee do
post :validate_query, on: :collection
end
end
Gitlab.ee do
resources :alerts, constraints: { id: /\d+/ }, only: [:index, :create, :show, :update, :destroy] do
post :notify, on: :collection
end
end
end
 
Loading
Loading
@@ -290,15 +266,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :pipeline_status
get :ci_environments_status
post :toggle_subscription
Gitlab.ee do
get :approvals
post :approvals, action: :approve
delete :approvals, action: :unapprove
post :rebase
end
post :remove_wip
post :assign_related_issues
get :discussions, format: :json
Loading
Loading
@@ -336,21 +303,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
post :bulk_update
end
 
Gitlab.ee do
resources :approvers, only: :destroy
delete 'approvers', to: 'approvers#destroy_via_user_id', as: :approver_via_user_id
resources :approver_groups, only: :destroy
scope module: :merge_requests do
resources :drafts, only: [:index, :update, :create, :destroy] do
collection do
post :publish
delete :discard
end
end
end
end
resources :discussions, only: [:show], constraints: { id: /\h{40}/ } do
member do
post :resolve
Loading
Loading
@@ -381,21 +333,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
 
Gitlab.ee do
resources :path_locks, only: [:index, :destroy] do
collection do
post :toggle
end
end
get '/service_desk' => 'service_desk#show', as: :service_desk
put '/service_desk' => 'service_desk#update', as: :service_desk_refresh
end
Gitlab.ee do
resources :push_rules, constraints: { id: /\d+/ }, only: [:update]
end
resources :pipelines, only: [:index, :new, :create, :show] do
collection do
resource :pipelines_settings, path: 'settings', only: [:show, :update]
Loading
Loading
@@ -414,11 +351,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :failures
get :status
get :test_report
Gitlab.ee do
get :security
get :licenses
end
end
 
member do
Loading
Loading
@@ -447,21 +379,12 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', constraints: { format: nil }
 
get '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api
Gitlab.ee do
get :logs
get '/pods/(:pod_name)/containers/(:container_name)/logs', to: 'environments#k8s_pod_logs', as: :k8s_pod_logs
end
end
 
collection do
get :metrics, action: :metrics_redirect
get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ }
get :search
Gitlab.ee do
get :logs, action: :logs_redirect
end
end
 
resources :deployments, only: [:index] do
Loading
Loading
@@ -472,14 +395,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
 
Gitlab.ee do
resources :protected_environments, only: [:create, :update, :destroy], constraints: { id: /\d+/ } do
collection do
get 'search'
end
end
end
namespace :serverless do
scope :functions do
get '/:environment_id/:id', to: 'functions#show'
Loading
Loading
@@ -522,14 +437,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
 
Gitlab.ee do
namespace :security do
resource :dashboard, only: [:show], controller: :dashboard
end
resources :vulnerability_feedback, only: [:index, :create, :update, :destroy], constraints: { id: /\d+/ }
end
get :issues, to: 'issues#calendar', constraints: lambda { |req| req.format == :ics }
 
resources :issues, concerns: :awardable, constraints: { id: /\d+/ } do
Loading
Loading
@@ -543,24 +450,11 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :realtime_changes
post :create_merge_request
get :discussions, format: :json
Gitlab.ee do
get 'designs(/*vueroute)', to: 'issues#designs', as: :designs, format: false
end
end
 
collection do
post :bulk_update
post :import_csv
Gitlab.ee do
post :export_csv
get :service_desk
end
end
Gitlab.ee do
resources :issue_links, only: [:index, :create, :destroy], as: 'links', path: 'links'
end
end
 
Loading
Loading
@@ -595,11 +489,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
 
Gitlab.ee do
resources :approvers, only: :destroy
resources :approver_groups, only: :destroy
end
resources :runner_projects, only: [:create, :destroy]
resources :badges, only: [:index] do
collection do
Loading
Loading
@@ -614,10 +503,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
 
Gitlab.ee do
resources :audit_events, only: [:index]
end
resources :error_tracking, only: [:index], controller: :error_tracking do
collection do
get ':issue_id/details',
Loading
Loading
@@ -639,9 +524,15 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
draw :wiki
draw :repository
 
Gitlab.ee do
resources :managed_licenses, only: [:index, :show, :new, :create, :edit, :update, :destroy]
end
# Legacy routes.
# Introduced in 12.0.
# Should be removed with https://gitlab.com/gitlab-org/gitlab/issues/28848.
Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags,
:network, :graphs, :autocomplete_sources,
:project_members, :deploy_keys, :deploy_tokens,
:labels, :milestones, :services, :boards, :releases,
:forks, :group_links, :import, :avatar, :mirror,
:cycle_analytics, :mattermost, :variables, :triggers)
end
 
resources(:projects,
Loading
Loading
@@ -666,23 +557,4 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
end
# Legacy routes.
# Introduced in 12.0.
# Should be removed with https://gitlab.com/gitlab-org/gitlab/issues/28848.
scope(path: '*namespace_id',
as: :namespace,
namespace_id: Gitlab::PathRegex.full_namespace_route_regex) do
scope(path: ':project_id',
constraints: { project_id: Gitlab::PathRegex.project_route_regex },
module: :projects,
as: :project) do
Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags,
:network, :graphs, :autocomplete_sources,
:project_members, :deploy_keys, :deploy_tokens,
:labels, :milestones, :services, :boards, :releases,
:forks, :group_links, :import, :avatar, :mirror,
:cycle_analytics, :mattermost, :variables, :triggers)
end
end
end
Gitlab.ee do
get 'unsubscribes/:email', to: 'unsubscribes#show', as: :unsubscribe
post 'unsubscribes/:email', to: 'unsubscribes#create'
end
# frozen_string_literal: true
 
# Allows individual providers to be directed to a chosen controller
# Call from inside devise_scope
Loading
Loading
@@ -30,10 +27,6 @@ devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks,
devise_scope :user do
get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
get '/users/almost_there' => 'confirmations#almost_there'
Gitlab.ee do
get '/users/auth/kerberos_spnego/negotiate' => 'omniauth_kerberos_spnego#negotiate'
end
end
 
scope '-/users', module: :users do
Loading
Loading
Loading
Loading
@@ -25,10 +25,6 @@ class ReworkRedirectRoutesIndexes < ActiveRecord::Migration[4.2]
remove_concurrent_index(:redirect_routes, :permanent)
end
 
# If we're on MySQL then the existing index on path is ok. But on
# Postgres we need to clean things up:
break unless Gitlab::Database.postgresql?
if_not_exists = Gitlab::Database.version.to_f >= 9.5 ? "IF NOT EXISTS" : ""
 
# Unique index on lower(path) across both types of redirect_routes:
Loading
Loading
@@ -53,8 +49,6 @@ class ReworkRedirectRoutesIndexes < ActiveRecord::Migration[4.2]
disable_statement_timeout do
add_concurrent_index(:redirect_routes, :permanent)
 
break unless Gitlab::Database.postgresql?
execute("CREATE INDEX CONCURRENTLY #{OLD_INDEX_NAME_PATH_TPOPS} ON redirect_routes (path varchar_pattern_ops);")
execute("CREATE INDEX CONCURRENTLY #{OLD_INDEX_NAME_PATH_LOWER} ON redirect_routes (LOWER(path));")
 
Loading
Loading
Loading
Loading
@@ -8,16 +8,10 @@ class AddSectionNameIdIndexOnCiBuildTraceSections < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
 
def up
# MySQL may already have this as a foreign key
unless index_exists?(:ci_build_trace_sections, :section_name_id, name: INDEX_NAME)
add_concurrent_index :ci_build_trace_sections, :section_name_id, name: INDEX_NAME
end
add_concurrent_index :ci_build_trace_sections, :section_name_id, name: INDEX_NAME
end
 
def down
# We cannot remove index for MySQL because it's needed for foreign key
if Gitlab::Database.postgresql?
remove_concurrent_index :ci_build_trace_sections, :section_name_id, name: INDEX_NAME
end
remove_concurrent_index :ci_build_trace_sections, :section_name_id, name: INDEX_NAME
end
end
Loading
Loading
@@ -13,28 +13,6 @@ class AddIndexesForUserActivityQueries < ActiveRecord::Migration[4.2]
def down
remove_concurrent_index :events, [:author_id, :project_id] if index_exists?(:events, [:author_id, :project_id])
 
patch_foreign_keys do
remove_concurrent_index :user_interacted_projects, :user_id if index_exists?(:user_interacted_projects, :user_id)
end
end
private
def patch_foreign_keys
return yield if Gitlab::Database.postgresql?
# MySQL doesn't like to remove the index with a foreign key using it.
remove_foreign_key :user_interacted_projects, :users if fk_exists?(:user_interacted_projects, :user_id)
yield
# Let's re-add the foreign key using the existing index on (user_id, project_id)
add_concurrent_foreign_key :user_interacted_projects, :users, column: :user_id unless fk_exists?(:user_interacted_projects, :user_id)
end
def fk_exists?(table, column)
foreign_keys(table).any? do |key|
key.options[:column] == column.to_s
end
remove_concurrent_index :user_interacted_projects, :user_id if index_exists?(:user_interacted_projects, :user_id)
end
end
Loading
Loading
@@ -29,14 +29,7 @@ class DropDuplicateProtectedTags < ActiveRecord::Migration[4.2]
.where(project_id: projects)
.where.not(id: ids)
 
if Gitlab::Database.postgresql?
tags.delete_all
else
# Workaround needed for MySQL
sql = "SELECT id FROM (#{tags.to_sql}) protected_tags"
ProtectedTag.where("id IN (#{sql})").delete_all # rubocop:disable GitlabSecurity/SqlInjection
end
tags.delete_all
end
end
 
Loading
Loading
Loading
Loading
@@ -8,11 +8,10 @@ class AddIndexToProjectDeployTokensDeployTokenId < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
 
def up
# MySQL already has index inserted
add_concurrent_index :project_deploy_tokens, :deploy_token_id if Gitlab::Database.postgresql?
add_concurrent_index :project_deploy_tokens, :deploy_token_id
end
 
def down
remove_concurrent_index(:project_deploy_tokens, :deploy_token_id) if Gitlab::Database.postgresql?
remove_concurrent_index(:project_deploy_tokens, :deploy_token_id)
end
end
Loading
Loading
@@ -50,17 +50,9 @@ class RemoveRedundantPipelineStages < ActiveRecord::Migration[4.2]
UPDATE ci_builds SET stage_id = NULL WHERE stage_id IN (#{redundant_stages_ids})
SQL
 
if Gitlab::Database.postgresql?
execute <<~SQL
DELETE FROM ci_stages WHERE id IN (#{redundant_stages_ids})
SQL
else # We can't modify a table we are selecting from on MySQL
execute <<~SQL
DELETE a FROM ci_stages AS a, ci_stages AS b
WHERE a.pipeline_id = b.pipeline_id AND a.name = b.name
AND a.id <> b.id
SQL
end
execute <<~SQL
DELETE FROM ci_stages WHERE id IN (#{redundant_stages_ids})
SQL
end
end
end
Loading
Loading
@@ -12,11 +12,7 @@ class BuildUserInteractedProjectsTable < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
 
def up
if Gitlab::Database.postgresql?
PostgresStrategy.new
else
MysqlStrategy.new
end.up
PostgresStrategy.new.up
 
if index_exists_by_name?(:user_interacted_projects, CreateUserInteractedProjectsTable::INDEX_NAME)
remove_concurrent_index_by_name :user_interacted_projects, CreateUserInteractedProjectsTable::INDEX_NAME
Loading
Loading
@@ -140,30 +136,4 @@ class BuildUserInteractedProjectsTable < ActiveRecord::Migration[4.2]
remove_concurrent_index(*args) if index_exists?(*args)
end
end
class MysqlStrategy < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
def up
execute <<~SQL
INSERT INTO user_interacted_projects (user_id, project_id)
SELECT e.user_id, e.project_id
FROM (SELECT DISTINCT author_id AS user_id, project_id FROM events WHERE project_id IS NOT NULL) AS e
LEFT JOIN user_interacted_projects ucp USING (user_id, project_id)
WHERE ucp.user_id IS NULL
SQL
unless index_exists?(:user_interacted_projects, [:project_id, :user_id])
add_concurrent_index :user_interacted_projects, [:project_id, :user_id], unique: true, name: UNIQUE_INDEX_NAME
end
unless foreign_key_exists?(:user_interacted_projects, :users, column: :user_id)
add_concurrent_foreign_key :user_interacted_projects, :users, column: :user_id, on_delete: :cascade
end
unless foreign_key_exists?(:user_interacted_projects, :projects, column: :project_id)
add_concurrent_foreign_key :user_interacted_projects, :projects, column: :project_id, on_delete: :cascade
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment