diff --git a/locales/en.json b/locales/en.json index e9d1913a9..033cc0fe2 100644 --- a/locales/en.json +++ b/locales/en.json @@ -211,6 +211,7 @@ "numberOfCves.cve": "Number of CVEs", "onHold": "On-hold", "options.all": "All", + "options.any": "Any", "osFilterLabel": "Operating system", "osFilterLabel.reports": "Applies to OS", "osFilterPlaceholder": "Filter by OS", diff --git a/src/Components/PresentationalComponents/Filters/CustomFilters/CheckboxCustomFilter.js b/src/Components/PresentationalComponents/Filters/CustomFilters/CheckboxCustomFilter.js index 350202ef5..75707aaf5 100644 --- a/src/Components/PresentationalComponents/Filters/CustomFilters/CheckboxCustomFilter.js +++ b/src/Components/PresentationalComponents/Filters/CustomFilters/CheckboxCustomFilter.js @@ -4,7 +4,7 @@ import { Select, SelectOption } from '@patternfly/react-core'; import { intl } from '../../../../Utilities/IntlProvider'; import messages from '../../../../Messages'; -const CheckboxCustomFilter = ({ filterData, setFilterData, selectProps, options, filterName, filterId }) => { +const CheckboxCustomFilter = ({ filterData, setFilterData, selectProps, options, filterName, filterId, allSelectedText }) => { const [isOpen, setOpen] = useState(false); const handleOnCheckboxChange = (filterId, optionName) => { @@ -25,7 +25,7 @@ const CheckboxCustomFilter = ({ filterData, setFilterData, selectProps, options, const itemsString = filterData[filterId].map(id => options.find(item => item.value === id).label).join(', '); return `${filterName}: ${filterData[filterId].length === 0 || filterData[filterId].length === options.length - ? intl.formatMessage(messages.optionsAll) : itemsString}`; + ? allSelectedText ?? intl.formatMessage(messages.optionsAll) : itemsString}`; }; return ( @@ -59,7 +59,8 @@ CheckboxCustomFilter.propTypes = { filterData: propTypes.object, setFilterData: propTypes.func, selectProps: propTypes.object, - options: propTypes.array + options: propTypes.array, + allSelectedText: propTypes.string }; export default CheckboxCustomFilter; diff --git a/src/Components/SmartComponents/Modals/ReportConfigModal.js b/src/Components/SmartComponents/Modals/ReportConfigModal.js index adc088551..0481bc32f 100644 --- a/src/Components/SmartComponents/Modals/ReportConfigModal.js +++ b/src/Components/SmartComponents/Modals/ReportConfigModal.js @@ -37,7 +37,7 @@ const ReportConfigModal = ({ reportTitle, setReportTitle }) => { - const [toggleSwitch, setToggleSwitch] = useState('all'); + const [includeAllColumns, setIncludeAllColumns] = useState(true); const activeFilters = [ 'rule_presence', @@ -61,17 +61,17 @@ const ReportConfigModal = ({ }; useEffect(() => { - if (toggleSwitch === 'all') { + if (includeAllColumns) { setColumnsToInclude(Object.keys(CVE_REPORT_FILTERS)); } - }, [toggleSwitch, setColumnsToInclude]); + }, [includeAllColumns, setColumnsToInclude]); return ( { return ( CVE_REPORT_FILTERS[filterId]?.component({ + ...CVE_REPORT_FILTERS[filterId], filterData, setFilterData, selectProps: { className: 'pf-u-mr-sm pf-u-mb-sm', @@ -132,15 +133,15 @@ const ReportConfigModal = ({ setToggleSwitch('all')} /> + isSelected={includeAllColumns} + onChange={() => setIncludeAllColumns(true)} /> setToggleSwitch('custom')} /> + isSelected={!includeAllColumns} + onChange={() => setIncludeAllColumns(false)} /> - {toggleSwitch === 'custom' && + {includeAllColumns ||
- Applies to OS: All + Applies to OS: Any
- Applies to OS: All + Applies to OS: Any - Applies to OS: All + Applies to OS: Any