Commit 8cb105cf authored by Pawel Chojnacki's avatar Pawel Chojnacki

Fix order of checks in editable? method.

+ address small nitpicks
parent 277f7fef
...@@ -28,7 +28,7 @@ class PrometheusService < MonitoringService ...@@ -28,7 +28,7 @@ class PrometheusService < MonitoringService
end end
def editable? def editable?
!prometheus_installed? || manual_configuration? manual_configuration? || !prometheus_installed?
end end
def title def title
...@@ -126,7 +126,8 @@ class PrometheusService < MonitoringService ...@@ -126,7 +126,8 @@ class PrometheusService < MonitoringService
end end
def prometheus_installed? def prometheus_installed?
return false if template? || !project return false if template?
return false unless project
project.clusters.enabled.any? { |cluster| cluster.application_prometheus&.installed? } project.clusters.enabled.any? { |cluster| cluster.application_prometheus&.installed? }
end end
...@@ -157,7 +158,7 @@ class PrometheusService < MonitoringService ...@@ -157,7 +158,7 @@ class PrometheusService < MonitoringService
end end
def synchronize_service_state! def synchronize_service_state!
self.active = prometheus_installed? || self.manual_configuration? self.active = prometheus_installed? || manual_configuration?
true true
end end
......
...@@ -249,7 +249,7 @@ FactoryBot.define do ...@@ -249,7 +249,7 @@ FactoryBot.define do
project.create_prometheus_service( project.create_prometheus_service(
active: true, active: true,
properties: { properties: {
api_url: 'https://prometheus.example.com', api_url: 'https://prometheus.example.com/',
manual_configuration: true manual_configuration: true
} }
) )
......
...@@ -30,8 +30,8 @@ FactoryBot.define do ...@@ -30,8 +30,8 @@ FactoryBot.define do
project project
active true active true
properties({ properties({
manual_configuration: true, api_url: 'https://prometheus.example.com/',
api_url: 'https://prometheus.example.com/' manual_configuration: true
}) })
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