@eventcatalog/core 2.65.0 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -26
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-NK6OYMRD.js → chunk-JB4YT5JY.js} +1 -1
- package/dist/{chunk-BMDTX5IN.js → chunk-TQ4HZREX.js} +1 -1
- package/dist/{chunk-IJRFYF4B.js → chunk-X4W4YC3U.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -21
- package/dist/eventcatalog.config.d.cts +10 -0
- package/dist/eventcatalog.config.d.ts +10 -0
- package/dist/eventcatalog.js +3 -20
- package/eventcatalog/src/components/CopyAsMarkdown.tsx +19 -1
- package/eventcatalog/src/components/FavoriteButton.tsx +54 -0
- package/eventcatalog/src/components/Grids/DomainGrid.tsx +386 -362
- package/eventcatalog/src/components/Grids/MessageGrid.tsx +166 -518
- package/eventcatalog/src/components/Header.astro +48 -23
- package/eventcatalog/src/components/Lists/VersionList.astro +2 -2
- package/eventcatalog/src/components/MDX/Design/Design.astro +4 -1
- package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -1
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +3 -3
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +8 -2
- package/eventcatalog/src/components/SchemaExplorer/SchemaPageViewer.tsx +37 -0
- package/eventcatalog/src/components/Search/Search.astro +48 -28
- package/eventcatalog/src/components/Search/SearchModal.tsx +393 -702
- package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +298 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/container.ts +66 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/domain.ts +101 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/flow.ts +29 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/message.ts +84 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/service.ts +147 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/shared.ts +146 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +1073 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/sidebar-builder.ts +365 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/storage.ts +90 -0
- package/eventcatalog/src/components/SideNav/SideNav.astro +18 -28
- package/eventcatalog/src/content.config.ts +2 -0
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +10 -4
- package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +3 -3
- package/eventcatalog/src/layouts/DirectoryLayout.astro +2 -2
- package/eventcatalog/src/layouts/DiscoverLayout.astro +3 -3
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +85 -63
- package/eventcatalog/src/layouts/VisualiserLayout.astro +3 -3
- package/eventcatalog/src/pages/_index.astro +530 -110
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +64 -0
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +29 -0
- package/eventcatalog/src/pages/directory/[type]/_index.data.ts +4 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +1 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +3 -3
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +1 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +362 -190
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +4 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +1 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +3 -27
- package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +2 -2
- package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +2 -2
- package/eventcatalog/src/pages/index.astro +14 -5
- package/eventcatalog/src/pages/nav-index.json.ts +30 -0
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +77 -0
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +90 -0
- package/eventcatalog/src/pages/schemas/{index.astro → explorer/index.astro} +3 -3
- package/eventcatalog/src/pages/studio.astro +3 -3
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +4 -3
- package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +2 -2
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +4 -3
- package/eventcatalog/src/stores/favorites-store.ts +83 -0
- package/eventcatalog/src/stores/sidebar-store.ts +8 -0
- package/eventcatalog/src/utils/collections/changelogs.ts +7 -4
- package/eventcatalog/src/utils/{channels.ts → collections/channels.ts} +81 -31
- package/eventcatalog/src/utils/collections/commands.ts +134 -0
- package/eventcatalog/src/utils/collections/containers.ts +44 -33
- package/eventcatalog/src/utils/collections/domains.ts +204 -62
- package/eventcatalog/src/utils/{entities.ts → collections/entities.ts} +44 -24
- package/eventcatalog/src/utils/collections/events.ts +136 -0
- package/eventcatalog/src/utils/collections/flows.ts +59 -25
- package/eventcatalog/src/utils/{messages.ts → collections/messages.ts} +13 -4
- package/eventcatalog/src/utils/{queries.ts → collections/queries.ts} +49 -28
- package/eventcatalog/src/utils/collections/services.ts +100 -68
- package/eventcatalog/src/utils/collections/teams.ts +94 -0
- package/eventcatalog/src/utils/collections/users.ts +122 -0
- package/eventcatalog/src/utils/collections/util.ts +57 -1
- package/eventcatalog/src/utils/feature.ts +3 -1
- package/eventcatalog/src/utils/{collections/file-diffs.ts → file-diffs.ts} +1 -1
- package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +2 -0
- package/eventcatalog/src/utils/node-graphs/domain-entity-map.ts +16 -6
- package/eventcatalog/src/utils/node-graphs/domains-canvas.ts +14 -10
- package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +36 -64
- package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +23 -19
- package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +36 -49
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +22 -18
- package/eventcatalog/src/utils/page-loaders/page-data-loader.ts +4 -4
- package/eventcatalog/tailwind.config.mjs +14 -0
- package/eventcatalog/tsconfig.json +2 -1
- package/package.json +7 -4
- package/eventcatalog/public/logo_old.png +0 -0
- package/eventcatalog/src/components/DiscoverInsight.astro +0 -61
- package/eventcatalog/src/components/Grids/ServiceGrid.tsx +0 -534
- package/eventcatalog/src/components/Lists/CustomSideBarSectionList.astro +0 -55
- package/eventcatalog/src/components/Lists/ProtocolList.tsx +0 -74
- package/eventcatalog/src/components/Lists/RepositoryList.astro +0 -37
- package/eventcatalog/src/components/Lists/SpecificationsList.astro +0 -67
- package/eventcatalog/src/components/SideBars/ChannelSideBar.astro +0 -204
- package/eventcatalog/src/components/SideBars/ContainerSideBar.astro +0 -180
- package/eventcatalog/src/components/SideBars/DomainSideBar.astro +0 -273
- package/eventcatalog/src/components/SideBars/EntitySideBar.astro +0 -139
- package/eventcatalog/src/components/SideBars/FlowSideBar.astro +0 -128
- package/eventcatalog/src/components/SideBars/MessageSideBar.astro +0 -248
- package/eventcatalog/src/components/SideBars/ServiceSideBar.astro +0 -294
- package/eventcatalog/src/components/SideNav/ListViewSideBar/components/CollapsibleGroup.tsx +0 -46
- package/eventcatalog/src/components/SideNav/ListViewSideBar/components/MessageList.tsx +0 -78
- package/eventcatalog/src/components/SideNav/ListViewSideBar/components/SpecificationList.tsx +0 -83
- package/eventcatalog/src/components/SideNav/ListViewSideBar/index.tsx +0 -1250
- package/eventcatalog/src/components/SideNav/ListViewSideBar/types.ts +0 -91
- package/eventcatalog/src/components/SideNav/ListViewSideBar/utils.ts +0 -201
- package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +0 -190
- package/eventcatalog/src/components/SideNav/TreeView/index.tsx +0 -94
- package/eventcatalog/src/components/TreeView/index.tsx +0 -328
- package/eventcatalog/src/components/TreeView/styles.module.css +0 -264
- package/eventcatalog/src/components/TreeView/useSlots.ts +0 -95
- package/eventcatalog/src/pages/architecture/[type]/index.astro +0 -14
- package/eventcatalog/src/pages/architecture/architecture.astro +0 -101
- package/eventcatalog/src/pages/architecture/docs/[type]/index.astro +0 -14
- package/eventcatalog/src/utils/commands.ts +0 -112
- package/eventcatalog/src/utils/events.ts +0 -108
- package/eventcatalog/src/utils/generators/index.ts +0 -10
- package/eventcatalog/src/utils/teams.ts +0 -72
- package/eventcatalog/src/utils/users.ts +0 -72
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { CollectionEntry } from 'astro:content';
|
|
2
|
+
import { buildUrl } from '@utils/url-builder';
|
|
3
|
+
import { getSpecificationsForService } from '@utils/collections/services';
|
|
4
|
+
import type { NavNode, ChildRef } from './shared';
|
|
5
|
+
import {
|
|
6
|
+
uniqueBy,
|
|
7
|
+
buildQuickReferenceSection,
|
|
8
|
+
buildOwnersSection,
|
|
9
|
+
shouldRenderSideBarSection,
|
|
10
|
+
buildResourceGroupSections,
|
|
11
|
+
buildRepositorySection,
|
|
12
|
+
} from './shared';
|
|
13
|
+
import { isVisualiserEnabled } from '@utils/feature';
|
|
14
|
+
import { pluralizeMessageType } from '@utils/collections/messages';
|
|
15
|
+
|
|
16
|
+
export const buildServiceNode = (service: CollectionEntry<'services'>, owners: any[], context: any): NavNode => {
|
|
17
|
+
const sendsMessages = service.data.sends || [];
|
|
18
|
+
const receivesMessages = service.data.receives || [];
|
|
19
|
+
const serviceEntities = service.data.entities || [];
|
|
20
|
+
|
|
21
|
+
const specifications = getSpecificationsForService(service);
|
|
22
|
+
const hasSpecifications = specifications.length > 0;
|
|
23
|
+
const openAPISpecifications = specifications.filter((specification) => specification.type === 'openapi');
|
|
24
|
+
const asyncAPISpecifications = specifications.filter((specification) => specification.type === 'asyncapi');
|
|
25
|
+
const graphQLSpecifications = specifications.filter((specification) => specification.type === 'graphql');
|
|
26
|
+
|
|
27
|
+
const dataStoresInService = uniqueBy([...(service.data.writesTo || []), ...(service.data.readsFrom || [])], 'id');
|
|
28
|
+
|
|
29
|
+
const serviceFlows = service.data.flows || [];
|
|
30
|
+
const hasFlows = serviceFlows.length > 0;
|
|
31
|
+
|
|
32
|
+
const hasDataStores = dataStoresInService.length > 0;
|
|
33
|
+
const resourceGroups = service.data.resourceGroups || [];
|
|
34
|
+
const hasResourceGroups = resourceGroups.length > 0;
|
|
35
|
+
|
|
36
|
+
const renderResourceGroups = hasResourceGroups && shouldRenderSideBarSection(service, 'resourceGroups');
|
|
37
|
+
const renderVisualiser = isVisualiserEnabled();
|
|
38
|
+
const renderMessages = shouldRenderSideBarSection(service, 'messages');
|
|
39
|
+
const renderSpecifications = hasSpecifications && shouldRenderSideBarSection(service, 'specifications');
|
|
40
|
+
const renderEntities = serviceEntities.length > 0 && shouldRenderSideBarSection(service, 'entities');
|
|
41
|
+
const renderOwners = owners.length > 0 && shouldRenderSideBarSection(service, 'owners');
|
|
42
|
+
const renderRepository = service.data.repository && shouldRenderSideBarSection(service, 'repository');
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
type: 'item',
|
|
46
|
+
title: service.data.name,
|
|
47
|
+
badge: 'Service',
|
|
48
|
+
summary: service.data.summary,
|
|
49
|
+
pages: [
|
|
50
|
+
buildQuickReferenceSection([
|
|
51
|
+
{ title: 'Overview', href: buildUrl(`/docs/services/${service.data.id}/${service.data.version}`) },
|
|
52
|
+
]),
|
|
53
|
+
{
|
|
54
|
+
type: 'group',
|
|
55
|
+
title: 'Architecture & Design',
|
|
56
|
+
icon: 'Workflow',
|
|
57
|
+
pages: [
|
|
58
|
+
{
|
|
59
|
+
type: 'item',
|
|
60
|
+
title: 'Architecture Diagram',
|
|
61
|
+
href: buildUrl(`/architecture/services/${service.data.id}/${service.data.version}`),
|
|
62
|
+
},
|
|
63
|
+
renderVisualiser && {
|
|
64
|
+
type: 'item',
|
|
65
|
+
title: 'Interaction Map',
|
|
66
|
+
href: buildUrl(`/visualiser/services/${service.data.id}/${service.data.version}`),
|
|
67
|
+
},
|
|
68
|
+
renderVisualiser &&
|
|
69
|
+
hasDataStores && {
|
|
70
|
+
type: 'item',
|
|
71
|
+
title: 'Data Map',
|
|
72
|
+
href: buildUrl(`/visualiser/services/${service.data.id}/${service.data.version}/data`),
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
renderSpecifications && {
|
|
77
|
+
type: 'group',
|
|
78
|
+
title: 'API & Contracts',
|
|
79
|
+
icon: 'FileCode',
|
|
80
|
+
pages: [
|
|
81
|
+
...openAPISpecifications.map((specification) => ({
|
|
82
|
+
type: 'item',
|
|
83
|
+
title: `${specification.name} (OpenAPI)`,
|
|
84
|
+
href: buildUrl(
|
|
85
|
+
`/docs/services/${service.data.id}/${service.data.version}/spec/${specification.filenameWithoutExtension}`
|
|
86
|
+
),
|
|
87
|
+
})),
|
|
88
|
+
...asyncAPISpecifications.map((specification) => ({
|
|
89
|
+
type: 'item',
|
|
90
|
+
title: `${specification.name} (AsyncAPI)`,
|
|
91
|
+
href: buildUrl(
|
|
92
|
+
`/docs/services/${service.data.id}/${service.data.version}/asyncapi/${specification.filenameWithoutExtension}`
|
|
93
|
+
),
|
|
94
|
+
})),
|
|
95
|
+
...graphQLSpecifications.map((specification) => ({
|
|
96
|
+
type: 'item',
|
|
97
|
+
title: `${specification.name} (GraphQL)`,
|
|
98
|
+
href: buildUrl(
|
|
99
|
+
`/docs/services/${service.data.id}/${service.data.version}/graphql/${specification.filenameWithoutExtension}`
|
|
100
|
+
),
|
|
101
|
+
})),
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
renderResourceGroups && buildResourceGroupSections(resourceGroups, context),
|
|
105
|
+
hasDataStores && {
|
|
106
|
+
type: 'group',
|
|
107
|
+
title: 'State and Persistence',
|
|
108
|
+
icon: 'Database',
|
|
109
|
+
pages: dataStoresInService.map(
|
|
110
|
+
(dataStore) => `container:${(dataStore as any).data.id}:${(dataStore as any).data.version}`
|
|
111
|
+
),
|
|
112
|
+
},
|
|
113
|
+
renderEntities && {
|
|
114
|
+
type: 'group',
|
|
115
|
+
title: 'Entities',
|
|
116
|
+
icon: 'Box',
|
|
117
|
+
pages: serviceEntities.map((entity) => `entity:${(entity as any).data.id}:${(entity as any).data.version}`),
|
|
118
|
+
},
|
|
119
|
+
sendsMessages.length > 0 &&
|
|
120
|
+
renderMessages && {
|
|
121
|
+
type: 'group',
|
|
122
|
+
title: 'Outbound Messages',
|
|
123
|
+
icon: 'Mail',
|
|
124
|
+
pages: sendsMessages.map(
|
|
125
|
+
(message) => `${pluralizeMessageType(message as any)}:${(message as any).data.id}:${(message as any).data.version}`
|
|
126
|
+
),
|
|
127
|
+
},
|
|
128
|
+
receivesMessages.length > 0 &&
|
|
129
|
+
renderMessages && {
|
|
130
|
+
type: 'group',
|
|
131
|
+
title: 'Inbound Messages',
|
|
132
|
+
icon: 'Mail',
|
|
133
|
+
pages: receivesMessages.map(
|
|
134
|
+
(receive) => `${pluralizeMessageType(receive as any)}:${(receive as any).data.id}:${(receive as any).data.version}`
|
|
135
|
+
),
|
|
136
|
+
},
|
|
137
|
+
hasFlows && {
|
|
138
|
+
type: 'group',
|
|
139
|
+
title: 'Flows',
|
|
140
|
+
icon: 'Waypoints',
|
|
141
|
+
pages: serviceFlows.map((flow) => `flow:${(flow as any).data.id}:${(flow as any).data.version}`),
|
|
142
|
+
},
|
|
143
|
+
renderOwners && buildOwnersSection(owners),
|
|
144
|
+
renderRepository && buildRepositorySection(service.data.repository as { url: string; language: string }),
|
|
145
|
+
].filter(Boolean) as ChildRef[],
|
|
146
|
+
};
|
|
147
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { ResourceGroup } from '@eventcatalog/sdk';
|
|
2
|
+
import type { CollectionEntry } from 'astro:content';
|
|
3
|
+
import { getLatestVersionInCollectionById } from '@utils/collections/util';
|
|
4
|
+
import { buildUrl } from '@utils/url-builder';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A child reference can be:
|
|
8
|
+
* - A string key (resolved from nodes map)
|
|
9
|
+
* - An inline node definition
|
|
10
|
+
*/
|
|
11
|
+
export type ChildRef = string | NavNode;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A navigation node (can be section or item)
|
|
15
|
+
*/
|
|
16
|
+
export type NavNode = {
|
|
17
|
+
type: 'group' | 'item';
|
|
18
|
+
title: string;
|
|
19
|
+
icon?: string; // Lucide icon name
|
|
20
|
+
href?: string; // URL (for leaf items)
|
|
21
|
+
external?: boolean; // If true, the item will open in a new tab
|
|
22
|
+
pages?: ChildRef[]; // Can mix keys and inline nodes
|
|
23
|
+
visible?: boolean; // If false, hide this node (default: true)
|
|
24
|
+
badge?: string; // Category badge shown in header (e.g., "Domain", "Service", "Message")
|
|
25
|
+
summary?: string; // Short description of the item
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The flat navigation data structure
|
|
30
|
+
*/
|
|
31
|
+
export type NavigationData = {
|
|
32
|
+
roots: ChildRef[]; // What to show at top level
|
|
33
|
+
nodes: Record<string, NavNode>; // Flat map of all nodes by key
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const uniqueBy = <T>(array: T[], key: keyof T): T[] => {
|
|
37
|
+
const seen = new Set();
|
|
38
|
+
return array.filter((item) => {
|
|
39
|
+
const value = item[key];
|
|
40
|
+
if (seen.has(value)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
seen.add(value);
|
|
44
|
+
return true;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type ResourceGroupContext = {
|
|
49
|
+
services: CollectionEntry<'services'>[];
|
|
50
|
+
domains: CollectionEntry<'domains'>[];
|
|
51
|
+
events: CollectionEntry<'events'>[];
|
|
52
|
+
commands: CollectionEntry<'commands'>[];
|
|
53
|
+
queries: CollectionEntry<'queries'>[];
|
|
54
|
+
flows: CollectionEntry<'flows'>[];
|
|
55
|
+
containers: CollectionEntry<'containers'>[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const buildQuickReferenceSection = (items: { title: string; href: string }[]): NavNode => ({
|
|
59
|
+
type: 'group',
|
|
60
|
+
title: 'Quick Reference',
|
|
61
|
+
icon: 'BookOpen',
|
|
62
|
+
pages: items.map((item) => ({
|
|
63
|
+
type: 'item',
|
|
64
|
+
title: item.title,
|
|
65
|
+
href: item.href,
|
|
66
|
+
})),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const buildOwnersSection = (owners: any[]): NavNode | null => {
|
|
70
|
+
if (owners.length === 0) return null;
|
|
71
|
+
return {
|
|
72
|
+
type: 'group',
|
|
73
|
+
title: 'Owners',
|
|
74
|
+
icon: 'Users',
|
|
75
|
+
pages: owners.map((owner) => ({
|
|
76
|
+
type: 'item',
|
|
77
|
+
title: owner?.data.name ?? '',
|
|
78
|
+
href: buildUrl(`/docs/${owner?.collection}/${owner?.data.id}`),
|
|
79
|
+
})),
|
|
80
|
+
visible: true,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const buildRepositorySection = (repository: { url: string; language: string }): NavNode | null => {
|
|
85
|
+
if (!repository) return null;
|
|
86
|
+
return {
|
|
87
|
+
type: 'group',
|
|
88
|
+
title: 'Code',
|
|
89
|
+
icon: 'Code',
|
|
90
|
+
pages: [
|
|
91
|
+
{
|
|
92
|
+
type: 'item',
|
|
93
|
+
title: repository.url,
|
|
94
|
+
href: repository.url,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const buildResourceGroupSections = (resourceGroups: ResourceGroup[], context: ResourceGroupContext) => {
|
|
101
|
+
return resourceGroups.map((resourceGroup) => buildResourceGroupSection(resourceGroup, context));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const buildResourceGroupSection = (resourceGroup: ResourceGroup, context: ResourceGroupContext) => {
|
|
105
|
+
// Only render resource groups that have a type
|
|
106
|
+
const resourcesWithTypes = resourceGroup.items.filter((item) => item.type !== undefined);
|
|
107
|
+
|
|
108
|
+
if (resourcesWithTypes.length === 0) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// If no version is provided, we need to get the latest version
|
|
113
|
+
const resourcesWithVersions = resourcesWithTypes.map((item) => {
|
|
114
|
+
let collection: any[] = [];
|
|
115
|
+
|
|
116
|
+
if (item.type === 'service') collection = context.services;
|
|
117
|
+
else if (item.type === 'domain') collection = context.domains;
|
|
118
|
+
else if (item.type === 'event') collection = context.events;
|
|
119
|
+
else if (item.type === 'command') collection = context.commands;
|
|
120
|
+
else if (item.type === 'query') collection = context.queries;
|
|
121
|
+
else if (item.type === 'flow') collection = context.flows;
|
|
122
|
+
else if (item.type === 'container') collection = context.containers;
|
|
123
|
+
|
|
124
|
+
if (item.version === undefined || item.version === 'latest') {
|
|
125
|
+
return { ...item, version: getLatestVersionInCollectionById(collection, item.id as string) };
|
|
126
|
+
}
|
|
127
|
+
return item;
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
type: 'group',
|
|
132
|
+
title: resourceGroup.title,
|
|
133
|
+
icon: 'Box',
|
|
134
|
+
pages: resourcesWithVersions.map((item) => {
|
|
135
|
+
const type = ['event', 'command', 'query'].includes(item.type as string) ? 'message' : item.type;
|
|
136
|
+
return `${type}:${item.id}:${item.version}`;
|
|
137
|
+
}),
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const shouldRenderSideBarSection = (resource: any, section: string) => {
|
|
142
|
+
if (!resource.data.detailsPanel) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
return resource.data.detailsPanel[section]?.visible ?? true;
|
|
146
|
+
};
|