Commit 4e544633 authored by Savas Vedova's avatar Savas Vedova Committed by Kushal Pandya

Hide vendor name when GitLab is the only one

parent 91df75d9
......@@ -85,6 +85,9 @@ export default {
};
},
computed: {
hasAnyScannersOtherThanGitLab() {
return this.vulnerabilities.some(v => v.scanner?.vendor !== 'GitLab');
},
notEnabledSecurityScanners() {
const { available = [], enabled = [] } = this.securityScanners;
return difference(available, enabled);
......@@ -360,7 +363,11 @@ export default {
<div data-testid="vulnerability-report-type" class="text-capitalize">
{{ useConvertReportType(item.reportType) }}
</div>
<div data-testid="vulnerability-vendor" class="gl-text-gray-300">
<div
v-if="hasAnyScannersOtherThanGitLab"
data-testid="vulnerability-vendor"
class="gl-text-gray-300"
>
{{ item.scanner.vendor }}
</div>
</template>
......
......@@ -48,6 +48,7 @@ describe('Vulnerability list component', () => {
const findCellText = label => findDataCell(label).text();
const findFiltersProducedNoResults = () => wrapper.find(FiltersProducedNoResults);
const findDashboardHasNoVulnerabilities = () => wrapper.find(DashboardHasNoVulnerabilities);
const findVendorNames = () => wrapper.find(`[data-testid="vulnerability-vendor"]`);
afterEach(() => {
wrapper.destroy();
......@@ -284,6 +285,48 @@ describe('Vulnerability list component', () => {
});
});
describe('when GitLab is the only scanner in the reports', () => {
let newVulnerabilities;
beforeEach(() => {
newVulnerabilities = generateVulnerabilities();
newVulnerabilities = newVulnerabilities.map(v => ({
...v,
scanner: { vendor: 'GitLab' },
}));
wrapper = createWrapper({
props: {
vulnerabilities: newVulnerabilities,
shouldShowReportType: true,
},
});
});
it('should not render the vendor name', () => {
expect(findVendorNames().exists()).toBe(false);
});
});
describe('when there are other scanners in the report', () => {
let newVulnerabilities;
beforeEach(() => {
newVulnerabilities = generateVulnerabilities();
newVulnerabilities[0].scanner = { vendor: 'GitLab' };
newVulnerabilities[1].scanner = { vendor: 'Third Party Scanner' };
wrapper = createWrapper({
props: {
vulnerabilities: newVulnerabilities,
shouldShowReportType: true,
},
});
});
it('should not render the vendor name', () => {
expect(findVendorNames().exists()).toBe(true);
});
});
describe('when a vulnerability is resolved on the default branch', () => {
let newVulnerabilities;
......
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