Fix order of checks in editable? method.
+ address small nitpicks
This commit is contained in:
parent
277f7fef2c
commit
8cb105cf5f
|
|
@ -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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue