Skip to content

Commit c316619

Browse files
committed
feat(config-ui): integrate external code
1 parent 714a5ff commit c316619

File tree

6 files changed

+619
-25
lines changed

6 files changed

+619
-25
lines changed

config-ui/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export * from './src/components';
2+
export * from './src/hooks';
3+
export * from './src/app/hook';
4+
export * from './src/utils/request';
5+
export * from './src/utils/operator';
6+
export * from './src/routes/error';
7+
export * from './src/routes/layout';
8+
export * from './src/routes/pipeline';
9+
export * from './src/routes/api-keys';
10+
export * from './src/pages/connection';
11+
export * from './src/pages/project';
12+
export * from './src/pages/blueprint';
13+
export * from './src/features/connections';

config-ui/package.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
"private": true,
44
"version": "0.0.0",
55
"packageManager": "[email protected]",
6+
"type": "module",
7+
"files": [
8+
"dist"
9+
],
10+
"main": "./dist/config-ui.umd.cjs",
11+
"module": "./dist/config-ui.js",
12+
"exports": {
13+
".": {
14+
"import": "./dist/config-ui.js",
15+
"require": "./dist/config-ui.cjs"
16+
},
17+
"./dist/style.css": {
18+
"import": "./dist/style.css",
19+
"require": "./dist/style.css"
20+
}
21+
},
622
"scripts": {
723
"start": "vite",
824
"build": "vite build",
@@ -65,6 +81,7 @@
6581
"lint-staged": "^13.1.0",
6682
"prettier": "^2.7.1",
6783
"typescript": "^4.9.4",
68-
"vite": "^4.2.3"
84+
"vite": "^4.2.3",
85+
"vite-plugin-dts": "^3.7.0"
6986
}
7087
}

config-ui/src/routes/layout/layout.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,6 @@ export const Layout = () => {
146146
<img src={APIIcon} alt="api" />
147147
<span>API</span>
148148
</ExternalLink>
149-
<Navbar.Divider />
150-
<a
151-
href="https://github.com/apache/incubator-devlake"
152-
rel="noreferrer"
153-
target="_blank"
154-
className="navIconLink"
155-
>
156-
<img src={GitHubIcon} alt="github" />
157-
<span>GitHub</span>
158-
</a>
159-
<Navbar.Divider />
160-
<a
161-
href="https://join.slack.com/t/devlake-io/shared_invite/zt-26ulybksw-IDrJYuqY1FrdjlMMJhs53Q"
162-
rel="noreferrer"
163-
target="_blank"
164-
>
165-
<img src={SlackIcon} alt="slack" />
166-
<span>Slack</span>
167-
</a>
168149
</Navbar.Group>
169150
</S.Header>
170151
<S.Inner>

config-ui/src/utils/request.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ instance.interceptors.response.use(
4343
window.location.replace('/db-migrate');
4444
}
4545

46+
if (status === 401) {
47+
window.location.reload();
48+
}
49+
4650
return Promise.reject(error);
4751
},
4852
);

config-ui/vite.config.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
import path from 'path';
2020
import { defineConfig } from 'vite';
2121
import react from '@vitejs/plugin-react';
22+
import dts from 'vite-plugin-dts';
2223

2324
// https://vitejs.dev/config/
2425
export default defineConfig({
25-
plugins: [react()],
26+
plugins: [react(), dts()],
2627

2728
envPrefix: 'DEVLAKE_',
2829

@@ -42,4 +43,21 @@ export default defineConfig({
4243
'@': path.join(__dirname, './src'),
4344
},
4445
},
46+
47+
build: {
48+
lib: {
49+
entry: path.resolve(__dirname, 'index.ts'),
50+
name: 'config-ui',
51+
fileName: 'config-ui',
52+
},
53+
rollupOptions: {
54+
external: ['react', 'react-dom', 'react-router-dom'],
55+
output: {
56+
globals: {
57+
react: 'React',
58+
'react-dom': 'ReactDOM',
59+
},
60+
},
61+
},
62+
},
4563
});

0 commit comments

Comments
 (0)