@redocly/theme 0.57.0-next.0 → 0.57.0-next.2
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/CatalogCardView/CatalogCard.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +36 -25
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.js +38 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +83 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.d.ts +2 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +29 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.d.ts +8 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.js +33 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.d.ts +16 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.js +24 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.js +30 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +5 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +7 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +3 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +22 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.js +18 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +2 -2
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityIcon.js +4 -6
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +1 -1
- package/lib/components/Catalog/variables.js +42 -0
- package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.js +13 -8
- package/lib/core/constants/catalog.d.ts +10 -0
- package/lib/core/constants/catalog.js +14 -1
- package/lib/core/hooks/__mocks__/search/use-recent-searches.d.ts +2 -2
- package/lib/core/hooks/__mocks__/search/use-recent-searches.js +2 -1
- package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +2 -2
- package/lib/core/hooks/__mocks__/search/use-search-filter.js +2 -1
- package/lib/core/hooks/__mocks__/search/use-suggested-pages.d.ts +2 -2
- package/lib/core/hooks/__mocks__/search/use-suggested-pages.js +2 -1
- package/lib/core/hooks/__mocks__/use-controlled-state.d.ts +1 -1
- package/lib/core/hooks/__mocks__/use-controlled-state.js +2 -1
- package/lib/core/hooks/__mocks__/use-input-key-commands.d.ts +3 -3
- package/lib/core/hooks/__mocks__/use-input-key-commands.js +3 -2
- package/lib/core/hooks/__mocks__/use-mobile-menu.d.ts +1 -1
- package/lib/core/hooks/__mocks__/use-mobile-menu.js +2 -1
- package/lib/core/hooks/__mocks__/use-theme-config.d.ts +2 -2
- package/lib/core/hooks/__mocks__/use-theme-config.js +2 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +47 -47
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +38 -37
- package/lib/core/hooks/__mocks__/use-time-ago.d.ts +2 -2
- package/lib/core/hooks/__mocks__/use-time-ago.js +2 -1
- package/lib/core/hooks/catalog/useGraph.d.ts +15 -0
- package/lib/core/hooks/catalog/useGraph.js +165 -0
- package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.js +4 -3
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.d.ts +1 -1
- package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.js +2 -1
- package/lib/core/hooks/use-page-actions.js +5 -1
- package/lib/core/openapi/index.d.ts +1 -0
- package/lib/core/openapi/index.js +3 -1
- package/lib/core/styles/index.d.ts +1 -0
- package/lib/core/styles/index.js +3 -0
- package/lib/core/styles/xyflow.d.ts +1 -0
- package/lib/core/styles/xyflow.js +623 -0
- package/lib/core/utils/dynamic.d.ts +9 -0
- package/lib/core/utils/dynamic.js +59 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/icons/GenericIcon/GenericIcon.d.ts +2 -2
- package/lib/icons/GenericIcon/GenericIcon.js +8 -3
- package/lib/icons/__tests__/IconTestUtils.d.ts +0 -1
- package/lib/icons/__tests__/IconTestUtils.js +8 -7
- package/package.json +11 -14
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +60 -42
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.tsx +63 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.tsx +7 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +91 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.tsx +48 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.tsx +45 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.tsx +49 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +6 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +8 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +24 -43
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +76 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +2 -2
- package/src/components/Catalog/CatalogEntityIcon.tsx +7 -5
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +1 -1
- package/src/components/Catalog/variables.ts +42 -0
- package/src/components/CatalogClassic/CatalogClassicVirtualizedGroups.tsx +29 -18
- package/src/core/constants/catalog.ts +13 -0
- package/src/core/hooks/__mocks__/search/use-recent-searches.ts +3 -1
- package/src/core/hooks/__mocks__/search/use-search-filter.ts +3 -1
- package/src/core/hooks/__mocks__/search/use-suggested-pages.ts +3 -1
- package/src/core/hooks/__mocks__/use-controlled-state.ts +3 -1
- package/src/core/hooks/__mocks__/use-input-key-commands.ts +4 -2
- package/src/core/hooks/__mocks__/use-mobile-menu.ts +3 -1
- package/src/core/hooks/__mocks__/use-theme-config.ts +3 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +39 -37
- package/src/core/hooks/__mocks__/use-time-ago.ts +3 -1
- package/src/core/hooks/catalog/useGraph.ts +236 -0
- package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +5 -3
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/menu/__mocks__/use-mobile-menu-items.ts +3 -1
- package/src/core/hooks/use-page-actions.ts +5 -1
- package/src/core/openapi/index.ts +1 -0
- package/src/core/styles/index.ts +1 -0
- package/src/core/styles/xyflow.ts +620 -0
- package/src/core/utils/dynamic.tsx +85 -0
- package/src/core/utils/index.ts +1 -0
- package/src/icons/GenericIcon/GenericIcon.tsx +13 -4
- package/src/icons/__tests__/IconTestUtils.tsx +5 -4
|
@@ -121,6 +121,7 @@ const ArrowCircle = styled_components_1.default.div `
|
|
|
121
121
|
`;
|
|
122
122
|
const CardContent = styled_components_1.default.div `
|
|
123
123
|
padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
|
|
124
|
+
height: 100%;
|
|
124
125
|
`;
|
|
125
126
|
const CardFooter = styled_components_1.default.div `
|
|
126
127
|
height: var(--catalog-card-footer-height);
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CatalogEntity = CatalogEntity;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
9
10
|
const utils_1 = require("../../../core/utils");
|
|
10
11
|
const ArrowLeftIcon_1 = require("../../../icons/ArrowLeftIcon/ArrowLeftIcon");
|
|
11
12
|
const CatalogPageDescription_1 = require("../../../components/Catalog/CatalogPageDescription");
|
|
@@ -21,6 +22,17 @@ const hooks_1 = require("../../../core/hooks");
|
|
|
21
22
|
const SidebarActions_1 = require("../../../components/SidebarActions/SidebarActions");
|
|
22
23
|
const CatalogEntitySchema_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntitySchema");
|
|
23
24
|
const CatalogEntityMethodAndPath_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityMethodAndPath");
|
|
25
|
+
const CatalogEntityRelationsGraph_lazy_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy");
|
|
26
|
+
const renderEntityContent = (entity) => {
|
|
27
|
+
switch (entity.type) {
|
|
28
|
+
case 'data-schema':
|
|
29
|
+
return react_1.default.createElement(CatalogEntitySchema_1.CatalogEntitySchema, { entity: entity });
|
|
30
|
+
case 'api-operation':
|
|
31
|
+
return react_1.default.createElement(CatalogEntityMethodAndPath_1.CatalogEntityMethodAndPath, { entity: entity });
|
|
32
|
+
default:
|
|
33
|
+
return react_1.default.createElement(CatalogEntityMetadata_1.CatalogEntityMetadata, { entity: entity });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
24
36
|
function CatalogEntity({ entity, entitiesCatalogConfig, catalogConfig, initialRelations, }) {
|
|
25
37
|
var _a;
|
|
26
38
|
const { useTranslate, useCatalog } = (0, hooks_1.useThemeHooks)();
|
|
@@ -28,38 +40,37 @@ function CatalogEntity({ entity, entitiesCatalogConfig, catalogConfig, initialRe
|
|
|
28
40
|
const linkToMainCatalog = `catalogs/${catalogConfig.slug}`;
|
|
29
41
|
const linkToMainCatalogLabel = translate(catalogConfig.titleTranslationKey);
|
|
30
42
|
const { layout, collapsedSidebar, onChangeViewClick, onChangeCollapseSidebarClick, searchQuery, setSearchQuery, } = useCatalog();
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
44
|
+
const linkBase = `${linkToMainCatalog}/entities/${entity.key}`;
|
|
45
|
+
const menuItemDefs = [
|
|
46
|
+
{ label: 'Overview', path: linkBase, end: true },
|
|
47
|
+
{ label: 'Relations Graph', path: `${linkBase}/relations-graph`, end: true },
|
|
48
|
+
];
|
|
49
|
+
const sidebarMenuItems = menuItemDefs.map(({ label, path, end }) => ({
|
|
50
|
+
label,
|
|
51
|
+
link: path,
|
|
52
|
+
active: Boolean((0, react_router_dom_1.matchPath)({ path: `/${path}`, end }, pathname)),
|
|
53
|
+
items: [],
|
|
54
|
+
hasActiveSubItem: false,
|
|
55
|
+
}));
|
|
41
56
|
return (react_1.default.createElement(CatalogPageWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntity" },
|
|
42
|
-
react_1.default.createElement(CatalogSidebar, { collapsed: collapsedSidebar, header: react_1.default.createElement(BackLink, { icon: react_1.default.createElement(ArrowLeftIcon_1.ArrowLeftIcon, null), iconPosition: "left", variant: "ghost", size: "medium", "data-component-name": "Sidebar/BackButton", to: linkToMainCatalog }, collapsedSidebar ? ('') : (react_1.default.createElement("div", { "data-translation-key": "sidebar.menu.backLabel" }, translate('sidebar.menu.backLabel')))), menu: react_1.default.createElement(Menu_1.Menu, { items:
|
|
43
|
-
{
|
|
44
|
-
label: 'Overview',
|
|
45
|
-
link: `${linkToMainCatalog}/entities/${entity.key}`,
|
|
46
|
-
active: true,
|
|
47
|
-
items: [],
|
|
48
|
-
hasActiveSubItem: false,
|
|
49
|
-
},
|
|
50
|
-
] }), footer: react_1.default.createElement(SidebarActions_1.SidebarActions, { layout: layout, collapsedSidebar: collapsedSidebar, isApiDocs: false, onChangeViewClick: onChangeViewClick, onChangeCollapseSidebarClick: onChangeCollapseSidebarClick }) }),
|
|
57
|
+
react_1.default.createElement(CatalogSidebar, { collapsed: collapsedSidebar, header: react_1.default.createElement(BackLink, { icon: react_1.default.createElement(ArrowLeftIcon_1.ArrowLeftIcon, null), iconPosition: "left", variant: "ghost", size: "medium", "data-component-name": "Sidebar/BackButton", to: linkToMainCatalog }, collapsedSidebar ? ('') : (react_1.default.createElement("div", { "data-translation-key": "sidebar.menu.backLabel" }, translate('sidebar.menu.backLabel')))), menu: react_1.default.createElement(Menu_1.Menu, { items: sidebarMenuItems }), footer: react_1.default.createElement(SidebarActions_1.SidebarActions, { layout: layout, collapsedSidebar: collapsedSidebar, isApiDocs: false, onChangeViewClick: onChangeViewClick, onChangeCollapseSidebarClick: onChangeCollapseSidebarClick }) }),
|
|
51
58
|
react_1.default.createElement(CatalogPageContent, null,
|
|
52
59
|
react_1.default.createElement(Breadcrumbs_1.Breadcrumbs, { additionalBreadcrumbs: [
|
|
53
60
|
{ label: linkToMainCatalogLabel, link: linkToMainCatalog },
|
|
54
61
|
{ label: entity.title },
|
|
55
62
|
] }),
|
|
56
63
|
react_1.default.createElement(CatalogEntityPageWrapper, null,
|
|
57
|
-
react_1.default.createElement(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
react_1.default.createElement(react_router_dom_1.Routes, null,
|
|
65
|
+
react_1.default.createElement(react_router_dom_1.Route, { path: `${catalogConfig.slug}/entities/${entity.key}` },
|
|
66
|
+
react_1.default.createElement(react_router_dom_1.Route, { index: true, element: react_1.default.createElement(react_1.default.Fragment, null,
|
|
67
|
+
react_1.default.createElement(CatalogPageDescription_1.CatalogPageDescription, { title: entity.title, description: (_a = entity.summary) !== null && _a !== void 0 ? _a : '', tag: entity.key }),
|
|
68
|
+
react_1.default.createElement(CatalogEntityProperties_1.CatalogEntityProperties, { entity: entity }),
|
|
69
|
+
react_1.default.createElement(CatalogTwoColumnsSection, null,
|
|
70
|
+
renderEntityContent(entity),
|
|
71
|
+
react_1.default.createElement(CatalogEntityLinks_1.CatalogEntityLinks, { entity: entity })),
|
|
72
|
+
react_1.default.createElement(CatalogEntityRelations_1.CatalogEntityRelations, { entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, initialRelations: initialRelations, searchQuery: searchQuery, setSearchQuery: setSearchQuery })) }),
|
|
73
|
+
react_1.default.createElement(react_router_dom_1.Route, { path: "relations-graph", element: react_1.default.createElement(CatalogEntityRelationsGraph_lazy_1.CatalogEntityRelationsGraph, { entity: entity }) })))))));
|
|
63
74
|
}
|
|
64
75
|
const CatalogPageWrapper = styled_components_1.default.div `
|
|
65
76
|
--sidebar-width: var(--catalog-sidebar-width);
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type EdgeProps } from '@xyflow/react';
|
|
3
|
+
export type CatalogEntityRelationsEdgeProps = EdgeProps & {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function CatalogEntityRelationsEdge(props: CatalogEntityRelationsEdgeProps): React.ReactElement;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogEntityRelationsEdge = CatalogEntityRelationsEdge;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_2 = require("@xyflow/react");
|
|
9
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
+
function CatalogEntityRelationsEdge(props) {
|
|
11
|
+
const { id, sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, style, label, markerEnd, className, } = props;
|
|
12
|
+
const [edgePath, labelX, labelY] = (0, react_2.getSmoothStepPath)({
|
|
13
|
+
sourceX,
|
|
14
|
+
sourceY,
|
|
15
|
+
sourcePosition,
|
|
16
|
+
targetX,
|
|
17
|
+
targetY,
|
|
18
|
+
targetPosition,
|
|
19
|
+
borderRadius: 12,
|
|
20
|
+
});
|
|
21
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
22
|
+
react_1.default.createElement(react_2.BaseEdge, { id: id, path: edgePath, style: style, markerEnd: markerEnd }),
|
|
23
|
+
label ? (react_1.default.createElement(react_2.EdgeLabelRenderer, null,
|
|
24
|
+
react_1.default.createElement(EdgeLabel, { className: className ? `nopan ${className}` : 'nopan', style: { transform: `translate(-50%, 0%) translate(${labelX}px, ${labelY - 10}px)` }, "data-component-name": "Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge" }, label))) : null));
|
|
25
|
+
}
|
|
26
|
+
const EdgeLabel = styled_components_1.default.div `
|
|
27
|
+
position: absolute;
|
|
28
|
+
background: var(--catalog-entity-relations-edge-label-bg-color);
|
|
29
|
+
color: var(--catalog-entity-relations-edge-label-text-color);
|
|
30
|
+
border: var(--catalog-entity-relations-edge-label-border-width)
|
|
31
|
+
var(--catalog-entity-relations-edge-label-border-style)
|
|
32
|
+
var(--catalog-entity-relations-edge-label-border-color);
|
|
33
|
+
border-radius: var(--catalog-entity-relations-edge-label-border-radius);
|
|
34
|
+
padding: var(--catalog-entity-relations-edge-label-padding);
|
|
35
|
+
font-size: var(--catalog-entity-relations-edge-label-font-size);
|
|
36
|
+
line-height: var(--catalog-entity-relations-edge-label-line-height);
|
|
37
|
+
`;
|
|
38
|
+
//# sourceMappingURL=CatalogEntityRelationsEdge.js.map
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { BffCatalogEntity } from '../../../../core/types';
|
|
3
|
+
export type CatalogEntityRelationsGraphProps = {
|
|
4
|
+
entity: BffCatalogEntity;
|
|
5
|
+
};
|
|
6
|
+
export declare function CatalogEntityRelationsGraph({ entity, }: CatalogEntityRelationsGraphProps): JSX.Element;
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.CatalogEntityRelationsGraph = CatalogEntityRelationsGraph;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const react_2 = require("@xyflow/react");
|
|
32
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
33
|
+
const hooks_1 = require("../../../../core/hooks");
|
|
34
|
+
const useGraph_1 = require("../../../../core/hooks/catalog/useGraph");
|
|
35
|
+
const CatalogEntityRelationsNode_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode");
|
|
36
|
+
const CatalogEntityRelationsEdge_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsEdge");
|
|
37
|
+
const styles_1 = require("../../../../core/styles");
|
|
38
|
+
const CatalogPageDescription_1 = require("../../../../components/Catalog/CatalogPageDescription");
|
|
39
|
+
const catalog_1 = require("../../../../core/constants/catalog");
|
|
40
|
+
const commonReactFlowConfig = {
|
|
41
|
+
fitView: true,
|
|
42
|
+
proOptions: {
|
|
43
|
+
hideAttribution: true,
|
|
44
|
+
},
|
|
45
|
+
style: {
|
|
46
|
+
border: 'var(--catalog-card-border-width) var(--catalog-card-border-style) var(--catalog-card-border-color)',
|
|
47
|
+
borderRadius: 'var(--catalog-card-border-radius, 8px)',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
function CatalogEntityRelationsGraph({ entity, }) {
|
|
51
|
+
var _a;
|
|
52
|
+
const { useFetchCatalogEntitiesRelations } = (0, hooks_1.useThemeHooks)();
|
|
53
|
+
const { activeColorMode } = (0, hooks_1.useColorSwitcher)();
|
|
54
|
+
const { items: allRelations } = useFetchCatalogEntitiesRelations({
|
|
55
|
+
entityKey: entity.key,
|
|
56
|
+
});
|
|
57
|
+
const { nodes, edges, onNodesChange, onEdgesChange, onConnect } = (0, useGraph_1.useGraph)({
|
|
58
|
+
entity,
|
|
59
|
+
relations: allRelations !== null && allRelations !== void 0 ? allRelations : [],
|
|
60
|
+
});
|
|
61
|
+
const nodeTypes = (0, react_1.useMemo)(() => ({ [catalog_1.GraphCustomNodeType.CatalogEntity]: CatalogEntityRelationsNode_1.CatalogEntityRelationsNode }), []);
|
|
62
|
+
const edgeTypes = (0, react_1.useMemo)(() => ({ [catalog_1.GraphCustomEdgeType.CatalogEdge]: CatalogEntityRelationsEdge_1.CatalogEntityRelationsEdge }), []);
|
|
63
|
+
const reactFlowConfig = allRelations.length
|
|
64
|
+
? Object.assign({ key: entity.id, nodes,
|
|
65
|
+
edges,
|
|
66
|
+
nodeTypes,
|
|
67
|
+
edgeTypes,
|
|
68
|
+
onNodesChange,
|
|
69
|
+
onEdgesChange,
|
|
70
|
+
onConnect, colorMode: activeColorMode }, commonReactFlowConfig) : Object.assign({}, commonReactFlowConfig);
|
|
71
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
72
|
+
react_1.default.createElement(CatalogPageDescription_1.CatalogPageDescription, { title: entity.title, description: (_a = entity.summary) !== null && _a !== void 0 ? _a : '', tag: entity.key }),
|
|
73
|
+
react_1.default.createElement(GraphWrapper, null,
|
|
74
|
+
react_1.default.createElement(react_2.ReactFlow, Object.assign({}, reactFlowConfig),
|
|
75
|
+
react_1.default.createElement(react_2.Background, { bgColor: "var(--catalog-card-bg-color)" }),
|
|
76
|
+
react_1.default.createElement(react_2.Controls, null)))));
|
|
77
|
+
}
|
|
78
|
+
const GraphWrapper = styled_components_1.default.div `
|
|
79
|
+
height: 700px;
|
|
80
|
+
width: 100%;
|
|
81
|
+
${styles_1.xyflow}
|
|
82
|
+
`;
|
|
83
|
+
//# sourceMappingURL=CatalogEntityRelationsGraph.js.map
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.CatalogEntityRelationsGraph = void 0;
|
|
27
|
+
const utils_1 = require("../../../../core/utils");
|
|
28
|
+
exports.CatalogEntityRelationsGraph = (0, utils_1.dynamic)(() => Promise.resolve().then(() => __importStar(require('./CatalogEntityRelationsGraph'))).then((mod) => mod.CatalogEntityRelationsGraph));
|
|
29
|
+
//# sourceMappingURL=CatalogEntityRelationsGraph.lazy.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type CatalogEntityRelationsLinkedNodeProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
entityType: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
to: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function CatalogEntityRelationsLinkedNode({ label, entityType, className, to, }: CatalogEntityRelationsLinkedNodeProps): React.ReactElement;
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogEntityRelationsLinkedNode = CatalogEntityRelationsLinkedNode;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_2 = require("@xyflow/react");
|
|
9
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
+
const CatalogEntityIcon_1 = require("../../../../components/Catalog/CatalogEntityIcon");
|
|
11
|
+
const Link_1 = require("../../../../components/Link/Link");
|
|
12
|
+
const catalog_1 = require("../../../../core/constants/catalog");
|
|
13
|
+
function CatalogEntityRelationsLinkedNode({ label, entityType, className, to, }) {
|
|
14
|
+
return (react_1.default.createElement(RelationsLinkedNodeWrapper, { className: className, to: to, "data-component-name": "Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode" },
|
|
15
|
+
react_1.default.createElement(react_2.Handle, { type: catalog_1.GraphHandleType.Target, position: react_2.Position.Top, id: catalog_1.GraphHandleType.Target }),
|
|
16
|
+
react_1.default.createElement(CatalogEntityIcon_1.CatalogEntityIcon, { entityType: entityType, defaultColor: false }),
|
|
17
|
+
react_1.default.createElement("div", null, label)));
|
|
18
|
+
}
|
|
19
|
+
const RelationsLinkedNodeWrapper = (0, styled_components_1.default)(Link_1.Link) `
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: var(--catalog-entity-relations-node-gap);
|
|
23
|
+
padding: var(--catalog-entity-relations-node-padding);
|
|
24
|
+
border-radius: var(--catalog-entity-relations-node-border-radius);
|
|
25
|
+
font-style: normal;
|
|
26
|
+
font-weight: var(--catalog-entity-relations-node-font-weight);
|
|
27
|
+
background: var(--catalog-entity-relations-node-bg-color);
|
|
28
|
+
color: var(--catalog-entity-relations-node-text-color);
|
|
29
|
+
border: var(--catalog-entity-relations-node-border-width)
|
|
30
|
+
var(--catalog-entity-relations-node-border-style)
|
|
31
|
+
var(--catalog-entity-relations-node-border-color);
|
|
32
|
+
`;
|
|
33
|
+
//# sourceMappingURL=CatalogEntityRelationsLinkedNode.js.map
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsNode.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type CatalogEntityNodeData = {
|
|
3
|
+
label: string;
|
|
4
|
+
entityType: string;
|
|
5
|
+
entityKey: string;
|
|
6
|
+
isRoot?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type CatalogEntityRelationsNodeProps = {
|
|
9
|
+
data: CatalogEntityNodeData;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare enum HandleType {
|
|
13
|
+
Target = "target",
|
|
14
|
+
Source = "source"
|
|
15
|
+
}
|
|
16
|
+
export declare function CatalogEntityRelationsNode({ data, className, }: CatalogEntityRelationsNodeProps): React.ReactElement;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HandleType = void 0;
|
|
7
|
+
exports.CatalogEntityRelationsNode = CatalogEntityRelationsNode;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const CatalogEntityRelationsRootNode_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode");
|
|
10
|
+
const CatalogEntityRelationsLinkedNode_1 = require("../../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsLinkedNode");
|
|
11
|
+
var HandleType;
|
|
12
|
+
(function (HandleType) {
|
|
13
|
+
HandleType["Target"] = "target";
|
|
14
|
+
HandleType["Source"] = "source";
|
|
15
|
+
})(HandleType || (exports.HandleType = HandleType = {}));
|
|
16
|
+
function CatalogEntityRelationsNode({ data, className, }) {
|
|
17
|
+
const { label, entityType, isRoot, entityKey } = data;
|
|
18
|
+
const mergedClassName = `nopan${className ? ` ${className}` : ''}`;
|
|
19
|
+
if (isRoot) {
|
|
20
|
+
return (react_1.default.createElement(CatalogEntityRelationsRootNode_1.CatalogEntityRelationsRootNode, { className: mergedClassName, label: label, entityType: entityType }));
|
|
21
|
+
}
|
|
22
|
+
return (react_1.default.createElement(CatalogEntityRelationsLinkedNode_1.CatalogEntityRelationsLinkedNode, { className: mergedClassName, label: label, entityType: entityType, to: `/catalogs/all/entities/${entityKey}` }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=CatalogEntityRelationsNode.js.map
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type CatalogEntityRelationsRootNodeProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
entityType: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function CatalogEntityRelationsRootNode({ label, entityType, className, }: CatalogEntityRelationsRootNodeProps): React.ReactElement;
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogEntityRelationsRootNode = CatalogEntityRelationsRootNode;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_2 = require("@xyflow/react");
|
|
9
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
10
|
+
const CatalogEntityIcon_1 = require("../../../../components/Catalog/CatalogEntityIcon");
|
|
11
|
+
const catalog_1 = require("../../../../core/constants/catalog");
|
|
12
|
+
function CatalogEntityRelationsRootNode({ label, entityType, className, }) {
|
|
13
|
+
return (react_1.default.createElement(RelationsRootNodeWrapper, { className: className, "data-component-name": "Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsRootNode" },
|
|
14
|
+
react_1.default.createElement(CatalogEntityIcon_1.CatalogEntityIcon, { entityType: entityType, forceColor: "var(--catalog-entity-relations-node-root-icon-color)" }),
|
|
15
|
+
react_1.default.createElement("div", null, label),
|
|
16
|
+
react_1.default.createElement(react_2.Handle, { type: catalog_1.GraphHandleType.Source, position: react_2.Position.Bottom, id: catalog_1.GraphHandleType.Source })));
|
|
17
|
+
}
|
|
18
|
+
const RelationsRootNodeWrapper = styled_components_1.default.div `
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: var(--catalog-entity-relations-node-gap);
|
|
22
|
+
padding: var(--catalog-entity-relations-node-padding);
|
|
23
|
+
border-radius: var(--catalog-entity-relations-node-border-radius);
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: var(--catalog-entity-relations-node-font-weight-root);
|
|
26
|
+
background: var(--catalog-entity-relations-node-root-bg-color);
|
|
27
|
+
color: var(--catalog-entity-relations-node-root-text-color);
|
|
28
|
+
border: none;
|
|
29
|
+
`;
|
|
30
|
+
//# sourceMappingURL=CatalogEntityRelationsRootNode.js.map
|
|
@@ -19,12 +19,14 @@ function CatalogEntityMethodAndPath({ entity }) {
|
|
|
19
19
|
react_1.default.createElement(Heading, null, "Method & Path"),
|
|
20
20
|
react_1.default.createElement(CatalogEntityInfoBar_1.CatalogEntityInfoBar, { leftContent: react_1.default.createElement(Label, null,
|
|
21
21
|
react_1.default.createElement(MethodTag, { color: method.toLowerCase() }, method),
|
|
22
|
-
path), withSeparator: false })));
|
|
22
|
+
react_1.default.createElement(PathLabel, null, path)), withSeparator: false })));
|
|
23
23
|
}
|
|
24
24
|
const MethodTag = (0, styled_components_1.default)(HttpTag_1.HttpTag) `
|
|
25
25
|
width: auto;
|
|
26
26
|
justify-content: start;
|
|
27
|
-
|
|
27
|
+
`;
|
|
28
|
+
const PathLabel = styled_components_1.default.label `
|
|
29
|
+
margin-left: var(--spacing-xxs);
|
|
28
30
|
`;
|
|
29
31
|
const LinksWrapper = styled_components_1.default.div `
|
|
30
32
|
display: flex;
|
|
@@ -37,6 +39,7 @@ const LinksWrapper = styled_components_1.default.div `
|
|
|
37
39
|
`;
|
|
38
40
|
const Label = styled_components_1.default.div `
|
|
39
41
|
display: flex;
|
|
42
|
+
width: 100%;
|
|
40
43
|
`;
|
|
41
44
|
const Heading = styled_components_1.default.h2 `
|
|
42
45
|
margin-bottom: var(--spacing-sm);
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type CatalogEntityRelationsProps = {
|
|
|
6
6
|
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
7
7
|
catalogConfig: CatalogEntityConfig;
|
|
8
8
|
initialRelations: BffCatalogRelatedEntityList;
|
|
9
|
+
initialFilter?: string;
|
|
9
10
|
searchQuery: string;
|
|
10
11
|
setSearchQuery: (query: string) => void;
|
|
11
12
|
};
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js
CHANGED
|
@@ -33,11 +33,15 @@ const ENTITY_DEFAULT_FILTERS = {
|
|
|
33
33
|
team: 'type:user',
|
|
34
34
|
};
|
|
35
35
|
function CatalogEntityRelations({ entity, entitiesCatalogConfig, initialRelations, catalogConfig, searchQuery, setSearchQuery, }) {
|
|
36
|
-
var _a;
|
|
37
36
|
const { useCatalogSort, useFetchCatalogEntitiesRelations } = (0, hooks_1.useThemeHooks)();
|
|
38
37
|
const { sortOption, setSortOption, handleSortClick, isColumnSorted } = useCatalogSort();
|
|
39
|
-
const [filter, setFilter] = (0, react_1.useState)(
|
|
40
|
-
const { items: relations, query } = useFetchCatalogEntitiesRelations({
|
|
38
|
+
const [filter, setFilter] = (0, react_1.useState)();
|
|
39
|
+
const { items: relations, query } = useFetchCatalogEntitiesRelations({
|
|
40
|
+
entityKey: entity.key,
|
|
41
|
+
search: searchQuery,
|
|
42
|
+
sort: sortOption !== null && sortOption !== void 0 ? sortOption : undefined,
|
|
43
|
+
filter: filter !== null && filter !== void 0 ? filter : ENTITY_DEFAULT_FILTERS[entity.type],
|
|
44
|
+
}, initialRelations);
|
|
41
45
|
const shouldShowLoadMore = query.hasNextPage ||
|
|
42
46
|
(query.isPlaceholderData && relations && relations.length >= LOAD_MORE_THRESHOLD);
|
|
43
47
|
switch (entity.type) {
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js
CHANGED
|
@@ -6,18 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CatalogEntityRelationsTable = CatalogEntityRelationsTable;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
-
const ArrowDownIcon_1 = require("../../../../icons/ArrowDownIcon/ArrowDownIcon");
|
|
10
|
-
const LoadMore_1 = require("../../../../components/LoadMore/LoadMore");
|
|
11
|
-
const CatalogTableView_1 = require("../../../../components/Catalog/CatalogTableView/CatalogTableView");
|
|
12
9
|
const CatalogActionsRow_1 = require("../../../../components/Catalog/CatalogActionsRow");
|
|
13
|
-
const
|
|
14
|
-
const CatalogEntitiesEmptyState_1 = require("../../../../components/Catalog/CatalogEntitiesEmptyState");
|
|
10
|
+
const CatalogEntityRelationsTableContent_1 = require("./CatalogEntityRelationsTableContent");
|
|
15
11
|
function CatalogEntityRelationsTable({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, setSearchQuery, heading, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }) {
|
|
16
12
|
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable" },
|
|
17
13
|
heading && react_1.default.createElement(Heading, null, heading),
|
|
18
|
-
|
|
19
|
-
react_1.default.createElement(
|
|
20
|
-
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' }))));
|
|
14
|
+
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 })));
|
|
21
16
|
}
|
|
22
17
|
const Heading = styled_components_1.default.h2 `
|
|
23
18
|
margin: var(--spacing-base) 0;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
3
|
+
import { BffCatalogRelatedEntity, SortOption } from '../../../../core/types';
|
|
4
|
+
import { CatalogColumn } from '../../../../components/Catalog/CatalogTableView/CatalogTableView';
|
|
5
|
+
export type CatalogEntityRelationsTableContentProps = {
|
|
6
|
+
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
7
|
+
catalogConfig: CatalogEntityConfig;
|
|
8
|
+
relations: BffCatalogRelatedEntity[];
|
|
9
|
+
query: {
|
|
10
|
+
fetchNextPage: () => void;
|
|
11
|
+
isFetchingNextPage: boolean;
|
|
12
|
+
};
|
|
13
|
+
searchQuery: string;
|
|
14
|
+
columns: CatalogColumn<BffCatalogRelatedEntity>[];
|
|
15
|
+
sortOption: SortOption | null;
|
|
16
|
+
setSortOption: (sortOption: SortOption | null) => void;
|
|
17
|
+
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
18
|
+
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
19
|
+
shouldShowLoadMore: boolean;
|
|
20
|
+
listType?: 'default' | 'team';
|
|
21
|
+
};
|
|
22
|
+
export declare function CatalogEntityRelationsTableContent({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }: CatalogEntityRelationsTableContentProps): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CatalogEntityRelationsTableContent = CatalogEntityRelationsTableContent;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ArrowDownIcon_1 = require("../../../../icons/ArrowDownIcon/ArrowDownIcon");
|
|
9
|
+
const LoadMore_1 = require("../../../../components/LoadMore/LoadMore");
|
|
10
|
+
const CatalogTableView_1 = require("../../../../components/Catalog/CatalogTableView/CatalogTableView");
|
|
11
|
+
const CatalogHighlight_1 = require("../../../../components/Catalog/CatalogHighlight");
|
|
12
|
+
const CatalogEntitiesEmptyState_1 = require("../../../../components/Catalog/CatalogEntitiesEmptyState");
|
|
13
|
+
function CatalogEntityRelationsTableContent({ entitiesCatalogConfig, catalogConfig, relations, query, searchQuery, columns, setSortOption, sortOption, handleSortClick, isColumnSorted, shouldShowLoadMore, listType, }) {
|
|
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 }))),
|
|
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
|
+
}
|
|
18
|
+
//# sourceMappingURL=CatalogEntityRelationsTableContent.js.map
|
package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js
CHANGED
|
@@ -48,9 +48,9 @@ function CatalogEntityTeamRelations({ entity, relations, query, searchQuery, set
|
|
|
48
48
|
return (react_1.default.createElement("div", { "data-component-name": "Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations" },
|
|
49
49
|
react_1.default.createElement(Tabs_1.Tabs, { forceReady: relations.length > 0, size: Tabs_1.TabsSize.MEDIUM },
|
|
50
50
|
react_1.default.createElement(TabItem, { label: "Members", icon: react_1.default.createElement(PeopleIcon_1.PeopleIcon, null), onClick: () => setFilter('type:user') },
|
|
51
|
-
react_1.default.createElement(CatalogEntityRelationsTable_1.CatalogEntityRelationsTable, { key:
|
|
51
|
+
react_1.default.createElement(CatalogEntityRelationsTable_1.CatalogEntityRelationsTable, { key: "members-table", entity: entity, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, columns: teamColumns, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, listType: "team" })),
|
|
52
52
|
react_1.default.createElement(TabItem, { label: "Related entities", icon: react_1.default.createElement(EntityTypeIcon_1.EntityTypeIcon, null), onClick: () => setFilter('-type:user') },
|
|
53
|
-
react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key:
|
|
53
|
+
react_1.default.createElement(CatalogEntityDefaultRelations_1.CatalogEntityDefaultRelations, { key: "related-entities-table", entity: entity, relations: relations, query: query, searchQuery: searchQuery, setSearchQuery: setSearchQuery, setFilter: setFilter, entitiesCatalogConfig: entitiesCatalogConfig, catalogConfig: catalogConfig, sortOption: sortOption, setSortOption: setSortOption, handleSortClick: handleSortClick, isColumnSorted: isColumnSorted, shouldShowLoadMore: shouldShowLoadMore, shouldShowHeading: false })))));
|
|
54
54
|
}
|
|
55
55
|
const TabItem = styled_components_1.default.div `
|
|
56
56
|
padding: 12px;
|
|
@@ -2,5 +2,6 @@ import { JSX } from 'react';
|
|
|
2
2
|
export type CatalogEntityIconProps = {
|
|
3
3
|
entityType: string;
|
|
4
4
|
defaultColor?: boolean;
|
|
5
|
+
forceColor?: string;
|
|
5
6
|
};
|
|
6
|
-
export declare function CatalogEntityIcon({ entityType, defaultColor, }: CatalogEntityIconProps): JSX.Element;
|
|
7
|
+
export declare function CatalogEntityIcon({ entityType, defaultColor, forceColor, }: CatalogEntityIconProps): JSX.Element;
|
|
@@ -12,10 +12,8 @@ const UserIcon_1 = require("../../icons/UserIcon/UserIcon");
|
|
|
12
12
|
const NetworkIcon_1 = require("../../icons/NetworkIcon/NetworkIcon");
|
|
13
13
|
const MoleculesIcon_1 = require("../../icons/MoleculesIcon/MoleculesIcon");
|
|
14
14
|
const getIconColor = (entityType) => `var(--catalog-entity-icon-color-${entityType})`;
|
|
15
|
-
const getEntityIcon = ({ entityType, defaultColor }) => {
|
|
16
|
-
const iconColor = defaultColor
|
|
17
|
-
? `var(--catalog-entity-icon-color)`
|
|
18
|
-
: getIconColor(entityType);
|
|
15
|
+
const getEntityIcon = ({ entityType, defaultColor, forceColor }) => {
|
|
16
|
+
const iconColor = forceColor !== null && forceColor !== void 0 ? forceColor : (defaultColor ? `var(--catalog-entity-icon-color)` : getIconColor(entityType));
|
|
19
17
|
const entityIconMap = {
|
|
20
18
|
service: react_1.default.createElement(CodeIcon_1.CodeIcon, { color: iconColor }),
|
|
21
19
|
domain: react_1.default.createElement(GraphIcon_1.GraphIcon, { color: iconColor }),
|
|
@@ -27,8 +25,8 @@ const getEntityIcon = ({ entityType, defaultColor }) => {
|
|
|
27
25
|
};
|
|
28
26
|
return entityIconMap[entityType];
|
|
29
27
|
};
|
|
30
|
-
function CatalogEntityIcon({ entityType, defaultColor = false, }) {
|
|
31
|
-
const icon = getEntityIcon({ entityType, defaultColor });
|
|
28
|
+
function CatalogEntityIcon({ entityType, defaultColor = false, forceColor, }) {
|
|
29
|
+
const icon = getEntityIcon({ entityType, defaultColor, forceColor });
|
|
32
30
|
if (!icon) {
|
|
33
31
|
throw new Error(`Unhandled entity type: ${entityType}`);
|
|
34
32
|
}
|
|
@@ -67,7 +67,7 @@ const CatalogTableViewRow = ({ entity, entitiesCatalogConfig, catalogConfig, col
|
|
|
67
67
|
catalogConfig,
|
|
68
68
|
entitiesCatalogConfig,
|
|
69
69
|
});
|
|
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(), 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))))));
|
|
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))))));
|
|
71
71
|
};
|
|
72
72
|
exports.CatalogTableViewRow = CatalogTableViewRow;
|
|
73
73
|
const TableRow = (0, styled_components_1.default)(Link_1.Link) `
|