summaryrefslogtreecommitdiff
path: root/app/models/prometheus_metric.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 12:06:12 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 12:06:12 +0000
commit3fc9a8e6957ddf75576dc63069c4c0249514499f (patch)
tree003e30463853843d6fb736a9396c7eb53a3dfc9a /app/models/prometheus_metric.rb
parente24153b0cb080b1b25076f8fd358b4273848f2e2 (diff)
downloadgitlab-ce-3fc9a8e6957ddf75576dc63069c4c0249514499f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/prometheus_metric.rb')
-rw-r--r--app/models/prometheus_metric.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/prometheus_metric.rb b/app/models/prometheus_metric.rb
index 08f4df7ea01..d0dc31476ff 100644
--- a/app/models/prometheus_metric.rb
+++ b/app/models/prometheus_metric.rb
@@ -14,7 +14,13 @@ class PrometheusMetric < ApplicationRecord
validates :project, presence: true, unless: :common?
validates :project, absence: true, if: :common?
+ scope :for_project, -> (project) { where(project: project) }
+ scope :for_group, -> (group) { where(group: group) }
+ scope :for_title, -> (title) { where(title: title) }
+ scope :for_y_label, -> (y_label) { where(y_label: y_label) }
+ scope :for_identifier, -> (identifier) { where(identifier: identifier) }
scope :common, -> { where(common: true) }
+ scope :ordered, -> { reorder(created_at: :asc) }
def priority
group_details(group).fetch(:priority)