summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-21 21:08:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-21 21:08:28 +0000
commit0a93f691bf210da97fcefe0ddf80b38b0b186a99 (patch)
treecf17fdecf913d0576a4ec3eba0b3704c06c86470 /app
parent07d811cd3cf4d3a1802363532756bf69cfc6346f (diff)
downloadgitlab-ce-0a93f691bf210da97fcefe0ddf80b38b0b186a99.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/pages/admin/jobs/components/table/admin_jobs_table_app.vue15
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue7
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue6
-rw-r--r--app/assets/stylesheets/page_bundles/merge_requests.scss8
-rw-r--r--app/helpers/issuables_helper.rb10
-rw-r--r--app/helpers/issue_type_helper.rb13
-rw-r--r--app/helpers/todos_helper.rb4
-rw-r--r--app/services/issues/build_service.rb21
-rw-r--r--app/services/issues/create_service.rb27
9 files changed, 65 insertions, 46 deletions
diff --git a/app/assets/javascripts/pages/admin/jobs/components/table/admin_jobs_table_app.vue b/app/assets/javascripts/pages/admin/jobs/components/table/admin_jobs_table_app.vue
index 148771d3cb5..4d1f3355bb9 100644
--- a/app/assets/javascripts/pages/admin/jobs/components/table/admin_jobs_table_app.vue
+++ b/app/assets/javascripts/pages/admin/jobs/components/table/admin_jobs_table_app.vue
@@ -103,6 +103,15 @@ export default {
this.count = newCount;
},
},
+ methods: {
+ fetchJobsByStatus(scope) {
+ this.infiniteScrollingTriggered = false;
+
+ this.scope = scope;
+
+ this.$apollo.queries.jobs.refetch({ statuses: scope });
+ },
+ },
};
</script>
@@ -112,7 +121,11 @@ export default {
{{ error }}
</gl-alert>
- <jobs-table-tabs :all-jobs-count="count" :loading="loading" />
+ <jobs-table-tabs
+ :all-jobs-count="count"
+ :loading="loading"
+ @fetchJobsByStatus="fetchJobsByStatus"
+ />
<jobs-skeleton-loader v-if="showSkeletonLoader" class="gl-mt-5" />
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
index a3c529de27c..f120680b440 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
@@ -545,14 +545,14 @@ export default {
<div class="mr-widget-body-controls gl-display-flex gl-align-items-center gl-flex-wrap">
<template v-if="shouldShowMergeControls">
<div
- class="gl-display-flex gl-sm-flex-direction-column gl-md-align-items-center gl-flex-wrap gl-w-full gl-md-pb-2"
+ class="gl-display-flex gl-sm-flex-direction-column gl-md-align-items-center gl-flex-wrap gl-w-full"
>
<gl-form-checkbox
v-if="canRemoveSourceBranch"
id="remove-source-branch-input"
v-model="removeSourceBranch"
:disabled="isRemoveSourceBranchButtonDisabled"
- class="js-remove-source-branch-checkbox gl-display-flex gl-align-items-center gl-mr-5 gl-mb-3 gl-md-mb-0"
+ class="js-remove-source-branch-checkbox gl-display-flex gl-align-items-center gl-mr-5"
data-testid="delete-source-branch-checkbox"
>
{{ __('Delete source branch') }}
@@ -564,14 +564,13 @@ export default {
v-model="squashBeforeMerge"
:help-path="mr.squashBeforeMergeHelpPath"
:is-disabled="isSquashReadOnly"
- class="gl-mr-5 gl-mb-3 gl-md-mb-0"
+ class="gl-mr-5"
/>
<gl-form-checkbox
v-if="shouldShowSquashEdit || shouldShowMergeEdit"
v-model="editCommitMessage"
data-testid="widget_edit_commit_message"
- class="gl-display-flex gl-align-items-center gl-mb-3 gl-md-mb-0"
>
{{ __('Edit commit message') }}
</gl-form-checkbox>
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
index 1413a46b4b9..97ef96fe382 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue
@@ -39,13 +39,13 @@ export default {
</script>
<template>
- <div class="gl-display-flex gl-align-items-center">
+ <div class="gl-display-flex">
<gl-form-checkbox
v-gl-tooltip
:checked="value"
:disabled="isDisabled"
name="squash"
- class="js-squash-checkbox gl-mr-2 gl-display-flex gl-align-items-center"
+ class="js-squash-checkbox gl-mr-2"
data-qa-selector="squash_checkbox"
:title="tooltipTitle"
@change="(checked) => $emit('input', checked)"
@@ -57,7 +57,7 @@ export default {
v-gl-tooltip
:href="helpPath"
:title="$options.i18n.helpLabel"
- class="gl-text-blue-600"
+ class="gl-text-blue-600 gl-line-height-1"
target="_blank"
>
<gl-icon name="question-o" />
diff --git a/app/assets/stylesheets/page_bundles/merge_requests.scss b/app/assets/stylesheets/page_bundles/merge_requests.scss
index d62dc2b2c5c..995c9ebe2a1 100644
--- a/app/assets/stylesheets/page_bundles/merge_requests.scss
+++ b/app/assets/stylesheets/page_bundles/merge_requests.scss
@@ -597,10 +597,6 @@ $tabs-holder-z-index: 250;
}
}
- label {
- margin-bottom: 0;
- }
-
.btn {
font-size: $gl-font-size;
}
@@ -695,10 +691,6 @@ $tabs-holder-z-index: 250;
margin-right: 7px;
}
- label {
- font-weight: $gl-font-weight-normal;
- }
-
.spacing {
margin: 0 0 0 10px;
}
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index 179ce01ae44..72df2608de7 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -144,9 +144,9 @@ module IssuablesHelper
def issuable_meta(issuable, project)
output = []
- if issuable.respond_to?(:work_item_type) && WorkItems::Type::WI_TYPES_WITH_CREATED_HEADER.include?(issuable.work_item_type.base_type)
+ if issuable.respond_to?(:work_item_type) && WorkItems::Type::WI_TYPES_WITH_CREATED_HEADER.include?(issue_type_for(issuable))
output << content_tag(:span, sprite_icon(issuable.work_item_type.icon_name.to_s, css_class: 'gl-icon gl-vertical-align-middle gl-text-gray-500'), class: 'gl-mr-2', aria: { hidden: 'true' })
- output << content_tag(:span, s_('IssuableStatus|%{wi_type} created %{created_at} by ').html_safe % { wi_type: IntegrationsHelper.integration_issue_type(issuable.issue_type), created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2')
+ output << content_tag(:span, s_('IssuableStatus|%{wi_type} created %{created_at} by ').html_safe % { wi_type: IntegrationsHelper.integration_issue_type(issue_type_for(issuable)), created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2')
else
output << content_tag(:span, s_('IssuableStatus|Created %{created_at} by').html_safe % { created_at: time_ago_with_tooltip(issuable.created_at) }, class: 'gl-mr-2')
end
@@ -263,7 +263,7 @@ module IssuablesHelper
{
hasClosingMergeRequest: issuable.merge_requests_count(current_user) != 0,
- issueType: issuable.issue_type,
+ issueType: issue_type_for(issuable),
zoomMeetingUrl: ZoomMeeting.canonical_meeting_url(issuable),
sentryIssueIdentifier: SentryIssue.find_by(issue: issuable)&.sentry_issue_identifier, # rubocop:disable CodeReuse/ActiveRecord
iid: issuable.iid.to_s,
@@ -329,7 +329,7 @@ module IssuablesHelper
def issuable_display_type(issuable)
case issuable
when Issue
- issuable.issue_type.downcase
+ issue_type_for(issuable).downcase
when MergeRequest
issuable.model_name.human.downcase
end
@@ -388,7 +388,7 @@ module IssuablesHelper
def issuable_type_selector_data(issuable)
{
- selected_type: issuable.issue_type,
+ selected_type: issue_type_for(issuable),
is_issue_allowed: create_issue_type_allowed?(@project, :issue).to_s,
is_incident_allowed: create_issue_type_allowed?(@project, :incident).to_s,
issue_path: new_project_issue_path(@project),
diff --git a/app/helpers/issue_type_helper.rb b/app/helpers/issue_type_helper.rb
new file mode 100644
index 00000000000..705cbe5c07a
--- /dev/null
+++ b/app/helpers/issue_type_helper.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module IssueTypeHelper
+ def issue_type_for(issue)
+ return if issue.blank?
+
+ if Feature.enabled?(:issue_type_uses_work_item_types_table)
+ issue.work_item_type.base_type
+ else
+ issue.issue_type
+ end
+ end
+end
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 9b0810f3d17..feafe35a3d5 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -76,7 +76,9 @@ module TodosHelper
elsif todo.member_access_requested?
_('Group')
elsif todo.for_issue_or_work_item?
- IntegrationsHelper.integration_issue_type(todo.target.issue_type)
+ IntegrationsHelper.integration_issue_type(
+ issue_type_for(todo.target)
+ )
else
IntegrationsHelper.integration_todo_target_type(todo.target_type)
end
diff --git a/app/services/issues/build_service.rb b/app/services/issues/build_service.rb
index cb90aca5800..d8c7c5d4455 100644
--- a/app/services/issues/build_service.rb
+++ b/app/services/issues/build_service.rb
@@ -17,6 +17,7 @@ module Issues
end
@issue = model_klass.new(issue_params.merge(container_param)).tap do |issue|
+ set_work_item_type(issue)
initialize_callbacks!(issue) if initialize_callbacks
end
end
@@ -74,6 +75,26 @@ module Issues
private
+ def set_work_item_type(issue)
+ work_item_type = if params[:work_item_type_id].present?
+ params.delete(:work_item_type)
+ WorkItems::Type.find_by(id: params.delete(:work_item_type_id)) # rubocop: disable CodeReuse/ActiveRecord
+ else
+ params.delete(:work_item_type)
+ end
+
+ base_type = work_item_type&.base_type
+ if create_issue_type_allowed?(container, base_type)
+ issue.work_item_type = work_item_type
+ # Up to this point issue_type might be set to the default, so we need to sync if a work item type is provided
+ issue.issue_type = work_item_type.base_type
+ end
+
+ # If no work item type was provided, we need to set it to whatever issue_type was up to this point,
+ # and that includes the column default
+ issue.work_item_type = WorkItems::Type.default_by_type(issue.issue_type)
+ end
+
def model_klass
::Issue
end
diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb
index 2a3f0abf4cb..ce19d77ca49 100644
--- a/app/services/issues/create_service.rb
+++ b/app/services/issues/create_service.rb
@@ -27,11 +27,10 @@ module Issues
# We should not initialize the callback classes during the build service execution because these will be
# initialized when we call #create below
@issue = @build_service.execute(initialize_callbacks: false)
- set_work_item_type(@issue)
- # issue_type is set in BuildService, so we can delete it from params, in later phase
- # it can be set also from quick actions - in that case work_item_id is synced later again
- params.delete(:issue_type)
+ # issue_type and work_item_type are set in BuildService, so we can delete it from params, in later phase
+ # it can be set also from quick actions
+ [:issue_type, :work_item_type, :work_item_type_id].each { |attribute| params.delete(attribute) }
handle_move_between_ids(@issue)
@@ -106,26 +105,6 @@ module Issues
private
- def set_work_item_type(issue)
- work_item_type = if params[:work_item_type_id].present?
- params.delete(:work_item_type)
- WorkItems::Type.find_by(id: params.delete(:work_item_type_id)) # rubocop: disable CodeReuse/ActiveRecord
- else
- params.delete(:work_item_type)
- end
-
- base_type = work_item_type&.base_type
- if create_issue_type_allowed?(container, base_type)
- issue.work_item_type = work_item_type
- # Up to this point issue_type might be set to the default, so we need to sync if a work item type is provided
- issue.issue_type = work_item_type.base_type
- end
-
- # If no work item type was provided, we need to set it to whatever issue_type was up to this point,
- # and that includes the column default
- issue.work_item_type = WorkItems::Type.default_by_type(issue.issue_type)
- end
-
def authorization_action
:create_issue
end