Commit ecd56dbb authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'jivanvl-address-missing-colors-chart-panels' into 'master'

Add the missing colors on the monitoring dashboards

See merge request gitlab-org/gitlab!24921
parents 6f175bff 0ba4408a
......@@ -14,6 +14,7 @@ import {
lineWidths,
symbolSizes,
dateFormats,
chartColorValues,
} from '../../constants';
import { makeDataSeries } from '~/helpers/monitor_helper';
import { graphDataValidatorForValues } from '../../utils';
......@@ -124,7 +125,7 @@ export default {
// Transforms & supplements query data to render appropriate labels & styles
// Input: [{ queryAttributes1 }, { queryAttributes2 }]
// Output: [{ seriesAttributes1 }, { seriesAttributes2 }]
return this.graphData.metrics.reduce((acc, query) => {
return this.graphData.metrics.reduce((acc, query, i) => {
const { appearance } = query;
const lineType =
appearance && appearance.line && appearance.line.type
......@@ -145,7 +146,7 @@ export default {
lineStyle: {
type: lineType,
width: lineWidth,
color: this.primaryColor,
color: chartColorValues[i % chartColorValues.length],
},
showSymbol: false,
areaStyle: this.graphData.type === 'area-chart' ? areaStyle : undefined,
......
......@@ -70,6 +70,13 @@ export const colorValues = {
anomalyAreaColor: '#1f78d1',
};
export const chartColorValues = [
'#1f78d1', // $blue-500 (see variables.scss)
'#1aaa55', // $green-500
'#fc9403', // $orange-500
'#6d49cb', // $purple
];
export const lineTypes = {
default: 'solid',
};
......
---
title: Add missing colors on the monitoring dashboards
merge_request: 24921
author:
type: fixed
......@@ -3,6 +3,7 @@ import { setTestTimeout } from 'helpers/timeout';
import { GlLink } from '@gitlab/ui';
import { GlAreaChart, GlLineChart, GlChartSeriesLabel } from '@gitlab/ui/dist/charts';
import { shallowWrapperContainsSlotText } from 'helpers/vue_test_utils_helper';
import { chartColorValues } from '~/monitoring/constants';
import { createStore } from '~/monitoring/stores';
import TimeSeries from '~/monitoring/components/charts/time_series.vue';
import * as types from '~/monitoring/stores/mutation_types';
......@@ -315,6 +316,10 @@ describe('Time series component', () => {
it('formats line width correctly', () => {
expect(chartData[0].lineStyle.width).toBe(2);
});
it('formats line color correctly', () => {
expect(chartData[0].lineStyle.color).toBe(chartColorValues[0]);
});
});
describe('chartOptions', () => {
......
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