From cb8a00981ce0a896032af8cdba1b089adbd54ab4 Mon Sep 17 00:00:00 2001 From: mkholjur Date: Mon, 13 Mar 2023 13:44:12 +0100 Subject: [PATCH] fix(ESSNTL-3760): handle insights disconnected hosts for patch, advisor, vuln tabs --- .../InventoryDetail/ApplicationDetails.js | 20 +++++++++++++------ .../InventoryDetail/InventoryDetail.js | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/InventoryDetail/ApplicationDetails.js b/src/components/InventoryDetail/ApplicationDetails.js index ba2d5b319..44be8716e 100644 --- a/src/components/InventoryDetail/ApplicationDetails.js +++ b/src/components/InventoryDetail/ApplicationDetails.js @@ -2,12 +2,15 @@ import React, { useState, useEffect, Suspense } from 'react'; import PropTypes from 'prop-types'; import { useSelector, useStore } from 'react-redux'; import { Tabs, Tab, Spinner, TabContent } from '@patternfly/react-core'; +import { verifyCulledInsightsClient } from '../../Utilities/sharedFunctions'; +import { getFact } from './helpers'; +import { NotConnected } from '@redhat-cloud-services/frontend-components/NotConnected'; /** * Component that renders tabs for each application detail and handles clicking on each item. * @param {*} props onTabSelect can be used to notify parent component that detail has been selected. */ -const ApplicationDetails = ({ onTabSelect, appList, activeApp, inventoryId, ...props }) => { +const ApplicationDetails = ({ onTabSelect, appList, activeApp, inventoryId, entity, ...props }) => { const store = useStore(); const items = useSelector(({ entityDetails }) => { return (entityDetails?.activeApps || appList || []) @@ -31,6 +34,8 @@ const ApplicationDetails = ({ onTabSelect, appList, activeApp, inventoryId, ...p } }, [disabledApps]); + const isDisconnected = verifyCulledInsightsClient(getFact('per_reporter_staleness', entity)); + return (
@@ -71,10 +76,12 @@ const ApplicationDetails = ({ onTabSelect, appList, activeApp, inventoryId, ...p > {item.name === currentApp &&
- + {isDisconnected && ['patch', 'vulnerabilities', 'advisor'] + .includes(currentApp) ? + : }
} @@ -93,7 +100,8 @@ ApplicationDetails.propTypes = { })), onTabSelect: PropTypes.func, activeApp: PropTypes.string.isRequired, - inventoryId: PropTypes.string.isRequired + inventoryId: PropTypes.string.isRequired, + entity: PropTypes.object }; export default ApplicationDetails; diff --git a/src/components/InventoryDetail/InventoryDetail.js b/src/components/InventoryDetail/InventoryDetail.js index 9bf39b778..fdb676f84 100644 --- a/src/components/InventoryDetail/InventoryDetail.js +++ b/src/components/InventoryDetail/InventoryDetail.js @@ -67,6 +67,7 @@ const InventoryDetail = ({ activeApp={activeApp} appList={appList} inventoryId={inventoryId} + entity={entity} /> )} )