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

Add latest changes from gitlab-org/gitlab@master

parent 6315ed96
No related branches found
No related tags found
No related merge requests found
Showing
with 102 additions and 144 deletions
Loading
Loading
@@ -71,6 +71,7 @@ export const getFileData = (
const url = joinPaths(
gon.relative_url_root || '/',
state.currentProjectId,
'-',
file.type,
getters.lastCommit && getters.lastCommit.id,
escapeFileUrl(file.prevPath || file.path),
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@ export function fetchLogsTree(client, path, offset, resolver = null) {
 
fetchpromise = axios
.get(
`${gon.relative_url_root}/${projectPath}/refs/${ref}/logs_tree/${path.replace(/^\//, '')}`,
`${gon.relative_url_root}/${projectPath}/-/refs/${ref}/logs_tree/${path.replace(/^\//, '')}`,
{
params: { format: 'json', offset },
},
Loading
Loading
.snippet-row {
.title {
margin-bottom: 2px;
font-weight: $gl-font-weight-bold;
}
 
.snippet-filename {
Loading
Loading
@@ -11,6 +12,10 @@
.snippet-info {
color: $gl-text-color-secondary;
}
a {
color: $gl-text-color;
}
}
 
.snippet-form-holder .file-holder .file-title {
Loading
Loading
Loading
Loading
@@ -30,7 +30,7 @@ class Projects::ErrorTrackingController < Projects::ErrorTracking::BaseControlle
service = ErrorTracking::IssueUpdateService.new(project, current_user, issue_update_params)
result = service.execute
 
return if handle_errors(result)
return if render_errors(result)
 
render json: {
result: result
Loading
Loading
@@ -47,7 +47,7 @@ class Projects::ErrorTrackingController < Projects::ErrorTracking::BaseControlle
)
result = service.execute
 
return if handle_errors(result)
return if render_errors(result)
 
render json: {
errors: serialize_errors(result[:issues]),
Loading
Loading
@@ -60,14 +60,14 @@ class Projects::ErrorTrackingController < Projects::ErrorTracking::BaseControlle
service = ErrorTracking::IssueDetailsService.new(project, current_user, issue_details_params)
result = service.execute
 
return if handle_errors(result)
return if render_errors(result)
 
render json: {
error: serialize_detailed_error(result[:issue])
}
end
 
def handle_errors(result)
def render_errors(result)
unless result[:status] == :success
render json: { message: result[:message] },
status: result[:http_status] || :bad_request
Loading
Loading
@@ -75,7 +75,7 @@ class Projects::ErrorTrackingController < Projects::ErrorTracking::BaseControlle
end
 
def list_issues_params
params.permit(:search_term, :sort, :cursor)
params.permit(:search_term, :sort, :cursor, :issue_status)
end
 
def issue_update_params
Loading
Loading
Loading
Loading
@@ -89,7 +89,9 @@ module ErrorTracking
end
 
def list_sentry_projects
{ projects: sentry_client.projects }
handle_exceptions do
{ projects: sentry_client.projects }
end
end
 
def issue_details(opts = {})
Loading
Loading
Loading
Loading
@@ -3,21 +3,9 @@
module ErrorTracking
class BaseService < ::BaseService
def execute
unauthorized = check_permissions
return unauthorized if unauthorized
 
begin
response = perform
rescue Sentry::Client::Error => e
return error(e.message, :bad_request)
rescue Sentry::Client::MissingKeysError => e
return error(e.message, :internal_server_error)
end
errors = parse_errors(response)
return errors if errors
success(parse_response(response))
perform
end
 
private
Loading
Loading
@@ -27,12 +15,21 @@ module ErrorTracking
"#{self.class} does not implement #{__method__}"
end
 
def compose_response(response, &block)
errors = parse_errors(response)
return errors if errors
yield if block_given?
success(parse_response(response))
end
def parse_response(response)
raise NotImplementedError,
"#{self.class} does not implement #{__method__}"
end
 
def check_permissions
def unauthorized
return error('Error Tracking is not enabled') unless enabled?
return error('Access denied', :unauthorized) unless can_read?
end
Loading
Loading
Loading
Loading
@@ -5,7 +5,9 @@ module ErrorTracking
private
 
def perform
project_error_tracking_setting.issue_details(issue_id: params[:issue_id])
response = project_error_tracking_setting.issue_details(issue_id: params[:issue_id])
compose_response(response)
end
 
def parse_response(response)
Loading
Loading
Loading
Loading
@@ -5,7 +5,9 @@ module ErrorTracking
private
 
def perform
project_error_tracking_setting.issue_latest_event(issue_id: params[:issue_id])
response = project_error_tracking_setting.issue_latest_event(issue_id: params[:issue_id])
compose_response(response)
end
 
def parse_response(response)
Loading
Loading
Loading
Loading
@@ -7,21 +7,15 @@ module ErrorTracking
private
 
def perform
response = fetch
response = project_error_tracking_setting.update_issue(
issue_id: params[:issue_id],
params: update_params
)
 
unless parse_errors(response).present?
compose_response(response) do
response[:closed_issue_iid] = update_related_issue&.iid
project_error_tracking_setting.expire_issues_cache
end
response
end
def fetch
project_error_tracking_setting.update_issue(
issue_id: params[:issue_id],
params: update_params
)
end
 
def update_related_issue
Loading
Loading
@@ -74,7 +68,7 @@ module ErrorTracking
}
end
 
def check_permissions
def unauthorized
return error('Error Tracking is not enabled') unless enabled?
return error('Access denied', :unauthorized) unless can_update?
end
Loading
Loading
Loading
Loading
@@ -6,6 +6,13 @@ module ErrorTracking
DEFAULT_LIMIT = 20
DEFAULT_SORT = 'last_seen'
 
# Sentry client supports 'muted' and 'assigned' but GitLab does not
ISSUE_STATUS_VALUES = %w[
resolved
unresolved
ignored
].freeze
def external_url
project_error_tracking_setting&.sentry_external_url
end
Loading
Loading
@@ -13,19 +20,31 @@ module ErrorTracking
private
 
def perform
project_error_tracking_setting.list_sentry_issues(
return invalid_status_error unless valid_status?
response = project_error_tracking_setting.list_sentry_issues(
issue_status: issue_status,
limit: limit,
search_term: params[:search_term].presence,
sort: sort,
cursor: params[:cursor].presence
)
compose_response(response)
end
 
def parse_response(response)
response.slice(:issues, :pagination)
end
 
def invalid_status_error
error('Bad Request: Invalid issue_status', http_status_for(:bad_Request))
end
def valid_status?
ISSUE_STATUS_VALUES.include?(issue_status)
end
def issue_status
params[:issue_status] || DEFAULT_ISSUE_STATUS
end
Loading
Loading
Loading
Loading
@@ -2,18 +2,16 @@
 
module ErrorTracking
class ListProjectsService < ErrorTracking::BaseService
def execute
private
def perform
unless project_error_tracking_setting.valid?
return error(project_error_tracking_setting.errors.full_messages.join(', '), :bad_request)
end
 
super
end
response = project_error_tracking_setting.list_sentry_projects
 
private
def perform
project_error_tracking_setting.list_sentry_projects
compose_response(response)
end
 
def parse_response(response)
Loading
Loading
Loading
Loading
@@ -3,17 +3,22 @@
- snippet_chunks = snippet_blob[:snippet_chunks]
- snippet_path = gitlab_snippet_path(snippet)
 
.search-result-row
%span
= snippet.title
.search-result-row.snippet-row
= image_tag avatar_icon_for_user(snippet.author), class: "avatar s40 d-none d-sm-block", alt: ''
.title
= link_to gitlab_snippet_path(snippet) do
= snippet.title
.snippet-info
= snippet.to_reference
&middot;
authored
= time_ago_with_tooltip(snippet.created_at)
by
= link_to user_snippets_path(snippet.author) do
= image_tag avatar_icon_for_user(snippet.author), class: "avatar avatar-inline s16", alt: ''
= snippet.author_name
%span.light= time_ago_with_tooltip(snippet.created_at)
%h4.snippet-title
.file-holder
.js-file-title.file-title
.file-holder.my-2
.js-file-title.file-title-flex-parent
= link_to snippet_path do
%i.fa.fa-file
%strong= snippet.file_name
Loading
Loading
---
title: Fix design of snippet search results page
merge_request: 23780
author:
type: fixed
---
title: Migrate epic, epic notes mentions to respective DB table
merge_request: 22333
author:
type: changed
---
title: Fix pipeline status loading errors on project dashboard page caused by Gitaly
connection failures
merge_request: 23378
author:
type: fixed
# frozen_string_literal: true
class MigrateEpicMentionsToDb < ActiveRecord::Migration[5.2]
DOWNTIME = false
disable_ddl_transaction!
DELAY = 2.minutes.to_i
BATCH_SIZE = 10000
MIGRATION = 'UserMentions::CreateResourceUserMention'
JOIN = "LEFT JOIN epic_user_mentions on epics.id = epic_user_mentions.epic_id"
QUERY_CONDITIONS = "(description like '%@%' OR title like '%@%') AND epic_user_mentions.epic_id is null"
class Epic < ActiveRecord::Base
include EachBatch
self.table_name = 'epics'
end
def up
return unless Gitlab.ee?
Epic
.joins(JOIN)
.where(QUERY_CONDITIONS)
.each_batch(of: BATCH_SIZE) do |batch, index|
range = batch.pluck(Arel.sql('MIN(epics.id)'), Arel.sql('MAX(epics.id)')).first
BackgroundMigrationWorker.perform_in(index * DELAY, MIGRATION, ['Epic', JOIN, QUERY_CONDITIONS, false, *range])
end
end
def down
# no-op
end
end
# frozen_string_literal: true
class MigrateEpicNotesMentionsToDb < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
DELAY = 2.minutes.to_i
BATCH_SIZE = 10000
MIGRATION = 'UserMentions::CreateResourceUserMention'
INDEX_NAME = 'epic_mentions_temp_index'
INDEX_CONDITION = "note LIKE '%@%'::text AND notes.noteable_type = 'Epic'"
QUERY_CONDITIONS = "#{INDEX_CONDITION} AND epic_user_mentions.epic_id IS NULL"
JOIN = 'LEFT JOIN epic_user_mentions ON notes.id = epic_user_mentions.note_id'
class Note < ActiveRecord::Base
include EachBatch
self.table_name = 'notes'
end
def up
return unless Gitlab.ee?
# create temporary index for notes with mentions, may take well over 1h
add_concurrent_index(:notes, :id, where: INDEX_CONDITION, name: INDEX_NAME)
Note
.joins(JOIN)
.where(QUERY_CONDITIONS)
.each_batch(of: BATCH_SIZE) do |batch, index|
range = batch.pluck(Arel.sql('MIN(notes.id)'), Arel.sql('MAX(notes.id)')).first
BackgroundMigrationWorker.perform_in(index * DELAY, MIGRATION, ['Epic', JOIN, QUERY_CONDITIONS, true, *range])
end
end
def down
# no-op
# temporary index is to be dropped in a different migration in an upcoming release:
# https://gitlab.com/gitlab-org/gitlab/issues/196842
end
end
Loading
Loading
@@ -2778,7 +2778,6 @@ ActiveRecord::Schema.define(version: 2020_01_27_090233) do
t.index ["commit_id"], name: "index_notes_on_commit_id"
t.index ["created_at"], name: "index_notes_on_created_at"
t.index ["discussion_id"], name: "index_notes_on_discussion_id"
t.index ["id"], name: "epic_mentions_temp_index", where: "((note ~~ '%@%'::text) AND ((noteable_type)::text = 'Epic'::text))"
t.index ["line_code"], name: "index_notes_on_line_code"
t.index ["note"], name: "index_notes_on_note_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["noteable_id", "noteable_type"], name: "index_notes_on_noteable_id_and_noteable_type"
Loading
Loading
Loading
Loading
@@ -9,20 +9,29 @@ description: 'Learn how to contribute to GitLab.'
 
- Set up GitLab's development environment with [GitLab Development Kit (GDK)](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/README.md)
- [GitLab contributing guide](contributing/index.md)
- [Architecture](architecture.md) of GitLab
- [Issues workflow](contributing/issue_workflow.md) (issue tracker guidelines, triaging, labels, feature proposals, issue weight, regression issues, technical and UX debt)
- [Merge requests workflow](contributing/merge_request_workflow.md) (merge request guidelines, contribution acceptance criteria, definition of done, dependencies)
- [Style guides](contributing/style_guides.md)
- [Implement design & UI elements](contributing/design.md)
- [GitLab Architecture Overview](architecture.md)
- [Rake tasks](rake_tasks.md) for development
 
## Processes
 
- [GitLab core team & GitLab Inc. contribution process](https://gitlab.com/gitlab-org/gitlab/blob/master/PROCESS.md)
- [Generate a changelog entry with `bin/changelog`](changelog.md)
**Must-reads:**
- [Code review guidelines](code_review.md) for reviewing code and having code reviewed
- [Database review guidelines](database_review.md) for reviewing database-related changes and complex SQL queries, and having them reviewed
- [Pipelines for the GitLab project](pipelines.md)
- [Guidelines for implementing Enterprise Edition features](ee_features.md)
Complementary reads:
- [GitLab core team & GitLab Inc. contribution process](https://gitlab.com/gitlab-org/gitlab/blob/master/PROCESS.md)
- [Security process for developers](https://gitlab.com/gitlab-org/release/docs/blob/master/general/security/developer.md#security-releases-critical-non-critical-as-a-developer)
- [Requesting access to Chatops on GitLab.com](chatops_on_gitlabcom.md#requesting-access) (for GitLabbers)
- [Guidelines for implementing Enterprise Edition features](ee_features.md)
- [Danger bot](dangerbot.md)
- [Generate a changelog entry with `bin/changelog`](changelog.md)
- [Requesting access to Chatops on GitLab.com](chatops_on_gitlabcom.md#requesting-access) (for GitLabbers)
 
## UX and Frontend guides
 
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ For guidance on UX implementation at GitLab, please refer to our [Design System]
 
The UX team uses labels to manage their workflow.
 
The ~"UX" label on an issue is a signal to the UX team that it will need UX attention.
The ~"UX" label on an issue is a signal to the UX team that it will need UX attention.
To better understand the priority by which UX tackles issues, see the [UX section](https://about.gitlab.com/handbook/engineering/ux/) of the handbook.
 
Once an issue has been worked on and is ready for development, a UXer removes the ~"UX" label and applies the ~"UX ready" label to that issue.
Loading
Loading
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