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

use v3 namespaces api #644

Closed
wants to merge 3 commits into from
Closed
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
31 changes: 29 additions & 2 deletions frontend/hub/namespaces/HubNamespace.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
export interface LinksType {
name: string;
url: string;
}

export interface LatestMetadataType {
pulp_href: string;
name: string;
company: string;
email: string;
description: string;
resources: string;
links: LinksType[];
avatar_sha256: string | null;
avatar_url: string | null;
metadata_sha256: string;
groups: string[];
task: string | null;
}

export interface HubNamespace {
pulp_href: string;
pulp_created: string;
id: number;
name: string;
company: string;
email: string;
avatar_url: string;
description: string;
num_collections: number;
groups: [
{
id: number;
name: string;
object_roles: string[];
object_permissions: string[];
pulp_href?: string;
}
];
related_fields: object;
resources: string;
owners: string[];
links: LinksType[];
my_permissions: string[];
latest_metadata: LatestMetadataType;
}
10 changes: 6 additions & 4 deletions frontend/hub/namespaces/HubNamespaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { PageHeader, PageLayout, PageTab, PageTable, PageTabs } from '../../../framework';
import { RouteObj } from '../../Routes';
import { idKeyFn, useHubView } from '../useHubView';
import { idKeyFn, usePulpView } from '../usePulpView';
import { HubNamespace } from './HubNamespace';
import { useHubNamespaceActions } from './hooks/useHubNamespaceActions';
import { useHubNamespaceFilters } from './hooks/useHubNamespaceFilters';
Expand Down Expand Up @@ -42,11 +42,13 @@ export function Namespaces() {
}

export function AllNamespaces() {
return <CommonNamespaces url="/api/automation-hub/_ui/v1/namespaces/" />;
return <CommonNamespaces url="/api/automation-hub/pulp/api/v3/pulp_ansible/namespaces/" />;
}

export function MyNamespaces() {
return <CommonNamespaces url="/api/automation-hub/_ui/v1/my-namespaces/" />;
return (
<CommonNamespaces url="/api/automation-hub/pulp/api/v3/pulp_ansible/namespaces/?my_permissions=ansible.change_ansiblenamespace" />
);
}

export function CommonNamespaces(props: { url: string }) {
Expand All @@ -56,7 +58,7 @@ export function CommonNamespaces(props: { url: string }) {
const tableColumns = useHubNamespacesColumns();
const toolbarActions = useHubNamespaceToolbarActions();
const rowActions = useHubNamespaceActions();
const view = useHubView<HubNamespace>(props.url, idKeyFn, toolbarFilters, tableColumns);
const view = usePulpView<HubNamespace>(props.url, idKeyFn, toolbarFilters, tableColumns);
return (
<PageTable<HubNamespace>
toolbarFilters={toolbarFilters}
Expand Down