@eventcatalog/core 3.0.0-beta.8 → 3.0.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 +41 -98
- package/dist/__mocks__/astro-content.cjs +32 -0
- package/dist/__mocks__/astro-content.d.cts +13 -0
- package/dist/__mocks__/astro-content.d.ts +13 -0
- package/dist/__mocks__/astro-content.js +7 -0
- 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/catalog-to-astro-content-directory.cjs +2 -19
- package/dist/catalog-to-astro-content-directory.d.cts +1 -2
- package/dist/catalog-to-astro-content-directory.d.ts +1 -2
- package/dist/catalog-to-astro-content-directory.js +3 -5
- package/dist/{chunk-R2BJ7MJG.js → chunk-6Z6ARMQS.js} +1 -17
- package/dist/{chunk-LQUXA3NB.js → chunk-BYP43AAT.js} +1 -1
- package/dist/{chunk-UTHNQFM7.js → chunk-E5Q7TZYT.js} +1 -1
- package/dist/{chunk-KEYJ3FB3.js → chunk-EKGR533N.js} +1 -1
- package/dist/{chunk-7MCE4J6I.js → chunk-KF5PARQK.js} +1 -1
- package/dist/{chunk-I3QUYHIK.js → chunk-VO5WYA44.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +20 -64
- package/dist/eventcatalog.config.d.cts +4 -0
- package/dist/eventcatalog.config.d.ts +4 -0
- package/dist/eventcatalog.js +26 -52
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/astro.config.mjs +4 -1
- package/eventcatalog/integrations/eventcatalog-features.ts +69 -0
- package/eventcatalog/public/icons/asyncapi-black.svg +2 -0
- package/eventcatalog/public/icons/graphql-black.svg +1 -0
- package/eventcatalog/public/icons/openapi-black.svg +1 -0
- package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +994 -0
- package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +24 -0
- package/eventcatalog/src/components/Grids/DomainGrid.tsx +310 -173
- package/eventcatalog/src/components/Grids/MessageGrid.tsx +299 -180
- package/eventcatalog/src/components/Grids/specification-utils.ts +106 -0
- package/eventcatalog/src/components/Header.astro +25 -5
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +14 -3
- package/eventcatalog/src/components/SchemaExplorer/ApiAccessSection.tsx +95 -90
- package/eventcatalog/src/components/SchemaExplorer/ApiContentViewer.tsx +144 -0
- package/eventcatalog/src/components/SchemaExplorer/Pagination.tsx +34 -8
- package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +2 -2
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsHeader.tsx +140 -109
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +5 -14
- package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +247 -59
- package/eventcatalog/src/components/SchemaExplorer/SchemaFilters.tsx +64 -126
- package/eventcatalog/src/components/SchemaExplorer/SchemaListItem.tsx +41 -43
- package/eventcatalog/src/components/Search/Search.astro +2 -2
- package/eventcatalog/src/components/Search/SearchDataLoader.astro +25 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +6 -3
- package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +44 -16
- package/eventcatalog/src/components/SideNav/SideNav.astro +0 -15
- package/eventcatalog/src/components/Tables/Table.tsx +96 -77
- package/eventcatalog/src/components/Tables/columns/ContainersTableColumns.tsx +108 -74
- package/eventcatalog/src/components/Tables/columns/DomainTableColumns.tsx +74 -55
- package/eventcatalog/src/components/Tables/columns/FlowTableColumns.tsx +36 -36
- package/eventcatalog/src/components/Tables/columns/MessageTableColumns.tsx +110 -77
- package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +105 -94
- package/eventcatalog/src/components/Tables/columns/SharedColumns.tsx +31 -26
- package/eventcatalog/src/components/Tables/columns/TeamsTableColumns.tsx +115 -215
- package/eventcatalog/src/components/Tables/columns/UserTableColumns.tsx +145 -243
- package/eventcatalog/src/content.config.ts +1 -13
- package/eventcatalog/src/enterprise/ai/chat-api.ts +360 -0
- package/eventcatalog/src/enterprise/auth/[...auth].ts +3 -0
- package/eventcatalog/src/enterprise/auth/login.astro +420 -0
- package/eventcatalog/src/enterprise/collections/index.ts +0 -1
- package/eventcatalog/src/layouts/Footer.astro +8 -5
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +133 -117
- package/eventcatalog/src/pages/_index.astro +243 -559
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +8 -2
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +9 -5
- package/eventcatalog/src/pages/directory/[type]/index.astro +6 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +19 -3
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +7 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +10 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +194 -121
- package/eventcatalog/src/pages/docs/teams/[id]/index.astro +94 -70
- package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +36 -0
- package/eventcatalog/src/pages/docs/users/[id]/index.astro +56 -45
- package/eventcatalog/src/pages/docs/users/[id].mdx.ts +36 -0
- package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +178 -0
- package/eventcatalog/src/pages/schemas/explorer/index.astro +7 -157
- package/eventcatalog/src/pages/studio.astro +124 -72
- package/eventcatalog/src/remark-plugins/directives.ts +30 -9
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/container.ts +10 -1
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/domain.ts +17 -7
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/message.ts +10 -1
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/service.ts +11 -4
- package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/shared.ts +14 -0
- package/eventcatalog/src/stores/{sidebar-store.ts → sidebar-store/index.ts} +1 -1
- package/eventcatalog/src/utils/collections/channels.ts +0 -2
- package/eventcatalog/src/utils/collections/commands.ts +0 -2
- package/eventcatalog/src/utils/collections/containers.ts +0 -2
- package/eventcatalog/src/utils/collections/domains.ts +0 -2
- package/eventcatalog/src/utils/collections/entities.ts +0 -2
- package/eventcatalog/src/utils/collections/events.ts +0 -2
- package/eventcatalog/src/utils/collections/flows.ts +0 -2
- package/eventcatalog/src/utils/collections/queries.ts +0 -2
- package/eventcatalog/src/utils/collections/schemas.ts +45 -7
- package/eventcatalog/src/utils/collections/services.ts +0 -2
- package/eventcatalog/src/utils/feature.ts +9 -5
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +1 -1
- package/eventcatalog/src/utils/resource-files.ts +86 -0
- package/package.json +12 -15
- package/default-files-for-collections/changelogs.md +0 -5
- package/default-files-for-collections/channels.md +0 -8
- package/default-files-for-collections/commands.md +0 -8
- package/default-files-for-collections/domains.md +0 -8
- package/default-files-for-collections/events.md +0 -8
- package/default-files-for-collections/flows.md +0 -11
- package/default-files-for-collections/queries.md +0 -8
- package/default-files-for-collections/services.md +0 -8
- package/default-files-for-collections/ubiquitousLanguages.md +0 -7
- package/eventcatalog/src/enterprise/collections/chat-prompts.ts +0 -32
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/Chat.tsx +0 -60
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatMessage.tsx +0 -414
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatSidebar.tsx +0 -169
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/InputModal.tsx +0 -244
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/MentionInput.tsx +0 -211
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/WelcomePromptArea.tsx +0 -176
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/default-prompts.ts +0 -93
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/hooks/ChatProvider.tsx +0 -143
- package/eventcatalog/src/enterprise/eventcatalog-chat/components/windows/ChatWindow.server.tsx +0 -387
- package/eventcatalog/src/enterprise/eventcatalog-chat/pages/api/chat.ts +0 -59
- package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +0 -104
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/ai-provider.ts +0 -140
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/anthropic.ts +0 -28
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/google.ts +0 -41
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/index.ts +0 -26
- package/eventcatalog/src/enterprise/eventcatalog-chat/providers/openai.ts +0 -61
- package/eventcatalog/src/enterprise/eventcatalog-chat/utils/chat-prompts.ts +0 -50
- package/eventcatalog/src/pages/auth/login.astro +0 -280
- package/eventcatalog/src/pages/chat/feature.astro +0 -179
- package/eventcatalog/src/pages/chat/index.astro +0 -10
- package/eventcatalog/src/pages/docs/_default-docs.mdx +0 -25
- package/eventcatalog/src/pages/docs/index.astro +0 -33
- package/eventcatalog/src/pages/nav-index.json.ts +0 -30
- /package/eventcatalog/src/{pages → enterprise}/auth/error.astro +0 -0
- /package/eventcatalog/src/{middleware-auth.ts → enterprise/auth/middleware/middleware-auth.ts} +0 -0
- /package/eventcatalog/src/{middleware.ts → enterprise/auth/middleware/middleware.ts} +0 -0
- /package/eventcatalog/src/{pages/unauthorized/index.astro → enterprise/auth/unauthorized.astro} +0 -0
- /package/eventcatalog/src/{pages → enterprise}/plans/index.astro +0 -0
- /package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/flow.ts +0 -0
- /package/eventcatalog/src/{components/SideNav/NestedSideBar/sidebar-builder.ts → stores/sidebar-store/state.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ServerIcon, BoltIcon, ChatBubbleLeftIcon, MagnifyingGlassIcon } from '@heroicons/react/24/solid';
|
|
2
2
|
import { createColumnHelper } from '@tanstack/react-table';
|
|
3
|
-
import { useMemo } from 'react';
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
4
|
import { filterByName, filterCollectionByName } from '../filters/custom-filters';
|
|
5
5
|
import { buildUrl } from '@utils/url-builder';
|
|
6
6
|
import { createBadgesColumn } from './SharedColumns';
|
|
@@ -32,23 +32,22 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
32
32
|
const type = useMemo(() => messageRaw.collection.slice(0, -1), [messageRaw.collection]);
|
|
33
33
|
const { color, Icon } = getColorAndIconForMessageType(type);
|
|
34
34
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
<a
|
|
36
|
+
href={buildUrl(`/docs/${messageRaw.collection}/${messageRaw.data.id}/${messageRaw.data.version}`)}
|
|
37
|
+
className="group inline-flex items-center"
|
|
38
|
+
>
|
|
39
|
+
<span
|
|
40
|
+
className={`inline-flex items-center rounded-md border border-gray-200 bg-white hover:border-${color}-300 hover:bg-${color}-50 transition-colors`}
|
|
39
41
|
>
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</div>
|
|
50
|
-
</a>
|
|
51
|
-
</div>
|
|
42
|
+
<span className={`flex items-center justify-center w-6 h-6 bg-${color}-500 rounded-l-md`}>
|
|
43
|
+
<Icon className="h-3 w-3 text-white" />
|
|
44
|
+
</span>
|
|
45
|
+
<span className="px-2 py-1 text-xs text-gray-700 group-hover:text-gray-900">
|
|
46
|
+
{messageRaw.data.name}
|
|
47
|
+
<span className="text-gray-400 ml-1">v{messageRaw.data.version}</span>
|
|
48
|
+
</span>
|
|
49
|
+
</span>
|
|
50
|
+
</a>
|
|
52
51
|
);
|
|
53
52
|
},
|
|
54
53
|
meta: {
|
|
@@ -60,11 +59,16 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
60
59
|
columnHelper.accessor('data.summary', {
|
|
61
60
|
id: 'summary',
|
|
62
61
|
header: () => <span>{tableConfiguration.columns?.summary?.label || 'Summary'}</span>,
|
|
63
|
-
cell: (info) =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
cell: (info) => {
|
|
63
|
+
const summary = info.renderValue() as string;
|
|
64
|
+
const isDraft = info.row.original.data.draft;
|
|
65
|
+
const displayText = `${summary || ''}${isDraft ? ' (Draft)' : ''}`;
|
|
66
|
+
return (
|
|
67
|
+
<span className="text-sm text-gray-600 line-clamp-2" title={displayText}>
|
|
68
|
+
{displayText}
|
|
69
|
+
</span>
|
|
70
|
+
);
|
|
71
|
+
},
|
|
68
72
|
footer: (info) => info.column.id,
|
|
69
73
|
meta: {
|
|
70
74
|
showFilter: false,
|
|
@@ -81,32 +85,43 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
81
85
|
},
|
|
82
86
|
cell: (info) => {
|
|
83
87
|
const producers = info.getValue();
|
|
88
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
89
|
+
|
|
84
90
|
if (producers?.length === 0 || !producers)
|
|
85
|
-
return
|
|
91
|
+
return (
|
|
92
|
+
<span className="inline-flex items-center px-2 py-1 text-xs text-gray-400 bg-gray-50 rounded-md border border-gray-100">
|
|
93
|
+
No producers
|
|
94
|
+
</span>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const visibleItems = isExpanded ? producers : producers.slice(0, 4);
|
|
98
|
+
const hiddenCount = producers.length - 4;
|
|
99
|
+
|
|
86
100
|
return (
|
|
87
|
-
<
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
<div className="flex flex-col gap-1.5">
|
|
102
|
+
{visibleItems.map((producer, index) => (
|
|
103
|
+
<a
|
|
104
|
+
key={`${producer.data.id}-${index}`}
|
|
105
|
+
href={buildUrl(`/docs/${producer.collection}/${producer.data.id}/${producer.data.version}`)}
|
|
106
|
+
className="group inline-flex items-center"
|
|
107
|
+
>
|
|
108
|
+
<span className="inline-flex items-center rounded-md border border-gray-200 bg-white hover:border-pink-300 hover:bg-pink-50 transition-colors">
|
|
109
|
+
<span className="flex items-center justify-center w-6 h-6 bg-pink-500 rounded-l-md">
|
|
110
|
+
<ServerIcon className="h-3 w-3 text-white" />
|
|
111
|
+
</span>
|
|
112
|
+
<span className="px-2 py-1 text-xs text-gray-700 group-hover:text-gray-900">
|
|
113
|
+
{producer.data.name}
|
|
114
|
+
<span className="text-gray-400 ml-1">v{producer.data.version}</span>
|
|
115
|
+
</span>
|
|
116
|
+
</span>
|
|
117
|
+
</a>
|
|
118
|
+
))}
|
|
119
|
+
{hiddenCount > 0 && (
|
|
120
|
+
<button onClick={() => setIsExpanded(!isExpanded)} className="text-xs text-gray-500 hover:text-gray-700 text-left">
|
|
121
|
+
{isExpanded ? 'Show less' : `+${hiddenCount} more`}
|
|
122
|
+
</button>
|
|
123
|
+
)}
|
|
124
|
+
</div>
|
|
110
125
|
);
|
|
111
126
|
},
|
|
112
127
|
footer: (info) => info.column.id,
|
|
@@ -121,33 +136,43 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
121
136
|
},
|
|
122
137
|
cell: (info) => {
|
|
123
138
|
const consumers = info.getValue();
|
|
139
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
140
|
+
|
|
124
141
|
if (consumers?.length === 0 || !consumers)
|
|
125
|
-
return
|
|
142
|
+
return (
|
|
143
|
+
<span className="inline-flex items-center px-2 py-1 text-xs text-gray-400 bg-gray-50 rounded-md border border-gray-100">
|
|
144
|
+
No consumers
|
|
145
|
+
</span>
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const visibleItems = isExpanded ? consumers : consumers.slice(0, 4);
|
|
149
|
+
const hiddenCount = consumers.length - 4;
|
|
126
150
|
|
|
127
151
|
return (
|
|
128
|
-
<
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
<div className="flex flex-col gap-1.5">
|
|
153
|
+
{visibleItems.map((consumer, index) => (
|
|
154
|
+
<a
|
|
155
|
+
key={`${consumer.data.id}-${index}`}
|
|
156
|
+
href={buildUrl(`/docs/${consumer.collection}/${consumer.data.id}/${consumer.data.version}`)}
|
|
157
|
+
className="group inline-flex items-center"
|
|
158
|
+
>
|
|
159
|
+
<span className="inline-flex items-center rounded-md border border-gray-200 bg-white hover:border-pink-300 hover:bg-pink-50 transition-colors">
|
|
160
|
+
<span className="flex items-center justify-center w-6 h-6 bg-pink-500 rounded-l-md">
|
|
161
|
+
<ServerIcon className="h-3 w-3 text-white" />
|
|
162
|
+
</span>
|
|
163
|
+
<span className="px-2 py-1 text-xs text-gray-700 group-hover:text-gray-900">
|
|
164
|
+
{consumer.data.name}
|
|
165
|
+
<span className="text-gray-400 ml-1">v{consumer.data.version}</span>
|
|
166
|
+
</span>
|
|
167
|
+
</span>
|
|
168
|
+
</a>
|
|
169
|
+
))}
|
|
170
|
+
{hiddenCount > 0 && (
|
|
171
|
+
<button onClick={() => setIsExpanded(!isExpanded)} className="text-xs text-gray-500 hover:text-gray-700 text-left">
|
|
172
|
+
{isExpanded ? 'Show less' : `+${hiddenCount} more`}
|
|
173
|
+
</button>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
151
176
|
);
|
|
152
177
|
},
|
|
153
178
|
footer: (info) => info.column.id,
|
|
@@ -158,14 +183,22 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
158
183
|
id: 'actions',
|
|
159
184
|
header: () => <span>{tableConfiguration.columns?.actions?.label || 'Actions'}</span>,
|
|
160
185
|
cell: (info) => {
|
|
161
|
-
const
|
|
186
|
+
const item = info.row.original;
|
|
162
187
|
return (
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
188
|
+
<div className="flex items-center gap-2">
|
|
189
|
+
<a
|
|
190
|
+
className="inline-flex items-center px-2.5 py-1 text-xs font-medium text-gray-600 bg-gray-50 border border-gray-200 rounded-md hover:bg-gray-100 hover:text-gray-900 transition-colors whitespace-nowrap"
|
|
191
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
192
|
+
>
|
|
193
|
+
Docs
|
|
194
|
+
</a>
|
|
195
|
+
<a
|
|
196
|
+
className="inline-flex items-center px-2.5 py-1 text-xs font-medium text-gray-600 bg-gray-50 border border-gray-200 rounded-md hover:bg-gray-100 hover:text-gray-900 transition-colors whitespace-nowrap"
|
|
197
|
+
href={buildUrl(`/visualiser/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
198
|
+
>
|
|
199
|
+
Visualiser
|
|
200
|
+
</a>
|
|
201
|
+
</div>
|
|
169
202
|
);
|
|
170
203
|
},
|
|
171
204
|
meta: {
|
|
@@ -15,25 +15,21 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
15
15
|
header: () => <span>{tableConfiguration.columns?.name?.label || 'Service'}</span>,
|
|
16
16
|
cell: (info) => {
|
|
17
17
|
const messageRaw = info.row.original;
|
|
18
|
-
const color = 'pink';
|
|
19
18
|
return (
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
>
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</div>
|
|
35
|
-
</a>
|
|
36
|
-
</div>
|
|
19
|
+
<a
|
|
20
|
+
href={buildUrl(`/docs/${messageRaw.collection}/${messageRaw.data.id}/${messageRaw.data.version}`)}
|
|
21
|
+
className="group inline-flex items-center"
|
|
22
|
+
>
|
|
23
|
+
<span className="inline-flex items-center rounded-md border border-gray-200 bg-white hover:border-pink-300 hover:bg-pink-50 transition-colors">
|
|
24
|
+
<span className="flex items-center justify-center w-6 h-6 bg-pink-500 rounded-l-md">
|
|
25
|
+
<ServerIcon className="h-3 w-3 text-white" />
|
|
26
|
+
</span>
|
|
27
|
+
<span className="px-2 py-1 text-xs text-gray-700 group-hover:text-gray-900">
|
|
28
|
+
{messageRaw.data.name}
|
|
29
|
+
<span className="text-gray-400 ml-1">v{messageRaw.data.version}</span>
|
|
30
|
+
</span>
|
|
31
|
+
</span>
|
|
32
|
+
</a>
|
|
37
33
|
);
|
|
38
34
|
},
|
|
39
35
|
meta: {
|
|
@@ -44,11 +40,16 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
44
40
|
columnHelper.accessor('data.summary', {
|
|
45
41
|
id: 'summary',
|
|
46
42
|
header: () => <span>{tableConfiguration.columns?.summary?.label || 'Summary'}</span>,
|
|
47
|
-
cell: (info) =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
cell: (info) => {
|
|
44
|
+
const summary = info.renderValue() as string;
|
|
45
|
+
const isDraft = info.row.original.data.draft;
|
|
46
|
+
const displayText = `${summary || ''}${isDraft ? ' (Draft)' : ''}`;
|
|
47
|
+
return (
|
|
48
|
+
<span className="text-sm text-gray-600 line-clamp-2" title={displayText}>
|
|
49
|
+
{displayText}
|
|
50
|
+
</span>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
52
53
|
footer: (info) => info.column.id,
|
|
53
54
|
meta: {
|
|
54
55
|
showFilter: false,
|
|
@@ -64,9 +65,7 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
64
65
|
},
|
|
65
66
|
cell: (info) => {
|
|
66
67
|
const receives = info.getValue() || [];
|
|
67
|
-
const
|
|
68
|
-
const isOpen = isExpandable ? receives?.length < 10 : true;
|
|
69
|
-
const [isExpanded, setIsExpanded] = useState(isOpen);
|
|
68
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
70
69
|
|
|
71
70
|
const receiversWithIcons = useMemo(
|
|
72
71
|
() =>
|
|
@@ -80,38 +79,41 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
80
79
|
);
|
|
81
80
|
|
|
82
81
|
if (receives?.length === 0 || !receives)
|
|
83
|
-
return
|
|
82
|
+
return (
|
|
83
|
+
<span className="inline-flex items-center px-2 py-1 text-xs text-gray-400 bg-gray-50 rounded-md border border-gray-100">
|
|
84
|
+
No messages
|
|
85
|
+
</span>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const visibleItems = isExpanded ? receiversWithIcons : receiversWithIcons.slice(0, 4);
|
|
89
|
+
const hiddenCount = receiversWithIcons.length - 4;
|
|
84
90
|
|
|
85
91
|
return (
|
|
86
|
-
<div>
|
|
87
|
-
{
|
|
88
|
-
<
|
|
89
|
-
{
|
|
92
|
+
<div className="flex flex-col gap-1.5">
|
|
93
|
+
{visibleItems.map((consumer, index: number) => (
|
|
94
|
+
<a
|
|
95
|
+
key={`${consumer.data.id}-${index}`}
|
|
96
|
+
href={buildUrl(`/docs/${consumer.collection}/${consumer.data.id}/${consumer.data.version}`)}
|
|
97
|
+
className="group inline-flex items-center"
|
|
98
|
+
>
|
|
99
|
+
<span
|
|
100
|
+
className={`inline-flex items-center rounded-md border border-gray-200 bg-white hover:border-${consumer.color}-300 hover:bg-${consumer.color}-50 transition-colors`}
|
|
101
|
+
>
|
|
102
|
+
<span className={`flex items-center justify-center w-6 h-6 bg-${consumer.color}-500 rounded-l-md`}>
|
|
103
|
+
<consumer.Icon className="h-3 w-3 text-white" />
|
|
104
|
+
</span>
|
|
105
|
+
<span className="px-2 py-1 text-xs text-gray-700 group-hover:text-gray-900">
|
|
106
|
+
{consumer.data.name}
|
|
107
|
+
<span className="text-gray-400 ml-1">v{consumer.data.version}</span>
|
|
108
|
+
</span>
|
|
109
|
+
</span>
|
|
110
|
+
</a>
|
|
111
|
+
))}
|
|
112
|
+
{hiddenCount > 0 && (
|
|
113
|
+
<button onClick={() => setIsExpanded(!isExpanded)} className="text-xs text-gray-500 hover:text-gray-700 text-left">
|
|
114
|
+
{isExpanded ? 'Show less' : `+${hiddenCount} more`}
|
|
90
115
|
</button>
|
|
91
116
|
)}
|
|
92
|
-
{isExpanded && (
|
|
93
|
-
<ul>
|
|
94
|
-
{receiversWithIcons.map((consumer, index: number) => (
|
|
95
|
-
<li key={`${consumer.data.id}-${index}`} className="py-1 group font-light ">
|
|
96
|
-
<a
|
|
97
|
-
href={buildUrl(`/docs/${consumer.collection}/${consumer.data.id}/${consumer.data.version}`)}
|
|
98
|
-
className="group-hover:text-primary flex space-x-1 items-center "
|
|
99
|
-
>
|
|
100
|
-
<div className={`flex items-center border border-gray-300 shadow-sm rounded-md`}>
|
|
101
|
-
<span className="flex items-center">
|
|
102
|
-
<span className={`bg-${consumer.color}-500 h-full rounded-tl rounded-bl p-1`}>
|
|
103
|
-
<consumer.Icon className="h-4 w-4 text-white" />
|
|
104
|
-
</span>
|
|
105
|
-
<span className="leading-none px-2 group-hover:underline ">
|
|
106
|
-
{consumer.data.name} (v{consumer.data.version})
|
|
107
|
-
</span>
|
|
108
|
-
</span>
|
|
109
|
-
</div>
|
|
110
|
-
</a>
|
|
111
|
-
</li>
|
|
112
|
-
))}
|
|
113
|
-
</ul>
|
|
114
|
-
)}
|
|
115
117
|
</div>
|
|
116
118
|
);
|
|
117
119
|
},
|
|
@@ -126,12 +128,7 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
126
128
|
},
|
|
127
129
|
cell: (info) => {
|
|
128
130
|
const sends = info.getValue() || [];
|
|
129
|
-
const
|
|
130
|
-
const isOpen = isExpandable ? sends?.length < 10 : true;
|
|
131
|
-
const [isExpanded, setIsExpanded] = useState(isOpen);
|
|
132
|
-
|
|
133
|
-
if (sends?.length === 0 || !sends)
|
|
134
|
-
return <div className="text-sm text-gray-400/80 text-left italic">Service sends no messages.</div>;
|
|
131
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
135
132
|
|
|
136
133
|
const sendersWithIcons = useMemo(
|
|
137
134
|
() =>
|
|
@@ -144,36 +141,42 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
144
141
|
[sends]
|
|
145
142
|
);
|
|
146
143
|
|
|
144
|
+
if (sends?.length === 0 || !sends)
|
|
145
|
+
return (
|
|
146
|
+
<span className="inline-flex items-center px-2 py-1 text-xs text-gray-400 bg-gray-50 rounded-md border border-gray-100">
|
|
147
|
+
No messages
|
|
148
|
+
</span>
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const visibleItems = isExpanded ? sendersWithIcons : sendersWithIcons.slice(0, 4);
|
|
152
|
+
const hiddenCount = sendersWithIcons.length - 4;
|
|
153
|
+
|
|
147
154
|
return (
|
|
148
|
-
<div>
|
|
149
|
-
{
|
|
150
|
-
<
|
|
151
|
-
{
|
|
155
|
+
<div className="flex flex-col gap-1.5">
|
|
156
|
+
{visibleItems.map((sender, index) => (
|
|
157
|
+
<a
|
|
158
|
+
key={`${sender.data.id}-${index}`}
|
|
159
|
+
href={buildUrl(`/docs/${sender.collection}/${sender.data.id}/${sender.data.version}`)}
|
|
160
|
+
className="group inline-flex items-center"
|
|
161
|
+
>
|
|
162
|
+
<span
|
|
163
|
+
className={`inline-flex items-center rounded-md border border-gray-200 bg-white hover:border-${sender.color}-300 hover:bg-${sender.color}-50 transition-colors`}
|
|
164
|
+
>
|
|
165
|
+
<span className={`flex items-center justify-center w-6 h-6 bg-${sender.color}-500 rounded-l-md`}>
|
|
166
|
+
<sender.Icon className="h-3 w-3 text-white" />
|
|
167
|
+
</span>
|
|
168
|
+
<span className="px-2 py-1 text-xs text-gray-700 group-hover:text-gray-900">
|
|
169
|
+
{sender.data.name}
|
|
170
|
+
<span className="text-gray-400 ml-1">v{sender.data.version}</span>
|
|
171
|
+
</span>
|
|
172
|
+
</span>
|
|
173
|
+
</a>
|
|
174
|
+
))}
|
|
175
|
+
{hiddenCount > 0 && (
|
|
176
|
+
<button onClick={() => setIsExpanded(!isExpanded)} className="text-xs text-gray-500 hover:text-gray-700 text-left">
|
|
177
|
+
{isExpanded ? 'Show less' : `+${hiddenCount} more`}
|
|
152
178
|
</button>
|
|
153
179
|
)}
|
|
154
|
-
{isExpanded && (
|
|
155
|
-
<ul>
|
|
156
|
-
{sendersWithIcons.map((sender, index) => (
|
|
157
|
-
<li key={`${sender.data.id}-${index}`} className="py-1 group font-light">
|
|
158
|
-
<a
|
|
159
|
-
href={buildUrl(`/docs/${sender.collection}/${sender.data.id}/${sender.data.version}`)}
|
|
160
|
-
className="group-hover:text-primary flex space-x-1 items-center "
|
|
161
|
-
>
|
|
162
|
-
<div className={`flex items-center border border-gray-300 shadow-sm rounded-md`}>
|
|
163
|
-
<span className="flex items-center">
|
|
164
|
-
<span className={`bg-${sender.color}-500 h-full rounded-tl rounded-bl p-1`}>
|
|
165
|
-
<sender.Icon className="h-4 w-4 text-white" />
|
|
166
|
-
</span>
|
|
167
|
-
<span className="leading-none px-2 group-hover:underline ">
|
|
168
|
-
{sender.data.name} (v{sender.data.version})
|
|
169
|
-
</span>
|
|
170
|
-
</span>
|
|
171
|
-
</div>
|
|
172
|
-
</a>
|
|
173
|
-
</li>
|
|
174
|
-
))}
|
|
175
|
-
</ul>
|
|
176
|
-
)}
|
|
177
180
|
</div>
|
|
178
181
|
);
|
|
179
182
|
},
|
|
@@ -184,14 +187,22 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
184
187
|
id: 'actions',
|
|
185
188
|
header: () => <span>{tableConfiguration.columns?.actions?.label || 'Actions'}</span>,
|
|
186
189
|
cell: (info) => {
|
|
187
|
-
const
|
|
190
|
+
const item = info.row.original;
|
|
188
191
|
return (
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
<div className="flex items-center gap-2">
|
|
193
|
+
<a
|
|
194
|
+
className="inline-flex items-center px-2.5 py-1 text-xs font-medium text-gray-600 bg-gray-50 border border-gray-200 rounded-md hover:bg-gray-100 hover:text-gray-900 transition-colors whitespace-nowrap"
|
|
195
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
196
|
+
>
|
|
197
|
+
Docs
|
|
198
|
+
</a>
|
|
199
|
+
<a
|
|
200
|
+
className="inline-flex items-center px-2.5 py-1 text-xs font-medium text-gray-600 bg-gray-50 border border-gray-200 rounded-md hover:bg-gray-100 hover:text-gray-900 transition-colors whitespace-nowrap"
|
|
201
|
+
href={buildUrl(`/visualiser/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
202
|
+
>
|
|
203
|
+
Visualiser
|
|
204
|
+
</a>
|
|
205
|
+
</div>
|
|
195
206
|
);
|
|
196
207
|
},
|
|
197
208
|
meta: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createColumnHelper } from '@tanstack/react-table';
|
|
2
2
|
import { Tag } from 'lucide-react';
|
|
3
|
+
import { useState } from 'react';
|
|
3
4
|
import { filterByBadge } from '../filters/custom-filters';
|
|
4
5
|
import type { TCollectionTypes, TData } from '../Table';
|
|
5
6
|
import { getIcon } from '@utils/badges';
|
|
@@ -15,39 +16,43 @@ export const createBadgesColumn = <T extends { data: Pick<TData<U>['data'], 'bad
|
|
|
15
16
|
cell: (info) => {
|
|
16
17
|
const item = info.row.original;
|
|
17
18
|
const badges = item.data.badges || [];
|
|
19
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
18
20
|
|
|
19
21
|
if (badges?.length === 0 || !badges)
|
|
20
|
-
return
|
|
22
|
+
return (
|
|
23
|
+
<span className="inline-flex items-center px-2 py-1 text-xs text-gray-400 bg-gray-50 rounded-md border border-gray-100">
|
|
24
|
+
No badges
|
|
25
|
+
</span>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const visibleItems = isExpanded ? badges : badges.slice(0, 4);
|
|
29
|
+
const hiddenCount = badges.length - 4;
|
|
21
30
|
|
|
22
31
|
return (
|
|
23
|
-
<
|
|
24
|
-
{
|
|
32
|
+
<div className="flex flex-wrap gap-1.5 items-center">
|
|
33
|
+
{visibleItems.map((badge, index) => {
|
|
34
|
+
const IconComponent = badge.icon ? getIcon(badge.icon) : null;
|
|
25
35
|
return (
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<IconComponent className="h-4 w-4 text-white" />
|
|
36
|
-
) : (
|
|
37
|
-
<Tag className="h-4 w-4 text-white" />
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
return <Tag className="h-4 w-4 text-white" />;
|
|
41
|
-
})()}
|
|
42
|
-
</span>
|
|
43
|
-
<span className="leading-none px-2 group-hover:underline ">{badge.content}</span>
|
|
44
|
-
</span>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</li>
|
|
36
|
+
<span
|
|
37
|
+
key={`${badge.id}-${index}`}
|
|
38
|
+
className={`inline-flex items-center rounded-md border border-gray-200 bg-white hover:border-${badge.backgroundColor}-300 hover:bg-${badge.backgroundColor}-50 transition-colors`}
|
|
39
|
+
>
|
|
40
|
+
<span className={`flex items-center justify-center w-6 h-6 bg-${badge.backgroundColor}-500 rounded-l-md`}>
|
|
41
|
+
{IconComponent ? <IconComponent className="h-3 w-3 text-white" /> : <Tag className="h-3 w-3 text-white" />}
|
|
42
|
+
</span>
|
|
43
|
+
<span className="px-2 py-1 text-xs text-gray-700">{badge.content}</span>
|
|
44
|
+
</span>
|
|
48
45
|
);
|
|
49
46
|
})}
|
|
50
|
-
|
|
47
|
+
{hiddenCount > 0 && (
|
|
48
|
+
<button
|
|
49
|
+
onClick={() => setIsExpanded(!isExpanded)}
|
|
50
|
+
className="text-xs text-gray-500 hover:text-gray-700 px-2 py-1 rounded hover:bg-gray-100 transition-colors"
|
|
51
|
+
>
|
|
52
|
+
{isExpanded ? 'Show less' : `+${hiddenCount} more`}
|
|
53
|
+
</button>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
51
56
|
);
|
|
52
57
|
},
|
|
53
58
|
meta: {
|