@redocly/theme 0.60.0 → 0.61.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Catalog/Catalog.js +12 -2
- package/lib/components/Catalog/CatalogEntities.js +18 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +10 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +25 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +4 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +11 -3
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +7 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +2 -3
- package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +4 -43
- package/lib/components/Catalog/CatalogSelector.d.ts +3 -4
- package/lib/components/Catalog/CatalogSelector.js +2 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +2 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +2 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +3 -5
- package/lib/core/hooks/catalog/use-catalog-entity-details.d.ts +11 -0
- package/lib/core/hooks/catalog/{use-catalog-table-view-row.js → use-catalog-entity-details.js} +9 -9
- package/lib/core/hooks/index.d.ts +1 -1
- package/lib/core/hooks/index.js +1 -1
- package/lib/core/types/catalog.d.ts +23 -10
- package/lib/core/types/hooks.d.ts +5 -11
- package/package.json +2 -2
- package/src/components/Catalog/Catalog.tsx +11 -9
- package/src/components/Catalog/CatalogEntities.tsx +24 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +21 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +27 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +3 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +18 -3
- package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +7 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +6 -17
- package/src/components/Catalog/CatalogSelector.tsx +4 -7
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +3 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +6 -5
- package/src/core/hooks/catalog/{use-catalog-table-view-row.ts → use-catalog-entity-details.ts} +11 -15
- package/src/core/hooks/index.ts +1 -1
- package/src/core/types/catalog.ts +32 -10
- package/src/core/types/hooks.ts +6 -24
- package/lib/core/hooks/catalog/use-catalog-table-view-row.d.ts +0 -11
|
@@ -36,10 +36,20 @@ function Catalog(props) {
|
|
|
36
36
|
const { catalogConfig, filters: serverFilters, entitiesTypes, initialEntitiesList, catalogSwitcherItems, initialViewMode, } = props;
|
|
37
37
|
const { useTranslate, useCatalog } = (0, hooks_1.useThemeHooks)();
|
|
38
38
|
const { translate } = useTranslate();
|
|
39
|
-
const { filters, searchQuery, setSearchQuery, filterQuery, sortOption, setSortOption, handleSortClick, isColumnSorted, viewMode, setViewMode, entitiesCounter, setEntitiesCounter, onChangeViewClick, onChangeCollapseSidebarClick, layout, collapsedSidebar, } = useCatalog(
|
|
39
|
+
const { filters, searchQuery, setSearchQuery, filterQuery, sortOption, setSortOption, handleSortClick, isColumnSorted, viewMode, setViewMode, entitiesCounter, setEntitiesCounter, onChangeViewClick, onChangeCollapseSidebarClick, layout, collapsedSidebar, } = useCatalog({
|
|
40
|
+
config: catalogConfig,
|
|
41
|
+
entitiesCounterInitial: (initialEntitiesList === null || initialEntitiesList === void 0 ? void 0 : initialEntitiesList.page.total) || 0,
|
|
42
|
+
serverFilters,
|
|
43
|
+
initialViewMode,
|
|
44
|
+
});
|
|
40
45
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
41
46
|
react_1.default.createElement(CatalogPageWrapper, { "data-component-name": "Catalog/Catalog" },
|
|
42
|
-
react_1.default.createElement(FiltersSidebar, { collapsed: collapsedSidebar, header: collapsedSidebar ? null : (react_1.default.createElement(CatalogSelector_1.CatalogSelector, { catalogSwitcherItems: catalogSwitcherItems,
|
|
47
|
+
react_1.default.createElement(FiltersSidebar, { collapsed: collapsedSidebar, header: collapsedSidebar ? null : (react_1.default.createElement(CatalogSelector_1.CatalogSelector, { catalogSwitcherItems: catalogSwitcherItems, onChange: () => {
|
|
48
|
+
setSearchQuery('');
|
|
49
|
+
setSortOption(null);
|
|
50
|
+
} })), menu: react_1.default.createElement(CatalogFilterContent_1.CatalogFilterContent, { filters: filters, filterTerm: searchQuery, filterValuesCasing: customCatalogOptionsCasing, onClear: () => {
|
|
51
|
+
setSearchQuery('');
|
|
52
|
+
} }), footer: react_1.default.createElement(SidebarActions_1.SidebarActions, { layout: layout, collapsedSidebar: collapsedSidebar, isApiDocs: false, onChangeViewClick: onChangeViewClick, onChangeCollapseSidebarClick: onChangeCollapseSidebarClick }) }),
|
|
43
53
|
react_1.default.createElement(CatalogPageContent, null,
|
|
44
54
|
react_1.default.createElement(CatalogPageDescription, null,
|
|
45
55
|
react_1.default.createElement(CatalogTitleWrapper, null,
|
|
@@ -45,7 +45,11 @@ const CatalogEntitiesEmptyState_1 = require("../../components/Catalog/CatalogEnt
|
|
|
45
45
|
const LOAD_MORE_THRESHOLD = 10;
|
|
46
46
|
function CatalogEntities(props) {
|
|
47
47
|
const { catalogConfig, excludedEntities, filterQuery, entitiesTypes, sortOption, searchQuery, viewMode, setEntitiesCounter, setSortOption, handleSortClick, isColumnSorted, } = props;
|
|
48
|
-
const {
|
|
48
|
+
const { getEntityDetailsLink } = (0, hooks_1.useCatalogEntityDetails)({
|
|
49
|
+
catalogConfig,
|
|
50
|
+
});
|
|
51
|
+
const { useTelemetry, useFetchCatalogEntities } = (0, hooks_1.useThemeHooks)();
|
|
52
|
+
const telemetry = useTelemetry();
|
|
49
53
|
const { initialFilter } = (0, hooks_1.useCatalogEntities)({
|
|
50
54
|
entitiesTypes,
|
|
51
55
|
excludedEntities,
|
|
@@ -58,6 +62,18 @@ function CatalogEntities(props) {
|
|
|
58
62
|
sort: sortOption || undefined,
|
|
59
63
|
search: searchQuery,
|
|
60
64
|
}, props.initialEntitiesList);
|
|
65
|
+
const onRowClick = (entity) => {
|
|
66
|
+
if (searchQuery) {
|
|
67
|
+
telemetry.sendCatalogEntitiesListSearchResultClickedMessage({
|
|
68
|
+
id: entity.id,
|
|
69
|
+
object: 'catalog_entity',
|
|
70
|
+
uri: getEntityDetailsLink(entity),
|
|
71
|
+
query: searchQuery,
|
|
72
|
+
entityKey: entity.key,
|
|
73
|
+
entityType: entity.type,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
61
77
|
const shouldShowLoadMore = query.hasNextPage ||
|
|
62
78
|
(query.isPlaceholderData && entities && entities.length >= LOAD_MORE_THRESHOLD);
|
|
63
79
|
(0, react_1.useEffect)(() => {
|
|
@@ -67,7 +83,7 @@ function CatalogEntities(props) {
|
|
|
67
83
|
return react_1.default.createElement(CatalogEntitiesEmptyState_1.CatalogEntitiesEmptyState, null);
|
|
68
84
|
}
|
|
69
85
|
return (react_1.default.createElement(CatalogHighlight_1.HighlightContext.Provider, { value: [searchQuery], "data-component-name": "Catalog/CatalogEntities" },
|
|
70
|
-
viewMode === 'cards' ? (react_1.default.createElement(CatalogCardView_1.CatalogCardView, { entities: entities, catalogConfig: catalogConfig })) : (react_1.default.createElement(CatalogTableView_1.CatalogTableView, { entities: entities, catalogConfig: catalogConfig, setSortOption: setSortOption, currentSortOption: sortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted })),
|
|
86
|
+
viewMode === 'cards' ? (react_1.default.createElement(CatalogCardView_1.CatalogCardView, { entities: entities, catalogConfig: catalogConfig })) : (react_1.default.createElement(CatalogTableView_1.CatalogTableView, { entities: entities, catalogConfig: catalogConfig, setSortOption: setSortOption, currentSortOption: sortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, onRowClick: onRowClick })),
|
|
71
87
|
shouldShowLoadMore && (react_1.default.createElement(LoadMore_1.LoadMore, { icon: react_1.default.createElement(ArrowDownIcon_1.ArrowDownIcon, { size: "var(--catalog-load-more-icon-size)" }), onClick: query.fetchNextPage, disabled: query.isFetchingNextPage, blinking: query.isFetchingNextPage, label: query.isFetchingNextPage ? 'Loading...' : 'Load More' }))));
|
|
72
88
|
}
|
|
73
89
|
//# sourceMappingURL=CatalogEntities.js.map
|
|
@@ -26,15 +26,11 @@ const renderFirstColumnEntitySection = (entity) => {
|
|
|
26
26
|
return react_1.default.createElement(CatalogEntityMetadata_1.CatalogEntityMetadata, { entity: entity });
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
const renderDataSchemaSection = (entity, relatedEntity,
|
|
30
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
31
|
-
RedocSchema,
|
|
32
|
-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
33
|
-
StoreProvider, GraphqlTypeRenderer) => {
|
|
29
|
+
const renderDataSchemaSection = ({ entity, relatedEntity, catalogConfig, RedocSchema, StoreProvider, GraphqlTypeRenderer, }) => {
|
|
34
30
|
if (entity.type !== 'data-schema') {
|
|
35
31
|
return null;
|
|
36
32
|
}
|
|
37
|
-
return (react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity, relatedEntity: relatedEntity, RedocSchema: RedocSchema, StoreProvider: StoreProvider, GraphqlTypeRenderer: GraphqlTypeRenderer }));
|
|
33
|
+
return (react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity, relatedEntity: relatedEntity, catalogConfig: catalogConfig, RedocSchema: RedocSchema, StoreProvider: StoreProvider, GraphqlTypeRenderer: GraphqlTypeRenderer }));
|
|
38
34
|
};
|
|
39
35
|
function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
40
36
|
var _a;
|
|
@@ -56,7 +52,14 @@ function CatalogEntity({ RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
|
56
52
|
react_1.default.createElement(react_router_dom_1.Route, { index: true, element: react_1.default.createElement(react_1.default.Fragment, null,
|
|
57
53
|
react_1.default.createElement(CatalogPageDescription_1.CatalogPageDescription, { title: entity.title, description: (_a = entity.summary) !== null && _a !== void 0 ? _a : '', tag: entity.key }),
|
|
58
54
|
react_1.default.createElement(CatalogEntityProperties_1.CatalogEntityProperties, { entity: entity }),
|
|
59
|
-
renderDataSchemaSection(
|
|
55
|
+
renderDataSchemaSection({
|
|
56
|
+
entity,
|
|
57
|
+
relatedEntity,
|
|
58
|
+
catalogConfig,
|
|
59
|
+
RedocSchema,
|
|
60
|
+
StoreProvider,
|
|
61
|
+
GraphqlTypeRenderer,
|
|
62
|
+
}),
|
|
60
63
|
react_1.default.createElement(CatalogTwoColumnsSection, null,
|
|
61
64
|
renderFirstColumnEntitySection(entity),
|
|
62
65
|
react_1.default.createElement(CatalogEntityLinks_1.CatalogEntityLinks, { entity: entity })),
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts
CHANGED
|
@@ -23,4 +23,4 @@ export type CatalogEntityRelationsTableProps = {
|
|
|
23
23
|
shouldShowLoadMore: boolean;
|
|
24
24
|
listType?: ListType;
|
|
25
25
|
};
|
|
26
|
-
export declare function CatalogEntityRelationsTable({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, setSearchQuery, heading, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }: CatalogEntityRelationsTableProps): JSX.Element;
|
|
26
|
+
export declare function CatalogEntityRelationsTable({ entity, entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, setSearchQuery, heading, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }: CatalogEntityRelationsTableProps): JSX.Element;
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js
CHANGED
|
@@ -8,11 +8,34 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const CatalogActionsRow_1 = require("../../../../components/Catalog/CatalogActionsRow");
|
|
10
10
|
const CatalogEntityRelationsTableContent_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent");
|
|
11
|
-
|
|
11
|
+
const hooks_1 = require("../../../../core/hooks");
|
|
12
|
+
const constants_1 = require("../../../../core/constants");
|
|
13
|
+
function CatalogEntityRelationsTable({ entity, entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, setSearchQuery, heading, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }) {
|
|
14
|
+
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
15
|
+
const telemetry = useTelemetry();
|
|
16
|
+
const { getEntityDetailsLink } = (0, hooks_1.useCatalogEntityDetails)({
|
|
17
|
+
catalogConfig,
|
|
18
|
+
entitiesCatalogConfig,
|
|
19
|
+
});
|
|
20
|
+
const onRowClick = (relatedEntity) => {
|
|
21
|
+
if (searchQuery) {
|
|
22
|
+
telemetry.sendCatalogEntitiesRelatedEntitiesListSearchResultClickMessage({
|
|
23
|
+
id: relatedEntity.id,
|
|
24
|
+
object: 'catalog_entity',
|
|
25
|
+
uri: getEntityDetailsLink(relatedEntity),
|
|
26
|
+
query: searchQuery,
|
|
27
|
+
entityKey: entity.key,
|
|
28
|
+
entityType: entity.type,
|
|
29
|
+
relationType: constants_1.reverseRelationMap[relatedEntity.relationType],
|
|
30
|
+
relatedEntityKey: relatedEntity.key,
|
|
31
|
+
relatedEntityType: relatedEntity.type,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
12
35
|
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable" },
|
|
13
36
|
heading && react_1.default.createElement(Heading, null, heading),
|
|
14
37
|
react_1.default.createElement(CatalogActionsRow_1.CatalogActionsRow, { searchQuery: searchQuery, setSearchQuery: setSearchQuery, sortOption: sortOption, setSortOption: setSortOption, style: { marginBottom: '12px' } }),
|
|
15
|
-
react_1.default.createElement(CatalogEntityRelationsTableContent_1.CatalogEntityRelationsTableContent, { entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, relations: relations, query: query, searchQuery: searchQuery, columns: columns, setSortOption: setSortOption, sortOption: sortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, listType: listType })));
|
|
38
|
+
react_1.default.createElement(CatalogEntityRelationsTableContent_1.CatalogEntityRelationsTableContent, { entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, relations: relations, query: query, searchQuery: searchQuery, columns: columns, setSortOption: setSortOption, sortOption: sortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, listType: listType, onRowClick: onRowClick })));
|
|
16
39
|
}
|
|
17
40
|
const Heading = styled_components_1.default.h2 `
|
|
18
41
|
margin: var(--spacing-base) 0;
|
|
@@ -19,5 +19,6 @@ export type CatalogEntityRelationsTableContentProps = {
|
|
|
19
19
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
20
20
|
shouldShowLoadMore: boolean;
|
|
21
21
|
listType?: ListType;
|
|
22
|
+
onRowClick: (entity: BffCatalogRelatedEntity) => void;
|
|
22
23
|
};
|
|
23
|
-
export declare function CatalogEntityRelationsTableContent({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }: CatalogEntityRelationsTableContentProps): JSX.Element;
|
|
24
|
+
export declare function CatalogEntityRelationsTableContent({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, onRowClick, }: CatalogEntityRelationsTableContentProps): JSX.Element;
|
|
@@ -10,9 +10,9 @@ const LoadMore_1 = require("../../../../components/LoadMore/LoadMore");
|
|
|
10
10
|
const CatalogTableView_1 = require("../../../../components/Catalog/CatalogTableView/CatalogTableView");
|
|
11
11
|
const CatalogHighlight_1 = require("../../../../components/Catalog/CatalogHighlight");
|
|
12
12
|
const CatalogEntitiesEmptyState_1 = require("../../../../components/Catalog/CatalogEntitiesEmptyState");
|
|
13
|
-
function CatalogEntityRelationsTableContent({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }) {
|
|
13
|
+
function CatalogEntityRelationsTableContent({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, onRowClick, }) {
|
|
14
14
|
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent" },
|
|
15
|
-
react_1.default.createElement(CatalogHighlight_1.HighlightContext.Provider, { value: [searchQuery] }, relations.length > 0 ? (react_1.default.createElement(CatalogTableView_1.CatalogTableView, { entities: relations, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, columns: columns, setSortOption: setSortOption, currentSortOption: sortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, style: { marginTop: 0 } })) : (react_1.default.createElement(CatalogEntitiesEmptyState_1.CatalogEntitiesEmptyState, { listType: listType }))),
|
|
15
|
+
react_1.default.createElement(CatalogHighlight_1.HighlightContext.Provider, { value: [searchQuery] }, relations.length > 0 ? (react_1.default.createElement(CatalogTableView_1.CatalogTableView, { entities: relations, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, columns: columns, setSortOption: setSortOption, currentSortOption: sortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, style: { marginTop: 0 }, onRowClick: onRowClick })) : (react_1.default.createElement(CatalogEntitiesEmptyState_1.CatalogEntitiesEmptyState, { listType: listType }))),
|
|
16
16
|
shouldShowLoadMore && (react_1.default.createElement(LoadMore_1.LoadMore, { icon: react_1.default.createElement(ArrowDownIcon_1.ArrowDownIcon, { size: "var(--catalog-load-more-icon-size)" }), onClick: query.fetchNextPage, disabled: query.isFetchingNextPage, blinking: query.isFetchingNextPage, label: query.isFetchingNextPage ? 'Loading...' : 'Load More' }))));
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=CatalogEntityRelationsTableContent.js.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { CatalogEntityConfig } from '@redocly/config';
|
|
3
|
+
import type { BffCatalogEntity, BffCatalogRelatedEntity } from '../../../core/types';
|
|
3
4
|
export type CatalogEntitySchemaProps = {
|
|
4
5
|
entity: BffCatalogEntity;
|
|
5
6
|
relatedEntity: BffCatalogRelatedEntity | null;
|
|
7
|
+
catalogConfig: CatalogEntityConfig;
|
|
6
8
|
RedocSchema: React.ComponentType<any>;
|
|
7
9
|
StoreProvider: React.ComponentType<any>;
|
|
8
10
|
GraphqlTypeRenderer?: React.ComponentType<{
|
|
@@ -10,4 +12,4 @@ export type CatalogEntitySchemaProps = {
|
|
|
10
12
|
typeName: string;
|
|
11
13
|
}>;
|
|
12
14
|
};
|
|
13
|
-
export declare function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer, }: CatalogEntitySchemaProps): React.JSX.Element;
|
|
15
|
+
export declare function CatalogEntitySchema({ entity, relatedEntity, catalogConfig, RedocSchema, StoreProvider, GraphqlTypeRenderer, }: CatalogEntitySchemaProps): React.JSX.Element;
|
|
@@ -44,17 +44,25 @@ const hooks_1 = require("../../../core/hooks");
|
|
|
44
44
|
const hooks_2 = require("../../../core/hooks");
|
|
45
45
|
const JsonViewer_1 = require("../../../components/JsonViewer/JsonViewer");
|
|
46
46
|
const CopyButton_1 = require("../../../components/Buttons/CopyButton");
|
|
47
|
-
function CatalogEntitySchema({ entity, relatedEntity, RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
47
|
+
function CatalogEntitySchema({ entity, relatedEntity, catalogConfig, RedocSchema, StoreProvider, GraphqlTypeRenderer, }) {
|
|
48
48
|
var _a, _b;
|
|
49
|
-
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
49
|
+
const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
50
|
+
const telemetry = useTelemetry();
|
|
50
51
|
const { translate } = useTranslate();
|
|
51
52
|
const { definition, parsedSchema, rawSchema } = (0, hooks_2.useCatalogEntitySchema)({ entity, relatedEntity });
|
|
52
53
|
const isGraphql = ((_a = entity.metadata) === null || _a === void 0 ? void 0 : _a.specType) === 'graphql';
|
|
53
54
|
const graphqlSDL = (_b = entity === null || entity === void 0 ? void 0 : entity.metadata) === null || _b === void 0 ? void 0 : _b.sdl;
|
|
55
|
+
const { getEntityDetailsLink } = (0, hooks_1.useCatalogEntityDetails)({
|
|
56
|
+
catalogConfig,
|
|
57
|
+
});
|
|
54
58
|
return (react_1.default.createElement(MetadataWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntityMetadata" },
|
|
55
59
|
react_1.default.createElement(HeaderWrapper, null,
|
|
56
60
|
react_1.default.createElement(Heading, null, translate('catalog.entity.schema.title')),
|
|
57
|
-
!isGraphql && (react_1.default.createElement(CopyButton_1.CopyButton, { data: rawSchema, buttonText: "Copy Schema", type: "compound", variant: "secondary", iconPosition: "right", size: "medium"
|
|
61
|
+
!isGraphql && (react_1.default.createElement(CopyButton_1.CopyButton, { data: rawSchema, buttonText: "Copy Schema", type: "compound", variant: "secondary", iconPosition: "right", size: "medium", onCopyClick: () => telemetry.sendCatalogEntitiesCopyDataSchemaClickedMessage({
|
|
62
|
+
id: entity.id,
|
|
63
|
+
object: 'catalog_entity',
|
|
64
|
+
uri: getEntityDetailsLink(entity),
|
|
65
|
+
}) }))),
|
|
58
66
|
react_1.default.createElement(SplitViewWrapper, null,
|
|
59
67
|
react_1.default.createElement(SchemaContentWrapper, null, isGraphql && graphqlSDL && GraphqlTypeRenderer ? (react_1.default.createElement(GraphqlTypeRenderer, { sdl: graphqlSDL, typeName: entity.title })) : (react_1.default.createElement(StoreProvider, { definition: definition },
|
|
60
68
|
react_1.default.createElement(RedocSchema, { schema: parsedSchema })))),
|
|
@@ -103,7 +103,13 @@ function CatalogFilterCheckboxes({ filter, filterValuesCasing, showCounter = tru
|
|
|
103
103
|
const id = 'filter--' + filter.property + '--' + value;
|
|
104
104
|
return (react_1.default.createElement(FilterCheckboxOption, { key: id, role: "link", onClick: () => {
|
|
105
105
|
filter.toggleOption(value);
|
|
106
|
-
telemetry.
|
|
106
|
+
telemetry.sendCatalogEntitiesFilterCheckboxToggledMessage({
|
|
107
|
+
id: filter.property + '--' + value,
|
|
108
|
+
object: 'checkbox',
|
|
109
|
+
uri: window.location.href,
|
|
110
|
+
category: filter.property,
|
|
111
|
+
value: value,
|
|
112
|
+
});
|
|
107
113
|
} },
|
|
108
114
|
react_1.default.createElement(CheckboxIcon_1.CheckboxIcon, { checked: filter.selectedOptions instanceof Set
|
|
109
115
|
? filter.selectedOptions.has(value) ||
|
|
@@ -2,12 +2,11 @@ import type { JSX } from 'react';
|
|
|
2
2
|
import type { ResolvedFilter } from '../../../core/types';
|
|
3
3
|
import type { RedoclyConfig } from '../../../config';
|
|
4
4
|
export type CatalogFilterContentProps = {
|
|
5
|
-
|
|
5
|
+
onClear: () => void;
|
|
6
6
|
filters: ResolvedFilter[];
|
|
7
7
|
filterTerm: string;
|
|
8
8
|
filterValuesCasing?: NonNullable<RedoclyConfig['catalog']>[string]['filterValuesCasing'] | ((str: string) => string);
|
|
9
|
-
hideSearch?: boolean;
|
|
10
9
|
showCounter?: boolean;
|
|
11
10
|
className?: string;
|
|
12
11
|
};
|
|
13
|
-
export declare function CatalogFilterContent({
|
|
12
|
+
export declare function CatalogFilterContent({ onClear, filters, filterTerm, filterValuesCasing, showCounter, className, }: CatalogFilterContentProps): JSX.Element | null;
|
|
@@ -1,50 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
38
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
6
|
exports.CatalogFilterContent = CatalogFilterContent;
|
|
40
7
|
const react_1 = __importDefault(require("react"));
|
|
41
|
-
const styled_components_1 =
|
|
42
|
-
const FilterInput_1 = require("../../../components/Filter/FilterInput");
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
43
9
|
const hooks_1 = require("../../../core/hooks");
|
|
44
10
|
const Button_1 = require("../../../components/Button/Button");
|
|
45
11
|
const CatalogFilter_1 = require("../../../components/Catalog/CatalogFilter/CatalogFilter");
|
|
46
12
|
const utils_1 = require("../../../core/utils");
|
|
47
|
-
function CatalogFilterContent({
|
|
13
|
+
function CatalogFilterContent({ onClear, filters, filterTerm, filterValuesCasing, showCounter = true, className, }) {
|
|
48
14
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
49
15
|
const { translate } = useTranslate();
|
|
50
16
|
const hasActiveFilters = filters.some((filter) => {
|
|
@@ -61,7 +27,7 @@ function CatalogFilterContent({ setFilterTerm, filters, filterTerm, filterValues
|
|
|
61
27
|
});
|
|
62
28
|
const handleClearAll = () => {
|
|
63
29
|
filters.forEach((filter) => filter.selectOption(''));
|
|
64
|
-
|
|
30
|
+
onClear();
|
|
65
31
|
};
|
|
66
32
|
if (!filters.length) {
|
|
67
33
|
return null;
|
|
@@ -70,8 +36,7 @@ function CatalogFilterContent({ setFilterTerm, filters, filterTerm, filterValues
|
|
|
70
36
|
react_1.default.createElement(FiltersHeader, null,
|
|
71
37
|
react_1.default.createElement(FiltersTitle, { "data-translation-key": "catalog.filters.title" }, translate('catalog.filters.title', 'Filters')),
|
|
72
38
|
hasActiveFilters ? (react_1.default.createElement(Button_1.Button, { size: "medium", tone: "danger", variant: "ghost", onClick: handleClearAll }, translate('catalog.filters.clearAll', 'Clear filters'))) : null),
|
|
73
|
-
|
|
74
|
-
react_1.default.createElement(FilterItems, { hideSearch: hideSearch }, filters.map((filter, idx) => (react_1.default.createElement(CatalogFilter_1.CatalogFilter, { filter: filter, key: filter.property + '-' + idx, filterValuesCasing: filterValuesCasing, showCounter: showCounter }))))));
|
|
39
|
+
react_1.default.createElement(FilterItems, null, filters.map((filter, idx) => (react_1.default.createElement(CatalogFilter_1.CatalogFilter, { filter: filter, key: filter.property + '-' + idx, filterValuesCasing: filterValuesCasing, showCounter: showCounter }))))));
|
|
75
40
|
}
|
|
76
41
|
const CatalogFilterContentWrapper = styled_components_1.default.div `
|
|
77
42
|
padding: 0 0 var(--filter-content-padding-vertical) 0;
|
|
@@ -94,9 +59,5 @@ const FilterItems = styled_components_1.default.div `
|
|
|
94
59
|
display: flex;
|
|
95
60
|
flex-direction: column;
|
|
96
61
|
border-top: 1px solid var(--border-color-secondary);
|
|
97
|
-
${({ hideSearch }) => hideSearch &&
|
|
98
|
-
(0, styled_components_1.css) `
|
|
99
|
-
border-top: none;
|
|
100
|
-
`}
|
|
101
62
|
`;
|
|
102
63
|
//# sourceMappingURL=CatalogFilterContent.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { Select } from '../../components/Select/Select';
|
|
3
|
-
import { CatalogSwitcherItem
|
|
3
|
+
import { CatalogSwitcherItem } from '../../core/types';
|
|
4
4
|
export type CatalogSelectorProps = {
|
|
5
5
|
catalogSwitcherItems: CatalogSwitcherItem[];
|
|
6
|
-
|
|
7
|
-
setSortOption: (option: SortOption | null) => void;
|
|
6
|
+
onChange: () => void;
|
|
8
7
|
};
|
|
9
|
-
export declare function CatalogSelector({ catalogSwitcherItems,
|
|
8
|
+
export declare function CatalogSelector({ catalogSwitcherItems, onChange, }: CatalogSelectorProps): JSX.Element;
|
|
10
9
|
export declare const CatalogSelectWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
10
|
export declare const CatalogSelectLabel: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
12
11
|
export declare const CatalogSelect: import("styled-components").StyledComponent<typeof Select, any, {}, never>;
|
|
@@ -12,7 +12,7 @@ const Select_1 = require("../../components/Select/Select");
|
|
|
12
12
|
const utils_1 = require("../../core/utils");
|
|
13
13
|
const hooks_1 = require("../../core/hooks");
|
|
14
14
|
const ChevronDownIcon_1 = require("../../icons/ChevronDownIcon/ChevronDownIcon");
|
|
15
|
-
function CatalogSelector({ catalogSwitcherItems,
|
|
15
|
+
function CatalogSelector({ catalogSwitcherItems, onChange, }) {
|
|
16
16
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
17
17
|
const { translate } = useTranslate();
|
|
18
18
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
@@ -27,8 +27,7 @@ function CatalogSelector({ catalogSwitcherItems, setSearchQuery, setSortOption,
|
|
|
27
27
|
react_1.default.createElement(exports.CatalogSelectLabel, null, translate('catalog.catalogs.label', 'Catalogs')),
|
|
28
28
|
react_1.default.createElement(exports.CatalogSelect, { value: selectedCatalogItem === null || selectedCatalogItem === void 0 ? void 0 : selectedCatalogItem.slug, options: options, onChange: (value) => {
|
|
29
29
|
navigate(`${pathPrefix}/catalogs/${value}`);
|
|
30
|
-
|
|
31
|
-
setSortOption(null);
|
|
30
|
+
onChange();
|
|
32
31
|
}, icon: react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, { color: "var(--catalog-select-icon-color)" }) })));
|
|
33
32
|
}
|
|
34
33
|
exports.CatalogSelectWrapper = styled_components_1.default.div `
|
|
@@ -15,6 +15,7 @@ export type CatalogTableViewProps<T extends BaseEntity> = {
|
|
|
15
15
|
columns?: CatalogColumn<T>[];
|
|
16
16
|
setSortOption: (sortOption: SortOption | null) => void;
|
|
17
17
|
currentSortOption?: SortOption | null;
|
|
18
|
+
onRowClick?: (entity: T) => void;
|
|
18
19
|
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
19
20
|
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
20
21
|
style?: React.CSSProperties;
|
|
@@ -28,4 +29,4 @@ export type CatalogColumn<T> = {
|
|
|
28
29
|
sortable?: boolean;
|
|
29
30
|
sortKey?: string;
|
|
30
31
|
};
|
|
31
|
-
export declare const CatalogTableView: <T extends BaseEntity>({ entities, entitiesCatalogConfig, catalogConfig, columns, setSortOption, currentSortOption, handleSortClick, isColumnSorted, style, }: CatalogTableViewProps<T>) => React.JSX.Element;
|
|
32
|
+
export declare const CatalogTableView: <T extends BaseEntity>({ entities, entitiesCatalogConfig, catalogConfig, columns, setSortOption, currentSortOption, onRowClick, handleSortClick, isColumnSorted, style, }: CatalogTableViewProps<T>) => React.JSX.Element;
|
|
@@ -60,10 +60,10 @@ const baseColumns = [
|
|
|
60
60
|
minWidth: '120px',
|
|
61
61
|
},
|
|
62
62
|
];
|
|
63
|
-
const CatalogTableView = ({ entities, entitiesCatalogConfig, catalogConfig, columns = baseColumns, setSortOption, currentSortOption, handleSortClick, isColumnSorted, style, }) => {
|
|
63
|
+
const CatalogTableView = ({ entities, entitiesCatalogConfig, catalogConfig, columns = baseColumns, setSortOption, currentSortOption, onRowClick, handleSortClick, isColumnSorted, style, }) => {
|
|
64
64
|
return (react_1.default.createElement(CatalogTableWrapper, { "data-component-name": "Catalog/CatalogTableView", style: style },
|
|
65
65
|
react_1.default.createElement(CatalogTableHeader, { columnsWidths: columns.map((column) => column.width || '1fr'), columnsMinWidths: columns.map((column) => column.minWidth || 'auto') }, columns.map((column) => (react_1.default.createElement(CatalogTableHeaderCell_1.CatalogTableHeaderCell, { key: column.key, column: column, setSortOption: setSortOption, currentSortOption: currentSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted })))),
|
|
66
|
-
react_1.default.createElement("div", null, entities.map((entity) => (react_1.default.createElement(CatalogTableViewRow_1.CatalogTableViewRow, { key: entity.id, entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, columns: columns }))))));
|
|
66
|
+
react_1.default.createElement("div", null, entities.map((entity) => (react_1.default.createElement(CatalogTableViewRow_1.CatalogTableViewRow, { key: entity.id, entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, columns: columns, onRowClick: onRowClick }))))));
|
|
67
67
|
};
|
|
68
68
|
exports.CatalogTableView = CatalogTableView;
|
|
69
69
|
const CatalogTableWrapper = styled_components_1.default.div `
|
|
@@ -12,6 +12,7 @@ export type CatalogTableViewRowProps<T extends BaseEntity> = {
|
|
|
12
12
|
entitiesCatalogConfig?: EntitiesCatalogConfig;
|
|
13
13
|
catalogConfig: CatalogEntityConfig;
|
|
14
14
|
columns?: CatalogColumn<T>[];
|
|
15
|
+
onRowClick?: (entity: T) => void;
|
|
15
16
|
};
|
|
16
17
|
export type CatalogColumn<T> = {
|
|
17
18
|
key: string;
|
|
@@ -22,4 +23,4 @@ export type CatalogColumn<T> = {
|
|
|
22
23
|
sortable?: boolean;
|
|
23
24
|
sortKey?: string;
|
|
24
25
|
};
|
|
25
|
-
export declare const CatalogTableViewRow: <T extends BaseEntity>({ entity, entitiesCatalogConfig, catalogConfig, columns, }: CatalogTableViewRowProps<T>) => React.JSX.Element;
|
|
26
|
+
export declare const CatalogTableViewRow: <T extends BaseEntity>({ entity, entitiesCatalogConfig, catalogConfig, columns, onRowClick, }: CatalogTableViewRowProps<T>) => React.JSX.Element;
|
|
@@ -60,14 +60,12 @@ const baseColumns = [
|
|
|
60
60
|
minWidth: '120px',
|
|
61
61
|
},
|
|
62
62
|
];
|
|
63
|
-
const CatalogTableViewRow = ({ entity, entitiesCatalogConfig, catalogConfig, columns = baseColumns, }) => {
|
|
64
|
-
const { getEntityDetailsLink } = (0, hooks_1.
|
|
65
|
-
entityKey: entity.key,
|
|
66
|
-
entityType: entity.type,
|
|
63
|
+
const CatalogTableViewRow = ({ entity, entitiesCatalogConfig, catalogConfig, columns = baseColumns, onRowClick = () => { }, }) => {
|
|
64
|
+
const { getEntityDetailsLink } = (0, hooks_1.useCatalogEntityDetails)({
|
|
67
65
|
catalogConfig,
|
|
68
66
|
entitiesCatalogConfig,
|
|
69
67
|
});
|
|
70
|
-
return (react_1.default.createElement(TableRow, { key: entity.id, "$columnsWidths": columns.map((column) => column.width || '1fr'), "$columnsMinWidths": columns.map((column) => column.minWidth || 'auto'), to: getEntityDetailsLink() + '?search=', style: { color: 'var(--catalog-page-wrapper-text-color)' }, "data-component-name": "Catalog/CatalogTableView/CatalogTableViewRow" }, columns.map((column) => (react_1.default.createElement(TableCell, { key: column.key, className: column.key === 'entity' ? '' : 'tooltip-cell-container' }, column.render(entity))))));
|
|
68
|
+
return (react_1.default.createElement(TableRow, { key: entity.id, "$columnsWidths": columns.map((column) => column.width || '1fr'), "$columnsMinWidths": columns.map((column) => column.minWidth || 'auto'), to: getEntityDetailsLink(entity) + '?search=', onClick: () => onRowClick(entity), style: { color: 'var(--catalog-page-wrapper-text-color)' }, "data-component-name": "Catalog/CatalogTableView/CatalogTableViewRow" }, columns.map((column) => (react_1.default.createElement(TableCell, { key: column.key, className: column.key === 'entity' ? '' : 'tooltip-cell-container' }, column.render(entity))))));
|
|
71
69
|
};
|
|
72
70
|
exports.CatalogTableViewRow = CatalogTableViewRow;
|
|
73
71
|
const TableRow = (0, styled_components_1.default)(Link_1.Link) `
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
2
|
+
import type { BffCatalogEntity } from '../../../core/types';
|
|
3
|
+
type Props = {
|
|
4
|
+
catalogConfig: CatalogEntityConfig;
|
|
5
|
+
entitiesCatalogConfig?: EntitiesCatalogConfig;
|
|
6
|
+
};
|
|
7
|
+
type BaseEntity = Pick<BffCatalogEntity, 'key' | 'type'>;
|
|
8
|
+
export declare function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig }: Props): {
|
|
9
|
+
getEntityDetailsLink: (entity: BaseEntity) => string;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
package/lib/core/hooks/catalog/{use-catalog-table-view-row.js → use-catalog-entity-details.js}
RENAMED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useCatalogEntityDetails = useCatalogEntityDetails;
|
|
4
4
|
const urls_1 = require("../../utils/urls");
|
|
5
|
-
function
|
|
6
|
-
const getCatalogSpecificConfigByEntityTypeIncluded = () => {
|
|
5
|
+
function useCatalogEntityDetails({ catalogConfig, entitiesCatalogConfig }) {
|
|
6
|
+
const getCatalogSpecificConfigByEntityTypeIncluded = (entity) => {
|
|
7
7
|
var _a;
|
|
8
8
|
if (!entitiesCatalogConfig) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
return Object.values((_a = entitiesCatalogConfig.catalogs) !== null && _a !== void 0 ? _a : {}).find((catalog) => {
|
|
12
12
|
var _a;
|
|
13
|
-
return (_a = catalog === null || catalog === void 0 ? void 0 : catalog.includes) === null || _a === void 0 ? void 0 : _a.some((include) => include.type ===
|
|
13
|
+
return (_a = catalog === null || catalog === void 0 ? void 0 : catalog.includes) === null || _a === void 0 ? void 0 : _a.some((include) => include.type === entity.type);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
const getEntityDetailsLink = () => {
|
|
16
|
+
const getEntityDetailsLink = (entity) => {
|
|
17
17
|
const pathPrefix = (0, urls_1.getPathPrefix)();
|
|
18
|
-
const catalogSpecificConfig = getCatalogSpecificConfigByEntityTypeIncluded();
|
|
18
|
+
const catalogSpecificConfig = getCatalogSpecificConfigByEntityTypeIncluded(entity);
|
|
19
19
|
if (!catalogSpecificConfig || !entitiesCatalogConfig) {
|
|
20
|
-
return `${pathPrefix}/catalogs/${catalogConfig.slug}/entities/${
|
|
20
|
+
return `${pathPrefix}/catalogs/${catalogConfig.slug}/entities/${entity.key}`;
|
|
21
21
|
}
|
|
22
|
-
return `${pathPrefix}/catalogs/${catalogSpecificConfig.slug}/entities/${
|
|
22
|
+
return `${pathPrefix}/catalogs/${catalogSpecificConfig.slug}/entities/${entity.key}`;
|
|
23
23
|
};
|
|
24
24
|
return { getEntityDetailsLink };
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=use-catalog-
|
|
26
|
+
//# sourceMappingURL=use-catalog-entity-details.js.map
|
|
@@ -45,6 +45,6 @@ export * from './use-user-teams';
|
|
|
45
45
|
export * from './use-page-actions';
|
|
46
46
|
export * from './use-mcp-config';
|
|
47
47
|
export * from './use-connect-mcp-button';
|
|
48
|
-
export * from './catalog/use-catalog-
|
|
48
|
+
export * from './catalog/use-catalog-entity-details';
|
|
49
49
|
export * from './catalog/use-catalog-entity-schema';
|
|
50
50
|
export * from './catalog/use-catalog-table-header-cell-actions';
|
package/lib/core/hooks/index.js
CHANGED
|
@@ -61,7 +61,7 @@ __exportStar(require("./use-user-teams"), exports);
|
|
|
61
61
|
__exportStar(require("./use-page-actions"), exports);
|
|
62
62
|
__exportStar(require("./use-mcp-config"), exports);
|
|
63
63
|
__exportStar(require("./use-connect-mcp-button"), exports);
|
|
64
|
-
__exportStar(require("./catalog/use-catalog-
|
|
64
|
+
__exportStar(require("./catalog/use-catalog-entity-details"), exports);
|
|
65
65
|
__exportStar(require("./catalog/use-catalog-entity-schema"), exports);
|
|
66
66
|
__exportStar(require("./catalog/use-catalog-table-header-cell-actions"), exports);
|
|
67
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { ENTITY_RELATION_TYPES } from '@redocly/config';
|
|
3
|
-
import type { CatalogEntityConfig, LayoutVariant } from '@redocly/config';
|
|
3
|
+
import type { CatalogEntityConfig, EntitiesCatalogConfig, LayoutVariant } from '@redocly/config';
|
|
4
4
|
import type { CatalogFilterConfig } from '../../config';
|
|
5
5
|
export type SortOption = 'title' | '-title' | 'type' | '-type';
|
|
6
|
+
export type FilterResult = {
|
|
7
|
+
value: string;
|
|
8
|
+
count: number;
|
|
9
|
+
};
|
|
10
|
+
export type CatalogFiltersWithCounts = Record<string, FilterResult[]>;
|
|
11
|
+
export type UseCatalogProps = {
|
|
12
|
+
config?: CatalogEntityConfig;
|
|
13
|
+
entitiesCatalogConfig?: EntitiesCatalogConfig;
|
|
14
|
+
serverFilters?: CatalogFiltersWithCounts;
|
|
15
|
+
entitiesCounterInitial?: number;
|
|
16
|
+
initialViewMode?: CatalogViewMode;
|
|
17
|
+
};
|
|
6
18
|
export type UseCatalogResponse = {
|
|
7
19
|
filters: ResolvedFilter[];
|
|
8
20
|
filterQuery: string;
|
|
@@ -21,6 +33,10 @@ export type UseCatalogResponse = {
|
|
|
21
33
|
layout: LayoutVariant;
|
|
22
34
|
collapsedSidebar: boolean;
|
|
23
35
|
};
|
|
36
|
+
export type UseCatalogFetchCatalogEntities = (params: CatalogApiParams, initialData?: BffCatalogEntityList) => CatalogApiResults<BffCatalogEntity>;
|
|
37
|
+
export type UseCatalogFetchCatalogEntitiesRelations = (params: CatalogApiParams & {
|
|
38
|
+
entityKey: string;
|
|
39
|
+
}, initialData?: BffCatalogRelatedEntityList) => CatalogApiResults<BffCatalogRelatedEntity>;
|
|
24
40
|
export type UseCatalogSortResponse = {
|
|
25
41
|
sortOption: SortOption | null;
|
|
26
42
|
setSortOption: (option: SortOption | null) => void;
|
|
@@ -83,8 +99,8 @@ export type CatalogItem = {
|
|
|
83
99
|
[k: string]: unknown;
|
|
84
100
|
};
|
|
85
101
|
export type DefaultCatalogSlug = 'services' | 'users' | 'teams' | 'domains' | 'api-descriptions' | 'all';
|
|
86
|
-
export type CatalogApiResults<T
|
|
87
|
-
query: UseInfiniteQueryResult<InfiniteData<
|
|
102
|
+
export type CatalogApiResults<T> = {
|
|
103
|
+
query: UseInfiniteQueryResult<InfiniteData<BffCatalogList<T>, unknown>, Error>;
|
|
88
104
|
items: T[];
|
|
89
105
|
total: number;
|
|
90
106
|
};
|
|
@@ -158,16 +174,13 @@ export type BffCatalogEntity = {
|
|
|
158
174
|
readonly createdAt: string;
|
|
159
175
|
readonly updatedAt: string;
|
|
160
176
|
};
|
|
161
|
-
export type
|
|
162
|
-
object: 'list';
|
|
163
|
-
page: Page;
|
|
164
|
-
items: Array<BffCatalogEntity>;
|
|
165
|
-
};
|
|
166
|
-
export type BffCatalogRelatedEntityList = {
|
|
177
|
+
export type BffCatalogList<T> = {
|
|
167
178
|
object: 'list';
|
|
168
179
|
page: Page;
|
|
169
|
-
items: Array<
|
|
180
|
+
items: Array<T>;
|
|
170
181
|
};
|
|
182
|
+
export type BffCatalogEntityList = BffCatalogList<BffCatalogEntity>;
|
|
183
|
+
export type BffCatalogRelatedEntityList = BffCatalogList<BffCatalogRelatedEntity>;
|
|
171
184
|
export type Page = {
|
|
172
185
|
endCursor: string | null;
|
|
173
186
|
startCursor: string | null;
|