mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-23 02:06:45 +02:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('architecture diagram', () => {
|
describe('architecture diagram', () => {
|
||||||
it('should render a simple architecture diagram with groups', () => {
|
it('should render a simple architecture diagram with groups', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
group api(cloud)[API]
|
group api(cloud)[API]
|
||||||
|
|
||||||
service db(database)[Database] in api
|
service db(database)[Database] in api
|
||||||
@@ -17,11 +17,11 @@ describe('architecture diagram', () => {
|
|||||||
disk2 T--B db
|
disk2 T--B db
|
||||||
server T--B gateway
|
server T--B gateway
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render an architecture diagram with groups within groups', () => {
|
it('should render an architecture diagram with groups within groups', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
group api[API]
|
group api[API]
|
||||||
group public[Public API] in api
|
group public[Public API] in api
|
||||||
group private[Private API] in api
|
group private[Private API] in api
|
||||||
@@ -37,18 +37,18 @@ describe('architecture diagram', () => {
|
|||||||
serv2 L--R db
|
serv2 L--R db
|
||||||
serv1 L--R gateway
|
serv1 L--R gateway
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render an architecture diagram with the fallback icon', () => {
|
it('should render an architecture diagram with the fallback icon', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
service unknown(iconnamedoesntexist)[Unknown Icon]
|
service unknown(iconnamedoesntexist)[Unknown Icon]
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render an architecture diagram with split directioning', () => {
|
it('should render an architecture diagram with split directioning', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
service db(database)[Database]
|
service db(database)[Database]
|
||||||
service s3(disk)[Storage]
|
service s3(disk)[Storage]
|
||||||
service serv1(server)[Server 1]
|
service serv1(server)[Server 1]
|
||||||
@@ -60,11 +60,11 @@ describe('architecture diagram', () => {
|
|||||||
serv2 L--B s3
|
serv2 L--B s3
|
||||||
serv1 T--B disk
|
serv1 T--B disk
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render an architecture diagram with directional arrows', () => {
|
it('should render an architecture diagram with directional arrows', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
service servC(server)[Server 1]
|
service servC(server)[Server 1]
|
||||||
service servL(server)[Server 2]
|
service servL(server)[Server 2]
|
||||||
service servR(server)[Server 3]
|
service servR(server)[Server 3]
|
||||||
@@ -81,11 +81,11 @@ describe('architecture diagram', () => {
|
|||||||
servR (T--R) servT
|
servR (T--R) servT
|
||||||
servR (B--R) servB
|
servR (B--R) servB
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render an architecture diagram with group edges', () => {
|
it('should render an architecture diagram with group edges', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
group left_group(cloud)[Left]
|
group left_group(cloud)[Left]
|
||||||
group right_group(cloud)[Right]
|
group right_group(cloud)[Right]
|
||||||
group top_group(cloud)[Top]
|
group top_group(cloud)[Top]
|
||||||
@@ -103,11 +103,11 @@ describe('architecture diagram', () => {
|
|||||||
top_disk{group} (B--T) center_disk{group}
|
top_disk{group} (B--T) center_disk{group}
|
||||||
bottom_disk{group} (T--B) center_disk{group}
|
bottom_disk{group} (T--B) center_disk{group}
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render an architecture diagram with edge labels', () => {
|
it('should render an architecture diagram with edge labels', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
service servC(server)[Server 1]
|
service servC(server)[Server 1]
|
||||||
service servL(server)[Server 2]
|
service servL(server)[Server 2]
|
||||||
service servR(server)[Server 3]
|
service servR(server)[Server 3]
|
||||||
@@ -124,11 +124,11 @@ describe('architecture diagram', () => {
|
|||||||
servR T-[Label]-R servT
|
servR T-[Label]-R servT
|
||||||
servR B-[Label]-R servB
|
servR B-[Label]-R servB
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render an architecture diagram with simple junction edges', () => {
|
it('should render an architecture diagram with simple junction edges', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
service left_disk(disk)[Disk]
|
service left_disk(disk)[Disk]
|
||||||
service top_disk(disk)[Disk]
|
service top_disk(disk)[Disk]
|
||||||
service bottom_disk(disk)[Disk]
|
service bottom_disk(disk)[Disk]
|
||||||
@@ -144,11 +144,11 @@ describe('architecture diagram', () => {
|
|||||||
top_gateway B--T juncR
|
top_gateway B--T juncR
|
||||||
bottom_gateway T--B juncR
|
bottom_gateway T--B juncR
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render an architecture diagram with complex junction edges', () => {
|
it('should render an architecture diagram with complex junction edges', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`architecture
|
`architecture
|
||||||
group left
|
group left
|
||||||
group right
|
group right
|
||||||
service left_disk(disk)[Disk] in left
|
service left_disk(disk)[Disk] in left
|
||||||
@@ -169,6 +169,6 @@ describe('architecture diagram', () => {
|
|||||||
|
|
||||||
juncC{group} R--L) juncR{group}
|
juncC{group} R--L) juncR{group}
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,23 +1,22 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<title>Architecture Mermaid Quick Test Page</title>
|
||||||
|
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
||||||
|
<style>
|
||||||
|
div.mermaid {
|
||||||
|
/* font-family: 'trebuchet ms', verdana, arial; */
|
||||||
|
font-family: 'Courier New', Courier, monospace !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="utf-8" />
|
<h1>Architecture diagram demo</h1>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<h2>Simple diagram with groups</h2>
|
||||||
<title>Architecture Mermaid Quick Test Page</title>
|
<pre class="mermaid">
|
||||||
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
|
||||||
<style>
|
|
||||||
div.mermaid {
|
|
||||||
/* font-family: 'trebuchet ms', verdana, arial; */
|
|
||||||
font-family: 'Courier New', Courier, monospace !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1>Architecture diagram demo</h1>
|
|
||||||
<h2>Simple diagram with groups</h2>
|
|
||||||
<pre class="mermaid">
|
|
||||||
architecture
|
architecture
|
||||||
group api(cloud)[API]
|
group api(cloud)[API]
|
||||||
|
|
||||||
@@ -32,10 +31,10 @@
|
|||||||
disk2 T--B db
|
disk2 T--B db
|
||||||
server T--B gateway
|
server T--B gateway
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>Groups within groups</h2>
|
<h2>Groups within groups</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
group api[API]
|
group api[API]
|
||||||
group public[Public API] in api
|
group public[Public API] in api
|
||||||
@@ -56,17 +55,17 @@
|
|||||||
|
|
||||||
serv1 L--R gateway
|
serv1 L--R gateway
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>Default icon (?) from unknown icon name</h2>
|
<h2>Default icon (?) from unknown icon name</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
service unknown(iconnamedoesntexist)[Unknown Icon]
|
service unknown(iconnamedoesntexist)[Unknown Icon]
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>Split Direction</h2>
|
<h2>Split Direction</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
service db(database)[Database]
|
service db(database)[Database]
|
||||||
service s3(disk)[Storage]
|
service s3(disk)[Storage]
|
||||||
@@ -79,10 +78,10 @@
|
|||||||
serv2 L--B s3
|
serv2 L--B s3
|
||||||
serv1 T--B disk
|
serv1 T--B disk
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>Arrow Tests</h2>
|
<h2>Arrow Tests</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
service servC(server)[Server 1]
|
service servC(server)[Server 1]
|
||||||
service servL(server)[Server 2]
|
service servL(server)[Server 2]
|
||||||
@@ -100,7 +99,7 @@
|
|||||||
servR (T--R) servT
|
servR (T--R) servT
|
||||||
servR (B--R) servB
|
servR (B--R) servB
|
||||||
</pre>
|
</pre>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
service servC(server)[Server 1]
|
service servC(server)[Server 1]
|
||||||
service servL(server)[Server 2]
|
service servL(server)[Server 2]
|
||||||
@@ -118,10 +117,10 @@
|
|||||||
servT (R--T) servR
|
servT (R--T) servR
|
||||||
servB (R--B) servR
|
servB (R--B) servR
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>Group Edges</h2>
|
<h2>Group Edges</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
group left_group(cloud)[Left]
|
group left_group(cloud)[Left]
|
||||||
group right_group(cloud)[Right]
|
group right_group(cloud)[Right]
|
||||||
@@ -139,11 +138,12 @@
|
|||||||
right_disk{group} (L--R) center_disk{group}
|
right_disk{group} (L--R) center_disk{group}
|
||||||
top_disk{group} (B--T) center_disk{group}
|
top_disk{group} (B--T) center_disk{group}
|
||||||
bottom_disk{group} (T--B) center_disk{group}
|
bottom_disk{group} (T--B) center_disk{group}
|
||||||
</pre>
|
</pre
|
||||||
<hr />
|
>
|
||||||
|
<hr />
|
||||||
|
|
||||||
<h2>Edge Label Test</h2>
|
<h2>Edge Label Test</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
service servC(server)[Server 1]
|
service servC(server)[Server 1]
|
||||||
service servL(server)[Server 2]
|
service servL(server)[Server 2]
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
servR T-[Label]-R servT
|
servR T-[Label]-R servT
|
||||||
servR B-[Label]-R servB
|
servR B-[Label]-R servB
|
||||||
</pre>
|
</pre>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
service servC(server)[Server 1]
|
service servC(server)[Server 1]
|
||||||
service servL(server)[Server 2]
|
service servL(server)[Server 2]
|
||||||
@@ -180,9 +180,9 @@
|
|||||||
servR B-[Label that is Long]-R servB
|
servR B-[Label that is Long]-R servB
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<h2>Junction Demo</h2>
|
<h2>Junction Demo</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
service left_disk(disk)[Disk]
|
service left_disk(disk)[Disk]
|
||||||
service top_disk(disk)[Disk]
|
service top_disk(disk)[Disk]
|
||||||
@@ -199,10 +199,10 @@
|
|||||||
top_gateway B--T juncR
|
top_gateway B--T juncR
|
||||||
bottom_gateway T--B juncR
|
bottom_gateway T--B juncR
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>Junction Demo Groups</h2>
|
<h2>Junction Demo Groups</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
group left
|
group left
|
||||||
group right
|
group right
|
||||||
@@ -224,10 +224,10 @@
|
|||||||
|
|
||||||
juncC{group} R--L) juncR{group}
|
juncC{group} R--L) juncR{group}
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2>AWS Icon Demo</h2>
|
<h2>AWS Icon Demo</h2>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
architecture
|
architecture
|
||||||
service s3(s3)[Cloud Store]
|
service s3(s3)[Cloud Store]
|
||||||
service ec2(ec2)[Server]
|
service ec2(ec2)[Server]
|
||||||
@@ -235,76 +235,76 @@
|
|||||||
|
|
||||||
s3 L--R ec2
|
s3 L--R ec2
|
||||||
s3 T--B wave
|
s3 T--B wave
|
||||||
</pre>
|
</pre
|
||||||
|
>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
|
|
||||||
const ALLOWED_TAGS = [
|
const ALLOWED_TAGS = [
|
||||||
'a',
|
'a',
|
||||||
'b',
|
'b',
|
||||||
'blockquote',
|
'blockquote',
|
||||||
'br',
|
'br',
|
||||||
'dd',
|
'dd',
|
||||||
'div',
|
'div',
|
||||||
'dl',
|
'dl',
|
||||||
'dt',
|
'dt',
|
||||||
'em',
|
'em',
|
||||||
'foreignObject',
|
'foreignObject',
|
||||||
'h1',
|
'h1',
|
||||||
'h2',
|
'h2',
|
||||||
'h3',
|
'h3',
|
||||||
'h4',
|
'h4',
|
||||||
'h5',
|
'h5',
|
||||||
'h6',
|
'h6',
|
||||||
'h7',
|
'h7',
|
||||||
'h8',
|
'h8',
|
||||||
'hr',
|
'hr',
|
||||||
'i',
|
'i',
|
||||||
'li',
|
'li',
|
||||||
'ul',
|
'ul',
|
||||||
'ol',
|
'ol',
|
||||||
'p',
|
'p',
|
||||||
'pre',
|
'pre',
|
||||||
'span',
|
'span',
|
||||||
'strike',
|
'strike',
|
||||||
'strong',
|
'strong',
|
||||||
'table',
|
'table',
|
||||||
'tbody',
|
'tbody',
|
||||||
'td',
|
'td',
|
||||||
'tfoot',
|
'tfoot',
|
||||||
'th',
|
'th',
|
||||||
'thead',
|
'thead',
|
||||||
'tr',
|
'tr',
|
||||||
];
|
];
|
||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'base',
|
theme: 'base',
|
||||||
startOnLoad: true,
|
startOnLoad: true,
|
||||||
logLevel: 0,
|
logLevel: 0,
|
||||||
flowchart: {
|
flowchart: {
|
||||||
|
useMaxWidth: false,
|
||||||
|
htmlLabels: true,
|
||||||
|
},
|
||||||
|
gantt: {
|
||||||
|
useMaxWidth: false,
|
||||||
|
},
|
||||||
|
architecture: {
|
||||||
|
iconSize: 80,
|
||||||
|
},
|
||||||
useMaxWidth: false,
|
useMaxWidth: false,
|
||||||
htmlLabels: true,
|
iconLibraries: ['aws:full'],
|
||||||
},
|
});
|
||||||
gantt: {
|
function callback() {
|
||||||
useMaxWidth: false,
|
alert('It worked');
|
||||||
},
|
}
|
||||||
architecture: {
|
mermaid.parseError = function (err, hash) {
|
||||||
iconSize: 80,
|
console.error('In parse error:');
|
||||||
},
|
console.error(err);
|
||||||
useMaxWidth: false,
|
};
|
||||||
iconLibraries: ['aws:full']
|
</script>
|
||||||
});
|
</body>
|
||||||
function callback() {
|
</html>
|
||||||
alert('It worked');
|
|
||||||
}
|
|
||||||
mermaid.parseError = function (err, hash) {
|
|
||||||
console.error('In parse error:');
|
|
||||||
console.error(err);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
@@ -140,4 +140,4 @@
|
|||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -102,7 +102,8 @@ function addGroups(groups: ArchitectureGroup[], cy: cytoscape.Core) {
|
|||||||
|
|
||||||
function addEdges(edges: ArchitectureEdge[], cy: cytoscape.Core) {
|
function addEdges(edges: ArchitectureEdge[], cy: cytoscape.Core) {
|
||||||
edges.forEach((parsedEdge) => {
|
edges.forEach((parsedEdge) => {
|
||||||
const { lhsId, rhsId, lhsInto, lhsGroup, rhsInto, lhsDir, rhsDir, rhsGroup, title } = parsedEdge;
|
const { lhsId, rhsId, lhsInto, lhsGroup, rhsInto, lhsDir, rhsDir, rhsGroup, title } =
|
||||||
|
parsedEdge;
|
||||||
const edgeType = isArchitectureDirectionXY(parsedEdge.lhsDir, parsedEdge.rhsDir)
|
const edgeType = isArchitectureDirectionXY(parsedEdge.lhsDir, parsedEdge.rhsDir)
|
||||||
? 'segments'
|
? 'segments'
|
||||||
: 'straight';
|
: 'straight';
|
||||||
|
Reference in New Issue
Block a user