Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ESSNTL-3760): handle insights disconnected hosts for patch, advis… #1791

Merged
merged 2 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/components/InventoryDetail/ApplicationDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || [])
Expand All @@ -31,6 +34,8 @@ const ApplicationDetails = ({ onTabSelect, appList, activeApp, inventoryId, ...p
}
}, [disabledApps]);

const isDisconnected = verifyCulledInsightsClient(getFact('per_reporter_staleness', entity));

return (
<React.Fragment>
<section className='pf-u-pr-lg pf-u-pl-lg pf-u-background-color-100-on-md'>
Expand Down Expand Up @@ -71,10 +76,12 @@ const ApplicationDetails = ({ onTabSelect, appList, activeApp, inventoryId, ...p
>
{item.name === currentApp && <Suspense fallback={Spinner}>
<section className='pf-c-page__main-section'>
<Cmp
inventoryId={inventoryId}
store={store}
/>
{isDisconnected && ['patch', 'vulnerabilities', 'advisor']
.includes(currentApp) ? <NotConnected/>
: <Cmp
inventoryId={inventoryId}
store={store}
/>}
</section>
</Suspense>}
</TabContent>
Expand All @@ -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;
1 change: 1 addition & 0 deletions src/components/InventoryDetail/InventoryDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const InventoryDetail = ({
activeApp={activeApp}
appList={appList}
inventoryId={inventoryId}
entity={entity}
/>
)}
</>)
Expand Down