Skip to content

Commit cc11043

Browse files
chore: bump version
1 parent f90b310 commit cc11043

File tree

8 files changed

+53
-28
lines changed

8 files changed

+53
-28
lines changed

dist/assets/ViewPage-42bf1b46.js renamed to dist/assets/ViewPage-c63ca148.js

Lines changed: 15 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/ViewPage-42bf1b46.js.map renamed to dist/assets/ViewPage-c63ca148.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/index-c1366d55.js renamed to dist/assets/index-312da009.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/index-312da009.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/index-c1366d55.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
display: none;
1111
}
1212
</style>
13-
<script type="module" crossorigin src="/assets/index-c1366d55.js"></script>
13+
<script type="module" crossorigin src="/assets/index-312da009.js"></script>
1414
</head>
1515
<body>
1616
<div id="app"></div>

src/coms/DBML/DbEditor.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ import '@/assets/css/simple-line-icons.css';
1414
import './libs/css/styles.css';
1515
import './libs/ace-config';
1616
17+
const erdDefault = `
18+
Table user {
19+
id integer [primary key]
20+
username varchar
21+
role_id varchar
22+
created_at timestamp
23+
updated_at timestamp
24+
}
25+
`
1726
const erdStore = useErdStore();
1827
const state = reactive({
1928
flowFlag: Date.now(),
@@ -37,13 +46,15 @@ const createVueFlowData = (dbmlRaw: String) => {
3746
try {
3847
return parseDBMLToJSON.parse(dbmlRaw);
3948
} catch (e) {
40-
console.error('Can`t parse dbml', e);
49+
alert('Can`t parse dbml.');
50+
erdStore.saveDbmlRaw(erdDefault)
51+
return parseDBMLToJSON.parse(erdDefault)
4152
}
4253
};
4354
4455
const initFlowData = () => {
45-
state.dbmlContent = erdStore.dbmlRaw
4656
const db = createVueFlowData(erdStore.dbmlRaw);
57+
state.dbmlContent = erdStore.dbmlRaw
4758
const { nodes, edges } = convertor.convertDbmlStructToVueFlowObj(db);
4859
state.nodes = nodes;
4960
state.edges = edges;

src/coms/DBML/libs/convertor.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,14 @@ class ConvertorToVueFlow {
5353
this.replaceTableNameFromAlias(db);
5454
const nodes = [];
5555
const edges = [];
56-
for (const table of db.tables) {
57-
nodes.push(this.convertTable(table));
58-
}
59-
for (let i = 0; i < db.refs.length; i++) {
60-
edges.push(this.convertRefs(db.refs[i], i));
56+
try {
57+
for (const table of db.tables) {
58+
nodes.push(this.convertTable(table));
59+
}
60+
for (let i = 0; i < db.refs.length; i++) {
61+
edges.push(this.convertRefs(db.refs[i], i));
62+
}
63+
} catch (e) {
6164
}
6265
return { nodes, edges };
6366
}
@@ -79,15 +82,18 @@ class ConvertorToVueFlow {
7982
}
8083

8184
private replaceTableNameFromAlias(db: RawDatabase): void {
82-
db.refs.map((ref) => {
83-
ref.endpoints.map((endpoint: Endpoint) => {
84-
const name = endpoint.tableName;
85-
const alias = (db as any).aliases.find((item: any) => item.kind === 'table' && item.name === name);
86-
if (alias) {
87-
endpoint.tableName = alias.value.tableName;
88-
}
85+
try {
86+
db.refs.map((ref) => {
87+
ref.endpoints.map((endpoint: Endpoint) => {
88+
const name = endpoint.tableName;
89+
const alias = (db as any).aliases.find((item: any) => item.kind === 'table' && item.name === name);
90+
if (alias) {
91+
endpoint.tableName = alias.value.tableName;
92+
}
93+
});
8994
});
90-
});
95+
} catch (e) {
96+
}
9197
}
9298
}
9399

0 commit comments

Comments
 (0)