diff --git a/src/App.js b/src/App.js
index 19cfc525c..fbad4d1dc 100644
--- a/src/App.js
+++ b/src/App.js
@@ -24,7 +24,8 @@ ReducerRegistry.register({ notifications });
const App = () => {
const { push } = useHistory();
const { pathname } = useLocation();
- const [[isUserAuthorized], isLoading] = useRbac([PERMISSIONS.accessApplication]);
+ const [[hasAnyVulnerabilityPermission, hasInventoryReadPermission], isLoading] =
+ useRbac([PERMISSIONS.accessApplication, PERMISSIONS.readHosts], '');
const [isReadOnlyBannerVisible, setReadOnlyBannerVisible] = useState(false);
const dispatch = useDispatch();
@@ -70,7 +71,7 @@ const App = () => {
window.setReadOnlyBannerVisible = setVisible => setReadOnlyBannerVisible(setVisible);
return (
- isLoading ? : isUserAuthorized ?
+ isLoading ? : (hasAnyVulnerabilityPermission && hasInventoryReadPermission) ?
{isReadOnlyBannerVisible && }
diff --git a/src/Components/SmartComponents/SystemsExposedTable/SystemsExposedTable.js b/src/Components/SmartComponents/SystemsExposedTable/SystemsExposedTable.js
index dc806f85f..d36373584 100644
--- a/src/Components/SmartComponents/SystemsExposedTable/SystemsExposedTable.js
+++ b/src/Components/SmartComponents/SystemsExposedTable/SystemsExposedTable.js
@@ -19,7 +19,7 @@ import {
selectRows,
changeColumnsCveDetail
} from '../../../Store/Actions/Actions';
-import { SYSTEMS_EXPOSED_HEADER, SYSTEMS_EXPOSED_ALLOWED_PARAMS, PERMISSIONS } from '../../../Helpers/constants';
+import { SYSTEMS_EXPOSED_HEADER, SYSTEMS_EXPOSED_ALLOWED_PARAMS } from '../../../Helpers/constants';
import { TableVariant } from '@patternfly/react-table';
import { InventoryTable } from '@redhat-cloud-services/frontend-components/Inventory';
import ErrorHandler from '../../PresentationalComponents/ErrorHandler/ErrorHandler';
@@ -29,21 +29,14 @@ import {
} from '@redhat-cloud-services/frontend-components-notifications/redux';
import { EmptyStateNoSystems } from '../../PresentationalComponents/EmptyStates/EmptyStates';
import { SystemsExposedTableToolbar } from './SystemsExposedTableToolbar';
-import { useGetEntities, useRbac } from '../../../Helpers/Hooks';
+import { useGetEntities } from '../../../Helpers/Hooks';
import * as APIHelper from '../../../Helpers/APIHelper';
import ColumnManagementModal from '../Modals/ColumnManagementModal';
-import Spinner from '@redhat-cloud-services/frontend-components/Spinner';
const SystemsExposedTable = ({
intl, cveName, cveStatusDetails, filterRuleValues,
hasSecurityRule, canEditPairStatus, canExport, inventoryRef, refreshInventory
}) => {
- const [[
- canReadHostsInventory],
- isLoadingInventory] = useRbac([
- PERMISSIONS.readHosts
- ], 'inventory');
-
const dispatch = useDispatch();
const [isAllExpanded, setIsAllExpanded] = useState(false);
const [StatusModal, setStatusModal] = useState(() => () => null);
@@ -140,89 +133,88 @@ const SystemsExposedTable = ({
- {isLoadingInventory ? :
- error?.hasError && !canReadHostsInventory
- ?
- : {
- ReducerRegistry.register({
- ...mergeWithEntities(
- inventoryEntitiesReducer(SYSTEMS_EXPOSED_HEADER),
- {
- page: Number(parameters.page || 1),
- perPage: 20,
- ...(parameters.sort && {
- sortBy: {
- key: parameters.sort.replace(/^-/, ''),
- direction: parameters.sort.match(/^-/) ? 'desc' : 'asc'
- }
- })
- }
- )
- });
- }}
- tableProps={{
- isStickyHeader: true,
- canSelectAll: false,
- actionResolver: () => canEditPairStatus && totalItems &&
- systemExposedTableRowActions(showStatusModal, cveStatusDetails),
- variant: TableVariant.compact
- }}
- paginationProps={{
- isDisabled: !totalItems
- }}
- showTagModal
- isFullView
- ref={inventoryRef}
- autoRefresh
- key="inventory"
- customFilters={{
- vulnerabilityParams: {
- ...parameters
- }
+ {error?.hasError
+ ?
+ : {
+ ReducerRegistry.register({
+ ...mergeWithEntities(
+ inventoryEntitiesReducer(SYSTEMS_EXPOSED_HEADER),
+ {
+ page: Number(parameters.page || 1),
+ perPage: 20,
+ ...(parameters.sort && {
+ sortBy: {
+ key: parameters.sort.replace(/^-/, ''),
+ direction: parameters.sort.match(/^-/) ? 'desc' : 'asc'
+ }
+ })
+ }
+ )
+ });
+ }}
+ tableProps={{
+ isStickyHeader: true,
+ canSelectAll: false,
+ actionResolver: () => canEditPairStatus && totalItems &&
+ systemExposedTableRowActions(showStatusModal, cveStatusDetails),
+ variant: TableVariant.compact
+ }}
+ paginationProps={{
+ isDisabled: !totalItems
+ }}
+ showTagModal
+ isFullView
+ ref={inventoryRef}
+ autoRefresh
+ key="inventory"
+ customFilters={{
+ vulnerabilityParams: {
+ ...parameters
+ }
+ }}
+ expandable={hasSecurityRule}
+ columnsCounter={columnCounter}
+ columns={defaultColumns => mergeColumns(defaultColumns)}
+ getEntities={getEntities}
+ hasCheckbox={totalItems !== 0}
+ showActions={totalItems !== 0}
+ onExpandClick={(_e, _i, isOpen, { id }) => dispatch(expandRow(id, isOpen))}
+ hideFilters={{ all: true }}
+ noSystemsTable={}
+ >
+ mergeColumns(defaultColumns)}
- getEntities={getEntities}
- hasCheckbox={totalItems !== 0}
- showActions={totalItems !== 0}
- onExpandClick={(_e, _i, isOpen, { id }) => dispatch(expandRow(id, isOpen))}
- hideFilters={{ all: true }}
- noSystemsTable={}
+ canEditPairStatus={canEditPairStatus}
+ canExport={canExport}
>
-
- {StatusModal && }
- dispatch(changeColumnsCveDetail(newColumns))}
- isModalOpen={isColumnModalOpen}
- setModalOpen={setColumnModalOpen}
- />
-
- }
+ {StatusModal && }
+ dispatch(changeColumnsCveDetail(newColumns))}
+ isModalOpen={isColumnModalOpen}
+ setModalOpen={setColumnModalOpen}
+ />
+
+ }
);
diff --git a/src/Components/SmartComponents/SystemsPage/SystemsPage.js b/src/Components/SmartComponents/SystemsPage/SystemsPage.js
index 38a320fbf..3ac5d8f3b 100644
--- a/src/Components/SmartComponents/SystemsPage/SystemsPage.js
+++ b/src/Components/SmartComponents/SystemsPage/SystemsPage.js
@@ -40,12 +40,6 @@ const SystemsPage = () => {
PERMISSIONS.readExcluded
]);
- const [[
- canReadHostsInventory],
- isLoadingInventory] = useRbac([
- PERMISSIONS.readHosts
- ], 'inventory');
-
const inventoryRef = React.createRef();
const dispatch = useDispatch();
const intl = useIntl();
@@ -113,73 +107,72 @@ const SystemsPage = () => {
/>
- {isLoadingInventory ? :
- hasError && !canReadHostsInventory
- ?
- : (
- {
- ReducerRegistry.register({
- ...mergeWithEntities(
- inventoryEntitiesReducer(columns),
- {
- page: Number(parameters.page || 1),
- perPage: Number(parameters.page_size || 20),
- ...(parameters.sort && {
- sortBy: {
- key: parameters.sort.replace(/^-/, ''),
- direction: parameters.sort.match(/^-/) ? 'desc' : 'asc'
- }
- })
- }
- )
- });
- }}
- tableProps={{
- isStickyHeader: true,
- canSelectAll: false,
- actionResolver: totalItems > 0 && canSetExcludedIncluded
- && ((rowData) => systemTableRowActions(rowData, doOptOut)),
- variant: TableVariant.compact
- }}
- paginationProps={{
- isDisabled: !totalItems
- }}
- showTagModal
- isFullView
- ref={inventoryRef}
- autoRefresh
- customFilters={{
- vulnerabilityParams: {
- ...parameters
- }
+ {hasError
+ ?
+ : (
+ {
+ ReducerRegistry.register({
+ ...mergeWithEntities(
+ inventoryEntitiesReducer(columns),
+ {
+ page: Number(parameters.page || 1),
+ perPage: Number(parameters.page_size || 20),
+ ...(parameters.sort && {
+ sortBy: {
+ key: parameters.sort.replace(/^-/, ''),
+ direction: parameters.sort.match(/^-/) ? 'desc' : 'asc'
+ }
+ })
+ }
+ )
+ });
+ }}
+ tableProps={{
+ isStickyHeader: true,
+ canSelectAll: false,
+ actionResolver: totalItems > 0 && canSetExcludedIncluded
+ && ((rowData) => systemTableRowActions(rowData, doOptOut)),
+ variant: TableVariant.compact
+ }}
+ paginationProps={{
+ isDisabled: !totalItems
+ }}
+ showTagModal
+ isFullView
+ ref={inventoryRef}
+ autoRefresh
+ customFilters={{
+ vulnerabilityParams: {
+ ...parameters
+ }
+ }}
+ columnsCounter={columnCounter}
+ columns={defaultColumns => mergeColumns(defaultColumns)}
+ getEntities={getEntities}
+ hideFilters={{ all: true }}
+ noSystemsTable={}
+ >
+ mergeColumns(defaultColumns)}
- getEntities={getEntities}
- hideFilters={{ all: true }}
- noSystemsTable={}
- >
-
-
- )}
+ actions
+ />
+
+ )}
:
);