diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2018-10-15 12:03:15 +0300 |
---|---|---|
committer | Peter Leitzen <pleitzen@gitlab.com> | 2018-10-16 10:16:43 +0300 |
commit | 3a3ec6f0213addb52abc29ee83e2d6a00e2292d3 (patch) | |
tree | 42d2840271155af848cbe22d20a50c5757f82fa2 /app | |
parent | 6ea674d1796488f784083eab53becb86330343cb (diff) |
Show available clusters when installed or updated
Before this commit updating Prometheus (e.g. adding alerts) made it
"updated" therefore not installed.
Diffstat (limited to 'app')
6 files changed, 14 insertions, 9 deletions
diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb index 7be6a14f585..e43a0fd1786 100644 --- a/app/models/clusters/applications/jupyter.rb +++ b/app/models/clusters/applications/jupyter.rb @@ -19,7 +19,7 @@ module Clusters def set_initial_status return unless not_installable? - if cluster&.application_ingress_installed? && cluster.application_ingress.external_ip + if cluster&.application_ingress_available? && cluster.application_ingress.external_ip self.status = 'installable' end end diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb index d7011ef447a..20d53b8e620 100644 --- a/app/models/clusters/cluster.rb +++ b/app/models/clusters/cluster.rb @@ -43,8 +43,9 @@ module Clusters delegate :active?, to: :platform_kubernetes, prefix: true, allow_nil: true delegate :rbac?, to: :platform_kubernetes, prefix: true, allow_nil: true - delegate :installed?, to: :application_helm, prefix: true, allow_nil: true - delegate :installed?, to: :application_ingress, prefix: true, allow_nil: true + delegate :available?, to: :application_helm, prefix: true, allow_nil: true + delegate :available?, to: :application_ingress, prefix: true, allow_nil: true + delegate :available?, to: :application_prometheus, prefix: true, allow_nil: true enum platform_type: { kubernetes: 1 diff --git a/app/models/clusters/concerns/application_core.rb b/app/models/clusters/concerns/application_core.rb index e3deedfb036..683b45331f6 100644 --- a/app/models/clusters/concerns/application_core.rb +++ b/app/models/clusters/concerns/application_core.rb @@ -15,7 +15,7 @@ module Clusters def set_initial_status return unless not_installable? - self.status = 'installable' if cluster&.application_helm_installed? + self.status = 'installable' if cluster&.application_helm_available? end def self.application_name diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb index a9df59fc059..93bdf9c223d 100644 --- a/app/models/clusters/concerns/application_status.rb +++ b/app/models/clusters/concerns/application_status.rb @@ -66,6 +66,10 @@ module Clusters end end end + + def available? + installed? || updated? + end end end end diff --git a/app/models/project_services/prometheus_service.rb b/app/models/project_services/prometheus_service.rb index 509e5b6089b..f141502d5df 100644 --- a/app/models/project_services/prometheus_service.rb +++ b/app/models/project_services/prometheus_service.rb @@ -26,7 +26,7 @@ class PrometheusService < MonitoringService end def editable? - manual_configuration? || !prometheus_installed? + manual_configuration? || !prometheus_available? end def title @@ -75,17 +75,17 @@ class PrometheusService < MonitoringService RestClient::Resource.new(api_url) if api_url && manual_configuration? && active? end - def prometheus_installed? + def prometheus_available? 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_available? } end private def synchronize_service_state - self.active = prometheus_installed? || manual_configuration? + self.active = prometheus_available? || manual_configuration? true end diff --git a/app/views/projects/services/prometheus/_configuration_banner.html.haml b/app/views/projects/services/prometheus/_configuration_banner.html.haml index 898b55e4b39..dfcb1c5d240 100644 --- a/app/views/projects/services/prometheus/_configuration_banner.html.haml +++ b/app/views/projects/services/prometheus/_configuration_banner.html.haml @@ -7,7 +7,7 @@ - else .container-fluid .row - - if service.prometheus_installed? + - if service.prometheus_available? .col-sm-2 .svg-container = image_tag 'illustrations/monitoring/getting_started.svg' |