summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-31 15:07:53 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-31 15:07:53 +0000
commitd7a028e20d29b8c6d0e780ac168544dfbb712d3c (patch)
treef9fc9ea12e166aec6c4ffe476ba7a3566396b696 /app
parent0d0cddc9ce20c5a7d8a2723d0aa620ca184a711a (diff)
downloadgitlab-ce-d7a028e20d29b8c6d0e780ac168544dfbb712d3c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/registry/explorer/pages/details.vue3
-rw-r--r--app/assets/stylesheets/framework/header.scss2
-rw-r--r--app/assets/stylesheets/framework/variables.scss1
-rw-r--r--app/assets/stylesheets/pages/editor.scss4
-rw-r--r--app/graphql/mutations/jira_import/start.rb58
-rw-r--r--app/graphql/types/mutation_type.rb1
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/models/ci/build_dependencies.rb85
-rw-r--r--app/models/ci/processable/dependencies.rb87
-rw-r--r--app/models/label_note.rb29
-rw-r--r--app/models/milestone_note.rb34
-rw-r--r--app/models/synthetic_note.rb50
-rw-r--r--app/views/admin/application_settings/_account_and_limit.html.haml9
13 files changed, 217 insertions, 148 deletions
diff --git a/app/assets/javascripts/registry/explorer/pages/details.vue b/app/assets/javascripts/registry/explorer/pages/details.vue
index 68a066f97e1..b558ed51a5b 100644
--- a/app/assets/javascripts/registry/explorer/pages/details.vue
+++ b/app/assets/javascripts/registry/explorer/pages/details.vue
@@ -77,9 +77,10 @@ export default {
return name;
},
fields() {
+ const tagClass = this.isDesktop ? 'w-25' : '';
return [
{ key: LIST_KEY_CHECKBOX, label: '', class: 'gl-w-16' },
- { key: LIST_KEY_TAG, label: LIST_LABEL_TAG, class: 'w-25' },
+ { key: LIST_KEY_TAG, label: LIST_LABEL_TAG, class: `${tagClass} js-tag-column` },
{ key: LIST_KEY_IMAGE_ID, label: LIST_LABEL_IMAGE_ID },
{ key: LIST_KEY_SIZE, label: LIST_LABEL_SIZE },
{ key: LIST_KEY_LAST_UPDATED, label: LIST_LABEL_LAST_UPDATED },
diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss
index 3792e6cb0a6..a0a020ec548 100644
--- a/app/assets/stylesheets/framework/header.scss
+++ b/app/assets/stylesheets/framework/header.scss
@@ -1,6 +1,6 @@
.navbar-gitlab {
padding: 0 16px;
- z-index: 1000;
+ z-index: $header-zindex;
margin-bottom: 0;
min-height: $header-height;
border: 0;
diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss
index b4ed6587fca..a3c1d8b1709 100644
--- a/app/assets/stylesheets/framework/variables.scss
+++ b/app/assets/stylesheets/framework/variables.scss
@@ -418,6 +418,7 @@ $browser-scrollbar-size: 10px;
* Misc
*/
$header-height: 40px;
+$header-zindex: 1000;
$suggestion-header-height: 46px;
$ide-statusbar-height: 25px;
$fixed-layout-width: 1280px;
diff --git a/app/assets/stylesheets/pages/editor.scss b/app/assets/stylesheets/pages/editor.scss
index b716c6e14fe..eb9684c7b3c 100644
--- a/app/assets/stylesheets/pages/editor.scss
+++ b/app/assets/stylesheets/pages/editor.scss
@@ -221,3 +221,7 @@
.editor-title-row {
margin-bottom: 20px;
}
+
+.popover.suggest-gitlab-ci-yml {
+ z-index: $header-zindex - 1;
+}
diff --git a/app/graphql/mutations/jira_import/start.rb b/app/graphql/mutations/jira_import/start.rb
new file mode 100644
index 00000000000..ffd3ce53b57
--- /dev/null
+++ b/app/graphql/mutations/jira_import/start.rb
@@ -0,0 +1,58 @@
+# frozen_string_literal: true
+
+module Mutations
+ module JiraImport
+ class Start < BaseMutation
+ include Mutations::ResolvesProject
+
+ graphql_name 'JiraImportStart'
+
+ field :jira_import,
+ Types::JiraImportType,
+ null: true,
+ description: 'The Jira import data after mutation'
+
+ argument :project_path, GraphQL::ID_TYPE,
+ required: true,
+ description: 'The project to import the Jira project into'
+ argument :jira_project_key, GraphQL::STRING_TYPE,
+ required: true,
+ description: 'Project key of the importer Jira project'
+ argument :jira_project_name, GraphQL::STRING_TYPE,
+ required: false,
+ description: 'Project name of the importer Jira project'
+
+ def resolve(project_path:, jira_project_key:)
+ project = find_project!(project_path: project_path)
+
+ raise_resource_not_available_error! unless project
+
+ service_response = ::JiraImport::StartImportService
+ .new(context[:current_user], project, jira_project_key)
+ .execute
+ import_data = service_response.payload[:import_data]
+
+ {
+ jira_import: import_data.errors.blank? ? import_data.projects.last : nil,
+ errors: errors_on_object(import_data)
+ }
+ end
+
+ private
+
+ def find_project!(project_path:)
+ return unless project_path.present?
+
+ authorized_find!(full_path: project_path)
+ end
+
+ def find_object(full_path:)
+ resolve_project(full_path: full_path)
+ end
+
+ def authorized_resource?(project)
+ Ability.allowed?(context[:current_user], :admin_project, project)
+ end
+ end
+ end
+end
diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb
index d3c0d9732d2..ab25d5baf71 100644
--- a/app/graphql/types/mutation_type.rb
+++ b/app/graphql/types/mutation_type.rb
@@ -39,6 +39,7 @@ module Types
mount_mutation Mutations::Snippets::Update
mount_mutation Mutations::Snippets::Create
mount_mutation Mutations::Snippets::MarkAsSpam
+ mount_mutation Mutations::JiraImport::Start
end
end
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index fb9e341dff7..5b794f7ccf0 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -914,7 +914,7 @@ module Ci
def dependencies
strong_memoize(:dependencies) do
- Ci::Processable::Dependencies.new(self)
+ Ci::BuildDependencies.new(self)
end
end
diff --git a/app/models/ci/build_dependencies.rb b/app/models/ci/build_dependencies.rb
new file mode 100644
index 00000000000..b5d67ef8e96
--- /dev/null
+++ b/app/models/ci/build_dependencies.rb
@@ -0,0 +1,85 @@
+# frozen_string_literal: true
+
+module Ci
+ class BuildDependencies
+ attr_reader :processable
+
+ def initialize(processable)
+ @processable = processable
+ end
+
+ def all
+ (local + cross_pipeline).uniq
+ end
+
+ # Dependencies local to the given pipeline
+ def local
+ return [] if no_local_dependencies_specified?
+
+ deps = model_class.where(pipeline_id: processable.pipeline_id).latest
+ deps = from_previous_stages(deps)
+ deps = from_needs(deps)
+ deps = from_dependencies(deps)
+ deps
+ end
+
+ # Dependencies that are defined in other pipelines
+ def cross_pipeline
+ []
+ end
+
+ def invalid_local
+ local.reject(&:valid_dependency?)
+ end
+
+ def valid?
+ valid_local? && valid_cross_pipeline?
+ end
+
+ private
+
+ # Dependencies can only be of Ci::Build type because only builds
+ # can create artifacts
+ def model_class
+ ::Ci::Build
+ end
+
+ def valid_local?
+ return true if Feature.enabled?('ci_disable_validates_dependencies')
+
+ local.all?(&:valid_dependency?)
+ end
+
+ def valid_cross_pipeline?
+ true
+ end
+
+ def project
+ processable.project
+ end
+
+ def no_local_dependencies_specified?
+ processable.options[:dependencies]&.empty?
+ end
+
+ def from_previous_stages(scope)
+ scope.before_stage(processable.stage_idx)
+ end
+
+ def from_needs(scope)
+ return scope unless Feature.enabled?(:ci_dag_support, project, default_enabled: true)
+ return scope unless processable.scheduling_type_dag?
+
+ needs_names = processable.needs.artifacts.select(:name)
+ scope.where(name: needs_names)
+ end
+
+ def from_dependencies(scope)
+ return scope unless processable.options[:dependencies].present?
+
+ scope.where(name: processable.options[:dependencies])
+ end
+ end
+end
+
+Ci::BuildDependencies.prepend_if_ee('EE::Ci::BuildDependencies')
diff --git a/app/models/ci/processable/dependencies.rb b/app/models/ci/processable/dependencies.rb
deleted file mode 100644
index 9d42ac4dc00..00000000000
--- a/app/models/ci/processable/dependencies.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# frozen_string_literal: true
-
-module Ci
- class Processable
- class Dependencies
- attr_reader :processable
-
- def initialize(processable)
- @processable = processable
- end
-
- def all
- (local + cross_pipeline).uniq
- end
-
- # Dependencies local to the given pipeline
- def local
- return [] if no_local_dependencies_specified?
-
- deps = model_class.where(pipeline_id: processable.pipeline_id).latest
- deps = from_previous_stages(deps)
- deps = from_needs(deps)
- deps = from_dependencies(deps)
- deps
- end
-
- # Dependencies that are defined in other pipelines
- def cross_pipeline
- []
- end
-
- def invalid_local
- local.reject(&:valid_dependency?)
- end
-
- def valid?
- valid_local? && valid_cross_pipeline?
- end
-
- private
-
- # Dependencies can only be of Ci::Build type because only builds
- # can create artifacts
- def model_class
- ::Ci::Build
- end
-
- def valid_local?
- return true if Feature.enabled?('ci_disable_validates_dependencies')
-
- local.all?(&:valid_dependency?)
- end
-
- def valid_cross_pipeline?
- true
- end
-
- def project
- processable.project
- end
-
- def no_local_dependencies_specified?
- processable.options[:dependencies]&.empty?
- end
-
- def from_previous_stages(scope)
- scope.before_stage(processable.stage_idx)
- end
-
- def from_needs(scope)
- return scope unless Feature.enabled?(:ci_dag_support, project, default_enabled: true)
- return scope unless processable.scheduling_type_dag?
-
- needs_names = processable.needs.artifacts.select(:name)
- scope.where(name: needs_names)
- end
-
- def from_dependencies(scope)
- return scope unless processable.options[:dependencies].present?
-
- scope.where(name: processable.options[:dependencies])
- end
- end
- end
-end
-
-Ci::Processable::Dependencies.prepend_if_ee('EE::Ci::Processable::Dependencies')
diff --git a/app/models/label_note.rb b/app/models/label_note.rb
index 13a2e1b0c72..e90028ce835 100644
--- a/app/models/label_note.rb
+++ b/app/models/label_note.rb
@@ -1,26 +1,13 @@
# frozen_string_literal: true
-class LabelNote < Note
+class LabelNote < SyntheticNote
attr_accessor :resource_parent
attr_reader :events
def self.from_events(events, resource: nil, resource_parent: nil)
resource ||= events.first.issuable
- attrs = {
- system: true,
- author: events.first.user,
- created_at: events.first.created_at,
- discussion_id: events.first.discussion_id,
- noteable: resource,
- system_note_metadata: SystemNoteMetadata.new(action: 'label'),
- events: events,
- resource_parent: resource_parent
- }
-
- if resource_parent.is_a?(Project)
- attrs[:project_id] = resource_parent.id
- end
+ attrs = note_attributes('label', events.first, resource, resource_parent).merge(events: events)
LabelNote.new(attrs)
end
@@ -35,22 +22,10 @@ class LabelNote < Note
true
end
- def note
- @note ||= note_text
- end
-
def note_html
@note_html ||= "<p dir=\"auto\">#{note_text(html: true)}</p>"
end
- def project
- resource_parent if resource_parent.is_a?(Project)
- end
-
- def group
- resource_parent if resource_parent.is_a?(Group)
- end
-
private
def update_outdated_markdown
diff --git a/app/models/milestone_note.rb b/app/models/milestone_note.rb
index 4b027b0782c..2ff9791feb0 100644
--- a/app/models/milestone_note.rb
+++ b/app/models/milestone_note.rb
@@ -1,46 +1,18 @@
# frozen_string_literal: true
-class MilestoneNote < ::Note
- attr_accessor :resource_parent, :event, :milestone
+class MilestoneNote < SyntheticNote
+ attr_accessor :milestone
def self.from_event(event, resource: nil, resource_parent: nil)
- resource ||= event.resource
-
- attrs = {
- system: true,
- author: event.user,
- created_at: event.created_at,
- noteable: resource,
- milestone: event.milestone,
- discussion_id: event.discussion_id,
- event: event,
- system_note_metadata: ::SystemNoteMetadata.new(action: 'milestone'),
- resource_parent: resource_parent
- }
-
- if resource_parent.is_a?(Project)
- attrs[:project_id] = resource_parent.id
- end
+ attrs = note_attributes('milestone', event, resource, resource_parent).merge(milestone: event.milestone)
MilestoneNote.new(attrs)
end
- def note
- @note ||= note_text
- end
-
def note_html
@note_html ||= Banzai::Renderer.cacheless_render_field(self, :note, { group: group, project: project })
end
- def project
- resource_parent if resource_parent.is_a?(Project)
- end
-
- def group
- resource_parent if resource_parent.is_a?(Group)
- end
-
private
def note_text(html: false)
diff --git a/app/models/synthetic_note.rb b/app/models/synthetic_note.rb
new file mode 100644
index 00000000000..3017140f871
--- /dev/null
+++ b/app/models/synthetic_note.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+class SyntheticNote < Note
+ attr_accessor :resource_parent, :event
+
+ self.abstract_class = true
+
+ def self.note_attributes(action, event, resource, resource_parent)
+ resource ||= event.resource
+
+ attrs = {
+ system: true,
+ author: event.user,
+ created_at: event.created_at,
+ discussion_id: event.discussion_id,
+ noteable: resource,
+ event: event,
+ system_note_metadata: ::SystemNoteMetadata.new(action: action),
+ resource_parent: resource_parent
+ }
+
+ if resource_parent.is_a?(Project)
+ attrs[:project_id] = resource_parent.id
+ end
+
+ attrs
+ end
+
+ def project
+ resource_parent if resource_parent.is_a?(Project)
+ end
+
+ def group
+ resource_parent if resource_parent.is_a?(Group)
+ end
+
+ def note
+ @note ||= note_text
+ end
+
+ def note_html
+ raise NotImplementedError
+ end
+
+ private
+
+ def note_text(html: false)
+ raise NotImplementedError
+ end
+end
diff --git a/app/views/admin/application_settings/_account_and_limit.html.haml b/app/views/admin/application_settings/_account_and_limit.html.haml
index aa377886edc..94a7a1be455 100644
--- a/app/views/admin/application_settings/_account_and_limit.html.haml
+++ b/app/views/admin/application_settings/_account_and_limit.html.haml
@@ -7,6 +7,15 @@
= f.check_box :gravatar_enabled, class: 'form-check-input'
= f.label :gravatar_enabled, class: 'form-check-label' do
= _('Gravatar enabled')
+
+ .form-group
+ = f.label :namespace_storage_size_limit, class: 'label-bold' do
+ = _('Maximum namespace storage (MB)')
+ = f.number_field :namespace_storage_size_limit, class: 'form-control', min: 0
+ %span.form-text.text-muted
+ = _('Includes repository storage, wiki storage, LFS objects, build artifacts and packages. 0 for unlimited.')
+ = link_to _('More information'), help_page_path('user/admin_area/settings/account_and_limit_settings', anchor: 'maximum-namespace-storage-size'), target: '_blank'
+
.form-group
= f.label :default_projects_limit, _('Default projects limit'), class: 'label-bold'
= f.number_field :default_projects_limit, class: 'form-control', title: _('Maximum number of projects.'), data: { toggle: 'tooltip', container: 'body' }