Commit 4a8274ef authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '229651-hide-gitlab-name' into 'master'

Hide vendor name when GitLab is the only one

See merge request gitlab-org/gitlab!40370
parents cadf5ceb 4e544633
...@@ -85,6 +85,9 @@ export default { ...@@ -85,6 +85,9 @@ export default {
}; };
}, },
computed: { computed: {
hasAnyScannersOtherThanGitLab() {
return this.vulnerabilities.some(v => v.scanner?.vendor !== 'GitLab');
},
notEnabledSecurityScanners() { notEnabledSecurityScanners() {
const { available = [], enabled = [] } = this.securityScanners; const { available = [], enabled = [] } = this.securityScanners;
return difference(available, enabled); return difference(available, enabled);
...@@ -360,7 +363,11 @@ export default { ...@@ -360,7 +363,11 @@ export default {
<div data-testid="vulnerability-report-type" class="text-capitalize"> <div data-testid="vulnerability-report-type" class="text-capitalize">
{{ useConvertReportType(item.reportType) }} {{ useConvertReportType(item.reportType) }}
</div> </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 }} {{ item.scanner.vendor }}
</div> </div>
</template> </template>
......
...@@ -48,6 +48,7 @@ describe('Vulnerability list component', () => { ...@@ -48,6 +48,7 @@ describe('Vulnerability list component', () => {
const findCellText = label => findDataCell(label).text(); const findCellText = label => findDataCell(label).text();
const findFiltersProducedNoResults = () => wrapper.find(FiltersProducedNoResults); const findFiltersProducedNoResults = () => wrapper.find(FiltersProducedNoResults);
const findDashboardHasNoVulnerabilities = () => wrapper.find(DashboardHasNoVulnerabilities); const findDashboardHasNoVulnerabilities = () => wrapper.find(DashboardHasNoVulnerabilities);
const findVendorNames = () => wrapper.find(`[data-testid="vulnerability-vendor"]`);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -284,6 +285,48 @@ describe('Vulnerability list component', () => { ...@@ -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', () => { describe('when a vulnerability is resolved on the default branch', () => {
let newVulnerabilities; 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