Refactor some methods in Prometheus model
- #update_errored? method def is redundant, already defined from state machine - #update_in_progress? moved to ApplicationStatus - #ready_status becomes a constant. Previously it was extended in ee/ so maybe that was why it's a instance method
This commit is contained in:
parent
8296ff580c
commit
d87486e678
2 changed files with 7 additions and 14 deletions
|
@ -5,7 +5,8 @@ module Clusters
|
|||
class Prometheus < ActiveRecord::Base
|
||||
include PrometheusAdapter
|
||||
|
||||
VERSION = '6.7.3'.freeze
|
||||
VERSION = '6.7.3'
|
||||
READY_STATUS = [:installed, :updating, :updated, :update_errored].freeze
|
||||
|
||||
self.table_name = 'clusters_applications_prometheus'
|
||||
|
||||
|
@ -24,20 +25,8 @@ module Clusters
|
|||
end
|
||||
end
|
||||
|
||||
def ready_status
|
||||
[:installed, :updating, :updated, :update_errored]
|
||||
end
|
||||
|
||||
def ready?
|
||||
ready_status.include?(status_name)
|
||||
end
|
||||
|
||||
def update_in_progress?
|
||||
status_name == :updating
|
||||
end
|
||||
|
||||
def update_errored?
|
||||
status_name == :update_errored
|
||||
READY_STATUS.include?(status_name)
|
||||
end
|
||||
|
||||
def chart
|
||||
|
|
|
@ -77,6 +77,10 @@ module Clusters
|
|||
def available?
|
||||
installed? || updated?
|
||||
end
|
||||
|
||||
def update_in_progress?
|
||||
updating?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue