Commit d87486e6 authored by Thong Kuah's avatar Thong Kuah

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
parent 8296ff58
...@@ -5,7 +5,8 @@ module Clusters ...@@ -5,7 +5,8 @@ module Clusters
class Prometheus < ActiveRecord::Base class Prometheus < ActiveRecord::Base
include PrometheusAdapter 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' self.table_name = 'clusters_applications_prometheus'
...@@ -24,20 +25,8 @@ module Clusters ...@@ -24,20 +25,8 @@ module Clusters
end end
end end
def ready_status
[:installed, :updating, :updated, :update_errored]
end
def ready? def ready?
ready_status.include?(status_name) READY_STATUS.include?(status_name)
end
def update_in_progress?
status_name == :updating
end
def update_errored?
status_name == :update_errored
end end
def chart def chart
......
...@@ -77,6 +77,10 @@ module Clusters ...@@ -77,6 +77,10 @@ module Clusters
def available? def available?
installed? || updated? installed? || updated?
end end
def update_in_progress?
updating?
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment