Skip to content

Commit

Permalink
Revert "chore: Correct prop types (#1720)" (#1727)
Browse files Browse the repository at this point in the history
This reverts commit 0eb04ef.
  • Loading branch information
leSamo authored Jul 20, 2022
1 parent 0eb04ef commit e5421e7
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const AdvisoryColumn = ({ cve, advisoriesList, linkToCustomerPortal }) => {
return (
advisoriesList?.length > 0
? (
advisoriesList.map((advisory, index) =>
advisoriesList.map((advisory, _i) =>
<a
key={`a_${index}`}
key={_i}
href={linkToCustomerPortal
? `${CUSTOMER_PORTAL_ADVISORY_PATH}/${advisory}`
: `${PATCHMAN_ADVISORY_PATH}/${advisory}`
Expand All @@ -26,7 +26,7 @@ const AdvisoryColumn = ({ cve, advisoriesList, linkToCustomerPortal }) => {
>
{advisory}
</a>
).reduce((prev, curr, index) => [prev, ', ', <br key={`br_${index}`}/>, curr])
).reduce((prev, curr, index) => [prev, ', ', <br key={index}/>, curr])
) : (
<Fragment>
<FormattedMessage {...messages.notAvailable} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const TagFilter = ({ selectedTags, setSelectedTags, onEdit, globalTags }) => {

const [isLoading, setLoading] = useState(true);
const [tags, setTags] = useState([]);
const [totalItemsCount, setTotalItemsCount] = useState(0);
const [totalItemsCount, setTotalItemsCount] = useState([]);
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(10);
const [tagSearch, setTagSearch] = useState('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const SelectCustomSorter = ({ sorterData, setSorterData, selectProps, options })
};

SelectCustomSorter.propTypes = {
sorterData: propTypes.string,
sorterData: propTypes.object,
setSorterData: propTypes.func,
selectProps: propTypes.object,
options: propTypes.array
Expand Down
2 changes: 1 addition & 1 deletion src/Components/SmartComponents/Modals/ReportConfigModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const ReportConfigModal = ({
ReportConfigModal.propTypes = {
isOpen: propTypes.bool,
filterData: propTypes.object,
sorterData: propTypes.oneOf(CUSTOM_REPORT_SORT_OPTIONS.map(option => option.value)),
sorterData: propTypes.object,
setFilterData: propTypes.func,
setSorterData: propTypes.func,
handleModalClose: propTypes.func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2825,7 +2825,7 @@ exports[`Report config modal component Should match snapshots 1`] = `
onUpdateData={[Function]}
pagination={
Object {
"count": 0,
"count": Array [],
"page": 1,
"perPage": 10,
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/SmartComponents/Remediation/Remediation.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Remediation = ({ cves, systems, manyRules, isDisabled }) => {
Remediation.propTypes = {
cves: propTypes.oneOfType([
propTypes.array,
propTypes.object
propTypes.string
]),
systems: propTypes.oneOfType([
propTypes.array,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ SystemsExposedTableToolbar.propTypes = {
parameters: propTypes.object,
cveName: propTypes.string,
cveStatusDetails: propTypes.object,
filterRuleValues: propTypes.array,
filterRuleValues: propTypes.object,
expandAll: propTypes.func,
hasSecurityRule: propTypes.bool,
isAllExpanded: propTypes.bool,
Expand Down
4 changes: 2 additions & 2 deletions src/Helpers/Hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const useNotification = (config) => {

useEffect(() => {
return () => {
if (!config?.preventClear) {
if (!config.preventClear) {
dispatch(clearNotificationsFEC());
}
};
Expand Down Expand Up @@ -220,7 +220,7 @@ export const useRbac = (requestedPermissions, app = 'vulnerability') => {
}, []);

if (loading) {
return [requestedPermissions.map(() => true), true];
return [requestedPermissions.map(() => []), true];
}

return [requestedPermissions.map(requestedPermission =>
Expand Down
3 changes: 1 addition & 2 deletions src/Utilities/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ const InsightsRoute = ({ component: Component, title, ...rest }) => {
};

InsightsRoute.propTypes = {
component: Route.propTypes.component,
component: PropTypes.func,
title: PropTypes.string
};

export const Routes = () => {
let location = useLocation();
let path = location.pathname;

return (
// TODO: Discuss with UX some nice loading placeholder
<Suspense fallback={Fragment}>
Expand Down

0 comments on commit e5421e7

Please sign in to comment.