hide prometheus manual integration form when auto config is active

This commit is contained in:
Mike Greiling 2018-01-31 15:55:47 -06:00
parent 0b47134e6a
commit 310ae68774
No known key found for this signature in database
GPG Key ID: 0303DF507FA67596
2 changed files with 28 additions and 19 deletions

View File

@ -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',

View File

@ -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'
- else
To automatically install prometheus disable manual configuration
%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
= 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