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

Add latest changes from gitlab-org/gitlab@master

parent 556c79d6
No related branches found
No related tags found
No related merge requests found
Showing
with 76 additions and 300 deletions
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33"
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33"
 
stages:
- sync
Loading
Loading
Loading
Loading
@@ -92,13 +92,21 @@ setup-test-env:
- .use-pg10
- .only-master
 
rspec migration pg9:
extends: .rspec-base-pg9
parallel: 4
rspec migration pg9-foss:
extends: .rspec-base-pg9-foss
parallel: 4
rspec unit pg9:
extends: .rspec-base-pg9
parallel: 24
parallel: 20
 
rspec unit pg9-foss:
extends: .rspec-base-pg9-foss
parallel: 24
parallel: 20
 
rspec integration pg9:
extends: .rspec-base-pg9
Loading
Loading
@@ -140,9 +148,13 @@ rspec system pg10:
- .only-ee
- .use-pg10-ee
 
rspec-ee migration pg9:
extends: .rspec-ee-base-pg9
parallel: 2
rspec-ee unit pg9:
extends: .rspec-ee-base-pg9
parallel: 7
parallel: 5
 
rspec-ee integration pg9:
extends: .rspec-ee-base-pg9
Loading
Loading
@@ -152,11 +164,17 @@ rspec-ee system pg9:
extends: .rspec-ee-base-pg9
parallel: 5
 
rspec-ee migration pg10:
extends:
- .rspec-ee-base-pg10
- .only-master
parallel: 2
rspec-ee unit pg10:
extends:
- .rspec-ee-base-pg10
- .only-master
parallel: 7
parallel: 5
 
rspec-ee integration pg10:
extends:
Loading
Loading
Loading
Loading
@@ -133,7 +133,7 @@ export default {
:keys="keys[currentTab]"
:store="store"
:endpoint="endpoint"
class="qa-project-deploy-keys"
data-qa-selector="project_deploy_keys"
/>
</template>
</div>
Loading
Loading
Loading
Loading
@@ -31,7 +31,7 @@ export default {
GlTooltip: GlTooltipDirective,
GlModal: GlModalDirective,
},
mixins: [Tracking.mixin({})],
mixins: [Tracking.mixin()],
props: {
repo: {
type: Object,
Loading
Loading
@@ -43,7 +43,6 @@ export default {
isOpen: false,
modalId: `confirm-repo-deletion-modal-${this.repo.id}`,
tracking: {
category: document.body.dataset.page,
label: 'registry_repository_delete',
},
};
Loading
Loading
@@ -67,7 +66,7 @@ export default {
}
},
handleDeleteRepository() {
this.track('confirm_delete', {});
this.track('confirm_delete');
return this.deleteItem(this.repo)
.then(() => {
createFlash(__('This container registry has been scheduled for deletion.'), 'notice');
Loading
Loading
@@ -103,7 +102,7 @@ export default {
:aria-label="s__('ContainerRegistry|Remove repository')"
class="js-remove-repo btn-inverted"
variant="danger"
@click="track('click_button', {})"
@click="track('click_button')"
>
<icon name="remove" />
</gl-button>
Loading
Loading
@@ -132,7 +131,7 @@ export default {
:modal-id="modalId"
ok-variant="danger"
@ok="handleDeleteRepository"
@cancel="track('cancel_delete', {})"
@cancel="track('cancel_delete')"
>
<template v-slot:modal-title>{{ s__('ContainerRegistry|Remove repository') }}</template>
<p
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@ export default {
directives: {
GlTooltip: GlTooltipDirective,
},
mixins: [timeagoMixin],
mixins: [timeagoMixin, Tracking.mixin()],
props: {
repo: {
type: Object,
Loading
Loading
@@ -71,9 +71,6 @@ export default {
},
methods: {
...mapActions(['fetchList', 'deleteItem', 'multiDeleteItems']),
track(action) {
Tracking.event(document.body.dataset.page, action, this.tracking);
},
setModalDescription(itemIndex = -1) {
if (itemIndex === -1) {
this.modalDescription = sprintf(
Loading
Loading
Loading
Loading
@@ -391,6 +391,10 @@ module IssuablesHelper
end
end
 
def issuable_templates_names(issuable)
issuable_templates(issuable).map { |template| template[:name] }
end
def selected_template(issuable)
params[:issuable_template] if issuable_templates(issuable).any? { |template| template[:name] == params[:issuable_template] }
end
Loading
Loading
Loading
Loading
@@ -133,7 +133,7 @@ class ActiveSession
 
entry_keys = raw_active_session_entries(redis, session_ids, user_id)
 
entry_keys.map do |raw_session|
entry_keys.compact.map do |raw_session|
Marshal.load(raw_session) # rubocop:disable Security/MarshalLoad
end
end
Loading
Loading
Loading
Loading
@@ -543,7 +543,11 @@ class Project < ApplicationRecord
#
# query - The search query as a String.
def search(query)
fuzzy_search(query, [:path, :name, :description])
if Feature.enabled?(:project_search_by_full_path, default_enabled: true)
joins(:route).fuzzy_search(query, [Route.arel_table[:path], :name, :description])
else
fuzzy_search(query, [:path, :name, :description])
end
end
 
def search_by_title(query)
Loading
Loading
---
title: Allow searching of projects by full path
merge_request: 20659
author:
type: added
Loading
Loading
@@ -48,35 +48,6 @@ function a(p) {
};
```
 
## Avoid side effects in constructors
Avoid making asynchronous calls, API requests or DOM manipulations in the `constructor`.
Move them into separate functions instead. This will make tests easier to write and
code easier to maintain.
```javascript
// bad
class myClass {
constructor(config) {
this.config = config;
axios.get(this.config.endpoint)
}
}
// good
class myClass {
constructor(config) {
this.config = config;
}
makeRequest() {
axios.get(this.config.endpoint)
}
}
const instance = new myClass();
instance.makeRequest();
```
## Avoid classes to handle DOM events
 
If the only purpose of the class is to bind a DOM event and handle the callback, prefer
Loading
Loading
@@ -215,7 +186,7 @@ we have a lot of examples of files which wrap their contents in IIFEs,
this is no longer necessary after the transition from Sprockets to webpack.
Do not use them anymore and feel free to remove them when refactoring legacy code.
 
## Global namespace and side effects
## Global namespace
 
Avoid adding to the global namespace.
 
Loading
Loading
@@ -227,6 +198,10 @@ window.MyClass = class { /* ... */ };
export default class MyClass { /* ... */ }
```
 
## Side effects
### Top-level side effects
Top-level side effects are forbidden in any script which contains `export`:
 
```javascript
Loading
Loading
@@ -238,38 +213,35 @@ document.addEventListener("DOMContentLoaded", function(event) {
}
```
 
Avoid constructors with side effects whenever possible.
### Avoid side effects in constructors
 
Side effects make constructors difficult to unit test and violate the [Single Responsibility Principle](https://en.wikipedia.org/wiki/Single_responsibility_principle).
Avoid making asynchronous calls, API requests or DOM manipulations in the `constructor`.
Move them into separate functions instead. This will make tests easier to write and
avoids violating the [Single Responsibility Principle](https://en.wikipedia.org/wiki/Single_responsibility_principle).
 
```javascript
// Bad
export class Foo {
constructor() {
this.currentState = state.INITIAL;
document.getElementById('root').addEventListener('click', this.handleCallback)
}
handleCallback() {
// bad
class myClass {
constructor(config) {
this.config = config;
axios.get(this.config.endpoint)
}
}
 
// Good
export class Foo {
constructor() {
this.currentState = state.INITIAL;
}
initListener(element) {
element.addEventListener('click', this.handleCallback)
// good
class myClass {
constructor(config) {
this.config = config;
}
handleCallback() {
makeRequest() {
axios.get(this.config.endpoint)
}
}
const instance = new myClass();
instance.makeRequest();
```
 
On the other hand, if a class only needs to extend a third-party or add
event listeners in some specific cases, they should be initialized outside
of the constructor.
## Pure Functions and Data Mutation
 
Strive to write many small pure functions and minimize where mutations occur
Loading
Loading
Loading
Loading
@@ -42,9 +42,9 @@ The current stages are:
## Default image
 
The default image is currently
`registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33`.
`registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-golang-1.12-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33`.
 
It includes Ruby 2.6.3, Go 1.11, Git 2.22, Chrome 73, Node 12, Yarn 1.16,
It includes Ruby 2.6.3, Go 1.12, Git 2.22, Chrome 73, Node 12, Yarn 1.16,
PostgreSQL 9.6, and Graphics Magick 1.3.33.
 
The images used in our pipelines are configured in the
Loading
Loading
doc/user/project/img/service_desk_disabled.png

11.4 KiB | W: 1600px | H: 266px

doc/user/project/img/service_desk_disabled.png

24.4 KiB | W: 1296px | H: 257px

doc/user/project/img/service_desk_disabled.png
doc/user/project/img/service_desk_disabled.png
doc/user/project/img/service_desk_disabled.png
doc/user/project/img/service_desk_disabled.png
  • 2-up
  • Swipe
  • Onion skin
doc/user/project/img/service_desk_enabled.png

21 KiB | W: 1426px | H: 482px

doc/user/project/img/service_desk_enabled.png

58.3 KiB | W: 1246px | H: 668px

doc/user/project/img/service_desk_enabled.png
doc/user/project/img/service_desk_enabled.png
doc/user/project/img/service_desk_enabled.png
doc/user/project/img/service_desk_enabled.png
  • 2-up
  • Swipe
  • Onion skin
Loading
Loading
@@ -57,7 +57,7 @@ you can skip the step 1 below; you only need to enable it per project.
support [email sub-addressing](../../administration/incoming_email.md#email-sub-addressing).
1. Navigate to your project's **Settings** and scroll down to the **Service Desk**
section.
1. If you have the correct access and an Premium license,
1. If you have the correct access and a Premium license,
you will see an option to set up Service Desk:
 
![Activate Service Desk option](img/service_desk_disabled.png)
Loading
Loading
@@ -79,6 +79,9 @@ you can skip the step 1 below; you only need to enable it per project.
However the older format is still supported, allowing existing aliases
or contacts to continue working._
 
1. If you have [templates](description_templates.md) in your repository, then you can optionally
select one of these templates from the dropdown to append it to all Service Desk issues.
1. Service Desk is now enabled for this project! You should be able to access it from your project's navigation **Issue submenu**:
 
![Service Desk Navigation Item](img/service_desk_nav_item.png)
Loading
Loading
Loading
Loading
@@ -4,21 +4,7 @@ module API
module Helpers
module Pagination
def paginate(relation)
return Gitlab::Pagination::OffsetPagination.new(self).paginate(relation) unless keyset_pagination_enabled?
request_context = Gitlab::Pagination::Keyset::RequestContext.new(self)
unless Gitlab::Pagination::Keyset.available?(request_context, relation)
return error!('Keyset pagination is not yet available for this type of request', 501)
end
Gitlab::Pagination::Keyset.paginate(request_context, relation)
end
private
def keyset_pagination_enabled?
params[:pagination] == 'keyset' && Feature.enabled?(:api_keyset_pagination)
::Gitlab::Pagination::OffsetPagination.new(self).paginate(relation)
end
end
end
Loading
Loading
Loading
Loading
@@ -82,6 +82,7 @@ module API
def present_projects(projects, options = {})
projects = reorder_projects(projects)
projects = apply_filters(projects)
projects = paginate(projects)
projects, options = with_custom_attributes(projects, options)
 
options = options.reverse_merge(
Loading
Loading
@@ -92,10 +93,7 @@ module API
)
options[:with] = Entities::BasicProjectDetails if params[:simple]
 
projects = options[:with].prepare_relation(projects, options)
projects = paginate(projects)
present projects, options
present options[:with].prepare_relation(projects, options), options
end
 
def translate_params_for_compatibility(params)
Loading
Loading
# frozen_string_literal: true
module Gitlab
module Pagination
module Keyset
def self.paginate(request_context, relation)
Gitlab::Pagination::Keyset::Pager.new(request_context).paginate(relation)
end
def self.available?(request_context, relation)
order_by = request_context.page.order_by
# This is only available for Project and order-by id (asc/desc)
return false unless relation.klass == Project
return false unless order_by.size == 1 && order_by[:id]
true
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Pagination
module Keyset
# A Page models the pagination information for a particular page of the collection
class Page
# Default and maximum size of records for a page
DEFAULT_PAGE_SIZE = 20
attr_accessor :lower_bounds, :end_reached
attr_reader :order_by
def initialize(order_by: {}, lower_bounds: nil, per_page: DEFAULT_PAGE_SIZE, end_reached: false)
@order_by = order_by.symbolize_keys
@lower_bounds = lower_bounds&.symbolize_keys
@per_page = per_page
@end_reached = end_reached
end
# Number of records to return per page
def per_page
return DEFAULT_PAGE_SIZE if @per_page <= 0
[@per_page, DEFAULT_PAGE_SIZE].min
end
# Determine whether this page indicates the end of the collection
def end_reached?
@end_reached
end
# Construct a Page for the next page
# Uses identical order_by/per_page information for the next page
def next(lower_bounds, end_reached)
dup.tap do |next_page|
next_page.lower_bounds = lower_bounds&.symbolize_keys
next_page.end_reached = end_reached
end
end
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Pagination
module Keyset
class Pager
attr_reader :request
def initialize(request)
@request = request
end
def paginate(relation)
# Validate assumption: The last two columns must match the page order_by
validate_order!(relation)
# This performs the database query and retrieves records
# We retrieve one record more to check if we have data beyond this page
all_records = relation.limit(page.per_page + 1).to_a # rubocop: disable CodeReuse/ActiveRecord
records_for_page = all_records.first(page.per_page)
# If we retrieved more records than belong on this page,
# we know there's a next page
there_is_more = all_records.size > records_for_page.size
apply_headers(records_for_page.last, there_is_more)
records_for_page
end
private
def apply_headers(last_record_in_page, there_is_more)
end_reached = last_record_in_page.nil? || !there_is_more
lower_bounds = last_record_in_page&.slice(page.order_by.keys)
next_page = page.next(lower_bounds, end_reached)
request.apply_headers(next_page)
end
def page
@page ||= request.page
end
def validate_order!(rel)
present_order = rel.order_values.map { |val| [val.expr.name.to_sym, val.direction] }.last(2).to_h
unless page.order_by == present_order
raise ArgumentError, "Page's order_by does not match the relation's order: #{present_order} vs #{page.order_by}"
end
end
end
end
end
end
# frozen_string_literal: true
module Gitlab
module Pagination
module Keyset
class RequestContext
attr_reader :request
DEFAULT_SORT_DIRECTION = :desc
PRIMARY_KEY = :id
# A tie breaker is added as an additional order-by column
# to establish a well-defined order. We use the primary key
# column here.
TIE_BREAKER = { PRIMARY_KEY => DEFAULT_SORT_DIRECTION }.freeze
def initialize(request)
@request = request
end
# extracts Paging information from request parameters
def page
@page ||= Page.new(order_by: order_by, per_page: params[:per_page])
end
def apply_headers(next_page)
request.header('Links', pagination_links(next_page))
end
private
def order_by
return TIE_BREAKER.dup unless params[:order_by]
order_by = { params[:order_by].to_sym => params[:sort]&.to_sym || DEFAULT_SORT_DIRECTION }
# Order by an additional unique key, we use the primary key here
order_by = order_by.merge(TIE_BREAKER) unless order_by[PRIMARY_KEY]
order_by
end
def params
@params ||= request.params
end
def lower_bounds_params(page)
page.lower_bounds.each_with_object({}) do |(column, value), params|
filter = filter_with_comparator(page, column)
params[filter] = value
end
end
def filter_with_comparator(page, column)
direction = page.order_by[column]
if direction&.to_sym == :desc
"#{column}_before"
else
"#{column}_after"
end
end
def page_href(page)
base_request_uri.tap do |uri|
uri.query = query_params_for(page).to_query
end.to_s
end
def pagination_links(next_page)
return if next_page.end_reached?
%(<#{page_href(next_page)}>; rel="next")
end
def base_request_uri
@base_request_uri ||= URI.parse(request.request.url).tap do |uri|
uri.host = Gitlab.config.gitlab.host
uri.port = Gitlab.config.gitlab.port
end
end
def query_params_for(page)
request.params.merge(lower_bounds_params(page))
end
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