From 13b6d1e18c7493aebaf639adec8f98f0892b3399 Mon Sep 17 00:00:00 2001 From: Shaiah Emigh-Doyle Date: Mon, 10 Jul 2023 15:14:54 -0400 Subject: [PATCH] add new HubNamespaceResponse and fix type errors --- frontend/hub/namespaces/HubNamespaceDetails.tsx | 10 ++-------- frontend/hub/useHubView.tsx | 5 +++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/frontend/hub/namespaces/HubNamespaceDetails.tsx b/frontend/hub/namespaces/HubNamespaceDetails.tsx index b6d9c1ffee..9b3b178aa4 100644 --- a/frontend/hub/namespaces/HubNamespaceDetails.tsx +++ b/frontend/hub/namespaces/HubNamespaceDetails.tsx @@ -12,7 +12,7 @@ import { import { PageDetailsFromColumns } from '../../../framework'; import { RouteObj } from '../../Routes'; import { useGet } from '../../common/crud/useGet'; -import { HubItemsResponse } from '../useHubView'; +import { HubNamespaceResponse } from '../useHubView'; import { HubNamespace } from './HubNamespace'; import { useHubView } from '../useHubView'; import { useHubNamespaceActions } from './hooks/useHubNamespaceActions'; @@ -29,17 +29,11 @@ import { DropdownPosition } from '@patternfly/react-core'; export function NamespaceDetails() { const { t } = useTranslation(); const params = useParams<{ id: string }>(); - const { data } = useGet>( + const { data } = useGet>( `/api/automation-hub/pulp/api/v3/pulp_ansible/namespaces/?limit=1&name=${params.id ?? ''}` ); let namespace: HubNamespace | undefined = undefined; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore if (data && data.results && data.count > 0) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment namespace = data.results[0]; } diff --git a/frontend/hub/useHubView.tsx b/frontend/hub/useHubView.tsx index 4825b95cf9..7cd5b0ea7d 100644 --- a/frontend/hub/useHubView.tsx +++ b/frontend/hub/useHubView.tsx @@ -22,6 +22,11 @@ export interface HubItemsResponse { }; } +export interface HubNamespaceResponse { + count: number; + results: T[]; +} + export type IHubView = IView & ISelected & { itemCount: number | undefined;