@redocly/theme 0.55.0-next.7 → 0.55.0-next.8
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/Breadcrumbs/Breadcrumbs.d.ts +2 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.js +2 -1
- package/lib/components/Catalog/Catalog.d.ts +11 -0
- package/lib/components/Catalog/Catalog.js +138 -0
- package/lib/components/Catalog/CatalogActionsRow.d.ts +15 -0
- package/lib/components/Catalog/CatalogActionsRow.js +34 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCard.d.ts +8 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +179 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCardView.d.ts +8 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCardView.js +20 -0
- package/lib/components/Catalog/CatalogEntities.d.ts +18 -0
- package/lib/components/Catalog/CatalogEntities.js +63 -0
- package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +2 -0
- package/lib/components/Catalog/CatalogEntitiesEmptyState.js +38 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +12 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +133 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +49 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +48 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +111 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +25 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +69 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +48 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +19 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +20 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +20 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +23 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +24 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.js +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +37 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +10 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +31 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +25 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +27 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +22 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +60 -0
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +5 -0
- package/lib/components/Catalog/CatalogEntityIcon.js +38 -0
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +5 -0
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +42 -0
- package/lib/components/Catalog/CatalogHighlight.d.ts +4 -0
- package/lib/components/Catalog/CatalogHighlight.js +48 -0
- package/lib/components/Catalog/CatalogPageDescription.d.ts +9 -0
- package/lib/components/Catalog/CatalogPageDescription.js +52 -0
- package/lib/components/Catalog/CatalogSelector.d.ts +12 -0
- package/lib/components/Catalog/CatalogSelector.js +48 -0
- package/lib/components/Catalog/CatalogSortButton.d.ts +10 -0
- package/lib/components/Catalog/CatalogSortButton.js +71 -0
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +19 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +6 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +63 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +19 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +11 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +101 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +31 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +106 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +27 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +127 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.d.ts +6 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +20 -0
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.d.ts +7 -0
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +66 -0
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +9 -0
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +46 -0
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +7 -0
- package/lib/components/Catalog/CatalogViewModeToggle.js +67 -0
- package/lib/components/Catalog/variables.d.ts +1 -0
- package/lib/components/Catalog/variables.dark.d.ts +1 -0
- package/lib/components/Catalog/variables.dark.js +8 -0
- package/lib/components/Catalog/variables.js +354 -0
- package/lib/components/CatalogClassic/CatalogClassicHighlight.js +1 -1
- package/lib/components/Filter/Filter.d.ts +1 -1
- package/lib/components/Filter/Filter.js +2 -2
- package/lib/components/Filter/FilterCheckboxes.d.ts +1 -1
- package/lib/components/Filter/FilterCheckboxes.js +4 -4
- package/lib/components/Filter/FilterContent.d.ts +3 -1
- package/lib/components/Filter/FilterContent.js +34 -4
- package/lib/components/Filter/FilterInput.js +35 -3
- package/lib/components/Filter/FilterSelect.d.ts +1 -1
- package/lib/components/Filter/FilterSelect.js +4 -4
- package/lib/components/LoadMore/LoadMore.d.ts +8 -0
- package/lib/components/LoadMore/LoadMore.js +18 -0
- package/lib/components/Markdown/Markdown.js +1 -1
- package/lib/components/PageNavigation/NavigationButton.d.ts +13 -0
- package/lib/components/PageNavigation/NavigationButton.js +32 -0
- package/lib/components/PageNavigation/NextButton.js +10 -29
- package/lib/components/PageNavigation/PageNavigation.js +1 -1
- package/lib/components/PageNavigation/PreviousButton.js +11 -27
- package/lib/components/Search/SearchAiConversationInput.js +2 -1
- package/lib/components/Select/Select.js +3 -3
- package/lib/components/Sidebar/Sidebar.d.ts +3 -0
- package/lib/components/Sidebar/Sidebar.js +3 -2
- package/lib/components/Tag/Tag.d.ts +3 -1
- package/lib/components/Tag/Tag.js +54 -2
- package/lib/components/Tag/variables.js +21 -0
- package/lib/components/Tooltip/Tooltip.d.ts +2 -1
- package/lib/components/Tooltip/Tooltip.js +26 -19
- package/lib/components/Tooltip/variables.js +17 -0
- package/lib/core/constants/catalog.d.ts +1 -0
- package/lib/core/constants/catalog.js +5 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/search.d.ts +1 -0
- package/lib/core/constants/search.js +2 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
- package/lib/core/hooks/catalog/useCatalogEntities.d.ts +4 -0
- package/lib/core/hooks/catalog/useCatalogEntities.js +17 -0
- package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.d.ts +15 -0
- package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.js +23 -0
- package/lib/core/hooks/catalog/useCatalogTableViewRow.d.ts +11 -0
- package/lib/core/hooks/catalog/useCatalogTableViewRow.js +26 -0
- package/lib/core/hooks/index.d.ts +2 -0
- package/lib/core/hooks/index.js +2 -0
- package/lib/core/hooks/use-user-teams.d.ts +1 -0
- package/lib/core/hooks/use-user-teams.js +10 -0
- package/lib/core/styles/dark.js +2 -0
- package/lib/core/styles/global.js +63 -60
- package/lib/core/types/catalog.d.ts +118 -5
- package/lib/core/types/filter.d.ts +1 -0
- package/lib/core/types/hooks.d.ts +11 -4
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/telemetry.d.ts +32 -0
- package/lib/core/types/telemetry.js +3 -0
- package/lib/icons/AscSortIcon/AscSortIcon.d.ts +9 -0
- package/lib/icons/AscSortIcon/AscSortIcon.js +25 -0
- package/lib/icons/CardsIcon/CardsIcon.d.ts +9 -0
- package/lib/icons/CardsIcon/CardsIcon.js +25 -0
- package/lib/icons/CaretDownIcon/CaretDownIcon.d.ts +9 -0
- package/lib/icons/CaretDownIcon/CaretDownIcon.js +22 -0
- package/lib/icons/CaretUpIcon/CaretUpIcon.d.ts +9 -0
- package/lib/icons/CaretUpIcon/CaretUpIcon.js +22 -0
- package/lib/icons/DescSortIcon/DescSortIcon.d.ts +9 -0
- package/lib/icons/DescSortIcon/DescSortIcon.js +25 -0
- package/lib/icons/EntityTypeIcon/EntityTypeIcon.d.ts +9 -0
- package/lib/icons/EntityTypeIcon/EntityTypeIcon.js +26 -0
- package/lib/icons/GithubIcon/GithubIcon.d.ts +9 -0
- package/lib/icons/GithubIcon/GithubIcon.js +22 -0
- package/lib/icons/GraphIcon/GraphIcon.d.ts +9 -0
- package/lib/icons/GraphIcon/GraphIcon.js +22 -0
- package/lib/icons/PeopleIcon/PeopleIcon.d.ts +9 -0
- package/lib/icons/PeopleIcon/PeopleIcon.js +27 -0
- package/lib/icons/SlackIcon/SlackIcon.d.ts +9 -0
- package/lib/icons/SlackIcon/SlackIcon.js +29 -0
- package/lib/icons/SortIcon/SortIcon.d.ts +9 -0
- package/lib/icons/SortIcon/SortIcon.js +25 -0
- package/lib/icons/TableIcon/TableIcon.d.ts +9 -0
- package/lib/icons/TableIcon/TableIcon.js +22 -0
- package/lib/icons/TagsIcon/TagsIcon.d.ts +9 -0
- package/lib/icons/TagsIcon/TagsIcon.js +24 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +19 -0
- package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tab.js +10 -2
- package/lib/markdoc/components/Tabs/TabList.js +2 -2
- package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -1
- package/lib/markdoc/components/Tabs/Tabs.js +2 -2
- package/package.json +2 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +7 -2
- package/src/components/Catalog/Catalog.tsx +235 -0
- package/src/components/Catalog/CatalogActionsRow.tsx +58 -0
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +227 -0
- package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +29 -0
- package/src/components/Catalog/CatalogEntities.tsx +107 -0
- package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +38 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +207 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +60 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +67 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +93 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +35 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +83 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +62 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +36 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +38 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +33 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +41 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +42 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +39 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +31 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +97 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +80 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +92 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +127 -0
- package/src/components/Catalog/CatalogEntityIcon.tsx +41 -0
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +48 -0
- package/src/components/Catalog/CatalogHighlight.tsx +56 -0
- package/src/components/Catalog/CatalogPageDescription.tsx +72 -0
- package/src/components/Catalog/CatalogSelector.tsx +67 -0
- package/src/components/Catalog/CatalogSortButton.tsx +78 -0
- package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +26 -0
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +77 -0
- package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +26 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +120 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +176 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +180 -0
- package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +28 -0
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +77 -0
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +83 -0
- package/src/components/Catalog/CatalogViewModeToggle.tsx +65 -0
- package/src/components/Catalog/variables.dark.ts +5 -0
- package/src/components/Catalog/variables.ts +351 -0
- package/src/components/CatalogClassic/CatalogClassicHighlight.tsx +1 -1
- package/src/components/Filter/Filter.tsx +10 -2
- package/src/components/Filter/FilterCheckboxes.tsx +8 -4
- package/src/components/Filter/FilterContent.tsx +21 -5
- package/src/components/Filter/FilterInput.tsx +16 -4
- package/src/components/Filter/FilterSelect.tsx +8 -4
- package/src/components/LoadMore/LoadMore.tsx +38 -0
- package/src/components/Markdown/Markdown.tsx +1 -1
- package/src/components/PageNavigation/NavigationButton.tsx +68 -0
- package/src/components/PageNavigation/NextButton.tsx +20 -43
- package/src/components/PageNavigation/PageNavigation.tsx +1 -1
- package/src/components/PageNavigation/PreviousButton.tsx +20 -43
- package/src/components/Search/SearchAiConversationInput.tsx +3 -0
- package/src/components/Select/Select.tsx +5 -3
- package/src/components/Sidebar/Sidebar.tsx +1 -1
- package/src/components/Tag/Tag.tsx +67 -1
- package/src/components/Tag/variables.ts +21 -0
- package/src/components/Tooltip/Tooltip.tsx +31 -22
- package/src/components/Tooltip/variables.ts +17 -0
- package/src/core/constants/catalog.ts +1 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/search.ts +2 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/catalog/useCatalogEntities.ts +16 -0
- package/src/core/hooks/catalog/useCatalogTableHeaderCellActions.ts +38 -0
- package/src/core/hooks/catalog/useCatalogTableViewRow.ts +40 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/use-user-teams.ts +8 -0
- package/src/core/styles/dark.ts +2 -0
- package/src/core/styles/global.ts +3 -0
- package/src/core/types/catalog.ts +143 -5
- package/src/core/types/filter.ts +1 -0
- package/src/core/types/hooks.ts +32 -5
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +20 -0
- package/src/core/types/telemetry.ts +36 -0
- package/src/core/utils/load-and-navigate.ts +5 -4
- package/src/icons/AscSortIcon/AscSortIcon.tsx +29 -0
- package/src/icons/CardsIcon/CardsIcon.tsx +38 -0
- package/src/icons/CaretDownIcon/CaretDownIcon.tsx +26 -0
- package/src/icons/CaretUpIcon/CaretUpIcon.tsx +26 -0
- package/src/icons/DescSortIcon/DescSortIcon.tsx +29 -0
- package/src/icons/EntityTypeIcon/EntityTypeIcon.tsx +49 -0
- package/src/icons/GithubIcon/GithubIcon.tsx +35 -0
- package/src/icons/GraphIcon/GraphIcon.tsx +26 -0
- package/src/icons/PeopleIcon/PeopleIcon.tsx +46 -0
- package/src/icons/SlackIcon/SlackIcon.tsx +61 -0
- package/src/icons/SortIcon/SortIcon.tsx +29 -0
- package/src/icons/TableIcon/TableIcon.tsx +26 -0
- package/src/icons/TagsIcon/TagsIcon.tsx +41 -0
- package/src/index.ts +20 -0
- package/src/markdoc/components/Tabs/Tab.tsx +12 -1
- package/src/markdoc/components/Tabs/TabList.tsx +2 -1
- package/src/markdoc/components/Tabs/Tabs.tsx +8 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { EntityTypeIcon } from '@redocly/theme/icons/EntityTypeIcon/EntityTypeIcon';
|
|
5
|
+
import { capitalize } from '@redocly/theme/core/utils';
|
|
6
|
+
import { CatalogEntityTypeIcon } from '@redocly/theme/components/Catalog/CatalogEntityTypeIcon';
|
|
7
|
+
|
|
8
|
+
import { CatalogEntityPropertyCard } from './CatalogEntityPropertyCard';
|
|
9
|
+
|
|
10
|
+
export type EntityTypePropertyProps = {
|
|
11
|
+
entity: BffCatalogEntity;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function EntityTypeProperty({ entity }: EntityTypePropertyProps): JSX.Element {
|
|
15
|
+
return (
|
|
16
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty">
|
|
17
|
+
<CatalogEntityPropertyCard
|
|
18
|
+
header={
|
|
19
|
+
<>
|
|
20
|
+
<EntityTypeIcon />
|
|
21
|
+
Entity type
|
|
22
|
+
</>
|
|
23
|
+
}
|
|
24
|
+
content={
|
|
25
|
+
<>
|
|
26
|
+
<CatalogEntityTypeIcon entityType={entity.type} />
|
|
27
|
+
<strong>{capitalize(entity.type)}</strong>
|
|
28
|
+
</>
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { GithubIcon } from '@redocly/theme/icons/GithubIcon/GithubIcon';
|
|
5
|
+
import { removeLeadingSlash } from '@redocly/theme/core/utils';
|
|
6
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
7
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
8
|
+
|
|
9
|
+
export type GitPropertyProps = {
|
|
10
|
+
entity: BffCatalogEntity;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function GitProperty({ entity }: GitPropertyProps): JSX.Element {
|
|
14
|
+
const git = entity.git;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/GitProperty">
|
|
18
|
+
<CatalogEntityPropertyCard
|
|
19
|
+
header={
|
|
20
|
+
<>
|
|
21
|
+
<GithubIcon />
|
|
22
|
+
Repositories
|
|
23
|
+
</>
|
|
24
|
+
}
|
|
25
|
+
content={
|
|
26
|
+
<>
|
|
27
|
+
{git?.map((repo) => {
|
|
28
|
+
const url = new URL(repo);
|
|
29
|
+
const repoName = removeLeadingSlash(url.pathname);
|
|
30
|
+
return (
|
|
31
|
+
<Tag key={repo} style={{ backgroundColor: 'var(--bg-color)' }}>
|
|
32
|
+
{repoName}
|
|
33
|
+
</Tag>
|
|
34
|
+
);
|
|
35
|
+
})}
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
5
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
7
|
+
|
|
8
|
+
export type OwnersPropertyProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function OwnersProperty({ entity }: OwnersPropertyProps): JSX.Element {
|
|
13
|
+
const { owners = [] } = entity;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty">
|
|
17
|
+
<CatalogEntityPropertyCard
|
|
18
|
+
header={
|
|
19
|
+
<>
|
|
20
|
+
<PeopleIcon />
|
|
21
|
+
Owners
|
|
22
|
+
</>
|
|
23
|
+
}
|
|
24
|
+
content={
|
|
25
|
+
<>
|
|
26
|
+
{owners.map((owner) => (
|
|
27
|
+
<Tag
|
|
28
|
+
key={owner?.id}
|
|
29
|
+
style={{
|
|
30
|
+
backgroundColor: 'var(--bg-color)',
|
|
31
|
+
borderRadius: 'var(--border-radius-xl)',
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
{owner?.title}
|
|
35
|
+
</Tag>
|
|
36
|
+
))}
|
|
37
|
+
</>
|
|
38
|
+
}
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { TagsIcon } from '@redocly/theme/icons/TagsIcon/TagsIcon';
|
|
5
|
+
import { CatalogTagsWithTooltip } from '@redocly/theme';
|
|
6
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
7
|
+
|
|
8
|
+
export type TagsPropertyProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function TagsProperty({ entity }: TagsPropertyProps): JSX.Element {
|
|
13
|
+
return (
|
|
14
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty">
|
|
15
|
+
<CatalogEntityPropertyCard
|
|
16
|
+
header={
|
|
17
|
+
<>
|
|
18
|
+
<TagsIcon />
|
|
19
|
+
Tags
|
|
20
|
+
</>
|
|
21
|
+
}
|
|
22
|
+
content={
|
|
23
|
+
<CatalogTagsWithTooltip
|
|
24
|
+
itemsToShow={8}
|
|
25
|
+
items={entity.tags || []}
|
|
26
|
+
tagProps={{
|
|
27
|
+
style: {
|
|
28
|
+
fontSize: 'var(--font-size-base)',
|
|
29
|
+
borderRadius: 'var(--border-radius)',
|
|
30
|
+
},
|
|
31
|
+
borderless: true,
|
|
32
|
+
color: 'grey',
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { EmailIcon } from '@redocly/theme/icons/EmailIcon/EmailIcon';
|
|
5
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
6
|
+
import { Email } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogUserEntityCell';
|
|
7
|
+
|
|
8
|
+
export type UserEmailPropertyProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function UserEmailProperty({ entity }: UserEmailPropertyProps): JSX.Element {
|
|
13
|
+
const email = entity.metadata?.email;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty">
|
|
17
|
+
<CatalogEntityPropertyCard
|
|
18
|
+
header={
|
|
19
|
+
<>
|
|
20
|
+
<EmailIcon />
|
|
21
|
+
Email
|
|
22
|
+
</>
|
|
23
|
+
}
|
|
24
|
+
content={<Email>{email}</Email>}
|
|
25
|
+
onClick={() => {
|
|
26
|
+
window.open(`mailto:${email}`, '_blank');
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
BffCatalogEntity,
|
|
7
|
+
BffCatalogRelatedEntity,
|
|
8
|
+
EntityType,
|
|
9
|
+
SortOption,
|
|
10
|
+
} from '@redocly/theme/core/types';
|
|
11
|
+
import {
|
|
12
|
+
CatalogColumn,
|
|
13
|
+
getEntityTagColor,
|
|
14
|
+
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
15
|
+
import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
|
|
16
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
17
|
+
import { CatalogEntityRelationsTable } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable';
|
|
18
|
+
|
|
19
|
+
const columns: CatalogColumn<BffCatalogRelatedEntity>[] = [
|
|
20
|
+
{
|
|
21
|
+
key: 'entity',
|
|
22
|
+
title: 'Entity',
|
|
23
|
+
render: (entity) => <CatalogEntityCell entity={entity} />,
|
|
24
|
+
sortable: true,
|
|
25
|
+
sortKey: 'title',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: 'type',
|
|
29
|
+
title: 'Type',
|
|
30
|
+
render: (entity) => (
|
|
31
|
+
<EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
|
|
32
|
+
{entity.type}
|
|
33
|
+
</EntityTypeTag>
|
|
34
|
+
),
|
|
35
|
+
sortable: true,
|
|
36
|
+
sortKey: 'type',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export type CatalogEntityDefaultRelationsProps = {
|
|
41
|
+
entity: BffCatalogEntity;
|
|
42
|
+
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
43
|
+
catalogConfig: CatalogEntityConfig;
|
|
44
|
+
relations: BffCatalogRelatedEntity[];
|
|
45
|
+
query: {
|
|
46
|
+
fetchNextPage: () => void;
|
|
47
|
+
isFetchingNextPage: boolean;
|
|
48
|
+
};
|
|
49
|
+
searchQuery: string;
|
|
50
|
+
setSearchQuery: (query: string) => void;
|
|
51
|
+
sortOption: SortOption | null;
|
|
52
|
+
setSortOption: (sortOption: SortOption | null) => void;
|
|
53
|
+
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
54
|
+
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
55
|
+
shouldShowLoadMore: boolean;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export function CatalogEntityDefaultRelations({
|
|
59
|
+
entity,
|
|
60
|
+
relations,
|
|
61
|
+
query,
|
|
62
|
+
searchQuery,
|
|
63
|
+
setSearchQuery,
|
|
64
|
+
entitiesCatalogConfig,
|
|
65
|
+
catalogConfig,
|
|
66
|
+
sortOption,
|
|
67
|
+
setSortOption,
|
|
68
|
+
handleSortClick,
|
|
69
|
+
isColumnSorted,
|
|
70
|
+
shouldShowLoadMore,
|
|
71
|
+
}: CatalogEntityDefaultRelationsProps): JSX.Element {
|
|
72
|
+
return (
|
|
73
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations">
|
|
74
|
+
<CatalogEntityRelationsTable
|
|
75
|
+
entity={entity}
|
|
76
|
+
catalogConfig={catalogConfig}
|
|
77
|
+
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
78
|
+
relations={relations}
|
|
79
|
+
query={query}
|
|
80
|
+
searchQuery={searchQuery}
|
|
81
|
+
setSearchQuery={setSearchQuery}
|
|
82
|
+
heading="Related entities"
|
|
83
|
+
columns={columns}
|
|
84
|
+
sortOption={sortOption}
|
|
85
|
+
setSortOption={setSortOption}
|
|
86
|
+
handleSortClick={handleSortClick}
|
|
87
|
+
isColumnSorted={isColumnSorted}
|
|
88
|
+
shouldShowLoadMore={shouldShowLoadMore}
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const EntityTypeTag = styled(Tag)`
|
|
95
|
+
font-size: var(--font-size-base);
|
|
96
|
+
background-color: transparent;
|
|
97
|
+
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity, BffCatalogRelatedEntityList } from '@redocly/theme/core/types';
|
|
5
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
6
|
+
import { CatalogEntityDefaultRelations } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations';
|
|
7
|
+
import { CatalogEntityTeamRelations } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations';
|
|
8
|
+
|
|
9
|
+
export type CatalogEntityRelationsProps = {
|
|
10
|
+
entity: BffCatalogEntity;
|
|
11
|
+
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
12
|
+
catalogConfig: CatalogEntityConfig;
|
|
13
|
+
initialRelations: BffCatalogRelatedEntityList;
|
|
14
|
+
};
|
|
15
|
+
const LOAD_MORE_THRESHOLD = 10;
|
|
16
|
+
|
|
17
|
+
export function CatalogEntityRelations({
|
|
18
|
+
entity,
|
|
19
|
+
entitiesCatalogConfig,
|
|
20
|
+
initialRelations,
|
|
21
|
+
catalogConfig,
|
|
22
|
+
}: CatalogEntityRelationsProps): JSX.Element | null {
|
|
23
|
+
const { useCatalogSort, useCatalogSearch, useFetchCatalogEntitiesRelations } = useThemeHooks();
|
|
24
|
+
const { sortOption, setSortOption, handleSortClick, isColumnSorted } = useCatalogSort();
|
|
25
|
+
const { searchQuery, setSearchQuery } = useCatalogSearch();
|
|
26
|
+
|
|
27
|
+
const { items: relations, query } = useFetchCatalogEntitiesRelations(
|
|
28
|
+
{ entityKey: entity.key, search: searchQuery, sort: sortOption ?? undefined },
|
|
29
|
+
initialRelations,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
if (relations.length === 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const shouldShowLoadMore =
|
|
37
|
+
query.hasNextPage ||
|
|
38
|
+
(query.isPlaceholderData && relations && relations.length >= LOAD_MORE_THRESHOLD);
|
|
39
|
+
|
|
40
|
+
switch (entity.type) {
|
|
41
|
+
case 'team':
|
|
42
|
+
return (
|
|
43
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations/CatalogEntityTeamRelations">
|
|
44
|
+
<CatalogEntityTeamRelations
|
|
45
|
+
entity={entity}
|
|
46
|
+
catalogConfig={catalogConfig}
|
|
47
|
+
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
48
|
+
relations={relations}
|
|
49
|
+
query={query}
|
|
50
|
+
searchQuery={searchQuery}
|
|
51
|
+
setSearchQuery={setSearchQuery}
|
|
52
|
+
sortOption={sortOption}
|
|
53
|
+
setSortOption={setSortOption}
|
|
54
|
+
handleSortClick={handleSortClick}
|
|
55
|
+
isColumnSorted={isColumnSorted}
|
|
56
|
+
shouldShowLoadMore={shouldShowLoadMore}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
default:
|
|
61
|
+
return (
|
|
62
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations/CatalogEntityDefaultRelations">
|
|
63
|
+
<CatalogEntityDefaultRelations
|
|
64
|
+
entity={entity}
|
|
65
|
+
catalogConfig={catalogConfig}
|
|
66
|
+
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
67
|
+
relations={relations}
|
|
68
|
+
query={query}
|
|
69
|
+
searchQuery={searchQuery}
|
|
70
|
+
setSearchQuery={setSearchQuery}
|
|
71
|
+
sortOption={sortOption}
|
|
72
|
+
setSortOption={setSortOption}
|
|
73
|
+
handleSortClick={handleSortClick}
|
|
74
|
+
isColumnSorted={isColumnSorted}
|
|
75
|
+
shouldShowLoadMore={shouldShowLoadMore}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
|
+
|
|
5
|
+
import { ArrowDownIcon } from '@redocly/theme/icons/ArrowDownIcon/ArrowDownIcon';
|
|
6
|
+
import { BffCatalogEntity, BffCatalogRelatedEntity, SortOption } from '@redocly/theme/core/types';
|
|
7
|
+
import { LoadMore } from '@redocly/theme/components/LoadMore/LoadMore';
|
|
8
|
+
import {
|
|
9
|
+
CatalogColumn,
|
|
10
|
+
CatalogTableView,
|
|
11
|
+
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
12
|
+
import { CatalogActionsRow } from '@redocly/theme/components/Catalog/CatalogActionsRow';
|
|
13
|
+
import { HighlightContext } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
14
|
+
|
|
15
|
+
export type CatalogEntityRelationsTableProps = {
|
|
16
|
+
entity: BffCatalogEntity;
|
|
17
|
+
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
18
|
+
catalogConfig: CatalogEntityConfig;
|
|
19
|
+
relations: BffCatalogRelatedEntity[];
|
|
20
|
+
query: {
|
|
21
|
+
fetchNextPage: () => void;
|
|
22
|
+
isFetchingNextPage: boolean;
|
|
23
|
+
};
|
|
24
|
+
searchQuery: string;
|
|
25
|
+
setSearchQuery: (query: string) => void;
|
|
26
|
+
heading: string;
|
|
27
|
+
filter?: string;
|
|
28
|
+
columns: CatalogColumn<BffCatalogRelatedEntity>[];
|
|
29
|
+
sortOption: SortOption | null;
|
|
30
|
+
setSortOption: (sortOption: SortOption | null) => void;
|
|
31
|
+
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
32
|
+
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
33
|
+
shouldShowLoadMore: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export function CatalogEntityRelationsTable({
|
|
37
|
+
entitiesCatalogConfig,
|
|
38
|
+
catalogConfig,
|
|
39
|
+
relations,
|
|
40
|
+
query,
|
|
41
|
+
searchQuery,
|
|
42
|
+
setSearchQuery,
|
|
43
|
+
heading,
|
|
44
|
+
columns,
|
|
45
|
+
setSortOption,
|
|
46
|
+
sortOption,
|
|
47
|
+
handleSortClick,
|
|
48
|
+
isColumnSorted,
|
|
49
|
+
shouldShowLoadMore,
|
|
50
|
+
}: CatalogEntityRelationsTableProps): JSX.Element {
|
|
51
|
+
return (
|
|
52
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable">
|
|
53
|
+
<Heading>{heading}</Heading>
|
|
54
|
+
<CatalogActionsRow
|
|
55
|
+
searchQuery={searchQuery}
|
|
56
|
+
setSearchQuery={setSearchQuery}
|
|
57
|
+
sortOption={sortOption}
|
|
58
|
+
setSortOption={setSortOption}
|
|
59
|
+
style={{ marginBottom: '12px' }}
|
|
60
|
+
/>
|
|
61
|
+
{relations.length > 0 && (
|
|
62
|
+
<HighlightContext.Provider value={[searchQuery]}>
|
|
63
|
+
<CatalogTableView
|
|
64
|
+
entities={relations}
|
|
65
|
+
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
66
|
+
catalogConfig={catalogConfig}
|
|
67
|
+
columns={columns}
|
|
68
|
+
setSortOption={setSortOption}
|
|
69
|
+
currentSortOption={sortOption}
|
|
70
|
+
handleSortClick={handleSortClick}
|
|
71
|
+
isColumnSorted={isColumnSorted}
|
|
72
|
+
/>
|
|
73
|
+
</HighlightContext.Provider>
|
|
74
|
+
)}
|
|
75
|
+
{shouldShowLoadMore && (
|
|
76
|
+
<LoadMore
|
|
77
|
+
icon={<ArrowDownIcon size="var(--catalog-load-more-icon-size)" />}
|
|
78
|
+
onClick={query.fetchNextPage}
|
|
79
|
+
disabled={query.isFetchingNextPage}
|
|
80
|
+
blinking={query.isFetchingNextPage}
|
|
81
|
+
label={query.isFetchingNextPage ? 'Loading...' : 'Load More'}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const Heading = styled.h2`
|
|
89
|
+
margin: var(--spacing-base) 0;
|
|
90
|
+
font-size: var(--font-size-md);
|
|
91
|
+
color: var(--catalog-metadata-heading-color);
|
|
92
|
+
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React, { JSX, ReactNode } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
|
+
|
|
5
|
+
import { Tabs, TabsSize } from '@redocly/theme/markdoc/components/Tabs/Tabs';
|
|
6
|
+
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
|
+
import { EntityTypeIcon } from '@redocly/theme/icons/EntityTypeIcon/EntityTypeIcon';
|
|
8
|
+
import { BffCatalogEntity, BffCatalogRelatedEntity, SortOption } from '@redocly/theme/core/types';
|
|
9
|
+
import { CatalogColumn } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
10
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
11
|
+
import { CatalogEntityRelationsTable } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable';
|
|
12
|
+
import { CatalogUserEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogUserEntityCell';
|
|
13
|
+
import { CatalogEntityDefaultRelations } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations';
|
|
14
|
+
|
|
15
|
+
const teamColumns: CatalogColumn<BffCatalogRelatedEntity>[] = [
|
|
16
|
+
{
|
|
17
|
+
key: 'entity',
|
|
18
|
+
title: 'User name',
|
|
19
|
+
render: (entity) => (
|
|
20
|
+
<CatalogUserEntityCell name={entity.title} email={entity.metadata?.email as string} />
|
|
21
|
+
),
|
|
22
|
+
width: '2fr',
|
|
23
|
+
sortable: true,
|
|
24
|
+
sortKey: 'title',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: 'metadata',
|
|
28
|
+
title: 'Role',
|
|
29
|
+
render: (entity) => (entity.metadata?.role ? <Tag>{entity.metadata?.role}</Tag> : null),
|
|
30
|
+
width: '2fr',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: 'description',
|
|
34
|
+
title: 'Description',
|
|
35
|
+
render: (entity) => <EntityDescription>{entity.summary}</EntityDescription>,
|
|
36
|
+
width: '3fr',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
export type CatalogEntityTeamRelationsProps = {
|
|
41
|
+
entity: BffCatalogEntity;
|
|
42
|
+
catalogConfig: CatalogEntityConfig;
|
|
43
|
+
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
44
|
+
relations: BffCatalogRelatedEntity[];
|
|
45
|
+
query: {
|
|
46
|
+
fetchNextPage: () => void;
|
|
47
|
+
isFetchingNextPage: boolean;
|
|
48
|
+
hasNextPage: boolean;
|
|
49
|
+
};
|
|
50
|
+
searchQuery: string;
|
|
51
|
+
setSearchQuery: (query: string) => void;
|
|
52
|
+
sortOption: SortOption | null;
|
|
53
|
+
setSortOption: (sortOption: SortOption | null) => void;
|
|
54
|
+
handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void;
|
|
55
|
+
isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean;
|
|
56
|
+
shouldShowLoadMore: boolean;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export function CatalogEntityTeamRelations({
|
|
60
|
+
entity,
|
|
61
|
+
relations,
|
|
62
|
+
query,
|
|
63
|
+
searchQuery,
|
|
64
|
+
setSearchQuery,
|
|
65
|
+
entitiesCatalogConfig,
|
|
66
|
+
catalogConfig,
|
|
67
|
+
sortOption,
|
|
68
|
+
setSortOption,
|
|
69
|
+
handleSortClick,
|
|
70
|
+
isColumnSorted,
|
|
71
|
+
shouldShowLoadMore,
|
|
72
|
+
}: CatalogEntityTeamRelationsProps): JSX.Element {
|
|
73
|
+
return (
|
|
74
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations">
|
|
75
|
+
<Tabs forceReady={relations.length > 0} size={TabsSize.MEDIUM}>
|
|
76
|
+
<TabItem label="Members" icon={<PeopleIcon />}>
|
|
77
|
+
<CatalogEntityRelationsTable
|
|
78
|
+
entity={entity}
|
|
79
|
+
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
80
|
+
catalogConfig={catalogConfig}
|
|
81
|
+
relations={relations}
|
|
82
|
+
query={query}
|
|
83
|
+
searchQuery={searchQuery}
|
|
84
|
+
setSearchQuery={setSearchQuery}
|
|
85
|
+
heading="Members"
|
|
86
|
+
filter="type:user"
|
|
87
|
+
columns={teamColumns}
|
|
88
|
+
sortOption={sortOption}
|
|
89
|
+
setSortOption={setSortOption}
|
|
90
|
+
handleSortClick={handleSortClick}
|
|
91
|
+
isColumnSorted={isColumnSorted}
|
|
92
|
+
shouldShowLoadMore={shouldShowLoadMore}
|
|
93
|
+
/>
|
|
94
|
+
</TabItem>
|
|
95
|
+
<TabItem label="Related entities" icon={<EntityTypeIcon />}>
|
|
96
|
+
<CatalogEntityDefaultRelations
|
|
97
|
+
entity={entity}
|
|
98
|
+
relations={relations}
|
|
99
|
+
query={query}
|
|
100
|
+
searchQuery={searchQuery}
|
|
101
|
+
setSearchQuery={setSearchQuery}
|
|
102
|
+
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
103
|
+
catalogConfig={catalogConfig}
|
|
104
|
+
sortOption={sortOption}
|
|
105
|
+
setSortOption={setSortOption}
|
|
106
|
+
handleSortClick={handleSortClick}
|
|
107
|
+
isColumnSorted={isColumnSorted}
|
|
108
|
+
shouldShowLoadMore={shouldShowLoadMore}
|
|
109
|
+
/>
|
|
110
|
+
</TabItem>
|
|
111
|
+
</Tabs>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const TabItem = styled.div<{ label: string; icon?: ReactNode }>`
|
|
117
|
+
padding: 12px;
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
const EntityDescription = styled.div`
|
|
121
|
+
font-size: var(--catalog-table-entity-summary-font-size);
|
|
122
|
+
line-height: var(--catalog-table-entity-summary-line-height);
|
|
123
|
+
display: -webkit-box;
|
|
124
|
+
-webkit-line-clamp: 2;
|
|
125
|
+
-webkit-box-orient: vertical;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
`;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { EntityType } from '@redocly/theme/core/types';
|
|
4
|
+
import { CodeIcon } from '@redocly/theme/icons/CodeIcon/CodeIcon';
|
|
5
|
+
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
6
|
+
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
|
+
import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
|
|
8
|
+
|
|
9
|
+
const iconColor = 'var(--catalog-entity-icon-color)';
|
|
10
|
+
|
|
11
|
+
const entityIconMap: Record<EntityType, JSX.Element> = {
|
|
12
|
+
service: <CodeIcon color={iconColor} />,
|
|
13
|
+
domain: <GraphIcon color={iconColor} />,
|
|
14
|
+
team: <PeopleIcon color={iconColor} />,
|
|
15
|
+
user: <UserIcon color={iconColor} />,
|
|
16
|
+
'api-description': <CodeIcon color={iconColor} />,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type CatalogEntityIconProps = {
|
|
20
|
+
entityType: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function CatalogEntityIcon({ entityType }: CatalogEntityIconProps): JSX.Element {
|
|
24
|
+
const key = entityType.toLowerCase() as EntityType;
|
|
25
|
+
|
|
26
|
+
switch (key) {
|
|
27
|
+
case 'service':
|
|
28
|
+
return entityIconMap.service;
|
|
29
|
+
case 'domain':
|
|
30
|
+
return entityIconMap.domain;
|
|
31
|
+
case 'team':
|
|
32
|
+
return entityIconMap.team;
|
|
33
|
+
case 'user':
|
|
34
|
+
return entityIconMap.user;
|
|
35
|
+
case 'api-description':
|
|
36
|
+
return entityIconMap['api-description'];
|
|
37
|
+
default:
|
|
38
|
+
const exhaustiveCheck: never = key;
|
|
39
|
+
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { CodeIcon } from '@redocly/theme/icons/CodeIcon/CodeIcon';
|
|
5
|
+
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
6
|
+
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
|
+
import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
|
|
8
|
+
|
|
9
|
+
const getEntityIcon = (entityType: string): ReactNode => {
|
|
10
|
+
const iconColor = 'var(--catalog-entity-icon-color)';
|
|
11
|
+
|
|
12
|
+
switch (entityType.toLowerCase()) {
|
|
13
|
+
case 'service':
|
|
14
|
+
return <CodeIcon color={iconColor} />;
|
|
15
|
+
case 'domain':
|
|
16
|
+
return <GraphIcon color={iconColor} />;
|
|
17
|
+
case 'team':
|
|
18
|
+
return <PeopleIcon color={iconColor} />;
|
|
19
|
+
case 'user':
|
|
20
|
+
return <UserIcon color={iconColor} />;
|
|
21
|
+
default:
|
|
22
|
+
return <CodeIcon color={iconColor} />;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type CatalogEntityTypeIconProps = {
|
|
27
|
+
entityType: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function CatalogEntityTypeIcon({ entityType }: CatalogEntityTypeIconProps) {
|
|
31
|
+
return (
|
|
32
|
+
<IconContainer data-component-name="Catalog/CatalogEntityTypeIcon">
|
|
33
|
+
{getEntityIcon(entityType)}
|
|
34
|
+
</IconContainer>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const IconContainer = styled.div`
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
width: var(--catalog-table-icon-width);
|
|
43
|
+
height: var(--catalog-table-icon-height);
|
|
44
|
+
border-radius: var(--catalog-table-icon-border-radius);
|
|
45
|
+
background-color: var(--catalog-table-icon-bg-color);
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
border: var(--catalog-table-icon-border-width) solid var(--catalog-table-icon-border-color);
|
|
48
|
+
`;
|