@eventcatalog/core 2.11.4 → 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.
@@ -419,6 +419,15 @@
419
419
  "contributions": [
420
420
  "code"
421
421
  ]
422
+ },
423
+ {
424
+ "login": "skyrpex",
425
+ "name": "Cristian Pallarés",
426
+ "avatar_url": "https://avatars.githubusercontent.com/u/1077520?v=4",
427
+ "profile": "https://pallares.io",
428
+ "contributions": [
429
+ "code"
430
+ ]
422
431
  }
423
432
  ],
424
433
  "contributorsPerLine": 7,
@@ -13,10 +13,10 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
  steps:
15
15
  - uses: actions/checkout@v4
16
- - uses: actions/setup-node@v4
16
+ - uses: pnpm/action-setup@v4
17
17
  with:
18
- node-version: '20.x'
18
+ version: 9
19
19
  - name: Installation
20
- run: npm ci
20
+ run: pnpm i
21
21
  - name: Prettier Code
22
- run: npm run format:diff
22
+ run: pnpm run format:diff
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
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
+
11
+ ## 2.11.5
12
+
13
+ ### Patch Changes
14
+
15
+ - 61e5cf1: fix(core): fixed outdir to output to users directory now
16
+ - 6e88fcf: chore(core): moved some GitHub CI/CD to pnpm
17
+ - b29d4f9: chore(core): removed code that copies over files twice to users catalog.
18
+ - a283534: fix(docs): remove blank space from the version tag
19
+
3
20
  ## 2.11.4
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -29,7 +29,7 @@
29
29
  <h4>Features: Documentation generator for Event Driven Architectures, Markdown driven, Document Domains/Services/Messages/Schemas and more, Content versioning, Assign Owners, Schemas, OpenAPI, MDX Components and more...</h4>
30
30
 
31
31
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
32
- [![All Contributors](https://img.shields.io/badge/all_contributors-44-orange.svg?style=flat-square)](#contributors-)
32
+ [![All Contributors](https://img.shields.io/badge/all_contributors-45-orange.svg?style=flat-square)](#contributors-)
33
33
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
34
34
 
35
35
  [Read the Docs](https://eventcatalog.dev/) | [Edit the Docs](https://github.com/event-catalog/docs) | [View Demo](https://demo.eventcatalog.dev/docs)
@@ -237,6 +237,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
237
237
  <tr>
238
238
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/hpatoio"><img src="https://avatars.githubusercontent.com/u/249948?v=4?s=100" width="100px;" alt="Simone Fumagalli"/><br /><sub><b>Simone Fumagalli</b></sub></a><br /><a href="https://github.com/event-catalog/eventcatalog/commits?author=hpatoio" title="Documentation">📖</a></td>
239
239
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/d-o-h"><img src="https://avatars.githubusercontent.com/u/23699653?v=4?s=100" width="100px;" alt="d-o-h"/><br /><sub><b>d-o-h</b></sub></a><br /><a href="https://github.com/event-catalog/eventcatalog/commits?author=d-o-h" title="Code">💻</a></td>
240
+ <td align="center" valign="top" width="14.28%"><a href="https://pallares.io"><img src="https://avatars.githubusercontent.com/u/1077520?v=4?s=100" width="100px;" alt="Cristian Pallarés"/><br /><sub><b>Cristian Pallarés</b></sub></a><br /><a href="https://github.com/event-catalog/eventcatalog/commits?author=skyrpex" title="Code">💻</a></td>
240
241
  </tr>
241
242
  </tbody>
242
243
  </table>
package/astro.config.mjs CHANGED
@@ -10,7 +10,7 @@ import { join } from 'node:path';
10
10
  import config from './eventcatalog.config';
11
11
  import expressiveCode from 'astro-expressive-code';
12
12
 
13
- const coreDirectory = process.env.CATALOG_DIR || process.cwd();
13
+ const projectDirectory = process.env.PROJECT_DIR || process.cwd();
14
14
  const base = config.base || '/';
15
15
 
16
16
  // https://astro.build/config
@@ -18,7 +18,7 @@ export default defineConfig({
18
18
  base,
19
19
  server: { port: config.port || 3000 },
20
20
 
21
- outDir: config.outDir ? join(coreDirectory, config.outDir) : join(coreDirectory, 'dist'),
21
+ outDir: config.outDir ? join(projectDirectory, config.outDir) : join(projectDirectory, 'dist'),
22
22
 
23
23
  // https://docs.astro.build/en/reference/configuration-reference/#site
24
24
  site: config.homepageLink || 'https://eventcatalog.dev/',
@@ -40,16 +40,6 @@ var dir = process.cwd();
40
40
  var core = (0, import_node_path.join)(dir, ".eventcatalog-core");
41
41
  var eventCatalogDir = (0, import_node_path.join)(currentDir, "../../");
42
42
  program.name("eventcatalog").description("Documentation tool for event-driven architectures");
43
- var copyFile = (from, to) => {
44
- if (import_fs.default.existsSync(from)) {
45
- import_fs.default.cpSync(from, to);
46
- }
47
- };
48
- var copyFolder = (from, to) => {
49
- if (import_fs.default.existsSync(from)) {
50
- import_fs.default.cpSync(from, to, { recursive: true });
51
- }
52
- };
53
43
  var ensureDir = (dir2) => {
54
44
  if (!import_fs.default.existsSync(dir2)) {
55
45
  import_fs.default.mkdirSync(dir2);
@@ -76,9 +66,6 @@ program.command("dev").description("Run development server of EventCatalog").opt
76
66
  }
77
67
  if (options.forceRecreate) clearCore();
78
68
  copyCore();
79
- copyFolder((0, import_node_path.join)(dir, "public"), (0, import_node_path.join)(core, "public"));
80
- copyFile((0, import_node_path.join)(dir, "eventcatalog.config.js"), (0, import_node_path.join)(core, "eventcatalog.config.js"));
81
- copyFile((0, import_node_path.join)(dir, "eventcatalog.styles.css"), (0, import_node_path.join)(core, "eventcatalog.styles.css"));
82
69
  console.log("EventCatalog is starting at http://localhost:3000/docs");
83
70
  (0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run dev`, {
84
71
  cwd: core,
@@ -89,25 +76,17 @@ program.command("dev").description("Run development server of EventCatalog").opt
89
76
  program.command("build").description("Run build of EventCatalog").action((options) => {
90
77
  console.log("Building EventCatalog...");
91
78
  copyCore();
92
- copyFolder((0, import_node_path.join)(dir, "public"), (0, import_node_path.join)(core, "public"));
93
- copyFile((0, import_node_path.join)(dir, "eventcatalog.config.js"), (0, import_node_path.join)(core, "eventcatalog.config.js"));
94
- copyFile((0, import_node_path.join)(dir, "eventcatalog.styles.css"), (0, import_node_path.join)(core, "eventcatalog.styles.css"));
95
79
  (0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run build`, {
96
80
  cwd: core,
97
81
  stdio: "inherit"
98
82
  });
99
- copyFolder((0, import_node_path.join)(core, "dist"), (0, import_node_path.join)(dir, "dist"));
100
83
  });
101
84
  var previewCatalog = () => {
102
85
  copyCore();
103
- copyFolder((0, import_node_path.join)(dir, "public"), (0, import_node_path.join)(core, "public"));
104
- copyFile((0, import_node_path.join)(dir, "eventcatalog.config.js"), (0, import_node_path.join)(core, "eventcatalog.config.js"));
105
- copyFile((0, import_node_path.join)(dir, "eventcatalog.styles.css"), (0, import_node_path.join)(core, "eventcatalog.styles.css"));
106
86
  (0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run preview -- --root ${dir} --port 3000`, {
107
87
  cwd: core,
108
88
  stdio: "inherit"
109
89
  });
110
- copyFolder((0, import_node_path.join)(core, "dist"), (0, import_node_path.join)(dir, "dist"));
111
90
  };
112
91
  program.command("preview").description("Serves the contents of your eventcatalog build directory").action((options) => {
113
92
  console.log("Starting preview of your build...");
@@ -119,9 +98,6 @@ program.command("start").description("Serves the contents of your eventcatalog b
119
98
  });
120
99
  program.command("generate [siteDir]").description("Start the generator scripts.").action(() => {
121
100
  copyCore();
122
- copyFolder((0, import_node_path.join)(dir, "public"), (0, import_node_path.join)(core, "public"));
123
- copyFile((0, import_node_path.join)(dir, "eventcatalog.config.js"), (0, import_node_path.join)(core, "eventcatalog.config.js"));
124
- copyFile((0, import_node_path.join)(dir, "eventcatalog.styles.css"), (0, import_node_path.join)(core, "eventcatalog.styles.css"));
125
101
  (0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' npm run generate`, {
126
102
  cwd: core,
127
103
  stdio: "inherit"
@@ -13,16 +13,6 @@ var dir = process.cwd();
13
13
  var core = join(dir, ".eventcatalog-core");
14
14
  var eventCatalogDir = join(currentDir, "../../");
15
15
  program.name("eventcatalog").description("Documentation tool for event-driven architectures");
16
- var copyFile = (from, to) => {
17
- if (fs.existsSync(from)) {
18
- fs.cpSync(from, to);
19
- }
20
- };
21
- var copyFolder = (from, to) => {
22
- if (fs.existsSync(from)) {
23
- fs.cpSync(from, to, { recursive: true });
24
- }
25
- };
26
16
  var ensureDir = (dir2) => {
27
17
  if (!fs.existsSync(dir2)) {
28
18
  fs.mkdirSync(dir2);
@@ -49,9 +39,6 @@ program.command("dev").description("Run development server of EventCatalog").opt
49
39
  }
50
40
  if (options.forceRecreate) clearCore();
51
41
  copyCore();
52
- copyFolder(join(dir, "public"), join(core, "public"));
53
- copyFile(join(dir, "eventcatalog.config.js"), join(core, "eventcatalog.config.js"));
54
- copyFile(join(dir, "eventcatalog.styles.css"), join(core, "eventcatalog.styles.css"));
55
42
  console.log("EventCatalog is starting at http://localhost:3000/docs");
56
43
  execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run dev`, {
57
44
  cwd: core,
@@ -62,25 +49,17 @@ program.command("dev").description("Run development server of EventCatalog").opt
62
49
  program.command("build").description("Run build of EventCatalog").action((options) => {
63
50
  console.log("Building EventCatalog...");
64
51
  copyCore();
65
- copyFolder(join(dir, "public"), join(core, "public"));
66
- copyFile(join(dir, "eventcatalog.config.js"), join(core, "eventcatalog.config.js"));
67
- copyFile(join(dir, "eventcatalog.styles.css"), join(core, "eventcatalog.styles.css"));
68
52
  execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run build`, {
69
53
  cwd: core,
70
54
  stdio: "inherit"
71
55
  });
72
- copyFolder(join(core, "dist"), join(dir, "dist"));
73
56
  });
74
57
  var previewCatalog = () => {
75
58
  copyCore();
76
- copyFolder(join(dir, "public"), join(core, "public"));
77
- copyFile(join(dir, "eventcatalog.config.js"), join(core, "eventcatalog.config.js"));
78
- copyFile(join(dir, "eventcatalog.styles.css"), join(core, "eventcatalog.styles.css"));
79
59
  execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run preview -- --root ${dir} --port 3000`, {
80
60
  cwd: core,
81
61
  stdio: "inherit"
82
62
  });
83
- copyFolder(join(core, "dist"), join(dir, "dist"));
84
63
  };
85
64
  program.command("preview").description("Serves the contents of your eventcatalog build directory").action((options) => {
86
65
  console.log("Starting preview of your build...");
@@ -92,9 +71,6 @@ program.command("start").description("Serves the contents of your eventcatalog b
92
71
  });
93
72
  program.command("generate [siteDir]").description("Start the generator scripts.").action(() => {
94
73
  copyCore();
95
- copyFolder(join(dir, "public"), join(core, "public"));
96
- copyFile(join(dir, "eventcatalog.config.js"), join(core, "eventcatalog.config.js"));
97
- copyFile(join(dir, "eventcatalog.styles.css"), join(core, "eventcatalog.styles.css"));
98
74
  execSync(`cross-env PROJECT_DIR='${dir}' npm run generate`, {
99
75
  cwd: core,
100
76
  stdio: "inherit"
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.11.4",
9
+ "version": "2.11.6",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -2,7 +2,6 @@
2
2
 
3
3
  // This is used for CI on vercel. Must copy files before building.
4
4
  import { join } from 'node:path';
5
- import fs from 'fs';
6
5
  import { execSync } from 'node:child_process';
7
6
  const __dirname = import.meta.dirname;
8
7
 
@@ -12,10 +11,6 @@ const catalog = args[0] || 'default';
12
11
  const catalogDir = join(__dirname, '../');
13
12
  const projectDIR = join(__dirname, `../examples/${catalog}`);
14
13
 
15
- fs.copyFileSync(join(projectDIR, 'eventcatalog.config.js'), join(catalogDir, 'eventcatalog.config.js'));
16
-
17
- fs.copyFileSync(join(projectDIR, 'eventcatalog.styles.css'), join(catalogDir, 'eventcatalog.styles.css'));
18
-
19
14
  execSync(
20
15
  `cross-env NODE_ENV=CI PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run build && astro check --minimumSeverity error`,
21
16
  {
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { join } from 'node:path';
3
- import fs from 'fs';
4
3
  import { execSync } from 'node:child_process';
5
4
  const __dirname = import.meta.dirname;
6
5
 
@@ -10,9 +9,6 @@ const catalog = args[0] || 'default';
10
9
  const catalogDir = join(__dirname, '../');
11
10
  const projectDIR = join(__dirname, `../examples/${catalog}`);
12
11
 
13
- fs.copyFileSync(join(projectDIR, 'eventcatalog.config.js'), join(catalogDir, 'eventcatalog.config.js'));
14
- fs.copyFileSync(join(projectDIR, 'eventcatalog.styles.css'), join(catalogDir, 'eventcatalog.styles.css'));
15
-
16
12
  execSync(
17
13
  `cross-env NODE_ENV=development PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run scripts:hydrate-content && cross-env PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run dev:local`,
18
14
  {
@@ -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
- <div className="flex justify-between">
240
- {footerLabel && (
241
- <div className="py-2 w-full text-left ">
242
- <span className=" text-sm no-underline py-2 text-gray-300">{footerLabel}</span>
243
- </div>
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
- {href && (
247
- <div className="py-2 w-full text-right">
248
- <a className=" text-sm no-underline py-2 text-gray-800 hover:text-primary" href={href}>
249
- {hrefLabel} &rarr;
250
- </a>
251
- </div>
252
- )}
253
- </div>
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} &rarr;
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
- const sidebar = document.getElementById('sidebar');
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
@@ -173,8 +173,8 @@ const badges = [getBadge(), ...contentBadges, ...getSpecificationBadges()];
173
173
  class="underline hover:text-primary block pt-2"
174
174
  href={buildUrl(`/docs/${props.collection}/${props.data.id}/${props.data.latestVersion}`)}
175
175
  >
176
- The latest version of this {props.collection.slice(0, props.collection.length - 1)} is v
177
- {props.data.latestVersion} &rarr;
176
+ The latest version of this {props.collection.slice(0, props.collection.length - 1)} is
177
+ <span>v{props.data.latestVersion}</span> &rarr;
178
178
  </a>
179
179
  </p>
180
180
  </div>
@@ -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>