Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-14 00:09:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-14 00:09:24 +0300
commit0698388e65ed3556a11ec7eb2e76e7b7f9f0489e (patch)
treee1f5121a371023c3bf14fab12d4ca4a2ff7b6429 /app
parentd9aac35d79489591396456aceefa609de4b8b05c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/diffs/components/no_changes.vue8
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/index.js9
-rw-r--r--app/assets/stylesheets/pages/note_form.scss8
-rw-r--r--app/controllers/groups/variables_controller.rb4
-rw-r--r--app/controllers/projects/incident_management/pager_duty_incidents_controller.rb31
-rw-r--r--app/controllers/projects/pipelines/stages_controller.rb29
-rw-r--r--app/controllers/projects/stages_controller.rb25
-rw-r--r--app/controllers/projects/variables_controller.rb4
-rw-r--r--app/helpers/icons_helper.rb9
-rw-r--r--app/models/alert_management/alert.rb3
-rw-r--r--app/presenters/projects/prometheus/alert_presenter.rb2
-rw-r--r--app/serializers/ci/group_variable_entity.rb6
-rw-r--r--app/serializers/ci/group_variable_serializer.rb7
-rw-r--r--app/serializers/ci/variable_entity.rb7
-rw-r--r--app/serializers/ci/variable_serializer.rb7
-rw-r--r--app/serializers/group_variable_entity.rb4
-rw-r--r--app/serializers/group_variable_serializer.rb5
-rw-r--r--app/serializers/variable_entity.rb5
-rw-r--r--app/serializers/variable_serializer.rb5
-rw-r--r--app/services/alert_management/process_prometheus_alert_service.rb2
-rw-r--r--app/services/projects/alerting/notify_service.rb6
-rw-r--r--app/services/projects/prometheus/alerts/notify_service.rb2
-rw-r--r--app/views/shared/notes/_hints.html.haml3
23 files changed, 121 insertions, 70 deletions
diff --git a/app/assets/javascripts/diffs/components/no_changes.vue b/app/assets/javascripts/diffs/components/no_changes.vue
index 94c2695a945..93afa978862 100644
--- a/app/assets/javascripts/diffs/components/no_changes.vue
+++ b/app/assets/javascripts/diffs/components/no_changes.vue
@@ -1,12 +1,12 @@
<script>
import { mapGetters } from 'vuex';
import { escape } from 'lodash';
-import { GlDeprecatedButton } from '@gitlab/ui';
+import { GlButton } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
export default {
components: {
- GlDeprecatedButton,
+ GlButton,
},
props: {
changesEmptyStateIllustration: {
@@ -43,9 +43,9 @@ export default {
<div class="text-content text-center">
<span v-html="emptyStateText"></span>
<div class="text-center">
- <gl-deprecated-button :href="getNoteableData.new_blob_path" variant="success">{{
+ <gl-button :href="getNoteableData.new_blob_path" variant="success" category="primary">{{
__('Create commit')
- }}</gl-deprecated-button>
+ }}</gl-button>
</div>
</div>
</div>
diff --git a/app/assets/javascripts/vue_merge_request_widget/index.js b/app/assets/javascripts/vue_merge_request_widget/index.js
index c59af0c4a1a..068829912bf 100644
--- a/app/assets/javascripts/vue_merge_request_widget/index.js
+++ b/app/assets/javascripts/vue_merge_request_widget/index.js
@@ -1,8 +1,15 @@
import Vue from 'vue';
import MrWidgetOptions from 'ee_else_ce/vue_merge_request_widget/mr_widget_options.vue';
import Translate from '../vue_shared/translate';
+import VueApollo from 'vue-apollo';
+import createDefaultClient from '~/lib/graphql';
Vue.use(Translate);
+Vue.use(VueApollo);
+
+const apolloProvider = new VueApollo({
+ defaultClient: createDefaultClient(),
+});
export default () => {
if (gl.mrWidget) return;
@@ -10,7 +17,7 @@ export default () => {
gl.mrWidgetData.gitlabLogo = gon.gitlab_logo;
gl.mrWidgetData.defaultAvatarUrl = gon.default_avatar_url;
- const vm = new Vue(MrWidgetOptions);
+ const vm = new Vue({ ...MrWidgetOptions, apolloProvider });
window.gl.mrWidget = {
checkStatus: vm.checkStatus,
diff --git a/app/assets/stylesheets/pages/note_form.scss b/app/assets/stylesheets/pages/note_form.scss
index aebc5cb757a..3a210d66420 100644
--- a/app/assets/stylesheets/pages/note_form.scss
+++ b/app/assets/stylesheets/pages/note_form.scss
@@ -360,14 +360,6 @@ table {
}
}
-.toolbar-button-icon {
- position: relative;
- top: 1px;
- margin-right: $gl-padding-4;
- color: inherit;
- font-size: 16px;
-}
-
.toolbar-text {
font-size: 14px;
line-height: 16px;
diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb
index 11e3cfb01e4..02b015e8e53 100644
--- a/app/controllers/groups/variables_controller.rb
+++ b/app/controllers/groups/variables_controller.rb
@@ -9,7 +9,7 @@ module Groups
def show
respond_to do |format|
format.json do
- render status: :ok, json: { variables: GroupVariableSerializer.new.represent(@group.variables) }
+ render status: :ok, json: { variables: ::Ci::GroupVariableSerializer.new.represent(@group.variables) }
end
end
end
@@ -29,7 +29,7 @@ module Groups
private
def render_group_variables
- render status: :ok, json: { variables: GroupVariableSerializer.new.represent(@group.variables) }
+ render status: :ok, json: { variables: ::Ci::GroupVariableSerializer.new.represent(@group.variables) }
end
def render_error
diff --git a/app/controllers/projects/incident_management/pager_duty_incidents_controller.rb b/app/controllers/projects/incident_management/pager_duty_incidents_controller.rb
new file mode 100644
index 00000000000..45c288243d7
--- /dev/null
+++ b/app/controllers/projects/incident_management/pager_duty_incidents_controller.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Projects
+ module IncidentManagement
+ class PagerDutyIncidentsController < Projects::ApplicationController
+ respond_to :json
+
+ skip_before_action :verify_authenticity_token
+ skip_before_action :project
+
+ prepend_before_action :project_without_auth
+
+ def create
+ result = ServiceResponse.success(http_status: :accepted)
+
+ unless Feature.enabled?(:pagerduty_webhook, @project)
+ result = ServiceResponse.error(message: 'Unauthorized', http_status: :unauthorized)
+ end
+
+ head result.http_status
+ end
+
+ private
+
+ def project_without_auth
+ @project ||= Project
+ .find_by_full_path("#{params[:namespace_id]}/#{params[:project_id]}")
+ end
+ end
+ end
+end
diff --git a/app/controllers/projects/pipelines/stages_controller.rb b/app/controllers/projects/pipelines/stages_controller.rb
new file mode 100644
index 00000000000..ce08b49ce9f
--- /dev/null
+++ b/app/controllers/projects/pipelines/stages_controller.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+module Projects
+ module Pipelines
+ class StagesController < Projects::Pipelines::ApplicationController
+ before_action :authorize_update_pipeline!
+
+ def play_manual
+ ::Ci::PlayManualStageService
+ .new(@project, current_user, pipeline: pipeline)
+ .execute(stage)
+
+ respond_to do |format|
+ format.json do
+ render json: StageSerializer
+ .new(project: @project, current_user: @current_user)
+ .represent(stage)
+ end
+ end
+ end
+
+ private
+
+ def stage
+ @pipeline_stage ||= pipeline.find_stage_by_name!(params[:stage_name])
+ end
+ end
+ end
+end
diff --git a/app/controllers/projects/stages_controller.rb b/app/controllers/projects/stages_controller.rb
deleted file mode 100644
index c8db5b1277f..00000000000
--- a/app/controllers/projects/stages_controller.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class Projects::StagesController < Projects::PipelinesController
- before_action :authorize_update_pipeline!
-
- def play_manual
- ::Ci::PlayManualStageService
- .new(@project, current_user, pipeline: pipeline)
- .execute(stage)
-
- respond_to do |format|
- format.json do
- render json: StageSerializer
- .new(project: @project, current_user: @current_user)
- .represent(stage)
- end
- end
- end
-
- private
-
- def stage
- @pipeline_stage ||= pipeline.find_stage_by_name!(params[:stage_name])
- end
-end
diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb
index 1dffc57fcf0..2cc030d18fc 100644
--- a/app/controllers/projects/variables_controller.rb
+++ b/app/controllers/projects/variables_controller.rb
@@ -6,7 +6,7 @@ class Projects::VariablesController < Projects::ApplicationController
def show
respond_to do |format|
format.json do
- render status: :ok, json: { variables: VariableSerializer.new.represent(@project.variables) }
+ render status: :ok, json: { variables: ::Ci::VariableSerializer.new.represent(@project.variables) }
end
end
end
@@ -26,7 +26,7 @@ class Projects::VariablesController < Projects::ApplicationController
private
def render_variables
- render status: :ok, json: { variables: VariableSerializer.new.represent(@project.variables) }
+ render status: :ok, json: { variables: ::Ci::VariableSerializer.new.represent(@project.variables) }
end
def render_error
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb
index 8a32d3c8a3f..aeba88d4939 100644
--- a/app/helpers/icons_helper.rb
+++ b/app/helpers/icons_helper.rb
@@ -53,6 +53,15 @@ module IconsHelper
content_tag(:svg, content_tag(:use, "", { "xlink:href" => "#{sprite_icon_path}##{icon_name}" } ), class: css_classes.empty? ? nil : css_classes.join(' '))
end
+ def loading_icon(container: false, color: 'orange', size: 'sm', css_class: nil)
+ css_classes = ['gl-spinner', "gl-spinner-#{color}", "gl-spinner-#{size}"]
+ css_classes << "#{css_class}" unless css_class.blank?
+
+ spinner = content_tag(:span, "", { class: css_classes.join(' '), aria: { label: _('Loading') } })
+
+ container == true ? content_tag(:div, spinner, { class: 'gl-spinner-container' }) : spinner
+ end
+
def external_snippet_icon(name)
content_tag(:span, "", class: "gl-snippet-icon gl-snippet-icon-#{name}")
end
diff --git a/app/models/alert_management/alert.rb b/app/models/alert_management/alert.rb
index 394957beb40..1a8a3f7a54c 100644
--- a/app/models/alert_management/alert.rb
+++ b/app/models/alert_management/alert.rb
@@ -57,7 +57,7 @@ module AlertManagement
validates :started_at, presence: true
validates :fingerprint, allow_blank: true, uniqueness: {
scope: :project,
- conditions: -> { where.not(status: STATUSES[:resolved]) },
+ conditions: -> { not_resolved },
message: -> (object, data) { _('Cannot have multiple unresolved alerts') }
}, unless: :resolved?
validate :hosts_length
@@ -120,6 +120,7 @@ module AlertManagement
scope :for_environment, -> (environment) { where(environment: environment) }
scope :search, -> (query) { fuzzy_search(query, [:title, :description, :monitoring_tool, :service]) }
scope :open, -> { with_status(:triggered, :acknowledged) }
+ scope :not_resolved, -> { where.not(status: STATUSES[:resolved]) }
scope :with_prometheus_alert, -> { includes(:prometheus_alert) }
scope :order_start_time, -> (sort_order) { order(started_at: sort_order) }
diff --git a/app/presenters/projects/prometheus/alert_presenter.rb b/app/presenters/projects/prometheus/alert_presenter.rb
index 8307c0ed8b8..1cf8b202810 100644
--- a/app/presenters/projects/prometheus/alert_presenter.rb
+++ b/app/presenters/projects/prometheus/alert_presenter.rb
@@ -6,7 +6,7 @@ module Projects
RESERVED_ANNOTATIONS = %w(gitlab_incident_markdown gitlab_y_label title).freeze
GENERIC_ALERT_SUMMARY_ANNOTATIONS = %w(monitoring_tool service hosts).freeze
MARKDOWN_LINE_BREAK = " \n".freeze
- INCIDENT_LABEL_NAME = IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES[:title].freeze
+ INCIDENT_LABEL_NAME = ::IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES[:title].freeze
METRIC_TIME_WINDOW = 30.minutes
def full_title
diff --git a/app/serializers/ci/group_variable_entity.rb b/app/serializers/ci/group_variable_entity.rb
new file mode 100644
index 00000000000..e7d0a957082
--- /dev/null
+++ b/app/serializers/ci/group_variable_entity.rb
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+module Ci
+ class GroupVariableEntity < Ci::BasicVariableEntity
+ end
+end
diff --git a/app/serializers/ci/group_variable_serializer.rb b/app/serializers/ci/group_variable_serializer.rb
new file mode 100644
index 00000000000..b100a931620
--- /dev/null
+++ b/app/serializers/ci/group_variable_serializer.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+module Ci
+ class GroupVariableSerializer < BaseSerializer
+ entity ::Ci::GroupVariableEntity
+ end
+end
diff --git a/app/serializers/ci/variable_entity.rb b/app/serializers/ci/variable_entity.rb
new file mode 100644
index 00000000000..715f829a0e1
--- /dev/null
+++ b/app/serializers/ci/variable_entity.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+module Ci
+ class VariableEntity < Ci::BasicVariableEntity
+ expose :environment_scope
+ end
+end
diff --git a/app/serializers/ci/variable_serializer.rb b/app/serializers/ci/variable_serializer.rb
new file mode 100644
index 00000000000..eb47d3b71b5
--- /dev/null
+++ b/app/serializers/ci/variable_serializer.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+module Ci
+ class VariableSerializer < BaseSerializer
+ entity ::Ci::VariableEntity
+ end
+end
diff --git a/app/serializers/group_variable_entity.rb b/app/serializers/group_variable_entity.rb
deleted file mode 100644
index 4f44723fefe..00000000000
--- a/app/serializers/group_variable_entity.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# frozen_string_literal: true
-
-class GroupVariableEntity < Ci::BasicVariableEntity
-end
diff --git a/app/serializers/group_variable_serializer.rb b/app/serializers/group_variable_serializer.rb
deleted file mode 100644
index ed20b240cce..00000000000
--- a/app/serializers/group_variable_serializer.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-class GroupVariableSerializer < BaseSerializer
- entity GroupVariableEntity
-end
diff --git a/app/serializers/variable_entity.rb b/app/serializers/variable_entity.rb
deleted file mode 100644
index 9b0db371acb..00000000000
--- a/app/serializers/variable_entity.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-class VariableEntity < Ci::BasicVariableEntity
- expose :environment_scope
-end
diff --git a/app/serializers/variable_serializer.rb b/app/serializers/variable_serializer.rb
deleted file mode 100644
index 586666cad8e..00000000000
--- a/app/serializers/variable_serializer.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-class VariableSerializer < BaseSerializer
- entity VariableEntity
-end
diff --git a/app/services/alert_management/process_prometheus_alert_service.rb b/app/services/alert_management/process_prometheus_alert_service.rb
index 24c091b4815..573d3914c05 100644
--- a/app/services/alert_management/process_prometheus_alert_service.rb
+++ b/app/services/alert_management/process_prometheus_alert_service.rb
@@ -94,7 +94,7 @@ module AlertManagement
end
def am_alert
- @am_alert ||= AlertManagement::Alert.for_fingerprint(project, gitlab_fingerprint).first
+ @am_alert ||= AlertManagement::Alert.not_resolved.for_fingerprint(project, gitlab_fingerprint).first
end
def bad_request
diff --git a/app/services/projects/alerting/notify_service.rb b/app/services/projects/alerting/notify_service.rb
index 4af3eba5df0..e08bc8efb15 100644
--- a/app/services/projects/alerting/notify_service.rb
+++ b/app/services/projects/alerting/notify_service.rb
@@ -4,7 +4,7 @@ module Projects
module Alerting
class NotifyService < BaseService
include Gitlab::Utils::StrongMemoize
- include IncidentManagement::Settings
+ include ::IncidentManagement::Settings
def execute(token)
return forbidden unless alerts_service_activated?
@@ -55,7 +55,7 @@ module Projects
def find_alert_by_fingerprint(fingerprint)
return unless fingerprint
- AlertManagement::Alert.for_fingerprint(project, fingerprint).first
+ AlertManagement::Alert.not_resolved.for_fingerprint(project, fingerprint).first
end
def send_email?
@@ -65,7 +65,7 @@ module Projects
def process_incident_issues(alert)
return if alert.issue
- IncidentManagement::ProcessAlertWorker.perform_async(nil, nil, alert.id)
+ ::IncidentManagement::ProcessAlertWorker.perform_async(nil, nil, alert.id)
end
def send_alert_email
diff --git a/app/services/projects/prometheus/alerts/notify_service.rb b/app/services/projects/prometheus/alerts/notify_service.rb
index 4b3aed2d1d9..ea557ebe20f 100644
--- a/app/services/projects/prometheus/alerts/notify_service.rb
+++ b/app/services/projects/prometheus/alerts/notify_service.rb
@@ -5,7 +5,7 @@ module Projects
module Alerts
class NotifyService < BaseService
include Gitlab::Utils::StrongMemoize
- include IncidentManagement::Settings
+ include ::IncidentManagement::Settings
# This set of keys identifies a payload as a valid Prometheus
# payload and thus processable by this service. See also
diff --git a/app/views/shared/notes/_hints.html.haml b/app/views/shared/notes/_hints.html.haml
index df20c04ed47..abd5d8cd9db 100644
--- a/app/views/shared/notes/_hints.html.haml
+++ b/app/views/shared/notes/_hints.html.haml
@@ -16,8 +16,7 @@
%span.attaching-file-message
-# Populated by app/assets/javascripts/dropzone_input.js
%span.uploading-progress 0%
- %span.uploading-spinner
- .toolbar-button-icon.spinner.align-text-top
+ = loading_icon(css_class: 'align-text-bottom gl-mr-2')
%span.uploading-error-container.hide
%span.uploading-error-icon