diff --git a/src/Components/SmartComponents/CVEs/CVEs.cy.js b/src/Components/SmartComponents/CVEs/CVEs.cy.js index 4a86f5b22..08817ac25 100644 --- a/src/Components/SmartComponents/CVEs/CVEs.cy.js +++ b/src/Components/SmartComponents/CVEs/CVEs.cy.js @@ -3,7 +3,7 @@ import { mount } from '@cypress/react'; import { BrowserRouter as Router } from 'react-router-dom'; import { Provider } from 'react-redux'; -import CVEs from './CVEs'; +import { CVEs } from './CVEs'; import ReducerRegistry from '../../../Utilities/ReducerRegistry'; import cvesResponse from '../../../../cypress/fixtures/cves.json'; @@ -23,7 +23,7 @@ const mountComponent = () => { - + diff --git a/src/Components/SmartComponents/CVEs/CVEs.js b/src/Components/SmartComponents/CVEs/CVEs.js index 2e76c62b3..afe060c53 100644 --- a/src/Components/SmartComponents/CVEs/CVEs.js +++ b/src/Components/SmartComponents/CVEs/CVEs.js @@ -1,6 +1,7 @@ import React, { useMemo, useState, useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { Stack, StackItem } from '@patternfly/react-core'; +import PropTypes from 'prop-types'; import { CVES_ALLOWED_PARAMS, PERMISSIONS, SERVICE_NAME } from '../../../Helpers/constants'; import { createCveListByAccount } from '../../../Helpers/VulnerabilityHelper'; import { constructFilterParameters, updateRef, useUrlParams } from '../../../Helpers/MiscHelper'; @@ -28,18 +29,13 @@ import { NotAuthorized } from '../../PresentationalComponents/EmptyStates/EmptyS export const CVETableContext = React.createContext({}); -export const CVEs = () => { +export const CVEs = ({ rbac }) => { const dispatch = useDispatch(); const [CveStatusModal, setStatusModal] = useState(() => () => null); const [CveBusinessRiskModal, setBusinessRiskModal] = useState(() => () => null); const [isFirstLoad, setFirstLoad] = useState(true); - const [[canEditStatusOrBusinessRisk, canEditPairStatus, canExport, canReadVulnerabilityResults], isRbacLoading] = useRbac([ - PERMISSIONS.setCveStatusAndBusinessRisk, - PERMISSIONS.setPairStatus, - PERMISSIONS.basicReporting, - PERMISSIONS.readVulnerabilityResults - ]); + const [[canEditStatusOrBusinessRisk, canEditPairStatus, canExport, canReadVulnerabilityResults], isRbacLoading] = rbac; const cveList = useSelector( ({ CVEsStore }) => CVEsStore.cveList @@ -181,7 +177,21 @@ export const CVEs = () => { } else { return ; } +}; + +CVEs.propTypes = { + rbac: PropTypes.array.isRequired +}; + +const CVEsWithRbac = () => { + const rbac = useRbac([ + PERMISSIONS.setCveStatusAndBusinessRisk, + PERMISSIONS.setPairStatus, + PERMISSIONS.basicReporting, + PERMISSIONS.readVulnerabilityResults + ]); + return ; }; -export default CVEs; +export default CVEsWithRbac; diff --git a/src/Components/SmartComponents/CVEs/__snapshots__/CVEs.test.js.snap b/src/Components/SmartComponents/CVEs/__snapshots__/CVEs.test.js.snap index 10813c818..c9b389118 100644 --- a/src/Components/SmartComponents/CVEs/__snapshots__/CVEs.test.js.snap +++ b/src/Components/SmartComponents/CVEs/__snapshots__/CVEs.test.js.snap @@ -36,403 +36,256 @@ exports[`CVEs Should render without props 1`] = ` } } > - - - - + - + + - Save - , - , + { + "cellFormatters": [ + [Function], + ], + "columnTransforms": [ + [Function], + ], + "isShownByDefault": true, + "isUnhidable": true, + "key": "synopsis", + "title": "CVE ID", + "transforms": [ + [Function], + ], + }, + { + "columnTransforms": [ + [Function], + ], + "isShownByDefault": true, + "key": "public_date", + "title": "Publish date", + "transforms": [ + [Function], + [Function], + ], + }, + { + "columnTransforms": [ + [Function], + ], + "isShownByDefault": true, + "key": "impact", + "title": "Severity", + "transforms": [ + [Function], + ], + }, + { + "isShownByDefault": true, + "key": "cvss_score", + "title": "CVSS base score", + "transforms": [ + [Function], + [Function], + ], + }, + { + "isShownByDefault": true, + "key": "systems_affected", + "title": "Systems", + "transforms": [ + [Function], + [Function], + ], + }, + { + "isShownByDefault": true, + "key": "business_risk", + "title": "Business risk", + "transforms": [ + [Function], + [Function], + ], + }, + { + "isShownByDefault": true, + "key": "status", + "title": "Status", + "transforms": [ + [Function], + [Function], + ], + }, ] } - appendTo={[Function]} - aria-describedby="" - aria-label="" - aria-labelledby="" - className="" - description={ - - - Selected categories will be displayed in the table. - - - - - - - - - - - } - hasNoBodyWrapper={false} - isOpen={false} - onClose={[Function]} - ouiaSafe={true} - showClose={true} - title="Manage columns" - titleIconVariant={null} - titleLabel="" - variant="small" + applyColumns={[Function]} + isModalOpen={false} + key="column-mgmt-modal" + setModalOpen={[Function]} > - } + + Save + , + , + ] + } + appendTo={[Function]} + aria-describedby="" + aria-label="" + aria-labelledby="" + className="" + description={ + + + Selected categories will be displayed in the table. + + + + + + + + + + + } + hasNoBodyWrapper={false} + isOpen={false} + onClose={[Function]} + ouiaSafe={true} + showClose={true} + title="Manage columns" + titleIconVariant={null} + titleLabel="" + variant="small" > - - Save - , - , - ] - } - aria-describedby="" - aria-label="" - aria-labelledby="" - boxId="pf-modal-part-0" - className="" - description={ - - - Selected categories will be displayed in the table. - - - - - - - - - - - } - descriptorId="pf-modal-part-2" - hasNoBodyWrapper={false} - isOpen={false} - labelId="pf-modal-part-1" - onClose={[Function]} - ouiaId="OUIA-Generated-Modal-small-1" - ouiaSafe={true} - showClose={true} - title="Manage columns" - titleIconVariant={null} - titleLabel="" - variant="small" - /> - - - - -
- -
} > - + Save + , + , + ] + } + aria-describedby="" + aria-label="" + aria-labelledby="" + boxId="pf-modal-part-0" + className="" + description={ + + + Selected categories will be displayed in the table. + + + + + + + + + + + } + descriptorId="pf-modal-part-2" + hasNoBodyWrapper={false} + isOpen={false} + labelId="pf-modal-part-1" + onClose={[Function]} + ouiaId="OUIA-Generated-Modal-small-1" + ouiaSafe={true} + showClose={true} + title="Manage columns" + titleIconVariant={null} + titleLabel="" + variant="small" + /> + + + + +
+ +
- - - - CVE-2020-0543 - - - , - }, - { - "title": - 09 June 2020 - , - }, - { - "title": - - , - }, - { - "title": - 6.5 - , - }, - { - "title": - - 1 - - - , - }, - { - "title": - Not defined - , - }, - { - "title": - - - On-hold - , - }, - ], - "exposed_systems_count": 1, - "id": "CVE-2019-6454", - "isOpen": false, - "rules": undefined, - "selected": false, - "status_id": 2, - "status_justification": "testhello", - }, - { - "cells": [ - { - "title": , - }, - ], - "fullWidth": true, - "parent": 0, - }, - ], - "errors": undefined, - "isLoading": false, - "meta": { - "cvesCount": 1, - "test": "test", - }, - }, - "expandedRows": [], - "isAllExpanded": false, - "methods": { - "apply": [Function], - "downloadReport": [Function], - "openCves": [Function], - "selectCves": [Function], - "setColumnManagementModalOpen": [Function], - "showBusinessRiskModal": [Function], - "showStatusModal": [Function], - }, - "params": { - "affecting": "true", - "sort": "-public_date", - }, - "selectedCves": [], - } - } - downloadReport={[Function]} intl={ { "$t": [Function], @@ -477,588 +330,689 @@ exports[`CVEs Should render without props 1`] = ` "wrapRichTextChunksInFragment": undefined, } } - totalNumber={0} > - - - , - ], - "isDisabled": false, - "onSelect": [Function], - "ouiaId": "export", - } - } - filterConfig={ + - - Critical - , - "value": "7", - }, + "cves": { + "data": [ + { + "business_risk_id": 0, + "business_risk_justification": null, + "cells": [ { - "label": - + + CVE-2020-0543 + + - Important - , - "value": "5", + , }, { - "label": - - Moderate - , - "value": "4", + "title": + 09 June 2020 + , }, { - "label": - + - Low - , - "value": "2", - }, - { - "label": - Unknown - , - "value": "1", - }, - ], - "onChange": [Function], - "value": [], - }, - "key": "impact", - "label": "severity", - "type": "checkbox", - "urlParam": "impact", - }, - { - "filterValues": { - "children": , - }, - "key": "cvss_score", - "label": "CVSS base score", - "type": "custom", - "urlParam": "cvss_filter", - }, - { - "filterValues": { - "items": [ - { - "label": "Critical", - "value": "4", + , }, { - "label": "High", - "value": "3", + "title": + 6.5 + , }, { - "label": "Medium", - "value": "2", + "title": + + 1 + + + , }, { - "label": "Low", - "value": "1", + "title": + Not defined + , }, { - "label": "Not defined", - "value": "0", + "title": + + + On-hold + , }, ], - "onChange": [Function], - "value": [], + "exposed_systems_count": 1, + "id": "CVE-2019-6454", + "isOpen": false, + "rules": undefined, + "selected": false, + "status_id": 2, + "status_justification": "testhello", }, - "key": "business_risk", - "label": "business risk", - "type": "checkbox", - "urlParam": "business_risk_id", - }, - { - "filterValues": { - "items": [ - { - "label": "1 or more", - "value": "true", - }, + { + "cells": [ { - "label": "None", - "value": "false", + "title": , }, ], - "onChange": [Function], - "value": [ - "true", - ], + "fullWidth": true, + "parent": 0, }, - "label": "systems", - "type": "checkbox", - "urlParam": "affecting", + ], + "errors": undefined, + "isLoading": false, + "meta": { + "cvesCount": 1, + "test": "test", }, - { - "filterValues": { - "items": [ - { - "label": "All", - "value": "all", - }, - { - "label": "Last 7 days", - "value": "last7", - }, - { - "label": "Last 30 days", - "value": "last30", - }, - { - "label": "Last 90 days", - "value": "last90", - }, - { - "label": "Last year", - "value": "lastYear", - }, - { - "label": "More than 1 year ago", - "value": "MoreThanYear", - }, - ], - "onChange": [Function], - "value": "0", + }, + "expandedRows": [], + "isAllExpanded": false, + "methods": { + "apply": [Function], + "downloadReport": [Function], + "openCves": [Function], + "selectCves": [Function], + "setColumnManagementModalOpen": [Function], + "showBusinessRiskModal": [Function], + "showStatusModal": [Function], + }, + "params": { + "affecting": "true", + "sort": "-public_date", + }, + "selectedCves": [], + } + } + downloadReport={[Function]} + intl={ + { + "$t": [Function], + "defaultFormats": {}, + "defaultLocale": "en", + "defaultRichTextElements": undefined, + "fallbackOnEmptyString": true, + "formatDate": [Function], + "formatDateTimeRange": [Function], + "formatDateToParts": [Function], + "formatDisplayName": [Function], + "formatList": [Function], + "formatListToParts": [Function], + "formatMessage": [Function], + "formatNumber": [Function], + "formatNumberToParts": [Function], + "formatPlural": [Function], + "formatRelativeTime": [Function], + "formatTime": [Function], + "formatTimeToParts": [Function], + "formats": {}, + "formatters": { + "getDateTimeFormat": [Function], + "getDisplayNames": [Function], + "getListFormat": [Function], + "getMessageFormat": [Function], + "getNumberFormat": [Function], + "getPluralRules": [Function], + "getRelativeTimeFormat": [Function], + }, + "locale": "en", + "messages": { + "default.cancel": "Cancel", + "default.delete": "Delete", + "default.remove": "Remove", + "default.save": "Save", + }, + "onError": [Function], + "onWarn": [Function], + "textComponent": Symbol(react.fragment), + "timeZone": undefined, + "wrapRichTextChunksInFragment": undefined, + } + } + totalNumber={0} + > + + + , + ], + "isDisabled": false, + "onSelect": [Function], + "ouiaId": "export", + } + } + filterConfig={ + { + "items": [ + { + "filterValues": { + "aria-label": "search-field", + "id": "search-cve", + "onChange": [Function], + "placeholder": "Search ID or description", + "value": undefined, + }, + "key": "filter", + "label": "CVE", + "type": "text", + }, + { + "filterValues": { + "items": [ + { + "label": "Has security rule", + "value": "true", + }, + { + "label": "Does not have security rule", + "value": "false", + }, + ], + "onChange": [Function], + "value": [], + }, + "key": "security_rule", + "label": "security rules", + "type": "checkbox", + }, + { + "filterValues": { + "items": [ + { + "label": "Has a known exploit", + "value": "true", + }, + { + "label": "No known exploit", + "value": "false", + }, + ], + "onChange": [Function], + "value": undefined, + }, + "key": "known_exploit", + "label": "known exploit", + "type": "checkbox", + }, + { + "filterValues": { + "items": [ + { + "label": + + Critical + , + "value": "7", + }, + { + "label": + + Important + , + "value": "5", + }, + { + "label": + + Moderate + , + "value": "4", + }, + { + "label": + + Low + , + "value": "2", + }, + { + "label": + Unknown + , + "value": "1", + }, + ], + "onChange": [Function], + "value": [], + }, + "key": "impact", + "label": "severity", + "type": "checkbox", + "urlParam": "impact", + }, + { + "filterValues": { + "children": , + }, + "key": "cvss_score", + "label": "CVSS base score", + "type": "custom", + "urlParam": "cvss_filter", + }, + { + "filterValues": { + "items": [ + { + "label": "Critical", + "value": "4", + }, + { + "label": "High", + "value": "3", + }, + { + "label": "Medium", + "value": "2", + }, + { + "label": "Low", + "value": "1", + }, + { + "label": "Not defined", + "value": "0", + }, + ], + "onChange": [Function], + "value": [], + }, + "key": "business_risk", + "label": "business risk", + "type": "checkbox", + "urlParam": "business_risk_id", + }, + { + "filterValues": { + "items": [ + { + "label": "1 or more", + "value": "true", + }, + { + "label": "None", + "value": "false", + }, + ], + "onChange": [Function], + "value": [ + "true", + ], + }, + "label": "systems", + "type": "checkbox", + "urlParam": "affecting", + }, + { + "filterValues": { + "items": [ + { + "label": "All", + "value": "all", + }, + { + "label": "Last 7 days", + "value": "last7", + }, + { + "label": "Last 30 days", + "value": "last30", + }, + { + "label": "Last 90 days", + "value": "last90", + }, + { + "label": "Last year", + "value": "lastYear", + }, + { + "label": "More than 1 year ago", + "value": "MoreThanYear", + }, + ], + "onChange": [Function], + "value": "0", + }, + "key": "publish_date", + "label": "publish date", + "type": "radio", + "urlParam": "publish_date", + }, + { + "filterValues": { + "items": [ + { + "label": "Not reviewed", + "value": "0", + }, + { + "label": "In review", + "value": "1", + }, + { + "label": "On-hold", + "value": "2", + }, + { + "label": "Scheduled for patch", + "value": "3", + }, + { + "label": "Resolved", + "value": "4", + }, + { + "label": "No action - risk accepted", + "value": "5", + }, + { + "label": "Resolved via mitigation", + "value": "6", + }, + ], + "onChange": [Function], + "value": [], + }, + "key": "status", + "label": "status", + "type": "checkbox", + }, + ], + } + } + pagination={ + { + "isDisabled": false, + "itemCount": 0, + "onPerPageSelect": [Function], + "onSetPage": [Function], + "ouiaId": "pagination-top", + "page": 1, + "perPage": 1, + } } - } - > - -
- -
- - -
- -
- - - -
-
- -
- + + + + + + + + +
+
+ +
- - Select none (0 items) - , - - Select page (1 item) - , - - Select all (0 items) - , + { + "onClick": [Function], + "title": "Select none (0 items)", + }, + { + "onClick": [Function], + "title": "Select page (1 item)", + }, + { + "onClick": [Function], + "title": "Select all (0 items)", + }, ] } - isOpen={false} onSelect={[Function]} ouiaId="bulk-select" - ouiaSafe={true} - toggle={ - - - - - , - ] - } - /> - } > - , ] } - isFlipEnabled={true} - isGrouped={false} isOpen={false} - isPlain={false} - isText={false} - menuAppendTo="inline" onSelect={[Function]} - position="left" - removeFindDomNode={false} + ouiaId="bulk-select" + ouiaSafe={true} toggle={ } - zIndex={9999} > -
+ Select none (0 items) + , + + Select page (1 item) + , + + Select all (0 items) + , + ] + } + isFlipEnabled={true} + isGrouped={false} + isOpen={false} + isPlain={false} + isText={false} + menuAppendTo="inline" + onSelect={[Function]} + position="left" + removeFindDomNode={false} + toggle={ + + + + + , + ] + } + /> + } + zIndex={9999} > - -
+ - + +
+
, + } + } + splitButtonItems={ + [ + + - - +
+
, + } + } + toggleVariant="default" + > + -
-
, - } - } - splitButtonItems={ - [ - - - - - , - ] - } - > -
- - - - -
- - -
-
, - } - } - toggleVariant="default" - > - - -
- -
- - - -
- - -
+ + + +
+ +
+ + + +
+ + - + - - Critical - , - "value": "7", - }, - { - "label": - - Important - , - "value": "5", - }, - { - "label": - - Moderate - , - "value": "4", - }, - { - "label": - - Low - , - "value": "2", - }, - { - "label": - Unknown - , - "value": "1", - }, - ], - "onChange": [Function], - "value": [], + { + "filterValues": { + "items": [ + { + "label": "Has a known exploit", + "value": "true", + }, + { + "label": "No known exploit", + "value": "false", + }, + ], + "onChange": [Function], + "value": undefined, + }, + "key": "known_exploit", + "label": "known exploit", + "type": "checkbox", }, - "key": "impact", - "label": "severity", - "type": "checkbox", - "urlParam": "impact", - }, - { - "filterValues": { - "children": + + Critical + , + "value": "7", + }, + { + "label": + + Important + , + "value": "5", + }, + { + "label": + + Moderate + , + "value": "4", + }, + { + "label": + + Low + , + "value": "2", + }, { - "placeholderText": "Filter by CVSS score range", + "label": + Unknown + , + "value": "1", + }, + ], + "onChange": [Function], + "value": [], + }, + "key": "impact", + "label": "severity", + "type": "checkbox", + "urlParam": "impact", + }, + { + "filterValues": { + "children": , + filterId="cvss_filter" + selectProps={ + { + "placeholderText": "Filter by CVSS score range", + } + } + setFilterData={[Function]} + />, + }, + "key": "cvss_score", + "label": "CVSS base score", + "type": "custom", + "urlParam": "cvss_filter", }, - "key": "cvss_score", - "label": "CVSS base score", - "type": "custom", - "urlParam": "cvss_filter", - }, - { - "filterValues": { - "items": [ - { - "label": "Critical", - "value": "4", - }, - { - "label": "High", - "value": "3", - }, - { - "label": "Medium", - "value": "2", - }, - { - "label": "Low", - "value": "1", - }, - { - "label": "Not defined", - "value": "0", - }, - ], - "onChange": [Function], - "value": [], + { + "filterValues": { + "items": [ + { + "label": "Critical", + "value": "4", + }, + { + "label": "High", + "value": "3", + }, + { + "label": "Medium", + "value": "2", + }, + { + "label": "Low", + "value": "1", + }, + { + "label": "Not defined", + "value": "0", + }, + ], + "onChange": [Function], + "value": [], + }, + "key": "business_risk", + "label": "business risk", + "type": "checkbox", + "urlParam": "business_risk_id", }, - "key": "business_risk", - "label": "business risk", - "type": "checkbox", - "urlParam": "business_risk_id", - }, - { - "filterValues": { - "items": [ - { - "label": "1 or more", - "value": "true", - }, - { - "label": "None", - "value": "false", - }, - ], - "onChange": [Function], - "value": [ - "true", - ], + { + "filterValues": { + "items": [ + { + "label": "1 or more", + "value": "true", + }, + { + "label": "None", + "value": "false", + }, + ], + "onChange": [Function], + "value": [ + "true", + ], + }, + "label": "systems", + "type": "checkbox", + "urlParam": "affecting", }, - "label": "systems", - "type": "checkbox", - "urlParam": "affecting", - }, - { - "filterValues": { - "items": [ - { - "label": "All", - "value": "all", - }, - { - "label": "Last 7 days", - "value": "last7", - }, - { - "label": "Last 30 days", - "value": "last30", - }, - { - "label": "Last 90 days", - "value": "last90", - }, - { - "label": "Last year", - "value": "lastYear", - }, - { - "label": "More than 1 year ago", - "value": "MoreThanYear", - }, - ], - "onChange": [Function], - "value": "0", + { + "filterValues": { + "items": [ + { + "label": "All", + "value": "all", + }, + { + "label": "Last 7 days", + "value": "last7", + }, + { + "label": "Last 30 days", + "value": "last30", + }, + { + "label": "Last 90 days", + "value": "last90", + }, + { + "label": "Last year", + "value": "lastYear", + }, + { + "label": "More than 1 year ago", + "value": "MoreThanYear", + }, + ], + "onChange": [Function], + "value": "0", + }, + "key": "publish_date", + "label": "publish date", + "type": "radio", + "urlParam": "publish_date", }, - "key": "publish_date", - "label": "publish date", - "type": "radio", - "urlParam": "publish_date", - }, - { - "filterValues": { - "items": [ - { - "label": "Not reviewed", - "value": "0", - }, - { - "label": "In review", - "value": "1", - }, - { - "label": "On-hold", - "value": "2", - }, - { - "label": "Scheduled for patch", - "value": "3", - }, - { - "label": "Resolved", - "value": "4", - }, - { - "label": "No action - risk accepted", - "value": "5", - }, - { - "label": "Resolved via mitigation", - "value": "6", - }, - ], - "onChange": [Function], - "value": [], + { + "filterValues": { + "items": [ + { + "label": "Not reviewed", + "value": "0", + }, + { + "label": "In review", + "value": "1", + }, + { + "label": "On-hold", + "value": "2", + }, + { + "label": "Scheduled for patch", + "value": "3", + }, + { + "label": "Resolved", + "value": "4", + }, + { + "label": "No action - risk accepted", + "value": "5", + }, + { + "label": "Resolved via mitigation", + "value": "6", + }, + ], + "onChange": [Function], + "value": [], + }, + "key": "status", + "label": "status", + "type": "checkbox", }, - "key": "status", - "label": "status", - "type": "checkbox", - }, - ] - } - > - -
- -
- - CVE - , - - Security rules - , - - Known exploit - , - - Severity - , - - CVSS base score - , - - Business risk - , - - Systems - , - - Publish date - , - - Status - , - ] - } - isOpen={false} - onSelect={[Function]} - ouiaId="ConditionalFilter" - toggle={ - - - - CVE - - - } +
+ +
- , ] } - isFlipEnabled={true} - isGrouped={false} isOpen={false} - isPlain={false} - isText={false} - menuAppendTo="inline" onSelect={[Function]} - position="left" - removeFindDomNode={false} + ouiaId="ConditionalFilter" toggle={ } - zIndex={9999} > -
+ CVE + , + + Security rules + , + + Known exploit + , + + Severity + , + + CVSS base score + , + + Business risk + , + + Systems + , + + Publish date + , + + Status + , + ] + } + isFlipEnabled={true} + isGrouped={false} + isOpen={false} + isPlain={false} + isText={false} + menuAppendTo="inline" + onSelect={[Function]} + position="left" + removeFindDomNode={false} + toggle={ + + + + CVE + + + } + zIndex={9999} > - - -
, - } - } +
- , } } - toggleVariant="default" > - +
, + } + } + toggleVariant="default" > - - - - - - - CVE - - - - - + + + + + - - - - - - - -
- - -
- - -
+ + + + + + + + + + + +
+ +
+
+
+ - - - - - - - - + + + + - - - - -
- - -
-
- -
- - - - + + + + + + + + + + + + + + + - - , - ], - "isDisabled": false, - "onSelect": [Function], - "ouiaId": "export", + exportConfig={ + { + "extraItems": [ +
  • + +
  • , + ], + "isDisabled": false, + "onSelect": [Function], + "ouiaId": "export", + } } - } - overflowActions={[]} - > - -
    - - - , - ] - } - isDisabled={false} - onSelect={[Function]} - ouiaId="export" +
    - - Export to CSV - , - - Export to JSON - ,
  • -
  • , - } - } - toggleIndicator={null} + + + , + ] + } + isFlipEnabled={true} + isGrouped={false} + isOpen={false} + isPlain={true} + isText={false} + menuAppendTo="inline" + onSelect={[Function]} + position="left" + removeFindDomNode={false} + toggle={ + + + + } + zIndex={9999} + > +
    - , } } - toggleVariant="default" + toggleIndicator={null} > - +
    , + } + } + toggleVariant="default" > - - - - - - - - - - -
    - - - - -
    - -
    + + + + + + + +
    + + + + +
    + - - Edit business risk - , - - Edit status - , - - Manage columns - , - ] - } - isOpen={false} - isPlain={true} - onSelect={[Function]} - ouiaId="Actions" - toggle={ - - } +
    - , ] } - isFlipEnabled={true} - isGrouped={false} isOpen={false} isPlain={true} - isText={false} - menuAppendTo="inline" onSelect={[Function]} - position="left" - removeFindDomNode={false} + ouiaId="Actions" toggle={ } - zIndex={9999} > -
    + Edit business risk + , + + Edit status + , + + Manage columns + , + ] + } + isFlipEnabled={true} + isGrouped={false} + isOpen={false} + isPlain={true} + isText={false} + menuAppendTo="inline" + onSelect={[Function]} + position="left" + removeFindDomNode={false} + toggle={ + + } + zIndex={9999} > - - -
    , - } - } +
    - - - - -
    -
    - -
    -
    -
    - -
    + +
    , + } + } + > + + + + + + + +
    +
    + - + -
    - + + + 0 + - + 0 + + + of + + + 0 + + + +
    + - - 0 - - - 0 - - - of - - - 0 - - - -
    - - - 10 - per page - , - - 20 - per page - , - - 50 - per page - , - - 100 - per page - , + { + "title": "10", + "value": 10, + }, + { + "title": "20", + "value": 20, + }, + { + "title": "50", + "value": 50, + }, + { + "title": "100", + "value": 100, + }, ] } - isFlipEnabled={true} - isGrouped={false} - isOpen={false} - isPlain={true} - isText={false} - menuAppendTo="inline" - onSelect={[Function]} - position="left" - toggle={ - - } + perPageSuffix="per page" + toggleTemplate={[Function]} + widgetId="options-menu-top" > -
    + 10 + per page + , + + 20 + per page + , + + 50 + per page + , + + 100 + per page + , + ] + } + isFlipEnabled={true} + isGrouped={false} + isOpen={false} + isPlain={true} + isText={false} + menuAppendTo="inline" + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    + - - - 0 - - - 0 - - - of - - - 0 - - - - - -
    -
    , - } - } - perPageComponent="div" - showToggle={true} - toggleTemplate={[Function]} - widgetId="options-menu-top" - > -
    - - - - 0 - - - 0 - - - of - - - 0 - - - - - - -
    , - } + + + + + + , } + } + perPageComponent="div" + showToggle={true} + toggleTemplate={[Function]} + widgetId="options-menu-top" + > +
    - + + + 0 + - + 0 + + + of + + + 0 + + + + + , } } - toggleVariant="default" > - +
    + , + } + } + toggleVariant="default" > - - - - - - - - - - - -
    - -
    -
    - - - - -
    - -
    - - + + + + + + + + + + + + + + + -
    -
    , + clearFiltersButtonText="Clear all filters" + expandableContentRef={ + { + "current":
    +
    +
    , + } } - } - id="ins-primary-data-toolbar-expandable-content-6" - isExpanded={false} - showClearFiltersButton={false} - > -
    - - -
    - - -
    - -
    - - -
    + + +
    + + +
    + +
    +
    +
    - -
    - + +
    - - - -
    - - Systems - -
      -
    • - +
        +
      • - -
        - - 1 or more - - - - -
        -
        - -
      • -
      + + + + + +
    + + + + +
    -
    - - - - -
    - -
    - + + + + + + + -
    -
    , + clearFiltersButtonText="Clear all filters" + expandableContentRef={ + { + "current":
    +
    +
    , + } } - } - id="ins-primary-data-toolbar-expandable-content-7" - isExpanded={false} - showClearFiltersButton={false} - > -
    - - -
    - - -
    - -
    - -
    + +
    -
    + + + + + + + + + + + + + + + + + + + +
    + diff --git a/src/Components/SmartComponents/LandingPage/__snapshots__/LandingPage.test.js.snap b/src/Components/SmartComponents/LandingPage/__snapshots__/LandingPage.test.js.snap index 8c5bea9d7..3bf0e1de7 100644 --- a/src/Components/SmartComponents/LandingPage/__snapshots__/LandingPage.test.js.snap +++ b/src/Components/SmartComponents/LandingPage/__snapshots__/LandingPage.test.js.snap @@ -66,7 +66,7 @@ exports[`CVEs: Should match the snapshot 1`] = ` /> - + `; diff --git a/src/Helpers/Hooks.js b/src/Helpers/Hooks.js index 1ca6b74b1..ba0c68f16 100644 --- a/src/Helpers/Hooks.js +++ b/src/Helpers/Hooks.js @@ -11,6 +11,7 @@ import { NotAuthorizedNotification, ReadOnlyNotification } from './constants'; import { useState } from 'react'; import unionBy from 'lodash/unionBy'; import ColumnManagementModal from '../Components/SmartComponents/Modals/ColumnManagementModal'; +import useChrome from '@redhat-cloud-services/frontend-components/useChrome'; export const useNotification = (config = {}) => { const dispatch = useDispatch(); @@ -212,9 +213,10 @@ const matchPermissions = (permissionA, permissionB) => { export const useRbac = (requestedPermissions, app = 'vulnerability') => { const [allPermissions, setAllPermissions] = useState([]); const [loading, setLoading] = useState(true); + const chrome = useChrome(); useEffect(() => { - insights?.chrome?.getUserPermissions?.(app, true).then(permissions => { + chrome?.getUserPermissions?.(app, true).then(permissions => { setAllPermissions(permissions); setLoading(false); });