Commit a9ca0760 authored by Fernando Arias's avatar Fernando Arias

Add container scanning to security group dashboard

Add container scanning to dropdown

* Add container scanning constant
* Add container scanning translation

Add changelog

* Add changelog entry for container scanning

Enable container scanning results in backend

* Enable feature via feature flag

Sort filter names and fix text overflow

* Sort security group dashboard filters in alphabetical order
* Fix x + more overflow styling problems

Refactor filter dropdown truncation logic

* In the vuln filter component dropdown re-work to use slots

Restore filter dropdown chevron

* restore filter dropdown chevron in slot

Remove uneeded tranlation

* Remove use of sprintf and __()
* Regenerate pot files

Remove need for sortBy, re-order manually

* Reorder object properties in REPORT_TYPES
* Tweak dropdown markup to allow for better alignment

Make code review adjustments

* Simplify usage of ternary operator in filter getter
* Conditionally show span if we have content
parent 3b1daa55
......@@ -55,7 +55,18 @@ export default {
v-if="filterId === 'report_type'"
:dashboard-documentation="dashboardDocumentation"
/>
<gl-dropdown :text="selectedOptionText" class="d-block mt-1">
<gl-dropdown class="d-block mt-1">
<template slot="button-content">
<span class="text-truncate">
{{ selectedOptionText.firstOption }}
</span>
<span v-if="selectedOptionText.extraOptionCount" class="flex-grow-1 ml-1">
{{ selectedOptionText.extraOptionCount }}
</span>
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</template>
<gl-dropdown-item
v-for="option in filter.options"
:key="option.id"
......
......@@ -22,6 +22,7 @@ export const CONFIDENCE_LEVELS = {
};
export const REPORT_TYPES = {
sast: s__('ciReport|SAST'),
container_scanning: s__('ciReport|Container Scanning'),
dependency_scanning: s__('ciReport|Dependency Scanning'),
sast: s__('ciReport|SAST'),
};
......@@ -9,15 +9,15 @@ export const getSelectedOptions = (state, getters) => filterId => {
export const getSelectedOptionNames = (state, getters) => filterId => {
const selectedOptions = getters.getSelectedOptions(filterId);
const [firstOption] = selectedOptions.map(option => option.name);
const extraOptionCount = selectedOptions.length - 1;
const firstOption = selectedOptions.map(option => option.name)[0];
return extraOptionCount
? sprintf(__('%{firstOption} +%{extraOptionCount} more'), {
return {
firstOption,
extraOptionCount,
})
: firstOption;
extraOptionCount: extraOptionCount
? sprintf(__('+%{extraOptionCount} more'), { extraOptionCount })
: '',
};
};
/**
......
......@@ -62,7 +62,7 @@ module EE
::Feature.disabled?(:parse_dependency_scanning_reports, default_enabled: true)
next if file_type == "container_scanning" &&
::Feature.disabled?(:parse_container_scanning_reports, default_enabled: false)
::Feature.disabled?(:parse_container_scanning_reports, default_enabled: true)
next if file_type == "dast" &&
::Feature.disabled?(:parse_dast_reports, default_enabled: false)
......
---
title: Add container scanning results to group security dashboard
merge_request: 9736
author:
type: added
......@@ -62,7 +62,7 @@ describe('filters module getters', () => {
'severity',
);
expect(selectedOptionNames).toEqual('All');
expect(selectedOptionNames).toEqual({ firstOption: 'All', extraOptionCount: '' });
});
it('should return the correct message when multiple filters are selected', () => {
......@@ -79,7 +79,7 @@ describe('filters module getters', () => {
'severity',
);
expect(selectedOptionNames).toEqual('Critical +1 more');
expect(selectedOptionNames).toEqual({ firstOption: 'Critical', extraOptionCount: '+1 more' });
});
});
......
......@@ -168,9 +168,6 @@ msgstr ""
msgid "%{firstLabel} +%{labelCount} more"
msgstr ""
msgid "%{firstOption} +%{extraOptionCount} more"
msgstr ""
msgid "%{group_docs_link_start}Groups%{group_docs_link_end} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects."
msgstr ""
......@@ -251,6 +248,9 @@ msgstr ""
msgid "+ %{moreCount} more"
msgstr ""
msgid "+%{extraOptionCount} more"
msgstr ""
msgid ", or "
msgstr ""
......@@ -11464,6 +11464,9 @@ msgstr ""
msgid "ciReport|Confidence"
msgstr ""
msgid "ciReport|Container Scanning"
msgstr ""
msgid "ciReport|Container scanning"
msgstr ""
......
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