diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-02-01 00:55:47 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-02-01 00:55:47 +0300 |
commit | 310ae68774d0ed9beef839dd1bbd221c945d0fe5 (patch) | |
tree | 54f3447bbf762407e60657b12e7ef0a4b342ee2b /app | |
parent | 0b47134e6a003cfad4501a1af31161316239f1bf (diff) |
hide prometheus manual integration form when auto config is active
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project_services/prometheus_service.rb | 18 | ||||
-rw-r--r-- | app/views/projects/services/prometheus/_help.html.haml | 27 |
2 files changed, 27 insertions, 18 deletions
diff --git a/app/models/project_services/prometheus_service.rb b/app/models/project_services/prometheus_service.rb index 3f90d841d58..f2f71547e03 100644 --- a/app/models/project_services/prometheus_service.rb +++ b/app/models/project_services/prometheus_service.rb @@ -27,6 +27,10 @@ class PrometheusService < MonitoringService false end + def editable? + !prometheus_installed? || manual_configuration? + end + def title 'Prometheus' end @@ -40,19 +44,13 @@ class PrometheusService < MonitoringService end def fields + return [] unless editable? [ { - type: 'fieldset', + type: 'checkbox', name: 'manual_configuration', - legend: 'Manual Configuration', - fields: [ - { - type: 'checkbox', - name: 'manual_configuration', - title: s_('PrometheusService|Active'), - required: true - } - ] + title: s_('PrometheusService|Active'), + required: true }, { type: 'text', diff --git a/app/views/projects/services/prometheus/_help.html.haml b/app/views/projects/services/prometheus/_help.html.haml index 96a194b212e..83d3faf658f 100644 --- a/app/views/projects/services/prometheus/_help.html.haml +++ b/app/views/projects/services/prometheus/_help.html.haml @@ -1,10 +1,21 @@ -.row.prepend-top-default.append-bottom-default - %p - - unless @service.manual_configuration? - - if @service.prometheus_installed? - = link_to 'Manage installed Prometheus', project_clusters_path(@project), class: 'btn btn-cancel' - - else - = link_to 'Install Prometheus', project_clusters_path(@project), class: 'btn btn-cancel' +%h4 + Auto configuration + +.prepend-top-default.append-bottom-default + - unless @service.manual_configuration? + - if @service.prometheus_installed? + = link_to 'Manage clusters', project_clusters_path(@project), class: 'btn' - else - To automatically install prometheus disable manual configuration + = link_to 'Install Prometheus on clusters', project_clusters_path(@project), class: 'btn btn-success' + - else + .well + To enable the installation of Prometheus on your clusters, deactivate the manual configuration below + +%hr + +%h4.append-bottom-default + Manual configuration +- unless @service.editable? + .well + To enable manual configuration, uninstall Prometheus from your clusters |