Commit c924cbb7 authored by Savas Vedova's avatar Savas Vedova

Make filters work for pipeline dashboard

This commit adds the router to the pipeline dashboard so
that filters are persisted in the URL and adds the state
argument to the GraphQL query.
parent a87a3d2c
...@@ -50,9 +50,16 @@ export default { ...@@ -50,9 +50,16 @@ export default {
query: findingsQuery, query: findingsQuery,
variables() { variables() {
return { return {
...this.filters,
pipelineId: this.pipeline.iid, pipelineId: this.pipeline.iid,
fullPath: this.projectFullPath, fullPath: this.projectFullPath,
first: VULNERABILITIES_PER_PAGE, first: VULNERABILITIES_PER_PAGE,
// Two issues here:
// 1. Severity filter, unlike vulnerabilities, need to be lower case.
// 2. Empty array returns an empty result, therefore we need to pass undefined in that case.
severity: this.filters?.severity?.length
? this.filters.severity.map((s) => s.toLowerCase())
: undefined,
}; };
}, },
update: ({ project }) => update: ({ project }) =>
......
...@@ -9,6 +9,7 @@ query pipelineFindings( ...@@ -9,6 +9,7 @@ query pipelineFindings(
$severity: [String!] $severity: [String!]
$reportType: [String!] $reportType: [String!]
$scanner: [String!] $scanner: [String!]
$state: [VulnerabilityState!]
) { ) {
project(fullPath: $fullPath) { project(fullPath: $fullPath) {
pipeline(iid: $pipelineId) { pipeline(iid: $pipelineId) {
...@@ -18,6 +19,7 @@ query pipelineFindings( ...@@ -18,6 +19,7 @@ query pipelineFindings(
severity: $severity severity: $severity
reportType: $reportType reportType: $reportType
scanner: $scanner scanner: $scanner
state: $state
) { ) {
nodes { nodes {
uuid uuid
......
...@@ -2,6 +2,7 @@ import Vue from 'vue'; ...@@ -2,6 +2,7 @@ import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import PipelineSecurityDashboard from './components/pipeline/pipeline_security_dashboard.vue'; import PipelineSecurityDashboard from './components/pipeline/pipeline_security_dashboard.vue';
import apolloProvider from './graphql/provider'; import apolloProvider from './graphql/provider';
import createRouter from './router';
import createDashboardStore from './store'; import createDashboardStore from './store';
import { DASHBOARD_TYPES } from './store/constants'; import { DASHBOARD_TYPES } from './store/constants';
import { LOADING_VULNERABILITIES_ERROR_CODES } from './store/modules/vulnerabilities/constants'; import { LOADING_VULNERABILITIES_ERROR_CODES } from './store/modules/vulnerabilities/constants';
...@@ -38,6 +39,7 @@ export default () => { ...@@ -38,6 +39,7 @@ export default () => {
return new Vue({ return new Vue({
el, el,
apolloProvider, apolloProvider,
router: createRouter(),
store: createDashboardStore({ store: createDashboardStore({
dashboardType: DASHBOARD_TYPES.PIPELINE, dashboardType: DASHBOARD_TYPES.PIPELINE,
}), }),
......
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