import React, { JSX } from 'react'; import type { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config'; import type { ListType } from '@redocly/theme/core/types'; import type { BffCatalogEntity, BffCatalogRelatedEntity } from '@redocly/theme/core/types'; import { CatalogColumn } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView'; import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell'; import { CatalogEntityRelationsTable } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable'; import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag'; import { CatalogEntityRelationCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityRelationCell'; import { CatalogLastUpdateCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogLastUpdateCell'; export type CatalogEntityDefaultRelationsProps = { entity: BffCatalogEntity; entitiesCatalogConfig: EntitiesCatalogConfig; catalogConfig: CatalogEntityConfig; relations: BffCatalogRelatedEntity[]; query: { fetchNextPage: () => void; isFetchingNextPage: boolean; }; searchQuery: string; setSearchQuery: (query: string) => void; sortOption: string | null; setSortOption: (sortOption: string | null) => void; handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void; isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean; shouldShowLoadMore: boolean; shouldShowHeading?: boolean; listType?: ListType; }; export function CatalogEntityDefaultRelations({ entity, relations, query, searchQuery, setSearchQuery, entitiesCatalogConfig, catalogConfig, sortOption, setSortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, shouldShowHeading = true, listType, }: CatalogEntityDefaultRelationsProps): JSX.Element { return (
); } function getRelationsTableColumns(listType?: ListType): CatalogColumn[] { const columns: CatalogColumn[] = [ { key: 'entity', title: 'Entity', render: (entity) => , sortable: true, sortKey: 'title', width: '4fr', }, { key: 'type', title: 'Type', render: (entity) => , sortable: true, sortKey: 'type', width: '2fr', }, { key: 'relationType', title: 'Relations', render: (entity) => ( ), width: '2fr', sortable: true, sortKey: 'relation_type', }, { key: 'lastUpdate', title: 'Last update', render: (entity) => , width: '1fr', minWidth: '112px', sortable: true, sortKey: 'updated_at', }, ]; if (listType === 'api-operation' || listType === 'data-schema') { return columns.filter((column) => column.key !== 'type'); } return columns; }