Skip to content

Commit e6bcd6e

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 654281e commit e6bcd6e

File tree

78 files changed

+1103
-344
lines changed

Some content is hidden

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

78 files changed

+1103
-344
lines changed

.test_license_encryption_key.pub

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtgemxR8RUJXi3p7G/dkh
3+
Yuln1L4lA6GtQsT83X0yTVDbLVsI2C6bepsRjGiLV0R/9JGvTojORx+9F/ZQAiEC
4+
g6QXWasAOSmrzr4EjADG6cWcCnOju8hX9yib1HUIBxl+jHkmXP3NPuwyb8p2G149
5+
EG1o4apEqE5RtqV/Xyx/u57xTYYZShJ/c7o4iA8xvt6IAKFPFKpQwb5hv4KvUZBP
6+
h0xG2qvOjDu430fK8JclPlXHqPjXDkXOZyLd4FvRStdEQU3RVXvUQfuGt/tOMS7J
7+
nPQ94fr/xdaEbcEtIlr32+tcgsMWyhqtDCPUWJT1aRPviUgaJKLoVs8tRKwYMV9+
8+
1wIDAQAB
9+
-----END PUBLIC KEY-----

app/assets/javascripts/environments/folder/environments_folder_view.vue

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<script>
2+
import { GlBadge, GlTab, GlTabs } from '@gitlab/ui';
23
import environmentsMixin from '../mixins/environments_mixin';
34
import CIPaginationMixin from '../../vue_shared/mixins/ci_pagination_api_mixin';
45
import StopEnvironmentModal from '../components/stop_environment_modal.vue';
56
import DeleteEnvironmentModal from '../components/delete_environment_modal.vue';
67
78
export default {
89
components: {
9-
StopEnvironmentModal,
1010
DeleteEnvironmentModal,
11+
GlBadge,
12+
GlTab,
13+
GlTabs,
14+
StopEnvironmentModal,
1115
},
1216
1317
mixins: [environmentsMixin, CIPaginationMixin],
@@ -73,9 +77,21 @@ export default {
7377
<b>{{ folderName }}</b>
7478
</h4>
7579

76-
<div class="top-area">
77-
<tabs v-if="!isLoading" :tabs="tabs" scope="environments" @onChangeTab="onChangeTab" />
78-
</div>
80+
<gl-tabs v-if="!isLoading" scope="environments" content-class="gl-display-none">
81+
<gl-tab
82+
v-for="(tab, i) in tabs"
83+
:key="`${tab.name}-${i}`"
84+
:active="tab.isActive"
85+
:title-item-class="tab.isActive ? 'gl-outline-none' : ''"
86+
:title-link-attributes="{ 'data-testid': `environments-tab-${tab.scope}` }"
87+
@click="onChangeTab(tab.scope)"
88+
>
89+
<template #title>
90+
<span>{{ tab.name }}</span>
91+
<gl-badge size="sm" class="gl-tab-counter-badge">{{ tab.count }}</gl-badge>
92+
</template>
93+
</gl-tab>
94+
</gl-tabs>
7995

8096
<container
8197
:is-loading="isLoading"

app/assets/javascripts/jira_import/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import App from './components/jira_import_app.vue';
66

77
Vue.use(VueApollo);
88

9-
const defaultClient = createDefaultClient();
9+
const defaultClient = createDefaultClient({}, { assumeImmutableResults: true });
1010

1111
const apolloProvider = new VueApollo({
1212
defaultClient,

app/assets/javascripts/jira_import/queries/initiate_jira_import.mutation.graphql

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
mutation($input: JiraImportStartInput!) {
44
jiraImportStart(input: $input) {
5-
clientMutationId
65
jiraImport {
76
...JiraImport
87
}

app/assets/javascripts/jira_import/utils/cache_update.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import produce from 'immer';
12
import getJiraImportDetailsQuery from '../queries/get_jira_import_details.query.graphql';
23
import { IMPORT_STATE } from './jira_import_utils';
34

@@ -13,22 +14,16 @@ export const addInProgressImportToStore = (store, jiraImportStart, fullPath) =>
1314
},
1415
};
1516

16-
const cacheData = store.readQuery({
17+
const sourceData = store.readQuery({
1718
...queryDetails,
1819
});
1920

2021
store.writeQuery({
2122
...queryDetails,
22-
data: {
23-
project: {
24-
...cacheData.project,
25-
jiraImportStatus: IMPORT_STATE.SCHEDULED,
26-
jiraImports: {
27-
...cacheData.project.jiraImports,
28-
nodes: cacheData.project.jiraImports.nodes.concat(jiraImportStart.jiraImport),
29-
},
30-
},
31-
},
23+
data: produce(sourceData, draftData => {
24+
draftData.project.jiraImportStatus = IMPORT_STATE.SCHEDULED; // eslint-disable-line no-param-reassign
25+
draftData.project.jiraImports.nodes.push(jiraImportStart.jiraImport);
26+
}),
3227
});
3328
};
3429

app/assets/javascripts/pipelines/constants.js

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export const TestStatus = {
1313
FAILED: 'failed',
1414
SKIPPED: 'skipped',
1515
SUCCESS: 'success',
16+
ERROR: 'error',
17+
UNKNOWN: 'unknown',
1618
};
1719

1820
export const FETCH_AUTHOR_ERROR_MESSAGE = __('There was a problem fetching project users.');

app/assets/javascripts/pipelines/stores/test_reports/utils.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import { __, sprintf } from '../../../locale';
2+
import { TestStatus } from '../../constants';
23

34
export function iconForTestStatus(status) {
45
switch (status) {
5-
case 'success':
6+
case TestStatus.SUCCESS:
67
return 'status_success_borderless';
7-
case 'failed':
8+
case TestStatus.FAILED:
89
return 'status_failed_borderless';
9-
default:
10+
case TestStatus.ERROR:
11+
return 'status_warning_borderless';
12+
case TestStatus.SKIPPED:
1013
return 'status_skipped_borderless';
14+
case TestStatus.UNKNOWN:
15+
default:
16+
return 'status_notfound_borderless';
1117
}
1218
}
1319

app/assets/stylesheets/framework/header.scss

-12
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,6 @@
203203
margin-right: 0;
204204
}
205205
}
206-
207-
&:hover,
208-
&:focus {
209-
text-decoration: none;
210-
outline: 0;
211-
opacity: 1;
212-
color: $white;
213-
214-
&.header-user-dropdown-toggle .header-user-avatar {
215-
border-color: $white;
216-
}
217-
}
218206
}
219207

220208
.header-new-dropdown-toggle {

app/assets/stylesheets/framework/icons.scss

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
}
1010
}
1111

12+
.ci-status-icon-error,
1213
.ci-status-icon-failed {
1314
svg {
1415
fill: $red-500;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
module ShowInheritedLabelsChecker
4+
extend ActiveSupport::Concern
5+
6+
private
7+
8+
def show_inherited_labels?(include_ancestor_groups)
9+
Feature.enabled?(:show_inherited_labels, @project || @group) || include_ancestor_groups # rubocop:disable Gitlab/ModuleWithInstanceVariables
10+
end
11+
end

app/controllers/groups/labels_controller.rb

+12-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
class Groups::LabelsController < Groups::ApplicationController
44
include ToggleSubscriptionAction
5+
include ShowInheritedLabelsChecker
56

67
before_action :label, only: [:edit, :update, :destroy]
78
before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy]
@@ -12,8 +13,9 @@ class Groups::LabelsController < Groups::ApplicationController
1213
def index
1314
respond_to do |format|
1415
format.html do
15-
@labels = GroupLabelsFinder
16-
.new(current_user, @group, params.merge(sort: sort)).execute
16+
# at group level we do not want to list project labels,
17+
# we only want `only_group_labels = false` when pulling labels for label filter dropdowns, fetched through json
18+
@labels = available_labels(params.merge(only_group_labels: true)).page(params[:page])
1719
end
1820
format.json do
1921
render json: LabelSerializer.new.represent_appearance(available_labels)
@@ -74,7 +76,7 @@ def authorize_read_labels!
7476
end
7577

7678
def label
77-
@label ||= @group.labels.find(params[:id])
79+
@label ||= available_labels(params.merge(only_group_labels: true)).find(params[:id])
7880
end
7981
alias_method :subscribable_resource, :label
8082

@@ -102,15 +104,17 @@ def save_previous_label_path
102104
session[:previous_labels_path] = URI(request.referer || '').path
103105
end
104106

105-
def available_labels
107+
def available_labels(options = params)
106108
@available_labels ||=
107109
LabelsFinder.new(
108110
current_user,
109111
group_id: @group.id,
110-
only_group_labels: params[:only_group_labels],
111-
include_ancestor_groups: params[:include_ancestor_groups],
112-
include_descendant_groups: params[:include_descendant_groups],
113-
search: params[:search]).execute
112+
only_group_labels: options[:only_group_labels],
113+
include_ancestor_groups: show_inherited_labels?(params[:include_ancestor_groups]),
114+
sort: sort,
115+
subscribed: options[:subscribed],
116+
include_descendant_groups: options[:include_descendant_groups],
117+
search: options[:search]).execute
114118
end
115119

116120
def sort

app/controllers/import/manifest_controller.rb

+7-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def upload
2626
manifest = Gitlab::ManifestImport::Manifest.new(params[:manifest].tempfile)
2727

2828
if manifest.valid?
29-
session[:manifest_import_repositories] = manifest.projects
30-
session[:manifest_import_group_id] = group.id
29+
manifest_import_metadata.save(manifest.projects, group.id)
3130

3231
redirect_to status_import_manifest_path
3332
else
@@ -96,12 +95,16 @@ def ensure_import_vars
9695

9796
# rubocop: disable CodeReuse/ActiveRecord
9897
def group
99-
@group ||= Group.find_by(id: session[:manifest_import_group_id])
98+
@group ||= Group.find_by(id: manifest_import_metadata.group_id)
10099
end
101100
# rubocop: enable CodeReuse/ActiveRecord
102101

102+
def manifest_import_metadata
103+
@manifest_import_status ||= Gitlab::ManifestImport::Metadata.new(current_user, fallback: session)
104+
end
105+
103106
def repositories
104-
@repositories ||= session[:manifest_import_repositories]
107+
@repositories ||= manifest_import_metadata.repositories
105108
end
106109

107110
def find_jobs

app/controllers/projects/labels_controller.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
class Projects::LabelsController < Projects::ApplicationController
44
include ToggleSubscriptionAction
5+
include ShowInheritedLabelsChecker
56

67
before_action :check_issuables_available!
78
before_action :label, only: [:edit, :update, :destroy, :promote]
@@ -161,7 +162,7 @@ def find_labels
161162
@available_labels ||=
162163
LabelsFinder.new(current_user,
163164
project_id: @project.id,
164-
include_ancestor_groups: params[:include_ancestor_groups],
165+
include_ancestor_groups: show_inherited_labels?(params[:include_ancestor_groups]),
165166
search: params[:search],
166167
subscribed: params[:subscribed],
167168
sort: sort).execute

app/finders/group_labels_finder.rb

-29
This file was deleted.

app/graphql/types/issue_sort_enum.rb

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class IssueSortEnum < IssuableSortEnum
88
value 'DUE_DATE_ASC', 'Due date by ascending order', value: :due_date_asc
99
value 'DUE_DATE_DESC', 'Due date by descending order', value: :due_date_desc
1010
value 'RELATIVE_POSITION_ASC', 'Relative position by ascending order', value: :relative_position_asc
11+
value 'SEVERITY_ASC', 'Severity from less critical to more critical', value: :severity_asc
12+
value 'SEVERITY_DESC', 'Severity from more critical to less critical', value: :severity_desc
1113
end
1214
end
1315

app/graphql/types/issue_type.rb

+15-6
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,22 @@ class IssueType < BaseObject
3636
end
3737

3838
field :author, Types::UserType, null: false,
39-
description: 'User that created the issue',
40-
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, obj.author_id).find }
39+
description: 'User that created the issue'
4140

4241
field :assignees, Types::UserType.connection_type, null: true,
4342
description: 'Assignees of the issue'
4443

4544
field :labels, Types::LabelType.connection_type, null: true,
4645
description: 'Labels of the issue'
4746
field :milestone, Types::MilestoneType, null: true,
48-
description: 'Milestone of the issue',
49-
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Milestone, obj.milestone_id).find }
47+
description: 'Milestone of the issue'
5048

5149
field :due_date, Types::TimeType, null: true,
5250
description: 'Due date of the issue'
5351
field :confidential, GraphQL::BOOLEAN_TYPE, null: false,
5452
description: 'Indicates the issue is confidential'
5553
field :discussion_locked, GraphQL::BOOLEAN_TYPE, null: false,
56-
description: 'Indicates discussion is locked on the issue',
57-
resolve: -> (obj, _args, _ctx) { !!obj.discussion_locked }
54+
description: 'Indicates discussion is locked on the issue'
5855

5956
field :upvotes, GraphQL::INT_TYPE, null: false,
6057
description: 'Number of upvotes the issue has received'
@@ -108,6 +105,18 @@ class IssueType < BaseObject
108105

109106
field :severity, Types::IssuableSeverityEnum, null: true,
110107
description: 'Severity level of the incident'
108+
109+
def author
110+
Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.author_id).find
111+
end
112+
113+
def milestone
114+
Gitlab::Graphql::Loaders::BatchModelLoader.new(Milestone, object.milestone_id).find
115+
end
116+
117+
def discussion_locked
118+
!!object.discussion_locked
119+
end
111120
end
112121
end
113122

app/graphql/types/project_member_type.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ class ProjectMemberType < BaseObject
1212
authorize :read_project
1313

1414
field :project, Types::ProjectType, null: true,
15-
description: 'Project that User is a member of',
16-
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, obj.source_id).find }
15+
description: 'Project that User is a member of'
16+
17+
def project
18+
Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.source_id).find
19+
end
1720
end
1821
end

0 commit comments

Comments
 (0)