@eventcatalog/core 2.11.5 → 2.11.6
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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/components/MDX/NodeGraph/NodeGraph.tsx +25 -14
- package/src/components/Tables/Table.tsx +13 -1
- package/src/layouts/DiscoverLayout.astro +1 -10
- package/src/layouts/VerticalSideBarLayout.astro +24 -15
- package/src/pages/docs/[type]/[id]/index.astro +8 -1
- package/src/pages/visualiser/[type]/[id]/[version]/index.astro +13 -0
- package/src/pages/visualiser/[type]/[id]/index.astro +55 -0
- package/src/pages/visualiser/index.astro +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @eventcatalog/core
|
|
2
2
|
|
|
3
|
+
## 2.11.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9a531d2: feat(core): added ability to embed discovery table
|
|
8
|
+
- 2352fc0: feat(core): added ability to embed catalog pages
|
|
9
|
+
- 112f735: feat(core): added ability to embed visualiser without footers
|
|
10
|
+
|
|
3
11
|
## 2.11.5
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -215,12 +215,21 @@ const NodeGraph = ({
|
|
|
215
215
|
linksToVisualiser = false,
|
|
216
216
|
}: NodeGraphProps) => {
|
|
217
217
|
const [elem, setElem] = useState(null);
|
|
218
|
+
const [showFooter, setShowFooter] = useState(true);
|
|
218
219
|
|
|
219
220
|
useEffect(() => {
|
|
220
221
|
// @ts-ignore
|
|
221
222
|
setElem(document.getElementById(`${id}-portal`));
|
|
222
223
|
}, []);
|
|
223
224
|
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
227
|
+
const embed = urlParams.get('embed');
|
|
228
|
+
if (embed === 'true') {
|
|
229
|
+
setShowFooter(false);
|
|
230
|
+
}
|
|
231
|
+
}, []);
|
|
232
|
+
|
|
224
233
|
if (!elem) return null;
|
|
225
234
|
|
|
226
235
|
return (
|
|
@@ -236,21 +245,23 @@ const NodeGraph = ({
|
|
|
236
245
|
linksToVisualiser={linksToVisualiser}
|
|
237
246
|
/>
|
|
238
247
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
|
|
248
|
+
{showFooter && (
|
|
249
|
+
<div className="flex justify-between" id="visualiser-footer">
|
|
250
|
+
{footerLabel && (
|
|
251
|
+
<div className="py-2 w-full text-left ">
|
|
252
|
+
<span className=" text-sm no-underline py-2 text-gray-300">{footerLabel}</span>
|
|
253
|
+
</div>
|
|
254
|
+
)}
|
|
245
255
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
256
|
+
{href && (
|
|
257
|
+
<div className="py-2 w-full text-right">
|
|
258
|
+
<a className=" text-sm no-underline py-2 text-gray-800 hover:text-primary" href={href}>
|
|
259
|
+
{hrefLabel} →
|
|
260
|
+
</a>
|
|
261
|
+
</div>
|
|
262
|
+
)}
|
|
263
|
+
</div>
|
|
264
|
+
)}
|
|
254
265
|
</ReactFlowProvider>,
|
|
255
266
|
elem
|
|
256
267
|
)}
|
|
@@ -15,7 +15,7 @@ import type { CollectionEntry } from 'astro:content';
|
|
|
15
15
|
import DebouncedInput from './DebouncedInput';
|
|
16
16
|
|
|
17
17
|
import { getColumnsByCollection } from './columns';
|
|
18
|
-
import { useMemo, useState } from 'react';
|
|
18
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import type { CollectionTypes } from '@types';
|
|
20
20
|
|
|
21
21
|
declare module '@tanstack/react-table' {
|
|
@@ -40,6 +40,18 @@ export const Table = ({
|
|
|
40
40
|
const [data, _setData] = useState(initialData);
|
|
41
41
|
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
|
|
42
42
|
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
console.log(window.location.pathname);
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
49
|
+
const id = urlParams.get('id');
|
|
50
|
+
if (id) {
|
|
51
|
+
setColumnFilters([{ id: 'name', value: id }]);
|
|
52
|
+
}
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
43
55
|
const columns = useMemo(() => getColumnsByCollection(collection), [collection]);
|
|
44
56
|
|
|
45
57
|
const table = useReactTable({
|
|
@@ -76,16 +76,7 @@ const tabs = [
|
|
|
76
76
|
|
|
77
77
|
<VerticalSideBarLayout title={`Explore | ${title}`}>
|
|
78
78
|
<main class="ml-0">
|
|
79
|
-
<div>
|
|
80
|
-
<!-- <div class="sm:hidden">
|
|
81
|
-
<label for="tabs" class="sr-only">Select a tab</label>
|
|
82
|
-
<select id="tabs" name="tabs" class="block w-full rounded-md border-gray-300 focus:border-indigo-500 focus:ring-indigo-500">
|
|
83
|
-
<option>My Account</option>
|
|
84
|
-
<option>Company</option>
|
|
85
|
-
<option selected>Team Members</option>
|
|
86
|
-
<option>Billing</option>
|
|
87
|
-
</select>
|
|
88
|
-
</div> -->
|
|
79
|
+
<div id="discover-collection-tabs">
|
|
89
80
|
<div class="hidden sm:block">
|
|
90
81
|
<div class="border-b border-gray-200">
|
|
91
82
|
<nav class="flex space-x-8 -mb-0.5 pl-6" aria-label="Tabs">
|
|
@@ -192,20 +192,6 @@ const showSideBarOnLoad = currentNavigationItem?.sidebar;
|
|
|
192
192
|
})
|
|
193
193
|
}
|
|
194
194
|
</div>
|
|
195
|
-
<!-- <div class="flex flex-col items-center mt-4 space-y-4 -mb-10">
|
|
196
|
-
<a href="https://discord.com/invite/3rjaZMmrAm" class="text-gray-500 has-tooltip">
|
|
197
|
-
<span class="tooltip rounded shadow-lg p-1 text-xs bg-black text-white ml-10 w-[162px]"
|
|
198
|
-
>Join EventCatalog Discord</span
|
|
199
|
-
>
|
|
200
|
-
<img src="/icons/discord.svg" class="w-7 h-7" />
|
|
201
|
-
</a>
|
|
202
|
-
<a href="https://github.com/event-catalog/eventcatalog" class="text-gray-500 has-tooltip">
|
|
203
|
-
<span class="tooltip rounded shadow-lg p-1 text-xs bg-black text-white ml-10 w-[175px]"
|
|
204
|
-
>Found an issue? Let us know</span
|
|
205
|
-
>
|
|
206
|
-
<img src="/icons/github-purple.svg" class="w-7 h-7" />
|
|
207
|
-
</a>
|
|
208
|
-
</div> -->
|
|
209
195
|
</nav>
|
|
210
196
|
</div>
|
|
211
197
|
|
|
@@ -234,8 +220,31 @@ const showSideBarOnLoad = currentNavigationItem?.sidebar;
|
|
|
234
220
|
});
|
|
235
221
|
|
|
236
222
|
document.addEventListener('contentLoaded', () => {
|
|
237
|
-
|
|
223
|
+
// Users can add ?embed=true to the URL to hide the navigation
|
|
224
|
+
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
225
|
+
const params = Object.fromEntries(urlSearchParams.entries());
|
|
226
|
+
const embeded = params.embed === 'true' ? true : false;
|
|
238
227
|
const content = document.getElementById('content');
|
|
228
|
+
|
|
229
|
+
if (embeded) {
|
|
230
|
+
const elementsToHide = [
|
|
231
|
+
'eventcatalog-vertical-nav',
|
|
232
|
+
'eventcatalog-header',
|
|
233
|
+
'eventcatalog-header-spacer',
|
|
234
|
+
'visualiser-footer',
|
|
235
|
+
'discover-collection-tabs',
|
|
236
|
+
];
|
|
237
|
+
|
|
238
|
+
elementsToHide.forEach((id) => {
|
|
239
|
+
const element = document.getElementById(id);
|
|
240
|
+
if (element) element.style.display = 'none';
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
content.classList.remove('ml-16');
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const sidebar = document.getElementById('sidebar');
|
|
239
248
|
const currentPath = window.location.href;
|
|
240
249
|
|
|
241
250
|
// Hide the sidebar if the current navigation item is not a sidebar item
|
|
@@ -37,10 +37,17 @@ const redirectUrl = buildUrl(pathname + '/' + props.data.latestVersion);
|
|
|
37
37
|
<!doctype html>
|
|
38
38
|
<html lang="en">
|
|
39
39
|
<head>
|
|
40
|
-
<meta http-equiv="refresh" content={`0; url=${redirectUrl}`} />
|
|
41
40
|
<Seo title={`EventCatalog | ${pageTitle}`} ogTitle={pageTitle} />
|
|
42
41
|
</head>
|
|
43
42
|
<body>
|
|
44
43
|
<p>You are being redirected to <a href={redirectUrl}>{redirectUrl}</a></p>
|
|
45
44
|
</body>
|
|
46
45
|
</html>
|
|
46
|
+
|
|
47
|
+
<script define:vars={{ redirectUrl }}>
|
|
48
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
49
|
+
const searchParams = window.location.search;
|
|
50
|
+
const fullRedirectUrl = redirectUrl + searchParams;
|
|
51
|
+
window.location.href = fullRedirectUrl;
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
@@ -60,3 +60,16 @@ const {
|
|
|
60
60
|
</div>
|
|
61
61
|
<ViewTransitions />
|
|
62
62
|
</VisualiserLayout>
|
|
63
|
+
|
|
64
|
+
<script define:vars={{ id }}>
|
|
65
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
66
|
+
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
67
|
+
const params = Object.fromEntries(urlSearchParams.entries());
|
|
68
|
+
const embeded = params.embed === 'true' ? true : false;
|
|
69
|
+
const viewport = document.getElementById(`${id}-portal`);
|
|
70
|
+
|
|
71
|
+
if (embeded) {
|
|
72
|
+
viewport.style.height = 'calc(100vh - 30px)';
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
</script>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Seo from '@components/Seo.astro';
|
|
3
|
+
import { buildUrl } from '@utils/url-builder';
|
|
4
|
+
import { getEvents } from '@utils/events';
|
|
5
|
+
import { getCommands } from '@utils/commands';
|
|
6
|
+
import { getServices } from '@utils/services/services';
|
|
7
|
+
import { getDomains } from '@utils/domains/domains';
|
|
8
|
+
import type { CollectionEntry } from 'astro:content';
|
|
9
|
+
import type { CollectionTypes } from '@types';
|
|
10
|
+
|
|
11
|
+
export async function getStaticPaths() {
|
|
12
|
+
const [events, commands, services, domains] = await Promise.all([getEvents(), getCommands(), getServices(), getDomains()]);
|
|
13
|
+
|
|
14
|
+
const buildPages = (collection: CollectionEntry<CollectionTypes>[]) => {
|
|
15
|
+
return collection.map((item) => ({
|
|
16
|
+
params: {
|
|
17
|
+
type: item.collection,
|
|
18
|
+
id: item.data.id,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
type: item.collection,
|
|
22
|
+
...item,
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return [...buildPages(domains), ...buildPages(events), ...buildPages(services), ...buildPages(commands)];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const props = Astro.props;
|
|
31
|
+
const pageTitle = `${props.collection} | ${props.data.name}`.replace(/^\w/, (c) => c.toUpperCase());
|
|
32
|
+
|
|
33
|
+
const { pathname } = Astro.url;
|
|
34
|
+
|
|
35
|
+
// redirect with any search params too
|
|
36
|
+
const redirectUrl = buildUrl(pathname + '/' + props.data.latestVersion);
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
<!doctype html>
|
|
40
|
+
<html lang="en">
|
|
41
|
+
<head>
|
|
42
|
+
<Seo title={`EventCatalog | ${pageTitle}`} ogTitle={pageTitle} />
|
|
43
|
+
</head>
|
|
44
|
+
<body>
|
|
45
|
+
<p>You are being redirected to <a href={redirectUrl}>{redirectUrl}</a></p>
|
|
46
|
+
</body>
|
|
47
|
+
</html>
|
|
48
|
+
|
|
49
|
+
<script define:vars={{ redirectUrl }}>
|
|
50
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
51
|
+
const searchParams = window.location.search;
|
|
52
|
+
const fullRedirectUrl = redirectUrl + searchParams;
|
|
53
|
+
window.location.href = fullRedirectUrl;
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import Layout from '../../layouts/VisualiserLayout.astro';
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
<Layout>
|
|
6
|
-
<div class="hidden no-items py-56 text-center -ml-52 text-gray-400">
|
|
7
|
-
No data loaded into your catalog. Please add some data to your to see visuals.
|
|
8
|
-
</div>
|
|
9
|
-
</Layout>
|
|
10
|
-
|
|
11
|
-
<script is:inline>
|
|
12
|
-
const navigationElem = document.getElementById('visualiser-navigation');
|
|
13
|
-
|
|
14
|
-
if (navigationElem) {
|
|
15
|
-
// Find the total anchor links
|
|
16
|
-
const totalAnchorLinks = navigationElem.querySelectorAll('a');
|
|
17
|
-
const link = navigationElem.querySelector('a');
|
|
18
|
-
const noItems = document.querySelector('.no-items');
|
|
19
|
-
|
|
20
|
-
// Show no-items if there are none
|
|
21
|
-
if (totalAnchorLinks.length === 0 && noItems) {
|
|
22
|
-
noItems.classList.remove('hidden');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Find the element with the id visualiser-navigation and the first a link in there and click it
|
|
26
|
-
if (link) {
|
|
27
|
-
link.click();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
</script>
|