Skip to content
Snippets Groups Projects
Commit 96821f96 authored by Savas Vedova's avatar Savas Vedova
Browse files

Enable timeline on trends chart

- Add changelog
- Update documentation image
parent b005bd81
No related branches found
No related tags found
No related merge requests found
doc/user/application_security/security_dashboard/img/project_security_dashboard_chart_v13_10.png

50.5 KiB | W: 1304px | H: 581px

doc/user/application_security/security_dashboard/img/project_security_dashboard_chart_v13_10.png

52.1 KiB | W: 1024px | H: 354px

doc/user/application_security/security_dashboard/img/project_security_dashboard_chart_v13_10.png
doc/user/application_security/security_dashboard/img/project_security_dashboard_chart_v13_10.png
doc/user/application_security/security_dashboard/img/project_security_dashboard_chart_v13_10.png
doc/user/application_security/security_dashboard/img/project_security_dashboard_chart_v13_10.png
  • 2-up
  • Swipe
  • Onion skin
Loading
Loading
@@ -10,6 +10,7 @@ import { createProjectLoadingError } from '../helpers';
import DashboardNotConfigured from './empty_states/reports_not_configured.vue';
import SecurityChartsLayout from './security_charts_layout.vue';
 
const CHART_DEFAULT_DAYS = 30;
const MAX_DAYS = 100;
const ISO_DATE = 'isoDate';
const SEVERITIES = [
Loading
Loading
@@ -73,6 +74,9 @@ export default {
};
},
computed: {
chartStartDate() {
return formatDate(getDateInPast(new Date(), CHART_DEFAULT_DAYS), ISO_DATE);
},
startDate() {
return formatDate(getDateInPast(new Date(), MAX_DAYS), ISO_DATE);
},
Loading
Loading
@@ -124,6 +128,20 @@ export default {
type: 'value',
minInterval: 1,
},
dataZoom: [
{
type: 'slider',
startValue: this.chartStartDate,
handleIcon: this.svgs['scroll-handle'],
dataBackground: {
lineStyle: {
width: 1,
color: '#bfbfbf',
},
areaStyle: null,
},
},
],
toolbox: {
feature: {
dataZoom: {
Loading
Loading
@@ -144,7 +162,7 @@ export default {
this.chartWidth = this.$refs.layout.$el.clientWidth;
},
created() {
['marquee-selection', 'redo', 'repeat', 'download'].forEach(this.setSvg);
['marquee-selection', 'redo', 'repeat', 'download', 'scroll-handle'].forEach(this.setSvg);
},
methods: {
async setSvg(name) {
Loading
Loading
---
title: Enable timeline on project security dashboard's trends chart
merge_request: 56844
author:
type: added
Loading
Loading
@@ -6,6 +6,7 @@ import DashboardNotConfigured from 'ee/security_dashboard/components/empty_state
import ProjectSecurityCharts from 'ee/security_dashboard/components/project_security_charts.vue';
import SecurityChartsLayout from 'ee/security_dashboard/components/security_charts_layout.vue';
import projectsHistoryQuery from 'ee/security_dashboard/graphql/queries/project_vulnerabilities_by_day_and_count.query.graphql';
import { useFakeDate } from 'helpers/fake_date';
import createMockApollo from 'helpers/mock_apollo_helper';
import {
mockProjectSecurityChartsWithData,
Loading
Loading
@@ -83,6 +84,8 @@ describe('Project Security Charts component', () => {
});
 
describe('when there is history data', () => {
useFakeDate(2021, 3, 11);
beforeEach(() => {
wrapper = createComponent({
query: mockProjectSecurityChartsWithData(),
Loading
Loading
@@ -109,6 +112,19 @@ describe('Project Security Charts component', () => {
expect(option.dataZoom.icon.zoom).toBe('path://mockSvgPathContent');
expect(option.dataZoom.icon.back).toBe('path://mockSvgPathContent');
});
it('contains the timeline slider', () => {
const { dataZoom } = findLineChart().props('option');
expect(dataZoom[0]).toMatchObject({
type: 'slider',
handleIcon: 'path://mockSvgPathContent',
startValue: '2021-03-12',
dataBackground: {
lineStyle: { width: 1 },
areaStyle: null,
},
});
});
});
 
describe('when there is no history data', () => {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment