diff --git a/src/Components/PresentationalComponents/CSAwRuleBox/CSAwRuleBox.js b/src/Components/PresentationalComponents/CSAwRuleBox/CSAwRuleBox.js index a03fc4dff..5a5407017 100644 --- a/src/Components/PresentationalComponents/CSAwRuleBox/CSAwRuleBox.js +++ b/src/Components/PresentationalComponents/CSAwRuleBox/CSAwRuleBox.js @@ -39,7 +39,7 @@ import CSAwRuleSummary from './CSAwRuleSummary'; import './CSAwRuleBox.scss'; import { HashLink } from 'react-router-hash-link'; -const CSAwRuleBox = ({ rules, synopsis, intl, setHeaderFilters, headerFilters }) => { +const CSAwRuleBox = ({ rules = [], synopsis, intl, setHeaderFilters, headerFilters }) => { const sortedRules = [].concat(rules).sort((a, b) => (b.systems_affected - a.systems_affected)); const handleExposedSystemFilter = (ruleId) => { setHeaderFilters(headerFilters?.rule !== ruleId @@ -252,10 +252,6 @@ const CSAwRuleBox = ({ rules, synopsis, intl, setHeaderFilters, headerFilters }) }; /*eslint-enable max-len*/ -CSAwRuleBox.defaultProps = { - rules: [] -}; - CSAwRuleBox.propTypes = { intl: PropTypes.any, rules: PropTypes.array, diff --git a/src/Components/PresentationalComponents/CSAwRuleBox/CSAwRuleSummary.js b/src/Components/PresentationalComponents/CSAwRuleBox/CSAwRuleSummary.js index 7e9d05670..265d63138 100644 --- a/src/Components/PresentationalComponents/CSAwRuleBox/CSAwRuleSummary.js +++ b/src/Components/PresentationalComponents/CSAwRuleBox/CSAwRuleSummary.js @@ -19,7 +19,7 @@ renderer.link = function() { marked.setOptions({ renderer }); -const CSAwRuleSummary = ({ text, truncate, intl, ...props }) => { +const CSAwRuleSummary = ({ text, truncate = true, intl, ...props }) => { const dangerousHtml = (text) => ({ __html: sanitizeHtml(text) }); return (text && @@ -41,12 +41,6 @@ const CSAwRuleSummary = ({ text, truncate, intl, ...props }) => { ); - -}; - -CSAwRuleSummary.defaultProps = { - truncate: true, - link: null }; CSAwRuleSummary.propTypes = { diff --git a/src/Components/PresentationalComponents/Header/Header.js b/src/Components/PresentationalComponents/Header/Header.js index 866b80302..d2663a789 100644 --- a/src/Components/PresentationalComponents/Header/Header.js +++ b/src/Components/PresentationalComponents/Header/Header.js @@ -7,7 +7,15 @@ import { intl } from '../../../Utilities/IntlProvider'; import { Split, SplitItem } from '@patternfly/react-core'; import BaseDropdown from '../BaseDropdown/BaseDropdown'; -const Header = ({ title, actions, breadcrumbs, showBreadcrumb, children, actionsOuiaId, labels }) => { +const Header = ({ + title = intl.formatMessage(messages.cvesHeader), + actions = [], + breadcrumbs, + showBreadcrumb = true, + children, + actionsOuiaId, + labels +}) => { return ( @@ -38,12 +46,6 @@ const Header = ({ title, actions, breadcrumbs, showBreadcrumb, children, actions ); }; -Header.defaultProps = { - showBreadcrumb: true, - actions: [], - title: intl.formatMessage(messages.cvesHeader) -}; - Header.propTypes = { breadcrumbs: propTypes.array, actions: propTypes.array, diff --git a/src/Components/PresentationalComponents/Kebab/KebabItems.js b/src/Components/PresentationalComponents/Kebab/KebabItems.js index 1fcaf3e48..5d207b2d5 100644 --- a/src/Components/PresentationalComponents/Kebab/KebabItems.js +++ b/src/Components/PresentationalComponents/Kebab/KebabItems.js @@ -10,7 +10,7 @@ export const kebabItemDownloadPDF = (loading, downloadReport, props = {}) => ( className="pf-v5-c-dropdown__menu-item" onClick={() => downloadReport(true)} {...props} > - {loading ? : } + {loading ? : } ); diff --git a/src/Components/PresentationalComponents/PaginationWrapper/PaginationWrapper.js b/src/Components/PresentationalComponents/PaginationWrapper/PaginationWrapper.js index 58c283bac..90d837b2e 100644 --- a/src/Components/PresentationalComponents/PaginationWrapper/PaginationWrapper.js +++ b/src/Components/PresentationalComponents/PaginationWrapper/PaginationWrapper.js @@ -5,7 +5,7 @@ import propTypes from 'prop-types'; import React from 'react'; import { DEFAULT_PAGE_SIZE } from '../../../Helpers/constants'; -const PaginationWrapper = ({ apply, meta, variant }) => { +const PaginationWrapper = ({ apply, meta, variant = PaginationVariant.bottom }) => { const { page, total_items: totalItems, page_size: pageSize } = meta; const handleChangePage = (_event, pageNumber) => apply({ page: pageNumber }); @@ -27,10 +27,6 @@ const PaginationWrapper = ({ apply, meta, variant }) => { ); }; -PaginationWrapper.defaultProps = { - variant: 'bottom' -}; - PaginationWrapper.propTypes = { apply: propTypes.func.isRequired, meta: propTypes.object.isRequired, diff --git a/src/Components/PresentationalComponents/ReportDetails/ReportDetails.js b/src/Components/PresentationalComponents/ReportDetails/ReportDetails.js index e4b863dd3..9cbdcb339 100644 --- a/src/Components/PresentationalComponents/ReportDetails/ReportDetails.js +++ b/src/Components/PresentationalComponents/ReportDetails/ReportDetails.js @@ -10,7 +10,7 @@ import { marked } from 'marked'; import propTypes from 'prop-types'; import sanitizeHtml from 'sanitize-html'; -const ReportDetails = ({ report, kbaDetail, kbaLoading }) => { +const ReportDetails = ({ report = {}, kbaDetail = {}, kbaLoading }) => { const rule = report.rule || report; const templateProcessor = (template, definitions) => { const DOT_SETTINGS = { ...doT.templateSettings, varname: ['pydata'], strip: false }; @@ -121,11 +121,6 @@ const ReportDetails = ({ report, kbaDetail, kbaLoading }) => { export default ReportDetails; -ReportDetails.defaultProps = { - report: {}, - kbaDetail: {} -}; - ReportDetails.propTypes = { report: propTypes.object, kbaDetail: propTypes.object, diff --git a/src/Components/SmartComponents/CVEs/CVEsTableToolbar.js b/src/Components/SmartComponents/CVEs/CVEsTableToolbar.js index 707ac6fd4..b9dcfc689 100644 --- a/src/Components/SmartComponents/CVEs/CVEsTableToolbar.js +++ b/src/Components/SmartComponents/CVEs/CVEsTableToolbar.js @@ -204,12 +204,6 @@ CVEsTableToolbarWithContext.propTypes = { canToggleCvesWithoutErrata: propTypes.bool }; -CVEsTableToolbarWithContext.defaultProps = { - totalNumber: 0, - apply: () => undefined, - downloadReport: () => undefined -}; - const CVEsTableToolbar = props => ( {context => } diff --git a/src/Components/SmartComponents/HybridInventory/ImmutableDevicesTab/ImmutableDevices.js b/src/Components/SmartComponents/HybridInventory/ImmutableDevicesTab/ImmutableDevices.js index 18258b331..8fd9e4ebc 100644 --- a/src/Components/SmartComponents/HybridInventory/ImmutableDevicesTab/ImmutableDevices.js +++ b/src/Components/SmartComponents/HybridInventory/ImmutableDevicesTab/ImmutableDevices.js @@ -27,7 +27,7 @@ import messages from '../../../../Messages'; import PageLoading from '../../../PresentationalComponents/Snippets/PageLoading'; import useFeatureFlag from '../../../../Utilities/useFeatureFlag'; -const ImmutableDevices = ({ intl, cveName, filterRuleValues, inventoryRef, headerFilters }) => { +const ImmutableDevices = ({ intl, cveName, filterRuleValues, inventoryRef, headerFilters = {} }) => { const [[canReadHostsInventory], isLoadingInventory] = useRbac([ PERMISSIONS.readHosts ], 'inventory'); @@ -137,9 +137,6 @@ const ImmutableDevices = ({ intl, cveName, filterRuleValues, inventoryRef, heade />; }; -ImmutableDevices.defaultProps = { - headerFilters: {} -}; ImmutableDevices.propTypes = { cveName: propTypes.string, intl: propTypes.object, diff --git a/src/Components/SmartComponents/Reports/Common/firstPagePDF.js b/src/Components/SmartComponents/Reports/Common/firstPagePDF.js index f6c999e1b..6ebc2af2b 100644 --- a/src/Components/SmartComponents/Reports/Common/firstPagePDF.js +++ b/src/Components/SmartComponents/Reports/Common/firstPagePDF.js @@ -206,10 +206,6 @@ const firstPagePDF = ({ data, meta, filters, intl, isReportDynamic, reportData, ); }; -firstPagePDF.defaultProps = { - user: undefined -}; - firstPagePDF.propTypes = { intl: PropTypes.any, filters: PropTypes.array, diff --git a/src/Components/SmartComponents/Reports/DownloadCVEsReport.js b/src/Components/SmartComponents/Reports/DownloadCVEsReport.js index 21ba0d723..b78ea9ab3 100644 --- a/src/Components/SmartComponents/Reports/DownloadCVEsReport.js +++ b/src/Components/SmartComponents/Reports/DownloadCVEsReport.js @@ -27,8 +27,8 @@ const DownloadCVEsReport = ({ reportData = {}, buttonProps, isReportDynamic = false, - label, - shouldUseHybridSystemFilter, + label = messages.kebabExportToPDF, + shouldUseHybridSystemFilter = false, ...props }) => { const intl = useIntl(); @@ -186,11 +186,6 @@ const DownloadCVEsReport = ({ ); }; -DownloadCVEsReport.defaultProps = { - label: messages.kebabexportToPDF, - shouldUseHybridSystemFilter: false -}; - DownloadCVEsReport.propTypes = { filters: propTypes.oneOfType([ propTypes.array, diff --git a/src/Components/SmartComponents/Reports/DownloadSystemsReport.js b/src/Components/SmartComponents/Reports/DownloadSystemsReport.js index 463d6601d..8bb7351f8 100644 --- a/src/Components/SmartComponents/Reports/DownloadSystemsReport.js +++ b/src/Components/SmartComponents/Reports/DownloadSystemsReport.js @@ -18,7 +18,7 @@ const DownloadSystemsReport = ({ params, reportData = {}, buttonProps, - label, + label = messages.kebabExportToPDF, ...props }) => { const intl = useIntl(); @@ -109,10 +109,6 @@ const DownloadSystemsReport = ({ ); }; -DownloadSystemsReport.defaultProps = { - label: messages.kebabexportToPDF -}; - DownloadSystemsReport.propTypes = { filters: propTypes.oneOfType([ propTypes.array, diff --git a/src/Components/SmartComponents/SystemCves/SystemCveTableToolbar.js b/src/Components/SmartComponents/SystemCves/SystemCveTableToolbar.js index a16e56eb3..49d6ad9c2 100644 --- a/src/Components/SmartComponents/SystemCves/SystemCveTableToolbar.js +++ b/src/Components/SmartComponents/SystemCves/SystemCveTableToolbar.js @@ -141,12 +141,6 @@ const SystemCveToolbarWithContext = ({ ); }; -SystemCveToolbarWithContext.defaultProps = { - totalNumber: 0, - apply: () => undefined, - downloadReport: () => undefined -}; - SystemCveToolbarWithContext.propTypes = { entity: propTypes.string, context: propTypes.object, @@ -162,4 +156,5 @@ SystemCveToolbarWithContext.propTypes = { const SystemCveToolbar = props => ( {context => } ); + export default injectIntl(SystemCveToolbar); diff --git a/src/Components/SmartComponents/SystemCves/SystemCves.js b/src/Components/SmartComponents/SystemCves/SystemCves.js index 43f0a7a1f..e218260dc 100644 --- a/src/Components/SmartComponents/SystemCves/SystemCves.js +++ b/src/Components/SmartComponents/SystemCves/SystemCves.js @@ -53,16 +53,16 @@ export const CVETableContext = createContext({}); export const SystemCVEs = ({ entity, intl, - showHeaderLabel, - setPageTitle, + showHeaderLabel = false, + setPageTitle = false, canExport, customAction, - canSelect, - canEditPairStatus, - canManageColumns, + canSelect = true, + canEditPairStatus = true, + canManageColumns = true, defaultColumns, filters, - linkToCustomerPortal + linkToCustomerPortal = false }) => { const dispatch = useDispatch(); const [StatusModal, setStatusModal] = useState(() => () => null); @@ -267,16 +267,6 @@ export const SystemCVEs = ({ } }; -SystemCVEs.defaultProps = { - allowedCveActions: [], - showHeaderLabel: false, - setPageTitle: false, - canSelect: true, - canManageColumns: true, - canEditPairStatus: true, - linkToCustomerPortal: false -}; - SystemCVEs.propTypes = { entity: propTypes.object, intl: propTypes.any, @@ -294,14 +284,14 @@ SystemCVEs.propTypes = { export const ConnectedSystemCves = injectIntl(SystemCVEs); -const TranslateSystemCves = ({ customItnlProvider, customIntlProvider, ...props }) => { +const TranslateSystemCves = ({ customItnlProvider = false, customIntlProvider = false, customRouter = false, ...props }) => { const Wrapper = (customItnlProvider || customIntlProvider) ? IntlProvider : Fragment; return - + ; }; @@ -311,10 +301,4 @@ TranslateSystemCves.propTypes = { customRouter: propTypes.bool }; -TranslateSystemCves.defaultProps = { - customItnlProvider: false, - customIntlProvider: false, - customRouter: false -}; - export default TranslateSystemCves; diff --git a/src/Messages.js b/src/Messages.js index ab6de096a..940ee4b59 100644 --- a/src/Messages.js +++ b/src/Messages.js @@ -1412,7 +1412,7 @@ export default defineMessages({ description: 'Title label for systems PDF report', defaultMessage: 'Insights Vulnerability Systems report' }, - kebabexportToPDF: { + kebabExportToPDF: { id: 'kebab.exportToPDF', description: 'Kebab item', defaultMessage: 'Export to PDF'