@eventcatalog/core 0.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/CHANGELOG.md +1 -0
- package/README.md +11 -0
- package/bin/eventcatalog.js +125 -0
- package/components/BreadCrumbs.tsx +50 -0
- package/components/ContentView.tsx +127 -0
- package/components/Footer.tsx +38 -0
- package/components/Grids/EventGrid.tsx +89 -0
- package/components/Grids/ServiceGrid.tsx +70 -0
- package/components/Header.tsx +59 -0
- package/components/Mdx/Admonition.tsx +33 -0
- package/components/Mdx/Examples.tsx +77 -0
- package/components/Mermaid/index.tsx +47 -0
- package/components/NotFound/index.tsx +44 -0
- package/components/Sidebars/EventSidebar.tsx +202 -0
- package/components/Sidebars/ServiceSidebar.tsx +198 -0
- package/components/SyntaxHighlighter.tsx +34 -0
- package/hooks/EventCatalog.tsx +35 -0
- package/lib/__tests__/assets/events/AddedItemToCart/index.md +19 -0
- package/lib/__tests__/assets/events/EmailSent/index.md +15 -0
- package/lib/__tests__/assets/events/EventWithSchemaAndExamples/examples/Basic.cs +31 -0
- package/lib/__tests__/assets/events/EventWithSchemaAndExamples/examples/Basic.js +1 -0
- package/lib/__tests__/assets/events/EventWithSchemaAndExamples/index.md +8 -0
- package/lib/__tests__/assets/events/EventWithSchemaAndExamples/schema.json +4 -0
- package/lib/__tests__/assets/events/EventWithVersions/index.md +10 -0
- package/lib/__tests__/assets/events/EventWithVersions/versioned/0.0.1/index.md +10 -0
- package/lib/__tests__/assets/services/Email Platform/index.md +17 -0
- package/lib/__tests__/events.spec.ts +294 -0
- package/lib/__tests__/file-reader.spec.ts +57 -0
- package/lib/__tests__/graphs.spec.ts +62 -0
- package/lib/__tests__/services.spec.ts +144 -0
- package/lib/events.ts +221 -0
- package/lib/file-reader.ts +52 -0
- package/lib/graphs.ts +33 -0
- package/lib/services.ts +72 -0
- package/next-env.d.ts +5 -0
- package/next.config.js +3 -0
- package/package.json +52 -0
- package/pages/_app.tsx +49 -0
- package/pages/api/event/[name]/download.js +25 -0
- package/pages/events/[name]/logs.tsx +170 -0
- package/pages/events/[name]/v/[version].tsx +19 -0
- package/pages/events/[name].tsx +139 -0
- package/pages/events.tsx +227 -0
- package/pages/index.tsx +47 -0
- package/pages/overview.tsx +80 -0
- package/pages/services/[name].tsx +102 -0
- package/pages/services.tsx +123 -0
- package/pages/users/[id].tsx +83 -0
- package/postcss.config.js +6 -0
- package/public/favicon.ico +0 -0
- package/public/logo-random.svg +114 -0
- package/public/logo.svg +44 -0
- package/public/opengraph.png +0 -0
- package/scripts/__tests__/assets/eventcatalog.config.js +33 -0
- package/scripts/__tests__/generate.spec.ts +39 -0
- package/scripts/generate.js +28 -0
- package/styles/Home.module.css +116 -0
- package/styles/globals.css +48 -0
- package/tailwind.config.js +16 -0
- package/tsconfig.json +38 -0
- package/types/index.ts +7 -0
- package/utils/random-bg.ts +13 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @eventcatalog/core
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## EventCatalog (core)
|
|
2
|
+
|
|
3
|
+
This is the main EventCatalog application.
|
|
4
|
+
|
|
5
|
+
To make changes or run this application core code, you will need to fork the EventCatalog repo and run the following command:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm run start:catalog
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This will run the catalog using the catalog information found in `examples/basic`.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const cli = require('commander');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
const fs = require('fs-extra');
|
|
7
|
+
|
|
8
|
+
// this is the directory the users project is in
|
|
9
|
+
const projectDIR = process.cwd();
|
|
10
|
+
const coreDirectory = path.join(__dirname, '../');
|
|
11
|
+
|
|
12
|
+
// this is the directory where the eventcatalog core code is
|
|
13
|
+
const eventCatalogLibDir = path.join(projectDIR, '.eventcatalog-core');
|
|
14
|
+
|
|
15
|
+
const copyCoreApplicationCodeIntoUsersProjectDir = () => {
|
|
16
|
+
const excludeFilesForCopy = ['.next', 'eventcatalog.config.js', 'bin', 'README.md'];
|
|
17
|
+
const exclusions = excludeFilesForCopy.map((file) => path.join(eventCatalogLibDir, file));
|
|
18
|
+
|
|
19
|
+
fs.ensureDirSync(eventCatalogLibDir);
|
|
20
|
+
fs.copySync(coreDirectory, eventCatalogLibDir);
|
|
21
|
+
|
|
22
|
+
// remove any files we don't care about
|
|
23
|
+
exclusions.map((path) => {
|
|
24
|
+
try {
|
|
25
|
+
fs.lstatSync(path).isDirectory()
|
|
26
|
+
? fs.rmSync(path, { recursive: true, force: true })
|
|
27
|
+
: fs.unlinkSync(path);
|
|
28
|
+
} catch (error) {}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
fs.copyFileSync(
|
|
32
|
+
path.join(projectDIR, 'eventcatalog.config.js'),
|
|
33
|
+
path.join(eventCatalogLibDir, 'eventcatalog.config.js')
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
cli
|
|
38
|
+
.command('start [siteDir]')
|
|
39
|
+
.description('Start the development server.')
|
|
40
|
+
.action(() => {
|
|
41
|
+
execSync(`PROJECT_DIR=${projectDIR} npm run start`, {
|
|
42
|
+
cwd: eventCatalogLibDir,
|
|
43
|
+
stdio: 'inherit',
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
cli
|
|
48
|
+
.command('build [siteDir]')
|
|
49
|
+
.description('Start the development server.')
|
|
50
|
+
.action(() => {
|
|
51
|
+
if (!fs.existsSync(eventCatalogLibDir)) {
|
|
52
|
+
copyCoreApplicationCodeIntoUsersProjectDir();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// copy any public assets over (from users to the lib itself)
|
|
56
|
+
fs.copySync(path.join(projectDIR, 'public'), path.join(eventCatalogLibDir, 'public'));
|
|
57
|
+
|
|
58
|
+
// build using nextjs
|
|
59
|
+
execSync(`PROJECT_DIR=${projectDIR} npm run build`, {
|
|
60
|
+
cwd: eventCatalogLibDir,
|
|
61
|
+
stdio: 'inherit',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// everything is built make sure its back in the users project directory
|
|
65
|
+
fs.copySync(path.join(eventCatalogLibDir, '.next'), path.join(projectDIR, '.next'));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
cli
|
|
69
|
+
.command('dev [siteDir]')
|
|
70
|
+
.description('Start the development server.')
|
|
71
|
+
.action(() => {
|
|
72
|
+
if (!fs.existsSync(eventCatalogLibDir)) {
|
|
73
|
+
copyCoreApplicationCodeIntoUsersProjectDir();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// copy any public assets over (from users to the lib itself)
|
|
77
|
+
fs.copySync(path.join(projectDIR, 'public'), path.join(eventCatalogLibDir, 'public'));
|
|
78
|
+
|
|
79
|
+
fs.copyFileSync(
|
|
80
|
+
path.join(projectDIR, 'eventcatalog.config.js'),
|
|
81
|
+
path.join(eventCatalogLibDir, 'eventcatalog.config.js')
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
execSync(`PROJECT_DIR=${projectDIR} npm run dev`, {
|
|
85
|
+
cwd: eventCatalogLibDir,
|
|
86
|
+
stdio: 'inherit',
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
cli
|
|
91
|
+
|
|
92
|
+
.command('generate [siteDir]')
|
|
93
|
+
.description('Start the generator scripts.')
|
|
94
|
+
.action(() => {
|
|
95
|
+
if (!fs.existsSync(eventCatalogLibDir)) {
|
|
96
|
+
// get the application ready
|
|
97
|
+
copyCoreApplicationCodeIntoUsersProjectDir();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
fs.copyFileSync(
|
|
101
|
+
path.join(projectDIR, 'eventcatalog.config.js'),
|
|
102
|
+
path.join(eventCatalogLibDir, 'eventcatalog.config.js')
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
execSync(`PROJECT_DIR=${projectDIR} npm run generate`, {
|
|
106
|
+
cwd: eventCatalogLibDir,
|
|
107
|
+
stdio: 'inherit',
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
async function run() {
|
|
112
|
+
cli.parse(process.argv);
|
|
113
|
+
|
|
114
|
+
if (!process.argv.slice(2).length) {
|
|
115
|
+
cli.outputHelp();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
run();
|
|
120
|
+
|
|
121
|
+
process.on('unhandledRejection', (err) => {
|
|
122
|
+
console.error(err);
|
|
123
|
+
// console.error(chalk.red(err.stack));
|
|
124
|
+
process.exit(1);
|
|
125
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HomeIcon } from '@heroicons/react/solid';
|
|
3
|
+
import Link from 'next/link';
|
|
4
|
+
|
|
5
|
+
interface BreadCrumbsProps {
|
|
6
|
+
pages: { name: string; href: string; current: boolean }[];
|
|
7
|
+
homePath?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function BreadCrumbs({ pages, homePath = '/events' }: BreadCrumbsProps) {
|
|
11
|
+
return (
|
|
12
|
+
<nav className="flex" aria-label="Breadcrumb">
|
|
13
|
+
<ol className="flex items-center space-x-4">
|
|
14
|
+
<li>
|
|
15
|
+
<Link href={homePath}>
|
|
16
|
+
<a className="text-gray-400 hover:text-gray-500">
|
|
17
|
+
<HomeIcon className="flex-shrink-0 h-5 w-5" aria-hidden="true" />
|
|
18
|
+
<span className="sr-only">Home</span>
|
|
19
|
+
</a>
|
|
20
|
+
</Link>
|
|
21
|
+
</li>
|
|
22
|
+
{pages.map((page) => (
|
|
23
|
+
<li key={page.name}>
|
|
24
|
+
<div className="flex items-center">
|
|
25
|
+
<svg
|
|
26
|
+
className="flex-shrink-0 h-5 w-5 text-gray-300"
|
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
+
fill="currentColor"
|
|
29
|
+
viewBox="0 0 20 20"
|
|
30
|
+
aria-hidden="true"
|
|
31
|
+
>
|
|
32
|
+
<path d="M5.555 17.776l8-16 .894.448-8 16-.894-.448z" />
|
|
33
|
+
</svg>
|
|
34
|
+
<Link href={page.href}>
|
|
35
|
+
<a
|
|
36
|
+
className="ml-4 text-sm font-medium text-gray-500 hover:text-gray-700"
|
|
37
|
+
aria-current={page.current ? 'page' : undefined}
|
|
38
|
+
>
|
|
39
|
+
{page.name}
|
|
40
|
+
</a>
|
|
41
|
+
</Link>
|
|
42
|
+
</div>
|
|
43
|
+
</li>
|
|
44
|
+
))}
|
|
45
|
+
</ol>
|
|
46
|
+
</nav>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default BreadCrumbs;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { PencilIcon } from '@heroicons/react/solid';
|
|
2
|
+
import Link from 'next/link';
|
|
3
|
+
import Admonition from '@/components/Mdx/Admonition';
|
|
4
|
+
|
|
5
|
+
interface ContentViewProps {
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
tags?: { href?: string; label: string }[];
|
|
9
|
+
lastModifiedDate: string;
|
|
10
|
+
children: JSX.Element;
|
|
11
|
+
sidebar: JSX.Element;
|
|
12
|
+
breadCrumbs: JSX.Element;
|
|
13
|
+
editUrl?: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
isOldVersion?: boolean;
|
|
16
|
+
latestVersionUrl?: string;
|
|
17
|
+
draft?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function ContentView({
|
|
21
|
+
title,
|
|
22
|
+
subtitle,
|
|
23
|
+
tags = [],
|
|
24
|
+
lastModifiedDate,
|
|
25
|
+
children,
|
|
26
|
+
sidebar: SideBar,
|
|
27
|
+
breadCrumbs: BreadCrumbs,
|
|
28
|
+
editUrl,
|
|
29
|
+
isOldVersion,
|
|
30
|
+
latestVersionUrl,
|
|
31
|
+
version,
|
|
32
|
+
draft: isDraft = false,
|
|
33
|
+
}: ContentViewProps) {
|
|
34
|
+
return (
|
|
35
|
+
<div className="flex relative">
|
|
36
|
+
<div className=" flex flex-col w-0 flex-1 ">
|
|
37
|
+
<main className="flex-1 ">
|
|
38
|
+
<div className="py-8 xl:py-10">
|
|
39
|
+
<div className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 xl:max-w-7xl xl:grid xl:grid-cols-4">
|
|
40
|
+
<div className="xl:col-span-3 xl:pr-8 xl:border-r xl:border-gray-200 flex-col justify-between flex">
|
|
41
|
+
<div>
|
|
42
|
+
{BreadCrumbs && (
|
|
43
|
+
<div className="mb-5 border-b border-gray-100 pb-4">{BreadCrumbs}</div>
|
|
44
|
+
)}
|
|
45
|
+
<div>
|
|
46
|
+
<div>
|
|
47
|
+
<div className="xl:border-b pb-4 flex justify-between ">
|
|
48
|
+
<div className="space-y-2 w-full">
|
|
49
|
+
<h1 className="text-3xl font-bold text-gray-900 relative">
|
|
50
|
+
{title}
|
|
51
|
+
<div className="-top-1 relative inline-block ml-2">
|
|
52
|
+
{tags.map((tag, index) => (
|
|
53
|
+
<span
|
|
54
|
+
key={`${tag}-${index}`}
|
|
55
|
+
className="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium -top-0.5 relative bg-yellow-100 text-yellow-800"
|
|
56
|
+
>
|
|
57
|
+
{tag.label}
|
|
58
|
+
</span>
|
|
59
|
+
))}
|
|
60
|
+
{isDraft && (
|
|
61
|
+
<span className="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium -top-0.5 relative bg-gray-500 text-gray-100">
|
|
62
|
+
Draft
|
|
63
|
+
</span>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
</h1>
|
|
67
|
+
<div className="text-gray-600 mb-10 text py-2">{subtitle}</div>
|
|
68
|
+
{isOldVersion && version && (
|
|
69
|
+
<Admonition className="mt-0 pt-0 w-full" type="warning">
|
|
70
|
+
<>
|
|
71
|
+
You are currently viewing an old version of this event ({version}).
|
|
72
|
+
<Link href={latestVersionUrl}>
|
|
73
|
+
<a className="block text-sm pl-7 mt-2 text-blue-500 underline">
|
|
74
|
+
Read latest version →
|
|
75
|
+
</a>
|
|
76
|
+
</Link>
|
|
77
|
+
</>
|
|
78
|
+
</Admonition>
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
81
|
+
<div className="mt-4 flex space-x-3 md:mt-0">
|
|
82
|
+
<button
|
|
83
|
+
type="button"
|
|
84
|
+
className="hidden md:inline-flex h-10 justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-900"
|
|
85
|
+
>
|
|
86
|
+
<PencilIcon
|
|
87
|
+
className="-ml-1 mr-2 h-5 w-5 text-gray-400"
|
|
88
|
+
aria-hidden="true"
|
|
89
|
+
/>
|
|
90
|
+
<span>Edit</span>
|
|
91
|
+
</button>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<div className="py-3 xl:pt-6 xl:pb-0">
|
|
95
|
+
{isDraft && (
|
|
96
|
+
<Admonition className="mt-0 pt-0" type="warning">
|
|
97
|
+
<>
|
|
98
|
+
This event is currently in <span className="underline">draft</span>{' '}
|
|
99
|
+
mode.
|
|
100
|
+
</>
|
|
101
|
+
</Admonition>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
<div className="prose max-w-none">{children}</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
<div className="flex justify-between mt-10">
|
|
110
|
+
<a href={editUrl} target="_blank" className="flex text-gray-400" rel="noreferrer">
|
|
111
|
+
<PencilIcon
|
|
112
|
+
className="top-1 mr-2 relative h-4 w-4 text-gray-400"
|
|
113
|
+
aria-hidden="true"
|
|
114
|
+
/>
|
|
115
|
+
<span>Edit this page</span>
|
|
116
|
+
</a>
|
|
117
|
+
<span className="italic text-xs mt-2">Last updated on {lastModifiedDate}</span>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div className="md:min-h-screen">{SideBar}</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</main>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useConfig } from '@/hooks/EventCatalog';
|
|
3
|
+
|
|
4
|
+
export default function Footer() {
|
|
5
|
+
const { organizationName, editUrl } = useConfig();
|
|
6
|
+
const year = new Date().getFullYear();
|
|
7
|
+
|
|
8
|
+
const navigation = {
|
|
9
|
+
main: [
|
|
10
|
+
{ name: 'Events', href: '/events' },
|
|
11
|
+
{ name: 'Services', href: '/services' },
|
|
12
|
+
{ name: '3D Node Graph', href: '/overview' },
|
|
13
|
+
{ name: 'GitHub', href: editUrl },
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<footer className="bg-gray-800">
|
|
19
|
+
<div className="max-w-7xl mx-auto py-12 px-4 overflow-hidden sm:px-6 lg:px-8">
|
|
20
|
+
<nav className="-mx-5 -my-2 flex flex-wrap justify-center" aria-label="Footer">
|
|
21
|
+
{navigation.main.map((item) => (
|
|
22
|
+
<div key={item.name} className="px-5 py-2">
|
|
23
|
+
<a href={item.href} className="text-base text-gray-500 hover:text-gray-900">
|
|
24
|
+
{item.name}
|
|
25
|
+
</a>
|
|
26
|
+
</div>
|
|
27
|
+
))}
|
|
28
|
+
</nav>
|
|
29
|
+
<p className="mt-8 text-center text-base text-gray-400">
|
|
30
|
+
Copyright © {year} {organizationName}. Built with{' '}
|
|
31
|
+
<a className="underline" href="https://eventcatalog.dev" target="_blank" rel="noreferrer">
|
|
32
|
+
EventCatalog.
|
|
33
|
+
</a>
|
|
34
|
+
</p>
|
|
35
|
+
</div>
|
|
36
|
+
</footer>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Link from 'next/link';
|
|
3
|
+
|
|
4
|
+
import { CubeIcon } from '@heroicons/react/outline';
|
|
5
|
+
|
|
6
|
+
import { Event } from '@eventcatalog/types';
|
|
7
|
+
import getBackgroundColor from '@/utils/random-bg';
|
|
8
|
+
|
|
9
|
+
import Mermaid from '@/components/Mermaid';
|
|
10
|
+
|
|
11
|
+
function classNames(...classes) {
|
|
12
|
+
return classes.filter(Boolean).join(' ');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface EventGridProps {
|
|
16
|
+
events: Event[];
|
|
17
|
+
showMermaidDiagrams?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function EventGrid({ events = [], showMermaidDiagrams = false }: EventGridProps) {
|
|
21
|
+
return (
|
|
22
|
+
<ul className="mt-3 grid grid-cols-1 gap-5 md:grid-cols-2">
|
|
23
|
+
{events.map((event) => {
|
|
24
|
+
const { draft: isDraft } = event;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<li key={event.name} className="flex">
|
|
28
|
+
<Link href={`/events/${event.name}`}>
|
|
29
|
+
<a className="flex shadow-sm rounded-md w-full">
|
|
30
|
+
<div
|
|
31
|
+
style={{
|
|
32
|
+
background: getBackgroundColor(event.name),
|
|
33
|
+
}}
|
|
34
|
+
className={classNames(
|
|
35
|
+
'bg-red-500',
|
|
36
|
+
'flex-shrink-0 flex items-center justify-center w-4 text-white text-sm font-medium rounded-l-md'
|
|
37
|
+
)}
|
|
38
|
+
/>
|
|
39
|
+
<div className="w-full border-t border-r border-b border-gray-200 bg-white rounded-r-md ">
|
|
40
|
+
<div className="p-4 text-sm space-y-2 flex flex-col justify-between h-full">
|
|
41
|
+
<div className="text-gray-900 font-bold hover:text-gray-600">
|
|
42
|
+
{event.name}
|
|
43
|
+
<span className="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
|
|
44
|
+
v{event.version}
|
|
45
|
+
</span>
|
|
46
|
+
{isDraft && (
|
|
47
|
+
<span className="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-500 text-gray-100">
|
|
48
|
+
Draft
|
|
49
|
+
</span>
|
|
50
|
+
)}
|
|
51
|
+
<div className="text-gray-500 text-xs font-normal mt-2 ">{event.summary}</div>
|
|
52
|
+
</div>
|
|
53
|
+
{showMermaidDiagrams && (
|
|
54
|
+
<div className="h-full items-center flex">
|
|
55
|
+
<Mermaid
|
|
56
|
+
source="event"
|
|
57
|
+
data={event}
|
|
58
|
+
rootNodeColor={getBackgroundColor(event.name)}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
<div className="flex space-x-4 text-xs pt-2 relative bottom-0 left-0">
|
|
63
|
+
<div className=" font-medium text-gray-500">
|
|
64
|
+
<CubeIcon
|
|
65
|
+
className="h-4 w-4 text-green-400 inline-block mr-2"
|
|
66
|
+
aria-hidden="true"
|
|
67
|
+
/>
|
|
68
|
+
Producers ({event.producers.length})
|
|
69
|
+
</div>
|
|
70
|
+
<div className=" font-medium text-gray-500">
|
|
71
|
+
<CubeIcon
|
|
72
|
+
className="h-4 w-4 text-indigo-400 inline-block mr-2"
|
|
73
|
+
aria-hidden="true"
|
|
74
|
+
/>
|
|
75
|
+
Subscribers ({event.consumers.length})
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</a>
|
|
81
|
+
</Link>
|
|
82
|
+
</li>
|
|
83
|
+
);
|
|
84
|
+
})}
|
|
85
|
+
</ul>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default EventGrid;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Link from 'next/link';
|
|
3
|
+
|
|
4
|
+
import { CubeIcon } from '@heroicons/react/outline';
|
|
5
|
+
|
|
6
|
+
import { Service } from '@eventcatalog/types';
|
|
7
|
+
|
|
8
|
+
import getBackgroundColor from '@/utils/random-bg';
|
|
9
|
+
|
|
10
|
+
interface ServiceGridProps {
|
|
11
|
+
services: Service[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function ServiceGrid({ services = [] }: ServiceGridProps) {
|
|
15
|
+
return (
|
|
16
|
+
<ul className="mt-3 grid grid-cols-1 gap-5 md:grid-cols-2">
|
|
17
|
+
{services.map((service) => {
|
|
18
|
+
const { draft: isDraft } = service;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<li key={service.name} className="flex">
|
|
22
|
+
<Link href={`/services/${service.name}`}>
|
|
23
|
+
<a className="flex shadow-sm w-full">
|
|
24
|
+
<div
|
|
25
|
+
style={{
|
|
26
|
+
background: getBackgroundColor(service.name),
|
|
27
|
+
}}
|
|
28
|
+
className="w-4 rounded-l-md"
|
|
29
|
+
/>
|
|
30
|
+
<div className="w-full border-t border-r border-b border-gray-200 bg-white rounded-r-md ">
|
|
31
|
+
<div className="p-4 text-sm space-y-2 flex flex-col justify-between h-full">
|
|
32
|
+
<div>
|
|
33
|
+
<span className="text-gray-900 font-bold">{service.name}</span>
|
|
34
|
+
{isDraft && (
|
|
35
|
+
<span className="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-500 text-gray-100">
|
|
36
|
+
Draft
|
|
37
|
+
</span>
|
|
38
|
+
)}
|
|
39
|
+
<div className="text-gray-500 text-xs font-normal mt-2 line-clamp-3">
|
|
40
|
+
{service.summary}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<div className="flex space-x-4 text-xs pt-2 relative bottom-0 left-0">
|
|
44
|
+
<div className=" font-medium text-gray-500">
|
|
45
|
+
<CubeIcon
|
|
46
|
+
className="h-4 w-4 text-green-400 inline-block mr-2"
|
|
47
|
+
aria-hidden="true"
|
|
48
|
+
/>
|
|
49
|
+
Subscribe Events ({service.subscribes.length})
|
|
50
|
+
</div>
|
|
51
|
+
<div className=" font-medium text-gray-500">
|
|
52
|
+
<CubeIcon
|
|
53
|
+
className="h-4 w-4 text-indigo-400 inline-block mr-2"
|
|
54
|
+
aria-hidden="true"
|
|
55
|
+
/>
|
|
56
|
+
Publish Events ({service.publishes.length})
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</a>
|
|
62
|
+
</Link>
|
|
63
|
+
</li>
|
|
64
|
+
);
|
|
65
|
+
})}
|
|
66
|
+
</ul>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default ServiceGrid;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
import { useRouter } from 'next/router';
|
|
3
|
+
import { useConfig } from '@/hooks/EventCatalog';
|
|
4
|
+
|
|
5
|
+
const navigation = [
|
|
6
|
+
{ name: 'Events', href: '/events' },
|
|
7
|
+
{ name: 'Services', href: '/services' },
|
|
8
|
+
{ name: '3D Node Graph', href: '/overview' },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
function classNames(...classes) {
|
|
12
|
+
return classes.filter(Boolean).join(' ');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function Example() {
|
|
16
|
+
const { title } = useConfig();
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="bg-gray-800">
|
|
21
|
+
<div className="max-w-7xl mx-auto ">
|
|
22
|
+
<div className="relative flex items-center justify-between h-16">
|
|
23
|
+
<div className="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start">
|
|
24
|
+
<div className="flex-shrink-0 flex items-center text-white font-bold">
|
|
25
|
+
<Link href="/events">
|
|
26
|
+
<a className="flex items-center">
|
|
27
|
+
<img alt="logo" className="text-white w-8 inline-block mr-3" src="/logo.svg" />
|
|
28
|
+
<span className="text-xl">{title}</span>
|
|
29
|
+
</a>
|
|
30
|
+
</Link>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div className="hidden sm:block sm:ml-6">
|
|
34
|
+
<div className="flex space-x-4">
|
|
35
|
+
{navigation.map((item) => {
|
|
36
|
+
const current = router.pathname.includes(item.href);
|
|
37
|
+
return (
|
|
38
|
+
<Link key={item.name} href={item.href}>
|
|
39
|
+
<a
|
|
40
|
+
className={classNames(
|
|
41
|
+
current
|
|
42
|
+
? 'bg-gray-900 text-white'
|
|
43
|
+
: 'text-gray-300 hover:bg-gray-700 hover:text-white',
|
|
44
|
+
'px-3 py-2 rounded-md text-sm font-medium'
|
|
45
|
+
)}
|
|
46
|
+
aria-current={current ? 'page' : undefined}
|
|
47
|
+
>
|
|
48
|
+
{item.name}
|
|
49
|
+
</a>
|
|
50
|
+
</Link>
|
|
51
|
+
);
|
|
52
|
+
})}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { InformationCircleIcon, ExclamationIcon } from '@heroicons/react/solid';
|
|
2
|
+
|
|
3
|
+
const getConfigurationByType = (type: string) => {
|
|
4
|
+
switch (type) {
|
|
5
|
+
case 'alert':
|
|
6
|
+
return { color: 'red', icon: ExclamationIcon };
|
|
7
|
+
case 'warning':
|
|
8
|
+
return { color: 'yellow', icon: ExclamationIcon };
|
|
9
|
+
default:
|
|
10
|
+
return { color: 'indigo', icon: InformationCircleIcon };
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface AdmonitionProps {
|
|
15
|
+
children: JSX.Element;
|
|
16
|
+
type?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function Admonition({ children, type, className }: AdmonitionProps) {
|
|
21
|
+
const { color, icon: Icon } = getConfigurationByType(type);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={`bg-${color}-50 border-l-4 border-${color}-400 my-4 ${className}`}>
|
|
25
|
+
<div className="flex">
|
|
26
|
+
<div className="ml-3 py-4">
|
|
27
|
+
<Icon className={`inline-block mr-2 h-5 w-5 text-${color}-400`} aria-hidden="true" />
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|