Commit 0cb6ffb7 authored by Alexander Turinske's avatar Alexander Turinske

Update cluster agent vulnerability code

- fix broken test
- abstract out vulnerability location types to
  shared folder
parent b7b473f3
{"__schema":{"types":[{"kind":"UNION","name":"VulnerabilityLocation","possibleTypes":[{"name":"VulnerabilityLocationContainerScanning"},{"name":"VulnerabilityLocationDast"},{"name":"VulnerabilityLocationDependencyScanning"},{"name":"VulnerabilityLocationSast"},{"name":"VulnerabilityLocationSecretDetection"}]}]}}
...@@ -2,14 +2,14 @@ import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; ...@@ -2,14 +2,14 @@ import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import introspectionQueryResultData from './fragmentTypes.json'; import { vulnerabilityLocationTypes } from '~/graphql_shared/fragment_types/vulnerability_location_types';
Vue.use(VueApollo); Vue.use(VueApollo);
// We create a fragment matcher so that we can create a fragment from an interface // We create a fragment matcher so that we can create a fragment from an interface
// Without this, Apollo throws a heuristic fragment matcher warning // Without this, Apollo throws a heuristic fragment matcher warning
const fragmentMatcher = new IntrospectionFragmentMatcher({ const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData, introspectionQueryResultData: vulnerabilityLocationTypes,
}); });
const defaultClient = createDefaultClient( const defaultClient = createDefaultClient(
......
export const vulnerabilityLocationTypes = {
__schema: {
types: [
{
kind: 'UNION',
name: 'VulnerabilityLocation',
possibleTypes: [
{ name: 'VulnerabilityLocationContainerScanning' },
{ name: 'VulnerabilityLocationDast' },
{ name: 'VulnerabilityLocationDependencyScanning' },
{ name: 'VulnerabilityLocationSast' },
{ name: 'VulnerabilityLocationSecretDetection' },
],
},
],
},
};
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
</script> </script>
<template> <template>
<agent-show-page v-bind="$props"> <agent-show-page>
<template v-if="showSecurityTab" #ee-security-tab> <template v-if="showSecurityTab" #ee-security-tab>
<gl-tab :title="$options.i18n.securityTabTitle"> <gl-tab :title="$options.i18n.securityTabTitle">
<agent-vulnerability-report /> <agent-vulnerability-report />
......
{"__schema":{"types":[{"kind":"UNION","name":"VulnerabilityLocation","possibleTypes":[{"name":"VulnerabilityLocationContainerScanning"},{"name":"VulnerabilityLocationDast"},{"name":"VulnerabilityLocationDependencyScanning"},{"name":"VulnerabilityLocationSast"},{"name":"VulnerabilityLocationSecretDetection"}]}]}}
...@@ -2,14 +2,14 @@ import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; ...@@ -2,14 +2,14 @@ import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import introspectionQueryResultData from './fragmentTypes.json'; import { vulnerabilityLocationTypes } from '~/graphql_shared/fragment_types/vulnerability_location_types';
Vue.use(VueApollo); Vue.use(VueApollo);
// We create a fragment matcher so that we can create a fragment from an interface // We create a fragment matcher so that we can create a fragment from an interface
// Without this, Apollo throws a heuristic fragment matcher warning // Without this, Apollo throws a heuristic fragment matcher warning
const fragmentMatcher = new IntrospectionFragmentMatcher({ const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData, introspectionQueryResultData: vulnerabilityLocationTypes,
}); });
const defaultClient = createDefaultClient( const defaultClient = createDefaultClient(
......
...@@ -19,7 +19,7 @@ describe('ClusterAgentShow', () => { ...@@ -19,7 +19,7 @@ describe('ClusterAgentShow', () => {
let wrapper; let wrapper;
useFakeDate([2021, 2, 15]); useFakeDate([2021, 2, 15]);
const propsData = { const provide = {
agentName: 'cluster-agent', agentName: 'cluster-agent',
projectPath: 'path/to/project', projectPath: 'path/to/project',
}; };
...@@ -49,7 +49,7 @@ describe('ClusterAgentShow', () => { ...@@ -49,7 +49,7 @@ describe('ClusterAgentShow', () => {
shallowMount(ClusterAgentShow, { shallowMount(ClusterAgentShow, {
localVue, localVue,
apolloProvider, apolloProvider,
propsData, provide,
stubs: { GlSprintf, TimeAgoTooltip, GlTab }, stubs: { GlSprintf, TimeAgoTooltip, GlTab },
}), }),
); );
...@@ -60,7 +60,7 @@ describe('ClusterAgentShow', () => { ...@@ -60,7 +60,7 @@ describe('ClusterAgentShow', () => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
shallowMount(ClusterAgentShow, { shallowMount(ClusterAgentShow, {
propsData, provide,
mocks: { $apollo, clusterAgent }, mocks: { $apollo, clusterAgent },
slots, slots,
stubs: { GlTab }, stubs: { GlTab },
...@@ -85,7 +85,7 @@ describe('ClusterAgentShow', () => { ...@@ -85,7 +85,7 @@ describe('ClusterAgentShow', () => {
}); });
it('displays the agent name', () => { it('displays the agent name', () => {
expect(wrapper.text()).toContain(propsData.agentName); expect(wrapper.text()).toContain(provide.agentName);
}); });
it('displays agent create information', () => { it('displays agent create information', () => {
......
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