Skip to content

Commit 4875344

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent eb90d59 commit 4875344

File tree

60 files changed

+899
-399
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+899
-399
lines changed

Gemfile.checksum

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
{"name":"extended-markdown-filter","version":"0.7.0","platform":"ruby","checksum":"c8eeef7409fbae18c6b407cd3e4eeb5d25c35cb08fe1ac06f375df3db2d4f138"},
163163
{"name":"factory_bot","version":"6.5.0","platform":"ruby","checksum":"6374b3a3593b8077ee9856d553d2e84d75b47b912cc24eafea4062f9363d2261"},
164164
{"name":"factory_bot_rails","version":"6.4.4","platform":"ruby","checksum":"139e17caa2c50f098fddf5e5e1f29e8067352024e91ca1186d018b36589e5c88"},
165-
{"name":"faraday","version":"2.12.1","platform":"ruby","checksum":"23f2128bf5d40533806b3a3f0444cca218d76d0af25320db8e782bf42ae0aa6f"},
165+
{"name":"faraday","version":"2.12.2","platform":"ruby","checksum":"157339c25c7b8bcb739f5cf1207cb0cefe8fa1c65027266bcbc34c90c84b9ad6"},
166166
{"name":"faraday-follow_redirects","version":"0.3.0","platform":"ruby","checksum":"d92d975635e2c7fe525dd494fcd4b9bb7f0a4a0ec0d5f4c15c729530fdb807f9"},
167167
{"name":"faraday-http-cache","version":"2.5.0","platform":"ruby","checksum":"64b7366d66e508e1c3dd855ebb20ce9da429330e412a23d9ebbc0a7a7b227463"},
168168
{"name":"faraday-multipart","version":"1.0.4","platform":"ruby","checksum":"9012021ab57790f7d712f590b48d5f948b19b43cfa11ca83e6459f06090b0725"},

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ GEM
602602
factory_bot_rails (6.4.4)
603603
factory_bot (~> 6.5)
604604
railties (>= 5.0.0)
605-
faraday (2.12.1)
605+
faraday (2.12.2)
606606
faraday-net_http (>= 2.0, < 3.5)
607607
json
608608
logger

Gemfile.next.checksum

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
{"name":"extended-markdown-filter","version":"0.7.0","platform":"ruby","checksum":"c8eeef7409fbae18c6b407cd3e4eeb5d25c35cb08fe1ac06f375df3db2d4f138"},
164164
{"name":"factory_bot","version":"6.5.0","platform":"ruby","checksum":"6374b3a3593b8077ee9856d553d2e84d75b47b912cc24eafea4062f9363d2261"},
165165
{"name":"factory_bot_rails","version":"6.4.4","platform":"ruby","checksum":"139e17caa2c50f098fddf5e5e1f29e8067352024e91ca1186d018b36589e5c88"},
166-
{"name":"faraday","version":"2.12.1","platform":"ruby","checksum":"23f2128bf5d40533806b3a3f0444cca218d76d0af25320db8e782bf42ae0aa6f"},
166+
{"name":"faraday","version":"2.12.2","platform":"ruby","checksum":"157339c25c7b8bcb739f5cf1207cb0cefe8fa1c65027266bcbc34c90c84b9ad6"},
167167
{"name":"faraday-follow_redirects","version":"0.3.0","platform":"ruby","checksum":"d92d975635e2c7fe525dd494fcd4b9bb7f0a4a0ec0d5f4c15c729530fdb807f9"},
168168
{"name":"faraday-http-cache","version":"2.5.0","platform":"ruby","checksum":"64b7366d66e508e1c3dd855ebb20ce9da429330e412a23d9ebbc0a7a7b227463"},
169169
{"name":"faraday-multipart","version":"1.0.4","platform":"ruby","checksum":"9012021ab57790f7d712f590b48d5f948b19b43cfa11ca83e6459f06090b0725"},

Gemfile.next.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ GEM
612612
factory_bot_rails (6.4.4)
613613
factory_bot (~> 6.5)
614614
railties (>= 5.0.0)
615-
faraday (2.12.1)
615+
faraday (2.12.2)
616616
faraday-net_http (>= 2.0, < 3.5)
617617
json
618618
logger
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#import "~/graphql_shared/fragments/ci_icon.fragment.graphql"
2+
3+
query getPipelineMetadata($fullPath: ID!, $iid: ID!) {
4+
project(fullPath: $fullPath) {
5+
id
6+
pipeline(iid: $iid) {
7+
id
8+
detailedStatus {
9+
label
10+
...CiIcon
11+
}
12+
finishedAt
13+
}
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
<script>
2+
import { GlLink, GlLoadingIcon, GlSprintf } from '@gitlab/ui';
3+
import Visibility from 'visibilityjs';
4+
import { createAlert } from '~/alert';
5+
import { __, s__ } from '~/locale';
6+
import { getIncreasedPollInterval } from '~/ci/utils/polling_utils';
7+
import { NETWORK_STATUS_READY, PIPELINE_POLL_INTERVAL_DEFAULT } from '~/ci/constants';
8+
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
9+
import CiIcon from '~/vue_shared/components/ci_icon/ci_icon.vue';
10+
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
11+
import { getQueryHeaders } from '~/ci/pipeline_details/graph/utils';
12+
import PipelineMiniGraph from '~/ci/pipeline_mini_graph/pipeline_mini_graph.vue';
13+
import getPipelineMetadataQuery from './graphql/queries/get_pipeline_metadata.query.graphql';
14+
15+
export default {
16+
name: 'PipelineSummary',
17+
i18n: {
18+
loadingText: s__('Pipeline|Checking pipeline status'),
19+
pipelineMetadataFetchError: __('There was a problem fetching the pipeline metadata.'),
20+
pipelineStatusText: s__('Pipelines|Pipeline %{linkStart}#%{pipelineId}%{linkEnd} %{status}'),
21+
},
22+
components: {
23+
CiIcon,
24+
GlLink,
25+
GlLoadingIcon,
26+
GlSprintf,
27+
PipelineMiniGraph,
28+
TimeAgoTooltip,
29+
},
30+
props: {
31+
fullPath: {
32+
type: String,
33+
required: true,
34+
},
35+
iid: {
36+
type: String,
37+
required: true,
38+
},
39+
pipelineEtag: {
40+
type: String,
41+
required: true,
42+
},
43+
},
44+
data() {
45+
return {
46+
pipelineInfo: {},
47+
pollInterval: PIPELINE_POLL_INTERVAL_DEFAULT,
48+
};
49+
},
50+
apollo: {
51+
pipelineInfo: {
52+
context() {
53+
return getQueryHeaders(this.pipelineEtag);
54+
},
55+
query: getPipelineMetadataQuery,
56+
notifyOnNetworkStatusChange: true,
57+
pollInterval() {
58+
return this.pollInterval;
59+
},
60+
variables() {
61+
return {
62+
fullPath: this.fullPath,
63+
iid: this.iid,
64+
};
65+
},
66+
result({ networkStatus }) {
67+
// We need this for handling the reactive poll interval while also using frontend cache
68+
// a status of 7 = 'ready'
69+
if (networkStatus !== NETWORK_STATUS_READY) return;
70+
this.pollInterval = this.increasePollInterval();
71+
},
72+
update({ project }) {
73+
return project?.pipeline || {};
74+
},
75+
error() {
76+
createAlert({ message: this.$options.i18n.pipelineMetadataFetchError });
77+
},
78+
},
79+
},
80+
computed: {
81+
finishedAt() {
82+
return this.pipelineInfo?.finishedAt;
83+
},
84+
isLoading() {
85+
return this.$apollo.queries.pipelineInfo.loading;
86+
},
87+
pipelineId() {
88+
return getIdFromGraphQLId(this.pipelineInfo?.id);
89+
},
90+
pipelinePath() {
91+
return this.status?.detailsPath || '';
92+
},
93+
status() {
94+
return this.pipelineInfo?.detailedStatus || null;
95+
},
96+
statusLabel() {
97+
return this.status?.label || '';
98+
},
99+
},
100+
mounted() {
101+
Visibility.change(() => {
102+
this.handlePolling();
103+
});
104+
},
105+
methods: {
106+
/** Note: cannot use `toggleQueryPollingByVisibility` because interval is dynamic */
107+
handlePolling() {
108+
if (!Visibility.hidden()) {
109+
this.resetPollInterval();
110+
} else {
111+
this.pollInterval = 0;
112+
}
113+
},
114+
increasePollInterval() {
115+
return getIncreasedPollInterval(this.pollInterval);
116+
},
117+
onJobActionExecuted() {
118+
this.resetPollInterval();
119+
},
120+
resetPollInterval() {
121+
this.pollInterval = PIPELINE_POLL_INTERVAL_DEFAULT;
122+
},
123+
},
124+
};
125+
</script>
126+
127+
<template>
128+
<div class="w-100">
129+
<div v-if="isLoading" class="align-items-center gl-mx-2 gl-flex">
130+
<gl-loading-icon class="gl-mr-4" />
131+
{{ $options.i18n.loadingText }}
132+
</div>
133+
<div v-else class="align-items-center w-100 gl-flex">
134+
<div
135+
class="flex-grow-1 justify-space-between gl-flex gl-flex-wrap gl-gap-3"
136+
:class="{ 'align-items-center': !finishedAt }"
137+
>
138+
<ci-icon v-if="status" class="gl-mt-1 gl-self-start" :status="status" />
139+
<div class="flex-grow-1 gl-flex gl-flex-col">
140+
<span>
141+
<gl-sprintf :message="$options.i18n.pipelineStatusText">
142+
<template #status>{{ statusLabel }}</template>
143+
<template #link="{ content }">
144+
<gl-link :href="pipelinePath">
145+
<gl-sprintf :message="content">
146+
<template #pipelineId>{{ pipelineId }}</template>
147+
</gl-sprintf>
148+
</gl-link>
149+
</template>
150+
</gl-sprintf>
151+
</span>
152+
<time-ago-tooltip
153+
v-if="finishedAt"
154+
class="gl-line-height-0 gl-flex gl-text-sm gl-text-subtle"
155+
:time="finishedAt"
156+
tooltip-placement="bottom"
157+
/>
158+
</div>
159+
<pipeline-mini-graph
160+
data-testid="pipeline-summary-pipeline-mini-graph"
161+
:full-path="fullPath"
162+
:iid="iid"
163+
:pipeline-etag="pipelineEtag"
164+
@jobActionExecuted="onJobActionExecuted"
165+
/>
166+
</div>
167+
</div>
168+
</div>
169+
</template>

app/assets/javascripts/ci/pipeline_mini_graph/pipeline_mini_graph.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default {
5050
default: false,
5151
},
5252
},
53-
emits: ['miniGraphStageClick'],
53+
emits: ['jobActionExecuted', 'miniGraphStageClick'],
5454
data() {
5555
return {
5656
pollInterval: PIPELINE_POLL_INTERVAL_DEFAULT,
@@ -128,6 +128,7 @@ export default {
128128
},
129129
onJobActionExecuted() {
130130
this.resetPollInterval();
131+
this.$emit('jobActionExecuted');
131132
},
132133
resetPollInterval() {
133134
this.pollInterval = PIPELINE_POLL_INTERVAL_DEFAULT;

app/assets/javascripts/ci/pipeline_mini_graph/pipeline_stages.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default {
2727
<div
2828
v-for="stage in stages"
2929
:key="stage.id"
30-
class="pipeline-mini-graph-stage-container dropdown gl-my-2 gl-mr-2 gl-inline-flex gl-align-middle"
30+
class="pipeline-mini-graph-stage-container dropdown gl-mr-2 gl-inline-flex gl-align-middle"
3131
>
3232
<pipeline-stage
3333
:stage="stage"

app/assets/javascripts/pdf/index.vue

+5-11
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,19 @@ export default {
3838
},
3939
methods: {
4040
async loadPDFJS() {
41-
pdfjs = this.glFeatures.upgradePdfjs
42-
? // eslint-disable-next-line import/extensions
43-
await import('pdfjs-dist-v4/legacy/build/pdf.mjs')
44-
: await import('pdfjs-dist-v3/legacy/build/pdf');
41+
// eslint-disable-next-line import/extensions
42+
pdfjs = await import('pdfjs-dist/legacy/build/pdf.mjs');
4543
({ getDocument, GlobalWorkerOptions } = pdfjs);
46-
GlobalWorkerOptions.workerSrc = this.glFeatures.upgradePdfjs
47-
? process.env.PDF_JS_WORKER_V4_PUBLIC_PATH
48-
: process.env.PDF_JS_WORKER_V3_PUBLIC_PATH;
44+
GlobalWorkerOptions.workerSrc = process.env.PDF_JS_WORKER_PUBLIC_PATH;
4945
},
5046
async load() {
5147
await this.loadPDFJS();
5248
this.pages = [];
5349
return getDocument({
5450
url: this.document,
55-
cMapUrl: this.glFeatures.upgradePdfjs
56-
? process.env.PDF_JS_CMAPS_V4_PUBLIC_PATH
57-
: process.env.PDF_JS_CMAPS_V3_PUBLIC_PATH,
51+
cMapUrl: process.env.PDF_JS_CMAPS_PUBLIC_PATH,
5852
cMapPacked: true,
59-
isEvalSupported: this.glFeatures.upgradePdfjs,
53+
isEvalSupported: true,
6054
})
6155
.promise.then(this.renderPages)
6256
.then((pages) => {
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import { fetchCommitMergeRequests } from '~/commit_merge_requests';
2-
import { initCommitPipelineMiniGraph } from './init_commit_pipeline_mini_graph';
3-
import initCommitPipelineStatus from './init_commit_pipeline_status';
2+
import initCommitPipelineSummary from './init_commit_pipeline_summary';
43
import initCommitReferences from './init_commit_references';
54

65
export const initCommitBoxInfo = () => {
76
// Display commit related branches
87
// Related merge requests to this commit
98
fetchCommitMergeRequests();
109

11-
// Display pipeline mini graph for this commit
12-
initCommitPipelineMiniGraph();
13-
14-
initCommitPipelineStatus();
10+
initCommitPipelineSummary();
1511

1612
initCommitReferences();
1713
};
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import Vue from 'vue';
22
import VueApollo from 'vue-apollo';
33
import createDefaultClient from '~/lib/graphql';
4-
import CommitBoxPipelineStatus from './components/commit_box_pipeline_status.vue';
4+
import PipelineSummary from '~/ci/common/pipeline_summary/pipeline_summary.vue';
55

66
Vue.use(VueApollo);
77

88
const apolloProvider = new VueApollo({
99
defaultClient: createDefaultClient(),
1010
});
1111

12-
export default (selector = '.js-commit-box-pipeline-status') => {
12+
export default (selector = '.js-commit-box-pipeline-summary') => {
1313
const el = document.querySelector(selector);
1414

1515
if (!el) {
@@ -22,13 +22,10 @@ export default (selector = '.js-commit-box-pipeline-status') => {
2222
new Vue({
2323
el,
2424
apolloProvider,
25-
provide: {
26-
fullPath,
27-
iid,
28-
graphqlResourceEtag,
29-
},
3025
render(createElement) {
31-
return createElement(CommitBoxPipelineStatus);
26+
return createElement(PipelineSummary, {
27+
props: { fullPath, iid, pipelineEtag: graphqlResourceEtag },
28+
});
3229
},
3330
});
3431
};

app/assets/stylesheets/bootstrap_migration_components.scss

-7
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,6 @@ input[type='file'] {
123123
.well-segment {
124124
padding: 1rem;
125125

126-
&.pipeline-info {
127-
align-items: center;
128-
display: flex;
129-
flex-wrap: wrap;
130-
gap: 0.25rem;
131-
}
132-
133126
&:not(:first-of-type) {
134127
@apply gl-border-t gl-border-t-section;
135128
}

app/controllers/projects/blob_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class Projects::BlobController < Projects::ApplicationController
4444

4545
before_action do
4646
push_frontend_feature_flag(:inline_blame, @project)
47-
push_frontend_feature_flag(:upgrade_pdfjs, current_user)
4847
push_licensed_feature(:file_locks) if @project.licensed_feature_available?(:file_locks)
4948
end
5049

app/controllers/projects/tree_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class Projects::TreeController < Projects::ApplicationController
1919

2020
before_action do
2121
push_frontend_feature_flag(:inline_blame, @project)
22-
push_frontend_feature_flag(:upgrade_pdfjs, current_user)
2322
push_licensed_feature(:file_locks) if @project.licensed_feature_available?(:file_locks)
2423
end
2524

app/controllers/projects_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class ProjectsController < Projects::ApplicationController
3838
before_action do
3939
push_frontend_feature_flag(:inline_blame, @project)
4040
push_frontend_feature_flag(:remove_monitor_metrics, @project)
41-
push_frontend_feature_flag(:upgrade_pdfjs, current_user)
4241
push_frontend_feature_flag(:issue_email_participants, @project)
4342
push_frontend_feature_flag(:edit_branch_rules, @project)
4443
# TODO: We need to remove the FF eventually when we rollout page_specific_styles

app/models/issue.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,12 @@ def work_item_type
371371
super
372372
end
373373

374-
def work_item_type_id=(work_item_type_id)
375-
self.correct_work_item_type_id = WorkItems::Type.find_by(id: work_item_type_id)&.correct_id
374+
def work_item_type_id=(input_work_item_type_id)
375+
work_item_type = WorkItems::Type.find_by_correct_id_with_fallback(input_work_item_type_id)
376376

377-
super
377+
self.correct_work_item_type_id = work_item_type&.correct_id
378+
379+
super(work_item_type&.id)
378380
end
379381

380382
def work_item_type=(work_item_type)
@@ -928,7 +930,7 @@ def ensure_namespace_id
928930
end
929931

930932
def ensure_work_item_type
931-
return if work_item_type_id.present? || work_item_type_id_change&.last.present?
933+
return if work_item_type.present? || work_item_type_id.present? || work_item_type_id_change&.last.present?
932934

933935
self.work_item_type = WorkItems::Type.default_by_type(DEFAULT_ISSUE_TYPE)
934936
end

0 commit comments

Comments
 (0)