diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /app/models/metrics/dashboard/annotation.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'app/models/metrics/dashboard/annotation.rb')
-rw-r--r-- | app/models/metrics/dashboard/annotation.rb | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/app/models/metrics/dashboard/annotation.rb b/app/models/metrics/dashboard/annotation.rb index d3d3f973398..ac0fcb41089 100644 --- a/app/models/metrics/dashboard/annotation.rb +++ b/app/models/metrics/dashboard/annotation.rb @@ -7,15 +7,10 @@ module Metrics self.table_name = 'metrics_dashboard_annotations' - belongs_to :environment, inverse_of: :metrics_dashboard_annotations - belongs_to :cluster, class_name: 'Clusters::Cluster', inverse_of: :metrics_dashboard_annotations - validates :starting_at, presence: true validates :description, presence: true, length: { maximum: 255 } validates :dashboard_path, presence: true, length: { maximum: 255 } validates :panel_xid, length: { maximum: 255 } - validate :single_ownership - validate :orphaned_annotation validate :ending_at_after_starting_at scope :after, ->(after) { where('starting_at >= ?', after) } @@ -34,18 +29,6 @@ module Metrics errors.add(:ending_at, s_("MetricsDashboardAnnotation|can't be before starting_at time")) end - - def single_ownership - return if cluster.nil? ^ environment.nil? - - errors.add(:base, s_("MetricsDashboardAnnotation|Annotation can't belong to both a cluster and an environment at the same time")) - end - - def orphaned_annotation - return if cluster.present? || environment.present? - - errors.add(:base, s_("MetricsDashboardAnnotation|Annotation must belong to a cluster or an environment")) - end end end end |