Skip to content

Commit

Permalink
feat(config-ui): integrate external code
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsweet committed Jan 4, 2024
1 parent 714a5ff commit c316619
Show file tree
Hide file tree
Showing 6 changed files with 619 additions and 25 deletions.
13 changes: 13 additions & 0 deletions config-ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export * from './src/components';
export * from './src/hooks';
export * from './src/app/hook';
export * from './src/utils/request';
export * from './src/utils/operator';
export * from './src/routes/error';
export * from './src/routes/layout';
export * from './src/routes/pipeline';
export * from './src/routes/api-keys';
export * from './src/pages/connection';
export * from './src/pages/project';
export * from './src/pages/blueprint';
export * from './src/features/connections';
19 changes: 18 additions & 1 deletion config-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
"private": true,
"version": "0.0.0",
"packageManager": "[email protected]",
"type": "module",
"files": [
"dist"
],
"main": "./dist/config-ui.umd.cjs",
"module": "./dist/config-ui.js",
"exports": {
".": {
"import": "./dist/config-ui.js",
"require": "./dist/config-ui.cjs"
},
"./dist/style.css": {
"import": "./dist/style.css",
"require": "./dist/style.css"
}
},
"scripts": {
"start": "vite",
"build": "vite build",
Expand Down Expand Up @@ -65,6 +81,7 @@
"lint-staged": "^13.1.0",
"prettier": "^2.7.1",
"typescript": "^4.9.4",
"vite": "^4.2.3"
"vite": "^4.2.3",
"vite-plugin-dts": "^3.7.0"
}
}
19 changes: 0 additions & 19 deletions config-ui/src/routes/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,25 +146,6 @@ export const Layout = () => {
<img src={APIIcon} alt="api" />
<span>API</span>
</ExternalLink>
<Navbar.Divider />
<a
href="https://github.com/apache/incubator-devlake"
rel="noreferrer"
target="_blank"
className="navIconLink"
>
<img src={GitHubIcon} alt="github" />
<span>GitHub</span>
</a>
<Navbar.Divider />
<a
href="https://join.slack.com/t/devlake-io/shared_invite/zt-26ulybksw-IDrJYuqY1FrdjlMMJhs53Q"
rel="noreferrer"
target="_blank"
>
<img src={SlackIcon} alt="slack" />
<span>Slack</span>
</a>
</Navbar.Group>
</S.Header>
<S.Inner>
Expand Down
4 changes: 4 additions & 0 deletions config-ui/src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ instance.interceptors.response.use(
window.location.replace('/db-migrate');
}

if (status === 401) {
window.location.reload();
}

return Promise.reject(error);
},
);
Expand Down
20 changes: 19 additions & 1 deletion config-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
import path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import dts from 'vite-plugin-dts';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [react(), dts()],

envPrefix: 'DEVLAKE_',

Expand All @@ -42,4 +43,21 @@ export default defineConfig({
'@': path.join(__dirname, './src'),
},
},

build: {
lib: {
entry: path.resolve(__dirname, 'index.ts'),
name: 'config-ui',
fileName: 'config-ui',
},
rollupOptions: {
external: ['react', 'react-dom', 'react-router-dom'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
},
},
},
},
});
Loading

0 comments on commit c316619

Please sign in to comment.