Skip to content

Commit b4c3970

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

File tree

72 files changed

+4624
-428
lines changed

Some content is hidden

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

72 files changed

+4624
-428
lines changed

.haml-lint.yml

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ linters:
139139
- Style/HashSyntax
140140
- Style/IdenticalConditionalBranches
141141
- Style/IfInsideElse
142+
- Style/InlineDisableAnnotation
142143
- Style/NegatedIf
143144
- Style/NestedTernaryOperator
144145
- Style/RedundantInterpolation

.rubocop.yml

+3
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,9 @@ Cop/UserAdmin:
925925
- 'spec/**/*.rb'
926926
- 'ee/spec/**/*.rb'
927927

928+
Style/InlineDisableAnnotation:
929+
Enabled: true
930+
928931
# See https://gitlab.com/gitlab-org/gitlab/-/issues/327495
929932
Style/RegexpLiteral:
930933
Enabled: false

.rubocop_todo/style/inline_disable_annotation.yml

+3,411
Large diffs are not rendered by default.

app/assets/javascripts/ci/pipeline_details/graph/components/job_item.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ export default {
329329
@mouseout="hideTooltips"
330330
>
331331
<div class="gl-display-flex gl-align-items-center gl-flex-grow-1">
332-
<ci-icon :status="job.status" size="md" :use-link="false" />
332+
<ci-icon :status="job.status" :use-link="false" />
333333
<div class="gl-pl-3 gl-pr-3 gl-display-flex gl-flex-direction-column gl-pipeline-job-width">
334334
<div class="gl-text-truncate gl-pr-9 gl-line-height-normal">{{ job.name }}</div>
335335
<div

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

-6
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ export default {
8181
// detailedStatus is graphQL, details.status is REST
8282
return pipeline?.detailedStatus || pipeline?.details?.status;
8383
},
84-
triggerButtonClass(pipeline) {
85-
const { group } = accessValue(pipeline, this.dataMethod, 'detailedStatus');
86-
87-
return `ci-status-icon-${group}`;
88-
},
8984
},
9085
};
9186
</script>
@@ -105,7 +100,6 @@ export default {
105100
v-gl-tooltip="{ title: pipelineTooltipText(pipeline) }"
106101
:status="pipelineStatus(pipeline)"
107102
:show-tooltip="false"
108-
:class="triggerButtonClass(pipeline)"
109103
class="linked-pipeline-mini-item gl-mb-0!"
110104
data-testid="linked-pipeline-mini-item"
111105
/>

app/assets/javascripts/vue_shared/components/ci_icon.vue

+40-85
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,11 @@ import { GlBadge, GlTooltipDirective, GlIcon } from '@gitlab/ui';
66
*
77
* Receives status object containing:
88
* status: {
9-
* group:"running" // used for CSS class
10-
* icon: "icon_status_running" // used to render the icon
9+
* icon: "status_running" // used to render the icon and CSS class
10+
* text: "Running",
11+
* detailsPath: '/project1/jobs/1' // can also be details_path
1112
* }
1213
*
13-
* Used in:
14-
* - Extended MR Popover
15-
* - Jobs show view header
16-
* - Jobs show view sidebar
17-
* - Jobs table
18-
* - Linked pipelines
19-
* - Pipeline graph
20-
* - Pipeline mini graph
21-
* - Pipeline show view badge
22-
* - Pipelines table Badge
2314
*/
2415
2516
export default {
@@ -35,13 +26,8 @@ export default {
3526
type: Object,
3627
required: true,
3728
validator(status) {
38-
const { group, icon } = status;
39-
return (
40-
typeof group === 'string' &&
41-
group.length &&
42-
typeof icon === 'string' &&
43-
icon.startsWith('status_')
44-
);
29+
const { icon } = status;
30+
return typeof icon === 'string' && icon.startsWith('status_');
4531
},
4632
},
4733
showStatusText: {
@@ -62,66 +48,47 @@ export default {
6248
},
6349
computed: {
6450
title() {
65-
return this.showTooltip && !this.showStatusText ? this.status?.text : '';
51+
if (this.showTooltip) {
52+
// show tooltip only when not showing text already
53+
return !this.showStatusText ? this.status?.text : null;
54+
}
55+
return null;
6656
},
67-
detailsPath() {
68-
// For now, this can either come from graphQL with camelCase or REST API in snake_case
69-
if (!this.useLink) {
70-
return null;
57+
ariaLabel() {
58+
// show aria-label only when text is not rendered
59+
if (!this.showStatusText) {
60+
return this.status?.text;
7161
}
72-
return this.status.detailsPath || this.status.details_path;
62+
return null;
7363
},
74-
wrapperStyleClasses() {
75-
const status = this.status.group;
76-
return `ci-status-icon ci-status-icon-${status} gl-rounded-full gl-justify-content-center gl-line-height-0`;
64+
href() {
65+
// href can come from GraphQL (camelCase) or REST API (snake_case)
66+
if (this.useLink) {
67+
return this.status.detailsPath || this.status.details_path;
68+
}
69+
return null;
7770
},
7871
icon() {
79-
return this.status.icon;
72+
if (this.status.icon) {
73+
return `${this.status.icon}_borderless`;
74+
}
75+
return null;
8076
},
81-
badgeStyles() {
77+
variant() {
8278
switch (this.status.icon) {
8379
case 'status_success':
84-
return {
85-
textColor: 'gl-text-green-700',
86-
variant: 'success',
87-
};
80+
return 'success';
8881
case 'status_warning':
89-
return {
90-
textColor: 'gl-text-orange-700',
91-
variant: 'warning',
92-
};
82+
case 'status_pending':
83+
return 'warning';
9384
case 'status_failed':
94-
return {
95-
textColor: 'gl-text-red-700',
96-
variant: 'danger',
97-
};
85+
return 'danger';
9886
case 'status_running':
99-
return {
100-
textColor: 'gl-text-blue-700',
101-
variant: 'info',
102-
};
103-
case 'status_pending':
104-
return {
105-
textColor: 'gl-text-orange-700',
106-
variant: 'warning',
107-
};
108-
case 'status_canceled':
109-
return {
110-
textColor: 'gl-text-gray-700',
111-
variant: 'neutral',
112-
};
113-
case 'status_manual':
114-
return {
115-
textColor: 'gl-text-gray-700',
116-
variant: 'neutral',
117-
};
87+
return 'info';
11888
// default covers the styles for the remainder of CI
11989
// statuses that are not explicitly stated here
12090
default:
121-
return {
122-
textColor: 'gl-text-gray-600',
123-
variant: 'muted',
124-
};
91+
return 'neutral';
12592
}
12693
},
12794
},
@@ -131,30 +98,18 @@ export default {
13198
<gl-badge
13299
v-gl-tooltip
133100
class="ci-icon gl-p-2"
101+
:class="`ci-icon-variant-${variant}`"
102+
:variant="variant"
134103
:title="title"
135-
:aria-label="title"
136-
:href="detailsPath"
104+
:aria-label="ariaLabel"
105+
:href="href"
137106
size="md"
138-
:variant="badgeStyles.variant"
139107
data-testid="ci-icon"
140108
@click="$emit('ciStatusBadgeClick')"
141109
>
142-
<span
143-
class="ci-icon-wrapper"
144-
:class="[
145-
wrapperStyleClasses,
146-
{
147-
'gl-display-inline-block gl-vertical-align-top': showStatusText,
148-
},
149-
]"
150-
>
151-
<gl-icon :name="icon" :aria-label="status.icon" /> </span
152-
><span
153-
v-if="showStatusText"
154-
class="gl-mx-2 gl-white-space-nowrap"
155-
:class="badgeStyles.textColor"
156-
data-testid="ci-icon-text"
157-
>{{ status.text }}</span
158-
>
110+
<span class="ci-icon-gl-icon-wrapper"><gl-icon :name="icon" /></span
111+
><span v-if="showStatusText" class="gl-mx-2 gl-white-space-nowrap" data-testid="ci-icon-text">{{
112+
status.text
113+
}}</span>
159114
</gl-badge>
160115
</template>

app/assets/stylesheets/framework/icons.scss

+59-27
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,96 @@
1-
@mixin icon-styles($primary-color, $svg-color) {
1+
@mixin icon-styles($color) {
22
svg,
33
.gl-icon {
4-
fill: $primary-color;
5-
}
6-
7-
// For the pipeline mini graph, we pass a custom 'gl-border' so that we can enforce
8-
// a border of 1px instead of the thicker svg borders to adhere to design standards.
9-
// If we implement the component with 'isBorderless' and also pass that border,
10-
// this css is to dynamically apply the correct border color for those specific icons.
11-
&.borderless {
12-
border-color: $primary-color;
13-
}
14-
15-
&.interactive {
16-
&:hover {
17-
background: $svg-color;
18-
}
19-
20-
&:hover,
21-
&.active {
22-
box-shadow: 0 0 0 1px $primary-color;
23-
}
4+
fill: $color;
245
}
256
}
267

278
.ci-status-icon-success,
289
.ci-status-icon-passed {
29-
@include icon-styles($green-500, $green-100);
10+
@include icon-styles($green-500);
3011
}
3112

3213
.ci-status-icon-error,
3314
.ci-status-icon-failed {
34-
@include icon-styles($red-500, $red-100);
15+
@include icon-styles($red-500);
3516
}
3617

3718
.ci-status-icon-pending,
3819
.ci-status-icon-waiting-for-resource,
3920
.ci-status-icon-waiting-for-callback,
4021
.ci-status-icon-failed-with-warnings,
4122
.ci-status-icon-success-with-warnings {
42-
@include icon-styles($orange-500, $orange-100);
23+
@include icon-styles($orange-500);
4324
}
4425

4526
.ci-status-icon-running {
46-
@include icon-styles($blue-500, $blue-100);
27+
@include icon-styles($blue-500);
4728
}
4829

4930
.ci-status-icon-canceled,
5031
.ci-status-icon-disabled,
5132
.ci-status-icon-scheduled,
5233
.ci-status-icon-manual {
53-
@include icon-styles($gray-900, $gray-100);
34+
@include icon-styles($gray-900);
5435
}
5536

5637
.ci-status-icon-notification,
5738
.ci-status-icon-preparing,
5839
.ci-status-icon-created,
5940
.ci-status-icon-skipped,
6041
.ci-status-icon-notfound {
61-
@include icon-styles($gray-500, $gray-100);
42+
@include icon-styles($gray-500);
43+
}
44+
45+
.ci-icon {
46+
// .ci-icon class is used at
47+
// - app/assets/javascripts/vue_shared/components/ci_icon.vue
48+
// - app/helpers/ci/status_helper.rb
49+
.ci-icon-gl-icon-wrapper {
50+
@include gl-rounded-full;
51+
@include gl-line-height-0;
52+
}
53+
54+
// Makes the borderless CI icons appear slightly bigger than the default 16px.
55+
// Could be fixed by making the SVG fill up the canvas in a follow up issue.
56+
.gl-icon {
57+
// fill: currentColor;
58+
width: 20px;
59+
height: 20px;
60+
margin: -2px;
61+
}
62+
63+
@mixin ci-icon-style($bg-color, $color, $gl-dark-bg-color: null, $gl-dark-color: null) {
64+
.ci-icon-gl-icon-wrapper {
65+
background-color: $bg-color;
66+
color: $color;
67+
68+
.gl-dark & {
69+
background-color: $gl-dark-bg-color;
70+
color: $gl-dark-color;
71+
}
72+
}
73+
}
74+
75+
&.ci-icon-variant-success {
76+
@include ci-icon-style($green-500, $white, $green-600, $green-50)
77+
}
78+
79+
&.ci-icon-variant-warning {
80+
@include ci-icon-style($orange-500, $white, $orange-600, $orange-50)
81+
}
82+
83+
&.ci-icon-variant-danger {
84+
@include ci-icon-style($red-500, $white, $red-600, $red-50)
85+
}
86+
87+
&.ci-icon-variant-info {
88+
@include ci-icon-style($white, $blue-500, $blue-600, $blue-50)
89+
}
90+
91+
&.ci-icon-variant-neutral {
92+
@include ci-icon-style($white, $gray-500)
93+
}
6294
}
6395

6496
.password-status-icon-success {

app/graphql/types/security/codequality_reports_comparer/degradation_type.rb

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module CodequalityReportsComparer
66
# rubocop: disable Graphql/AuthorizeTypes -- The resolver authorizes the request
77
class DegradationType < BaseObject
88
graphql_name 'CodequalityReportsComparerReportDegradation'
9-
109
description 'Represents a degradation on the compared codequality report.'
1110

1211
field :description, GraphQL::Types::String,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
3+
module Types
4+
module Security
5+
module CodequalityReportsComparer
6+
class ReportGenerationStatusEnum < BaseEnum
7+
graphql_name 'CodequalityReportsComparerReportGenerationStatus'
8+
description 'Represents the generation status of the compared codequality report.'
9+
10+
value 'PARSED', value: :parsed, description: 'Report was generated.'
11+
value 'PARSING', value: :parsing, description: 'Report is being generated.'
12+
value 'ERROR', value: :error, description: 'An error happened while generating the report.'
13+
end
14+
end
15+
end
16+
end

app/graphql/types/security/codequality_reports_comparer/status_enum.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ module Types
44
module Security
55
module CodequalityReportsComparer
66
class StatusEnum < BaseEnum
7-
graphql_name 'CodequalityReportsComparerReportStatus'
8-
description 'Report comparison status'
7+
graphql_name 'CodequalityReportsComparerStatus'
8+
description 'Represents the state of the code quality report.'
99

10-
value 'SUCCESS', value: 'success', description: 'Report successfully generated.'
11-
value 'FAILED', value: 'failed', description: 'Report failed to generate.'
10+
value 'SUCCESS', value: 'success', description: 'No degradations found in the head pipeline report.'
11+
value 'FAILED', value: 'failed', description: 'Report generated and there are new code quality degradations.'
1212
value 'NOT_FOUND', value: 'not_found', description: 'Head report or base report not found.'
1313
end
1414
end

app/graphql/types/security/codequality_reports_comparer_type.rb

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ class CodequalityReportsComparerType < BaseObject
88

99
description 'Represents reports comparison for code quality.'
1010

11+
field :status,
12+
type: CodequalityReportsComparer::ReportGenerationStatusEnum,
13+
null: true,
14+
description: 'Compared codequality report generation status.'
15+
1116
field :report,
1217
type: CodequalityReportsComparer::ReportType,
1318
null: true,

0 commit comments

Comments
 (0)