Commit c67a83fd authored by Paul Slaughter's avatar Paul Slaughter

Merge branch '9510-new-metric-button-should-not-be-duplicated-on-custom-metrics-page' into 'master'

Remove duplicated 'New metric' button in Prometheus configuration

Closes #9510

See merge request gitlab-org/gitlab-ee!14964
parents 21d364d0 73435dc6
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
} }
.custom-monitored-metrics { .custom-monitored-metrics {
.card-title { .card-header {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -292,17 +292,6 @@ ...@@ -292,17 +292,6 @@
} }
} }
.loading-metrics,
.empty-metrics {
padding: 30px 10px;
p,
.btn {
margin-top: 10px;
margin-bottom: 0;
}
}
.loading-metrics .metrics-load-spinner { .loading-metrics .metrics-load-spinner {
color: $gl-gray-700; color: $gl-gray-700;
} }
......
...@@ -8,15 +8,16 @@ ...@@ -8,15 +8,16 @@
.col-lg-9 .col-lg-9
.card.js-panel-monitored-metrics{ data: { active_metrics: active_common_project_prometheus_metrics_path(project, :json), metrics_help_path: help_page_path('user/project/integrations/prometheus_library/index') } } .card.js-panel-monitored-metrics{ data: { active_metrics: active_common_project_prometheus_metrics_path(project, :json), metrics_help_path: help_page_path('user/project/integrations/prometheus_library/index') } }
.card-header .card-header
= s_('PrometheusService|Common metrics') %strong
= s_('PrometheusService|Common metrics')
%span.badge.badge-pill.js-monitored-count 0 %span.badge.badge-pill.js-monitored-count 0
.card-body .card-body
.loading-metrics.js-loading-metrics .loading-metrics.js-loading-metrics
%p.prepend-top-10.prepend-left-10 %p.m-3
= icon('spinner spin', class: 'metrics-load-spinner') = icon('spinner spin', class: 'metrics-load-spinner')
= s_('PrometheusService|Finding and configuring metrics...') = s_('PrometheusService|Finding and configuring metrics...')
.empty-metrics.hidden.js-empty-metrics .empty-metrics.hidden.js-empty-metrics
%p.text-tertiary.prepend-top-10.prepend-left-10 %p.text-tertiary.m-3
= s_('PrometheusService|Waiting for your first deployment to an environment to find common metrics') = s_('PrometheusService|Waiting for your first deployment to an environment to find common metrics')
%ul.list-unstyled.metrics-list.hidden.js-metrics-list %ul.list-unstyled.metrics-list.hidden.js-metrics-list
......
...@@ -34,16 +34,14 @@ export default class EEPrometheusMetrics extends PrometheusMetrics { ...@@ -34,16 +34,14 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
'.js-no-active-integration-text', '.js-no-active-integration-text',
); );
this.$newCustomMetricButton = this.$monitoredCustomMetricsPanel.find('.js-new-metric-button'); this.$newCustomMetricButton = this.$monitoredCustomMetricsPanel.find('.js-new-metric-button');
this.$newCustomMetricButtonBody = this.$monitoredCustomMetricsPanel.find( this.$newCustomMetricText = this.$monitoredCustomMetricsPanel.find('.js-new-metric-text');
'.js-new-metric-body-button',
);
this.$flashCustomMetricsContainer = this.$wrapperCustomMetrics.find('.flash-container'); this.$flashCustomMetricsContainer = this.$wrapperCustomMetrics.find('.flash-container');
this.$els = [ this.$els = [
this.$monitoredCustomMetricsLoading, this.$monitoredCustomMetricsLoading,
this.$monitoredCustomMetricsList, this.$monitoredCustomMetricsList,
this.$newCustomMetricButton, this.$newCustomMetricButton,
this.$newCustomMetricButtonBody, this.$newCustomMetricText,
this.$monitoredCustomMetricsNoIntegrationText, this.$monitoredCustomMetricsNoIntegrationText,
this.$monitoredCustomMetricsEmpty, this.$monitoredCustomMetricsEmpty,
]; ];
...@@ -74,7 +72,6 @@ export default class EEPrometheusMetrics extends PrometheusMetrics { ...@@ -74,7 +72,6 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
break; break;
case PANEL_STATE.LIST: case PANEL_STATE.LIST:
this.setVisible(this.$newCustomMetricButton, this.$monitoredCustomMetricsList); this.setVisible(this.$newCustomMetricButton, this.$monitoredCustomMetricsList);
break; break;
case PANEL_STATE.NO_INTEGRATION: case PANEL_STATE.NO_INTEGRATION:
this.setVisible( this.setVisible(
...@@ -86,7 +83,7 @@ export default class EEPrometheusMetrics extends PrometheusMetrics { ...@@ -86,7 +83,7 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
this.setVisible( this.setVisible(
this.$monitoredCustomMetricsEmpty, this.$monitoredCustomMetricsEmpty,
this.$newCustomMetricButton, this.$newCustomMetricButton,
this.$newCustomMetricButtonBody, this.$newCustomMetricText,
); );
break; break;
} }
......
...@@ -8,22 +8,23 @@ ...@@ -8,22 +8,23 @@
.col-lg-9 .col-lg-9
.card.custom-monitored-metrics.js-panel-custom-monitored-metrics{ data: { active_custom_metrics: project_prometheus_metrics_path(project), environments_data: environments_list_data, service_active: "#{@service.active}" } } .card.custom-monitored-metrics.js-panel-custom-monitored-metrics{ data: { active_custom_metrics: project_prometheus_metrics_path(project), environments_data: environments_list_data, service_active: "#{@service.active}" } }
.card-header .card-header
%h3.card-title %strong
= s_('PrometheusService|Custom metrics') = s_('PrometheusService|Custom metrics')
%span.badge.badge-pill.js-custom-monitored-count 0 %span.badge.badge-pill.js-custom-monitored-count 0
= link_to s_('PrometheusService|New metric'), new_project_prometheus_metric_path(project), class: 'btn btn-success js-new-metric-button hidden' = link_to s_('PrometheusService|New metric'), new_project_prometheus_metric_path(project), class: 'btn btn-success js-new-metric-button hidden'
.card-body .card-body
.flash-container.hidden .flash-container.hidden
.flash-warning .flash-warning
.flash-text .flash-text
.loading-metrics.js-loading-custom-metrics .loading-metrics.js-loading-custom-metrics
%p.prepend-top-10.prepend-left-10 %p.m-3
= icon('spinner spin', class: 'metrics-load-spinner') = icon('spinner spin', class: 'metrics-load-spinner')
= s_('PrometheusService|Finding custom metrics...') = s_('PrometheusService|Finding custom metrics...')
.empty-metrics.hidden.js-empty-custom-metrics .empty-metrics.hidden.js-empty-custom-metrics
%p.text-tertiary.prepend-top-10.prepend-left-10.js-no-active-integration-text.hidden %p.text-tertiary.m-3.js-no-active-integration-text.hidden
= s_('PrometheusService|Enable Prometheus to define custom metrics, using either option above') = s_('PrometheusService|Enable Prometheus to define custom metrics, using either option above')
= link_to s_('PrometheusService|New metric'), new_project_prometheus_metric_path(project), class: 'btn btn-success prepend-top-10 prepend-left-10 append-bottom-10 js-new-metric-body-button hidden' %p.text-tertiary.m-3.js-new-metric-text.hidden
= s_('PrometheusService|No custom metrics have been created. Create one using the button above')
%ul.list-unstyled.metrics-list.hidden.js-custom-metrics-list %ul.list-unstyled.metrics-list.hidden.js-custom-metrics-list
= render_ce 'projects/services/prometheus/metrics', project: project = render_ce 'projects/services/prometheus/metrics', project: project
---
title: Remove duplicated 'New metric' button in prometheus configuration
merge_request: 14964
author:
type: changed
...@@ -56,7 +56,7 @@ describe('PrometheusMetrics EE', () => { ...@@ -56,7 +56,7 @@ describe('PrometheusMetrics EE', () => {
).toBeTruthy(); ).toBeTruthy();
expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toBeTruthy(); expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toBeTruthy();
expect(prometheusMetrics.$newCustomMetricButtonBody.hasClass('hidden')).toBeTruthy(); expect(prometheusMetrics.$newCustomMetricText.hasClass('hidden')).toBeTruthy();
}); });
it('should show metrics list when called with `list`', () => { it('should show metrics list when called with `list`', () => {
...@@ -70,7 +70,7 @@ describe('PrometheusMetrics EE', () => { ...@@ -70,7 +70,7 @@ describe('PrometheusMetrics EE', () => {
).toBeTruthy(); ).toBeTruthy();
expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toEqual(false); expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toEqual(false);
expect(prometheusMetrics.$newCustomMetricButtonBody.hasClass('hidden')).toBeTruthy(); expect(prometheusMetrics.$newCustomMetricText.hasClass('hidden')).toBeTruthy();
}); });
it('should show empty state when called with `empty`', () => { it('should show empty state when called with `empty`', () => {
...@@ -84,7 +84,7 @@ describe('PrometheusMetrics EE', () => { ...@@ -84,7 +84,7 @@ describe('PrometheusMetrics EE', () => {
).toBeTruthy(); ).toBeTruthy();
expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toEqual(false); expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toEqual(false);
expect(prometheusMetrics.$newCustomMetricButtonBody.hasClass('hidden')).toEqual(false); expect(prometheusMetrics.$newCustomMetricText.hasClass('hidden')).toEqual(false);
}); });
it('should show monitored metrics list', () => { it('should show monitored metrics list', () => {
...@@ -100,7 +100,7 @@ describe('PrometheusMetrics EE', () => { ...@@ -100,7 +100,7 @@ describe('PrometheusMetrics EE', () => {
).toBeTruthy(); ).toBeTruthy();
expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toEqual(false); expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toEqual(false);
expect(prometheusMetrics.$newCustomMetricButtonBody.hasClass('hidden')).toBeTruthy(); expect(prometheusMetrics.$newCustomMetricText.hasClass('hidden')).toBeTruthy();
expect($metricsListLi.length).toEqual(metrics.length); expect($metricsListLi.length).toEqual(metrics.length);
}); });
...@@ -116,7 +116,7 @@ describe('PrometheusMetrics EE', () => { ...@@ -116,7 +116,7 @@ describe('PrometheusMetrics EE', () => {
expect(prometheusMetrics.$monitoredCustomMetricsLoading.hasClass('hidden')).toBeTruthy(); expect(prometheusMetrics.$monitoredCustomMetricsLoading.hasClass('hidden')).toBeTruthy();
expect(prometheusMetrics.$monitoredCustomMetricsList.hasClass('hidden')).toBeTruthy(); expect(prometheusMetrics.$monitoredCustomMetricsList.hasClass('hidden')).toBeTruthy();
expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toBeTruthy(); expect(prometheusMetrics.$newCustomMetricButton.hasClass('hidden')).toBeTruthy();
expect(prometheusMetrics.$newCustomMetricButtonBody.hasClass('hidden')).toBeTruthy(); expect(prometheusMetrics.$newCustomMetricText.hasClass('hidden')).toBeTruthy();
}); });
}); });
}); });
...@@ -11614,6 +11614,9 @@ msgstr "" ...@@ -11614,6 +11614,9 @@ msgstr ""
msgid "PrometheusService|New metric" msgid "PrometheusService|New metric"
msgstr "" msgstr ""
msgid "PrometheusService|No custom metrics have been created. Create one using the button above"
msgstr ""
msgid "PrometheusService|Prometheus API Base URL, like http://prometheus.example.com/" msgid "PrometheusService|Prometheus API Base URL, like http://prometheus.example.com/"
msgstr "" msgstr ""
......
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