diff options
3 files changed, 7 insertions, 1 deletions
diff --git a/changelogs/unreleased/34655-label-field-for-setting-a-chart-s-legend-text-is-not-working.yml b/changelogs/unreleased/34655-label-field-for-setting-a-chart-s-legend-text-is-not-working.yml new file mode 100644 index 00000000000..c7a68935e8c --- /dev/null +++ b/changelogs/unreleased/34655-label-field-for-setting-a-chart-s-legend-text-is-not-working.yml @@ -0,0 +1,4 @@ +--- +title: Fixed the chart legend not being set correctly +merge_request: 12628 +author: diff --git a/spec/javascripts/monitoring/mock_data.js b/spec/javascripts/monitoring/mock_data.js index 56d938e1fbe..b69f4eddffc 100644 --- a/spec/javascripts/monitoring/mock_data.js +++ b/spec/javascripts/monitoring/mock_data.js @@ -2481,6 +2481,7 @@ export const singleRowMetrics = [ 'queries': [ { 'query_range': 'avg(rate(container_cpu_usage_seconds_total{%{environment_filter}}[2m])) * 100', + 'label': 'Container CPU', 'result': [ { 'metric': { diff --git a/spec/javascripts/monitoring/monitoring_column_spec.js b/spec/javascripts/monitoring/monitoring_column_spec.js index b3bc97adc9f..c423024dce0 100644 --- a/spec/javascripts/monitoring/monitoring_column_spec.js +++ b/spec/javascripts/monitoring/monitoring_column_spec.js @@ -95,7 +95,7 @@ describe('MonitoringColumn', () => { }); }); - it('has a title for the y-axis that comes from the backend', () => { + it('has a title for the y-axis and the chart legend that comes from the backend', () => { const component = createComponent({ columnData: singleRowMetrics[0], classType: 'col-md-6', @@ -104,5 +104,6 @@ describe('MonitoringColumn', () => { }); expect(component.yAxisLabel).toEqual(component.columnData.y_label); + expect(component.legendTitle).toEqual(component.columnData.queries[0].label); }); }); |