@eventcatalog/core 3.5.2 → 3.6.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/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-OKWCSRLE.js → chunk-2DSMO5BZ.js} +1 -1
- package/dist/{chunk-YTZSPYJN.js → chunk-O3LNFOFS.js} +1 -1
- package/dist/{chunk-YVX5C6L3.js → chunk-O7ZZX4CS.js} +1 -1
- package/dist/{chunk-WO3AKJVB.js → chunk-XTN3M6CM.js} +1 -1
- package/dist/{chunk-YOFNY2RC.js → chunk-YQ2LO4G6.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- 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/src/components/EnvironmentDropdown.tsx +1 -1
- package/eventcatalog/src/components/Search/SearchDataLoader.astro +23 -11
- package/eventcatalog/src/components/Search/SearchModal.tsx +17 -2
- package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +12 -6
- package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +25 -14
- package/eventcatalog/src/components/Tables/Discover/DiscoverTable.tsx +816 -0
- package/eventcatalog/src/components/Tables/Discover/FilterComponents.tsx +161 -0
- package/eventcatalog/src/components/Tables/Discover/columns.tsx +565 -0
- package/eventcatalog/src/components/Tables/Discover/index.ts +4 -0
- package/eventcatalog/src/components/Tables/columns/ContainersTableColumns.tsx +1 -1
- package/eventcatalog/src/components/Tables/columns/DomainTableColumns.tsx +1 -1
- package/eventcatalog/src/components/Tables/columns/FlowTableColumns.tsx +1 -1
- package/eventcatalog/src/components/Tables/columns/MessageTableColumns.tsx +1 -1
- package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +54 -64
- package/eventcatalog/src/components/Tables/columns/SharedColumns.tsx +15 -30
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +1 -1
- package/eventcatalog/src/pages/api/sidebar-data.json.ts +22 -0
- package/eventcatalog/src/pages/discover/[type]/_index.data.ts +5 -1
- package/eventcatalog/src/pages/discover/[type]/index.astro +360 -41
- package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/state.ts +25 -22
- package/package.json +1 -1
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import { createColumnHelper } from '@tanstack/react-table';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
ServerIcon,
|
|
5
|
+
BoltIcon,
|
|
6
|
+
ChatBubbleLeftIcon,
|
|
7
|
+
MagnifyingGlassIcon,
|
|
8
|
+
RectangleGroupIcon,
|
|
9
|
+
QueueListIcon,
|
|
10
|
+
DocumentTextIcon,
|
|
11
|
+
MapIcon,
|
|
12
|
+
} from '@heroicons/react/24/solid';
|
|
13
|
+
import { ArrowDownIcon, ArrowUpIcon } from '@heroicons/react/24/outline';
|
|
14
|
+
import { DatabaseIcon } from 'lucide-react';
|
|
15
|
+
import * as Tooltip from '@radix-ui/react-tooltip';
|
|
16
|
+
import { buildUrl } from '@utils/url-builder';
|
|
17
|
+
import { getColorAndIconForCollection } from '@utils/collections/icons';
|
|
18
|
+
import FavoriteButton from '@components/FavoriteButton';
|
|
19
|
+
import type { DiscoverTableData, CollectionType } from './DiscoverTable';
|
|
20
|
+
import type { TableConfiguration } from '@types';
|
|
21
|
+
|
|
22
|
+
// Color mapping to ensure Tailwind classes are included in the build
|
|
23
|
+
const colorClasses: Record<string, string> = {
|
|
24
|
+
orange: 'text-orange-500',
|
|
25
|
+
blue: 'text-blue-500',
|
|
26
|
+
green: 'text-green-500',
|
|
27
|
+
pink: 'text-pink-500',
|
|
28
|
+
yellow: 'text-yellow-500',
|
|
29
|
+
teal: 'text-teal-500',
|
|
30
|
+
purple: 'text-purple-500',
|
|
31
|
+
red: 'text-red-500',
|
|
32
|
+
gray: 'text-gray-500',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Reusable tooltip wrapper component
|
|
36
|
+
const ActionTooltip = ({ children, label }: { children: React.ReactNode; label: string }) => (
|
|
37
|
+
<Tooltip.Provider delayDuration={200}>
|
|
38
|
+
<Tooltip.Root>
|
|
39
|
+
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
|
40
|
+
<Tooltip.Portal>
|
|
41
|
+
<Tooltip.Content
|
|
42
|
+
className="bg-[rgb(var(--ec-page-text))] text-[rgb(var(--ec-page-bg))] rounded px-2 py-1 text-xs shadow-md z-50"
|
|
43
|
+
side="top"
|
|
44
|
+
sideOffset={5}
|
|
45
|
+
>
|
|
46
|
+
{label}
|
|
47
|
+
<Tooltip.Arrow className="fill-[rgb(var(--ec-page-text))]" />
|
|
48
|
+
</Tooltip.Content>
|
|
49
|
+
</Tooltip.Portal>
|
|
50
|
+
</Tooltip.Root>
|
|
51
|
+
</Tooltip.Provider>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const columnHelper = createColumnHelper<DiscoverTableData>();
|
|
55
|
+
|
|
56
|
+
// Badge cell component (proper React component to use hooks)
|
|
57
|
+
const BadgesCell = ({ badges }: { badges: Array<{ content: string; backgroundColor?: string; textColor?: string }> }) => {
|
|
58
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
59
|
+
|
|
60
|
+
if (!badges || badges.length === 0) return <span className="text-xs text-[rgb(var(--ec-icon-color))]">-</span>;
|
|
61
|
+
|
|
62
|
+
const visibleItems = isExpanded ? badges : badges.slice(0, 3);
|
|
63
|
+
const hiddenCount = badges.length - 3;
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div className="flex flex-col gap-1 items-start">
|
|
67
|
+
{visibleItems.map((badge, index) => (
|
|
68
|
+
<span
|
|
69
|
+
key={`${badge.content}-${index}`}
|
|
70
|
+
className="inline-flex items-center px-2 py-0.5 text-xs font-medium rounded-md max-w-[140px] truncate border border-[rgb(var(--ec-accent)/0.5)] text-[rgb(var(--ec-page-text))] bg-transparent"
|
|
71
|
+
title={badge.content}
|
|
72
|
+
>
|
|
73
|
+
{badge.content}
|
|
74
|
+
</span>
|
|
75
|
+
))}
|
|
76
|
+
{hiddenCount > 0 && (
|
|
77
|
+
<button onClick={() => setIsExpanded(!isExpanded)} className="text-xs text-[rgb(var(--ec-accent))] hover:underline">
|
|
78
|
+
{isExpanded ? 'less' : `+${hiddenCount}`}
|
|
79
|
+
</button>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Shared badge column
|
|
86
|
+
const createBadgesColumn = (tableConfiguration: TableConfiguration) =>
|
|
87
|
+
columnHelper.accessor((row) => row.data.badges, {
|
|
88
|
+
id: 'badges',
|
|
89
|
+
header: () => <span>{tableConfiguration?.columns?.badges?.label || 'Badges'}</span>,
|
|
90
|
+
cell: (info) => <BadgesCell badges={info.getValue() || []} />,
|
|
91
|
+
meta: {
|
|
92
|
+
showFilter: false,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Shared actions column
|
|
97
|
+
const createActionsColumn = (collectionType: CollectionType, tableConfiguration: TableConfiguration) =>
|
|
98
|
+
columnHelper.accessor('data.name', {
|
|
99
|
+
id: 'actions',
|
|
100
|
+
header: () => <span></span>,
|
|
101
|
+
cell: (info) => {
|
|
102
|
+
const item = info.row.original;
|
|
103
|
+
const href = buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`);
|
|
104
|
+
const nodeKey = `${item.collection}-${item.data.id}-${item.data.version}`;
|
|
105
|
+
const badgeLabel = collectionType.charAt(0).toUpperCase() + collectionType.slice(1, -1);
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<div className="flex items-center gap-0.5">
|
|
109
|
+
<ActionTooltip label="View documentation">
|
|
110
|
+
<a
|
|
111
|
+
className="p-1.5 text-[rgb(var(--ec-icon-color))] hover:text-[rgb(var(--ec-accent))] hover:bg-[rgb(var(--ec-accent)/0.1)] rounded-md transition-colors"
|
|
112
|
+
href={href}
|
|
113
|
+
>
|
|
114
|
+
<DocumentTextIcon className="w-4 h-4" />
|
|
115
|
+
</a>
|
|
116
|
+
</ActionTooltip>
|
|
117
|
+
<ActionTooltip label="View in visualiser">
|
|
118
|
+
<a
|
|
119
|
+
className="p-1.5 text-[rgb(var(--ec-icon-color))] hover:text-[rgb(var(--ec-accent))] hover:bg-[rgb(var(--ec-accent)/0.1)] rounded-md transition-colors"
|
|
120
|
+
href={buildUrl(`/visualiser/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
121
|
+
>
|
|
122
|
+
<MapIcon className="w-4 h-4" />
|
|
123
|
+
</a>
|
|
124
|
+
</ActionTooltip>
|
|
125
|
+
<ActionTooltip label="Add to favorites">
|
|
126
|
+
<span>
|
|
127
|
+
<FavoriteButton nodeKey={nodeKey} title={item.data.name} badge={badgeLabel} href={href} size="sm" />
|
|
128
|
+
</span>
|
|
129
|
+
</ActionTooltip>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
meta: {
|
|
134
|
+
showFilter: false,
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Shared summary column
|
|
139
|
+
const createSummaryColumn = (tableConfiguration: TableConfiguration) =>
|
|
140
|
+
columnHelper.accessor('data.summary', {
|
|
141
|
+
id: 'summary',
|
|
142
|
+
header: () => <span>{tableConfiguration?.columns?.summary?.label || 'Summary'}</span>,
|
|
143
|
+
cell: (info) => {
|
|
144
|
+
const summary = info.renderValue() as string;
|
|
145
|
+
const isDraft = info.row.original.data.draft;
|
|
146
|
+
const displayText = `${summary || ''}${isDraft ? ' (Draft)' : ''}`;
|
|
147
|
+
return (
|
|
148
|
+
<span className="text-sm text-[rgb(var(--ec-icon-color))] line-clamp-2" title={displayText}>
|
|
149
|
+
{displayText}
|
|
150
|
+
</span>
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
meta: {
|
|
154
|
+
showFilter: false,
|
|
155
|
+
className: 'max-w-md',
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Collection list cell renderer (for producers, consumers, services, etc.)
|
|
160
|
+
const CollectionListCell = ({
|
|
161
|
+
items,
|
|
162
|
+
emptyText = '-',
|
|
163
|
+
maxVisible = 3,
|
|
164
|
+
}: {
|
|
165
|
+
items: Array<{ collection: string; data: { id: string; name: string; version: string } }> | undefined;
|
|
166
|
+
emptyText?: string;
|
|
167
|
+
maxVisible?: number;
|
|
168
|
+
}) => {
|
|
169
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
170
|
+
|
|
171
|
+
const itemsWithIcons = useMemo(
|
|
172
|
+
() =>
|
|
173
|
+
items?.map((item) => ({
|
|
174
|
+
...item,
|
|
175
|
+
...getColorAndIconForCollection(item.collection),
|
|
176
|
+
})) || [],
|
|
177
|
+
[items]
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
if (!items || items.length === 0) return <span className="text-xs text-[rgb(var(--ec-icon-color))]">{emptyText}</span>;
|
|
181
|
+
|
|
182
|
+
const visibleItems = isExpanded ? itemsWithIcons : itemsWithIcons.slice(0, maxVisible);
|
|
183
|
+
const hiddenCount = itemsWithIcons.length - maxVisible;
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div className="flex flex-col gap-1">
|
|
187
|
+
{visibleItems.map((item, index: number) => (
|
|
188
|
+
<a
|
|
189
|
+
key={`${item.data.id}-${index}`}
|
|
190
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
191
|
+
className="group inline-flex items-center gap-1.5 text-xs hover:text-[rgb(var(--ec-accent))] transition-colors"
|
|
192
|
+
>
|
|
193
|
+
<item.Icon className={`h-3.5 w-3.5 ${colorClasses[item.color] || 'text-gray-500'} flex-shrink-0`} />
|
|
194
|
+
<span className="truncate max-w-[120px]" title={item.data.name}>
|
|
195
|
+
{item.data.name}
|
|
196
|
+
</span>
|
|
197
|
+
</a>
|
|
198
|
+
))}
|
|
199
|
+
{hiddenCount > 0 && (
|
|
200
|
+
<button
|
|
201
|
+
onClick={() => setIsExpanded(!isExpanded)}
|
|
202
|
+
className="text-xs text-[rgb(var(--ec-accent))] hover:underline text-left"
|
|
203
|
+
>
|
|
204
|
+
{isExpanded ? 'Show less' : `+${hiddenCount} more`}
|
|
205
|
+
</button>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// ============================================================================
|
|
212
|
+
// EVENT COLUMNS
|
|
213
|
+
// ============================================================================
|
|
214
|
+
export const getEventColumns = (tableConfiguration: TableConfiguration) => [
|
|
215
|
+
columnHelper.accessor('data.name', {
|
|
216
|
+
id: 'name',
|
|
217
|
+
header: () => <span>{tableConfiguration?.columns?.name?.label || 'Event'}</span>,
|
|
218
|
+
cell: (info) => {
|
|
219
|
+
const item = info.row.original;
|
|
220
|
+
const isLatestVersion = item.data.version === item.data.latestVersion;
|
|
221
|
+
return (
|
|
222
|
+
<a
|
|
223
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
224
|
+
className="group inline-flex items-center gap-2 hover:text-[rgb(var(--ec-accent))] transition-colors"
|
|
225
|
+
>
|
|
226
|
+
<BoltIcon className="h-4 w-4 text-orange-500 flex-shrink-0" />
|
|
227
|
+
<span className="text-sm font-semibold text-[rgb(var(--ec-page-text))] group-hover:text-[rgb(var(--ec-accent))]">
|
|
228
|
+
{item.data.name}
|
|
229
|
+
</span>
|
|
230
|
+
{!isLatestVersion && <span className="text-xs text-[rgb(var(--ec-icon-color))]">v{item.data.version}</span>}
|
|
231
|
+
</a>
|
|
232
|
+
);
|
|
233
|
+
},
|
|
234
|
+
meta: {
|
|
235
|
+
filterVariant: 'name',
|
|
236
|
+
},
|
|
237
|
+
}),
|
|
238
|
+
createSummaryColumn(tableConfiguration),
|
|
239
|
+
columnHelper.accessor('data.producers', {
|
|
240
|
+
id: 'producers',
|
|
241
|
+
header: () => <span>Producers</span>,
|
|
242
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
243
|
+
meta: {
|
|
244
|
+
showFilter: false,
|
|
245
|
+
},
|
|
246
|
+
}),
|
|
247
|
+
columnHelper.accessor('data.consumers', {
|
|
248
|
+
id: 'consumers',
|
|
249
|
+
header: () => <span>Consumers</span>,
|
|
250
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
251
|
+
meta: {
|
|
252
|
+
showFilter: false,
|
|
253
|
+
},
|
|
254
|
+
}),
|
|
255
|
+
createBadgesColumn(tableConfiguration),
|
|
256
|
+
createActionsColumn('events', tableConfiguration),
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
// ============================================================================
|
|
260
|
+
// COMMAND COLUMNS
|
|
261
|
+
// ============================================================================
|
|
262
|
+
export const getCommandColumns = (tableConfiguration: TableConfiguration) => [
|
|
263
|
+
columnHelper.accessor('data.name', {
|
|
264
|
+
id: 'name',
|
|
265
|
+
header: () => <span>{tableConfiguration?.columns?.name?.label || 'Command'}</span>,
|
|
266
|
+
cell: (info) => {
|
|
267
|
+
const item = info.row.original;
|
|
268
|
+
const isLatestVersion = item.data.version === item.data.latestVersion;
|
|
269
|
+
return (
|
|
270
|
+
<a
|
|
271
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
272
|
+
className="group inline-flex items-center gap-2 hover:text-[rgb(var(--ec-accent))] transition-colors"
|
|
273
|
+
>
|
|
274
|
+
<ChatBubbleLeftIcon className="h-4 w-4 text-blue-500 flex-shrink-0" />
|
|
275
|
+
<span className="text-sm font-semibold text-[rgb(var(--ec-page-text))] group-hover:text-[rgb(var(--ec-accent))]">
|
|
276
|
+
{item.data.name}
|
|
277
|
+
</span>
|
|
278
|
+
{!isLatestVersion && <span className="text-xs text-[rgb(var(--ec-icon-color))]">v{item.data.version}</span>}
|
|
279
|
+
</a>
|
|
280
|
+
);
|
|
281
|
+
},
|
|
282
|
+
meta: {
|
|
283
|
+
filterVariant: 'name',
|
|
284
|
+
},
|
|
285
|
+
}),
|
|
286
|
+
createSummaryColumn(tableConfiguration),
|
|
287
|
+
columnHelper.accessor('data.producers', {
|
|
288
|
+
id: 'producers',
|
|
289
|
+
header: () => <span>Producers</span>,
|
|
290
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
291
|
+
meta: {
|
|
292
|
+
showFilter: false,
|
|
293
|
+
},
|
|
294
|
+
}),
|
|
295
|
+
columnHelper.accessor('data.consumers', {
|
|
296
|
+
id: 'consumers',
|
|
297
|
+
header: () => <span>Consumers</span>,
|
|
298
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
299
|
+
meta: {
|
|
300
|
+
showFilter: false,
|
|
301
|
+
},
|
|
302
|
+
}),
|
|
303
|
+
createBadgesColumn(tableConfiguration),
|
|
304
|
+
createActionsColumn('commands', tableConfiguration),
|
|
305
|
+
];
|
|
306
|
+
|
|
307
|
+
// ============================================================================
|
|
308
|
+
// QUERY COLUMNS
|
|
309
|
+
// ============================================================================
|
|
310
|
+
export const getQueryColumns = (tableConfiguration: TableConfiguration) => [
|
|
311
|
+
columnHelper.accessor('data.name', {
|
|
312
|
+
id: 'name',
|
|
313
|
+
header: () => <span>{tableConfiguration?.columns?.name?.label || 'Query'}</span>,
|
|
314
|
+
cell: (info) => {
|
|
315
|
+
const item = info.row.original;
|
|
316
|
+
const isLatestVersion = item.data.version === item.data.latestVersion;
|
|
317
|
+
return (
|
|
318
|
+
<a
|
|
319
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
320
|
+
className="group inline-flex items-center gap-2 hover:text-[rgb(var(--ec-accent))] transition-colors"
|
|
321
|
+
>
|
|
322
|
+
<MagnifyingGlassIcon className="h-4 w-4 text-green-500 flex-shrink-0" />
|
|
323
|
+
<span className="text-sm font-semibold text-[rgb(var(--ec-page-text))] group-hover:text-[rgb(var(--ec-accent))]">
|
|
324
|
+
{item.data.name}
|
|
325
|
+
</span>
|
|
326
|
+
{!isLatestVersion && <span className="text-xs text-[rgb(var(--ec-icon-color))]">v{item.data.version}</span>}
|
|
327
|
+
</a>
|
|
328
|
+
);
|
|
329
|
+
},
|
|
330
|
+
meta: {
|
|
331
|
+
filterVariant: 'name',
|
|
332
|
+
},
|
|
333
|
+
}),
|
|
334
|
+
createSummaryColumn(tableConfiguration),
|
|
335
|
+
columnHelper.accessor('data.producers', {
|
|
336
|
+
id: 'producers',
|
|
337
|
+
header: () => <span>Producers</span>,
|
|
338
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
339
|
+
meta: {
|
|
340
|
+
showFilter: false,
|
|
341
|
+
},
|
|
342
|
+
}),
|
|
343
|
+
columnHelper.accessor('data.consumers', {
|
|
344
|
+
id: 'consumers',
|
|
345
|
+
header: () => <span>Consumers</span>,
|
|
346
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
347
|
+
meta: {
|
|
348
|
+
showFilter: false,
|
|
349
|
+
},
|
|
350
|
+
}),
|
|
351
|
+
createBadgesColumn(tableConfiguration),
|
|
352
|
+
createActionsColumn('queries', tableConfiguration),
|
|
353
|
+
];
|
|
354
|
+
|
|
355
|
+
// ============================================================================
|
|
356
|
+
// SERVICE COLUMNS
|
|
357
|
+
// ============================================================================
|
|
358
|
+
export const getServiceColumns = (tableConfiguration: TableConfiguration) => [
|
|
359
|
+
columnHelper.accessor('data.name', {
|
|
360
|
+
id: 'name',
|
|
361
|
+
header: () => <span>{tableConfiguration?.columns?.name?.label || 'Service'}</span>,
|
|
362
|
+
cell: (info) => {
|
|
363
|
+
const item = info.row.original;
|
|
364
|
+
const isLatestVersion = item.data.version === item.data.latestVersion;
|
|
365
|
+
return (
|
|
366
|
+
<a
|
|
367
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
368
|
+
className="group inline-flex items-center gap-2 hover:text-[rgb(var(--ec-accent))] transition-colors"
|
|
369
|
+
>
|
|
370
|
+
<ServerIcon className="h-4 w-4 text-pink-500 flex-shrink-0" />
|
|
371
|
+
<span className="text-sm font-semibold text-[rgb(var(--ec-page-text))] group-hover:text-[rgb(var(--ec-accent))]">
|
|
372
|
+
{item.data.name}
|
|
373
|
+
</span>
|
|
374
|
+
{!isLatestVersion && <span className="text-xs text-[rgb(var(--ec-icon-color))]">v{item.data.version}</span>}
|
|
375
|
+
</a>
|
|
376
|
+
);
|
|
377
|
+
},
|
|
378
|
+
meta: {
|
|
379
|
+
filterVariant: 'name',
|
|
380
|
+
},
|
|
381
|
+
}),
|
|
382
|
+
createSummaryColumn(tableConfiguration),
|
|
383
|
+
columnHelper.accessor('data.receives', {
|
|
384
|
+
id: 'receives',
|
|
385
|
+
header: () => (
|
|
386
|
+
<span className="flex items-center gap-1">
|
|
387
|
+
<ArrowDownIcon className="w-3.5 h-3.5" />
|
|
388
|
+
Receives
|
|
389
|
+
</span>
|
|
390
|
+
),
|
|
391
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
392
|
+
meta: {
|
|
393
|
+
showFilter: false,
|
|
394
|
+
},
|
|
395
|
+
}),
|
|
396
|
+
columnHelper.accessor('data.sends', {
|
|
397
|
+
id: 'sends',
|
|
398
|
+
header: () => (
|
|
399
|
+
<span className="flex items-center gap-1">
|
|
400
|
+
<ArrowUpIcon className="w-3.5 h-3.5" />
|
|
401
|
+
Sends
|
|
402
|
+
</span>
|
|
403
|
+
),
|
|
404
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
405
|
+
meta: {
|
|
406
|
+
showFilter: false,
|
|
407
|
+
},
|
|
408
|
+
}),
|
|
409
|
+
createBadgesColumn(tableConfiguration),
|
|
410
|
+
createActionsColumn('services', tableConfiguration),
|
|
411
|
+
];
|
|
412
|
+
|
|
413
|
+
// ============================================================================
|
|
414
|
+
// DOMAIN COLUMNS
|
|
415
|
+
// ============================================================================
|
|
416
|
+
export const getDomainColumns = (tableConfiguration: TableConfiguration) => [
|
|
417
|
+
columnHelper.accessor('data.name', {
|
|
418
|
+
id: 'name',
|
|
419
|
+
header: () => <span>{tableConfiguration?.columns?.name?.label || 'Domain'}</span>,
|
|
420
|
+
cell: (info) => {
|
|
421
|
+
const item = info.row.original;
|
|
422
|
+
const isLatestVersion = item.data.version === item.data.latestVersion;
|
|
423
|
+
return (
|
|
424
|
+
<a
|
|
425
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
426
|
+
className="group inline-flex items-center gap-2 hover:text-[rgb(var(--ec-accent))] transition-colors"
|
|
427
|
+
>
|
|
428
|
+
<RectangleGroupIcon className="h-4 w-4 text-yellow-500 flex-shrink-0" />
|
|
429
|
+
<span className="text-sm font-semibold text-[rgb(var(--ec-page-text))] group-hover:text-[rgb(var(--ec-accent))]">
|
|
430
|
+
{item.data.name}
|
|
431
|
+
</span>
|
|
432
|
+
{!isLatestVersion && <span className="text-xs text-[rgb(var(--ec-icon-color))]">v{item.data.version}</span>}
|
|
433
|
+
</a>
|
|
434
|
+
);
|
|
435
|
+
},
|
|
436
|
+
meta: {
|
|
437
|
+
filterVariant: 'name',
|
|
438
|
+
},
|
|
439
|
+
}),
|
|
440
|
+
createSummaryColumn(tableConfiguration),
|
|
441
|
+
columnHelper.accessor('data.services', {
|
|
442
|
+
id: 'services',
|
|
443
|
+
header: () => <span>Services</span>,
|
|
444
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
445
|
+
meta: {
|
|
446
|
+
showFilter: false,
|
|
447
|
+
},
|
|
448
|
+
}),
|
|
449
|
+
createBadgesColumn(tableConfiguration),
|
|
450
|
+
createActionsColumn('domains', tableConfiguration),
|
|
451
|
+
];
|
|
452
|
+
|
|
453
|
+
// ============================================================================
|
|
454
|
+
// FLOW COLUMNS
|
|
455
|
+
// ============================================================================
|
|
456
|
+
export const getFlowColumns = (tableConfiguration: TableConfiguration) => [
|
|
457
|
+
columnHelper.accessor('data.name', {
|
|
458
|
+
id: 'name',
|
|
459
|
+
header: () => <span>{tableConfiguration?.columns?.name?.label || 'Flow'}</span>,
|
|
460
|
+
cell: (info) => {
|
|
461
|
+
const item = info.row.original;
|
|
462
|
+
const isLatestVersion = item.data.version === item.data.latestVersion;
|
|
463
|
+
return (
|
|
464
|
+
<a
|
|
465
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
466
|
+
className="group inline-flex items-center gap-2 hover:text-[rgb(var(--ec-accent))] transition-colors"
|
|
467
|
+
>
|
|
468
|
+
<QueueListIcon className="h-4 w-4 text-teal-500 flex-shrink-0" />
|
|
469
|
+
<span className="text-sm font-semibold text-[rgb(var(--ec-page-text))] group-hover:text-[rgb(var(--ec-accent))]">
|
|
470
|
+
{item.data.name}
|
|
471
|
+
</span>
|
|
472
|
+
{!isLatestVersion && <span className="text-xs text-[rgb(var(--ec-icon-color))]">v{item.data.version}</span>}
|
|
473
|
+
</a>
|
|
474
|
+
);
|
|
475
|
+
},
|
|
476
|
+
meta: {
|
|
477
|
+
filterVariant: 'name',
|
|
478
|
+
},
|
|
479
|
+
}),
|
|
480
|
+
createSummaryColumn(tableConfiguration),
|
|
481
|
+
createBadgesColumn(tableConfiguration),
|
|
482
|
+
createActionsColumn('flows', tableConfiguration),
|
|
483
|
+
];
|
|
484
|
+
|
|
485
|
+
// ============================================================================
|
|
486
|
+
// CONTAINER (DATA) COLUMNS
|
|
487
|
+
// ============================================================================
|
|
488
|
+
export const getContainerColumns = (tableConfiguration: TableConfiguration) => [
|
|
489
|
+
columnHelper.accessor('data.name', {
|
|
490
|
+
id: 'name',
|
|
491
|
+
header: () => <span>{tableConfiguration?.columns?.name?.label || 'Data'}</span>,
|
|
492
|
+
cell: (info) => {
|
|
493
|
+
const item = info.row.original;
|
|
494
|
+
const isLatestVersion = item.data.version === item.data.latestVersion;
|
|
495
|
+
return (
|
|
496
|
+
<a
|
|
497
|
+
href={buildUrl(`/docs/${item.collection}/${item.data.id}/${item.data.version}`)}
|
|
498
|
+
className="group inline-flex items-center gap-2 hover:text-[rgb(var(--ec-accent))] transition-colors"
|
|
499
|
+
>
|
|
500
|
+
<DatabaseIcon className="h-4 w-4 text-blue-500 flex-shrink-0" />
|
|
501
|
+
<span className="text-sm font-semibold text-[rgb(var(--ec-page-text))] group-hover:text-[rgb(var(--ec-accent))]">
|
|
502
|
+
{item.data.name}
|
|
503
|
+
</span>
|
|
504
|
+
{!isLatestVersion && <span className="text-xs text-[rgb(var(--ec-icon-color))]">v{item.data.version}</span>}
|
|
505
|
+
</a>
|
|
506
|
+
);
|
|
507
|
+
},
|
|
508
|
+
meta: {
|
|
509
|
+
filterVariant: 'name',
|
|
510
|
+
},
|
|
511
|
+
}),
|
|
512
|
+
createSummaryColumn(tableConfiguration),
|
|
513
|
+
columnHelper.accessor('data.servicesThatWriteToContainer', {
|
|
514
|
+
id: 'writes',
|
|
515
|
+
header: () => (
|
|
516
|
+
<span className="flex items-center gap-1">
|
|
517
|
+
<ArrowDownIcon className="w-3.5 h-3.5" />
|
|
518
|
+
Writes
|
|
519
|
+
</span>
|
|
520
|
+
),
|
|
521
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
522
|
+
meta: {
|
|
523
|
+
showFilter: false,
|
|
524
|
+
},
|
|
525
|
+
}),
|
|
526
|
+
columnHelper.accessor('data.servicesThatReadFromContainer', {
|
|
527
|
+
id: 'reads',
|
|
528
|
+
header: () => (
|
|
529
|
+
<span className="flex items-center gap-1">
|
|
530
|
+
<ArrowUpIcon className="w-3.5 h-3.5" />
|
|
531
|
+
Reads
|
|
532
|
+
</span>
|
|
533
|
+
),
|
|
534
|
+
cell: (info) => <CollectionListCell items={info.getValue()} />,
|
|
535
|
+
meta: {
|
|
536
|
+
showFilter: false,
|
|
537
|
+
},
|
|
538
|
+
}),
|
|
539
|
+
createBadgesColumn(tableConfiguration),
|
|
540
|
+
createActionsColumn('containers', tableConfiguration),
|
|
541
|
+
];
|
|
542
|
+
|
|
543
|
+
// ============================================================================
|
|
544
|
+
// COLUMN GETTER BY COLLECTION TYPE
|
|
545
|
+
// ============================================================================
|
|
546
|
+
export const getDiscoverColumns = (collectionType: CollectionType, tableConfiguration: TableConfiguration) => {
|
|
547
|
+
switch (collectionType) {
|
|
548
|
+
case 'events':
|
|
549
|
+
return getEventColumns(tableConfiguration);
|
|
550
|
+
case 'commands':
|
|
551
|
+
return getCommandColumns(tableConfiguration);
|
|
552
|
+
case 'queries':
|
|
553
|
+
return getQueryColumns(tableConfiguration);
|
|
554
|
+
case 'services':
|
|
555
|
+
return getServiceColumns(tableConfiguration);
|
|
556
|
+
case 'domains':
|
|
557
|
+
return getDomainColumns(tableConfiguration);
|
|
558
|
+
case 'flows':
|
|
559
|
+
return getFlowColumns(tableConfiguration);
|
|
560
|
+
case 'containers':
|
|
561
|
+
return getContainerColumns(tableConfiguration);
|
|
562
|
+
default:
|
|
563
|
+
return [];
|
|
564
|
+
}
|
|
565
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { DiscoverTable } from './DiscoverTable';
|
|
2
|
+
export type { DiscoverTableData, DiscoverTableProps, CollectionType, PropertyOption } from './DiscoverTable';
|
|
3
|
+
export { FilterDropdown, CheckboxItem } from './FilterComponents';
|
|
4
|
+
export type { FilterDropdownProps, CheckboxItemProps } from './FilterComponents';
|
|
@@ -45,7 +45,7 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
45
45
|
cell: (info) => {
|
|
46
46
|
const summary = info.renderValue() as string;
|
|
47
47
|
return (
|
|
48
|
-
<span className="text-sm text-[rgb(var(--ec-
|
|
48
|
+
<span className="text-sm text-[rgb(var(--ec-icon-color))] line-clamp-2" title={summary || ''}>
|
|
49
49
|
{summary}
|
|
50
50
|
</span>
|
|
51
51
|
);
|
|
@@ -46,7 +46,7 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
46
46
|
const isDraft = info.row.original.data.draft;
|
|
47
47
|
const displayText = `${summary || ''}${isDraft ? ' (Draft)' : ''}`;
|
|
48
48
|
return (
|
|
49
|
-
<span className="text-sm text-[rgb(var(--ec-
|
|
49
|
+
<span className="text-sm text-[rgb(var(--ec-icon-color))] line-clamp-2" title={displayText}>
|
|
50
50
|
{displayText}
|
|
51
51
|
</span>
|
|
52
52
|
);
|
|
@@ -43,7 +43,7 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
43
43
|
cell: (info) => {
|
|
44
44
|
const summary = info.renderValue() as string;
|
|
45
45
|
return (
|
|
46
|
-
<span className="text-sm text-[rgb(var(--ec-
|
|
46
|
+
<span className="text-sm text-[rgb(var(--ec-icon-color))] line-clamp-2" title={summary || ''}>
|
|
47
47
|
{summary}
|
|
48
48
|
</span>
|
|
49
49
|
);
|
|
@@ -64,7 +64,7 @@ export const columns = (tableConfiguration: TableConfiguration) => [
|
|
|
64
64
|
const isDraft = info.row.original.data.draft;
|
|
65
65
|
const displayText = `${summary || ''}${isDraft ? ' (Draft)' : ''}`;
|
|
66
66
|
return (
|
|
67
|
-
<span className="text-sm text-[rgb(var(--ec-
|
|
67
|
+
<span className="text-sm text-[rgb(var(--ec-icon-color))] line-clamp-2" title={displayText}>
|
|
68
68
|
{displayText}
|
|
69
69
|
</span>
|
|
70
70
|
);
|