-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add latest changes from gitlab-org/gitlab@master
- Loading branch information
GitLab Bot
committed
Dec 1, 2020
1 parent
2ddcd63
commit 259aa13
Showing
21 changed files
with
526 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
app/assets/javascripts/pipelines/components/graph/linked_pipelines_column_legacy.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<script> | ||
import LinkedPipeline from './linked_pipeline.vue'; | ||
import { UPSTREAM } from './constants'; | ||
export default { | ||
components: { | ||
LinkedPipeline, | ||
}, | ||
props: { | ||
columnTitle: { | ||
type: String, | ||
required: true, | ||
}, | ||
linkedPipelines: { | ||
type: Array, | ||
required: true, | ||
}, | ||
type: { | ||
type: String, | ||
required: true, | ||
}, | ||
projectId: { | ||
type: Number, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
columnClass() { | ||
const positionValues = { | ||
right: 'gl-ml-11', | ||
left: 'gl-mr-7', | ||
}; | ||
return `graph-position-${this.graphPosition} ${positionValues[this.graphPosition]}`; | ||
}, | ||
graphPosition() { | ||
return this.isUpstream ? 'left' : 'right'; | ||
}, | ||
// Refactor string match when BE returns Upstream/Downstream indicators | ||
isUpstream() { | ||
return this.type === UPSTREAM; | ||
}, | ||
}, | ||
methods: { | ||
onPipelineClick(downstreamNode, pipeline, index) { | ||
this.$emit('linkedPipelineClick', pipeline, index, downstreamNode); | ||
}, | ||
onDownstreamHovered(jobName) { | ||
this.$emit('downstreamHovered', jobName); | ||
}, | ||
onPipelineExpandToggle(jobName, expanded) { | ||
// Highlighting only applies to downstream pipelines | ||
if (this.isUpstream) { | ||
return; | ||
} | ||
this.$emit('pipelineExpandToggle', jobName, expanded); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<template> | ||
<div :class="columnClass" class="stage-column linked-pipelines-column"> | ||
<div class="stage-name linked-pipelines-column-title">{{ columnTitle }}</div> | ||
<div v-if="isUpstream" class="cross-project-triangle"></div> | ||
<ul> | ||
<linked-pipeline | ||
v-for="(pipeline, index) in linkedPipelines" | ||
:key="pipeline.id" | ||
:class="{ | ||
active: pipeline.isExpanded, | ||
'left-connector': pipeline.isExpanded && graphPosition === 'left', | ||
}" | ||
:pipeline="pipeline" | ||
:column-title="columnTitle" | ||
:project-id="projectId" | ||
:type="type" | ||
@pipelineClicked="onPipelineClick($event, pipeline, index)" | ||
@downstreamHovered="onDownstreamHovered" | ||
@pipelineExpandToggle="onPipelineExpandToggle" | ||
/> | ||
</ul> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
changelogs/unreleased/id-use-gitaly-for-first-page-of-branches.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
title: Paginate first page of branches using Gitaly | ||
merge_request: 48595 | ||
author: | ||
type: performance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# frozen_string_literal: true | ||
|
||
module Gitlab | ||
module Pagination | ||
class OffsetHeaderBuilder | ||
attr_reader :request_context, :per_page, :page, :next_page, :prev_page, :total, :total_pages | ||
|
||
delegate :params, :header, :request, to: :request_context | ||
|
||
def initialize(request_context:, per_page:, page:, next_page:, prev_page: nil, total:, total_pages:) | ||
@request_context = request_context | ||
@per_page = per_page | ||
@page = page | ||
@next_page = next_page | ||
@prev_page = prev_page | ||
@total = total | ||
@total_pages = total_pages | ||
end | ||
|
||
def execute(exclude_total_headers: false, data_without_counts: false) | ||
header 'X-Per-Page', per_page.to_s | ||
header 'X-Page', page.to_s | ||
header 'X-Next-Page', next_page.to_s | ||
header 'X-Prev-Page', prev_page.to_s | ||
header 'Link', pagination_links(data_without_counts) | ||
|
||
return if exclude_total_headers || data_without_counts | ||
|
||
header 'X-Total', total.to_s | ||
header 'X-Total-Pages', total_pages.to_s | ||
end | ||
|
||
private | ||
|
||
def pagination_links(data_without_counts) | ||
[].tap do |links| | ||
links << %(<#{page_href(page: prev_page)}>; rel="prev") if prev_page | ||
links << %(<#{page_href(page: next_page)}>; rel="next") if next_page | ||
links << %(<#{page_href(page: 1)}>; rel="first") | ||
|
||
links << %(<#{page_href(page: total_pages)}>; rel="last") unless data_without_counts | ||
end.join(', ') | ||
end | ||
|
||
def base_request_uri | ||
@base_request_uri ||= URI.parse(request.url).tap do |uri| | ||
uri.host = Gitlab.config.gitlab.host | ||
uri.port = Gitlab.config.gitlab.port | ||
end | ||
end | ||
|
||
def build_page_url(query_params:) | ||
base_request_uri.tap do |uri| | ||
uri.query = query_params | ||
end.to_s | ||
end | ||
|
||
def page_href(next_page_params = {}) | ||
query_params = params.merge(**next_page_params, per_page: params[:per_page]).to_query | ||
|
||
build_page_url(query_params: query_params) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.