Commit 5ab95048 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'dbodicherla/add_prometheus_integration_page_in_ops' into 'master'

Add prometheus integration page in ops

See merge request gitlab-org/gitlab!24727
parents b59676e0 87d0e436
......@@ -8,6 +8,7 @@ module Projects
helper_method :error_tracking_setting
def show
render locals: { prometheus_service: prometheus_service }
end
def update
......@@ -28,6 +29,10 @@ module Projects
private
def prometheus_service
project.find_or_initialize_service(::PrometheusService.to_param)
end
def render_update_response(result)
respond_to do |format|
format.html do
......
%b
= s_('PrometheusService|Auto configuration')
- if service.manual_configuration?
.info-well.p-2.mt-2
= s_('PrometheusService|To enable the installation of Prometheus on your clusters, deactivate the manual configuration below')
- else
.container-fluid
.row
- if service.prometheus_available?
.col-sm-2
.svg-container
= image_tag 'illustrations/monitoring/getting_started.svg'
.col-sm-10
%p.text-success.prepend-top-default
= s_('PrometheusService|Prometheus is being automatically managed on your clusters')
= link_to s_('PrometheusService|Manage clusters'), project_clusters_path(project), class: 'btn'
- else
.col-sm-2
= image_tag 'illustrations/monitoring/loading.svg'
.col-sm-10
%p.prepend-top-default
= s_('PrometheusService|Automatically deploy and configure Prometheus on your clusters to monitor your project’s environments')
= link_to s_('PrometheusService|Install Prometheus on clusters'), project_clusters_path(project), class: 'btn btn-success'
%section.settings.no-animate.js-prometheus-settings
.settings-header
%h4
= _('Prometheus')
%button.btn.js-settings-toggle{ type: 'button' }
= _('Expand')
%p
= _('Link Prometheus monitoring to GitLab.')
= link_to _('More information'), help_page_path('user/project/integrations/prometheus'), target: '_blank', rel: 'noopener noreferrer'
.settings-content
- if @project
= render 'projects/settings/operations/configuration_banner', project: @project, service: service
%b.append-bottom-default
= s_('PrometheusService|Manual configuration')
- unless service.editable?
.info-well
= s_('PrometheusService|To enable manual configuration, uninstall Prometheus from your clusters')
......@@ -4,6 +4,7 @@
= render 'projects/settings/operations/incidents'
= render 'projects/settings/operations/error_tracking'
= render 'projects/settings/operations/prometheus', service: prometheus_service if Feature.enabled?(:settings_operations_prometheus_service)
= render 'projects/settings/operations/external_dashboard'
= render 'projects/settings/operations/grafana_integration'
= render_if_exists 'projects/settings/operations/tracing'
......@@ -26,7 +26,7 @@ describe 'projects/settings/operations/show' do
end
it 'links to project.tracing_external_url' do
render
render template: "projects/settings/operations/show", locals: { prometheus_service: project.find_or_initialize_service('prometheus') }
expect(rendered).to have_link('Tracing', href: tracing_url)
end
......@@ -40,7 +40,7 @@ describe 'projects/settings/operations/show' do
end
it 'sanitizes external_url' do
render
render template: "projects/settings/operations/show", locals: { prometheus_service: project.find_or_initialize_service('prometheus') }
expect(tracing_setting.external_url).to eq(malicious_tracing_url)
expect(rendered).to have_link('Tracing', href: cleaned_url)
......@@ -59,7 +59,7 @@ describe 'projects/settings/operations/show' do
end
it 'links to Tracing page' do
render
render template: "projects/settings/operations/show", locals: { prometheus_service: project.find_or_initialize_service('prometheus') }
expect(rendered).to have_link('Tracing', href: project_tracing_path(project))
end
......
......@@ -11576,6 +11576,9 @@ msgstr[1] ""
msgid "Line changes"
msgstr ""
msgid "Link Prometheus monitoring to GitLab."
msgstr ""
msgid "Link copied"
msgstr ""
......@@ -15374,6 +15377,9 @@ msgstr ""
msgid "ProjectsNew|Want to house several dependent projects under the same namespace? %{link_start}Create a group.%{link_end}"
msgstr ""
msgid "Prometheus"
msgstr ""
msgid "PrometheusAlerts|%{count} alerts applied"
msgstr ""
......
......@@ -26,7 +26,7 @@ describe 'projects/settings/operations/show' do
context 'Settings page ' do
it 'renders the Operations Settings page' do
render
render template: "projects/settings/operations/show", locals: { prometheus_service: project.find_or_initialize_service('prometheus') }
expect(rendered).to have_content _('Error Tracking')
expect(rendered).to have_content _('To link Sentry to GitLab, enter your Sentry URL and Auth Token')
......
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