Skip to content

Commit

Permalink
[Fleet] Correctly track install status of an integration (#93464)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Fernández Gómez authored Mar 4, 2021
1 parent 284a77c commit a050b7a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { Error, Loading } from '../../../../components';
import { useBreadcrumbs } from '../../../../hooks';
import { WithHeaderLayout, WithHeaderLayoutProps } from '../../../../layouts';
import { RELEASE_BADGE_DESCRIPTION, RELEASE_BADGE_LABEL } from '../../components/release_badge';
import { useSetPackageInstallStatus } from '../../hooks';
import { useGetPackageInstallStatus, useSetPackageInstallStatus } from '../../hooks';

import { IntegrationAgentPolicyCount, UpdateIcon, IconPanel, LoadingIconPanel } from './components';
import { OverviewPage } from './overview';
Expand Down Expand Up @@ -77,6 +77,15 @@ export function Detail() {
// Package info state
const [packageInfo, setPackageInfo] = useState<PackageInfo | null>(null);
const setPackageInstallStatus = useSetPackageInstallStatus();
const getPackageInstallStatus = useGetPackageInstallStatus();

const packageInstallStatus = useMemo(() => {
if (packageInfo === null || !packageInfo.name) {
return undefined;
}
return getPackageInstallStatus(packageInfo.name).status;
}, [packageInfo, getPackageInstallStatus]);

const updateAvailable =
packageInfo &&
'savedObject' in packageInfo &&
Expand All @@ -88,7 +97,6 @@ export function Detail() {
pkgkey
);

const packageInstallStatus = packageInfoData?.response.status;
const showCustomTab =
useUIExtension(packageInfoData?.response.name ?? '', 'package-detail-custom') !== undefined;

Expand Down

0 comments on commit a050b7a

Please sign in to comment.