summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-09 00:09:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-09 00:09:11 +0000
commitf44bf01f69a491d4dfca8d631b390371bd0eec7a (patch)
tree873c673d96a75212485d5bfe808451798f6134fa /app
parent83fc2f3dc81052cad76addb44726876ba1d0f156 (diff)
downloadgitlab-ce-f44bf01f69a491d4dfca8d631b390371bd0eec7a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/related_merge_requests/components/related_merge_requests.vue2
-rw-r--r--app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_button.vue10
-rw-r--r--app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_search_input.vue24
-rw-r--r--app/assets/stylesheets/framework/dropdowns.scss7
-rw-r--r--app/assets/stylesheets/pages/issues/issue_count_badge.scss2
-rw-r--r--app/models/environment.rb14
-rw-r--r--app/models/project.rb4
-rw-r--r--app/serializers/fork_namespace_entity.rb52
-rw-r--r--app/serializers/fork_namespace_serializer.rb5
9 files changed, 103 insertions, 17 deletions
diff --git a/app/assets/javascripts/related_merge_requests/components/related_merge_requests.vue b/app/assets/javascripts/related_merge_requests/components/related_merge_requests.vue
index 05803ba09ab..15e9b8559d4 100644
--- a/app/assets/javascripts/related_merge_requests/components/related_merge_requests.vue
+++ b/app/assets/javascripts/related_merge_requests/components/related_merge_requests.vue
@@ -82,7 +82,7 @@ export default {
{{ __('Related merge requests') }}
</span>
<div v-if="totalCount" class="d-inline-flex lh-100 align-middle">
- <div class="mr-count-badge border-width-1px border-style-solid border-color-default">
+ <div class="mr-count-badge gl-display-inline-flex">
<div class="mr-count-badge-count">
<svg class="s16 mr-1 text-secondary">
<icon name="merge-request" class="mr-1 text-secondary" />
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_button.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_button.vue
index 30f7e6a5980..1be5284fa9c 100644
--- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_button.vue
+++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_button.vue
@@ -1,7 +1,11 @@
<script>
import { __, s__, sprintf } from '~/locale';
+import { GlIcon } from '@gitlab/ui';
export default {
+ components: {
+ GlIcon,
+ },
props: {
abilityName: {
type: String,
@@ -72,6 +76,10 @@ export default {
data-toggle="dropdown"
>
<span class="dropdown-toggle-text"> {{ dropdownToggleText }} </span>
- <i aria-hidden="true" class="fa fa-chevron-down" data-hidden="true"> </i>
+ <gl-icon
+ name="chevron-down"
+ class="gl-absolute gl-top-3 gl-right-3 gl-text-gray-700"
+ :size="16"
+ />
</button>
</template>
diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_search_input.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_search_input.vue
index bf51fa3dc38..f0a846c4924 100644
--- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_search_input.vue
+++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_search_input.vue
@@ -1,5 +1,11 @@
<script>
-export default {};
+import { GlIcon } from '@gitlab/ui';
+
+export default {
+ components: {
+ GlIcon,
+ },
+};
</script>
<template>
@@ -10,13 +16,13 @@ export default {};
class="dropdown-input-field"
type="search"
/>
- <i aria-hidden="true" class="fa fa-search dropdown-input-search" data-hidden="true"> </i>
- <i
- aria-hidden="true"
- class="fa fa-times dropdown-input-clear js-dropdown-input-clear"
- data-hidden="true"
- role="button"
- >
- </i>
+ <gl-icon
+ name="search"
+ class="dropdown-input-search gl-absolute gl-top-3 gl-right-5 gl-text-gray-500 gl-pointer-events-none"
+ />
+ <gl-icon
+ name="close"
+ class="dropdown-input-clear js-dropdown-input-clear gl-absolute gl-top-3 gl-right-5 gl-text-gray-700"
+ />
</div>
</template>
diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss
index ee32bf3494a..622dbc20ac1 100644
--- a/app/assets/stylesheets/framework/dropdowns.scss
+++ b/app/assets/stylesheets/framework/dropdowns.scss
@@ -639,9 +639,12 @@
display: none;
cursor: pointer;
pointer-events: all;
- right: 22px;
- top: 9px;
+ top: $gl-padding-8;
font-size: 14px;
+
+ &:not(.gl-icon) {
+ right: 22px;
+ }
}
&.has-value {
diff --git a/app/assets/stylesheets/pages/issues/issue_count_badge.scss b/app/assets/stylesheets/pages/issues/issue_count_badge.scss
index 569f323abd8..f2283e02ad2 100644
--- a/app/assets/stylesheets/pages/issues/issue_count_badge.scss
+++ b/app/assets/stylesheets/pages/issues/issue_count_badge.scss
@@ -1,7 +1,5 @@
.issue-count-badge,
.mr-count-badge {
- display: inline-flex;
- border-radius: $border-radius-base;
padding: 5px $gl-padding-8;
}
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 494b166f80a..bddc84f10b5 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -228,8 +228,18 @@ class Environment < ApplicationRecord
end
def cancel_deployment_jobs!
- jobs = all_deployments.active.with_deployable
- jobs.each { |deployment| deployment.deployable.cancel! }
+ jobs = active_deployments.with_deployable
+ jobs.each do |deployment|
+ # guard against data integrity issues,
+ # for example https://gitlab.com/gitlab-org/gitlab/-/issues/218659#note_348823660
+ next unless deployment.deployable
+
+ Gitlab::OptimisticLocking.retry_lock(deployment.deployable) do |deployable|
+ deployable.cancel! if deployable&.cancelable?
+ end
+ rescue => e
+ Gitlab::ErrorTracking.track_exception(e, environment_id: id, deployment_id: deployment.id)
+ end
end
def stop_with_action!(current_user)
diff --git a/app/models/project.rb b/app/models/project.rb
index d51b5bc7b34..0af3d8caff3 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -525,6 +525,10 @@ class Project < ApplicationRecord
group: :ip_restrictions, namespace: [:route, :owner])
}
+ scope :with_api_commit_entity_associations, -> {
+ preload(:project_feature, :route, namespace: [:route, :owner])
+ }
+
enum auto_cancel_pending_pipelines: { disabled: 0, enabled: 1 }
chronic_duration_attr :build_timeout_human_readable, :build_timeout,
diff --git a/app/serializers/fork_namespace_entity.rb b/app/serializers/fork_namespace_entity.rb
new file mode 100644
index 00000000000..068862e0951
--- /dev/null
+++ b/app/serializers/fork_namespace_entity.rb
@@ -0,0 +1,52 @@
+# frozen_string_literal: true
+
+class ForkNamespaceEntity < Grape::Entity
+ include ActionView::Helpers::NumberHelper
+ include RequestAwareEntity
+ include MarkupHelper
+
+ expose :id, :name, :description, :visibility, :full_name,
+ :created_at, :updated_at, :avatar_url
+
+ expose :fork_path do |namespace, options|
+ project_forks_path(options[:project], namespace_key: namespace.id)
+ end
+
+ expose :forked_project_path do |namespace, options|
+ if forked_project = namespace.find_fork_of(options[:project])
+ project_path(forked_project)
+ end
+ end
+
+ expose :permission do |namespace, options|
+ membership(options[:current_user], namespace)&.human_access
+ end
+
+ expose :relative_path do |namespace|
+ polymorphic_path(namespace)
+ end
+
+ expose :markdown_description do |namespace|
+ markdown_description(namespace)
+ end
+
+ expose :can_create_project do |namespace, options|
+ options[:current_user].can?(:create_projects, namespace)
+ end
+
+ private
+
+ # rubocop: disable CodeReuse/ActiveRecord
+ def membership(user, object)
+ return unless user
+
+ @membership ||= user.members.find_by(source: object)
+ end
+ # rubocop: enable CodeReuse/ActiveRecord
+
+ def markdown_description(namespace)
+ markdown_field(namespace, :description)
+ end
+end
+
+ForkNamespaceEntity.prepend_if_ee('EE::ForkNamespaceEntity')
diff --git a/app/serializers/fork_namespace_serializer.rb b/app/serializers/fork_namespace_serializer.rb
new file mode 100644
index 00000000000..1461938269e
--- /dev/null
+++ b/app/serializers/fork_namespace_serializer.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+class ForkNamespaceSerializer < BaseSerializer
+ entity ForkNamespaceEntity
+end