Skip to content

Commit

Permalink
add new HubNamespaceResponse and fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaiahWren committed Jul 10, 2023
1 parent ca8c1e5 commit 13b6d1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 2 additions & 8 deletions frontend/hub/namespaces/HubNamespaceDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -29,17 +29,11 @@ import { DropdownPosition } from '@patternfly/react-core';
export function NamespaceDetails() {
const { t } = useTranslation();
const params = useParams<{ id: string }>();
const { data } = useGet<HubItemsResponse<HubNamespace>>(
const { data } = useGet<HubNamespaceResponse<HubNamespace>>(
`/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];
}

Expand Down
5 changes: 5 additions & 0 deletions frontend/hub/useHubView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export interface HubItemsResponse<T extends object> {
};
}

export interface HubNamespaceResponse<T extends object> {
count: number;
results: T[];
}

export type IHubView<T extends object> = IView &
ISelected<T> & {
itemCount: number | undefined;
Expand Down

0 comments on commit 13b6d1e

Please sign in to comment.