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
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/models/alert_management
parentd9aac35d79489591396456aceefa609de4b8b05c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/alert_management')
-rw-r--r--app/models/alert_management/alert.rb3
1 files changed, 2 insertions, 1 deletions
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) }